fansunited-data-layer 0.8.5 → 0.8.7

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 (26) hide show
  1. package/api/sportal365-sports/basketball/games/index.d.ts.map +1 -1
  2. package/api/sportal365-sports/basketball/games/transformers/game.d.ts.map +1 -1
  3. package/api/sportal365-sports/basketball/games/types.d.ts +6 -1
  4. package/api/sportal365-sports/basketball/games/types.d.ts.map +1 -1
  5. package/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +1 -1
  6. package/api/sportal365-sports/football/matches/types/odds.types.d.ts +2 -76
  7. package/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +1 -1
  8. package/api/sportal365-sports/shared/index.d.ts +2 -0
  9. package/api/sportal365-sports/shared/index.d.ts.map +1 -1
  10. package/api/sportal365-sports/shared/odds.transformer.d.ts +12 -0
  11. package/api/sportal365-sports/shared/odds.transformer.d.ts.map +1 -0
  12. package/api/sportal365-sports/shared/odds.types.d.ts +81 -0
  13. package/api/sportal365-sports/shared/odds.types.d.ts.map +1 -0
  14. package/api/sportal365-sports/tennis/matches/transformers/match.d.ts.map +1 -1
  15. package/api/sportal365-sports/tennis/matches/types.d.ts +2 -1
  16. package/api/sportal365-sports/tennis/matches/types.d.ts.map +1 -1
  17. package/client.cjs +1 -1
  18. package/client.js +2 -2
  19. package/fansunited-data-layer.cjs +1 -1
  20. package/fansunited-data-layer.js +385 -383
  21. package/{matches-B8E7KjZU.js → matches-BefXoB5p.js} +171 -167
  22. package/matches-CiVDiSIz.cjs +1 -0
  23. package/package.json +1 -1
  24. package/types/canonical/match.types.d.ts +2 -0
  25. package/types/canonical/match.types.d.ts.map +1 -1
  26. package/matches-B-ZxR-B9.cjs +0 -1
