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