fansunited-frontend-components 0.0.86 → 0.0.87

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 (127) hide show
  1. package/Betslip.js +1 -1
  2. package/ChanceGame.js +10 -10
  3. package/ClassicQuizPlay.js +1 -1
  4. package/CollectLead.js +7 -7
  5. package/CompetitionStatistics.d.ts +5 -0
  6. package/CompetitionStatistics.d.ts.map +1 -0
  7. package/CompetitionStatistics.js +2802 -0
  8. package/CompetitorCard.js +637 -656
  9. package/Discussion.js +1 -1
  10. package/EitherOrPlay.js +1 -1
  11. package/EventCard.js +40 -47
  12. package/EventGamePlay.js +1 -1
  13. package/Leaderboard.js +13 -13
  14. package/List.js +15 -15
  15. package/MatchQuizPlay.js +1 -1
  16. package/PersonalityQuizPlay.js +1 -1
  17. package/PickThePair.js +11 -11
  18. package/PlayerOfTheMatch.js +22 -22
  19. package/PollVote.js +1 -1
  20. package/Predictor.js +1 -1
  21. package/README.md +138 -3
  22. package/Standings.js +10 -10
  23. package/TopX.js +38 -37
  24. package/chunks/{AccessTime-DZsXIVlS.js → AccessTime-DnYmc2y3.js} +1 -1
  25. package/chunks/{AlertMessage-mdjyklCX.js → AlertMessage-DaxNsecq.js} +21 -20
  26. package/chunks/{Avatar-D3yp-aRF.js → Avatar-CmxmG17Y.js} +3 -3
  27. package/chunks/{Button-Ba88lSnz.js → Button-ClWJ5CUf.js} +3 -3
  28. package/chunks/{Card-ZbfN9iNz.js → Card-BAIFE-g5.js} +12 -11
  29. package/chunks/{CardActions-CmWWezXa.js → CardActions-UK4_wiGW.js} +11 -11
  30. package/chunks/{CardContent-DxoVbjf2.js → CardContent-BKLKsqNJ.js} +2 -2
  31. package/chunks/{ChanceGameEmbedVariant-s8IuiPTs.js → ChanceGameEmbedVariant-BkX-XQ-f.js} +10 -10
  32. package/chunks/{CheckCircle-BG2qEsq1.js → CheckCircle-DPspFBOU.js} +1 -1
  33. package/chunks/{Chip-dm_ka0yY.js → Chip-06eY-2lp.js} +38 -37
  34. package/chunks/{Close-Da_jsGnv.js → Close-C04vOO5T.js} +1 -1
  35. package/chunks/{Close-y509nyXQ.js → Close-DFwlCPON.js} +1 -1
  36. package/chunks/{CollectLeadForm-CQLR-11r.js → CollectLeadForm-CNl5gQZc.js} +46 -45
  37. package/chunks/{ConsentsList-C-U7raxx.js → ConsentsList-CccpD61h.js} +6 -6
  38. package/chunks/{DirectionScope-naCviTG1.js → DirectionScope-8YC2_4GO.js} +1 -1
  39. package/chunks/{Divider-DQT1c9FQ.js → Divider-DWIh5AWp.js} +3 -3
  40. package/chunks/{Edit-DaTdMbng.js → Edit-CMe6gWEl.js} +8 -8
  41. package/chunks/{EmojiEvents-DFNrzPuy.js → EmojiEvents-CRgQHdIP.js} +1 -1
  42. package/chunks/{FavoriteBorder-CbmeWW2T.js → FavoriteBorder-4LopuXjl.js} +1 -1
  43. package/chunks/{FormControl-DgzOlvzS.js → FormControl-DVXYjXgr.js} +12 -12
  44. package/chunks/{FormLabel-BSFhHZnm.js → FormLabel-D5Fg4BoV.js} +3 -3
  45. package/chunks/{GlobalStyles-DMO_VrN7.js → GlobalStyles-Cu-OUtHY.js} +1 -1
  46. package/chunks/{InlineSpinner-BDGu6S9a.js → InlineSpinner-BqP-sRnL.js} +2 -2
  47. package/chunks/{Input-Cb3solC7.js → Input-BOvLXH0a.js} +19 -18
  48. package/chunks/{KeyboardArrowDown-p7zQXgQW.js → KeyboardArrowDown-BQz06NpG.js} +1 -1
  49. package/chunks/{KeyboardArrowRight-CxFWmjUb.js → KeyboardArrowRight-CMArGhjp.js} +1 -1
  50. package/chunks/{Link-5-5Tkbsx.js → Link-C73EMUDp.js} +17 -16
  51. package/chunks/{ListItemButton-ClXre7Xx.js → ListItemButton-6Dx_qKG9.js} +20 -19
  52. package/chunks/{ModalClose-DvCxOJfi.js → ModalClose-DCM0NGvd.js} +6 -6
  53. package/chunks/{ModalDialog-BfVORTO9.js → ModalDialog-CaSBYjVn.js} +22 -22
  54. package/chunks/{NotFoundSkeleton-CBL3Q0e2.js → NotFoundSkeleton-D34gqMWJ.js} +2 -2
  55. package/chunks/{Notification-DEfeZ_zB.js → Notification-Q_rv7f9m.js} +20 -19
  56. package/chunks/{OverlayScoreStateSkeleton-BfWHiCoT.js → OverlayScoreStateSkeleton-k9CYtDkE.js} +4 -4
  57. package/chunks/{OverlayScoreStateWrapperSkeleton-DGCoxYU_.js → OverlayScoreStateWrapperSkeleton-B8wadyuJ.js} +1 -1
  58. package/chunks/{OverlaySignInSkeleton-Bjs-kbH_.js → OverlaySignInSkeleton-D_idxb5n.js} +4 -4
  59. package/chunks/{OverlaySkeleton-CYq0fXsc.js → OverlaySkeleton-m-qkzhXB.js} +9 -9
  60. package/chunks/{Person-BvTGLIe1.js → Person-utLXm1J4.js} +1 -1
  61. package/chunks/{PersonOutline-DylGIHBz.js → PersonOutline-lhMwfisr.js} +1 -1
  62. package/chunks/{PickOneOfX-Cw5YmUZK.js → PickOneOfX-DRiLtqqV.js} +3 -3
  63. package/chunks/{Popper-CiuNPpkb.js → Popper-Bdn0wHi9.js} +3 -3
  64. package/chunks/{Portal-DzlKOG-O.js → Portal-BEroYNyJ.js} +11 -11
  65. package/chunks/{Portal-IratSYID.js → Portal-BdRuZNR8.js} +1 -1
  66. package/chunks/{Predictor-C3Kr_dEA.js → Predictor-Bn2zkvlD.js} +2007 -2011
  67. package/chunks/{PrizeCard-CwEzUVMJ.js → PrizeCard-nRBh9VU_.js} +4084 -2173
  68. package/chunks/{Search-B7BcOoCG.js → Search-B-Xqc3De.js} +1 -1
  69. package/chunks/{Select-oNgIy1H3.js → Select-CmHfLRTg.js} +25 -24
  70. package/chunks/{Sheet-DVdyMkHi.js → Sheet-Q5izbz85.js} +18 -17
  71. package/chunks/{SignInCta-DcNkObOQ.js → SignInCta-FBCz227A.js} +3 -3
  72. package/chunks/{Spinner-DBETUiAV.js → Spinner-wUVcNUtR.js} +2 -2
  73. package/chunks/{SportsSoccer-DGQ7NYD7.js → SportsSoccer-Dq3Azbu-.js} +1 -1
  74. package/chunks/{Stack-CppwMpFB.js → Stack-CY7bQJ7u.js} +19 -19
  75. package/chunks/{StandardContentSkeleton-B8nlGHR6.js → StandardContentSkeleton-Bm_8xH6p.js} +1 -1
  76. package/chunks/{Table-Dk1ukQa6.js → Table-Cew1z7pw.js} +2 -2
  77. package/chunks/{Tabs-CmFfmpyp.js → Tabs-DuqeCPIW.js} +19 -18
  78. package/chunks/{Textarea-BRHSeC7k.js → Textarea-Dwn6AF-Z.js} +3 -3
  79. package/chunks/{TimerOutlined-iVv_QE1G.js → TimerOutlined-HGpj-FEQ.js} +1 -1
  80. package/chunks/{Tooltip-BaFJF8Hm.js → Tooltip-Boqkti8t.js} +44 -43
  81. package/chunks/Typography-DaXtC0md.js +1086 -0
  82. package/chunks/{WorkspacePremiumOutlined-CgWyDKg5.js → WorkspacePremiumOutlined-OHYXXF58.js} +1 -1
  83. package/chunks/colorInversionUtils-BPGyYARg.js +347 -0
  84. package/chunks/{createSvgIcon-BkXgNHbb.js → createSvgIcon-DaCJY2eU.js} +1 -1
  85. package/chunks/{createSvgIcon-DvpPe0m8.js → createSvgIcon-mpOIuxRM.js} +2 -2
  86. package/chunks/{dividerClasses-_a2MkLdj.js → dividerClasses-D8aWZR-L.js} +1 -1
  87. package/chunks/{elementAcceptingRef-CFCF4JTN.js → elementAcceptingRef-DhvOV1kD.js} +1 -1
  88. package/chunks/{formLabelClasses-DnxGgDxQ.js → formLabelClasses-DrWVkeKS.js} +1 -1
  89. package/chunks/{helpers-BVcELFvC.js → helpers-CqPvv3gw.js} +1 -1
  90. package/chunks/index-BI_1_9JX.js +4 -0
  91. package/chunks/index-CBD3UTgX.js +4 -0
  92. package/chunks/index-CDxdDU5W.js +4 -0
  93. package/chunks/index-CR9X9c_3.js +4 -0
  94. package/chunks/index-DLWjbTmD.js +4 -0
  95. package/chunks/index-DVzuyb5J.js +4 -0
  96. package/chunks/{index-Jo_fbxsQ.js → index-iWn7Rdh9.js} +1 -1
  97. package/chunks/index-kvAqk2tW.js +4 -0
  98. package/chunks/{main-CpERt7cC.js → main-BOQ_5kqd.js} +30 -30
  99. package/chunks/{main-CpXKD7Ei.js → main-BRCfR5lM.js} +76 -75
  100. package/chunks/{main-RD9fUvtz.js → main-C6bG2zD0.js} +28 -28
  101. package/chunks/{main-Che3VjMd.js → main-CB6OELiE.js} +19 -19
  102. package/chunks/{main-f7EUpatJ.js → main-DgcqQ3D5.js} +22 -22
  103. package/chunks/{main-DZoTUuoz.js → main-Dn5EUDh-.js} +34 -34
  104. package/chunks/{main-NkO906fN.js → main-DoPO3SkP.js} +3 -3
  105. package/chunks/{main-P_iMTyYG.js → main-DyQtrmbq.js} +25 -25
  106. package/chunks/searchEntities-SJcoznz0.js +38 -0
  107. package/chunks/{useButton-Qs8SQ3Oc.js → useButton-4zMfywSn.js} +5 -4
  108. package/chunks/{useConsents-DPYMv1XL.js → useConsents-C9bnFES_.js} +12 -12
  109. package/chunks/{useEventCallback-CdVOlM24.js → useEventCallback-D-URXDH4.js} +1 -1
  110. package/chunks/{useForwardedInput-D_hsYWHs.js → useForwardedInput-Bm2kgM0U.js} +2 -2
  111. package/chunks/{useImageVariant-DKmsQtyv.js → useImageVariant-Bwh3HQQD.js} +1 -1
  112. package/chunks/{useParticipationDraft-D9mIeJ3U.js → useParticipationDraft-ZkV4H6kC.js} +6 -6
  113. package/chunks/{useSwitch-CqvwWw9p.js → useSwitch-CIN7Th7t.js} +24 -23
  114. package/components.d.ts +2 -1
  115. package/components.d.ts.map +1 -1
  116. package/index.d.ts +1 -0
  117. package/index.d.ts.map +1 -1
  118. package/index.js +14 -12
  119. package/package.json +6 -2
  120. package/chunks/Typography-Du02dCpZ.js +0 -1429
  121. package/chunks/index-4WCNqsoq.js +0 -4
  122. package/chunks/index-7NrjBlB3.js +0 -4
  123. package/chunks/index-Blkau85P.js +0 -4
  124. package/chunks/index-CnOFf4hs.js +0 -4
  125. package/chunks/index-CwIKdVGP.js +0 -4
  126. package/chunks/index-DjIGlrHG.js +0 -4
  127. package/chunks/index-a8UF4nkE.js +0 -4
