fansunited-data-layer 0.0.6 → 0.0.8

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.
@@ -1,70 +1,69 @@
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;
1
+ let p = null;
2
+ function Z(t) {
3
+ p = t;
5
4
  }
6
- function T() {
7
- if (!z)
5
+ function i() {
6
+ if (!p)
8
7
  throw new Error(
9
8
  "Data layer config not initialized. Call setConfig() in your root layout."
10
9
  );
11
- return z;
10
+ return p;
12
11
  }
13
- function tt() {
14
- return z !== null;
12
+ function w() {
13
+ return p !== null;
15
14
  }
16
- function Ee(e) {
17
- const t = e.replace(/\/$/, "");
18
- function n() {
19
- const { sportal365Sports: a } = T();
20
- if (!a)
15
+ function A(t) {
16
+ const e = t.replace(/\/$/, "");
17
+ function o() {
18
+ const { sportal365Sports: s } = i();
19
+ if (!s)
21
20
  throw new Error("Sportal365 Sports API configuration is missing");
22
- const s = `${a.username}:${a.password}`;
23
- return `Basic ${btoa(s)}`;
21
+ const a = `${s.username}:${s.password}`;
22
+ return `Basic ${btoa(a)}`;
24
23
  }
25
- function r(a) {
26
- return `${t}${a}`;
24
+ function n(s) {
25
+ return `${e}${s}`;
27
26
  }
28
27
  return {
29
- async get(a) {
30
- const { sportal365Sports: s } = T();
31
- if (!s)
28
+ async get(s) {
29
+ const { sportal365Sports: a } = i();
30
+ if (!a)
32
31
  throw new Error("Sportal365 Sports API configuration is missing");
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(), {
32
+ const d = new URL(n(s.path));
33
+ if (s.params)
34
+ for (const [l, m] of Object.entries(s.params))
35
+ m !== void 0 && (Array.isArray(m) ? m.length > 0 && d.searchParams.set(l, m.join(",")) : d.searchParams.set(l, m));
36
+ const c = await fetch(d.toString(), {
38
37
  method: "GET",
39
38
  headers: {
40
- Authorization: n(),
39
+ Authorization: o(),
41
40
  "Content-Type": "application/json",
42
- "X-Project": s.projectId
41
+ "X-Project": a.projectId
43
42
  },
44
- signal: s.timeout ? AbortSignal.timeout(s.timeout) : void 0
43
+ signal: a.timeout ? AbortSignal.timeout(a.timeout) : void 0
45
44
  });
46
- if (!p.ok)
47
- throw new Error(`Sportal365 API error: ${p.status} ${p.statusText}`);
48
- return p.json();
45
+ if (!c.ok)
46
+ throw new Error(`Sportal365 API error: ${c.status} ${c.statusText}`);
47
+ return c.json();
49
48
  }
50
49
  };
51
50
  }
52
- const Te = "https://football.api.sportal365.com", ve = "https://standing.api.sportal365.com", O = Ee(Te);
53
- function re(e) {
54
- if (e)
51
+ const O = "https://football.api.sportal365.com", v = "https://standing.api.sportal365.com", u = A(O);
52
+ function f(t) {
53
+ if (t)
55
54
  return {
56
- id: e.id,
57
- name: e.name,
58
- slug: e.slug,
59
- position: e.position,
60
- gender: e.gender,
61
- assets: e.assets ? {
62
- photo: e.assets.thumb?.url,
63
- photoTransparent: e.assets.thumb_transparent_background?.url
55
+ id: t.id,
56
+ name: t.name,
57
+ slug: t.slug,
58
+ position: t.position,
59
+ gender: t.gender,
60
+ assets: t.assets ? {
61
+ photo: t.assets.thumb?.url,
62
+ photoTransparent: t.assets.thumb_transparent_background?.url
64
63
  } : void 0
65
64
  };
66
65
  }
67
- const Se = {
66
+ const L = {
68
67
  // Scoring events
69
68
  GOAL: "GOAL",
70
69
  PENALTY_GOAL: "PENALTY_GOAL",
@@ -89,20 +88,20 @@ const Se = {
89
88
  PENALTY_MISSED: "PENALTY_MISSED",
90
89
  PENALTY_SAVED: "PENALTY_SAVED"
91
90
  };
92
- function J(e) {
93
- const t = Se[e.type_code];
94
- return t ? {
95
- id: e.id,
96
- type: t,
97
- competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
98
- minute: e.minute,
99
- injuryMinute: e.injury_minute,
100
- primaryPlayer: re(e.primary_player),
101
- secondaryPlayer: re(e.secondary_player),
102
- score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
103
- } : (console.warn(`Unknown event type: ${e.type_code}`), null);
104
- }
105
- function ke(e) {
91
+ function g(t) {
92
+ const e = L[t.type_code];
93
+ return e ? {
94
+ id: t.id,
95
+ type: e,
96
+ competitorPosition: t.team_position === "HOME" ? "ONE" : "TWO",
97
+ minute: t.minute,
98
+ injuryMinute: t.injury_minute,
99
+ primaryPlayer: f(t.primary_player),
100
+ secondaryPlayer: f(t.secondary_player),
101
+ score: t.score ? { competitorOne: String(t.score.home), competitorTwo: String(t.score.away) } : void 0
102
+ } : (console.warn(`Unknown event type: ${t.type_code}`), null);
103
+ }
104
+ function k(t) {
106
105
  return {
107
106
  code: {
108
107
  FINISHED: "finished",
@@ -113,486 +112,486 @@ function ke(e) {
113
112
  POSTPONED: "postponed",
114
113
  UNKNOWN: "not_started",
115
114
  ABANDONED: "abandoned"
116
- }[e.type] ?? "not_started",
117
- name: e.name,
118
- shortName: e.short_name,
119
- type: e.type
115
+ }[t.type] ?? "not_started",
116
+ name: t.name,
117
+ shortName: t.short_name,
118
+ type: t.type
120
119
  };
121
120
  }
122
- function ae(e) {
121
+ function y(t) {
123
122
  return {
124
- id: e.id,
125
- name: e.name,
126
- shortName: e.short_name ?? void 0,
127
- threeLetterCode: e.three_letter_code,
128
- slug: e.slug,
129
- type: e.type ?? "club",
130
- gender: e.gender,
131
- assets: e.assets ? {
132
- logo: e.assets.logo?.url,
133
- homeKit: e.assets.home_kit?.url,
134
- awayKit: e.assets.away_kit?.url,
135
- squadImage: e.assets.squad_image?.url
123
+ id: t.id,
124
+ name: t.name,
125
+ shortName: t.short_name ?? void 0,
126
+ threeLetterCode: t.three_letter_code,
127
+ slug: t.slug,
128
+ type: t.type ?? "club",
129
+ gender: t.gender,
130
+ assets: t.assets ? {
131
+ logo: t.assets.logo?.url,
132
+ homeKit: t.assets.home_kit?.url,
133
+ awayKit: t.assets.away_kit?.url,
134
+ squadImage: t.assets.squad_image?.url
136
135
  } : void 0,
137
- metadata: e.shirt_color ? { shirtColor: e.shirt_color } : void 0
136
+ metadata: t.shirt_color ? { shirtColor: t.shirt_color } : void 0
138
137
  };
139
138
  }
140
- function Ae(e) {
139
+ function I(t) {
141
140
  return {
142
- kickoffTime: new Date(e.kickoff_time),
143
- currentMinute: e.minute?.regular_time,
144
- phaseStartedAt: e.phase_started_at ? new Date(e.phase_started_at) : void 0,
145
- finishedAt: e.finished_at ? new Date(e.finished_at) : void 0,
146
- firstHalfStartedAt: e.first_half_started_at ? new Date(e.first_half_started_at) : void 0,
147
- secondHalfStartedAt: e.second_half_started_at ? new Date(e.second_half_started_at) : void 0,
148
- extraTimeFirstHalfStartedAt: e.extra_time_first_half_started_at ? new Date(e.extra_time_first_half_started_at) : void 0,
149
- extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
141
+ kickoffTime: new Date(t.kickoff_time),
142
+ currentMinute: t.minute?.regular_time,
143
+ phaseStartedAt: t.phase_started_at ? new Date(t.phase_started_at) : void 0,
144
+ finishedAt: t.finished_at ? new Date(t.finished_at) : void 0,
145
+ firstHalfStartedAt: t.first_half_started_at ? new Date(t.first_half_started_at) : void 0,
146
+ secondHalfStartedAt: t.second_half_started_at ? new Date(t.second_half_started_at) : void 0,
147
+ extraTimeFirstHalfStartedAt: t.extra_time_first_half_started_at ? new Date(t.extra_time_first_half_started_at) : void 0,
148
+ extraTimeSecondHalfStartedAt: t.extra_time_second_half_started_at ? new Date(t.extra_time_second_half_started_at) : void 0
150
149
  };
151
150
  }
152
- function Oe(e) {
153
- if (!e) return;
154
- const t = (r) => r ? { competitorOne: String(r.home), competitorTwo: String(r.away) } : void 0, n = e.total ?? e.regular_time;
151
+ function C(t) {
152
+ if (!t) return;
153
+ const e = (n) => n ? { competitorOne: String(n.home), competitorTwo: String(n.away) } : void 0, o = t.total ?? t.regular_time;
155
154
  return {
156
- competitorOne: n?.home != null ? String(n.home) : null,
157
- competitorTwo: n?.away != null ? String(n.away) : null,
155
+ competitorOne: o?.home != null ? String(o.home) : null,
156
+ competitorTwo: o?.away != null ? String(o.away) : null,
158
157
  breakdown: {
159
- total: t(e.total),
160
- halfTime: t(e.half_time),
161
- regularTime: t(e.regular_time),
162
- extraTime: t(e.extra_time),
163
- penaltyShootout: t(e.penalty_shootout),
164
- aggregate: t(e.aggregate)
158
+ total: e(t.total),
159
+ halfTime: e(t.half_time),
160
+ regularTime: e(t.regular_time),
161
+ extraTime: e(t.extra_time),
162
+ penaltyShootout: e(t.penalty_shootout),
163
+ aggregate: e(t.aggregate)
165
164
  }
166
165
  };
167
166
  }
168
- function be(e) {
169
- if (e)
167
+ function N(t) {
168
+ if (t)
170
169
  return {
171
- id: e.id,
172
- name: e.name,
173
- slug: e.slug,
174
- assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0
175
- };
176
- }
177
- function Re(e) {
178
- if (e?.length)
179
- return e.map((t) => ({
180
170
  id: t.id,
181
171
  name: t.name,
182
172
  slug: t.slug,
183
- role: t.role ?? "REFEREE",
184
- gender: t.gender
173
+ assets: t.assets?.image?.url ? { image: t.assets.image.url } : void 0
174
+ };
175
+ }
176
+ function b(t) {
177
+ if (t?.length)
178
+ return t.map((e) => ({
179
+ id: e.id,
180
+ name: e.name,
181
+ slug: e.slug,
182
+ role: e.role ?? "REFEREE",
183
+ gender: e.gender
185
184
  }));
186
185
  }
187
- function Ce(e) {
188
- if (!e.season?.tournament) return;
189
- const { tournament: t, ...n } = e.season;
186
+ function D(t) {
187
+ if (!t.season?.tournament) return;
188
+ const { tournament: e, ...o } = t.season;
190
189
  return {
191
- id: t.id,
192
- name: t.name,
193
- slug: t.slug,
194
- type: t.type,
195
- region: t.region,
196
- country: t.country ? {
197
- id: t.country.id,
198
- name: t.country.name,
199
- code: t.country.code ?? void 0,
200
- flag: t.country.assets?.flag?.url
190
+ id: e.id,
191
+ name: e.name,
192
+ slug: e.slug,
193
+ type: e.type,
194
+ region: e.region,
195
+ country: e.country ? {
196
+ id: e.country.id,
197
+ name: e.country.name,
198
+ code: e.country.code ?? void 0,
199
+ flag: e.country.assets?.flag?.url
201
200
  } : void 0,
202
201
  season: {
203
- id: n.id,
204
- name: n.name,
205
- status: n.status
202
+ id: o.id,
203
+ name: o.name,
204
+ status: o.status
206
205
  },
207
- stage: e.stage ? {
208
- id: e.stage.id,
209
- name: e.stage.name,
210
- type: e.stage.type
206
+ stage: t.stage ? {
207
+ id: t.stage.id,
208
+ name: t.stage.name,
209
+ type: t.stage.type
211
210
  } : void 0,
212
- assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0
211
+ assets: e.assets?.logo?.url ? { logo: e.assets.logo.url } : void 0
213
212
  };
214
213
  }
215
- function Ne(e) {
216
- if (!e.winner?.match?.id) return;
217
- const t = {
214
+ function P(t) {
215
+ if (!t.winner?.match?.id) return;
216
+ const e = {
218
217
  "Regular Time": "REGULAR_TIME",
219
218
  "Extra Time": "EXTRA_TIME",
220
219
  Penalties: "PENALTIES"
221
220
  };
222
221
  return {
223
- competitorId: e.winner.match.id,
224
- reason: e.winner.match.reason?.name ? t[e.winner.match.reason.name] : void 0,
225
- aggregate: !!e.winner.aggregate
222
+ competitorId: t.winner.match.id,
223
+ reason: t.winner.match.reason?.name ? e[t.winner.match.reason.name] : void 0,
224
+ aggregate: !!t.winner.aggregate
226
225
  };
227
226
  }
228
- function me(e) {
227
+ function S(t) {
229
228
  return {
230
- id: e.id,
231
- slug: e.slug,
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),
237
- round: e.round ? {
238
- id: e.round.id ?? e.round.key,
239
- key: e.round.key,
240
- name: e.round.name,
241
- type: e.round.type ?? "REGULAR"
229
+ id: t.id,
230
+ slug: t.slug,
231
+ status: k(t.status),
232
+ timing: I(t),
233
+ competitorOne: y(t.home_team),
234
+ competitorTwo: y(t.away_team),
235
+ competition: D(t),
236
+ round: t.round ? {
237
+ id: t.round.id ?? t.round.key,
238
+ key: t.round.key,
239
+ name: t.round.name,
240
+ type: t.round.type ?? "REGULAR"
242
241
  } : void 0,
243
- group: e.group ? {
244
- id: e.group.id,
245
- name: e.group.name
242
+ group: t.group ? {
243
+ id: t.group.id,
244
+ name: t.group.name
246
245
  } : void 0,
247
- venue: be(e.venue),
248
- officials: Re(e.referees),
249
- spectators: e.spectators ?? void 0,
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),
254
- coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
255
- lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status
246
+ venue: N(t.venue),
247
+ officials: b(t.referees),
248
+ spectators: t.spectators ?? void 0,
249
+ score: C(t.score),
250
+ mainEvents: t.main_events?.map(g).filter((e) => e !== null),
251
+ penaltyShootoutEvents: t.penalty_shootout_events?.map(g).filter((e) => e !== null),
252
+ winner: P(t),
253
+ coverage: t.coverage === "NOT_LIVE" ? "UNKNOWN" : t.coverage,
254
+ lineupStatus: t.lineup_status === "UNCONFIRMED" ? "EXPECTED" : t.lineup_status
256
255
  };
257
256
  }
258
- function Le(e) {
259
- const t = e.player;
257
+ function R(t) {
258
+ const e = t.player;
260
259
  return {
261
- id: t.id,
262
- name: t.name,
263
- slug: t.slug,
264
- position: t.position,
265
- shirtNumber: e.shirt_number,
266
- positionX: e.position_x ?? void 0,
267
- positionY: e.position_y ?? void 0,
268
- country: t.country ? {
269
- id: t.country.id,
270
- name: t.country.name,
271
- code: t.country.code
260
+ id: e.id,
261
+ name: e.name,
262
+ slug: e.slug,
263
+ position: e.position,
264
+ shirtNumber: t.shirt_number,
265
+ positionX: t.position_x ?? void 0,
266
+ positionY: t.position_y ?? void 0,
267
+ country: e.country ? {
268
+ id: e.country.id,
269
+ name: e.country.name,
270
+ code: e.country.code
272
271
  } : void 0,
273
- birthdate: t.birthdate,
274
- profile: t.profile ? {
275
- height: t.profile.height,
276
- weight: t.profile.weight
272
+ birthdate: e.birthdate,
273
+ profile: e.profile ? {
274
+ height: e.profile.height,
275
+ weight: e.profile.weight
277
276
  } : void 0,
278
- events: e.events?.map(J).filter((n) => n !== null)
277
+ events: t.events?.map(g).filter((o) => o !== null)
279
278
  };
280
279
  }
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);
280
+ function h(t) {
281
+ const e = [], o = [];
282
+ for (const n of t.players) {
283
+ const s = R(n);
284
+ n.type.category === "start" ? e.push(s) : n.type.category === "sub" && o.push(s);
286
285
  }
287
286
  return {
288
- competitorId: e.team_id,
289
- formation: e.formation,
290
- coach: e.coach ? {
291
- id: e.coach.id,
292
- name: e.coach.name,
293
- slug: e.coach.slug,
294
- country: e.coach.country ? {
295
- id: e.coach.country.id,
296
- name: e.coach.country.name,
297
- code: e.coach.country.code
287
+ competitorId: t.team_id,
288
+ formation: t.formation,
289
+ coach: t.coach ? {
290
+ id: t.coach.id,
291
+ name: t.coach.name,
292
+ slug: t.coach.slug,
293
+ country: t.coach.country ? {
294
+ id: t.coach.country.id,
295
+ name: t.coach.country.name,
296
+ code: t.coach.country.code
298
297
  } : void 0,
299
- birthdate: e.coach.birthdate
298
+ birthdate: t.coach.birthdate
300
299
  } : void 0,
301
- starters: t,
302
- substitutes: n
300
+ starters: e,
301
+ substitutes: o
303
302
  };
304
303
  }
305
- function Pe(e) {
304
+ function F(t) {
306
305
  return {
307
- matchId: e.match_id,
308
- confirmed: e.status === "CONFIRMED",
309
- competitorOne: se(e.home_team),
310
- competitorTwo: se(e.away_team)
306
+ matchId: t.match_id,
307
+ confirmed: t.status === "CONFIRMED",
308
+ competitorOne: h(t.home_team),
309
+ competitorTwo: h(t.away_team)
311
310
  };
312
311
  }
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")
312
+ function r(t, e, o, n) {
313
+ return e == null ? null : { key: t, value: String(e), label: o, unit: n };
314
+ }
315
+ function E(t, e) {
316
+ const o = (e.shots_on ?? 0) + (e.shots_off ?? 0) + (e.shots_blocked ?? 0), n = [
317
+ r("possession", e.possession, "Possession", "%"),
318
+ r("shots_total", o, "Shots"),
319
+ r("shots_on_target", e.shots_on, "Shots on Target"),
320
+ r("shots_off_target", e.shots_off, "Shots off Target"),
321
+ r("shots_blocked", e.shots_blocked, "Shots Blocked"),
322
+ r("corners", e.corners, "Corner Kicks"),
323
+ r("goal_kicks", e.goal_kicks, "Goal Kicks"),
324
+ r("throw_ins", e.throw_in, "Throw Ins"),
325
+ r("offsides", e.offside, "Offsides"),
326
+ r("fouls", e.fouls_committed, "Fouls"),
327
+ r("yellow_cards", e.yellow_cards, "Yellow Cards"),
328
+ r("passes", e.pass, "Passes"),
329
+ r("crosses", e.crosses, "Crosses")
331
330
  ];
332
331
  return {
333
- competitorId: e,
334
- statistics: r.filter((a) => a !== null)
332
+ competitorId: t,
333
+ statistics: n.filter((s) => s !== null)
335
334
  };
336
335
  }
337
- function Ie(e) {
338
- const t = e.find((r) => r.home_team), n = e.find((r) => !r.home_team);
339
- if (!t || !n)
336
+ function M(t) {
337
+ const e = t.find((n) => n.home_team), o = t.find((n) => !n.home_team);
338
+ if (!e || !o)
340
339
  throw new Error("Missing competitor statistics");
341
340
  return {
342
- competitorOne: ie(String(t.team.id), t.statistics),
343
- competitorTwo: ie(String(n.team.id), n.statistics)
341
+ competitorOne: E(String(e.team.id), e.statistics),
342
+ competitorTwo: E(String(o.team.id), o.statistics)
344
343
  };
345
344
  }
346
- function De(e) {
347
- const t = e.urls?.find((n) => n.app_type === "desktop")?.url;
345
+ function U(t) {
346
+ const e = t.urls?.find((o) => o.app_type === "desktop")?.url;
348
347
  return {
349
- id: e.id,
350
- name: e.name,
351
- code: e.code,
352
- value: e.value ?? void 0,
353
- odds: e.odds,
354
- oddsOld: e.odds_old,
355
- movement: e.movement === "STABLE" ? "NONE" : e.movement,
356
- url: t
348
+ id: t.id,
349
+ name: t.name,
350
+ code: t.code,
351
+ value: t.value ?? void 0,
352
+ odds: t.odds,
353
+ oddsOld: t.odds_old,
354
+ movement: t.movement === "STABLE" ? "NONE" : t.movement,
355
+ url: e
357
356
  };
358
357
  }
359
- function xe(e) {
358
+ function $(t) {
360
359
  return {
361
360
  type: {
362
- id: e.type.id,
363
- code: e.type.code,
364
- name: e.type.name
361
+ id: t.type.id,
362
+ code: t.type.code,
363
+ name: t.type.name
365
364
  },
366
365
  period: {
367
- id: e.scope.id,
368
- type: e.scope.type,
369
- name: e.scope.name
366
+ id: t.scope.id,
367
+ type: t.scope.type,
368
+ name: t.scope.name
370
369
  },
371
- selections: e.selections.map(De)
370
+ selections: t.selections.map(U)
372
371
  };
373
372
  }
374
- function Me(e) {
373
+ function Y(t) {
375
374
  return {
376
375
  operator: {
377
- id: e.bookmaker.id,
378
- name: e.bookmaker.name,
379
- url: e.bookmaker.url,
380
- branding: e.bookmaker.branding ? {
381
- backgroundColor: e.bookmaker.branding.background_color,
382
- textColor: e.bookmaker.branding.text_color,
383
- logo: e.bookmaker.assets?.[0]?.logo
376
+ id: t.bookmaker.id,
377
+ name: t.bookmaker.name,
378
+ url: t.bookmaker.url,
379
+ branding: t.bookmaker.branding ? {
380
+ backgroundColor: t.bookmaker.branding.background_color,
381
+ textColor: t.bookmaker.branding.text_color,
382
+ logo: t.bookmaker.assets?.[0]?.logo
384
383
  } : void 0
385
384
  },
386
- type: e.type,
387
- markets: e.markets.map(xe)
385
+ type: t.type,
386
+ markets: t.markets.map($)
388
387
  };
389
388
  }
390
- function Fe(e, t) {
389
+ function G(t, e) {
391
390
  return {
392
- matchId: e,
393
- operators: t.map(Me)
391
+ matchId: t,
392
+ operators: e.map(Y)
394
393
  };
395
394
  }
396
- function ce(e) {
397
- if (e == null || e === "")
395
+ function T(t) {
396
+ if (t == null || t === "")
398
397
  return;
399
- const t = typeof e == "number" ? e : parseInt(e, 10);
400
- return isNaN(t) ? void 0 : t;
398
+ const e = typeof t == "number" ? t : parseInt(t, 10);
399
+ return isNaN(e) ? void 0 : e;
401
400
  }
402
- function je(e) {
401
+ function H(t) {
403
402
  return {
404
- externalId: e.external_id,
405
- minute: ce(e.elapsed),
406
- addedTime: ce(e.elapsed_plus),
407
- text: e.auto_text,
408
- details: e.details,
403
+ externalId: t.external_id,
404
+ minute: T(t.elapsed),
405
+ addedTime: T(t.elapsed_plus),
406
+ text: t.auto_text,
407
+ details: t.details,
409
408
  meta: {
410
- type: e.type,
411
- commentaryType: e.commentary_type,
412
- subtype1: e.subtype_1,
413
- subtype2: e.subtype_2,
414
- timestamp: e.incident_timestamp
409
+ type: t.type,
410
+ commentaryType: t.commentary_type,
411
+ subtype1: t.subtype_1,
412
+ subtype2: t.subtype_2,
413
+ timestamp: t.incident_timestamp
415
414
  }
416
415
  };
417
416
  }
418
- async function ot(e, t = {}) {
419
- const { sportal365Sports: n } = T(), r = await O.get({
420
- path: `/v2/matches/${e}`,
417
+ async function tt(t, e = {}) {
418
+ const { sportal365Sports: o } = i(), n = await u.get({
419
+ path: `/v2/matches/${t}`,
421
420
  params: {
422
- language_code: t.languageCode ?? n?.languageCode ?? "en",
423
- odd_client: t.oddClient,
424
- odd_type: t.oddType,
425
- scope_type: t.scopeType,
426
- odd_format: t.oddFormat,
427
- market_types: t.marketTypes,
428
- bookmaker_ids: t.bookmakerIds,
429
- optional_data: t.optionalData
421
+ language_code: e.languageCode ?? o?.languageCode ?? "en",
422
+ odd_client: e.oddClient,
423
+ odd_type: e.oddType,
424
+ scope_type: e.scopeType,
425
+ odd_format: e.oddFormat,
426
+ market_types: e.marketTypes,
427
+ bookmaker_ids: e.bookmakerIds,
428
+ optional_data: e.optionalData
430
429
  }
431
430
  });
432
- return me(r);
431
+ return S(n);
433
432
  }
434
- async function nt(e, t = {}) {
435
- const { sportal365Sports: n } = T();
436
- return (await O.get({
437
- path: `/v2/matches/${e}/events`,
433
+ async function et(t, e = {}) {
434
+ const { sportal365Sports: o } = i();
435
+ return (await u.get({
436
+ path: `/v2/matches/${t}/events`,
438
437
  params: {
439
- language_code: t.languageCode ?? n?.languageCode ?? "en"
438
+ language_code: e.languageCode ?? o?.languageCode ?? "en"
440
439
  }
441
- })).events.map(J).filter((a) => a !== null);
440
+ })).events.map(g).filter((s) => s !== null);
442
441
  }
443
- async function rt(e, t = {}) {
444
- const { sportal365Sports: n } = T(), r = await O.get({
445
- path: `/v2/matches/${e}/lineups`,
442
+ async function ot(t, e = {}) {
443
+ const { sportal365Sports: o } = i(), n = await u.get({
444
+ path: `/v2/matches/${t}/lineups`,
446
445
  params: {
447
- language_code: t.languageCode ?? n?.languageCode ?? "en"
446
+ language_code: e.languageCode ?? o?.languageCode ?? "en"
448
447
  }
449
448
  });
450
- return Pe(r);
449
+ return F(n);
451
450
  }
452
- async function at(e, t = {}) {
453
- const { sportal365Sports: n } = T(), r = await O.get({
454
- path: `/v2/matches/${e}`,
451
+ async function nt(t, e = {}) {
452
+ const { sportal365Sports: o } = i(), n = await u.get({
453
+ path: `/v2/matches/${t}`,
455
454
  params: {
456
- language_code: t.languageCode ?? n?.languageCode ?? "en",
457
- odd_client: t.oddClient ?? n?.oddClient,
458
- odd_type: t.oddType,
459
- scope_type: t.scopeType ?? "ALL",
460
- odd_format: t.oddFormat ?? "DECIMAL",
461
- market_types: t.marketTypes,
462
- bookmaker_ids: t.bookmakerIds
455
+ language_code: e.languageCode ?? o?.languageCode ?? "en",
456
+ odd_client: e.oddClient ?? o?.oddClient,
457
+ odd_type: e.oddType,
458
+ scope_type: e.scopeType ?? "ALL",
459
+ odd_format: e.oddFormat ?? "DECIMAL",
460
+ market_types: e.marketTypes,
461
+ bookmaker_ids: e.bookmakerIds
463
462
  }
464
463
  });
465
- return Fe(e, r.odds ?? []);
464
+ return G(t, n.odds ?? []);
466
465
  }
467
- async function st(e, t = {}) {
468
- const { sportal365Sports: n } = T(), r = await O.get({
469
- path: `/events/${e}/teamstats`,
466
+ async function st(t, e = {}) {
467
+ const { sportal365Sports: o } = i(), n = await u.get({
468
+ path: `/events/${t}/teamstats`,
470
469
  params: {
471
- language_code: t.languageCode ?? n?.languageCode ?? "en"
470
+ language_code: e.languageCode ?? o?.languageCode ?? "en"
472
471
  }
473
472
  });
474
- return Ie(r);
473
+ return M(n);
475
474
  }
476
- async function it(e, t = {}) {
477
- const { sportal365Sports: n } = T();
478
- return (await O.get({
479
- path: `/matches/${e}/commentary`,
475
+ async function at(t, e = {}) {
476
+ const { sportal365Sports: o } = i();
477
+ return (await u.get({
478
+ path: `/matches/${t}/commentary`,
480
479
  params: {
481
- language_code: t.languageCode ?? n?.languageCode ?? "en"
480
+ language_code: e.languageCode ?? o?.languageCode ?? "en"
482
481
  }
483
- })).map(je);
482
+ })).map(H);
484
483
  }
485
- async function ct(e) {
486
- const { sportal365Sports: t } = T();
487
- return (await O.get({
484
+ async function rt(t) {
485
+ const { sportal365Sports: e } = i();
486
+ return (await u.get({
488
487
  path: "/v2/matches",
489
488
  params: {
490
- language_code: e.languageCode ?? t?.languageCode ?? "en",
491
- limit: e.limit.toString(),
492
- offset: e.offset.toString(),
489
+ language_code: t.languageCode ?? e?.languageCode ?? "en",
490
+ limit: t.limit.toString(),
491
+ offset: t.offset.toString(),
493
492
  // Competition filters
494
- tournament_ids: e.tournamentIds,
495
- season_ids: e.seasonIds,
496
- stage_ids: e.stageIds,
497
- group_ids: e.groupIds,
498
- round_ids: e.roundIds,
499
- round_filter: e.roundFilter,
493
+ tournament_ids: t.tournamentIds,
494
+ season_ids: t.seasonIds,
495
+ stage_ids: t.stageIds,
496
+ group_ids: t.groupIds,
497
+ round_ids: t.roundIds,
498
+ round_filter: t.roundFilter,
500
499
  // Time filters
501
- from_kickoff_time: e.fromKickoffTime,
502
- to_kickoff_time: e.toKickoffTime,
500
+ from_kickoff_time: t.fromKickoffTime,
501
+ to_kickoff_time: t.toKickoffTime,
503
502
  // Entity filters
504
- team_ids: e.teamIds,
505
- team_ids_operator: e.teamIdsOperator,
506
- referee_id: e.refereeId,
507
- venue_id: e.venueId,
508
- player_id: e.playerId,
503
+ team_ids: t.teamIds,
504
+ team_ids_operator: t.teamIdsOperator,
505
+ referee_id: t.refereeId,
506
+ venue_id: t.venueId,
507
+ player_id: t.playerId,
509
508
  // Status filters
510
- status_types: e.statusTypes,
511
- status_codes: e.statusCodes,
509
+ status_types: t.statusTypes,
510
+ status_codes: t.statusCodes,
512
511
  // Odds
513
- odd_client: e.oddClient ?? t?.oddClient,
514
- odd_type: e.oddType,
515
- scope_type: e.scopeType,
516
- odd_format: e.oddFormat,
517
- market_types: e.marketTypes,
518
- bookmaker_ids: e.bookmakerIds,
512
+ odd_client: t.oddClient ?? e?.oddClient,
513
+ odd_type: t.oddType,
514
+ scope_type: t.scopeType,
515
+ odd_format: t.oddFormat,
516
+ market_types: t.marketTypes,
517
+ bookmaker_ids: t.bookmakerIds,
519
518
  // Sorting and optional data
520
- sort_direction: e.sortDirection,
521
- optional_data: e.optionalData
519
+ sort_direction: t.sortDirection,
520
+ optional_data: t.optionalData
522
521
  }
523
- })).matches.map(me);
522
+ })).matches.map(S);
524
523
  }
525
- function Ye(e) {
524
+ function x(t) {
526
525
  return {
527
- id: e.id,
528
- name: e.name,
529
- shortName: e.short_name ?? void 0,
530
- threeLetterCode: e.three_letter_code,
531
- slug: e.slug,
532
- type: e.type === "placeholder" ? "club" : e.type,
533
- gender: e.gender,
534
- country: e.country ? {
535
- id: e.country.id,
536
- name: e.country.name,
537
- code: e.country.code ?? void 0,
538
- flag: e.country.assets?.flag?.url
526
+ id: t.id,
527
+ name: t.name,
528
+ shortName: t.short_name ?? void 0,
529
+ threeLetterCode: t.three_letter_code,
530
+ slug: t.slug,
531
+ type: t.type === "placeholder" ? "club" : t.type,
532
+ gender: t.gender,
533
+ country: t.country ? {
534
+ id: t.country.id,
535
+ name: t.country.name,
536
+ code: t.country.code ?? void 0,
537
+ flag: t.country.assets?.flag?.url
539
538
  } : void 0,
540
- assets: e.assets ? {
541
- logo: e.assets.logo?.url,
542
- homeKit: e.assets.home_kit?.url,
543
- awayKit: e.assets.away_kit?.url,
544
- squadImage: e.assets.squad_image?.url
539
+ assets: t.assets ? {
540
+ logo: t.assets.logo?.url,
541
+ homeKit: t.assets.home_kit?.url,
542
+ awayKit: t.assets.away_kit?.url,
543
+ squadImage: t.assets.squad_image?.url
545
544
  } : void 0
546
545
  };
547
546
  }
548
- async function ut(e, t = {}) {
549
- const { sportal365Sports: n } = T(), r = await O.get({
550
- path: `/v2/teams/${e}`,
547
+ async function it(t, e = {}) {
548
+ const { sportal365Sports: o } = i(), n = await u.get({
549
+ path: `/v2/teams/${t}`,
551
550
  params: {
552
- language_code: t.languageCode ?? n?.languageCode ?? "en",
551
+ language_code: e.languageCode ?? o?.languageCode ?? "en",
553
552
  optional_data: "form"
554
553
  }
555
554
  });
556
- return Ye(r);
555
+ return x(n);
557
556
  }
558
- const $e = ve.replace(/\/$/, "");
559
- function Ue() {
560
- const { sportal365Sports: e } = T();
561
- if (!e)
557
+ const K = v.replace(/\/$/, "");
558
+ function W() {
559
+ const { sportal365Sports: t } = i();
560
+ if (!t)
562
561
  throw new Error("Sportal365 Sports API configuration is missing");
563
- const t = `${e.username}:${e.password}`;
564
- return `Basic ${btoa(t)}`;
562
+ const e = `${t.username}:${t.password}`;
563
+ return `Basic ${btoa(e)}`;
565
564
  }
566
- function We(e) {
567
- return `${$e}${e}`;
565
+ function j(t) {
566
+ return `${K}${t}`;
568
567
  }
569
- const Ge = {
570
- async get(e) {
571
- const { sportal365Sports: t } = T();
572
- if (!t)
568
+ const B = {
569
+ async get(t) {
570
+ const { sportal365Sports: e } = i();
571
+ if (!e)
573
572
  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(), {
573
+ const o = new URL(j(t.path));
574
+ if (t.params)
575
+ for (const [s, a] of Object.entries(t.params))
576
+ a !== void 0 && (Array.isArray(a) ? a.length > 0 && o.searchParams.set(s, a.join(",")) : o.searchParams.set(s, a));
577
+ const n = await fetch(o.toString(), {
579
578
  method: "GET",
580
579
  headers: {
581
- Authorization: Ue(),
580
+ Authorization: W(),
582
581
  "Content-Type": "application/json",
583
- "X-Project": t.projectId
582
+ "X-Project": e.projectId
584
583
  // Standings API uses X-Project
585
584
  },
586
- signal: t.timeout ? AbortSignal.timeout(t.timeout) : void 0
585
+ signal: e.timeout ? AbortSignal.timeout(e.timeout) : void 0
587
586
  });
588
- if (!r.ok) {
589
- const a = await r.text();
590
- throw new Error(`Sportal365 Standings API error: ${r.status} ${r.statusText} - ${a}`);
587
+ if (!n.ok) {
588
+ const s = await n.text();
589
+ throw new Error(`Sportal365 Standings API error: ${n.status} ${n.statusText} - ${s}`);
591
590
  }
592
- return r.json();
591
+ return n.json();
593
592
  }
594
593
  };
595
- function He(e) {
594
+ function V(t) {
596
595
  return {
597
596
  RANK: "rank",
598
597
  PLAYED: "played",
@@ -603,9 +602,9 @@ function He(e) {
603
602
  GOALS_AGAINST: "goalsAgainst",
604
603
  GOAL_DIFFERENCE: "goalDifference",
605
604
  POINTS: "points"
606
- }[e] ?? e.toLowerCase();
605
+ }[t] ?? t.toLowerCase();
607
606
  }
608
- function w(e) {
607
+ function _(t) {
609
608
  return {
610
609
  CHAMPIONS_LEAGUE: "championsLeague",
611
610
  EUROPA_LEAGUE: "europaLeague",
@@ -613,10 +612,10 @@ function w(e) {
613
612
  RELEGATION: "relegation",
614
613
  PLAYOFF: "playoff",
615
614
  PROMOTION: "promotion"
616
- }[e] ?? e.toLowerCase().replace(/_/g, "");
615
+ }[t] ?? t.toLowerCase().replace(/_/g, "");
617
616
  }
618
- function Be(e) {
619
- switch (e) {
617
+ function X(t) {
618
+ switch (t) {
620
619
  case "win":
621
620
  return "W";
622
621
  case "loss":
@@ -625,490 +624,103 @@ function Be(e) {
625
624
  return "D";
626
625
  }
627
626
  }
628
- function Ke(e, t) {
629
- if (!t || t.length === 0)
627
+ function q(t, e) {
628
+ if (!e || e.length === 0)
630
629
  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;
630
+ const o = e.map((s) => {
631
+ const a = s.participants.find((c) => c.id !== t) ?? s.participants[0], d = s.result?.[0]?.results?.map((c) => c.value).join("-") ?? void 0;
633
632
  return {
634
- matchId: a.id,
635
- result: Be(a.outcome),
636
- score: m,
633
+ matchId: s.id,
634
+ result: X(s.outcome),
635
+ score: d,
637
636
  opponent: {
638
- id: s.id,
639
- name: s.name,
640
- logo: s.display_asset?.url ?? s.assets?.logo?.url
637
+ id: a.id,
638
+ name: a.name,
639
+ logo: a.display_asset?.url ?? a.assets?.logo?.url
641
640
  },
642
- date: new Date(a.start_time),
643
- competition: a.competition ? {
644
- id: a.competition.id,
645
- name: a.competition.name
641
+ date: new Date(s.start_time),
642
+ competition: s.competition ? {
643
+ id: s.competition.id,
644
+ name: s.competition.name
646
645
  } : void 0
647
646
  };
648
- }), r = n.map((a) => a.result).join("");
647
+ }), n = o.map((s) => s.result).join("");
649
648
  return {
650
- competitorId: e,
651
- results: n,
652
- formString: r
649
+ competitorId: t,
650
+ results: o,
651
+ formString: n
653
652
  };
654
653
  }
655
- function Ve(e) {
654
+ function z(t) {
656
655
  return {
657
- key: w(e.standing_api_rule_type),
658
- name: e.name,
659
- position: e.type
656
+ key: _(t.standing_api_rule_type),
657
+ name: t.name,
658
+ position: t.type
660
659
  };
661
660
  }
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;
661
+ function J(t) {
662
+ const e = {};
663
+ let o = 0;
664
+ for (const d of t.columns) {
665
+ const c = V(d.type.code), l = parseInt(d.value, 10);
666
+ d.type.code === "RANK" ? o = l : e[c] = isNaN(l) ? void 0 : l;
668
667
  }
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;
668
+ const n = t.rules?.length > 0 ? t.rules.map((d) => _(d.standing_api_rule_type)) : void 0, s = q(t.team.id, t.form), a = t.team.assets?.logo?.url;
670
669
  return {
671
- rank: n,
670
+ rank: o,
672
671
  competitor: {
673
- id: e.team.id,
674
- name: e.team.name,
675
- shortName: e.team.short_name ?? void 0,
676
- logo: s
672
+ id: t.team.id,
673
+ name: t.team.name,
674
+ shortName: t.team.short_name ?? void 0,
675
+ logo: a
677
676
  },
678
- stats: t,
679
- form: a,
680
- rules: r
677
+ stats: e,
678
+ form: s,
679
+ rules: n
681
680
  };
682
681
  }
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));
682
+ function Q(t) {
683
+ const e = t.map(J), o = /* @__PURE__ */ new Map();
684
+ for (const n of t)
685
+ if (n.rules)
686
+ for (const s of n.rules) {
687
+ const a = _(s.standing_api_rule_type);
688
+ o.has(a) || o.set(a, z(s));
690
689
  }
691
690
  return {
692
- entries: t,
691
+ entries: e,
693
692
  metadata: {
694
- legend: Array.from(n.values())
693
+ legend: Array.from(o.values())
695
694
  }
696
695
  };
697
696
  }
698
- async function lt(e) {
699
- const n = (await Ge.get({
697
+ async function dt(t) {
698
+ const o = (await B.get({
700
699
  path: "/standings/football",
701
700
  params: {
702
- stage_id: e.stageId,
703
- coverage_type: e.coverageType ?? "ALL",
704
- optional_data: e.optionalData
701
+ stage_id: t.stageId,
702
+ coverage_type: t.coverageType ?? "ALL",
703
+ optional_data: t.optionalData
705
704
  }
706
705
  })).data?.[0];
707
- if (!n?.standings?.length)
706
+ if (!o?.standings?.length)
708
707
  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;
717
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
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, {
726
- $$typeof: e,
727
- type: r,
728
- key: m,
729
- ref: a !== void 0 ? a : null,
730
- props: s
731
- };
732
- }
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:
746
- return "Fragment";
747
- case j:
748
- return "Profiler";
749
- case F:
750
- return "StrictMode";
751
- case U:
752
- return "Suspense";
753
- case W:
754
- return "SuspenseList";
755
- case H:
756
- return "Activity";
757
- }
758
- if (typeof o == "object")
759
- switch (typeof o.tag == "number" && console.error(
760
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
761
- ), o.$$typeof) {
762
- case M:
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;
775
- try {
776
- return e(o(i));
777
- } catch {
778
- }
779
- }
780
- return null;
781
- }
782
- function t(o) {
783
- return "" + o;
784
- }
785
- function n(o) {
786
- try {
787
- t(o);
788
- var i = !1;
789
- } catch {
790
- i = !0;
791
- }
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,
797
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
798
- g
799
- ), t(o);
800
- }
801
- }
802
- function r(o) {
803
- if (o === R) return "<>";
804
- if (typeof o == "object" && o !== null && o.$$typeof === C)
805
- return "<...>";
806
- try {
807
- var i = e(o);
808
- return i ? "<" + i + ">" : "<...>";
809
- } catch {
810
- return "<...>";
811
- }
812
- }
813
- function a() {
814
- var o = P.A;
815
- return o === null ? null : o.getOwner();
816
- }
817
- function s() {
818
- return Error("react-stack-top-frame");
819
- }
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;
824
- }
825
- return o.key !== void 0;
826
- }
827
- function p(o, i) {
828
- function l() {
829
- E || (E = !0, console.error(
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)",
831
- i
832
- ));
833
- }
834
- l.isReactWarning = !0, Object.defineProperty(o, "key", {
835
- get: l,
836
- configurable: !0
837
- });
838
- }
839
- function v() {
840
- var o = e(this.type);
841
- return K[o] || (K[o] = !0, console.error(
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."
843
- )), o = this.props.ref, o !== void 0 ? o : null;
844
- }
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", {
854
- enumerable: !1,
855
- get: v
856
- }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
857
- configurable: !1,
858
- enumerable: !1,
859
- writable: !0,
860
- value: 0
861
- }), Object.defineProperty(o, "_debugInfo", {
862
- configurable: !1,
863
- enumerable: !1,
864
- writable: !0,
865
- value: null
866
- }), Object.defineProperty(o, "_debugStack", {
867
- configurable: !1,
868
- enumerable: !1,
869
- writable: !0,
870
- value: V
871
- }), Object.defineProperty(o, "_debugTask", {
872
- configurable: !1,
873
- enumerable: !1,
874
- writable: !0,
875
- value: X
876
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
877
- }
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(_);
886
- } else
887
- console.error(
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."
889
- );
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";
895
- });
896
- g = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", oe[_ + g] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
897
- `A props object containing a "key" prop is being spread into JSX:
898
- let props = %s;
899
- <%s {...props} />
900
- React keys must be passed directly to JSX without using spread:
901
- let props = %s;
902
- <%s key={someKey} {...props} />`,
903
- g,
904
- _,
905
- N,
906
- _
907
- ), oe[_ + g] = !0);
908
- }
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
924
- );
925
- }
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));
928
- }
929
- function S(o) {
930
- return typeof o == "object" && o !== null && o.$$typeof === L;
931
- }
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() {
933
- return null;
934
- };
935
- b = {
936
- react_stack_bottom_frame: function(o) {
937
- return o();
938
- }
939
- };
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++;
946
- return d(
947
- o,
948
- i,
949
- l,
950
- !1,
951
- g ? Error("react-stack-top-frame") : ee,
952
- g ? f(r(o)) : te
953
- );
954
- }, D.jsxs = function(o, i, l) {
955
- var g = 1e4 > P.recentlyCreatedOwnerStacks++;
956
- return d(
957
- o,
958
- i,
959
- l,
960
- !0,
961
- g ? Error("react-stack-top-frame") : ee,
962
- g ? f(r(o)) : te
963
- );
964
- };
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());
1017
- },
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());
1023
- },
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
1070
- }),
1071
- [
1072
- e,
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 });
708
+ const n = o.standings[0];
709
+ return n?.standing?.length ? Q(n.standing) : { entries: [], metadata: { legend: [] } };
1096
710
  }
1097
- const ft = "0.0.2";
711
+ const ct = "0.0.2";
1098
712
  export {
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,
713
+ i as getConfig,
714
+ tt as getFootballMatch,
715
+ at as getFootballMatchCommentary,
716
+ et as getFootballMatchEvents,
717
+ ot as getFootballMatchLineups,
718
+ nt as getFootballMatchOdds,
1106
719
  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
720
+ rt as getFootballMatches,
721
+ dt as getFootballStandings,
722
+ it as getFootballTeam,
723
+ w as isConfigured,
724
+ Z as setConfig,
725
+ ct as version
1114
726
  };