fansunited-data-layer 0.0.4 → 0.0.5

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.
@@ -1,529 +1,6 @@
1
- import * as T from "react";
2
- import xe from "react";
3
- let V = null;
4
- function Kt(e) {
5
- V = e;
6
- }
7
- function O() {
8
- if (!V)
9
- throw new Error(
10
- "Data layer config not initialized. Call setConfig() in your root layout."
11
- );
12
- return V;
13
- }
14
- function zt() {
15
- return V !== null;
16
- }
17
- function je(e) {
18
- const t = e.replace(/\/$/, "");
19
- function r() {
20
- const { sportal365Sports: i } = O();
21
- if (!i)
22
- throw new Error("Sportal365 Sports API configuration is missing");
23
- const u = `${i.username}:${i.password}`;
24
- return `Basic ${btoa(u)}`;
25
- }
26
- function s(i) {
27
- return `${t}${i}`;
28
- }
29
- return {
30
- async get(i) {
31
- const { sportal365Sports: u } = O();
32
- if (!u)
33
- throw new Error("Sportal365 Sports API configuration is missing");
34
- const a = new URL(s(i.path));
35
- if (i.params)
36
- for (const [l, h] of Object.entries(i.params))
37
- h !== void 0 && (Array.isArray(h) ? h.length > 0 && a.searchParams.set(l, h.join(",")) : a.searchParams.set(l, h));
38
- const o = await fetch(a.toString(), {
39
- method: "GET",
40
- headers: {
41
- Authorization: r(),
42
- "Content-Type": "application/json",
43
- "X-Project-Id": u.projectId
44
- },
45
- signal: u.timeout ? AbortSignal.timeout(u.timeout) : void 0
46
- });
47
- if (!o.ok)
48
- throw new Error(`Sportal365 API error: ${o.status} ${o.statusText}`);
49
- return o.json();
50
- }
51
- };
52
- }
53
- const Ue = "https://football.api.sportal365.com", k = je(Ue);
54
- function fe(e) {
55
- if (e)
56
- return {
57
- id: e.id,
58
- name: e.name,
59
- slug: e.slug,
60
- position: e.position,
61
- gender: e.gender,
62
- assets: e.assets ? {
63
- photo: e.assets.thumb?.url,
64
- photoTransparent: e.assets.thumb_transparent_background?.url
65
- } : void 0
66
- };
67
- }
68
- const Ye = {
69
- // Scoring events
70
- GOAL: "GOAL",
71
- PENALTY_GOAL: "PENALTY_GOAL",
72
- OWN_GOAL: "OWN_GOAL",
73
- DISALLOWED_GOAL: "DISALLOWED_GOAL",
74
- PENALTY_SHOOTOUT_SCORED: "PENALTY_SHOOTOUT_SCORED",
75
- PENALTY_SHOOTOUT_MISSED: "PENALTY_SHOOTOUT_MISSED",
76
- // Card events
77
- YELLOW_CARD: "YELLOW_CARD",
78
- RED_CARD: "RED_CARD",
79
- YELLOW_RED_CARD: "YELLOW_RED_CARD",
80
- // Substitution
81
- SUBSTITUTION: "SUBSTITUTION",
82
- // Match flow events
83
- KICKOFF: "KICKOFF",
84
- HALFTIME: "HALFTIME",
85
- START_SECOND_HALF: "START_SECOND_HALF",
86
- FINISHED: "FINISHED",
87
- INJURY_TIME: "INJURY_TIME",
88
- // Penalty events
89
- PENALTY_AWARDED: "PENALTY_AWARDED",
90
- PENALTY_MISSED: "PENALTY_MISSED",
91
- PENALTY_SAVED: "PENALTY_SAVED"
92
- };
93
- function w(e) {
94
- const t = Ye[e.type_code];
95
- return t ? {
96
- id: e.id,
97
- type: t,
98
- competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
99
- minute: e.minute,
100
- injuryMinute: e.injury_minute,
101
- primaryPlayer: fe(e.primary_player),
102
- secondaryPlayer: fe(e.secondary_player),
103
- score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
104
- } : (console.warn(`Unknown event type: ${e.type_code}`), null);
105
- }
106
- function $e(e) {
107
- return {
108
- code: {
109
- FINISHED: "finished",
110
- NOT_STARTED: "not_started",
111
- LIVE: "live",
112
- INTERRUPTED: "interrupted",
113
- CANCELLED: "cancelled",
114
- POSTPONED: "postponed",
115
- UNKNOWN: "not_started",
116
- ABANDONED: "abandoned"
117
- }[e.type] ?? "not_started",
118
- name: e.name,
119
- shortName: e.short_name,
120
- type: e.type
121
- };
122
- }
123
- function he(e) {
124
- return {
125
- id: e.id,
126
- name: e.name,
127
- shortName: e.short_name ?? void 0,
128
- threeLetterCode: e.three_letter_code,
129
- slug: e.slug,
130
- type: e.type ?? "club",
131
- gender: e.gender,
132
- assets: e.assets ? {
133
- logo: e.assets.logo?.url,
134
- homeKit: e.assets.home_kit?.url,
135
- awayKit: e.assets.away_kit?.url,
136
- squadImage: e.assets.squad_image?.url
137
- } : void 0,
138
- metadata: e.shirt_color ? { shirtColor: e.shirt_color } : void 0
139
- };
140
- }
141
- function qe(e) {
142
- return {
143
- kickoffTime: new Date(e.kickoff_time),
144
- currentMinute: e.minute?.regular_time,
145
- phaseStartedAt: e.phase_started_at ? new Date(e.phase_started_at) : void 0,
146
- finishedAt: e.finished_at ? new Date(e.finished_at) : void 0,
147
- firstHalfStartedAt: e.first_half_started_at ? new Date(e.first_half_started_at) : void 0,
148
- secondHalfStartedAt: e.second_half_started_at ? new Date(e.second_half_started_at) : void 0,
149
- extraTimeFirstHalfStartedAt: e.extra_time_first_half_started_at ? new Date(e.extra_time_first_half_started_at) : void 0,
150
- extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
151
- };
152
- }
153
- function Be(e) {
154
- if (!e) return;
155
- const t = (s) => s ? { competitorOne: String(s.home), competitorTwo: String(s.away) } : void 0, r = e.total ?? e.regular_time;
156
- return {
157
- competitorOne: r?.home != null ? String(r.home) : null,
158
- competitorTwo: r?.away != null ? String(r.away) : null,
159
- breakdown: {
160
- total: t(e.total),
161
- halfTime: t(e.half_time),
162
- regularTime: t(e.regular_time),
163
- extraTime: t(e.extra_time),
164
- penaltyShootout: t(e.penalty_shootout),
165
- aggregate: t(e.aggregate)
166
- }
167
- };
168
- }
169
- function Qe(e) {
170
- if (e)
171
- return {
172
- id: e.id,
173
- name: e.name,
174
- slug: e.slug,
175
- assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0
176
- };
177
- }
178
- function He(e) {
179
- if (e?.length)
180
- return e.map((t) => ({
181
- id: t.id,
182
- name: t.name,
183
- slug: t.slug,
184
- role: t.role ?? "REFEREE",
185
- gender: t.gender
186
- }));
187
- }
188
- function We(e) {
189
- if (!e.season?.tournament) return;
190
- const { tournament: t, ...r } = e.season;
191
- return {
192
- id: t.id,
193
- name: t.name,
194
- slug: t.slug,
195
- type: t.type,
196
- region: t.region,
197
- country: t.country ? {
198
- id: t.country.id,
199
- name: t.country.name,
200
- code: t.country.code ?? void 0,
201
- flag: t.country.assets?.flag?.url
202
- } : void 0,
203
- season: {
204
- id: r.id,
205
- name: r.name,
206
- status: r.status
207
- },
208
- stage: e.stage ? {
209
- id: e.stage.id,
210
- name: e.stage.name,
211
- type: e.stage.type
212
- } : void 0,
213
- assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0
214
- };
215
- }
216
- function Ve(e) {
217
- if (!e.winner?.match?.id) return;
218
- const t = {
219
- "Regular Time": "REGULAR_TIME",
220
- "Extra Time": "EXTRA_TIME",
221
- Penalties: "PENALTIES"
222
- };
223
- return {
224
- competitorId: e.winner.match.id,
225
- reason: e.winner.match.reason?.name ? t[e.winner.match.reason.name] : void 0,
226
- aggregate: !!e.winner.aggregate
227
- };
228
- }
229
- function Ne(e) {
230
- return {
231
- id: e.id,
232
- slug: e.slug,
233
- status: $e(e.status),
234
- timing: qe(e),
235
- competitorOne: he(e.home_team),
236
- competitorTwo: he(e.away_team),
237
- competition: We(e),
238
- round: e.round ? {
239
- id: e.round.id ?? e.round.key,
240
- key: e.round.key,
241
- name: e.round.name,
242
- type: e.round.type ?? "REGULAR"
243
- } : void 0,
244
- group: e.group ? {
245
- id: e.group.id,
246
- name: e.group.name
247
- } : void 0,
248
- venue: Qe(e.venue),
249
- officials: He(e.referees),
250
- spectators: e.spectators ?? void 0,
251
- score: Be(e.score),
252
- mainEvents: e.main_events?.map(w).filter((t) => t !== null),
253
- penaltyShootoutEvents: e.penalty_shootout_events?.map(w).filter((t) => t !== null),
254
- winner: Ve(e),
255
- coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
256
- lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status
257
- };
258
- }
259
- function we(e) {
260
- const t = e.player;
261
- return {
262
- id: t.id,
263
- name: t.name,
264
- slug: t.slug,
265
- position: t.position,
266
- shirtNumber: e.shirt_number,
267
- positionX: e.position_x ?? void 0,
268
- positionY: e.position_y ?? void 0,
269
- country: t.country ? {
270
- id: t.country.id,
271
- name: t.country.name,
272
- code: t.country.code
273
- } : void 0,
274
- birthdate: t.birthdate,
275
- profile: t.profile ? {
276
- height: t.profile.height,
277
- weight: t.profile.weight
278
- } : void 0,
279
- events: e.events?.map(w).filter((r) => r !== null)
280
- };
281
- }
282
- function me(e) {
283
- const t = [], r = [];
284
- for (const s of e.players) {
285
- const i = we(s);
286
- s.type.category === "start" ? t.push(i) : s.type.category === "sub" && r.push(i);
287
- }
288
- return {
289
- competitorId: e.team_id,
290
- formation: e.formation,
291
- coach: e.coach ? {
292
- id: e.coach.id,
293
- name: e.coach.name,
294
- slug: e.coach.slug,
295
- country: e.coach.country ? {
296
- id: e.coach.country.id,
297
- name: e.coach.country.name,
298
- code: e.coach.country.code
299
- } : void 0,
300
- birthdate: e.coach.birthdate
301
- } : void 0,
302
- starters: t,
303
- substitutes: r
304
- };
305
- }
306
- function Ge(e) {
307
- return {
308
- matchId: e.match_id,
309
- confirmed: e.status === "CONFIRMED",
310
- competitorOne: me(e.home_team),
311
- competitorTwo: me(e.away_team)
312
- };
313
- }
314
- function v(e, t, r, s) {
315
- return t == null ? null : { key: e, value: String(t), label: r, unit: s };
316
- }
317
- function pe(e, t) {
318
- const r = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), s = [
319
- v("possession", t.possession, "Possession", "%"),
320
- v("shots_total", r, "Shots"),
321
- v("shots_on_target", t.shots_on, "Shots on Target"),
322
- v("shots_off_target", t.shots_off, "Shots off Target"),
323
- v("shots_blocked", t.shots_blocked, "Shots Blocked"),
324
- v("corners", t.corners, "Corner Kicks"),
325
- v("goal_kicks", t.goal_kicks, "Goal Kicks"),
326
- v("throw_ins", t.throw_in, "Throw Ins"),
327
- v("offsides", t.offside, "Offsides"),
328
- v("fouls", t.fouls_committed, "Fouls"),
329
- v("yellow_cards", t.yellow_cards, "Yellow Cards"),
330
- v("passes", t.pass, "Passes"),
331
- v("crosses", t.crosses, "Crosses")
332
- ];
333
- return {
334
- competitorId: e,
335
- statistics: s.filter((i) => i !== null)
336
- };
337
- }
338
- function Ke(e) {
339
- const t = e.find((s) => s.home_team), r = e.find((s) => !s.home_team);
340
- if (!t || !r)
341
- throw new Error("Missing competitor statistics");
342
- return {
343
- competitorOne: pe(String(t.team.id), t.statistics),
344
- competitorTwo: pe(String(r.team.id), r.statistics)
345
- };
346
- }
347
- function ze(e) {
348
- const t = e.urls?.find((r) => r.app_type === "desktop")?.url;
349
- return {
350
- id: e.id,
351
- name: e.name,
352
- code: e.code,
353
- value: e.value ?? void 0,
354
- odds: e.odds,
355
- oddsOld: e.odds_old,
356
- movement: e.movement === "STABLE" ? "NONE" : e.movement,
357
- url: t
358
- };
359
- }
360
- function Je(e) {
361
- return {
362
- type: {
363
- id: e.type.id,
364
- code: e.type.code,
365
- name: e.type.name
366
- },
367
- period: {
368
- id: e.scope.id,
369
- type: e.scope.type,
370
- name: e.scope.name
371
- },
372
- selections: e.selections.map(ze)
373
- };
374
- }
375
- function Xe(e) {
376
- return {
377
- operator: {
378
- id: e.bookmaker.id,
379
- name: e.bookmaker.name,
380
- url: e.bookmaker.url,
381
- branding: e.bookmaker.branding ? {
382
- backgroundColor: e.bookmaker.branding.background_color,
383
- textColor: e.bookmaker.branding.text_color,
384
- logo: e.bookmaker.assets?.[0]?.logo
385
- } : void 0
386
- },
387
- type: e.type,
388
- markets: e.markets.map(Je)
389
- };
390
- }
391
- function Ze(e, t) {
392
- return {
393
- matchId: e,
394
- operators: t.map(Xe)
395
- };
396
- }
397
- function ge(e) {
398
- if (e == null || e === "")
399
- return;
400
- const t = typeof e == "number" ? e : parseInt(e, 10);
401
- return isNaN(t) ? void 0 : t;
402
- }
403
- function et(e) {
404
- return {
405
- externalId: e.external_id,
406
- minute: ge(e.elapsed),
407
- addedTime: ge(e.elapsed_plus),
408
- text: e.auto_text,
409
- details: e.details,
410
- meta: {
411
- type: e.type,
412
- commentaryType: e.commentary_type,
413
- subtype1: e.subtype_1,
414
- subtype2: e.subtype_2,
415
- timestamp: e.incident_timestamp
416
- }
417
- };
418
- }
419
- async function tt(e, t = {}) {
420
- const { sportal365Sports: r } = O(), s = await k.get({
421
- path: `/v2/matches/${e}`,
422
- params: {
423
- language_code: t.languageCode ?? r?.languageCode ?? "en",
424
- odd_client: t.oddClient,
425
- odd_type: t.oddType,
426
- scope_type: t.scopeType,
427
- odd_format: t.oddFormat,
428
- market_types: t.marketTypes,
429
- bookmaker_ids: t.bookmakerIds,
430
- optional_data: t.optionalData
431
- }
432
- });
433
- return Ne(s);
434
- }
435
- async function Jt(e, t = {}) {
436
- const { sportal365Sports: r } = O();
437
- return (await k.get({
438
- path: `/v2/matches/${e}/events`,
439
- params: {
440
- language_code: t.languageCode ?? r?.languageCode ?? "en"
441
- }
442
- })).events.map(w).filter((i) => i !== null);
443
- }
444
- async function Xt(e, t = {}) {
445
- const { sportal365Sports: r } = O(), s = await k.get({
446
- path: `/v2/matches/${e}/lineups`,
447
- params: {
448
- language_code: t.languageCode ?? r?.languageCode ?? "en"
449
- }
450
- });
451
- return Ge(s);
452
- }
453
- async function Zt(e, t = {}) {
454
- const { sportal365Sports: r } = O(), s = await k.get({
455
- path: `/v2/matches/${e}`,
456
- params: {
457
- language_code: t.languageCode ?? r?.languageCode ?? "en",
458
- odd_client: t.oddClient ?? r?.oddClient,
459
- odd_type: t.oddType,
460
- scope_type: t.scopeType ?? "ALL",
461
- odd_format: t.oddFormat ?? "DECIMAL",
462
- market_types: t.marketTypes,
463
- bookmaker_ids: t.bookmakerIds
464
- }
465
- });
466
- return Ze(e, s.odds ?? []);
467
- }
468
- async function er(e, t = {}) {
469
- const { sportal365Sports: r } = O(), s = await k.get({
470
- path: `/events/${e}/teamstats`,
471
- params: {
472
- language_code: t.languageCode ?? r?.languageCode ?? "en"
473
- }
474
- });
475
- return Ke(s);
476
- }
477
- async function tr(e, t = {}) {
478
- const { sportal365Sports: r } = O();
479
- return (await k.get({
480
- path: `/matches/${e}/commentary`,
481
- params: {
482
- language_code: t.languageCode ?? r?.languageCode ?? "en"
483
- }
484
- })).map(et);
485
- }
486
- async function rt(e) {
487
- const { sportal365Sports: t } = O();
488
- return (await k.get({
489
- path: "/v2/matches",
490
- params: {
491
- language_code: e.languageCode ?? t?.languageCode ?? "en",
492
- limit: e.limit.toString(),
493
- offset: e.offset.toString(),
494
- // Competition filters
495
- tournament_ids: e.tournamentIds,
496
- season_ids: e.seasonIds,
497
- stage_ids: e.stageIds,
498
- group_ids: e.groupIds,
499
- round_ids: e.roundIds,
500
- round_filter: e.roundFilter,
501
- // Time filters
502
- from_kickoff_time: e.fromKickoffTime,
503
- to_kickoff_time: e.toKickoffTime,
504
- // Entity filters
505
- team_ids: e.teamIds,
506
- team_ids_operator: e.teamIdsOperator,
507
- referee_id: e.refereeId,
508
- venue_id: e.venueId,
509
- player_id: e.playerId,
510
- // Status filters
511
- status_types: e.statusTypes,
512
- status_codes: e.statusCodes,
513
- // Odds
514
- odd_client: e.oddClient ?? t?.oddClient,
515
- odd_type: e.oddType,
516
- scope_type: e.scopeType,
517
- odd_format: e.oddFormat,
518
- market_types: e.marketTypes,
519
- bookmaker_ids: e.bookmakerIds,
520
- // Sorting and optional data
521
- sort_direction: e.sortDirection,
522
- optional_data: e.optionalData
523
- }
524
- })).matches.map(Ne);
525
- }
526
- function nt(e) {
1
+ import { g as o, f as l } from "./prepareTeamMatches.server-B9jIHuIg.js";
2
+ import { a as u, h as d, b as m, c as p, d as h, e as f, j as y, i as b, k as M, p as F, m as _, n as C, l as v, s as T } from "./prepareTeamMatches.server-B9jIHuIg.js";
3
+ function n(e) {
527
4
  return {
528
5
  id: e.id,
529
6
  name: e.name,
@@ -546,1240 +23,31 @@ function nt(e) {
546
23
  } : void 0
547
24
  };
548
25
  }
549
- async function rr(e, t = {}) {
550
- const { sportal365Sports: r } = O(), s = await k.get({
26
+ async function c(e, t = {}) {
27
+ const { sportal365Sports: a } = o(), s = await l.get({
551
28
  path: `/v2/teams/${e}`,
552
29
  params: {
553
- language_code: t.languageCode ?? r?.languageCode ?? "en",
30
+ language_code: t.languageCode ?? a?.languageCode ?? "en",
554
31
  optional_data: "form"
555
32
  }
556
33
  });
557
- return nt(s);
558
- }
559
- function ye(e, t) {
560
- return {
561
- id: e.id,
562
- name: e.name,
563
- shortName: e.shortName,
564
- logo: e.assets?.logo ? { url: e.assets.logo, alt: e.name } : void 0,
565
- score: t != null ? st(t) : void 0
566
- };
567
- }
568
- function st(e) {
569
- return {
570
- main: e
571
- };
572
- }
573
- function it(e) {
574
- switch (e.type) {
575
- case "LIVE":
576
- return "live";
577
- case "FINISHED":
578
- return "final";
579
- case "POSTPONED":
580
- return "postponed";
581
- case "CANCELLED":
582
- return "cancelled";
583
- case "INTERRUPTED":
584
- case "ABANDONED":
585
- return "suspended";
586
- case "NOT_STARTED":
587
- default:
588
- return "scheduled";
589
- }
590
- }
591
- function ot(e, t) {
592
- if (t.type === "LIVE")
593
- return {
594
- current: e.currentPeriod,
595
- label: e.currentMinute ? `${e.currentMinute}'` : void 0
596
- };
597
- }
598
- function at(e) {
599
- if (e.type === "LIVE")
600
- return { color: "#ef4444" };
601
- }
602
- function De(e) {
603
- return {
604
- id: e.id,
605
- sport: "football",
606
- competitorOne: ye(e.competitorOne, e.score?.competitorOne),
607
- competitorTwo: ye(e.competitorTwo, e.score?.competitorTwo),
608
- status: it(e.status),
609
- period: ot(e.timing, e.status),
610
- liveIndicator: at(e.status),
611
- metadata: {
612
- venue: e.venue?.name,
613
- date: e.timing.kickoffTime.toISOString().split("T")[0],
614
- time: e.timing.kickoffTime.toLocaleTimeString("en-US", {
615
- hour: "2-digit",
616
- minute: "2-digit",
617
- hour12: !1
618
- }),
619
- competition: e.competition?.name,
620
- round: e.round?.name,
621
- winner: e.winner?.competitorId === e.competitorOne.id ? "competitorOne" : e.winner?.competitorId === e.competitorTwo.id ? "competitorTwo" : void 0
622
- },
623
- link: e.slug ? `/match/${e.slug}` : `/match/${e.id}`
624
- };
625
- }
626
- function ut(e) {
627
- return e.toISOString().split("T")[0];
628
- }
629
- async function ct(e, t) {
630
- const r = await tt(e, {
631
- languageCode: t?.languageCode
632
- });
633
- return De(r);
634
- }
635
- function lt(e) {
636
- return {
637
- match: De(e),
638
- dateGroup: ut(e.timing.kickoffTime),
639
- competitionGroup: e.competition?.name,
640
- competitionLogo: e.competition?.assets?.logo,
641
- competitionSubtitle: e.competition?.country?.name,
642
- roundGroup: e.round?.name
643
- };
644
- }
645
- function dt(e) {
646
- const t = {
647
- limit: e.limit ?? 50,
648
- offset: e.offset ?? 0,
649
- languageCode: e.languageCode
650
- };
651
- return e.fromDate && (t.fromKickoffTime = e.fromDate), e.toDate && (t.toKickoffTime = e.toDate), e.tournamentIds && (t.tournamentIds = e.tournamentIds), e.teamId && (t.teamIds = [e.teamId]), e.roundIds && (t.roundIds = e.roundIds), e.seasonIds && (t.seasonIds = e.seasonIds), e.statusTypes && (t.statusTypes = e.statusTypes), e.variant === "teamResults" || e.variant === "teamResultsByCompetition" ? t.sortDirection = "desc" : (e.variant === "teamFixtures" || e.variant === "teamFixturesByCompetition") && (t.sortDirection = "asc"), t;
652
- }
653
- async function G(e) {
654
- const t = dt(e);
655
- return {
656
- items: (await rt(t)).map((i) => lt(i)),
657
- variant: e.variant
658
- };
659
- }
660
- var ne = class {
661
- constructor() {
662
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
663
- }
664
- subscribe(e) {
665
- return this.listeners.add(e), this.onSubscribe(), () => {
666
- this.listeners.delete(e), this.onUnsubscribe();
667
- };
668
- }
669
- hasListeners() {
670
- return this.listeners.size > 0;
671
- }
672
- onSubscribe() {
673
- }
674
- onUnsubscribe() {
675
- }
676
- }, ft = {
677
- // We need the wrapper function syntax below instead of direct references to
678
- // global setTimeout etc.
679
- //
680
- // BAD: `setTimeout: setTimeout`
681
- // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
682
- //
683
- // If we use direct references here, then anything that wants to spy on or
684
- // replace the global setTimeout (like tests) won't work since we'll already
685
- // have a hard reference to the original implementation at the time when this
686
- // file was imported.
687
- setTimeout: (e, t) => setTimeout(e, t),
688
- clearTimeout: (e) => clearTimeout(e),
689
- setInterval: (e, t) => setInterval(e, t),
690
- clearInterval: (e) => clearInterval(e)
691
- }, ht = class {
692
- // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
693
- // type at app boot; and if we leave that type, then any new timer provider
694
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
695
- //
696
- // We settle for type safety for the TimeoutProvider type, and accept that
697
- // this class is unsafe internally to allow for extension.
698
- #t = ft;
699
- #e = !1;
700
- setTimeoutProvider(e) {
701
- process.env.NODE_ENV !== "production" && this.#e && e !== this.#t && console.error(
702
- "[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
703
- { previous: this.#t, provider: e }
704
- ), this.#t = e, process.env.NODE_ENV !== "production" && (this.#e = !1);
705
- }
706
- setTimeout(e, t) {
707
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setTimeout(e, t);
708
- }
709
- clearTimeout(e) {
710
- this.#t.clearTimeout(e);
711
- }
712
- setInterval(e, t) {
713
- return process.env.NODE_ENV !== "production" && (this.#e = !0), this.#t.setInterval(e, t);
714
- }
715
- clearInterval(e) {
716
- this.#t.clearInterval(e);
717
- }
718
- }, H = new ht();
719
- function mt(e) {
720
- setTimeout(e, 0);
721
- }
722
- var Y = typeof window > "u" || "Deno" in globalThis;
723
- function Z() {
724
- }
725
- function _e(e) {
726
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
727
- }
728
- function pt(e, t) {
729
- return Math.max(e + (t || 0) - Date.now(), 0);
730
- }
731
- function U(e, t) {
732
- return typeof e == "function" ? e(t) : e;
733
- }
734
- function E(e, t) {
735
- return typeof e == "function" ? e(t) : e;
736
- }
737
- var gt = Object.prototype.hasOwnProperty;
738
- function ee(e, t) {
739
- if (e === t)
740
- return e;
741
- const r = ve(e) && ve(t);
742
- if (!r && !(be(e) && be(t))) return t;
743
- const i = (r ? e : Object.keys(e)).length, u = r ? t : Object.keys(t), a = u.length, o = r ? new Array(a) : {};
744
- let l = 0;
745
- for (let h = 0; h < a; h++) {
746
- const d = r ? h : u[h], y = e[d], f = t[d];
747
- if (y === f) {
748
- o[d] = y, (r ? h < i : gt.call(e, d)) && l++;
749
- continue;
750
- }
751
- if (y === null || f === null || typeof y != "object" || typeof f != "object") {
752
- o[d] = f;
753
- continue;
754
- }
755
- const S = ee(y, f);
756
- o[d] = S, S === y && l++;
757
- }
758
- return i === a && l === i ? e : o;
759
- }
760
- function te(e, t) {
761
- if (!t || Object.keys(e).length !== Object.keys(t).length)
762
- return !1;
763
- for (const r in e)
764
- if (e[r] !== t[r])
765
- return !1;
766
- return !0;
767
- }
768
- function ve(e) {
769
- return Array.isArray(e) && e.length === Object.keys(e).length;
770
- }
771
- function be(e) {
772
- if (!Ee(e))
773
- return !1;
774
- const t = e.constructor;
775
- if (t === void 0)
776
- return !0;
777
- const r = t.prototype;
778
- return !(!Ee(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
779
- }
780
- function Ee(e) {
781
- return Object.prototype.toString.call(e) === "[object Object]";
782
- }
783
- function Te(e, t, r) {
784
- if (typeof r.structuralSharing == "function")
785
- return r.structuralSharing(e, t);
786
- if (r.structuralSharing !== !1) {
787
- if (process.env.NODE_ENV !== "production")
788
- try {
789
- return ee(e, t);
790
- } catch (s) {
791
- throw console.error(
792
- `Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${s}`
793
- ), s;
794
- }
795
- return ee(e, t);
796
- }
797
- return t;
798
- }
799
- function yt(e, t) {
800
- return typeof e == "function" ? e(...t) : !!e;
801
- }
802
- var _t = class extends ne {
803
- #t;
804
- #e;
805
- #n;
806
- constructor() {
807
- super(), this.#n = (e) => {
808
- if (!Y && window.addEventListener) {
809
- const t = () => e();
810
- return window.addEventListener("visibilitychange", t, !1), () => {
811
- window.removeEventListener("visibilitychange", t);
812
- };
813
- }
814
- };
815
- }
816
- onSubscribe() {
817
- this.#e || this.setEventListener(this.#n);
818
- }
819
- onUnsubscribe() {
820
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
821
- }
822
- setEventListener(e) {
823
- this.#n = e, this.#e?.(), this.#e = e((t) => {
824
- typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
825
- });
826
- }
827
- setFocused(e) {
828
- this.#t !== e && (this.#t = e, this.onFocus());
829
- }
830
- onFocus() {
831
- const e = this.isFocused();
832
- this.listeners.forEach((t) => {
833
- t(e);
834
- });
835
- }
836
- isFocused() {
837
- return typeof this.#t == "boolean" ? this.#t : globalThis.document?.visibilityState !== "hidden";
838
- }
839
- }, vt = new _t();
840
- function Se() {
841
- let e, t;
842
- const r = new Promise((i, u) => {
843
- e = i, t = u;
844
- });
845
- r.status = "pending", r.catch(() => {
846
- });
847
- function s(i) {
848
- Object.assign(r, i), delete r.resolve, delete r.reject;
849
- }
850
- return r.resolve = (i) => {
851
- s({
852
- status: "fulfilled",
853
- value: i
854
- }), e(i);
855
- }, r.reject = (i) => {
856
- s({
857
- status: "rejected",
858
- reason: i
859
- }), t(i);
860
- }, r;
861
- }
862
- var bt = mt;
863
- function Et() {
864
- let e = [], t = 0, r = (o) => {
865
- o();
866
- }, s = (o) => {
867
- o();
868
- }, i = bt;
869
- const u = (o) => {
870
- t ? e.push(o) : i(() => {
871
- r(o);
872
- });
873
- }, a = () => {
874
- const o = e;
875
- e = [], o.length && i(() => {
876
- s(() => {
877
- o.forEach((l) => {
878
- r(l);
879
- });
880
- });
881
- });
882
- };
883
- return {
884
- batch: (o) => {
885
- let l;
886
- t++;
887
- try {
888
- l = o();
889
- } finally {
890
- t--, t || a();
891
- }
892
- return l;
893
- },
894
- /**
895
- * All calls to the wrapped function will be batched.
896
- */
897
- batchCalls: (o) => (...l) => {
898
- u(() => {
899
- o(...l);
900
- });
901
- },
902
- schedule: u,
903
- /**
904
- * Use this method to set a custom notify function.
905
- * This can be used to for example wrap notifications with `React.act` while running tests.
906
- */
907
- setNotifyFunction: (o) => {
908
- r = o;
909
- },
910
- /**
911
- * Use this method to set a custom function to batch notifications together into a single tick.
912
- * By default React Query will use the batch function provided by ReactDOM or React Native.
913
- */
914
- setBatchNotifyFunction: (o) => {
915
- s = o;
916
- },
917
- setScheduler: (o) => {
918
- i = o;
919
- }
920
- };
921
- }
922
- var Pe = Et(), Tt = class extends ne {
923
- #t = !0;
924
- #e;
925
- #n;
926
- constructor() {
927
- super(), this.#n = (e) => {
928
- if (!Y && window.addEventListener) {
929
- const t = () => e(!0), r = () => e(!1);
930
- return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
931
- window.removeEventListener("online", t), window.removeEventListener("offline", r);
932
- };
933
- }
934
- };
935
- }
936
- onSubscribe() {
937
- this.#e || this.setEventListener(this.#n);
938
- }
939
- onUnsubscribe() {
940
- this.hasListeners() || (this.#e?.(), this.#e = void 0);
941
- }
942
- setEventListener(e) {
943
- this.#n = e, this.#e?.(), this.#e = e(this.setOnline.bind(this));
944
- }
945
- setOnline(e) {
946
- this.#t !== e && (this.#t = e, this.listeners.forEach((r) => {
947
- r(e);
948
- }));
949
- }
950
- isOnline() {
951
- return this.#t;
952
- }
953
- }, St = new Tt();
954
- function Ot(e) {
955
- return (e ?? "online") === "online" ? St.isOnline() : !0;
956
- }
957
- function It(e, t) {
958
- return {
959
- fetchFailureCount: 0,
960
- fetchFailureReason: null,
961
- fetchStatus: Ot(t.networkMode) ? "fetching" : "paused",
962
- ...e === void 0 && {
963
- error: null,
964
- status: "pending"
965
- }
966
- };
967
- }
968
- var Rt = class extends ne {
969
- constructor(e, t) {
970
- super(), this.options = t, this.#t = e, this.#i = null, this.#s = Se(), this.bindMethods(), this.setOptions(t);
971
- }
972
- #t;
973
- #e = void 0;
974
- #n = void 0;
975
- #r = void 0;
976
- #a;
977
- #d;
978
- #s;
979
- #i;
980
- #p;
981
- #f;
982
- // This property keeps track of the last query with defined data.
983
- // It will be used to pass the previous data and query to the placeholder function between renders.
984
- #h;
985
- #u;
986
- #c;
987
- #o;
988
- #m = /* @__PURE__ */ new Set();
989
- bindMethods() {
990
- this.refetch = this.refetch.bind(this);
991
- }
992
- onSubscribe() {
993
- this.listeners.size === 1 && (this.#e.addObserver(this), Oe(this.#e, this.options) ? this.#l() : this.updateResult(), this.#v());
994
- }
995
- onUnsubscribe() {
996
- this.hasListeners() || this.destroy();
997
- }
998
- shouldFetchOnReconnect() {
999
- return re(
1000
- this.#e,
1001
- this.options,
1002
- this.options.refetchOnReconnect
1003
- );
1004
- }
1005
- shouldFetchOnWindowFocus() {
1006
- return re(
1007
- this.#e,
1008
- this.options,
1009
- this.options.refetchOnWindowFocus
1010
- );
1011
- }
1012
- destroy() {
1013
- this.listeners = /* @__PURE__ */ new Set(), this.#b(), this.#E(), this.#e.removeObserver(this);
1014
- }
1015
- setOptions(e) {
1016
- const t = this.options, r = this.#e;
1017
- if (this.options = this.#t.defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof E(this.options.enabled, this.#e) != "boolean")
1018
- throw new Error(
1019
- "Expected enabled to be a boolean or a callback that returns a boolean"
1020
- );
1021
- this.#T(), this.#e.setOptions(this.options), t._defaulted && !te(this.options, t) && this.#t.getQueryCache().notify({
1022
- type: "observerOptionsUpdated",
1023
- query: this.#e,
1024
- observer: this
1025
- });
1026
- const s = this.hasListeners();
1027
- s && Ie(
1028
- this.#e,
1029
- r,
1030
- this.options,
1031
- t
1032
- ) && this.#l(), this.updateResult(), s && (this.#e !== r || E(this.options.enabled, this.#e) !== E(t.enabled, this.#e) || U(this.options.staleTime, this.#e) !== U(t.staleTime, this.#e)) && this.#g();
1033
- const i = this.#y();
1034
- s && (this.#e !== r || E(this.options.enabled, this.#e) !== E(t.enabled, this.#e) || i !== this.#o) && this.#_(i);
1035
- }
1036
- getOptimisticResult(e) {
1037
- const t = this.#t.getQueryCache().build(this.#t, e), r = this.createResult(t, e);
1038
- return kt(this, r) && (this.#r = r, this.#d = this.options, this.#a = this.#e.state), r;
1039
- }
1040
- getCurrentResult() {
1041
- return this.#r;
1042
- }
1043
- trackResult(e, t) {
1044
- return new Proxy(e, {
1045
- get: (r, s) => (this.trackProp(s), t?.(s), s === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && this.#s.status === "pending" && this.#s.reject(
1046
- new Error(
1047
- "experimental_prefetchInRender feature flag is not enabled"
1048
- )
1049
- )), Reflect.get(r, s))
1050
- });
1051
- }
1052
- trackProp(e) {
1053
- this.#m.add(e);
1054
- }
1055
- getCurrentQuery() {
1056
- return this.#e;
1057
- }
1058
- refetch({ ...e } = {}) {
1059
- return this.fetch({
1060
- ...e
1061
- });
1062
- }
1063
- fetchOptimistic(e) {
1064
- const t = this.#t.defaultQueryOptions(e), r = this.#t.getQueryCache().build(this.#t, t);
1065
- return r.fetch().then(() => this.createResult(r, t));
1066
- }
1067
- fetch(e) {
1068
- return this.#l({
1069
- ...e,
1070
- cancelRefetch: e.cancelRefetch ?? !0
1071
- }).then(() => (this.updateResult(), this.#r));
1072
- }
1073
- #l(e) {
1074
- this.#T();
1075
- let t = this.#e.fetch(
1076
- this.options,
1077
- e
1078
- );
1079
- return e?.throwOnError || (t = t.catch(Z)), t;
1080
- }
1081
- #g() {
1082
- this.#b();
1083
- const e = U(
1084
- this.options.staleTime,
1085
- this.#e
1086
- );
1087
- if (Y || this.#r.isStale || !_e(e))
1088
- return;
1089
- const r = pt(this.#r.dataUpdatedAt, e) + 1;
1090
- this.#u = H.setTimeout(() => {
1091
- this.#r.isStale || this.updateResult();
1092
- }, r);
1093
- }
1094
- #y() {
1095
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#e) : this.options.refetchInterval) ?? !1;
1096
- }
1097
- #_(e) {
1098
- this.#E(), this.#o = e, !(Y || E(this.options.enabled, this.#e) === !1 || !_e(this.#o) || this.#o === 0) && (this.#c = H.setInterval(() => {
1099
- (this.options.refetchIntervalInBackground || vt.isFocused()) && this.#l();
1100
- }, this.#o));
1101
- }
1102
- #v() {
1103
- this.#g(), this.#_(this.#y());
1104
- }
1105
- #b() {
1106
- this.#u && (H.clearTimeout(this.#u), this.#u = void 0);
1107
- }
1108
- #E() {
1109
- this.#c && (H.clearInterval(this.#c), this.#c = void 0);
1110
- }
1111
- createResult(e, t) {
1112
- const r = this.#e, s = this.options, i = this.#r, u = this.#a, a = this.#d, l = e !== r ? e.state : this.#n, { state: h } = e;
1113
- let d = { ...h }, y = !1, f;
1114
- if (t._optimisticResults) {
1115
- const _ = this.hasListeners(), R = !_ && Oe(e, t), C = _ && Ie(e, r, t, s);
1116
- (R || C) && (d = {
1117
- ...d,
1118
- ...It(h.data, e.options)
1119
- }), t._optimisticResults === "isRestoring" && (d.fetchStatus = "idle");
1120
- }
1121
- let { error: S, errorUpdatedAt: P, status: I } = d;
1122
- f = d.data;
1123
- let A = !1;
1124
- if (t.placeholderData !== void 0 && f === void 0 && I === "pending") {
1125
- let _;
1126
- i?.isPlaceholderData && t.placeholderData === a?.placeholderData ? (_ = i.data, A = !0) : _ = typeof t.placeholderData == "function" ? t.placeholderData(
1127
- this.#h?.state.data,
1128
- this.#h
1129
- ) : t.placeholderData, _ !== void 0 && (I = "success", f = Te(
1130
- i?.data,
1131
- _,
1132
- t
1133
- ), y = !0);
1134
- }
1135
- if (t.select && f !== void 0 && !A)
1136
- if (i && f === u?.data && t.select === this.#p)
1137
- f = this.#f;
1138
- else
1139
- try {
1140
- this.#p = t.select, f = t.select(f), f = Te(i?.data, f, t), this.#f = f, this.#i = null;
1141
- } catch (_) {
1142
- this.#i = _;
1143
- }
1144
- this.#i && (S = this.#i, f = this.#f, P = Date.now(), I = "error");
1145
- const L = d.fetchStatus === "fetching", F = I === "pending", M = I === "error", q = F && L, B = f !== void 0, b = {
1146
- status: I,
1147
- fetchStatus: d.fetchStatus,
1148
- isPending: F,
1149
- isSuccess: I === "success",
1150
- isError: M,
1151
- isInitialLoading: q,
1152
- isLoading: q,
1153
- data: f,
1154
- dataUpdatedAt: d.dataUpdatedAt,
1155
- error: S,
1156
- errorUpdatedAt: P,
1157
- failureCount: d.fetchFailureCount,
1158
- failureReason: d.fetchFailureReason,
1159
- errorUpdateCount: d.errorUpdateCount,
1160
- isFetched: d.dataUpdateCount > 0 || d.errorUpdateCount > 0,
1161
- isFetchedAfterMount: d.dataUpdateCount > l.dataUpdateCount || d.errorUpdateCount > l.errorUpdateCount,
1162
- isFetching: L,
1163
- isRefetching: L && !F,
1164
- isLoadingError: M && !B,
1165
- isPaused: d.fetchStatus === "paused",
1166
- isPlaceholderData: y,
1167
- isRefetchError: M && B,
1168
- isStale: se(e, t),
1169
- refetch: this.refetch,
1170
- promise: this.#s,
1171
- isEnabled: E(t.enabled, e) !== !1
1172
- };
1173
- if (this.options.experimental_prefetchInRender) {
1174
- const _ = (N) => {
1175
- b.status === "error" ? N.reject(b.error) : b.data !== void 0 && N.resolve(b.data);
1176
- }, R = () => {
1177
- const N = this.#s = b.promise = Se();
1178
- _(N);
1179
- }, C = this.#s;
1180
- switch (C.status) {
1181
- case "pending":
1182
- e.queryHash === r.queryHash && _(C);
1183
- break;
1184
- case "fulfilled":
1185
- (b.status === "error" || b.data !== C.value) && R();
1186
- break;
1187
- case "rejected":
1188
- (b.status !== "error" || b.error !== C.reason) && R();
1189
- break;
1190
- }
1191
- }
1192
- return b;
1193
- }
1194
- updateResult() {
1195
- const e = this.#r, t = this.createResult(this.#e, this.options);
1196
- if (this.#a = this.#e.state, this.#d = this.options, this.#a.data !== void 0 && (this.#h = this.#e), te(t, e))
1197
- return;
1198
- this.#r = t;
1199
- const r = () => {
1200
- if (!e)
1201
- return !0;
1202
- const { notifyOnChangeProps: s } = this.options, i = typeof s == "function" ? s() : s;
1203
- if (i === "all" || !i && !this.#m.size)
1204
- return !0;
1205
- const u = new Set(
1206
- i ?? this.#m
1207
- );
1208
- return this.options.throwOnError && u.add("error"), Object.keys(this.#r).some((a) => {
1209
- const o = a;
1210
- return this.#r[o] !== e[o] && u.has(o);
1211
- });
1212
- };
1213
- this.#S({ listeners: r() });
1214
- }
1215
- #T() {
1216
- const e = this.#t.getQueryCache().build(this.#t, this.options);
1217
- if (e === this.#e)
1218
- return;
1219
- const t = this.#e;
1220
- this.#e = e, this.#n = e.state, this.hasListeners() && (t?.removeObserver(this), e.addObserver(this));
1221
- }
1222
- onQueryUpdate() {
1223
- this.updateResult(), this.hasListeners() && this.#v();
1224
- }
1225
- #S(e) {
1226
- Pe.batch(() => {
1227
- e.listeners && this.listeners.forEach((t) => {
1228
- t(this.#r);
1229
- }), this.#t.getQueryCache().notify({
1230
- query: this.#e,
1231
- type: "observerResultsUpdated"
1232
- });
1233
- });
1234
- }
1235
- };
1236
- function Ct(e, t) {
1237
- return E(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
1238
- }
1239
- function Oe(e, t) {
1240
- return Ct(e, t) || e.state.data !== void 0 && re(e, t, t.refetchOnMount);
1241
- }
1242
- function re(e, t, r) {
1243
- if (E(t.enabled, e) !== !1 && U(t.staleTime, e) !== "static") {
1244
- const s = typeof r == "function" ? r(e) : r;
1245
- return s === "always" || s !== !1 && se(e, t);
1246
- }
1247
- return !1;
1248
- }
1249
- function Ie(e, t, r, s) {
1250
- return (e !== t || E(s.enabled, e) === !1) && (!r.suspense || e.state.status !== "error") && se(e, r);
1251
- }
1252
- function se(e, t) {
1253
- return E(t.enabled, e) !== !1 && e.isStaleByTime(U(t.staleTime, e));
1254
- }
1255
- function kt(e, t) {
1256
- return !te(e.getCurrentResult(), t);
1257
- }
1258
- var W = { exports: {} }, x = {};
1259
- var Re;
1260
- function At() {
1261
- if (Re) return x;
1262
- Re = 1;
1263
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
1264
- function r(s, i, u) {
1265
- var a = null;
1266
- if (u !== void 0 && (a = "" + u), i.key !== void 0 && (a = "" + i.key), "key" in i) {
1267
- u = {};
1268
- for (var o in i)
1269
- o !== "key" && (u[o] = i[o]);
1270
- } else u = i;
1271
- return i = u.ref, {
1272
- $$typeof: e,
1273
- type: s,
1274
- key: a,
1275
- ref: i !== void 0 ? i : null,
1276
- props: u
1277
- };
1278
- }
1279
- return x.Fragment = t, x.jsx = r, x.jsxs = r, x;
1280
- }
1281
- var j = {};
1282
- var Ce;
1283
- function Nt() {
1284
- return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && (function() {
1285
- function e(n) {
1286
- if (n == null) return null;
1287
- if (typeof n == "function")
1288
- return n.$$typeof === N ? null : n.displayName || n.name || null;
1289
- if (typeof n == "string") return n;
1290
- switch (n) {
1291
- case A:
1292
- return "Fragment";
1293
- case F:
1294
- return "Profiler";
1295
- case L:
1296
- return "StrictMode";
1297
- case ie:
1298
- return "Suspense";
1299
- case b:
1300
- return "SuspenseList";
1301
- case C:
1302
- return "Activity";
1303
- }
1304
- if (typeof n == "object")
1305
- switch (typeof n.tag == "number" && console.error(
1306
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1307
- ), n.$$typeof) {
1308
- case I:
1309
- return "Portal";
1310
- case q:
1311
- return n.displayName || "Context";
1312
- case M:
1313
- return (n._context.displayName || "Context") + ".Consumer";
1314
- case B:
1315
- var c = n.render;
1316
- return n = n.displayName, n || (n = c.displayName || c.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
1317
- case _:
1318
- return c = n.displayName || null, c !== null ? c : e(n.type) || "Memo";
1319
- case R:
1320
- c = n._payload, n = n._init;
1321
- try {
1322
- return e(n(c));
1323
- } catch {
1324
- }
1325
- }
1326
- return null;
1327
- }
1328
- function t(n) {
1329
- return "" + n;
1330
- }
1331
- function r(n) {
1332
- try {
1333
- t(n);
1334
- var c = !1;
1335
- } catch {
1336
- c = !0;
1337
- }
1338
- if (c) {
1339
- c = console;
1340
- var m = c.error, p = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
1341
- return m.call(
1342
- c,
1343
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1344
- p
1345
- ), t(n);
1346
- }
1347
- }
1348
- function s(n) {
1349
- if (n === A) return "<>";
1350
- if (typeof n == "object" && n !== null && n.$$typeof === R)
1351
- return "<...>";
1352
- try {
1353
- var c = e(n);
1354
- return c ? "<" + c + ">" : "<...>";
1355
- } catch {
1356
- return "<...>";
1357
- }
1358
- }
1359
- function i() {
1360
- var n = K.A;
1361
- return n === null ? null : n.getOwner();
1362
- }
1363
- function u() {
1364
- return Error("react-stack-top-frame");
1365
- }
1366
- function a(n) {
1367
- if (oe.call(n, "key")) {
1368
- var c = Object.getOwnPropertyDescriptor(n, "key").get;
1369
- if (c && c.isReactWarning) return !1;
1370
- }
1371
- return n.key !== void 0;
1372
- }
1373
- function o(n, c) {
1374
- function m() {
1375
- ae || (ae = !0, console.error(
1376
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1377
- c
1378
- ));
1379
- }
1380
- m.isReactWarning = !0, Object.defineProperty(n, "key", {
1381
- get: m,
1382
- configurable: !0
1383
- });
1384
- }
1385
- function l() {
1386
- var n = e(this.type);
1387
- return ue[n] || (ue[n] = !0, console.error(
1388
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1389
- )), n = this.props.ref, n !== void 0 ? n : null;
1390
- }
1391
- function h(n, c, m, p, Q, J) {
1392
- var g = m.ref;
1393
- return n = {
1394
- $$typeof: P,
1395
- type: n,
1396
- key: c,
1397
- props: m,
1398
- _owner: p
1399
- }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(n, "ref", {
1400
- enumerable: !1,
1401
- get: l
1402
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
1403
- configurable: !1,
1404
- enumerable: !1,
1405
- writable: !0,
1406
- value: 0
1407
- }), Object.defineProperty(n, "_debugInfo", {
1408
- configurable: !1,
1409
- enumerable: !1,
1410
- writable: !0,
1411
- value: null
1412
- }), Object.defineProperty(n, "_debugStack", {
1413
- configurable: !1,
1414
- enumerable: !1,
1415
- writable: !0,
1416
- value: Q
1417
- }), Object.defineProperty(n, "_debugTask", {
1418
- configurable: !1,
1419
- enumerable: !1,
1420
- writable: !0,
1421
- value: J
1422
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
1423
- }
1424
- function d(n, c, m, p, Q, J) {
1425
- var g = c.children;
1426
- if (g !== void 0)
1427
- if (p)
1428
- if (Fe(g)) {
1429
- for (p = 0; p < g.length; p++)
1430
- y(g[p]);
1431
- Object.freeze && Object.freeze(g);
1432
- } else
1433
- console.error(
1434
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1435
- );
1436
- else y(g);
1437
- if (oe.call(c, "key")) {
1438
- g = e(n);
1439
- var D = Object.keys(c).filter(function(Me) {
1440
- return Me !== "key";
1441
- });
1442
- p = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", de[g + p] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
1443
- `A props object containing a "key" prop is being spread into JSX:
1444
- let props = %s;
1445
- <%s {...props} />
1446
- React keys must be passed directly to JSX without using spread:
1447
- let props = %s;
1448
- <%s key={someKey} {...props} />`,
1449
- p,
1450
- g,
1451
- D,
1452
- g
1453
- ), de[g + p] = !0);
1454
- }
1455
- if (g = null, m !== void 0 && (r(m), g = "" + m), a(c) && (r(c.key), g = "" + c.key), "key" in c) {
1456
- m = {};
1457
- for (var X in c)
1458
- X !== "key" && (m[X] = c[X]);
1459
- } else m = c;
1460
- return g && o(
1461
- m,
1462
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
1463
- ), h(
1464
- n,
1465
- g,
1466
- m,
1467
- i(),
1468
- Q,
1469
- J
1470
- );
1471
- }
1472
- function y(n) {
1473
- f(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === R && (n._payload.status === "fulfilled" ? f(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
1474
- }
1475
- function f(n) {
1476
- return typeof n == "object" && n !== null && n.$$typeof === P;
1477
- }
1478
- var S = xe, P = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), q = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), ie = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), K = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, oe = Object.prototype.hasOwnProperty, Fe = Array.isArray, z = console.createTask ? console.createTask : function() {
1479
- return null;
1480
- };
1481
- S = {
1482
- react_stack_bottom_frame: function(n) {
1483
- return n();
1484
- }
1485
- };
1486
- var ae, ue = {}, ce = S.react_stack_bottom_frame.bind(
1487
- S,
1488
- u
1489
- )(), le = z(s(u)), de = {};
1490
- j.Fragment = A, j.jsx = function(n, c, m) {
1491
- var p = 1e4 > K.recentlyCreatedOwnerStacks++;
1492
- return d(
1493
- n,
1494
- c,
1495
- m,
1496
- !1,
1497
- p ? Error("react-stack-top-frame") : ce,
1498
- p ? z(s(n)) : le
1499
- );
1500
- }, j.jsxs = function(n, c, m) {
1501
- var p = 1e4 > K.recentlyCreatedOwnerStacks++;
1502
- return d(
1503
- n,
1504
- c,
1505
- m,
1506
- !0,
1507
- p ? Error("react-stack-top-frame") : ce,
1508
- p ? z(s(n)) : le
1509
- );
1510
- };
1511
- })()), j;
1512
- }
1513
- var ke;
1514
- function Dt() {
1515
- return ke || (ke = 1, process.env.NODE_ENV === "production" ? W.exports = At() : W.exports = Nt()), W.exports;
1516
- }
1517
- Dt();
1518
- var Pt = T.createContext(
1519
- void 0
1520
- ), Lt = (e) => {
1521
- const t = T.useContext(Pt);
1522
- if (!t)
1523
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1524
- return t;
1525
- }, Le = T.createContext(!1), Ft = () => T.useContext(Le);
1526
- Le.Provider;
1527
- function Mt() {
1528
- let e = !1;
1529
- return {
1530
- clearReset: () => {
1531
- e = !1;
1532
- },
1533
- reset: () => {
1534
- e = !0;
1535
- },
1536
- isReset: () => e
1537
- };
1538
- }
1539
- var xt = T.createContext(Mt()), jt = () => T.useContext(xt), Ut = (e, t) => {
1540
- (e.suspense || e.throwOnError || e.experimental_prefetchInRender) && (t.isReset() || (e.retryOnMount = !1));
1541
- }, Yt = (e) => {
1542
- T.useEffect(() => {
1543
- e.clearReset();
1544
- }, [e]);
1545
- }, $t = ({
1546
- result: e,
1547
- errorResetBoundary: t,
1548
- throwOnError: r,
1549
- query: s,
1550
- suspense: i
1551
- }) => e.isError && !t.isReset() && !e.isFetching && s && (i && e.data === void 0 || yt(r, [e.error, s])), qt = (e) => {
1552
- if (e.suspense) {
1553
- const r = (i) => i === "static" ? i : Math.max(i ?? 1e3, 1e3), s = e.staleTime;
1554
- e.staleTime = typeof s == "function" ? (...i) => r(s(...i)) : r(s), typeof e.gcTime == "number" && (e.gcTime = Math.max(
1555
- e.gcTime,
1556
- 1e3
1557
- ));
1558
- }
1559
- }, Bt = (e, t) => e.isLoading && e.isFetching && !t, Qt = (e, t) => e?.suspense && t.isPending, Ae = (e, t, r) => t.fetchOptimistic(e).catch(() => {
1560
- r.clearReset();
1561
- });
1562
- function Ht(e, t, r) {
1563
- if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
1564
- throw new Error(
1565
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
1566
- );
1567
- const s = Ft(), i = jt(), u = Lt(), a = u.defaultQueryOptions(e);
1568
- u.getDefaultOptions().queries?._experimental_beforeQuery?.(
1569
- a
1570
- ), process.env.NODE_ENV !== "production" && (a.queryFn || console.error(
1571
- `[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
1572
- )), a._optimisticResults = s ? "isRestoring" : "optimistic", qt(a), Ut(a, i), Yt(i);
1573
- const o = !u.getQueryCache().get(a.queryHash), [l] = T.useState(
1574
- () => new t(
1575
- u,
1576
- a
1577
- )
1578
- ), h = l.getOptimisticResult(a), d = !s && e.subscribed !== !1;
1579
- if (T.useSyncExternalStore(
1580
- T.useCallback(
1581
- (y) => {
1582
- const f = d ? l.subscribe(Pe.batchCalls(y)) : Z;
1583
- return l.updateResult(), f;
1584
- },
1585
- [l, d]
1586
- ),
1587
- () => l.getCurrentResult(),
1588
- () => l.getCurrentResult()
1589
- ), T.useEffect(() => {
1590
- l.setOptions(a);
1591
- }, [a, l]), Qt(a, h))
1592
- throw Ae(a, l, i);
1593
- if ($t({
1594
- result: h,
1595
- errorResetBoundary: i,
1596
- throwOnError: a.throwOnError,
1597
- query: u.getQueryCache().get(a.queryHash),
1598
- suspense: a.suspense
1599
- }))
1600
- throw h.error;
1601
- return u.getDefaultOptions().queries?._experimental_afterQuery?.(
1602
- a,
1603
- h
1604
- ), a.experimental_prefetchInRender && !Y && Bt(h, s) && (o ? (
1605
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
1606
- Ae(a, l, i)
1607
- ) : (
1608
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
1609
- u.getQueryCache().get(a.queryHash)?.promise
1610
- ))?.catch(Z).finally(() => {
1611
- l.updateResult();
1612
- }), a.notifyOnChangeProps ? h : l.trackResult(h);
1613
- }
1614
- function $(e, t) {
1615
- return Ht(e, Rt);
1616
- }
1617
- function nr(e, t) {
1618
- return $({
1619
- queryKey: ["match-score", e, { lang: t?.languageCode }],
1620
- queryFn: () => ct(e, {
1621
- languageCode: t?.languageCode
1622
- }),
1623
- initialData: t?.initialData,
1624
- enabled: t?.enabled ?? !0,
1625
- refetchInterval: t?.refetchInterval ?? !1,
1626
- refetchIntervalInBackground: !1,
1627
- staleTime: 3e4
1628
- // 30 seconds
1629
- });
1630
- }
1631
- function sr(e) {
1632
- const t = [
1633
- "match-list",
1634
- e.variant,
1635
- {
1636
- fromDate: e.fromDate,
1637
- toDate: e.toDate,
1638
- tournamentIds: e.tournamentIds,
1639
- teamId: e.teamId,
1640
- roundIds: e.roundIds,
1641
- seasonIds: e.seasonIds,
1642
- statusTypes: e.statusTypes,
1643
- limit: e.limit,
1644
- offset: e.offset,
1645
- lang: e.languageCode
1646
- }
1647
- ];
1648
- return $({
1649
- queryKey: t,
1650
- queryFn: () => G(e),
1651
- initialData: e.initialData,
1652
- enabled: e.enabled ?? !0,
1653
- refetchInterval: e.refetchInterval ?? !1,
1654
- refetchIntervalInBackground: !1,
1655
- staleTime: 6e4
1656
- // 1 minute
1657
- });
1658
- }
1659
- async function Wt(e, t) {
1660
- const r = t?.groupByCompetition ? "teamResultsByCompetition" : "teamResults";
1661
- return G({
1662
- variant: r,
1663
- teamId: e,
1664
- statusTypes: ["FINISHED"],
1665
- languageCode: t?.languageCode,
1666
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1667
- tournamentIds: t?.tournamentIds,
1668
- limit: t?.limit ?? 20,
1669
- offset: t?.offset ?? 0
1670
- });
1671
- }
1672
- async function Vt(e, t) {
1673
- const r = t?.groupByCompetition ? "teamFixturesByCompetition" : "teamFixtures";
1674
- return G({
1675
- variant: r,
1676
- teamId: e,
1677
- statusTypes: ["NOT_STARTED"],
1678
- languageCode: t?.languageCode,
1679
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1680
- tournamentIds: t?.tournamentIds,
1681
- limit: t?.limit ?? 20,
1682
- offset: t?.offset ?? 0
1683
- });
1684
- }
1685
- async function wt(e, t) {
1686
- const r = t?.groupByCompetition ? "teamMatchesByCompetition" : "teamMatches";
1687
- return G({
1688
- variant: r,
1689
- teamId: e,
1690
- languageCode: t?.languageCode,
1691
- seasonIds: t?.seasonId ? [t.seasonId] : void 0,
1692
- tournamentIds: t?.tournamentIds,
1693
- limit: t?.limit ?? 20,
1694
- offset: t?.offset ?? 0
1695
- });
1696
- }
1697
- function ir(e, t) {
1698
- const r = t?.groupByCompetition ? "teamResultsByCompetition" : "teamResults";
1699
- return $({
1700
- queryKey: [
1701
- "team-results",
1702
- e,
1703
- r,
1704
- {
1705
- seasonId: t?.seasonId,
1706
- tournamentIds: t?.tournamentIds,
1707
- limit: t?.limit,
1708
- offset: t?.offset,
1709
- lang: t?.languageCode
1710
- }
1711
- ],
1712
- queryFn: () => Wt(e, t),
1713
- initialData: t?.initialData,
1714
- enabled: t?.enabled ?? !0,
1715
- refetchInterval: t?.refetchInterval ?? !1,
1716
- staleTime: 6e4
1717
- });
1718
- }
1719
- function or(e, t) {
1720
- const r = t?.groupByCompetition ? "teamFixturesByCompetition" : "teamFixtures";
1721
- return $({
1722
- queryKey: [
1723
- "team-fixtures",
1724
- e,
1725
- r,
1726
- {
1727
- seasonId: t?.seasonId,
1728
- tournamentIds: t?.tournamentIds,
1729
- limit: t?.limit,
1730
- offset: t?.offset,
1731
- lang: t?.languageCode
1732
- }
1733
- ],
1734
- queryFn: () => Vt(e, t),
1735
- initialData: t?.initialData,
1736
- enabled: t?.enabled ?? !0,
1737
- refetchInterval: t?.refetchInterval ?? !1,
1738
- staleTime: 6e4
1739
- });
1740
- }
1741
- function ar(e, t) {
1742
- const r = t?.groupByCompetition ? "teamMatchesByCompetition" : "teamMatches";
1743
- return $({
1744
- queryKey: [
1745
- "team-matches",
1746
- e,
1747
- r,
1748
- {
1749
- seasonId: t?.seasonId,
1750
- tournamentIds: t?.tournamentIds,
1751
- limit: t?.limit,
1752
- offset: t?.offset,
1753
- lang: t?.languageCode
1754
- }
1755
- ],
1756
- queryFn: () => wt(e, t),
1757
- initialData: t?.initialData,
1758
- enabled: t?.enabled ?? !0,
1759
- refetchInterval: t?.refetchInterval ?? !1,
1760
- staleTime: 6e4
1761
- });
34
+ return n(s);
1762
35
  }
1763
36
  export {
1764
- O as getConfig,
1765
- tt as getFootballMatch,
1766
- tr as getFootballMatchCommentary,
1767
- Jt as getFootballMatchEvents,
1768
- Xt as getFootballMatchLineups,
1769
- Zt as getFootballMatchOdds,
1770
- er as getFootballMatchStatistics,
1771
- rt as getFootballMatches,
1772
- rr as getFootballTeam,
1773
- zt as isConfigured,
1774
- G as prepareMatchList,
1775
- ct as prepareMatchScore,
1776
- Vt as prepareTeamFixtures,
1777
- wt as prepareTeamMatches,
1778
- Wt as prepareTeamResults,
1779
- Kt as setConfig,
1780
- sr as usePrepareMatchList,
1781
- nr as usePrepareMatchScore,
1782
- or as usePrepareTeamFixtures,
1783
- ar as usePrepareTeamMatches,
1784
- ir as usePrepareTeamResults
37
+ o as getConfig,
38
+ u as getFootballMatch,
39
+ d as getFootballMatchCommentary,
40
+ m as getFootballMatchEvents,
41
+ p as getFootballMatchLineups,
42
+ h as getFootballMatchOdds,
43
+ f as getFootballMatchStatistics,
44
+ y as getFootballMatches,
45
+ c as getFootballTeam,
46
+ b as isConfigured,
47
+ M as prepareMatchList,
48
+ F as prepareMatchScore,
49
+ _ as prepareTeamFixtures,
50
+ C as prepareTeamMatches,
51
+ v as prepareTeamResults,
52
+ T as setConfig
1785
53
  };