@@ -1,7 +1,7 @@
1
- import { t as _, g as A, f as se, c as V, S as ie, a as re, b as ae, d as ce, e as le, h as de } from "./matches-B8E7KjZU.js";
2
- import { i as _o, j as So, k as Co, l as Ao, m as Oo, n as No, o as Ro, p as Eo, q as Fo, r as Mo, s as Lo, u as Io, v as Do, w as Go, x as bo, y as Po, z as ko, A as Ho, B as Uo, C as Bo, D as $o, E as xo } from "./matches-B8E7KjZU.js";
3
- import { useMemo as G } from "react";
4
- function ue(e) {
1
+ import { t as _, g as A, f as ie, c as V, S as re, a as ee, b as ae, d as ce, e as de, h as le, i as ue } from "./matches-BefXoB5p.js";
2
+ import { j as So, k as Co, l as Ao, m as Oo, n as No, o as Ro, p as Fo, q as Eo, r as Mo, s as Lo, u as Io, v as Go, w as Do, x as Po, y as bo, z as ko, A as Ho, B as Uo, C as Bo, D as $o, E as xo, F as Wo } from "./matches-BefXoB5p.js";
3
+ import { useMemo as D } from "react";
4
+ function me(e) {
5
5
  return {
6
6
  entityType: "tournament",
7
7
  id: e.id.toString(),
@@ -23,7 +23,7 @@ function ue(e) {
23
23
  providerRef: _(e.uuid)
24
24
  };
25
25
  }
26
- function me(e) {
26
+ function fe(e) {
27
27
  return {
28
28
  entityType: "player",
29
29
  id: e.id.toString(),
@@ -45,7 +45,7 @@ function me(e) {
45
45
  providerRef: _(e.uuid)
46
46
  };
47
47
  }
48
- function fe(e) {
48
+ function ge(e) {
49
49
  return {
50
50
  entityType: "team",
51
51
  id: e.id.toString(),
@@ -68,7 +68,7 @@ function fe(e) {
68
68
  providerRef: _(e.uuid)
69
69
  };
70
70
  }
71
- function ge(e) {
71
+ function pe(e) {
72
72
  return {
73
73
  entityType: "president",
74
74
  id: e.id.toString(),
@@ -88,7 +88,7 @@ function ge(e) {
88
88
  providerRef: _(e.uuid)
89
89
  };
90
90
  }
91
- function pe(e) {
91
+ function ye(e) {
92
92
  return {
93
93
  entityType: "venue",
94
94
  id: e.id.toString(),
@@ -124,7 +124,7 @@ function pe(e) {
124
124
  providerRef: _(e.uuid)
125
125
  };
126
126
  }
127
- function ye(e) {
127
+ function he(e) {
128
128
  return {
129
129
  entityType: "coach",
130
130
  id: e.id.toString(),
@@ -144,31 +144,31 @@ function ye(e) {
144
144
  providerRef: _(e.uuid)
145
145
  };
146
146
  }
147
- function he(e) {
147
+ function Te(e) {
148
148
  switch (e.entity_type) {
149
149
  case "tournament":
150
- return ue(e);
151
- case "player":
152
150
  return me(e);
153
- case "team":
151
+ case "player":
154
152
  return fe(e);
155
- case "president":
153
+ case "team":
156
154
  return ge(e);
157
- case "venue":
155
+ case "president":
158
156
  return pe(e);
159
- case "coach":
157
+ case "venue":
160
158
  return ye(e);
159
+ case "coach":
160
+ return he(e);
161
161
  default:
162
162
  throw new Error(`Unknown entity type: ${e.entity_type}`);
163
163
  }
164
164
  }
165
- async function Ot(e, t) {
165
+ async function Nt(e, t) {
166
166
  if (!e.query || e.query.trim() === "")
167
167
  return {
168
168
  results: [],
169
169
  query: e.query || ""
170
170
  };
171
- const o = t || A(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await se.get({
171
+ const o = t || A(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await ie.get({
172
172
  path: "/search",
173
173
  params: {
174
174
  query: e.query.trim(),
@@ -185,12 +185,12 @@ async function Ot(e, t) {
185
185
  results: [],
186
186
  query: e.query
187
187
  } : {
188
- results: i.map(he),
188
+ results: i.map(Te),
189
189
  query: e.query
190
190
  };
191
191
  }
192
- const Te = V(ie);
193
- function ve(e) {
192
+ const ve = V(re);
193
+ function _e(e) {
194
194
  const t = {
195
195
  FINISHED: "finished",
196
196
  NOT_STARTED: "not_started",
@@ -217,13 +217,13 @@ function Q(e) {
217
217
  gender: e.gender
218
218
  };
219
219
  }
220
- function _e(e) {
220
+ function Se(e) {
221
221
  return {
222
222
  kickoffTime: new Date(e.game_time),
223
223
  currentMinute: e.minute
224
224
  };
225
225
  }
226
- function Se(e) {
226
+ function Ce(e) {
227
227
  if (!e.season?.competition) return;
228
228
  const t = e.season.competition;
229
229
  return {
@@ -249,7 +249,7 @@ function Se(e) {
249
249
  } : void 0
250
250
  };
251
251
  }
252
- function Ce(e) {
252
+ function Ae(e) {
253
253
  if (e)
254
254
  return {
255
255
  id: e.id,
@@ -257,9 +257,8 @@ function Ce(e) {
257
257
  slug: e.slug
258
258
  };
259
259
  }
260
- function Ae(e) {
260
+ function Oe(e) {
261
261
  if (!e || e.length === 0) return;
262
- console.log("[livescore:basketball] raw score entries:", JSON.stringify(e, null, 2));
263
262
  const t = e.filter((i) => i.result_type.category === "single_period");
264
263
  if (t.length === 0) return;
265
264
  let o = 0, n = 0;
@@ -281,21 +280,21 @@ function Ae(e) {
281
280
  }
282
281
  };
283
282
  }
284
- function Oe(e) {
283
+ function Ne(e) {
285
284
  if (e.winner)
286
285
  return {
287
286
  competitorId: e.winner.id
288
287
  };
289
288
  }
290
- function Ne(e) {
289
+ function Re(e) {
291
290
  return {
292
291
  id: e.id,
293
292
  slug: e.slug,
294
- status: ve(e.status),
295
- timing: _e(e),
293
+ status: _e(e.status),
294
+ timing: Se(e),
296
295
  competitorOne: Q(e.home_team),
297
296
  competitorTwo: Q(e.away_team),
298
- competition: Se(e),
297
+ competition: Ce(e),
299
298
  round: e.round ? {
300
299
  id: e.round.id,
301
300
  key: e.round.uuid,
@@ -303,9 +302,10 @@ function Ne(e) {
303
302
  type: "REGULAR",
304
303
  providerRef: _(e.round.uuid)
305
304
  } : void 0,
306
- venue: Ce(e.arena),
307
- score: Ae(e.score),
308
- winner: Oe(e),
305
+ venue: Ae(e.arena),
306
+ score: Oe(e.score),
307
+ winner: Ne(e),
308
+ odds: e.odds ? ee(e.odds) : void 0,
309
309
  coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
310
310
  providerRef: [
311
311
  {
@@ -315,15 +315,17 @@ function Ne(e) {
315
315
  ]
316
316
  };
317
317
  }
318
- async function Nt(e, t) {
318
+ async function Rt(e, t) {
319
319
  const o = t || A(), { sportal365Sports: n } = o;
320
- return (await Te.get({
320
+ return (await ve.get({
321
321
  path: "/games",
322
322
  params: {
323
323
  offset: "0",
324
324
  limit: "1000",
325
325
  competition_list: e?.competitionList,
326
326
  status_type: e?.statusTypes,
327
+ from_game_time: e?.fromGameTime,
328
+ to_game_time: e?.toGameTime,
327
329
  odd_client: e?.oddClient ?? n?.oddClient,
328
330
  odd_type: e?.oddType,
329
331
  market_types: e?.marketTypes,
@@ -334,9 +336,9 @@ async function Nt(e, t) {
334
336
  },
335
337
  next: e?.next,
336
338
  config: o
337
- })).games.map(Ne);
339
+ })).games.map(Re);
338
340
  }
339
- const Re = V(re);
341
+ const Fe = V(ae);
340
342
  function Ee(e) {
341
343
  const t = {
342
344
  FINISHED: "finished",
@@ -413,14 +415,14 @@ function X(e) {
413
415
  gender: e.details?.[0]?.gender
414
416
  };
415
417
  }
416
- function Fe(e) {
418
+ function Me(e) {
417
419
  return {
418
420
  kickoffTime: new Date(e.scheduled_start_time),
419
421
  phaseStartedAt: e.started_at ? new Date(e.started_at) : void 0,
420
422
  finishedAt: e.finished_at ? new Date(e.finished_at) : void 0
421
423
  };
422
424
  }
423
- function Me(e) {
425
+ function Le(e) {
424
426
  if (!e.tournament) return;
425
427
  const t = e.tournament;
426
428
  return {
@@ -436,23 +438,22 @@ function Me(e) {
436
438
  } : void 0
437
439
  };
438
440
  }
439
- function Le(e) {
441
+ function Ie(e) {
440
442
  if (!e.results || e.results.length === 0) return;
441
- console.log("[livescore:tennis] raw results entries:", JSON.stringify(e.results, null, 2));
442
- const t = e.results.filter((l) => /^set\d+$/i.test(l.type.code));
443
+ const t = e.results.filter((d) => /^set\d+$/i.test(d.type.code));
443
444
  if (t.length === 0) return;
444
445
  const o = [];
445
- for (const l of t) {
446
- const d = l.values.find((c) => c.position === "1"), u = l.values.find((c) => c.position === "2");
447
- !d || !u || d.value == null || u.value == null || o.push({
448
- competitorOne: d.value,
446
+ for (const d of t) {
447
+ const l = d.values.find((c) => c.position === "1"), u = d.values.find((c) => c.position === "2");
448
+ !l || !u || l.value == null || u.value == null || o.push({
449
+ competitorOne: l.value,
449
450
  competitorTwo: u.value
450
451
  });
451
452
  }
452
453
  if (o.length === 0) return;
453
- const n = e.results.find((l) => l.type.code === "setswon"), s = n?.values.find((l) => l.position === "1"), i = n?.values.find((l) => l.position === "2");
454
+ const n = e.results.find((d) => d.type.code === "setswon"), s = n?.values.find((d) => d.position === "1"), i = n?.values.find((d) => d.position === "2");
454
455
  let r, a;
455
- return s?.value != null && i?.value != null ? (r = parseInt(s.value), a = parseInt(i.value)) : (r = o.filter((l) => parseInt(l.competitorOne) > parseInt(l.competitorTwo)).length, a = o.filter((l) => parseInt(l.competitorTwo) > parseInt(l.competitorOne)).length), {
456
+ return s?.value != null && i?.value != null ? (r = parseInt(s.value), a = parseInt(i.value)) : (r = o.filter((d) => parseInt(d.competitorOne) > parseInt(d.competitorTwo)).length, a = o.filter((d) => parseInt(d.competitorTwo) > parseInt(d.competitorOne)).length), {
456
457
  competitorOne: String(r),
457
458
  competitorTwo: String(a),
458
459
  breakdown: {
@@ -464,7 +465,7 @@ function Le(e) {
464
465
  }
465
466
  };
466
467
  }
467
- function Ie(e) {
468
+ function Ge(e) {
468
469
  const t = e.participants.find((o) => o.winner === "YES");
469
470
  if (t)
470
471
  return {
@@ -477,10 +478,10 @@ function De(e) {
477
478
  id: e.id,
478
479
  slug: e.slug,
479
480
  status: Ee(e.status),
480
- timing: Fe(e),
481
+ timing: Me(e),
481
482
  competitorOne: X(t[0]),
482
483
  competitorTwo: X(t[1]),
483
- competition: Me(e),
484
+ competition: Le(e),
484
485
  round: e.round ? {
485
486
  id: e.round.id,
486
487
  key: e.round.uuid,
@@ -488,8 +489,9 @@ function De(e) {
488
489
  type: "REGULAR",
489
490
  providerRef: _(e.round.uuid)
490
491
  } : void 0,
491
- score: Le(e),
492
- winner: Ie(e),
492
+ score: Ie(e),
493
+ winner: Ge(e),
494
+ odds: e.odds ? ee(e.odds) : void 0,
493
495
  coverage: e.coverage?.type === "NOT_LIVE" ? "UNKNOWN" : e.coverage?.type,
494
496
  metadata: {
495
497
  matchType: e.type,
@@ -505,9 +507,9 @@ function De(e) {
505
507
  ]
506
508
  };
507
509
  }
508
- async function Rt(e, t) {
510
+ async function Ft(e, t) {
509
511
  const o = t || A(), { sportal365Sports: n } = o;
510
- return (await Re.get({
512
+ return (await Fe.get({
511
513
  path: "/matches/livescore",
512
514
  params: {
513
515
  date: e?.date,
@@ -530,7 +532,7 @@ async function Rt(e, t) {
530
532
  config: o
531
533
  })).matches.map(De);
532
534
  }
533
- const Ge = V(ae);
535
+ const Pe = V(ce);
534
536
  function R(e) {
535
537
  return {
536
538
  language: e.language,
@@ -539,13 +541,13 @@ function R(e) {
539
541
  threeLetterCode: e.three_letter_code ?? void 0
540
542
  };
541
543
  }
542
- function E(e) {
544
+ function F(e) {
543
545
  if (!(!e || !e.url))
544
546
  return {
545
547
  url: e.url
546
548
  };
547
549
  }
548
- function D(e) {
550
+ function G(e) {
549
551
  if (e)
550
552
  return {
551
553
  id: e.id,
@@ -554,7 +556,7 @@ function D(e) {
554
556
  shortName: e.short_name ?? void 0,
555
557
  threeLetterCode: e.three_letter_code ?? void 0,
556
558
  translations: e.translations.map(R),
557
- displayAsset: E(e.display_asset),
559
+ displayAsset: F(e.display_asset),
558
560
  slug: e.slug,
559
561
  providerRef: e.id
560
562
  };
@@ -568,11 +570,11 @@ function K(e) {
568
570
  shortName: e.short_name ?? void 0,
569
571
  threeLetterCode: e.three_letter_code ?? void 0,
570
572
  translations: e.translations.map(R),
571
- displayAsset: E(e.display_asset),
573
+ displayAsset: F(e.display_asset),
572
574
  slug: e.slug,
573
575
  tagScore: e.tag_score ?? void 0,
574
576
  sport: e.sport,
575
- country: D(e.country),
577
+ country: G(e.country),
576
578
  gender: e.gender,
577
579
  competitionIds: e.competition_ids,
578
580
  type: e.type,
@@ -581,7 +583,7 @@ function K(e) {
581
583
  providerRef: e.id
582
584
  };
583
585
  }
584
- function ee(e) {
586
+ function te(e) {
585
587
  return {
586
588
  entityType: "city",
587
589
  id: e.id,
@@ -590,11 +592,11 @@ function ee(e) {
590
592
  shortName: e.short_name ?? void 0,
591
593
  threeLetterCode: e.three_letter_code ?? void 0,
592
594
  translations: e.translations.map(R),
593
- displayAsset: E(e.display_asset),
595
+ displayAsset: F(e.display_asset),
594
596
  slug: e.slug,
595
597
  tagScore: e.tag_score ?? void 0,
596
598
  sport: e.sport,
597
- country: D(e.country),
599
+ country: G(e.country),
598
600
  providerRef: e.id
599
601
  };
600
602
  }
@@ -607,16 +609,16 @@ function be(e) {
607
609
  shortName: e.short_name ?? void 0,
608
610
  threeLetterCode: e.three_letter_code ?? void 0,
609
611
  translations: e.translations.map(R),
610
- displayAsset: E(e.display_asset),
612
+ displayAsset: F(e.display_asset),
611
613
  slug: e.slug,
612
614
  tagScore: e.tag_score ?? void 0,
613
615
  sport: e.sport,
614
- country: D(e.country),
616
+ country: G(e.country),
615
617
  gender: e.gender,
616
618
  providerRef: e.id
617
619
  };
618
620
  }
619
- function Pe(e) {
621
+ function ke(e) {
620
622
  return {
621
623
  entityType: "player",
622
624
  id: e.id,
@@ -625,18 +627,18 @@ function Pe(e) {
625
627
  shortName: e.short_name ?? void 0,
626
628
  threeLetterCode: e.three_letter_code ?? void 0,
627
629
  translations: e.translations.map(R),
628
- displayAsset: E(e.display_asset),
630
+ displayAsset: F(e.display_asset),
629
631
  slug: e.slug,
630
632
  tagScore: e.tag_score ?? void 0,
631
633
  sport: e.sport,
632
- country: D(e.country),
634
+ country: G(e.country),
633
635
  gender: e.gender,
634
636
  birthdate: e.birthdate ?? void 0,
635
637
  position: e.position ?? void 0,
636
638
  providerRef: e.id
637
639
  };
638
640
  }
639
- function ke(e) {
641
+ function He(e) {
640
642
  return {
641
643
  entityType: "coach",
642
644
  id: e.id,
@@ -645,17 +647,17 @@ function ke(e) {
645
647
  shortName: e.short_name ?? void 0,
646
648
  threeLetterCode: e.three_letter_code ?? void 0,
647
649
  translations: e.translations.map(R),
648
- displayAsset: E(e.display_asset),
650
+ displayAsset: F(e.display_asset),
649
651
  slug: e.slug,
650
652
  tagScore: e.tag_score ?? void 0,
651
653
  sport: e.sport,
652
- country: D(e.country),
654
+ country: G(e.country),
653
655
  gender: e.gender,
654
656
  birthdate: e.birthdate ?? void 0,
655
657
  providerRef: e.id
656
658
  };
657
659
  }
658
- function He(e) {
660
+ function Ue(e) {
659
661
  return {
660
662
  entityType: "referee",
661
663
  id: e.id,
@@ -664,17 +666,17 @@ function He(e) {
664
666
  shortName: e.short_name ?? void 0,
665
667
  threeLetterCode: e.three_letter_code ?? void 0,
666
668
  translations: e.translations.map(R),
667
- displayAsset: E(e.display_asset),
669
+ displayAsset: F(e.display_asset),
668
670
  slug: e.slug,
669
671
  tagScore: e.tag_score ?? void 0,
670
672
  sport: e.sport,
671
- country: D(e.country),
673
+ country: G(e.country),
672
674
  gender: e.gender,
673
675
  birthdate: e.birthdate ?? void 0,
674
676
  providerRef: e.id
675
677
  };
676
678
  }
677
- function Ue(e) {
679
+ function Be(e) {
678
680
  return {
679
681
  entityType: "venue",
680
682
  id: e.id,
@@ -683,16 +685,16 @@ function Ue(e) {
683
685
  shortName: e.short_name ?? void 0,
684
686
  threeLetterCode: e.three_letter_code ?? void 0,
685
687
  translations: e.translations.map(R),
686
- displayAsset: E(e.display_asset),
688
+ displayAsset: F(e.display_asset),
687
689
  slug: e.slug,
688
690
  tagScore: e.tag_score ?? void 0,
689
691
  sport: e.sport,
690
- country: D(e.country),
691
- city: e.city ? ee(e.city) : void 0,
692
+ country: G(e.country),
693
+ city: e.city ? te(e.city) : void 0,
692
694
  providerRef: e.id
693
695
  };
694
696
  }
695
- function Be(e) {
697
+ function $e(e) {
696
698
  return {
697
699
  entityType: e.entity_type,
698
700
  id: e.id,
@@ -701,18 +703,18 @@ function Be(e) {
701
703
  shortName: e.short_name ?? void 0,
702
704
  threeLetterCode: e.three_letter_code ?? void 0,
703
705
  translations: e.translations.map(R),
704
- displayAsset: E(e.display_asset),
706
+ displayAsset: F(e.display_asset),
705
707
  slug: e.slug,
706
708
  tagScore: e.tag_score ?? void 0,
707
709
  sport: e.sport,
708
- country: D(e.country),
710
+ country: G(e.country),
709
711
  gender: e.gender,
710
712
  type: e.type ?? void 0,
711
713
  region: e.region ?? void 0,
712
714
  providerRef: e.id
713
715
  };
714
716
  }
715
- function $e(e) {
717
+ function xe(e) {
716
718
  return {
717
719
  entityType: "match",
718
720
  id: e.id,
@@ -721,7 +723,7 @@ function $e(e) {
721
723
  shortName: e.short_name ?? void 0,
722
724
  threeLetterCode: e.three_letter_code ?? void 0,
723
725
  translations: e.translations.map(R),
724
- displayAsset: E(e.display_asset),
726
+ displayAsset: F(e.display_asset),
725
727
  slug: e.slug,
726
728
  tagScore: e.tag_score ?? void 0,
727
729
  sport: e.sport,
@@ -732,7 +734,7 @@ function $e(e) {
732
734
  providerRef: e.id
733
735
  };
734
736
  }
735
- function xe(e) {
737
+ function We(e) {
736
738
  return {
737
739
  entityType: "country",
738
740
  id: e.id,
@@ -741,36 +743,36 @@ function xe(e) {
741
743
  shortName: e.short_name ?? void 0,
742
744
  threeLetterCode: e.three_letter_code ?? void 0,
743
745
  translations: e.translations.map(R),
744
- displayAsset: E(e.display_asset),
746
+ displayAsset: F(e.display_asset),
745
747
  slug: e.slug,
746
748
  tagScore: e.tag_score ?? void 0,
747
749
  sport: e.sport,
748
750
  providerRef: e.id
749
751
  };
750
752
  }
751
- function We(e) {
753
+ function qe(e) {
752
754
  switch (e.entity_type) {
753
755
  case "team":
754
756
  return K(e);
755
757
  case "city":
756
- return ee(e);
758
+ return te(e);
757
759
  case "horse":
758
760
  return be(e);
759
761
  case "player":
760
- return Pe(e);
761
- case "coach":
762
762
  return ke(e);
763
- case "referee":
763
+ case "coach":
764
764
  return He(e);
765
- case "venue":
765
+ case "referee":
766
766
  return Ue(e);
767
+ case "venue":
768
+ return Be(e);
767
769
  case "tournament":
768
770
  case "competition":
769
- return Be(e);
770
- case "match":
771
771
  return $e(e);
772
- case "country":
772
+ case "match":
773
773
  return xe(e);
774
+ case "country":
775
+ return We(e);
774
776
  default: {
775
777
  const t = e;
776
778
  throw new Error(`Unknown entity type: ${t.entity_type}`);
@@ -780,7 +782,7 @@ function We(e) {
780
782
  async function Et(e = {}, t) {
781
783
  const o = t ?? A(), n = {};
782
784
  e.name && (n.name = e.name), e.entityTypes && e.entityTypes.length > 0 && (n.entity_type = e.entityTypes.join(",")), e.sports && e.sports.length > 0 && (n.sport = e.sports.join(",")), e.eventStartTime && (n.event_start_time = e.eventStartTime), e.ids && e.ids.length > 0 && (n.ids = e.ids.join(",")), e.competitionIds && e.competitionIds.length > 0 && (n.competition_ids = e.competitionIds.join(",")), e.domain && (n.domain = e.domain), e.inputLanguage && (n.input_language = e.inputLanguage), e.translationLanguage && (n.translation_language = e.translationLanguage), e.limit !== void 0 && (n.limit = e.limit.toString()), e.offset !== void 0 && (n.offset = e.offset.toString());
783
- const s = await Ge.get({
785
+ const s = await Pe.get({
784
786
  path: "/suggest",
785
787
  params: n,
786
788
  next: e.next,
@@ -790,12 +792,12 @@ async function Et(e = {}, t) {
790
792
  results: [],
791
793
  query: e.name
792
794
  } : {
793
- results: s.results.map(We),
795
+ results: s.results.map(qe),
794
796
  query: e.name
795
797
  };
796
798
  }
797
- const qe = V(ce);
798
- function Ve(e, t) {
799
+ const Ve = V(de);
800
+ function je(e, t) {
799
801
  return {
800
802
  teamId: e.id,
801
803
  teamName: e.name,
@@ -807,8 +809,8 @@ function Ve(e, t) {
807
809
  }))
808
810
  };
809
811
  }
810
- async function Ft(e, t) {
811
- const o = t || A(), n = e.next ?? { revalidate: 600 }, s = await qe.get({
812
+ async function Mt(e, t) {
813
+ const o = t || A(), n = e.next ?? { revalidate: 600 }, s = await Ve.get({
812
814
  path: "/statistics/aggregate",
813
815
  params: {
814
816
  participant_ids: e.teamId,
@@ -820,9 +822,9 @@ async function Ft(e, t) {
820
822
  });
821
823
  if (!s.data || s.data.length === 0)
822
824
  throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
823
- return Ve(s.data[0], e.seasonId);
825
+ return je(s.data[0], e.seasonId);
824
826
  }
825
- function je(e) {
827
+ function Ke(e) {
826
828
  const t = e.replace(/\/$/, "");
827
829
  function o(n) {
828
830
  return `${t}${n}`;
@@ -840,9 +842,9 @@ function je(e) {
840
842
  if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), n.params)
841
843
  for (const [u, c] of Object.entries(n.params))
842
844
  c !== void 0 && (Array.isArray(c) ? c.length > 0 && r.searchParams.set(u, c.join(",")) : r.searchParams.set(u, c));
843
- const a = 3e4, l = new URL(r.toString());
844
- l.searchParams.delete("key"), l.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", l.toString());
845
- const d = await fetch(r.toString(), {
845
+ const a = 3e4, d = new URL(r.toString());
846
+ d.searchParams.delete("key"), d.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", d.toString());
847
+ const l = await fetch(r.toString(), {
846
848
  method: "GET",
847
849
  headers: {
848
850
  Accept: "application/json",
@@ -854,26 +856,26 @@ function je(e) {
854
856
  // Next.js cache options for ISR/on-demand revalidation
855
857
  ...n.next && { next: n.next }
856
858
  });
857
- if (!d.ok) {
858
- let u = `Fans United API error: ${d.status} ${d.statusText}`;
859
+ if (!l.ok) {
860
+ let u = `Fans United API error: ${l.status} ${l.statusText}`;
859
861
  try {
860
- const c = await d.text();
862
+ const c = await l.text();
861
863
  c && (u += ` - ${c}`);
862
864
  } catch (c) {
863
865
  console.error("[Fans United HTTP] Failed to read error response body:", {
864
866
  error: c instanceof Error ? c.message : String(c),
865
- status: d.status,
866
- statusText: d.statusText
867
+ status: l.status,
868
+ statusText: l.statusText
867
869
  });
868
870
  }
869
871
  throw new Error(u);
870
872
  }
871
- return d.json();
873
+ return l.json();
872
874
  }
873
875
  };
874
876
  }
875
- const Ke = "https://football.fansunitedapi.com", I = je(Ke);
876
- function Ye(e) {
877
+ const Ye = "https://football.fansunitedapi.com", I = Ke(Ye);
878
+ function ze(e) {
877
879
  return {
878
880
  id: String(e.id),
879
881
  name: e.name,
@@ -886,7 +888,7 @@ function Ye(e) {
886
888
  ]
887
889
  };
888
890
  }
889
- function ze(e) {
891
+ function Je(e) {
890
892
  const t = {
891
893
  id: String(e.id),
892
894
  name: e.name,
@@ -915,16 +917,16 @@ function ze(e) {
915
917
  ]
916
918
  }), e.assets?.logo && (t.assets = {
917
919
  logo: e.assets.logo
918
- }), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(Ye)), e.current_season && (t.season = {
920
+ }), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(ze)), e.current_season && (t.season = {
919
921
  id: String(e.current_season.id),
920
922
  name: e.current_season.name,
921
923
  status: e.current_season.active ? "ACTIVE" : "INACTIVE"
922
924
  }), t;
923
925
  }
924
- function Je(e) {
925
- return e.map(ze);
926
+ function Qe(e) {
927
+ return e.map(Je);
926
928
  }
927
- async function Mt(e, t) {
929
+ async function Lt(e, t) {
928
930
  const o = {};
929
931
  e?.lang ? o.lang = e.lang : o.lang = "EN", e?.sortField && (o.sort_field = e.sortField), e?.sortOrder && (o.sort_order = e.sortOrder), e?.page !== void 0 && (o.page = String(e.page)), e?.perPage !== void 0 && (o.per_page = String(e.perPage)), e?.countryId !== void 0 && (o.country_id = String(e.countryId)), e?.active !== void 0 && (o.active = e.active ? "1" : "0");
930
932
  const n = await I.get({
@@ -932,12 +934,12 @@ async function Mt(e, t) {
932
934
  params: o,
933
935
  config: t,
934
936
  next: e?.next
935
- }), s = n.data.map((d) => d.id), i = new Set(s);
937
+ }), s = n.data.map((l) => l.id), i = new Set(s);
936
938
  s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
937
- const r = Je(n.data), a = /* @__PURE__ */ new Set(), l = r.filter((d) => a.has(d.id) ? !1 : (a.add(d.id), !0));
938
- return r.length !== l.length && console.warn(`Removed ${r.length - l.length} duplicate competitions`), l;
939
+ const r = Qe(n.data), a = /* @__PURE__ */ new Set(), d = r.filter((l) => a.has(l.id) ? !1 : (a.add(l.id), !0));
940
+ return r.length !== d.length && console.warn(`Removed ${r.length - d.length} duplicate competitions`), d;
939
941
  }
940
- function Qe(e) {
942
+ function Xe(e) {
941
943
  return {
942
944
  id: e.id,
943
945
  name: e.name,
@@ -953,13 +955,13 @@ function Qe(e) {
953
955
  ]
954
956
  };
955
957
  }
956
- function Xe(e) {
958
+ function Ze(e) {
957
959
  return {
958
960
  id: e.id,
959
961
  name: e.name,
960
962
  type: e.type?.toUpperCase() || "LEAGUE",
961
963
  gender: e.gender?.toUpperCase(),
962
- country: e.country ? Qe(e.country) : void 0,
964
+ country: e.country ? Xe(e.country) : void 0,
963
965
  assets: e.assets?.logo ? {
964
966
  logo: e.assets.logo
965
967
  } : void 0,
@@ -971,10 +973,10 @@ function Xe(e) {
971
973
  ]
972
974
  };
973
975
  }
974
- function Ze(e) {
975
- return Xe(e.data);
976
+ function we(e) {
977
+ return Ze(e.data);
976
978
  }
977
- async function Lt(e, t, o) {
979
+ async function It(e, t, o) {
978
980
  const n = o || A(), s = {};
979
981
  t?.lang && (s.lang = t.lang);
980
982
  const i = await I.get({
@@ -983,9 +985,9 @@ async function Lt(e, t, o) {
983
985
  next: t?.next,
984
986
  config: n
985
987
  });
986
- return Ze(i);
988
+ return we(i);
987
989
  }
988
- function we(e) {
990
+ function et(e) {
989
991
  return {
990
992
  id: e.id,
991
993
  name: e.name,
@@ -999,7 +1001,7 @@ function we(e) {
999
1001
  ]
1000
1002
  };
1001
1003
  }
1002
- function te(e) {
1004
+ function oe(e) {
1003
1005
  return {
1004
1006
  id: e.id,
1005
1007
  name: e.name,
@@ -1007,7 +1009,7 @@ function te(e) {
1007
1009
  threeLetterCode: e.code,
1008
1010
  type: e.national ? "national" : "club",
1009
1011
  gender: e.gender ? e.gender.toUpperCase() : void 0,
1010
- country: e.country ? we(e.country) : void 0,
1012
+ country: e.country ? et(e.country) : void 0,
1011
1013
  assets: e.assets?.logo ? {
1012
1014
  logo: e.assets.logo
1013
1015
  } : void 0,
@@ -1027,13 +1029,13 @@ function te(e) {
1027
1029
  ]
1028
1030
  };
1029
1031
  }
1030
- function et(e) {
1031
- return te(e.data);
1032
- }
1033
1032
  function tt(e) {
1034
- return e.data.map(te);
1033
+ return oe(e.data);
1035
1034
  }
1036
- async function It(e, t, o) {
1035
+ function ot(e) {
1036
+ return e.data.map(oe);
1037
+ }
1038
+ async function Gt(e, t, o) {
1037
1039
  const n = o || A(), s = {};
1038
1040
  t?.lang && (s.lang = t.lang);
1039
1041
  const i = await I.get({
@@ -1042,7 +1044,7 @@ async function It(e, t, o) {
1042
1044
  next: t?.next,
1043
1045
  config: n
1044
1046
  });
1045
- return et(i);
1047
+ return tt(i);
1046
1048
  }
1047
1049
  async function Dt(e, t) {
1048
1050
  const o = t || A(), n = {};
@@ -1053,7 +1055,7 @@ async function Dt(e, t) {
1053
1055
  next: e?.next,
1054
1056
  config: o
1055
1057
  });
1056
- return tt(s);
1058
+ return ot(s);
1057
1059
  }
1058
1060
  function Y(e) {
1059
1061
  return {
@@ -1069,7 +1071,7 @@ function Y(e) {
1069
1071
  ]
1070
1072
  };
1071
1073
  }
1072
- function ot(e) {
1074
+ function nt(e) {
1073
1075
  return {
1074
1076
  id: e.id,
1075
1077
  name: e.name,
@@ -1090,7 +1092,7 @@ function ot(e) {
1090
1092
  ]
1091
1093
  };
1092
1094
  }
1093
- function nt(e) {
1095
+ function st(e) {
1094
1096
  return {
1095
1097
  id: e.id,
1096
1098
  name: e.name,
@@ -1108,7 +1110,7 @@ function nt(e) {
1108
1110
  ]
1109
1111
  };
1110
1112
  }
1111
- function oe(e) {
1113
+ function ne(e) {
1112
1114
  return {
1113
1115
  type: "player",
1114
1116
  id: e.id,
@@ -1119,8 +1121,8 @@ function oe(e) {
1119
1121
  assets: e.assets?.headshot ? {
1120
1122
  photo: e.assets.headshot
1121
1123
  } : void 0,
1122
- teams: e.teams?.map(ot),
1123
- competitions: e.competitions?.map(nt),
1124
+ teams: e.teams?.map(nt),
1125
+ competitions: e.competitions?.map(st),
1124
1126
  providerRef: [
1125
1127
  {
1126
1128
  provider: "fansunited",
@@ -1129,13 +1131,13 @@ function oe(e) {
1129
1131
  ]
1130
1132
  };
1131
1133
  }
1132
- function st(e) {
1133
- return oe(e.data);
1134
- }
1135
1134
  function it(e) {
1136
- return e.data.map(oe);
1135
+ return ne(e.data);
1137
1136
  }
1138
- async function Gt(e, t, o) {
1137
+ function rt(e) {
1138
+ return e.data.map(ne);
1139
+ }
1140
+ async function Pt(e, t, o) {
1139
1141
  const n = o || A(), s = {};
1140
1142
  t?.lang && (s.lang = t.lang);
1141
1143
  const i = await I.get({
@@ -1144,7 +1146,7 @@ async function Gt(e, t, o) {
1144
1146
  next: t?.next,
1145
1147
  config: n
1146
1148
  });
1147
- return st(i);
1149
+ return it(i);
1148
1150
  }
1149
1151
  async function bt(e, t) {
1150
1152
  const o = t || A(), n = {};
@@ -1155,9 +1157,9 @@ async function bt(e, t) {
1155
1157
  next: e?.next,
1156
1158
  config: o
1157
1159
  });
1158
- return it(s);
1160
+ return rt(s);
1159
1161
  }
1160
- async function Pt(e, t, o) {
1162
+ async function kt(e, t, o) {
1161
1163
  const n = o || A(), s = {};
1162
1164
  t?.lang && (s.lang = t.lang);
1163
1165
  const i = await I.get({
@@ -1168,7 +1170,7 @@ async function Pt(e, t, o) {
1168
1170
  });
1169
1171
  return le(i);
1170
1172
  }
1171
- async function kt(e, t) {
1173
+ async function Ht(e, t) {
1172
1174
  const o = t || A(), n = {};
1173
1175
  e?.lang && (n.lang = e.lang), e?.competitions && (n.competitions = e.competitions), e?.countries && (n.countries = e.countries), e?.fromDate && (n.from_date = e.fromDate), e?.toDate && (n.to_date = e.toDate), e?.matches && (n.matches = e.matches), e?.teams && (n.teams = e.teams), e?.status && (n.status = e.status), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder), e?.showDeleted !== void 0 && (n.show_deleted = e.showDeleted ? "true" : "false");
1174
1176
  const s = await I.get({
@@ -1177,7 +1179,7 @@ async function kt(e, t) {
1177
1179
  next: e?.next,
1178
1180
  config: o
1179
1181
  });
1180
- return de(s);
1182
+ return ue(s);
1181
1183
  }
1182
1184
  function z(e) {
1183
1185
  return {
@@ -1193,7 +1195,7 @@ function z(e) {
1193
1195
  ]
1194
1196
  };
1195
1197
  }
1196
- function rt(e) {
1198
+ function at(e) {
1197
1199
  return {
1198
1200
  id: e.id,
1199
1201
  name: e.name,
@@ -1213,7 +1215,7 @@ function rt(e) {
1213
1215
  ]
1214
1216
  };
1215
1217
  }
1216
- function at(e) {
1218
+ function ct(e) {
1217
1219
  return {
1218
1220
  type: "player",
1219
1221
  id: e.id,
@@ -1233,7 +1235,7 @@ function at(e) {
1233
1235
  ]
1234
1236
  };
1235
1237
  }
1236
- function ct(e) {
1238
+ function dt(e) {
1237
1239
  return {
1238
1240
  type: e.national ? "national" : "club",
1239
1241
  id: e.id,
@@ -1256,7 +1258,7 @@ function ct(e) {
1256
1258
  function j(e) {
1257
1259
  switch (e.entity_type) {
1258
1260
  case "competition": {
1259
- const t = rt(e);
1261
+ const t = at(e);
1260
1262
  return {
1261
1263
  source: "FOOTBALL",
1262
1264
  entityType: "competition",
@@ -1265,7 +1267,7 @@ function j(e) {
1265
1267
  };
1266
1268
  }
1267
1269
  case "player": {
1268
- const t = at(e);
1270
+ const t = ct(e);
1269
1271
  return {
1270
1272
  source: "FOOTBALL",
1271
1273
  entityType: "player",
@@ -1274,7 +1276,7 @@ function j(e) {
1274
1276
  };
1275
1277
  }
1276
1278
  case "team": {
1277
- const t = ct(e);
1279
+ const t = dt(e);
1278
1280
  return {
1279
1281
  source: "FOOTBALL",
1280
1282
  entityType: "team",
@@ -1289,13 +1291,13 @@ function j(e) {
1289
1291
  throw new Error(`Unknown entity type: ${e.entity_type}`);
1290
1292
  }
1291
1293
  }
1292
- async function Ht(e, t) {
1294
+ async function Ut(e, t) {
1293
1295
  if (!e.query || e.query.trim() === "")
1294
1296
  return [];
1295
1297
  const o = t || A(), n = {
1296
1298
  q: e.query.trim()
1297
- }, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((l) => {
1298
- switch (l) {
1299
+ }, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((d) => {
1300
+ switch (d) {
1299
1301
  case "team":
1300
1302
  return "teams";
1301
1303
  case "player":
@@ -1303,7 +1305,7 @@ async function Ht(e, t) {
1303
1305
  case "competition":
1304
1306
  return "competitions";
1305
1307
  default:
1306
- return l;
1308
+ return d;
1307
1309
  }
1308
1310
  });
1309
1311
  n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
@@ -1313,35 +1315,35 @@ async function Ht(e, t) {
1313
1315
  next: e.next,
1314
1316
  config: o
1315
1317
  }), a = [];
1316
- return r.data && (r.data.competitions && r.data.competitions.forEach((l) => {
1317
- const d = j({ ...l, entity_type: "competition" });
1318
- d && a.push(d);
1319
- }), r.data.teams && r.data.teams.forEach((l) => {
1320
- const d = j({ ...l, entity_type: "team" });
1321
- d && a.push(d);
1322
- }), r.data.players && r.data.players.forEach((l) => {
1323
- const d = j({ ...l, entity_type: "player" });
1324
- d && a.push(d);
1318
+ return r.data && (r.data.competitions && r.data.competitions.forEach((d) => {
1319
+ const l = j({ ...d, entity_type: "competition" });
1320
+ l && a.push(l);
1321
+ }), r.data.teams && r.data.teams.forEach((d) => {
1322
+ const l = j({ ...d, entity_type: "team" });
1323
+ l && a.push(l);
1324
+ }), r.data.players && r.data.players.forEach((d) => {
1325
+ const l = j({ ...d, entity_type: "player" });
1326
+ l && a.push(l);
1325
1327
  })), a;
1326
1328
  }
1327
- function Ut(e) {
1329
+ function Bt(e) {
1328
1330
  return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((o) => o.active) ?? e.seasons[0];
1329
1331
  }
1330
- function Bt(e, t) {
1332
+ function $t(e, t) {
1331
1333
  const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
1332
1334
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= o;
1333
1335
  return i && r && a;
1334
1336
  });
1335
1337
  return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
1336
1338
  }
1337
- function $t(e, t) {
1339
+ function xt(e, t) {
1338
1340
  const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
1339
1341
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
1340
1342
  return i && r && a;
1341
1343
  });
1342
1344
  return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
1343
1345
  }
1344
- function xt(e, t) {
1346
+ function Wt(e, t) {
1345
1347
  const o = /* @__PURE__ */ new Date();
1346
1348
  return t.filter((s) => {
1347
1349
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED" || s.status.type === "LIVE", a = new Date(s.timing.kickoffTime) >= o || s.status.type === "LIVE";
@@ -1350,7 +1352,7 @@ function xt(e, t) {
1350
1352
  (s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
1351
1353
  );
1352
1354
  }
1353
- function Wt(e, t) {
1355
+ function qt(e, t) {
1354
1356
  const o = /* @__PURE__ */ new Date();
1355
1357
  return t.filter((s) => {
1356
1358
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
@@ -1359,20 +1361,20 @@ function Wt(e, t) {
1359
1361
  (s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
1360
1362
  );
1361
1363
  }
1362
- function qt(e, t, o) {
1364
+ function Vt(e, t, o) {
1363
1365
  const n = o.filter((r) => r.status.type === "FINISHED"), s = o.filter(
1364
1366
  (r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
1365
1367
  ), i = t.entries.map((r) => {
1366
- const a = r.competitor.id, l = n.filter(
1368
+ const a = r.competitor.id, d = n.filter(
1367
1369
  (m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
1368
- ), d = s.filter(
1370
+ ), l = s.filter(
1369
1371
  (m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
1370
1372
  );
1371
1373
  let u, c;
1372
- return l.forEach((m) => {
1373
- const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), F = g ? p : h, S = g ? h : p;
1374
+ return d.forEach((m) => {
1375
+ const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), E = g ? p : h, S = g ? h : p;
1374
1376
  let O;
1375
- F > S ? O = "W" : F === S ? O = "D" : O = "L";
1377
+ E > S ? O = "W" : E === S ? O = "D" : O = "L";
1376
1378
  const M = {
1377
1379
  result: O,
1378
1380
  score: `${p} - ${h}`,
@@ -1381,7 +1383,7 @@ function qt(e, t, o) {
1381
1383
  isUpcoming: !1
1382
1384
  };
1383
1385
  g ? u = M : c = M;
1384
- }), d.forEach((m) => {
1386
+ }), l.forEach((m) => {
1385
1387
  const g = m.competitorOne.id === e;
1386
1388
  g && !u ? u = {
1387
1389
  date: m.timing.kickoffTime,
@@ -1409,7 +1411,7 @@ function qt(e, t, o) {
1409
1411
  rows: i
1410
1412
  };
1411
1413
  }
1412
- function Vt(e, t = 10) {
1414
+ function jt(e, t = 10) {
1413
1415
  return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, n) => {
1414
1416
  const s = o.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
1415
1417
  if (i !== s)
@@ -1418,7 +1420,7 @@ function Vt(e, t = 10) {
1418
1420
  return (n.seasonStatistics?.assists ?? 0) - r;
1419
1421
  }).slice(0, t);
1420
1422
  }
1421
- function jt(e, t = 10) {
1423
+ function Kt(e, t = 10) {
1422
1424
  return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, n) => {
1423
1425
  const s = o.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
1424
1426
  if (i !== s)
@@ -1427,7 +1429,7 @@ function jt(e, t = 10) {
1427
1429
  return (n.seasonStatistics?.goals ?? 0) - r;
1428
1430
  }).slice(0, t);
1429
1431
  }
1430
- function Kt(e, t = 10) {
1432
+ function Yt(e, t = 10) {
1431
1433
  return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, n) => {
1432
1434
  const s = o.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
1433
1435
  if (i !== s)
@@ -1436,7 +1438,7 @@ function Kt(e, t = 10) {
1436
1438
  return (n.seasonStatistics?.minutes ?? 0) - r;
1437
1439
  }).slice(0, t);
1438
1440
  }
1439
- function Yt(e, t = 10) {
1441
+ function zt(e, t = 10) {
1440
1442
  return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, n) => {
1441
1443
  const s = o.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
1442
1444
  if (i !== s)
@@ -1445,7 +1447,7 @@ function Yt(e, t = 10) {
1445
1447
  return (n.seasonStatistics?.appearances ?? 0) - r;
1446
1448
  }).slice(0, t);
1447
1449
  }
1448
- function zt(e, t = 10) {
1450
+ function Jt(e, t = 10) {
1449
1451
  return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, n) => {
1450
1452
  const s = o.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
1451
1453
  if (i !== s)
@@ -1454,16 +1456,16 @@ function zt(e, t = 10) {
1454
1456
  return (n.seasonStatistics?.appearances ?? 0) - r;
1455
1457
  }).slice(0, t);
1456
1458
  }
1457
- function Jt(e, t = 10) {
1459
+ function Qt(e, t = 10) {
1458
1460
  return e.players.filter((o) => {
1459
1461
  const n = o.seasonStatistics?.yellowCards ?? 0, s = o.seasonStatistics?.redCards ?? 0;
1460
1462
  return n + s > 0;
1461
1463
  }).sort((o, n) => {
1462
- const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0, l = s + i * 3, d = r + a * 3;
1463
- return d !== l ? d - l : a !== i ? a - i : r - s;
1464
+ const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0, d = s + i * 3, l = r + a * 3;
1465
+ return l !== d ? l - d : a !== i ? a - i : r - s;
1464
1466
  }).slice(0, t);
1465
1467
  }
1466
- function P(e) {
1468
+ function b(e) {
1467
1469
  const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1468
1470
  return e.forEach((n) => {
1469
1471
  !n.mainEvents || n.mainEvents.length === 0 || n.mainEvents.forEach((s) => {
@@ -1514,53 +1516,53 @@ function H(e) {
1514
1516
  }));
1515
1517
  }
1516
1518
  function lt(e, t = 10) {
1517
- const o = P(e);
1519
+ const o = b(e);
1518
1520
  return H(o).filter((s) => (s.goals ?? 0) > 0).sort((s, i) => {
1519
1521
  const r = s.goals ?? 0, a = i.goals ?? 0;
1520
1522
  if (a !== r)
1521
1523
  return a - r;
1522
- const l = s.assists ?? 0;
1523
- return (i.assists ?? 0) - l;
1524
+ const d = s.assists ?? 0;
1525
+ return (i.assists ?? 0) - d;
1524
1526
  }).slice(0, t);
1525
1527
  }
1526
- function dt(e, t = 10) {
1527
- const o = P(e);
1528
+ function ut(e, t = 10) {
1529
+ const o = b(e);
1528
1530
  return H(o).filter((s) => (s.assists ?? 0) > 0).sort((s, i) => {
1529
1531
  const r = s.assists ?? 0, a = i.assists ?? 0;
1530
1532
  if (a !== r)
1531
1533
  return a - r;
1532
- const l = s.goals ?? 0;
1533
- return (i.goals ?? 0) - l;
1534
+ const d = s.goals ?? 0;
1535
+ return (i.goals ?? 0) - d;
1534
1536
  }).slice(0, t);
1535
1537
  }
1536
- function ut(e, t = 10) {
1537
- const o = P(e);
1538
+ function mt(e, t = 10) {
1539
+ const o = b(e);
1538
1540
  return H(o).filter((s) => (s.totalCards ?? 0) > 0).sort((s, i) => {
1539
1541
  const r = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
1540
1542
  if (a !== r)
1541
1543
  return a - r;
1542
- const l = s.redCards ?? 0, d = i.redCards ?? 0;
1543
- if (d !== l)
1544
- return d - l;
1544
+ const d = s.redCards ?? 0, l = i.redCards ?? 0;
1545
+ if (l !== d)
1546
+ return l - d;
1545
1547
  const u = s.yellowCards ?? 0;
1546
1548
  return (i.yellowCards ?? 0) - u;
1547
1549
  }).slice(0, t);
1548
1550
  }
1549
- function mt(e, t = 10) {
1550
- const o = P(e);
1551
+ function ft(e, t = 10) {
1552
+ const o = b(e);
1551
1553
  return H(o).filter((s) => (s.goals ?? 0) + (s.assists ?? 0) > 0).sort((s, i) => {
1552
1554
  const r = (s.goals ?? 0) + (s.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
1553
1555
  if (a !== r)
1554
1556
  return a - r;
1555
- const l = s.goals ?? 0, d = i.goals ?? 0;
1556
- if (d !== l)
1557
- return d - l;
1557
+ const d = s.goals ?? 0, l = i.goals ?? 0;
1558
+ if (l !== d)
1559
+ return l - d;
1558
1560
  const u = s.assists ?? 0;
1559
1561
  return (i.assists ?? 0) - u;
1560
1562
  }).slice(0, t);
1561
1563
  }
1562
- function ft(e) {
1563
- const t = P(e);
1564
+ function gt(e) {
1565
+ const t = b(e);
1564
1566
  return H(t).sort((n, s) => {
1565
1567
  const i = n.appearances ?? 0, r = s.appearances ?? 0;
1566
1568
  if (r !== i)
@@ -1569,60 +1571,60 @@ function ft(e) {
1569
1571
  return (s.goals ?? 0) + (s.assists ?? 0) - a;
1570
1572
  });
1571
1573
  }
1572
- function Qt(e, t = 10) {
1573
- return G(() => lt(e, t), [e, t]);
1574
- }
1575
1574
  function Xt(e, t = 10) {
1576
- return G(() => dt(e, t), [e, t]);
1575
+ return D(() => lt(e, t), [e, t]);
1577
1576
  }
1578
1577
  function Zt(e, t = 10) {
1579
- return G(() => ut(e, t), [e, t]);
1578
+ return D(() => ut(e, t), [e, t]);
1580
1579
  }
1581
1580
  function wt(e, t = 10) {
1582
- return G(() => mt(e, t), [e, t]);
1581
+ return D(() => mt(e, t), [e, t]);
1583
1582
  }
1584
- function eo(e) {
1585
- return G(() => ft(e), [e]);
1583
+ function eo(e, t = 10) {
1584
+ return D(() => ft(e, t), [e, t]);
1586
1585
  }
1587
- function gt(e) {
1588
- return G(() => P(e), [e]);
1586
+ function to(e) {
1587
+ return D(() => gt(e), [e]);
1589
1588
  }
1590
- function to(e, t) {
1591
- const o = gt(e);
1592
- return G(() => o.get(t), [o, t]);
1589
+ function pt(e) {
1590
+ return D(() => b(e), [e]);
1593
1591
  }
1594
- const pt = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
1592
+ function oo(e, t) {
1593
+ const o = pt(e);
1594
+ return D(() => o.get(t), [o, t]);
1595
+ }
1596
+ const yt = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
1595
1597
  function N(e, t) {
1596
1598
  return t > 0 ? e / t * 100 : 0;
1597
1599
  }
1598
1600
  function W(e, t) {
1599
1601
  return t > 0 ? e / t : 0;
1600
1602
  }
1601
- function oo(e, t = !1, o = 2) {
1603
+ function no(e, t = !1, o = 2) {
1602
1604
  return t ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(o);
1603
1605
  }
1604
- function no(e, t) {
1606
+ function so(e, t) {
1605
1607
  const o = typeof e == "string" ? parseFloat(e) : e;
1606
1608
  if (isNaN(o) || t === 0) return "0";
1607
1609
  const n = (o / t).toFixed(1);
1608
1610
  return `${o} (${n} avg)`;
1609
1611
  }
1610
- function so(e, t) {
1612
+ function io(e, t) {
1611
1613
  const o = typeof e == "string" ? parseFloat(e) : e;
1612
1614
  return isNaN(o) || t === 0 ? "0.0" : (o / t).toFixed(1);
1613
1615
  }
1614
- function io(e) {
1616
+ function ro(e) {
1615
1617
  const t = parseFloat(e);
1616
1618
  return isNaN(t) ? "0%" : `${Math.round(t)}%`;
1617
1619
  }
1618
- function yt(e, t, o) {
1620
+ function ht(e, t, o) {
1619
1621
  if (e.status?.type !== "FINISHED" || !e.score) return null;
1620
1622
  const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s, r = o ? s : n;
1621
- let a = null, l = null;
1622
- const d = e.score.breakdown?.halfTime;
1623
- if (d) {
1624
- const g = parseInt(d.competitorOne || "0"), p = parseInt(d.competitorTwo || "0");
1625
- a = o ? g : p, l = o ? p : g;
1623
+ let a = null, d = null;
1624
+ const l = e.score.breakdown?.halfTime;
1625
+ if (l) {
1626
+ const g = parseInt(l.competitorOne || "0"), p = parseInt(l.competitorTwo || "0");
1627
+ a = o ? g : p, d = o ? p : g;
1626
1628
  }
1627
1629
  const u = e.statistics;
1628
1630
  let c = null, m = null;
@@ -1634,7 +1636,7 @@ function yt(e, t, o) {
1634
1636
  goalsFor: i,
1635
1637
  goalsAgainst: r,
1636
1638
  halfTimeGoalsFor: a,
1637
- halfTimeGoalsAgainst: l,
1639
+ halfTimeGoalsAgainst: d,
1638
1640
  cornersFor: c,
1639
1641
  cornersAgainst: m,
1640
1642
  isWin: i > r,
@@ -1645,58 +1647,58 @@ function yt(e, t, o) {
1645
1647
  function J(e, t) {
1646
1648
  return e.competitorOne.id === t;
1647
1649
  }
1648
- function ht(e, t) {
1650
+ function Tt(e, t) {
1649
1651
  return e.competitorTwo.id === t;
1650
1652
  }
1651
- function ro(e, t) {
1652
- return J(e, t) || ht(e, t);
1653
+ function ao(e, t) {
1654
+ return J(e, t) || Tt(e, t);
1653
1655
  }
1654
- function ao(e) {
1656
+ function co(e) {
1655
1657
  return e.status?.type === "FINISHED";
1656
1658
  }
1657
- function co(e, t) {
1659
+ function lo(e, t) {
1658
1660
  const o = J(e, t);
1659
1661
  return parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
1660
1662
  }
1661
- function lo(e, t) {
1663
+ function uo(e, t) {
1662
1664
  const o = J(e, t);
1663
1665
  return parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1664
1666
  }
1665
- function uo(e, t, o) {
1667
+ function mo(e, t, o) {
1666
1668
  const n = e.filter((u) => {
1667
1669
  if (u.status?.type !== "FINISHED" || !u.score) return !1;
1668
1670
  const c = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
1669
1671
  return c && m;
1670
1672
  });
1671
- let s = 0, i = 0, r = 0, a = 0, l = 0;
1673
+ let s = 0, i = 0, r = 0, a = 0, d = 0;
1672
1674
  n.forEach((u) => {
1673
1675
  const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), g = u.competitorOne.id === t, p = g ? c : m, h = g ? m : c;
1674
- a += p, l += h, p > h ? s++ : h > p ? i++ : r++;
1676
+ a += p, d += h, p > h ? s++ : h > p ? i++ : r++;
1675
1677
  });
1676
- const d = n.length;
1678
+ const l = n.length;
1677
1679
  return {
1678
- totalMatches: d,
1680
+ totalMatches: l,
1679
1681
  homeTeamWins: s,
1680
1682
  awayTeamWins: i,
1681
1683
  draws: r,
1682
1684
  homeTeamGoals: a,
1683
- awayTeamGoals: l,
1684
- homeTeamWinPercentage: d > 0 ? s / d * 100 : 0,
1685
- awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
1686
- drawPercentage: d > 0 ? r / d * 100 : 0,
1687
- homeTeamAvgGoals: d > 0 ? a / d : 0,
1688
- awayTeamAvgGoals: d > 0 ? l / d : 0
1685
+ awayTeamGoals: d,
1686
+ homeTeamWinPercentage: l > 0 ? s / l * 100 : 0,
1687
+ awayTeamWinPercentage: l > 0 ? i / l * 100 : 0,
1688
+ drawPercentage: l > 0 ? r / l * 100 : 0,
1689
+ homeTeamAvgGoals: l > 0 ? a / l : 0,
1690
+ awayTeamAvgGoals: l > 0 ? d / l : 0
1689
1691
  };
1690
1692
  }
1691
- function mo(e, t, o, n = 5) {
1693
+ function fo(e, t, o, n = 5) {
1692
1694
  return e.filter((i) => {
1693
1695
  if (i.status?.type !== "FINISHED" || !i.score) return !1;
1694
1696
  const r = i.competitorOne.id === t || i.competitorTwo.id === t, a = i.competitorOne.id === o || i.competitorTwo.id === o;
1695
1697
  return r && a;
1696
1698
  }).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
1697
- const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), l = i.competitorOne.id === t, d = l ? r : a, u = l ? a : r;
1699
+ const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), d = i.competitorOne.id === t, l = d ? r : a, u = d ? a : r;
1698
1700
  let c;
1699
- return d > u ? c = "home" : u > d ? c = "away" : c = "draw", {
1701
+ return l > u ? c = "home" : u > l ? c = "away" : c = "draw", {
1700
1702
  id: i.id,
1701
1703
  date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
1702
1704
  day: "numeric",
@@ -1714,13 +1716,13 @@ function mo(e, t, o, n = 5) {
1714
1716
  };
1715
1717
  });
1716
1718
  }
1717
- function Tt(e, t, o) {
1719
+ function vt(e, t, o) {
1718
1720
  return e.filter((n) => {
1719
1721
  const s = n.competitorOne.id === t, i = n.competitorTwo.id === t;
1720
1722
  return !s && !i ? !1 : o === "home" ? s : i;
1721
1723
  }).map((n) => {
1722
1724
  const s = n.competitorOne.id === t;
1723
- return yt(n, t, s);
1725
+ return ht(n, t, s);
1724
1726
  }).filter((n) => n !== null);
1725
1727
  }
1726
1728
  function Z(e, t, o, n) {
@@ -1728,20 +1730,20 @@ function Z(e, t, o, n) {
1728
1730
  for (const i of e) {
1729
1731
  const r = i.competitorOne.id === t, a = i.competitorTwo.id === t;
1730
1732
  if (!r && !a || o === "home" && !r || o === "away" && !a || i.status?.type !== "FINISHED") continue;
1731
- const l = i.mainEvents;
1732
- if (!l || !Array.isArray(l)) continue;
1733
- const d = l.filter((p) => p.type && pt.includes(p.type)).sort((p, h) => {
1734
- const F = p.minute ?? 0, S = h.minute ?? 0;
1735
- return F !== S ? F - S : (p.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
1733
+ const d = i.mainEvents;
1734
+ if (!d || !Array.isArray(d)) continue;
1735
+ const l = d.filter((p) => p.type && yt.includes(p.type)).sort((p, h) => {
1736
+ const E = p.minute ?? 0, S = h.minute ?? 0;
1737
+ return E !== S ? E - S : (p.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
1736
1738
  });
1737
- if (d.length === 0) continue;
1738
- const u = d[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
1739
+ if (l.length === 0) continue;
1740
+ const u = l[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
1739
1741
  let g;
1740
1742
  m ? g = u.competitorPosition !== c : g = u.competitorPosition === c, (n === "scored" && g || n === "conceded" && !g) && s++;
1741
1743
  }
1742
1744
  return s;
1743
1745
  }
1744
- function vt(e, t, o) {
1746
+ function _t(e, t, o) {
1745
1747
  let n = 0;
1746
1748
  for (const s of e) {
1747
1749
  const i = s.competitorOne.id === t, r = s.competitorTwo.id === t;
@@ -1751,8 +1753,8 @@ function vt(e, t, o) {
1751
1753
  }
1752
1754
  return n;
1753
1755
  }
1754
- function fo(e, t, o) {
1755
- const n = Tt(e, t, o), s = n.length;
1756
+ function go(e, t, o) {
1757
+ const n = vt(e, t, o), s = n.length;
1756
1758
  if (s === 0)
1757
1759
  return {
1758
1760
  played: 0,
@@ -1773,21 +1775,21 @@ function fo(e, t, o) {
1773
1775
  avgCornersFor: 0,
1774
1776
  avgCornersAgainst: 0
1775
1777
  };
1776
- const i = n.reduce((f, v) => f + v.goalsFor, 0), r = n.reduce((f, v) => f + v.goalsAgainst, 0), a = n.filter((f) => f.goalsAgainst === 0).length, l = n.filter((f) => f.isWin && f.goalsAgainst === 0).length, d = n.filter((f) => f.goalsFor > 0).length, u = n.filter((f) => f.goalsFor === 0).length, c = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, g = n.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
1778
+ const i = n.reduce((f, v) => f + v.goalsFor, 0), r = n.reduce((f, v) => f + v.goalsAgainst, 0), a = n.filter((f) => f.goalsAgainst === 0).length, d = n.filter((f) => f.isWin && f.goalsAgainst === 0).length, l = n.filter((f) => f.goalsFor > 0).length, u = n.filter((f) => f.goalsFor === 0).length, c = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, g = n.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
1777
1779
  const v = f.halfTimeGoalsFor, k = f.goalsFor - v;
1778
1780
  return v > 0 && k > 0;
1779
- }).length, F = Z(e, t, o, "scored"), S = vt(e, t, o), O = g.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, M = g.filter((f) => {
1781
+ }).length, E = Z(e, t, o, "scored"), S = _t(e, t, o), O = g.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, M = g.filter((f) => {
1780
1782
  const v = f.halfTimeGoalsAgainst, k = f.goalsAgainst - v;
1781
1783
  return v > 0 && k > 0;
1782
- }).length, U = Z(e, t, o, "conceded"), B = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, b = n.filter((f) => f.cornersFor !== null), $ = b.reduce((f, v) => f + (v.cornersFor || 0), 0), x = b.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1784
+ }).length, U = Z(e, t, o, "conceded"), B = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, P = n.filter((f) => f.cornersFor !== null), $ = P.reduce((f, v) => f + (v.cornersFor || 0), 0), x = P.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1783
1785
  return {
1784
1786
  played: s,
1785
1787
  goalsForPerMatch: W(i, s),
1786
1788
  cleanSheets: N(a, s),
1787
- wonToNil: N(l, s),
1788
- scoringRate: N(d, s),
1789
+ wonToNil: N(d, s),
1790
+ scoringRate: N(l, s),
1789
1791
  scoredInBothHalves: N(h, p),
1790
- scoredFirst: N(F, S),
1792
+ scoredFirst: N(E, S),
1791
1793
  leadingAtHalfTime: N(O, p),
1792
1794
  goalsAgainstPerMatch: W(r, s),
1793
1795
  failedToScore: N(u, s),
@@ -1796,31 +1798,31 @@ function fo(e, t, o) {
1796
1798
  concededInBothHalves: N(M, p),
1797
1799
  concededFirst: N(U, S),
1798
1800
  losingAtHalfTime: N(B, p),
1799
- avgCornersFor: W($, b.length),
1800
- avgCornersAgainst: W(x, b.length)
1801
+ avgCornersFor: W($, P.length),
1802
+ avgCornersAgainst: W(x, P.length)
1801
1803
  };
1802
1804
  }
1803
- function _t(e, t) {
1805
+ function St(e, t) {
1804
1806
  return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
1805
1807
  const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = s + i, a = o.periods;
1806
- let l = null;
1808
+ let d = null;
1807
1809
  if (a && Array.isArray(a)) {
1808
- const d = a.find(
1810
+ const l = a.find(
1809
1811
  (u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
1810
1812
  );
1811
- if (d?.score) {
1812
- const u = parseInt(d.score.competitorOne || "0"), c = parseInt(d.score.competitorTwo || "0");
1813
- l = u + c;
1813
+ if (l?.score) {
1814
+ const u = parseInt(l.score.competitorOne || "0"), c = parseInt(l.score.competitorTwo || "0");
1815
+ d = u + c;
1814
1816
  }
1815
1817
  }
1816
- return { totalGoals: r, halfTimeGoals: l, isHome: n };
1818
+ return { totalGoals: r, halfTimeGoals: d, isHome: n };
1817
1819
  });
1818
1820
  }
1819
1821
  function y(e, t) {
1820
1822
  return e.length === 0 ? 0 : e.filter((n) => n > t).length / e.length * 100;
1821
1823
  }
1822
- function go(e, t) {
1823
- const o = _t(e, t), n = o.filter((c) => c.isHome), s = o.filter((c) => !c.isHome), i = o.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), l = o.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), d = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
1824
+ function po(e, t) {
1825
+ const o = St(e, t), n = o.filter((c) => c.isHome), s = o.filter((c) => !c.isHome), i = o.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), d = o.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), l = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
1824
1826
  return {
1825
1827
  over05: {
1826
1828
  home: y(r, 0.5),
@@ -1853,23 +1855,23 @@ function go(e, t) {
1853
1855
  away: y(a, 5.5)
1854
1856
  },
1855
1857
  over05HT: {
1856
- home: y(d, 0.5),
1857
- total: y(l, 0.5),
1858
+ home: y(l, 0.5),
1859
+ total: y(d, 0.5),
1858
1860
  away: y(u, 0.5)
1859
1861
  },
1860
1862
  over15HT: {
1861
- home: y(d, 1.5),
1862
- total: y(l, 1.5),
1863
+ home: y(l, 1.5),
1864
+ total: y(d, 1.5),
1863
1865
  away: y(u, 1.5)
1864
1866
  },
1865
1867
  over25HT: {
1866
- home: y(d, 2.5),
1867
- total: y(l, 2.5),
1868
+ home: y(l, 2.5),
1869
+ total: y(d, 2.5),
1868
1870
  away: y(u, 2.5)
1869
1871
  }
1870
1872
  };
1871
1873
  }
1872
- function St(e, t) {
1874
+ function Ct(e, t) {
1873
1875
  const o = e.competitorOne.id === t, n = e.competitorTwo.id === t;
1874
1876
  if (!o && !n || !e.score) return null;
1875
1877
  const s = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
@@ -1879,10 +1881,10 @@ function St(e, t) {
1879
1881
  isHome: o
1880
1882
  };
1881
1883
  }
1882
- function po(e, t, o, n, s, i) {
1883
- const r = t?.entries.find((L) => L.competitor.id === e), a = o?.entries.find((L) => L.competitor.id === e), l = n?.entries.find((L) => L.competitor.id === e), d = s?.entries.find((L) => L.competitor.id === e), u = i?.entries.find((L) => L.competitor.id === e);
1884
+ function yo(e, t, o, n, s, i) {
1885
+ const r = t?.entries.find((L) => L.competitor.id === e), a = o?.entries.find((L) => L.competitor.id === e), d = n?.entries.find((L) => L.competitor.id === e), l = s?.entries.find((L) => L.competitor.id === e), u = i?.entries.find((L) => L.competitor.id === e);
1884
1886
  if (!r) return null;
1885
- const c = a?.stats?.goalsFor ?? 0, m = l?.stats?.goalsFor ?? 0, g = r?.stats?.goalsFor ?? 0, p = d?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, F = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, O = l?.stats?.played ?? 0, M = r?.stats?.played ?? 0, U = M > 0 ? g / M : 0, B = M > 0 ? F / M : 0, b = U + B, $ = S > 0 ? c / S : 0, x = O > 0 ? m / O : 0, f = S > 0 ? p / S : 0, v = O > 0 ? h / O : 0, k = $ + f, ne = x + v;
1887
+ const c = a?.stats?.goalsFor ?? 0, m = d?.stats?.goalsFor ?? 0, g = r?.stats?.goalsFor ?? 0, p = l?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, E = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, O = d?.stats?.played ?? 0, M = r?.stats?.played ?? 0, U = M > 0 ? g / M : 0, B = M > 0 ? E / M : 0, P = U + B, $ = S > 0 ? c / S : 0, x = O > 0 ? m / O : 0, f = S > 0 ? p / S : 0, v = O > 0 ? h / O : 0, k = $ + f, se = x + v;
1886
1888
  return {
1887
1889
  homeGoals: c,
1888
1890
  totalGoals: g,
@@ -1891,23 +1893,23 @@ function po(e, t, o, n, s, i) {
1891
1893
  awayGamesPlayed: O,
1892
1894
  totalGamesPlayed: M,
1893
1895
  homeGoalsConceded: p,
1894
- totalGoalsConceded: F,
1896
+ totalGoalsConceded: E,
1895
1897
  awayGoalsConceded: h,
1896
1898
  gfPerMatch: U,
1897
1899
  gaPerMatch: B,
1898
- gfGaPerMatch: b,
1900
+ gfGaPerMatch: P,
1899
1901
  homeGfPerMatch: $,
1900
1902
  awayGfPerMatch: x,
1901
1903
  homeGaPerMatch: f,
1902
1904
  awayGaPerMatch: v,
1903
1905
  homeGfGaPerMatch: k,
1904
- awayGfGaPerMatch: ne
1906
+ awayGfGaPerMatch: se
1905
1907
  };
1906
1908
  }
1907
1909
  function C(e, t, o, n) {
1908
1910
  const s = e.filter((r) => {
1909
- const a = r.competitorOne.id === t, l = r.competitorTwo.id === t;
1910
- return !(!a && !l || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !l);
1911
+ const a = r.competitorOne.id === t, d = r.competitorTwo.id === t;
1912
+ return !(!a && !d || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !d);
1911
1913
  }).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
1912
1914
  if (s.length === 0) return null;
1913
1915
  let i = 0;
@@ -1960,7 +1962,7 @@ function q(e, t, o) {
1960
1962
  concededTwice: C(e, t, T.concededTwice, o)
1961
1963
  };
1962
1964
  }
1963
- function yo(e, t, o) {
1965
+ function ho(e, t, o) {
1964
1966
  const n = q(e, t, "home"), s = q(e, t), i = q(e, o, "away"), r = q(e, o);
1965
1967
  return [
1966
1968
  {
@@ -2053,7 +2055,7 @@ function w(e, t) {
2053
2055
  const o = /* @__PURE__ */ new Map();
2054
2056
  return e.forEach((n) => {
2055
2057
  if (n.status?.type !== "FINISHED") return;
2056
- const s = St(n, t);
2058
+ const s = Ct(n, t);
2057
2059
  if (!s) return;
2058
2060
  const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = o.get(i) || {
2059
2061
  opponentId: i,
@@ -2063,17 +2065,17 @@ function w(e, t) {
2063
2065
  s.isHome ? a.homeResult = s.result : a.awayResult = s.result, o.set(i, a);
2064
2066
  }), o;
2065
2067
  }
2066
- function ho(e, t, o, n, s, i, r) {
2067
- const a = w(e, t), l = w(e, o), d = /* @__PURE__ */ new Set([
2068
+ function To(e, t, o, n, s, i, r) {
2069
+ const a = w(e, t), d = w(e, o), l = /* @__PURE__ */ new Set([
2068
2070
  ...a.keys(),
2069
- ...l.keys(),
2071
+ ...d.keys(),
2070
2072
  t,
2071
2073
  // Include home team as row for away team results
2072
2074
  o
2073
2075
  // Include away team as row for home team results
2074
2076
  ]), u = [];
2075
- return d.forEach((c) => {
2076
- const m = a.get(c), g = l.get(c);
2077
+ return l.forEach((c) => {
2078
+ const m = a.get(c), g = d.get(c);
2077
2079
  if (!m && !g && c !== t && c !== o)
2078
2080
  return;
2079
2081
  let p, h;
@@ -2091,92 +2093,92 @@ function ho(e, t, o, n, s, i, r) {
2091
2093
  }), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
2092
2094
  }
2093
2095
  export {
2094
- pt as GOAL_EVENT_TYPES,
2095
- _o as addProviderRef,
2096
- P as aggregatePlayerStatisticsFromMatches,
2097
- yt as analyzeMatch,
2096
+ yt as GOAL_EVENT_TYPES,
2097
+ So as addProviderRef,
2098
+ b as aggregatePlayerStatisticsFromMatches,
2099
+ ht as analyzeMatch,
2098
2100
  W as calcAverage,
2099
2101
  N as calcPercentage,
2100
- uo as calculateH2HStats,
2102
+ mo as calculateH2HStats,
2101
2103
  C as calculateStreak,
2102
- so as formatAsAverage,
2103
- io as formatPossessionPercentage,
2104
- oo as formatStatValue,
2105
- no as formatWithAverage,
2106
- Ut as getActiveSeason,
2107
- ft as getAllPlayerStatisticsFromMatches,
2108
- Nt as getBasketballLivescore,
2109
- So as getBatchMatchOdds,
2104
+ io as formatAsAverage,
2105
+ ro as formatPossessionPercentage,
2106
+ no as formatStatValue,
2107
+ so as formatWithAverage,
2108
+ Bt as getActiveSeason,
2109
+ gt as getAllPlayerStatisticsFromMatches,
2110
+ Rt as getBasketballLivescore,
2111
+ Co as getBatchMatchOdds,
2110
2112
  A as getConfig,
2111
- Lt as getFansUnitedFootballCompetition,
2112
- Mt as getFansUnitedFootballCompetitions,
2113
- Pt as getFansUnitedFootballMatch,
2114
- kt as getFansUnitedFootballMatches,
2115
- Gt as getFansUnitedFootballPlayer,
2113
+ It as getFansUnitedFootballCompetition,
2114
+ Lt as getFansUnitedFootballCompetitions,
2115
+ kt as getFansUnitedFootballMatch,
2116
+ Ht as getFansUnitedFootballMatches,
2117
+ Pt as getFansUnitedFootballPlayer,
2116
2118
  bt as getFansUnitedFootballPlayers,
2117
- Ht as getFansUnitedFootballSearch,
2118
- It as getFansUnitedFootballTeam,
2119
+ Ut as getFansUnitedFootballSearch,
2120
+ Gt as getFansUnitedFootballTeam,
2119
2121
  Dt as getFansUnitedFootballTeams,
2120
- Co as getFootballCompetition,
2121
- Ao as getFootballLivescore,
2122
- Oo as getFootballMatch,
2123
- No as getFootballMatchCommentary,
2124
- Ro as getFootballMatchEvents,
2122
+ Ao as getFootballCompetition,
2123
+ Oo as getFootballLivescore,
2124
+ No as getFootballMatch,
2125
+ Ro as getFootballMatchCommentary,
2126
+ Fo as getFootballMatchEvents,
2125
2127
  Eo as getFootballMatchLineups,
2126
- Fo as getFootballMatchOdds,
2127
- Mo as getFootballMatchStatistics,
2128
- Lo as getFootballMatches,
2129
- Io as getFootballPlayerSeasonStatistics,
2128
+ Mo as getFootballMatchOdds,
2129
+ Lo as getFootballMatchStatistics,
2130
+ Io as getFootballMatches,
2131
+ Go as getFootballPlayerSeasonStatistics,
2130
2132
  Do as getFootballSeasonDetails,
2131
- Go as getFootballStandings,
2133
+ Po as getFootballStandings,
2132
2134
  bo as getFootballTeam,
2133
- Po as getFootballTeamSquad,
2134
- ko as getLeaderboardMatches,
2135
- Ho as getLeaderboardTeamMatches,
2136
- Uo as getLeaderboardTemplate,
2137
- St as getMatchResult,
2138
- ut as getMostCardedPlayersFromMatches,
2139
- lo as getOpponentScore,
2140
- Bo as getProviderRefId,
2141
- mo as getRecentH2HMeetings,
2142
- Wt as getTeamFinishedMatches,
2143
- po as getTeamGoalStats,
2144
- fo as getTeamHomeAwayStats,
2145
- Jt as getTeamMostDecorated,
2146
- Bt as getTeamNextMatch,
2147
- go as getTeamOverUnderStats,
2148
- $t as getTeamPreviousMatch,
2149
- qt as getTeamResultsTable,
2150
- co as getTeamScore,
2151
- Ft as getTeamSeasonStatistics,
2135
+ ko as getFootballTeamSquad,
2136
+ Ho as getLeaderboardMatches,
2137
+ Uo as getLeaderboardTeamMatches,
2138
+ Bo as getLeaderboardTemplate,
2139
+ Ct as getMatchResult,
2140
+ mt as getMostCardedPlayersFromMatches,
2141
+ uo as getOpponentScore,
2142
+ $o as getProviderRefId,
2143
+ fo as getRecentH2HMeetings,
2144
+ qt as getTeamFinishedMatches,
2145
+ yo as getTeamGoalStats,
2146
+ go as getTeamHomeAwayStats,
2147
+ Qt as getTeamMostDecorated,
2148
+ $t as getTeamNextMatch,
2149
+ po as getTeamOverUnderStats,
2150
+ xt as getTeamPreviousMatch,
2151
+ Vt as getTeamResultsTable,
2152
+ lo as getTeamScore,
2153
+ Mt as getTeamSeasonStatistics,
2152
2154
  q as getTeamStreaks,
2153
- yo as getTeamStreaksComparison,
2154
- Kt as getTeamTopAppearances,
2155
- jt as getTeamTopAssisters,
2156
- zt as getTeamTopCleanSheets,
2157
- Yt as getTeamTopMinutesPlayed,
2158
- Vt as getTeamTopScorers,
2159
- xt as getTeamUpcomingMatches,
2160
- ho as getTeamsCommonOpponents,
2161
- Rt as getTennisLivescore,
2162
- dt as getTopAssistersFromMatches,
2163
- mt as getTopGoalContributorsFromMatches,
2155
+ ho as getTeamStreaksComparison,
2156
+ Yt as getTeamTopAppearances,
2157
+ Kt as getTeamTopAssisters,
2158
+ Jt as getTeamTopCleanSheets,
2159
+ zt as getTeamTopMinutesPlayed,
2160
+ jt as getTeamTopScorers,
2161
+ Wt as getTeamUpcomingMatches,
2162
+ To as getTeamsCommonOpponents,
2163
+ Ft as getTennisLivescore,
2164
+ ut as getTopAssistersFromMatches,
2165
+ ft as getTopGoalContributorsFromMatches,
2164
2166
  lt as getTopScorersFromMatches,
2165
- $o as isConfigured,
2166
- ao as isMatchFinished,
2167
- ht as isTeamAway,
2167
+ xo as isConfigured,
2168
+ co as isMatchFinished,
2169
+ Tt as isTeamAway,
2168
2170
  J as isTeamHome,
2169
- ro as isTeamInMatch,
2171
+ ao as isTeamInMatch,
2170
2172
  Et as search,
2171
- Ot as searchFootball,
2172
- xo as setConfig,
2173
+ Nt as searchFootball,
2174
+ Wo as setConfig,
2173
2175
  T as streakFilters,
2174
2176
  _ as toProviderRefArray,
2175
- eo as useAllPlayerStatisticsFromMatches,
2176
- Zt as useMostCardedPlayersFromMatches,
2177
- to as usePlayerStatistics,
2178
- gt as usePlayerStatisticsMap,
2179
- Xt as useTopAssistersFromMatches,
2180
- wt as useTopGoalContributorsFromMatches,
2181
- Qt as useTopScorersFromMatches
2177
+ to as useAllPlayerStatisticsFromMatches,
2178
+ wt as useMostCardedPlayersFromMatches,
2179
+ oo as usePlayerStatistics,
2180
+ pt as usePlayerStatisticsMap,
2181
+ Zt as useTopAssistersFromMatches,
2182
+ eo as useTopGoalContributorsFromMatches,
2183
+ Xt as useTopScorersFromMatches
2182
2184
  };