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