@wral/hsot-data 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +1165 -1116
- package/dist/{hsot-brackets-Cc0zj07F.js → hsot-brackets-Bqk0gI3J.js} +524 -475
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { createClient as
|
|
3
|
-
const
|
|
1
|
+
import { LitElement as le, html as n, css as w, nothing as p, svg as ee } from "lit";
|
|
2
|
+
import { createClient as ke } from "./client.mjs";
|
|
3
|
+
const E = {
|
|
4
4
|
game: "/{sport}/game/{id}/",
|
|
5
5
|
school: "/school/{id}/",
|
|
6
6
|
section: "/{sport}/{view}/",
|
|
@@ -13,73 +13,73 @@ function g(a, e) {
|
|
|
13
13
|
}
|
|
14
14
|
function z(a) {
|
|
15
15
|
return {
|
|
16
|
-
game: a.getAttribute("game-href") ||
|
|
17
|
-
school: a.getAttribute("school-href") ||
|
|
18
|
-
section: a.getAttribute("section-href") ||
|
|
19
|
-
report: a.getAttribute("report-href") ||
|
|
16
|
+
game: a.getAttribute("game-href") || E.game,
|
|
17
|
+
school: a.getAttribute("school-href") || E.school,
|
|
18
|
+
section: a.getAttribute("section-href") || E.section,
|
|
19
|
+
report: a.getAttribute("report-href") || E.report
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t = g(a.report ||
|
|
22
|
+
function ce(a, e = "") {
|
|
23
|
+
const t = g(a.report || E.report, { id: e || "" });
|
|
24
24
|
return e ? t : t.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
26
|
+
const k = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
27
|
+
function x(a, e) {
|
|
28
28
|
if (!a) return "TBD";
|
|
29
29
|
const [t, s, r] = String(a).split("-").map(Number);
|
|
30
30
|
return !t || !s || !r ? "TBD" : new Date(t, s - 1, r).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function W(a) {
|
|
33
33
|
if (!a) return "";
|
|
34
34
|
const [e, t] = String(a).split(":").map(Number);
|
|
35
35
|
if (Number.isNaN(e)) return "";
|
|
36
36
|
const s = e >= 12 ? "PM" : "AM";
|
|
37
37
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Se(a) {
|
|
40
40
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Ie(a) {
|
|
43
43
|
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
44
44
|
}
|
|
45
45
|
function _(a = /* @__PURE__ */ new Date()) {
|
|
46
46
|
const e = a.getFullYear();
|
|
47
47
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function V(a = /* @__PURE__ */ new Date()) {
|
|
50
50
|
const e = (t) => String(t).padStart(2, "0");
|
|
51
51
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Te(a, e = V()) {
|
|
54
54
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
55
55
|
if (!t.length || t.includes(e)) return e;
|
|
56
56
|
const s = t.filter((r) => r < e);
|
|
57
57
|
return s.length ? s[s.length - 1] : t[0];
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Y(a) {
|
|
60
60
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function G(a) {
|
|
63
63
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
64
64
|
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
65
65
|
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
66
66
|
}
|
|
67
|
-
const
|
|
67
|
+
const Ce = (a) => {
|
|
68
68
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
69
69
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
70
70
|
};
|
|
71
|
-
function
|
|
71
|
+
function te(a, e) {
|
|
72
72
|
const t = (o) => {
|
|
73
|
-
const
|
|
74
|
-
return
|
|
73
|
+
const i = /^\d+/.exec(String(o ?? ""));
|
|
74
|
+
return i ? Number(i[0]) : null;
|
|
75
75
|
}, s = t(a), r = t(e);
|
|
76
76
|
return s !== null && r !== null && s !== r ? r - s : s !== null && r === null ? -1 : s === null && r !== null ? 1 : String(a ?? "").localeCompare(String(e ?? ""), "en", { sensitivity: "base" });
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function De(a, e) {
|
|
79
79
|
const t = (s) => String(s?.name ?? s ?? "");
|
|
80
80
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function de(a) {
|
|
83
83
|
if (a.state === "live") {
|
|
84
84
|
const e = [a.period, a.clock].filter(Boolean).join(" ");
|
|
85
85
|
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
@@ -88,10 +88,21 @@ function ce(a) {
|
|
|
88
88
|
const e = [];
|
|
89
89
|
return a.finish === "overtime" && e.push("OT"), a.finish === "shootout" && e.push("PK-SO"), a.forfeit && a.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
|
|
90
90
|
}
|
|
91
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${
|
|
91
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${x(a.date, { month: "short", day: "numeric" })} · ${W(a.time)}`.replace(/ · $/, "") };
|
|
92
|
+
}
|
|
93
|
+
const Be = ["boys", "girls"];
|
|
94
|
+
function he(a, e) {
|
|
95
|
+
return e ? a ? a.gender === e || a.gender === "coed" : !1 : !0;
|
|
92
96
|
}
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
function me(a, e) {
|
|
98
|
+
return e ? (a || []).filter((t) => he(t, e)) : a || [];
|
|
99
|
+
}
|
|
100
|
+
function q(a) {
|
|
101
|
+
const e = new Set((a || []).map((t) => t && t.gender));
|
|
102
|
+
return Be.filter((t) => e.has(t));
|
|
103
|
+
}
|
|
104
|
+
const Fe = (a) => q(a).length === 2, ze = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
105
|
+
function I(a) {
|
|
95
106
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
96
107
|
const t = e.indexOf("#");
|
|
97
108
|
let s = "";
|
|
@@ -99,43 +110,43 @@ function S(a) {
|
|
|
99
110
|
let r = e.split("?")[0] + s;
|
|
100
111
|
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
101
112
|
}
|
|
102
|
-
function
|
|
113
|
+
function pe() {
|
|
103
114
|
const a = globalThis.location;
|
|
104
115
|
if (!a) return "";
|
|
105
116
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
106
|
-
return
|
|
117
|
+
return I((a.pathname || "") + e);
|
|
107
118
|
}
|
|
108
|
-
function
|
|
119
|
+
function Pe(a, e, t) {
|
|
109
120
|
if (!t) return null;
|
|
110
|
-
const s =
|
|
121
|
+
const s = I(a);
|
|
111
122
|
if (!s) return null;
|
|
112
|
-
const r =
|
|
123
|
+
const r = I(g(e.game, { sport: t, id: "" })), o = I(g(e.school, { id: "" }));
|
|
113
124
|
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
114
|
-
const
|
|
115
|
-
if (s ===
|
|
116
|
-
if (!s.startsWith(`${
|
|
117
|
-
const
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
function
|
|
121
|
-
const s = (
|
|
125
|
+
const i = I(g(e.section, { sport: t, view: "" }));
|
|
126
|
+
if (s === i) return "";
|
|
127
|
+
if (!s.startsWith(`${i}/`)) return null;
|
|
128
|
+
const d = s.slice(i.length + 1), h = d.split("/");
|
|
129
|
+
return h.length > 2 || h.some((l) => !/^[a-z][a-z-]*$/.test(l)) || ze.has(h[0]) ? null : d;
|
|
130
|
+
}
|
|
131
|
+
function Ee(a, e, t) {
|
|
132
|
+
const s = (o) => g(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r = Fe(e) ? [
|
|
122
133
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
123
134
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
124
135
|
] : [{ label: "Standings", href: s("standings") }];
|
|
125
136
|
return [
|
|
126
|
-
{ label: `${
|
|
137
|
+
{ label: `${k(a)} Home`, href: s("") },
|
|
127
138
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
128
139
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
129
|
-
...
|
|
140
|
+
...r,
|
|
130
141
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
131
142
|
];
|
|
132
143
|
}
|
|
133
|
-
function
|
|
134
|
-
const t =
|
|
144
|
+
function Ae(a, e = pe()) {
|
|
145
|
+
const t = I(e);
|
|
135
146
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
136
|
-
t &&
|
|
147
|
+
t && I(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
137
148
|
}
|
|
138
|
-
class
|
|
149
|
+
class $ extends le {
|
|
139
150
|
static properties = {
|
|
140
151
|
api: { type: String },
|
|
141
152
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -154,7 +165,7 @@ class y extends ie {
|
|
|
154
165
|
this._client = e, this.isConnected && this.load();
|
|
155
166
|
}
|
|
156
167
|
get client() {
|
|
157
|
-
return this._client ? this._client : this.api ?
|
|
168
|
+
return this._client ? this._client : this.api ? ke({ baseUrl: this.api }) : null;
|
|
158
169
|
}
|
|
159
170
|
connectedCallback() {
|
|
160
171
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -166,7 +177,7 @@ class y extends ie {
|
|
|
166
177
|
this.load();
|
|
167
178
|
}
|
|
168
179
|
updated(e) {
|
|
169
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
180
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), Ae(this);
|
|
170
181
|
}
|
|
171
182
|
async load() {
|
|
172
183
|
const e = this.client;
|
|
@@ -201,7 +212,7 @@ class y extends ie {
|
|
|
201
212
|
return n``;
|
|
202
213
|
}
|
|
203
214
|
}
|
|
204
|
-
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
215
|
+
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
205
216
|
:host {
|
|
206
217
|
--hsot-red: var(--color-red, #D1232A);
|
|
207
218
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -239,7 +250,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
239
250
|
outline-offset: 1px;
|
|
240
251
|
}
|
|
241
252
|
.mut { color: var(--hsot-gray-5); }
|
|
242
|
-
`,
|
|
253
|
+
`, Ne = w`
|
|
243
254
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
244
255
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
245
256
|
.band h1, .band h2.bandtitle {
|
|
@@ -288,7 +299,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
288
299
|
@media (max-width: 720px) {
|
|
289
300
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
290
301
|
}
|
|
291
|
-
`,
|
|
302
|
+
`, Re = w`
|
|
292
303
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
293
304
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
294
305
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -352,7 +363,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
352
363
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
353
364
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
354
365
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
355
|
-
`,
|
|
366
|
+
`, Ge = w`
|
|
356
367
|
.pill {
|
|
357
368
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
358
369
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -367,7 +378,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
367
378
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
368
379
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
369
380
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
370
|
-
`,
|
|
381
|
+
`, Me = w`
|
|
371
382
|
.tablewrap { overflow-x: auto; }
|
|
372
383
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
373
384
|
table.data th {
|
|
@@ -385,7 +396,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
385
396
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
386
397
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
387
398
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
388
|
-
`,
|
|
399
|
+
`, Le = w`
|
|
389
400
|
.swatch {
|
|
390
401
|
display: inline-flex; align-items: center; justify-content: center;
|
|
391
402
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -409,7 +420,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
409
420
|
.dot.W { background: var(--hsot-win); }
|
|
410
421
|
.dot.L { background: var(--hsot-loss); }
|
|
411
422
|
.dot.T { background: var(--hsot-tie); }
|
|
412
|
-
`,
|
|
423
|
+
`, Oe = w`
|
|
413
424
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
414
425
|
.gamelist li {
|
|
415
426
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -459,24 +470,24 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Fe = $`
|
|
|
459
470
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
460
471
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
461
472
|
.gamelist a.box { font-size: 0.78rem; }
|
|
462
|
-
`, P = [
|
|
473
|
+
`, P = [_e, Ne, Re, Ge, Me, Le, Oe];
|
|
463
474
|
function H(a) {
|
|
464
475
|
return a.state !== "final" ? null : a.forfeit === "home" ? "away" : a.forfeit === "away" || a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
465
476
|
}
|
|
466
|
-
function
|
|
477
|
+
function He(a) {
|
|
467
478
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
468
479
|
}
|
|
469
480
|
function N(a, e) {
|
|
470
|
-
const t = {}, s = (o) => (t[o] = t[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && (!e || o.date <= e)).sort((o,
|
|
481
|
+
const t = {}, s = (o) => (t[o] = t[o] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[o]), r = a.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && (!e || o.date <= e)).sort((o, i) => String(o.date).localeCompare(String(i.date)));
|
|
471
482
|
for (const o of r) {
|
|
472
|
-
const
|
|
473
|
-
for (const
|
|
474
|
-
const
|
|
475
|
-
if (!
|
|
476
|
-
const c = s(
|
|
483
|
+
const i = H(o), d = o.gameType === "conference";
|
|
484
|
+
for (const h of ["home", "away"]) {
|
|
485
|
+
const l = h === "home" ? o.homeTeamId : o.awayTeamId;
|
|
486
|
+
if (!l) continue;
|
|
487
|
+
const c = s(l), m = h === "home" ? o.homeScore : o.awayScore, f = h === "home" ? o.awayScore : o.homeScore;
|
|
477
488
|
c.pf += m, c.pa += f;
|
|
478
489
|
let u = "T";
|
|
479
|
-
|
|
490
|
+
i === "tie" ? (c.t += 1, d && (c.ct += 1)) : i === h ? (c.w += 1, d && (c.cw += 1), u = "W") : (c.l += 1, d && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: m, their: f, opp: h === "home" ? o.awayTeamId : o.homeTeamId, conf: d });
|
|
480
491
|
}
|
|
481
492
|
}
|
|
482
493
|
return t;
|
|
@@ -488,51 +499,51 @@ function U(a) {
|
|
|
488
499
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
489
500
|
return e + t;
|
|
490
501
|
}
|
|
491
|
-
const
|
|
502
|
+
const se = (a, e, t) => {
|
|
492
503
|
const s = a + e + t;
|
|
493
504
|
return s ? (a + t / 2) / s : 0;
|
|
494
|
-
},
|
|
495
|
-
function
|
|
505
|
+
}, ae = (a) => a.toFixed(3).replace("0.", ".");
|
|
506
|
+
function S(a, e = !1) {
|
|
496
507
|
if (!a) return "0-0";
|
|
497
508
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
498
509
|
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
499
510
|
}
|
|
500
|
-
function
|
|
511
|
+
function fe(a, e) {
|
|
501
512
|
return a.map((t) => {
|
|
502
513
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
503
|
-
return { team: t, rec: s, confPct:
|
|
514
|
+
return { team: t, rec: s, confPct: se(s.cw, s.cl, s.ct), overallPct: se(s.w, s.l, s.t) };
|
|
504
515
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
505
516
|
}
|
|
506
|
-
function
|
|
517
|
+
function K(a, e) {
|
|
507
518
|
return a.filter((t) => (t.homeTeamId === e || t.awayTeamId === e) && (t.state === "scheduled" || t.state === "live") && t.gameType !== "scrimmage").sort((t, s) => String(t.date).localeCompare(String(s.date)))[0] || null;
|
|
508
519
|
}
|
|
509
|
-
function
|
|
520
|
+
function re(a, e) {
|
|
510
521
|
const t = a[e];
|
|
511
522
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
512
523
|
}
|
|
513
|
-
function
|
|
524
|
+
function It(a, e, t, s = "") {
|
|
514
525
|
let r = null;
|
|
515
526
|
for (const o of a || [])
|
|
516
527
|
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
517
528
|
return r;
|
|
518
529
|
}
|
|
519
|
-
function
|
|
530
|
+
function Q(a, e, t, s, r) {
|
|
520
531
|
const o = e[t];
|
|
521
532
|
if (!o) return null;
|
|
522
|
-
const
|
|
523
|
-
for (const
|
|
524
|
-
if (
|
|
525
|
-
const
|
|
526
|
-
(!c ||
|
|
533
|
+
const i = /* @__PURE__ */ new Map();
|
|
534
|
+
for (const h of a || []) {
|
|
535
|
+
if (h.sport !== s || r && h.effectiveDate > r || h.gender && o.gender !== h.gender && o.gender !== "coed") continue;
|
|
536
|
+
const l = h.gender || "", c = i.get(l);
|
|
537
|
+
(!c || h.effectiveDate > c.effectiveDate) && i.set(l, h);
|
|
527
538
|
}
|
|
528
|
-
let
|
|
529
|
-
for (const
|
|
530
|
-
const
|
|
531
|
-
|
|
539
|
+
let d = null;
|
|
540
|
+
for (const h of i.values()) {
|
|
541
|
+
const l = (h.teamIds || []).indexOf(t);
|
|
542
|
+
l !== -1 && (!d || h.effectiveDate > d.effectiveDate) && (d = { poll: h, rank: l + 1 });
|
|
532
543
|
}
|
|
533
|
-
return
|
|
544
|
+
return d ? d.rank : null;
|
|
534
545
|
}
|
|
535
|
-
function
|
|
546
|
+
function Ue(a, e, t) {
|
|
536
547
|
if (!a) return { kind: "none", delta: 0 };
|
|
537
548
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
538
549
|
if (!s) return { kind: "none", delta: 0 };
|
|
@@ -542,67 +553,67 @@ function Me(a, e, t) {
|
|
|
542
553
|
const o = r - s;
|
|
543
554
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
544
555
|
}
|
|
545
|
-
function
|
|
556
|
+
function je(a) {
|
|
546
557
|
return /^https?:\/\//i.test(String(a || ""));
|
|
547
558
|
}
|
|
548
|
-
function
|
|
549
|
-
if (!
|
|
559
|
+
function ue(a, { w: e, h: t } = {}) {
|
|
560
|
+
if (!je(a)) return "";
|
|
550
561
|
const s = [];
|
|
551
562
|
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
552
563
|
const r = a.includes("?") ? "&" : "?";
|
|
553
564
|
return `${a}${r}${s.join("&")}`;
|
|
554
565
|
}
|
|
555
|
-
function
|
|
566
|
+
function M(a, e) {
|
|
556
567
|
const t = e * 2;
|
|
557
|
-
return
|
|
568
|
+
return ue(a?.logoAssetId, { w: t, h: t });
|
|
558
569
|
}
|
|
559
|
-
function
|
|
560
|
-
return
|
|
570
|
+
function qe(a, e) {
|
|
571
|
+
return ue(a?.photoAssetId, { w: e * 2 });
|
|
561
572
|
}
|
|
562
573
|
function j(a, e, { title: t, sub: s, teams: r }) {
|
|
563
|
-
const o =
|
|
574
|
+
const o = pe(), d = !!a.querySelector(':scope > a[slot="nav"]') || Pe(o, e.hrefs, e.sport) !== null;
|
|
564
575
|
return n`
|
|
565
576
|
<div class="band section">
|
|
566
577
|
<div class="inner">
|
|
567
578
|
<h1>${t}</h1>
|
|
568
579
|
${s ? n`<p class="sub">${s}</p>` : p}
|
|
569
580
|
</div>
|
|
570
|
-
${
|
|
571
|
-
<nav class="sectionnav" aria-label="${
|
|
581
|
+
${d ? n`
|
|
582
|
+
<nav class="sectionnav" aria-label="${k(e.sport)} section">
|
|
572
583
|
<div class="navrow">
|
|
573
584
|
<slot name="nav">
|
|
574
|
-
${
|
|
575
|
-
aria-current=${o &&
|
|
585
|
+
${Ee(e.sport, r, e.hrefs).map((h) => n`<a href=${h.href}
|
|
586
|
+
aria-current=${o && I(h.href) === o ? "page" : p}>${h.label}</a>`)}
|
|
576
587
|
</slot>
|
|
577
588
|
</div>
|
|
578
589
|
</nav>` : p}
|
|
579
590
|
</div>
|
|
580
591
|
`;
|
|
581
592
|
}
|
|
582
|
-
const
|
|
593
|
+
const T = (a, e) => {
|
|
583
594
|
const t = a.teamsById[e];
|
|
584
595
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
585
|
-
}, F = (a, e) =>
|
|
586
|
-
function
|
|
596
|
+
}, F = (a, e) => T(a, e)?.name || "TBD", L = (a, e) => T(a, e)?.abbr || "TBD";
|
|
597
|
+
function C(a, e = 26) {
|
|
587
598
|
if (!a) return p;
|
|
588
|
-
const t =
|
|
599
|
+
const t = M(a, e);
|
|
589
600
|
if (t)
|
|
590
601
|
return n`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
591
602
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
592
|
-
const s = a.colorPrimary || "#030711", r =
|
|
603
|
+
const s = a.colorPrimary || "#030711", r = G(s);
|
|
593
604
|
return n`<span class="swatch" aria-hidden="true"
|
|
594
605
|
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
595
|
-
>${
|
|
606
|
+
>${Y(a)}</span>`;
|
|
596
607
|
}
|
|
597
|
-
function
|
|
598
|
-
const s =
|
|
608
|
+
function X(a, e, t) {
|
|
609
|
+
const s = Q(a.rankings, a.teamsById, e, a.sport, t);
|
|
599
610
|
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
600
611
|
}
|
|
601
612
|
function O(a, e, t) {
|
|
602
|
-
const s =
|
|
603
|
-
return s ? n`${
|
|
613
|
+
const s = T(a, e);
|
|
614
|
+
return s ? n`${X(a, e, t)}<a href=${g(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
604
615
|
}
|
|
605
|
-
function
|
|
616
|
+
function Z(a, e, t = 5) {
|
|
606
617
|
const s = a.records[e];
|
|
607
618
|
if (!s || !s.results.length) return n`<span class="mut">·</span>`;
|
|
608
619
|
const r = s.results.slice(-1 * t);
|
|
@@ -612,30 +623,30 @@ function X(a, e, t = 5) {
|
|
|
612
623
|
href=${g(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
613
624
|
</span>`;
|
|
614
625
|
}
|
|
615
|
-
function
|
|
626
|
+
function D(a, e) {
|
|
616
627
|
return a.querySelector(':scope > [slot="rail"]') ? n`<div class="view withrail">
|
|
617
628
|
<div class="viewmain">${e}</div>
|
|
618
629
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
619
630
|
</div>` : n`<div class="view">${e}</div>`;
|
|
620
631
|
}
|
|
621
|
-
function
|
|
632
|
+
function B(a) {
|
|
622
633
|
if (!a.promoImage) return p;
|
|
623
634
|
const e = n`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
624
635
|
return n`<div class="promo">${a.promoHref ? n`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
625
636
|
}
|
|
626
|
-
function
|
|
627
|
-
const e =
|
|
637
|
+
function A(a) {
|
|
638
|
+
const e = de(a);
|
|
628
639
|
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
629
640
|
}
|
|
630
|
-
function
|
|
641
|
+
function ge(a, e, t) {
|
|
631
642
|
if (!e) return n`<span class="mut">·</span>`;
|
|
632
643
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
633
|
-
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${
|
|
644
|
+
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${x(e.date, { month: "numeric", day: "numeric" })} `}${r} ${L(a, s)}`;
|
|
634
645
|
}
|
|
635
|
-
class
|
|
646
|
+
class We extends $ {
|
|
636
647
|
static styles = P;
|
|
637
648
|
static properties = {
|
|
638
|
-
|
|
649
|
+
...$.properties,
|
|
639
650
|
sport: { type: String },
|
|
640
651
|
season: { type: String },
|
|
641
652
|
date: { type: String }
|
|
@@ -651,20 +662,20 @@ class Oe extends y {
|
|
|
651
662
|
this._datePinned = !!this.date;
|
|
652
663
|
}
|
|
653
664
|
async fetchData(e) {
|
|
654
|
-
const t = this.season || _(), [s, r, o,
|
|
665
|
+
const t = this.season || _(), [s, r, o, i, d] = await Promise.all([
|
|
655
666
|
e.listSchools(),
|
|
656
667
|
e.listTeams({ sport: this.sport }),
|
|
657
668
|
e.listConferences(),
|
|
658
669
|
e.listGames({ sport: this.sport, season: t }),
|
|
659
670
|
e.listRankings({ sport: this.sport })
|
|
660
671
|
]);
|
|
661
|
-
return this._datePinned || (this.date =
|
|
672
|
+
return this._datePinned || (this.date = Te(i.items.map((h) => h.date)), this._datePinned = !0), {
|
|
662
673
|
season: t,
|
|
663
674
|
schools: s.items,
|
|
664
675
|
teams: r.items,
|
|
665
676
|
conferences: o.items,
|
|
666
|
-
games:
|
|
667
|
-
rankings:
|
|
677
|
+
games: i.items,
|
|
678
|
+
rankings: d.items
|
|
668
679
|
};
|
|
669
680
|
}
|
|
670
681
|
get ctx() {
|
|
@@ -678,30 +689,30 @@ class Oe extends y {
|
|
|
678
689
|
}, this._ctxData = this.data), this._ctx;
|
|
679
690
|
}
|
|
680
691
|
renderView() {
|
|
681
|
-
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
682
|
-
const c = [
|
|
692
|
+
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((l) => l.date).filter(Boolean))].sort(), r = Number.MAX_SAFE_INTEGER, o = (l) => {
|
|
693
|
+
const c = [l.awayTeamId, l.homeTeamId].map((m) => Q(e.rankings, e.teamsById, m, this.sport, l.date)).filter(Boolean);
|
|
683
694
|
return c.length ? Math.min(...c) : r;
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
return
|
|
688
|
-
const c =
|
|
689
|
-
|
|
695
|
+
}, i = this.data.games.filter((l) => l.date === this.date), d = new Map(i.map((l) => [l, o(l)]));
|
|
696
|
+
i.sort((l, c) => (l.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || d.get(l) - d.get(c));
|
|
697
|
+
const h = /* @__PURE__ */ new Map();
|
|
698
|
+
return i.forEach((l) => {
|
|
699
|
+
const c = l.gameType === "conference" && l.conferenceId ? t[l.conferenceId]?.name || "Conference" : l.gameType === "playoff" ? "Playoffs" : l.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
700
|
+
h.has(c) || h.set(c, []), h.get(c).push(l);
|
|
690
701
|
}), n`
|
|
691
702
|
${j(this, e, {
|
|
692
|
-
title: n`${
|
|
693
|
-
sub: n`${
|
|
703
|
+
title: n`${k(this.sport)} scores & schedules`,
|
|
704
|
+
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${i.length} games`,
|
|
694
705
|
teams: this.data.teams
|
|
695
706
|
})}
|
|
696
|
-
${
|
|
697
|
-
${
|
|
707
|
+
${D(this, n`
|
|
708
|
+
${B(this)}
|
|
698
709
|
<div class="toolbar">
|
|
699
710
|
<label class="asof" for="datesel">Date</label>
|
|
700
|
-
<select id="datesel" @change=${(
|
|
701
|
-
this.date =
|
|
711
|
+
<select id="datesel" @change=${(l) => {
|
|
712
|
+
this.date = l.target.value;
|
|
702
713
|
}}>
|
|
703
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
704
|
-
${
|
|
714
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((l) => n`<option value=${l} ?selected=${l === this.date}>
|
|
715
|
+
${x(l, { weekday: "short", month: "short", day: "numeric" })}${l === V() ? " · today" : ""}
|
|
705
716
|
</option>`)}
|
|
706
717
|
</select>
|
|
707
718
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -713,11 +724,11 @@ class Oe extends y {
|
|
|
713
724
|
this.date = s[s.indexOf(this.date) + 1];
|
|
714
725
|
}}>Next →</button>
|
|
715
726
|
<span class="spacer"></span>
|
|
716
|
-
<span class="asof">Live games first · <a href=${
|
|
727
|
+
<span class="asof">Live games first · <a href=${ce(e.hrefs)}>report a score</a> to see it update here</span>
|
|
717
728
|
</div>
|
|
718
|
-
${
|
|
719
|
-
${[...
|
|
720
|
-
<div class="section-title">${
|
|
729
|
+
${i.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
730
|
+
${[...h.entries()].map(([l, c]) => n`
|
|
731
|
+
<div class="section-title">${l}</div>
|
|
721
732
|
<div class="card"><ul class="gamelist">
|
|
722
733
|
${c.map((m) => this.renderGame(e, m))}
|
|
723
734
|
</ul></div>
|
|
@@ -729,10 +740,10 @@ class Oe extends y {
|
|
|
729
740
|
// a lone score column on the far right read as detached from the teams).
|
|
730
741
|
// Scheduled games carry their start time on the status pill alone.
|
|
731
742
|
renderGame(e, t) {
|
|
732
|
-
const s = t.state === "final" || t.state === "live", r = (
|
|
743
|
+
const s = t.state === "final" || t.state === "live", r = (i, d, h = p) => n`<span class="side">${O(e, i, t.date)}${s ? n`<span class="score">${d}</span>` : p}${h}</span>`, o = He(t);
|
|
733
744
|
return n`
|
|
734
745
|
<li>
|
|
735
|
-
${
|
|
746
|
+
${A(t)}
|
|
736
747
|
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
737
748
|
${o ? n`<span class="ff">${F(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
738
749
|
<span class="where">${t.venue || ""}</span>
|
|
@@ -742,83 +753,115 @@ class Oe extends y {
|
|
|
742
753
|
`;
|
|
743
754
|
}
|
|
744
755
|
}
|
|
745
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
746
|
-
class
|
|
756
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", We);
|
|
757
|
+
class Ve extends $ {
|
|
747
758
|
static styles = P;
|
|
748
759
|
static properties = {
|
|
749
|
-
|
|
760
|
+
...$.properties,
|
|
750
761
|
sport: { type: String },
|
|
762
|
+
gender: { type: String },
|
|
751
763
|
season: { type: String },
|
|
752
764
|
classFilter: { state: !0 },
|
|
753
|
-
query: { state: !0 }
|
|
765
|
+
query: { state: !0 },
|
|
766
|
+
pickedGender: { state: !0 }
|
|
754
767
|
};
|
|
755
768
|
constructor() {
|
|
756
|
-
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
769
|
+
super(), this.sport = "football", this.gender = "", this.season = "", this.classFilter = "All", this.query = "", this.pickedGender = "";
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* The side the table shows: the pinned `gender`, else the reader's pick,
|
|
773
|
+
* else the first side fielded. '' only for a sport with one side, where
|
|
774
|
+
* there is nothing to scope.
|
|
775
|
+
*/
|
|
776
|
+
get viewGender() {
|
|
777
|
+
if (this.gender) return this.gender;
|
|
778
|
+
const e = q(this.data?.teams);
|
|
779
|
+
return e.length < 2 ? "" : e.includes(this.pickedGender) ? this.pickedGender : e[0];
|
|
757
780
|
}
|
|
758
781
|
async fetchData(e) {
|
|
759
|
-
const t = this.season || _(), [s, r, o,
|
|
782
|
+
const t = this.season || _(), [s, r, o, i, d] = await Promise.all([
|
|
760
783
|
e.listConferences({ active: !0 }),
|
|
761
784
|
e.listSchools(),
|
|
785
|
+
// Deliberately NOT gender-filtered: the sub-nav decides whether to
|
|
786
|
+
// offer Boys/Girls standings from the sides the sport fields, so it
|
|
787
|
+
// needs the whole sport. The table filters below.
|
|
762
788
|
e.listTeams({ sport: this.sport }),
|
|
789
|
+
// Games carry no gender (it lives on the team they are played by),
|
|
790
|
+
// so this stays the sport's season. Records key off team ids, and a
|
|
791
|
+
// team only appears in its own side's games.
|
|
763
792
|
e.listGames({ sport: this.sport, season: t }),
|
|
764
|
-
e.listRankings({ sport: this.sport })
|
|
793
|
+
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} })
|
|
765
794
|
]);
|
|
766
795
|
return {
|
|
767
796
|
season: t,
|
|
768
797
|
conferences: s.items,
|
|
769
798
|
schools: r.items,
|
|
770
799
|
teams: o.items,
|
|
771
|
-
games:
|
|
772
|
-
rankings:
|
|
800
|
+
games: i.items,
|
|
801
|
+
rankings: d.items
|
|
773
802
|
};
|
|
774
803
|
}
|
|
775
804
|
get ctx() {
|
|
776
|
-
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
805
|
+
return (!this._ctx || this._ctxData !== this.data || this._ctxGender !== this.viewGender) && (this._ctx = {
|
|
777
806
|
teamsById: b(this.data.teams),
|
|
778
807
|
schoolsById: b(this.data.schools),
|
|
779
808
|
records: N(this.data.games),
|
|
780
809
|
rankings: this.data.rankings,
|
|
781
810
|
hrefs: z(this),
|
|
782
|
-
sport: this.sport
|
|
783
|
-
|
|
811
|
+
sport: this.sport,
|
|
812
|
+
// The teams this view stands for — one side of a gendered
|
|
813
|
+
// sport, or all of them when the sport fields only one.
|
|
814
|
+
teams: me(this.data.teams, this.viewGender)
|
|
815
|
+
}, this._ctxData = this.data, this._ctxGender = this.viewGender), this._ctx;
|
|
784
816
|
}
|
|
785
817
|
renderView() {
|
|
786
|
-
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((
|
|
818
|
+
const e = this.ctx, t = this.viewGender, s = this.gender ? [] : q(this.data.teams), r = ["All", ...[...new Set(this.data.conferences.flatMap((i) => i.classifications || []))].sort(te)].slice(0, 9), o = this.data.conferences.filter((i) => i.active !== !1).filter((i) => this.classFilter === "All" || (i.classifications || []).includes(this.classFilter)).sort(De);
|
|
787
819
|
return n`
|
|
788
820
|
${j(this, e, {
|
|
789
|
-
title: n`${
|
|
821
|
+
title: n`${t ? `${k(t)} ` : ""}${k(this.sport)} standings`,
|
|
790
822
|
sub: n`${this.data.season} season · every conference, computed live from reported results`,
|
|
823
|
+
// The WHOLE sport, not this view's side: the sub-nav offers the
|
|
824
|
+
// Boys/Girls split only when both are fielded, and a
|
|
825
|
+
// gender-scoped list would always look like one side.
|
|
791
826
|
teams: this.data.teams
|
|
792
827
|
})}
|
|
793
|
-
${
|
|
794
|
-
${
|
|
828
|
+
${D(this, n`
|
|
829
|
+
${B(this)}
|
|
795
830
|
<div class="toolbar">
|
|
831
|
+
${s.length === 2 ? n`
|
|
832
|
+
<div role="group" aria-label="Boys or girls standings">
|
|
833
|
+
${s.map((i) => n`<button class="chip ${t === i ? "on" : ""}"
|
|
834
|
+
aria-pressed=${t === i ? "true" : "false"}
|
|
835
|
+
@click=${() => {
|
|
836
|
+
this.pickedGender = i;
|
|
837
|
+
}}>${k(i)}</button>`)}
|
|
838
|
+
</div>` : p}
|
|
796
839
|
<div role="group" aria-label="Classification filter">
|
|
797
|
-
${
|
|
840
|
+
${r.map((i) => n`<button class="chip ${this.classFilter === i ? "on" : ""}"
|
|
798
841
|
@click=${() => {
|
|
799
|
-
this.classFilter =
|
|
800
|
-
}}>${
|
|
842
|
+
this.classFilter = i;
|
|
843
|
+
}}>${i}</button>`)}
|
|
801
844
|
</div>
|
|
802
845
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
803
|
-
.value=${this.query} @input=${(
|
|
804
|
-
this.query =
|
|
846
|
+
.value=${this.query} @input=${(i) => {
|
|
847
|
+
this.query = i.target.value;
|
|
805
848
|
}}>
|
|
806
849
|
<span class="spacer"></span>
|
|
807
|
-
<span class="asof">Records through ${
|
|
850
|
+
<span class="asof">Records through ${x(V(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
808
851
|
</div>
|
|
809
|
-
${
|
|
852
|
+
${o.map((i) => this.renderConference(e, i))}
|
|
810
853
|
`)}
|
|
811
854
|
`;
|
|
812
855
|
}
|
|
813
856
|
renderConference(e, t) {
|
|
814
|
-
const s =
|
|
857
|
+
const s = e.teams.filter((i) => i.conferenceId === t.id);
|
|
815
858
|
if (!s.length) return p;
|
|
816
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
859
|
+
const r = this.query.trim().toLowerCase(), o = fe(s, e.records);
|
|
817
860
|
return n`
|
|
818
861
|
<div class="card">
|
|
819
862
|
<div class="card-head">
|
|
820
863
|
<h2>${t.name}</h2>
|
|
821
|
-
${[...t.classifications || []].sort(
|
|
864
|
+
${[...t.classifications || []].sort(te).map((i) => n`<span class="pill class">${i}</span>`)}
|
|
822
865
|
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
823
866
|
</div>
|
|
824
867
|
<div class="tablewrap"><table class="data">
|
|
@@ -828,43 +871,43 @@ class He extends y {
|
|
|
828
871
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
829
872
|
</tr></thead>
|
|
830
873
|
<tbody>
|
|
831
|
-
${o.map((
|
|
874
|
+
${o.map((i, d) => this.renderRow(e, i, d, r))}
|
|
832
875
|
</tbody>
|
|
833
876
|
</table></div>
|
|
834
877
|
</div>
|
|
835
878
|
`;
|
|
836
879
|
}
|
|
837
880
|
renderRow(e, t, s, r) {
|
|
838
|
-
const o = e.schoolsById[t.team.schoolId],
|
|
839
|
-
if (r && !
|
|
840
|
-
const
|
|
881
|
+
const o = e.schoolsById[t.team.schoolId], i = o?.name || t.team.name || "TBD";
|
|
882
|
+
if (r && !i.toLowerCase().includes(r)) return p;
|
|
883
|
+
const d = t.rec.pf - t.rec.pa, h = K(this.data.games, t.team.id), l = () => {
|
|
841
884
|
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
842
885
|
};
|
|
843
886
|
return n`
|
|
844
887
|
<tr class="rowlink" @click=${(c) => {
|
|
845
|
-
c.target.closest("a") ||
|
|
888
|
+
c.target.closest("a") || l();
|
|
846
889
|
}}>
|
|
847
890
|
<td class="mut">${s + 1}</td>
|
|
848
891
|
<td class="teamcell">
|
|
849
|
-
${
|
|
850
|
-
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${
|
|
892
|
+
${C(o)}${X(e, t.team.id, null)}
|
|
893
|
+
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${i}</a>
|
|
851
894
|
</td>
|
|
852
|
-
<td class="num">${
|
|
853
|
-
<td class="num">${
|
|
854
|
-
<td class="num">${
|
|
855
|
-
<td class="num">${
|
|
895
|
+
<td class="num">${S(t.rec, !0)}</td>
|
|
896
|
+
<td class="num">${ae(t.confPct)}</td>
|
|
897
|
+
<td class="num">${S(t.rec)}</td>
|
|
898
|
+
<td class="num">${ae(t.overallPct)}</td>
|
|
856
899
|
<td class="num">${t.rec.pf}</td>
|
|
857
900
|
<td class="num">${t.rec.pa}</td>
|
|
858
|
-
<td class="num" style="color:${
|
|
901
|
+
<td class="num" style="color:${d >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${d > 0 ? "+" : ""}${d}</td>
|
|
859
902
|
<td>${U(t.rec.results) || "·"}</td>
|
|
860
|
-
<td>${
|
|
861
|
-
<td>${
|
|
903
|
+
<td>${Z(e, t.team.id)}</td>
|
|
904
|
+
<td>${ge(e, h, t.team.id)}</td>
|
|
862
905
|
</tr>
|
|
863
906
|
`;
|
|
864
907
|
}
|
|
865
908
|
}
|
|
866
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
867
|
-
const
|
|
909
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", Ve);
|
|
910
|
+
const Ye = w`
|
|
868
911
|
.hero1 {
|
|
869
912
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
870
913
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -881,10 +924,10 @@ const Ue = $`
|
|
|
881
924
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
882
925
|
.sparkline { vertical-align: middle; }
|
|
883
926
|
`;
|
|
884
|
-
class
|
|
885
|
-
static styles = [...P,
|
|
927
|
+
class Ke extends $ {
|
|
928
|
+
static styles = [...P, Ye];
|
|
886
929
|
static properties = {
|
|
887
|
-
|
|
930
|
+
...$.properties,
|
|
888
931
|
sport: { type: String },
|
|
889
932
|
gender: { type: String },
|
|
890
933
|
season: { type: String },
|
|
@@ -899,20 +942,20 @@ class je extends y {
|
|
|
899
942
|
e && (this.pollDate = e);
|
|
900
943
|
}
|
|
901
944
|
async fetchData(e) {
|
|
902
|
-
const t = this.season || _(), [s, r, o,
|
|
945
|
+
const t = this.season || _(), [s, r, o, i, d] = await Promise.all([
|
|
903
946
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
904
947
|
e.listSchools(),
|
|
905
948
|
e.listTeams({ sport: this.sport }),
|
|
906
949
|
e.listConferences(),
|
|
907
950
|
e.listGames({ sport: this.sport, season: t })
|
|
908
|
-
]),
|
|
951
|
+
]), h = s.items.filter((l) => !this.gender || !l.gender || l.gender === this.gender).sort((l, c) => c.effectiveDate.localeCompare(l.effectiveDate));
|
|
909
952
|
return {
|
|
910
953
|
season: t,
|
|
911
|
-
polls:
|
|
954
|
+
polls: h,
|
|
912
955
|
schools: r.items,
|
|
913
956
|
teams: o.items,
|
|
914
|
-
conferences:
|
|
915
|
-
games:
|
|
957
|
+
conferences: i.items,
|
|
958
|
+
games: d.items
|
|
916
959
|
};
|
|
917
960
|
}
|
|
918
961
|
get ctx() {
|
|
@@ -926,46 +969,46 @@ class je extends y {
|
|
|
926
969
|
}, this._ctxData = this.data), this._ctx;
|
|
927
970
|
}
|
|
928
971
|
sparkline(e, t, s) {
|
|
929
|
-
const
|
|
972
|
+
const d = t.map((m, f) => {
|
|
930
973
|
const u = (m.teamIds || []).indexOf(e);
|
|
931
974
|
if (u === -1) return null;
|
|
932
|
-
const
|
|
933
|
-
return { x:
|
|
934
|
-
}),
|
|
935
|
-
let
|
|
936
|
-
if (
|
|
937
|
-
m ?
|
|
938
|
-
}),
|
|
939
|
-
const c =
|
|
975
|
+
const y = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, v = 3 + u / 24 * 20;
|
|
976
|
+
return { x: y, y: v };
|
|
977
|
+
}), h = [];
|
|
978
|
+
let l = [];
|
|
979
|
+
if (d.forEach((m) => {
|
|
980
|
+
m ? l.push(m) : l.length && (h.push(l), l = []);
|
|
981
|
+
}), l.length && h.push(l), !h.length) return p;
|
|
982
|
+
const c = d[s];
|
|
940
983
|
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
941
|
-
${
|
|
984
|
+
${h.map((m) => ee`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
942
985
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
943
|
-
${c ?
|
|
986
|
+
${c ? ee`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
944
987
|
</svg>`;
|
|
945
988
|
}
|
|
946
989
|
movement(e, t, s) {
|
|
947
|
-
const r =
|
|
990
|
+
const r = Ue(e, t, s);
|
|
948
991
|
return r.kind === "up" ? n`<span class="delta up">▲ ${r.delta}</span>` : r.kind === "down" ? n`<span class="delta down">▼ ${r.delta}</span>` : r.kind === "new" ? n`<span class="delta new">NEW</span>` : r.kind === "same" ? n`<span class="delta same">—</span>` : n`<span class="delta same">·</span>`;
|
|
949
992
|
}
|
|
950
993
|
renderView() {
|
|
951
994
|
const e = this.ctx, t = this.data.polls;
|
|
952
995
|
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
953
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null,
|
|
996
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, i = t.slice().reverse(), d = i.indexOf(r), h = b(this.data.conferences), l = (r.teamIds || [])[0], c = l ? T(e, l) : null;
|
|
954
997
|
return n`
|
|
955
998
|
${j(this, e, {
|
|
956
|
-
title: n`${
|
|
999
|
+
title: n`${k(this.sport)} Top 25`,
|
|
957
1000
|
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
958
1001
|
teams: this.data.teams
|
|
959
1002
|
})}
|
|
960
|
-
${
|
|
961
|
-
${
|
|
1003
|
+
${D(this, n`
|
|
1004
|
+
${B(this)}
|
|
962
1005
|
<div class="toolbar">
|
|
963
1006
|
<label class="asof" for="pollsel">Poll of</label>
|
|
964
1007
|
<select id="pollsel" @change=${(m) => {
|
|
965
1008
|
this.pollDate = m.target.value;
|
|
966
1009
|
}}>
|
|
967
1010
|
${t.map((m, f) => n`<option value=${m.effectiveDate} ?selected=${m === r}>
|
|
968
|
-
${
|
|
1011
|
+
${x(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
969
1012
|
</option>`)}
|
|
970
1013
|
</select>
|
|
971
1014
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -979,65 +1022,65 @@ class je extends y {
|
|
|
979
1022
|
<span class="spacer"></span>
|
|
980
1023
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
981
1024
|
</div>
|
|
982
|
-
${c ? this.renderHero(e, r, o,
|
|
1025
|
+
${c ? this.renderHero(e, r, o, l, c, h) : p}
|
|
983
1026
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
984
1027
|
<thead><tr>
|
|
985
1028
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
986
1029
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
987
1030
|
</tr></thead>
|
|
988
1031
|
<tbody>
|
|
989
|
-
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o,
|
|
1032
|
+
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o, i, d, h, m, f + 1))}
|
|
990
1033
|
</tbody>
|
|
991
1034
|
</table></div></div>
|
|
992
1035
|
<p class="note">Ranks elsewhere on the site resolve the poll in effect on the game date, so past box scores keep the ranks they were played under.</p>
|
|
993
1036
|
`)}
|
|
994
1037
|
`;
|
|
995
1038
|
}
|
|
996
|
-
renderHero(e, t, s, r, o,
|
|
997
|
-
const
|
|
1039
|
+
renderHero(e, t, s, r, o, i) {
|
|
1040
|
+
const d = e.records[r], h = re(e.records, r), l = i[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
998
1041
|
return n`
|
|
999
1042
|
<div class="hero1" style="background:${c}">
|
|
1000
1043
|
<div class="bigrank">#1</div>
|
|
1001
|
-
${
|
|
1044
|
+
${C(o, 64)}
|
|
1002
1045
|
<div>
|
|
1003
1046
|
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1004
1047
|
<div class="facts">
|
|
1005
|
-
${
|
|
1006
|
-
· streak ${U(
|
|
1007
|
-
${
|
|
1048
|
+
${S(d)} overall${l ? n` · ${S(d, !0)} ${l.name}` : p}
|
|
1049
|
+
· streak ${U(d?.results) || "·"}
|
|
1050
|
+
${h ? n` · last: ${h.mark} ${h.my}-${h.their} vs ${L(e, h.opp)}` : p}
|
|
1008
1051
|
${this.movement(t, s, r)}
|
|
1009
1052
|
</div>
|
|
1010
1053
|
</div>
|
|
1011
1054
|
</div>
|
|
1012
1055
|
`;
|
|
1013
1056
|
}
|
|
1014
|
-
renderRow(e, t, s, r, o,
|
|
1015
|
-
const
|
|
1016
|
-
if (!
|
|
1017
|
-
const c = e.records[
|
|
1018
|
-
location.href = g(e.hrefs.school, { id:
|
|
1057
|
+
renderRow(e, t, s, r, o, i, d, h) {
|
|
1058
|
+
const l = T(e, d);
|
|
1059
|
+
if (!l) return p;
|
|
1060
|
+
const c = e.records[d], m = re(e.records, d), f = K(this.data.games, d), u = i[e.teamsById[d]?.conferenceId], y = () => {
|
|
1061
|
+
location.href = g(e.hrefs.school, { id: l.id });
|
|
1019
1062
|
};
|
|
1020
1063
|
return n`
|
|
1021
|
-
<tr class="rowlink" @click=${(
|
|
1022
|
-
|
|
1064
|
+
<tr class="rowlink" @click=${(v) => {
|
|
1065
|
+
v.target.closest("a") || y();
|
|
1023
1066
|
}}>
|
|
1024
|
-
<td class="num" style="font-weight:700">${
|
|
1025
|
-
<td>${this.movement(t, s,
|
|
1026
|
-
<td class="teamcell">${
|
|
1027
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1028
|
-
<td class="num">${
|
|
1067
|
+
<td class="num" style="font-weight:700">${h}</td>
|
|
1068
|
+
<td>${this.movement(t, s, d)}</td>
|
|
1069
|
+
<td class="teamcell">${C(l)}<a href=${g(e.hrefs.school, { id: l.id })}>${l.name}</a>
|
|
1070
|
+
<span class="mut" style="font-size:0.78rem">${l.mascot || ""}</span></td>
|
|
1071
|
+
<td class="num">${S(c)}</td>
|
|
1029
1072
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
1030
1073
|
<td>${m ? n`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1031
1074
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1032
|
-
${m.my}-${m.their} vs ${
|
|
1033
|
-
<td>${
|
|
1034
|
-
<td>${this.sparkline(
|
|
1075
|
+
${m.my}-${m.their} vs ${L(e, m.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1076
|
+
<td>${ge(e, f, d)}</td>
|
|
1077
|
+
<td>${this.sparkline(d, r, o)}</td>
|
|
1035
1078
|
</tr>
|
|
1036
1079
|
`;
|
|
1037
1080
|
}
|
|
1038
1081
|
}
|
|
1039
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1040
|
-
const
|
|
1082
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", Ke);
|
|
1083
|
+
const Qe = w`
|
|
1041
1084
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1042
1085
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1043
1086
|
.schoolhero .crest {
|
|
@@ -1091,47 +1134,48 @@ const qe = $`
|
|
|
1091
1134
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1092
1135
|
}
|
|
1093
1136
|
`;
|
|
1094
|
-
class
|
|
1095
|
-
static styles = [...P,
|
|
1137
|
+
class Xe extends $ {
|
|
1138
|
+
static styles = [...P, Qe];
|
|
1096
1139
|
static properties = {
|
|
1097
|
-
|
|
1140
|
+
...$.properties,
|
|
1098
1141
|
schoolId: { type: String, attribute: "school-id" },
|
|
1099
1142
|
sport: { type: String },
|
|
1143
|
+
gender: { type: String },
|
|
1100
1144
|
season: { type: String },
|
|
1101
1145
|
activeTeamId: { state: !0 }
|
|
1102
1146
|
};
|
|
1103
1147
|
constructor() {
|
|
1104
|
-
super(), this.schoolId = "", this.sport = "", this.season = "", this.activeTeamId = "";
|
|
1148
|
+
super(), this.schoolId = "", this.sport = "", this.gender = "", this.season = "", this.activeTeamId = "";
|
|
1105
1149
|
}
|
|
1106
1150
|
connectedCallback() {
|
|
1107
1151
|
super.connectedCallback();
|
|
1108
|
-
const e = new URLSearchParams(globalThis.location?.search || "").get("sport");
|
|
1109
|
-
|
|
1152
|
+
const e = new URLSearchParams(globalThis.location?.search || ""), t = e.get("sport"), s = e.get("gender");
|
|
1153
|
+
t && !this.sport && (this.sport = t), s && !this.gender && (this.gender = s);
|
|
1110
1154
|
}
|
|
1111
1155
|
async fetchData(e) {
|
|
1112
|
-
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items,
|
|
1113
|
-
|
|
1114
|
-
|
|
1156
|
+
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football", d = o.find((v) => v.id === this.activeTeamId) || o.find((v) => v.sport === i && he(v, this.gender)) || o.find((v) => v.sport === i) || o[0] || null, [h, l, c, m, f, u, y] = await Promise.all([
|
|
1157
|
+
d ? e.listGames({ sport: d.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1158
|
+
d ? e.listTeams({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1115
1159
|
e.listSchools(),
|
|
1116
1160
|
e.listConferences(),
|
|
1117
|
-
|
|
1118
|
-
|
|
1161
|
+
d ? e.listRankings({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1162
|
+
d ? e.listRosters({ teamId: d.id }) : Promise.resolve({ items: [] }),
|
|
1119
1163
|
// teamId is the public surface's one players filter (roster
|
|
1120
1164
|
// membership) — never fetch the whole collection.
|
|
1121
|
-
|
|
1165
|
+
d ? e.listPlayers({ teamId: d.id }) : Promise.resolve({ items: [] })
|
|
1122
1166
|
]);
|
|
1123
1167
|
return {
|
|
1124
1168
|
season: t,
|
|
1125
1169
|
school: s,
|
|
1126
1170
|
teams: o,
|
|
1127
|
-
active:
|
|
1171
|
+
active: d,
|
|
1128
1172
|
games: h.items,
|
|
1129
|
-
allTeams:
|
|
1130
|
-
schools:
|
|
1131
|
-
conferences:
|
|
1132
|
-
rankings:
|
|
1133
|
-
roster:
|
|
1134
|
-
players:
|
|
1173
|
+
allTeams: l.items,
|
|
1174
|
+
schools: c.items,
|
|
1175
|
+
conferences: m.items,
|
|
1176
|
+
rankings: f.items,
|
|
1177
|
+
roster: u.items.find((v) => v.season === t) || null,
|
|
1178
|
+
players: y.items
|
|
1135
1179
|
};
|
|
1136
1180
|
}
|
|
1137
1181
|
get ctx() {
|
|
@@ -1144,24 +1188,29 @@ class We extends y {
|
|
|
1144
1188
|
sport: this.data.active?.sport || "football"
|
|
1145
1189
|
}, this._ctxData = this.data), this._ctx;
|
|
1146
1190
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1191
|
+
/**
|
|
1192
|
+
* Open a team's tab. The team id is what selects it — sport alone is
|
|
1193
|
+
* ambiguous on a gendered sport — with sport and gender kept in step so
|
|
1194
|
+
* the rest of the view and a shared ?sport=&gender= link agree with it.
|
|
1195
|
+
*/
|
|
1196
|
+
switchTeam(e) {
|
|
1197
|
+
e && (this.activeTeamId = e.id, this.sport = e.sport, this.gender = e.gender || "", this.load());
|
|
1149
1198
|
}
|
|
1150
1199
|
renderView() {
|
|
1151
1200
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1152
1201
|
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1153
|
-
const o = this.ctx,
|
|
1202
|
+
const o = this.ctx, i = G(e.colorPrimary || "#030711"), d = (e.adm || [])[0], h = b(this.data.conferences), l = s ? h[s.conferenceId] : null;
|
|
1154
1203
|
return n`
|
|
1155
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${
|
|
1204
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${i}">
|
|
1156
1205
|
<div class="inner">
|
|
1157
|
-
${
|
|
1206
|
+
${M(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${M(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${G(e.colorSecondary || "#7C7C7C")}">${Y(e)}</div>`}
|
|
1158
1207
|
<div style="min-width:260px">
|
|
1159
1208
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1160
1209
|
<div class="facts">
|
|
1161
1210
|
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1162
1211
|
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1163
|
-
${
|
|
1164
|
-
${
|
|
1212
|
+
${l ? n`<span><b>Conference</b>${l.name}</span>` : p}
|
|
1213
|
+
${d ? n`<span><b>Enrollment</b>${d.value.toLocaleString()} (${d.season} ADM)</span>` : p}
|
|
1165
1214
|
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1166
1215
|
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1167
1216
|
</div>
|
|
@@ -1170,29 +1219,29 @@ class We extends y {
|
|
|
1170
1219
|
</div>
|
|
1171
1220
|
<div class="band">
|
|
1172
1221
|
<nav class="tabs" aria-label="Teams">
|
|
1173
|
-
${t.map((c) => c.id === s?.id ? n`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : n`<a href="#" @click=${(m) => {
|
|
1174
|
-
m.preventDefault(), this.
|
|
1222
|
+
${t.map((c) => c.id === s?.id ? n`<a class="on" href="#" aria-current="page" @click=${(m) => m.preventDefault()}>${c.name}</a>` : n`<a href="#" @click=${(m) => {
|
|
1223
|
+
m.preventDefault(), this.switchTeam(c);
|
|
1175
1224
|
}}>${c.name}</a>`)}
|
|
1176
1225
|
</nav>
|
|
1177
1226
|
</div>
|
|
1178
|
-
${
|
|
1179
|
-
${
|
|
1180
|
-
${s ? this.renderTeam(o, s,
|
|
1227
|
+
${D(this, n`
|
|
1228
|
+
${B(this)}
|
|
1229
|
+
${s ? this.renderTeam(o, s, l, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1181
1230
|
`)}
|
|
1182
1231
|
`;
|
|
1183
1232
|
}
|
|
1184
1233
|
renderTeam(e, t, s, r) {
|
|
1185
|
-
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] },
|
|
1234
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, i = o.w + o.l + o.t, d = s ? me(this.data.allTeams.filter((m) => m.conferenceId === s.id), t.gender) : [], h = s ? fe(d, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, l = Q(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((m) => m.homeTeamId === t.id || m.awayTeamId === t.id).sort((m, f) => String(m.date).localeCompare(String(f.date)));
|
|
1186
1235
|
return n`
|
|
1187
1236
|
<div class="tiles">
|
|
1188
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1189
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1190
|
-
<div class="s">${
|
|
1191
|
-
<div class="tile"><div class="k">Points</div><div class="v">${
|
|
1192
|
-
<div class="s">scored per game · ${
|
|
1237
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${S(o)}</div><div class="s">${i} games played</div></div>
|
|
1238
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${S(o, !0)}</div>
|
|
1239
|
+
<div class="s">${h ? `${Ce(h)} of ${d.length}` : "·"}</div></div>
|
|
1240
|
+
<div class="tile"><div class="k">Points</div><div class="v">${i ? (o.pf / i).toFixed(1) : "0.0"}</div>
|
|
1241
|
+
<div class="s">scored per game · ${i ? (o.pa / i).toFixed(1) : "0.0"} allowed</div></div>
|
|
1193
1242
|
<div class="tile"><div class="k">Streak</div><div class="v">${U(o.results) || "·"}</div>
|
|
1194
|
-
<div class="s">last 5: ${
|
|
1195
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1243
|
+
<div class="s">last 5: ${Z(e, t.id)}</div></div>
|
|
1244
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${l ? `#${l}` : "NR"}</div>
|
|
1196
1245
|
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1197
1246
|
</div>
|
|
1198
1247
|
${(t.championships || []).length ? n`
|
|
@@ -1214,20 +1263,20 @@ class We extends y {
|
|
|
1214
1263
|
`;
|
|
1215
1264
|
}
|
|
1216
1265
|
renderGameRow(e, t, s) {
|
|
1217
|
-
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId,
|
|
1218
|
-
let
|
|
1266
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore, d = r ? s.awayScore : s.homeScore;
|
|
1267
|
+
let h = n`<span class="mut">${W(s.time)}</span>`;
|
|
1219
1268
|
if (s.state === "final") {
|
|
1220
1269
|
const c = H(s), m = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
|
|
1221
|
-
|
|
1222
|
-
} else s.state === "live" && (
|
|
1223
|
-
const
|
|
1270
|
+
h = n`<span class=${m}>${m}</span> ${i}-${d}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1271
|
+
} else s.state === "live" && (h = n`<span style="color:var(--hsot-red)">${i}-${d}</span>`);
|
|
1272
|
+
const l = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1224
1273
|
return n`
|
|
1225
1274
|
<li>
|
|
1226
|
-
<span class="d">${
|
|
1227
|
-
${
|
|
1228
|
-
<span class="res">${
|
|
1275
|
+
<span class="d">${x(s.date)}</span>
|
|
1276
|
+
${de(s).kind === "sched" ? p : A(s)}
|
|
1277
|
+
<span class="res">${h}</span>
|
|
1229
1278
|
<span class="opp">${r ? "vs" : "at"} ${O(e, o, s.date)}
|
|
1230
|
-
<span class="pill type">${
|
|
1279
|
+
<span class="pill type">${l}</span>
|
|
1231
1280
|
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1232
1281
|
</span>
|
|
1233
1282
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1239,25 +1288,25 @@ class We extends y {
|
|
|
1239
1288
|
const s = this.data.roster;
|
|
1240
1289
|
if (!s)
|
|
1241
1290
|
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1242
|
-
const r =
|
|
1291
|
+
const r = qe(s, 560), o = this.data.school?.name || "", i = b(this.data.players), d = s.entries.slice().sort((l, c) => (l.number || 0) - (c.number || 0)), h = d.some((l) => i[l.playerId]?.college);
|
|
1243
1292
|
return n`
|
|
1244
1293
|
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1245
1294
|
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1246
1295
|
<div class="tablewrap"><table class="data roster">
|
|
1247
|
-
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${
|
|
1296
|
+
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ? n`<th>College</th>` : p}</tr></thead>
|
|
1248
1297
|
<tbody>
|
|
1249
|
-
${
|
|
1250
|
-
const c = l
|
|
1298
|
+
${d.map((l) => {
|
|
1299
|
+
const c = i[l.playerId];
|
|
1251
1300
|
if (!c) return p;
|
|
1252
|
-
const m =
|
|
1301
|
+
const m = Ie(l), f = [m, c.classOf].filter(Boolean).join(" · ") || "·";
|
|
1253
1302
|
return n`<tr>
|
|
1254
|
-
<td class="num mut">${
|
|
1303
|
+
<td class="num mut">${l.number ?? "·"}</td>
|
|
1255
1304
|
<td class="player" style="font-weight:500">${c.firstName} ${c.lastName}<span class="sub">${f}</span></td>
|
|
1256
1305
|
<td class="pos">${m || "·"}</td>
|
|
1257
1306
|
<td class="cls mut">${c.classOf || "·"}</td>
|
|
1258
|
-
<td class="num">${
|
|
1307
|
+
<td class="num">${Se(c.heightIn)}</td>
|
|
1259
1308
|
<td class="num">${c.weightLb || "·"}</td>
|
|
1260
|
-
${
|
|
1309
|
+
${h ? n`<td class="college">${c.college || "·"}</td>` : p}
|
|
1261
1310
|
</tr>`;
|
|
1262
1311
|
})}
|
|
1263
1312
|
</tbody>
|
|
@@ -1265,8 +1314,8 @@ class We extends y {
|
|
|
1265
1314
|
`;
|
|
1266
1315
|
}
|
|
1267
1316
|
}
|
|
1268
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1269
|
-
const
|
|
1317
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Xe);
|
|
1318
|
+
const ve = {
|
|
1270
1319
|
football: ["quarters", 4],
|
|
1271
1320
|
flag_football: ["quarters", 4],
|
|
1272
1321
|
basketball: ["quarters", 4],
|
|
@@ -1277,57 +1326,57 @@ const fe = {
|
|
|
1277
1326
|
softball: ["innings", 7],
|
|
1278
1327
|
volleyball: ["sets", 3]
|
|
1279
1328
|
};
|
|
1280
|
-
function
|
|
1281
|
-
return (
|
|
1329
|
+
function be(a) {
|
|
1330
|
+
return (ve[a] || ["quarters", 4])[0];
|
|
1282
1331
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return (
|
|
1332
|
+
function J(a) {
|
|
1333
|
+
return (ve[a] || ["quarters", 4])[1];
|
|
1285
1334
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const t =
|
|
1335
|
+
function Ze(a, e) {
|
|
1336
|
+
const t = be(a), s = J(a);
|
|
1288
1337
|
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1289
1338
|
const r = e - s;
|
|
1290
1339
|
return `OT${r > 1 ? r : ""}`;
|
|
1291
1340
|
}
|
|
1292
|
-
function
|
|
1341
|
+
function Je(a, e) {
|
|
1293
1342
|
const t = String(a ?? "").trim();
|
|
1294
1343
|
let s;
|
|
1295
|
-
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ?
|
|
1344
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? be(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? J(e) + Number(s[1] || s[2] || 1) : (s = /^[TB](\d+)$/i.exec(t)) || (s = /^(\d+)(?:st|nd|rd|th)\s*set$/i.exec(t)) || (s = /^set\s*(\d+)$/i.exec(t)) ? Number(s[1]) : null;
|
|
1296
1345
|
}
|
|
1297
1346
|
const R = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1298
|
-
function
|
|
1347
|
+
function et(a) {
|
|
1299
1348
|
const e = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1300
1349
|
if (!e.length) return null;
|
|
1301
1350
|
const t = a.sport, s = /* @__PURE__ */ new Map();
|
|
1302
1351
|
for (const m of e) {
|
|
1303
|
-
const f =
|
|
1304
|
-
if (!f || u === null ||
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1352
|
+
const f = Je(m?.period, t), u = R(m?.homeScore), y = R(m?.awayScore);
|
|
1353
|
+
if (!f || u === null || y === null) return null;
|
|
1354
|
+
const v = s.get(f) || { home: 0, away: 0 };
|
|
1355
|
+
v.home = Math.max(v.home, u), v.away = Math.max(v.away, y), s.set(f, v);
|
|
1307
1356
|
}
|
|
1308
1357
|
const r = Math.max(...s.keys()), o = [];
|
|
1309
|
-
let
|
|
1358
|
+
let i = !0, d = { home: 0, away: 0 };
|
|
1310
1359
|
for (let m = 1; m <= r; m += 1) {
|
|
1311
|
-
const f = s.get(m) ||
|
|
1312
|
-
(u < 0 ||
|
|
1360
|
+
const f = s.get(m) || d, u = f.home - d.home, y = f.away - d.away;
|
|
1361
|
+
(u < 0 || y < 0) && (i = !1), o.push({ period: m, home: Math.max(u, 0), away: Math.max(y, 0) }), d = { home: Math.max(f.home, d.home), away: Math.max(f.away, d.away) };
|
|
1313
1362
|
}
|
|
1314
|
-
const
|
|
1315
|
-
return
|
|
1363
|
+
const h = R(a.homeScore) ?? 0, l = R(a.awayScore) ?? 0, c = i && d.home === h && d.away === l;
|
|
1364
|
+
return i = i && d.home <= h && d.away <= l, { periods: o, reconciled: c, consistent: i };
|
|
1316
1365
|
}
|
|
1317
|
-
function
|
|
1366
|
+
function tt(a) {
|
|
1318
1367
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1319
|
-
const e =
|
|
1368
|
+
const e = et(a);
|
|
1320
1369
|
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1321
1370
|
}
|
|
1322
|
-
const
|
|
1323
|
-
function
|
|
1371
|
+
const st = "https://api.wral.com/search";
|
|
1372
|
+
function at(a) {
|
|
1324
1373
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1325
1374
|
}
|
|
1326
|
-
function
|
|
1327
|
-
const t = String(a ||
|
|
1375
|
+
function rt(a, e) {
|
|
1376
|
+
const t = String(a || st).replace(/\/+$/, ""), s = new URLSearchParams({ query: at(e), sort: "score", lang: "en" });
|
|
1328
1377
|
return `${t}/v1/query?${s}`;
|
|
1329
1378
|
}
|
|
1330
|
-
function
|
|
1379
|
+
function ye(a) {
|
|
1331
1380
|
try {
|
|
1332
1381
|
const e = new URL(a);
|
|
1333
1382
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1342,13 +1391,13 @@ function ge(a) {
|
|
|
1342
1391
|
}
|
|
1343
1392
|
return { uri: a, title: a };
|
|
1344
1393
|
}
|
|
1345
|
-
async function
|
|
1346
|
-
const r = await ((...
|
|
1394
|
+
async function ot(a, e, t) {
|
|
1395
|
+
const r = await ((...d) => fetch(...d))(rt(a, e));
|
|
1347
1396
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1348
|
-
const o = await r.json(),
|
|
1349
|
-
return e.map((
|
|
1397
|
+
const o = await r.json(), i = new Map((o.items || []).map((d) => [d.uri, d]));
|
|
1398
|
+
return e.map((d) => i.get(d) || ye(d));
|
|
1350
1399
|
}
|
|
1351
|
-
const
|
|
1400
|
+
const nt = w`
|
|
1352
1401
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1353
1402
|
.breadcrumbs a { text-decoration: none; }
|
|
1354
1403
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1404,10 +1453,10 @@ const tt = $`
|
|
|
1404
1453
|
.cols { grid-template-columns: 1fr; }
|
|
1405
1454
|
}
|
|
1406
1455
|
`;
|
|
1407
|
-
class
|
|
1408
|
-
static styles = [...P,
|
|
1456
|
+
class it extends $ {
|
|
1457
|
+
static styles = [...P, nt];
|
|
1409
1458
|
static properties = {
|
|
1410
|
-
|
|
1459
|
+
...$.properties,
|
|
1411
1460
|
gameId: { type: String, attribute: "game-id" },
|
|
1412
1461
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1413
1462
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
@@ -1425,7 +1474,7 @@ class st extends y {
|
|
|
1425
1474
|
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1426
1475
|
}
|
|
1427
1476
|
async fetchData(e) {
|
|
1428
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o,
|
|
1477
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i, d, h, l] = await Promise.all([
|
|
1429
1478
|
e.listSchools(),
|
|
1430
1479
|
e.listTeams({ sport: t.sport }),
|
|
1431
1480
|
e.listConferences(),
|
|
@@ -1435,16 +1484,16 @@ class st extends y {
|
|
|
1435
1484
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1436
1485
|
// The embed drops the Coverage grid, so it skips the search
|
|
1437
1486
|
// round-trip entirely rather than fetching cards it will not render.
|
|
1438
|
-
s.length && !this.embed ?
|
|
1487
|
+
s.length && !this.embed ? ot(this.searchApi, s).catch(() => s.map(ye)) : Promise.resolve([])
|
|
1439
1488
|
]);
|
|
1440
1489
|
return {
|
|
1441
1490
|
game: t,
|
|
1442
1491
|
schools: r.items,
|
|
1443
1492
|
teams: o.items,
|
|
1444
|
-
conferences:
|
|
1445
|
-
rankings:
|
|
1446
|
-
games:
|
|
1447
|
-
coverage:
|
|
1493
|
+
conferences: i.items,
|
|
1494
|
+
rankings: d.items,
|
|
1495
|
+
games: h.items,
|
|
1496
|
+
coverage: l
|
|
1448
1497
|
};
|
|
1449
1498
|
}
|
|
1450
1499
|
get ctx() {
|
|
@@ -1460,13 +1509,13 @@ class st extends y {
|
|
|
1460
1509
|
renderView() {
|
|
1461
1510
|
const e = this.data.game;
|
|
1462
1511
|
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1463
|
-
const t = this.ctx, s = b(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null,
|
|
1512
|
+
const t = this.ctx, s = b(this.data.conferences), r = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, o = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, i = H(e), d = (c) => e.state === "final" && i !== c && i !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, l = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
|
|
1464
1513
|
return n`
|
|
1465
|
-
${
|
|
1466
|
-
${
|
|
1514
|
+
${D(this, n`
|
|
1515
|
+
${B(this)}
|
|
1467
1516
|
${this.embed ? p : n`
|
|
1468
1517
|
<p class="breadcrumbs">
|
|
1469
|
-
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${
|
|
1518
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${k(e.sport)}</a> /
|
|
1470
1519
|
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1471
1520
|
${F(t, e.awayTeamId)} at ${F(t, e.homeTeamId)}
|
|
1472
1521
|
</p>`}
|
|
@@ -1475,21 +1524,21 @@ class st extends y {
|
|
|
1475
1524
|
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1476
1525
|
<div class="mid">
|
|
1477
1526
|
<div class="bigscore">
|
|
1478
|
-
<span style=${
|
|
1527
|
+
<span style=${d("away")}>${e.awayScore}</span>
|
|
1479
1528
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1480
|
-
<span style=${
|
|
1529
|
+
<span style=${d("home")}>${e.homeScore}</span>
|
|
1481
1530
|
</div>
|
|
1482
|
-
<div class="status">${
|
|
1483
|
-
<div class="status">${
|
|
1531
|
+
<div class="status">${A(e)}</div>
|
|
1532
|
+
<div class="status">${x(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? n` · ${W(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1484
1533
|
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1485
1534
|
<div class="status">
|
|
1486
|
-
<span class="pill type">${e.gameType === "conference" ? `${
|
|
1535
|
+
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1487
1536
|
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1488
1537
|
${(e.tags || []).map((c) => n`<span class="pill type">${c}</span>`)}
|
|
1489
1538
|
</div>
|
|
1490
1539
|
${this.embed ? p : n`
|
|
1491
1540
|
<div class="status">
|
|
1492
|
-
<a href=${
|
|
1541
|
+
<a href=${ce(t.hrefs, e.id)}>Report a score for this game</a>
|
|
1493
1542
|
</div>`}
|
|
1494
1543
|
</div>
|
|
1495
1544
|
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
@@ -1522,11 +1571,11 @@ class st extends y {
|
|
|
1522
1571
|
<div class="cols">
|
|
1523
1572
|
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1524
1573
|
</div>
|
|
1525
|
-
${
|
|
1574
|
+
${l.length ? n`
|
|
1526
1575
|
<div class="section-title">Head to head this season</div>
|
|
1527
1576
|
<div class="card"><ul class="gamelist">
|
|
1528
|
-
${
|
|
1529
|
-
<span class="d">${
|
|
1577
|
+
${l.map((c) => n`<li>
|
|
1578
|
+
<span class="d">${x(c.date)}</span>${A(c)}
|
|
1530
1579
|
<span class="opp">${F(t, c.awayTeamId)} ${c.awayScore}, ${F(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1531
1580
|
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1532
1581
|
</li>`)}
|
|
@@ -1536,37 +1585,37 @@ class st extends y {
|
|
|
1536
1585
|
}
|
|
1537
1586
|
teamBlock(e, t, s, r, o) {
|
|
1538
1587
|
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1539
|
-
const
|
|
1588
|
+
const i = e.teamsById[s], d = e.records[s], h = M(r, 58);
|
|
1540
1589
|
return n`
|
|
1541
1590
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1542
|
-
${
|
|
1591
|
+
${h ? n`<img class="crest logo" alt="" loading="lazy" src=${h} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${G(r.colorPrimary || "#030711")}">${Y(r)}</span>`}
|
|
1543
1592
|
<div>
|
|
1544
|
-
<div class="tname">${
|
|
1545
|
-
<div class="trec">${r.mascot || ""} · ${
|
|
1593
|
+
<div class="tname">${X(e, s, t.date)}<a href=${g(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1594
|
+
<div class="trec">${r.mascot || ""} · ${S(d)}${i?.conferenceId ? n` · ${S(d, !0)} conf` : p}</div>
|
|
1546
1595
|
</div>
|
|
1547
1596
|
</div>
|
|
1548
1597
|
`;
|
|
1549
1598
|
}
|
|
1550
1599
|
renderLineScore(e, t, s) {
|
|
1551
|
-
const r =
|
|
1600
|
+
const r = tt(e);
|
|
1552
1601
|
if (!r)
|
|
1553
1602
|
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1554
|
-
const o = Math.max(
|
|
1603
|
+
const o = Math.max(J(e.sport), ...r.map((l) => l.period)), i = (l) => Ze(e.sport, l), d = (l, c) => {
|
|
1555
1604
|
const m = r.find((f) => f.period === c);
|
|
1556
|
-
return m ? m[
|
|
1557
|
-
},
|
|
1605
|
+
return m ? m[l] : e.state === "final" ? 0 : "·";
|
|
1606
|
+
}, h = (l, c, m) => n`
|
|
1558
1607
|
<tr>
|
|
1559
|
-
<td class="teamcell">${
|
|
1560
|
-
${Array.from({ length: o }, (f, u) => n`<td class="num">${
|
|
1608
|
+
<td class="teamcell">${C(l, 20)}${l?.abbr || "TBD"}</td>
|
|
1609
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${d(c, u + 1)}</td>`)}
|
|
1561
1610
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1562
1611
|
</tr>`;
|
|
1563
1612
|
return n`
|
|
1564
1613
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1565
1614
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1566
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
1615
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (l, c) => n`<th class="num">${i(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1567
1616
|
<tbody>
|
|
1568
|
-
${
|
|
1569
|
-
${
|
|
1617
|
+
${h(t, "away", e.awayScore)}
|
|
1618
|
+
${h(s, "home", e.homeScore)}
|
|
1570
1619
|
</tbody>
|
|
1571
1620
|
</table>
|
|
1572
1621
|
</div>
|
|
@@ -1575,7 +1624,7 @@ class st extends y {
|
|
|
1575
1624
|
renderScoringPlays(e, t, s) {
|
|
1576
1625
|
const r = Array.isArray(e.scoringPlays) ? e.scoringPlays : [];
|
|
1577
1626
|
if (!r.length) return p;
|
|
1578
|
-
const o = (
|
|
1627
|
+
const o = (i) => [i.period, i.clock].filter(Boolean).join(" ");
|
|
1579
1628
|
return n`
|
|
1580
1629
|
<div class="plays">
|
|
1581
1630
|
<div class="plays-title">Scoring plays</div>
|
|
@@ -1586,11 +1635,11 @@ class st extends y {
|
|
|
1586
1635
|
<th class="num">${t?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
1587
1636
|
</tr></thead>
|
|
1588
1637
|
<tbody>
|
|
1589
|
-
${r.map((
|
|
1590
|
-
<td class="when">${o(
|
|
1591
|
-
<td class="play">${
|
|
1592
|
-
<td class="num">${
|
|
1593
|
-
<td class="num">${
|
|
1638
|
+
${r.map((i) => n`<tr>
|
|
1639
|
+
<td class="when">${o(i) || "·"}</td>
|
|
1640
|
+
<td class="play">${i.description || "·"}</td>
|
|
1641
|
+
<td class="num">${i.awayScore}</td>
|
|
1642
|
+
<td class="num">${i.homeScore}</td>
|
|
1594
1643
|
</tr>`)}
|
|
1595
1644
|
</tbody>
|
|
1596
1645
|
</table>
|
|
@@ -1600,24 +1649,24 @@ class st extends y {
|
|
|
1600
1649
|
}
|
|
1601
1650
|
renderContext(e, t, s) {
|
|
1602
1651
|
if (!s) return p;
|
|
1603
|
-
const r = e.records[t], o =
|
|
1652
|
+
const r = e.records[t], o = K(this.data.games, t);
|
|
1604
1653
|
return n`
|
|
1605
1654
|
<div class="card ctxcard">
|
|
1606
|
-
<div class="who">${
|
|
1655
|
+
<div class="who">${C(s)}${s.name}</div>
|
|
1607
1656
|
<div class="row">
|
|
1608
|
-
<span>Last 5: ${
|
|
1657
|
+
<span>Last 5: ${Z(e, t)}</span>
|
|
1609
1658
|
<span>Streak: <b>${r ? U(r.results) : "·"}</b></span>
|
|
1610
1659
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1611
|
-
<span>Next: ${o ? n`${
|
|
1612
|
-
${o.homeTeamId === t ? "vs" : "at"} ${
|
|
1660
|
+
<span>Next: ${o ? n`${x(o.date, { month: "numeric", day: "numeric" })}
|
|
1661
|
+
${o.homeTeamId === t ? "vs" : "at"} ${L(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
1613
1662
|
</div>
|
|
1614
1663
|
</div>
|
|
1615
1664
|
`;
|
|
1616
1665
|
}
|
|
1617
1666
|
}
|
|
1618
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1619
|
-
const
|
|
1620
|
-
class
|
|
1667
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", it);
|
|
1668
|
+
const lt = 250, ct = 2;
|
|
1669
|
+
class dt extends le {
|
|
1621
1670
|
static properties = {
|
|
1622
1671
|
api: { type: String },
|
|
1623
1672
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1628,7 +1677,7 @@ class ot extends ie {
|
|
|
1628
1677
|
activeIndex: { state: !0 },
|
|
1629
1678
|
searched: { state: !0 }
|
|
1630
1679
|
};
|
|
1631
|
-
static styles =
|
|
1680
|
+
static styles = w`
|
|
1632
1681
|
:host {
|
|
1633
1682
|
display: block;
|
|
1634
1683
|
position: relative;
|
|
@@ -1697,11 +1746,11 @@ class ot extends ie {
|
|
|
1697
1746
|
}
|
|
1698
1747
|
onInput(e) {
|
|
1699
1748
|
const t = e.target.value.trim();
|
|
1700
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1749
|
+
if (clearTimeout(this.debounceTimer), t.length < ct) {
|
|
1701
1750
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1702
1751
|
return;
|
|
1703
1752
|
}
|
|
1704
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1753
|
+
this.debounceTimer = setTimeout(() => this.search(t), lt);
|
|
1705
1754
|
}
|
|
1706
1755
|
async search(e) {
|
|
1707
1756
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1794,37 +1843,37 @@ class ot extends ie {
|
|
|
1794
1843
|
`;
|
|
1795
1844
|
}
|
|
1796
1845
|
}
|
|
1797
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1798
|
-
function
|
|
1799
|
-
const t = new Map(a.map((
|
|
1800
|
-
for (const
|
|
1801
|
-
|
|
1802
|
-
const o = a.filter((
|
|
1803
|
-
function h
|
|
1804
|
-
const
|
|
1805
|
-
if (!
|
|
1806
|
-
const m = [...s.get(
|
|
1807
|
-
return { game:
|
|
1846
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", dt);
|
|
1847
|
+
function $e(a, e) {
|
|
1848
|
+
const t = new Map(a.map((h) => [h.id, h])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1849
|
+
for (const h of e || [])
|
|
1850
|
+
h.outcome === "winner" && (s.has(h.targetGameId) || s.set(h.targetGameId, []), s.get(h.targetGameId).push(h), r.has(h.sourceGameId) || r.set(h.sourceGameId, []), r.get(h.sourceGameId).push(h));
|
|
1851
|
+
const o = a.filter((h) => !r.has(h.id)), i = (h) => h.targetSlot === "home" ? 0 : 1;
|
|
1852
|
+
function d(h) {
|
|
1853
|
+
const l = t.get(h);
|
|
1854
|
+
if (!l) return null;
|
|
1855
|
+
const m = [...s.get(h) || []].sort((f, u) => i(f) - i(u)).map((f) => d(f.sourceGameId)).filter(Boolean);
|
|
1856
|
+
return { game: l, children: m, bracketGroup: l.bracketGroup };
|
|
1808
1857
|
}
|
|
1809
|
-
return o.length === 1 ?
|
|
1858
|
+
return o.length === 1 ? d(o[0].id) : o.map((h) => d(h.id));
|
|
1810
1859
|
}
|
|
1811
|
-
function
|
|
1860
|
+
function we(a, e = [], t = 0) {
|
|
1812
1861
|
if (!a) return e;
|
|
1813
1862
|
e[t] || (e[t] = []), e[t].push(a.game);
|
|
1814
|
-
for (const s of a.children || [])
|
|
1863
|
+
for (const s of a.children || []) we(s, e, t + 1);
|
|
1815
1864
|
return e;
|
|
1816
1865
|
}
|
|
1817
|
-
const
|
|
1818
|
-
function
|
|
1819
|
-
const s =
|
|
1866
|
+
const ht = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
1867
|
+
function mt({ round: a, perGroup: e, groupCount: t = 1 }) {
|
|
1868
|
+
const s = ht(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - a;
|
|
1820
1869
|
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
1821
1870
|
}
|
|
1822
|
-
function
|
|
1871
|
+
function pt(a) {
|
|
1823
1872
|
if (!a || !a.length) return "setup";
|
|
1824
1873
|
const e = Math.max(...a.map((s) => s.round ?? 0)), t = a.filter((s) => (s.round ?? 0) === e);
|
|
1825
1874
|
return t.length && t.every((s) => s.state === "final") ? "complete" : a.some((s) => s.state !== "scheduled" || s.homeScore || s.awayScore || s.round === 1 && (s.homeTeamId || s.awayTeamId)) ? "active" : "setup";
|
|
1826
1875
|
}
|
|
1827
|
-
function
|
|
1876
|
+
function ft(a, e) {
|
|
1828
1877
|
const t = a?.groupNames || [];
|
|
1829
1878
|
if (t.length >= 2) {
|
|
1830
1879
|
const r = t.map((o) => ({ key: o, name: o }));
|
|
@@ -1833,72 +1882,72 @@ function ct(a, e) {
|
|
|
1833
1882
|
const s = [...new Set((e || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
1834
1883
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
1835
1884
|
}
|
|
1836
|
-
const
|
|
1885
|
+
const ut = (a, e) => e?.key == null ? [...a || []] : (a || []).filter((t) => t.bracketGroup === e.key), oe = (a) => {
|
|
1837
1886
|
const e = /(\d+)\s*$/.exec(a.label || "");
|
|
1838
1887
|
return e ? Number(e[1]) : 1 / 0;
|
|
1839
|
-
},
|
|
1840
|
-
function
|
|
1888
|
+
}, ne = (a, e) => oe(a) - oe(e) || String(a.id).localeCompare(String(e.id));
|
|
1889
|
+
function gt(a, e) {
|
|
1841
1890
|
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
1842
|
-
const t =
|
|
1891
|
+
const t = $e(a, e), s = /* @__PURE__ */ new Map();
|
|
1843
1892
|
for (const r of Array.isArray(t) ? t : [t]) {
|
|
1844
|
-
const o =
|
|
1845
|
-
o.forEach((
|
|
1893
|
+
const o = we(r), i = o.length - 1;
|
|
1894
|
+
o.forEach((d, h) => d.forEach((l) => s.set(l.id, i - h + 1)));
|
|
1846
1895
|
}
|
|
1847
1896
|
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
1848
1897
|
}
|
|
1849
|
-
function
|
|
1850
|
-
const s =
|
|
1898
|
+
function vt(a, e, t) {
|
|
1899
|
+
const s = ut(a, t);
|
|
1851
1900
|
if (!s.length) return [];
|
|
1852
|
-
const r =
|
|
1853
|
-
for (const
|
|
1854
|
-
const c = r(
|
|
1855
|
-
o.has(c) || o.set(c, []), o.get(c).push(
|
|
1856
|
-
}
|
|
1857
|
-
const
|
|
1858
|
-
for (const
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
let
|
|
1862
|
-
for (const
|
|
1863
|
-
let c = [...o.get(
|
|
1864
|
-
if (
|
|
1901
|
+
const r = gt(a || [], e || []), o = /* @__PURE__ */ new Map();
|
|
1902
|
+
for (const l of s) {
|
|
1903
|
+
const c = r(l);
|
|
1904
|
+
o.has(c) || o.set(c, []), o.get(c).push(l);
|
|
1905
|
+
}
|
|
1906
|
+
const i = /* @__PURE__ */ new Map();
|
|
1907
|
+
for (const l of e || [])
|
|
1908
|
+
l.outcome === "winner" && (i.has(l.targetGameId) || i.set(l.targetGameId, []), i.get(l.targetGameId).push(l.sourceGameId));
|
|
1909
|
+
const d = [];
|
|
1910
|
+
let h = null;
|
|
1911
|
+
for (const l of [...o.keys()].sort((c, m) => c - m)) {
|
|
1912
|
+
let c = [...o.get(l)];
|
|
1913
|
+
if (h) {
|
|
1865
1914
|
const m = (f) => {
|
|
1866
|
-
const u = (
|
|
1915
|
+
const u = (i.get(f.id) || []).map((y) => h.get(y)).filter((y) => y !== void 0);
|
|
1867
1916
|
return u.length ? Math.min(...u) : 1 / 0;
|
|
1868
1917
|
};
|
|
1869
|
-
c.sort((f, u) => m(f) - m(u) ||
|
|
1918
|
+
c.sort((f, u) => m(f) - m(u) || ne(f, u));
|
|
1870
1919
|
} else
|
|
1871
|
-
c.sort(
|
|
1872
|
-
|
|
1920
|
+
c.sort(ne);
|
|
1921
|
+
h = new Map(c.map((m, f) => [m.id, f])), d.push({ round: l, games: c });
|
|
1873
1922
|
}
|
|
1874
|
-
return
|
|
1923
|
+
return d;
|
|
1875
1924
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const s = a[`${e}TeamId`] || null, r = (t || []).find((
|
|
1925
|
+
function bt(a, e, t) {
|
|
1926
|
+
const s = a[`${e}TeamId`] || null, r = (t || []).find((i) => i.gameId === a.id && i.slot === e), o = a[`${e}Seed`] ?? r?.seed ?? null;
|
|
1878
1927
|
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
1879
1928
|
}
|
|
1880
|
-
function
|
|
1929
|
+
function xe(a) {
|
|
1881
1930
|
const e = H(a);
|
|
1882
1931
|
return e === "home" || e === "away" ? e : null;
|
|
1883
1932
|
}
|
|
1884
|
-
function
|
|
1885
|
-
const t =
|
|
1933
|
+
function yt(a, e) {
|
|
1934
|
+
const t = $e(a || [], e || []);
|
|
1886
1935
|
if (!t || Array.isArray(t)) return null;
|
|
1887
|
-
const s =
|
|
1936
|
+
const s = xe(t.game);
|
|
1888
1937
|
return s && t.game[`${s}TeamId`] || null;
|
|
1889
1938
|
}
|
|
1890
|
-
const
|
|
1891
|
-
function
|
|
1939
|
+
const ie = { active: 0, setup: 1, complete: 2 };
|
|
1940
|
+
function $t(a, { id: e, param: t } = {}) {
|
|
1892
1941
|
const s = a || [];
|
|
1893
1942
|
if (!s.length) return null;
|
|
1894
1943
|
for (const r of [e, t]) {
|
|
1895
1944
|
if (!r) continue;
|
|
1896
|
-
const o = s.find((
|
|
1945
|
+
const o = s.find((i) => i.id === r);
|
|
1897
1946
|
if (o) return o;
|
|
1898
1947
|
}
|
|
1899
|
-
return [...s].sort((r, o) => (
|
|
1948
|
+
return [...s].sort((r, o) => (ie[r.status] ?? 3) - (ie[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
1900
1949
|
}
|
|
1901
|
-
const
|
|
1950
|
+
const wt = w`
|
|
1902
1951
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
1903
1952
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
1904
1953
|
.roundhead {
|
|
@@ -1944,10 +1993,10 @@ const gt = $`
|
|
|
1944
1993
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
1945
1994
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
1946
1995
|
`;
|
|
1947
|
-
class
|
|
1948
|
-
static styles = [P,
|
|
1996
|
+
class xt extends $ {
|
|
1997
|
+
static styles = [P, wt];
|
|
1949
1998
|
static properties = {
|
|
1950
|
-
|
|
1999
|
+
...$.properties,
|
|
1951
2000
|
sport: { type: String },
|
|
1952
2001
|
season: { type: String },
|
|
1953
2002
|
tournamentId: { type: String, attribute: "tournament-id" },
|
|
@@ -1958,9 +2007,9 @@ class vt extends y {
|
|
|
1958
2007
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
1959
2008
|
}
|
|
1960
2009
|
async fetchData(e) {
|
|
1961
|
-
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o =
|
|
2010
|
+
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = $t(s, { id: this.picked || this.tournamentId, param: r });
|
|
1962
2011
|
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
1963
|
-
const [
|
|
2012
|
+
const [i, d, h, l, c] = await Promise.all([
|
|
1964
2013
|
e.listSeedings(o.id),
|
|
1965
2014
|
e.listEdges(o.id),
|
|
1966
2015
|
e.listGames({ tournamentId: o.id }),
|
|
@@ -1971,10 +2020,10 @@ class vt extends y {
|
|
|
1971
2020
|
season: t,
|
|
1972
2021
|
tournaments: s,
|
|
1973
2022
|
tournament: o,
|
|
1974
|
-
seedings:
|
|
1975
|
-
edges:
|
|
1976
|
-
games:
|
|
1977
|
-
schools:
|
|
2023
|
+
seedings: i.items,
|
|
2024
|
+
edges: d.items,
|
|
2025
|
+
games: h.items,
|
|
2026
|
+
schools: l.items,
|
|
1978
2027
|
teams: c.items
|
|
1979
2028
|
};
|
|
1980
2029
|
}
|
|
@@ -2002,20 +2051,20 @@ class vt extends y {
|
|
|
2002
2051
|
}
|
|
2003
2052
|
renderView() {
|
|
2004
2053
|
const e = this.data, t = this.ctx, s = j(this, t, {
|
|
2005
|
-
title: n`${
|
|
2054
|
+
title: n`${k(this.sport)} playoff brackets`,
|
|
2006
2055
|
sub: e.tournament ? n`${e.tournament.name} · ${e.season} season` : n`${e.season} season`,
|
|
2007
2056
|
teams: e.teams
|
|
2008
2057
|
});
|
|
2009
2058
|
if (!e.tournament)
|
|
2010
|
-
return n`${s}${
|
|
2011
|
-
${
|
|
2059
|
+
return n`${s}${D(this, n`
|
|
2060
|
+
${B(this)}
|
|
2012
2061
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2013
2062
|
`)}`;
|
|
2014
|
-
const r =
|
|
2063
|
+
const r = ft(e.tournament, e.games), o = r.find((m) => m.key === this.group) || r[0], i = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, d = (Number(e.tournament.size) || 0) / i, h = vt(e.games, e.edges, o), l = pt(e.games), c = yt(e.games, e.edges);
|
|
2015
2064
|
return n`
|
|
2016
2065
|
${s}
|
|
2017
|
-
${
|
|
2018
|
-
${
|
|
2066
|
+
${D(this, n`
|
|
2067
|
+
${B(this)}
|
|
2019
2068
|
<div class="toolbar">
|
|
2020
2069
|
${e.tournaments.length > 1 ? n`
|
|
2021
2070
|
<div role="group" aria-label="Tournament">
|
|
@@ -2031,16 +2080,16 @@ class vt extends y {
|
|
|
2031
2080
|
}}>${m.name}</button>`)}
|
|
2032
2081
|
</div>` : p}
|
|
2033
2082
|
<span class="spacer"></span>
|
|
2034
|
-
<span class="pill ${
|
|
2083
|
+
<span class="pill ${l === "complete" ? "final" : l === "active" ? "class" : "type"}">${l === "complete" ? "Complete" : l === "active" ? "In progress" : "Bracket set"}</span>
|
|
2035
2084
|
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2036
2085
|
</div>
|
|
2037
2086
|
${c ? n`<div class="champ"><span class="pill champ">Champion</span>
|
|
2038
|
-
${T(
|
|
2039
|
-
${
|
|
2087
|
+
${C(T(t, c), 26)}<span class="tname">${O(t, c)}</span></div>` : p}
|
|
2088
|
+
${h.length ? n`
|
|
2040
2089
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2041
|
-
${
|
|
2090
|
+
${h.map((m) => n`
|
|
2042
2091
|
<section class="round">
|
|
2043
|
-
<h3 class="roundhead">${
|
|
2092
|
+
<h3 class="roundhead">${mt({ round: m.round, perGroup: d, groupCount: i })}</h3>
|
|
2044
2093
|
<div class="games">${m.games.map((f) => this.renderMatchup(t, f))}</div>
|
|
2045
2094
|
</section>`)}
|
|
2046
2095
|
</div>` : n`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
@@ -2054,7 +2103,7 @@ class vt extends y {
|
|
|
2054
2103
|
${this.renderSlot(e, t, "home")}
|
|
2055
2104
|
${this.renderSlot(e, t, "away")}
|
|
2056
2105
|
<footer class="mfoot">
|
|
2057
|
-
${
|
|
2106
|
+
${A(t)}
|
|
2058
2107
|
${t.label ? n`<span class="label">${t.label}</span>` : p}
|
|
2059
2108
|
<span class="spacer"></span>
|
|
2060
2109
|
${s ? n`<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : p}
|
|
@@ -2063,40 +2112,40 @@ class vt extends y {
|
|
|
2063
2112
|
`;
|
|
2064
2113
|
}
|
|
2065
2114
|
renderSlot(e, t, s) {
|
|
2066
|
-
const { teamId: r, seed: o, bye:
|
|
2115
|
+
const { teamId: r, seed: o, bye: i } = bt(t, s, this.data.seedings), d = xe(t), h = t.state === "live" || t.state === "final";
|
|
2067
2116
|
return n`
|
|
2068
|
-
<div class="slot ${
|
|
2117
|
+
<div class="slot ${d ? d === s ? "winner" : "loser" : ""}">
|
|
2069
2118
|
<span class="seed">${o ?? ""}</span>
|
|
2070
|
-
${r ? n`${T(
|
|
2071
|
-
${
|
|
2119
|
+
${r ? n`${C(T(e, r), 22)}<span class="tname">${O(e, r, t.date)}</span>` : i ? n`<span class="tname bye">Bye</span>` : n`<span class="tname mut">TBD</span>`}
|
|
2120
|
+
${h ? n`<span class="score">${t[`${s}Score`] ?? 0}</span>` : p}
|
|
2072
2121
|
</div>
|
|
2073
2122
|
`;
|
|
2074
2123
|
}
|
|
2075
2124
|
}
|
|
2076
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2125
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", xt);
|
|
2077
2126
|
export {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2127
|
+
E as D,
|
|
2128
|
+
it as H,
|
|
2129
|
+
xt as a,
|
|
2130
|
+
Ke as b,
|
|
2131
|
+
Xe as c,
|
|
2132
|
+
dt as d,
|
|
2133
|
+
We as e,
|
|
2134
|
+
Ve as f,
|
|
2135
|
+
ft as g,
|
|
2136
|
+
$e as h,
|
|
2137
|
+
yt as i,
|
|
2089
2138
|
N as j,
|
|
2090
|
-
|
|
2139
|
+
pt as k,
|
|
2091
2140
|
g as l,
|
|
2092
2141
|
H as m,
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2142
|
+
It as n,
|
|
2143
|
+
mt as o,
|
|
2144
|
+
Ue as p,
|
|
2145
|
+
vt as q,
|
|
2146
|
+
S as r,
|
|
2147
|
+
fe as s,
|
|
2099
2148
|
U as t,
|
|
2100
|
-
|
|
2101
|
-
|
|
2149
|
+
Q as u,
|
|
2150
|
+
we as v
|
|
2102
2151
|
};
|