fansunited-data-layer 0.6.2 → 0.6.4
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.
package/fansunited-data-layer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as C, g as F, f as te, c as X, S as oe, a as
|
|
2
|
-
import { e as Qt, h as Xt, i as Zt, j as wt, k as eo, l as to, m as oo, n as
|
|
1
|
+
import { t as C, g as F, f as te, c as X, S as oe, a as ne, b as se, d as ie } from "./matches-CBFdPkPa.js";
|
|
2
|
+
import { e as Qt, h as Xt, i as Zt, j as wt, k as eo, l as to, m as oo, n as no, o as so, p as io, q as ro, r as ao, s as co, u as lo, v as uo, w as mo, x as fo, y as go, z as po, A as yo, B as ho } from "./matches-CBFdPkPa.js";
|
|
3
3
|
import { useMemo as P } from "react";
|
|
4
4
|
function re(e) {
|
|
5
5
|
return {
|
|
@@ -162,21 +162,21 @@ function me(e) {
|
|
|
162
162
|
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
165
|
+
async function st(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 || F(), { sportal365Sports:
|
|
171
|
+
const o = t || F(), { sportal365Sports: s } = o, n = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await te.get({
|
|
172
172
|
path: "/search",
|
|
173
173
|
params: {
|
|
174
174
|
query: e.query.trim(),
|
|
175
|
-
entity_type:
|
|
176
|
-
language_code: e.languageCode ??
|
|
175
|
+
entity_type: n.join(","),
|
|
176
|
+
language_code: e.languageCode ?? s?.languageCode ?? "en"
|
|
177
177
|
},
|
|
178
178
|
headers: {
|
|
179
|
-
"Accept-Language": e.languageCode ??
|
|
179
|
+
"Accept-Language": e.languageCode ?? s?.languageCode ?? "en"
|
|
180
180
|
},
|
|
181
181
|
next: e.next,
|
|
182
182
|
config: o
|
|
@@ -204,7 +204,7 @@ function G(e) {
|
|
|
204
204
|
url: e.url
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function N(e) {
|
|
208
208
|
if (e)
|
|
209
209
|
return {
|
|
210
210
|
id: e.id,
|
|
@@ -231,7 +231,7 @@ function V(e) {
|
|
|
231
231
|
slug: e.slug,
|
|
232
232
|
tagScore: e.tag_score ?? void 0,
|
|
233
233
|
sport: e.sport,
|
|
234
|
-
country:
|
|
234
|
+
country: N(e.country),
|
|
235
235
|
gender: e.gender,
|
|
236
236
|
competitionIds: e.competition_ids,
|
|
237
237
|
type: e.type,
|
|
@@ -253,7 +253,7 @@ function Z(e) {
|
|
|
253
253
|
slug: e.slug,
|
|
254
254
|
tagScore: e.tag_score ?? void 0,
|
|
255
255
|
sport: e.sport,
|
|
256
|
-
country:
|
|
256
|
+
country: N(e.country),
|
|
257
257
|
providerRef: e.id
|
|
258
258
|
};
|
|
259
259
|
}
|
|
@@ -270,7 +270,7 @@ function ge(e) {
|
|
|
270
270
|
slug: e.slug,
|
|
271
271
|
tagScore: e.tag_score ?? void 0,
|
|
272
272
|
sport: e.sport,
|
|
273
|
-
country:
|
|
273
|
+
country: N(e.country),
|
|
274
274
|
gender: e.gender,
|
|
275
275
|
providerRef: e.id
|
|
276
276
|
};
|
|
@@ -288,7 +288,7 @@ function pe(e) {
|
|
|
288
288
|
slug: e.slug,
|
|
289
289
|
tagScore: e.tag_score ?? void 0,
|
|
290
290
|
sport: e.sport,
|
|
291
|
-
country:
|
|
291
|
+
country: N(e.country),
|
|
292
292
|
gender: e.gender,
|
|
293
293
|
birthdate: e.birthdate ?? void 0,
|
|
294
294
|
position: e.position ?? void 0,
|
|
@@ -308,7 +308,7 @@ function ye(e) {
|
|
|
308
308
|
slug: e.slug,
|
|
309
309
|
tagScore: e.tag_score ?? void 0,
|
|
310
310
|
sport: e.sport,
|
|
311
|
-
country:
|
|
311
|
+
country: N(e.country),
|
|
312
312
|
gender: e.gender,
|
|
313
313
|
birthdate: e.birthdate ?? void 0,
|
|
314
314
|
providerRef: e.id
|
|
@@ -327,7 +327,7 @@ function he(e) {
|
|
|
327
327
|
slug: e.slug,
|
|
328
328
|
tagScore: e.tag_score ?? void 0,
|
|
329
329
|
sport: e.sport,
|
|
330
|
-
country:
|
|
330
|
+
country: N(e.country),
|
|
331
331
|
gender: e.gender,
|
|
332
332
|
birthdate: e.birthdate ?? void 0,
|
|
333
333
|
providerRef: e.id
|
|
@@ -346,7 +346,7 @@ function Te(e) {
|
|
|
346
346
|
slug: e.slug,
|
|
347
347
|
tagScore: e.tag_score ?? void 0,
|
|
348
348
|
sport: e.sport,
|
|
349
|
-
country:
|
|
349
|
+
country: N(e.country),
|
|
350
350
|
city: e.city ? Z(e.city) : void 0,
|
|
351
351
|
providerRef: e.id
|
|
352
352
|
};
|
|
@@ -364,7 +364,7 @@ function ve(e) {
|
|
|
364
364
|
slug: e.slug,
|
|
365
365
|
tagScore: e.tag_score ?? void 0,
|
|
366
366
|
sport: e.sport,
|
|
367
|
-
country:
|
|
367
|
+
country: N(e.country),
|
|
368
368
|
gender: e.gender,
|
|
369
369
|
type: e.type ?? void 0,
|
|
370
370
|
region: e.region ?? void 0,
|
|
@@ -437,23 +437,23 @@ function Ce(e) {
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
async function it(e = {}, t) {
|
|
440
|
-
const o = t ?? F(),
|
|
441
|
-
e.name && (
|
|
442
|
-
const
|
|
440
|
+
const o = t ?? F(), s = {};
|
|
441
|
+
e.name && (s.name = e.name), e.entityTypes && e.entityTypes.length > 0 && (s.entity_type = e.entityTypes.join(",")), e.sports && e.sports.length > 0 && (s.sport = e.sports.join(",")), e.eventStartTime && (s.event_start_time = e.eventStartTime), e.ids && e.ids.length > 0 && (s.ids = e.ids.join(",")), e.competitionIds && e.competitionIds.length > 0 && (s.competition_ids = e.competitionIds.join(",")), e.domain && (s.domain = e.domain), e.inputLanguage && (s.input_language = e.inputLanguage), e.translationLanguage && (s.translation_language = e.translationLanguage), e.limit !== void 0 && (s.limit = e.limit.toString()), e.offset !== void 0 && (s.offset = e.offset.toString());
|
|
442
|
+
const n = await fe.get({
|
|
443
443
|
path: "/suggest",
|
|
444
|
-
params:
|
|
444
|
+
params: s,
|
|
445
445
|
next: e.next,
|
|
446
446
|
config: o
|
|
447
447
|
});
|
|
448
|
-
return !
|
|
448
|
+
return !n.results || n.results.length === 0 ? {
|
|
449
449
|
results: [],
|
|
450
450
|
query: e.name
|
|
451
451
|
} : {
|
|
452
|
-
results:
|
|
452
|
+
results: n.results.map(Ce),
|
|
453
453
|
query: e.name
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
|
-
const Ae = X(
|
|
456
|
+
const Ae = X(ne);
|
|
457
457
|
function Oe(e, t) {
|
|
458
458
|
return {
|
|
459
459
|
teamId: e.id,
|
|
@@ -467,65 +467,67 @@ function Oe(e, t) {
|
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
469
|
async function rt(e, t) {
|
|
470
|
-
const o = t || F(),
|
|
470
|
+
const o = t || F(), s = e.next ?? { revalidate: 600 }, n = await Ae.get({
|
|
471
471
|
path: "/statistics/aggregate",
|
|
472
472
|
params: {
|
|
473
473
|
participant_ids: e.teamId,
|
|
474
474
|
season_ids: e.seasonId,
|
|
475
475
|
participant_type: "TEAM"
|
|
476
476
|
},
|
|
477
|
-
next:
|
|
477
|
+
next: s,
|
|
478
478
|
config: o
|
|
479
479
|
});
|
|
480
|
-
if (!
|
|
480
|
+
if (!n.data || n.data.length === 0)
|
|
481
481
|
throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
|
|
482
|
-
return Oe(
|
|
482
|
+
return Oe(n.data[0], e.seasonId);
|
|
483
483
|
}
|
|
484
484
|
function Fe(e) {
|
|
485
485
|
const t = e.replace(/\/$/, "");
|
|
486
|
-
function o(
|
|
487
|
-
return `${t}${
|
|
486
|
+
function o(s) {
|
|
487
|
+
return `${t}${s}`;
|
|
488
488
|
}
|
|
489
489
|
return {
|
|
490
|
-
async get(
|
|
491
|
-
const
|
|
490
|
+
async get(s) {
|
|
491
|
+
const n = s.config || F(), { fansUnited: i } = n;
|
|
492
492
|
if (!i)
|
|
493
493
|
throw new Error(
|
|
494
494
|
"Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
|
|
495
495
|
);
|
|
496
496
|
if (!i.apiKey || !i.clientId)
|
|
497
497
|
throw new Error("Fans United configuration requires both 'apiKey' and 'clientId'");
|
|
498
|
-
const r = new URL(o(
|
|
499
|
-
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId),
|
|
500
|
-
for (const [
|
|
501
|
-
|
|
502
|
-
const
|
|
498
|
+
const r = new URL(o(s.path));
|
|
499
|
+
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), s.params)
|
|
500
|
+
for (const [u, c] of Object.entries(s.params))
|
|
501
|
+
c !== void 0 && (Array.isArray(c) ? c.length > 0 && r.searchParams.set(u, c.join(",")) : r.searchParams.set(u, c));
|
|
502
|
+
const a = 3e4, d = new URL(r.toString());
|
|
503
|
+
d.searchParams.delete("key"), d.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", d.toString());
|
|
504
|
+
const l = await fetch(r.toString(), {
|
|
503
505
|
method: "GET",
|
|
504
506
|
headers: {
|
|
505
507
|
Accept: "application/json",
|
|
506
508
|
"Content-Type": "application/json",
|
|
507
509
|
// Merge custom headers (they can override defaults)
|
|
508
|
-
...
|
|
510
|
+
...s.headers
|
|
509
511
|
},
|
|
510
|
-
signal: AbortSignal.timeout(
|
|
512
|
+
signal: AbortSignal.timeout(a),
|
|
511
513
|
// Next.js cache options for ISR/on-demand revalidation
|
|
512
|
-
...
|
|
514
|
+
...s.next && { next: s.next }
|
|
513
515
|
});
|
|
514
|
-
if (!
|
|
515
|
-
let
|
|
516
|
+
if (!l.ok) {
|
|
517
|
+
let u = `Fans United API error: ${l.status} ${l.statusText}`;
|
|
516
518
|
try {
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
} catch (
|
|
519
|
+
const c = await l.text();
|
|
520
|
+
c && (u += ` - ${c}`);
|
|
521
|
+
} catch (c) {
|
|
520
522
|
console.error("[Fans United HTTP] Failed to read error response body:", {
|
|
521
|
-
error:
|
|
522
|
-
status:
|
|
523
|
-
statusText:
|
|
523
|
+
error: c instanceof Error ? c.message : String(c),
|
|
524
|
+
status: l.status,
|
|
525
|
+
statusText: l.statusText
|
|
524
526
|
});
|
|
525
527
|
}
|
|
526
|
-
throw new Error(
|
|
528
|
+
throw new Error(u);
|
|
527
529
|
}
|
|
528
|
-
return
|
|
530
|
+
return l.json();
|
|
529
531
|
}
|
|
530
532
|
};
|
|
531
533
|
}
|
|
@@ -584,19 +586,17 @@ function De(e) {
|
|
|
584
586
|
async function at(e, t) {
|
|
585
587
|
const o = {};
|
|
586
588
|
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");
|
|
587
|
-
const
|
|
589
|
+
const s = await I.get({
|
|
588
590
|
path: "/v1/competitions",
|
|
589
591
|
params: o,
|
|
590
592
|
config: t,
|
|
591
593
|
next: e?.next
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
const r = De(n.data), a = /* @__PURE__ */ new Set(), c = r.filter((l) => a.has(l.id) ? !1 : (a.add(l.id), !0));
|
|
597
|
-
return r.length !== c.length && console.warn(`Removed ${r.length - c.length} duplicate competitions`), c;
|
|
594
|
+
}), n = s.data.map((l) => l.id), i = new Set(n);
|
|
595
|
+
n.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
|
|
596
|
+
const r = De(s.data), a = /* @__PURE__ */ new Set(), d = r.filter((l) => a.has(l.id) ? !1 : (a.add(l.id), !0));
|
|
597
|
+
return r.length !== d.length && console.warn(`Removed ${r.length - d.length} duplicate competitions`), d;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Ee(e) {
|
|
600
600
|
return {
|
|
601
601
|
id: e.id,
|
|
602
602
|
name: e.name,
|
|
@@ -612,13 +612,13 @@ function Ne(e) {
|
|
|
612
612
|
]
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Ne(e) {
|
|
616
616
|
return {
|
|
617
617
|
id: e.id,
|
|
618
618
|
name: e.name,
|
|
619
619
|
type: e.type?.toUpperCase() || "LEAGUE",
|
|
620
620
|
gender: e.gender?.toUpperCase(),
|
|
621
|
-
country: e.country ?
|
|
621
|
+
country: e.country ? Ee(e.country) : void 0,
|
|
622
622
|
assets: e.assets?.logo ? {
|
|
623
623
|
logo: e.assets.logo
|
|
624
624
|
} : void 0,
|
|
@@ -631,16 +631,16 @@ function Ee(e) {
|
|
|
631
631
|
};
|
|
632
632
|
}
|
|
633
633
|
function Ie(e) {
|
|
634
|
-
return
|
|
634
|
+
return Ne(e.data);
|
|
635
635
|
}
|
|
636
636
|
async function ct(e, t, o) {
|
|
637
|
-
const
|
|
638
|
-
t?.lang && (
|
|
637
|
+
const s = o || F(), n = {};
|
|
638
|
+
t?.lang && (n.lang = t.lang);
|
|
639
639
|
const i = await I.get({
|
|
640
640
|
path: `/v1/competitions/${e}`,
|
|
641
|
-
params:
|
|
641
|
+
params: n,
|
|
642
642
|
next: t?.next,
|
|
643
|
-
config:
|
|
643
|
+
config: s
|
|
644
644
|
});
|
|
645
645
|
return Ie(i);
|
|
646
646
|
}
|
|
@@ -690,13 +690,13 @@ function be(e) {
|
|
|
690
690
|
return Le(e.data);
|
|
691
691
|
}
|
|
692
692
|
async function lt(e, t, o) {
|
|
693
|
-
const
|
|
694
|
-
t?.lang && (
|
|
693
|
+
const s = o || F(), n = {};
|
|
694
|
+
t?.lang && (n.lang = t.lang);
|
|
695
695
|
const i = await I.get({
|
|
696
696
|
path: `/v1/teams/${e}`,
|
|
697
|
-
params:
|
|
697
|
+
params: n,
|
|
698
698
|
next: t?.next,
|
|
699
|
-
config:
|
|
699
|
+
config: s
|
|
700
700
|
});
|
|
701
701
|
return be(i);
|
|
702
702
|
}
|
|
@@ -777,52 +777,52 @@ function w(e) {
|
|
|
777
777
|
function Be(e) {
|
|
778
778
|
return w(e.data);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function Ue(e) {
|
|
781
781
|
return e.data.map(w);
|
|
782
782
|
}
|
|
783
783
|
async function dt(e, t, o) {
|
|
784
|
-
const
|
|
785
|
-
t?.lang && (
|
|
784
|
+
const s = o || F(), n = {};
|
|
785
|
+
t?.lang && (n.lang = t.lang);
|
|
786
786
|
const i = await I.get({
|
|
787
787
|
path: `/v1/players/${e}`,
|
|
788
|
-
params:
|
|
788
|
+
params: n,
|
|
789
789
|
next: t?.next,
|
|
790
|
-
config:
|
|
790
|
+
config: s
|
|
791
791
|
});
|
|
792
792
|
return Be(i);
|
|
793
793
|
}
|
|
794
794
|
async function ut(e, t) {
|
|
795
|
-
const o = t || F(),
|
|
796
|
-
e?.lang && (
|
|
797
|
-
const
|
|
795
|
+
const o = t || F(), s = {};
|
|
796
|
+
e?.lang && (s.lang = e.lang), e?.playerIds && (s.player_ids = e.playerIds), e?.countryId && (s.country_id = e.countryId), e?.name && (s.name = e.name), e?.scope && (s.scope = e.scope), e?.limit !== void 0 && (s.limit = String(e.limit)), e?.page !== void 0 && (s.page = String(e.page)), e?.sortField && (s.sort_field = e.sortField), e?.sortOrder && (s.sort_order = e.sortOrder);
|
|
797
|
+
const n = await I.get({
|
|
798
798
|
path: "/v1/players",
|
|
799
|
-
params:
|
|
799
|
+
params: s,
|
|
800
800
|
next: e?.next,
|
|
801
801
|
config: o
|
|
802
802
|
});
|
|
803
|
-
return
|
|
803
|
+
return Ue(n);
|
|
804
804
|
}
|
|
805
805
|
async function mt(e, t, o) {
|
|
806
|
-
const
|
|
807
|
-
t?.lang && (
|
|
806
|
+
const s = o || F(), n = {};
|
|
807
|
+
t?.lang && (n.lang = t.lang);
|
|
808
808
|
const i = await I.get({
|
|
809
809
|
path: `/v1/matches/${e}`,
|
|
810
|
-
params:
|
|
810
|
+
params: n,
|
|
811
811
|
next: t?.next,
|
|
812
|
-
config:
|
|
812
|
+
config: s
|
|
813
813
|
});
|
|
814
|
-
return
|
|
814
|
+
return se(i);
|
|
815
815
|
}
|
|
816
816
|
async function ft(e, t) {
|
|
817
|
-
const o = t || F(),
|
|
818
|
-
e?.lang && (
|
|
819
|
-
const
|
|
817
|
+
const o = t || F(), s = {};
|
|
818
|
+
e?.lang && (s.lang = e.lang), e?.competitions && (s.competitions = e.competitions), e?.countries && (s.countries = e.countries), e?.fromDate && (s.from_date = e.fromDate), e?.toDate && (s.to_date = e.toDate), e?.matches && (s.matches = e.matches), e?.teams && (s.teams = e.teams), e?.status && (s.status = e.status), e?.limit !== void 0 && (s.limit = String(e.limit)), e?.page !== void 0 && (s.page = String(e.page)), e?.sortField && (s.sort_field = e.sortField), e?.sortOrder && (s.sort_order = e.sortOrder), e?.showDeleted !== void 0 && (s.show_deleted = e.showDeleted ? "true" : "false");
|
|
819
|
+
const n = await I.get({
|
|
820
820
|
path: "/v1/matches",
|
|
821
|
-
params:
|
|
821
|
+
params: s,
|
|
822
822
|
next: e?.next,
|
|
823
823
|
config: o
|
|
824
824
|
});
|
|
825
|
-
return ie(
|
|
825
|
+
return ie(n);
|
|
826
826
|
}
|
|
827
827
|
function z(e) {
|
|
828
828
|
return {
|
|
@@ -838,7 +838,7 @@ function z(e) {
|
|
|
838
838
|
]
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function $e(e) {
|
|
842
842
|
return {
|
|
843
843
|
id: e.id,
|
|
844
844
|
name: e.name,
|
|
@@ -901,7 +901,7 @@ function We(e) {
|
|
|
901
901
|
function j(e) {
|
|
902
902
|
switch (e.entity_type) {
|
|
903
903
|
case "competition": {
|
|
904
|
-
const t =
|
|
904
|
+
const t = $e(e);
|
|
905
905
|
return {
|
|
906
906
|
source: "FOOTBALL",
|
|
907
907
|
entityType: "competition",
|
|
@@ -937,10 +937,10 @@ function j(e) {
|
|
|
937
937
|
async function gt(e, t) {
|
|
938
938
|
if (!e.query || e.query.trim() === "")
|
|
939
939
|
return [];
|
|
940
|
-
const o = t || F(),
|
|
940
|
+
const o = t || F(), s = {
|
|
941
941
|
q: e.query.trim()
|
|
942
|
-
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((
|
|
943
|
-
switch (
|
|
942
|
+
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((d) => {
|
|
943
|
+
switch (d) {
|
|
944
944
|
case "team":
|
|
945
945
|
return "teams";
|
|
946
946
|
case "player":
|
|
@@ -948,24 +948,24 @@ async function gt(e, t) {
|
|
|
948
948
|
case "competition":
|
|
949
949
|
return "competitions";
|
|
950
950
|
default:
|
|
951
|
-
return
|
|
951
|
+
return d;
|
|
952
952
|
}
|
|
953
953
|
});
|
|
954
|
-
|
|
954
|
+
s.entities = i.join(","), e.lang && (s.lang = e.lang), e.limit && (s.limit = String(e.limit));
|
|
955
955
|
const r = await I.get({
|
|
956
956
|
path: "/v1/search",
|
|
957
|
-
params:
|
|
957
|
+
params: s,
|
|
958
958
|
next: e.next,
|
|
959
959
|
config: o
|
|
960
960
|
}), a = [];
|
|
961
|
-
return r.data && (r.data.competitions && r.data.competitions.forEach((
|
|
962
|
-
const l = j({ ...
|
|
961
|
+
return r.data && (r.data.competitions && r.data.competitions.forEach((d) => {
|
|
962
|
+
const l = j({ ...d, entity_type: "competition" });
|
|
963
963
|
l && a.push(l);
|
|
964
|
-
}), r.data.teams && r.data.teams.forEach((
|
|
965
|
-
const l = j({ ...
|
|
964
|
+
}), r.data.teams && r.data.teams.forEach((d) => {
|
|
965
|
+
const l = j({ ...d, entity_type: "team" });
|
|
966
966
|
l && a.push(l);
|
|
967
|
-
}), r.data.players && r.data.players.forEach((
|
|
968
|
-
const l = j({ ...
|
|
967
|
+
}), r.data.players && r.data.players.forEach((d) => {
|
|
968
|
+
const l = j({ ...d, entity_type: "player" });
|
|
969
969
|
l && a.push(l);
|
|
970
970
|
})), a;
|
|
971
971
|
}
|
|
@@ -973,48 +973,48 @@ function pt(e) {
|
|
|
973
973
|
return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((o) => o.active) ?? e.seasons[0];
|
|
974
974
|
}
|
|
975
975
|
function yt(e, t) {
|
|
976
|
-
const o = /* @__PURE__ */ new Date(),
|
|
977
|
-
const i =
|
|
976
|
+
const o = /* @__PURE__ */ new Date(), s = t.filter((n) => {
|
|
977
|
+
const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "NOT_STARTED", a = new Date(n.timing.kickoffTime) >= o;
|
|
978
978
|
return i && r && a;
|
|
979
979
|
});
|
|
980
|
-
return
|
|
980
|
+
return s.sort((n, i) => new Date(n.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), s[0];
|
|
981
981
|
}
|
|
982
982
|
function ht(e, t) {
|
|
983
|
-
const o = /* @__PURE__ */ new Date(),
|
|
984
|
-
const i =
|
|
983
|
+
const o = /* @__PURE__ */ new Date(), s = t.filter((n) => {
|
|
984
|
+
const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "FINISHED", a = new Date(n.timing.kickoffTime) <= o;
|
|
985
985
|
return i && r && a;
|
|
986
986
|
});
|
|
987
|
-
return
|
|
987
|
+
return s.sort((n, i) => new Date(i.timing.kickoffTime).getTime() - new Date(n.timing.kickoffTime).getTime()), s[0];
|
|
988
988
|
}
|
|
989
989
|
function Tt(e, t) {
|
|
990
990
|
const o = /* @__PURE__ */ new Date();
|
|
991
|
-
return t.filter((
|
|
992
|
-
const i =
|
|
991
|
+
return t.filter((n) => {
|
|
992
|
+
const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "NOT_STARTED" || n.status.type === "LIVE", a = new Date(n.timing.kickoffTime) >= o || n.status.type === "LIVE";
|
|
993
993
|
return i && r && a;
|
|
994
994
|
}).sort(
|
|
995
|
-
(
|
|
995
|
+
(n, i) => new Date(n.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
|
|
996
996
|
);
|
|
997
997
|
}
|
|
998
998
|
function vt(e, t) {
|
|
999
999
|
const o = /* @__PURE__ */ new Date();
|
|
1000
|
-
return t.filter((
|
|
1001
|
-
const i =
|
|
1000
|
+
return t.filter((n) => {
|
|
1001
|
+
const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "FINISHED", a = new Date(n.timing.kickoffTime) <= o;
|
|
1002
1002
|
return i && r && a;
|
|
1003
1003
|
}).sort(
|
|
1004
|
-
(
|
|
1004
|
+
(n, i) => new Date(i.timing.kickoffTime).getTime() - new Date(n.timing.kickoffTime).getTime()
|
|
1005
1005
|
);
|
|
1006
1006
|
}
|
|
1007
1007
|
function St(e, t, o) {
|
|
1008
|
-
const
|
|
1008
|
+
const s = o.filter((r) => r.status.type === "FINISHED"), n = o.filter(
|
|
1009
1009
|
(r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
|
|
1010
1010
|
), i = t.entries.map((r) => {
|
|
1011
|
-
const a = r.competitor.id,
|
|
1011
|
+
const a = r.competitor.id, d = s.filter(
|
|
1012
1012
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1013
|
-
), l =
|
|
1013
|
+
), l = n.filter(
|
|
1014
1014
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1015
1015
|
);
|
|
1016
|
-
let u,
|
|
1017
|
-
return
|
|
1016
|
+
let u, c;
|
|
1017
|
+
return d.forEach((m) => {
|
|
1018
1018
|
const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), R = g ? p : h, S = g ? h : p;
|
|
1019
1019
|
let A;
|
|
1020
1020
|
R > S ? A = "W" : R === S ? A = "D" : A = "L";
|
|
@@ -1025,14 +1025,14 @@ function St(e, t, o) {
|
|
|
1025
1025
|
matchId: m.id,
|
|
1026
1026
|
isUpcoming: !1
|
|
1027
1027
|
};
|
|
1028
|
-
g ? u = D :
|
|
1028
|
+
g ? u = D : c = D;
|
|
1029
1029
|
}), l.forEach((m) => {
|
|
1030
1030
|
const g = m.competitorOne.id === e;
|
|
1031
1031
|
g && !u ? u = {
|
|
1032
1032
|
date: m.timing.kickoffTime,
|
|
1033
1033
|
matchId: m.id,
|
|
1034
1034
|
isUpcoming: !0
|
|
1035
|
-
} : !g && !
|
|
1035
|
+
} : !g && !c && (c = {
|
|
1036
1036
|
date: m.timing.kickoffTime,
|
|
1037
1037
|
matchId: m.id,
|
|
1038
1038
|
isUpcoming: !0
|
|
@@ -1046,7 +1046,7 @@ function St(e, t, o) {
|
|
|
1046
1046
|
gamesPlayed: r.stats.played ?? 0,
|
|
1047
1047
|
points: r.stats.points ?? 0,
|
|
1048
1048
|
homeResult: u,
|
|
1049
|
-
awayResult:
|
|
1049
|
+
awayResult: c
|
|
1050
1050
|
};
|
|
1051
1051
|
});
|
|
1052
1052
|
return {
|
|
@@ -1055,67 +1055,67 @@ function St(e, t, o) {
|
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
1057
|
function _t(e, t = 10) {
|
|
1058
|
-
return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o,
|
|
1059
|
-
const
|
|
1060
|
-
if (i !==
|
|
1061
|
-
return i -
|
|
1058
|
+
return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, s) => {
|
|
1059
|
+
const n = o.seasonStatistics?.goals ?? 0, i = s.seasonStatistics?.goals ?? 0;
|
|
1060
|
+
if (i !== n)
|
|
1061
|
+
return i - n;
|
|
1062
1062
|
const r = o.seasonStatistics?.assists ?? 0;
|
|
1063
|
-
return (
|
|
1063
|
+
return (s.seasonStatistics?.assists ?? 0) - r;
|
|
1064
1064
|
}).slice(0, t);
|
|
1065
1065
|
}
|
|
1066
1066
|
function Ct(e, t = 10) {
|
|
1067
|
-
return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o,
|
|
1068
|
-
const
|
|
1069
|
-
if (i !==
|
|
1070
|
-
return i -
|
|
1067
|
+
return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, s) => {
|
|
1068
|
+
const n = o.seasonStatistics?.assists ?? 0, i = s.seasonStatistics?.assists ?? 0;
|
|
1069
|
+
if (i !== n)
|
|
1070
|
+
return i - n;
|
|
1071
1071
|
const r = o.seasonStatistics?.goals ?? 0;
|
|
1072
|
-
return (
|
|
1072
|
+
return (s.seasonStatistics?.goals ?? 0) - r;
|
|
1073
1073
|
}).slice(0, t);
|
|
1074
1074
|
}
|
|
1075
1075
|
function At(e, t = 10) {
|
|
1076
|
-
return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o,
|
|
1077
|
-
const
|
|
1078
|
-
if (i !==
|
|
1079
|
-
return i -
|
|
1076
|
+
return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, s) => {
|
|
1077
|
+
const n = o.seasonStatistics?.appearances ?? 0, i = s.seasonStatistics?.appearances ?? 0;
|
|
1078
|
+
if (i !== n)
|
|
1079
|
+
return i - n;
|
|
1080
1080
|
const r = o.seasonStatistics?.minutes ?? 0;
|
|
1081
|
-
return (
|
|
1081
|
+
return (s.seasonStatistics?.minutes ?? 0) - r;
|
|
1082
1082
|
}).slice(0, t);
|
|
1083
1083
|
}
|
|
1084
1084
|
function Ot(e, t = 10) {
|
|
1085
|
-
return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o,
|
|
1086
|
-
const
|
|
1087
|
-
if (i !==
|
|
1088
|
-
return i -
|
|
1085
|
+
return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, s) => {
|
|
1086
|
+
const n = o.seasonStatistics?.minutes ?? 0, i = s.seasonStatistics?.minutes ?? 0;
|
|
1087
|
+
if (i !== n)
|
|
1088
|
+
return i - n;
|
|
1089
1089
|
const r = o.seasonStatistics?.appearances ?? 0;
|
|
1090
|
-
return (
|
|
1090
|
+
return (s.seasonStatistics?.appearances ?? 0) - r;
|
|
1091
1091
|
}).slice(0, t);
|
|
1092
1092
|
}
|
|
1093
1093
|
function Ft(e, t = 10) {
|
|
1094
|
-
return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o,
|
|
1095
|
-
const
|
|
1096
|
-
if (i !==
|
|
1097
|
-
return i -
|
|
1094
|
+
return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, s) => {
|
|
1095
|
+
const n = o.seasonStatistics?.cleansheets ?? 0, i = s.seasonStatistics?.cleansheets ?? 0;
|
|
1096
|
+
if (i !== n)
|
|
1097
|
+
return i - n;
|
|
1098
1098
|
const r = o.seasonStatistics?.appearances ?? 0;
|
|
1099
|
-
return (
|
|
1099
|
+
return (s.seasonStatistics?.appearances ?? 0) - r;
|
|
1100
1100
|
}).slice(0, t);
|
|
1101
1101
|
}
|
|
1102
1102
|
function Mt(e, t = 10) {
|
|
1103
1103
|
return e.players.filter((o) => {
|
|
1104
|
-
const
|
|
1105
|
-
return
|
|
1106
|
-
}).sort((o,
|
|
1107
|
-
const
|
|
1108
|
-
return l !==
|
|
1104
|
+
const s = o.seasonStatistics?.yellowCards ?? 0, n = o.seasonStatistics?.redCards ?? 0;
|
|
1105
|
+
return s + n > 0;
|
|
1106
|
+
}).sort((o, s) => {
|
|
1107
|
+
const n = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = s.seasonStatistics?.yellowCards ?? 0, a = s.seasonStatistics?.redCards ?? 0, d = n + i * 3, l = r + a * 3;
|
|
1108
|
+
return l !== d ? l - d : a !== i ? a - i : r - n;
|
|
1109
1109
|
}).slice(0, t);
|
|
1110
1110
|
}
|
|
1111
1111
|
function b(e) {
|
|
1112
1112
|
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1113
|
-
return e.forEach((
|
|
1114
|
-
!
|
|
1115
|
-
if (
|
|
1116
|
-
const i =
|
|
1113
|
+
return e.forEach((s) => {
|
|
1114
|
+
!s.mainEvents || s.mainEvents.length === 0 || s.mainEvents.forEach((n) => {
|
|
1115
|
+
if (n.primaryPlayer) {
|
|
1116
|
+
const i = n.primaryPlayer.id;
|
|
1117
1117
|
t.has(i) || t.set(i, {
|
|
1118
|
-
playerId:
|
|
1118
|
+
playerId: n.primaryPlayer.id,
|
|
1119
1119
|
seasonId: "",
|
|
1120
1120
|
// Not applicable for match aggregation
|
|
1121
1121
|
teamId: "",
|
|
@@ -1127,12 +1127,12 @@ function b(e) {
|
|
|
1127
1127
|
appearances: 0
|
|
1128
1128
|
});
|
|
1129
1129
|
const r = t.get(i);
|
|
1130
|
-
o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(
|
|
1130
|
+
o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(s.id), (n.type === "GOAL" || n.type === "PENALTY_GOAL") && (r.goals = (r.goals ?? 0) + 1), n.type === "YELLOW_CARD" && (r.yellowCards = (r.yellowCards ?? 0) + 1), (n.type === "RED_CARD" || n.type === "YELLOW_RED_CARD") && (r.redCards = (r.redCards ?? 0) + 1);
|
|
1131
1131
|
}
|
|
1132
|
-
if (
|
|
1133
|
-
const i =
|
|
1132
|
+
if (n.secondaryPlayer && (n.type === "GOAL" || n.type === "PENALTY_GOAL")) {
|
|
1133
|
+
const i = n.secondaryPlayer.id;
|
|
1134
1134
|
t.has(i) || t.set(i, {
|
|
1135
|
-
playerId:
|
|
1135
|
+
playerId: n.secondaryPlayer.id,
|
|
1136
1136
|
seasonId: "",
|
|
1137
1137
|
// Not applicable for match aggregation
|
|
1138
1138
|
teamId: "",
|
|
@@ -1144,12 +1144,12 @@ function b(e) {
|
|
|
1144
1144
|
appearances: 0
|
|
1145
1145
|
});
|
|
1146
1146
|
const r = t.get(i);
|
|
1147
|
-
r.assists = (r.assists ?? 0) + 1, o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(
|
|
1147
|
+
r.assists = (r.assists ?? 0) + 1, o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(s.id);
|
|
1148
1148
|
}
|
|
1149
1149
|
});
|
|
1150
|
-
}), o.forEach((
|
|
1151
|
-
const i = t.get(
|
|
1152
|
-
i && i.appearances !== void 0 && (i.appearances =
|
|
1150
|
+
}), o.forEach((s, n) => {
|
|
1151
|
+
const i = t.get(n);
|
|
1152
|
+
i && i.appearances !== void 0 && (i.appearances = s.size);
|
|
1153
1153
|
}), t;
|
|
1154
1154
|
}
|
|
1155
1155
|
function k(e) {
|
|
@@ -1160,58 +1160,58 @@ function k(e) {
|
|
|
1160
1160
|
}
|
|
1161
1161
|
function qe(e, t = 10) {
|
|
1162
1162
|
const o = b(e);
|
|
1163
|
-
return k(o).filter((
|
|
1164
|
-
const r =
|
|
1163
|
+
return k(o).filter((n) => (n.goals ?? 0) > 0).sort((n, i) => {
|
|
1164
|
+
const r = n.goals ?? 0, a = i.goals ?? 0;
|
|
1165
1165
|
if (a !== r)
|
|
1166
1166
|
return a - r;
|
|
1167
|
-
const
|
|
1168
|
-
return (i.assists ?? 0) -
|
|
1167
|
+
const d = n.assists ?? 0;
|
|
1168
|
+
return (i.assists ?? 0) - d;
|
|
1169
1169
|
}).slice(0, t);
|
|
1170
1170
|
}
|
|
1171
1171
|
function je(e, t = 10) {
|
|
1172
1172
|
const o = b(e);
|
|
1173
|
-
return k(o).filter((
|
|
1174
|
-
const r =
|
|
1173
|
+
return k(o).filter((n) => (n.assists ?? 0) > 0).sort((n, i) => {
|
|
1174
|
+
const r = n.assists ?? 0, a = i.assists ?? 0;
|
|
1175
1175
|
if (a !== r)
|
|
1176
1176
|
return a - r;
|
|
1177
|
-
const
|
|
1178
|
-
return (i.goals ?? 0) -
|
|
1177
|
+
const d = n.goals ?? 0;
|
|
1178
|
+
return (i.goals ?? 0) - d;
|
|
1179
1179
|
}).slice(0, t);
|
|
1180
1180
|
}
|
|
1181
1181
|
function Ve(e, t = 10) {
|
|
1182
1182
|
const o = b(e);
|
|
1183
|
-
return k(o).filter((
|
|
1184
|
-
const r = (
|
|
1183
|
+
return k(o).filter((n) => (n.totalCards ?? 0) > 0).sort((n, i) => {
|
|
1184
|
+
const r = (n.yellowCards ?? 0) + (n.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
|
|
1185
1185
|
if (a !== r)
|
|
1186
1186
|
return a - r;
|
|
1187
|
-
const
|
|
1188
|
-
if (l !==
|
|
1189
|
-
return l -
|
|
1190
|
-
const u =
|
|
1187
|
+
const d = n.redCards ?? 0, l = i.redCards ?? 0;
|
|
1188
|
+
if (l !== d)
|
|
1189
|
+
return l - d;
|
|
1190
|
+
const u = n.yellowCards ?? 0;
|
|
1191
1191
|
return (i.yellowCards ?? 0) - u;
|
|
1192
1192
|
}).slice(0, t);
|
|
1193
1193
|
}
|
|
1194
1194
|
function Ye(e, t = 10) {
|
|
1195
1195
|
const o = b(e);
|
|
1196
|
-
return k(o).filter((
|
|
1197
|
-
const r = (
|
|
1196
|
+
return k(o).filter((n) => (n.goals ?? 0) + (n.assists ?? 0) > 0).sort((n, i) => {
|
|
1197
|
+
const r = (n.goals ?? 0) + (n.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
|
|
1198
1198
|
if (a !== r)
|
|
1199
1199
|
return a - r;
|
|
1200
|
-
const
|
|
1201
|
-
if (l !==
|
|
1202
|
-
return l -
|
|
1203
|
-
const u =
|
|
1200
|
+
const d = n.goals ?? 0, l = i.goals ?? 0;
|
|
1201
|
+
if (l !== d)
|
|
1202
|
+
return l - d;
|
|
1203
|
+
const u = n.assists ?? 0;
|
|
1204
1204
|
return (i.assists ?? 0) - u;
|
|
1205
1205
|
}).slice(0, t);
|
|
1206
1206
|
}
|
|
1207
1207
|
function ze(e) {
|
|
1208
1208
|
const t = b(e);
|
|
1209
|
-
return k(t).sort((
|
|
1210
|
-
const i =
|
|
1209
|
+
return k(t).sort((s, n) => {
|
|
1210
|
+
const i = s.appearances ?? 0, r = n.appearances ?? 0;
|
|
1211
1211
|
if (r !== i)
|
|
1212
1212
|
return r - i;
|
|
1213
|
-
const a = (
|
|
1214
|
-
return (
|
|
1213
|
+
const a = (s.goals ?? 0) + (s.assists ?? 0);
|
|
1214
|
+
return (n.goals ?? 0) + (n.assists ?? 0) - a;
|
|
1215
1215
|
});
|
|
1216
1216
|
}
|
|
1217
1217
|
function Gt(e, t = 10) {
|
|
@@ -1223,10 +1223,10 @@ function Rt(e, t = 10) {
|
|
|
1223
1223
|
function Dt(e, t = 10) {
|
|
1224
1224
|
return P(() => Ve(e, t), [e, t]);
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function Et(e, t = 10) {
|
|
1227
1227
|
return P(() => Ye(e, t), [e, t]);
|
|
1228
1228
|
}
|
|
1229
|
-
function
|
|
1229
|
+
function Nt(e) {
|
|
1230
1230
|
return P(() => ze(e), [e]);
|
|
1231
1231
|
}
|
|
1232
1232
|
function Ke(e) {
|
|
@@ -1249,8 +1249,8 @@ function Pt(e, t = !1, o = 2) {
|
|
|
1249
1249
|
function Lt(e, t) {
|
|
1250
1250
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
1251
1251
|
if (isNaN(o) || t === 0) return "0";
|
|
1252
|
-
const
|
|
1253
|
-
return `${o} (${
|
|
1252
|
+
const s = (o / t).toFixed(1);
|
|
1253
|
+
return `${o} (${s} avg)`;
|
|
1254
1254
|
}
|
|
1255
1255
|
function bt(e, t) {
|
|
1256
1256
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
@@ -1262,25 +1262,25 @@ function Ht(e) {
|
|
|
1262
1262
|
}
|
|
1263
1263
|
function Qe(e, t, o) {
|
|
1264
1264
|
if (e.status?.type !== "FINISHED" || !e.score) return null;
|
|
1265
|
-
const
|
|
1266
|
-
let a = null,
|
|
1265
|
+
const s = parseInt(e.score.competitorOne || "0"), n = parseInt(e.score.competitorTwo || "0"), i = o ? s : n, r = o ? n : s;
|
|
1266
|
+
let a = null, d = null;
|
|
1267
1267
|
const l = e.score.breakdown?.halfTime;
|
|
1268
1268
|
if (l) {
|
|
1269
1269
|
const g = parseInt(l.competitorOne || "0"), p = parseInt(l.competitorTwo || "0");
|
|
1270
|
-
a = o ? g : p,
|
|
1270
|
+
a = o ? g : p, d = o ? p : g;
|
|
1271
1271
|
}
|
|
1272
1272
|
const u = e.statistics;
|
|
1273
|
-
let
|
|
1273
|
+
let c = null, m = null;
|
|
1274
1274
|
if (u) {
|
|
1275
1275
|
const g = u.find?.((p) => p.type === "CORNERS");
|
|
1276
|
-
g && (
|
|
1276
|
+
g && (c = o ? g.competitorOne : g.competitorTwo, m = o ? g.competitorTwo : g.competitorOne);
|
|
1277
1277
|
}
|
|
1278
1278
|
return {
|
|
1279
1279
|
goalsFor: i,
|
|
1280
1280
|
goalsAgainst: r,
|
|
1281
1281
|
halfTimeGoalsFor: a,
|
|
1282
|
-
halfTimeGoalsAgainst:
|
|
1283
|
-
cornersFor:
|
|
1282
|
+
halfTimeGoalsAgainst: d,
|
|
1283
|
+
cornersFor: c,
|
|
1284
1284
|
cornersAgainst: m,
|
|
1285
1285
|
isWin: i > r,
|
|
1286
1286
|
isDraw: i === r,
|
|
@@ -1299,49 +1299,49 @@ function kt(e, t) {
|
|
|
1299
1299
|
function Bt(e) {
|
|
1300
1300
|
return e.status?.type === "FINISHED";
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function Ut(e, t) {
|
|
1303
1303
|
const o = K(e, t);
|
|
1304
1304
|
return parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function $t(e, t) {
|
|
1307
1307
|
const o = K(e, t);
|
|
1308
1308
|
return parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1309
1309
|
}
|
|
1310
1310
|
function xt(e, t, o) {
|
|
1311
|
-
const
|
|
1311
|
+
const s = e.filter((u) => {
|
|
1312
1312
|
if (u.status?.type !== "FINISHED" || !u.score) return !1;
|
|
1313
|
-
const
|
|
1314
|
-
return
|
|
1313
|
+
const c = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
|
|
1314
|
+
return c && m;
|
|
1315
1315
|
});
|
|
1316
|
-
let
|
|
1317
|
-
|
|
1318
|
-
const
|
|
1319
|
-
a += p,
|
|
1316
|
+
let n = 0, i = 0, r = 0, a = 0, d = 0;
|
|
1317
|
+
s.forEach((u) => {
|
|
1318
|
+
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;
|
|
1319
|
+
a += p, d += h, p > h ? n++ : h > p ? i++ : r++;
|
|
1320
1320
|
});
|
|
1321
|
-
const l =
|
|
1321
|
+
const l = s.length;
|
|
1322
1322
|
return {
|
|
1323
1323
|
totalMatches: l,
|
|
1324
|
-
homeTeamWins:
|
|
1324
|
+
homeTeamWins: n,
|
|
1325
1325
|
awayTeamWins: i,
|
|
1326
1326
|
draws: r,
|
|
1327
1327
|
homeTeamGoals: a,
|
|
1328
|
-
awayTeamGoals:
|
|
1329
|
-
homeTeamWinPercentage: l > 0 ?
|
|
1328
|
+
awayTeamGoals: d,
|
|
1329
|
+
homeTeamWinPercentage: l > 0 ? n / l * 100 : 0,
|
|
1330
1330
|
awayTeamWinPercentage: l > 0 ? i / l * 100 : 0,
|
|
1331
1331
|
drawPercentage: l > 0 ? r / l * 100 : 0,
|
|
1332
1332
|
homeTeamAvgGoals: l > 0 ? a / l : 0,
|
|
1333
|
-
awayTeamAvgGoals: l > 0 ?
|
|
1333
|
+
awayTeamAvgGoals: l > 0 ? d / l : 0
|
|
1334
1334
|
};
|
|
1335
1335
|
}
|
|
1336
|
-
function Wt(e, t, o,
|
|
1336
|
+
function Wt(e, t, o, s = 5) {
|
|
1337
1337
|
return e.filter((i) => {
|
|
1338
1338
|
if (i.status?.type !== "FINISHED" || !i.score) return !1;
|
|
1339
1339
|
const r = i.competitorOne.id === t || i.competitorTwo.id === t, a = i.competitorOne.id === o || i.competitorTwo.id === o;
|
|
1340
1340
|
return r && a;
|
|
1341
|
-
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0,
|
|
1342
|
-
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"),
|
|
1343
|
-
let
|
|
1344
|
-
return l > u ?
|
|
1341
|
+
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, s).map((i) => {
|
|
1342
|
+
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;
|
|
1343
|
+
let c;
|
|
1344
|
+
return l > u ? c = "home" : u > l ? c = "away" : c = "draw", {
|
|
1345
1345
|
id: i.id,
|
|
1346
1346
|
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1347
1347
|
day: "numeric",
|
|
@@ -1355,50 +1355,50 @@ function Wt(e, t, o, n = 5) {
|
|
|
1355
1355
|
homeScore: r,
|
|
1356
1356
|
awayScore: a,
|
|
1357
1357
|
venue: i.venue?.name,
|
|
1358
|
-
winner:
|
|
1358
|
+
winner: c
|
|
1359
1359
|
};
|
|
1360
1360
|
});
|
|
1361
1361
|
}
|
|
1362
1362
|
function Ze(e, t, o) {
|
|
1363
|
-
return e.filter((
|
|
1364
|
-
const
|
|
1365
|
-
return !
|
|
1366
|
-
}).map((
|
|
1367
|
-
const
|
|
1368
|
-
return Qe(
|
|
1369
|
-
}).filter((
|
|
1370
|
-
}
|
|
1371
|
-
function J(e, t, o,
|
|
1372
|
-
let
|
|
1363
|
+
return e.filter((s) => {
|
|
1364
|
+
const n = s.competitorOne.id === t, i = s.competitorTwo.id === t;
|
|
1365
|
+
return !n && !i ? !1 : o === "home" ? n : i;
|
|
1366
|
+
}).map((s) => {
|
|
1367
|
+
const n = s.competitorOne.id === t;
|
|
1368
|
+
return Qe(s, t, n);
|
|
1369
|
+
}).filter((s) => s !== null);
|
|
1370
|
+
}
|
|
1371
|
+
function J(e, t, o, s) {
|
|
1372
|
+
let n = 0;
|
|
1373
1373
|
for (const i of e) {
|
|
1374
1374
|
const r = i.competitorOne.id === t, a = i.competitorTwo.id === t;
|
|
1375
1375
|
if (!r && !a || o === "home" && !r || o === "away" && !a || i.status?.type !== "FINISHED") continue;
|
|
1376
|
-
const
|
|
1377
|
-
if (!
|
|
1378
|
-
const l =
|
|
1376
|
+
const d = i.mainEvents;
|
|
1377
|
+
if (!d || !Array.isArray(d)) continue;
|
|
1378
|
+
const l = d.filter((p) => p.type && Je.includes(p.type)).sort((p, h) => {
|
|
1379
1379
|
const R = p.minute ?? 0, S = h.minute ?? 0;
|
|
1380
1380
|
return R !== S ? R - S : (p.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
|
|
1381
1381
|
});
|
|
1382
1382
|
if (l.length === 0) continue;
|
|
1383
|
-
const u = l[0],
|
|
1383
|
+
const u = l[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
|
|
1384
1384
|
let g;
|
|
1385
|
-
m ? g = u.competitorPosition !==
|
|
1385
|
+
m ? g = u.competitorPosition !== c : g = u.competitorPosition === c, (s === "scored" && g || s === "conceded" && !g) && n++;
|
|
1386
1386
|
}
|
|
1387
|
-
return
|
|
1387
|
+
return n;
|
|
1388
1388
|
}
|
|
1389
1389
|
function we(e, t, o) {
|
|
1390
|
-
let
|
|
1391
|
-
for (const
|
|
1392
|
-
const i =
|
|
1393
|
-
if (!i && !r || o === "home" && !i || o === "away" && !r ||
|
|
1394
|
-
const a =
|
|
1395
|
-
a && Array.isArray(a) &&
|
|
1390
|
+
let s = 0;
|
|
1391
|
+
for (const n of e) {
|
|
1392
|
+
const i = n.competitorOne.id === t, r = n.competitorTwo.id === t;
|
|
1393
|
+
if (!i && !r || o === "home" && !i || o === "away" && !r || n.status?.type !== "FINISHED") continue;
|
|
1394
|
+
const a = n.mainEvents;
|
|
1395
|
+
a && Array.isArray(a) && s++;
|
|
1396
1396
|
}
|
|
1397
|
-
return
|
|
1397
|
+
return s;
|
|
1398
1398
|
}
|
|
1399
1399
|
function qt(e, t, o) {
|
|
1400
|
-
const
|
|
1401
|
-
if (
|
|
1400
|
+
const s = Ze(e, t, o), n = s.length;
|
|
1401
|
+
if (n === 0)
|
|
1402
1402
|
return {
|
|
1403
1403
|
played: 0,
|
|
1404
1404
|
goalsForPerMatch: 0,
|
|
@@ -1418,54 +1418,54 @@ function qt(e, t, o) {
|
|
|
1418
1418
|
avgCornersFor: 0,
|
|
1419
1419
|
avgCornersAgainst: 0
|
|
1420
1420
|
};
|
|
1421
|
-
const i =
|
|
1421
|
+
const i = s.reduce((f, v) => f + v.goalsFor, 0), r = s.reduce((f, v) => f + v.goalsAgainst, 0), a = s.filter((f) => f.goalsAgainst === 0).length, d = s.filter((f) => f.isWin && f.goalsAgainst === 0).length, l = s.filter((f) => f.goalsFor > 0).length, u = s.filter((f) => f.goalsFor === 0).length, c = s.filter((f) => f.isLoss && f.goalsFor === 0).length, m = s.filter((f) => f.goalsAgainst > 0).length, g = s.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
|
|
1422
1422
|
const v = f.halfTimeGoalsFor, H = f.goalsFor - v;
|
|
1423
1423
|
return v > 0 && H > 0;
|
|
1424
1424
|
}).length, R = J(e, t, o, "scored"), S = we(e, t, o), A = g.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, D = g.filter((f) => {
|
|
1425
1425
|
const v = f.halfTimeGoalsAgainst, H = f.goalsAgainst - v;
|
|
1426
1426
|
return v > 0 && H > 0;
|
|
1427
|
-
}).length, B = J(e, t, o, "conceded"),
|
|
1427
|
+
}).length, B = J(e, t, o, "conceded"), U = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, L = s.filter((f) => f.cornersFor !== null), $ = L.reduce((f, v) => f + (v.cornersFor || 0), 0), x = L.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
|
|
1428
1428
|
return {
|
|
1429
|
-
played:
|
|
1430
|
-
goalsForPerMatch: W(i,
|
|
1431
|
-
cleanSheets: O(a,
|
|
1432
|
-
wonToNil: O(
|
|
1433
|
-
scoringRate: O(l,
|
|
1429
|
+
played: n,
|
|
1430
|
+
goalsForPerMatch: W(i, n),
|
|
1431
|
+
cleanSheets: O(a, n),
|
|
1432
|
+
wonToNil: O(d, n),
|
|
1433
|
+
scoringRate: O(l, n),
|
|
1434
1434
|
scoredInBothHalves: O(h, p),
|
|
1435
1435
|
scoredFirst: O(R, S),
|
|
1436
1436
|
leadingAtHalfTime: O(A, p),
|
|
1437
|
-
goalsAgainstPerMatch: W(r,
|
|
1438
|
-
failedToScore: O(u,
|
|
1439
|
-
lostToNil: O(
|
|
1440
|
-
concedingRate: O(m,
|
|
1437
|
+
goalsAgainstPerMatch: W(r, n),
|
|
1438
|
+
failedToScore: O(u, n),
|
|
1439
|
+
lostToNil: O(c, n),
|
|
1440
|
+
concedingRate: O(m, n),
|
|
1441
1441
|
concededInBothHalves: O(D, p),
|
|
1442
1442
|
concededFirst: O(B, S),
|
|
1443
|
-
losingAtHalfTime: O(
|
|
1444
|
-
avgCornersFor: W(
|
|
1443
|
+
losingAtHalfTime: O(U, p),
|
|
1444
|
+
avgCornersFor: W($, L.length),
|
|
1445
1445
|
avgCornersAgainst: W(x, L.length)
|
|
1446
1446
|
};
|
|
1447
1447
|
}
|
|
1448
1448
|
function et(e, t) {
|
|
1449
1449
|
return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
|
|
1450
|
-
const
|
|
1451
|
-
let
|
|
1450
|
+
const s = o.competitorOne.id === t, n = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = n + i, a = o.periods;
|
|
1451
|
+
let d = null;
|
|
1452
1452
|
if (a && Array.isArray(a)) {
|
|
1453
1453
|
const l = a.find(
|
|
1454
1454
|
(u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
|
|
1455
1455
|
);
|
|
1456
1456
|
if (l?.score) {
|
|
1457
|
-
const u = parseInt(l.score.competitorOne || "0"),
|
|
1458
|
-
|
|
1457
|
+
const u = parseInt(l.score.competitorOne || "0"), c = parseInt(l.score.competitorTwo || "0");
|
|
1458
|
+
d = u + c;
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
|
-
return { totalGoals: r, halfTimeGoals:
|
|
1461
|
+
return { totalGoals: r, halfTimeGoals: d, isHome: s };
|
|
1462
1462
|
});
|
|
1463
1463
|
}
|
|
1464
1464
|
function y(e, t) {
|
|
1465
|
-
return e.length === 0 ? 0 : e.filter((
|
|
1465
|
+
return e.length === 0 ? 0 : e.filter((s) => s > t).length / e.length * 100;
|
|
1466
1466
|
}
|
|
1467
1467
|
function jt(e, t) {
|
|
1468
|
-
const o = et(e, t),
|
|
1468
|
+
const o = et(e, t), s = o.filter((c) => c.isHome), n = o.filter((c) => !c.isHome), i = o.map((c) => c.totalGoals), r = s.map((c) => c.totalGoals), a = n.map((c) => c.totalGoals), d = o.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), l = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
|
|
1469
1469
|
return {
|
|
1470
1470
|
over05: {
|
|
1471
1471
|
home: y(r, 0.5),
|
|
@@ -1499,37 +1499,37 @@ function jt(e, t) {
|
|
|
1499
1499
|
},
|
|
1500
1500
|
over05HT: {
|
|
1501
1501
|
home: y(l, 0.5),
|
|
1502
|
-
total: y(
|
|
1502
|
+
total: y(d, 0.5),
|
|
1503
1503
|
away: y(u, 0.5)
|
|
1504
1504
|
},
|
|
1505
1505
|
over15HT: {
|
|
1506
1506
|
home: y(l, 1.5),
|
|
1507
|
-
total: y(
|
|
1507
|
+
total: y(d, 1.5),
|
|
1508
1508
|
away: y(u, 1.5)
|
|
1509
1509
|
},
|
|
1510
1510
|
over25HT: {
|
|
1511
1511
|
home: y(l, 2.5),
|
|
1512
|
-
total: y(
|
|
1512
|
+
total: y(d, 2.5),
|
|
1513
1513
|
away: y(u, 2.5)
|
|
1514
1514
|
}
|
|
1515
1515
|
};
|
|
1516
1516
|
}
|
|
1517
1517
|
function tt(e, t) {
|
|
1518
|
-
const o = e.competitorOne.id === t,
|
|
1519
|
-
if (!o && !
|
|
1520
|
-
const
|
|
1518
|
+
const o = e.competitorOne.id === t, s = e.competitorTwo.id === t;
|
|
1519
|
+
if (!o && !s || !e.score) return null;
|
|
1520
|
+
const n = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
|
|
1521
1521
|
let r;
|
|
1522
|
-
return
|
|
1523
|
-
result: { score: `${
|
|
1522
|
+
return n > i ? r = "W" : n < i ? r = "L" : r = "D", {
|
|
1523
|
+
result: { score: `${n}:${i}`, result: r, isHome: o },
|
|
1524
1524
|
isHome: o
|
|
1525
1525
|
};
|
|
1526
1526
|
}
|
|
1527
|
-
function Vt(e, t, o,
|
|
1528
|
-
const r = t?.entries.find((
|
|
1527
|
+
function Vt(e, t, o, s, n, i) {
|
|
1528
|
+
const r = t?.entries.find((E) => E.competitor.id === e), a = o?.entries.find((E) => E.competitor.id === e), d = s?.entries.find((E) => E.competitor.id === e), l = n?.entries.find((E) => E.competitor.id === e), u = i?.entries.find((E) => E.competitor.id === e);
|
|
1529
1529
|
if (!r) return null;
|
|
1530
|
-
const
|
|
1530
|
+
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, R = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = d?.stats?.played ?? 0, D = r?.stats?.played ?? 0, B = D > 0 ? g / D : 0, U = D > 0 ? R / D : 0, L = B + U, $ = S > 0 ? c / S : 0, x = A > 0 ? m / A : 0, f = S > 0 ? p / S : 0, v = A > 0 ? h / A : 0, H = $ + f, ee = x + v;
|
|
1531
1531
|
return {
|
|
1532
|
-
homeGoals:
|
|
1532
|
+
homeGoals: c,
|
|
1533
1533
|
totalGoals: g,
|
|
1534
1534
|
awayGoals: m,
|
|
1535
1535
|
homeGamesPlayed: S,
|
|
@@ -1539,9 +1539,9 @@ function Vt(e, t, o, n, s, i) {
|
|
|
1539
1539
|
totalGoalsConceded: R,
|
|
1540
1540
|
awayGoalsConceded: h,
|
|
1541
1541
|
gfPerMatch: B,
|
|
1542
|
-
gaPerMatch:
|
|
1542
|
+
gaPerMatch: U,
|
|
1543
1543
|
gfGaPerMatch: L,
|
|
1544
|
-
homeGfPerMatch:
|
|
1544
|
+
homeGfPerMatch: $,
|
|
1545
1545
|
awayGfPerMatch: x,
|
|
1546
1546
|
homeGaPerMatch: f,
|
|
1547
1547
|
awayGaPerMatch: v,
|
|
@@ -1549,14 +1549,14 @@ function Vt(e, t, o, n, s, i) {
|
|
|
1549
1549
|
awayGfGaPerMatch: ee
|
|
1550
1550
|
};
|
|
1551
1551
|
}
|
|
1552
|
-
function _(e, t, o,
|
|
1553
|
-
const
|
|
1554
|
-
const a = r.competitorOne.id === t,
|
|
1555
|
-
return !(!a && !
|
|
1552
|
+
function _(e, t, o, s) {
|
|
1553
|
+
const n = e.filter((r) => {
|
|
1554
|
+
const a = r.competitorOne.id === t, d = r.competitorTwo.id === t;
|
|
1555
|
+
return !(!a && !d || r.status?.type !== "FINISHED" || s === "home" && !a || s === "away" && !d);
|
|
1556
1556
|
}).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
|
|
1557
|
-
if (
|
|
1557
|
+
if (n.length === 0) return null;
|
|
1558
1558
|
let i = 0;
|
|
1559
|
-
for (const r of
|
|
1559
|
+
for (const r of n) {
|
|
1560
1560
|
const a = r.competitorOne.id === t;
|
|
1561
1561
|
if (o(r, t, a))
|
|
1562
1562
|
i++;
|
|
@@ -1567,13 +1567,13 @@ function _(e, t, o, n) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
const T = {
|
|
1569
1569
|
win: (e, t, o) => {
|
|
1570
|
-
const
|
|
1571
|
-
return
|
|
1570
|
+
const s = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), n = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1571
|
+
return s > n;
|
|
1572
1572
|
},
|
|
1573
1573
|
draw: (e) => e.score?.competitorOne === e.score?.competitorTwo,
|
|
1574
1574
|
loss: (e, t, o) => {
|
|
1575
|
-
const
|
|
1576
|
-
return
|
|
1575
|
+
const s = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), n = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1576
|
+
return s < n;
|
|
1577
1577
|
},
|
|
1578
1578
|
noWin: (e, t, o) => !T.win(e, t, o),
|
|
1579
1579
|
noDraw: (e) => !T.draw(e),
|
|
@@ -1606,89 +1606,89 @@ function q(e, t, o) {
|
|
|
1606
1606
|
};
|
|
1607
1607
|
}
|
|
1608
1608
|
function Yt(e, t, o) {
|
|
1609
|
-
const
|
|
1609
|
+
const s = q(e, t, "home"), n = q(e, t), i = q(e, o, "away"), r = q(e, o);
|
|
1610
1610
|
return [
|
|
1611
1611
|
{
|
|
1612
1612
|
label: "Consecutive wins",
|
|
1613
|
-
homeTeam: { home:
|
|
1613
|
+
homeTeam: { home: s.win, total: n.win },
|
|
1614
1614
|
awayTeam: { total: r.win, home: i.win },
|
|
1615
1615
|
colorType: "neutral"
|
|
1616
1616
|
},
|
|
1617
1617
|
{
|
|
1618
1618
|
label: "Consecutive draws",
|
|
1619
|
-
homeTeam: { home:
|
|
1619
|
+
homeTeam: { home: s.draw, total: n.draw },
|
|
1620
1620
|
awayTeam: { total: r.draw, home: i.draw },
|
|
1621
1621
|
colorType: "neutral"
|
|
1622
1622
|
},
|
|
1623
1623
|
{
|
|
1624
1624
|
label: "Consecutive defeats",
|
|
1625
|
-
homeTeam: { home:
|
|
1625
|
+
homeTeam: { home: s.loss, total: n.loss },
|
|
1626
1626
|
awayTeam: { total: r.loss, home: i.loss },
|
|
1627
1627
|
colorType: "neutral"
|
|
1628
1628
|
},
|
|
1629
1629
|
{
|
|
1630
1630
|
label: "No win",
|
|
1631
|
-
homeTeam: { home:
|
|
1631
|
+
homeTeam: { home: s.noWin, total: n.noWin },
|
|
1632
1632
|
awayTeam: { total: r.noWin, home: i.noWin },
|
|
1633
1633
|
colorType: "negative"
|
|
1634
1634
|
},
|
|
1635
1635
|
{
|
|
1636
1636
|
label: "No draw",
|
|
1637
|
-
homeTeam: { home:
|
|
1637
|
+
homeTeam: { home: s.noDraw, total: n.noDraw },
|
|
1638
1638
|
awayTeam: { total: r.noDraw, home: i.noDraw },
|
|
1639
1639
|
colorType: "neutral"
|
|
1640
1640
|
},
|
|
1641
1641
|
{
|
|
1642
1642
|
label: "No defeat",
|
|
1643
|
-
homeTeam: { home:
|
|
1643
|
+
homeTeam: { home: s.noDefeat, total: n.noDefeat },
|
|
1644
1644
|
awayTeam: { total: r.noDefeat, home: i.noDefeat },
|
|
1645
1645
|
colorType: "positive"
|
|
1646
1646
|
},
|
|
1647
1647
|
{
|
|
1648
1648
|
label: "Scored at least once",
|
|
1649
|
-
homeTeam: { home:
|
|
1649
|
+
homeTeam: { home: s.scored, total: n.scored },
|
|
1650
1650
|
awayTeam: { total: r.scored, home: i.scored },
|
|
1651
1651
|
colorType: "positive"
|
|
1652
1652
|
},
|
|
1653
1653
|
{
|
|
1654
1654
|
label: "Conceded at least once",
|
|
1655
|
-
homeTeam: { home:
|
|
1655
|
+
homeTeam: { home: s.conceded, total: n.conceded },
|
|
1656
1656
|
awayTeam: { total: r.conceded, home: i.conceded },
|
|
1657
1657
|
colorType: "negative"
|
|
1658
1658
|
},
|
|
1659
1659
|
{
|
|
1660
1660
|
label: "No goal scored",
|
|
1661
|
-
homeTeam: { home:
|
|
1661
|
+
homeTeam: { home: s.noGoalScored, total: n.noGoalScored },
|
|
1662
1662
|
awayTeam: { total: r.noGoalScored, home: i.noGoalScored },
|
|
1663
1663
|
colorType: "neutral"
|
|
1664
1664
|
},
|
|
1665
1665
|
{
|
|
1666
1666
|
label: "No goal conceded",
|
|
1667
|
-
homeTeam: { home:
|
|
1667
|
+
homeTeam: { home: s.noGoalConceded, total: n.noGoalConceded },
|
|
1668
1668
|
awayTeam: { total: r.noGoalConceded, home: i.noGoalConceded },
|
|
1669
1669
|
colorType: "neutral"
|
|
1670
1670
|
},
|
|
1671
1671
|
{
|
|
1672
1672
|
label: "GS + GC over 2.5",
|
|
1673
|
-
homeTeam: { home:
|
|
1673
|
+
homeTeam: { home: s.over25, total: n.over25 },
|
|
1674
1674
|
awayTeam: { total: r.over25, home: i.over25 },
|
|
1675
1675
|
colorType: "neutral"
|
|
1676
1676
|
},
|
|
1677
1677
|
{
|
|
1678
1678
|
label: "GS + GC under 2.5",
|
|
1679
|
-
homeTeam: { home:
|
|
1679
|
+
homeTeam: { home: s.under25, total: n.under25 },
|
|
1680
1680
|
awayTeam: { total: r.under25, home: i.under25 },
|
|
1681
1681
|
colorType: "neutral"
|
|
1682
1682
|
},
|
|
1683
1683
|
{
|
|
1684
1684
|
label: "Scored at least twice",
|
|
1685
|
-
homeTeam: { home:
|
|
1685
|
+
homeTeam: { home: s.scoredTwice, total: n.scoredTwice },
|
|
1686
1686
|
awayTeam: { total: r.scoredTwice, home: i.scoredTwice },
|
|
1687
1687
|
colorType: "positive"
|
|
1688
1688
|
},
|
|
1689
1689
|
{
|
|
1690
1690
|
label: "Conceded at least twice",
|
|
1691
|
-
homeTeam: { home:
|
|
1691
|
+
homeTeam: { home: s.concededTwice, total: n.concededTwice },
|
|
1692
1692
|
awayTeam: { total: r.concededTwice, home: i.concededTwice },
|
|
1693
1693
|
colorType: "negative"
|
|
1694
1694
|
}
|
|
@@ -1696,44 +1696,44 @@ function Yt(e, t, o) {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
function Q(e, t) {
|
|
1698
1698
|
const o = /* @__PURE__ */ new Map();
|
|
1699
|
-
return e.forEach((
|
|
1700
|
-
if (
|
|
1701
|
-
const
|
|
1702
|
-
if (!
|
|
1703
|
-
const i =
|
|
1699
|
+
return e.forEach((s) => {
|
|
1700
|
+
if (s.status?.type !== "FINISHED") return;
|
|
1701
|
+
const n = tt(s, t);
|
|
1702
|
+
if (!n) return;
|
|
1703
|
+
const i = n.isHome ? s.competitorTwo.id : s.competitorOne.id, r = n.isHome ? s.competitorTwo : s.competitorOne, a = o.get(i) || {
|
|
1704
1704
|
opponentId: i,
|
|
1705
1705
|
opponentName: r.name,
|
|
1706
1706
|
opponentLogo: r.assets?.logo
|
|
1707
1707
|
};
|
|
1708
|
-
|
|
1708
|
+
n.isHome ? a.homeResult = n.result : a.awayResult = n.result, o.set(i, a);
|
|
1709
1709
|
}), o;
|
|
1710
1710
|
}
|
|
1711
|
-
function zt(e, t, o,
|
|
1712
|
-
const a = Q(e, t),
|
|
1711
|
+
function zt(e, t, o, s, n, i, r) {
|
|
1712
|
+
const a = Q(e, t), d = Q(e, o), l = /* @__PURE__ */ new Set([
|
|
1713
1713
|
...a.keys(),
|
|
1714
|
-
...
|
|
1714
|
+
...d.keys(),
|
|
1715
1715
|
t,
|
|
1716
1716
|
// Include home team as row for away team results
|
|
1717
1717
|
o
|
|
1718
1718
|
// Include away team as row for home team results
|
|
1719
1719
|
]), u = [];
|
|
1720
|
-
return l.forEach((
|
|
1721
|
-
const m = a.get(
|
|
1722
|
-
if (!m && !g &&
|
|
1720
|
+
return l.forEach((c) => {
|
|
1721
|
+
const m = a.get(c), g = d.get(c);
|
|
1722
|
+
if (!m && !g && c !== t && c !== o)
|
|
1723
1723
|
return;
|
|
1724
1724
|
let p, h;
|
|
1725
|
-
|
|
1726
|
-
opponentId:
|
|
1725
|
+
c === t ? (p = s, h = i) : c === o ? (p = n, h = r) : (p = m?.opponentName || g?.opponentName || "", h = m?.opponentLogo || g?.opponentLogo), u.push({
|
|
1726
|
+
opponentId: c,
|
|
1727
1727
|
opponentName: p,
|
|
1728
1728
|
opponentLogo: h,
|
|
1729
1729
|
homeTeamHome: m?.homeResult,
|
|
1730
1730
|
homeTeamAway: m?.awayResult,
|
|
1731
1731
|
awayTeamHome: g?.homeResult,
|
|
1732
1732
|
awayTeamAway: g?.awayResult,
|
|
1733
|
-
isHomeTeamRow:
|
|
1734
|
-
isAwayTeamRow:
|
|
1733
|
+
isHomeTeamRow: c === t,
|
|
1734
|
+
isAwayTeamRow: c === o
|
|
1735
1735
|
});
|
|
1736
|
-
}), u.sort((
|
|
1736
|
+
}), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
|
|
1737
1737
|
}
|
|
1738
1738
|
export {
|
|
1739
1739
|
Je as GOAL_EVENT_TYPES,
|
|
@@ -1765,8 +1765,8 @@ export {
|
|
|
1765
1765
|
eo as getFootballMatchCommentary,
|
|
1766
1766
|
to as getFootballMatchEvents,
|
|
1767
1767
|
oo as getFootballMatchLineups,
|
|
1768
|
-
|
|
1769
|
-
|
|
1768
|
+
no as getFootballMatchOdds,
|
|
1769
|
+
so as getFootballMatchStatistics,
|
|
1770
1770
|
io as getFootballMatches,
|
|
1771
1771
|
ro as getFootballPlayerSeasonStatistics,
|
|
1772
1772
|
ao as getFootballSeasonDetails,
|
|
@@ -1778,7 +1778,7 @@ export {
|
|
|
1778
1778
|
go as getLeaderboardTemplate,
|
|
1779
1779
|
tt as getMatchResult,
|
|
1780
1780
|
Ve as getMostCardedPlayersFromMatches,
|
|
1781
|
-
|
|
1781
|
+
$t as getOpponentScore,
|
|
1782
1782
|
po as getProviderRefId,
|
|
1783
1783
|
Wt as getRecentH2HMeetings,
|
|
1784
1784
|
vt as getTeamFinishedMatches,
|
|
@@ -1789,7 +1789,7 @@ export {
|
|
|
1789
1789
|
jt as getTeamOverUnderStats,
|
|
1790
1790
|
ht as getTeamPreviousMatch,
|
|
1791
1791
|
St as getTeamResultsTable,
|
|
1792
|
-
|
|
1792
|
+
Ut as getTeamScore,
|
|
1793
1793
|
rt as getTeamSeasonStatistics,
|
|
1794
1794
|
q as getTeamStreaks,
|
|
1795
1795
|
Yt as getTeamStreaksComparison,
|
|
@@ -1809,15 +1809,15 @@ export {
|
|
|
1809
1809
|
K as isTeamHome,
|
|
1810
1810
|
kt as isTeamInMatch,
|
|
1811
1811
|
it as search,
|
|
1812
|
-
|
|
1812
|
+
st as searchFootball,
|
|
1813
1813
|
ho as setConfig,
|
|
1814
1814
|
T as streakFilters,
|
|
1815
1815
|
C as toProviderRefArray,
|
|
1816
|
-
|
|
1816
|
+
Nt as useAllPlayerStatisticsFromMatches,
|
|
1817
1817
|
Dt as useMostCardedPlayersFromMatches,
|
|
1818
1818
|
It as usePlayerStatistics,
|
|
1819
1819
|
Ke as usePlayerStatisticsMap,
|
|
1820
1820
|
Rt as useTopAssistersFromMatches,
|
|
1821
|
-
|
|
1821
|
+
Et as useTopGoalContributorsFromMatches,
|
|
1822
1822
|
Gt as useTopScorersFromMatches
|
|
1823
1823
|
};
|