fansunited-data-layer 0.9.0 → 0.11.1

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