fansunited-data-layer 0.12.1 → 0.13.0

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 (28) hide show
  1. package/api/sportal365-sports/football/index.d.ts +2 -2
  2. package/api/sportal365-sports/football/index.d.ts.map +1 -1
  3. package/api/sportal365-sports/football/statistics/index.d.ts +46 -1
  4. package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -1
  5. package/api/sportal365-sports/football/statistics/player-career.transformer.d.ts +11 -0
  6. package/api/sportal365-sports/football/statistics/player-career.transformer.d.ts.map +1 -0
  7. package/api/sportal365-sports/football/statistics/player-career.types.d.ts +115 -0
  8. package/api/sportal365-sports/football/statistics/player-career.types.d.ts.map +1 -0
  9. package/api/sportal365-sports/football/statistics/player-recent.transformer.d.ts +11 -0
  10. package/api/sportal365-sports/football/statistics/player-recent.transformer.d.ts.map +1 -0
  11. package/api/sportal365-sports/football/statistics/player-recent.types.d.ts +31 -0
  12. package/api/sportal365-sports/football/statistics/player-recent.types.d.ts.map +1 -0
  13. package/api/sportal365-sports/index.d.ts +2 -2
  14. package/api/sportal365-sports/index.d.ts.map +1 -1
  15. package/client.cjs +1 -1
  16. package/client.js +2 -2
  17. package/fansunited-data-layer.cjs +1 -1
  18. package/fansunited-data-layer.js +15 -13
  19. package/index.d.ts +3 -3
  20. package/index.d.ts.map +1 -1
  21. package/{matches-CB-dSXEA.js → matches-BvHU-bP0.js} +721 -559
  22. package/matches-Ci0Ci_Mw.cjs +1 -0
  23. package/package.json +1 -1
  24. package/types/canonical/index.d.ts +1 -1
  25. package/types/canonical/index.d.ts.map +1 -1
  26. package/types/canonical/statistics.types.d.ts +102 -0
  27. package/types/canonical/statistics.types.d.ts.map +1 -1
  28. package/matches-DvC2VSyO.cjs +0 -1