@@ -0,0 +1,2802 @@
1
+ import { jsx as r, jsxs as y, Fragment as pe } from "react/jsx-runtime";
2
+ import z, { useState as J, useEffect as le, useMemo as de, useRef as rt, useCallback as st } from "react";
3
+ import { g as it, u as at, f as lt, n as dt, z as ct, a as ut, B as h, i as xe, m as pt, p as mt, o as ht, q as gt, r as ft, C as yt, s as xt, E as bt, t as wt, w as Ct } from "./chunks/PrizeCard-nRBh9VU_.js";
4
+ import { S as St } from "./chunks/Spinner-wUVcNUtR.js";
5
+ import { createPortal as It } from "react-dom";
6
+ import { f as vt } from "./chunks/searchEntities-SJcoznz0.js";
7
+ import { h as kt } from "./chunks/helpers-CqPvv3gw.js";
8
+ import { p as Re, c as Tt, d as $t } from "./chunks/index-D-yn2UCo.js";
9
+ import { B as _t } from "./chunks/DirectionScope-8YC2_4GO.js";
10
+ import { T as Et } from "./chunks/Typography-DaXtC0md.js";
11
+ import { c as Rt } from "./chunks/createLucideIcon-YBRjY5Kl.js";
12
+ import { G as Mt } from "./chunks/GlobalStyles-Cu-OUtHY.js";
13
+ /**
14
+ * @license lucide-react v0.454.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ */
19
+ const At = Rt("Tv", [
20
+ ["rect", { width: "20", height: "15", x: "2", y: "7", rx: "2", ry: "2", key: "10ag99" }],
21
+ ["polyline", { points: "17 2 12 7 7 2", key: "11pgbg" }]
22
+ ]), Fe = "https://sports.fansunitedapi.com/v1", Be = (e) => {
23
+ try {
24
+ const t = e.helpers.getSDKConfiguration();
25
+ return !(t != null && t.apiKey) || !(t != null && t.clientId) ? null : { apiKey: t.apiKey, clientId: t.clientId };
26
+ } catch {
27
+ return null;
28
+ }
29
+ }, je = (e) => {
30
+ const t = Be(e);
31
+ return t ? new URLSearchParams({ key: t.apiKey, client_id: t.clientId }) : null;
32
+ }, Lt = async (e, t, o, s) => {
33
+ const i = je(e);
34
+ if (!i || !t) return null;
35
+ o && i.set("season_id", o);
36
+ const a = await fetch(
37
+ `${Fe}/competitions/${encodeURIComponent(t)}?${i.toString()}`,
38
+ { signal: s }
39
+ );
40
+ if (!a.ok) throw new Error(`Sports API responded ${a.status}`);
41
+ const d = await a.json(), l = (d == null ? void 0 : d.data) ?? d;
42
+ return l != null && l.id ? l : null;
43
+ }, zt = async (e, t, o) => {
44
+ var i;
45
+ const s = je(e);
46
+ if (!s) return null;
47
+ s.set("disable_cache", String(Date.now()));
48
+ try {
49
+ const a = await fetch(
50
+ `${Fe}/events/${encodeURIComponent(t)}?${s.toString()}`,
51
+ { signal: o }
52
+ );
53
+ if (!a.ok) return null;
54
+ const d = await a.json(), l = (i = (d == null ? void 0 : d.data) ?? d) == null ? void 0 : i.event;
55
+ return l != null && l.id ? l : null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }, Dt = async (e, t, o) => {
60
+ const s = /* @__PURE__ */ new Map(), i = Be(e);
61
+ return !i || t.length === 0 || (await vt(i, t, {
62
+ signal: o,
63
+ partial: !0
64
+ })).forEach((d) => s.set(d.id, d)), s;
65
+ }, Pt = ["1_15", "16_30", "31_45", "46_60", "61_75", "76_90"], be = (e) => {
66
+ const t = /* @__PURE__ */ new Map();
67
+ return (e ?? []).forEach((o) => {
68
+ o.key && o.value != null && t.set(o.key.toLowerCase(), o.value);
69
+ }), t;
70
+ }, Q = (e, t) => {
71
+ const o = e.get(t);
72
+ if (o == null || o === "") return null;
73
+ const s = Number(o);
74
+ return Number.isFinite(s) ? s : null;
75
+ }, N = (e, t) => Q(e, t) ?? 0, Wt = [
76
+ [/POSTPON/, "postponed"],
77
+ [/CANCEL/, "cancelled"],
78
+ [/INTERRUPT|SUSPEND/, "interrupted"],
79
+ [/ABANDON/, "abandoned"]
80
+ ], He = (e) => {
81
+ var o;
82
+ const t = `${(e == null ? void 0 : e.type) ?? ""} ${(e == null ? void 0 : e.code) ?? ""} ${(e == null ? void 0 : e.sub_type) ?? ""}`.toUpperCase();
83
+ return ((o = Wt.find(([s]) => s.test(t))) == null ? void 0 : o[1]) ?? null;
84
+ }, Ge = (e) => {
85
+ if (He(e)) return "CANCELLED";
86
+ const t = `${(e == null ? void 0 : e.type) ?? ""} ${(e == null ? void 0 : e.code) ?? ""}`.toUpperCase();
87
+ return /(FINISH|ENDED|CLOSED|AFTER_)/.test(t) ? "FINISHED" : /(LIVE|PROGRESS|INPLAY|IN_PLAY|HALF|PERIOD)/.test(t) ? "LIVE" : "UPCOMING";
88
+ }, Ot = {
89
+ "1st_half": 0,
90
+ "2nd_half": 45,
91
+ extra_time: 90,
92
+ extra_time_1: 90,
93
+ extra_time_2: 105
94
+ }, Nt = (e) => {
95
+ var i, a;
96
+ const t = (((i = e.status) == null ? void 0 : i.sub_type) ?? "").toLowerCase(), o = Ot[t], s = ((a = e.timing) == null ? void 0 : a.current_minute) ?? 0;
97
+ return o === void 0 || s <= 0 ? null : o + s;
98
+ }, he = (e, t) => {
99
+ const o = (e.score ?? []).find((a) => a.key === t);
100
+ if (!o || o.competitor_one == null || o.competitor_two == null)
101
+ return null;
102
+ const s = Number(o.competitor_one), i = Number(o.competitor_two);
103
+ return Number.isFinite(s) && Number.isFinite(i) ? [s, i] : null;
104
+ }, Me = (e) => {
105
+ const t = be(e == null ? void 0 : e.stats);
106
+ return {
107
+ id: (e == null ? void 0 : e.id) ?? "",
108
+ yellowCards: Q(t, "yellow_cards"),
109
+ redCards: Q(t, "red_cards"),
110
+ shotsOnTarget: Q(t, "shots_on_target"),
111
+ possession: Q(t, "ball_possession_percentage"),
112
+ corners: Q(t, "corners"),
113
+ goalsByPeriod: Pt.map((o) => N(t, `goals_${o}`))
114
+ };
115
+ }, Ft = 3 * 24 * 60 * 60 * 1e3, Bt = (e, t) => {
116
+ const o = t.filter((a) => !!a.id).map((a) => {
117
+ const d = /* @__PURE__ */ new Set();
118
+ (a.groups ?? []).forEach(
119
+ (u) => (u.standings ?? []).forEach((g) => g.competitor_id && d.add(g.competitor_id))
120
+ );
121
+ const l = Date.parse(a.start_date ?? ""), c = Date.parse(a.end_date ?? "") + 24 * 60 * 60 * 1e3;
122
+ return { id: a.id, teams: d, from: l, to: c };
123
+ }), s = (a, d) => !Number.isFinite(a.from) || !Number.isFinite(a.to) ? 1 / 0 : d < a.from ? a.from - d : d > a.to ? d - a.to : 0, i = /* @__PURE__ */ new Map();
124
+ return e.forEach((a) => {
125
+ var b, m, I, x, $;
126
+ if ((b = a.round) != null && b.stage_id) {
127
+ i.set(a, a.round.stage_id);
128
+ return;
129
+ }
130
+ if (o.length <= 1) {
131
+ i.set(a, ((m = o[0]) == null ? void 0 : m.id) ?? null);
132
+ return;
133
+ }
134
+ const d = Date.parse(((I = a.timing) == null ? void 0 : I.start_time) ?? ""), l = ((x = a.competitor_one) == null ? void 0 : x.id) ?? "", c = (($ = a.competitor_two) == null ? void 0 : $.id) ?? "", u = (v) => s(v, d) <= Ft, g = o.filter((v) => v.teams.has(l) && v.teams.has(c) && u(v)).sort((v, E) => v.teams.size - E.teams.size)[0];
135
+ if (g) {
136
+ i.set(a, g.id);
137
+ return;
138
+ }
139
+ const f = (v) => [...v].sort((E, D) => s(E, d) - s(D, d))[0], w = f(o.filter((v) => v.teams.size === 0 || u(v))) ?? f(o);
140
+ i.set(a, (w == null ? void 0 : w.id) ?? null);
141
+ }), i;
142
+ }, jt = (e, t, o) => {
143
+ var a, d;
144
+ const s = Ge(e.status), i = s === "FINISHED" || s === "LIVE";
145
+ return {
146
+ id: e.id ?? "",
147
+ status: s,
148
+ start: ((a = e.timing) == null ? void 0 : a.start_time) ?? "",
149
+ stageId: o,
150
+ round: t,
151
+ home: Me(e.competitor_one),
152
+ away: Me(e.competitor_two),
153
+ fullTime: i ? he(e, "result") ?? he(e, "full_time") ?? [0, 0] : null,
154
+ halfTime: i ? he(e, "half_time") : null,
155
+ liveMinute: s === "LIVE" ? Nt(e) : null,
156
+ notPlayedReason: He(e.status),
157
+ isHalfTime: s === "LIVE" && (((d = e.status) == null ? void 0 : d.sub_type) ?? "").toLowerCase() === "halftime"
158
+ };
159
+ }, Ht = (e) => {
160
+ const t = /* @__PURE__ */ new Map();
161
+ e.forEach((s) => {
162
+ var l, c;
163
+ const i = ((l = s.round) == null ? void 0 : l.id) ?? "", a = ((c = s.timing) == null ? void 0 : c.start_time) ?? "", d = t.get(i);
164
+ (d === void 0 || a < d) && t.set(i, a);
165
+ });
166
+ const o = new Map(
167
+ Array.from(t.entries()).sort((s, i) => s[1].localeCompare(i[1])).map(([s], i) => [s, i + 1])
168
+ );
169
+ return new Map(
170
+ e.map((s) => {
171
+ var i, a;
172
+ return [
173
+ s,
174
+ ((i = s.round) == null ? void 0 : i.matchday) ?? o.get(((a = s.round) == null ? void 0 : a.id) ?? "") ?? 1
175
+ ];
176
+ })
177
+ );
178
+ }, Ae = (e) => {
179
+ const t = be(e.statistics);
180
+ return {
181
+ teamId: e.team_id ?? "",
182
+ matchesPlayed: N(t, "matches_played"),
183
+ won: N(t, "won"),
184
+ draw: N(t, "draw"),
185
+ lost: N(t, "lost"),
186
+ homeWon: N(t, "home_won"),
187
+ awayWon: N(t, "away_won"),
188
+ goalsScored: N(t, "goals_scored"),
189
+ goalsAllowed: N(t, "goals_allowed"),
190
+ avgTotalGoals: Q(t, "avg_total_goals")
191
+ };
192
+ }, Gt = (e) => {
193
+ const t = be(e.statistics);
194
+ return {
195
+ athleteId: e.athlete_id ?? "",
196
+ teamId: e.team_id ?? "",
197
+ goals: N(t, "goals"),
198
+ assists: N(t, "assists"),
199
+ minutes: N(t, "minutes"),
200
+ appearances: N(t, "appearances"),
201
+ yellowCards: N(t, "yellow_cards"),
202
+ redCards: N(t, "red_cards"),
203
+ cleanSheets: N(t, "clean_sheets")
204
+ };
205
+ }, Ut = (e, t, o) => {
206
+ const s = e.season, i = ((s == null ? void 0 : s.events) ?? []).filter((m) => !!m.id).map((m) => {
207
+ const I = o.get(m.id);
208
+ if (!I) return m;
209
+ const x = ($, v) => $ && typeof $ == "object" ? $ : v;
210
+ return {
211
+ ...m,
212
+ ...I,
213
+ round: m.round ?? I.round,
214
+ competitor_one: x(I.competitor_one, m.competitor_one),
215
+ competitor_two: x(I.competitor_two, m.competitor_two)
216
+ };
217
+ }), a = (s == null ? void 0 : s.stages) ?? [], d = Bt(i, a), l = t ? i.filter((m) => d.get(m) === t) : i, c = Ht(l), u = new Set(l.map((m) => d.get(m))), g = a.filter((m) => !!m.id && u.has(m.id)).map((m) => ({
218
+ id: m.id,
219
+ nameId: m.stage_name_id || null,
220
+ order: m.order ?? 0
221
+ })).sort((m, I) => m.order - I.order), f = /* @__PURE__ */ new Map(), w = (s == null ? void 0 : s.team_stats) ?? [], b = t || null;
222
+ return w.filter((m) => (m.stage_id ?? null) === b).forEach((m) => m.team_id && f.set(m.team_id, Ae(m))), t && f.size === 0 && w.filter((m) => m.stage_id == null).forEach((m) => m.team_id && f.set(m.team_id, Ae(m))), {
223
+ id: e.id ?? "",
224
+ sport: e.sport ?? null,
225
+ season: {
226
+ id: (s == null ? void 0 : s.id) ?? null,
227
+ name: (s == null ? void 0 : s.name) ?? null,
228
+ startDate: (s == null ? void 0 : s.start_date) ?? null,
229
+ endDate: (s == null ? void 0 : s.end_date) ?? null
230
+ },
231
+ matches: l.map((m) => jt(m, c.get(m) ?? 1, d.get(m) ?? null)),
232
+ stages: g,
233
+ teamStats: f,
234
+ athletes: ((s == null ? void 0 : s.athlete_stats) ?? []).filter((m) => !!m.athlete_id && (m.statistics ?? []).length > 0).map(Gt)
235
+ };
236
+ }, Kt = (e) => (e ?? "").split("-")[0].toUpperCase(), Vt = (e, t, o) => {
237
+ const s = Kt(t), i = (a, d) => {
238
+ var l, c, u;
239
+ return ((u = (c = (l = e.get(a)) == null ? void 0 : l.assets) == null ? void 0 : c.find((g) => g.key === d)) == null ? void 0 : u.value) ?? null;
240
+ };
241
+ return {
242
+ has: (a) => e.has(a),
243
+ name: (a) => {
244
+ var c, u;
245
+ const d = e.get(a);
246
+ return d && (((u = (c = d.translations) == null ? void 0 : c.find(
247
+ (g) => {
248
+ var f;
249
+ return ((f = g.language) == null ? void 0 : f.toUpperCase()) === s;
250
+ }
251
+ )) == null ? void 0 : u.name) || d.name) || o;
252
+ },
253
+ logo: (a) => i(a, "LOGO"),
254
+ photo: (a) => i(a, "HEADSHOT"),
255
+ position: (a) => {
256
+ var d;
257
+ return ((d = e.get(a)) == null ? void 0 : d.position) ?? null;
258
+ }
259
+ };
260
+ }, Yt = 4 * 60 * 60 * 1e3, Xt = (e) => {
261
+ var o, s, i, a, d, l, c, u, g;
262
+ const t = new Set(((o = e.meta) == null ? void 0 : o.entity_ids) ?? []);
263
+ return e.id && t.add(e.id), (i = (s = e.season) == null ? void 0 : s.stages) == null || i.forEach((f) => f.stage_name_id && t.add(f.stage_name_id)), (d = (a = e.season) == null ? void 0 : a.events) == null || d.forEach((f) => {
264
+ var w, b;
265
+ (w = f.competitor_one) != null && w.id && t.add(f.competitor_one.id), (b = f.competitor_two) != null && b.id && t.add(f.competitor_two.id);
266
+ }), (c = (l = e.season) == null ? void 0 : l.team_stats) == null || c.forEach((f) => f.team_id && t.add(f.team_id)), (g = (u = e.season) == null ? void 0 : u.athlete_stats) == null || g.forEach((f) => {
267
+ f.athlete_id && t.add(f.athlete_id), f.team_id && t.add(f.team_id);
268
+ }), Array.from(t);
269
+ }, qt = (e, t) => {
270
+ var i;
271
+ const o = Ge(e.status);
272
+ if (o === "LIVE") return !0;
273
+ if (o !== "UPCOMING") return !1;
274
+ const s = Date.parse(((i = e.timing) == null ? void 0 : i.start_time) ?? "");
275
+ return Number.isFinite(s) && s <= t && t - s < Yt;
276
+ }, Jt = (e, t, o, s, i) => {
277
+ const { seasonId: a, stageId: d, liveRefresh: l, refreshInterval: c } = i, [u, g] = J(null), [f, w] = J(
278
+ () => /* @__PURE__ */ new Map()
279
+ ), [b, m] = J(
280
+ () => /* @__PURE__ */ new Map()
281
+ ), [I, x] = J(!0), [$, v] = J(!1);
282
+ le(() => {
283
+ if (!e || !t) {
284
+ x(!1);
285
+ return;
286
+ }
287
+ const T = new AbortController();
288
+ return x(!0), v(!1), m(/* @__PURE__ */ new Map()), (async () => {
289
+ try {
290
+ const R = await Lt(
291
+ e,
292
+ t,
293
+ a,
294
+ T.signal
295
+ );
296
+ if (T.signal.aborted) return;
297
+ const O = R ? await Dt(
298
+ e,
299
+ Xt(R),
300
+ T.signal
301
+ ) : /* @__PURE__ */ new Map();
302
+ if (T.signal.aborted) return;
303
+ g(R), w(O);
304
+ } catch (R) {
305
+ if (T.signal.aborted || (R == null ? void 0 : R.name) === "AbortError")
306
+ return;
307
+ g(null), v(!0);
308
+ } finally {
309
+ T.signal.aborted || x(!1);
310
+ }
311
+ })(), () => T.abort();
312
+ }, [e, t, a]);
313
+ const [E, D] = J(() => Date.now());
314
+ le(() => {
315
+ if (!u || !l) return;
316
+ const T = setInterval(() => D(Date.now()), 6e4);
317
+ return () => clearInterval(T);
318
+ }, [u, l]);
319
+ const M = de(() => {
320
+ var T;
321
+ return !u || !l || c <= 0 ? "" : (((T = u.season) == null ? void 0 : T.events) ?? []).map((R) => R.id ? b.get(R.id) ?? R : R).filter((R) => R.id && qt(R, E)).map((R) => R.id).join(",");
322
+ }, [u, b, l, c, E]);
323
+ le(() => {
324
+ if (!M) return;
325
+ const T = M.split(","), R = new AbortController(), H = setInterval(async () => {
326
+ const G = await Promise.all(
327
+ T.map((p) => zt(e, p, R.signal))
328
+ );
329
+ R.signal.aborted || m((p) => {
330
+ const _ = new Map(p);
331
+ return G.forEach((k) => (k == null ? void 0 : k.id) && _.set(k.id, k)), _;
332
+ });
333
+ }, c);
334
+ return () => {
335
+ R.abort(), clearInterval(H);
336
+ };
337
+ }, [e, M, c]);
338
+ const A = de(
339
+ () => u ? Ut(u, d, b) : null,
340
+ [u, d, b]
341
+ ), L = de(
342
+ () => Vt(f, o, s),
343
+ [f, o, s]
344
+ );
345
+ return { data: A, competitionId: (u == null ? void 0 : u.id) ?? t, entities: L, loading: I, error: $ };
346
+ }, n = (e, t = 16) => `${Math.round(e / t * 1e4) / 1e4}em`, W = () => {
347
+ const e = it(), t = at(), o = lt(), s = dt() === "dark", i = (d, l) => `rgba(${kt(d)}, ${l})`, a = e.palette.primary.plainColor;
348
+ return {
349
+ fonts: t,
350
+ radius: o,
351
+ alpha: i,
352
+ colors: {
353
+ surface: e.surface,
354
+ onSurface: e.onSurface,
355
+ variant: e.surfaceVariant,
356
+ border: e.outlineEnabledBorder,
357
+ text: e.textPrimary,
358
+ body: e.textBody,
359
+ dim: i(e.textSecondary, 0.62),
360
+ primary: a,
361
+ primaryContainer: e.palette.primary.primaryContainer,
362
+ onPrimary: e.palette.primary.onPrimary,
363
+ success: e.palette.success.plainColor,
364
+ danger: e.palette.danger.plainColor,
365
+ tint: i(a, s ? 0.14 : 0.08),
366
+ tint2: i(a, s ? 0.26 : 0.16),
367
+ // Card colours are the real-world card colour, not a theme accent.
368
+ yellowCard: "#F5C400"
369
+ }
370
+ };
371
+ }, we = (e) => e.status === "FINISHED" && !!e.fullTime, ce = (e) => e.fullTime ? e.fullTime[0] + e.fullTime[1] : 0, Le = (e, t, o) => e.filter(
372
+ (s) => (s.home.id === t || s.away.id === t) && s.start < o
373
+ ).sort((s, i) => i.start.localeCompare(s.start)).slice(0, 5).reverse().map((s) => {
374
+ const i = s.home.id === t, [a, d] = s.fullTime, l = i ? a : d, c = i ? d : a;
375
+ return { match: s, isHome: i, result: l > c ? "W" : l < c ? "L" : "D" };
376
+ }), Qt = (e) => {
377
+ const t = /* @__PURE__ */ new Map();
378
+ return e.forEach((o) => {
379
+ const [s, i] = o.fullTime;
380
+ [
381
+ { side: o.home, conceded: i },
382
+ { side: o.away, conceded: s }
383
+ ].forEach(({ side: a, conceded: d }) => {
384
+ const l = t.get(a.id) ?? { cleanSheets: 0, yellowCards: 0, redCards: 0 };
385
+ d === 0 && (l.cleanSheets += 1), l.yellowCards += a.yellowCards ?? 0, l.redCards += a.redCards ?? 0, t.set(a.id, l);
386
+ });
387
+ }), t;
388
+ }, Zt = (e, t) => e.find(
389
+ (o) => o.id !== t.id && (o.home.id === t.home.id && o.away.id === t.away.id || o.home.id === t.away.id && o.away.id === t.home.id)
390
+ ) ?? null, B = (e, t) => t ? Math.round(e / t * 100) : 0, eo = (e) => {
391
+ const t = e.filter(we), o = (c) => t.reduce((u, g) => u + c(g), 0), s = o(ce), i = t.filter((c) => c.fullTime[0] > c.fullTime[1]).length, a = t.filter((c) => c.fullTime[1] > c.fullTime[0]).length, d = o((c) => c.halfTime ? c.halfTime[0] + c.halfTime[1] : 0), l = [0, 1, 2, 3, 4, 5].map(
392
+ (c) => o((u) => (u.home.goalsByPeriod[c] ?? 0) + (u.away.goalsByPeriod[c] ?? 0))
393
+ );
394
+ return {
395
+ total: e.length,
396
+ played: t.length,
397
+ goals: s,
398
+ homeWins: i,
399
+ awayWins: a,
400
+ draws: t.length - i - a,
401
+ firstHalfGoals: d,
402
+ secondHalfGoals: s - d,
403
+ goalsByPeriod: l,
404
+ yellowCards: o((c) => (c.home.yellowCards ?? 0) + (c.away.yellowCards ?? 0)),
405
+ redCards: o((c) => (c.home.redCards ?? 0) + (c.away.redCards ?? 0)),
406
+ shotsOnTarget: o((c) => (c.home.shotsOnTarget ?? 0) + (c.away.shotsOnTarget ?? 0)),
407
+ corners: o((c) => (c.home.corners ?? 0) + (c.away.corners ?? 0)),
408
+ bothScored: t.filter((c) => c.fullTime[0] > 0 && c.fullTime[1] > 0).length,
409
+ goalless: t.filter((c) => ce(c) === 0).length,
410
+ over: (c) => t.filter((u) => ce(u) > c).length
411
+ };
412
+ }, to = 10, Ue = {
413
+ scorers: (e) => e.goals,
414
+ assists: (e) => e.assists,
415
+ contributions: (e) => e.goals + e.assists,
416
+ cleanSheets: (e) => e.cleanSheets,
417
+ minutes: (e) => e.minutes,
418
+ cards: (e) => e.yellowCards + e.redCards
419
+ }, ge = Object.keys(Ue), oo = (e, t) => {
420
+ const o = Ue[t];
421
+ return e.map((i) => ({ athlete: i, value: o(i) })).filter((i) => i.value > 0).sort(
422
+ (i, a) => a.value - i.value || (t === "cards" ? a.athlete.redCards - i.athlete.redCards : t === "minutes" ? 0 : i.athlete.minutes - a.athlete.minutes)
423
+ ).slice(0, to).map((i, a, d) => {
424
+ let l = a + 1;
425
+ for (; l > 1 && d[l - 2].value === i.value; ) l -= 1;
426
+ const c = a > 0 && d[a - 1].value === i.value || a < d.length - 1 && d[a + 1].value === i.value;
427
+ return { ...i, rank: c ? `${l}=` : `${l}` };
428
+ });
429
+ }, U = (e, t, o = 1) => [...e].sort((s, i) => o * (t(i) - t(s)))[0], no = (e) => Array.from(e.values()), ro = (e) => {
430
+ const t = ct(e), o = /* @__PURE__ */ new Map();
431
+ return {
432
+ date: (s, i) => {
433
+ const a = new Date(s);
434
+ return Number.isNaN(a.getTime()) ? "" : a.toLocaleDateString(t, i);
435
+ },
436
+ time: (s) => {
437
+ const i = new Date(s);
438
+ return Number.isNaN(i.getTime()) ? "" : i.toLocaleTimeString(t, { hour: "2-digit", minute: "2-digit" });
439
+ },
440
+ decimal: (s, i) => {
441
+ let a = o.get(i);
442
+ return a || (a = new Intl.NumberFormat(t, {
443
+ minimumFractionDigits: i,
444
+ maximumFractionDigits: i
445
+ }), o.set(i, a)), a.format(Number.isFinite(s) ? s : 0);
446
+ }
447
+ };
448
+ }, so = (e, t) => t ? e.replace(
449
+ /\{\{\s*(\w+)\s*\}\}/g,
450
+ (o, s) => s in t ? String(t[s]) : o
451
+ ) : e, io = (e) => {
452
+ const { t } = ut("common");
453
+ return de(
454
+ () => (o, s) => {
455
+ const i = e == null ? void 0 : e[o];
456
+ return typeof i == "string" && i.trim() ? so(i, s) : t(`competitionStatistics.${o}`, s ?? {});
457
+ },
458
+ [e, t]
459
+ );
460
+ }, S = ({
461
+ size: e,
462
+ font: t = "primary",
463
+ weight: o,
464
+ color: s,
465
+ upper: i,
466
+ cms: a,
467
+ ellipsis: d,
468
+ parentSize: l = 16,
469
+ component: c = "span",
470
+ sx: u,
471
+ children: g
472
+ }) => {
473
+ const { fonts: f } = W();
474
+ return /* @__PURE__ */ r(
475
+ h,
476
+ {
477
+ component: c,
478
+ sx: [
479
+ {
480
+ fontSize: n(e, l),
481
+ fontFamily: t === "primary" ? f.primary : f.secondary,
482
+ ...o ? { fontWeight: o } : {},
483
+ ...s ? { color: s } : {},
484
+ ...i ? { textTransform: "uppercase", letterSpacing: n(0.5, e) } : {},
485
+ ...a ? { unicodeBidi: "plaintext" } : {},
486
+ ...d ? { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } : {}
487
+ },
488
+ ...Array.isArray(u) ? u : [u]
489
+ ],
490
+ children: g
491
+ }
492
+ );
493
+ }, j = ({
494
+ url: e,
495
+ size: t,
496
+ sx: o
497
+ }) => e ? /* @__PURE__ */ r(
498
+ h,
499
+ {
500
+ sx: [
501
+ {
502
+ width: n(t),
503
+ height: n(t),
504
+ flexShrink: 0,
505
+ backgroundImage: `url("${e}")`,
506
+ backgroundSize: "contain",
507
+ backgroundRepeat: "no-repeat",
508
+ backgroundPosition: "center"
509
+ },
510
+ ...Array.isArray(o) ? o : [o]
511
+ ]
512
+ }
513
+ ) : null, Z = ({ sx: e, ...t }) => {
514
+ const { colors: o, radius: s } = W();
515
+ return /* @__PURE__ */ r(
516
+ h,
517
+ {
518
+ ...t,
519
+ sx: [
520
+ {
521
+ backgroundColor: o.surface,
522
+ border: `1px solid ${o.border}`,
523
+ borderRadius: s.md
524
+ },
525
+ ...Array.isArray(e) ? e : [e]
526
+ ]
527
+ }
528
+ );
529
+ }, Ke = ({ children: e }) => {
530
+ const { colors: t } = W();
531
+ return /* @__PURE__ */ r(S, { size: 13, weight: 700, upper: !0, color: t.text, sx: { padding: `0 ${n(2, 13)}` }, children: e });
532
+ }, Y = ({
533
+ size: e = 11,
534
+ children: t,
535
+ sx: o
536
+ }) => {
537
+ const { colors: s } = W();
538
+ return /* @__PURE__ */ r(S, { size: e, font: "secondary", weight: 700, upper: !0, color: s.dim, sx: o, children: t });
539
+ }, Ve = z.createContext(null), ao = Ve.Provider, K = () => {
540
+ const e = z.useContext(Ve);
541
+ if (!e) throw new Error("useWidget must be used inside WidgetProvider");
542
+ return e;
543
+ }, lo = () => {
544
+ var m;
545
+ const { colors: e, radius: t } = W(), { data: o, competitionId: s, entities: i, finished: a, label: d, fmt: l } = K(), c = a.length, u = o.matches.length, g = B(c, u), f = (m = o.matches.filter((I) => I.status === "UPCOMING" || I.status === "LIVE").sort((I, x) => I.round - x.round)[0]) == null ? void 0 : m.round, w = {
546
+ day: "numeric",
547
+ month: "short",
548
+ year: "numeric"
549
+ }, b = o.season.startDate && o.season.endDate ? `${l.date(o.season.startDate, w)} – ${l.date(o.season.endDate, w)}` : "";
550
+ return /* @__PURE__ */ y(
551
+ Z,
552
+ {
553
+ sx: {
554
+ padding: `${n(12)} ${n(16)}`,
555
+ display: "flex",
556
+ alignItems: "center",
557
+ gap: n(12),
558
+ flexWrap: "wrap"
559
+ },
560
+ children: [
561
+ /* @__PURE__ */ r(j, { url: i.logo(s), size: 40 }),
562
+ /* @__PURE__ */ y(h, { sx: { minWidth: 0, flex: `1 1 ${n(200)}` }, children: [
563
+ /* @__PURE__ */ y(h, { sx: { display: "flex", alignItems: "center", gap: n(8), flexWrap: "wrap" }, children: [
564
+ /* @__PURE__ */ r(S, { size: 17, weight: 700, color: e.text, cms: !0, children: i.name(s) }),
565
+ o.season.name ? /* @__PURE__ */ r(
566
+ S,
567
+ {
568
+ size: 10,
569
+ weight: 600,
570
+ color: e.primary,
571
+ sx: {
572
+ backgroundColor: e.tint,
573
+ borderRadius: t.full,
574
+ padding: `${n(3, 10)} ${n(8, 10)}`
575
+ },
576
+ children: o.season.name
577
+ }
578
+ ) : null
579
+ ] }),
580
+ b ? /* @__PURE__ */ r(
581
+ S,
582
+ {
583
+ component: "div",
584
+ size: 11,
585
+ font: "secondary",
586
+ color: e.dim,
587
+ sx: { marginTop: n(2, 11) },
588
+ children: b
589
+ }
590
+ ) : null
591
+ ] }),
592
+ /* @__PURE__ */ y(h, { sx: { flex: `1 1 ${n(220)}`, minWidth: 0 }, children: [
593
+ /* @__PURE__ */ y(
594
+ S,
595
+ {
596
+ component: "div",
597
+ size: 11,
598
+ font: "secondary",
599
+ color: e.dim,
600
+ sx: {
601
+ display: "flex",
602
+ justifyContent: "space-between",
603
+ marginBottom: n(5, 11)
604
+ },
605
+ children: [
606
+ /* @__PURE__ */ r("span", { children: f !== void 0 ? d("upcomingRound", { round: f }) : d("seasonFinished") }),
607
+ /* @__PURE__ */ y("span", { children: [
608
+ /* @__PURE__ */ r(h, { component: "b", sx: { color: e.text }, children: c }),
609
+ " ",
610
+ d("seasonProgress", {
611
+ matches: d("matchesCount", { count: u }),
612
+ pct: g
613
+ })
614
+ ] })
615
+ ]
616
+ }
617
+ ),
618
+ /* @__PURE__ */ r(
619
+ h,
620
+ {
621
+ sx: {
622
+ height: n(6),
623
+ borderRadius: t.full,
624
+ backgroundColor: e.variant,
625
+ overflow: "hidden"
626
+ },
627
+ children: /* @__PURE__ */ r(
628
+ h,
629
+ {
630
+ sx: {
631
+ height: "100%",
632
+ width: `${g}%`,
633
+ backgroundColor: e.primary,
634
+ borderRadius: t.full
635
+ }
636
+ }
637
+ )
638
+ }
639
+ )
640
+ ] })
641
+ ]
642
+ }
643
+ );
644
+ }, co = {
645
+ match: "matchId",
646
+ team: "competitorId",
647
+ player: "athleteId"
648
+ }, ue = (e) => {
649
+ var t;
650
+ return !!(e != null && e.onClick || (t = e == null ? void 0 : e.url) != null && t.trim());
651
+ }, ye = (e, t, o) => {
652
+ var d;
653
+ if (!ue(e)) return null;
654
+ const s = ((d = e == null ? void 0 : e.url) == null ? void 0 : d.trim()) ?? "", i = encodeURIComponent(o);
655
+ return {
656
+ href: s ? s.replace(
657
+ /\{(\w+)\}/g,
658
+ (l, c) => c === "id" || c === co[t] ? i : l
659
+ ) : null,
660
+ target: (e == null ? void 0 : e.target) ?? void 0,
661
+ onClick: e != null && e.onClick ? (l) => {
662
+ var c;
663
+ l.stopPropagation(), l.preventDefault(), (c = e.onClick) == null || c.call(e, o);
664
+ } : (l) => l.stopPropagation()
665
+ };
666
+ }, oe = (e, t) => Math.round(e.minutes / t), X = (e, t) => t("matchesCount", { count: e.appearances }), ne = (e, t) => t("minutesCount", { count: e.minutes }), Ye = {
667
+ scorers: {
668
+ title: "scorers",
669
+ unit: "unitGoals",
670
+ secondary: (e, t, o) => [X(e, o), ne(e, o), o("goalEvery", { count: oe(e, t) })],
671
+ chips: (e, t, o) => [X(e, o), ne(e, o), o("goalRate", { count: oe(e, t) })]
672
+ },
673
+ assists: {
674
+ title: "assists",
675
+ unit: "unitAssists",
676
+ secondary: (e, t, o) => [X(e, o), ne(e, o), o("assistEvery", { count: oe(e, t) })],
677
+ chips: (e, t, o) => [X(e, o), ne(e, o), o("assistRate", { count: oe(e, t) })]
678
+ },
679
+ contributions: {
680
+ title: "contributions",
681
+ unit: "unitContributions",
682
+ secondary: (e, t, o) => [
683
+ o("goalsCount", { count: e.goals }),
684
+ o("assistsCount", { count: e.assists }),
685
+ o("contributionEvery", { count: oe(e, t) })
686
+ ],
687
+ chips: (e, t, o) => [
688
+ o("goalsShort", { count: e.goals }),
689
+ o("assistsShort", { count: e.assists }),
690
+ o("contributionRate", { count: oe(e, t) })
691
+ ]
692
+ },
693
+ cleanSheets: {
694
+ title: "cleanSheets",
695
+ unit: "unitMatches",
696
+ secondary: (e, t, o) => [X(e, o), ne(e, o)],
697
+ chips: (e, t, o) => [X(e, o), ne(e, o)]
698
+ },
699
+ minutes: {
700
+ title: "mostMinutes",
701
+ unit: "unitMinutes",
702
+ secondary: (e, t, o) => [
703
+ X(e, o),
704
+ o("minutesPerMatch", { count: e.appearances ? Math.round(t / e.appearances) : 0 })
705
+ ],
706
+ chips: (e, t, o) => [
707
+ X(e, o),
708
+ o("minutesPerMatch", { count: e.appearances ? Math.round(t / e.appearances) : 0 })
709
+ ]
710
+ },
711
+ cards: {
712
+ title: "mostCards",
713
+ unit: "unitCards",
714
+ secondary: (e, t, o) => [
715
+ o("yellowCount", { count: e.yellowCards }),
716
+ o("redCount", { count: e.redCards })
717
+ ],
718
+ chips: (e, t, o) => [
719
+ o("yellowCount", { count: e.yellowCards }),
720
+ o("redCount", { count: e.redCards })
721
+ ]
722
+ }
723
+ }, uo = {
724
+ goalkeeper: "goalkeeper",
725
+ defender: "defender",
726
+ midfielder: "midfielder",
727
+ forward: "forward"
728
+ }, ze = ({ photo: e, initial: t, size: o, badge: s, teamLogo: i, hero: a }) => {
729
+ const { colors: d } = W(), l = a ? 22 : 12;
730
+ return /* @__PURE__ */ y(
731
+ h,
732
+ {
733
+ sx: {
734
+ position: "relative",
735
+ flexShrink: 0,
736
+ ...a ? {} : { width: n(o), height: n(o) }
737
+ },
738
+ children: [
739
+ /* @__PURE__ */ r(
740
+ S,
741
+ {
742
+ component: "div",
743
+ size: l,
744
+ weight: 700,
745
+ color: d.dim,
746
+ sx: {
747
+ width: n(o, l),
748
+ height: n(o, l),
749
+ borderRadius: "50%",
750
+ backgroundColor: a ? d.surface : d.variant,
751
+ ...a ? { border: `2px solid ${d.primary}` } : {},
752
+ display: "flex",
753
+ alignItems: "center",
754
+ justifyContent: "center",
755
+ overflow: "hidden",
756
+ ...e ? {
757
+ backgroundImage: `url("${e}")`,
758
+ backgroundSize: "cover",
759
+ backgroundPosition: "top center"
760
+ } : {}
761
+ },
762
+ children: e ? null : t
763
+ }
764
+ ),
765
+ i ? /* @__PURE__ */ r(
766
+ h,
767
+ {
768
+ sx: {
769
+ position: "absolute",
770
+ right: n(-4),
771
+ bottom: n(a ? -2 : -3),
772
+ width: n(s),
773
+ height: n(s),
774
+ borderRadius: "50%",
775
+ backgroundColor: d.surface,
776
+ border: `1px solid ${d.border}`,
777
+ backgroundImage: `url("${i}")`,
778
+ backgroundSize: "70%",
779
+ backgroundRepeat: "no-repeat",
780
+ backgroundPosition: "center"
781
+ }
782
+ }
783
+ ) : null
784
+ ]
785
+ }
786
+ );
787
+ }, po = ({ category: e }) => {
788
+ var $, v, E, D;
789
+ const { colors: t, radius: o, fonts: s } = W(), { data: i, entities: a, label: d, props: l } = K(), [c, u] = z.useState(!1), g = Ye[e], f = z.useMemo(() => oo(i.athletes, e), [i.athletes, e]), w = Math.min(10, Math.max(1, Math.round(l.playerRankingsRows ?? 5))), b = f.slice(0, c ? 10 : w), m = ue(l.playerCTA), I = (M) => {
790
+ const A = M.athlete.athleteId, L = a.name(A), T = uo[a.position(A) ?? ""];
791
+ return {
792
+ id: A,
793
+ name: L,
794
+ photo: a.photo(A),
795
+ initial: L.trim().charAt(0),
796
+ team: a.name(M.athlete.teamId),
797
+ teamLogo: a.logo(M.athlete.teamId),
798
+ position: T ? d(T) : "",
799
+ cta: ye(l.playerCTA, "player", A)
800
+ };
801
+ }, x = b[0] ? I(b[0]) : null;
802
+ return /* @__PURE__ */ y(
803
+ h,
804
+ {
805
+ sx: {
806
+ backgroundColor: t.surface,
807
+ border: `1px solid ${t.border}`,
808
+ borderRadius: o.md,
809
+ overflow: "hidden",
810
+ display: "flex",
811
+ flexDirection: "column"
812
+ },
813
+ children: [
814
+ /* @__PURE__ */ r(
815
+ S,
816
+ {
817
+ component: "div",
818
+ size: 11,
819
+ font: "secondary",
820
+ weight: 700,
821
+ upper: !0,
822
+ color: t.dim,
823
+ sx: { padding: `${n(10, 11)} ${n(14, 11)} 0` },
824
+ children: d(g.title)
825
+ }
826
+ ),
827
+ x && b[0] ? /* @__PURE__ */ y(
828
+ h,
829
+ {
830
+ component: ($ = x.cta) != null && $.href ? "a" : "div",
831
+ href: ((v = x.cta) == null ? void 0 : v.href) ?? void 0,
832
+ target: (E = x.cta) == null ? void 0 : E.target,
833
+ onClick: (D = x.cta) == null ? void 0 : D.onClick,
834
+ sx: {
835
+ margin: n(10),
836
+ padding: n(12),
837
+ borderRadius: `calc(${o.md} - 2px)`,
838
+ background: `linear-gradient(135deg, ${t.tint2}, ${t.tint})`,
839
+ display: "flex",
840
+ alignItems: "center",
841
+ gap: n(12),
842
+ cursor: m ? "pointer" : "default",
843
+ textDecoration: "none",
844
+ color: "inherit"
845
+ },
846
+ children: [
847
+ /* @__PURE__ */ r(
848
+ ze,
849
+ {
850
+ photo: x.photo,
851
+ initial: x.initial,
852
+ size: 60,
853
+ badge: 24,
854
+ teamLogo: x.teamLogo,
855
+ hero: !0
856
+ }
857
+ ),
858
+ /* @__PURE__ */ y(h, { sx: { flex: 1, minWidth: 0 }, children: [
859
+ /* @__PURE__ */ r(S, { component: "div", size: 15, weight: 700, color: t.text, ellipsis: !0, cms: !0, children: x.name }),
860
+ /* @__PURE__ */ r(
861
+ S,
862
+ {
863
+ component: "div",
864
+ size: 11,
865
+ font: "secondary",
866
+ color: t.dim,
867
+ ellipsis: !0,
868
+ cms: !0,
869
+ sx: { marginTop: n(2, 11) },
870
+ children: [x.team, x.position].filter(Boolean).join(" · ")
871
+ }
872
+ ),
873
+ /* @__PURE__ */ r(h, { sx: { display: "flex", gap: n(4), flexWrap: "wrap", marginTop: n(6) }, children: g.chips(b[0].athlete, b[0].value, d).map((M) => /* @__PURE__ */ r(
874
+ S,
875
+ {
876
+ size: 10,
877
+ font: "secondary",
878
+ weight: 600,
879
+ color: t.body,
880
+ sx: {
881
+ backgroundColor: t.surface,
882
+ borderRadius: o.full,
883
+ padding: `${n(2, 10)} ${n(7, 10)}`
884
+ },
885
+ children: M
886
+ },
887
+ M
888
+ )) })
889
+ ] }),
890
+ /* @__PURE__ */ y(h, { sx: { textAlign: "right", flexShrink: 0 }, children: [
891
+ /* @__PURE__ */ r(S, { component: "div", size: 32, weight: 700, color: t.primary, sx: { lineHeight: 1 }, children: b[0].value }),
892
+ /* @__PURE__ */ r(
893
+ S,
894
+ {
895
+ component: "div",
896
+ size: 10,
897
+ font: "secondary",
898
+ upper: !0,
899
+ color: t.dim,
900
+ sx: { marginTop: n(3, 10) },
901
+ children: d(g.unit)
902
+ }
903
+ )
904
+ ] })
905
+ ]
906
+ }
907
+ ) : null,
908
+ b.slice(1).map((M) => {
909
+ var L, T, R, O;
910
+ const A = I(M);
911
+ return /* @__PURE__ */ y(
912
+ h,
913
+ {
914
+ component: (L = A.cta) != null && L.href ? "a" : "div",
915
+ href: ((T = A.cta) == null ? void 0 : T.href) ?? void 0,
916
+ target: (R = A.cta) == null ? void 0 : R.target,
917
+ onClick: (O = A.cta) == null ? void 0 : O.onClick,
918
+ sx: {
919
+ display: "grid",
920
+ gridTemplateColumns: `${n(28)} ${n(32)} minmax(0,1fr) auto`,
921
+ alignItems: "center",
922
+ gap: n(10),
923
+ padding: `${n(8)} ${n(14)}`,
924
+ borderTop: `1px solid ${t.border}`,
925
+ cursor: m ? "pointer" : "default",
926
+ textDecoration: "none",
927
+ color: "inherit",
928
+ "&:hover": { backgroundColor: m ? t.onSurface : "transparent" }
929
+ },
930
+ children: [
931
+ /* @__PURE__ */ r(S, { size: 12, font: "secondary", weight: 700, color: t.dim, children: M.rank }),
932
+ /* @__PURE__ */ r(ze, { photo: A.photo, initial: A.initial, size: 32, badge: 16, teamLogo: A.teamLogo }),
933
+ /* @__PURE__ */ y(h, { sx: { minWidth: 0 }, children: [
934
+ /* @__PURE__ */ r(S, { component: "div", size: 13, weight: 600, color: t.text, ellipsis: !0, cms: !0, children: A.name }),
935
+ /* @__PURE__ */ r(S, { component: "div", size: 11, font: "secondary", color: t.dim, ellipsis: !0, children: g.secondary(M.athlete, M.value, d).join(" · ") })
936
+ ] }),
937
+ /* @__PURE__ */ r(S, { size: 16, weight: 700, color: t.primary, children: M.value })
938
+ ]
939
+ },
940
+ A.id
941
+ );
942
+ }),
943
+ f.length > w ? /* @__PURE__ */ r(
944
+ h,
945
+ {
946
+ component: "button",
947
+ type: "button",
948
+ onClick: () => u(!c),
949
+ sx: {
950
+ border: "none",
951
+ borderTop: `1px solid ${t.border}`,
952
+ background: "transparent",
953
+ cursor: "pointer",
954
+ padding: n(9, 12),
955
+ fontFamily: s.secondary,
956
+ fontSize: n(12),
957
+ fontWeight: 700,
958
+ color: t.primary
959
+ },
960
+ children: c ? d("showLess") : d("showAll", { count: f.length })
961
+ }
962
+ ) : null
963
+ ]
964
+ }
965
+ );
966
+ }, mo = () => {
967
+ const { colors: e, radius: t, fonts: o } = W(), { label: s, props: i } = K(), a = xe(), [d, l] = z.useState(0), c = i.playerRankingsLayout ?? "auto", u = c === "tabs" || c === "auto" && a, g = u ? [ge[d]] : ge;
968
+ return /* @__PURE__ */ y(h, { sx: { display: "flex", flexDirection: "column", gap: n(10) }, children: [
969
+ /* @__PURE__ */ r(Ke, { children: s("leadersTitle") }),
970
+ u ? /* @__PURE__ */ r(
971
+ h,
972
+ {
973
+ sx: {
974
+ display: "flex",
975
+ gap: n(4),
976
+ overflowX: "auto",
977
+ padding: n(3),
978
+ backgroundColor: e.surface,
979
+ border: `1px solid ${e.border}`,
980
+ borderRadius: t.full
981
+ },
982
+ children: ge.map((f, w) => {
983
+ const b = w === d;
984
+ return /* @__PURE__ */ r(
985
+ h,
986
+ {
987
+ component: "button",
988
+ type: "button",
989
+ onClick: () => l(w),
990
+ sx: {
991
+ flex: "1 0 auto",
992
+ whiteSpace: "nowrap",
993
+ border: "none",
994
+ cursor: "pointer",
995
+ borderRadius: t.full,
996
+ padding: `${n(6, 12)} ${n(12, 12)}`,
997
+ fontFamily: o.primary,
998
+ fontSize: n(12),
999
+ fontWeight: 700,
1000
+ backgroundColor: b ? e.primary : "transparent",
1001
+ color: b ? e.onPrimary : e.dim
1002
+ },
1003
+ children: s(Ye[f].title)
1004
+ },
1005
+ f
1006
+ );
1007
+ })
1008
+ }
1009
+ ) : null,
1010
+ /* @__PURE__ */ r(
1011
+ h,
1012
+ {
1013
+ sx: {
1014
+ display: "grid",
1015
+ gridTemplateColumns: u ? "1fr" : `repeat(auto-fit,minmax(${n(300)},1fr))`,
1016
+ gap: n(12)
1017
+ },
1018
+ children: g.map((f) => /* @__PURE__ */ r(po, { category: f }, f))
1019
+ }
1020
+ )
1021
+ ] });
1022
+ }, ho = 3e4, re = {
1023
+ threeWay: { code: "FT_1X2", outcomes: ["1", "X", "2"] },
1024
+ twoWay: { code: "WINNER_OT", outcomes: ["1", "2"] }
1025
+ }, go = /* @__PURE__ */ new Set(["FOOTBALL", "HOCKEY", "ICE_HOCKEY"]), fo = (e) => go.has((e ?? "").toUpperCase()) ? [re.threeWay, re.twoWay] : [re.twoWay, re.threeWay], yo = (e, t) => {
1026
+ const o = (e || t || "").trim().toUpperCase();
1027
+ return o === "1" || o === "HOME" || o === "HOME_TEAM" ? "1" : o === "X" || o === "DRAW" ? "X" : o === "2" || o === "AWAY" || o === "AWAY_TEAM" ? "2" : null;
1028
+ }, De = (e) => {
1029
+ if (!Array.isArray(e)) return null;
1030
+ const t = e.find((o) => typeof (o == null ? void 0 : o.url) == "string" && o.url);
1031
+ return t ? t.url : null;
1032
+ }, xo = (e, t, o, s, i) => {
1033
+ var a, d;
1034
+ for (const l of t) {
1035
+ if (`${(l == null ? void 0 : l.type) ?? "PRE_EVENT"}`.toUpperCase() === "LIVE" !== i) continue;
1036
+ const u = o.map((x) => ({
1037
+ candidate: x,
1038
+ market: (l.markets ?? []).find(
1039
+ ($) => {
1040
+ var v, E;
1041
+ return (((v = $ == null ? void 0 : $.type) == null ? void 0 : v.code) || ((E = $ == null ? void 0 : $.type) == null ? void 0 : E.id) || "").toUpperCase() === x.code;
1042
+ }
1043
+ )
1044
+ })).find((x) => !!x.market);
1045
+ if (!(u != null && u.market)) continue;
1046
+ const { candidate: g, market: f } = u, w = [];
1047
+ if ((f.selections ?? []).forEach((x) => {
1048
+ const $ = yo(x == null ? void 0 : x.code, x == null ? void 0 : x.name);
1049
+ if (!$) return;
1050
+ const v = Number(x == null ? void 0 : x.odds);
1051
+ if (!Number.isFinite(v) || v <= 0 || w.some((A) => A.label === $)) return;
1052
+ const E = s == null ? void 0 : s.get($), D = ((x == null ? void 0 : x.movement) ?? "").toUpperCase(), M = D === "UP" || D === "DOWN" ? D.toLowerCase() : E === void 0 || E === v ? "none" : v > E ? "up" : "down";
1053
+ w.push({ label: $, value: v.toFixed(2), odd: v, change: M, url: De(x == null ? void 0 : x.urls) });
1054
+ }), !g.outcomes.every((x) => w.some(($) => $.label === x))) continue;
1055
+ const b = g.outcomes;
1056
+ w.sort((x, $) => b.indexOf(x.label) - b.indexOf($.label));
1057
+ const m = l.bookmaker, I = ((m == null ? void 0 : m.assets) ?? [])[0];
1058
+ return {
1059
+ matchId: e,
1060
+ market: g.code,
1061
+ operator: m ? {
1062
+ name: m.name ?? "",
1063
+ logo: (I == null ? void 0 : I.transparentBackgroundUrl) || (I == null ? void 0 : I.logo) || null,
1064
+ url: De(m.eventUrls) ?? m.url ?? null,
1065
+ backgroundColor: ((a = m.branding) == null ? void 0 : a.backgroundColor) ?? (I == null ? void 0 : I.backgroundColor) ?? null,
1066
+ textColor: ((d = m.branding) == null ? void 0 : d.textColor) ?? null
1067
+ } : null,
1068
+ values: w
1069
+ };
1070
+ }
1071
+ return null;
1072
+ }, bo = (e, t, o) => {
1073
+ const {
1074
+ enabled: s,
1075
+ liveMatchIds: i = [],
1076
+ sport: a,
1077
+ pollingIntervalMs: d = ho,
1078
+ operators: l,
1079
+ affiliateId: c,
1080
+ affiliateIds: u
1081
+ } = o, [g, f] = J(() => /* @__PURE__ */ new Map()), w = rt(/* @__PURE__ */ new Map()), b = [...t].sort().join(","), m = [...i].sort().join(","), I = (l ?? []).join(","), x = `${c ?? ""}|${JSON.stringify(u ?? {})}`, $ = st(async () => {
1082
+ const v = b ? b.split(",") : [], E = new Set(m ? m.split(",") : []);
1083
+ if (!e || v.length === 0) {
1084
+ f(/* @__PURE__ */ new Map());
1085
+ return;
1086
+ }
1087
+ try {
1088
+ const D = fo(a), M = {
1089
+ oddType: E.size ? Re.ALL : Re.PRE_EVENT,
1090
+ scopeType: Tt.ORDINARY_TIME,
1091
+ oddFormat: $t.DECIMAL,
1092
+ marketTypes: D.map((T) => T.code),
1093
+ ...l && l.length ? { operators: l } : {},
1094
+ ...c ? { affiliateId: c } : {},
1095
+ ...u && Object.keys(u).length ? { affiliateIds: u } : {}
1096
+ }, A = await e.odds.getByMatchIds(v, M), L = /* @__PURE__ */ new Map();
1097
+ v.forEach((T) => {
1098
+ const R = xo(
1099
+ T,
1100
+ (A == null ? void 0 : A.get(T)) ?? [],
1101
+ D,
1102
+ w.current.get(T),
1103
+ E.has(T)
1104
+ );
1105
+ R && (L.set(T, R), w.current.set(T, new Map(R.values.map((O) => [O.label, O.odd]))));
1106
+ }), f(L);
1107
+ } catch {
1108
+ f(/* @__PURE__ */ new Map());
1109
+ }
1110
+ }, [e, b, m, a, I, x]);
1111
+ return le(() => {
1112
+ if (!s || !b) {
1113
+ f(/* @__PURE__ */ new Map());
1114
+ return;
1115
+ }
1116
+ let v = !1;
1117
+ const E = () => {
1118
+ v || $();
1119
+ };
1120
+ if (E(), d <= 0) return () => {
1121
+ v = !0;
1122
+ };
1123
+ const D = setInterval(E, d);
1124
+ return () => {
1125
+ v = !0, clearInterval(D);
1126
+ };
1127
+ }, [s, b, d, $]), g;
1128
+ }, F = ({ label: e, home: t, away: o, percent: s, format: i }) => {
1129
+ const { colors: a, radius: d } = W(), l = t ?? 0, c = o ?? 0, u = l + c || 1, g = s ? Math.round(l) : l, f = s ? Math.round(c) : c, w = (b) => b == null ? "–" : s ? `${Math.round(b)}%` : i ? i(b) : String(b);
1130
+ return /* @__PURE__ */ y(
1131
+ h,
1132
+ {
1133
+ sx: {
1134
+ display: "grid",
1135
+ gridTemplateColumns: `${n(44)} 1fr ${n(44)}`,
1136
+ alignItems: "center",
1137
+ gap: n(12)
1138
+ },
1139
+ children: [
1140
+ /* @__PURE__ */ r(
1141
+ S,
1142
+ {
1143
+ size: 14,
1144
+ weight: 700,
1145
+ font: "secondary",
1146
+ color: g > f ? a.text : a.dim,
1147
+ sx: { textAlign: "right" },
1148
+ children: w(t)
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ y(h, { sx: { display: "flex", flexDirection: "column", gap: n(4) }, children: [
1152
+ /* @__PURE__ */ r(S, { size: 10, font: "secondary", upper: !0, color: a.dim, sx: { textAlign: "center" }, children: e }),
1153
+ /* @__PURE__ */ y(h, { sx: { display: "flex", gap: n(2), height: n(6) }, children: [
1154
+ /* @__PURE__ */ r(
1155
+ h,
1156
+ {
1157
+ sx: {
1158
+ flex: 1,
1159
+ display: "flex",
1160
+ justifyContent: "flex-end",
1161
+ backgroundColor: a.variant,
1162
+ borderRadius: `${d.full} 0 0 ${d.full}`,
1163
+ overflow: "hidden"
1164
+ },
1165
+ children: /* @__PURE__ */ r(h, { sx: { width: `${B(l, u)}%`, backgroundColor: a.primary } })
1166
+ }
1167
+ ),
1168
+ /* @__PURE__ */ r(
1169
+ h,
1170
+ {
1171
+ sx: {
1172
+ flex: 1,
1173
+ backgroundColor: a.variant,
1174
+ borderRadius: `0 ${d.full} ${d.full} 0`,
1175
+ overflow: "hidden"
1176
+ },
1177
+ children: /* @__PURE__ */ r(
1178
+ h,
1179
+ {
1180
+ sx: {
1181
+ width: `${B(c, u)}%`,
1182
+ height: "100%",
1183
+ backgroundColor: a.primaryContainer
1184
+ }
1185
+ }
1186
+ )
1187
+ }
1188
+ )
1189
+ ] })
1190
+ ] }),
1191
+ /* @__PURE__ */ r(S, { size: 14, weight: 700, font: "secondary", color: f > g ? a.text : a.dim, children: w(o) })
1192
+ ]
1193
+ }
1194
+ );
1195
+ }, wo = [0, 15, 30, 45, 60, 75, 90], Co = 5.5, So = ({
1196
+ x: e,
1197
+ top: t,
1198
+ logo: o,
1199
+ color: s
1200
+ }) => {
1201
+ const { colors: i } = W();
1202
+ return /* @__PURE__ */ r(
1203
+ h,
1204
+ {
1205
+ sx: {
1206
+ position: "absolute",
1207
+ left: `${e}%`,
1208
+ top: t ? "22%" : "78%",
1209
+ transform: "translate(-50%,-50%)",
1210
+ display: "flex"
1211
+ },
1212
+ children: /* @__PURE__ */ y(
1213
+ h,
1214
+ {
1215
+ sx: {
1216
+ position: "relative",
1217
+ width: n(26),
1218
+ height: n(26),
1219
+ borderRadius: "50%",
1220
+ backgroundColor: i.surface,
1221
+ border: `2px solid ${s}`,
1222
+ boxShadow: "0 1px 3px rgba(0,0,0,.18)",
1223
+ display: "flex",
1224
+ alignItems: "center",
1225
+ justifyContent: "center"
1226
+ },
1227
+ children: [
1228
+ o ? /* @__PURE__ */ r(
1229
+ h,
1230
+ {
1231
+ component: "img",
1232
+ src: o,
1233
+ alt: "",
1234
+ sx: { width: n(18), height: n(18), objectFit: "contain", display: "block" }
1235
+ }
1236
+ ) : null,
1237
+ /* @__PURE__ */ r(
1238
+ h,
1239
+ {
1240
+ sx: {
1241
+ position: "absolute",
1242
+ right: n(-6),
1243
+ bottom: n(-6),
1244
+ width: n(14),
1245
+ height: n(14),
1246
+ borderRadius: "50%",
1247
+ backgroundColor: i.surface,
1248
+ border: `1px solid ${i.border}`,
1249
+ display: "flex",
1250
+ alignItems: "center",
1251
+ justifyContent: "center",
1252
+ color: i.text
1253
+ },
1254
+ children: /* @__PURE__ */ y(
1255
+ "svg",
1256
+ {
1257
+ width: "0.5625em",
1258
+ height: "0.5625em",
1259
+ viewBox: "0 0 24 24",
1260
+ fill: "none",
1261
+ stroke: "currentColor",
1262
+ strokeWidth: "2.4",
1263
+ strokeLinecap: "round",
1264
+ strokeLinejoin: "round",
1265
+ children: [
1266
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
1267
+ /* @__PURE__ */ r("path", { d: "m12 7 4.5 3.3-1.7 5.4H9.2L7.5 10.3z" })
1268
+ ]
1269
+ }
1270
+ )
1271
+ }
1272
+ )
1273
+ ]
1274
+ }
1275
+ )
1276
+ }
1277
+ );
1278
+ }, Io = ({ match: e }) => {
1279
+ const { colors: t } = W(), { entities: o, label: s } = K(), i = o.logo(e.home.id), a = o.logo(e.away.id), [d, l] = e.fullTime ?? [0, 0], c = [];
1280
+ return e.home.goalsByPeriod.forEach((u, g) => {
1281
+ const f = (m, I) => (g * 15 + 7.5 + (I - (m - 1) / 2) * Co) / 90 * 100, w = e.home.goalsByPeriod[g] ?? 0, b = e.away.goalsByPeriod[g] ?? 0;
1282
+ for (let m = 0; m < w; m += 1) c.push({ x: f(w, m), top: !0, key: `h${g}-${m}` });
1283
+ for (let m = 0; m < b; m += 1) c.push({ x: f(b, m), top: !1, key: `a${g}-${m}` });
1284
+ }), /* @__PURE__ */ y(pe, { children: [
1285
+ /* @__PURE__ */ r(F, { label: s("possession"), home: e.home.possession, away: e.away.possession, percent: !0 }),
1286
+ /* @__PURE__ */ r(F, { label: s("shotsOnTarget"), home: e.home.shotsOnTarget, away: e.away.shotsOnTarget }),
1287
+ /* @__PURE__ */ r(F, { label: s("corners"), home: e.home.corners, away: e.away.corners }),
1288
+ /* @__PURE__ */ r(F, { label: s("yellowCards"), home: e.home.yellowCards, away: e.away.yellowCards }),
1289
+ /* @__PURE__ */ r(F, { label: s("redCards"), home: e.home.redCards, away: e.away.redCards }),
1290
+ /* @__PURE__ */ y(
1291
+ h,
1292
+ {
1293
+ sx: {
1294
+ display: "grid",
1295
+ gridTemplateColumns: `${n(44)} 1fr ${n(44)}`,
1296
+ alignItems: "center",
1297
+ gap: n(12),
1298
+ marginTop: n(4)
1299
+ },
1300
+ children: [
1301
+ /* @__PURE__ */ r(j, { url: i, size: 30, sx: { justifySelf: "end" } }),
1302
+ /* @__PURE__ */ y(h, { sx: { position: "relative", height: n(84), gridColumn: 2 }, children: [
1303
+ /* @__PURE__ */ r(
1304
+ h,
1305
+ {
1306
+ sx: {
1307
+ position: "absolute",
1308
+ left: 0,
1309
+ right: 0,
1310
+ top: "50%",
1311
+ height: "2px",
1312
+ backgroundColor: t.border,
1313
+ transform: "translateY(-50%)"
1314
+ }
1315
+ }
1316
+ ),
1317
+ wo.map((u) => {
1318
+ const g = u === 45, f = g ? t.text : t.dim;
1319
+ return /* @__PURE__ */ y(z.Fragment, { children: [
1320
+ /* @__PURE__ */ r(
1321
+ h,
1322
+ {
1323
+ sx: {
1324
+ position: "absolute",
1325
+ left: `${u / 90 * 100}%`,
1326
+ top: "50%",
1327
+ transform: "translate(-50%,-50%)",
1328
+ width: g ? "2px" : "1px",
1329
+ height: n(g ? 14 : 8),
1330
+ backgroundColor: f,
1331
+ borderRadius: "1px"
1332
+ }
1333
+ }
1334
+ ),
1335
+ /* @__PURE__ */ r(
1336
+ S,
1337
+ {
1338
+ size: 10,
1339
+ font: "secondary",
1340
+ weight: g ? 700 : 400,
1341
+ color: f,
1342
+ sx: {
1343
+ position: "absolute",
1344
+ left: `${u / 90 * 100}%`,
1345
+ bottom: 0,
1346
+ transform: "translateX(-50%)",
1347
+ whiteSpace: "nowrap"
1348
+ },
1349
+ children: g ? s("halfTimeShort") : s("minuteTick", { minute: u })
1350
+ }
1351
+ )
1352
+ ] }, u);
1353
+ }),
1354
+ c.map((u) => /* @__PURE__ */ r(
1355
+ So,
1356
+ {
1357
+ x: u.x,
1358
+ top: u.top,
1359
+ logo: u.top ? i : a,
1360
+ color: u.top ? t.primary : t.primaryContainer
1361
+ },
1362
+ u.key
1363
+ )),
1364
+ d + l === 0 ? /* @__PURE__ */ r(
1365
+ S,
1366
+ {
1367
+ size: 11,
1368
+ font: "secondary",
1369
+ color: t.dim,
1370
+ sx: {
1371
+ position: "absolute",
1372
+ left: "50%",
1373
+ top: n(14, 11),
1374
+ transform: "translateX(-50%)"
1375
+ },
1376
+ children: s("noGoals")
1377
+ }
1378
+ ) : null
1379
+ ] }),
1380
+ /* @__PURE__ */ r(j, { url: a, size: 30, sx: { justifySelf: "start", gridColumn: 3 } })
1381
+ ]
1382
+ }
1383
+ )
1384
+ ] });
1385
+ }, vo = 3e3, ko = ({ odds: e, config: t, onAddToBetslip: o }) => {
1386
+ const { colors: s, fonts: i, radius: a } = W(), d = "1.625em", l = ((t == null ? void 0 : t.mode) ?? "default") === "flash", c = (t == null ? void 0 : t.flashInterval) ?? vo, [u, g] = z.useState(!1);
1387
+ z.useEffect(() => {
1388
+ if (!l) return;
1389
+ const m = setInterval(() => g((I) => !I), c);
1390
+ return () => clearInterval(m);
1391
+ }, [l, c]);
1392
+ const f = e.operator, w = (m) => f ? /* @__PURE__ */ r(
1393
+ h,
1394
+ {
1395
+ component: f.url ? "a" : "div",
1396
+ href: f.url ?? void 0,
1397
+ target: f.url ? "_blank" : void 0,
1398
+ rel: f.url ? "noopener noreferrer" : void 0,
1399
+ sx: {
1400
+ display: "flex",
1401
+ alignItems: "center",
1402
+ justifyContent: "center",
1403
+ gap: "0.375em",
1404
+ height: d,
1405
+ paddingInline: "0.375em",
1406
+ borderRadius: a.xs,
1407
+ boxSizing: "border-box",
1408
+ textDecoration: "none",
1409
+ flexShrink: 0,
1410
+ whiteSpace: "nowrap",
1411
+ // The operator's brand colours are data, not theme.
1412
+ backgroundColor: f.backgroundColor ?? s.onSurface,
1413
+ color: f.textColor ?? s.text,
1414
+ ...m ? { flex: 1 } : { maxWidth: "5.25em", width: "100%" }
1415
+ },
1416
+ children: f.logo ? /* @__PURE__ */ r(
1417
+ h,
1418
+ {
1419
+ component: "img",
1420
+ src: f.logo,
1421
+ alt: f.name,
1422
+ loading: "lazy",
1423
+ sx: { height: "100%", width: "auto", objectFit: "contain" }
1424
+ }
1425
+ ) : /* @__PURE__ */ r(
1426
+ Et,
1427
+ {
1428
+ sx: {
1429
+ fontFamily: i.primary,
1430
+ fontSize: "0.75em",
1431
+ fontWeight: 600,
1432
+ lineHeight: 1.35,
1433
+ color: "inherit",
1434
+ whiteSpace: "nowrap",
1435
+ unicodeBidi: "plaintext"
1436
+ },
1437
+ children: f.name
1438
+ }
1439
+ )
1440
+ }
1441
+ ) : null, b = (m) => /* @__PURE__ */ y(
1442
+ h,
1443
+ {
1444
+ component: m.url ? "a" : "button",
1445
+ type: m.url ? void 0 : "button",
1446
+ href: m.url ?? void 0,
1447
+ target: m.url ? "_blank" : void 0,
1448
+ rel: m.url ? "noopener noreferrer" : void 0,
1449
+ onClick: () => o == null ? void 0 : o({
1450
+ matchId: e.matchId,
1451
+ market: e.market,
1452
+ pick: m.label,
1453
+ odd: m.odd
1454
+ }),
1455
+ sx: {
1456
+ flex: 1,
1457
+ minWidth: 0,
1458
+ height: d,
1459
+ display: "flex",
1460
+ alignItems: "center",
1461
+ justifyContent: "space-between",
1462
+ gap: "0.25em",
1463
+ paddingInline: "0.5em",
1464
+ borderRadius: a.xs,
1465
+ border: `1px solid ${s.border}`,
1466
+ boxSizing: "border-box",
1467
+ backgroundColor: s.surface,
1468
+ color: s.text,
1469
+ cursor: "pointer",
1470
+ textDecoration: "none",
1471
+ fontFamily: i.secondary,
1472
+ // A <button> doesn't inherit font-size, and `height` in em resolves against its own.
1473
+ fontSize: "1em",
1474
+ lineHeight: 1.35,
1475
+ "&:hover": { borderColor: s.dim }
1476
+ },
1477
+ children: [
1478
+ /* @__PURE__ */ r(h, { component: "span", sx: { color: s.dim, fontSize: "0.75em" }, children: m.label }),
1479
+ /* @__PURE__ */ y(
1480
+ h,
1481
+ {
1482
+ component: "span",
1483
+ sx: { fontSize: "0.75em", fontWeight: 700, fontVariantNumeric: "tabular-nums" },
1484
+ children: [
1485
+ /* @__PURE__ */ r(_t, { children: m.value }),
1486
+ /* @__PURE__ */ r(
1487
+ h,
1488
+ {
1489
+ component: "span",
1490
+ "aria-hidden": !0,
1491
+ sx: {
1492
+ marginInlineStart: "0.25em",
1493
+ // Always takes its space, so a price without movement sits where the others do.
1494
+ visibility: m.change === "none" ? "hidden" : "visible",
1495
+ color: m.change === "up" ? s.success : s.danger
1496
+ },
1497
+ children: m.change === "down" ? "↓" : "↑"
1498
+ }
1499
+ )
1500
+ ]
1501
+ }
1502
+ )
1503
+ ]
1504
+ },
1505
+ m.label
1506
+ );
1507
+ return /* @__PURE__ */ r(h, { sx: { display: "flex", alignItems: "center", gap: "0.3125em" }, children: l ? u && f ? w(!0) : e.values.map(b) : /* @__PURE__ */ y(pe, { children: [
1508
+ w(!1),
1509
+ e.values.map(b)
1510
+ ] }) });
1511
+ }, To = { W: "formWin", D: "formDraw", L: "formLoss" }, Pe = ({ entry: e, side: t }) => {
1512
+ const { colors: o, radius: s } = W(), { entities: i, label: a, fmt: d } = K(), [l, c] = z.useState(!1), { match: u, result: g } = e, f = { W: o.success, D: o.variant, L: o.danger }[g], w = t === "away" ? { right: n(-4) } : { left: n(-4) }, b = t === "away" ? { right: n(10) } : { left: n(10) }, [m, I] = u.fullTime ?? [0, 0], x = ($, v) => /* @__PURE__ */ y(
1513
+ h,
1514
+ {
1515
+ sx: {
1516
+ display: "flex",
1517
+ alignItems: "center",
1518
+ gap: n(6),
1519
+ minWidth: 0,
1520
+ ...v ? { flexDirection: "row-reverse" } : {}
1521
+ },
1522
+ children: [
1523
+ /* @__PURE__ */ r(j, { url: i.logo($), size: 22 }),
1524
+ /* @__PURE__ */ r(S, { size: 12, weight: 600, ellipsis: !0, cms: !0, sx: v ? { textAlign: "end" } : void 0, children: i.name($) })
1525
+ ]
1526
+ }
1527
+ );
1528
+ return /* @__PURE__ */ y(
1529
+ h,
1530
+ {
1531
+ onMouseEnter: () => c(!0),
1532
+ onMouseLeave: () => c(!1),
1533
+ sx: { position: "relative", display: "flex" },
1534
+ children: [
1535
+ /* @__PURE__ */ r(
1536
+ S,
1537
+ {
1538
+ size: 11,
1539
+ font: "secondary",
1540
+ weight: 700,
1541
+ color: g === "D" ? o.body : o.onPrimary,
1542
+ sx: {
1543
+ width: n(24, 11),
1544
+ height: n(24, 11),
1545
+ borderRadius: `calc(${s.sm} - 2px)`,
1546
+ display: "inline-flex",
1547
+ alignItems: "center",
1548
+ justifyContent: "center",
1549
+ backgroundColor: f,
1550
+ cursor: "help",
1551
+ outline: `2px solid ${l ? o.primary : "transparent"}`,
1552
+ outlineOffset: "1px"
1553
+ },
1554
+ children: a(To[g])
1555
+ }
1556
+ ),
1557
+ l ? /* @__PURE__ */ y(
1558
+ h,
1559
+ {
1560
+ sx: {
1561
+ position: "absolute",
1562
+ bottom: `calc(100% + ${n(10)})`,
1563
+ ...w,
1564
+ zIndex: 50,
1565
+ width: n(240),
1566
+ backgroundColor: o.surface,
1567
+ color: o.text,
1568
+ borderRadius: s.sm,
1569
+ padding: `${n(8)} ${n(10)}`,
1570
+ boxShadow: "0 6px 20px rgba(33,33,33,.18)",
1571
+ display: "flex",
1572
+ flexDirection: "column",
1573
+ gap: n(6),
1574
+ pointerEvents: "none"
1575
+ },
1576
+ children: [
1577
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", weight: 500, color: o.dim, sx: { textAlign: "center" }, children: a("formMeta", {
1578
+ round: u.round,
1579
+ date: d.date(u.start, { day: "numeric", month: "long", year: "numeric" })
1580
+ }) }),
1581
+ /* @__PURE__ */ y(
1582
+ h,
1583
+ {
1584
+ sx: {
1585
+ display: "grid",
1586
+ gridTemplateColumns: "minmax(0,1fr) auto minmax(0,1fr)",
1587
+ alignItems: "center",
1588
+ gap: n(8)
1589
+ },
1590
+ children: [
1591
+ x(u.home.id, !1),
1592
+ /* @__PURE__ */ r(S, { size: 15, weight: 700, sx: { whiteSpace: "nowrap", fontVariantNumeric: "tabular-nums" }, children: `${m} – ${I}` }),
1593
+ x(u.away.id, !0)
1594
+ ]
1595
+ }
1596
+ ),
1597
+ /* @__PURE__ */ r(
1598
+ h,
1599
+ {
1600
+ component: "span",
1601
+ sx: {
1602
+ position: "absolute",
1603
+ top: "100%",
1604
+ ...b,
1605
+ border: `${n(6)} solid transparent`,
1606
+ borderTopColor: o.surface
1607
+ }
1608
+ }
1609
+ )
1610
+ ]
1611
+ }
1612
+ ) : null
1613
+ ]
1614
+ }
1615
+ );
1616
+ }, $o = ({ match: e }) => {
1617
+ var m, I;
1618
+ const { colors: t } = W(), { data: o, entities: s, finished: i, tally: a, label: d, fmt: l } = K(), c = o.teamStats.get(e.home.id), u = o.teamStats.get(e.away.id), g = Zt(i, e), f = Le(i, e.home.id, e.start), w = Le(i, e.away.id, e.start), b = (x) => l.decimal(x, 1);
1619
+ return /* @__PURE__ */ y(pe, { children: [
1620
+ /* @__PURE__ */ y(
1621
+ h,
1622
+ {
1623
+ sx: {
1624
+ display: "grid",
1625
+ gridTemplateColumns: `${n(44)} 1fr ${n(44)}`,
1626
+ alignItems: "center",
1627
+ gap: n(12)
1628
+ },
1629
+ children: [
1630
+ /* @__PURE__ */ r(j, { url: s.logo(e.home.id), size: 30, sx: { justifySelf: "end" } }),
1631
+ /* @__PURE__ */ y(
1632
+ h,
1633
+ {
1634
+ sx: {
1635
+ gridColumn: 2,
1636
+ display: "flex",
1637
+ justifyContent: "space-between",
1638
+ alignItems: "center",
1639
+ gap: n(12)
1640
+ },
1641
+ children: [
1642
+ /* @__PURE__ */ r(h, { sx: { display: "flex", gap: n(4) }, children: f.map((x) => /* @__PURE__ */ r(Pe, { entry: x, side: "home" }, x.match.id)) }),
1643
+ /* @__PURE__ */ r(S, { size: 10, font: "secondary", upper: !0, color: t.dim, sx: { textAlign: "center" }, children: d("formLast5") }),
1644
+ /* @__PURE__ */ r(h, { sx: { display: "flex", gap: n(4) }, children: w.map((x) => /* @__PURE__ */ r(Pe, { entry: x, side: "away" }, x.match.id)) })
1645
+ ]
1646
+ }
1647
+ ),
1648
+ /* @__PURE__ */ r(
1649
+ j,
1650
+ {
1651
+ url: s.logo(e.away.id),
1652
+ size: 30,
1653
+ sx: { justifySelf: "start", gridColumn: 3 }
1654
+ }
1655
+ )
1656
+ ]
1657
+ }
1658
+ ),
1659
+ /* @__PURE__ */ r(F, { label: d("wins"), home: (c == null ? void 0 : c.won) ?? null, away: (u == null ? void 0 : u.won) ?? null }),
1660
+ /* @__PURE__ */ r(F, { label: d("draws"), home: (c == null ? void 0 : c.draw) ?? null, away: (u == null ? void 0 : u.draw) ?? null }),
1661
+ /* @__PURE__ */ r(F, { label: d("losses"), home: (c == null ? void 0 : c.lost) ?? null, away: (u == null ? void 0 : u.lost) ?? null }),
1662
+ /* @__PURE__ */ r(F, { label: d("goalsScored"), home: (c == null ? void 0 : c.goalsScored) ?? null, away: (u == null ? void 0 : u.goalsScored) ?? null }),
1663
+ /* @__PURE__ */ r(F, { label: d("goalsConceded"), home: (c == null ? void 0 : c.goalsAllowed) ?? null, away: (u == null ? void 0 : u.goalsAllowed) ?? null }),
1664
+ /* @__PURE__ */ r(
1665
+ F,
1666
+ {
1667
+ label: d("goalsPerMatch"),
1668
+ home: (c == null ? void 0 : c.avgTotalGoals) != null ? Number(c.avgTotalGoals.toFixed(1)) : null,
1669
+ away: (u == null ? void 0 : u.avgTotalGoals) != null ? Number(u.avgTotalGoals.toFixed(1)) : null,
1670
+ format: b
1671
+ }
1672
+ ),
1673
+ /* @__PURE__ */ r(F, { label: d("homeAwayWins"), home: (c == null ? void 0 : c.homeWon) ?? null, away: (u == null ? void 0 : u.awayWon) ?? null }),
1674
+ /* @__PURE__ */ r(
1675
+ F,
1676
+ {
1677
+ label: d("cleanSheets"),
1678
+ home: ((m = a.get(e.home.id)) == null ? void 0 : m.cleanSheets) ?? 0,
1679
+ away: ((I = a.get(e.away.id)) == null ? void 0 : I.cleanSheets) ?? 0
1680
+ }
1681
+ ),
1682
+ g != null && g.fullTime ? /* @__PURE__ */ y(S, { component: "div", size: 11, font: "secondary", color: t.dim, children: [
1683
+ d("previousMeeting"),
1684
+ " ",
1685
+ /* @__PURE__ */ y(h, { component: "b", sx: { color: t.text }, children: [
1686
+ /* @__PURE__ */ r(h, { component: "span", sx: { unicodeBidi: "plaintext" }, children: s.name(g.home.id) }),
1687
+ " ",
1688
+ `${g.fullTime[0]}:${g.fullTime[1]}`,
1689
+ " ",
1690
+ /* @__PURE__ */ r(h, { component: "span", sx: { unicodeBidi: "plaintext" }, children: s.name(g.away.id) }),
1691
+ " ",
1692
+ d("previousMeetingRound", { round: g.round })
1693
+ ] })
1694
+ ] }) : null
1695
+ ] });
1696
+ }, _o = ({ match: e, odds: t, open: o, onToggle: s }) => {
1697
+ var H, G;
1698
+ const { colors: i, radius: a } = W(), { entities: d, label: l, fmt: c, props: u } = K(), g = (H = u.callbacks) == null ? void 0 : H.onBroadcastClick, f = e.status === "FINISHED", w = e.status === "LIVE", [b, m] = e.fullTime ?? [0, 0], I = f && b > m, x = f && m > b, $ = f && b === m, v = e.status === "CANCELLED", E = !v, D = !f && !v, M = w ? e.liveMinute !== null ? l("liveMinute", { minute: e.liveMinute }) : e.isHalfTime ? l("halfTimeShort") : l("live") : c.time(e.start), A = xe(), L = (u.showOdds ?? !1) && !A && (e.status === "UPCOMING" || w), T = t ? /* @__PURE__ */ r(
1699
+ ko,
1700
+ {
1701
+ odds: t,
1702
+ config: u.odds,
1703
+ onAddToBetslip: (G = u.callbacks) == null ? void 0 : G.onAddToBetslip
1704
+ }
1705
+ ) : null, R = {
1706
+ // A price click must not toggle the row.
1707
+ onClick: (p) => p.stopPropagation(),
1708
+ onKeyDown: (p) => p.stopPropagation()
1709
+ }, O = (p, _, k, V) => /* @__PURE__ */ r(
1710
+ S,
1711
+ {
1712
+ size: 14,
1713
+ weight: _ ? 700 : 500,
1714
+ color: k && !$ ? i.dim : i.text,
1715
+ ellipsis: !0,
1716
+ cms: !0,
1717
+ sx: V ? { textAlign: "right" } : void 0,
1718
+ children: d.name(p)
1719
+ }
1720
+ );
1721
+ return /* @__PURE__ */ y(h, { sx: { borderBottom: `1px solid ${i.border}` }, children: [
1722
+ /* @__PURE__ */ y(
1723
+ h,
1724
+ {
1725
+ ...E ? {
1726
+ role: "button",
1727
+ "aria-expanded": o,
1728
+ tabIndex: 0,
1729
+ onClick: s,
1730
+ onKeyDown: (p) => {
1731
+ (p.key === "Enter" || p.key === " ") && (p.preventDefault(), s());
1732
+ }
1733
+ } : {},
1734
+ sx: {
1735
+ display: "grid",
1736
+ gridTemplateColumns: [
1737
+ D ? n(g ? 80 : 60) : null,
1738
+ "minmax(0,1fr) auto minmax(0,1fr)",
1739
+ L ? n(300) : null,
1740
+ n(20)
1741
+ ].filter(Boolean).join(" "),
1742
+ alignItems: "center",
1743
+ columnGap: n(8),
1744
+ rowGap: n(6),
1745
+ // Minus the 3px accent border, so the rail lines up with the day header's text.
1746
+ padding: `${n(6)} ${n(16)} ${n(6)} calc(${n(16)} - 3px)`,
1747
+ cursor: E ? "pointer" : "default",
1748
+ backgroundColor: o ? i.onSurface : "transparent",
1749
+ borderLeft: `3px solid ${w ? i.danger : "transparent"}`,
1750
+ // Not onSurface: that is the day-header fill, so a hovered row would merge into it.
1751
+ ...E ? {
1752
+ "&:hover": {
1753
+ backgroundColor: o ? i.onSurface : i.tint
1754
+ }
1755
+ } : {}
1756
+ },
1757
+ children: [
1758
+ D ? /* @__PURE__ */ y(
1759
+ h,
1760
+ {
1761
+ sx: {
1762
+ display: "flex",
1763
+ alignItems: "center",
1764
+ gap: n(6),
1765
+ whiteSpace: "nowrap"
1766
+ },
1767
+ children: [
1768
+ w ? /* @__PURE__ */ r(
1769
+ h,
1770
+ {
1771
+ component: "span",
1772
+ sx: {
1773
+ width: n(7),
1774
+ height: n(7),
1775
+ borderRadius: "50%",
1776
+ backgroundColor: i.danger,
1777
+ animation: "cs-pulse 1s ease-in-out infinite"
1778
+ }
1779
+ }
1780
+ ) : null,
1781
+ /* @__PURE__ */ r(
1782
+ S,
1783
+ {
1784
+ size: 13,
1785
+ font: "secondary",
1786
+ weight: 700,
1787
+ color: w ? i.danger : i.text,
1788
+ children: M
1789
+ }
1790
+ ),
1791
+ g && e.status === "UPCOMING" ? /* @__PURE__ */ r(
1792
+ h,
1793
+ {
1794
+ component: "button",
1795
+ type: "button",
1796
+ "aria-label": l("watchOnTv"),
1797
+ title: l("watchOnTv"),
1798
+ onClick: (p) => {
1799
+ p.stopPropagation(), g(e.id);
1800
+ },
1801
+ onKeyDown: (p) => p.stopPropagation(),
1802
+ sx: {
1803
+ display: "inline-flex",
1804
+ alignItems: "center",
1805
+ justifyContent: "center",
1806
+ padding: 0,
1807
+ border: "none",
1808
+ background: "transparent",
1809
+ cursor: "pointer",
1810
+ fontSize: n(16),
1811
+ color: i.dim,
1812
+ "&:hover": { color: i.primary }
1813
+ },
1814
+ children: /* @__PURE__ */ r(At, { size: "1em", "aria-hidden": !0 })
1815
+ }
1816
+ ) : null
1817
+ ]
1818
+ }
1819
+ ) : null,
1820
+ /* @__PURE__ */ y(
1821
+ h,
1822
+ {
1823
+ sx: {
1824
+ display: "flex",
1825
+ alignItems: "center",
1826
+ justifyContent: "flex-end",
1827
+ gap: n(8),
1828
+ minWidth: 0
1829
+ },
1830
+ children: [
1831
+ O(e.home.id, I, x, !0),
1832
+ /* @__PURE__ */ r(j, { url: d.logo(e.home.id), size: 24 })
1833
+ ]
1834
+ }
1835
+ ),
1836
+ /* @__PURE__ */ y(
1837
+ h,
1838
+ {
1839
+ sx: {
1840
+ display: "flex",
1841
+ flexDirection: "column",
1842
+ alignItems: "center",
1843
+ minWidth: n(56)
1844
+ },
1845
+ children: [
1846
+ v && e.notPlayedReason ? /* @__PURE__ */ r(
1847
+ S,
1848
+ {
1849
+ size: 11,
1850
+ font: "secondary",
1851
+ weight: 700,
1852
+ upper: !0,
1853
+ color: i.dim,
1854
+ sx: {
1855
+ backgroundColor: i.onSurface,
1856
+ borderRadius: a.sm,
1857
+ padding: `${n(5, 11)} ${n(8, 11)}`,
1858
+ whiteSpace: "nowrap"
1859
+ },
1860
+ children: l(e.notPlayedReason)
1861
+ }
1862
+ ) : /* @__PURE__ */ r(
1863
+ S,
1864
+ {
1865
+ size: 15,
1866
+ weight: 700,
1867
+ color: i.text,
1868
+ sx: {
1869
+ letterSpacing: n(1, 15),
1870
+ backgroundColor: f || w ? i.onSurface : "transparent",
1871
+ borderRadius: a.sm,
1872
+ padding: `${n(3, 15)} ${n(8, 15)}`,
1873
+ whiteSpace: "nowrap"
1874
+ },
1875
+ children: f || w ? `${b} : ${m}` : "–"
1876
+ }
1877
+ ),
1878
+ (f || w) && e.halfTime ? /* @__PURE__ */ r(
1879
+ S,
1880
+ {
1881
+ size: 10,
1882
+ font: "secondary",
1883
+ color: i.dim,
1884
+ sx: { marginTop: n(2, 10) },
1885
+ children: `(${e.halfTime[0]}:${e.halfTime[1]})`
1886
+ }
1887
+ ) : null
1888
+ ]
1889
+ }
1890
+ ),
1891
+ /* @__PURE__ */ y(
1892
+ h,
1893
+ {
1894
+ sx: {
1895
+ display: "flex",
1896
+ alignItems: "center",
1897
+ gap: n(8),
1898
+ minWidth: 0
1899
+ },
1900
+ children: [
1901
+ /* @__PURE__ */ r(j, { url: d.logo(e.away.id), size: 24 }),
1902
+ O(e.away.id, x, I, !1)
1903
+ ]
1904
+ }
1905
+ ),
1906
+ L ? /* @__PURE__ */ r(h, { ...R, sx: { minWidth: 0, cursor: "default" }, children: T }) : null,
1907
+ /* @__PURE__ */ r(
1908
+ h,
1909
+ {
1910
+ component: "svg",
1911
+ viewBox: "0 0 24 24",
1912
+ fill: "none",
1913
+ stroke: "currentColor",
1914
+ strokeWidth: "2",
1915
+ strokeLinecap: "round",
1916
+ strokeLinejoin: "round",
1917
+ sx: {
1918
+ width: n(16),
1919
+ height: n(16),
1920
+ color: i.dim,
1921
+ // Hidden, not removed, so the teams stay aligned with the expandable rows.
1922
+ visibility: E ? "visible" : "hidden",
1923
+ transform: o ? "rotate(180deg)" : "rotate(0)",
1924
+ transition: "transform .2s"
1925
+ },
1926
+ children: /* @__PURE__ */ r("path", { d: "m6 9 6 6 6-6" })
1927
+ }
1928
+ ),
1929
+ T && !L ? /* @__PURE__ */ r(
1930
+ h,
1931
+ {
1932
+ ...R,
1933
+ sx: {
1934
+ gridColumn: D ? "2 / 5" : "1 / 4",
1935
+ display: "flex",
1936
+ justifyContent: "center",
1937
+ cursor: "default"
1938
+ },
1939
+ children: /* @__PURE__ */ r(h, { sx: { width: "100%", maxWidth: n(300) }, children: T })
1940
+ }
1941
+ ) : null
1942
+ ]
1943
+ }
1944
+ ),
1945
+ o && E ? /* @__PURE__ */ r(
1946
+ h,
1947
+ {
1948
+ sx: {
1949
+ padding: `${n(6)} ${n(16)} ${n(16)}`,
1950
+ display: "flex",
1951
+ flexDirection: "column",
1952
+ gap: n(14),
1953
+ backgroundColor: i.onSurface,
1954
+ borderTop: `1px solid ${i.border}`
1955
+ },
1956
+ children: f || w ? /* @__PURE__ */ r(Io, { match: e }) : /* @__PURE__ */ r($o, { match: e })
1957
+ }
1958
+ ) : null
1959
+ ] });
1960
+ }, We = (e, t) => e.start.localeCompare(t.start), Eo = (e) => e.status === "UPCOMING" || e.status === "LIVE", Ro = () => {
1961
+ var ve, ke, Te, $e, _e;
1962
+ const { colors: e, radius: t, fonts: o } = W(), { sdk: s, data: i, entities: a, label: d, fmt: l, props: c } = K(), [u, g] = z.useState("upcoming"), [f, w] = z.useState(null), [b, m] = z.useState(null), [I, x] = z.useState(null), [$, v] = z.useState(null), [E, D] = z.useState(null), M = u === "upcoming", A = (C) => Eo(C) === M, L = i.matches.filter(A).sort(We), T = i.stages.filter(
1963
+ (C) => L.some((P) => P.stageId === C.id)
1964
+ ), R = M ? T : [...T].reverse(), O = R.length > 1, H = M ? f : b, G = (ve = M ? L[0] : L[L.length - 1]) == null ? void 0 : ve.stageId, p = O ? R.some((C) => C.id === H) ? H : G ?? R[0].id : null, _ = (C) => !O || C.stageId === p, k = Array.from(
1965
+ new Set(L.filter(_).map((C) => C.round))
1966
+ ).sort((C, P) => C - P), V = M ? k : [...k].reverse(), q = M ? I : $, Ce = q !== null && k.includes(q) ? q : M ? k[0] : k[k.length - 1], ee = i.matches.filter((C) => C.round === Ce && _(C)).sort(We), te = ee.filter(A), Xe = z.useMemo(
1967
+ () => te.filter((C) => C.status === "UPCOMING" || C.status === "LIVE").map((C) => C.id),
1968
+ [te]
1969
+ ), qe = z.useMemo(
1970
+ () => te.filter((C) => C.status === "LIVE").map((C) => C.id),
1971
+ [te]
1972
+ ), Je = bo(s, Xe, {
1973
+ enabled: c.showOdds ?? !1,
1974
+ liveMatchIds: qe,
1975
+ sport: i.sport,
1976
+ pollingIntervalMs: (ke = c.odds) == null ? void 0 : ke.pollingInterval,
1977
+ operators: (Te = c.odds) == null ? void 0 : Te.operators,
1978
+ affiliateId: ($e = c.odds) == null ? void 0 : $e.affiliateId,
1979
+ affiliateIds: (_e = c.odds) == null ? void 0 : _e.affiliateIds
1980
+ }), Se = (C) => l.date(C, { day: "numeric", month: "short" }), Qe = ee.length ? d("roundSummary", {
1981
+ from: Se(ee[0].start),
1982
+ to: Se(ee[ee.length - 1].start),
1983
+ matches: d("matchesCount", { count: ee.length })
1984
+ }) : "", me = [];
1985
+ te.forEach((C) => {
1986
+ const P = l.date(C.start, {
1987
+ weekday: "long",
1988
+ day: "numeric",
1989
+ month: "long"
1990
+ }), Ee = me.find((nt) => nt.label === P);
1991
+ Ee ? Ee.rows.push(C) : me.push({ label: P, rows: [C] });
1992
+ });
1993
+ const Ze = (C) => {
1994
+ g(C), D(null);
1995
+ }, et = (C) => {
1996
+ M ? x(C) : v(C), D(null);
1997
+ }, tt = (C) => {
1998
+ M ? (w(C), x(null)) : (m(C), v(null)), D(null);
1999
+ }, ot = (C) => C.nameId && a.has(C.nameId) ? a.name(C.nameId) : d("stage", { number: i.stages.indexOf(C) + 1 }), Ie = (C) => {
2000
+ const P = u === C;
2001
+ return /* @__PURE__ */ r(
2002
+ h,
2003
+ {
2004
+ component: "button",
2005
+ type: "button",
2006
+ onClick: () => Ze(C),
2007
+ sx: {
2008
+ border: "none",
2009
+ cursor: "pointer",
2010
+ borderRadius: t.full,
2011
+ padding: `${n(7, 13)} ${n(14, 13)}`,
2012
+ fontFamily: o.primary,
2013
+ fontSize: n(13),
2014
+ fontWeight: 700,
2015
+ backgroundColor: P ? e.surface : "transparent",
2016
+ color: P ? e.text : e.dim,
2017
+ boxShadow: P ? "0 1px 2px rgba(0,0,0,.12)" : "none"
2018
+ },
2019
+ children: d(C)
2020
+ }
2021
+ );
2022
+ };
2023
+ return /* @__PURE__ */ y(Z, { sx: { overflow: "hidden" }, children: [
2024
+ /* @__PURE__ */ y(
2025
+ h,
2026
+ {
2027
+ sx: {
2028
+ display: "flex",
2029
+ alignItems: "center",
2030
+ justifyContent: "space-between",
2031
+ gap: n(12),
2032
+ padding: `${n(12)} ${n(16)}`,
2033
+ borderBottom: `1px solid ${e.border}`,
2034
+ flexWrap: "wrap"
2035
+ },
2036
+ children: [
2037
+ /* @__PURE__ */ y(
2038
+ h,
2039
+ {
2040
+ sx: {
2041
+ display: "flex",
2042
+ gap: n(4),
2043
+ padding: n(3),
2044
+ backgroundColor: e.onSurface,
2045
+ borderRadius: t.full
2046
+ },
2047
+ children: [
2048
+ Ie("upcoming"),
2049
+ Ie("results")
2050
+ ]
2051
+ }
2052
+ ),
2053
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", color: e.dim, children: Qe })
2054
+ ]
2055
+ }
2056
+ ),
2057
+ O ? (
2058
+ // Pills styled like the Standings stage tabs.
2059
+ /* @__PURE__ */ r(
2060
+ h,
2061
+ {
2062
+ role: "tablist",
2063
+ sx: {
2064
+ display: "flex",
2065
+ gap: n(4),
2066
+ overflowX: "auto",
2067
+ padding: `${n(10)} ${n(16)}`,
2068
+ borderBottom: `1px solid ${e.border}`,
2069
+ scrollbarWidth: "none",
2070
+ "&::-webkit-scrollbar": { display: "none" }
2071
+ },
2072
+ children: R.map((C) => {
2073
+ const P = C.id === p;
2074
+ return /* @__PURE__ */ r(
2075
+ h,
2076
+ {
2077
+ component: "button",
2078
+ type: "button",
2079
+ role: "tab",
2080
+ "aria-selected": P,
2081
+ onClick: () => tt(C.id),
2082
+ sx: {
2083
+ flexShrink: 0,
2084
+ border: "none",
2085
+ cursor: "pointer",
2086
+ borderRadius: t.full,
2087
+ padding: `${n(6, 12)} ${n(12, 12)}`,
2088
+ fontFamily: o.primary,
2089
+ fontSize: n(12),
2090
+ fontWeight: 700,
2091
+ lineHeight: 1,
2092
+ textTransform: "uppercase",
2093
+ letterSpacing: "0.025em",
2094
+ whiteSpace: "nowrap",
2095
+ unicodeBidi: "plaintext",
2096
+ backgroundColor: P ? e.primary : "transparent",
2097
+ color: P ? e.onPrimary : e.dim,
2098
+ "&:hover": P ? {} : { backgroundColor: e.variant, color: e.primary }
2099
+ },
2100
+ children: ot(C)
2101
+ },
2102
+ C.id
2103
+ );
2104
+ })
2105
+ }
2106
+ )
2107
+ ) : null,
2108
+ V.length > (O ? 1 : 0) ? /* @__PURE__ */ r(
2109
+ h,
2110
+ {
2111
+ sx: {
2112
+ display: "flex",
2113
+ gap: n(6),
2114
+ overflowX: "auto",
2115
+ padding: `${n(10)} ${n(16)}`,
2116
+ borderBottom: `1px solid ${e.border}`,
2117
+ scrollbarWidth: "none",
2118
+ "&::-webkit-scrollbar": { display: "none" }
2119
+ },
2120
+ children: V.map((C) => {
2121
+ const P = C === Ce;
2122
+ return /* @__PURE__ */ r(
2123
+ h,
2124
+ {
2125
+ component: "button",
2126
+ type: "button",
2127
+ onClick: () => et(C),
2128
+ sx: {
2129
+ flexShrink: 0,
2130
+ border: `1px solid ${P ? e.primary : e.border}`,
2131
+ cursor: "pointer",
2132
+ borderRadius: t.full,
2133
+ padding: `${n(5, 12)} ${n(12, 12)}`,
2134
+ fontFamily: o.secondary,
2135
+ fontSize: n(12),
2136
+ fontWeight: 700,
2137
+ backgroundColor: P ? e.primary : e.surface,
2138
+ color: P ? e.onPrimary : e.body,
2139
+ whiteSpace: "nowrap"
2140
+ },
2141
+ children: d("round", { round: C })
2142
+ },
2143
+ C
2144
+ );
2145
+ })
2146
+ }
2147
+ ) : null,
2148
+ me.map((C) => /* @__PURE__ */ y(z.Fragment, { children: [
2149
+ /* @__PURE__ */ r(
2150
+ S,
2151
+ {
2152
+ component: "div",
2153
+ size: 11,
2154
+ font: "secondary",
2155
+ weight: 700,
2156
+ upper: !0,
2157
+ color: e.dim,
2158
+ sx: {
2159
+ padding: `${n(8, 11)} ${n(16, 11)} ${n(4, 11)}`,
2160
+ backgroundColor: e.onSurface
2161
+ },
2162
+ children: C.label
2163
+ }
2164
+ ),
2165
+ C.rows.map((P) => /* @__PURE__ */ r(
2166
+ _o,
2167
+ {
2168
+ match: P,
2169
+ odds: Je.get(P.id) ?? null,
2170
+ open: E === P.id,
2171
+ onToggle: () => D(E === P.id ? null : P.id)
2172
+ },
2173
+ P.id
2174
+ ))
2175
+ ] }, C.label)),
2176
+ te.length === 0 ? /* @__PURE__ */ r(
2177
+ S,
2178
+ {
2179
+ component: "div",
2180
+ size: 14,
2181
+ font: "secondary",
2182
+ color: e.dim,
2183
+ sx: { padding: n(24, 14), textAlign: "center" },
2184
+ children: L.length > 0 ? d("noMatches") : d(M ? "noUpcomingMatches" : "noResultsYet")
2185
+ }
2186
+ ) : null
2187
+ ] });
2188
+ }, Oe = ["1-15'", "16-30'", "31-45'", "46-60'", "61-75'", "76-90'"], fe = `repeat(auto-fit,minmax(${n(280)},1fr))`, se = ({ children: e }) => /* @__PURE__ */ r(
2189
+ Z,
2190
+ {
2191
+ sx: {
2192
+ padding: `${n(14)} ${n(16)}`,
2193
+ display: "flex",
2194
+ flexDirection: "column",
2195
+ gap: n(10)
2196
+ },
2197
+ children: e
2198
+ }
2199
+ ), Ne = ({
2200
+ widths: e,
2201
+ height: t
2202
+ }) => {
2203
+ const { radius: o } = W();
2204
+ return /* @__PURE__ */ r(
2205
+ h,
2206
+ {
2207
+ sx: {
2208
+ display: "flex",
2209
+ height: n(t),
2210
+ borderRadius: o.full,
2211
+ overflow: "hidden",
2212
+ gap: "2px"
2213
+ },
2214
+ children: e.map((s, i) => /* @__PURE__ */ r(h, { sx: { width: `${s.w}%`, backgroundColor: s.color } }, i))
2215
+ }
2216
+ );
2217
+ }, ie = ({
2218
+ icon: e,
2219
+ caption: t,
2220
+ children: o
2221
+ }) => {
2222
+ const { colors: s, radius: i } = W();
2223
+ return /* @__PURE__ */ y(
2224
+ h,
2225
+ {
2226
+ sx: {
2227
+ backgroundColor: s.onSurface,
2228
+ borderRadius: `calc(${i.md} - 2px)`,
2229
+ padding: n(12),
2230
+ display: "flex",
2231
+ alignItems: "center",
2232
+ gap: n(10)
2233
+ },
2234
+ children: [
2235
+ /* @__PURE__ */ r(
2236
+ h,
2237
+ {
2238
+ component: "span",
2239
+ sx: {
2240
+ width: n(34),
2241
+ height: n(34),
2242
+ borderRadius: "50%",
2243
+ backgroundColor: s.tint,
2244
+ color: s.primary,
2245
+ display: "flex",
2246
+ alignItems: "center",
2247
+ justifyContent: "center",
2248
+ flexShrink: 0,
2249
+ "& svg": { width: n(18), height: n(18) }
2250
+ },
2251
+ children: e
2252
+ }
2253
+ ),
2254
+ /* @__PURE__ */ y(h, { children: [
2255
+ o,
2256
+ /* @__PURE__ */ r(S, { component: "div", size: 10, font: "secondary", color: s.dim, sx: { marginTop: n(3, 10) }, children: t })
2257
+ ] })
2258
+ ]
2259
+ }
2260
+ );
2261
+ }, ae = {
2262
+ viewBox: "0 0 24 24",
2263
+ fill: "none",
2264
+ stroke: "currentColor",
2265
+ strokeWidth: 2,
2266
+ strokeLinecap: "round",
2267
+ strokeLinejoin: "round"
2268
+ }, Mo = 4, Ao = (e, t, o, s) => {
2269
+ if (s) return 12;
2270
+ if (o) return e === t - 1 && t % 2 === 1 ? 12 : 6;
2271
+ const i = Math.min(t, Mo), a = e < i ? i : t - i;
2272
+ return Math.floor(12 / a);
2273
+ }, Lo = () => {
2274
+ const { colors: e, radius: t } = W(), o = xe(), s = pt(), { data: i, entities: a, tally: d, label: l, fmt: c, props: u } = K(), g = z.useMemo(() => eo(i.matches), [i.matches]), f = g.played, w = (p) => l("ofMatches", { value: p, matches: l("matchesCount", { count: f }) }), b = (p) => c.decimal(f ? p / f : 0, 1), m = (p, _ = 22) => /* @__PURE__ */ r(S, { size: _, weight: 700, color: e.text, sx: { lineHeight: 1 }, children: p }), I = [
2275
+ {
2276
+ label: l("matchesPlayed"),
2277
+ value: f,
2278
+ sub: l("remaining", { count: g.total - f })
2279
+ },
2280
+ {
2281
+ label: l("totalGoals"),
2282
+ value: g.goals,
2283
+ sub: l("goalsPerMatchValue", { value: c.decimal(f ? g.goals / f : 0, 2) })
2284
+ },
2285
+ { label: l("homeWins"), value: `${B(g.homeWins, f)}%`, sub: w(g.homeWins) },
2286
+ {
2287
+ label: l("bothTeamsScored"),
2288
+ value: `${B(g.bothScored, f)}%`,
2289
+ sub: l("bttsSummary", {
2290
+ matches: l("matchesCount", { count: g.bothScored }),
2291
+ goalless: g.goalless
2292
+ })
2293
+ }
2294
+ ], x = [
2295
+ { label: l("homeWin"), n: g.homeWins, color: e.primary },
2296
+ { label: l("draw"), n: g.draws, color: e.border },
2297
+ { label: l("awayWin"), n: g.awayWins, color: e.primaryContainer }
2298
+ ], $ = Math.max(...g.goalsByPeriod, 1), v = [
2299
+ ...[1.5, 2.5, 3.5].map((p) => ({
2300
+ // "Over 1.5" reads better as the whole number it means: 2+.
2301
+ label: l("goalsOrMore", { count: Math.ceil(p) }),
2302
+ pct: B(g.over(p), f)
2303
+ })),
2304
+ { label: l("bothTeamsScored"), pct: B(g.bothScored, f) },
2305
+ { label: l("goallessDraw"), pct: B(g.goalless, f) }
2306
+ ], E = no(i.teamStats), D = Array.from(d.keys()), M = ue(u.teamCTA), A = [], L = (p, _, k, V, q) => {
2307
+ _ !== void 0 && A.push({ label: l(p), teamId: k(_), value: V(_), unit: q(_) });
2308
+ };
2309
+ L("mostWins", U(E, (p) => p.won), (p) => p.teamId, (p) => p.won, (p) => l("unitWins", { count: p.won })), L("bestAttack", U(E, (p) => p.goalsScored), (p) => p.teamId, (p) => p.goalsScored, () => l("unitGoals")), L("bestDefence", U(E, (p) => p.goalsAllowed, -1), (p) => p.teamId, (p) => p.goalsAllowed, (p) => l("unitConceded", { count: p.goalsAllowed })), L(
2310
+ "cleanSheets",
2311
+ U(D, (p) => {
2312
+ var _;
2313
+ return ((_ = d.get(p)) == null ? void 0 : _.cleanSheets) ?? 0;
2314
+ }),
2315
+ (p) => p,
2316
+ (p) => {
2317
+ var _;
2318
+ return ((_ = d.get(p)) == null ? void 0 : _.cleanSheets) ?? 0;
2319
+ },
2320
+ () => l("unitMatches")
2321
+ ), L("bestHome", U(E, (p) => p.homeWon), (p) => p.teamId, (p) => p.homeWon, (p) => l("unitWins", { count: p.homeWon })), L("bestAway", U(E, (p) => p.awayWon), (p) => p.teamId, (p) => p.awayWon, (p) => l("unitWins", { count: p.awayWon })), L(
2322
+ "mostCards",
2323
+ U(D, (p) => {
2324
+ var _, k;
2325
+ return (((_ = d.get(p)) == null ? void 0 : _.yellowCards) ?? 0) + (((k = d.get(p)) == null ? void 0 : k.redCards) ?? 0);
2326
+ }),
2327
+ (p) => p,
2328
+ (p) => {
2329
+ var _, k;
2330
+ return (((_ = d.get(p)) == null ? void 0 : _.yellowCards) ?? 0) + (((k = d.get(p)) == null ? void 0 : k.redCards) ?? 0);
2331
+ },
2332
+ (p) => {
2333
+ var _, k;
2334
+ return `${l("yellowCount", { count: ((_ = d.get(p)) == null ? void 0 : _.yellowCards) ?? 0 })} · ${l("redCount", {
2335
+ count: ((k = d.get(p)) == null ? void 0 : k.redCards) ?? 0
2336
+ })}`;
2337
+ }
2338
+ );
2339
+ const T = i.matches.filter(we), R = [], O = U(T, ce), H = U(T, (p) => Math.abs(p.fullTime[0] - p.fullTime[1]));
2340
+ O && R.push({ label: l("highestScoring"), match: O }), H && R.push({ label: l("biggestWin"), match: H });
2341
+ const G = ue(u.matchCTA);
2342
+ return /* @__PURE__ */ y(h, { sx: { display: "flex", flexDirection: "column", gap: n(12) }, children: [
2343
+ /* @__PURE__ */ r(Ke, { children: l("seasonTitle") }),
2344
+ /* @__PURE__ */ r(h, { sx: { display: "grid", gridTemplateColumns: `repeat(auto-fit,minmax(${n(150)},1fr))`, gap: n(12) }, children: I.map((p) => /* @__PURE__ */ y(
2345
+ Z,
2346
+ {
2347
+ sx: { padding: `${n(14)} ${n(16)}`, display: "flex", flexDirection: "column", gap: n(4) },
2348
+ children: [
2349
+ /* @__PURE__ */ r(Y, { size: 10, children: p.label }),
2350
+ /* @__PURE__ */ r(S, { size: 28, weight: 700, color: e.primary, sx: { lineHeight: 1 }, children: p.value }),
2351
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", color: e.dim, children: p.sub })
2352
+ ]
2353
+ },
2354
+ p.label
2355
+ )) }),
2356
+ /* @__PURE__ */ y(h, { sx: { display: "grid", gridTemplateColumns: fe, gap: n(12) }, children: [
2357
+ /* @__PURE__ */ y(se, { children: [
2358
+ /* @__PURE__ */ r(Y, { children: l("outcomeTitle") }),
2359
+ /* @__PURE__ */ r(Ne, { height: 14, widths: x.map((p) => ({ w: B(p.n, f), color: p.color })) }),
2360
+ /* @__PURE__ */ r(h, { sx: { display: "grid", gridTemplateColumns: "repeat(3,1fr)", gap: n(8) }, children: x.map((p) => /* @__PURE__ */ y(
2361
+ h,
2362
+ {
2363
+ sx: {
2364
+ display: "flex",
2365
+ flexDirection: "column",
2366
+ gap: n(2),
2367
+ textAlign: "left",
2368
+ borderLeft: `3px solid ${p.color}`,
2369
+ paddingLeft: n(8)
2370
+ },
2371
+ children: [
2372
+ m(`${B(p.n, f)}%`),
2373
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", color: e.dim, sx: { marginTop: n(3, 11) }, children: p.label }),
2374
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", color: e.body, children: w(p.n) })
2375
+ ]
2376
+ },
2377
+ p.label
2378
+ )) })
2379
+ ] }),
2380
+ /* @__PURE__ */ y(se, { children: [
2381
+ /* @__PURE__ */ y(h, { sx: { display: "flex", justifyContent: "space-between", alignItems: "baseline", gap: n(8) }, children: [
2382
+ /* @__PURE__ */ r(Y, { children: l("goalTimingTitle") }),
2383
+ /* @__PURE__ */ y(S, { size: 11, font: "secondary", color: e.dim, children: [
2384
+ l("firstHalf"),
2385
+ " ",
2386
+ /* @__PURE__ */ r(h, { component: "b", sx: { color: e.text }, children: g.firstHalfGoals }),
2387
+ " ",
2388
+ "· ",
2389
+ l("secondHalf"),
2390
+ " ",
2391
+ /* @__PURE__ */ r(h, { component: "b", sx: { color: e.text }, children: g.secondHalfGoals })
2392
+ ] })
2393
+ ] }),
2394
+ /* @__PURE__ */ r(
2395
+ Ne,
2396
+ {
2397
+ height: 8,
2398
+ widths: [
2399
+ { w: B(g.firstHalfGoals, g.goals), color: e.primaryContainer },
2400
+ { w: B(g.secondHalfGoals, g.goals), color: e.primary }
2401
+ ]
2402
+ }
2403
+ ),
2404
+ /* @__PURE__ */ r(
2405
+ h,
2406
+ {
2407
+ sx: {
2408
+ display: "grid",
2409
+ gridTemplateColumns: "repeat(6,1fr)",
2410
+ gap: n(6),
2411
+ alignItems: "end",
2412
+ height: n(72)
2413
+ },
2414
+ children: g.goalsByPeriod.map((p, _) => /* @__PURE__ */ y(
2415
+ h,
2416
+ {
2417
+ sx: {
2418
+ display: "flex",
2419
+ flexDirection: "column",
2420
+ alignItems: "center",
2421
+ gap: n(3),
2422
+ height: "100%",
2423
+ justifyContent: "flex-end"
2424
+ },
2425
+ children: [
2426
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", weight: 700, color: e.text, children: p }),
2427
+ /* @__PURE__ */ r(
2428
+ h,
2429
+ {
2430
+ sx: {
2431
+ width: "100%",
2432
+ height: n(Math.max(6, Math.round(p / $ * 56))),
2433
+ borderRadius: `${t.xs} ${t.xs} 0 0`,
2434
+ backgroundColor: p === $ ? e.primary : e.tint2
2435
+ }
2436
+ }
2437
+ )
2438
+ ]
2439
+ },
2440
+ Oe[_]
2441
+ ))
2442
+ }
2443
+ ),
2444
+ /* @__PURE__ */ r(h, { sx: { display: "grid", gridTemplateColumns: "repeat(6,1fr)", gap: n(6) }, children: Oe.map((p) => /* @__PURE__ */ r(S, { size: 10, font: "secondary", color: e.dim, sx: { textAlign: "center", unicodeBidi: "isolate" }, children: p }, p)) })
2445
+ ] })
2446
+ ] }),
2447
+ /* @__PURE__ */ y(h, { sx: { display: "grid", gridTemplateColumns: fe, gap: n(12) }, children: [
2448
+ /* @__PURE__ */ y(se, { children: [
2449
+ /* @__PURE__ */ r(Y, { children: l("scoringTitle") }),
2450
+ v.map((p) => /* @__PURE__ */ y(
2451
+ h,
2452
+ {
2453
+ sx: {
2454
+ display: "grid",
2455
+ gridTemplateColumns: `${n(150)} 1fr ${n(44)}`,
2456
+ alignItems: "center",
2457
+ gap: n(10)
2458
+ },
2459
+ children: [
2460
+ /* @__PURE__ */ r(S, { size: 12, font: "secondary", weight: 500, color: e.body, ellipsis: !0, children: p.label }),
2461
+ /* @__PURE__ */ r(h, { sx: { height: n(8), borderRadius: t.full, backgroundColor: e.variant, overflow: "hidden" }, children: /* @__PURE__ */ r(h, { sx: { height: "100%", width: `${p.pct}%`, backgroundColor: e.primary, borderRadius: t.full } }) }),
2462
+ /* @__PURE__ */ r(S, { size: 12, font: "secondary", weight: 700, color: e.text, sx: { textAlign: "right" }, children: `${p.pct}%` })
2463
+ ]
2464
+ },
2465
+ p.label
2466
+ ))
2467
+ ] }),
2468
+ /* @__PURE__ */ y(se, { children: [
2469
+ /* @__PURE__ */ r(Y, { children: l("averagesTitle") }),
2470
+ /* @__PURE__ */ y(h, { sx: { display: "grid", gridTemplateColumns: "repeat(2,1fr)", gap: n(8) }, children: [
2471
+ /* @__PURE__ */ r(
2472
+ ie,
2473
+ {
2474
+ caption: l("avgShotsOnTarget"),
2475
+ icon: /* @__PURE__ */ y("svg", { ...ae, children: [
2476
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
2477
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "6" }),
2478
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "2" })
2479
+ ] }),
2480
+ children: m(b(g.shotsOnTarget))
2481
+ }
2482
+ ),
2483
+ /* @__PURE__ */ r(
2484
+ ie,
2485
+ {
2486
+ caption: l("avgCorners"),
2487
+ icon: /* @__PURE__ */ y("svg", { ...ae, children: [
2488
+ /* @__PURE__ */ r("path", { d: "M4 22V4" }),
2489
+ /* @__PURE__ */ r("path", { d: "M4 4h12l-3 4 3 4H4" }),
2490
+ /* @__PURE__ */ r("path", { d: "M2 22h6" })
2491
+ ] }),
2492
+ children: m(b(g.corners))
2493
+ }
2494
+ ),
2495
+ /* @__PURE__ */ r(
2496
+ ie,
2497
+ {
2498
+ caption: l("avgCards"),
2499
+ icon: /* @__PURE__ */ r("svg", { ...ae, children: /* @__PURE__ */ r("rect", { x: "6", y: "3", width: "12", height: "18", rx: "2" }) }),
2500
+ children: m(b(g.yellowCards + g.redCards))
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ r(
2504
+ ie,
2505
+ {
2506
+ caption: l("avgGoalsByHalf"),
2507
+ icon: /* @__PURE__ */ y("svg", { ...ae, children: [
2508
+ /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "10" }),
2509
+ /* @__PURE__ */ r("path", { d: "M12 2a10 10 0 0 1 0 20z", fill: "currentColor", stroke: "none", opacity: ".35" }),
2510
+ /* @__PURE__ */ r("path", { d: "M12 2v20" })
2511
+ ] }),
2512
+ children: /* @__PURE__ */ y(h, { sx: { display: "flex", alignItems: "baseline", gap: n(4) }, children: [
2513
+ m(b(g.firstHalfGoals)),
2514
+ /* @__PURE__ */ r(S, { size: 11, font: "secondary", color: e.dim, children: "/" }),
2515
+ m(b(g.secondHalfGoals))
2516
+ ] })
2517
+ }
2518
+ )
2519
+ ] }),
2520
+ /* @__PURE__ */ y(
2521
+ h,
2522
+ {
2523
+ sx: {
2524
+ display: "flex",
2525
+ alignItems: "center",
2526
+ justifyContent: "space-between",
2527
+ gap: n(12),
2528
+ borderTop: `1px solid ${e.border}`,
2529
+ paddingTop: n(12),
2530
+ flexWrap: "wrap"
2531
+ },
2532
+ children: [
2533
+ /* @__PURE__ */ r(Y, { children: l("totalCards") }),
2534
+ /* @__PURE__ */ r(h, { sx: { display: "flex", gap: n(20) }, children: [
2535
+ { n: g.yellowCards, color: e.yellowCard, key: "yellow" },
2536
+ { n: g.redCards, color: e.danger, key: "red" }
2537
+ ].map((p) => /* @__PURE__ */ y(h, { sx: { display: "flex", alignItems: "center", gap: n(10) }, children: [
2538
+ /* @__PURE__ */ y(h, { component: "span", sx: { position: "relative", width: n(22), height: n(26), flexShrink: 0 }, children: [
2539
+ /* @__PURE__ */ r(
2540
+ h,
2541
+ {
2542
+ component: "span",
2543
+ sx: {
2544
+ position: "absolute",
2545
+ left: 0,
2546
+ top: n(4),
2547
+ width: n(14),
2548
+ height: n(20),
2549
+ borderRadius: "3px",
2550
+ backgroundColor: p.color,
2551
+ opacity: 0.45,
2552
+ transform: "rotate(-12deg)"
2553
+ }
2554
+ }
2555
+ ),
2556
+ /* @__PURE__ */ r(
2557
+ h,
2558
+ {
2559
+ component: "span",
2560
+ sx: {
2561
+ position: "absolute",
2562
+ left: n(6),
2563
+ top: 0,
2564
+ width: n(14),
2565
+ height: n(20),
2566
+ borderRadius: "3px",
2567
+ backgroundColor: p.color,
2568
+ boxShadow: "0 1px 3px rgba(0,0,0,.2)"
2569
+ }
2570
+ }
2571
+ )
2572
+ ] }),
2573
+ m(p.n, 20)
2574
+ ] }, p.key)) })
2575
+ ]
2576
+ }
2577
+ )
2578
+ ] })
2579
+ ] }),
2580
+ A.length ? /* @__PURE__ */ r(
2581
+ h,
2582
+ {
2583
+ sx: {
2584
+ display: "grid",
2585
+ gridTemplateColumns: "repeat(12, minmax(0, 1fr))",
2586
+ gap: n(12)
2587
+ },
2588
+ children: A.map((p, _) => {
2589
+ const k = ye(u.teamCTA, "team", p.teamId);
2590
+ return /* @__PURE__ */ y(
2591
+ Z,
2592
+ {
2593
+ component: k != null && k.href ? "a" : "div",
2594
+ href: (k == null ? void 0 : k.href) ?? void 0,
2595
+ target: k == null ? void 0 : k.target,
2596
+ onClick: k == null ? void 0 : k.onClick,
2597
+ sx: {
2598
+ padding: `${n(12)} ${n(14)}`,
2599
+ display: "flex",
2600
+ alignItems: "center",
2601
+ gap: n(10),
2602
+ cursor: M ? "pointer" : "default",
2603
+ gridColumn: `span ${Ao(_, A.length, o, s)}`,
2604
+ textDecoration: "none",
2605
+ color: "inherit",
2606
+ "&:hover": { backgroundColor: M ? e.onSurface : e.surface }
2607
+ },
2608
+ children: [
2609
+ /* @__PURE__ */ r(j, { url: a.logo(p.teamId), size: 36 }),
2610
+ /* @__PURE__ */ y(h, { sx: { minWidth: 0, flex: 1 }, children: [
2611
+ /* @__PURE__ */ r(Y, { size: 10, sx: { display: "block" }, children: p.label }),
2612
+ /* @__PURE__ */ r(S, { component: "div", size: 13, weight: 700, color: e.text, ellipsis: !0, cms: !0, children: a.name(p.teamId) })
2613
+ ] }),
2614
+ /* @__PURE__ */ y(h, { sx: { textAlign: "right", flexShrink: 0 }, children: [
2615
+ /* @__PURE__ */ r(S, { component: "div", size: 22, weight: 700, color: e.primary, sx: { lineHeight: 1 }, children: p.value }),
2616
+ /* @__PURE__ */ r(S, { component: "div", size: 10, font: "secondary", color: e.dim, sx: { marginTop: n(2, 10) }, children: p.unit })
2617
+ ] })
2618
+ ]
2619
+ },
2620
+ p.label
2621
+ );
2622
+ })
2623
+ }
2624
+ ) : null,
2625
+ R.length ? /* @__PURE__ */ r(h, { sx: { display: "grid", gridTemplateColumns: fe, gap: n(12) }, children: R.map(({ label: p, match: _ }) => {
2626
+ const k = ye(u.matchCTA, "match", _.id), [V, q] = _.fullTime ?? [0, 0];
2627
+ return /* @__PURE__ */ y(
2628
+ Z,
2629
+ {
2630
+ component: k != null && k.href ? "a" : "div",
2631
+ href: (k == null ? void 0 : k.href) ?? void 0,
2632
+ target: k == null ? void 0 : k.target,
2633
+ onClick: k == null ? void 0 : k.onClick,
2634
+ sx: {
2635
+ padding: `${n(12)} ${n(16)}`,
2636
+ display: "flex",
2637
+ flexDirection: "column",
2638
+ gap: n(8),
2639
+ cursor: G ? "pointer" : "default",
2640
+ textDecoration: "none",
2641
+ color: "inherit",
2642
+ "&:hover": { backgroundColor: G ? e.onSurface : e.surface }
2643
+ },
2644
+ children: [
2645
+ /* @__PURE__ */ y(Y, { size: 10, sx: { display: "flex", justifyContent: "space-between" }, children: [
2646
+ /* @__PURE__ */ r("span", { children: p }),
2647
+ /* @__PURE__ */ r("span", { children: l("recordRound", {
2648
+ round: _.round,
2649
+ date: c.date(_.start, { day: "2-digit", month: "2-digit" })
2650
+ }) })
2651
+ ] }),
2652
+ /* @__PURE__ */ y(
2653
+ h,
2654
+ {
2655
+ sx: {
2656
+ display: "grid",
2657
+ gridTemplateColumns: "minmax(0,1fr) auto minmax(0,1fr)",
2658
+ alignItems: "center",
2659
+ gap: n(8)
2660
+ },
2661
+ children: [
2662
+ /* @__PURE__ */ y(h, { sx: { display: "flex", alignItems: "center", justifyContent: "flex-end", gap: n(8), minWidth: 0 }, children: [
2663
+ /* @__PURE__ */ r(S, { size: 13, weight: 600, color: e.text, ellipsis: !0, cms: !0, children: a.name(_.home.id) }),
2664
+ /* @__PURE__ */ r(j, { url: a.logo(_.home.id), size: 28 })
2665
+ ] }),
2666
+ /* @__PURE__ */ r(
2667
+ S,
2668
+ {
2669
+ size: 18,
2670
+ weight: 700,
2671
+ color: e.text,
2672
+ sx: {
2673
+ letterSpacing: n(1, 18),
2674
+ backgroundColor: e.onSurface,
2675
+ borderRadius: t.sm,
2676
+ padding: `${n(4, 18)} ${n(10, 18)}`
2677
+ },
2678
+ children: `${V} : ${q}`
2679
+ }
2680
+ ),
2681
+ /* @__PURE__ */ y(h, { sx: { display: "flex", alignItems: "center", gap: n(8), minWidth: 0 }, children: [
2682
+ /* @__PURE__ */ r(j, { url: a.logo(_.away.id), size: 28 }),
2683
+ /* @__PURE__ */ r(S, { size: 13, weight: 600, color: e.text, ellipsis: !0, cms: !0, children: a.name(_.away.id) })
2684
+ ] })
2685
+ ]
2686
+ }
2687
+ )
2688
+ ]
2689
+ },
2690
+ p
2691
+ );
2692
+ }) }) : null
2693
+ ] });
2694
+ }, zo = ["header", "matches", "players", "season"], Do = 3e4, Po = (e) => {
2695
+ const {
2696
+ entityId: t,
2697
+ sdk: o,
2698
+ language: s,
2699
+ seasonId: i,
2700
+ stageId: a,
2701
+ sections: d = zo,
2702
+ liveRefresh: l = !0,
2703
+ refreshInterval: c = Do,
2704
+ labels: u
2705
+ } = e, { colors: g, fonts: f } = W(), w = io(u), b = z.useMemo(() => ro(s), [s]), { data: m, competitionId: I, entities: x, loading: $, error: v } = Jt(
2706
+ o,
2707
+ t,
2708
+ s,
2709
+ "–",
2710
+ { seasonId: i, stageId: a, liveRefresh: l, refreshInterval: c }
2711
+ ), E = z.useMemo(() => m ? m.matches.filter(we) : [], [m]), D = z.useMemo(() => Qt(E), [E]), M = Array.from(new Set(d)), A = (T) => /* @__PURE__ */ r(Z, { sx: { padding: n(24) }, children: /* @__PURE__ */ r(S, { component: "div", size: 14, font: "secondary", color: g.dim, sx: { textAlign: "center" }, children: T }) });
2712
+ let L;
2713
+ return $ ? L = /* @__PURE__ */ r(St, { my: 10 }) : v ? L = A(w("loadFailed")) : !m || m.matches.length === 0 ? L = A(w("noData")) : L = /* @__PURE__ */ r(
2714
+ ao,
2715
+ {
2716
+ value: { sdk: o, data: m, competitionId: I, entities: x, finished: E, tally: D, label: w, fmt: b, props: e },
2717
+ children: M.map((T) => T === "header" ? /* @__PURE__ */ r(lo, {}, T) : T === "matches" ? /* @__PURE__ */ r(Ro, {}, T) : T === "players" ? m.athletes.length ? /* @__PURE__ */ r(mo, {}, T) : null : T === "season" ? /* @__PURE__ */ r(Lo, {}, T) : null)
2718
+ }
2719
+ ), /* @__PURE__ */ r(
2720
+ h,
2721
+ {
2722
+ sx: {
2723
+ fontSize: "1em",
2724
+ fontFamily: f.primary,
2725
+ color: g.text,
2726
+ lineHeight: "normal",
2727
+ display: "flex",
2728
+ flexDirection: "column",
2729
+ gap: n(16)
2730
+ },
2731
+ children: L
2732
+ }
2733
+ );
2734
+ }, Wo = (e) => {
2735
+ const [t, o] = z.useState(!1), [s, i] = z.useState(!1), a = mt(e.language), d = z.useRef(
2736
+ `competition-statistics-shadow-root-${Math.random().toString(36).substring(2, 11)}`
2737
+ ), l = z.useRef(null), c = z.useRef(null), u = z.useRef(null), [g, f] = z.useState(null);
2738
+ z.useEffect(() => {
2739
+ ht(e.language || "en").finally(() => i(!0));
2740
+ }, [e.language]), z.useEffect(() => {
2741
+ if (!l.current) return;
2742
+ l.current.shadowRoot ? (c.current = l.current.shadowRoot, u.current = c.current.getElementById(
2743
+ d.current
2744
+ ), u.current || (u.current = document.createElement("div"), u.current.id = d.current, u.current.style.height = "100%", c.current.appendChild(u.current))) : (c.current = l.current.attachShadow({ mode: "open" }), u.current = document.createElement("div"), u.current.id = d.current, u.current.style.height = "100%", c.current.appendChild(u.current)), gt(u.current, a);
2745
+ const I = Ct("competition-statistics", a);
2746
+ return f(
2747
+ (x) => (x == null ? void 0 : x.key) === I ? x : ft(
2748
+ "competition-statistics",
2749
+ c.current,
2750
+ a
2751
+ )
2752
+ ), o(!0), () => {
2753
+ o(!1);
2754
+ };
2755
+ }, [a]);
2756
+ const w = e.themeOptions, b = /* @__PURE__ */ r(h, { ref: l, sx: { height: "100%", display: "block" } }), m = t && s && u.current && g ? It(
2757
+ // Keyed on the cache, not on `direction`: it must change in the same render that adopts
2758
+ // the new cache, or CssVarsProvider writes its CSS variables into the outgoing cache and
2759
+ // never repeats.
2760
+ /* @__PURE__ */ r(yt, { value: g, children: /* @__PURE__ */ r(xt, { containerRef: l, children: /* @__PURE__ */ r(
2761
+ bt,
2762
+ {
2763
+ customTheme: w,
2764
+ mode: w == null ? void 0 : w.mode,
2765
+ shadowRootElement: u.current,
2766
+ direction: a,
2767
+ children: /* @__PURE__ */ y(
2768
+ wt,
2769
+ {
2770
+ shadowRootElement: u.current,
2771
+ leadPhoneCountryCode: null,
2772
+ language: e.language,
2773
+ optionsLayout: null,
2774
+ direction: a,
2775
+ children: [
2776
+ /* @__PURE__ */ r(
2777
+ Mt,
2778
+ {
2779
+ styles: {
2780
+ "@keyframes cs-pulse": {
2781
+ "0%, 100%": { opacity: 1, transform: "scale(1)" },
2782
+ "50%": { opacity: 0.4, transform: "scale(.7)" }
2783
+ }
2784
+ }
2785
+ }
2786
+ ),
2787
+ e.children
2788
+ ]
2789
+ }
2790
+ )
2791
+ }
2792
+ ) }) }, g.key),
2793
+ u.current
2794
+ ) : null;
2795
+ return /* @__PURE__ */ y(pe, { children: [
2796
+ b,
2797
+ m
2798
+ ] });
2799
+ }, Oo = (e) => /* @__PURE__ */ r(Wo, { ...e, children: /* @__PURE__ */ r(Po, { ...e }) }), Jo = Oo;
2800
+ export {
2801
+ Jo as CompetitionStatistics
2802
+ };