fansunited-data-layer 0.0.4 → 0.0.6

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 (58) hide show
  1. package/README.md +0 -68
  2. package/dist/api/sportal365-sports/constants.d.ts +1 -1
  3. package/dist/api/sportal365-sports/constants.d.ts.map +1 -1
  4. package/dist/api/sportal365-sports/football/index.d.ts +2 -0
  5. package/dist/api/sportal365-sports/football/index.d.ts.map +1 -1
  6. package/dist/api/sportal365-sports/football/standings/http.d.ts +13 -0
  7. package/dist/api/sportal365-sports/football/standings/http.d.ts.map +1 -0
  8. package/dist/api/sportal365-sports/football/standings/index.d.ts +30 -0
  9. package/dist/api/sportal365-sports/football/standings/index.d.ts.map +1 -0
  10. package/dist/api/sportal365-sports/football/standings/standing.transformer.d.ts +14 -0
  11. package/dist/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -0
  12. package/dist/api/sportal365-sports/football/standings/standing.types.d.ts +128 -0
  13. package/dist/api/sportal365-sports/football/standings/standing.types.d.ts.map +1 -0
  14. package/dist/api/sportal365-sports/index.d.ts +2 -2
  15. package/dist/api/sportal365-sports/index.d.ts.map +1 -1
  16. package/dist/fansunited-data-layer.js +585 -1256
  17. package/dist/fansunited-data-layer.umd.cjs +2 -2
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/providers/competition.context.d.ts +8 -0
  21. package/dist/providers/competition.context.d.ts.map +1 -0
  22. package/dist/providers/competition.provider.d.ts +3 -0
  23. package/dist/providers/competition.provider.d.ts.map +1 -0
  24. package/dist/providers/competition.types.d.ts +68 -0
  25. package/dist/providers/competition.types.d.ts.map +1 -0
  26. package/dist/providers/index.d.ts +7 -0
  27. package/dist/providers/index.d.ts.map +1 -0
  28. package/dist/types/canonical/index.d.ts +1 -1
  29. package/dist/types/canonical/index.d.ts.map +1 -1
  30. package/dist/types/canonical/standing.types.d.ts +35 -8
  31. package/dist/types/canonical/standing.types.d.ts.map +1 -1
  32. package/dist/types/index.d.ts +2 -1
  33. package/dist/types/index.d.ts.map +1 -1
  34. package/package.json +1 -3
  35. package/dist/use-cases/index.d.ts +0 -13
  36. package/dist/use-cases/index.d.ts.map +0 -1
  37. package/dist/use-cases/mappers/index.d.ts +0 -7
  38. package/dist/use-cases/mappers/index.d.ts.map +0 -1
  39. package/dist/use-cases/mappers/matchMappers.d.ts +0 -45
  40. package/dist/use-cases/mappers/matchMappers.d.ts.map +0 -1
  41. package/dist/use-cases/match/index.d.ts +0 -14
  42. package/dist/use-cases/match/index.d.ts.map +0 -1
  43. package/dist/use-cases/match/prepareMatchList.server.d.ts +0 -53
  44. package/dist/use-cases/match/prepareMatchList.server.d.ts.map +0 -1
  45. package/dist/use-cases/match/prepareMatchScore.server.d.ts +0 -33
  46. package/dist/use-cases/match/prepareMatchScore.server.d.ts.map +0 -1
  47. package/dist/use-cases/match/usePrepareMatchList.d.ts +0 -20
  48. package/dist/use-cases/match/usePrepareMatchList.d.ts.map +0 -1
  49. package/dist/use-cases/match/usePrepareMatchScore.d.ts +0 -31
  50. package/dist/use-cases/match/usePrepareMatchScore.d.ts.map +0 -1
  51. package/dist/use-cases/team/index.d.ts +0 -10
  52. package/dist/use-cases/team/index.d.ts.map +0 -1
  53. package/dist/use-cases/team/prepareTeamMatches.server.d.ts +0 -56
  54. package/dist/use-cases/team/prepareTeamMatches.server.d.ts.map +0 -1
  55. package/dist/use-cases/team/usePrepareTeamMatches.d.ts +0 -26
  56. package/dist/use-cases/team/usePrepareTeamMatches.d.ts.map +0 -1
  57. package/dist/use-cases/types.d.ts +0 -8
  58. package/dist/use-cases/types.d.ts.map +0 -1
