fansunited-data-layer 0.9.0 → 0.10.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/index.d.ts +2 -0
- package/api/fansunited/index.d.ts.map +1 -1
- package/api/fansunited/search/__tests__/index.test.d.ts +2 -0
- package/api/fansunited/search/__tests__/index.test.d.ts.map +1 -0
- package/api/fansunited/search/__tests__/transformer.test.d.ts +2 -0
- package/api/fansunited/search/__tests__/transformer.test.d.ts.map +1 -0
- package/api/fansunited/search/constants.d.ts +2 -0
- package/api/fansunited/search/constants.d.ts.map +1 -0
- package/api/fansunited/search/http.d.ts +5 -0
- package/api/fansunited/search/http.d.ts.map +1 -0
- package/api/fansunited/search/index.d.ts +50 -0
- package/api/fansunited/search/index.d.ts.map +1 -0
- package/api/fansunited/search/raw-types.d.ts +93 -0
- package/api/fansunited/search/raw-types.d.ts.map +1 -0
- package/api/fansunited/search/transformer.d.ts +66 -0
- package/api/fansunited/search/transformer.d.ts.map +1 -0
- package/api/fansunited/search/types.d.ts +136 -0
- package/api/fansunited/search/types.d.ts.map +1 -0
- package/cache/__tests__/cache-manager.test.d.ts +2 -0
- package/cache/__tests__/cache-manager.test.d.ts.map +1 -0
- package/cache/__tests__/cleanup.test.d.ts +2 -0
- package/cache/__tests__/cleanup.test.d.ts.map +1 -0
- package/cache/__tests__/memory-store.test.d.ts +2 -0
- package/cache/__tests__/memory-store.test.d.ts.map +1 -0
- package/cache/__tests__/sqlite-store.test.d.ts +2 -0
- package/cache/__tests__/sqlite-store.test.d.ts.map +1 -0
- package/cache/cache-manager.d.ts +42 -0
- package/cache/cache-manager.d.ts.map +1 -0
- package/cache/cleanup.d.ts +7 -0
- package/cache/cleanup.d.ts.map +1 -0
- package/cache/index.d.ts +13 -0
- package/cache/index.d.ts.map +1 -0
- package/cache/memory-store.d.ts +12 -0
- package/cache/memory-store.d.ts.map +1 -0
- package/cache/sqlite-store.d.ts +19 -0
- package/cache/sqlite-store.d.ts.map +1 -0
- package/cache/types.d.ts +15 -0
- package/cache/types.d.ts.map +1 -0
- package/client.js +2 -2
- package/config/types.d.ts +2 -0
- package/config/types.d.ts.map +1 -1
- package/fansunited-data-layer.cjs +1 -1
- package/fansunited-data-layer.js +2600 -1462
- package/index.d.ts +5 -3
- package/index.d.ts.map +1 -1
- package/{matches-CIte0UPI.js → matches-dKvggZia.js} +21 -21
- package/package.json +11 -3
- package/types/canonical/base.types.d.ts +28 -2
- package/types/canonical/base.types.d.ts.map +1 -1
- package/types/canonical/index.d.ts +1 -1
- package/types/canonical/index.d.ts.map +1 -1
package/fansunited-data-layer.js
CHANGED
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
4
|
-
function
|
|
1
|
+
import { t as L, g as b, f as Qt, c as ot, S as Vt, a as It, b as Kt, d as Xt, e as Jt, h as Zt, i as wt, j as te, k as ee } from "./matches-dKvggZia.js";
|
|
2
|
+
import { l as Xo, m as Jo, n as Zo, o as wo, p as ts, q as es, r as ns, s as os, u as ss, v as is, w as rs, x as as, y as cs, z as ls, A as ds, B as us, C as fs, D as hs, E as ms, F as gs, G as ps } from "./matches-dKvggZia.js";
|
|
3
|
+
import { useMemo as j } from "react";
|
|
4
|
+
function ne(t) {
|
|
5
5
|
return {
|
|
6
6
|
entityType: "tournament",
|
|
7
|
-
id:
|
|
8
|
-
name:
|
|
9
|
-
slug:
|
|
10
|
-
gender:
|
|
11
|
-
type:
|
|
12
|
-
region:
|
|
7
|
+
id: t.id.toString(),
|
|
8
|
+
name: t.name,
|
|
9
|
+
slug: t.slug,
|
|
10
|
+
gender: t.gender,
|
|
11
|
+
type: t.type,
|
|
12
|
+
region: t.region,
|
|
13
13
|
country: {
|
|
14
|
-
id:
|
|
15
|
-
name:
|
|
14
|
+
id: t.country.id.toString(),
|
|
15
|
+
name: t.country.name,
|
|
16
16
|
code: void 0,
|
|
17
|
-
flag:
|
|
18
|
-
providerRef:
|
|
17
|
+
flag: t.country.url_flag ?? void 0,
|
|
18
|
+
providerRef: L(t.country.uuid)
|
|
19
19
|
},
|
|
20
|
-
assets:
|
|
21
|
-
logo:
|
|
20
|
+
assets: t.url_logo ? {
|
|
21
|
+
logo: t.url_logo
|
|
22
22
|
} : void 0,
|
|
23
|
-
providerRef:
|
|
23
|
+
providerRef: L(t.uuid)
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function oe(t) {
|
|
27
27
|
return {
|
|
28
28
|
entityType: "player",
|
|
29
|
-
id:
|
|
30
|
-
name:
|
|
31
|
-
slug:
|
|
32
|
-
position:
|
|
33
|
-
gender:
|
|
34
|
-
birthdate:
|
|
29
|
+
id: t.id.toString(),
|
|
30
|
+
name: t.name,
|
|
31
|
+
slug: t.slug,
|
|
32
|
+
position: t.position,
|
|
33
|
+
gender: t.gender,
|
|
34
|
+
birthdate: t.birthdate,
|
|
35
35
|
country: {
|
|
36
|
-
id:
|
|
37
|
-
name:
|
|
36
|
+
id: t.country.id.toString(),
|
|
37
|
+
name: t.country.name,
|
|
38
38
|
code: void 0,
|
|
39
|
-
flag:
|
|
40
|
-
providerRef:
|
|
39
|
+
flag: t.country.url_flag ?? void 0,
|
|
40
|
+
providerRef: L(t.country.uuid)
|
|
41
41
|
},
|
|
42
|
-
assets:
|
|
43
|
-
photo:
|
|
42
|
+
assets: t.url_thumb ? {
|
|
43
|
+
photo: t.url_thumb
|
|
44
44
|
} : void 0,
|
|
45
|
-
providerRef:
|
|
45
|
+
providerRef: L(t.uuid)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function se(t) {
|
|
49
49
|
return {
|
|
50
50
|
entityType: "team",
|
|
51
|
-
id:
|
|
52
|
-
name:
|
|
53
|
-
slug:
|
|
54
|
-
shortName:
|
|
55
|
-
threeLetterCode:
|
|
56
|
-
type:
|
|
57
|
-
gender:
|
|
51
|
+
id: t.id.toString(),
|
|
52
|
+
name: t.name,
|
|
53
|
+
slug: t.slug,
|
|
54
|
+
shortName: t.short_name ?? void 0,
|
|
55
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
56
|
+
type: t.type === "national" ? "national" : "club",
|
|
57
|
+
gender: t.gender,
|
|
58
58
|
country: {
|
|
59
|
-
id:
|
|
60
|
-
name:
|
|
59
|
+
id: t.country.id.toString(),
|
|
60
|
+
name: t.country.name,
|
|
61
61
|
code: void 0,
|
|
62
|
-
flag:
|
|
63
|
-
providerRef:
|
|
62
|
+
flag: t.country.url_flag ?? void 0,
|
|
63
|
+
providerRef: L(t.country.uuid)
|
|
64
64
|
},
|
|
65
|
-
assets:
|
|
66
|
-
logo:
|
|
65
|
+
assets: t.url_logo ? {
|
|
66
|
+
logo: t.url_logo
|
|
67
67
|
} : void 0,
|
|
68
|
-
providerRef:
|
|
68
|
+
providerRef: L(t.uuid)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function ie(t) {
|
|
72
72
|
return {
|
|
73
73
|
entityType: "president",
|
|
74
|
-
id:
|
|
75
|
-
name:
|
|
76
|
-
slug:
|
|
77
|
-
birthdate:
|
|
74
|
+
id: t.id.toString(),
|
|
75
|
+
name: t.name,
|
|
76
|
+
slug: t.slug,
|
|
77
|
+
birthdate: t.birthdate ?? void 0,
|
|
78
78
|
country: {
|
|
79
|
-
id:
|
|
80
|
-
name:
|
|
79
|
+
id: t.country.id.toString(),
|
|
80
|
+
name: t.country.name,
|
|
81
81
|
code: void 0,
|
|
82
|
-
flag:
|
|
83
|
-
providerRef:
|
|
82
|
+
flag: t.country.url_flag ?? void 0,
|
|
83
|
+
providerRef: L(t.country.uuid)
|
|
84
84
|
},
|
|
85
|
-
assets:
|
|
86
|
-
photo:
|
|
85
|
+
assets: t.url_thumb ? {
|
|
86
|
+
photo: t.url_thumb
|
|
87
87
|
} : void 0,
|
|
88
|
-
providerRef:
|
|
88
|
+
providerRef: L(t.uuid)
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function re(t) {
|
|
92
92
|
return {
|
|
93
93
|
entityType: "venue",
|
|
94
|
-
id:
|
|
95
|
-
name:
|
|
96
|
-
slug:
|
|
94
|
+
id: t.id.toString(),
|
|
95
|
+
name: t.name,
|
|
96
|
+
slug: t.slug,
|
|
97
97
|
city: {
|
|
98
|
-
id:
|
|
99
|
-
name:
|
|
98
|
+
id: t.city.id.toString(),
|
|
99
|
+
name: t.city.name,
|
|
100
100
|
country: {
|
|
101
|
-
id:
|
|
102
|
-
name:
|
|
101
|
+
id: t.city.country.id.toString(),
|
|
102
|
+
name: t.city.country.name,
|
|
103
103
|
code: void 0,
|
|
104
|
-
flag:
|
|
105
|
-
providerRef:
|
|
104
|
+
flag: t.city.country.url_flag ?? void 0,
|
|
105
|
+
providerRef: L(t.city.country.uuid)
|
|
106
106
|
},
|
|
107
|
-
providerRef:
|
|
107
|
+
providerRef: L(t.city.uuid)
|
|
108
108
|
},
|
|
109
109
|
country: {
|
|
110
|
-
id:
|
|
111
|
-
name:
|
|
110
|
+
id: t.country.id.toString(),
|
|
111
|
+
name: t.country.name,
|
|
112
112
|
code: void 0,
|
|
113
|
-
flag:
|
|
114
|
-
providerRef:
|
|
113
|
+
flag: t.country.url_flag ?? void 0,
|
|
114
|
+
providerRef: L(t.country.uuid)
|
|
115
115
|
},
|
|
116
116
|
profile: {
|
|
117
|
-
latitude:
|
|
118
|
-
longitude:
|
|
119
|
-
capacity:
|
|
117
|
+
latitude: t.profile.lat,
|
|
118
|
+
longitude: t.profile.lng,
|
|
119
|
+
capacity: t.profile.capacity
|
|
120
120
|
},
|
|
121
|
-
assets:
|
|
122
|
-
image:
|
|
121
|
+
assets: t.url_thumb ? {
|
|
122
|
+
image: t.url_thumb
|
|
123
123
|
} : void 0,
|
|
124
|
-
providerRef:
|
|
124
|
+
providerRef: L(t.uuid)
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ae(t) {
|
|
128
128
|
return {
|
|
129
129
|
entityType: "coach",
|
|
130
|
-
id:
|
|
131
|
-
name:
|
|
132
|
-
slug:
|
|
133
|
-
birthdate:
|
|
130
|
+
id: t.id.toString(),
|
|
131
|
+
name: t.name,
|
|
132
|
+
slug: t.slug,
|
|
133
|
+
birthdate: t.birthdate ?? void 0,
|
|
134
134
|
country: {
|
|
135
|
-
id:
|
|
136
|
-
name:
|
|
135
|
+
id: t.country.id.toString(),
|
|
136
|
+
name: t.country.name,
|
|
137
137
|
code: void 0,
|
|
138
|
-
flag:
|
|
139
|
-
providerRef:
|
|
138
|
+
flag: t.country.url_flag ?? void 0,
|
|
139
|
+
providerRef: L(t.country.uuid)
|
|
140
140
|
},
|
|
141
|
-
assets:
|
|
142
|
-
photo:
|
|
141
|
+
assets: t.url_thumb ? {
|
|
142
|
+
photo: t.url_thumb
|
|
143
143
|
} : void 0,
|
|
144
|
-
providerRef:
|
|
144
|
+
providerRef: L(t.uuid)
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
switch (
|
|
147
|
+
function ce(t) {
|
|
148
|
+
switch (t.entity_type) {
|
|
149
149
|
case "tournament":
|
|
150
|
-
return
|
|
150
|
+
return ne(t);
|
|
151
151
|
case "player":
|
|
152
|
-
return
|
|
152
|
+
return oe(t);
|
|
153
153
|
case "team":
|
|
154
|
-
return
|
|
154
|
+
return se(t);
|
|
155
155
|
case "president":
|
|
156
|
-
return
|
|
156
|
+
return ie(t);
|
|
157
157
|
case "venue":
|
|
158
|
-
return
|
|
158
|
+
return re(t);
|
|
159
159
|
case "coach":
|
|
160
|
-
return
|
|
160
|
+
return ae(t);
|
|
161
161
|
default:
|
|
162
|
-
throw new Error(`Unknown entity type: ${
|
|
162
|
+
throw new Error(`Unknown entity type: ${t.entity_type}`);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
166
|
-
if (!
|
|
165
|
+
async function zn(t, e) {
|
|
166
|
+
if (!t.query || t.query.trim() === "")
|
|
167
167
|
return {
|
|
168
168
|
results: [],
|
|
169
|
-
query:
|
|
169
|
+
query: t.query || ""
|
|
170
170
|
};
|
|
171
|
-
const
|
|
171
|
+
const n = e || b(), { sportal365Sports: o } = n, s = t.entityTypes && t.entityTypes.length > 0 ? t.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await Qt.get({
|
|
172
172
|
path: "/search",
|
|
173
173
|
params: {
|
|
174
|
-
query:
|
|
174
|
+
query: t.query.trim(),
|
|
175
175
|
entity_type: s.join(","),
|
|
176
|
-
language_code:
|
|
176
|
+
language_code: t.languageCode ?? o?.languageCode ?? "en"
|
|
177
177
|
},
|
|
178
178
|
headers: {
|
|
179
|
-
"Accept-Language":
|
|
179
|
+
"Accept-Language": t.languageCode ?? o?.languageCode ?? "en"
|
|
180
180
|
},
|
|
181
|
-
next:
|
|
182
|
-
config:
|
|
181
|
+
next: t.next,
|
|
182
|
+
config: n
|
|
183
183
|
});
|
|
184
184
|
return !i || i.length === 0 ? {
|
|
185
185
|
results: [],
|
|
186
|
-
query:
|
|
186
|
+
query: t.query
|
|
187
187
|
} : {
|
|
188
|
-
results: i.map(
|
|
189
|
-
query:
|
|
188
|
+
results: i.map(ce),
|
|
189
|
+
query: t.query
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
const
|
|
193
|
-
function
|
|
194
|
-
const
|
|
192
|
+
const le = ot(Vt);
|
|
193
|
+
function de(t) {
|
|
194
|
+
const e = {
|
|
195
195
|
FINISHED: "finished",
|
|
196
196
|
NOT_STARTED: "not_started",
|
|
197
197
|
LIVE: "live",
|
|
@@ -199,606 +199,606 @@ function Se(e) {
|
|
|
199
199
|
CANCELLED: "cancelled",
|
|
200
200
|
POSTPONED: "postponed",
|
|
201
201
|
UNKNOWN: "not_started"
|
|
202
|
-
},
|
|
202
|
+
}, n = t.type.toUpperCase();
|
|
203
203
|
return {
|
|
204
|
-
code:
|
|
205
|
-
name:
|
|
206
|
-
shortName:
|
|
207
|
-
type:
|
|
204
|
+
code: e[n] ?? "not_started",
|
|
205
|
+
name: t.name,
|
|
206
|
+
shortName: t.short_name,
|
|
207
|
+
type: n
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Ot(t) {
|
|
211
211
|
return {
|
|
212
|
-
id:
|
|
213
|
-
name:
|
|
214
|
-
threeLetterCode:
|
|
215
|
-
slug:
|
|
216
|
-
type:
|
|
217
|
-
gender:
|
|
212
|
+
id: t.id,
|
|
213
|
+
name: t.name,
|
|
214
|
+
threeLetterCode: t.three_letter_code,
|
|
215
|
+
slug: t.slug,
|
|
216
|
+
type: t.type === "national" ? "national" : "club",
|
|
217
|
+
gender: t.gender
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function ue(t) {
|
|
221
221
|
return {
|
|
222
|
-
kickoffTime: new Date(
|
|
223
|
-
currentMinute:
|
|
222
|
+
kickoffTime: new Date(t.game_time),
|
|
223
|
+
currentMinute: t.minute
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
if (!
|
|
228
|
-
const
|
|
226
|
+
function fe(t) {
|
|
227
|
+
if (!t.season?.competition) return;
|
|
228
|
+
const e = t.season.competition;
|
|
229
229
|
return {
|
|
230
|
-
id:
|
|
231
|
-
name:
|
|
232
|
-
slug:
|
|
230
|
+
id: e.id,
|
|
231
|
+
name: e.name,
|
|
232
|
+
slug: e.slug,
|
|
233
233
|
type: "LEAGUE",
|
|
234
|
-
gender:
|
|
235
|
-
region:
|
|
236
|
-
country:
|
|
237
|
-
id:
|
|
238
|
-
name:
|
|
234
|
+
gender: e.gender,
|
|
235
|
+
region: e.region,
|
|
236
|
+
country: e.country ? {
|
|
237
|
+
id: e.country.id,
|
|
238
|
+
name: e.country.name
|
|
239
239
|
} : void 0,
|
|
240
240
|
season: {
|
|
241
|
-
id:
|
|
242
|
-
name:
|
|
243
|
-
status:
|
|
241
|
+
id: t.season.id,
|
|
242
|
+
name: t.season.name,
|
|
243
|
+
status: t.season.status
|
|
244
244
|
},
|
|
245
|
-
stage:
|
|
246
|
-
id:
|
|
247
|
-
name:
|
|
248
|
-
type:
|
|
245
|
+
stage: t.stage ? {
|
|
246
|
+
id: t.stage.id,
|
|
247
|
+
name: t.stage.name,
|
|
248
|
+
type: t.stage.type
|
|
249
249
|
} : void 0
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
if (
|
|
252
|
+
function he(t) {
|
|
253
|
+
if (t)
|
|
254
254
|
return {
|
|
255
|
-
id:
|
|
256
|
-
name:
|
|
257
|
-
slug:
|
|
255
|
+
id: t.id,
|
|
256
|
+
name: t.name,
|
|
257
|
+
slug: t.slug
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
if (!
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
let
|
|
260
|
+
function me(t) {
|
|
261
|
+
if (!t || t.length === 0) return;
|
|
262
|
+
const e = t.filter((i) => i.result_type.category === "single_period");
|
|
263
|
+
if (e.length === 0) return;
|
|
264
|
+
let n = 0, o = 0;
|
|
265
265
|
const s = [];
|
|
266
|
-
for (const i of
|
|
267
|
-
|
|
266
|
+
for (const i of e)
|
|
267
|
+
n += i.home, o += i.away, s.push({
|
|
268
268
|
competitorOne: String(i.home),
|
|
269
269
|
competitorTwo: String(i.away)
|
|
270
270
|
});
|
|
271
271
|
return {
|
|
272
|
-
competitorOne: String(
|
|
273
|
-
competitorTwo: String(
|
|
272
|
+
competitorOne: String(n),
|
|
273
|
+
competitorTwo: String(o),
|
|
274
274
|
breakdown: {
|
|
275
275
|
total: {
|
|
276
|
-
competitorOne: String(
|
|
277
|
-
competitorTwo: String(
|
|
276
|
+
competitorOne: String(n),
|
|
277
|
+
competitorTwo: String(o)
|
|
278
278
|
},
|
|
279
279
|
periods: s
|
|
280
280
|
}
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
if (
|
|
283
|
+
function ge(t) {
|
|
284
|
+
if (t.winner)
|
|
285
285
|
return {
|
|
286
|
-
competitorId:
|
|
286
|
+
competitorId: t.winner.id
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function pe(t) {
|
|
290
290
|
return {
|
|
291
|
-
id:
|
|
292
|
-
slug:
|
|
293
|
-
status:
|
|
294
|
-
timing:
|
|
295
|
-
competitorOne:
|
|
296
|
-
competitorTwo:
|
|
297
|
-
competition:
|
|
298
|
-
round:
|
|
299
|
-
id:
|
|
300
|
-
key:
|
|
301
|
-
name:
|
|
291
|
+
id: t.id,
|
|
292
|
+
slug: t.slug,
|
|
293
|
+
status: de(t.status),
|
|
294
|
+
timing: ue(t),
|
|
295
|
+
competitorOne: Ot(t.home_team),
|
|
296
|
+
competitorTwo: Ot(t.away_team),
|
|
297
|
+
competition: fe(t),
|
|
298
|
+
round: t.round ? {
|
|
299
|
+
id: t.round.id,
|
|
300
|
+
key: t.round.uuid,
|
|
301
|
+
name: t.round.name,
|
|
302
302
|
type: "REGULAR",
|
|
303
|
-
providerRef:
|
|
303
|
+
providerRef: L(t.round.uuid)
|
|
304
304
|
} : void 0,
|
|
305
|
-
venue:
|
|
306
|
-
score:
|
|
307
|
-
winner:
|
|
308
|
-
odds:
|
|
309
|
-
coverage:
|
|
305
|
+
venue: he(t.arena),
|
|
306
|
+
score: me(t.score),
|
|
307
|
+
winner: ge(t),
|
|
308
|
+
odds: t.odds ? It(t.odds) : void 0,
|
|
309
|
+
coverage: t.coverage === "NOT_LIVE" ? "UNKNOWN" : t.coverage,
|
|
310
310
|
providerRef: [
|
|
311
311
|
{
|
|
312
312
|
provider: "sportal365-basketball",
|
|
313
|
-
id:
|
|
313
|
+
id: t.id
|
|
314
314
|
}
|
|
315
315
|
]
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
async function
|
|
319
|
-
const
|
|
320
|
-
return (await
|
|
318
|
+
async function Yn(t, e) {
|
|
319
|
+
const n = e || b(), { sportal365Sports: o } = n;
|
|
320
|
+
return (await le.get({
|
|
321
321
|
path: "/games",
|
|
322
322
|
params: {
|
|
323
323
|
offset: "0",
|
|
324
324
|
limit: "1000",
|
|
325
|
-
competition_list:
|
|
326
|
-
status_type:
|
|
327
|
-
from_game_time:
|
|
328
|
-
to_game_time:
|
|
329
|
-
odd_client:
|
|
330
|
-
odd_type:
|
|
331
|
-
market_types:
|
|
332
|
-
language_code:
|
|
325
|
+
competition_list: t?.competitionList,
|
|
326
|
+
status_type: t?.statusTypes,
|
|
327
|
+
from_game_time: t?.fromGameTime,
|
|
328
|
+
to_game_time: t?.toGameTime,
|
|
329
|
+
odd_client: t?.oddClient ?? o?.oddClient,
|
|
330
|
+
odd_type: t?.oddType,
|
|
331
|
+
market_types: t?.marketTypes,
|
|
332
|
+
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
333
333
|
},
|
|
334
334
|
headers: {
|
|
335
|
-
"Accept-Language":
|
|
335
|
+
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
336
336
|
},
|
|
337
|
-
next:
|
|
338
|
-
config:
|
|
339
|
-
})).games.map(
|
|
337
|
+
next: t?.next,
|
|
338
|
+
config: n
|
|
339
|
+
})).games.map(pe);
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
function
|
|
343
|
-
const
|
|
341
|
+
const ye = ot(Kt);
|
|
342
|
+
function Te(t) {
|
|
343
|
+
const e = {
|
|
344
344
|
FINISHED: "finished",
|
|
345
345
|
NOT_STARTED: "not_started",
|
|
346
346
|
LIVE: "live",
|
|
347
347
|
INTERRUPTED: "interrupted",
|
|
348
348
|
CANCELLED: "cancelled",
|
|
349
349
|
POSTPONED: "postponed"
|
|
350
|
-
},
|
|
350
|
+
}, n = t.type.toUpperCase();
|
|
351
351
|
return {
|
|
352
|
-
code:
|
|
353
|
-
name:
|
|
354
|
-
shortName:
|
|
355
|
-
type:
|
|
352
|
+
code: e[n] ?? "not_started",
|
|
353
|
+
name: t.name,
|
|
354
|
+
shortName: t.short_name,
|
|
355
|
+
type: n
|
|
356
356
|
};
|
|
357
357
|
}
|
|
358
|
-
function
|
|
359
|
-
if (
|
|
358
|
+
function Et(t) {
|
|
359
|
+
if (t.type === "PLAYER")
|
|
360
360
|
return {
|
|
361
|
-
id:
|
|
362
|
-
name:
|
|
363
|
-
shortName:
|
|
364
|
-
threeLetterCode:
|
|
361
|
+
id: t.id,
|
|
362
|
+
name: t.name,
|
|
363
|
+
shortName: t.short_name,
|
|
364
|
+
threeLetterCode: t.three_letter_code,
|
|
365
365
|
type: "player",
|
|
366
|
-
country:
|
|
367
|
-
id:
|
|
368
|
-
name:
|
|
366
|
+
country: t.details?.[0]?.country ? {
|
|
367
|
+
id: t.details[0].country.id,
|
|
368
|
+
name: t.details[0].country.name
|
|
369
369
|
} : void 0,
|
|
370
|
-
gender:
|
|
370
|
+
gender: t.details?.[0]?.gender
|
|
371
371
|
};
|
|
372
|
-
if (
|
|
373
|
-
const
|
|
374
|
-
id:
|
|
375
|
-
name:
|
|
376
|
-
shortName:
|
|
377
|
-
threeLetterCode:
|
|
372
|
+
if (t.type === "TEAM_DOUBLE" && t.details && t.details.length === 2) {
|
|
373
|
+
const e = {
|
|
374
|
+
id: t.details[0].id,
|
|
375
|
+
name: t.details[0].name,
|
|
376
|
+
shortName: t.details[0].short_name,
|
|
377
|
+
threeLetterCode: t.details[0].three_letter_code,
|
|
378
378
|
type: "player",
|
|
379
|
-
country:
|
|
380
|
-
id:
|
|
381
|
-
name:
|
|
379
|
+
country: t.details[0].country ? {
|
|
380
|
+
id: t.details[0].country.id,
|
|
381
|
+
name: t.details[0].country.name
|
|
382
382
|
} : void 0,
|
|
383
|
-
gender:
|
|
384
|
-
},
|
|
385
|
-
id:
|
|
386
|
-
name:
|
|
387
|
-
shortName:
|
|
388
|
-
threeLetterCode:
|
|
383
|
+
gender: t.details[0].gender
|
|
384
|
+
}, n = {
|
|
385
|
+
id: t.details[1].id,
|
|
386
|
+
name: t.details[1].name,
|
|
387
|
+
shortName: t.details[1].short_name,
|
|
388
|
+
threeLetterCode: t.details[1].three_letter_code,
|
|
389
389
|
type: "player",
|
|
390
|
-
country:
|
|
391
|
-
id:
|
|
392
|
-
name:
|
|
390
|
+
country: t.details[1].country ? {
|
|
391
|
+
id: t.details[1].country.id,
|
|
392
|
+
name: t.details[1].country.name
|
|
393
393
|
} : void 0,
|
|
394
|
-
gender:
|
|
394
|
+
gender: t.details[1].gender
|
|
395
395
|
};
|
|
396
396
|
return {
|
|
397
|
-
id:
|
|
398
|
-
name:
|
|
399
|
-
shortName:
|
|
400
|
-
threeLetterCode:
|
|
397
|
+
id: t.id,
|
|
398
|
+
name: t.name,
|
|
399
|
+
shortName: t.short_name,
|
|
400
|
+
threeLetterCode: t.three_letter_code,
|
|
401
401
|
type: "pair",
|
|
402
|
-
players: [
|
|
402
|
+
players: [e, n]
|
|
403
403
|
};
|
|
404
404
|
} else
|
|
405
405
|
return {
|
|
406
|
-
id:
|
|
407
|
-
name:
|
|
408
|
-
shortName:
|
|
409
|
-
threeLetterCode:
|
|
406
|
+
id: t.id,
|
|
407
|
+
name: t.name,
|
|
408
|
+
shortName: t.short_name,
|
|
409
|
+
threeLetterCode: t.three_letter_code,
|
|
410
410
|
type: "national",
|
|
411
|
-
country:
|
|
412
|
-
id:
|
|
413
|
-
name:
|
|
411
|
+
country: t.details?.[0]?.country ? {
|
|
412
|
+
id: t.details[0].country.id,
|
|
413
|
+
name: t.details[0].country.name
|
|
414
414
|
} : void 0,
|
|
415
|
-
gender:
|
|
415
|
+
gender: t.details?.[0]?.gender
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function _e(t) {
|
|
419
419
|
return {
|
|
420
|
-
kickoffTime: new Date(
|
|
421
|
-
phaseStartedAt:
|
|
422
|
-
finishedAt:
|
|
420
|
+
kickoffTime: new Date(t.scheduled_start_time),
|
|
421
|
+
phaseStartedAt: t.started_at ? new Date(t.started_at) : void 0,
|
|
422
|
+
finishedAt: t.finished_at ? new Date(t.finished_at) : void 0
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
if (!
|
|
427
|
-
const
|
|
425
|
+
function ve(t) {
|
|
426
|
+
if (!t.tournament) return;
|
|
427
|
+
const e = t.tournament;
|
|
428
428
|
return {
|
|
429
|
-
id:
|
|
430
|
-
name:
|
|
431
|
-
slug:
|
|
429
|
+
id: e.competition?.id ?? e.id,
|
|
430
|
+
name: e.competition?.name ?? e.name,
|
|
431
|
+
slug: e.competition?.slug ?? e.slug,
|
|
432
432
|
type: "TOURNAMENT",
|
|
433
|
-
gender:
|
|
433
|
+
gender: e.gender,
|
|
434
434
|
region: "INTERNATIONAL",
|
|
435
|
-
country:
|
|
436
|
-
id:
|
|
437
|
-
name:
|
|
435
|
+
country: e.country ? {
|
|
436
|
+
id: e.country.id,
|
|
437
|
+
name: e.country.name
|
|
438
438
|
} : void 0
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
|
-
function
|
|
442
|
-
if (!
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
const
|
|
446
|
-
for (const c of
|
|
447
|
-
const d = c.values.find((l) => l.position === "1"),
|
|
448
|
-
!d || !
|
|
441
|
+
function Se(t) {
|
|
442
|
+
if (!t.results || t.results.length === 0) return;
|
|
443
|
+
const e = t.results.filter((c) => /^set\d+$/i.test(c.type.code));
|
|
444
|
+
if (e.length === 0) return;
|
|
445
|
+
const n = [];
|
|
446
|
+
for (const c of e) {
|
|
447
|
+
const d = c.values.find((l) => l.position === "1"), f = c.values.find((l) => l.position === "2");
|
|
448
|
+
!d || !f || d.value == null || f.value == null || n.push({
|
|
449
449
|
competitorOne: d.value,
|
|
450
|
-
competitorTwo:
|
|
450
|
+
competitorTwo: f.value
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
-
if (
|
|
454
|
-
const
|
|
455
|
-
let
|
|
456
|
-
return s?.value != null && i?.value != null ? (
|
|
457
|
-
competitorOne: String(
|
|
458
|
-
competitorTwo: String(
|
|
453
|
+
if (n.length === 0) return;
|
|
454
|
+
const o = t.results.find((c) => c.type.code === "setswon"), s = o?.values.find((c) => c.position === "1"), i = o?.values.find((c) => c.position === "2");
|
|
455
|
+
let r, a;
|
|
456
|
+
return s?.value != null && i?.value != null ? (r = parseInt(s.value), a = parseInt(i.value)) : (r = n.filter((c) => parseInt(c.competitorOne) > parseInt(c.competitorTwo)).length, a = n.filter((c) => parseInt(c.competitorTwo) > parseInt(c.competitorOne)).length), {
|
|
457
|
+
competitorOne: String(r),
|
|
458
|
+
competitorTwo: String(a),
|
|
459
459
|
breakdown: {
|
|
460
460
|
total: {
|
|
461
|
-
competitorOne: String(
|
|
462
|
-
competitorTwo: String(
|
|
461
|
+
competitorOne: String(r),
|
|
462
|
+
competitorTwo: String(a)
|
|
463
463
|
},
|
|
464
|
-
periods:
|
|
464
|
+
periods: n
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
468
|
+
function Ae(t) {
|
|
469
|
+
const e = t.participants.find((n) => n.winner === "YES");
|
|
470
|
+
if (e)
|
|
471
471
|
return {
|
|
472
|
-
competitorId:
|
|
472
|
+
competitorId: e.id
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
const
|
|
475
|
+
function Ce(t) {
|
|
476
|
+
const e = t.participants.sort((n, o) => n.position - o.position);
|
|
477
477
|
return {
|
|
478
|
-
id:
|
|
479
|
-
slug:
|
|
480
|
-
status:
|
|
481
|
-
timing:
|
|
482
|
-
competitorOne:
|
|
483
|
-
competitorTwo:
|
|
484
|
-
competition:
|
|
485
|
-
round:
|
|
486
|
-
id:
|
|
487
|
-
key:
|
|
488
|
-
name:
|
|
478
|
+
id: t.id,
|
|
479
|
+
slug: t.slug,
|
|
480
|
+
status: Te(t.status),
|
|
481
|
+
timing: _e(t),
|
|
482
|
+
competitorOne: Et(e[0]),
|
|
483
|
+
competitorTwo: Et(e[1]),
|
|
484
|
+
competition: ve(t),
|
|
485
|
+
round: t.round ? {
|
|
486
|
+
id: t.round.id,
|
|
487
|
+
key: t.round.uuid,
|
|
488
|
+
name: t.round.name,
|
|
489
489
|
type: "REGULAR",
|
|
490
|
-
providerRef:
|
|
490
|
+
providerRef: L(t.round.uuid)
|
|
491
491
|
} : void 0,
|
|
492
|
-
score:
|
|
493
|
-
winner:
|
|
494
|
-
odds:
|
|
495
|
-
coverage:
|
|
492
|
+
score: Se(t),
|
|
493
|
+
winner: Ae(t),
|
|
494
|
+
odds: t.odds ? It(t.odds) : void 0,
|
|
495
|
+
coverage: t.coverage?.type === "NOT_LIVE" ? "UNKNOWN" : t.coverage?.type,
|
|
496
496
|
metadata: {
|
|
497
|
-
matchType:
|
|
498
|
-
bestOfSets:
|
|
499
|
-
surface:
|
|
500
|
-
indoorOutdoor:
|
|
497
|
+
matchType: t.type,
|
|
498
|
+
bestOfSets: t.best_of_sets,
|
|
499
|
+
surface: t.tournament?.surface,
|
|
500
|
+
indoorOutdoor: t.tournament?.indoor_outdoor
|
|
501
501
|
},
|
|
502
502
|
providerRef: [
|
|
503
503
|
{
|
|
504
504
|
provider: "sportal365-tennis",
|
|
505
|
-
id:
|
|
505
|
+
id: t.id
|
|
506
506
|
}
|
|
507
507
|
]
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
|
-
async function
|
|
511
|
-
const
|
|
512
|
-
return (await
|
|
510
|
+
async function jn(t, e) {
|
|
511
|
+
const n = e || b(), { sportal365Sports: o } = n;
|
|
512
|
+
return (await ye.get({
|
|
513
513
|
path: "/matches/livescore",
|
|
514
514
|
params: {
|
|
515
|
-
date:
|
|
516
|
-
utc_offset:
|
|
515
|
+
date: t?.date,
|
|
516
|
+
utc_offset: t?.utcOffset?.toString(),
|
|
517
517
|
offset: "0",
|
|
518
518
|
limit: "1000",
|
|
519
|
-
type:
|
|
520
|
-
gender:
|
|
521
|
-
status_type:
|
|
522
|
-
competition_list:
|
|
523
|
-
odd_client:
|
|
524
|
-
odd_type:
|
|
525
|
-
market_types:
|
|
526
|
-
language_code:
|
|
519
|
+
type: t?.type,
|
|
520
|
+
gender: t?.gender,
|
|
521
|
+
status_type: t?.statusType,
|
|
522
|
+
competition_list: t?.competitionList,
|
|
523
|
+
odd_client: t?.oddClient ?? o?.oddClient,
|
|
524
|
+
odd_type: t?.oddType,
|
|
525
|
+
market_types: t?.marketTypes,
|
|
526
|
+
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
527
527
|
},
|
|
528
528
|
headers: {
|
|
529
|
-
"Accept-Language":
|
|
529
|
+
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
530
530
|
},
|
|
531
|
-
next:
|
|
532
|
-
config:
|
|
533
|
-
})).matches.map(
|
|
531
|
+
next: t?.next,
|
|
532
|
+
config: n
|
|
533
|
+
})).matches.map(Ce);
|
|
534
534
|
}
|
|
535
|
-
const
|
|
536
|
-
function
|
|
535
|
+
const Oe = ot(Xt);
|
|
536
|
+
function D(t) {
|
|
537
537
|
return {
|
|
538
|
-
language:
|
|
539
|
-
name:
|
|
540
|
-
shortName:
|
|
541
|
-
threeLetterCode:
|
|
538
|
+
language: t.language,
|
|
539
|
+
name: t.name,
|
|
540
|
+
shortName: t.short_name ?? void 0,
|
|
541
|
+
threeLetterCode: t.three_letter_code ?? void 0
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
if (!(!
|
|
544
|
+
function U(t) {
|
|
545
|
+
if (!(!t || !t.url))
|
|
546
546
|
return {
|
|
547
|
-
url:
|
|
547
|
+
url: t.url
|
|
548
548
|
};
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
if (
|
|
550
|
+
function z(t) {
|
|
551
|
+
if (t)
|
|
552
552
|
return {
|
|
553
|
-
id:
|
|
554
|
-
legacyId:
|
|
555
|
-
name:
|
|
556
|
-
shortName:
|
|
557
|
-
threeLetterCode:
|
|
558
|
-
translations:
|
|
559
|
-
displayAsset:
|
|
560
|
-
slug:
|
|
561
|
-
providerRef:
|
|
553
|
+
id: t.id,
|
|
554
|
+
legacyId: t.legacy_id ?? void 0,
|
|
555
|
+
name: t.name,
|
|
556
|
+
shortName: t.short_name ?? void 0,
|
|
557
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
558
|
+
translations: t.translations.map(D),
|
|
559
|
+
displayAsset: U(t.display_asset),
|
|
560
|
+
slug: t.slug,
|
|
561
|
+
providerRef: t.id
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function yt(t) {
|
|
565
565
|
return {
|
|
566
566
|
entityType: "team",
|
|
567
|
-
id:
|
|
568
|
-
legacyId:
|
|
569
|
-
name:
|
|
570
|
-
shortName:
|
|
571
|
-
threeLetterCode:
|
|
572
|
-
translations:
|
|
573
|
-
displayAsset:
|
|
574
|
-
slug:
|
|
575
|
-
tagScore:
|
|
576
|
-
sport:
|
|
577
|
-
country:
|
|
578
|
-
gender:
|
|
579
|
-
competitionIds:
|
|
580
|
-
type:
|
|
581
|
-
national:
|
|
582
|
-
undecided:
|
|
583
|
-
providerRef:
|
|
567
|
+
id: t.id,
|
|
568
|
+
legacyId: t.legacy_id ?? void 0,
|
|
569
|
+
name: t.name,
|
|
570
|
+
shortName: t.short_name ?? void 0,
|
|
571
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
572
|
+
translations: t.translations.map(D),
|
|
573
|
+
displayAsset: U(t.display_asset),
|
|
574
|
+
slug: t.slug,
|
|
575
|
+
tagScore: t.tag_score ?? void 0,
|
|
576
|
+
sport: t.sport,
|
|
577
|
+
country: z(t.country),
|
|
578
|
+
gender: t.gender,
|
|
579
|
+
competitionIds: t.competition_ids,
|
|
580
|
+
type: t.type,
|
|
581
|
+
national: t.national,
|
|
582
|
+
undecided: t.undecided,
|
|
583
|
+
providerRef: t.id
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function Pt(t) {
|
|
587
587
|
return {
|
|
588
588
|
entityType: "city",
|
|
589
|
-
id:
|
|
590
|
-
legacyId:
|
|
591
|
-
name:
|
|
592
|
-
shortName:
|
|
593
|
-
threeLetterCode:
|
|
594
|
-
translations:
|
|
595
|
-
displayAsset:
|
|
596
|
-
slug:
|
|
597
|
-
tagScore:
|
|
598
|
-
sport:
|
|
599
|
-
country:
|
|
600
|
-
providerRef:
|
|
589
|
+
id: t.id,
|
|
590
|
+
legacyId: t.legacy_id ?? void 0,
|
|
591
|
+
name: t.name,
|
|
592
|
+
shortName: t.short_name ?? void 0,
|
|
593
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
594
|
+
translations: t.translations.map(D),
|
|
595
|
+
displayAsset: U(t.display_asset),
|
|
596
|
+
slug: t.slug,
|
|
597
|
+
tagScore: t.tag_score ?? void 0,
|
|
598
|
+
sport: t.sport,
|
|
599
|
+
country: z(t.country),
|
|
600
|
+
providerRef: t.id
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Ee(t) {
|
|
604
604
|
return {
|
|
605
605
|
entityType: "horse",
|
|
606
|
-
id:
|
|
607
|
-
legacyId:
|
|
608
|
-
name:
|
|
609
|
-
shortName:
|
|
610
|
-
threeLetterCode:
|
|
611
|
-
translations:
|
|
612
|
-
displayAsset:
|
|
613
|
-
slug:
|
|
614
|
-
tagScore:
|
|
615
|
-
sport:
|
|
616
|
-
country:
|
|
617
|
-
gender:
|
|
618
|
-
providerRef:
|
|
606
|
+
id: t.id,
|
|
607
|
+
legacyId: t.legacy_id ?? void 0,
|
|
608
|
+
name: t.name,
|
|
609
|
+
shortName: t.short_name ?? void 0,
|
|
610
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
611
|
+
translations: t.translations.map(D),
|
|
612
|
+
displayAsset: U(t.display_asset),
|
|
613
|
+
slug: t.slug,
|
|
614
|
+
tagScore: t.tag_score ?? void 0,
|
|
615
|
+
sport: t.sport,
|
|
616
|
+
country: z(t.country),
|
|
617
|
+
gender: t.gender,
|
|
618
|
+
providerRef: t.id
|
|
619
619
|
};
|
|
620
620
|
}
|
|
621
|
-
function
|
|
621
|
+
function Fe(t) {
|
|
622
622
|
return {
|
|
623
623
|
entityType: "player",
|
|
624
|
-
id:
|
|
625
|
-
legacyId:
|
|
626
|
-
name:
|
|
627
|
-
shortName:
|
|
628
|
-
threeLetterCode:
|
|
629
|
-
translations:
|
|
630
|
-
displayAsset:
|
|
631
|
-
slug:
|
|
632
|
-
tagScore:
|
|
633
|
-
sport:
|
|
634
|
-
country:
|
|
635
|
-
gender:
|
|
636
|
-
birthdate:
|
|
637
|
-
position:
|
|
638
|
-
providerRef:
|
|
624
|
+
id: t.id,
|
|
625
|
+
legacyId: t.legacy_id ?? void 0,
|
|
626
|
+
name: t.name,
|
|
627
|
+
shortName: t.short_name ?? void 0,
|
|
628
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
629
|
+
translations: t.translations.map(D),
|
|
630
|
+
displayAsset: U(t.display_asset),
|
|
631
|
+
slug: t.slug,
|
|
632
|
+
tagScore: t.tag_score ?? void 0,
|
|
633
|
+
sport: t.sport,
|
|
634
|
+
country: z(t.country),
|
|
635
|
+
gender: t.gender,
|
|
636
|
+
birthdate: t.birthdate ?? void 0,
|
|
637
|
+
position: t.position ?? void 0,
|
|
638
|
+
providerRef: t.id
|
|
639
639
|
};
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Le(t) {
|
|
642
642
|
return {
|
|
643
643
|
entityType: "coach",
|
|
644
|
-
id:
|
|
645
|
-
legacyId:
|
|
646
|
-
name:
|
|
647
|
-
shortName:
|
|
648
|
-
threeLetterCode:
|
|
649
|
-
translations:
|
|
650
|
-
displayAsset:
|
|
651
|
-
slug:
|
|
652
|
-
tagScore:
|
|
653
|
-
sport:
|
|
654
|
-
country:
|
|
655
|
-
gender:
|
|
656
|
-
birthdate:
|
|
657
|
-
providerRef:
|
|
644
|
+
id: t.id,
|
|
645
|
+
legacyId: t.legacy_id ?? void 0,
|
|
646
|
+
name: t.name,
|
|
647
|
+
shortName: t.short_name ?? void 0,
|
|
648
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
649
|
+
translations: t.translations.map(D),
|
|
650
|
+
displayAsset: U(t.display_asset),
|
|
651
|
+
slug: t.slug,
|
|
652
|
+
tagScore: t.tag_score ?? void 0,
|
|
653
|
+
sport: t.sport,
|
|
654
|
+
country: z(t.country),
|
|
655
|
+
gender: t.gender,
|
|
656
|
+
birthdate: t.birthdate ?? void 0,
|
|
657
|
+
providerRef: t.id
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function be(t) {
|
|
661
661
|
return {
|
|
662
662
|
entityType: "referee",
|
|
663
|
-
id:
|
|
664
|
-
legacyId:
|
|
665
|
-
name:
|
|
666
|
-
shortName:
|
|
667
|
-
threeLetterCode:
|
|
668
|
-
translations:
|
|
669
|
-
displayAsset:
|
|
670
|
-
slug:
|
|
671
|
-
tagScore:
|
|
672
|
-
sport:
|
|
673
|
-
country:
|
|
674
|
-
gender:
|
|
675
|
-
birthdate:
|
|
676
|
-
providerRef:
|
|
663
|
+
id: t.id,
|
|
664
|
+
legacyId: t.legacy_id ?? void 0,
|
|
665
|
+
name: t.name,
|
|
666
|
+
shortName: t.short_name ?? void 0,
|
|
667
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
668
|
+
translations: t.translations.map(D),
|
|
669
|
+
displayAsset: U(t.display_asset),
|
|
670
|
+
slug: t.slug,
|
|
671
|
+
tagScore: t.tag_score ?? void 0,
|
|
672
|
+
sport: t.sport,
|
|
673
|
+
country: z(t.country),
|
|
674
|
+
gender: t.gender,
|
|
675
|
+
birthdate: t.birthdate ?? void 0,
|
|
676
|
+
providerRef: t.id
|
|
677
677
|
};
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function Ne(t) {
|
|
680
680
|
return {
|
|
681
681
|
entityType: "venue",
|
|
682
|
-
id:
|
|
683
|
-
legacyId:
|
|
684
|
-
name:
|
|
685
|
-
shortName:
|
|
686
|
-
threeLetterCode:
|
|
687
|
-
translations:
|
|
688
|
-
displayAsset:
|
|
689
|
-
slug:
|
|
690
|
-
tagScore:
|
|
691
|
-
sport:
|
|
692
|
-
country:
|
|
693
|
-
city:
|
|
694
|
-
providerRef:
|
|
682
|
+
id: t.id,
|
|
683
|
+
legacyId: t.legacy_id ?? void 0,
|
|
684
|
+
name: t.name,
|
|
685
|
+
shortName: t.short_name ?? void 0,
|
|
686
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
687
|
+
translations: t.translations.map(D),
|
|
688
|
+
displayAsset: U(t.display_asset),
|
|
689
|
+
slug: t.slug,
|
|
690
|
+
tagScore: t.tag_score ?? void 0,
|
|
691
|
+
sport: t.sport,
|
|
692
|
+
country: z(t.country),
|
|
693
|
+
city: t.city ? Pt(t.city) : void 0,
|
|
694
|
+
providerRef: t.id
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function Re(t) {
|
|
698
698
|
return {
|
|
699
|
-
entityType:
|
|
700
|
-
id:
|
|
701
|
-
legacyId:
|
|
702
|
-
name:
|
|
703
|
-
shortName:
|
|
704
|
-
threeLetterCode:
|
|
705
|
-
translations:
|
|
706
|
-
displayAsset:
|
|
707
|
-
slug:
|
|
708
|
-
tagScore:
|
|
709
|
-
sport:
|
|
710
|
-
country:
|
|
711
|
-
gender:
|
|
712
|
-
type:
|
|
713
|
-
region:
|
|
714
|
-
providerRef:
|
|
699
|
+
entityType: t.entity_type,
|
|
700
|
+
id: t.id,
|
|
701
|
+
legacyId: t.legacy_id ?? void 0,
|
|
702
|
+
name: t.name,
|
|
703
|
+
shortName: t.short_name ?? void 0,
|
|
704
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
705
|
+
translations: t.translations.map(D),
|
|
706
|
+
displayAsset: U(t.display_asset),
|
|
707
|
+
slug: t.slug,
|
|
708
|
+
tagScore: t.tag_score ?? void 0,
|
|
709
|
+
sport: t.sport,
|
|
710
|
+
country: z(t.country),
|
|
711
|
+
gender: t.gender,
|
|
712
|
+
type: t.type ?? void 0,
|
|
713
|
+
region: t.region ?? void 0,
|
|
714
|
+
providerRef: t.id
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Ie(t) {
|
|
718
718
|
return {
|
|
719
719
|
entityType: "match",
|
|
720
|
-
id:
|
|
721
|
-
legacyId:
|
|
722
|
-
name:
|
|
723
|
-
shortName:
|
|
724
|
-
threeLetterCode:
|
|
725
|
-
translations:
|
|
726
|
-
displayAsset:
|
|
727
|
-
slug:
|
|
728
|
-
tagScore:
|
|
729
|
-
sport:
|
|
730
|
-
competitionId:
|
|
731
|
-
startTime:
|
|
732
|
-
homeTeam:
|
|
733
|
-
awayTeam:
|
|
734
|
-
providerRef:
|
|
720
|
+
id: t.id,
|
|
721
|
+
legacyId: t.legacy_id ?? void 0,
|
|
722
|
+
name: t.name,
|
|
723
|
+
shortName: t.short_name ?? void 0,
|
|
724
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
725
|
+
translations: t.translations.map(D),
|
|
726
|
+
displayAsset: U(t.display_asset),
|
|
727
|
+
slug: t.slug,
|
|
728
|
+
tagScore: t.tag_score ?? void 0,
|
|
729
|
+
sport: t.sport,
|
|
730
|
+
competitionId: t.competition_id ?? void 0,
|
|
731
|
+
startTime: t.start_time ?? void 0,
|
|
732
|
+
homeTeam: t.home_team ? yt(t.home_team) : void 0,
|
|
733
|
+
awayTeam: t.away_team ? yt(t.away_team) : void 0,
|
|
734
|
+
providerRef: t.id
|
|
735
735
|
};
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function Pe(t) {
|
|
738
738
|
return {
|
|
739
739
|
entityType: "country",
|
|
740
|
-
id:
|
|
741
|
-
legacyId:
|
|
742
|
-
name:
|
|
743
|
-
shortName:
|
|
744
|
-
threeLetterCode:
|
|
745
|
-
translations:
|
|
746
|
-
displayAsset:
|
|
747
|
-
slug:
|
|
748
|
-
tagScore:
|
|
749
|
-
sport:
|
|
750
|
-
providerRef:
|
|
740
|
+
id: t.id,
|
|
741
|
+
legacyId: t.legacy_id ?? void 0,
|
|
742
|
+
name: t.name,
|
|
743
|
+
shortName: t.short_name ?? void 0,
|
|
744
|
+
threeLetterCode: t.three_letter_code ?? void 0,
|
|
745
|
+
translations: t.translations.map(D),
|
|
746
|
+
displayAsset: U(t.display_asset),
|
|
747
|
+
slug: t.slug,
|
|
748
|
+
tagScore: t.tag_score ?? void 0,
|
|
749
|
+
sport: t.sport,
|
|
750
|
+
providerRef: t.id
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
|
-
function
|
|
754
|
-
switch (
|
|
753
|
+
function Me(t) {
|
|
754
|
+
switch (t.entity_type) {
|
|
755
755
|
case "team":
|
|
756
|
-
return
|
|
756
|
+
return yt(t);
|
|
757
757
|
case "city":
|
|
758
|
-
return
|
|
758
|
+
return Pt(t);
|
|
759
759
|
case "horse":
|
|
760
|
-
return
|
|
760
|
+
return Ee(t);
|
|
761
761
|
case "player":
|
|
762
|
-
return
|
|
762
|
+
return Fe(t);
|
|
763
763
|
case "coach":
|
|
764
|
-
return
|
|
764
|
+
return Le(t);
|
|
765
765
|
case "referee":
|
|
766
|
-
return
|
|
766
|
+
return be(t);
|
|
767
767
|
case "venue":
|
|
768
|
-
return
|
|
768
|
+
return Ne(t);
|
|
769
769
|
case "tournament":
|
|
770
770
|
case "competition":
|
|
771
|
-
return
|
|
771
|
+
return Re(t);
|
|
772
772
|
case "match":
|
|
773
|
-
return
|
|
773
|
+
return Ie(t);
|
|
774
774
|
case "country":
|
|
775
|
-
return
|
|
775
|
+
return Pe(t);
|
|
776
776
|
default: {
|
|
777
|
-
const
|
|
778
|
-
throw new Error(`Unknown entity type: ${
|
|
777
|
+
const e = t;
|
|
778
|
+
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
async function
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
const s = await
|
|
782
|
+
async function qn(t = {}, e) {
|
|
783
|
+
const n = e ?? b(), o = {};
|
|
784
|
+
t.name && (o.name = t.name), t.entityTypes && t.entityTypes.length > 0 && (o.entity_type = t.entityTypes.join(",")), t.sports && t.sports.length > 0 && (o.sport = t.sports.join(",")), t.eventStartTime && (o.event_start_time = t.eventStartTime), t.ids && t.ids.length > 0 && (o.ids = t.ids.join(",")), t.competitionIds && t.competitionIds.length > 0 && (o.competition_ids = t.competitionIds.join(",")), t.domain && (o.domain = t.domain), t.inputLanguage && (o.input_language = t.inputLanguage), t.translationLanguage && (o.translation_language = t.translationLanguage), t.limit !== void 0 && (o.limit = t.limit.toString()), t.offset !== void 0 && (o.offset = t.offset.toString());
|
|
785
|
+
const s = await Oe.get({
|
|
786
786
|
path: "/suggest",
|
|
787
|
-
params:
|
|
788
|
-
next:
|
|
789
|
-
config:
|
|
787
|
+
params: o,
|
|
788
|
+
next: t.next,
|
|
789
|
+
config: n
|
|
790
790
|
});
|
|
791
791
|
return !s.results || s.results.length === 0 ? {
|
|
792
792
|
results: [],
|
|
793
|
-
query:
|
|
793
|
+
query: t.name
|
|
794
794
|
} : {
|
|
795
|
-
results: s.results.map(
|
|
796
|
-
query:
|
|
795
|
+
results: s.results.map(Me),
|
|
796
|
+
query: t.name
|
|
797
797
|
};
|
|
798
798
|
}
|
|
799
|
-
const
|
|
800
|
-
function
|
|
801
|
-
const
|
|
799
|
+
const Ge = ot(Jt);
|
|
800
|
+
function De(t) {
|
|
801
|
+
const e = {
|
|
802
802
|
RANK: null,
|
|
803
803
|
// rank is a top-level field, not a stat
|
|
804
804
|
PLAYED: "played",
|
|
@@ -809,9 +809,9 @@ function je(e) {
|
|
|
809
809
|
GOALS_AGAINST: "goalsAgainst",
|
|
810
810
|
POINTS: "points"
|
|
811
811
|
};
|
|
812
|
-
return
|
|
812
|
+
return t in e ? e[t] : t.toLowerCase().replace(/_/g, "");
|
|
813
813
|
}
|
|
814
|
-
function
|
|
814
|
+
function Mt(t) {
|
|
815
815
|
return {
|
|
816
816
|
CHAMPIONS_LEAGUE: "championsLeague",
|
|
817
817
|
CHAMPIONS_LEAGUE_QUAL: "championsLeagueQual",
|
|
@@ -852,28 +852,28 @@ function oe(e) {
|
|
|
852
852
|
AFC_CHAMPIONS_LEAGUE_QUAL: "afcChampionsLeagueQual",
|
|
853
853
|
PLAYOFF_TO_AFC_CHAMPIONS_LEAGUE_QUAL: "playoffAfcChampionsLeagueQual",
|
|
854
854
|
WORLD_CUP: "worldCup"
|
|
855
|
-
}[
|
|
855
|
+
}[t] ?? t.toLowerCase().replace(/_/g, "");
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
857
|
+
function Ue(t) {
|
|
858
|
+
return t === "RELEGATION" || t === "RELEGATION_PLAYOFF" ? "BOTTOM" : t.includes("PLAYOFF") ? "MIDDLE" : "TOP";
|
|
859
859
|
}
|
|
860
|
-
function
|
|
861
|
-
if (!
|
|
862
|
-
const
|
|
860
|
+
function xe(t, e) {
|
|
861
|
+
if (!e || e.length === 0) return;
|
|
862
|
+
const n = {
|
|
863
863
|
win: "W",
|
|
864
864
|
loss: "L",
|
|
865
865
|
draw: "D"
|
|
866
|
-
},
|
|
867
|
-
const i = s.participants.find((
|
|
866
|
+
}, o = e.map((s) => {
|
|
867
|
+
const i = s.participants.find((u) => u.id === t), r = s.participants.find((u) => u.id !== t), a = i?.position === "1", c = s.result.find((u) => u.type === "display"), d = c?.results.find((u) => u.position === "1")?.value, f = c?.results.find((u) => u.position === "2")?.value, l = d && f ? `${d}-${f}` : void 0;
|
|
868
868
|
return {
|
|
869
869
|
matchId: s.id,
|
|
870
|
-
result:
|
|
870
|
+
result: n[s.outcome] ?? "L",
|
|
871
871
|
score: l,
|
|
872
|
-
homeAway:
|
|
872
|
+
homeAway: a ? "HOME" : "AWAY",
|
|
873
873
|
opponent: {
|
|
874
|
-
id:
|
|
875
|
-
name:
|
|
876
|
-
logo:
|
|
874
|
+
id: r?.id ?? "",
|
|
875
|
+
name: r?.name ?? "",
|
|
876
|
+
logo: r?.display_asset?.url
|
|
877
877
|
},
|
|
878
878
|
date: new Date(s.start_time),
|
|
879
879
|
competition: s.competition ? {
|
|
@@ -883,163 +883,163 @@ function ze(e, t) {
|
|
|
883
883
|
};
|
|
884
884
|
});
|
|
885
885
|
return {
|
|
886
|
-
competitorId:
|
|
887
|
-
results:
|
|
888
|
-
formString:
|
|
886
|
+
competitorId: t,
|
|
887
|
+
results: o,
|
|
888
|
+
formString: o.map((s) => s.result).join("")
|
|
889
889
|
};
|
|
890
890
|
}
|
|
891
|
-
function
|
|
892
|
-
const
|
|
893
|
-
for (const
|
|
894
|
-
const
|
|
895
|
-
|
|
891
|
+
function He(t) {
|
|
892
|
+
const e = {};
|
|
893
|
+
for (const n of t) {
|
|
894
|
+
const o = De(n.type.code);
|
|
895
|
+
o && (e[o] = Number(n.value));
|
|
896
896
|
}
|
|
897
|
-
return
|
|
897
|
+
return e.goalsFor != null && e.goalsAgainst != null && e.goalDifference == null && (e.goalDifference = e.goalsFor - e.goalsAgainst), e;
|
|
898
898
|
}
|
|
899
|
-
function
|
|
900
|
-
const
|
|
901
|
-
return
|
|
899
|
+
function ke(t) {
|
|
900
|
+
const e = t.find((n) => n.type.code === "RANK");
|
|
901
|
+
return e ? Number(e.value) : 0;
|
|
902
902
|
}
|
|
903
|
-
function
|
|
904
|
-
const
|
|
903
|
+
function $e(t) {
|
|
904
|
+
const e = t.rules?.length > 0 ? t.rules.map((n) => Mt(n.standing_api_rule_type)) : void 0;
|
|
905
905
|
return {
|
|
906
|
-
rank:
|
|
906
|
+
rank: ke(t.columns),
|
|
907
907
|
competitor: {
|
|
908
|
-
id:
|
|
909
|
-
name:
|
|
910
|
-
shortName:
|
|
908
|
+
id: t.team.id,
|
|
909
|
+
name: t.team.name,
|
|
910
|
+
shortName: t.team.short_name ?? void 0,
|
|
911
911
|
logo: void 0
|
|
912
912
|
// Standings API doesn't include logo in team object
|
|
913
913
|
},
|
|
914
|
-
stats:
|
|
915
|
-
form:
|
|
916
|
-
rules:
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
function
|
|
920
|
-
const
|
|
921
|
-
for (const
|
|
922
|
-
if (
|
|
923
|
-
for (const
|
|
924
|
-
const s =
|
|
925
|
-
|
|
914
|
+
stats: He(t.columns),
|
|
915
|
+
form: xe(t.team.id, t.form ?? []),
|
|
916
|
+
rules: e
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function Be(t) {
|
|
920
|
+
const e = /* @__PURE__ */ new Map();
|
|
921
|
+
for (const n of t)
|
|
922
|
+
if (n.rules)
|
|
923
|
+
for (const o of n.rules) {
|
|
924
|
+
const s = Mt(o.standing_api_rule_type);
|
|
925
|
+
e.has(s) || e.set(s, {
|
|
926
926
|
key: s,
|
|
927
|
-
name:
|
|
928
|
-
position:
|
|
927
|
+
name: o.name,
|
|
928
|
+
position: Ue(o.type)
|
|
929
929
|
});
|
|
930
930
|
}
|
|
931
|
-
return Array.from(
|
|
931
|
+
return Array.from(e.values());
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
const
|
|
933
|
+
function We(t) {
|
|
934
|
+
const e = t.standing.map($e), n = Be(t.standing);
|
|
935
935
|
return {
|
|
936
|
-
entries:
|
|
937
|
-
metadata: { legend:
|
|
936
|
+
entries: e,
|
|
937
|
+
metadata: { legend: n }
|
|
938
938
|
};
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
940
|
+
function ze(t) {
|
|
941
|
+
return t.standings.map((e) => ({
|
|
942
942
|
stage: {
|
|
943
|
-
id:
|
|
944
|
-
name:
|
|
943
|
+
id: t.stage.id,
|
|
944
|
+
name: t.stage.name
|
|
945
945
|
},
|
|
946
946
|
group: {
|
|
947
|
-
id:
|
|
948
|
-
name:
|
|
949
|
-
type:
|
|
947
|
+
id: e.group.id,
|
|
948
|
+
name: e.group.name,
|
|
949
|
+
type: e.group.type
|
|
950
950
|
},
|
|
951
|
-
coverageType:
|
|
952
|
-
rankingType:
|
|
953
|
-
standings:
|
|
951
|
+
coverageType: e.type,
|
|
952
|
+
rankingType: e.ranking_type,
|
|
953
|
+
standings: We(e)
|
|
954
954
|
}));
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
return !
|
|
958
|
-
}
|
|
959
|
-
async function
|
|
960
|
-
const
|
|
961
|
-
season_id:
|
|
962
|
-
stage_id:
|
|
963
|
-
group_id:
|
|
964
|
-
coverage_type:
|
|
965
|
-
home_away:
|
|
966
|
-
optional_data:
|
|
967
|
-
row_limit:
|
|
968
|
-
row_offset:
|
|
969
|
-
translation_language:
|
|
970
|
-
}, i = await
|
|
971
|
-
path: `/standings/${
|
|
956
|
+
function Ye(t) {
|
|
957
|
+
return !t?.data || t.data.length === 0 ? [] : t.data.flatMap(ze);
|
|
958
|
+
}
|
|
959
|
+
async function Qn(t, e) {
|
|
960
|
+
const n = e || b(), { sportal365Sports: o } = n, s = {
|
|
961
|
+
season_id: t.seasonId,
|
|
962
|
+
stage_id: t.stageId,
|
|
963
|
+
group_id: t.groupId,
|
|
964
|
+
coverage_type: t.coverageType,
|
|
965
|
+
home_away: t.homeAway,
|
|
966
|
+
optional_data: t.includeForm ? "form" : void 0,
|
|
967
|
+
row_limit: t.rowLimit?.toString(),
|
|
968
|
+
row_offset: t.rowOffset?.toString(),
|
|
969
|
+
translation_language: t.languageCode ?? o?.languageCode ?? "en"
|
|
970
|
+
}, i = await Ge.get({
|
|
971
|
+
path: `/standings/${t.sport}`,
|
|
972
972
|
params: s,
|
|
973
|
-
next:
|
|
974
|
-
config:
|
|
973
|
+
next: t.next,
|
|
974
|
+
config: n
|
|
975
975
|
});
|
|
976
|
-
return
|
|
977
|
-
}
|
|
978
|
-
const
|
|
979
|
-
function
|
|
980
|
-
return {
|
|
981
|
-
teamId:
|
|
982
|
-
teamName:
|
|
983
|
-
seasonId:
|
|
984
|
-
statistics:
|
|
985
|
-
key:
|
|
986
|
-
value:
|
|
987
|
-
label:
|
|
976
|
+
return Ye(i);
|
|
977
|
+
}
|
|
978
|
+
const je = ot(Zt);
|
|
979
|
+
function qe(t, e) {
|
|
980
|
+
return {
|
|
981
|
+
teamId: t.id,
|
|
982
|
+
teamName: t.name,
|
|
983
|
+
seasonId: e,
|
|
984
|
+
statistics: t.statistics.map((n) => ({
|
|
985
|
+
key: n.id,
|
|
986
|
+
value: n.value,
|
|
987
|
+
label: n.name
|
|
988
988
|
}))
|
|
989
989
|
};
|
|
990
990
|
}
|
|
991
|
-
async function
|
|
992
|
-
const
|
|
991
|
+
async function Vn(t, e) {
|
|
992
|
+
const n = e || b(), o = t.next ?? { revalidate: 600 }, s = await je.get({
|
|
993
993
|
path: "/statistics/aggregate",
|
|
994
994
|
params: {
|
|
995
|
-
participant_ids:
|
|
996
|
-
season_ids:
|
|
995
|
+
participant_ids: t.teamId,
|
|
996
|
+
season_ids: t.seasonId,
|
|
997
997
|
participant_type: "TEAM"
|
|
998
998
|
},
|
|
999
|
-
next:
|
|
1000
|
-
config:
|
|
999
|
+
next: o,
|
|
1000
|
+
config: n
|
|
1001
1001
|
});
|
|
1002
1002
|
if (!s.data || s.data.length === 0)
|
|
1003
|
-
throw new Error(`No statistics found for team ${
|
|
1004
|
-
return
|
|
1003
|
+
throw new Error(`No statistics found for team ${t.teamId} in season ${t.seasonId}`);
|
|
1004
|
+
return qe(s.data[0], t.seasonId);
|
|
1005
1005
|
}
|
|
1006
|
-
function
|
|
1007
|
-
const
|
|
1008
|
-
function o
|
|
1009
|
-
return `${
|
|
1006
|
+
function Gt(t) {
|
|
1007
|
+
const e = t.replace(/\/$/, "");
|
|
1008
|
+
function n(o) {
|
|
1009
|
+
return `${e}${o}`;
|
|
1010
1010
|
}
|
|
1011
1011
|
return {
|
|
1012
|
-
async get(
|
|
1013
|
-
const s =
|
|
1012
|
+
async get(o) {
|
|
1013
|
+
const s = o.config || b(), { fansUnited: i } = s;
|
|
1014
1014
|
if (!i)
|
|
1015
1015
|
throw new Error(
|
|
1016
1016
|
"Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
|
|
1017
1017
|
);
|
|
1018
1018
|
if (!i.apiKey || !i.clientId)
|
|
1019
1019
|
throw new Error("Fans United configuration requires both 'apiKey' and 'clientId'");
|
|
1020
|
-
const
|
|
1021
|
-
if (
|
|
1022
|
-
for (const [
|
|
1023
|
-
l !== void 0 && (Array.isArray(l) ? l.length > 0 &&
|
|
1024
|
-
const
|
|
1020
|
+
const r = new URL(n(o.path));
|
|
1021
|
+
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), o.params)
|
|
1022
|
+
for (const [f, l] of Object.entries(o.params))
|
|
1023
|
+
l !== void 0 && (Array.isArray(l) ? l.length > 0 && r.searchParams.set(f, l.join(",")) : r.searchParams.set(f, l));
|
|
1024
|
+
const a = 3e4, c = new URL(r.toString());
|
|
1025
1025
|
c.searchParams.delete("key"), c.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", c.toString());
|
|
1026
|
-
const d = await fetch(
|
|
1026
|
+
const d = await fetch(r.toString(), {
|
|
1027
1027
|
method: "GET",
|
|
1028
1028
|
headers: {
|
|
1029
1029
|
Accept: "application/json",
|
|
1030
1030
|
"Content-Type": "application/json",
|
|
1031
1031
|
// Merge custom headers (they can override defaults)
|
|
1032
|
-
...
|
|
1032
|
+
...o.headers
|
|
1033
1033
|
},
|
|
1034
|
-
signal: AbortSignal.timeout(
|
|
1034
|
+
signal: AbortSignal.timeout(a),
|
|
1035
1035
|
// Next.js cache options for ISR/on-demand revalidation
|
|
1036
|
-
...
|
|
1036
|
+
...o.next && { next: o.next }
|
|
1037
1037
|
});
|
|
1038
1038
|
if (!d.ok) {
|
|
1039
|
-
let
|
|
1039
|
+
let f = `Fans United API error: ${d.status} ${d.statusText}`;
|
|
1040
1040
|
try {
|
|
1041
1041
|
const l = await d.text();
|
|
1042
|
-
l && (
|
|
1042
|
+
l && (f += ` - ${l}`);
|
|
1043
1043
|
} catch (l) {
|
|
1044
1044
|
console.error("[Fans United HTTP] Failed to read error response body:", {
|
|
1045
1045
|
error: l instanceof Error ? l.message : String(l),
|
|
@@ -1047,435 +1047,435 @@ function it(e) {
|
|
|
1047
1047
|
statusText: d.statusText
|
|
1048
1048
|
});
|
|
1049
1049
|
}
|
|
1050
|
-
throw new Error(
|
|
1050
|
+
throw new Error(f);
|
|
1051
1051
|
}
|
|
1052
1052
|
return d.json();
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
1055
1055
|
}
|
|
1056
|
-
const
|
|
1057
|
-
function
|
|
1056
|
+
const Qe = "https://football.fansunitedapi.com", $ = Gt(Qe);
|
|
1057
|
+
function Ve(t) {
|
|
1058
1058
|
return {
|
|
1059
|
-
id: String(
|
|
1060
|
-
name:
|
|
1061
|
-
active:
|
|
1059
|
+
id: String(t.id),
|
|
1060
|
+
name: t.name,
|
|
1061
|
+
active: t.active,
|
|
1062
1062
|
providerRef: [
|
|
1063
1063
|
{
|
|
1064
1064
|
provider: "fansunited",
|
|
1065
|
-
id: String(
|
|
1065
|
+
id: String(t.id)
|
|
1066
1066
|
}
|
|
1067
1067
|
]
|
|
1068
1068
|
};
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1071
|
-
const
|
|
1072
|
-
id: String(
|
|
1073
|
-
name:
|
|
1074
|
-
shortName:
|
|
1075
|
-
slug:
|
|
1076
|
-
type:
|
|
1077
|
-
region:
|
|
1078
|
-
gender:
|
|
1070
|
+
function Ke(t) {
|
|
1071
|
+
const e = {
|
|
1072
|
+
id: String(t.id),
|
|
1073
|
+
name: t.name,
|
|
1074
|
+
shortName: t.short_name,
|
|
1075
|
+
slug: t.slug,
|
|
1076
|
+
type: t.type || "LEAGUE",
|
|
1077
|
+
region: t.region,
|
|
1078
|
+
gender: t.gender,
|
|
1079
1079
|
providerRef: [
|
|
1080
1080
|
{
|
|
1081
1081
|
provider: "fansunited",
|
|
1082
|
-
id: String(
|
|
1082
|
+
id: String(t.id)
|
|
1083
1083
|
}
|
|
1084
1084
|
]
|
|
1085
1085
|
};
|
|
1086
|
-
return
|
|
1087
|
-
id: String(
|
|
1088
|
-
name:
|
|
1089
|
-
code:
|
|
1090
|
-
flag:
|
|
1086
|
+
return t.country && (e.country = {
|
|
1087
|
+
id: String(t.country.id),
|
|
1088
|
+
name: t.country.name,
|
|
1089
|
+
code: t.country.code,
|
|
1090
|
+
flag: t.country.assets?.flag,
|
|
1091
1091
|
providerRef: [
|
|
1092
1092
|
{
|
|
1093
1093
|
provider: "fansunited",
|
|
1094
|
-
id: String(
|
|
1094
|
+
id: String(t.country.id)
|
|
1095
1095
|
}
|
|
1096
1096
|
]
|
|
1097
|
-
}),
|
|
1098
|
-
logo:
|
|
1099
|
-
}),
|
|
1100
|
-
id: String(
|
|
1101
|
-
name:
|
|
1102
|
-
status:
|
|
1103
|
-
}),
|
|
1104
|
-
}
|
|
1105
|
-
function
|
|
1106
|
-
return
|
|
1107
|
-
}
|
|
1108
|
-
async function
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1111
|
-
const
|
|
1097
|
+
}), t.assets?.logo && (e.assets = {
|
|
1098
|
+
logo: t.assets.logo
|
|
1099
|
+
}), t.seasons && t.seasons.length > 0 && (e.seasons = t.seasons.map(Ve)), t.current_season && (e.season = {
|
|
1100
|
+
id: String(t.current_season.id),
|
|
1101
|
+
name: t.current_season.name,
|
|
1102
|
+
status: t.current_season.active ? "ACTIVE" : "INACTIVE"
|
|
1103
|
+
}), e;
|
|
1104
|
+
}
|
|
1105
|
+
function Xe(t) {
|
|
1106
|
+
return t.map(Ke);
|
|
1107
|
+
}
|
|
1108
|
+
async function Kn(t, e) {
|
|
1109
|
+
const n = {};
|
|
1110
|
+
t?.lang ? n.lang = t.lang : n.lang = "EN", t?.sortField && (n.sort_field = t.sortField), t?.sortOrder && (n.sort_order = t.sortOrder), t?.page !== void 0 && (n.page = String(t.page)), t?.perPage !== void 0 && (n.per_page = String(t.perPage)), t?.countryId !== void 0 && (n.country_id = String(t.countryId)), t?.active !== void 0 && (n.active = t.active ? "1" : "0");
|
|
1111
|
+
const o = await $.get({
|
|
1112
1112
|
path: "/v1/competitions",
|
|
1113
|
-
params:
|
|
1114
|
-
config:
|
|
1115
|
-
next:
|
|
1116
|
-
}), s =
|
|
1113
|
+
params: n,
|
|
1114
|
+
config: e,
|
|
1115
|
+
next: t?.next
|
|
1116
|
+
}), s = o.data.map((d) => d.id), i = new Set(s);
|
|
1117
1117
|
s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1118
|
+
const r = Xe(o.data), a = /* @__PURE__ */ new Set(), c = r.filter((d) => a.has(d.id) ? !1 : (a.add(d.id), !0));
|
|
1119
|
+
return r.length !== c.length && console.warn(`Removed ${r.length - c.length} duplicate competitions`), c;
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function Je(t) {
|
|
1122
1122
|
return {
|
|
1123
|
-
id:
|
|
1124
|
-
name:
|
|
1125
|
-
code:
|
|
1126
|
-
assets:
|
|
1127
|
-
flag:
|
|
1123
|
+
id: t.id,
|
|
1124
|
+
name: t.name,
|
|
1125
|
+
code: t.country_code,
|
|
1126
|
+
assets: t.assets?.flag ? {
|
|
1127
|
+
flag: t.assets.flag
|
|
1128
1128
|
} : void 0,
|
|
1129
1129
|
providerRef: [
|
|
1130
1130
|
{
|
|
1131
1131
|
provider: "fansunited",
|
|
1132
|
-
id:
|
|
1132
|
+
id: t.id
|
|
1133
1133
|
}
|
|
1134
1134
|
]
|
|
1135
1135
|
};
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Ze(t) {
|
|
1138
1138
|
return {
|
|
1139
|
-
id:
|
|
1140
|
-
name:
|
|
1141
|
-
type:
|
|
1142
|
-
gender:
|
|
1143
|
-
country:
|
|
1144
|
-
assets:
|
|
1145
|
-
logo:
|
|
1139
|
+
id: t.id,
|
|
1140
|
+
name: t.name,
|
|
1141
|
+
type: t.type?.toUpperCase() || "LEAGUE",
|
|
1142
|
+
gender: t.gender?.toUpperCase(),
|
|
1143
|
+
country: t.country ? Je(t.country) : void 0,
|
|
1144
|
+
assets: t.assets?.logo ? {
|
|
1145
|
+
logo: t.assets.logo
|
|
1146
1146
|
} : void 0,
|
|
1147
1147
|
providerRef: [
|
|
1148
1148
|
{
|
|
1149
1149
|
provider: "fansunited",
|
|
1150
|
-
id:
|
|
1150
|
+
id: t.id
|
|
1151
1151
|
}
|
|
1152
1152
|
]
|
|
1153
1153
|
};
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return
|
|
1155
|
+
function we(t) {
|
|
1156
|
+
return Ze(t.data);
|
|
1157
1157
|
}
|
|
1158
|
-
async function
|
|
1159
|
-
const
|
|
1160
|
-
|
|
1161
|
-
const i = await
|
|
1162
|
-
path: `/v1/competitions/${
|
|
1158
|
+
async function Xn(t, e, n) {
|
|
1159
|
+
const o = n || b(), s = {};
|
|
1160
|
+
e?.lang && (s.lang = e.lang);
|
|
1161
|
+
const i = await $.get({
|
|
1162
|
+
path: `/v1/competitions/${t}`,
|
|
1163
1163
|
params: s,
|
|
1164
|
-
next:
|
|
1165
|
-
config:
|
|
1164
|
+
next: e?.next,
|
|
1165
|
+
config: o
|
|
1166
1166
|
});
|
|
1167
|
-
return
|
|
1167
|
+
return we(i);
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function tn(t) {
|
|
1170
1170
|
return {
|
|
1171
|
-
id:
|
|
1172
|
-
name:
|
|
1173
|
-
code:
|
|
1174
|
-
flag:
|
|
1171
|
+
id: t.id,
|
|
1172
|
+
name: t.name,
|
|
1173
|
+
code: t.country_code,
|
|
1174
|
+
flag: t.assets?.flag,
|
|
1175
1175
|
providerRef: [
|
|
1176
1176
|
{
|
|
1177
1177
|
provider: "fansunited",
|
|
1178
|
-
id:
|
|
1178
|
+
id: t.id
|
|
1179
1179
|
}
|
|
1180
1180
|
]
|
|
1181
1181
|
};
|
|
1182
1182
|
}
|
|
1183
|
-
function
|
|
1183
|
+
function Dt(t) {
|
|
1184
1184
|
return {
|
|
1185
|
-
id:
|
|
1186
|
-
name:
|
|
1187
|
-
shortName:
|
|
1188
|
-
threeLetterCode:
|
|
1189
|
-
type:
|
|
1190
|
-
gender:
|
|
1191
|
-
country:
|
|
1192
|
-
assets:
|
|
1193
|
-
logo:
|
|
1185
|
+
id: t.id,
|
|
1186
|
+
name: t.name,
|
|
1187
|
+
shortName: t.short_name || void 0,
|
|
1188
|
+
threeLetterCode: t.code,
|
|
1189
|
+
type: t.national ? "national" : "club",
|
|
1190
|
+
gender: t.gender ? t.gender.toUpperCase() : void 0,
|
|
1191
|
+
country: t.country ? tn(t.country) : void 0,
|
|
1192
|
+
assets: t.assets?.logo ? {
|
|
1193
|
+
logo: t.assets.logo
|
|
1194
1194
|
} : void 0,
|
|
1195
|
-
metadata:
|
|
1196
|
-
shirtColors:
|
|
1195
|
+
metadata: t.colors ? {
|
|
1196
|
+
shirtColors: t.colors.primary ? [
|
|
1197
1197
|
{
|
|
1198
1198
|
type: "home",
|
|
1199
|
-
colorCode:
|
|
1199
|
+
colorCode: t.colors.primary
|
|
1200
1200
|
}
|
|
1201
1201
|
] : void 0
|
|
1202
1202
|
} : void 0,
|
|
1203
1203
|
providerRef: [
|
|
1204
1204
|
{
|
|
1205
1205
|
provider: "fansunited",
|
|
1206
|
-
id:
|
|
1206
|
+
id: t.id
|
|
1207
1207
|
}
|
|
1208
1208
|
]
|
|
1209
1209
|
};
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1212
|
-
return
|
|
1211
|
+
function en(t) {
|
|
1212
|
+
return Dt(t.data);
|
|
1213
1213
|
}
|
|
1214
|
-
function
|
|
1215
|
-
return
|
|
1214
|
+
function nn(t) {
|
|
1215
|
+
return t.data.map(Dt);
|
|
1216
1216
|
}
|
|
1217
|
-
async function
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
const i = await
|
|
1221
|
-
path: `/v1/teams/${
|
|
1217
|
+
async function Jn(t, e, n) {
|
|
1218
|
+
const o = n || b(), s = {};
|
|
1219
|
+
e?.lang && (s.lang = e.lang);
|
|
1220
|
+
const i = await $.get({
|
|
1221
|
+
path: `/v1/teams/${t}`,
|
|
1222
1222
|
params: s,
|
|
1223
|
-
next:
|
|
1224
|
-
config:
|
|
1223
|
+
next: e?.next,
|
|
1224
|
+
config: o
|
|
1225
1225
|
});
|
|
1226
|
-
return
|
|
1226
|
+
return en(i);
|
|
1227
1227
|
}
|
|
1228
|
-
async function
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1231
|
-
const s = await
|
|
1228
|
+
async function Zn(t, e) {
|
|
1229
|
+
const n = e || b(), o = {};
|
|
1230
|
+
t?.lang && (o.lang = t.lang), t?.teamIds && (o.team_ids = t.teamIds), t?.countryId && (o.country_id = t.countryId), t?.name && (o.name = t.name), t?.scope && (o.scope = t.scope), t?.national !== void 0 && (o.national = String(t.national)), t?.gender && (o.gender = t.gender), t?.limit !== void 0 && (o.limit = String(t.limit)), t?.page !== void 0 && (o.page = String(t.page)), t?.sortField && (o.sort_field = t.sortField), t?.sortOrder && (o.sort_order = t.sortOrder);
|
|
1231
|
+
const s = await $.get({
|
|
1232
1232
|
path: "/v1/teams",
|
|
1233
|
-
params:
|
|
1234
|
-
next:
|
|
1235
|
-
config:
|
|
1233
|
+
params: o,
|
|
1234
|
+
next: t?.next,
|
|
1235
|
+
config: n
|
|
1236
1236
|
});
|
|
1237
|
-
return
|
|
1237
|
+
return nn(s);
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function vt(t) {
|
|
1240
1240
|
return {
|
|
1241
|
-
id:
|
|
1242
|
-
name:
|
|
1243
|
-
code:
|
|
1244
|
-
flag:
|
|
1241
|
+
id: t.id,
|
|
1242
|
+
name: t.name,
|
|
1243
|
+
code: t.country_code,
|
|
1244
|
+
flag: t.assets?.flag,
|
|
1245
1245
|
providerRef: [
|
|
1246
1246
|
{
|
|
1247
1247
|
provider: "fansunited",
|
|
1248
|
-
id:
|
|
1248
|
+
id: t.id
|
|
1249
1249
|
}
|
|
1250
1250
|
]
|
|
1251
1251
|
};
|
|
1252
1252
|
}
|
|
1253
|
-
function
|
|
1253
|
+
function on(t) {
|
|
1254
1254
|
return {
|
|
1255
|
-
id:
|
|
1256
|
-
name:
|
|
1257
|
-
shortName:
|
|
1258
|
-
fullName:
|
|
1259
|
-
threeLetterCode:
|
|
1260
|
-
type:
|
|
1261
|
-
gender:
|
|
1262
|
-
country:
|
|
1263
|
-
assets:
|
|
1264
|
-
logo:
|
|
1255
|
+
id: t.id,
|
|
1256
|
+
name: t.name,
|
|
1257
|
+
shortName: t.short_name ?? void 0,
|
|
1258
|
+
fullName: t.full_name ?? void 0,
|
|
1259
|
+
threeLetterCode: t.code,
|
|
1260
|
+
type: t.national ? "national" : "club",
|
|
1261
|
+
gender: t.gender?.toUpperCase(),
|
|
1262
|
+
country: t.country ? vt(t.country) : void 0,
|
|
1263
|
+
assets: t.assets?.logo ? {
|
|
1264
|
+
logo: t.assets.logo
|
|
1265
1265
|
} : void 0,
|
|
1266
1266
|
providerRef: [
|
|
1267
1267
|
{
|
|
1268
1268
|
provider: "fansunited",
|
|
1269
|
-
id:
|
|
1269
|
+
id: t.id
|
|
1270
1270
|
}
|
|
1271
1271
|
]
|
|
1272
1272
|
};
|
|
1273
1273
|
}
|
|
1274
|
-
function
|
|
1274
|
+
function sn(t) {
|
|
1275
1275
|
return {
|
|
1276
|
-
id:
|
|
1277
|
-
name:
|
|
1278
|
-
type:
|
|
1279
|
-
gender:
|
|
1280
|
-
country:
|
|
1281
|
-
assets:
|
|
1282
|
-
logo:
|
|
1276
|
+
id: t.id,
|
|
1277
|
+
name: t.name,
|
|
1278
|
+
type: t.type?.toUpperCase() || "LEAGUE",
|
|
1279
|
+
gender: t.gender?.toUpperCase(),
|
|
1280
|
+
country: t.country ? vt(t.country) : void 0,
|
|
1281
|
+
assets: t.assets?.logo ? {
|
|
1282
|
+
logo: t.assets.logo
|
|
1283
1283
|
} : void 0,
|
|
1284
1284
|
providerRef: [
|
|
1285
1285
|
{
|
|
1286
1286
|
provider: "fansunited",
|
|
1287
|
-
id:
|
|
1287
|
+
id: t.id
|
|
1288
1288
|
}
|
|
1289
1289
|
]
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
|
-
function
|
|
1292
|
+
function Ut(t) {
|
|
1293
1293
|
return {
|
|
1294
1294
|
type: "player",
|
|
1295
|
-
id:
|
|
1296
|
-
name:
|
|
1297
|
-
position:
|
|
1298
|
-
birthdate:
|
|
1299
|
-
country:
|
|
1300
|
-
assets:
|
|
1301
|
-
photo:
|
|
1295
|
+
id: t.id,
|
|
1296
|
+
name: t.name,
|
|
1297
|
+
position: t.position,
|
|
1298
|
+
birthdate: t.birth_date,
|
|
1299
|
+
country: t.country ? vt(t.country) : void 0,
|
|
1300
|
+
assets: t.assets?.headshot ? {
|
|
1301
|
+
photo: t.assets.headshot
|
|
1302
1302
|
} : void 0,
|
|
1303
|
-
teams:
|
|
1304
|
-
competitions:
|
|
1303
|
+
teams: t.teams?.map(on),
|
|
1304
|
+
competitions: t.competitions?.map(sn),
|
|
1305
1305
|
providerRef: [
|
|
1306
1306
|
{
|
|
1307
1307
|
provider: "fansunited",
|
|
1308
|
-
id:
|
|
1308
|
+
id: t.id
|
|
1309
1309
|
}
|
|
1310
1310
|
]
|
|
1311
1311
|
};
|
|
1312
1312
|
}
|
|
1313
|
-
function
|
|
1314
|
-
return
|
|
1313
|
+
function rn(t) {
|
|
1314
|
+
return Ut(t.data);
|
|
1315
1315
|
}
|
|
1316
|
-
function
|
|
1317
|
-
return
|
|
1316
|
+
function an(t) {
|
|
1317
|
+
return t.data.map(Ut);
|
|
1318
1318
|
}
|
|
1319
|
-
async function
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
const i = await
|
|
1323
|
-
path: `/v1/players/${
|
|
1319
|
+
async function wn(t, e, n) {
|
|
1320
|
+
const o = n || b(), s = {};
|
|
1321
|
+
e?.lang && (s.lang = e.lang);
|
|
1322
|
+
const i = await $.get({
|
|
1323
|
+
path: `/v1/players/${t}`,
|
|
1324
1324
|
params: s,
|
|
1325
|
-
next: t?.next,
|
|
1326
|
-
config: n
|
|
1327
|
-
});
|
|
1328
|
-
return Tt(i);
|
|
1329
|
-
}
|
|
1330
|
-
async function zt(e, t) {
|
|
1331
|
-
const o = t || A(), n = {};
|
|
1332
|
-
e?.lang && (n.lang = e.lang), e?.playerIds && (n.player_ids = e.playerIds), e?.countryId && (n.country_id = e.countryId), e?.name && (n.name = e.name), e?.scope && (n.scope = e.scope), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder);
|
|
1333
|
-
const s = await R.get({
|
|
1334
|
-
path: "/v1/players",
|
|
1335
|
-
params: n,
|
|
1336
1325
|
next: e?.next,
|
|
1337
1326
|
config: o
|
|
1338
1327
|
});
|
|
1339
|
-
return
|
|
1328
|
+
return rn(i);
|
|
1340
1329
|
}
|
|
1341
|
-
async function
|
|
1342
|
-
const n =
|
|
1343
|
-
t?.lang && (
|
|
1344
|
-
const
|
|
1345
|
-
path:
|
|
1346
|
-
params:
|
|
1330
|
+
async function to(t, e) {
|
|
1331
|
+
const n = e || b(), o = {};
|
|
1332
|
+
t?.lang && (o.lang = t.lang), t?.playerIds && (o.player_ids = t.playerIds), t?.countryId && (o.country_id = t.countryId), t?.name && (o.name = t.name), t?.scope && (o.scope = t.scope), t?.limit !== void 0 && (o.limit = String(t.limit)), t?.page !== void 0 && (o.page = String(t.page)), t?.sortField && (o.sort_field = t.sortField), t?.sortOrder && (o.sort_order = t.sortOrder);
|
|
1333
|
+
const s = await $.get({
|
|
1334
|
+
path: "/v1/players",
|
|
1335
|
+
params: o,
|
|
1347
1336
|
next: t?.next,
|
|
1348
1337
|
config: n
|
|
1349
1338
|
});
|
|
1350
|
-
return
|
|
1339
|
+
return an(s);
|
|
1351
1340
|
}
|
|
1352
|
-
async function
|
|
1353
|
-
const o =
|
|
1354
|
-
e?.lang && (
|
|
1355
|
-
const
|
|
1356
|
-
path:
|
|
1357
|
-
params:
|
|
1341
|
+
async function eo(t, e, n) {
|
|
1342
|
+
const o = n || b(), s = {};
|
|
1343
|
+
e?.lang && (s.lang = e.lang);
|
|
1344
|
+
const i = await $.get({
|
|
1345
|
+
path: `/v1/matches/${t}`,
|
|
1346
|
+
params: s,
|
|
1358
1347
|
next: e?.next,
|
|
1359
1348
|
config: o
|
|
1360
1349
|
});
|
|
1361
|
-
return
|
|
1350
|
+
return wt(i);
|
|
1362
1351
|
}
|
|
1363
|
-
function
|
|
1352
|
+
async function no(t, e) {
|
|
1353
|
+
const n = e || b(), o = {};
|
|
1354
|
+
t?.lang && (o.lang = t.lang), t?.competitions && (o.competitions = t.competitions), t?.countries && (o.countries = t.countries), t?.fromDate && (o.from_date = t.fromDate), t?.toDate && (o.to_date = t.toDate), t?.matches && (o.matches = t.matches), t?.teams && (o.teams = t.teams), t?.status && (o.status = t.status), t?.limit !== void 0 && (o.limit = String(t.limit)), t?.page !== void 0 && (o.page = String(t.page)), t?.sortField && (o.sort_field = t.sortField), t?.sortOrder && (o.sort_order = t.sortOrder), t?.showDeleted !== void 0 && (o.show_deleted = t.showDeleted ? "true" : "false");
|
|
1355
|
+
const s = await $.get({
|
|
1356
|
+
path: "/v1/matches",
|
|
1357
|
+
params: o,
|
|
1358
|
+
next: t?.next,
|
|
1359
|
+
config: n
|
|
1360
|
+
});
|
|
1361
|
+
return te(s);
|
|
1362
|
+
}
|
|
1363
|
+
function St(t) {
|
|
1364
1364
|
return {
|
|
1365
|
-
id:
|
|
1366
|
-
name:
|
|
1367
|
-
code:
|
|
1368
|
-
flag:
|
|
1365
|
+
id: t.id,
|
|
1366
|
+
name: t.name,
|
|
1367
|
+
code: t.country_code,
|
|
1368
|
+
flag: t.assets?.flag || void 0,
|
|
1369
1369
|
providerRef: [
|
|
1370
1370
|
{
|
|
1371
1371
|
provider: "fansunited",
|
|
1372
|
-
id:
|
|
1372
|
+
id: t.id
|
|
1373
1373
|
}
|
|
1374
1374
|
]
|
|
1375
1375
|
};
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function cn(t) {
|
|
1378
1378
|
return {
|
|
1379
|
-
id:
|
|
1380
|
-
name:
|
|
1381
|
-
shortName:
|
|
1382
|
-
type:
|
|
1383
|
-
region:
|
|
1384
|
-
gender:
|
|
1385
|
-
country:
|
|
1386
|
-
assets:
|
|
1387
|
-
logo:
|
|
1379
|
+
id: t.id,
|
|
1380
|
+
name: t.name,
|
|
1381
|
+
shortName: t.short_name || void 0,
|
|
1382
|
+
type: t.type || "LEAGUE",
|
|
1383
|
+
region: t.region,
|
|
1384
|
+
gender: t.gender?.toUpperCase(),
|
|
1385
|
+
country: t.country ? St(t.country) : void 0,
|
|
1386
|
+
assets: t.assets?.logo ? {
|
|
1387
|
+
logo: t.assets.logo
|
|
1388
1388
|
} : void 0,
|
|
1389
1389
|
providerRef: [
|
|
1390
1390
|
{
|
|
1391
1391
|
provider: "fansunited",
|
|
1392
|
-
id:
|
|
1392
|
+
id: t.id
|
|
1393
1393
|
}
|
|
1394
1394
|
]
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function ln(t) {
|
|
1398
1398
|
return {
|
|
1399
1399
|
type: "player",
|
|
1400
|
-
id:
|
|
1401
|
-
name:
|
|
1402
|
-
position:
|
|
1403
|
-
gender:
|
|
1404
|
-
birthdate:
|
|
1405
|
-
country:
|
|
1406
|
-
assets:
|
|
1407
|
-
photo:
|
|
1400
|
+
id: t.id,
|
|
1401
|
+
name: t.name,
|
|
1402
|
+
position: t.position || void 0,
|
|
1403
|
+
gender: t.gender?.toUpperCase(),
|
|
1404
|
+
birthdate: t.birth_date || void 0,
|
|
1405
|
+
country: t.country ? St(t.country) : void 0,
|
|
1406
|
+
assets: t.assets?.headshot ? {
|
|
1407
|
+
photo: t.assets.headshot
|
|
1408
1408
|
} : void 0,
|
|
1409
1409
|
providerRef: [
|
|
1410
1410
|
{
|
|
1411
1411
|
provider: "fansunited",
|
|
1412
|
-
id:
|
|
1412
|
+
id: t.id
|
|
1413
1413
|
}
|
|
1414
1414
|
]
|
|
1415
1415
|
};
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function dn(t) {
|
|
1418
1418
|
return {
|
|
1419
|
-
type:
|
|
1420
|
-
id:
|
|
1421
|
-
name:
|
|
1422
|
-
shortName:
|
|
1423
|
-
threeLetterCode:
|
|
1424
|
-
gender:
|
|
1425
|
-
country:
|
|
1426
|
-
assets:
|
|
1427
|
-
logo:
|
|
1419
|
+
type: t.national ? "national" : "club",
|
|
1420
|
+
id: t.id,
|
|
1421
|
+
name: t.name,
|
|
1422
|
+
shortName: t.short_name || void 0,
|
|
1423
|
+
threeLetterCode: t.code || void 0,
|
|
1424
|
+
gender: t.gender?.toUpperCase(),
|
|
1425
|
+
country: t.country ? St(t.country) : void 0,
|
|
1426
|
+
assets: t.assets?.logo ? {
|
|
1427
|
+
logo: t.assets.logo
|
|
1428
1428
|
} : void 0,
|
|
1429
1429
|
providerRef: [
|
|
1430
1430
|
{
|
|
1431
1431
|
provider: "fansunited",
|
|
1432
|
-
id:
|
|
1432
|
+
id: t.id
|
|
1433
1433
|
}
|
|
1434
1434
|
]
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1438
|
-
switch (
|
|
1437
|
+
function gt(t) {
|
|
1438
|
+
switch (t.entity_type) {
|
|
1439
1439
|
case "competition": {
|
|
1440
|
-
const
|
|
1440
|
+
const e = cn(t);
|
|
1441
1441
|
return {
|
|
1442
1442
|
source: "FOOTBALL",
|
|
1443
1443
|
entityType: "competition",
|
|
1444
|
-
entityId:
|
|
1445
|
-
entityData:
|
|
1444
|
+
entityId: t.id,
|
|
1445
|
+
entityData: e
|
|
1446
1446
|
};
|
|
1447
1447
|
}
|
|
1448
1448
|
case "player": {
|
|
1449
|
-
const
|
|
1449
|
+
const e = ln(t);
|
|
1450
1450
|
return {
|
|
1451
1451
|
source: "FOOTBALL",
|
|
1452
1452
|
entityType: "player",
|
|
1453
|
-
entityId:
|
|
1454
|
-
entityData:
|
|
1453
|
+
entityId: t.id,
|
|
1454
|
+
entityData: e
|
|
1455
1455
|
};
|
|
1456
1456
|
}
|
|
1457
1457
|
case "team": {
|
|
1458
|
-
const
|
|
1458
|
+
const e = dn(t);
|
|
1459
1459
|
return {
|
|
1460
1460
|
source: "FOOTBALL",
|
|
1461
1461
|
entityType: "team",
|
|
1462
|
-
entityId:
|
|
1463
|
-
entityData:
|
|
1462
|
+
entityId: t.id,
|
|
1463
|
+
entityData: e
|
|
1464
1464
|
};
|
|
1465
1465
|
}
|
|
1466
1466
|
case "venue":
|
|
1467
1467
|
case "coach":
|
|
1468
1468
|
return null;
|
|
1469
1469
|
default:
|
|
1470
|
-
throw new Error(`Unknown entity type: ${
|
|
1470
|
+
throw new Error(`Unknown entity type: ${t.entity_type}`);
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
async function
|
|
1474
|
-
if (!
|
|
1473
|
+
async function oo(t, e) {
|
|
1474
|
+
if (!t.query || t.query.trim() === "")
|
|
1475
1475
|
return [];
|
|
1476
|
-
const
|
|
1477
|
-
q:
|
|
1478
|
-
}, i = (
|
|
1476
|
+
const n = e || b(), o = {
|
|
1477
|
+
q: t.query.trim()
|
|
1478
|
+
}, i = (t.entityTypes && t.entityTypes.length > 0 ? t.entityTypes : ["competition", "team", "player"]).map((c) => {
|
|
1479
1479
|
switch (c) {
|
|
1480
1480
|
case "team":
|
|
1481
1481
|
return "teams";
|
|
@@ -1487,170 +1487,1296 @@ async function Zt(e, t) {
|
|
|
1487
1487
|
return c;
|
|
1488
1488
|
}
|
|
1489
1489
|
});
|
|
1490
|
-
|
|
1491
|
-
const
|
|
1490
|
+
o.entities = i.join(","), t.lang && (o.lang = t.lang), t.limit && (o.limit = String(t.limit));
|
|
1491
|
+
const r = await $.get({
|
|
1492
1492
|
path: "/v1/search",
|
|
1493
|
-
params:
|
|
1494
|
-
next:
|
|
1495
|
-
config:
|
|
1496
|
-
}),
|
|
1497
|
-
return
|
|
1498
|
-
const d =
|
|
1499
|
-
d &&
|
|
1500
|
-
}),
|
|
1501
|
-
const d =
|
|
1502
|
-
d &&
|
|
1503
|
-
}),
|
|
1504
|
-
const d =
|
|
1505
|
-
d &&
|
|
1506
|
-
})),
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1493
|
+
params: o,
|
|
1494
|
+
next: t.next,
|
|
1495
|
+
config: n
|
|
1496
|
+
}), a = [];
|
|
1497
|
+
return r.data && (r.data.competitions && r.data.competitions.forEach((c) => {
|
|
1498
|
+
const d = gt({ ...c, entity_type: "competition" });
|
|
1499
|
+
d && a.push(d);
|
|
1500
|
+
}), r.data.teams && r.data.teams.forEach((c) => {
|
|
1501
|
+
const d = gt({ ...c, entity_type: "team" });
|
|
1502
|
+
d && a.push(d);
|
|
1503
|
+
}), r.data.players && r.data.players.forEach((c) => {
|
|
1504
|
+
const d = gt({ ...c, entity_type: "player" });
|
|
1505
|
+
d && a.push(d);
|
|
1506
|
+
})), a;
|
|
1507
|
+
}
|
|
1508
|
+
const un = "https://search.fansunitedapi.com", B = Gt(un);
|
|
1509
|
+
var fn = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, xt = /* @__PURE__ */ new Set(), Tt = typeof process == "object" && process ? process : {}, Ht = (t, e, n, o) => {
|
|
1510
|
+
typeof Tt.emitWarning == "function" ? Tt.emitWarning(t, e, n, o) : console.error(`[${n}] ${e}: ${t}`);
|
|
1511
|
+
}, ut = globalThis.AbortController, Ft = globalThis.AbortSignal;
|
|
1512
|
+
if (typeof ut > "u") {
|
|
1513
|
+
Ft = class {
|
|
1514
|
+
onabort;
|
|
1515
|
+
_onabort = [];
|
|
1516
|
+
reason;
|
|
1517
|
+
aborted = !1;
|
|
1518
|
+
addEventListener(n, o) {
|
|
1519
|
+
this._onabort.push(o);
|
|
1520
|
+
}
|
|
1521
|
+
}, ut = class {
|
|
1522
|
+
constructor() {
|
|
1523
|
+
e();
|
|
1524
|
+
}
|
|
1525
|
+
signal = new Ft();
|
|
1526
|
+
abort(n) {
|
|
1527
|
+
if (!this.signal.aborted) {
|
|
1528
|
+
this.signal.reason = n, this.signal.aborted = !0;
|
|
1529
|
+
for (let o of this.signal._onabort) o(n);
|
|
1530
|
+
this.signal.onabort?.(n);
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
let t = Tt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", e = () => {
|
|
1535
|
+
t && (t = !1, Ht("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", e));
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
var hn = (t) => !xt.has(t), W = (t) => t && t === Math.floor(t) && t > 0 && isFinite(t), kt = (t) => W(t) ? t <= Math.pow(2, 8) ? Uint8Array : t <= Math.pow(2, 16) ? Uint16Array : t <= Math.pow(2, 32) ? Uint32Array : t <= Number.MAX_SAFE_INTEGER ? dt : null : null, dt = class extends Array {
|
|
1539
|
+
constructor(t) {
|
|
1540
|
+
super(t), this.fill(0);
|
|
1541
|
+
}
|
|
1542
|
+
}, mn = class et {
|
|
1543
|
+
heap;
|
|
1544
|
+
length;
|
|
1545
|
+
static #a = !1;
|
|
1546
|
+
static create(e) {
|
|
1547
|
+
let n = kt(e);
|
|
1548
|
+
if (!n) return [];
|
|
1549
|
+
et.#a = !0;
|
|
1550
|
+
let o = new et(e, n);
|
|
1551
|
+
return et.#a = !1, o;
|
|
1552
|
+
}
|
|
1553
|
+
constructor(e, n) {
|
|
1554
|
+
if (!et.#a) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1555
|
+
this.heap = new n(e), this.length = 0;
|
|
1556
|
+
}
|
|
1557
|
+
push(e) {
|
|
1558
|
+
this.heap[this.length++] = e;
|
|
1559
|
+
}
|
|
1560
|
+
pop() {
|
|
1561
|
+
return this.heap[--this.length];
|
|
1562
|
+
}
|
|
1563
|
+
}, gn = class $t {
|
|
1564
|
+
#a;
|
|
1565
|
+
#u;
|
|
1566
|
+
#p;
|
|
1567
|
+
#N;
|
|
1568
|
+
#y;
|
|
1569
|
+
#M;
|
|
1570
|
+
#G;
|
|
1571
|
+
#T;
|
|
1572
|
+
get perf() {
|
|
1573
|
+
return this.#T;
|
|
1574
|
+
}
|
|
1575
|
+
ttl;
|
|
1576
|
+
ttlResolution;
|
|
1577
|
+
ttlAutopurge;
|
|
1578
|
+
updateAgeOnGet;
|
|
1579
|
+
updateAgeOnHas;
|
|
1580
|
+
allowStale;
|
|
1581
|
+
noDisposeOnSet;
|
|
1582
|
+
noUpdateTTL;
|
|
1583
|
+
maxEntrySize;
|
|
1584
|
+
sizeCalculation;
|
|
1585
|
+
noDeleteOnFetchRejection;
|
|
1586
|
+
noDeleteOnStaleGet;
|
|
1587
|
+
allowStaleOnFetchAbort;
|
|
1588
|
+
allowStaleOnFetchRejection;
|
|
1589
|
+
ignoreFetchAbort;
|
|
1590
|
+
#s;
|
|
1591
|
+
#_;
|
|
1592
|
+
#o;
|
|
1593
|
+
#n;
|
|
1594
|
+
#t;
|
|
1595
|
+
#l;
|
|
1596
|
+
#f;
|
|
1597
|
+
#c;
|
|
1598
|
+
#i;
|
|
1599
|
+
#v;
|
|
1600
|
+
#r;
|
|
1601
|
+
#S;
|
|
1602
|
+
#A;
|
|
1603
|
+
#h;
|
|
1604
|
+
#m;
|
|
1605
|
+
#C;
|
|
1606
|
+
#b;
|
|
1607
|
+
#d;
|
|
1608
|
+
#D;
|
|
1609
|
+
static unsafeExposeInternals(e) {
|
|
1610
|
+
return { starts: e.#A, ttls: e.#h, autopurgeTimers: e.#m, sizes: e.#S, keyMap: e.#o, keyList: e.#n, valList: e.#t, next: e.#l, prev: e.#f, get head() {
|
|
1611
|
+
return e.#c;
|
|
1612
|
+
}, get tail() {
|
|
1613
|
+
return e.#i;
|
|
1614
|
+
}, free: e.#v, isBackgroundFetch: (n) => e.#e(n), backgroundFetch: (n, o, s, i) => e.#H(n, o, s, i), moveToTail: (n) => e.#P(n), indexes: (n) => e.#O(n), rindexes: (n) => e.#E(n), isStale: (n) => e.#g(n) };
|
|
1615
|
+
}
|
|
1616
|
+
get max() {
|
|
1617
|
+
return this.#a;
|
|
1618
|
+
}
|
|
1619
|
+
get maxSize() {
|
|
1620
|
+
return this.#u;
|
|
1621
|
+
}
|
|
1622
|
+
get calculatedSize() {
|
|
1623
|
+
return this.#_;
|
|
1624
|
+
}
|
|
1625
|
+
get size() {
|
|
1626
|
+
return this.#s;
|
|
1627
|
+
}
|
|
1628
|
+
get fetchMethod() {
|
|
1629
|
+
return this.#M;
|
|
1630
|
+
}
|
|
1631
|
+
get memoMethod() {
|
|
1632
|
+
return this.#G;
|
|
1633
|
+
}
|
|
1634
|
+
get dispose() {
|
|
1635
|
+
return this.#p;
|
|
1636
|
+
}
|
|
1637
|
+
get onInsert() {
|
|
1638
|
+
return this.#N;
|
|
1639
|
+
}
|
|
1640
|
+
get disposeAfter() {
|
|
1641
|
+
return this.#y;
|
|
1642
|
+
}
|
|
1643
|
+
constructor(e) {
|
|
1644
|
+
let { max: n = 0, ttl: o, ttlResolution: s = 1, ttlAutopurge: i, updateAgeOnGet: r, updateAgeOnHas: a, allowStale: c, dispose: d, onInsert: f, disposeAfter: l, noDisposeOnSet: u, noUpdateTTL: h, maxSize: p = 0, maxEntrySize: y = 0, sizeCalculation: S, fetchMethod: g, memoMethod: T, noDeleteOnFetchRejection: A, noDeleteOnStaleGet: C, allowStaleOnFetchRejection: v, allowStaleOnFetchAbort: R, ignoreFetchAbort: P, perf: M } = e;
|
|
1645
|
+
if (M !== void 0 && typeof M?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
1646
|
+
if (this.#T = M ?? fn, n !== 0 && !W(n)) throw new TypeError("max option must be a nonnegative integer");
|
|
1647
|
+
let m = n ? kt(n) : Array;
|
|
1648
|
+
if (!m) throw new Error("invalid max value: " + n);
|
|
1649
|
+
if (this.#a = n, this.#u = p, this.maxEntrySize = y || this.#u, this.sizeCalculation = S, this.sizeCalculation) {
|
|
1650
|
+
if (!this.#u && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1651
|
+
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
1652
|
+
}
|
|
1653
|
+
if (T !== void 0 && typeof T != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
1654
|
+
if (this.#G = T, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
1655
|
+
if (this.#M = g, this.#b = !!g, this.#o = /* @__PURE__ */ new Map(), this.#n = new Array(n).fill(void 0), this.#t = new Array(n).fill(void 0), this.#l = new m(n), this.#f = new m(n), this.#c = 0, this.#i = 0, this.#v = mn.create(n), this.#s = 0, this.#_ = 0, typeof d == "function" && (this.#p = d), typeof f == "function" && (this.#N = f), typeof l == "function" ? (this.#y = l, this.#r = []) : (this.#y = void 0, this.#r = void 0), this.#C = !!this.#p, this.#D = !!this.#N, this.#d = !!this.#y, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!h, this.noDeleteOnFetchRejection = !!A, this.allowStaleOnFetchRejection = !!v, this.allowStaleOnFetchAbort = !!R, this.ignoreFetchAbort = !!P, this.maxEntrySize !== 0) {
|
|
1656
|
+
if (this.#u !== 0 && !W(this.#u)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
1657
|
+
if (!W(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1658
|
+
this.#j();
|
|
1659
|
+
}
|
|
1660
|
+
if (this.allowStale = !!c, this.noDeleteOnStaleGet = !!C, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!a, this.ttlResolution = W(s) || s === 0 ? s : 1, this.ttlAutopurge = !!i, this.ttl = o || 0, this.ttl) {
|
|
1661
|
+
if (!W(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
1662
|
+
this.#k();
|
|
1663
|
+
}
|
|
1664
|
+
if (this.#a === 0 && this.ttl === 0 && this.#u === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1665
|
+
if (!this.ttlAutopurge && !this.#a && !this.#u) {
|
|
1666
|
+
let O = "LRU_CACHE_UNBOUNDED";
|
|
1667
|
+
hn(O) && (xt.add(O), Ht("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", O, $t));
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
getRemainingTTL(e) {
|
|
1671
|
+
return this.#o.has(e) ? 1 / 0 : 0;
|
|
1672
|
+
}
|
|
1673
|
+
#k() {
|
|
1674
|
+
let e = new dt(this.#a), n = new dt(this.#a);
|
|
1675
|
+
this.#h = e, this.#A = n;
|
|
1676
|
+
let o = this.ttlAutopurge ? new Array(this.#a) : void 0;
|
|
1677
|
+
this.#m = o, this.#$ = (r, a, c = this.#T.now()) => {
|
|
1678
|
+
if (n[r] = a !== 0 ? c : 0, e[r] = a, o?.[r] && (clearTimeout(o[r]), o[r] = void 0), a !== 0 && o) {
|
|
1679
|
+
let d = setTimeout(() => {
|
|
1680
|
+
this.#g(r) && this.#F(this.#n[r], "expire");
|
|
1681
|
+
}, a + 1);
|
|
1682
|
+
d.unref && d.unref(), o[r] = d;
|
|
1683
|
+
}
|
|
1684
|
+
}, this.#R = (r) => {
|
|
1685
|
+
n[r] = e[r] !== 0 ? this.#T.now() : 0;
|
|
1686
|
+
}, this.#L = (r, a) => {
|
|
1687
|
+
if (e[a]) {
|
|
1688
|
+
let c = e[a], d = n[a];
|
|
1689
|
+
if (!c || !d) return;
|
|
1690
|
+
r.ttl = c, r.start = d, r.now = s || i();
|
|
1691
|
+
let f = r.now - d;
|
|
1692
|
+
r.remainingTTL = c - f;
|
|
1693
|
+
}
|
|
1694
|
+
};
|
|
1695
|
+
let s = 0, i = () => {
|
|
1696
|
+
let r = this.#T.now();
|
|
1697
|
+
if (this.ttlResolution > 0) {
|
|
1698
|
+
s = r;
|
|
1699
|
+
let a = setTimeout(() => s = 0, this.ttlResolution);
|
|
1700
|
+
a.unref && a.unref();
|
|
1701
|
+
}
|
|
1702
|
+
return r;
|
|
1703
|
+
};
|
|
1704
|
+
this.getRemainingTTL = (r) => {
|
|
1705
|
+
let a = this.#o.get(r);
|
|
1706
|
+
if (a === void 0) return 0;
|
|
1707
|
+
let c = e[a], d = n[a];
|
|
1708
|
+
if (!c || !d) return 1 / 0;
|
|
1709
|
+
let f = (s || i()) - d;
|
|
1710
|
+
return c - f;
|
|
1711
|
+
}, this.#g = (r) => {
|
|
1712
|
+
let a = n[r], c = e[r];
|
|
1713
|
+
return !!c && !!a && (s || i()) - a > c;
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
#R = () => {
|
|
1717
|
+
};
|
|
1718
|
+
#L = () => {
|
|
1719
|
+
};
|
|
1720
|
+
#$ = () => {
|
|
1721
|
+
};
|
|
1722
|
+
#g = () => !1;
|
|
1723
|
+
#j() {
|
|
1724
|
+
let e = new dt(this.#a);
|
|
1725
|
+
this.#_ = 0, this.#S = e, this.#I = (n) => {
|
|
1726
|
+
this.#_ -= e[n], e[n] = 0;
|
|
1727
|
+
}, this.#B = (n, o, s, i) => {
|
|
1728
|
+
if (this.#e(o)) return 0;
|
|
1729
|
+
if (!W(s)) if (i) {
|
|
1730
|
+
if (typeof i != "function") throw new TypeError("sizeCalculation must be a function");
|
|
1731
|
+
if (s = i(o, n), !W(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
1732
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
1733
|
+
return s;
|
|
1734
|
+
}, this.#U = (n, o, s) => {
|
|
1735
|
+
if (e[n] = o, this.#u) {
|
|
1736
|
+
let i = this.#u - e[n];
|
|
1737
|
+
for (; this.#_ > i; ) this.#x(!0);
|
|
1738
|
+
}
|
|
1739
|
+
this.#_ += e[n], s && (s.entrySize = o, s.totalCalculatedSize = this.#_);
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
#I = (e) => {
|
|
1743
|
+
};
|
|
1744
|
+
#U = (e, n, o) => {
|
|
1745
|
+
};
|
|
1746
|
+
#B = (e, n, o, s) => {
|
|
1747
|
+
if (o || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1748
|
+
return 0;
|
|
1749
|
+
};
|
|
1750
|
+
*#O({ allowStale: e = this.allowStale } = {}) {
|
|
1751
|
+
if (this.#s) for (let n = this.#i; !(!this.#W(n) || ((e || !this.#g(n)) && (yield n), n === this.#c)); ) n = this.#f[n];
|
|
1752
|
+
}
|
|
1753
|
+
*#E({ allowStale: e = this.allowStale } = {}) {
|
|
1754
|
+
if (this.#s) for (let n = this.#c; !(!this.#W(n) || ((e || !this.#g(n)) && (yield n), n === this.#i)); ) n = this.#l[n];
|
|
1755
|
+
}
|
|
1756
|
+
#W(e) {
|
|
1757
|
+
return e !== void 0 && this.#o.get(this.#n[e]) === e;
|
|
1758
|
+
}
|
|
1759
|
+
*entries() {
|
|
1760
|
+
for (let e of this.#O()) this.#t[e] !== void 0 && this.#n[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#n[e], this.#t[e]]);
|
|
1761
|
+
}
|
|
1762
|
+
*rentries() {
|
|
1763
|
+
for (let e of this.#E()) this.#t[e] !== void 0 && this.#n[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#n[e], this.#t[e]]);
|
|
1764
|
+
}
|
|
1765
|
+
*keys() {
|
|
1766
|
+
for (let e of this.#O()) {
|
|
1767
|
+
let n = this.#n[e];
|
|
1768
|
+
n !== void 0 && !this.#e(this.#t[e]) && (yield n);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
*rkeys() {
|
|
1772
|
+
for (let e of this.#E()) {
|
|
1773
|
+
let n = this.#n[e];
|
|
1774
|
+
n !== void 0 && !this.#e(this.#t[e]) && (yield n);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
*values() {
|
|
1778
|
+
for (let e of this.#O()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
1779
|
+
}
|
|
1780
|
+
*rvalues() {
|
|
1781
|
+
for (let e of this.#E()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
1782
|
+
}
|
|
1783
|
+
[Symbol.iterator]() {
|
|
1784
|
+
return this.entries();
|
|
1785
|
+
}
|
|
1786
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
1787
|
+
find(e, n = {}) {
|
|
1788
|
+
for (let o of this.#O()) {
|
|
1789
|
+
let s = this.#t[o], i = this.#e(s) ? s.__staleWhileFetching : s;
|
|
1790
|
+
if (i !== void 0 && e(i, this.#n[o], this)) return this.get(this.#n[o], n);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
forEach(e, n = this) {
|
|
1794
|
+
for (let o of this.#O()) {
|
|
1795
|
+
let s = this.#t[o], i = this.#e(s) ? s.__staleWhileFetching : s;
|
|
1796
|
+
i !== void 0 && e.call(n, i, this.#n[o], this);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
rforEach(e, n = this) {
|
|
1800
|
+
for (let o of this.#E()) {
|
|
1801
|
+
let s = this.#t[o], i = this.#e(s) ? s.__staleWhileFetching : s;
|
|
1802
|
+
i !== void 0 && e.call(n, i, this.#n[o], this);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
purgeStale() {
|
|
1806
|
+
let e = !1;
|
|
1807
|
+
for (let n of this.#E({ allowStale: !0 })) this.#g(n) && (this.#F(this.#n[n], "expire"), e = !0);
|
|
1808
|
+
return e;
|
|
1809
|
+
}
|
|
1810
|
+
info(e) {
|
|
1811
|
+
let n = this.#o.get(e);
|
|
1812
|
+
if (n === void 0) return;
|
|
1813
|
+
let o = this.#t[n], s = this.#e(o) ? o.__staleWhileFetching : o;
|
|
1814
|
+
if (s === void 0) return;
|
|
1815
|
+
let i = { value: s };
|
|
1816
|
+
if (this.#h && this.#A) {
|
|
1817
|
+
let r = this.#h[n], a = this.#A[n];
|
|
1818
|
+
if (r && a) {
|
|
1819
|
+
let c = r - (this.#T.now() - a);
|
|
1820
|
+
i.ttl = c, i.start = Date.now();
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return this.#S && (i.size = this.#S[n]), i;
|
|
1824
|
+
}
|
|
1825
|
+
dump() {
|
|
1826
|
+
let e = [];
|
|
1827
|
+
for (let n of this.#O({ allowStale: !0 })) {
|
|
1828
|
+
let o = this.#n[n], s = this.#t[n], i = this.#e(s) ? s.__staleWhileFetching : s;
|
|
1829
|
+
if (i === void 0 || o === void 0) continue;
|
|
1830
|
+
let r = { value: i };
|
|
1831
|
+
if (this.#h && this.#A) {
|
|
1832
|
+
r.ttl = this.#h[n];
|
|
1833
|
+
let a = this.#T.now() - this.#A[n];
|
|
1834
|
+
r.start = Math.floor(Date.now() - a);
|
|
1835
|
+
}
|
|
1836
|
+
this.#S && (r.size = this.#S[n]), e.unshift([o, r]);
|
|
1837
|
+
}
|
|
1838
|
+
return e;
|
|
1839
|
+
}
|
|
1840
|
+
load(e) {
|
|
1841
|
+
this.clear();
|
|
1842
|
+
for (let [n, o] of e) {
|
|
1843
|
+
if (o.start) {
|
|
1844
|
+
let s = Date.now() - o.start;
|
|
1845
|
+
o.start = this.#T.now() - s;
|
|
1846
|
+
}
|
|
1847
|
+
this.set(n, o.value, o);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
set(e, n, o = {}) {
|
|
1851
|
+
if (n === void 0) return this.delete(e), this;
|
|
1852
|
+
let { ttl: s = this.ttl, start: i, noDisposeOnSet: r = this.noDisposeOnSet, sizeCalculation: a = this.sizeCalculation, status: c } = o, { noUpdateTTL: d = this.noUpdateTTL } = o, f = this.#B(e, n, o.size || 0, a);
|
|
1853
|
+
if (this.maxEntrySize && f > this.maxEntrySize) return c && (c.set = "miss", c.maxEntrySizeExceeded = !0), this.#F(e, "set"), this;
|
|
1854
|
+
let l = this.#s === 0 ? void 0 : this.#o.get(e);
|
|
1855
|
+
if (l === void 0) l = this.#s === 0 ? this.#i : this.#v.length !== 0 ? this.#v.pop() : this.#s === this.#a ? this.#x(!1) : this.#s, this.#n[l] = e, this.#t[l] = n, this.#o.set(e, l), this.#l[this.#i] = l, this.#f[l] = this.#i, this.#i = l, this.#s++, this.#U(l, f, c), c && (c.set = "add"), d = !1, this.#D && this.#N?.(n, e, "add");
|
|
1856
|
+
else {
|
|
1857
|
+
this.#P(l);
|
|
1858
|
+
let u = this.#t[l];
|
|
1859
|
+
if (n !== u) {
|
|
1860
|
+
if (this.#b && this.#e(u)) {
|
|
1861
|
+
u.__abortController.abort(new Error("replaced"));
|
|
1862
|
+
let { __staleWhileFetching: h } = u;
|
|
1863
|
+
h !== void 0 && !r && (this.#C && this.#p?.(h, e, "set"), this.#d && this.#r?.push([h, e, "set"]));
|
|
1864
|
+
} else r || (this.#C && this.#p?.(u, e, "set"), this.#d && this.#r?.push([u, e, "set"]));
|
|
1865
|
+
if (this.#I(l), this.#U(l, f, c), this.#t[l] = n, c) {
|
|
1866
|
+
c.set = "replace";
|
|
1867
|
+
let h = u && this.#e(u) ? u.__staleWhileFetching : u;
|
|
1868
|
+
h !== void 0 && (c.oldValue = h);
|
|
1869
|
+
}
|
|
1870
|
+
} else c && (c.set = "update");
|
|
1871
|
+
this.#D && this.onInsert?.(n, e, n === u ? "update" : "replace");
|
|
1872
|
+
}
|
|
1873
|
+
if (s !== 0 && !this.#h && this.#k(), this.#h && (d || this.#$(l, s, i), c && this.#L(c, l)), !r && this.#d && this.#r) {
|
|
1874
|
+
let u = this.#r, h;
|
|
1875
|
+
for (; h = u?.shift(); ) this.#y?.(...h);
|
|
1876
|
+
}
|
|
1877
|
+
return this;
|
|
1878
|
+
}
|
|
1879
|
+
pop() {
|
|
1880
|
+
try {
|
|
1881
|
+
for (; this.#s; ) {
|
|
1882
|
+
let e = this.#t[this.#c];
|
|
1883
|
+
if (this.#x(!0), this.#e(e)) {
|
|
1884
|
+
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
1885
|
+
} else if (e !== void 0) return e;
|
|
1886
|
+
}
|
|
1887
|
+
} finally {
|
|
1888
|
+
if (this.#d && this.#r) {
|
|
1889
|
+
let e = this.#r, n;
|
|
1890
|
+
for (; n = e?.shift(); ) this.#y?.(...n);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
#x(e) {
|
|
1895
|
+
let n = this.#c, o = this.#n[n], s = this.#t[n];
|
|
1896
|
+
return this.#b && this.#e(s) ? s.__abortController.abort(new Error("evicted")) : (this.#C || this.#d) && (this.#C && this.#p?.(s, o, "evict"), this.#d && this.#r?.push([s, o, "evict"])), this.#I(n), this.#m?.[n] && (clearTimeout(this.#m[n]), this.#m[n] = void 0), e && (this.#n[n] = void 0, this.#t[n] = void 0, this.#v.push(n)), this.#s === 1 ? (this.#c = this.#i = 0, this.#v.length = 0) : this.#c = this.#l[n], this.#o.delete(o), this.#s--, n;
|
|
1897
|
+
}
|
|
1898
|
+
has(e, n = {}) {
|
|
1899
|
+
let { updateAgeOnHas: o = this.updateAgeOnHas, status: s } = n, i = this.#o.get(e);
|
|
1900
|
+
if (i !== void 0) {
|
|
1901
|
+
let r = this.#t[i];
|
|
1902
|
+
if (this.#e(r) && r.__staleWhileFetching === void 0) return !1;
|
|
1903
|
+
if (this.#g(i)) s && (s.has = "stale", this.#L(s, i));
|
|
1904
|
+
else return o && this.#R(i), s && (s.has = "hit", this.#L(s, i)), !0;
|
|
1905
|
+
} else s && (s.has = "miss");
|
|
1906
|
+
return !1;
|
|
1907
|
+
}
|
|
1908
|
+
peek(e, n = {}) {
|
|
1909
|
+
let { allowStale: o = this.allowStale } = n, s = this.#o.get(e);
|
|
1910
|
+
if (s === void 0 || !o && this.#g(s)) return;
|
|
1911
|
+
let i = this.#t[s];
|
|
1912
|
+
return this.#e(i) ? i.__staleWhileFetching : i;
|
|
1913
|
+
}
|
|
1914
|
+
#H(e, n, o, s) {
|
|
1915
|
+
let i = n === void 0 ? void 0 : this.#t[n];
|
|
1916
|
+
if (this.#e(i)) return i;
|
|
1917
|
+
let r = new ut(), { signal: a } = o;
|
|
1918
|
+
a?.addEventListener("abort", () => r.abort(a.reason), { signal: r.signal });
|
|
1919
|
+
let c = { signal: r.signal, options: o, context: s }, d = (y, S = !1) => {
|
|
1920
|
+
let { aborted: g } = r.signal, T = o.ignoreFetchAbort && y !== void 0, A = o.ignoreFetchAbort || !!(o.allowStaleOnFetchAbort && y !== void 0);
|
|
1921
|
+
if (o.status && (g && !S ? (o.status.fetchAborted = !0, o.status.fetchError = r.signal.reason, T && (o.status.fetchAbortIgnored = !0)) : o.status.fetchResolved = !0), g && !T && !S) return l(r.signal.reason, A);
|
|
1922
|
+
let C = h, v = this.#t[n];
|
|
1923
|
+
return (v === h || T && S && v === void 0) && (y === void 0 ? C.__staleWhileFetching !== void 0 ? this.#t[n] = C.__staleWhileFetching : this.#F(e, "fetch") : (o.status && (o.status.fetchUpdated = !0), this.set(e, y, c.options))), y;
|
|
1924
|
+
}, f = (y) => (o.status && (o.status.fetchRejected = !0, o.status.fetchError = y), l(y, !1)), l = (y, S) => {
|
|
1925
|
+
let { aborted: g } = r.signal, T = g && o.allowStaleOnFetchAbort, A = T || o.allowStaleOnFetchRejection, C = A || o.noDeleteOnFetchRejection, v = h;
|
|
1926
|
+
if (this.#t[n] === h && (!C || !S && v.__staleWhileFetching === void 0 ? this.#F(e, "fetch") : T || (this.#t[n] = v.__staleWhileFetching)), A) return o.status && v.__staleWhileFetching !== void 0 && (o.status.returnedStale = !0), v.__staleWhileFetching;
|
|
1927
|
+
if (v.__returned === v) throw y;
|
|
1928
|
+
}, u = (y, S) => {
|
|
1929
|
+
let g = this.#M?.(e, i, c);
|
|
1930
|
+
g && g instanceof Promise && g.then((T) => y(T === void 0 ? void 0 : T), S), r.signal.addEventListener("abort", () => {
|
|
1931
|
+
(!o.ignoreFetchAbort || o.allowStaleOnFetchAbort) && (y(void 0), o.allowStaleOnFetchAbort && (y = (T) => d(T, !0)));
|
|
1932
|
+
});
|
|
1933
|
+
};
|
|
1934
|
+
o.status && (o.status.fetchDispatched = !0);
|
|
1935
|
+
let h = new Promise(u).then(d, f), p = Object.assign(h, { __abortController: r, __staleWhileFetching: i, __returned: void 0 });
|
|
1936
|
+
return n === void 0 ? (this.set(e, p, { ...c.options, status: void 0 }), n = this.#o.get(e)) : this.#t[n] = p, p;
|
|
1937
|
+
}
|
|
1938
|
+
#e(e) {
|
|
1939
|
+
if (!this.#b) return !1;
|
|
1940
|
+
let n = e;
|
|
1941
|
+
return !!n && n instanceof Promise && n.hasOwnProperty("__staleWhileFetching") && n.__abortController instanceof ut;
|
|
1942
|
+
}
|
|
1943
|
+
async fetch(e, n = {}) {
|
|
1944
|
+
let { allowStale: o = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: r = this.ttl, noDisposeOnSet: a = this.noDisposeOnSet, size: c = 0, sizeCalculation: d = this.sizeCalculation, noUpdateTTL: f = this.noUpdateTTL, noDeleteOnFetchRejection: l = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: u = this.allowStaleOnFetchRejection, ignoreFetchAbort: h = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: y, forceRefresh: S = !1, status: g, signal: T } = n;
|
|
1945
|
+
if (!this.#b) return g && (g.fetch = "get"), this.get(e, { allowStale: o, updateAgeOnGet: s, noDeleteOnStaleGet: i, status: g });
|
|
1946
|
+
let A = { allowStale: o, updateAgeOnGet: s, noDeleteOnStaleGet: i, ttl: r, noDisposeOnSet: a, size: c, sizeCalculation: d, noUpdateTTL: f, noDeleteOnFetchRejection: l, allowStaleOnFetchRejection: u, allowStaleOnFetchAbort: p, ignoreFetchAbort: h, status: g, signal: T }, C = this.#o.get(e);
|
|
1947
|
+
if (C === void 0) {
|
|
1948
|
+
g && (g.fetch = "miss");
|
|
1949
|
+
let v = this.#H(e, C, A, y);
|
|
1950
|
+
return v.__returned = v;
|
|
1951
|
+
} else {
|
|
1952
|
+
let v = this.#t[C];
|
|
1953
|
+
if (this.#e(v)) {
|
|
1954
|
+
let m = o && v.__staleWhileFetching !== void 0;
|
|
1955
|
+
return g && (g.fetch = "inflight", m && (g.returnedStale = !0)), m ? v.__staleWhileFetching : v.__returned = v;
|
|
1956
|
+
}
|
|
1957
|
+
let R = this.#g(C);
|
|
1958
|
+
if (!S && !R) return g && (g.fetch = "hit"), this.#P(C), s && this.#R(C), g && this.#L(g, C), v;
|
|
1959
|
+
let P = this.#H(e, C, A, y), M = P.__staleWhileFetching !== void 0 && o;
|
|
1960
|
+
return g && (g.fetch = R ? "stale" : "refresh", M && R && (g.returnedStale = !0)), M ? P.__staleWhileFetching : P.__returned = P;
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
async forceFetch(e, n = {}) {
|
|
1964
|
+
let o = await this.fetch(e, n);
|
|
1965
|
+
if (o === void 0) throw new Error("fetch() returned undefined");
|
|
1966
|
+
return o;
|
|
1967
|
+
}
|
|
1968
|
+
memo(e, n = {}) {
|
|
1969
|
+
let o = this.#G;
|
|
1970
|
+
if (!o) throw new Error("no memoMethod provided to constructor");
|
|
1971
|
+
let { context: s, forceRefresh: i, ...r } = n, a = this.get(e, r);
|
|
1972
|
+
if (!i && a !== void 0) return a;
|
|
1973
|
+
let c = o(e, a, { options: r, context: s });
|
|
1974
|
+
return this.set(e, c, r), c;
|
|
1975
|
+
}
|
|
1976
|
+
get(e, n = {}) {
|
|
1977
|
+
let { allowStale: o = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, status: r } = n, a = this.#o.get(e);
|
|
1978
|
+
if (a !== void 0) {
|
|
1979
|
+
let c = this.#t[a], d = this.#e(c);
|
|
1980
|
+
return r && this.#L(r, a), this.#g(a) ? (r && (r.get = "stale"), d ? (r && o && c.__staleWhileFetching !== void 0 && (r.returnedStale = !0), o ? c.__staleWhileFetching : void 0) : (i || this.#F(e, "expire"), r && o && (r.returnedStale = !0), o ? c : void 0)) : (r && (r.get = "hit"), d ? c.__staleWhileFetching : (this.#P(a), s && this.#R(a), c));
|
|
1981
|
+
} else r && (r.get = "miss");
|
|
1982
|
+
}
|
|
1983
|
+
#z(e, n) {
|
|
1984
|
+
this.#f[n] = e, this.#l[e] = n;
|
|
1985
|
+
}
|
|
1986
|
+
#P(e) {
|
|
1987
|
+
e !== this.#i && (e === this.#c ? this.#c = this.#l[e] : this.#z(this.#f[e], this.#l[e]), this.#z(this.#i, e), this.#i = e);
|
|
1988
|
+
}
|
|
1989
|
+
delete(e) {
|
|
1990
|
+
return this.#F(e, "delete");
|
|
1991
|
+
}
|
|
1992
|
+
#F(e, n) {
|
|
1993
|
+
let o = !1;
|
|
1994
|
+
if (this.#s !== 0) {
|
|
1995
|
+
let s = this.#o.get(e);
|
|
1996
|
+
if (s !== void 0) if (this.#m?.[s] && (clearTimeout(this.#m?.[s]), this.#m[s] = void 0), o = !0, this.#s === 1) this.#Y(n);
|
|
1997
|
+
else {
|
|
1998
|
+
this.#I(s);
|
|
1999
|
+
let i = this.#t[s];
|
|
2000
|
+
if (this.#e(i) ? i.__abortController.abort(new Error("deleted")) : (this.#C || this.#d) && (this.#C && this.#p?.(i, e, n), this.#d && this.#r?.push([i, e, n])), this.#o.delete(e), this.#n[s] = void 0, this.#t[s] = void 0, s === this.#i) this.#i = this.#f[s];
|
|
2001
|
+
else if (s === this.#c) this.#c = this.#l[s];
|
|
2002
|
+
else {
|
|
2003
|
+
let r = this.#f[s];
|
|
2004
|
+
this.#l[r] = this.#l[s];
|
|
2005
|
+
let a = this.#l[s];
|
|
2006
|
+
this.#f[a] = this.#f[s];
|
|
2007
|
+
}
|
|
2008
|
+
this.#s--, this.#v.push(s);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
if (this.#d && this.#r?.length) {
|
|
2012
|
+
let s = this.#r, i;
|
|
2013
|
+
for (; i = s?.shift(); ) this.#y?.(...i);
|
|
2014
|
+
}
|
|
2015
|
+
return o;
|
|
2016
|
+
}
|
|
2017
|
+
clear() {
|
|
2018
|
+
return this.#Y("delete");
|
|
2019
|
+
}
|
|
2020
|
+
#Y(e) {
|
|
2021
|
+
for (let n of this.#E({ allowStale: !0 })) {
|
|
2022
|
+
let o = this.#t[n];
|
|
2023
|
+
if (this.#e(o)) o.__abortController.abort(new Error("deleted"));
|
|
2024
|
+
else {
|
|
2025
|
+
let s = this.#n[n];
|
|
2026
|
+
this.#C && this.#p?.(o, s, e), this.#d && this.#r?.push([o, s, e]);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
if (this.#o.clear(), this.#t.fill(void 0), this.#n.fill(void 0), this.#h && this.#A) {
|
|
2030
|
+
this.#h.fill(0), this.#A.fill(0);
|
|
2031
|
+
for (let n of this.#m ?? []) n !== void 0 && clearTimeout(n);
|
|
2032
|
+
this.#m?.fill(void 0);
|
|
2033
|
+
}
|
|
2034
|
+
if (this.#S && this.#S.fill(0), this.#c = 0, this.#i = 0, this.#v.length = 0, this.#_ = 0, this.#s = 0, this.#d && this.#r) {
|
|
2035
|
+
let n = this.#r, o;
|
|
2036
|
+
for (; o = n?.shift(); ) this.#y?.(...o);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
const pn = 50 * 1024 * 1024, tt = new gn({
|
|
2041
|
+
maxSize: pn,
|
|
2042
|
+
sizeCalculation: (t) => JSON.stringify(t.data).length
|
|
2043
|
+
}), F = {
|
|
2044
|
+
get(t) {
|
|
2045
|
+
return tt.get(t);
|
|
2046
|
+
},
|
|
2047
|
+
set(t, e) {
|
|
2048
|
+
tt.set(t, { data: e, storedAt: Date.now() });
|
|
2049
|
+
},
|
|
2050
|
+
delete(t) {
|
|
2051
|
+
tt.delete(t);
|
|
2052
|
+
},
|
|
2053
|
+
clear() {
|
|
2054
|
+
tt.clear();
|
|
2055
|
+
},
|
|
2056
|
+
get size() {
|
|
2057
|
+
return tt.size;
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
let G = null;
|
|
2061
|
+
function so(t) {
|
|
2062
|
+
G = t;
|
|
2063
|
+
}
|
|
2064
|
+
const yn = {
|
|
2065
|
+
competitions: { staleTTL: 24 * 3600, maxTTL: 72 * 3600 },
|
|
2066
|
+
teams: { staleTTL: 24 * 3600, maxTTL: 48 * 3600 },
|
|
2067
|
+
athletes: { staleTTL: 24 * 3600, maxTTL: 48 * 3600 },
|
|
2068
|
+
venues: { staleTTL: 72 * 3600, maxTTL: 168 * 3600 },
|
|
2069
|
+
countries: { staleTTL: 96 * 3600, maxTTL: 168 * 3600 },
|
|
2070
|
+
coaches: { staleTTL: 24 * 3600, maxTTL: 48 * 3600 },
|
|
2071
|
+
search: { staleTTL: 300, maxTTL: 1800 }
|
|
2072
|
+
}, pt = /* @__PURE__ */ new Set();
|
|
2073
|
+
function Bt(t) {
|
|
2074
|
+
const e = yn[t];
|
|
2075
|
+
if (!e)
|
|
2076
|
+
throw new Error(`Unknown entity type: ${t}`);
|
|
2077
|
+
return e;
|
|
2078
|
+
}
|
|
2079
|
+
function ft(t, e) {
|
|
2080
|
+
return Date.now() - t.storedAt < e * 1e3;
|
|
2081
|
+
}
|
|
2082
|
+
function ht(t, e) {
|
|
2083
|
+
return Date.now() - t.storedAt >= e * 1e3;
|
|
2084
|
+
}
|
|
2085
|
+
function mt(t, e, n) {
|
|
2086
|
+
pt.has(t) || (pt.add(t), n().then((o) => {
|
|
2087
|
+
F.set(t, o), G?.isInitialized && G.set(t, e, o);
|
|
2088
|
+
}).catch((o) => {
|
|
2089
|
+
console.error(`[cache] Background refresh failed for ${t}:`, o);
|
|
2090
|
+
}).finally(() => {
|
|
2091
|
+
pt.delete(t);
|
|
2092
|
+
}));
|
|
2093
|
+
}
|
|
2094
|
+
async function q(t, e, n) {
|
|
2095
|
+
const { staleTTL: o, maxTTL: s } = Bt(e), i = F.get(t);
|
|
2096
|
+
if (i) {
|
|
2097
|
+
if (ft(i, o))
|
|
2098
|
+
return i.data;
|
|
2099
|
+
if (!ht(i, s))
|
|
2100
|
+
return mt(t, e, n), i.data;
|
|
2101
|
+
}
|
|
2102
|
+
if (G?.isInitialized) {
|
|
2103
|
+
const a = G.get(t);
|
|
2104
|
+
if (a && !ht(a, s))
|
|
2105
|
+
return F.set(t, a.data), ft(a, o) || mt(t, e, n), a.data;
|
|
2106
|
+
}
|
|
2107
|
+
const r = await n();
|
|
2108
|
+
return F.set(t, r), G?.isInitialized && G.set(t, e, r), r;
|
|
2109
|
+
}
|
|
2110
|
+
async function Tn(t, e, n, o) {
|
|
2111
|
+
const { staleTTL: s, maxTTL: i } = Bt(e), r = /* @__PURE__ */ new Map(), a = [];
|
|
2112
|
+
for (const c of t) {
|
|
2113
|
+
const d = o(c);
|
|
2114
|
+
let f = !1;
|
|
2115
|
+
const l = F.get(d);
|
|
2116
|
+
if (l && !ht(l, i) && (r.set(c, l.data), ft(l, s) || mt(d, e, async () => {
|
|
2117
|
+
const h = (await n([c])).get(c);
|
|
2118
|
+
if (!h) throw new Error(`Batch fetcher did not return ID: ${c}`);
|
|
2119
|
+
return h;
|
|
2120
|
+
}), f = !0), !f && G?.isInitialized) {
|
|
2121
|
+
const u = G.get(d);
|
|
2122
|
+
u && !ht(u, i) && (F.set(d, u.data), r.set(c, u.data), ft(u, s) || mt(d, e, async () => {
|
|
2123
|
+
const p = (await n([c])).get(c);
|
|
2124
|
+
if (!p) throw new Error(`Batch fetcher did not return ID: ${c}`);
|
|
2125
|
+
return p;
|
|
2126
|
+
}), f = !0);
|
|
2127
|
+
}
|
|
2128
|
+
f || a.push(c);
|
|
2129
|
+
}
|
|
2130
|
+
if (a.length > 0) {
|
|
2131
|
+
const c = await n(a);
|
|
2132
|
+
for (const [d, f] of c) {
|
|
2133
|
+
const l = o(d);
|
|
2134
|
+
F.set(l, f), G?.isInitialized && G.set(l, e, f), r.set(d, f);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
return r;
|
|
2138
|
+
}
|
|
2139
|
+
function io(t) {
|
|
2140
|
+
F.delete(t);
|
|
2141
|
+
}
|
|
2142
|
+
function x(t, e, n, o) {
|
|
2143
|
+
const s = e.toUpperCase(), i = t.find((r) => r.language.toUpperCase() === s);
|
|
2144
|
+
if (i)
|
|
2145
|
+
return {
|
|
2146
|
+
name: i.name,
|
|
2147
|
+
shortName: i.short_name ?? o ?? void 0
|
|
2148
|
+
};
|
|
2149
|
+
if (s !== "EN") {
|
|
2150
|
+
const r = t.find((a) => a.language.toUpperCase() === "EN");
|
|
2151
|
+
if (r)
|
|
2152
|
+
return {
|
|
2153
|
+
name: r.name,
|
|
2154
|
+
shortName: r.short_name ?? o ?? void 0
|
|
2155
|
+
};
|
|
2156
|
+
}
|
|
2157
|
+
return {
|
|
2158
|
+
name: n,
|
|
2159
|
+
shortName: o ?? void 0
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
function Q(t) {
|
|
2163
|
+
const e = {};
|
|
2164
|
+
for (const n of t)
|
|
2165
|
+
e[n.key.toLowerCase()] = n.value;
|
|
2166
|
+
return e;
|
|
2167
|
+
}
|
|
2168
|
+
function K(t) {
|
|
2169
|
+
if (!t) return;
|
|
2170
|
+
const e = {};
|
|
2171
|
+
return t.primary_color && (e.primaryColor = t.primary_color), t.secondary_color && (e.secondaryColor = t.secondary_color), t.text_color && (e.textColor = t.text_color), t.background_color && (e.backgroundColor = t.background_color), t.background_gradient_from_color && (e.backgroundGradientFromColor = t.background_gradient_from_color), t.background_gradient_to_color && (e.backgroundGradientToColor = t.background_gradient_to_color), t.background_image && (e.backgroundImage = t.background_image), Object.keys(e).length > 0 ? e : void 0;
|
|
2172
|
+
}
|
|
2173
|
+
function X(t) {
|
|
2174
|
+
return t.map((e) => ({ provider: e.provider, id: e.id }));
|
|
2175
|
+
}
|
|
2176
|
+
function _n(t, e) {
|
|
2177
|
+
return t.filter((n) => n.relationship === e).map((n) => n.related_id);
|
|
2178
|
+
}
|
|
2179
|
+
function H(t, e, n) {
|
|
2180
|
+
const o = t || _n(e, "COUNTRY")[0];
|
|
2181
|
+
if (!o) return;
|
|
2182
|
+
const s = F.get(o) ?? F.get(`entity:${o}`);
|
|
2183
|
+
if (s?.data) {
|
|
2184
|
+
const i = s.data;
|
|
2185
|
+
return st(i, n);
|
|
2186
|
+
}
|
|
2187
|
+
return { id: o, name: o };
|
|
2188
|
+
}
|
|
2189
|
+
function st(t, e) {
|
|
2190
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []);
|
|
2191
|
+
return {
|
|
2192
|
+
id: t.id,
|
|
2193
|
+
name: n,
|
|
2194
|
+
...t.country_code ? { code: t.country_code } : {},
|
|
2195
|
+
...s.flag ? { flag: s.flag } : {},
|
|
2196
|
+
...o ? { shortName: o } : {}
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
function At(t, e) {
|
|
2200
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.branding), r = H(null, t.related ?? [], e);
|
|
2201
|
+
return {
|
|
2202
|
+
id: t.id,
|
|
2203
|
+
name: n,
|
|
2204
|
+
sport: t.sport,
|
|
2205
|
+
...o ? { shortName: o } : {},
|
|
2206
|
+
...t.format ? { type: t.format } : {},
|
|
2207
|
+
...r ? { country: r } : {},
|
|
2208
|
+
...s.logo ? { assets: { logo: s.logo } } : {},
|
|
2209
|
+
...i ? { metadata: { branding: i } } : {}
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
function nt(t, e) {
|
|
2213
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.metadata?.branding), r = H(t.country_id, t.related ?? [], e);
|
|
2214
|
+
return {
|
|
2215
|
+
id: t.id,
|
|
2216
|
+
name: n,
|
|
2217
|
+
sport: t.sport,
|
|
2218
|
+
...o ? { shortName: o } : {},
|
|
2219
|
+
...t.three_letter_code ? { threeLetterCode: t.three_letter_code } : {},
|
|
2220
|
+
...t.full_name ? { fullName: t.full_name } : {},
|
|
2221
|
+
...t.nickname ? { nickname: t.nickname } : {},
|
|
2222
|
+
...t.gender ? { gender: t.gender } : {},
|
|
2223
|
+
...r ? { country: r } : {},
|
|
2224
|
+
...s.logo ? { assets: { logo: s.logo } } : {},
|
|
2225
|
+
...i ? { metadata: { branding: i } } : {}
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
function Wt(t, e) {
|
|
2229
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.metadata?.branding), r = H(t.country_id, t.related ?? [], e);
|
|
2230
|
+
return {
|
|
2231
|
+
id: t.id,
|
|
2232
|
+
name: n,
|
|
2233
|
+
sport: t.sport,
|
|
2234
|
+
type: "player",
|
|
2235
|
+
...o ? { shortName: o } : {},
|
|
2236
|
+
...t.position ? { position: t.position } : {},
|
|
2237
|
+
...t.birth_date ? { birthdate: t.birth_date } : {},
|
|
2238
|
+
...t.shirt_number != null ? { shirtNumber: t.shirt_number } : {},
|
|
2239
|
+
...t.gender ? { gender: t.gender } : {},
|
|
2240
|
+
...r ? { country: r } : {},
|
|
2241
|
+
...s.logo || s.headshot ? { assets: { ...s.logo ? { logo: s.logo } : {}, ...s.headshot ? { photo: s.headshot } : {} } } : {},
|
|
2242
|
+
...i ? { metadata: { branding: i } } : {}
|
|
2243
|
+
};
|
|
2244
|
+
}
|
|
2245
|
+
function zt(t, e) {
|
|
2246
|
+
const { name: n } = x(t.translations ?? [], e, t.name, t.short_name), o = H(t.country_id, t.related ?? [], e), s = t.capacity != null || t.latitude != null || t.longitude != null;
|
|
2247
|
+
return {
|
|
2248
|
+
id: t.id,
|
|
2249
|
+
name: n,
|
|
2250
|
+
sport: t.sport,
|
|
2251
|
+
...o ? { country: o } : {},
|
|
2252
|
+
...s ? {
|
|
2253
|
+
profile: {
|
|
2254
|
+
...t.capacity != null ? { capacity: t.capacity } : {},
|
|
2255
|
+
...t.latitude != null ? { latitude: t.latitude } : {},
|
|
2256
|
+
...t.longitude != null ? { longitude: t.longitude } : {}
|
|
2257
|
+
}
|
|
2258
|
+
} : {}
|
|
2259
|
+
};
|
|
2260
|
+
}
|
|
2261
|
+
function vn(t, e) {
|
|
2262
|
+
const { name: n } = x(t.translations ?? [], e, t.name, t.short_name), o = H(t.country_id, t.related ?? [], e);
|
|
2263
|
+
return {
|
|
2264
|
+
id: t.id,
|
|
2265
|
+
name: n,
|
|
2266
|
+
sport: t.sport,
|
|
2267
|
+
...t.birth_date ? { birthdate: t.birth_date } : {},
|
|
2268
|
+
...o ? { country: o } : {}
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
function Sn(t, e, n) {
|
|
2272
|
+
const o = F.get(t) ?? F.get(`entity:${t}`);
|
|
2273
|
+
if (!o?.data) return;
|
|
2274
|
+
const s = o.data;
|
|
2275
|
+
switch (e) {
|
|
2276
|
+
case "COMPETITION":
|
|
2277
|
+
return At(s, n);
|
|
2278
|
+
case "TEAM":
|
|
2279
|
+
return nt(s, n);
|
|
2280
|
+
case "ATHLETE":
|
|
2281
|
+
return Wt(s, n);
|
|
2282
|
+
case "COUNTRY":
|
|
2283
|
+
return st(s, n);
|
|
2284
|
+
default:
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
function it(t, e) {
|
|
2289
|
+
if (!t || t.length === 0) return;
|
|
2290
|
+
const n = {};
|
|
2291
|
+
for (const o of t) {
|
|
2292
|
+
const s = Sn(o.related_id, o.relationship, e);
|
|
2293
|
+
if (s)
|
|
2294
|
+
switch (o.relationship) {
|
|
2295
|
+
case "COMPETITION":
|
|
2296
|
+
(n.competitions ??= []).push(s);
|
|
2297
|
+
break;
|
|
2298
|
+
case "TEAM":
|
|
2299
|
+
(n.teams ??= []).push(s);
|
|
2300
|
+
break;
|
|
2301
|
+
case "ATHLETE":
|
|
2302
|
+
(n.athletes ??= []).push(s);
|
|
2303
|
+
break;
|
|
2304
|
+
case "COUNTRY":
|
|
2305
|
+
(n.countries ??= []).push(s);
|
|
2306
|
+
break;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
return Object.keys(n).length > 0 ? n : void 0;
|
|
2310
|
+
}
|
|
2311
|
+
function An(t, e) {
|
|
2312
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.branding), r = H(null, t.related ?? [], e), a = it(t.related ?? [], e);
|
|
2313
|
+
return {
|
|
2314
|
+
id: t.id,
|
|
2315
|
+
name: n,
|
|
2316
|
+
sport: t.sport,
|
|
2317
|
+
...o ? { shortName: o } : {},
|
|
2318
|
+
...t.format ? { type: t.format } : {},
|
|
2319
|
+
...t.gender ? { gender: t.gender } : {},
|
|
2320
|
+
...r ? { country: r } : {},
|
|
2321
|
+
...s.logo ? { assets: { logo: s.logo } } : {},
|
|
2322
|
+
...i ? { metadata: { branding: i } } : {},
|
|
2323
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {},
|
|
2324
|
+
...a ? { related: a } : {}
|
|
2325
|
+
};
|
|
2326
|
+
}
|
|
2327
|
+
function Lt(t, e) {
|
|
2328
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.metadata?.branding), r = H(t.country_id, t.related ?? [], e), a = it(t.related ?? [], e);
|
|
2329
|
+
return {
|
|
2330
|
+
id: t.id,
|
|
2331
|
+
name: n,
|
|
2332
|
+
sport: t.sport,
|
|
2333
|
+
...o ? { shortName: o } : {},
|
|
2334
|
+
...t.three_letter_code ? { threeLetterCode: t.three_letter_code } : {},
|
|
2335
|
+
...t.full_name ? { fullName: t.full_name } : {},
|
|
2336
|
+
...t.nickname ? { nickname: t.nickname } : {},
|
|
2337
|
+
...t.gender ? { gender: t.gender } : {},
|
|
2338
|
+
...r ? { country: r } : {},
|
|
2339
|
+
...s.logo ? { assets: { logo: s.logo } } : {},
|
|
2340
|
+
...i ? { metadata: { branding: i } } : {},
|
|
2341
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {},
|
|
2342
|
+
...a ? { related: a } : {}
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
function Cn(t, e) {
|
|
2346
|
+
const { name: n, shortName: o } = x(t.translations ?? [], e, t.name, t.short_name), s = Q(t.assets ?? []), i = K(t.metadata?.branding), r = H(t.country_id, t.related ?? [], e), a = it(t.related ?? [], e);
|
|
2347
|
+
return {
|
|
2348
|
+
id: t.id,
|
|
2349
|
+
name: n,
|
|
2350
|
+
sport: t.sport,
|
|
2351
|
+
type: "player",
|
|
2352
|
+
...o ? { shortName: o } : {},
|
|
2353
|
+
...t.position ? { position: t.position } : {},
|
|
2354
|
+
...t.birth_date ? { birthdate: t.birth_date } : {},
|
|
2355
|
+
...t.shirt_number != null ? { shirtNumber: t.shirt_number } : {},
|
|
2356
|
+
...t.gender ? { gender: t.gender } : {},
|
|
2357
|
+
...r ? { country: r } : {},
|
|
2358
|
+
...s.logo || s.headshot ? { assets: { ...s.logo ? { logo: s.logo } : {}, ...s.headshot ? { photo: s.headshot } : {} } } : {},
|
|
2359
|
+
...i ? { metadata: { branding: i } } : {},
|
|
2360
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {},
|
|
2361
|
+
...a ? { related: a } : {}
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2364
|
+
function On(t, e) {
|
|
2365
|
+
return {
|
|
2366
|
+
...st(t, e),
|
|
2367
|
+
sport: t.sport,
|
|
2368
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {}
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
function En(t, e) {
|
|
2372
|
+
const { name: n } = x(t.translations ?? [], e, t.name, t.short_name), o = H(t.country_id, t.related ?? [], e), s = it(t.related ?? [], e), i = t.capacity != null || t.latitude != null || t.longitude != null;
|
|
2373
|
+
return {
|
|
2374
|
+
id: t.id,
|
|
2375
|
+
name: n,
|
|
2376
|
+
sport: t.sport,
|
|
2377
|
+
...o ? { country: o } : {},
|
|
2378
|
+
...i ? {
|
|
2379
|
+
profile: {
|
|
2380
|
+
...t.capacity != null ? { capacity: t.capacity } : {},
|
|
2381
|
+
...t.latitude != null ? { latitude: t.latitude } : {},
|
|
2382
|
+
...t.longitude != null ? { longitude: t.longitude } : {}
|
|
2383
|
+
}
|
|
2384
|
+
} : {},
|
|
2385
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {},
|
|
2386
|
+
...s ? { related: s } : {}
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
function Fn(t, e) {
|
|
2390
|
+
const { name: n } = x(t.translations ?? [], e, t.name, t.short_name), o = H(t.country_id, t.related ?? [], e), s = it(t.related ?? [], e);
|
|
2391
|
+
return {
|
|
2392
|
+
id: t.id,
|
|
2393
|
+
name: n,
|
|
2394
|
+
sport: t.sport,
|
|
2395
|
+
...t.birth_date ? { birthdate: t.birth_date } : {},
|
|
2396
|
+
...o ? { country: o } : {},
|
|
2397
|
+
...t.provider_ref?.length ? { providerRef: X(t.provider_ref) } : {},
|
|
2398
|
+
...s ? { related: s } : {}
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
function Yt(t, e) {
|
|
2402
|
+
const n = t.content_type?.toUpperCase?.(), o = t.type?.toUpperCase?.(), s = t.entityType?.toLowerCase?.();
|
|
2403
|
+
return n === "COMPETITION" || s === "competition" ? { ...An(t, e), entityType: "competition" } : s === "country" || t.country_code !== void 0 ? { ...On(t, e), entityType: "country" } : s === "venue" || t.capacity !== void 0 && !s ? { ...En(t, e), entityType: "venue" } : s === "coach" || o === "COACH" ? { ...Fn(t, e), entityType: "coach" } : s === "athlete" || o === "PLAYER" || t.position !== void 0 || t.shirt_number !== void 0 ? { ...Cn(t, e), entityType: "athlete" } : s === "team" || o === "TEAM" || t.three_letter_code !== void 0 ? { ...Lt(t, e), entityType: "team" } : { ...Lt(t, e), entityType: "team" };
|
|
2404
|
+
}
|
|
2405
|
+
function Ln(t, e) {
|
|
2406
|
+
const n = t.content_type?.toUpperCase?.(), o = t.type?.toUpperCase?.(), s = t.entityType?.toLowerCase?.();
|
|
2407
|
+
return n === "COMPETITION" || s === "competition" ? { ...At(t, e), entityType: "competition" } : s === "country" || t.country_code !== void 0 ? { ...st(t, e), entityType: "country" } : s === "venue" || t.capacity !== void 0 && !s ? { ...zt(t, e), entityType: "venue" } : s === "coach" || o === "COACH" ? { ...vn(t, e), entityType: "coach" } : s === "athlete" || o === "PLAYER" || t.position !== void 0 || t.shirt_number !== void 0 ? { ...Wt(t, e), entityType: "athlete" } : s === "team" || o === "TEAM" || t.three_letter_code !== void 0 ? { ...nt(t, e), entityType: "team" } : { ...nt(t, e), entityType: "team" };
|
|
2408
|
+
}
|
|
2409
|
+
function J(t) {
|
|
2410
|
+
const e = Object.entries(t).filter(([, o]) => o !== void 0).sort(([o], [s]) => o.localeCompare(s)).map(([o, s]) => `${o}=${Array.isArray(s) ? s.join(",") : s}`).join("&");
|
|
2411
|
+
let n = 0;
|
|
2412
|
+
for (let o = 0; o < e.length; o++)
|
|
2413
|
+
n = (n << 5) - n + e.charCodeAt(o) | 0;
|
|
2414
|
+
return n.toString(36);
|
|
2415
|
+
}
|
|
2416
|
+
function V(t) {
|
|
2417
|
+
for (const e of t)
|
|
2418
|
+
e.id && F.set(`entity:${e.id}`, e);
|
|
2419
|
+
}
|
|
2420
|
+
function Y(t) {
|
|
2421
|
+
if (t?.lang) return t.lang;
|
|
2422
|
+
if (ee()) {
|
|
2423
|
+
const e = b();
|
|
2424
|
+
if (e.fansUnited && "lang" in e.fansUnited && e.fansUnited.lang)
|
|
2425
|
+
return e.fansUnited.lang;
|
|
2426
|
+
}
|
|
2427
|
+
return "EN";
|
|
2428
|
+
}
|
|
2429
|
+
function bt(t) {
|
|
2430
|
+
const e = /* @__PURE__ */ new Set();
|
|
2431
|
+
for (const n of t) {
|
|
2432
|
+
const o = n, s = o.related;
|
|
2433
|
+
if (s)
|
|
2434
|
+
for (const r of s)
|
|
2435
|
+
F.get(`entity:${r.related_id}`) || e.add(r.related_id);
|
|
2436
|
+
const i = o.country_id;
|
|
2437
|
+
i && !F.get(`entity:${i}`) && e.add(i);
|
|
2438
|
+
}
|
|
2439
|
+
return e;
|
|
2440
|
+
}
|
|
2441
|
+
async function _t(t, e) {
|
|
2442
|
+
if (t.size === 0) return [];
|
|
2443
|
+
const n = await B.get({
|
|
2444
|
+
path: "/v1/entities/search",
|
|
2445
|
+
params: { ids: Array.from(t) },
|
|
2446
|
+
next: e?.next,
|
|
2447
|
+
config: e?.config
|
|
1515
2448
|
});
|
|
1516
|
-
return n.
|
|
2449
|
+
return V(n.data), n.data;
|
|
2450
|
+
}
|
|
2451
|
+
async function jt(t, e) {
|
|
2452
|
+
const n = bt(t);
|
|
2453
|
+
if (n.size !== 0)
|
|
2454
|
+
try {
|
|
2455
|
+
const o = await _t(n, e), s = bt(o);
|
|
2456
|
+
s.size > 0 && await _t(s, e);
|
|
2457
|
+
} catch {
|
|
2458
|
+
}
|
|
1517
2459
|
}
|
|
1518
|
-
function
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1521
|
-
|
|
2460
|
+
async function rt(t, e) {
|
|
2461
|
+
const n = /* @__PURE__ */ new Set();
|
|
2462
|
+
for (const o of t) {
|
|
2463
|
+
const s = o, i = s.country_id;
|
|
2464
|
+
i && !F.get(`entity:${i}`) && n.add(i);
|
|
2465
|
+
const r = s.related;
|
|
2466
|
+
if (r)
|
|
2467
|
+
for (const a of r)
|
|
2468
|
+
a.relationship === "COUNTRY" && !F.get(`entity:${a.related_id}`) && n.add(a.related_id);
|
|
2469
|
+
}
|
|
2470
|
+
if (n.size !== 0)
|
|
2471
|
+
try {
|
|
2472
|
+
await _t(n, e);
|
|
2473
|
+
} catch {
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
async function ro(t = {}, e) {
|
|
2477
|
+
const n = Y(t), o = {
|
|
2478
|
+
query: t.query,
|
|
2479
|
+
content_type: t.contentType,
|
|
2480
|
+
ids: t.ids,
|
|
2481
|
+
limit: t.limit?.toString(),
|
|
2482
|
+
page: t.page?.toString(),
|
|
2483
|
+
mode: t.mode,
|
|
2484
|
+
sport: t.sport,
|
|
2485
|
+
relationship: t.relationship,
|
|
2486
|
+
value: t.value
|
|
2487
|
+
}, s = `search:entities:${J(o)}`, i = await q(
|
|
2488
|
+
s,
|
|
2489
|
+
"search",
|
|
2490
|
+
() => B.get({
|
|
2491
|
+
path: "/v1/entities/search",
|
|
2492
|
+
params: o,
|
|
2493
|
+
next: t.next || e?.next,
|
|
2494
|
+
config: t.config
|
|
2495
|
+
})
|
|
2496
|
+
);
|
|
2497
|
+
return V(i.data), await rt(i.data, { next: t.next || e?.next, config: t.config }), { data: i.data.map(
|
|
2498
|
+
(a) => Ln(a, n)
|
|
2499
|
+
), pagination: i.meta.pagination };
|
|
2500
|
+
}
|
|
2501
|
+
async function ao(t, e) {
|
|
2502
|
+
const n = Y(e), o = `entity:${t}`, s = await q(o, "search", async () => {
|
|
2503
|
+
const i = await B.get({
|
|
2504
|
+
path: "/v1/entities/search",
|
|
2505
|
+
params: { ids: [t] },
|
|
2506
|
+
next: e?.next,
|
|
2507
|
+
config: e?.config
|
|
2508
|
+
});
|
|
2509
|
+
if (!i.data || i.data.length === 0)
|
|
2510
|
+
throw new Error(`Entity not found: ${t}`);
|
|
2511
|
+
return i.data[0];
|
|
1522
2512
|
});
|
|
1523
|
-
return
|
|
2513
|
+
return await jt([s], { next: e?.next, config: e?.config }), Yt(s, n);
|
|
1524
2514
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
2515
|
+
async function co(t, e) {
|
|
2516
|
+
if (t.length === 0) return [];
|
|
2517
|
+
const n = Y(e), o = await Tn(
|
|
2518
|
+
t,
|
|
2519
|
+
"search",
|
|
2520
|
+
async (i) => {
|
|
2521
|
+
const r = await B.get({
|
|
2522
|
+
path: "/v1/entities/search",
|
|
2523
|
+
params: { ids: i },
|
|
2524
|
+
next: e?.next,
|
|
2525
|
+
config: e?.config
|
|
2526
|
+
}), a = /* @__PURE__ */ new Map();
|
|
2527
|
+
for (const c of r.data)
|
|
2528
|
+
a.set(c.id, c);
|
|
2529
|
+
return a;
|
|
2530
|
+
},
|
|
2531
|
+
(i) => `entity:${i}`
|
|
2532
|
+
), s = t.map((i) => o.get(i)).filter((i) => i !== void 0);
|
|
2533
|
+
return await jt(s, { next: e?.next, config: e?.config }), s.map((i) => Yt(i, n));
|
|
2534
|
+
}
|
|
2535
|
+
async function lo(t = {}) {
|
|
2536
|
+
const e = Y(t), n = {
|
|
2537
|
+
content_type: "competition",
|
|
2538
|
+
query: t.query,
|
|
2539
|
+
limit: t.limit?.toString(),
|
|
2540
|
+
page: t.page?.toString(),
|
|
2541
|
+
sport: t.sport
|
|
2542
|
+
}, o = `competitions:${J(n)}`, s = await q(
|
|
2543
|
+
o,
|
|
2544
|
+
"competitions",
|
|
2545
|
+
() => B.get({
|
|
2546
|
+
path: "/v1/entities/search",
|
|
2547
|
+
params: n,
|
|
2548
|
+
next: t.next,
|
|
2549
|
+
config: t.config
|
|
2550
|
+
})
|
|
2551
|
+
);
|
|
2552
|
+
return V(s.data), await rt(s.data, { next: t.next, config: t.config }), { data: s.data.map((r) => At(r, e)), pagination: s.meta.pagination };
|
|
2553
|
+
}
|
|
2554
|
+
async function uo(t, e = {}) {
|
|
2555
|
+
const n = Y(e), o = {
|
|
2556
|
+
content_type: "team",
|
|
2557
|
+
relationship: "COUNTRY",
|
|
2558
|
+
value: t,
|
|
2559
|
+
query: e.query,
|
|
2560
|
+
limit: e.limit?.toString(),
|
|
2561
|
+
page: e.page?.toString(),
|
|
2562
|
+
sport: e.sport
|
|
2563
|
+
}, s = `teams:country:${t}:${J(o)}`, i = await q(
|
|
2564
|
+
s,
|
|
2565
|
+
"teams",
|
|
2566
|
+
() => B.get({
|
|
2567
|
+
path: "/v1/entities/search",
|
|
2568
|
+
params: o,
|
|
2569
|
+
next: e.next,
|
|
2570
|
+
config: e.config
|
|
2571
|
+
})
|
|
2572
|
+
);
|
|
2573
|
+
return V(i.data), await rt(i.data, { next: e.next, config: e.config }), { data: i.data.map((a) => nt(a, n)), pagination: i.meta.pagination };
|
|
2574
|
+
}
|
|
2575
|
+
async function fo(t, e = {}) {
|
|
2576
|
+
const n = Y(e), o = {
|
|
2577
|
+
content_type: "team",
|
|
2578
|
+
relationship: "COMPETITION",
|
|
2579
|
+
value: t,
|
|
2580
|
+
query: e.query,
|
|
2581
|
+
limit: e.limit?.toString(),
|
|
2582
|
+
page: e.page?.toString(),
|
|
2583
|
+
sport: e.sport
|
|
2584
|
+
}, s = `teams:competition:${t}:${J(o)}`, i = await q(
|
|
2585
|
+
s,
|
|
2586
|
+
"teams",
|
|
2587
|
+
() => B.get({
|
|
2588
|
+
path: "/v1/entities/search",
|
|
2589
|
+
params: o,
|
|
2590
|
+
next: e.next,
|
|
2591
|
+
config: e.config
|
|
2592
|
+
})
|
|
2593
|
+
);
|
|
2594
|
+
return V(i.data), await rt(i.data, { next: e.next, config: e.config }), { data: i.data.map((a) => nt(a, n)), pagination: i.meta.pagination };
|
|
2595
|
+
}
|
|
2596
|
+
async function ho(t = {}) {
|
|
2597
|
+
const e = Y(t), n = {
|
|
2598
|
+
content_type: "country",
|
|
2599
|
+
query: t.query,
|
|
2600
|
+
limit: t.limit?.toString(),
|
|
2601
|
+
page: t.page?.toString(),
|
|
2602
|
+
sport: t.sport
|
|
2603
|
+
}, o = `countries:${J(n)}`, s = await q(
|
|
2604
|
+
o,
|
|
2605
|
+
"countries",
|
|
2606
|
+
() => B.get({
|
|
2607
|
+
path: "/v1/entities/search",
|
|
2608
|
+
params: n,
|
|
2609
|
+
next: t.next,
|
|
2610
|
+
config: t.config
|
|
2611
|
+
})
|
|
2612
|
+
);
|
|
2613
|
+
return V(s.data), { data: s.data.map((r) => st(r, e)), pagination: s.meta.pagination };
|
|
2614
|
+
}
|
|
2615
|
+
async function mo(t = {}) {
|
|
2616
|
+
const e = Y(t), n = {
|
|
2617
|
+
content_type: "venue",
|
|
2618
|
+
query: t.query,
|
|
2619
|
+
limit: t.limit?.toString(),
|
|
2620
|
+
page: t.page?.toString(),
|
|
2621
|
+
sport: t.sport
|
|
2622
|
+
}, o = `venues:${J(n)}`, s = await q(
|
|
2623
|
+
o,
|
|
2624
|
+
"venues",
|
|
2625
|
+
() => B.get({
|
|
2626
|
+
path: "/v1/entities/search",
|
|
2627
|
+
params: n,
|
|
2628
|
+
next: t.next,
|
|
2629
|
+
config: t.config
|
|
2630
|
+
})
|
|
2631
|
+
);
|
|
2632
|
+
return V(s.data), await rt(s.data, { next: t.next, config: t.config }), { data: s.data.map((r) => zt(r, e)), pagination: s.meta.pagination };
|
|
2633
|
+
}
|
|
2634
|
+
function go(t) {
|
|
2635
|
+
return !t.seasons || t.seasons.length === 0 ? void 0 : t.seasons.find((n) => n.active) ?? t.seasons[0];
|
|
2636
|
+
}
|
|
2637
|
+
function po(t, e) {
|
|
2638
|
+
const n = /* @__PURE__ */ new Date(), o = e.filter((s) => {
|
|
2639
|
+
const i = s.competitorOne.id === t || s.competitorTwo.id === t, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= n;
|
|
2640
|
+
return i && r && a;
|
|
2641
|
+
});
|
|
2642
|
+
return o.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), o[0];
|
|
2643
|
+
}
|
|
2644
|
+
function yo(t, e) {
|
|
2645
|
+
const n = /* @__PURE__ */ new Date(), o = e.filter((s) => {
|
|
2646
|
+
const i = s.competitorOne.id === t || s.competitorTwo.id === t, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= n;
|
|
2647
|
+
return i && r && a;
|
|
2648
|
+
});
|
|
2649
|
+
return o.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), o[0];
|
|
2650
|
+
}
|
|
2651
|
+
function To(t, e) {
|
|
2652
|
+
const n = /* @__PURE__ */ new Date();
|
|
2653
|
+
return e.filter((s) => {
|
|
2654
|
+
const i = s.competitorOne.id === t || s.competitorTwo.id === t, r = s.status.type === "NOT_STARTED" || s.status.type === "LIVE", a = new Date(s.timing.kickoffTime) >= n || s.status.type === "LIVE";
|
|
2655
|
+
return i && r && a;
|
|
1530
2656
|
}).sort(
|
|
1531
2657
|
(s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
|
|
1532
2658
|
);
|
|
1533
2659
|
}
|
|
1534
|
-
function
|
|
1535
|
-
const
|
|
1536
|
-
return
|
|
1537
|
-
const i = s.competitorOne.id ===
|
|
1538
|
-
return i &&
|
|
2660
|
+
function _o(t, e) {
|
|
2661
|
+
const n = /* @__PURE__ */ new Date();
|
|
2662
|
+
return e.filter((s) => {
|
|
2663
|
+
const i = s.competitorOne.id === t || s.competitorTwo.id === t, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= n;
|
|
2664
|
+
return i && r && a;
|
|
1539
2665
|
}).sort(
|
|
1540
2666
|
(s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
|
|
1541
2667
|
);
|
|
1542
2668
|
}
|
|
1543
|
-
function
|
|
1544
|
-
const
|
|
1545
|
-
(
|
|
1546
|
-
), i =
|
|
1547
|
-
const
|
|
1548
|
-
(
|
|
2669
|
+
function vo(t, e, n) {
|
|
2670
|
+
const o = n.filter((r) => r.status.type === "FINISHED"), s = n.filter(
|
|
2671
|
+
(r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
|
|
2672
|
+
), i = e.entries.map((r) => {
|
|
2673
|
+
const a = r.competitor.id, c = o.filter(
|
|
2674
|
+
(u) => u.competitorOne.id === t && u.competitorTwo.id === a || u.competitorOne.id === a && u.competitorTwo.id === t
|
|
1549
2675
|
), d = s.filter(
|
|
1550
|
-
(
|
|
2676
|
+
(u) => u.competitorOne.id === t && u.competitorTwo.id === a || u.competitorOne.id === a && u.competitorTwo.id === t
|
|
1551
2677
|
);
|
|
1552
|
-
let
|
|
1553
|
-
return c.forEach((
|
|
1554
|
-
const
|
|
1555
|
-
let
|
|
1556
|
-
|
|
1557
|
-
const
|
|
1558
|
-
result:
|
|
1559
|
-
score: `${
|
|
1560
|
-
date:
|
|
1561
|
-
matchId:
|
|
2678
|
+
let f, l;
|
|
2679
|
+
return c.forEach((u) => {
|
|
2680
|
+
const h = u.competitorOne.id === t, p = parseInt(u.score?.competitorOne ?? "0"), y = parseInt(u.score?.competitorTwo ?? "0"), S = h ? p : y, g = h ? y : p;
|
|
2681
|
+
let T;
|
|
2682
|
+
S > g ? T = "W" : S === g ? T = "D" : T = "L";
|
|
2683
|
+
const A = {
|
|
2684
|
+
result: T,
|
|
2685
|
+
score: `${p} - ${y}`,
|
|
2686
|
+
date: u.timing.kickoffTime,
|
|
2687
|
+
matchId: u.id,
|
|
1562
2688
|
isUpcoming: !1
|
|
1563
2689
|
};
|
|
1564
|
-
|
|
1565
|
-
}), d.forEach((
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1568
|
-
date:
|
|
1569
|
-
matchId:
|
|
2690
|
+
h ? f = A : l = A;
|
|
2691
|
+
}), d.forEach((u) => {
|
|
2692
|
+
const h = u.competitorOne.id === t;
|
|
2693
|
+
h && !f ? f = {
|
|
2694
|
+
date: u.timing.kickoffTime,
|
|
2695
|
+
matchId: u.id,
|
|
1570
2696
|
isUpcoming: !0
|
|
1571
|
-
} : !
|
|
1572
|
-
date:
|
|
1573
|
-
matchId:
|
|
2697
|
+
} : !h && !l && (l = {
|
|
2698
|
+
date: u.timing.kickoffTime,
|
|
2699
|
+
matchId: u.id,
|
|
1574
2700
|
isUpcoming: !0
|
|
1575
2701
|
});
|
|
1576
2702
|
}), {
|
|
1577
|
-
rank:
|
|
1578
|
-
teamId:
|
|
1579
|
-
teamName:
|
|
1580
|
-
teamShortName:
|
|
1581
|
-
teamLogo:
|
|
1582
|
-
gamesPlayed:
|
|
1583
|
-
points:
|
|
1584
|
-
homeResult:
|
|
2703
|
+
rank: r.rank,
|
|
2704
|
+
teamId: r.competitor.id,
|
|
2705
|
+
teamName: r.competitor.name,
|
|
2706
|
+
teamShortName: r.competitor.shortName,
|
|
2707
|
+
teamLogo: r.competitor.logo,
|
|
2708
|
+
gamesPlayed: r.stats.played ?? 0,
|
|
2709
|
+
points: r.stats.points ?? 0,
|
|
2710
|
+
homeResult: f,
|
|
1585
2711
|
awayResult: l
|
|
1586
2712
|
};
|
|
1587
2713
|
});
|
|
1588
2714
|
return {
|
|
1589
|
-
teamId:
|
|
2715
|
+
teamId: t,
|
|
1590
2716
|
rows: i
|
|
1591
2717
|
};
|
|
1592
2718
|
}
|
|
1593
|
-
function
|
|
1594
|
-
return
|
|
1595
|
-
const s =
|
|
2719
|
+
function So(t, e = 10) {
|
|
2720
|
+
return t.players.filter((n) => (n.seasonStatistics?.goals ?? 0) > 0).sort((n, o) => {
|
|
2721
|
+
const s = n.seasonStatistics?.goals ?? 0, i = o.seasonStatistics?.goals ?? 0;
|
|
1596
2722
|
if (i !== s)
|
|
1597
2723
|
return i - s;
|
|
1598
|
-
const
|
|
1599
|
-
return (
|
|
1600
|
-
}).slice(0,
|
|
2724
|
+
const r = n.seasonStatistics?.assists ?? 0;
|
|
2725
|
+
return (o.seasonStatistics?.assists ?? 0) - r;
|
|
2726
|
+
}).slice(0, e);
|
|
1601
2727
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1604
|
-
const s =
|
|
2728
|
+
function Ao(t, e = 10) {
|
|
2729
|
+
return t.players.filter((n) => (n.seasonStatistics?.assists ?? 0) > 0).sort((n, o) => {
|
|
2730
|
+
const s = n.seasonStatistics?.assists ?? 0, i = o.seasonStatistics?.assists ?? 0;
|
|
1605
2731
|
if (i !== s)
|
|
1606
2732
|
return i - s;
|
|
1607
|
-
const
|
|
1608
|
-
return (
|
|
1609
|
-
}).slice(0,
|
|
2733
|
+
const r = n.seasonStatistics?.goals ?? 0;
|
|
2734
|
+
return (o.seasonStatistics?.goals ?? 0) - r;
|
|
2735
|
+
}).slice(0, e);
|
|
1610
2736
|
}
|
|
1611
|
-
function
|
|
1612
|
-
return
|
|
1613
|
-
const s =
|
|
2737
|
+
function Co(t, e = 10) {
|
|
2738
|
+
return t.players.filter((n) => (n.seasonStatistics?.appearances ?? 0) > 0).sort((n, o) => {
|
|
2739
|
+
const s = n.seasonStatistics?.appearances ?? 0, i = o.seasonStatistics?.appearances ?? 0;
|
|
1614
2740
|
if (i !== s)
|
|
1615
2741
|
return i - s;
|
|
1616
|
-
const
|
|
1617
|
-
return (
|
|
1618
|
-
}).slice(0,
|
|
2742
|
+
const r = n.seasonStatistics?.minutes ?? 0;
|
|
2743
|
+
return (o.seasonStatistics?.minutes ?? 0) - r;
|
|
2744
|
+
}).slice(0, e);
|
|
1619
2745
|
}
|
|
1620
|
-
function
|
|
1621
|
-
return
|
|
1622
|
-
const s =
|
|
2746
|
+
function Oo(t, e = 10) {
|
|
2747
|
+
return t.players.filter((n) => (n.seasonStatistics?.minutes ?? 0) > 0).sort((n, o) => {
|
|
2748
|
+
const s = n.seasonStatistics?.minutes ?? 0, i = o.seasonStatistics?.minutes ?? 0;
|
|
1623
2749
|
if (i !== s)
|
|
1624
2750
|
return i - s;
|
|
1625
|
-
const
|
|
1626
|
-
return (
|
|
1627
|
-
}).slice(0,
|
|
2751
|
+
const r = n.seasonStatistics?.appearances ?? 0;
|
|
2752
|
+
return (o.seasonStatistics?.appearances ?? 0) - r;
|
|
2753
|
+
}).slice(0, e);
|
|
1628
2754
|
}
|
|
1629
|
-
function
|
|
1630
|
-
return
|
|
1631
|
-
const s =
|
|
2755
|
+
function Eo(t, e = 10) {
|
|
2756
|
+
return t.players.filter((n) => (n.seasonStatistics?.cleansheets ?? 0) > 0).sort((n, o) => {
|
|
2757
|
+
const s = n.seasonStatistics?.cleansheets ?? 0, i = o.seasonStatistics?.cleansheets ?? 0;
|
|
1632
2758
|
if (i !== s)
|
|
1633
2759
|
return i - s;
|
|
1634
|
-
const
|
|
1635
|
-
return (
|
|
1636
|
-
}).slice(0,
|
|
1637
|
-
}
|
|
1638
|
-
function
|
|
1639
|
-
return
|
|
1640
|
-
const
|
|
1641
|
-
return
|
|
1642
|
-
}).sort((
|
|
1643
|
-
const s =
|
|
1644
|
-
return d !== c ? d - c :
|
|
1645
|
-
}).slice(0,
|
|
1646
|
-
}
|
|
1647
|
-
function
|
|
1648
|
-
const
|
|
1649
|
-
return
|
|
1650
|
-
!
|
|
2760
|
+
const r = n.seasonStatistics?.appearances ?? 0;
|
|
2761
|
+
return (o.seasonStatistics?.appearances ?? 0) - r;
|
|
2762
|
+
}).slice(0, e);
|
|
2763
|
+
}
|
|
2764
|
+
function Fo(t, e = 10) {
|
|
2765
|
+
return t.players.filter((n) => {
|
|
2766
|
+
const o = n.seasonStatistics?.yellowCards ?? 0, s = n.seasonStatistics?.redCards ?? 0;
|
|
2767
|
+
return o + s > 0;
|
|
2768
|
+
}).sort((n, o) => {
|
|
2769
|
+
const s = n.seasonStatistics?.yellowCards ?? 0, i = n.seasonStatistics?.redCards ?? 0, r = o.seasonStatistics?.yellowCards ?? 0, a = o.seasonStatistics?.redCards ?? 0, c = s + i * 3, d = r + a * 3;
|
|
2770
|
+
return d !== c ? d - c : a !== i ? a - i : r - s;
|
|
2771
|
+
}).slice(0, e);
|
|
2772
|
+
}
|
|
2773
|
+
function Z(t) {
|
|
2774
|
+
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
2775
|
+
return t.forEach((o) => {
|
|
2776
|
+
!o.mainEvents || o.mainEvents.length === 0 || o.mainEvents.forEach((s) => {
|
|
1651
2777
|
if (s.primaryPlayer) {
|
|
1652
2778
|
const i = s.primaryPlayer.id;
|
|
1653
|
-
|
|
2779
|
+
e.has(i) || e.set(i, {
|
|
1654
2780
|
playerId: s.primaryPlayer.id,
|
|
1655
2781
|
seasonId: "",
|
|
1656
2782
|
// Not applicable for match aggregation
|
|
@@ -1662,12 +2788,12 @@ function H(e) {
|
|
|
1662
2788
|
redCards: 0,
|
|
1663
2789
|
appearances: 0
|
|
1664
2790
|
});
|
|
1665
|
-
const
|
|
1666
|
-
|
|
2791
|
+
const r = e.get(i);
|
|
2792
|
+
n.has(i) || n.set(i, /* @__PURE__ */ new Set()), n.get(i).add(o.id), (s.type === "GOAL" || s.type === "PENALTY_GOAL") && (r.goals = (r.goals ?? 0) + 1), s.type === "YELLOW_CARD" && (r.yellowCards = (r.yellowCards ?? 0) + 1), (s.type === "RED_CARD" || s.type === "YELLOW_RED_CARD") && (r.redCards = (r.redCards ?? 0) + 1);
|
|
1667
2793
|
}
|
|
1668
2794
|
if (s.secondaryPlayer && (s.type === "GOAL" || s.type === "PENALTY_GOAL")) {
|
|
1669
2795
|
const i = s.secondaryPlayer.id;
|
|
1670
|
-
|
|
2796
|
+
e.has(i) || e.set(i, {
|
|
1671
2797
|
playerId: s.secondaryPlayer.id,
|
|
1672
2798
|
seasonId: "",
|
|
1673
2799
|
// Not applicable for match aggregation
|
|
@@ -1679,205 +2805,205 @@ function H(e) {
|
|
|
1679
2805
|
redCards: 0,
|
|
1680
2806
|
appearances: 0
|
|
1681
2807
|
});
|
|
1682
|
-
const
|
|
1683
|
-
|
|
2808
|
+
const r = e.get(i);
|
|
2809
|
+
r.assists = (r.assists ?? 0) + 1, n.has(i) || n.set(i, /* @__PURE__ */ new Set()), n.get(i).add(o.id);
|
|
1684
2810
|
}
|
|
1685
2811
|
});
|
|
1686
|
-
}),
|
|
1687
|
-
const i =
|
|
1688
|
-
i && i.appearances !== void 0 && (i.appearances =
|
|
1689
|
-
}),
|
|
1690
|
-
}
|
|
1691
|
-
function
|
|
1692
|
-
return Array.from(
|
|
1693
|
-
...
|
|
1694
|
-
totalCards: (
|
|
2812
|
+
}), n.forEach((o, s) => {
|
|
2813
|
+
const i = e.get(s);
|
|
2814
|
+
i && i.appearances !== void 0 && (i.appearances = o.size);
|
|
2815
|
+
}), e;
|
|
2816
|
+
}
|
|
2817
|
+
function at(t) {
|
|
2818
|
+
return Array.from(t.values()).map((e) => ({
|
|
2819
|
+
...e,
|
|
2820
|
+
totalCards: (e.yellowCards ?? 0) + (e.redCards ?? 0)
|
|
1695
2821
|
}));
|
|
1696
2822
|
}
|
|
1697
|
-
function
|
|
1698
|
-
const
|
|
1699
|
-
return
|
|
1700
|
-
const
|
|
1701
|
-
if (
|
|
1702
|
-
return
|
|
2823
|
+
function bn(t, e = 10) {
|
|
2824
|
+
const n = Z(t);
|
|
2825
|
+
return at(n).filter((s) => (s.goals ?? 0) > 0).sort((s, i) => {
|
|
2826
|
+
const r = s.goals ?? 0, a = i.goals ?? 0;
|
|
2827
|
+
if (a !== r)
|
|
2828
|
+
return a - r;
|
|
1703
2829
|
const c = s.assists ?? 0;
|
|
1704
2830
|
return (i.assists ?? 0) - c;
|
|
1705
|
-
}).slice(0,
|
|
1706
|
-
}
|
|
1707
|
-
function
|
|
1708
|
-
const
|
|
1709
|
-
return
|
|
1710
|
-
const
|
|
1711
|
-
if (
|
|
1712
|
-
return
|
|
2831
|
+
}).slice(0, e);
|
|
2832
|
+
}
|
|
2833
|
+
function Nn(t, e = 10) {
|
|
2834
|
+
const n = Z(t);
|
|
2835
|
+
return at(n).filter((s) => (s.assists ?? 0) > 0).sort((s, i) => {
|
|
2836
|
+
const r = s.assists ?? 0, a = i.assists ?? 0;
|
|
2837
|
+
if (a !== r)
|
|
2838
|
+
return a - r;
|
|
1713
2839
|
const c = s.goals ?? 0;
|
|
1714
2840
|
return (i.goals ?? 0) - c;
|
|
1715
|
-
}).slice(0,
|
|
1716
|
-
}
|
|
1717
|
-
function
|
|
1718
|
-
const
|
|
1719
|
-
return
|
|
1720
|
-
const
|
|
1721
|
-
if (
|
|
1722
|
-
return
|
|
2841
|
+
}).slice(0, e);
|
|
2842
|
+
}
|
|
2843
|
+
function Rn(t, e = 10) {
|
|
2844
|
+
const n = Z(t);
|
|
2845
|
+
return at(n).filter((s) => (s.totalCards ?? 0) > 0).sort((s, i) => {
|
|
2846
|
+
const r = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
|
|
2847
|
+
if (a !== r)
|
|
2848
|
+
return a - r;
|
|
1723
2849
|
const c = s.redCards ?? 0, d = i.redCards ?? 0;
|
|
1724
2850
|
if (d !== c)
|
|
1725
2851
|
return d - c;
|
|
1726
|
-
const
|
|
1727
|
-
return (i.yellowCards ?? 0) -
|
|
1728
|
-
}).slice(0,
|
|
1729
|
-
}
|
|
1730
|
-
function
|
|
1731
|
-
const
|
|
1732
|
-
return
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
return
|
|
2852
|
+
const f = s.yellowCards ?? 0;
|
|
2853
|
+
return (i.yellowCards ?? 0) - f;
|
|
2854
|
+
}).slice(0, e);
|
|
2855
|
+
}
|
|
2856
|
+
function In(t, e = 10) {
|
|
2857
|
+
const n = Z(t);
|
|
2858
|
+
return at(n).filter((s) => (s.goals ?? 0) + (s.assists ?? 0) > 0).sort((s, i) => {
|
|
2859
|
+
const r = (s.goals ?? 0) + (s.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
|
|
2860
|
+
if (a !== r)
|
|
2861
|
+
return a - r;
|
|
1736
2862
|
const c = s.goals ?? 0, d = i.goals ?? 0;
|
|
1737
2863
|
if (d !== c)
|
|
1738
2864
|
return d - c;
|
|
1739
|
-
const
|
|
1740
|
-
return (i.assists ?? 0) -
|
|
1741
|
-
}).slice(0,
|
|
1742
|
-
}
|
|
1743
|
-
function
|
|
1744
|
-
const
|
|
1745
|
-
return
|
|
1746
|
-
const i =
|
|
1747
|
-
if (
|
|
1748
|
-
return
|
|
1749
|
-
const
|
|
1750
|
-
return (s.goals ?? 0) + (s.assists ?? 0) -
|
|
2865
|
+
const f = s.assists ?? 0;
|
|
2866
|
+
return (i.assists ?? 0) - f;
|
|
2867
|
+
}).slice(0, e);
|
|
2868
|
+
}
|
|
2869
|
+
function Pn(t) {
|
|
2870
|
+
const e = Z(t);
|
|
2871
|
+
return at(e).sort((o, s) => {
|
|
2872
|
+
const i = o.appearances ?? 0, r = s.appearances ?? 0;
|
|
2873
|
+
if (r !== i)
|
|
2874
|
+
return r - i;
|
|
2875
|
+
const a = (o.goals ?? 0) + (o.assists ?? 0);
|
|
2876
|
+
return (s.goals ?? 0) + (s.assists ?? 0) - a;
|
|
1751
2877
|
});
|
|
1752
2878
|
}
|
|
1753
|
-
function
|
|
1754
|
-
return
|
|
2879
|
+
function Lo(t, e = 10) {
|
|
2880
|
+
return j(() => bn(t, e), [t, e]);
|
|
1755
2881
|
}
|
|
1756
|
-
function
|
|
1757
|
-
return
|
|
2882
|
+
function bo(t, e = 10) {
|
|
2883
|
+
return j(() => Nn(t, e), [t, e]);
|
|
1758
2884
|
}
|
|
1759
|
-
function
|
|
1760
|
-
return
|
|
2885
|
+
function No(t, e = 10) {
|
|
2886
|
+
return j(() => Rn(t, e), [t, e]);
|
|
1761
2887
|
}
|
|
1762
|
-
function
|
|
1763
|
-
return
|
|
2888
|
+
function Ro(t, e = 10) {
|
|
2889
|
+
return j(() => In(t, e), [t, e]);
|
|
1764
2890
|
}
|
|
1765
|
-
function
|
|
1766
|
-
return
|
|
2891
|
+
function Io(t) {
|
|
2892
|
+
return j(() => Pn(t), [t]);
|
|
1767
2893
|
}
|
|
1768
|
-
function
|
|
1769
|
-
return
|
|
2894
|
+
function Mn(t) {
|
|
2895
|
+
return j(() => Z(t), [t]);
|
|
1770
2896
|
}
|
|
1771
|
-
function
|
|
1772
|
-
const
|
|
1773
|
-
return
|
|
2897
|
+
function Po(t, e) {
|
|
2898
|
+
const n = Mn(t);
|
|
2899
|
+
return j(() => n.get(e), [n, e]);
|
|
1774
2900
|
}
|
|
1775
|
-
const
|
|
1776
|
-
function
|
|
1777
|
-
return
|
|
2901
|
+
const Gn = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
|
|
2902
|
+
function I(t, e) {
|
|
2903
|
+
return e > 0 ? t / e * 100 : 0;
|
|
1778
2904
|
}
|
|
1779
|
-
function
|
|
1780
|
-
return
|
|
2905
|
+
function ct(t, e) {
|
|
2906
|
+
return e > 0 ? t / e : 0;
|
|
1781
2907
|
}
|
|
1782
|
-
function
|
|
1783
|
-
return
|
|
2908
|
+
function Mo(t, e = !1, n = 2) {
|
|
2909
|
+
return e ? `${Math.round(t)}%` : Number.isInteger(t) ? t.toString() : t.toFixed(n);
|
|
1784
2910
|
}
|
|
1785
|
-
function
|
|
1786
|
-
const
|
|
1787
|
-
if (isNaN(
|
|
1788
|
-
const
|
|
1789
|
-
return `${
|
|
2911
|
+
function Go(t, e) {
|
|
2912
|
+
const n = typeof t == "string" ? parseFloat(t) : t;
|
|
2913
|
+
if (isNaN(n) || e === 0) return "0";
|
|
2914
|
+
const o = (n / e).toFixed(1);
|
|
2915
|
+
return `${n} (${o} avg)`;
|
|
1790
2916
|
}
|
|
1791
|
-
function
|
|
1792
|
-
const
|
|
1793
|
-
return isNaN(
|
|
2917
|
+
function Do(t, e) {
|
|
2918
|
+
const n = typeof t == "string" ? parseFloat(t) : t;
|
|
2919
|
+
return isNaN(n) || e === 0 ? "0.0" : (n / e).toFixed(1);
|
|
1794
2920
|
}
|
|
1795
|
-
function
|
|
1796
|
-
const
|
|
1797
|
-
return isNaN(
|
|
2921
|
+
function Uo(t) {
|
|
2922
|
+
const e = parseFloat(t);
|
|
2923
|
+
return isNaN(e) ? "0%" : `${Math.round(e)}%`;
|
|
1798
2924
|
}
|
|
1799
|
-
function
|
|
1800
|
-
if (
|
|
1801
|
-
const
|
|
1802
|
-
let
|
|
1803
|
-
const d =
|
|
2925
|
+
function Dn(t, e, n) {
|
|
2926
|
+
if (t.status?.type !== "FINISHED" || !t.score) return null;
|
|
2927
|
+
const o = parseInt(t.score.competitorOne || "0"), s = parseInt(t.score.competitorTwo || "0"), i = n ? o : s, r = n ? s : o;
|
|
2928
|
+
let a = null, c = null;
|
|
2929
|
+
const d = t.score.breakdown?.halfTime;
|
|
1804
2930
|
if (d) {
|
|
1805
|
-
const
|
|
1806
|
-
|
|
2931
|
+
const h = parseInt(d.competitorOne || "0"), p = parseInt(d.competitorTwo || "0");
|
|
2932
|
+
a = n ? h : p, c = n ? p : h;
|
|
1807
2933
|
}
|
|
1808
|
-
const
|
|
1809
|
-
let l = null,
|
|
1810
|
-
if (
|
|
1811
|
-
const
|
|
1812
|
-
|
|
2934
|
+
const f = t.statistics;
|
|
2935
|
+
let l = null, u = null;
|
|
2936
|
+
if (f) {
|
|
2937
|
+
const h = f.find?.((p) => p.type === "CORNERS");
|
|
2938
|
+
h && (l = n ? h.competitorOne : h.competitorTwo, u = n ? h.competitorTwo : h.competitorOne);
|
|
1813
2939
|
}
|
|
1814
2940
|
return {
|
|
1815
2941
|
goalsFor: i,
|
|
1816
|
-
goalsAgainst:
|
|
1817
|
-
halfTimeGoalsFor:
|
|
2942
|
+
goalsAgainst: r,
|
|
2943
|
+
halfTimeGoalsFor: a,
|
|
1818
2944
|
halfTimeGoalsAgainst: c,
|
|
1819
2945
|
cornersFor: l,
|
|
1820
|
-
cornersAgainst:
|
|
1821
|
-
isWin: i >
|
|
1822
|
-
isDraw: i ===
|
|
1823
|
-
isLoss: i <
|
|
2946
|
+
cornersAgainst: u,
|
|
2947
|
+
isWin: i > r,
|
|
2948
|
+
isDraw: i === r,
|
|
2949
|
+
isLoss: i < r
|
|
1824
2950
|
};
|
|
1825
2951
|
}
|
|
1826
|
-
function
|
|
1827
|
-
return
|
|
2952
|
+
function Ct(t, e) {
|
|
2953
|
+
return t.competitorOne.id === e;
|
|
1828
2954
|
}
|
|
1829
|
-
function
|
|
1830
|
-
return
|
|
2955
|
+
function Un(t, e) {
|
|
2956
|
+
return t.competitorTwo.id === e;
|
|
1831
2957
|
}
|
|
1832
|
-
function
|
|
1833
|
-
return
|
|
2958
|
+
function xo(t, e) {
|
|
2959
|
+
return Ct(t, e) || Un(t, e);
|
|
1834
2960
|
}
|
|
1835
|
-
function
|
|
1836
|
-
return
|
|
2961
|
+
function Ho(t) {
|
|
2962
|
+
return t.status?.type === "FINISHED";
|
|
1837
2963
|
}
|
|
1838
|
-
function
|
|
1839
|
-
const
|
|
1840
|
-
return parseInt(
|
|
2964
|
+
function ko(t, e) {
|
|
2965
|
+
const n = Ct(t, e);
|
|
2966
|
+
return parseInt(n ? t.score?.competitorOne || "0" : t.score?.competitorTwo || "0");
|
|
1841
2967
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const
|
|
1844
|
-
return parseInt(
|
|
2968
|
+
function $o(t, e) {
|
|
2969
|
+
const n = Ct(t, e);
|
|
2970
|
+
return parseInt(n ? t.score?.competitorTwo || "0" : t.score?.competitorOne || "0");
|
|
1845
2971
|
}
|
|
1846
|
-
function
|
|
1847
|
-
const
|
|
1848
|
-
if (
|
|
1849
|
-
const l =
|
|
1850
|
-
return l &&
|
|
2972
|
+
function Bo(t, e, n) {
|
|
2973
|
+
const o = t.filter((f) => {
|
|
2974
|
+
if (f.status?.type !== "FINISHED" || !f.score) return !1;
|
|
2975
|
+
const l = f.competitorOne.id === e || f.competitorTwo.id === e, u = f.competitorOne.id === n || f.competitorTwo.id === n;
|
|
2976
|
+
return l && u;
|
|
1851
2977
|
});
|
|
1852
|
-
let s = 0, i = 0,
|
|
1853
|
-
|
|
1854
|
-
const l = parseInt(
|
|
1855
|
-
|
|
2978
|
+
let s = 0, i = 0, r = 0, a = 0, c = 0;
|
|
2979
|
+
o.forEach((f) => {
|
|
2980
|
+
const l = parseInt(f.score?.competitorOne || "0"), u = parseInt(f.score?.competitorTwo || "0"), h = f.competitorOne.id === e, p = h ? l : u, y = h ? u : l;
|
|
2981
|
+
a += p, c += y, p > y ? s++ : y > p ? i++ : r++;
|
|
1856
2982
|
});
|
|
1857
|
-
const d =
|
|
2983
|
+
const d = o.length;
|
|
1858
2984
|
return {
|
|
1859
2985
|
totalMatches: d,
|
|
1860
2986
|
homeTeamWins: s,
|
|
1861
2987
|
awayTeamWins: i,
|
|
1862
|
-
draws:
|
|
1863
|
-
homeTeamGoals:
|
|
2988
|
+
draws: r,
|
|
2989
|
+
homeTeamGoals: a,
|
|
1864
2990
|
awayTeamGoals: c,
|
|
1865
2991
|
homeTeamWinPercentage: d > 0 ? s / d * 100 : 0,
|
|
1866
2992
|
awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
|
|
1867
|
-
drawPercentage: d > 0 ?
|
|
1868
|
-
homeTeamAvgGoals: d > 0 ?
|
|
2993
|
+
drawPercentage: d > 0 ? r / d * 100 : 0,
|
|
2994
|
+
homeTeamAvgGoals: d > 0 ? a / d : 0,
|
|
1869
2995
|
awayTeamAvgGoals: d > 0 ? c / d : 0
|
|
1870
2996
|
};
|
|
1871
2997
|
}
|
|
1872
|
-
function
|
|
1873
|
-
return
|
|
2998
|
+
function Wo(t, e, n, o = 5) {
|
|
2999
|
+
return t.filter((i) => {
|
|
1874
3000
|
if (i.status?.type !== "FINISHED" || !i.score) return !1;
|
|
1875
|
-
const
|
|
1876
|
-
return
|
|
1877
|
-
}).sort((i,
|
|
1878
|
-
const
|
|
3001
|
+
const r = i.competitorOne.id === e || i.competitorTwo.id === e, a = i.competitorOne.id === n || i.competitorTwo.id === n;
|
|
3002
|
+
return r && a;
|
|
3003
|
+
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, o).map((i) => {
|
|
3004
|
+
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), c = i.competitorOne.id === e, d = c ? r : a, f = c ? a : r;
|
|
1879
3005
|
let l;
|
|
1880
|
-
return d >
|
|
3006
|
+
return d > f ? l = "home" : f > d ? l = "away" : l = "draw", {
|
|
1881
3007
|
id: i.id,
|
|
1882
3008
|
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1883
3009
|
day: "numeric",
|
|
@@ -1888,52 +3014,52 @@ function Fo(e, t, o, n = 5) {
|
|
|
1888
3014
|
awayTeamName: i.competitorTwo.name,
|
|
1889
3015
|
homeTeamLogo: i.competitorOne.assets?.logo,
|
|
1890
3016
|
awayTeamLogo: i.competitorTwo.assets?.logo,
|
|
1891
|
-
homeScore:
|
|
1892
|
-
awayScore:
|
|
3017
|
+
homeScore: r,
|
|
3018
|
+
awayScore: a,
|
|
1893
3019
|
venue: i.venue?.name,
|
|
1894
3020
|
winner: l
|
|
1895
3021
|
};
|
|
1896
3022
|
});
|
|
1897
3023
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1900
|
-
const s =
|
|
1901
|
-
return !s && !i ? !1 :
|
|
1902
|
-
}).map((
|
|
1903
|
-
const s =
|
|
1904
|
-
return
|
|
1905
|
-
}).filter((
|
|
3024
|
+
function xn(t, e, n) {
|
|
3025
|
+
return t.filter((o) => {
|
|
3026
|
+
const s = o.competitorOne.id === e, i = o.competitorTwo.id === e;
|
|
3027
|
+
return !s && !i ? !1 : n === "home" ? s : i;
|
|
3028
|
+
}).map((o) => {
|
|
3029
|
+
const s = o.competitorOne.id === e;
|
|
3030
|
+
return Dn(o, e, s);
|
|
3031
|
+
}).filter((o) => o !== null);
|
|
1906
3032
|
}
|
|
1907
|
-
function
|
|
3033
|
+
function Nt(t, e, n, o) {
|
|
1908
3034
|
let s = 0;
|
|
1909
|
-
for (const i of
|
|
1910
|
-
const
|
|
1911
|
-
if (!
|
|
3035
|
+
for (const i of t) {
|
|
3036
|
+
const r = i.competitorOne.id === e, a = i.competitorTwo.id === e;
|
|
3037
|
+
if (!r && !a || n === "home" && !r || n === "away" && !a || i.status?.type !== "FINISHED") continue;
|
|
1912
3038
|
const c = i.mainEvents;
|
|
1913
3039
|
if (!c || !Array.isArray(c)) continue;
|
|
1914
|
-
const d = c.filter((
|
|
1915
|
-
const
|
|
1916
|
-
return
|
|
3040
|
+
const d = c.filter((p) => p.type && Gn.includes(p.type)).sort((p, y) => {
|
|
3041
|
+
const S = p.minute ?? 0, g = y.minute ?? 0;
|
|
3042
|
+
return S !== g ? S - g : (p.injuryMinute ?? 0) - (y.injuryMinute ?? 0);
|
|
1917
3043
|
});
|
|
1918
3044
|
if (d.length === 0) continue;
|
|
1919
|
-
const
|
|
1920
|
-
let
|
|
1921
|
-
|
|
3045
|
+
const f = d[0], l = r ? "ONE" : "TWO", u = f.type === "OWN_GOAL";
|
|
3046
|
+
let h;
|
|
3047
|
+
u ? h = f.competitorPosition !== l : h = f.competitorPosition === l, (o === "scored" && h || o === "conceded" && !h) && s++;
|
|
1922
3048
|
}
|
|
1923
3049
|
return s;
|
|
1924
3050
|
}
|
|
1925
|
-
function
|
|
1926
|
-
let
|
|
1927
|
-
for (const s of
|
|
1928
|
-
const i = s.competitorOne.id ===
|
|
1929
|
-
if (!i && !
|
|
1930
|
-
const
|
|
1931
|
-
|
|
3051
|
+
function Hn(t, e, n) {
|
|
3052
|
+
let o = 0;
|
|
3053
|
+
for (const s of t) {
|
|
3054
|
+
const i = s.competitorOne.id === e, r = s.competitorTwo.id === e;
|
|
3055
|
+
if (!i && !r || n === "home" && !i || n === "away" && !r || s.status?.type !== "FINISHED") continue;
|
|
3056
|
+
const a = s.mainEvents;
|
|
3057
|
+
a && Array.isArray(a) && o++;
|
|
1932
3058
|
}
|
|
1933
|
-
return
|
|
3059
|
+
return o;
|
|
1934
3060
|
}
|
|
1935
|
-
function
|
|
1936
|
-
const
|
|
3061
|
+
function zo(t, e, n) {
|
|
3062
|
+
const o = xn(t, e, n), s = o.length;
|
|
1937
3063
|
if (s === 0)
|
|
1938
3064
|
return {
|
|
1939
3065
|
played: 0,
|
|
@@ -1954,411 +3080,423 @@ function No(e, t, o) {
|
|
|
1954
3080
|
avgCornersFor: 0,
|
|
1955
3081
|
avgCornersAgainst: 0
|
|
1956
3082
|
};
|
|
1957
|
-
const i =
|
|
1958
|
-
const
|
|
1959
|
-
return
|
|
1960
|
-
}).length,
|
|
1961
|
-
const
|
|
1962
|
-
return
|
|
1963
|
-
}).length,
|
|
3083
|
+
const i = o.reduce((m, O) => m + O.goalsFor, 0), r = o.reduce((m, O) => m + O.goalsAgainst, 0), a = o.filter((m) => m.goalsAgainst === 0).length, c = o.filter((m) => m.isWin && m.goalsAgainst === 0).length, d = o.filter((m) => m.goalsFor > 0).length, f = o.filter((m) => m.goalsFor === 0).length, l = o.filter((m) => m.isLoss && m.goalsFor === 0).length, u = o.filter((m) => m.goalsAgainst > 0).length, h = o.filter((m) => m.halfTimeGoalsFor !== null), p = h.length, y = h.filter((m) => {
|
|
3084
|
+
const O = m.halfTimeGoalsFor, w = m.goalsFor - O;
|
|
3085
|
+
return O > 0 && w > 0;
|
|
3086
|
+
}).length, S = Nt(t, e, n, "scored"), g = Hn(t, e, n), T = h.filter((m) => m.halfTimeGoalsFor > m.halfTimeGoalsAgainst).length, A = h.filter((m) => {
|
|
3087
|
+
const O = m.halfTimeGoalsAgainst, w = m.goalsAgainst - O;
|
|
3088
|
+
return O > 0 && w > 0;
|
|
3089
|
+
}).length, C = Nt(t, e, n, "conceded"), v = h.filter((m) => m.halfTimeGoalsAgainst > m.halfTimeGoalsFor).length, R = o.filter((m) => m.cornersFor !== null), P = R.reduce((m, O) => m + (O.cornersFor || 0), 0), M = R.reduce((m, O) => m + (O.cornersAgainst || 0), 0);
|
|
1964
3090
|
return {
|
|
1965
3091
|
played: s,
|
|
1966
|
-
goalsForPerMatch:
|
|
1967
|
-
cleanSheets:
|
|
1968
|
-
wonToNil:
|
|
1969
|
-
scoringRate:
|
|
1970
|
-
scoredInBothHalves:
|
|
1971
|
-
scoredFirst:
|
|
1972
|
-
leadingAtHalfTime:
|
|
1973
|
-
goalsAgainstPerMatch:
|
|
1974
|
-
failedToScore:
|
|
1975
|
-
lostToNil:
|
|
1976
|
-
concedingRate:
|
|
1977
|
-
concededInBothHalves:
|
|
1978
|
-
concededFirst:
|
|
1979
|
-
losingAtHalfTime:
|
|
1980
|
-
avgCornersFor:
|
|
1981
|
-
avgCornersAgainst:
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
function
|
|
1985
|
-
return
|
|
1986
|
-
const
|
|
3092
|
+
goalsForPerMatch: ct(i, s),
|
|
3093
|
+
cleanSheets: I(a, s),
|
|
3094
|
+
wonToNil: I(c, s),
|
|
3095
|
+
scoringRate: I(d, s),
|
|
3096
|
+
scoredInBothHalves: I(y, p),
|
|
3097
|
+
scoredFirst: I(S, g),
|
|
3098
|
+
leadingAtHalfTime: I(T, p),
|
|
3099
|
+
goalsAgainstPerMatch: ct(r, s),
|
|
3100
|
+
failedToScore: I(f, s),
|
|
3101
|
+
lostToNil: I(l, s),
|
|
3102
|
+
concedingRate: I(u, s),
|
|
3103
|
+
concededInBothHalves: I(A, p),
|
|
3104
|
+
concededFirst: I(C, g),
|
|
3105
|
+
losingAtHalfTime: I(v, p),
|
|
3106
|
+
avgCornersFor: ct(P, R.length),
|
|
3107
|
+
avgCornersAgainst: ct(M, R.length)
|
|
3108
|
+
};
|
|
3109
|
+
}
|
|
3110
|
+
function kn(t, e) {
|
|
3111
|
+
return t.filter((n) => n.status?.type !== "FINISHED" ? !1 : n.competitorOne.id === e || n.competitorTwo.id === e).map((n) => {
|
|
3112
|
+
const o = n.competitorOne.id === e, s = parseInt(n.score?.competitorOne || "0"), i = parseInt(n.score?.competitorTwo || "0"), r = s + i, a = n.periods;
|
|
1987
3113
|
let c = null;
|
|
1988
|
-
if (
|
|
1989
|
-
const d =
|
|
1990
|
-
(
|
|
3114
|
+
if (a && Array.isArray(a)) {
|
|
3115
|
+
const d = a.find(
|
|
3116
|
+
(f) => f.type === "FIRST_HALF" || f.type === "1ST_HALF"
|
|
1991
3117
|
);
|
|
1992
3118
|
if (d?.score) {
|
|
1993
|
-
const
|
|
1994
|
-
c =
|
|
3119
|
+
const f = parseInt(d.score.competitorOne || "0"), l = parseInt(d.score.competitorTwo || "0");
|
|
3120
|
+
c = f + l;
|
|
1995
3121
|
}
|
|
1996
3122
|
}
|
|
1997
|
-
return { totalGoals:
|
|
3123
|
+
return { totalGoals: r, halfTimeGoals: c, isHome: o };
|
|
1998
3124
|
});
|
|
1999
3125
|
}
|
|
2000
|
-
function
|
|
2001
|
-
return
|
|
3126
|
+
function _(t, e) {
|
|
3127
|
+
return t.length === 0 ? 0 : t.filter((o) => o > e).length / t.length * 100;
|
|
2002
3128
|
}
|
|
2003
|
-
function
|
|
2004
|
-
const
|
|
3129
|
+
function Yo(t, e) {
|
|
3130
|
+
const n = kn(t, e), o = n.filter((l) => l.isHome), s = n.filter((l) => !l.isHome), i = n.map((l) => l.totalGoals), r = o.map((l) => l.totalGoals), a = s.map((l) => l.totalGoals), c = n.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals), d = o.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals), f = s.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals);
|
|
2005
3131
|
return {
|
|
2006
3132
|
over05: {
|
|
2007
|
-
home:
|
|
2008
|
-
total:
|
|
2009
|
-
away:
|
|
3133
|
+
home: _(r, 0.5),
|
|
3134
|
+
total: _(i, 0.5),
|
|
3135
|
+
away: _(a, 0.5)
|
|
2010
3136
|
},
|
|
2011
3137
|
over15: {
|
|
2012
|
-
home:
|
|
2013
|
-
total:
|
|
2014
|
-
away:
|
|
3138
|
+
home: _(r, 1.5),
|
|
3139
|
+
total: _(i, 1.5),
|
|
3140
|
+
away: _(a, 1.5)
|
|
2015
3141
|
},
|
|
2016
3142
|
over25: {
|
|
2017
|
-
home:
|
|
2018
|
-
total:
|
|
2019
|
-
away:
|
|
3143
|
+
home: _(r, 2.5),
|
|
3144
|
+
total: _(i, 2.5),
|
|
3145
|
+
away: _(a, 2.5)
|
|
2020
3146
|
},
|
|
2021
3147
|
over35: {
|
|
2022
|
-
home:
|
|
2023
|
-
total:
|
|
2024
|
-
away:
|
|
3148
|
+
home: _(r, 3.5),
|
|
3149
|
+
total: _(i, 3.5),
|
|
3150
|
+
away: _(a, 3.5)
|
|
2025
3151
|
},
|
|
2026
3152
|
over45: {
|
|
2027
|
-
home:
|
|
2028
|
-
total:
|
|
2029
|
-
away:
|
|
3153
|
+
home: _(r, 4.5),
|
|
3154
|
+
total: _(i, 4.5),
|
|
3155
|
+
away: _(a, 4.5)
|
|
2030
3156
|
},
|
|
2031
3157
|
over55: {
|
|
2032
|
-
home:
|
|
2033
|
-
total:
|
|
2034
|
-
away:
|
|
3158
|
+
home: _(r, 5.5),
|
|
3159
|
+
total: _(i, 5.5),
|
|
3160
|
+
away: _(a, 5.5)
|
|
2035
3161
|
},
|
|
2036
3162
|
over05HT: {
|
|
2037
|
-
home:
|
|
2038
|
-
total:
|
|
2039
|
-
away:
|
|
3163
|
+
home: _(d, 0.5),
|
|
3164
|
+
total: _(c, 0.5),
|
|
3165
|
+
away: _(f, 0.5)
|
|
2040
3166
|
},
|
|
2041
3167
|
over15HT: {
|
|
2042
|
-
home:
|
|
2043
|
-
total:
|
|
2044
|
-
away:
|
|
3168
|
+
home: _(d, 1.5),
|
|
3169
|
+
total: _(c, 1.5),
|
|
3170
|
+
away: _(f, 1.5)
|
|
2045
3171
|
},
|
|
2046
3172
|
over25HT: {
|
|
2047
|
-
home:
|
|
2048
|
-
total:
|
|
2049
|
-
away:
|
|
3173
|
+
home: _(d, 2.5),
|
|
3174
|
+
total: _(c, 2.5),
|
|
3175
|
+
away: _(f, 2.5)
|
|
2050
3176
|
}
|
|
2051
3177
|
};
|
|
2052
3178
|
}
|
|
2053
|
-
function
|
|
2054
|
-
const
|
|
2055
|
-
if (!
|
|
2056
|
-
const s = parseInt(
|
|
2057
|
-
let
|
|
2058
|
-
return s > i ?
|
|
2059
|
-
result: { score: `${s}:${i}`, result:
|
|
2060
|
-
isHome:
|
|
3179
|
+
function $n(t, e) {
|
|
3180
|
+
const n = t.competitorOne.id === e, o = t.competitorTwo.id === e;
|
|
3181
|
+
if (!n && !o || !t.score) return null;
|
|
3182
|
+
const s = parseInt(n ? t.score.competitorOne || "0" : t.score.competitorTwo || "0"), i = parseInt(n ? t.score.competitorTwo || "0" : t.score.competitorOne || "0");
|
|
3183
|
+
let r;
|
|
3184
|
+
return s > i ? r = "W" : s < i ? r = "L" : r = "D", {
|
|
3185
|
+
result: { score: `${s}:${i}`, result: r, isHome: n },
|
|
3186
|
+
isHome: n
|
|
2061
3187
|
};
|
|
2062
3188
|
}
|
|
2063
|
-
function
|
|
2064
|
-
const
|
|
2065
|
-
if (!
|
|
2066
|
-
const l =
|
|
3189
|
+
function jo(t, e, n, o, s, i) {
|
|
3190
|
+
const r = e?.entries.find((k) => k.competitor.id === t), a = n?.entries.find((k) => k.competitor.id === t), c = o?.entries.find((k) => k.competitor.id === t), d = s?.entries.find((k) => k.competitor.id === t), f = i?.entries.find((k) => k.competitor.id === t);
|
|
3191
|
+
if (!r) return null;
|
|
3192
|
+
const l = a?.stats?.goalsFor ?? 0, u = c?.stats?.goalsFor ?? 0, h = r?.stats?.goalsFor ?? 0, p = d?.stats?.goalsAgainst ?? 0, y = f?.stats?.goalsAgainst ?? 0, S = r?.stats?.goalsAgainst ?? 0, g = a?.stats?.played ?? 0, T = c?.stats?.played ?? 0, A = r?.stats?.played ?? 0, C = A > 0 ? h / A : 0, v = A > 0 ? S / A : 0, R = C + v, P = g > 0 ? l / g : 0, M = T > 0 ? u / T : 0, m = g > 0 ? p / g : 0, O = T > 0 ? y / T : 0, w = P + m, qt = M + O;
|
|
2067
3193
|
return {
|
|
2068
3194
|
homeGoals: l,
|
|
2069
|
-
totalGoals:
|
|
2070
|
-
awayGoals:
|
|
2071
|
-
homeGamesPlayed:
|
|
2072
|
-
awayGamesPlayed:
|
|
2073
|
-
totalGamesPlayed:
|
|
2074
|
-
homeGoalsConceded:
|
|
2075
|
-
totalGoalsConceded:
|
|
2076
|
-
awayGoalsConceded:
|
|
2077
|
-
gfPerMatch:
|
|
2078
|
-
gaPerMatch:
|
|
2079
|
-
gfGaPerMatch:
|
|
2080
|
-
homeGfPerMatch:
|
|
2081
|
-
awayGfPerMatch:
|
|
2082
|
-
homeGaPerMatch:
|
|
2083
|
-
awayGaPerMatch:
|
|
2084
|
-
homeGfGaPerMatch:
|
|
2085
|
-
awayGfGaPerMatch:
|
|
2086
|
-
};
|
|
2087
|
-
}
|
|
2088
|
-
function
|
|
2089
|
-
const s =
|
|
2090
|
-
const
|
|
2091
|
-
return !(!
|
|
2092
|
-
}).sort((
|
|
3195
|
+
totalGoals: h,
|
|
3196
|
+
awayGoals: u,
|
|
3197
|
+
homeGamesPlayed: g,
|
|
3198
|
+
awayGamesPlayed: T,
|
|
3199
|
+
totalGamesPlayed: A,
|
|
3200
|
+
homeGoalsConceded: p,
|
|
3201
|
+
totalGoalsConceded: S,
|
|
3202
|
+
awayGoalsConceded: y,
|
|
3203
|
+
gfPerMatch: C,
|
|
3204
|
+
gaPerMatch: v,
|
|
3205
|
+
gfGaPerMatch: R,
|
|
3206
|
+
homeGfPerMatch: P,
|
|
3207
|
+
awayGfPerMatch: M,
|
|
3208
|
+
homeGaPerMatch: m,
|
|
3209
|
+
awayGaPerMatch: O,
|
|
3210
|
+
homeGfGaPerMatch: w,
|
|
3211
|
+
awayGfGaPerMatch: qt
|
|
3212
|
+
};
|
|
3213
|
+
}
|
|
3214
|
+
function N(t, e, n, o) {
|
|
3215
|
+
const s = t.filter((r) => {
|
|
3216
|
+
const a = r.competitorOne.id === e, c = r.competitorTwo.id === e;
|
|
3217
|
+
return !(!a && !c || r.status?.type !== "FINISHED" || o === "home" && !a || o === "away" && !c);
|
|
3218
|
+
}).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
|
|
2093
3219
|
if (s.length === 0) return null;
|
|
2094
3220
|
let i = 0;
|
|
2095
|
-
for (const
|
|
2096
|
-
const
|
|
2097
|
-
if (
|
|
3221
|
+
for (const r of s) {
|
|
3222
|
+
const a = r.competitorOne.id === e;
|
|
3223
|
+
if (n(r, e, a))
|
|
2098
3224
|
i++;
|
|
2099
3225
|
else
|
|
2100
3226
|
break;
|
|
2101
3227
|
}
|
|
2102
3228
|
return i > 0 ? i : null;
|
|
2103
3229
|
}
|
|
2104
|
-
const
|
|
2105
|
-
win: (
|
|
2106
|
-
const
|
|
2107
|
-
return
|
|
3230
|
+
const E = {
|
|
3231
|
+
win: (t, e, n) => {
|
|
3232
|
+
const o = parseInt(n ? t.score?.competitorOne || "0" : t.score?.competitorTwo || "0"), s = parseInt(n ? t.score?.competitorTwo || "0" : t.score?.competitorOne || "0");
|
|
3233
|
+
return o > s;
|
|
2108
3234
|
},
|
|
2109
|
-
draw: (
|
|
2110
|
-
loss: (
|
|
2111
|
-
const
|
|
2112
|
-
return
|
|
3235
|
+
draw: (t) => t.score?.competitorOne === t.score?.competitorTwo,
|
|
3236
|
+
loss: (t, e, n) => {
|
|
3237
|
+
const o = parseInt(n ? t.score?.competitorOne || "0" : t.score?.competitorTwo || "0"), s = parseInt(n ? t.score?.competitorTwo || "0" : t.score?.competitorOne || "0");
|
|
3238
|
+
return o < s;
|
|
2113
3239
|
},
|
|
2114
|
-
noWin: (
|
|
2115
|
-
noDraw: (
|
|
2116
|
-
noDefeat: (
|
|
2117
|
-
scored: (
|
|
2118
|
-
conceded: (
|
|
2119
|
-
noGoalScored: (
|
|
2120
|
-
noGoalConceded: (
|
|
2121
|
-
over25: (
|
|
2122
|
-
under25: (
|
|
2123
|
-
scoredTwice: (
|
|
2124
|
-
concededTwice: (
|
|
3240
|
+
noWin: (t, e, n) => !E.win(t, e, n),
|
|
3241
|
+
noDraw: (t) => !E.draw(t),
|
|
3242
|
+
noDefeat: (t, e, n) => !E.loss(t, e, n),
|
|
3243
|
+
scored: (t, e, n) => parseInt(n ? t.score?.competitorOne || "0" : t.score?.competitorTwo || "0") >= 1,
|
|
3244
|
+
conceded: (t, e, n) => parseInt(n ? t.score?.competitorTwo || "0" : t.score?.competitorOne || "0") >= 1,
|
|
3245
|
+
noGoalScored: (t, e, n) => !E.scored(t, e, n),
|
|
3246
|
+
noGoalConceded: (t, e, n) => !E.conceded(t, e, n),
|
|
3247
|
+
over25: (t) => parseInt(t.score?.competitorOne || "0") + parseInt(t.score?.competitorTwo || "0") > 2,
|
|
3248
|
+
under25: (t) => parseInt(t.score?.competitorOne || "0") + parseInt(t.score?.competitorTwo || "0") < 3,
|
|
3249
|
+
scoredTwice: (t, e, n) => parseInt(n ? t.score?.competitorOne || "0" : t.score?.competitorTwo || "0") >= 2,
|
|
3250
|
+
concededTwice: (t, e, n) => parseInt(n ? t.score?.competitorTwo || "0" : t.score?.competitorOne || "0") >= 2
|
|
2125
3251
|
};
|
|
2126
|
-
function
|
|
2127
|
-
return {
|
|
2128
|
-
win:
|
|
2129
|
-
draw:
|
|
2130
|
-
loss:
|
|
2131
|
-
noWin:
|
|
2132
|
-
noDraw:
|
|
2133
|
-
noDefeat:
|
|
2134
|
-
scored:
|
|
2135
|
-
conceded:
|
|
2136
|
-
noGoalScored:
|
|
2137
|
-
noGoalConceded:
|
|
2138
|
-
over25:
|
|
2139
|
-
under25:
|
|
2140
|
-
scoredTwice:
|
|
2141
|
-
concededTwice:
|
|
2142
|
-
};
|
|
2143
|
-
}
|
|
2144
|
-
function
|
|
2145
|
-
const
|
|
3252
|
+
function lt(t, e, n) {
|
|
3253
|
+
return {
|
|
3254
|
+
win: N(t, e, E.win, n),
|
|
3255
|
+
draw: N(t, e, E.draw, n),
|
|
3256
|
+
loss: N(t, e, E.loss, n),
|
|
3257
|
+
noWin: N(t, e, E.noWin, n),
|
|
3258
|
+
noDraw: N(t, e, E.noDraw, n),
|
|
3259
|
+
noDefeat: N(t, e, E.noDefeat, n),
|
|
3260
|
+
scored: N(t, e, E.scored, n),
|
|
3261
|
+
conceded: N(t, e, E.conceded, n),
|
|
3262
|
+
noGoalScored: N(t, e, E.noGoalScored, n),
|
|
3263
|
+
noGoalConceded: N(t, e, E.noGoalConceded, n),
|
|
3264
|
+
over25: N(t, e, E.over25, n),
|
|
3265
|
+
under25: N(t, e, E.under25, n),
|
|
3266
|
+
scoredTwice: N(t, e, E.scoredTwice, n),
|
|
3267
|
+
concededTwice: N(t, e, E.concededTwice, n)
|
|
3268
|
+
};
|
|
3269
|
+
}
|
|
3270
|
+
function qo(t, e, n) {
|
|
3271
|
+
const o = lt(t, e, "home"), s = lt(t, e), i = lt(t, n, "away"), r = lt(t, n);
|
|
2146
3272
|
return [
|
|
2147
3273
|
{
|
|
2148
3274
|
label: "Consecutive wins",
|
|
2149
|
-
homeTeam: { home:
|
|
2150
|
-
awayTeam: { total:
|
|
3275
|
+
homeTeam: { home: o.win, total: s.win },
|
|
3276
|
+
awayTeam: { total: r.win, home: i.win },
|
|
2151
3277
|
colorType: "neutral"
|
|
2152
3278
|
},
|
|
2153
3279
|
{
|
|
2154
3280
|
label: "Consecutive draws",
|
|
2155
|
-
homeTeam: { home:
|
|
2156
|
-
awayTeam: { total:
|
|
3281
|
+
homeTeam: { home: o.draw, total: s.draw },
|
|
3282
|
+
awayTeam: { total: r.draw, home: i.draw },
|
|
2157
3283
|
colorType: "neutral"
|
|
2158
3284
|
},
|
|
2159
3285
|
{
|
|
2160
3286
|
label: "Consecutive defeats",
|
|
2161
|
-
homeTeam: { home:
|
|
2162
|
-
awayTeam: { total:
|
|
3287
|
+
homeTeam: { home: o.loss, total: s.loss },
|
|
3288
|
+
awayTeam: { total: r.loss, home: i.loss },
|
|
2163
3289
|
colorType: "neutral"
|
|
2164
3290
|
},
|
|
2165
3291
|
{
|
|
2166
3292
|
label: "No win",
|
|
2167
|
-
homeTeam: { home:
|
|
2168
|
-
awayTeam: { total:
|
|
3293
|
+
homeTeam: { home: o.noWin, total: s.noWin },
|
|
3294
|
+
awayTeam: { total: r.noWin, home: i.noWin },
|
|
2169
3295
|
colorType: "negative"
|
|
2170
3296
|
},
|
|
2171
3297
|
{
|
|
2172
3298
|
label: "No draw",
|
|
2173
|
-
homeTeam: { home:
|
|
2174
|
-
awayTeam: { total:
|
|
3299
|
+
homeTeam: { home: o.noDraw, total: s.noDraw },
|
|
3300
|
+
awayTeam: { total: r.noDraw, home: i.noDraw },
|
|
2175
3301
|
colorType: "neutral"
|
|
2176
3302
|
},
|
|
2177
3303
|
{
|
|
2178
3304
|
label: "No defeat",
|
|
2179
|
-
homeTeam: { home:
|
|
2180
|
-
awayTeam: { total:
|
|
3305
|
+
homeTeam: { home: o.noDefeat, total: s.noDefeat },
|
|
3306
|
+
awayTeam: { total: r.noDefeat, home: i.noDefeat },
|
|
2181
3307
|
colorType: "positive"
|
|
2182
3308
|
},
|
|
2183
3309
|
{
|
|
2184
3310
|
label: "Scored at least once",
|
|
2185
|
-
homeTeam: { home:
|
|
2186
|
-
awayTeam: { total:
|
|
3311
|
+
homeTeam: { home: o.scored, total: s.scored },
|
|
3312
|
+
awayTeam: { total: r.scored, home: i.scored },
|
|
2187
3313
|
colorType: "positive"
|
|
2188
3314
|
},
|
|
2189
3315
|
{
|
|
2190
3316
|
label: "Conceded at least once",
|
|
2191
|
-
homeTeam: { home:
|
|
2192
|
-
awayTeam: { total:
|
|
3317
|
+
homeTeam: { home: o.conceded, total: s.conceded },
|
|
3318
|
+
awayTeam: { total: r.conceded, home: i.conceded },
|
|
2193
3319
|
colorType: "negative"
|
|
2194
3320
|
},
|
|
2195
3321
|
{
|
|
2196
3322
|
label: "No goal scored",
|
|
2197
|
-
homeTeam: { home:
|
|
2198
|
-
awayTeam: { total:
|
|
3323
|
+
homeTeam: { home: o.noGoalScored, total: s.noGoalScored },
|
|
3324
|
+
awayTeam: { total: r.noGoalScored, home: i.noGoalScored },
|
|
2199
3325
|
colorType: "neutral"
|
|
2200
3326
|
},
|
|
2201
3327
|
{
|
|
2202
3328
|
label: "No goal conceded",
|
|
2203
|
-
homeTeam: { home:
|
|
2204
|
-
awayTeam: { total:
|
|
3329
|
+
homeTeam: { home: o.noGoalConceded, total: s.noGoalConceded },
|
|
3330
|
+
awayTeam: { total: r.noGoalConceded, home: i.noGoalConceded },
|
|
2205
3331
|
colorType: "neutral"
|
|
2206
3332
|
},
|
|
2207
3333
|
{
|
|
2208
3334
|
label: "GS + GC over 2.5",
|
|
2209
|
-
homeTeam: { home:
|
|
2210
|
-
awayTeam: { total:
|
|
3335
|
+
homeTeam: { home: o.over25, total: s.over25 },
|
|
3336
|
+
awayTeam: { total: r.over25, home: i.over25 },
|
|
2211
3337
|
colorType: "neutral"
|
|
2212
3338
|
},
|
|
2213
3339
|
{
|
|
2214
3340
|
label: "GS + GC under 2.5",
|
|
2215
|
-
homeTeam: { home:
|
|
2216
|
-
awayTeam: { total:
|
|
3341
|
+
homeTeam: { home: o.under25, total: s.under25 },
|
|
3342
|
+
awayTeam: { total: r.under25, home: i.under25 },
|
|
2217
3343
|
colorType: "neutral"
|
|
2218
3344
|
},
|
|
2219
3345
|
{
|
|
2220
3346
|
label: "Scored at least twice",
|
|
2221
|
-
homeTeam: { home:
|
|
2222
|
-
awayTeam: { total:
|
|
3347
|
+
homeTeam: { home: o.scoredTwice, total: s.scoredTwice },
|
|
3348
|
+
awayTeam: { total: r.scoredTwice, home: i.scoredTwice },
|
|
2223
3349
|
colorType: "positive"
|
|
2224
3350
|
},
|
|
2225
3351
|
{
|
|
2226
3352
|
label: "Conceded at least twice",
|
|
2227
|
-
homeTeam: { home:
|
|
2228
|
-
awayTeam: { total:
|
|
3353
|
+
homeTeam: { home: o.concededTwice, total: s.concededTwice },
|
|
3354
|
+
awayTeam: { total: r.concededTwice, home: i.concededTwice },
|
|
2229
3355
|
colorType: "negative"
|
|
2230
3356
|
}
|
|
2231
3357
|
];
|
|
2232
3358
|
}
|
|
2233
|
-
function
|
|
2234
|
-
const
|
|
2235
|
-
return
|
|
2236
|
-
if (
|
|
2237
|
-
const s =
|
|
3359
|
+
function Rt(t, e) {
|
|
3360
|
+
const n = /* @__PURE__ */ new Map();
|
|
3361
|
+
return t.forEach((o) => {
|
|
3362
|
+
if (o.status?.type !== "FINISHED") return;
|
|
3363
|
+
const s = $n(o, e);
|
|
2238
3364
|
if (!s) return;
|
|
2239
|
-
const i = s.isHome ?
|
|
3365
|
+
const i = s.isHome ? o.competitorTwo.id : o.competitorOne.id, r = s.isHome ? o.competitorTwo : o.competitorOne, a = n.get(i) || {
|
|
2240
3366
|
opponentId: i,
|
|
2241
|
-
opponentName:
|
|
2242
|
-
opponentLogo:
|
|
3367
|
+
opponentName: r.name,
|
|
3368
|
+
opponentLogo: r.assets?.logo
|
|
2243
3369
|
};
|
|
2244
|
-
s.isHome ?
|
|
2245
|
-
}),
|
|
3370
|
+
s.isHome ? a.homeResult = s.result : a.awayResult = s.result, n.set(i, a);
|
|
3371
|
+
}), n;
|
|
2246
3372
|
}
|
|
2247
|
-
function
|
|
2248
|
-
const
|
|
2249
|
-
...
|
|
3373
|
+
function Qo(t, e, n, o, s, i, r) {
|
|
3374
|
+
const a = Rt(t, e), c = Rt(t, n), d = /* @__PURE__ */ new Set([
|
|
3375
|
+
...a.keys(),
|
|
2250
3376
|
...c.keys(),
|
|
2251
|
-
|
|
3377
|
+
e,
|
|
2252
3378
|
// Include home team as row for away team results
|
|
2253
|
-
|
|
3379
|
+
n
|
|
2254
3380
|
// Include away team as row for home team results
|
|
2255
|
-
]),
|
|
3381
|
+
]), f = [];
|
|
2256
3382
|
return d.forEach((l) => {
|
|
2257
|
-
const
|
|
2258
|
-
if (!
|
|
3383
|
+
const u = a.get(l), h = c.get(l);
|
|
3384
|
+
if (!u && !h && l !== e && l !== n)
|
|
2259
3385
|
return;
|
|
2260
|
-
let
|
|
2261
|
-
l ===
|
|
3386
|
+
let p, y;
|
|
3387
|
+
l === e ? (p = o, y = i) : l === n ? (p = s, y = r) : (p = u?.opponentName || h?.opponentName || "", y = u?.opponentLogo || h?.opponentLogo), f.push({
|
|
2262
3388
|
opponentId: l,
|
|
2263
|
-
opponentName:
|
|
2264
|
-
opponentLogo:
|
|
2265
|
-
homeTeamHome:
|
|
2266
|
-
homeTeamAway:
|
|
2267
|
-
awayTeamHome:
|
|
2268
|
-
awayTeamAway:
|
|
2269
|
-
isHomeTeamRow: l ===
|
|
2270
|
-
isAwayTeamRow: l ===
|
|
3389
|
+
opponentName: p,
|
|
3390
|
+
opponentLogo: y,
|
|
3391
|
+
homeTeamHome: u?.homeResult,
|
|
3392
|
+
homeTeamAway: u?.awayResult,
|
|
3393
|
+
awayTeamHome: h?.homeResult,
|
|
3394
|
+
awayTeamAway: h?.awayResult,
|
|
3395
|
+
isHomeTeamRow: l === e,
|
|
3396
|
+
isAwayTeamRow: l === n
|
|
2271
3397
|
});
|
|
2272
|
-
}),
|
|
3398
|
+
}), f.sort((l, u) => l.isHomeTeamRow ? -1 : u.isHomeTeamRow ? 1 : l.isAwayTeamRow ? -1 : u.isAwayTeamRow ? 1 : l.opponentName.localeCompare(u.opponentName));
|
|
2273
3399
|
}
|
|
2274
3400
|
export {
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
3401
|
+
Gn as GOAL_EVENT_TYPES,
|
|
3402
|
+
Xo as addProviderRef,
|
|
3403
|
+
Z as aggregatePlayerStatisticsFromMatches,
|
|
3404
|
+
Dn as analyzeMatch,
|
|
3405
|
+
q as cached,
|
|
3406
|
+
Tn as cachedBatch,
|
|
3407
|
+
ct as calcAverage,
|
|
3408
|
+
I as calcPercentage,
|
|
3409
|
+
Bo as calculateH2HStats,
|
|
3410
|
+
N as calculateStreak,
|
|
3411
|
+
Do as formatAsAverage,
|
|
3412
|
+
Uo as formatPossessionPercentage,
|
|
3413
|
+
Mo as formatStatValue,
|
|
3414
|
+
Go as formatWithAverage,
|
|
3415
|
+
go as getActiveSeason,
|
|
3416
|
+
Pn as getAllPlayerStatisticsFromMatches,
|
|
3417
|
+
Yn as getBasketballLivescore,
|
|
3418
|
+
Jo as getBatchMatchOdds,
|
|
3419
|
+
b as getConfig,
|
|
3420
|
+
lo as getFansUnitedCompetitions,
|
|
3421
|
+
ho as getFansUnitedCountries,
|
|
3422
|
+
co as getFansUnitedEntitiesByIds,
|
|
3423
|
+
ao as getFansUnitedEntityById,
|
|
3424
|
+
Xn as getFansUnitedFootballCompetition,
|
|
3425
|
+
Kn as getFansUnitedFootballCompetitions,
|
|
3426
|
+
eo as getFansUnitedFootballMatch,
|
|
3427
|
+
no as getFansUnitedFootballMatches,
|
|
3428
|
+
wn as getFansUnitedFootballPlayer,
|
|
3429
|
+
to as getFansUnitedFootballPlayers,
|
|
3430
|
+
oo as getFansUnitedFootballSearch,
|
|
3431
|
+
Jn as getFansUnitedFootballTeam,
|
|
3432
|
+
Zn as getFansUnitedFootballTeams,
|
|
3433
|
+
ro as getFansUnitedSearchEntities,
|
|
3434
|
+
fo as getFansUnitedTeamsByCompetition,
|
|
3435
|
+
uo as getFansUnitedTeamsByCountry,
|
|
3436
|
+
mo as getFansUnitedVenues,
|
|
3437
|
+
Zo as getFootballCompetition,
|
|
3438
|
+
wo as getFootballLivescore,
|
|
3439
|
+
ts as getFootballMatch,
|
|
3440
|
+
es as getFootballMatchCommentary,
|
|
3441
|
+
ns as getFootballMatchEvents,
|
|
3442
|
+
os as getFootballMatchLineups,
|
|
3443
|
+
ss as getFootballMatchOdds,
|
|
3444
|
+
is as getFootballMatchStatistics,
|
|
3445
|
+
rs as getFootballMatches,
|
|
3446
|
+
as as getFootballPlayerSeasonStatistics,
|
|
3447
|
+
cs as getFootballSeasonDetails,
|
|
3448
|
+
ls as getFootballStandings,
|
|
3449
|
+
ds as getFootballTeam,
|
|
3450
|
+
us as getFootballTeamSquad,
|
|
3451
|
+
fs as getLeaderboardMatches,
|
|
3452
|
+
hs as getLeaderboardTeamMatches,
|
|
3453
|
+
ms as getLeaderboardTemplate,
|
|
3454
|
+
$n as getMatchResult,
|
|
3455
|
+
Rn as getMostCardedPlayersFromMatches,
|
|
3456
|
+
$o as getOpponentScore,
|
|
3457
|
+
gs as getProviderRefId,
|
|
3458
|
+
Wo as getRecentH2HMeetings,
|
|
3459
|
+
Qn as getSportal365Standings,
|
|
3460
|
+
_o as getTeamFinishedMatches,
|
|
3461
|
+
jo as getTeamGoalStats,
|
|
3462
|
+
zo as getTeamHomeAwayStats,
|
|
3463
|
+
Fo as getTeamMostDecorated,
|
|
3464
|
+
po as getTeamNextMatch,
|
|
3465
|
+
Yo as getTeamOverUnderStats,
|
|
3466
|
+
yo as getTeamPreviousMatch,
|
|
3467
|
+
vo as getTeamResultsTable,
|
|
3468
|
+
ko as getTeamScore,
|
|
3469
|
+
Vn as getTeamSeasonStatistics,
|
|
3470
|
+
lt as getTeamStreaks,
|
|
3471
|
+
qo as getTeamStreaksComparison,
|
|
3472
|
+
Co as getTeamTopAppearances,
|
|
3473
|
+
Ao as getTeamTopAssisters,
|
|
3474
|
+
Eo as getTeamTopCleanSheets,
|
|
3475
|
+
Oo as getTeamTopMinutesPlayed,
|
|
3476
|
+
So as getTeamTopScorers,
|
|
3477
|
+
To as getTeamUpcomingMatches,
|
|
3478
|
+
Qo as getTeamsCommonOpponents,
|
|
3479
|
+
jn as getTennisLivescore,
|
|
3480
|
+
Nn as getTopAssistersFromMatches,
|
|
3481
|
+
In as getTopGoalContributorsFromMatches,
|
|
3482
|
+
bn as getTopScorersFromMatches,
|
|
3483
|
+
so as initL2,
|
|
3484
|
+
io as invalidate,
|
|
3485
|
+
ee as isConfigured,
|
|
3486
|
+
Ho as isMatchFinished,
|
|
3487
|
+
Un as isTeamAway,
|
|
3488
|
+
Ct as isTeamHome,
|
|
3489
|
+
xo as isTeamInMatch,
|
|
3490
|
+
qn as search,
|
|
3491
|
+
zn as searchFootball,
|
|
3492
|
+
ps as setConfig,
|
|
3493
|
+
E as streakFilters,
|
|
3494
|
+
L as toProviderRefArray,
|
|
3495
|
+
Io as useAllPlayerStatisticsFromMatches,
|
|
3496
|
+
No as useMostCardedPlayersFromMatches,
|
|
3497
|
+
Po as usePlayerStatistics,
|
|
3498
|
+
Mn as usePlayerStatisticsMap,
|
|
3499
|
+
bo as useTopAssistersFromMatches,
|
|
3500
|
+
Ro as useTopGoalContributorsFromMatches,
|
|
3501
|
+
Lo as useTopScorersFromMatches
|
|
2364
3502
|
};
|