@@ -1,58 +1,58 @@
1
- const A = "__FANSUNITED_DATA_LAYER_CONFIG__";
2
- function Le(e) {
3
- globalThis[A] = e;
1
+ const E = "__FANSUNITED_DATA_LAYER_CONFIG__";
2
+ function xe(e) {
3
+ globalThis[E] = e;
4
4
  }
5
5
  function g() {
6
- const e = globalThis[A];
6
+ const e = globalThis[E];
7
7
  if (!e)
8
8
  throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");
9
9
  return e;
10
10
  }
11
- function ke() {
12
- return globalThis[A] !== void 0;
11
+ function Me() {
12
+ return globalThis[E] !== void 0;
13
13
  }
14
- function U(e) {
14
+ function $(e) {
15
15
  const t = e.replace(/\/$/, "");
16
- function n(s) {
17
- const { sportal365Sports: a } = s;
16
+ function s(o) {
17
+ const { sportal365Sports: a } = o;
18
18
  if (!a)
19
19
  throw new Error("Sportal365 Sports API configuration is missing");
20
- const l = `${a.username}:${a.password}`;
21
- return `Basic ${btoa(l)}`;
20
+ const c = `${a.username}:${a.password}`;
21
+ return `Basic ${btoa(c)}`;
22
22
  }
23
- function o(s) {
24
- return `${t}${s}`;
23
+ function n(o) {
24
+ return `${t}${o}`;
25
25
  }
26
26
  return {
27
- async get(s) {
28
- const a = s.config || g(), { sportal365Sports: l } = a;
29
- if (!l)
27
+ async get(o) {
28
+ const a = o.config || g(), { sportal365Sports: c } = a;
29
+ if (!c)
30
30
  throw new Error("Sportal365 Sports API configuration is missing");
31
- const d = new URL(o(s.path));
32
- if (s.params)
33
- for (const [_, m] of Object.entries(s.params))
34
- m !== void 0 && (Array.isArray(m) ? m.length > 0 && d.searchParams.set(_, m.join(",")) : d.searchParams.set(_, m));
35
- const u = await fetch(d.toString(), {
31
+ const r = new URL(n(o.path));
32
+ if (o.params)
33
+ for (const [f, m] of Object.entries(o.params))
34
+ m !== void 0 && (Array.isArray(m) ? m.length > 0 && r.searchParams.set(f, m.join(",")) : r.searchParams.set(f, m));
35
+ const d = await fetch(r.toString(), {
36
36
  method: "GET",
37
37
  headers: {
38
- Authorization: n(a),
38
+ Authorization: s(a),
39
39
  "Content-Type": "application/json",
40
- "X-Project": l.projectId,
40
+ "X-Project": c.projectId,
41
41
  // Merge custom headers (they can override defaults)
42
- ...s.headers
42
+ ...o.headers
43
43
  },
44
- signal: l.timeout ? AbortSignal.timeout(l.timeout) : void 0,
44
+ signal: c.timeout ? AbortSignal.timeout(c.timeout) : void 0,
45
45
  // Next.js cache options for ISR/on-demand revalidation
46
- ...s.next && { next: s.next }
46
+ ...o.next && { next: o.next }
47
47
  });
48
- if (!u.ok)
49
- throw new Error(`Sportal365 API error: ${u.status} ${u.statusText}`);
50
- return u.json();
48
+ if (!d.ok)
49
+ throw new Error(`Sportal365 API error: ${d.status} ${d.statusText}`);
50
+ return d.json();
51
51
  }
52
52
  };
53
53
  }
54
- const G = "https://football.api.sportal365.com", De = "https://basketball.api.sportal365.com", Ne = "https://tennis.api.sportal365.com", Fe = "https://sports-statistics.api.sportal365.com", Pe = "https://sports-search.api.sportal365.com", xe = "https://standing.api.sportal365.com", p = U(G);
55
- function R(e) {
54
+ const G = "https://football.api.sportal365.com", Ue = "https://basketball.api.sportal365.com", $e = "https://tennis.api.sportal365.com", Ge = "https://sports-statistics.api.sportal365.com", He = "https://sports-search.api.sportal365.com", Be = "https://standing.api.sportal365.com", p = $(G);
55
+ function L(e) {
56
56
  if (e)
57
57
  return {
58
58
  id: e.id,
@@ -91,7 +91,7 @@ const H = {
91
91
  PENALTY_MISSED: "PENALTY_MISSED",
92
92
  PENALTY_SAVED: "PENALTY_SAVED"
93
93
  };
94
- function S(e) {
94
+ function I(e) {
95
95
  const t = H[e.type_code];
96
96
  return t ? {
97
97
  id: e.id,
@@ -99,12 +99,12 @@ function S(e) {
99
99
  competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
100
100
  minute: e.minute,
101
101
  injuryMinute: e.injury_minute,
102
- primaryPlayer: R(e.primary_player),
103
- secondaryPlayer: R(e.secondary_player),
102
+ primaryPlayer: L(e.primary_player),
103
+ secondaryPlayer: L(e.secondary_player),
104
104
  score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
105
105
  } : (console.warn(`Unknown event type: ${e.type_code}`), null);
106
106
  }
107
- function r(e, t = "sportal365") {
107
+ function u(e, t = "sportal365") {
108
108
  if (e)
109
109
  return [
110
110
  {
@@ -113,19 +113,19 @@ function r(e, t = "sportal365") {
113
113
  }
114
114
  ];
115
115
  }
116
- function Me(e, t) {
117
- return e ? e.find((o) => o.provider === t)?.id : void 0;
116
+ function Ye(e, t) {
117
+ return e ? e.find((n) => n.provider === t)?.id : void 0;
118
118
  }
119
- function Ue(e, t, n) {
120
- const o = e ?? [], s = o.findIndex((a) => a.provider === t);
121
- if (s >= 0) {
122
- const a = [...o];
123
- return a[s] = { provider: t, id: n }, a;
119
+ function Ve(e, t, s) {
120
+ const n = e ?? [], o = n.findIndex((a) => a.provider === t);
121
+ if (o >= 0) {
122
+ const a = [...n];
123
+ return a[o] = { provider: t, id: s }, a;
124
124
  } else
125
- return [...o, { provider: t, id: n }];
125
+ return [...n, { provider: t, id: s }];
126
126
  }
127
127
  function B(e) {
128
- const t = e.urls?.find((n) => n.app_type === "desktop")?.url;
128
+ const t = e.urls?.find((s) => s.app_type === "desktop")?.url;
129
129
  return {
130
130
  id: e.id,
131
131
  name: e.name,
@@ -138,7 +138,7 @@ function B(e) {
138
138
  providerSelectionId: e.provider_info?.selection_id
139
139
  };
140
140
  }
141
- function $(e) {
141
+ function Y(e) {
142
142
  return {
143
143
  type: {
144
144
  id: e.type.id,
@@ -153,32 +153,32 @@ function $(e) {
153
153
  selections: e.selections.map(B)
154
154
  };
155
155
  }
156
- function Y(e) {
156
+ function V(e) {
157
157
  if (!e) return !0;
158
- const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
159
- return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
158
+ const t = e.replace("#", ""), s = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
159
+ return (0.2126 * s + 0.7152 * n + 0.0722 * o) / 255 < 0.5;
160
160
  }
161
- function V(e) {
162
- const t = e.bookmaker.assets?.[0], n = e.bookmaker.branding || t, o = e.bookmaker.branding?.background_color || t?.background_color, s = e.bookmaker.branding?.text_color || (Y(o) ? "#FFFFFF" : "#000000");
161
+ function W(e) {
162
+ const t = e.bookmaker.assets?.[0], s = e.bookmaker.branding || t, n = e.bookmaker.branding?.background_color || t?.background_color, o = e.bookmaker.branding?.text_color || (V(n) ? "#FFFFFF" : "#000000");
163
163
  return {
164
164
  operator: {
165
165
  id: e.bookmaker.id,
166
166
  name: e.bookmaker.name,
167
167
  url: e.bookmaker.url,
168
- branding: n ? {
169
- backgroundColor: o,
170
- textColor: s,
168
+ branding: s ? {
169
+ backgroundColor: n,
170
+ textColor: o,
171
171
  logo: t?.logo
172
172
  } : void 0
173
173
  },
174
174
  type: e.type,
175
- markets: e.markets.map($)
175
+ markets: e.markets.map(Y)
176
176
  };
177
177
  }
178
- function W(e) {
179
- return e.map(V);
180
- }
181
178
  function j(e) {
179
+ return e.map(W);
180
+ }
181
+ function K(e) {
182
182
  const t = {
183
183
  finished_ap: "finished_after_penalties",
184
184
  // finished after penalties
@@ -192,8 +192,8 @@ function j(e) {
192
192
  postponed: "postponed",
193
193
  abandoned: "abandoned"
194
194
  };
195
- let n;
196
- return e.code && t[e.code] ? n = t[e.code] : n = {
195
+ let s;
196
+ return e.code && t[e.code] ? s = t[e.code] : s = {
197
197
  FINISHED: "finished",
198
198
  NOT_STARTED: "not_started",
199
199
  LIVE: "live",
@@ -203,13 +203,13 @@ function j(e) {
203
203
  UNKNOWN: "not_started",
204
204
  ABANDONED: "abandoned"
205
205
  }[e.type] ?? "not_started", {
206
- code: n,
206
+ code: s,
207
207
  name: e.name,
208
208
  shortName: e.short_name,
209
209
  type: e.type
210
210
  };
211
211
  }
212
- function L(e) {
212
+ function k(e) {
213
213
  return {
214
214
  id: e.id,
215
215
  name: e.name,
@@ -232,10 +232,10 @@ function L(e) {
232
232
  }
233
233
  ]
234
234
  } : void 0,
235
- providerRef: r(e.uuid)
235
+ providerRef: u(e.uuid)
236
236
  };
237
237
  }
238
- function K(e) {
238
+ function q(e) {
239
239
  return {
240
240
  kickoffTime: new Date(e.kickoff_time),
241
241
  currentMinute: e.minute?.regular_time,
@@ -247,12 +247,12 @@ function K(e) {
247
247
  extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
248
248
  };
249
249
  }
250
- function q(e) {
250
+ function X(e) {
251
251
  if (!e) return;
252
- const t = (o) => o ? { competitorOne: String(o.home), competitorTwo: String(o.away) } : void 0, n = e.after_extra_time ?? e.regular_time;
252
+ const t = (n) => n ? { competitorOne: String(n.home), competitorTwo: String(n.away) } : void 0, s = e.after_extra_time ?? e.regular_time;
253
253
  return {
254
- competitorOne: n?.home != null ? String(n.home) : null,
255
- competitorTwo: n?.away != null ? String(n.away) : null,
254
+ competitorOne: s?.home != null ? String(s.home) : null,
255
+ competitorTwo: s?.away != null ? String(s.away) : null,
256
256
  breakdown: {
257
257
  total: t(e.total),
258
258
  halfTime: t(e.half_time),
@@ -263,17 +263,17 @@ function q(e) {
263
263
  }
264
264
  };
265
265
  }
266
- function X(e) {
266
+ function z(e) {
267
267
  if (e)
268
268
  return {
269
269
  id: e.id,
270
270
  name: e.name,
271
271
  slug: e.slug,
272
272
  assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0,
273
- providerRef: r(e.uuid)
273
+ providerRef: u(e.uuid)
274
274
  };
275
275
  }
276
- function z(e) {
276
+ function J(e) {
277
277
  if (e?.length)
278
278
  return e.map((t) => ({
279
279
  id: t.id,
@@ -283,9 +283,9 @@ function z(e) {
283
283
  gender: t.gender
284
284
  }));
285
285
  }
286
- function J(e) {
286
+ function Q(e) {
287
287
  if (!e.season?.tournament) return;
288
- const { tournament: t, ...n } = e.season;
288
+ const { tournament: t, ...s } = e.season;
289
289
  return {
290
290
  id: t.id,
291
291
  name: t.name,
@@ -297,12 +297,12 @@ function J(e) {
297
297
  name: t.country.name,
298
298
  code: t.country.code ?? void 0,
299
299
  flag: t.country.assets?.flag?.url,
300
- providerRef: r(t.country.uuid)
300
+ providerRef: u(t.country.uuid)
301
301
  } : void 0,
302
302
  season: {
303
- id: n.id,
304
- name: n.name,
305
- status: n.status
303
+ id: s.id,
304
+ name: s.name,
305
+ status: s.status
306
306
  },
307
307
  stage: e.stage ? {
308
308
  id: e.stage.id,
@@ -310,10 +310,10 @@ function J(e) {
310
310
  type: e.stage.type
311
311
  } : void 0,
312
312
  assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0,
313
- providerRef: r(t.uuid)
313
+ providerRef: u(t.uuid)
314
314
  };
315
315
  }
316
- function Q(e) {
316
+ function Z(e) {
317
317
  if (!e.winner?.match?.id) return;
318
318
  const t = {
319
319
  "Regular Time": "REGULAR_TIME",
@@ -326,41 +326,41 @@ function Q(e) {
326
326
  aggregate: !!e.winner.aggregate
327
327
  };
328
328
  }
329
- function E(e) {
329
+ function b(e) {
330
330
  return {
331
331
  id: e.id,
332
332
  slug: e.slug,
333
333
  sport: "football",
334
- status: j(e.status),
335
- timing: K(e),
336
- competitorOne: L(e.home_team),
337
- competitorTwo: L(e.away_team),
338
- competition: J(e),
334
+ status: K(e.status),
335
+ timing: q(e),
336
+ competitorOne: k(e.home_team),
337
+ competitorTwo: k(e.away_team),
338
+ competition: Q(e),
339
339
  round: e.round ? {
340
340
  id: e.round.id ?? e.round.key,
341
341
  key: e.round.key,
342
342
  name: e.round.name,
343
343
  type: e.round.type ?? "REGULAR",
344
- providerRef: r(e.round.uuid)
344
+ providerRef: u(e.round.uuid)
345
345
  } : void 0,
346
346
  group: e.group ? {
347
347
  id: e.group.id,
348
348
  name: e.group.name,
349
- providerRef: r(e.group.uuid)
349
+ providerRef: u(e.group.uuid)
350
350
  } : void 0,
351
- venue: X(e.venue),
352
- officials: z(e.referees),
351
+ venue: z(e.venue),
352
+ officials: J(e.referees),
353
353
  spectators: e.spectators ?? void 0,
354
- score: q(e.score),
355
- mainEvents: e.main_events?.map(S).filter((t) => t !== null),
356
- penaltyShootoutEvents: e.penalty_shootout_events?.map(S).filter((t) => t !== null),
357
- winner: Q(e),
354
+ score: X(e.score),
355
+ mainEvents: e.main_events?.map(I).filter((t) => t !== null),
356
+ penaltyShootoutEvents: e.penalty_shootout_events?.map(I).filter((t) => t !== null),
357
+ winner: Z(e),
358
358
  coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
359
359
  lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status,
360
- providerRef: r(e.uuid)
360
+ providerRef: u(e.uuid)
361
361
  };
362
362
  }
363
- function Z(e) {
363
+ function w(e) {
364
364
  const t = e.player;
365
365
  return {
366
366
  id: t.id,
@@ -374,7 +374,7 @@ function Z(e) {
374
374
  id: t.country.id,
375
375
  name: t.country.name,
376
376
  code: t.country.code,
377
- providerRef: r(t.country.uuid)
377
+ providerRef: u(t.country.uuid)
378
378
  } : void 0,
379
379
  birthdate: t.birthdate,
380
380
  profile: t.profile ? {
@@ -385,15 +385,15 @@ function Z(e) {
385
385
  photo: t.assets.thumb?.url,
386
386
  photoTransparent: t.assets.thumb_transparent_background?.url
387
387
  } : void 0,
388
- events: e.events?.map(S).filter((n) => n !== null),
389
- providerRef: r(t.uuid)
388
+ events: e.events?.map(I).filter((s) => s !== null),
389
+ providerRef: u(t.uuid)
390
390
  };
391
391
  }
392
- function k(e) {
393
- const t = [], n = [];
394
- for (const o of e.players) {
395
- const s = Z(o);
396
- o.type.category === "start" ? t.push(s) : o.type.category === "sub" && n.push(s);
392
+ function D(e) {
393
+ const t = [], s = [];
394
+ for (const n of e.players) {
395
+ const o = w(n);
396
+ n.type.category === "start" ? t.push(o) : n.type.category === "sub" && s.push(o);
397
397
  }
398
398
  return {
399
399
  competitorId: e.team_id,
@@ -406,73 +406,73 @@ function k(e) {
406
406
  id: e.coach.country.id,
407
407
  name: e.coach.country.name,
408
408
  code: e.coach.country.code,
409
- providerRef: r(e.coach.country.uuid)
409
+ providerRef: u(e.coach.country.uuid)
410
410
  } : void 0,
411
411
  birthdate: e.coach.birthdate,
412
- providerRef: r(e.coach.uuid)
412
+ providerRef: u(e.coach.uuid)
413
413
  } : void 0,
414
414
  starters: t,
415
- substitutes: n
415
+ substitutes: s
416
416
  };
417
417
  }
418
- function w(e) {
418
+ function ee(e) {
419
419
  return {
420
420
  matchId: e.match_id,
421
421
  confirmed: e.status === "CONFIRMED",
422
- competitorOne: k(e.home_team),
423
- competitorTwo: k(e.away_team)
422
+ competitorOne: D(e.home_team),
423
+ competitorTwo: D(e.away_team)
424
424
  };
425
425
  }
426
- function y(e, t, n, o) {
427
- return t == null ? null : { key: e, value: String(t), label: n, unit: o };
428
- }
429
- function D(e, t) {
430
- const n = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), o = [
431
- y("possession", t.possession, "Possession", "%"),
432
- y("shots_total", n, "Shots"),
433
- y("shots_on_target", t.shots_on, "Shots on Target"),
434
- y("shots_off_target", t.shots_off, "Shots off Target"),
435
- y("shots_blocked", t.shots_blocked, "Shots Blocked"),
436
- y("corners", t.corners, "Corner Kicks"),
437
- y("goal_kicks", t.goal_kicks, "Goal Kicks"),
438
- y("throw_ins", t.throw_in, "Throw Ins"),
439
- y("offsides", t.offside, "Offsides"),
440
- y("fouls", t.fouls_committed, "Fouls"),
441
- y("yellow_cards", t.yellow_cards, "Yellow Cards"),
442
- y("passes", t.pass, "Passes"),
443
- y("crosses", t.crosses, "Crosses")
426
+ function h(e, t, s, n) {
427
+ return t == null ? null : { key: e, value: String(t), label: s, unit: n };
428
+ }
429
+ function N(e, t) {
430
+ const s = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), n = [
431
+ h("possession", t.possession, "Possession", "%"),
432
+ h("shots_total", s, "Shots"),
433
+ h("shots_on_target", t.shots_on, "Shots on Target"),
434
+ h("shots_off_target", t.shots_off, "Shots off Target"),
435
+ h("shots_blocked", t.shots_blocked, "Shots Blocked"),
436
+ h("corners", t.corners, "Corner Kicks"),
437
+ h("goal_kicks", t.goal_kicks, "Goal Kicks"),
438
+ h("throw_ins", t.throw_in, "Throw Ins"),
439
+ h("offsides", t.offside, "Offsides"),
440
+ h("fouls", t.fouls_committed, "Fouls"),
441
+ h("yellow_cards", t.yellow_cards, "Yellow Cards"),
442
+ h("passes", t.pass, "Passes"),
443
+ h("crosses", t.crosses, "Crosses")
444
444
  ];
445
445
  return {
446
446
  competitorId: e,
447
- statistics: o.filter((s) => s !== null)
447
+ statistics: n.filter((o) => o !== null)
448
448
  };
449
449
  }
450
- function ee(e) {
451
- const t = e.find((o) => o.home_team), n = e.find((o) => !o.home_team);
452
- if (!t || !n)
450
+ function te(e) {
451
+ const t = e.find((n) => n.home_team), s = e.find((n) => !n.home_team);
452
+ if (!t || !s)
453
453
  throw new Error("Missing competitor statistics");
454
454
  return {
455
- competitorOne: D(String(t.team.id), t.statistics),
456
- competitorTwo: D(String(n.team.id), n.statistics)
455
+ competitorOne: N(String(t.team.id), t.statistics),
456
+ competitorTwo: N(String(s.team.id), s.statistics)
457
457
  };
458
458
  }
459
- function te(e, t) {
459
+ function ne(e, t) {
460
460
  return {
461
461
  matchId: e,
462
- operators: W(t)
462
+ operators: j(t)
463
463
  };
464
464
  }
465
- function N(e) {
465
+ function F(e) {
466
466
  if (e == null || e === "")
467
467
  return;
468
468
  const t = typeof e == "number" ? e : parseInt(e, 10);
469
469
  return isNaN(t) ? void 0 : t;
470
470
  }
471
- function oe(e) {
471
+ function se(e) {
472
472
  return {
473
473
  externalId: e.external_id,
474
- minute: N(e.elapsed),
475
- addedTime: N(e.elapsed_plus),
474
+ minute: F(e.elapsed),
475
+ addedTime: F(e.elapsed_plus),
476
476
  text: e.auto_text,
477
477
  details: e.details,
478
478
  meta: {
@@ -484,11 +484,11 @@ function oe(e) {
484
484
  }
485
485
  };
486
486
  }
487
- async function Ge(e, t, n) {
488
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
487
+ async function We(e, t, s) {
488
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
489
489
  path: `/v2/matches/${e}`,
490
490
  params: {
491
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
491
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
492
492
  odd_client: t?.oddClient,
493
493
  odd_type: t?.oddType,
494
494
  scope_type: t?.scopeType,
@@ -498,47 +498,47 @@ async function Ge(e, t, n) {
498
498
  optional_data: t?.optionalData
499
499
  },
500
500
  headers: {
501
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
501
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
502
502
  },
503
503
  next: t?.next,
504
- config: o
504
+ config: n
505
505
  });
506
- return E(a);
506
+ return b(a);
507
507
  }
508
- async function He(e, t, n) {
509
- const o = n || g(), { sportal365Sports: s } = o;
508
+ async function je(e, t, s) {
509
+ const n = s || g(), { sportal365Sports: o } = n;
510
510
  return (await p.get({
511
511
  path: `/v2/matches/${e}/events`,
512
512
  params: {
513
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
513
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
514
514
  },
515
515
  headers: {
516
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
516
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
517
517
  },
518
518
  next: t?.next,
519
- config: o
520
- })).events.map(S).filter((l) => l !== null);
519
+ config: n
520
+ })).events.map(I).filter((c) => c !== null);
521
521
  }
522
- async function Be(e, t, n) {
523
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
522
+ async function Ke(e, t, s) {
523
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
524
524
  path: `/v2/matches/${e}/lineups`,
525
525
  params: {
526
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
526
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
527
527
  },
528
528
  headers: {
529
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
529
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
530
530
  },
531
531
  next: t?.next,
532
- config: o
532
+ config: n
533
533
  });
534
- return w(a);
534
+ return ee(a);
535
535
  }
536
- async function $e(e, t, n) {
537
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
536
+ async function qe(e, t, s) {
537
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
538
538
  path: `/v2/matches/${e}`,
539
539
  params: {
540
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
541
- odd_client: t?.oddClient ?? s?.oddClient,
540
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
541
+ odd_client: t?.oddClient ?? o?.oddClient,
542
542
  odd_type: t?.oddType,
543
543
  scope_type: t?.scopeType ?? "ALL",
544
544
  odd_format: t?.oddFormat ?? "DECIMAL",
@@ -546,47 +546,47 @@ async function $e(e, t, n) {
546
546
  bookmaker_ids: t?.bookmakerIds
547
547
  },
548
548
  headers: {
549
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
549
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
550
550
  },
551
551
  next: t?.next,
552
- config: o
552
+ config: n
553
553
  });
554
- return te(e, a.odds ?? []);
554
+ return ne(e, a.odds ?? []);
555
555
  }
556
- async function Ye(e, t, n) {
557
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
556
+ async function Xe(e, t, s) {
557
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
558
558
  path: `/events/${e}/teamstats`,
559
559
  params: {
560
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
560
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
561
561
  },
562
562
  headers: {
563
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
563
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
564
564
  },
565
565
  next: t?.next,
566
- config: o
566
+ config: n
567
567
  });
568
- return ee(a);
568
+ return te(a);
569
569
  }
570
- async function Ve(e, t, n) {
571
- const o = n || g(), { sportal365Sports: s } = o;
570
+ async function ze(e, t, s) {
571
+ const n = s || g(), { sportal365Sports: o } = n;
572
572
  return (await p.get({
573
573
  path: `/matches/${e}/commentary`,
574
574
  params: {
575
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
575
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
576
576
  },
577
577
  headers: {
578
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
578
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
579
579
  },
580
580
  next: t?.next,
581
- config: o
582
- })).map(oe);
581
+ config: n
582
+ })).map(se);
583
583
  }
584
- async function We(e, t) {
585
- const n = t || g(), { sportal365Sports: o } = n;
584
+ async function Je(e, t) {
585
+ const s = t || g(), { sportal365Sports: n } = s;
586
586
  return (await p.get({
587
587
  path: "/v2/matches",
588
588
  params: {
589
- language_code: e.languageCode ?? o?.languageCode ?? "en",
589
+ language_code: e.languageCode ?? n?.languageCode ?? "en",
590
590
  limit: e.limit.toString(),
591
591
  offset: e.offset.toString(),
592
592
  // Competition filters
@@ -609,7 +609,7 @@ async function We(e, t) {
609
609
  status_types: e.statusTypes,
610
610
  status_codes: e.statusCodes,
611
611
  // Odds
612
- odd_client: e.oddClient ?? o?.oddClient,
612
+ odd_client: e.oddClient ?? n?.oddClient,
613
613
  odd_type: e.oddType,
614
614
  scope_type: e.scopeType,
615
615
  odd_format: e.oddFormat,
@@ -620,14 +620,14 @@ async function We(e, t) {
620
620
  optional_data: e.optionalData
621
621
  },
622
622
  headers: {
623
- "Accept-Language": e.languageCode ?? o?.languageCode ?? "en"
623
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
624
624
  },
625
625
  next: e.next,
626
- config: n
627
- })).matches.map(E);
626
+ config: s
627
+ })).matches.map(b);
628
628
  }
629
- async function je(e, t) {
630
- const n = t || g(), { sportal365Sports: o } = n;
629
+ async function Qe(e, t) {
630
+ const s = t || g(), { sportal365Sports: n } = s;
631
631
  return (await p.get({
632
632
  path: "/v2/matches/livescore",
633
633
  params: {
@@ -638,9 +638,9 @@ async function je(e, t) {
638
638
  tournament_group: e?.tournamentGroup,
639
639
  status_types: e?.statusTypes,
640
640
  selection_filter: e?.selectionFilter,
641
- language_code: e?.languageCode ?? o?.languageCode ?? "en",
641
+ language_code: e?.languageCode ?? n?.languageCode ?? "en",
642
642
  // Odds parameters
643
- odd_client: e?.oddClient ?? o?.oddClient,
643
+ odd_client: e?.oddClient ?? n?.oddClient,
644
644
  odd_type: e?.oddType,
645
645
  scope_type: e?.scopeType,
646
646
  odd_format: e?.oddFormat,
@@ -649,13 +649,13 @@ async function je(e, t) {
649
649
  optional_data: e?.optionalData
650
650
  },
651
651
  headers: {
652
- "Accept-Language": e?.languageCode ?? o?.languageCode ?? "en"
652
+ "Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
653
653
  },
654
654
  next: e?.next,
655
- config: n
656
- })).matches.map(E);
655
+ config: s
656
+ })).matches.map(b);
657
657
  }
658
- function ne(e) {
658
+ function oe(e) {
659
659
  return {
660
660
  id: e.id,
661
661
  name: e.name,
@@ -669,7 +669,7 @@ function ne(e) {
669
669
  name: e.country.name,
670
670
  code: e.country.code ?? void 0,
671
671
  flag: e.country.assets?.flag?.url,
672
- providerRef: r(e.country.uuid)
672
+ providerRef: u(e.country.uuid)
673
673
  } : void 0,
674
674
  // Extended team profile data
675
675
  venue: e.venue ? {
@@ -684,16 +684,16 @@ function ne(e) {
684
684
  name: e.venue.city.country.name,
685
685
  code: e.venue.city.country.code ?? void 0,
686
686
  flag: e.venue.city.country.assets?.flag?.url,
687
- providerRef: r(e.venue.city.country.uuid)
687
+ providerRef: u(e.venue.city.country.uuid)
688
688
  } : void 0,
689
- providerRef: r(e.venue.city.uuid ?? void 0)
689
+ providerRef: u(e.venue.city.uuid ?? void 0)
690
690
  } : void 0,
691
691
  country: e.venue.country ? {
692
692
  id: e.venue.country.id,
693
693
  name: e.venue.country.name,
694
694
  code: e.venue.country.code ?? void 0,
695
695
  flag: e.venue.country.assets?.flag?.url,
696
- providerRef: r(e.venue.country.uuid)
696
+ providerRef: u(e.venue.country.uuid)
697
697
  } : void 0,
698
698
  profile: e.venue.profile ? {
699
699
  latitude: e.venue.profile.lat,
@@ -703,7 +703,7 @@ function ne(e) {
703
703
  assets: e.venue.assets?.image?.url ? {
704
704
  image: e.venue.assets.image.url
705
705
  } : void 0,
706
- providerRef: r(e.venue.uuid)
706
+ providerRef: u(e.venue.uuid)
707
707
  } : void 0,
708
708
  coach: e.coach ? {
709
709
  id: e.coach.id,
@@ -714,10 +714,10 @@ function ne(e) {
714
714
  name: e.coach.country.name,
715
715
  code: e.coach.country.code ?? void 0,
716
716
  flag: e.coach.country.assets?.flag?.url,
717
- providerRef: r(e.coach.country.uuid)
717
+ providerRef: u(e.coach.country.uuid)
718
718
  },
719
719
  birthdate: e.coach.birthdate,
720
- providerRef: r(e.coach.uuid)
720
+ providerRef: u(e.coach.uuid)
721
721
  } : void 0,
722
722
  founded: e.founded,
723
723
  // Assets
@@ -747,28 +747,28 @@ function ne(e) {
747
747
  name: t.name,
748
748
  slug: t.slug,
749
749
  active: t.status === "ACTIVE",
750
- providerRef: r(t.uuid)
750
+ providerRef: u(t.uuid)
751
751
  })),
752
752
  currentSeason: e.current_season ? {
753
753
  id: e.current_season.id,
754
754
  name: e.current_season.name,
755
755
  slug: e.current_season.slug,
756
756
  active: e.current_season.status === "ACTIVE",
757
- providerRef: r(e.current_season.uuid)
757
+ providerRef: u(e.current_season.uuid)
758
758
  } : void 0,
759
759
  // Form - map to FUSportsCompetitorForm
760
760
  form: e.form && e.form.length > 0 ? {
761
761
  competitorId: e.id,
762
762
  results: e.form.map((t) => {
763
- const o = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], s = t.result[0]?.results.find((d) => d.position === "1")?.value, a = t.result[0]?.results.find((d) => d.position === "2")?.value, l = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
763
+ const n = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], o = t.result[0]?.results.find((r) => r.position === "1")?.value, a = t.result[0]?.results.find((r) => r.position === "2")?.value, c = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
764
764
  return {
765
765
  matchId: t.id,
766
- result: l,
767
- score: s && a ? `${s}-${a}` : void 0,
766
+ result: c,
767
+ score: o && a ? `${o}-${a}` : void 0,
768
768
  opponent: {
769
- id: o.id,
770
- name: o.name,
771
- logo: o.display_asset?.url
769
+ id: n.id,
770
+ name: n.name,
771
+ logo: n.display_asset?.url
772
772
  },
773
773
  date: new Date(t.start_time),
774
774
  competition: t.competition ? {
@@ -779,10 +779,10 @@ function ne(e) {
779
779
  }),
780
780
  formString: e.form.map((t) => t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L").join("")
781
781
  } : void 0,
782
- providerRef: r(e.uuid)
782
+ providerRef: u(e.uuid)
783
783
  };
784
784
  }
785
- function se(e) {
785
+ function ae(e) {
786
786
  const t = e.player;
787
787
  return {
788
788
  id: t.id,
@@ -795,7 +795,7 @@ function se(e) {
795
795
  name: t.country.name,
796
796
  code: t.country.code ?? void 0,
797
797
  flag: t.country.assets?.flag?.url,
798
- providerRef: r(t.country.uuid)
798
+ providerRef: u(t.country.uuid)
799
799
  } : void 0,
800
800
  gender: t.gender,
801
801
  birthdate: t.birthdate,
@@ -811,11 +811,11 @@ function se(e) {
811
811
  contractType: e.contract_type,
812
812
  contractUntil: e.contract_until ?? void 0,
813
813
  joinedDate: e.start_date ?? void 0,
814
- providerRef: r(t.id)
814
+ providerRef: u(t.id)
815
815
  // Using player.id as provider reference
816
816
  };
817
817
  }
818
- function ae(e) {
818
+ function ie(e) {
819
819
  return {
820
820
  id: e.id,
821
821
  name: e.name,
@@ -825,74 +825,74 @@ function ae(e) {
825
825
  name: e.country.name,
826
826
  code: e.country.code ?? void 0,
827
827
  flag: e.country.assets?.flag?.url,
828
- providerRef: r(e.country.uuid)
828
+ providerRef: u(e.country.uuid)
829
829
  } : void 0,
830
830
  birthdate: e.birthdate,
831
- providerRef: r(e.uuid)
831
+ providerRef: u(e.uuid)
832
832
  };
833
833
  }
834
- function ie(e) {
834
+ function re(e) {
835
835
  return {
836
836
  teamId: e.team.id,
837
837
  teamName: e.team.name,
838
- coach: e.coach ? ae(e.coach) : void 0,
839
- players: e.players.map(se)
838
+ coach: e.coach ? ie(e.coach) : void 0,
839
+ players: e.players.map(ae)
840
840
  };
841
841
  }
842
- function re(e) {
842
+ function de(e) {
843
843
  const t = parseInt(e, 10);
844
844
  return isNaN(t) ? void 0 : t;
845
845
  }
846
846
  function i(e, t) {
847
- const n = e.find((o) => o.name === t);
848
- return n ? re(n.value) : void 0;
847
+ const s = e.find((n) => n.name === t);
848
+ return s ? de(s.value) : void 0;
849
849
  }
850
- function de(e, t) {
851
- const n = e.statistics;
850
+ function ue(e, t) {
851
+ const s = e.statistics;
852
852
  return {
853
853
  playerId: e.player.id,
854
854
  seasonId: e.season.id,
855
855
  teamId: t,
856
856
  // Core statistics
857
- appearances: i(n, "played"),
858
- started: i(n, "started"),
859
- substituteIn: i(n, "substitute_in"),
860
- substituteOut: i(n, "substitute_out"),
861
- minutes: i(n, "minutes"),
862
- minutesSubstitute: i(n, "minutes_substitute"),
857
+ appearances: i(s, "played"),
858
+ started: i(s, "started"),
859
+ substituteIn: i(s, "substitute_in"),
860
+ substituteOut: i(s, "substitute_out"),
861
+ minutes: i(s, "minutes"),
862
+ minutesSubstitute: i(s, "minutes_substitute"),
863
863
  // Scoring
864
- goals: i(n, "goals"),
865
- goalsSubstitute: i(n, "goals_substitute"),
866
- penaltyGoals: i(n, "penalty_goals"),
867
- ownGoals: i(n, "own_goals"),
868
- assists: i(n, "assists"),
864
+ goals: i(s, "goals"),
865
+ goalsSubstitute: i(s, "goals_substitute"),
866
+ penaltyGoals: i(s, "penalty_goals"),
867
+ ownGoals: i(s, "own_goals"),
868
+ assists: i(s, "assists"),
869
869
  // Shooting
870
- shots: i(n, "shots"),
871
- shotsOnTarget: i(n, "shots_on_target"),
870
+ shots: i(s, "shots"),
871
+ shotsOnTarget: i(s, "shots_on_target"),
872
872
  // Discipline
873
- yellowCards: i(n, "yellow_cards"),
874
- redCards: i(n, "red_cards"),
875
- foulsCommitted: i(n, "fouls_committed"),
876
- penaltiesCommitted: i(n, "penalties_committed"),
873
+ yellowCards: i(s, "yellow_cards"),
874
+ redCards: i(s, "red_cards"),
875
+ foulsCommitted: i(s, "fouls_committed"),
876
+ penaltiesCommitted: i(s, "penalties_committed"),
877
877
  // Penalties
878
- penaltiesMissed: i(n, "penalties_missed"),
878
+ penaltiesMissed: i(s, "penalties_missed"),
879
879
  // Defensive
880
- cleansheets: i(n, "cleansheets"),
880
+ cleansheets: i(s, "cleansheets"),
881
881
  // Goalkeeper-specific
882
- saves: i(n, "saves"),
883
- conceded: i(n, "conceded"),
884
- caughtBall: i(n, "caught_ball"),
885
- penaltiesReceived: i(n, "penalties_received"),
882
+ saves: i(s, "saves"),
883
+ conceded: i(s, "conceded"),
884
+ caughtBall: i(s, "caught_ball"),
885
+ penaltiesReceived: i(s, "penalties_received"),
886
886
  // Other
887
- offsides: i(n, "offsides"),
887
+ offsides: i(s, "offsides"),
888
888
  // Raw statistics array (for any additional stats not mapped above)
889
- rawStatistics: n.map((o) => ({
890
- name: o.name,
891
- value: o.value
889
+ rawStatistics: s.map((n) => ({
890
+ name: n.name,
891
+ value: n.value
892
892
  }))
893
893
  };
894
894
  }
895
- function ue(e) {
895
+ function ce(e) {
896
896
  const t = e.statistics;
897
897
  return {
898
898
  playerId: e.player.id,
@@ -930,176 +930,336 @@ function ue(e) {
930
930
  // Other
931
931
  offsides: i(t, "offsides"),
932
932
  // Raw statistics array
933
- rawStatistics: t.map((n) => ({
934
- name: n.name,
935
- value: n.value
933
+ rawStatistics: t.map((s) => ({
934
+ name: s.name,
935
+ value: s.value
936
936
  }))
937
937
  };
938
938
  }
939
- function c(e, t) {
939
+ function l(e, t) {
940
940
  if (!(e === void 0 && t === void 0))
941
941
  return (e ?? 0) + (t ?? 0);
942
942
  }
943
- function ce(e, t) {
943
+ function le(e, t) {
944
944
  return {
945
945
  playerId: e.playerId,
946
946
  seasonId: e.seasonId,
947
947
  // Core statistics
948
- appearances: c(e.appearances, t.appearances),
949
- started: c(e.started, t.started),
950
- substituteIn: c(e.substituteIn, t.substituteIn),
951
- substituteOut: c(e.substituteOut, t.substituteOut),
952
- minutes: c(e.minutes, t.minutes),
953
- minutesSubstitute: c(e.minutesSubstitute, t.minutesSubstitute),
948
+ appearances: l(e.appearances, t.appearances),
949
+ started: l(e.started, t.started),
950
+ substituteIn: l(e.substituteIn, t.substituteIn),
951
+ substituteOut: l(e.substituteOut, t.substituteOut),
952
+ minutes: l(e.minutes, t.minutes),
953
+ minutesSubstitute: l(e.minutesSubstitute, t.minutesSubstitute),
954
954
  // Scoring
955
- goals: c(e.goals, t.goals),
956
- goalsSubstitute: c(e.goalsSubstitute, t.goalsSubstitute),
957
- penaltyGoals: c(e.penaltyGoals, t.penaltyGoals),
958
- ownGoals: c(e.ownGoals, t.ownGoals),
959
- assists: c(e.assists, t.assists),
955
+ goals: l(e.goals, t.goals),
956
+ goalsSubstitute: l(e.goalsSubstitute, t.goalsSubstitute),
957
+ penaltyGoals: l(e.penaltyGoals, t.penaltyGoals),
958
+ ownGoals: l(e.ownGoals, t.ownGoals),
959
+ assists: l(e.assists, t.assists),
960
960
  // Shooting
961
- shots: c(e.shots, t.shots),
962
- shotsOnTarget: c(e.shotsOnTarget, t.shotsOnTarget),
961
+ shots: l(e.shots, t.shots),
962
+ shotsOnTarget: l(e.shotsOnTarget, t.shotsOnTarget),
963
963
  // Discipline
964
- yellowCards: c(e.yellowCards, t.yellowCards),
965
- redCards: c(e.redCards, t.redCards),
966
- foulsCommitted: c(e.foulsCommitted, t.foulsCommitted),
967
- penaltiesCommitted: c(e.penaltiesCommitted, t.penaltiesCommitted),
964
+ yellowCards: l(e.yellowCards, t.yellowCards),
965
+ redCards: l(e.redCards, t.redCards),
966
+ foulsCommitted: l(e.foulsCommitted, t.foulsCommitted),
967
+ penaltiesCommitted: l(e.penaltiesCommitted, t.penaltiesCommitted),
968
968
  // Penalties
969
- penaltiesMissed: c(e.penaltiesMissed, t.penaltiesMissed),
969
+ penaltiesMissed: l(e.penaltiesMissed, t.penaltiesMissed),
970
970
  // Defensive
971
- cleansheets: c(e.cleansheets, t.cleansheets),
971
+ cleansheets: l(e.cleansheets, t.cleansheets),
972
972
  // Goalkeeper-specific
973
- saves: c(e.saves, t.saves),
974
- conceded: c(e.conceded, t.conceded),
975
- caughtBall: c(e.caughtBall, t.caughtBall),
976
- penaltiesReceived: c(e.penaltiesReceived, t.penaltiesReceived),
973
+ saves: l(e.saves, t.saves),
974
+ conceded: l(e.conceded, t.conceded),
975
+ caughtBall: l(e.caughtBall, t.caughtBall),
976
+ penaltiesReceived: l(e.penaltiesReceived, t.penaltiesReceived),
977
977
  // Other
978
- offsides: c(e.offsides, t.offsides),
978
+ offsides: l(e.offsides, t.offsides),
979
979
  // Concatenate raw statistics from both entries
980
980
  rawStatistics: [...e.rawStatistics ?? [], ...t.rawStatistics ?? []]
981
981
  };
982
982
  }
983
- async function le(e, t) {
984
- const n = t || g(), { sportal365Sports: o } = n, { seasonIds: s, teamId: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
985
- season_ids: s.join(","),
983
+ function me(e) {
984
+ return {
985
+ tournamentSeason: {
986
+ id: String(e.tournament_season.id),
987
+ name: e.tournament_season.name,
988
+ uuid: e.tournament_season.uuid,
989
+ active: e.tournament_season.active,
990
+ tournament: {
991
+ id: String(e.tournament_season.tournament.id),
992
+ name: e.tournament_season.tournament.name,
993
+ uuid: e.tournament_season.tournament.uuid,
994
+ type: e.tournament_season.tournament.type,
995
+ region: e.tournament_season.tournament.region,
996
+ logo: e.tournament_season.tournament.url_logo,
997
+ country: e.tournament_season.tournament.country ? {
998
+ id: String(e.tournament_season.tournament.country.id),
999
+ name: e.tournament_season.tournament.country.name,
1000
+ uuid: e.tournament_season.tournament.country.uuid
1001
+ } : void 0
1002
+ }
1003
+ },
1004
+ team: {
1005
+ id: String(e.team.id),
1006
+ name: e.team.name,
1007
+ uuid: e.team.uuid,
1008
+ threeLetterCode: e.team.three_letter_code,
1009
+ type: e.team.type,
1010
+ logo: e.team.url_logo
1011
+ },
1012
+ // Core statistics
1013
+ appearances: e.played,
1014
+ started: e.started,
1015
+ substituteIn: e.substitute_in,
1016
+ substituteOut: e.substitute_out,
1017
+ minutes: e.minutes,
1018
+ minutesSubstitute: e.minutes_substitute,
1019
+ // Scoring
1020
+ goals: e.goals,
1021
+ goalsSubstitute: e.goals_substitute,
1022
+ penaltyGoals: e.penalty_goals,
1023
+ ownGoals: e.own_goals,
1024
+ assists: e.assists,
1025
+ // Shooting
1026
+ shots: e.shots,
1027
+ shotsOnTarget: e.shots_on_target,
1028
+ // Discipline
1029
+ yellowCards: e.yellow_cards,
1030
+ redCards: e.red_cards,
1031
+ foulsCommitted: e.fouls_committed,
1032
+ penaltiesCommitted: e.penalties_committed,
1033
+ // Penalties
1034
+ penaltiesMissed: e.penalties_missed,
1035
+ penaltiesReceived: e.penalties_received,
1036
+ penaltiesSaved: e.penalties_saved,
1037
+ // Defensive
1038
+ cleansheets: e.cleansheets,
1039
+ // Other
1040
+ offsides: e.offsides,
1041
+ // Player context
1042
+ position: e.position,
1043
+ age: e.age,
1044
+ shirtNumber: e.shirt_number
1045
+ };
1046
+ }
1047
+ function ge(e) {
1048
+ const t = e[0];
1049
+ return {
1050
+ playerId: String(t.player.id),
1051
+ playerName: t.player.name,
1052
+ playerUuid: t.player.uuid,
1053
+ entries: e.map(me)
1054
+ };
1055
+ }
1056
+ function pe(e) {
1057
+ const t = parseInt(e, 10);
1058
+ return isNaN(t) ? void 0 : t;
1059
+ }
1060
+ function v(e, t) {
1061
+ const s = e.find((n) => n.name === t);
1062
+ return s ? pe(s.value) : void 0;
1063
+ }
1064
+ function fe(e) {
1065
+ return {
1066
+ id: e.id,
1067
+ name: e.name,
1068
+ uuid: e.uuid,
1069
+ threeLetterCode: e.three_letter_code,
1070
+ type: e.type,
1071
+ logo: e.assets?.logo?.url
1072
+ };
1073
+ }
1074
+ function _e(e) {
1075
+ const t = e.aggregated_statistics;
1076
+ return {
1077
+ playerId: e.player.id,
1078
+ playerName: e.player.name,
1079
+ playerUuid: e.player.uuid,
1080
+ position: e.player.position,
1081
+ teams: e.teams.map(fe),
1082
+ matches: e.matches.map(b),
1083
+ // Core statistics
1084
+ appearances: v(t, "played"),
1085
+ started: v(t, "started"),
1086
+ substituteIn: v(t, "substitute_in"),
1087
+ substituteOut: v(t, "substitute_out"),
1088
+ minutes: v(t, "minutes"),
1089
+ minutesSubstitute: v(t, "minutes_substitute"),
1090
+ // Scoring
1091
+ goals: v(t, "goals"),
1092
+ goalsSubstitute: v(t, "goals_substitute"),
1093
+ penaltyGoals: v(t, "penalty_goals"),
1094
+ assists: v(t, "assists"),
1095
+ // Discipline
1096
+ yellowCards: v(t, "yellow_cards"),
1097
+ redCards: v(t, "red_cards"),
1098
+ // Raw statistics array
1099
+ rawStatistics: t.map((s) => ({
1100
+ name: s.name,
1101
+ value: s.value
1102
+ }))
1103
+ };
1104
+ }
1105
+ async function ye(e, t) {
1106
+ const s = t || g(), { sportal365Sports: n } = s, { seasonIds: o, teamId: a, languageCode: c, next: r } = e, d = r ?? { revalidate: 0 }, f = {
1107
+ season_ids: o.join(","),
986
1108
  team_id: a,
987
- language_code: l ?? o?.languageCode ?? "en"
1109
+ language_code: c ?? n?.languageCode ?? "en"
988
1110
  }, m = await p.get({
989
1111
  path: "/v2/statistics/players/season",
990
- params: _,
1112
+ params: f,
991
1113
  headers: {
992
- "Accept-Language": l ?? o?.languageCode ?? "en"
1114
+ "Accept-Language": c ?? n?.languageCode ?? "en"
993
1115
  },
994
- next: u,
995
- config: n
1116
+ next: d,
1117
+ config: s
996
1118
  });
997
1119
  if (!m.statistics)
998
1120
  return console.error("[getFootballPlayerSeasonStatistics] Invalid API response - missing statistics array:", {
999
1121
  teamId: a,
1000
- seasonIds: s,
1122
+ seasonIds: o,
1001
1123
  response: m
1002
1124
  }), {};
1003
1125
  if (m.statistics.length === 0)
1004
1126
  throw console.warn("[getFootballPlayerSeasonStatistics] API returned empty statistics array:", {
1005
1127
  teamId: a,
1006
- seasonIds: s,
1128
+ seasonIds: o,
1007
1129
  hint: "This could be due to: wrong credentials, wrong project header, no data for this team/season, or API issue"
1008
1130
  }), new Error(
1009
- `No player statistics found for team ${a} in seasons ${s.join(", ")}. This could be due to: wrong credentials, wrong X-Project header, or no data available for this team/season.`
1131
+ `No player statistics found for team ${a} in seasons ${o.join(", ")}. This could be due to: wrong credentials, wrong X-Project header, or no data available for this team/season.`
1010
1132
  );
1011
- const h = {};
1012
- for (const C of m.statistics) {
1013
- const T = C.player.id;
1014
- h[T] = de(C, a);
1133
+ const _ = {};
1134
+ for (const S of m.statistics) {
1135
+ const T = S.player.id;
1136
+ _[T] = ue(S, a);
1015
1137
  }
1016
- return h;
1138
+ return _;
1017
1139
  }
1018
- async function Ke(e, t) {
1019
- const n = t || g(), { sportal365Sports: o } = n, { playerIds: s, seasonIds: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
1020
- player_ids: s.join(","),
1140
+ async function Ze(e, t) {
1141
+ const s = t || g(), { sportal365Sports: n } = s, { playerIds: o, seasonIds: a, languageCode: c, next: r } = e, d = r ?? { revalidate: 0 }, f = {
1142
+ player_ids: o.join(","),
1021
1143
  season_ids: a.join(","),
1022
- language_code: l ?? o?.languageCode ?? "en"
1144
+ language_code: c ?? n?.languageCode ?? "en"
1023
1145
  }, m = await p.get({
1024
1146
  path: "/v2/statistics/players/season",
1025
- params: _,
1147
+ params: f,
1026
1148
  headers: {
1027
- "Accept-Language": l ?? o?.languageCode ?? "en"
1149
+ "Accept-Language": c ?? n?.languageCode ?? "en"
1028
1150
  },
1029
- next: u,
1030
- config: n
1151
+ next: d,
1152
+ config: s
1031
1153
  });
1032
1154
  if (!m.statistics)
1033
1155
  return console.error("[getFootballPlayerSeasonStatisticsByPlayerIds] Invalid API response - missing statistics array:", {
1034
- playerIds: s,
1156
+ playerIds: o,
1035
1157
  seasonIds: a,
1036
1158
  response: m
1037
1159
  }), {};
1038
1160
  if (m.statistics.length === 0)
1039
1161
  return {};
1040
- const h = {};
1041
- for (const C of m.statistics) {
1042
- const T = C.player.id, f = ue(C);
1043
- h[T] ? h[T] = ce(h[T], f) : h[T] = f;
1162
+ const _ = {};
1163
+ for (const S of m.statistics) {
1164
+ const T = S.player.id, y = ce(S);
1165
+ _[T] ? _[T] = le(_[T], y) : _[T] = y;
1044
1166
  }
1045
- return h;
1167
+ return _;
1046
1168
  }
1047
- async function qe(e, t, n) {
1048
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
1169
+ async function we(e, t) {
1170
+ const s = t || g(), { sportal365Sports: n } = s, { playerId: o, languageCode: a, next: c } = e, r = c ?? { revalidate: 0 }, d = await p.get({
1171
+ path: `/players/${o}/statistics`,
1172
+ params: {
1173
+ language_code: a ?? n?.languageCode ?? "en"
1174
+ },
1175
+ headers: {
1176
+ "Accept-Language": a ?? n?.languageCode ?? "en"
1177
+ },
1178
+ next: r,
1179
+ config: s
1180
+ });
1181
+ if (!Array.isArray(d) || d.length === 0)
1182
+ throw new Error(
1183
+ `No career statistics found for player ${o}. This could be due to: invalid player ID/slug, wrong credentials, or no data available.`
1184
+ );
1185
+ return ge(d);
1186
+ }
1187
+ async function et(e, t) {
1188
+ const s = t || g(), { sportal365Sports: n } = s, { playerId: o, matches: a, tournamentIds: c, teamId: r, languageCode: d, next: f } = e, m = f ?? { revalidate: 0 }, _ = {
1189
+ language_code: d ?? n?.languageCode ?? "en"
1190
+ };
1191
+ a != null && (_.matches = String(a)), c?.length && (_.tournament_ids = c.join(",")), r && (_.team_id = r);
1192
+ const S = await p.get({
1193
+ path: `/v2/statistics/players/${o}/recent-statistics`,
1194
+ params: _,
1195
+ headers: {
1196
+ "Accept-Language": d ?? n?.languageCode ?? "en"
1197
+ },
1198
+ next: m,
1199
+ config: s
1200
+ });
1201
+ if (!S.player || !S.matches)
1202
+ throw new Error(
1203
+ `No recent statistics found for player ${o}. This could be due to: invalid player ID, wrong credentials, or no data available.`
1204
+ );
1205
+ return _e(S);
1206
+ }
1207
+ async function tt(e, t, s) {
1208
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
1049
1209
  path: `/v2/teams/${e}`,
1050
1210
  params: {
1051
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
1211
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
1052
1212
  optional_data: "form"
1053
1213
  },
1054
1214
  headers: {
1055
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1215
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1056
1216
  },
1057
1217
  next: t?.next,
1058
- config: o
1218
+ config: n
1059
1219
  });
1060
- return ne(a);
1220
+ return oe(a);
1061
1221
  }
1062
- async function Xe(e, t, n) {
1063
- const o = n || g(), { sportal365Sports: s } = o, a = t?.seasonIds && t.seasonIds.length > 0 ? { revalidate: 0 } : t?.next, l = await p.get({
1222
+ async function nt(e, t, s) {
1223
+ const n = s || g(), { sportal365Sports: o } = n, a = t?.seasonIds && t.seasonIds.length > 0 ? { revalidate: 0 } : t?.next, c = await p.get({
1064
1224
  path: `/v2/teams/${e}/squad`,
1065
1225
  params: {
1066
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
1226
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
1067
1227
  memberStatus: t?.memberStatus ?? "ACTIVE"
1068
1228
  },
1069
1229
  headers: {
1070
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1230
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1071
1231
  },
1072
1232
  next: a,
1073
- config: o
1074
- }), d = ie(l);
1233
+ config: n
1234
+ }), r = re(c);
1075
1235
  if (t?.seasonIds && t.seasonIds.length > 0)
1076
1236
  try {
1077
- const u = await le(
1237
+ const d = await ye(
1078
1238
  {
1079
1239
  seasonIds: t.seasonIds,
1080
1240
  teamId: e,
1081
1241
  languageCode: t.languageCode,
1082
1242
  next: t.next
1083
1243
  },
1084
- o
1244
+ n
1085
1245
  );
1086
- for (const _ of d.players) {
1087
- const m = u[_.id];
1088
- m && (_.seasonStatistics = m);
1246
+ for (const f of r.players) {
1247
+ const m = d[f.id];
1248
+ m && (f.seasonStatistics = m);
1089
1249
  }
1090
- } catch (u) {
1250
+ } catch (d) {
1091
1251
  console.error("[getFootballTeamSquad] Failed to fetch player statistics:", {
1092
- error: u instanceof Error ? u.message : String(u),
1093
- stack: u instanceof Error ? u.stack : void 0,
1252
+ error: d instanceof Error ? d.message : String(d),
1253
+ stack: d instanceof Error ? d.stack : void 0,
1094
1254
  teamId: e,
1095
1255
  seasonIds: t.seasonIds
1096
1256
  });
1097
1257
  }
1098
1258
  else
1099
1259
  console.warn("[getFootballTeamSquad] No seasonIds provided, skipping stats fetch");
1100
- return d;
1260
+ return r;
1101
1261
  }
1102
- function me(e) {
1262
+ function he(e) {
1103
1263
  return {
1104
1264
  id: String(e.id),
1105
1265
  name: e.name,
@@ -1111,31 +1271,31 @@ function me(e) {
1111
1271
  id: String(e.country.id),
1112
1272
  name: e.country.name,
1113
1273
  flag: e.country.url_flag,
1114
- providerRef: r(e.country.uuid)
1274
+ providerRef: u(e.country.uuid)
1115
1275
  },
1116
1276
  seasons: e.seasons.map((t) => ({
1117
1277
  id: String(t.id),
1118
1278
  name: t.name,
1119
1279
  slug: t.slug,
1120
1280
  active: t.active,
1121
- providerRef: r(t.uuid)
1281
+ providerRef: u(t.uuid)
1122
1282
  })),
1123
1283
  assets: e.url_logo ? {
1124
1284
  logo: e.url_logo
1125
1285
  } : void 0,
1126
- providerRef: r(e.uuid)
1286
+ providerRef: u(e.uuid)
1127
1287
  };
1128
1288
  }
1129
- function ge(e) {
1130
- const t = e.rounds.map((n) => ({
1131
- id: n.id,
1132
- name: n.name,
1133
- key: n.key,
1134
- type: n.type,
1135
- status: n.status,
1136
- startDate: n.start_date,
1137
- endDate: n.end_date,
1138
- providerRef: r(n.uuid)
1289
+ function ve(e) {
1290
+ const t = e.rounds.map((s) => ({
1291
+ id: s.id,
1292
+ name: s.name,
1293
+ key: s.key,
1294
+ type: s.type,
1295
+ status: s.status,
1296
+ startDate: s.start_date,
1297
+ endDate: s.end_date,
1298
+ providerRef: u(s.uuid)
1139
1299
  }));
1140
1300
  return {
1141
1301
  id: e.stage.id,
@@ -1149,28 +1309,28 @@ function ge(e) {
1149
1309
  startDate: e.stage.start_date,
1150
1310
  endDate: e.stage.end_date,
1151
1311
  rounds: t,
1152
- providerRef: r(e.stage.uuid)
1312
+ providerRef: u(e.stage.uuid)
1153
1313
  };
1154
1314
  }
1155
- function pe(e) {
1156
- const { season: t, stages: n } = e, { tournament: o } = t, s = {
1157
- id: o.id,
1158
- name: o.name,
1159
- slug: o.slug,
1160
- type: o.type,
1161
- region: o.region,
1162
- gender: o.gender,
1315
+ function Se(e) {
1316
+ const { season: t, stages: s } = e, { tournament: n } = t, o = {
1317
+ id: n.id,
1318
+ name: n.name,
1319
+ slug: n.slug,
1320
+ type: n.type,
1321
+ region: n.region,
1322
+ gender: n.gender,
1163
1323
  country: {
1164
- id: o.country.id,
1165
- name: o.country.name,
1166
- code: o.country.code ?? void 0,
1167
- flag: o.country.assets?.flag?.url,
1168
- providerRef: r(o.country.uuid)
1324
+ id: n.country.id,
1325
+ name: n.country.name,
1326
+ code: n.country.code ?? void 0,
1327
+ flag: n.country.assets?.flag?.url,
1328
+ providerRef: u(n.country.uuid)
1169
1329
  },
1170
- assets: o.assets?.logo?.url ? {
1171
- logo: o.assets.logo.url
1330
+ assets: n.assets?.logo?.url ? {
1331
+ logo: n.assets.logo.url
1172
1332
  } : void 0,
1173
- providerRef: r(o.uuid)
1333
+ providerRef: u(n.uuid)
1174
1334
  };
1175
1335
  return {
1176
1336
  id: t.id,
@@ -1178,43 +1338,43 @@ function pe(e) {
1178
1338
  slug: t.slug,
1179
1339
  active: t.status === "ACTIVE",
1180
1340
  status: t.status === "ACTIVE" ? "ACTIVE" : "INACTIVE",
1181
- competition: s,
1182
- stages: n.map(ge),
1183
- providerRef: r(t.uuid)
1341
+ competition: o,
1342
+ stages: s.map(ve),
1343
+ providerRef: u(t.uuid)
1184
1344
  };
1185
1345
  }
1186
- async function ze(e, t, n) {
1187
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
1346
+ async function st(e, t, s) {
1347
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
1188
1348
  path: `/tournaments/${e}`,
1189
1349
  params: {
1190
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
1350
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
1191
1351
  },
1192
1352
  headers: {
1193
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1353
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1194
1354
  },
1195
1355
  next: t?.next,
1196
- config: o
1356
+ config: n
1197
1357
  });
1198
- return me(a);
1358
+ return he(a);
1199
1359
  }
1200
- async function Je(e, t) {
1201
- const n = t || g(), { sportal365Sports: o } = n;
1360
+ async function ot(e, t) {
1361
+ const s = t || g(), { sportal365Sports: n } = s;
1202
1362
  if (!e?.seasonId && !e?.competitionId)
1203
1363
  throw new Error("Either seasonId or competitionId must be provided");
1204
- const s = {
1205
- language_code: e?.languageCode ?? o?.languageCode ?? "en"
1364
+ const o = {
1365
+ language_code: e?.languageCode ?? n?.languageCode ?? "en"
1206
1366
  };
1207
- e.seasonId ? s.season_id = e.seasonId : e.competitionId && (s.tournament_id = e.competitionId, e.status && (s.status = e.status));
1367
+ e.seasonId ? o.season_id = e.seasonId : e.competitionId && (o.tournament_id = e.competitionId, e.status && (o.status = e.status));
1208
1368
  const a = await p.get({
1209
1369
  path: "/v2/seasons/details",
1210
- params: s,
1370
+ params: o,
1211
1371
  headers: {
1212
- "Accept-Language": e?.languageCode ?? o?.languageCode ?? "en"
1372
+ "Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
1213
1373
  },
1214
1374
  next: e?.next,
1215
- config: n
1375
+ config: s
1216
1376
  });
1217
- return pe(a);
1377
+ return Se(a);
1218
1378
  }
1219
1379
  function O(e) {
1220
1380
  return {
@@ -1226,44 +1386,44 @@ function O(e) {
1226
1386
  promotion: "promotion"
1227
1387
  }[e.toLowerCase()] ?? e.toLowerCase().replace(/_/g, "");
1228
1388
  }
1229
- function fe(e) {
1389
+ function Ce(e) {
1230
1390
  const t = e.toLowerCase();
1231
1391
  return t === "relegation" ? "BOTTOM" : t === "playoff" ? "MIDDLE" : "TOP";
1232
1392
  }
1233
- function _e(e, t) {
1393
+ function Te(e, t) {
1234
1394
  if (!t || t.length === 0)
1235
1395
  return;
1236
- const n = t.map((s) => {
1237
- const a = s.event, l = a.home_team.id === e, d = l ? a.away_team : a.home_team, u = `${a.goal_home}-${a.goal_away}`;
1396
+ const s = t.map((o) => {
1397
+ const a = o.event, c = a.home_team.id === e, r = c ? a.away_team : a.home_team, d = `${a.goal_home}-${a.goal_away}`;
1238
1398
  return {
1239
1399
  matchId: a.id.toString(),
1240
- result: s.outcome,
1241
- score: u,
1242
- homeAway: l ? "HOME" : "AWAY",
1400
+ result: o.outcome,
1401
+ score: d,
1402
+ homeAway: c ? "HOME" : "AWAY",
1243
1403
  opponent: {
1244
- id: d.id.toString(),
1245
- name: d.name,
1246
- logo: d.url_logo
1404
+ id: r.id.toString(),
1405
+ name: r.name,
1406
+ logo: r.url_logo
1247
1407
  },
1248
1408
  date: new Date(a.start_time),
1249
1409
  competition: void 0
1250
1410
  // Football API doesn't include competition in form
1251
1411
  };
1252
- }), o = n.map((s) => s.result).join("");
1412
+ }), n = s.map((o) => o.result).join("");
1253
1413
  return {
1254
1414
  competitorId: e.toString(),
1255
- results: n,
1256
- formString: o
1415
+ results: s,
1416
+ formString: n
1257
1417
  };
1258
1418
  }
1259
- function ye(e) {
1419
+ function Ie(e) {
1260
1420
  return {
1261
1421
  key: O(e.code),
1262
1422
  name: e.name,
1263
- position: fe(e.type)
1423
+ position: Ce(e.type)
1264
1424
  };
1265
1425
  }
1266
- function he(e) {
1426
+ function be(e) {
1267
1427
  const t = {
1268
1428
  played: e.played,
1269
1429
  won: e.wins,
@@ -1273,7 +1433,7 @@ function he(e) {
1273
1433
  goalsAgainst: e.goals_against,
1274
1434
  goalDifference: e.goals_for - e.goals_against,
1275
1435
  points: e.points
1276
- }, n = e.rules?.length > 0 ? e.rules.map((s) => O(s.code)) : void 0, o = _e(e.team.id, e.team.form ?? []);
1436
+ }, s = e.rules?.length > 0 ? e.rules.map((o) => O(o.code)) : void 0, n = Te(e.team.id, e.team.form ?? []);
1277
1437
  return {
1278
1438
  rank: e.rank,
1279
1439
  competitor: {
@@ -1284,41 +1444,41 @@ function he(e) {
1284
1444
  uuid: e.team.uuid
1285
1445
  },
1286
1446
  stats: t,
1287
- form: o,
1288
- rules: n
1447
+ form: n,
1448
+ rules: s
1289
1449
  };
1290
1450
  }
1291
- function ve(e) {
1292
- const t = e.map(he), n = /* @__PURE__ */ new Map();
1293
- for (const o of e)
1294
- if (o.rules)
1295
- for (const s of o.rules) {
1296
- const a = O(s.code);
1297
- n.has(a) || n.set(a, ye(s));
1451
+ function Ae(e) {
1452
+ const t = e.map(be), s = /* @__PURE__ */ new Map();
1453
+ for (const n of e)
1454
+ if (n.rules)
1455
+ for (const o of n.rules) {
1456
+ const a = O(o.code);
1457
+ s.has(a) || s.set(a, Ie(o));
1298
1458
  }
1299
1459
  return {
1300
1460
  entries: t,
1301
1461
  metadata: {
1302
- legend: Array.from(n.values())
1462
+ legend: Array.from(s.values())
1303
1463
  }
1304
1464
  };
1305
1465
  }
1306
- async function Qe(e, t) {
1307
- const n = t || g(), { sportal365Sports: o } = n, s = e.expand?.join(","), a = await p.get({
1466
+ async function at(e, t) {
1467
+ const s = t || g(), { sportal365Sports: n } = s, o = e.expand?.join(","), a = await p.get({
1308
1468
  path: `/tournaments/seasons/stages/${e.stageId}/standing`,
1309
1469
  params: {
1310
- expand: s,
1311
- language_code: e.languageCode ?? o?.languageCode ?? "en"
1470
+ expand: o,
1471
+ language_code: e.languageCode ?? n?.languageCode ?? "en"
1312
1472
  },
1313
1473
  headers: {
1314
- "Accept-Language": e.languageCode ?? o?.languageCode ?? "en"
1474
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
1315
1475
  },
1316
1476
  next: e.next,
1317
- config: n
1477
+ config: s
1318
1478
  });
1319
- return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : ve(a);
1479
+ return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : Ae(a);
1320
1480
  }
1321
- function P(e) {
1481
+ function x(e) {
1322
1482
  return {
1323
1483
  id: e.id,
1324
1484
  name: e.name,
@@ -1334,13 +1494,13 @@ function P(e) {
1334
1494
  ]
1335
1495
  };
1336
1496
  }
1337
- function Te(e) {
1497
+ function Ee(e) {
1338
1498
  return {
1339
1499
  id: e.id,
1340
1500
  name: e.name,
1341
1501
  type: e.type?.toUpperCase() || "LEAGUE",
1342
1502
  gender: e.gender?.toUpperCase(),
1343
- country: e.country ? P(e.country) : void 0,
1503
+ country: e.country ? x(e.country) : void 0,
1344
1504
  assets: e.assets?.logo ? {
1345
1505
  logo: e.assets.logo
1346
1506
  } : void 0,
@@ -1352,7 +1512,7 @@ function Te(e) {
1352
1512
  ]
1353
1513
  };
1354
1514
  }
1355
- function Ce(e) {
1515
+ function Oe(e) {
1356
1516
  if (e.status) {
1357
1517
  const a = {
1358
1518
  notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
@@ -1365,21 +1525,21 @@ function Ce(e) {
1365
1525
  if (a)
1366
1526
  return a;
1367
1527
  }
1368
- let t = "not_started", n = "NOT_STARTED", o = "Not Started";
1369
- return e.finished_at ? (t = "finished", n = "FINISHED", o = "Finished") : e.started_at && (t = "live", n = "LIVE", o = "Live"), {
1528
+ let t = "not_started", s = "NOT_STARTED", n = "Not Started";
1529
+ return e.finished_at ? (t = "finished", s = "FINISHED", n = "Finished") : e.started_at && (t = "live", s = "LIVE", n = "Live"), {
1370
1530
  code: t,
1371
- name: o,
1372
- type: n
1531
+ name: n,
1532
+ type: s
1373
1533
  };
1374
1534
  }
1375
- function Se(e) {
1535
+ function Re(e) {
1376
1536
  return {
1377
1537
  kickoffTime: new Date(e.kickoff_at),
1378
1538
  currentMinute: e.minute ?? void 0,
1379
1539
  currentPeriod: void 0
1380
1540
  };
1381
1541
  }
1382
- function F(e) {
1542
+ function P(e) {
1383
1543
  return {
1384
1544
  id: e.id,
1385
1545
  name: e.name,
@@ -1388,7 +1548,7 @@ function F(e) {
1388
1548
  threeLetterCode: e.code,
1389
1549
  type: e.national ? "national" : "club",
1390
1550
  gender: e.gender?.toUpperCase(),
1391
- country: e.country ? P(e.country) : void 0,
1551
+ country: e.country ? x(e.country) : void 0,
1392
1552
  assets: e.assets?.logo ? {
1393
1553
  logo: e.assets.logo
1394
1554
  } : void 0,
@@ -1400,18 +1560,18 @@ function F(e) {
1400
1560
  ]
1401
1561
  };
1402
1562
  }
1403
- function Ie(e) {
1563
+ function Le(e) {
1404
1564
  if (!e) return;
1405
- const t = (o) => o ? {
1406
- competitorOne: o.home_goals !== null ? String(o.home_goals) : "0",
1407
- competitorTwo: o.away_goals !== null ? String(o.away_goals) : "0"
1408
- } : void 0, n = t(e.ft_score);
1409
- if (n)
1565
+ const t = (n) => n ? {
1566
+ competitorOne: n.home_goals !== null ? String(n.home_goals) : "0",
1567
+ competitorTwo: n.away_goals !== null ? String(n.away_goals) : "0"
1568
+ } : void 0, s = t(e.ft_score);
1569
+ if (s)
1410
1570
  return {
1411
- competitorOne: n.competitorOne,
1412
- competitorTwo: n.competitorTwo,
1571
+ competitorOne: s.competitorOne,
1572
+ competitorTwo: s.competitorTwo,
1413
1573
  breakdown: {
1414
- total: n,
1574
+ total: s,
1415
1575
  halfTime: t(e.ht_score),
1416
1576
  regularTime: t(e.ft_score),
1417
1577
  extraTime: t(e.aet_score),
@@ -1419,16 +1579,16 @@ function Ie(e) {
1419
1579
  }
1420
1580
  };
1421
1581
  }
1422
- function b(e) {
1582
+ function R(e) {
1423
1583
  return {
1424
1584
  id: e.id,
1425
1585
  sport: e.sport ?? "football",
1426
- status: Ce(e),
1427
- timing: Se(e),
1428
- competitorOne: F(e.home_team),
1429
- competitorTwo: F(e.away_team),
1430
- score: Ie(e.scores),
1431
- competition: e.context?.competition ? Te(e.context.competition) : void 0,
1586
+ status: Oe(e),
1587
+ timing: Re(e),
1588
+ competitorOne: P(e.home_team),
1589
+ competitorTwo: P(e.away_team),
1590
+ score: Le(e.scores),
1591
+ competition: e.context?.competition ? Ee(e.context.competition) : void 0,
1432
1592
  lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
1433
1593
  updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
1434
1594
  isUndecided: e.undecided ?? void 0,
@@ -1440,39 +1600,39 @@ function b(e) {
1440
1600
  ]
1441
1601
  };
1442
1602
  }
1443
- function Ze(e) {
1444
- return b(e.data);
1603
+ function it(e) {
1604
+ return R(e.data);
1445
1605
  }
1446
- function we(e) {
1447
- return e.data.map(b);
1606
+ function rt(e) {
1607
+ return e.data.map(R);
1448
1608
  }
1449
- function Ae(e) {
1450
- return e.map(b);
1609
+ function ke(e) {
1610
+ return e.map(R);
1451
1611
  }
1452
- async function Ee(e, t, n) {
1453
- const o = await e.loyalty.getTemplateMatches(
1612
+ async function De(e, t, s) {
1613
+ const n = await e.loyalty.getTemplateMatches(
1454
1614
  t,
1455
- n?.groupId,
1456
- n?.disableCache
1615
+ s?.groupId,
1616
+ s?.disableCache
1457
1617
  );
1458
- return Ae(o);
1618
+ return ke(n);
1459
1619
  }
1460
- async function et(e, t, n, o) {
1461
- return (await Ee(e, t, o)).filter((a) => a.competitorOne.id === n || a.competitorTwo.id === n);
1620
+ async function dt(e, t, s, n) {
1621
+ return (await De(e, t, n)).filter((a) => a.competitorOne.id === s || a.competitorTwo.id === s);
1462
1622
  }
1463
- async function tt(e, t, n) {
1464
- const o = await e.loyalty.getTemplateById(t, n?.disableCache);
1623
+ async function ut(e, t, s) {
1624
+ const n = await e.loyalty.getTemplateById(t, s?.disableCache);
1465
1625
  return {
1466
- id: o.id,
1467
- name: o.name,
1468
- description: o.description,
1469
- type: o.type,
1470
- fromDate: o.fromDate,
1471
- toDate: o.toDate,
1472
- markets: o.markets || [],
1473
- teamIds: o.teamIds || [],
1474
- matchIds: o.matchIds || [],
1475
- groups: (o.groups || []).map((a) => ({
1626
+ id: n.id,
1627
+ name: n.name,
1628
+ description: n.description,
1629
+ type: n.type,
1630
+ fromDate: n.fromDate,
1631
+ toDate: n.toDate,
1632
+ markets: n.markets || [],
1633
+ teamIds: n.teamIds || [],
1634
+ matchIds: n.matchIds || [],
1635
+ groups: (n.groups || []).map((a) => ({
1476
1636
  groupId: a.groupId,
1477
1637
  label: a.label,
1478
1638
  flags: a.flags || [],
@@ -1482,32 +1642,32 @@ async function tt(e, t, n) {
1482
1642
  matchIds: a.filters?.matchIds || []
1483
1643
  }
1484
1644
  })),
1485
- gameIds: o.gameIds || [],
1486
- gameTypes: o.gameTypes || [],
1487
- competitionIds: o.competitionIds || [],
1488
- excludedProfileIds: o.excludedProfileIds || [],
1489
- rules: o.rules || "",
1490
- labels: o.labels || {},
1491
- customFields: o.customFields || {},
1645
+ gameIds: n.gameIds || [],
1646
+ gameTypes: n.gameTypes || [],
1647
+ competitionIds: n.competitionIds || [],
1648
+ excludedProfileIds: n.excludedProfileIds || [],
1649
+ rules: n.rules || "",
1650
+ labels: n.labels || {},
1651
+ customFields: n.customFields || {},
1492
1652
  // Convert BrandingModel to plain object
1493
- branding: o.branding ? JSON.parse(JSON.stringify(o.branding)) : {},
1653
+ branding: n.branding ? JSON.parse(JSON.stringify(n.branding)) : {},
1494
1654
  brandingId: null,
1495
1655
  // brandingId doesn't exist on TemplateByIdModel, using null
1496
- flags: o.flags || [],
1656
+ flags: n.flags || [],
1497
1657
  images: {
1498
- main: o.images?.main || null,
1499
- cover: o.images?.cover || null,
1500
- mobile: o.images?.mobile || null
1658
+ main: n.images?.main || null,
1659
+ cover: n.images?.cover || null,
1660
+ mobile: n.images?.mobile || null
1501
1661
  },
1502
- status: o.status,
1503
- automaticallyChangeStatus: o.automaticallyChangeStatus || !1,
1504
- createdAt: o.createdAt,
1505
- updatedAt: o.updatedAt,
1506
- related: o.related || [],
1507
- adContent: o.adContent || ""
1662
+ status: n.status,
1663
+ automaticallyChangeStatus: n.automaticallyChangeStatus || !1,
1664
+ createdAt: n.createdAt,
1665
+ updatedAt: n.updatedAt,
1666
+ related: n.related || [],
1667
+ adContent: n.adContent || ""
1508
1668
  };
1509
1669
  }
1510
- function Oe(e) {
1670
+ function Ne(e) {
1511
1671
  return {
1512
1672
  "1x2": "1X2",
1513
1673
  12: "12",
@@ -1524,110 +1684,112 @@ function Oe(e) {
1524
1684
  FIRST_HALF_AND_FINAL_RESULT: "FIRST_HALF_AND_FINAL_RESULT"
1525
1685
  }[e] || e.toUpperCase();
1526
1686
  }
1527
- function be(e, t) {
1528
- const n = /* @__PURE__ */ new Map();
1529
- return e.forEach((o, s) => {
1530
- if (!o || o.length === 0)
1687
+ function Fe(e, t) {
1688
+ const s = /* @__PURE__ */ new Map();
1689
+ return e.forEach((n, o) => {
1690
+ if (!n || n.length === 0)
1531
1691
  return;
1532
- const l = (t ? o.filter((d) => d.bookmaker && t.includes(d.bookmaker.id)) : o).filter((d) => d.bookmaker && d.markets && d.markets.length > 0).map((d) => {
1533
- const u = d.bookmaker, _ = u.assets?.[0], m = u.branding?.backgroundColor || _?.backgroundColor, h = u.branding?.textColor || (Re(m) ? "#FFFFFF" : "#000000"), C = _?.transparentBackgroundUrl || _?.logo, T = u.eventUrls?.find((f) => f.appType === "desktop")?.url || u.links?.find((f) => f.appType === "desktop")?.homepageUrl || u.url || "";
1692
+ const c = (t ? n.filter((r) => r.bookmaker && t.includes(r.bookmaker.id)) : n).filter((r) => r.bookmaker && r.markets && r.markets.length > 0).map((r) => {
1693
+ const d = r.bookmaker, f = d.assets?.[0], m = d.branding?.backgroundColor || f?.backgroundColor, _ = d.branding?.textColor || (Pe(m) ? "#FFFFFF" : "#000000"), S = f?.transparentBackgroundUrl || f?.logo, T = d.eventUrls?.find((y) => y.appType === "desktop")?.url || d.links?.find((y) => y.appType === "desktop")?.homepageUrl || d.url || "";
1534
1694
  return {
1535
1695
  operator: {
1536
- id: u.id,
1537
- name: u.name,
1696
+ id: d.id,
1697
+ name: d.name,
1538
1698
  url: T,
1539
1699
  branding: {
1540
1700
  backgroundColor: m,
1541
- textColor: h,
1542
- logo: C
1701
+ textColor: _,
1702
+ logo: S
1543
1703
  }
1544
1704
  },
1545
- type: d.type,
1705
+ type: r.type,
1546
1706
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1547
- markets: d.markets.map((f) => ({
1707
+ markets: r.markets.map((y) => ({
1548
1708
  type: {
1549
- id: f.type.id,
1550
- code: f.type.code,
1551
- name: f.type.name
1709
+ id: y.type.id,
1710
+ code: y.type.code,
1711
+ name: y.type.name
1552
1712
  },
1553
1713
  period: {
1554
- id: f.scope.id,
1555
- type: f.scope.type,
1556
- name: f.scope.name
1714
+ id: y.scope.id,
1715
+ type: y.scope.type,
1716
+ name: y.scope.name
1557
1717
  },
1558
1718
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1559
- selections: f.selections.map((v) => {
1560
- const x = v.urls?.find((M) => M.appType === "desktop")?.url;
1561
- let I = "NONE";
1562
- return v.movement === "UP" ? I = "UP" : v.movement === "DOWN" && (I = "DOWN"), {
1563
- id: v.id,
1564
- name: v.name,
1565
- code: v.code,
1566
- value: v.value,
1567
- odds: v.odds,
1568
- oddsOld: v.oddsOld,
1569
- movement: I,
1570
- url: x,
1571
- providerSelectionId: v.providerInfo?.selectionId
1719
+ selections: y.selections.map((C) => {
1720
+ const M = C.urls?.find((U) => U.appType === "desktop")?.url;
1721
+ let A = "NONE";
1722
+ return C.movement === "UP" ? A = "UP" : C.movement === "DOWN" && (A = "DOWN"), {
1723
+ id: C.id,
1724
+ name: C.name,
1725
+ code: C.code,
1726
+ value: C.value,
1727
+ odds: C.odds,
1728
+ oddsOld: C.oddsOld,
1729
+ movement: A,
1730
+ url: M,
1731
+ providerSelectionId: C.providerInfo?.selectionId
1572
1732
  };
1573
1733
  })
1574
1734
  }))
1575
1735
  };
1576
1736
  });
1577
- n.set(s, l);
1578
- }), n;
1737
+ s.set(o, c);
1738
+ }), s;
1579
1739
  }
1580
- function Re(e) {
1740
+ function Pe(e) {
1581
1741
  if (!e) return !0;
1582
- const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
1583
- return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
1742
+ const t = e.replace("#", ""), s = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
1743
+ return (0.2126 * s + 0.7152 * n + 0.0722 * o) / 255 < 0.5;
1584
1744
  }
1585
- async function ot(e, t, n) {
1745
+ async function ct(e, t, s) {
1586
1746
  if (!t || t.length === 0)
1587
1747
  return /* @__PURE__ */ new Map();
1588
- const o = {
1589
- oddType: n?.oddType || "ALL",
1590
- scopeType: n?.scopeType || "ORDINARY_TIME",
1591
- oddFormat: n?.oddFormat || "DECIMAL"
1748
+ const n = {
1749
+ oddType: s?.oddType || "ALL",
1750
+ scopeType: s?.scopeType || "ORDINARY_TIME",
1751
+ oddFormat: s?.oddFormat || "DECIMAL"
1592
1752
  };
1593
- n?.marketTypes && n.marketTypes.length > 0 && (o.marketTypes = n.marketTypes.map((a) => Oe(a)));
1594
- const s = await e.odds.getByMatchIds(t, o);
1595
- return be(s, n?.bookmakerIds);
1753
+ s?.marketTypes && s.marketTypes.length > 0 && (n.marketTypes = s.marketTypes.map((a) => Ne(a)));
1754
+ const o = await e.odds.getByMatchIds(t, n);
1755
+ return Fe(o, s?.bookmakerIds);
1596
1756
  }
1597
1757
  export {
1598
- Qe as A,
1599
- qe as B,
1600
- Xe as C,
1601
- Ee as D,
1602
- et as E,
1603
- tt as F,
1604
- Me as G,
1605
- Le as H,
1606
- De as S,
1607
- W as a,
1608
- Ne as b,
1609
- U as c,
1610
- Pe as d,
1611
- xe as e,
1758
+ Ze as A,
1759
+ ot as B,
1760
+ at as C,
1761
+ tt as D,
1762
+ nt as E,
1763
+ De as F,
1764
+ dt as G,
1765
+ ut as H,
1766
+ Ye as I,
1767
+ xe as J,
1768
+ Ue as S,
1769
+ j as a,
1770
+ $e as b,
1771
+ $ as c,
1772
+ He as d,
1773
+ Be as e,
1612
1774
  p as f,
1613
1775
  g,
1614
- Fe as h,
1615
- Ze as i,
1616
- we as j,
1617
- ke as k,
1618
- Ue as l,
1619
- ot as m,
1620
- ze as n,
1621
- je as o,
1622
- Ge as p,
1623
- Ve as q,
1624
- He as r,
1625
- Be as s,
1626
- r as t,
1627
- $e as u,
1628
- Ye as v,
1629
- We as w,
1630
- le as x,
1631
- Ke as y,
1632
- Je as z
1776
+ Ge as h,
1777
+ it as i,
1778
+ rt as j,
1779
+ Me as k,
1780
+ Ve as l,
1781
+ ct as m,
1782
+ st as n,
1783
+ Qe as o,
1784
+ We as p,
1785
+ ze as q,
1786
+ je as r,
1787
+ Ke as s,
1788
+ u as t,
1789
+ qe as u,
1790
+ Xe as v,
1791
+ Je as w,
1792
+ we as x,
1793
+ et as y,
1794
+ ye as z
1633
1795
  };