@@ -1,57 +1,56 @@
1
- import * as T from "react";
2
- import xe from "react";
3
- let V = null;
4
- function Kt(e) {
5
- V = e;
1
+ import ge, { createContext as _e, useContext as ye, useState as ne, useEffect as Q, useCallback as y, useMemo as he } from "react";
2
+ let z = null;
3
+ function et(e) {
4
+ z = e;
6
5
  }
7
- function O() {
8
- if (!V)
6
+ function T() {
7
+ if (!z)
9
8
  throw new Error(
10
9
  "Data layer config not initialized. Call setConfig() in your root layout."
11
10
  );
12
- return V;
11
+ return z;
13
12
  }
14
- function zt() {
15
- return V !== null;
13
+ function tt() {
14
+ return z !== null;
16
15
  }
17
- function je(e) {
16
+ function Ee(e) {
18
17
  const t = e.replace(/\/$/, "");
19
- function r() {
20
- const { sportal365Sports: i } = O();
21
- if (!i)
18
+ function n() {
19
+ const { sportal365Sports: a } = T();
20
+ if (!a)
22
21
  throw new Error("Sportal365 Sports API configuration is missing");
23
- const u = `${i.username}:${i.password}`;
24
- return `Basic ${btoa(u)}`;
22
+ const s = `${a.username}:${a.password}`;
23
+ return `Basic ${btoa(s)}`;
25
24
  }
26
- function s(i) {
27
- return `${t}${i}`;
25
+ function r(a) {
26
+ return `${t}${a}`;
28
27
  }
29
28
  return {
30
- async get(i) {
31
- const { sportal365Sports: u } = O();
32
- if (!u)
29
+ async get(a) {
30
+ const { sportal365Sports: s } = T();
31
+ if (!s)
33
32
  throw new Error("Sportal365 Sports API configuration is missing");
34
- const a = new URL(s(i.path));
35
- if (i.params)
36
- for (const [l, h] of Object.entries(i.params))
37
- h !== void 0 && (Array.isArray(h) ? h.length > 0 && a.searchParams.set(l, h.join(",")) : a.searchParams.set(l, h));
38
- const o = await fetch(a.toString(), {
33
+ const m = new URL(r(a.path));
34
+ if (a.params)
35
+ for (const [v, k] of Object.entries(a.params))
36
+ k !== void 0 && (Array.isArray(k) ? k.length > 0 && m.searchParams.set(v, k.join(",")) : m.searchParams.set(v, k));
37
+ const p = await fetch(m.toString(), {
39
38
  method: "GET",
40
39
  headers: {
41
- Authorization: r(),
40
+ Authorization: n(),
42
41
  "Content-Type": "application/json",
43
- "X-Project-Id": u.projectId
42
+ "X-Project": s.projectId
44
43
  },
45
- signal: u.timeout ? AbortSignal.timeout(u.timeout) : void 0
44
+ signal: s.timeout ? AbortSignal.timeout(s.timeout) : void 0
46
45
  });
47
- if (!o.ok)
48
- throw new Error(`Sportal365 API error: ${o.status} ${o.statusText}`);
49
- return o.json();
46
+ if (!p.ok)
47
+ throw new Error(`Sportal365 API error: ${p.status} ${p.statusText}`);
48
+ return p.json();
50
49
  }
51
50
  };
52
51
  }
53
- const Ue = "https://football.api.sportal365.com", k = je(Ue);
54
- function fe(e) {
52
+ const Te = "https://football.api.sportal365.com", ve = "https://standing.api.sportal365.com", O = Ee(Te);
53
+ function re(e) {
55
54
  if (e)
56
55
  return {
57
56
  id: e.id,
@@ -65,7 +64,7 @@ function fe(e) {
65
64
  } : void 0
66
65
  };
67
66
  }
68
- const Ye = {
67
+ const Se = {
69
68
  // Scoring events
70
69
  GOAL: "GOAL",
71
70
  PENALTY_GOAL: "PENALTY_GOAL",
@@ -90,20 +89,20 @@ const Ye = {
90
89
  PENALTY_MISSED: "PENALTY_MISSED",
91
90
  PENALTY_SAVED: "PENALTY_SAVED"
92
91
  };
93
- function w(e) {
94
- const t = Ye[e.type_code];
92
+ function J(e) {
93
+ const t = Se[e.type_code];
95
94
  return t ? {
96
95
  id: e.id,
97
96
  type: t,
98
97
  competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
99
98
  minute: e.minute,
100
99
  injuryMinute: e.injury_minute,
101
- primaryPlayer: fe(e.primary_player),
102
- secondaryPlayer: fe(e.secondary_player),
100
+ primaryPlayer: re(e.primary_player),
101
+ secondaryPlayer: re(e.secondary_player),
103
102
  score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
104
103
  } : (console.warn(`Unknown event type: ${e.type_code}`), null);
105
104
  }
106
- function $e(e) {
105
+ function ke(e) {
107
106
  return {
108
107
  code: {
109
108
  FINISHED: "finished",
@@ -120,7 +119,7 @@ function $e(e) {
120
119
  type: e.type
121
120
  };
122
121
  }
123
- function he(e) {
122
+ function ae(e) {
124
123
  return {
125
124
  id: e.id,
126
125
  name: e.name,
@@ -138,7 +137,7 @@ function he(e) {
138
137
  metadata: e.shirt_color ? { shirtColor: e.shirt_color } : void 0
139
138
  };
140
139
  }
141
- function qe(e) {
140
+ function Ae(e) {
142
141
  return {
143
142
  kickoffTime: new Date(e.kickoff_time),
144
143
  currentMinute: e.minute?.regular_time,
@@ -150,12 +149,12 @@ function qe(e) {
150
149
  extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
151
150
  };
152
151
  }
153
- function Be(e) {
152
+ function Oe(e) {
154
153
  if (!e) return;
155
- const t = (s) => s ? { competitorOne: String(s.home), competitorTwo: String(s.away) } : void 0, r = e.total ?? e.regular_time;
154
+ const t = (r) => r ? { competitorOne: String(r.home), competitorTwo: String(r.away) } : void 0, n = e.total ?? e.regular_time;
156
155
  return {
157
- competitorOne: r?.home != null ? String(r.home) : null,
158
- competitorTwo: r?.away != null ? String(r.away) : null,
156
+ competitorOne: n?.home != null ? String(n.home) : null,
157
+ competitorTwo: n?.away != null ? String(n.away) : null,
159
158
  breakdown: {
160
159
  total: t(e.total),
161
160
  halfTime: t(e.half_time),
@@ -166,7 +165,7 @@ function Be(e) {
166
165
  }
167
166
  };
168
167
  }
169
- function Qe(e) {
168
+ function be(e) {
170
169
  if (e)
171
170
  return {
172
171
  id: e.id,
@@ -175,7 +174,7 @@ function Qe(e) {
175
174
  assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0
176
175
  };
177
176
  }
178
- function He(e) {
177
+ function Re(e) {
179
178
  if (e?.length)
180
179
  return e.map((t) => ({
181
180
  id: t.id,
@@ -185,9 +184,9 @@ function He(e) {
185
184
  gender: t.gender
186
185
  }));
187
186
  }
188
- function We(e) {
187
+ function Ce(e) {
189
188
  if (!e.season?.tournament) return;
190
- const { tournament: t, ...r } = e.season;
189
+ const { tournament: t, ...n } = e.season;
191
190
  return {
192
191
  id: t.id,
193
192
  name: t.name,
@@ -201,9 +200,9 @@ function We(e) {
201
200
  flag: t.country.assets?.flag?.url
202
201
  } : void 0,
203
202
  season: {
204
- id: r.id,
205
- name: r.name,
206
- status: r.status
203
+ id: n.id,
204
+ name: n.name,
205
+ status: n.status
207
206
  },
208
207
  stage: e.stage ? {
209
208
  id: e.stage.id,
@@ -213,7 +212,7 @@ function We(e) {
213
212
  assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0
214
213
  };
215
214
  }
216
- function Ve(e) {
215
+ function Ne(e) {
217
216
  if (!e.winner?.match?.id) return;
218
217
  const t = {
219
218
  "Regular Time": "REGULAR_TIME",
@@ -226,15 +225,15 @@ function Ve(e) {
226
225
  aggregate: !!e.winner.aggregate
227
226
  };
228
227
  }
229
- function Ne(e) {
228
+ function me(e) {
230
229
  return {
231
230
  id: e.id,
232
231
  slug: e.slug,
233
- status: $e(e.status),
234
- timing: qe(e),
235
- competitorOne: he(e.home_team),
236
- competitorTwo: he(e.away_team),
237
- competition: We(e),
232
+ status: ke(e.status),
233
+ timing: Ae(e),
234
+ competitorOne: ae(e.home_team),
235
+ competitorTwo: ae(e.away_team),
236
+ competition: Ce(e),
238
237
  round: e.round ? {
239
238
  id: e.round.id ?? e.round.key,
240
239
  key: e.round.key,
@@ -245,18 +244,18 @@ function Ne(e) {
245
244
  id: e.group.id,
246
245
  name: e.group.name
247
246
  } : void 0,
248
- venue: Qe(e.venue),
249
- officials: He(e.referees),
247
+ venue: be(e.venue),
248
+ officials: Re(e.referees),
250
249
  spectators: e.spectators ?? void 0,
251
- score: Be(e.score),
252
- mainEvents: e.main_events?.map(w).filter((t) => t !== null),
253
- penaltyShootoutEvents: e.penalty_shootout_events?.map(w).filter((t) => t !== null),
254
- winner: Ve(e),
250
+ score: Oe(e.score),
251
+ mainEvents: e.main_events?.map(J).filter((t) => t !== null),
252
+ penaltyShootoutEvents: e.penalty_shootout_events?.map(J).filter((t) => t !== null),
253
+ winner: Ne(e),
255
254
  coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
256
255
  lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status
257
256
  };
258
257
  }
259
- function we(e) {
258
+ function Le(e) {
260
259
  const t = e.player;
261
260
  return {
262
261
  id: t.id,
@@ -276,14 +275,14 @@ function we(e) {
276
275
  height: t.profile.height,
277
276
  weight: t.profile.weight
278
277
  } : void 0,
279
- events: e.events?.map(w).filter((r) => r !== null)
278
+ events: e.events?.map(J).filter((n) => n !== null)
280
279
  };
281
280
  }
282
- function me(e) {
283
- const t = [], r = [];
284
- for (const s of e.players) {
285
- const i = we(s);
286
- s.type.category === "start" ? t.push(i) : s.type.category === "sub" && r.push(i);
281
+ function se(e) {
282
+ const t = [], n = [];
283
+ for (const r of e.players) {
284
+ const a = Le(r);
285
+ r.type.category === "start" ? t.push(a) : r.type.category === "sub" && n.push(a);
287
286
  }
288
287
  return {
289
288
  competitorId: e.team_id,
@@ -300,52 +299,52 @@ function me(e) {
300
299
  birthdate: e.coach.birthdate
301
300
  } : void 0,
302
301
  starters: t,
303
- substitutes: r
302
+ substitutes: n
304
303
  };
305
304
  }
306
- function Ge(e) {
305
+ function Pe(e) {
307
306
  return {
308
307
  matchId: e.match_id,
309
308
  confirmed: e.status === "CONFIRMED",
310
- competitorOne: me(e.home_team),
311
- competitorTwo: me(e.away_team)
309
+ competitorOne: se(e.home_team),
310
+ competitorTwo: se(e.away_team)
312
311
  };
313
312
  }
314
- function v(e, t, r, s) {
315
- return t == null ? null : { key: e, value: String(t), label: r, unit: s };
316
- }
317
- function pe(e, t) {
318
- const r = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), s = [
319
- v("possession", t.possession, "Possession", "%"),
320
- v("shots_total", r, "Shots"),
321
- v("shots_on_target", t.shots_on, "Shots on Target"),
322
- v("shots_off_target", t.shots_off, "Shots off Target"),
323
- v("shots_blocked", t.shots_blocked, "Shots Blocked"),
324
- v("corners", t.corners, "Corner Kicks"),
325
- v("goal_kicks", t.goal_kicks, "Goal Kicks"),
326
- v("throw_ins", t.throw_in, "Throw Ins"),
327
- v("offsides", t.offside, "Offsides"),
328
- v("fouls", t.fouls_committed, "Fouls"),
329
- v("yellow_cards", t.yellow_cards, "Yellow Cards"),
330
- v("passes", t.pass, "Passes"),
331
- v("crosses", t.crosses, "Crosses")
313
+ function h(e, t, n, r) {
314
+ return t == null ? null : { key: e, value: String(t), label: n, unit: r };
315
+ }
316
+ function ie(e, t) {
317
+ const n = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), r = [
318
+ h("possession", t.possession, "Possession", "%"),
319
+ h("shots_total", n, "Shots"),
320
+ h("shots_on_target", t.shots_on, "Shots on Target"),
321
+ h("shots_off_target", t.shots_off, "Shots off Target"),
322
+ h("shots_blocked", t.shots_blocked, "Shots Blocked"),
323
+ h("corners", t.corners, "Corner Kicks"),
324
+ h("goal_kicks", t.goal_kicks, "Goal Kicks"),
325
+ h("throw_ins", t.throw_in, "Throw Ins"),
326
+ h("offsides", t.offside, "Offsides"),
327
+ h("fouls", t.fouls_committed, "Fouls"),
328
+ h("yellow_cards", t.yellow_cards, "Yellow Cards"),
329
+ h("passes", t.pass, "Passes"),
330
+ h("crosses", t.crosses, "Crosses")
332
331
  ];
333
332
  return {
334
333
  competitorId: e,
335
- statistics: s.filter((i) => i !== null)
334
+ statistics: r.filter((a) => a !== null)
336
335
  };
337
336
  }
338
- function Ke(e) {
339
- const t = e.find((s) => s.home_team), r = e.find((s) => !s.home_team);
340
- if (!t || !r)
337
+ function Ie(e) {
338
+ const t = e.find((r) => r.home_team), n = e.find((r) => !r.home_team);
339
+ if (!t || !n)
341
340
  throw new Error("Missing competitor statistics");
342
341
  return {
343
- competitorOne: pe(String(t.team.id), t.statistics),
344
- competitorTwo: pe(String(r.team.id), r.statistics)
342
+ competitorOne: ie(String(t.team.id), t.statistics),
343
+ competitorTwo: ie(String(n.team.id), n.statistics)
345
344
  };
346
345
  }
347
- function ze(e) {
348
- const t = e.urls?.find((r) => r.app_type === "desktop")?.url;
346
+ function De(e) {
347
+ const t = e.urls?.find((n) => n.app_type === "desktop")?.url;
349
348
  return {
350
349
  id: e.id,
351
350
  name: e.name,
@@ -357,7 +356,7 @@ function ze(e) {
357
356
  url: t
358
357
  };
359
358
  }
360
- function Je(e) {
359
+ function xe(e) {
361
360
  return {
362
361
  type: {
363
362
  id: e.type.id,
@@ -369,10 +368,10 @@ function Je(e) {
369
368
  type: e.scope.type,
370
369
  name: e.scope.name
371
370
  },
372
- selections: e.selections.map(ze)
371
+ selections: e.selections.map(De)
373
372
  };
374
373
  }
375
- function Xe(e) {
374
+ function Me(e) {
376
375
  return {
377
376
  operator: {
378
377
  id: e.bookmaker.id,
@@ -385,26 +384,26 @@ function Xe(e) {
385
384
  } : void 0
386
385
  },
387
386
  type: e.type,
388
- markets: e.markets.map(Je)
387
+ markets: e.markets.map(xe)
389
388
  };
390
389
  }
391
- function Ze(e, t) {
390
+ function Fe(e, t) {
392
391
  return {
393
392
  matchId: e,
394
- operators: t.map(Xe)
393
+ operators: t.map(Me)
395
394
  };
396
395
  }
397
- function ge(e) {
396
+ function ce(e) {
398
397
  if (e == null || e === "")
399
398
  return;
400
399
  const t = typeof e == "number" ? e : parseInt(e, 10);
401
400
  return isNaN(t) ? void 0 : t;
402
401
  }
403
- function et(e) {
402
+ function je(e) {
404
403
  return {
405
404
  externalId: e.external_id,
406
- minute: ge(e.elapsed),
407
- addedTime: ge(e.elapsed_plus),
405
+ minute: ce(e.elapsed),
406
+ addedTime: ce(e.elapsed_plus),
408
407
  text: e.auto_text,
409
408
  details: e.details,
410
409
  meta: {
@@ -416,11 +415,11 @@ function et(e) {
416
415
  }
417
416
  };
418
417
  }
419
- async function tt(e, t = {}) {
420
- const { sportal365Sports: r } = O(), s = await k.get({
418
+ async function ot(e, t = {}) {
419
+ const { sportal365Sports: n } = T(), r = await O.get({
421
420
  path: `/v2/matches/${e}`,
422
421
  params: {
423
- language_code: t.languageCode ?? r?.languageCode ?? "en",
422
+ language_code: t.languageCode ?? n?.languageCode ?? "en",
424
423
  odd_client: t.oddClient,
425
424
  odd_type: t.oddType,
426
425
  scope_type: t.scopeType,
@@ -430,32 +429,32 @@ async function tt(e, t = {}) {
430
429
  optional_data: t.optionalData
431
430
  }
432
431
  });
433
- return Ne(s);
432
+ return me(r);
434
433
  }
435
- async function Jt(e, t = {}) {
436
- const { sportal365Sports: r } = O();
437
- return (await k.get({
434
+ async function nt(e, t = {}) {
435
+ const { sportal365Sports: n } = T();
436
+ return (await O.get({
438
437
  path: `/v2/matches/${e}/events`,
439
438
  params: {
440
- language_code: t.languageCode ?? r?.languageCode ?? "en"
439
+ language_code: t.languageCode ?? n?.languageCode ?? "en"
441
440
  }
442
- })).events.map(w).filter((i) => i !== null);
441
+ })).events.map(J).filter((a) => a !== null);
443
442
  }
444
- async function Xt(e, t = {}) {
445
- const { sportal365Sports: r } = O(), s = await k.get({
443
+ async function rt(e, t = {}) {
444
+ const { sportal365Sports: n } = T(), r = await O.get({
446
445
  path: `/v2/matches/${e}/lineups`,
447
446
  params: {
448
- language_code: t.languageCode ?? r?.languageCode ?? "en"
447
+ language_code: t.languageCode ?? n?.languageCode ?? "en"
449
448
  }
450
449
  });
451
- return Ge(s);
450
+ return Pe(r);
452
451
  }
453
- async function Zt(e, t = {}) {
454
- const { sportal365Sports: r } = O(), s = await k.get({
452
+ async function at(e, t = {}) {
453
+ const { sportal365Sports: n } = T(), r = await O.get({
455
454
  path: `/v2/matches/${e}`,
456
455
  params: {
457
- language_code: t.languageCode ?? r?.languageCode ?? "en",
458
- odd_client: t.oddClient ?? r?.oddClient,
456
+ language_code: t.languageCode ?? n?.languageCode ?? "en",
457
+ odd_client: t.oddClient ?? n?.oddClient,
459
458
  odd_type: t.oddType,
460
459
  scope_type: t.scopeType ?? "ALL",
461
460
  odd_format: t.oddFormat ?? "DECIMAL",
@@ -463,29 +462,29 @@ async function Zt(e, t = {}) {
463
462
  bookmaker_ids: t.bookmakerIds
464
463
  }
465
464
  });
466
- return Ze(e, s.odds ?? []);
465
+ return Fe(e, r.odds ?? []);
467
466
  }
468
- async function er(e, t = {}) {
469
- const { sportal365Sports: r } = O(), s = await k.get({
467
+ async function st(e, t = {}) {
468
+ const { sportal365Sports: n } = T(), r = await O.get({
470
469
  path: `/events/${e}/teamstats`,
471
470
  params: {
472
- language_code: t.languageCode ?? r?.languageCode ?? "en"
471
+ language_code: t.languageCode ?? n?.languageCode ?? "en"
473
472
  }
474
473
  });
475
- return Ke(s);
474
+ return Ie(r);
476
475
  }
477
- async function tr(e, t = {}) {
478
- const { sportal365Sports: r } = O();
479
- return (await k.get({
476
+ async function it(e, t = {}) {
477
+ const { sportal365Sports: n } = T();
478
+ return (await O.get({
480
479
  path: `/matches/${e}/commentary`,
481
480
  params: {
482
- language_code: t.languageCode ?? r?.languageCode ?? "en"
481
+ language_code: t.languageCode ?? n?.languageCode ?? "en"
483
482
  }
484
- })).map(et);
483
+ })).map(je);
485
484
  }
486
- async function rt(e) {
487
- const { sportal365Sports: t } = O();
488
- return (await k.get({
485
+ async function ct(e) {
486
+ const { sportal365Sports: t } = T();
487
+ return (await O.get({
489
488
  path: "/v2/matches",
490
489
  params: {
491
490
  language_code: e.languageCode ?? t?.languageCode ?? "en",
@@ -521,9 +520,9 @@ async function rt(e) {
521
520
  sort_direction: e.sortDirection,
522
521
  optional_data: e.optionalData
523
522
  }
524
- })).matches.map(Ne);
523
+ })).matches.map(me);
525
524
  }
526
- function nt(e) {
525
+ function Ye(e) {
527
526
  return {
528
527
  id: e.id,
529
528
  name: e.name,
@@ -546,1240 +545,570 @@ function nt(e) {
546
545
  } : void 0
547
546
  };
548
547
  }
549
- async function rr(e, t = {}) {
550
- const { sportal365Sports: r } = O(), s = await k.get({
548
+ async function ut(e, t = {}) {
549
+ const { sportal365Sports: n } = T(), r = await O.get({
551
550
  path: `/v2/teams/${e}`,
552
551
  params: {
553
- language_code: t.languageCode ?? r?.languageCode ?? "en",
552
+ language_code: t.languageCode ?? n?.languageCode ?? "en",
554
553
  optional_data: "form"
555
554
  }
556
555
  });
557
- return nt(s);
556
+ return Ye(r);
557
+ }
558
+ const $e = ve.replace(/\/$/, "");
559
+ function Ue() {
560
+ const { sportal365Sports: e } = T();
561
+ if (!e)
562
+ throw new Error("Sportal365 Sports API configuration is missing");
563
+ const t = `${e.username}:${e.password}`;
564
+ return `Basic ${btoa(t)}`;
565
+ }
566
+ function We(e) {
567
+ return `${$e}${e}`;
558
568
  }
559
- function ye(e, t) {
569
+ const Ge = {
570
+ async get(e) {
571
+ const { sportal365Sports: t } = T();
572
+ if (!t)
573
+ throw new Error("Sportal365 Sports API configuration is missing");
574
+ const n = new URL(We(e.path));
575
+ if (e.params)
576
+ for (const [a, s] of Object.entries(e.params))
577
+ s !== void 0 && (Array.isArray(s) ? s.length > 0 && n.searchParams.set(a, s.join(",")) : n.searchParams.set(a, s));
578
+ const r = await fetch(n.toString(), {
579
+ method: "GET",
580
+ headers: {
581
+ Authorization: Ue(),
582
+ "Content-Type": "application/json",
583
+ "X-Project": t.projectId
584
+ // Standings API uses X-Project
585
+ },
586
+ signal: t.timeout ? AbortSignal.timeout(t.timeout) : void 0
587
+ });
588
+ if (!r.ok) {
589
+ const a = await r.text();
590
+ throw new Error(`Sportal365 Standings API error: ${r.status} ${r.statusText} - ${a}`);
591
+ }
592
+ return r.json();
593
+ }
594
+ };
595
+ function He(e) {
560
596
  return {
561
- id: e.id,
562
- name: e.name,
563
- shortName: e.shortName,
564
- logo: e.assets?.logo ? { url: e.assets.logo, alt: e.name } : void 0,
565
- score: t != null ? st(t) : void 0
566
- };
597
+ RANK: "rank",
598
+ PLAYED: "played",
599
+ WINS: "won",
600
+ DRAWS: "drawn",
601
+ LOSSES: "lost",
602
+ GOALS_FOR: "goalsFor",
603
+ GOALS_AGAINST: "goalsAgainst",
604
+ GOAL_DIFFERENCE: "goalDifference",
605
+ POINTS: "points"
606
+ }[e] ?? e.toLowerCase();
567
607
  }
568
- function st(e) {
608
+ function w(e) {
569
609
  return {
570
- main: e
571
- };
610
+ CHAMPIONS_LEAGUE: "championsLeague",
611
+ EUROPA_LEAGUE: "europaLeague",
612
+ CONFERENCE_LEAGUE: "conferenceLeague",
613
+ RELEGATION: "relegation",
614
+ PLAYOFF: "playoff",
615
+ PROMOTION: "promotion"
616
+ }[e] ?? e.toLowerCase().replace(/_/g, "");
572
617
  }
573
- function it(e) {
574
- switch (e.type) {
575
- case "LIVE":
576
- return "live";
577
- case "FINISHED":
578
- return "final";
579
- case "POSTPONED":
580
- return "postponed";
581
- case "CANCELLED":
582
- return "cancelled";
583
- case "INTERRUPTED":
584
- case "ABANDONED":
585
- return "suspended";
586
- case "NOT_STARTED":
587
- default:
588
- return "scheduled";
618
+ function Be(e) {
619
+ switch (e) {
620
+ case "win":
621
+ return "W";
622
+ case "loss":
623
+ return "L";
624
+ case "draw":
625
+ return "D";
589
626
  }
590
627
  }
591
- function ot(e, t) {
592
- if (t.type === "LIVE")
628
+ function Ke(e, t) {
629
+ if (!t || t.length === 0)
630
+ return;
631
+ const n = t.map((a) => {
632
+ const s = a.participants.find((p) => p.id !== e) ?? a.participants[0], m = a.result?.[0]?.results?.map((p) => p.value).join("-") ?? void 0;
593
633
  return {
594
- current: e.currentPeriod,
595
- label: e.currentMinute ? `${e.currentMinute}'` : void 0
634
+ matchId: a.id,
635
+ result: Be(a.outcome),
636
+ score: m,
637
+ opponent: {
638
+ id: s.id,
639
+ name: s.name,
640
+ logo: s.display_asset?.url ?? s.assets?.logo?.url
641
+ },
642
+ date: new Date(a.start_time),
643
+ competition: a.competition ? {
644
+ id: a.competition.id,
645
+ name: a.competition.name
646
+ } : void 0
596
647
  };
597
- }
598
- function at(e) {
599
- if (e.type === "LIVE")
600
- return { color: "#ef4444" };
601
- }
602
- function De(e) {
603
- return {
604
- id: e.id,
605
- sport: "football",
606
- competitorOne: ye(e.competitorOne, e.score?.competitorOne),
607
- competitorTwo: ye(e.competitorTwo, e.score?.competitorTwo),
608
- status: it(e.status),
609
- period: ot(e.timing, e.status),
610
- liveIndicator: at(e.status),
611
- metadata: {
612
- venue: e.venue?.name,
613
- date: e.timing.kickoffTime.toISOString().split("T")[0],
614
- time: e.timing.kickoffTime.toLocaleTimeString("en-US", {
615
- hour: "2-digit",
616
- minute: "2-digit",
617
- hour12: !1
618
- }),
619
- competition: e.competition?.name,
620
- round: e.round?.name,
621
- winner: e.winner?.competitorId === e.competitorOne.id ? "competitorOne" : e.winner?.competitorId === e.competitorTwo.id ? "competitorTwo" : void 0
622
- },
623
- link: e.slug ? `/match/${e.slug}` : `/match/${e.id}`
624
- };
625
- }
626
- function ut(e) {
627
- return e.toISOString().split("T")[0];
628
- }
629
- async function ct(e, t) {
630
- const r = await tt(e, {
631
- languageCode: t?.languageCode
632
- });
633
- return De(r);
634
- }
635
- function lt(e) {
648
+ }), r = n.map((a) => a.result).join("");
636
649
  return {
637
- match: De(e),
638
- dateGroup: ut(e.timing.kickoffTime),
639
- competitionGroup: e.competition?.name,
640
- competitionLogo: e.competition?.assets?.logo,
641
- competitionSubtitle: e.competition?.country?.name,
642
- roundGroup: e.round?.name
643
- };
644
- }
645
- function dt(e) {
646
- const t = {
647
- limit: e.limit ?? 50,
648
- offset: e.offset ?? 0,
649
- languageCode: e.languageCode
650
+ competitorId: e,
651
+ results: n,
652
+ formString: r
650
653
  };
651
- return e.fromDate && (t.fromKickoffTime = e.fromDate), e.toDate && (t.toKickoffTime = e.toDate), e.tournamentIds && (t.tournamentIds = e.tournamentIds), e.teamId && (t.teamIds = [e.teamId]), e.roundIds && (t.roundIds = e.roundIds), e.seasonIds && (t.seasonIds = e.seasonIds), e.statusTypes && (t.statusTypes = e.statusTypes), e.variant === "teamResults" || e.variant === "teamResultsByCompetition" ? t.sortDirection = "desc" : (e.variant === "teamFixtures" || e.variant === "teamFixturesByCompetition") && (t.sortDirection = "asc"), t;
652
654
  }
653
- async function G(e) {
654
- const t = dt(e);
655
+ function Ve(e) {
655
656
  return {
656
- items: (await rt(t)).map((i) => lt(i)),
657
- variant: e.variant
657
+ key: w(e.standing_api_rule_type),
658
+ name: e.name,
659
+ position: e.type
658
660
  };
659
661
  }
660
- var ne = class {
661
- constructor() {
662
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
663
- }
664
- subscribe(e) {
665
- return this.listeners.add(e), this.onSubscribe(), () => {
666
- this.listeners.delete(e), this.onUnsubscribe();
667
- };
668
- }
669
- hasListeners() {
670
- return this.listeners.size > 0;
671
- }
672
- onSubscribe() {
673
- }
674
- onUnsubscribe() {
675
- }
676
- }, ft = {
677
- // We need the wrapper function syntax below instead of direct references to
678
- // global setTimeout etc.
679
- //
680
- // BAD: `setTimeout: setTimeout`
681
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
682
- //
683
- // If we use direct references here, then anything that wants to spy on or
684
- // replace the global setTimeout (like tests) won't work since we'll already
685
- // have a hard reference to the original implementation at the time when this
686
- // file was imported.
687
- setTimeout: (e, t) => setTimeout(e, t),
688
- clearTimeout: (e) => clearTimeout(e),
689
- setInterval: (e, t) => setInterval(e, t),
690
- clearInterval: (e) => clearInterval(e)
691
- }, ht = class {
692
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
693
- // type at app boot; and if we leave that type, then any new timer provider
694
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
695
- //
696
- // We settle for type safety for the TimeoutProvider type, and accept that
697
- // this class is unsafe internally to allow for extension.
698
- #t = ft;
699
- #e = !1;
700
- setTimeoutProvider(e) {
701
- process.env.NODE_ENV !== "production" && this.#e && e !== this.#t && console.error(
702
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
703
- { previous: this.#t, provider: e }
704
- ), this.#t = e, process.env.NODE_ENV !== "production" && (this.#e = !1);
705
- }
706
- setTimeout(e, t) {
707
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setTimeout(e, t);
708
- }
709
- clearTimeout(e) {
710
- this.#t.clearTimeout(e);
711
- }
712
- setInterval(e, t) {
713
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setInterval(e, t);
714
- }
715
- clearInterval(e) {
716
- this.#t.clearInterval(e);
717
- }
718
- }, H = new ht();
719
- function mt(e) {
720
- setTimeout(e, 0);
721
- }
722
- var Y = typeof window > "u" || "Deno" in globalThis;
723
- function Z() {
724
- }
725
- function _e(e) {
726
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
727
- }
728
- function pt(e, t) {
729
- return Math.max(e + (t || 0) - Date.now(), 0);
730
- }
731
- function U(e, t) {
732
- return typeof e == "function" ? e(t) : e;
733
- }
734
- function E(e, t) {
735
- return typeof e == "function" ? e(t) : e;
736
- }
737
- var gt = Object.prototype.hasOwnProperty;
738
- function ee(e, t) {
739
- if (e === t)
740
- return e;
741
- const r = ve(e) && ve(t);
742
- if (!r && !(be(e) && be(t))) return t;
743
- const i = (r ? e : Object.keys(e)).length, u = r ? t : Object.keys(t), a = u.length, o = r ? new Array(a) : {};
744
- let l = 0;
745
- for (let h = 0; h < a; h++) {
746
- const d = r ? h : u[h], y = e[d], f = t[d];
747
- if (y === f) {
748
- o[d] = y, (r ? h < i : gt.call(e, d)) && l++;
749
- continue;
750
- }
751
- if (y === null || f === null || typeof y != "object" || typeof f != "object") {
752
- o[d] = f;
753
- continue;
754
- }
755
- const S = ee(y, f);
756
- o[d] = S, S === y && l++;
757
- }
758
- return i === a && l === i ? e : o;
759
- }
760
- function te(e, t) {
761
- if (!t || Object.keys(e).length !== Object.keys(t).length)
762
- return !1;
763
- for (const r in e)
764
- if (e[r] !== t[r])
765
- return !1;
766
- return !0;
767
- }
768
- function ve(e) {
769
- return Array.isArray(e) && e.length === Object.keys(e).length;
770
- }
771
- function be(e) {
772
- if (!Ee(e))
773
- return !1;
774
- const t = e.constructor;
775
- if (t === void 0)
776
- return !0;
777
- const r = t.prototype;
778
- return !(!Ee(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
779
- }
780
- function Ee(e) {
781
- return Object.prototype.toString.call(e) === "[object Object]";
782
- }
783
- function Te(e, t, r) {
784
- if (typeof r.structuralSharing == "function")
785
- return r.structuralSharing(e, t);
786
- if (r.structuralSharing !== !1) {
787
- if (process.env.NODE_ENV !== "production")
788
- try {
789
- return ee(e, t);
790
- } catch (s) {
791
- throw console.error(
792
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${s}`
793
- ), s;
794
- }
795
- return ee(e, t);
796
- }
797
- return t;
798
- }
799
- function yt(e, t) {
800
- return typeof e == "function" ? e(...t) : !!e;
801
- }
802
- var _t = class extends ne {
803
- #t;
804
- #e;
805
- #n;
806
- constructor() {
807
- super(), this.#n = (e) => {
808
- if (!Y && window.addEventListener) {
809
- const t = () => e();
810
- return window.addEventListener("visibilitychange", t, !1), () => {
811
- window.removeEventListener("visibilitychange", t);
812
- };
813
- }
814
- };
815
- }
816
- onSubscribe() {
817
- this.#e || this.setEventListener(this.#n);
818
- }
819
- onUnsubscribe() {
820
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
821
- }
822
- setEventListener(e) {
823
- this.#n = e, this.#e?.(), this.#e = e((t) => {
824
- typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
825
- });
826
- }
827
- setFocused(e) {
828
- this.#t !== e && (this.#t = e, this.onFocus());
829
- }
830
- onFocus() {
831
- const e = this.isFocused();
832
- this.listeners.forEach((t) => {
833
- t(e);
834
- });
835
- }
836
- isFocused() {
837
- return typeof this.#t == "boolean" ? this.#t : globalThis.document?.visibilityState !== "hidden";
838
- }
839
- }, vt = new _t();
840
- function Se() {
841
- let e, t;
842
- const r = new Promise((i, u) => {
843
- e = i, t = u;
844
- });
845
- r.status = "pending", r.catch(() => {
846
- });
847
- function s(i) {
848
- Object.assign(r, i), delete r.resolve, delete r.reject;
662
+ function qe(e) {
663
+ const t = {};
664
+ let n = 0;
665
+ for (const m of e.columns) {
666
+ const p = He(m.type.code), v = parseInt(m.value, 10);
667
+ m.type.code === "RANK" ? n = v : t[p] = isNaN(v) ? void 0 : v;
849
668
  }
850
- return r.resolve = (i) => {
851
- s({
852
- status: "fulfilled",
853
- value: i
854
- }), e(i);
855
- }, r.reject = (i) => {
856
- s({
857
- status: "rejected",
858
- reason: i
859
- }), t(i);
860
- }, r;
861
- }
862
- var bt = mt;
863
- function Et() {
864
- let e = [], t = 0, r = (o) => {
865
- o();
866
- }, s = (o) => {
867
- o();
868
- }, i = bt;
869
- const u = (o) => {
870
- t ? e.push(o) : i(() => {
871
- r(o);
872
- });
873
- }, a = () => {
874
- const o = e;
875
- e = [], o.length && i(() => {
876
- s(() => {
877
- o.forEach((l) => {
878
- r(l);
879
- });
880
- });
881
- });
882
- };
669
+ const r = e.rules?.length > 0 ? e.rules.map((m) => w(m.standing_api_rule_type)) : void 0, a = Ke(e.team.id, e.form), s = e.team.assets?.logo?.url;
883
670
  return {
884
- batch: (o) => {
885
- let l;
886
- t++;
887
- try {
888
- l = o();
889
- } finally {
890
- t--, t || a();
891
- }
892
- return l;
893
- },
894
- /**
895
- * All calls to the wrapped function will be batched.
896
- */
897
- batchCalls: (o) => (...l) => {
898
- u(() => {
899
- o(...l);
900
- });
901
- },
902
- schedule: u,
903
- /**
904
- * Use this method to set a custom notify function.
905
- * This can be used to for example wrap notifications with `React.act` while running tests.
906
- */
907
- setNotifyFunction: (o) => {
908
- r = o;
909
- },
910
- /**
911
- * Use this method to set a custom function to batch notifications together into a single tick.
912
- * By default React Query will use the batch function provided by ReactDOM or React Native.
913
- */
914
- setBatchNotifyFunction: (o) => {
915
- s = o;
671
+ rank: n,
672
+ competitor: {
673
+ id: e.team.id,
674
+ name: e.team.name,
675
+ shortName: e.team.short_name ?? void 0,
676
+ logo: s
916
677
  },
917
- setScheduler: (o) => {
918
- i = o;
919
- }
678
+ stats: t,
679
+ form: a,
680
+ rules: r
920
681
  };
921
682
  }
922
- var Pe = Et(), Tt = class extends ne {
923
- #t = !0;
924
- #e;
925
- #n;
926
- constructor() {
927
- super(), this.#n = (e) => {
928
- if (!Y && window.addEventListener) {
929
- const t = () => e(!0), r = () => e(!1);
930
- return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
931
- window.removeEventListener("online", t), window.removeEventListener("offline", r);
932
- };
683
+ function ze(e) {
684
+ const t = e.map(qe), n = /* @__PURE__ */ new Map();
685
+ for (const r of e)
686
+ if (r.rules)
687
+ for (const a of r.rules) {
688
+ const s = w(a.standing_api_rule_type);
689
+ n.has(s) || n.set(s, Ve(a));
933
690
  }
934
- };
935
- }
936
- onSubscribe() {
937
- this.#e || this.setEventListener(this.#n);
938
- }
939
- onUnsubscribe() {
940
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
941
- }
942
- setEventListener(e) {
943
- this.#n = e, this.#e?.(), this.#e = e(this.setOnline.bind(this));
944
- }
945
- setOnline(e) {
946
- this.#t !== e && (this.#t = e, this.listeners.forEach((r) => {
947
- r(e);
948
- }));
949
- }
950
- isOnline() {
951
- return this.#t;
952
- }
953
- }, St = new Tt();
954
- function Ot(e) {
955
- return (e ?? "online") === "online" ? St.isOnline() : !0;
956
- }
957
- function It(e, t) {
958
691
  return {
959
- fetchFailureCount: 0,
960
- fetchFailureReason: null,
961
- fetchStatus: Ot(t.networkMode) ? "fetching" : "paused",
962
- ...e === void 0 && {
963
- error: null,
964
- status: "pending"
692
+ entries: t,
693
+ metadata: {
694
+ legend: Array.from(n.values())
965
695
  }
966
696
  };
967
697
  }
968
- var Rt = class extends ne {
969
- constructor(e, t) {
970
- super(), this.options = t, this.#t = e, this.#i = null, this.#s = Se(), this.bindMethods(), this.setOptions(t);
971
- }
972
- #t;
973
- #e = void 0;
974
- #n = void 0;
975
- #r = void 0;
976
- #a;
977
- #d;
978
- #s;
979
- #i;
980
- #p;
981
- #f;
982
- // This property keeps track of the last query with defined data.
983
- // It will be used to pass the previous data and query to the placeholder function between renders.
984
- #h;
985
- #u;
986
- #c;
987
- #o;
988
- #m = /* @__PURE__ */ new Set();
989
- bindMethods() {
990
- this.refetch = this.refetch.bind(this);
991
- }
992
- onSubscribe() {
993
- this.listeners.size === 1 && (this.#e.addObserver(this), Oe(this.#e, this.options) ? this.#l() : this.updateResult(), this.#v());
994
- }
995
- onUnsubscribe() {
996
- this.hasListeners() || this.destroy();
997
- }
998
- shouldFetchOnReconnect() {
999
- return re(
1000
- this.#e,
1001
- this.options,
1002
- this.options.refetchOnReconnect
1003
- );
1004
- }
1005
- shouldFetchOnWindowFocus() {
1006
- return re(
1007
- this.#e,
1008
- this.options,
1009
- this.options.refetchOnWindowFocus
1010
- );
1011
- }
1012
- destroy() {
1013
- this.listeners = /* @__PURE__ */ new Set(), this.#b(), this.#E(), this.#e.removeObserver(this);
1014
- }
1015
- setOptions(e) {
1016
- const t = this.options, r = this.#e;
1017
- if (this.options = this.#t.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof E(this.options.enabled, this.#e) != "boolean")
1018
- throw new Error(
1019
- "Expected enabled to be a boolean or a callback that returns a boolean"
1020
- );
1021
- this.#T(), this.#e.setOptions(this.options), t._defaulted && !te(this.options, t) && this.#t.getQueryCache().notify({
1022
- type: "observerOptionsUpdated",
1023
- query: this.#e,
1024
- observer: this
1025
- });
1026
- const s = this.hasListeners();
1027
- s && Ie(
1028
- this.#e,
1029
- r,
1030
- this.options,
1031
- t
1032
- ) && this.#l(), this.updateResult(), s && (this.#e !== r || E(this.options.enabled, this.#e) !== E(t.enabled, this.#e) || U(this.options.staleTime, this.#e) !== U(t.staleTime, this.#e)) && this.#g();
1033
- const i = this.#y();
1034
- s && (this.#e !== r || E(this.options.enabled, this.#e) !== E(t.enabled, this.#e) || i !== this.#o) && this.#_(i);
1035
- }
1036
- getOptimisticResult(e) {
1037
- const t = this.#t.getQueryCache().build(this.#t, e), r = this.createResult(t, e);
1038
- return kt(this, r) && (this.#r = r, this.#d = this.options, this.#a = this.#e.state), r;
1039
- }
1040
- getCurrentResult() {
1041
- return this.#r;
1042
- }
1043
- trackResult(e, t) {
1044
- return new Proxy(e, {
1045
- get: (r, s) => (this.trackProp(s), t?.(s), s === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#s.status === "pending" && this.#s.reject(
1046
- new Error(
1047
- "experimental_prefetchInRender feature flag is not enabled"
1048
- )
1049
- )), Reflect.get(r, s))
1050
- });
1051
- }
1052
- trackProp(e) {
1053
- this.#m.add(e);
1054
- }
1055
- getCurrentQuery() {
1056
- return this.#e;
1057
- }
1058
- refetch({ ...e } = {}) {
1059
- return this.fetch({
1060
- ...e
1061
- });
1062
- }
1063
- fetchOptimistic(e) {
1064
- const t = this.#t.defaultQueryOptions(e), r = this.#t.getQueryCache().build(this.#t, t);
1065
- return r.fetch().then(() => this.createResult(r, t));
1066
- }
1067
- fetch(e) {
1068
- return this.#l({
1069
- ...e,
1070
- cancelRefetch: e.cancelRefetch ?? !0
1071
- }).then(() => (this.updateResult(), this.#r));
1072
- }
1073
- #l(e) {
1074
- this.#T();
1075
- let t = this.#e.fetch(
1076
- this.options,
1077
- e
1078
- );
1079
- return e?.throwOnError || (t = t.catch(Z)), t;
1080
- }
1081
- #g() {
1082
- this.#b();
1083
- const e = U(
1084
- this.options.staleTime,
1085
- this.#e
1086
- );
1087
- if (Y || this.#r.isStale || !_e(e))
1088
- return;
1089
- const r = pt(this.#r.dataUpdatedAt, e) + 1;
1090
- this.#u = H.setTimeout(() => {
1091
- this.#r.isStale || this.updateResult();
1092
- }, r);
1093
- }
1094
- #y() {
1095
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
1096
- }
1097
- #_(e) {
1098
- this.#E(), this.#o = e, !(Y || E(this.options.enabled, this.#e) === !1 || !_e(this.#o) || this.#o === 0) && (this.#c = H.setInterval(() => {
1099
- (this.options.refetchIntervalInBackground || vt.isFocused()) && this.#l();
1100
- }, this.#o));
1101
- }
1102
- #v() {
1103
- this.#g(), this.#_(this.#y());
1104
- }
1105
- #b() {
1106
- this.#u && (H.clearTimeout(this.#u), this.#u = void 0);
1107
- }
1108
- #E() {
1109
- this.#c && (H.clearInterval(this.#c), this.#c = void 0);
1110
- }
1111
- createResult(e, t) {
1112
- const r = this.#e, s = this.options, i = this.#r, u = this.#a, a = this.#d, l = e !== r ? e.state : this.#n, { state: h } = e;
1113
- let d = { ...h }, y = !1, f;
1114
- if (t._optimisticResults) {
1115
- const _ = this.hasListeners(), R = !_ && Oe(e, t), C = _ && Ie(e, r, t, s);
1116
- (R || C) && (d = {
1117
- ...d,
1118
- ...It(h.data, e.options)
1119
- }), t._optimisticResults === "isRestoring" && (d.fetchStatus = "idle");
1120
- }
1121
- let { error: S, errorUpdatedAt: P, status: I } = d;
1122
- f = d.data;
1123
- let A = !1;
1124
- if (t.placeholderData !== void 0 && f === void 0 && I === "pending") {
1125
- let _;
1126
- i?.isPlaceholderData && t.placeholderData === a?.placeholderData ? (_ = i.data, A = !0) : _ = typeof t.placeholderData == "function" ? t.placeholderData(
1127
- this.#h?.state.data,
1128
- this.#h
1129
- ) : t.placeholderData, _ !== void 0 && (I = "success", f = Te(
1130
- i?.data,
1131
- _,
1132
- t
1133
- ), y = !0);
1134
- }
1135
- if (t.select && f !== void 0 && !A)
1136
- if (i && f === u?.data && t.select === this.#p)
1137
- f = this.#f;
1138
- else
1139
- try {
1140
- this.#p = t.select, f = t.select(f), f = Te(i?.data, f, t), this.#f = f, this.#i = null;
1141
- } catch (_) {
1142
- this.#i = _;
1143
- }
1144
- this.#i && (S = this.#i, f = this.#f, P = Date.now(), I = "error");
1145
- const L = d.fetchStatus === "fetching", F = I === "pending", M = I === "error", q = F && L, B = f !== void 0, b = {
1146
- status: I,
1147
- fetchStatus: d.fetchStatus,
1148
- isPending: F,
1149
- isSuccess: I === "success",
1150
- isError: M,
1151
- isInitialLoading: q,
1152
- isLoading: q,
1153
- data: f,
1154
- dataUpdatedAt: d.dataUpdatedAt,
1155
- error: S,
1156
- errorUpdatedAt: P,
1157
- failureCount: d.fetchFailureCount,
1158
- failureReason: d.fetchFailureReason,
1159
- errorUpdateCount: d.errorUpdateCount,
1160
- isFetched: d.dataUpdateCount > 0 || d.errorUpdateCount > 0,
1161
- isFetchedAfterMount: d.dataUpdateCount > l.dataUpdateCount || d.errorUpdateCount > l.errorUpdateCount,
1162
- isFetching: L,
1163
- isRefetching: L && !F,
1164
- isLoadingError: M && !B,
1165
- isPaused: d.fetchStatus === "paused",
1166
- isPlaceholderData: y,
1167
- isRefetchError: M && B,
1168
- isStale: se(e, t),
1169
- refetch: this.refetch,
1170
- promise: this.#s,
1171
- isEnabled: E(t.enabled, e) !== !1
1172
- };
1173
- if (this.options.experimental_prefetchInRender) {
1174
- const _ = (N) => {
1175
- b.status === "error" ? N.reject(b.error) : b.data !== void 0 && N.resolve(b.data);
1176
- }, R = () => {
1177
- const N = this.#s = b.promise = Se();
1178
- _(N);
1179
- }, C = this.#s;
1180
- switch (C.status) {
1181
- case "pending":
1182
- e.queryHash === r.queryHash && _(C);
1183
- break;
1184
- case "fulfilled":
1185
- (b.status === "error" || b.data !== C.value) && R();
1186
- break;
1187
- case "rejected":
1188
- (b.status !== "error" || b.error !== C.reason) && R();
1189
- break;
1190
- }
698
+ async function lt(e) {
699
+ const n = (await Ge.get({
700
+ path: "/standings/football",
701
+ params: {
702
+ stage_id: e.stageId,
703
+ coverage_type: e.coverageType ?? "ALL",
704
+ optional_data: e.optionalData
1191
705
  }
1192
- return b;
1193
- }
1194
- updateResult() {
1195
- const e = this.#r, t = this.createResult(this.#e, this.options);
1196
- if (this.#a = this.#e.state, this.#d = this.options, this.#a.data !== void 0 && (this.#h = this.#e), te(t, e))
1197
- return;
1198
- this.#r = t;
1199
- const r = () => {
1200
- if (!e)
1201
- return !0;
1202
- const { notifyOnChangeProps: s } = this.options, i = typeof s == "function" ? s() : s;
1203
- if (i === "all" || !i && !this.#m.size)
1204
- return !0;
1205
- const u = new Set(
1206
- i ?? this.#m
1207
- );
1208
- return this.options.throwOnError && u.add("error"), Object.keys(this.#r).some((a) => {
1209
- const o = a;
1210
- return this.#r[o] !== e[o] && u.has(o);
1211
- });
1212
- };
1213
- this.#S({ listeners: r() });
1214
- }
1215
- #T() {
1216
- const e = this.#t.getQueryCache().build(this.#t, this.options);
1217
- if (e === this.#e)
1218
- return;
1219
- const t = this.#e;
1220
- this.#e = e, this.#n = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
1221
- }
1222
- onQueryUpdate() {
1223
- this.updateResult(), this.hasListeners() && this.#v();
1224
- }
1225
- #S(e) {
1226
- Pe.batch(() => {
1227
- e.listeners && this.listeners.forEach((t) => {
1228
- t(this.#r);
1229
- }), this.#t.getQueryCache().notify({
1230
- query: this.#e,
1231
- type: "observerResultsUpdated"
1232
- });
1233
- });
1234
- }
1235
- };
1236
- function Ct(e, t) {
1237
- return E(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
1238
- }
1239
- function Oe(e, t) {
1240
- return Ct(e, t) || e.state.data !== void 0 && re(e, t, t.refetchOnMount);
1241
- }
1242
- function re(e, t, r) {
1243
- if (E(t.enabled, e) !== !1 && U(t.staleTime, e) !== "static") {
1244
- const s = typeof r == "function" ? r(e) : r;
1245
- return s === "always" || s !== !1 && se(e, t);
1246
- }
1247
- return !1;
1248
- }
1249
- function Ie(e, t, r, s) {
1250
- return (e !== t || E(s.enabled, e) === !1) && (!r.suspense || e.state.status !== "error") && se(e, r);
1251
- }
1252
- function se(e, t) {
1253
- return E(t.enabled, e) !== !1 && e.isStaleByTime(U(t.staleTime, e));
1254
- }
1255
- function kt(e, t) {
1256
- return !te(e.getCurrentResult(), t);
1257
- }
1258
- var W = { exports: {} }, x = {};
1259
- var Re;
1260
- function At() {
1261
- if (Re) return x;
1262
- Re = 1;
706
+ })).data?.[0];
707
+ if (!n?.standings?.length)
708
+ return { entries: [], metadata: { legend: [] } };
709
+ const r = n.standings[0];
710
+ return r?.standing?.length ? ze(r.standing) : { entries: [], metadata: { legend: [] } };
711
+ }
712
+ var q = { exports: {} }, I = {};
713
+ var ue;
714
+ function Je() {
715
+ if (ue) return I;
716
+ ue = 1;
1263
717
  var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
1264
- function r(s, i, u) {
1265
- var a = null;
1266
- if (u !== void 0 && (a = "" + u), i.key !== void 0 && (a = "" + i.key), "key" in i) {
1267
- u = {};
1268
- for (var o in i)
1269
- o !== "key" && (u[o] = i[o]);
1270
- } else u = i;
1271
- return i = u.ref, {
718
+ function n(r, a, s) {
719
+ var m = null;
720
+ if (s !== void 0 && (m = "" + s), a.key !== void 0 && (m = "" + a.key), "key" in a) {
721
+ s = {};
722
+ for (var p in a)
723
+ p !== "key" && (s[p] = a[p]);
724
+ } else s = a;
725
+ return a = s.ref, {
1272
726
  $$typeof: e,
1273
- type: s,
1274
- key: a,
1275
- ref: i !== void 0 ? i : null,
1276
- props: u
727
+ type: r,
728
+ key: m,
729
+ ref: a !== void 0 ? a : null,
730
+ props: s
1277
731
  };
1278
732
  }
1279
- return x.Fragment = t, x.jsx = r, x.jsxs = r, x;
1280
- }
1281
- var j = {};
1282
- var Ce;
1283
- function Nt() {
1284
- return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && (function() {
1285
- function e(n) {
1286
- if (n == null) return null;
1287
- if (typeof n == "function")
1288
- return n.$$typeof === N ? null : n.displayName || n.name || null;
1289
- if (typeof n == "string") return n;
1290
- switch (n) {
1291
- case A:
733
+ return I.Fragment = t, I.jsx = n, I.jsxs = n, I;
734
+ }
735
+ var D = {};
736
+ var le;
737
+ function Xe() {
738
+ return le || (le = 1, process.env.NODE_ENV !== "production" && (function() {
739
+ function e(o) {
740
+ if (o == null) return null;
741
+ if (typeof o == "function")
742
+ return o.$$typeof === B ? null : o.displayName || o.name || null;
743
+ if (typeof o == "string") return o;
744
+ switch (o) {
745
+ case R:
1292
746
  return "Fragment";
1293
- case F:
747
+ case j:
1294
748
  return "Profiler";
1295
- case L:
749
+ case F:
1296
750
  return "StrictMode";
1297
- case ie:
751
+ case U:
1298
752
  return "Suspense";
1299
- case b:
753
+ case W:
1300
754
  return "SuspenseList";
1301
- case C:
755
+ case H:
1302
756
  return "Activity";
1303
757
  }
1304
- if (typeof n == "object")
1305
- switch (typeof n.tag == "number" && console.error(
758
+ if (typeof o == "object")
759
+ switch (typeof o.tag == "number" && console.error(
1306
760
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1307
- ), n.$$typeof) {
1308
- case I:
1309
- return "Portal";
1310
- case q:
1311
- return n.displayName || "Context";
761
+ ), o.$$typeof) {
1312
762
  case M:
1313
- return (n._context.displayName || "Context") + ".Consumer";
1314
- case B:
1315
- var c = n.render;
1316
- return n = n.displayName, n || (n = c.displayName || c.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
1317
- case _:
1318
- return c = n.displayName || null, c !== null ? c : e(n.type) || "Memo";
1319
- case R:
1320
- c = n._payload, n = n._init;
763
+ return "Portal";
764
+ case $:
765
+ return o.displayName || "Context";
766
+ case Y:
767
+ return (o._context.displayName || "Context") + ".Consumer";
768
+ case A:
769
+ var i = o.render;
770
+ return o = o.displayName, o || (o = i.displayName || i.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
771
+ case G:
772
+ return i = o.displayName || null, i !== null ? i : e(o.type) || "Memo";
773
+ case C:
774
+ i = o._payload, o = o._init;
1321
775
  try {
1322
- return e(n(c));
776
+ return e(o(i));
1323
777
  } catch {
1324
778
  }
1325
779
  }
1326
780
  return null;
1327
781
  }
1328
- function t(n) {
1329
- return "" + n;
782
+ function t(o) {
783
+ return "" + o;
1330
784
  }
1331
- function r(n) {
785
+ function n(o) {
1332
786
  try {
1333
- t(n);
1334
- var c = !1;
787
+ t(o);
788
+ var i = !1;
1335
789
  } catch {
1336
- c = !0;
790
+ i = !0;
1337
791
  }
1338
- if (c) {
1339
- c = console;
1340
- var m = c.error, p = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
1341
- return m.call(
1342
- c,
792
+ if (i) {
793
+ i = console;
794
+ var l = i.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
795
+ return l.call(
796
+ i,
1343
797
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1344
- p
1345
- ), t(n);
798
+ g
799
+ ), t(o);
1346
800
  }
1347
801
  }
1348
- function s(n) {
1349
- if (n === A) return "<>";
1350
- if (typeof n == "object" && n !== null && n.$$typeof === R)
802
+ function r(o) {
803
+ if (o === R) return "<>";
804
+ if (typeof o == "object" && o !== null && o.$$typeof === C)
1351
805
  return "<...>";
1352
806
  try {
1353
- var c = e(n);
1354
- return c ? "<" + c + ">" : "<...>";
807
+ var i = e(o);
808
+ return i ? "<" + i + ">" : "<...>";
1355
809
  } catch {
1356
810
  return "<...>";
1357
811
  }
1358
812
  }
1359
- function i() {
1360
- var n = K.A;
1361
- return n === null ? null : n.getOwner();
813
+ function a() {
814
+ var o = P.A;
815
+ return o === null ? null : o.getOwner();
1362
816
  }
1363
- function u() {
817
+ function s() {
1364
818
  return Error("react-stack-top-frame");
1365
819
  }
1366
- function a(n) {
1367
- if (oe.call(n, "key")) {
1368
- var c = Object.getOwnPropertyDescriptor(n, "key").get;
1369
- if (c && c.isReactWarning) return !1;
820
+ function m(o) {
821
+ if (c.call(o, "key")) {
822
+ var i = Object.getOwnPropertyDescriptor(o, "key").get;
823
+ if (i && i.isReactWarning) return !1;
1370
824
  }
1371
- return n.key !== void 0;
825
+ return o.key !== void 0;
1372
826
  }
1373
- function o(n, c) {
1374
- function m() {
1375
- ae || (ae = !0, console.error(
827
+ function p(o, i) {
828
+ function l() {
829
+ E || (E = !0, console.error(
1376
830
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1377
- c
831
+ i
1378
832
  ));
1379
833
  }
1380
- m.isReactWarning = !0, Object.defineProperty(n, "key", {
1381
- get: m,
834
+ l.isReactWarning = !0, Object.defineProperty(o, "key", {
835
+ get: l,
1382
836
  configurable: !0
1383
837
  });
1384
838
  }
1385
- function l() {
1386
- var n = e(this.type);
1387
- return ue[n] || (ue[n] = !0, console.error(
839
+ function v() {
840
+ var o = e(this.type);
841
+ return K[o] || (K[o] = !0, console.error(
1388
842
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1389
- )), n = this.props.ref, n !== void 0 ? n : null;
843
+ )), o = this.props.ref, o !== void 0 ? o : null;
1390
844
  }
1391
- function h(n, c, m, p, Q, J) {
1392
- var g = m.ref;
1393
- return n = {
1394
- $$typeof: P,
1395
- type: n,
1396
- key: c,
1397
- props: m,
1398
- _owner: p
1399
- }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(n, "ref", {
845
+ function k(o, i, l, g, V, X) {
846
+ var _ = l.ref;
847
+ return o = {
848
+ $$typeof: L,
849
+ type: o,
850
+ key: i,
851
+ props: l,
852
+ _owner: g
853
+ }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(o, "ref", {
1400
854
  enumerable: !1,
1401
- get: l
1402
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
855
+ get: v
856
+ }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
1403
857
  configurable: !1,
1404
858
  enumerable: !1,
1405
859
  writable: !0,
1406
860
  value: 0
1407
- }), Object.defineProperty(n, "_debugInfo", {
861
+ }), Object.defineProperty(o, "_debugInfo", {
1408
862
  configurable: !1,
1409
863
  enumerable: !1,
1410
864
  writable: !0,
1411
865
  value: null
1412
- }), Object.defineProperty(n, "_debugStack", {
866
+ }), Object.defineProperty(o, "_debugStack", {
1413
867
  configurable: !1,
1414
868
  enumerable: !1,
1415
869
  writable: !0,
1416
- value: Q
1417
- }), Object.defineProperty(n, "_debugTask", {
870
+ value: V
871
+ }), Object.defineProperty(o, "_debugTask", {
1418
872
  configurable: !1,
1419
873
  enumerable: !1,
1420
874
  writable: !0,
1421
- value: J
1422
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
875
+ value: X
876
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
1423
877
  }
1424
- function d(n, c, m, p, Q, J) {
1425
- var g = c.children;
1426
- if (g !== void 0)
1427
- if (p)
1428
- if (Fe(g)) {
1429
- for (p = 0; p < g.length; p++)
1430
- y(g[p]);
1431
- Object.freeze && Object.freeze(g);
878
+ function d(o, i, l, g, V, X) {
879
+ var _ = i.children;
880
+ if (_ !== void 0)
881
+ if (g)
882
+ if (u(_)) {
883
+ for (g = 0; g < _.length; g++)
884
+ x(_[g]);
885
+ Object.freeze && Object.freeze(_);
1432
886
  } else
1433
887
  console.error(
1434
888
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1435
889
  );
1436
- else y(g);
1437
- if (oe.call(c, "key")) {
1438
- g = e(n);
1439
- var D = Object.keys(c).filter(function(Me) {
1440
- return Me !== "key";
890
+ else x(_);
891
+ if (c.call(i, "key")) {
892
+ _ = e(o);
893
+ var N = Object.keys(i).filter(function(pe) {
894
+ return pe !== "key";
1441
895
  });
1442
- p = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", de[g + p] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
896
+ g = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", oe[_ + g] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
1443
897
  `A props object containing a "key" prop is being spread into JSX:
1444
898
  let props = %s;
1445
899
  <%s {...props} />
1446
900
  React keys must be passed directly to JSX without using spread:
1447
901
  let props = %s;
1448
902
  <%s key={someKey} {...props} />`,
1449
- p,
1450
903
  g,
1451
- D,
1452
- g
1453
- ), de[g + p] = !0);
904
+ _,
905
+ N,
906
+ _
907
+ ), oe[_ + g] = !0);
1454
908
  }
1455
- if (g = null, m !== void 0 && (r(m), g = "" + m), a(c) && (r(c.key), g = "" + c.key), "key" in c) {
1456
- m = {};
1457
- for (var X in c)
1458
- X !== "key" && (m[X] = c[X]);
1459
- } else m = c;
1460
- return g && o(
1461
- m,
1462
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
1463
- ), h(
1464
- n,
1465
- g,
1466
- m,
1467
- i(),
1468
- Q,
1469
- J
909
+ if (_ = null, l !== void 0 && (n(l), _ = "" + l), m(i) && (n(i.key), _ = "" + i.key), "key" in i) {
910
+ l = {};
911
+ for (var Z in i)
912
+ Z !== "key" && (l[Z] = i[Z]);
913
+ } else l = i;
914
+ return _ && p(
915
+ l,
916
+ typeof o == "function" ? o.displayName || o.name || "Unknown" : o
917
+ ), k(
918
+ o,
919
+ _,
920
+ l,
921
+ a(),
922
+ V,
923
+ X
1470
924
  );
1471
925
  }
1472
- function y(n) {
1473
- f(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === R && (n._payload.status === "fulfilled" ? f(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
926
+ function x(o) {
927
+ S(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === C && (o._payload.status === "fulfilled" ? S(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
1474
928
  }
1475
- function f(n) {
1476
- return typeof n == "object" && n !== null && n.$$typeof === P;
929
+ function S(o) {
930
+ return typeof o == "object" && o !== null && o.$$typeof === L;
1477
931
  }
1478
- var S = xe, P = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), q = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), ie = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), K = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, oe = Object.prototype.hasOwnProperty, Fe = Array.isArray, z = console.createTask ? console.createTask : function() {
932
+ var b = ge, L = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), U = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), G = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), B = Symbol.for("react.client.reference"), P = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, c = Object.prototype.hasOwnProperty, u = Array.isArray, f = console.createTask ? console.createTask : function() {
1479
933
  return null;
1480
934
  };
1481
- S = {
1482
- react_stack_bottom_frame: function(n) {
1483
- return n();
935
+ b = {
936
+ react_stack_bottom_frame: function(o) {
937
+ return o();
1484
938
  }
1485
939
  };
1486
- var ae, ue = {}, ce = S.react_stack_bottom_frame.bind(
1487
- S,
1488
- u
1489
- )(), le = z(s(u)), de = {};
1490
- j.Fragment = A, j.jsx = function(n, c, m) {
1491
- var p = 1e4 > K.recentlyCreatedOwnerStacks++;
940
+ var E, K = {}, ee = b.react_stack_bottom_frame.bind(
941
+ b,
942
+ s
943
+ )(), te = f(r(s)), oe = {};
944
+ D.Fragment = R, D.jsx = function(o, i, l) {
945
+ var g = 1e4 > P.recentlyCreatedOwnerStacks++;
1492
946
  return d(
1493
- n,
1494
- c,
1495
- m,
947
+ o,
948
+ i,
949
+ l,
1496
950
  !1,
1497
- p ? Error("react-stack-top-frame") : ce,
1498
- p ? z(s(n)) : le
951
+ g ? Error("react-stack-top-frame") : ee,
952
+ g ? f(r(o)) : te
1499
953
  );
1500
- }, j.jsxs = function(n, c, m) {
1501
- var p = 1e4 > K.recentlyCreatedOwnerStacks++;
954
+ }, D.jsxs = function(o, i, l) {
955
+ var g = 1e4 > P.recentlyCreatedOwnerStacks++;
1502
956
  return d(
1503
- n,
1504
- c,
1505
- m,
957
+ o,
958
+ i,
959
+ l,
1506
960
  !0,
1507
- p ? Error("react-stack-top-frame") : ce,
1508
- p ? z(s(n)) : le
961
+ g ? Error("react-stack-top-frame") : ee,
962
+ g ? f(r(o)) : te
1509
963
  );
1510
964
  };
1511
- })()), j;
1512
- }
1513
- var ke;
1514
- function Dt() {
1515
- return ke || (ke = 1, process.env.NODE_ENV === "production" ? W.exports = At() : W.exports = Nt()), W.exports;
1516
- }
1517
- Dt();
1518
- var Pt = T.createContext(
1519
- void 0
1520
- ), Lt = (e) => {
1521
- const t = T.useContext(Pt);
1522
- if (!t)
1523
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1524
- return t;
1525
- }, Le = T.createContext(!1), Ft = () => T.useContext(Le);
1526
- Le.Provider;
1527
- function Mt() {
1528
- let e = !1;
1529
- return {
1530
- clearReset: () => {
1531
- e = !1;
965
+ })()), D;
966
+ }
967
+ var de;
968
+ function Ze() {
969
+ return de || (de = 1, process.env.NODE_ENV === "production" ? q.exports = Je() : q.exports = Xe()), q.exports;
970
+ }
971
+ var Qe = Ze();
972
+ const fe = _e(null);
973
+ function dt() {
974
+ const e = ye(fe);
975
+ if (!e)
976
+ throw new Error("useCompetition must be used within CompetitionProvider");
977
+ return e;
978
+ }
979
+ function mt({
980
+ competitionId: e,
981
+ seasonId: t,
982
+ stageId: n,
983
+ matches: r,
984
+ standings: a,
985
+ previousSeasons: s,
986
+ config: m,
987
+ autoRefresh: p = !0,
988
+ refreshInterval: v = 3e4,
989
+ children: k
990
+ }) {
991
+ const [d, x] = ne(r), [S, b] = ne(a);
992
+ Q(() => {
993
+ x(r);
994
+ }, [r]), Q(() => {
995
+ b(a);
996
+ }, [a]), Q(() => {
997
+ if (!p || !d.some((f) => f.status.code === "live")) return;
998
+ const u = setInterval(async () => {
999
+ console.log("[CompetitionProvider] Auto-refresh triggered for live matches");
1000
+ }, v);
1001
+ return () => clearInterval(u);
1002
+ }, [p, v, d]);
1003
+ const L = y((c) => d.find((u) => u.id === c), [d]), M = y(
1004
+ (c) => d.filter((u) => u.competitorOne.id === c || u.competitorTwo.id === c),
1005
+ [d]
1006
+ ), R = y(
1007
+ (c) => d.filter((u) => u.timing.kickoffTime.toISOString().startsWith(c)),
1008
+ [d]
1009
+ ), F = y(
1010
+ (c) => d.filter((u) => u.round?.id === c),
1011
+ [d]
1012
+ ), j = y(() => d.filter((c) => c.status.code === "live"), [d]), Y = y(
1013
+ (c) => {
1014
+ const u = /* @__PURE__ */ new Date();
1015
+ let f = d.filter((E) => E.status.code === "not_started" && E.timing.kickoffTime > u);
1016
+ return c && (f = f.filter((E) => E.competitorOne.id === c || E.competitorTwo.id === c)), f.sort((E, K) => E.timing.kickoffTime.getTime() - K.timing.kickoffTime.getTime());
1532
1017
  },
1533
- reset: () => {
1534
- e = !0;
1018
+ [d]
1019
+ ), $ = y(
1020
+ (c) => {
1021
+ let u = d.filter((f) => f.status.code === "finished");
1022
+ return c && (u = u.filter((f) => f.competitorOne.id === c || f.competitorTwo.id === c)), u.sort((f, E) => E.timing.kickoffTime.getTime() - f.timing.kickoffTime.getTime());
1535
1023
  },
1536
- isReset: () => e
1537
- };
1538
- }
1539
- var xt = T.createContext(Mt()), jt = () => T.useContext(xt), Ut = (e, t) => {
1540
- (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
1541
- }, Yt = (e) => {
1542
- T.useEffect(() => {
1543
- e.clearReset();
1544
- }, [e]);
1545
- }, $t = ({
1546
- result: e,
1547
- errorResetBoundary: t,
1548
- throwOnError: r,
1549
- query: s,
1550
- suspense: i
1551
- }) => e.isError && !t.isReset() && !e.isFetching && s && (i && e.data === void 0 || yt(r, [e.error, s])), qt = (e) => {
1552
- if (e.suspense) {
1553
- const r = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), s = e.staleTime;
1554
- e.staleTime = typeof s == "function" ? (...i) => r(s(...i)) : r(s), typeof e.gcTime == "number" && (e.gcTime = Math.max(
1555
- e.gcTime,
1556
- 1e3
1557
- ));
1558
- }
1559
- }, Bt = (e, t) => e.isLoading && e.isFetching && !t, Qt = (e, t) => e?.suspense && t.isPending, Ae = (e, t, r) => t.fetchOptimistic(e).catch(() => {
1560
- r.clearReset();
1561
- });
1562
- function Ht(e, t, r) {
1563
- if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
1564
- throw new Error(
1565
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1566
- );
1567
- const s = Ft(), i = jt(), u = Lt(), a = u.defaultQueryOptions(e);
1568
- u.getDefaultOptions().queries?._experimental_beforeQuery?.(
1569
- a
1570
- ), process.env.NODE_ENV !== "production" && (a.queryFn || console.error(
1571
- `[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
1572
- )), a._optimisticResults = s ? "isRestoring" : "optimistic", qt(a), Ut(a, i), Yt(i);
1573
- const o = !u.getQueryCache().get(a.queryHash), [l] = T.useState(
1574
- () => new t(
1575
- u,
1576
- a
1577
- )
1578
- ), h = l.getOptimisticResult(a), d = !s && e.subscribed !== !1;
1579
- if (T.useSyncExternalStore(
1580
- T.useCallback(
1581
- (y) => {
1582
- const f = d ? l.subscribe(Pe.batchCalls(y)) : Z;
1583
- return l.updateResult(), f;
1584
- },
1585
- [l, d]
1586
- ),
1587
- () => l.getCurrentResult(),
1588
- () => l.getCurrentResult()
1589
- ), T.useEffect(() => {
1590
- l.setOptions(a);
1591
- }, [a, l]), Qt(a, h))
1592
- throw Ae(a, l, i);
1593
- if ($t({
1594
- result: h,
1595
- errorResetBoundary: i,
1596
- throwOnError: a.throwOnError,
1597
- query: u.getQueryCache().get(a.queryHash),
1598
- suspense: a.suspense
1599
- }))
1600
- throw h.error;
1601
- return u.getDefaultOptions().queries?._experimental_afterQuery?.(
1602
- a,
1603
- h
1604
- ), a.experimental_prefetchInRender && !Y && Bt(h, s) && (o ? (
1605
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1606
- Ae(a, l, i)
1607
- ) : (
1608
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1609
- u.getQueryCache().get(a.queryHash)?.promise
1610
- ))?.catch(Z).finally(() => {
1611
- l.updateResult();
1612
- }), a.notifyOnChangeProps ? h : l.trackResult(h);
1613
- }
1614
- function $(e, t) {
1615
- return Ht(e, Rt);
1616
- }
1617
- function nr(e, t) {
1618
- return $({
1619
- queryKey: ["match-score", e, { lang: t?.languageCode }],
1620
- queryFn: () => ct(e, {
1621
- languageCode: t?.languageCode
1024
+ [d]
1025
+ ), A = y(
1026
+ (c) => S.find((u) => u.competitor.id === c),
1027
+ [S]
1028
+ ), U = y((c) => A(c)?.form?.formString, [A]), W = y((c) => A(c)?.stats, [A]), G = y(
1029
+ (c) => [...S].sort((u, f) => u.rank - f.rank).slice(0, c),
1030
+ [S]
1031
+ ), C = y(
1032
+ (c) => [...S].sort((u, f) => f.rank - u.rank).slice(0, c),
1033
+ [S]
1034
+ ), H = y(
1035
+ (c) => s?.find((u) => u.id === c)?.matches,
1036
+ [s]
1037
+ ), B = y(
1038
+ (c) => s?.find((u) => u.id === c)?.standings,
1039
+ [s]
1040
+ ), P = he(
1041
+ () => ({
1042
+ // Core identifiers
1043
+ competitionId: e,
1044
+ seasonId: t,
1045
+ stageId: n,
1046
+ // Core data
1047
+ matches: d,
1048
+ standings: S,
1049
+ // Historical data
1050
+ previousSeasons: s,
1051
+ // Custom configuration
1052
+ config: m,
1053
+ // Match helpers
1054
+ getMatch: L,
1055
+ getMatchesByTeam: M,
1056
+ getMatchesByDate: R,
1057
+ getMatchesByRound: F,
1058
+ getLiveMatches: j,
1059
+ getUpcomingMatches: Y,
1060
+ getFinishedMatches: $,
1061
+ // Standings helpers
1062
+ getTeamStanding: A,
1063
+ getTeamForm: U,
1064
+ getTeamStats: W,
1065
+ getTopTeams: G,
1066
+ getBottomTeams: C,
1067
+ // Historical helpers
1068
+ getSeasonMatches: H,
1069
+ getSeasonStandings: B
1622
1070
  }),
1623
- initialData: t?.initialData,
1624
- enabled: t?.enabled ?? !0,
1625
- refetchInterval: t?.refetchInterval ?? !1,
1626
- refetchIntervalInBackground: !1,
1627
- staleTime: 3e4
1628
- // 30 seconds
1629
- });
1630
- }
1631
- function sr(e) {
1632
- const t = [
1633
- "match-list",
1634
- e.variant,
1635
- {
1636
- fromDate: e.fromDate,
1637
- toDate: e.toDate,
1638
- tournamentIds: e.tournamentIds,
1639
- teamId: e.teamId,
1640
- roundIds: e.roundIds,
1641
- seasonIds: e.seasonIds,
1642
- statusTypes: e.statusTypes,
1643
- limit: e.limit,
1644
- offset: e.offset,
1645
- lang: e.languageCode
1646
- }
1647
- ];
1648
- return $({
1649
- queryKey: t,
1650
- queryFn: () => G(e),
1651
- initialData: e.initialData,
1652
- enabled: e.enabled ?? !0,
1653
- refetchInterval: e.refetchInterval ?? !1,
1654
- refetchIntervalInBackground: !1,
1655
- staleTime: 6e4
1656
- // 1 minute
1657
- });
1658
- }
1659
- async function Wt(e, t) {
1660
- const r = t?.groupByCompetition ? "teamResultsByCompetition" : "teamResults";
1661
- return G({
1662
- variant: r,
1663
- teamId: e,
1664
- statusTypes: ["FINISHED"],
1665
- languageCode: t?.languageCode,
1666
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1667
- tournamentIds: t?.tournamentIds,
1668
- limit: t?.limit ?? 20,
1669
- offset: t?.offset ?? 0
1670
- });
1671
- }
1672
- async function Vt(e, t) {
1673
- const r = t?.groupByCompetition ? "teamFixturesByCompetition" : "teamFixtures";
1674
- return G({
1675
- variant: r,
1676
- teamId: e,
1677
- statusTypes: ["NOT_STARTED"],
1678
- languageCode: t?.languageCode,
1679
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1680
- tournamentIds: t?.tournamentIds,
1681
- limit: t?.limit ?? 20,
1682
- offset: t?.offset ?? 0
1683
- });
1684
- }
1685
- async function wt(e, t) {
1686
- const r = t?.groupByCompetition ? "teamMatchesByCompetition" : "teamMatches";
1687
- return G({
1688
- variant: r,
1689
- teamId: e,
1690
- languageCode: t?.languageCode,
1691
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1692
- tournamentIds: t?.tournamentIds,
1693
- limit: t?.limit ?? 20,
1694
- offset: t?.offset ?? 0
1695
- });
1696
- }
1697
- function ir(e, t) {
1698
- const r = t?.groupByCompetition ? "teamResultsByCompetition" : "teamResults";
1699
- return $({
1700
- queryKey: [
1701
- "team-results",
1702
- e,
1703
- r,
1704
- {
1705
- seasonId: t?.seasonId,
1706
- tournamentIds: t?.tournamentIds,
1707
- limit: t?.limit,
1708
- offset: t?.offset,
1709
- lang: t?.languageCode
1710
- }
1711
- ],
1712
- queryFn: () => Wt(e, t),
1713
- initialData: t?.initialData,
1714
- enabled: t?.enabled ?? !0,
1715
- refetchInterval: t?.refetchInterval ?? !1,
1716
- staleTime: 6e4
1717
- });
1718
- }
1719
- function or(e, t) {
1720
- const r = t?.groupByCompetition ? "teamFixturesByCompetition" : "teamFixtures";
1721
- return $({
1722
- queryKey: [
1723
- "team-fixtures",
1724
- e,
1725
- r,
1726
- {
1727
- seasonId: t?.seasonId,
1728
- tournamentIds: t?.tournamentIds,
1729
- limit: t?.limit,
1730
- offset: t?.offset,
1731
- lang: t?.languageCode
1732
- }
1733
- ],
1734
- queryFn: () => Vt(e, t),
1735
- initialData: t?.initialData,
1736
- enabled: t?.enabled ?? !0,
1737
- refetchInterval: t?.refetchInterval ?? !1,
1738
- staleTime: 6e4
1739
- });
1740
- }
1741
- function ar(e, t) {
1742
- const r = t?.groupByCompetition ? "teamMatchesByCompetition" : "teamMatches";
1743
- return $({
1744
- queryKey: [
1745
- "team-matches",
1071
+ [
1746
1072
  e,
1747
- r,
1748
- {
1749
- seasonId: t?.seasonId,
1750
- tournamentIds: t?.tournamentIds,
1751
- limit: t?.limit,
1752
- offset: t?.offset,
1753
- lang: t?.languageCode
1754
- }
1755
- ],
1756
- queryFn: () => wt(e, t),
1757
- initialData: t?.initialData,
1758
- enabled: t?.enabled ?? !0,
1759
- refetchInterval: t?.refetchInterval ?? !1,
1760
- staleTime: 6e4
1761
- });
1762
- }
1073
+ t,
1074
+ n,
1075
+ d,
1076
+ S,
1077
+ s,
1078
+ m,
1079
+ L,
1080
+ M,
1081
+ R,
1082
+ F,
1083
+ j,
1084
+ Y,
1085
+ $,
1086
+ A,
1087
+ U,
1088
+ W,
1089
+ G,
1090
+ C,
1091
+ H,
1092
+ B
1093
+ ]
1094
+ );
1095
+ return /* @__PURE__ */ Qe.jsx(fe.Provider, { value: P, children: k });
1096
+ }
1097
+ const ft = "0.0.2";
1763
1098
  export {
1764
- O as getConfig,
1765
- tt as getFootballMatch,
1766
- tr as getFootballMatchCommentary,
1767
- Jt as getFootballMatchEvents,
1768
- Xt as getFootballMatchLineups,
1769
- Zt as getFootballMatchOdds,
1770
- er as getFootballMatchStatistics,
1771
- rt as getFootballMatches,
1772
- rr as getFootballTeam,
1773
- zt as isConfigured,
1774
- G as prepareMatchList,
1775
- ct as prepareMatchScore,
1776
- Vt as prepareTeamFixtures,
1777
- wt as prepareTeamMatches,
1778
- Wt as prepareTeamResults,
1779
- Kt as setConfig,
1780
- sr as usePrepareMatchList,
1781
- nr as usePrepareMatchScore,
1782
- or as usePrepareTeamFixtures,
1783
- ar as usePrepareTeamMatches,
1784
- ir as usePrepareTeamResults
1099
+ mt as CompetitionProvider,
1100
+ T as getConfig,
1101
+ ot as getFootballMatch,
1102
+ it as getFootballMatchCommentary,
1103
+ nt as getFootballMatchEvents,
1104
+ rt as getFootballMatchLineups,
1105
+ at as getFootballMatchOdds,
1106
+ st as getFootballMatchStatistics,
1107
+ ct as getFootballMatches,
1108
+ lt as getFootballStandings,
1109
+ ut as getFootballTeam,
1110
+ tt as isConfigured,
1111
+ et as setConfig,
1112
+ dt as useCompetition,
1113
+ ft as version
1785
1114
  };