@wral/hsot-data 0.4.0 → 0.5.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 +20 -4
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +759 -694
- package/dist/{hsot-brackets-Bqk0gI3J.js → hsot-brackets-D3mrvZfC.js} +507 -442
- 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 ce, html as n, css as $, nothing as p, svg as ee } from "lit";
|
|
2
|
+
import { createClient as Be } from "./client.mjs";
|
|
3
|
+
const P = {
|
|
4
4
|
game: "/{sport}/game/{id}/",
|
|
5
5
|
school: "/school/{id}/",
|
|
6
6
|
section: "/{sport}/{view}/",
|
|
@@ -13,14 +13,14 @@ 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") || P.game,
|
|
17
|
+
school: a.getAttribute("school-href") || P.school,
|
|
18
|
+
section: a.getAttribute("section-href") || P.section,
|
|
19
|
+
report: a.getAttribute("report-href") || P.report
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t = g(a.report ||
|
|
22
|
+
function de(a, e = "") {
|
|
23
|
+
const t = g(a.report || P.report, { id: e || "" });
|
|
24
24
|
return e ? t : t.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
25
25
|
}
|
|
26
26
|
const k = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
@@ -36,10 +36,10 @@ function W(a) {
|
|
|
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 De(a) {
|
|
40
40
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Fe(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()) {
|
|
@@ -50,7 +50,7 @@ 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 ze(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);
|
|
@@ -64,7 +64,7 @@ function G(a) {
|
|
|
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 Ae = (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
|
};
|
|
@@ -75,11 +75,11 @@ function te(a, e) {
|
|
|
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 he(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 me(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" };
|
|
@@ -90,19 +90,19 @@ function de(a) {
|
|
|
90
90
|
}
|
|
91
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
92
|
}
|
|
93
|
-
const
|
|
94
|
-
function
|
|
93
|
+
const Pe = ["boys", "girls"];
|
|
94
|
+
function pe(a, e) {
|
|
95
95
|
return e ? a ? a.gender === e || a.gender === "coed" : !1 : !0;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return e ? (a || []).filter((t) =>
|
|
97
|
+
function fe(a, e) {
|
|
98
|
+
return e ? (a || []).filter((t) => pe(t, e)) : a || [];
|
|
99
99
|
}
|
|
100
100
|
function q(a) {
|
|
101
101
|
const e = new Set((a || []).map((t) => t && t.gender));
|
|
102
|
-
return
|
|
102
|
+
return Pe.filter((t) => e.has(t));
|
|
103
103
|
}
|
|
104
|
-
const
|
|
105
|
-
function
|
|
104
|
+
const Ee = (a) => q(a).length === 2, _e = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
105
|
+
function S(a) {
|
|
106
106
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
107
107
|
const t = e.indexOf("#");
|
|
108
108
|
let s = "";
|
|
@@ -110,26 +110,26 @@ function I(a) {
|
|
|
110
110
|
let r = e.split("?")[0] + s;
|
|
111
111
|
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function ue() {
|
|
114
114
|
const a = globalThis.location;
|
|
115
115
|
if (!a) return "";
|
|
116
116
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
117
|
-
return
|
|
117
|
+
return S((a.pathname || "") + e);
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Re(a, e, t) {
|
|
120
120
|
if (!t) return null;
|
|
121
|
-
const s =
|
|
121
|
+
const s = S(a);
|
|
122
122
|
if (!s) return null;
|
|
123
|
-
const r =
|
|
123
|
+
const r = S(g(e.game, { sport: t, id: "" })), o = S(g(e.school, { id: "" }));
|
|
124
124
|
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
125
|
-
const i =
|
|
125
|
+
const i = S(g(e.section, { sport: t, view: "" }));
|
|
126
126
|
if (s === i) return "";
|
|
127
127
|
if (!s.startsWith(`${i}/`)) return null;
|
|
128
|
-
const
|
|
129
|
-
return
|
|
128
|
+
const l = s.slice(i.length + 1), d = l.split("/");
|
|
129
|
+
return d.length > 2 || d.some((m) => !/^[a-z][a-z-]*$/.test(m)) || _e.has(d[0]) ? null : l;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const s = (o) => g(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r =
|
|
131
|
+
function Ne(a, e, t) {
|
|
132
|
+
const s = (o) => g(t.section, { sport: a, view: o }).replace(/([^:])\/{2,}/g, "$1/"), r = Ee(e) ? [
|
|
133
133
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
134
134
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
135
135
|
] : [{ label: "Standings", href: s("standings") }];
|
|
@@ -141,12 +141,12 @@ function Ee(a, e, t) {
|
|
|
141
141
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
142
142
|
];
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
const t =
|
|
144
|
+
function Ge(a, e = ue()) {
|
|
145
|
+
const t = S(e);
|
|
146
146
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
147
|
-
t &&
|
|
147
|
+
t && S(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
148
148
|
}
|
|
149
|
-
class
|
|
149
|
+
class w extends ce {
|
|
150
150
|
static properties = {
|
|
151
151
|
api: { type: String },
|
|
152
152
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -165,7 +165,7 @@ class $ extends le {
|
|
|
165
165
|
this._client = e, this.isConnected && this.load();
|
|
166
166
|
}
|
|
167
167
|
get client() {
|
|
168
|
-
return this._client ? this._client : this.api ?
|
|
168
|
+
return this._client ? this._client : this.api ? Be({ baseUrl: this.api }) : null;
|
|
169
169
|
}
|
|
170
170
|
connectedCallback() {
|
|
171
171
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -177,7 +177,7 @@ class $ extends le {
|
|
|
177
177
|
this.load();
|
|
178
178
|
}
|
|
179
179
|
updated(e) {
|
|
180
|
-
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(), Ge(this);
|
|
181
181
|
}
|
|
182
182
|
async load() {
|
|
183
183
|
const e = this.client;
|
|
@@ -212,7 +212,7 @@ class $ extends le {
|
|
|
212
212
|
return n``;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
215
|
+
const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Me = $`
|
|
216
216
|
:host {
|
|
217
217
|
--hsot-red: var(--color-red, #D1232A);
|
|
218
218
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -250,7 +250,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
250
250
|
outline-offset: 1px;
|
|
251
251
|
}
|
|
252
252
|
.mut { color: var(--hsot-gray-5); }
|
|
253
|
-
`,
|
|
253
|
+
`, Le = $`
|
|
254
254
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
255
255
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
256
256
|
.band h1, .band h2.bandtitle {
|
|
@@ -299,7 +299,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
299
299
|
@media (max-width: 720px) {
|
|
300
300
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
301
301
|
}
|
|
302
|
-
`,
|
|
302
|
+
`, Oe = $`
|
|
303
303
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
304
304
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
305
305
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -363,7 +363,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
363
363
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
364
364
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
365
365
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
366
|
-
`,
|
|
366
|
+
`, He = $`
|
|
367
367
|
.pill {
|
|
368
368
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
369
369
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -378,7 +378,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
378
378
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
379
379
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
380
380
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
381
|
-
`,
|
|
381
|
+
`, Ue = $`
|
|
382
382
|
.tablewrap { overflow-x: auto; }
|
|
383
383
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
384
384
|
table.data th {
|
|
@@ -396,7 +396,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
396
396
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
397
397
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
398
398
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
399
|
-
`,
|
|
399
|
+
`, je = $`
|
|
400
400
|
.swatch {
|
|
401
401
|
display: inline-flex; align-items: center; justify-content: center;
|
|
402
402
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -420,7 +420,7 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
420
420
|
.dot.W { background: var(--hsot-win); }
|
|
421
421
|
.dot.L { background: var(--hsot-loss); }
|
|
422
422
|
.dot.T { background: var(--hsot-tie); }
|
|
423
|
-
`,
|
|
423
|
+
`, qe = $`
|
|
424
424
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
425
425
|
.gamelist li {
|
|
426
426
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -470,24 +470,24 @@ const b = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), _e = w`
|
|
|
470
470
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
471
471
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
472
472
|
.gamelist a.box { font-size: 0.78rem; }
|
|
473
|
-
`,
|
|
473
|
+
`, A = [Me, Le, Oe, He, Ue, je, qe];
|
|
474
474
|
function H(a) {
|
|
475
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";
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function We(a) {
|
|
478
478
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function R(a, e) {
|
|
481
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)));
|
|
482
482
|
for (const o of r) {
|
|
483
|
-
const i = H(o),
|
|
484
|
-
for (const
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
487
|
-
const
|
|
488
|
-
|
|
483
|
+
const i = H(o), l = o.gameType === "conference";
|
|
484
|
+
for (const d of ["home", "away"]) {
|
|
485
|
+
const m = d === "home" ? o.homeTeamId : o.awayTeamId;
|
|
486
|
+
if (!m) continue;
|
|
487
|
+
const h = s(m), c = d === "home" ? o.homeScore : o.awayScore, f = d === "home" ? o.awayScore : o.homeScore;
|
|
488
|
+
h.pf += c, h.pa += f;
|
|
489
489
|
let u = "T";
|
|
490
|
-
i === "tie" ? (
|
|
490
|
+
i === "tie" ? (h.t += 1, l && (h.ct += 1)) : i === d ? (h.w += 1, l && (h.cw += 1), u = "W") : (h.l += 1, l && (h.cl += 1), u = "L"), h.results.push({ gameId: o.id, date: o.date, mark: u, my: c, their: f, opp: d === "home" ? o.awayTeamId : o.homeTeamId, conf: l });
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
return t;
|
|
@@ -503,12 +503,12 @@ const se = (a, e, t) => {
|
|
|
503
503
|
const s = a + e + t;
|
|
504
504
|
return s ? (a + t / 2) / s : 0;
|
|
505
505
|
}, ae = (a) => a.toFixed(3).replace("0.", ".");
|
|
506
|
-
function
|
|
506
|
+
function I(a, e = !1) {
|
|
507
507
|
if (!a) return "0-0";
|
|
508
508
|
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
509
509
|
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function ge(a, e) {
|
|
512
512
|
return a.map((t) => {
|
|
513
513
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
514
514
|
return { team: t, rec: s, confPct: se(s.cw, s.cl, s.ct), overallPct: se(s.w, s.l, s.t) };
|
|
@@ -521,7 +521,7 @@ function re(a, e) {
|
|
|
521
521
|
const t = a[e];
|
|
522
522
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function Nt(a, e, t, s = "") {
|
|
525
525
|
let r = null;
|
|
526
526
|
for (const o of a || [])
|
|
527
527
|
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
@@ -531,19 +531,19 @@ function Q(a, e, t, s, r) {
|
|
|
531
531
|
const o = e[t];
|
|
532
532
|
if (!o) return null;
|
|
533
533
|
const i = /* @__PURE__ */ new Map();
|
|
534
|
-
for (const
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
(!
|
|
534
|
+
for (const d of a || []) {
|
|
535
|
+
if (d.sport !== s || r && d.effectiveDate > r || d.gender && o.gender !== d.gender && o.gender !== "coed") continue;
|
|
536
|
+
const m = d.gender || "", h = i.get(m);
|
|
537
|
+
(!h || d.effectiveDate > h.effectiveDate) && i.set(m, d);
|
|
538
538
|
}
|
|
539
|
-
let
|
|
540
|
-
for (const
|
|
541
|
-
const
|
|
542
|
-
|
|
539
|
+
let l = null;
|
|
540
|
+
for (const d of i.values()) {
|
|
541
|
+
const m = (d.teamIds || []).indexOf(t);
|
|
542
|
+
m !== -1 && (!l || d.effectiveDate > l.effectiveDate) && (l = { poll: d, rank: m + 1 });
|
|
543
543
|
}
|
|
544
|
-
return
|
|
544
|
+
return l ? l.rank : null;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Ve(a, e, t) {
|
|
547
547
|
if (!a) return { kind: "none", delta: 0 };
|
|
548
548
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
549
549
|
if (!s) return { kind: "none", delta: 0 };
|
|
@@ -553,11 +553,11 @@ function Ue(a, e, t) {
|
|
|
553
553
|
const o = r - s;
|
|
554
554
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function Ye(a) {
|
|
557
557
|
return /^https?:\/\//i.test(String(a || ""));
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
if (!
|
|
559
|
+
function ve(a, { w: e, h: t } = {}) {
|
|
560
|
+
if (!Ye(a)) return "";
|
|
561
561
|
const s = [];
|
|
562
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");
|
|
563
563
|
const r = a.includes("?") ? "&" : "?";
|
|
@@ -565,25 +565,25 @@ function ue(a, { w: e, h: t } = {}) {
|
|
|
565
565
|
}
|
|
566
566
|
function M(a, e) {
|
|
567
567
|
const t = e * 2;
|
|
568
|
-
return
|
|
568
|
+
return ve(a?.logoAssetId, { w: t, h: t });
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
return
|
|
570
|
+
function Ke(a, e) {
|
|
571
|
+
return ve(a?.photoAssetId, { w: e * 2 });
|
|
572
572
|
}
|
|
573
573
|
function j(a, e, { title: t, sub: s, teams: r }) {
|
|
574
|
-
const o =
|
|
574
|
+
const o = ue(), l = !!a.querySelector(':scope > a[slot="nav"]') || Re(o, e.hrefs, e.sport) !== null;
|
|
575
575
|
return n`
|
|
576
576
|
<div class="band section">
|
|
577
577
|
<div class="inner">
|
|
578
578
|
<h1>${t}</h1>
|
|
579
579
|
${s ? n`<p class="sub">${s}</p>` : p}
|
|
580
580
|
</div>
|
|
581
|
-
${
|
|
581
|
+
${l ? n`
|
|
582
582
|
<nav class="sectionnav" aria-label="${k(e.sport)} section">
|
|
583
583
|
<div class="navrow">
|
|
584
584
|
<slot name="nav">
|
|
585
|
-
${
|
|
586
|
-
aria-current=${o &&
|
|
585
|
+
${Ne(e.sport, r, e.hrefs).map((d) => n`<a href=${d.href}
|
|
586
|
+
aria-current=${o && S(d.href) === o ? "page" : p}>${d.label}</a>`)}
|
|
587
587
|
</slot>
|
|
588
588
|
</div>
|
|
589
589
|
</nav>` : p}
|
|
@@ -605,15 +605,15 @@ function C(a, e = 26) {
|
|
|
605
605
|
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
606
606
|
>${Y(a)}</span>`;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Z(a, e, t) {
|
|
609
609
|
const s = Q(a.rankings, a.teamsById, e, a.sport, t);
|
|
610
610
|
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
611
611
|
}
|
|
612
612
|
function O(a, e, t) {
|
|
613
613
|
const s = T(a, e);
|
|
614
|
-
return s ? n`${
|
|
614
|
+
return s ? n`${Z(a, e, t)}<a href=${g(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function X(a, e, t = 5) {
|
|
617
617
|
const s = a.records[e];
|
|
618
618
|
if (!s || !s.results.length) return n`<span class="mut">·</span>`;
|
|
619
619
|
const r = s.results.slice(-1 * t);
|
|
@@ -623,96 +623,144 @@ function Z(a, e, t = 5) {
|
|
|
623
623
|
href=${g(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
624
624
|
</span>`;
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function B(a, e) {
|
|
627
627
|
return a.querySelector(':scope > [slot="rail"]') ? n`<div class="view withrail">
|
|
628
628
|
<div class="viewmain">${e}</div>
|
|
629
629
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
630
630
|
</div>` : n`<div class="view">${e}</div>`;
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function D(a) {
|
|
633
633
|
if (!a.promoImage) return p;
|
|
634
634
|
const e = n`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
635
635
|
return n`<div class="promo">${a.promoHref ? n`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
const e =
|
|
637
|
+
function E(a) {
|
|
638
|
+
const e = me(a);
|
|
639
639
|
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function be(a, e, t) {
|
|
642
642
|
if (!e) return n`<span class="mut">·</span>`;
|
|
643
643
|
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
644
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)}`;
|
|
645
645
|
}
|
|
646
|
-
|
|
647
|
-
|
|
646
|
+
const Qe = ["all", "conferences"], ye = "all", oe = (a) => Qe.includes(a) ? a : ye, $e = Number.MAX_SAFE_INTEGER, we = (a, e, t) => {
|
|
647
|
+
const s = a[t];
|
|
648
|
+
return s && e[s.schoolId] || null;
|
|
649
|
+
};
|
|
650
|
+
function Ze(a, e) {
|
|
651
|
+
const t = (a || []).map((s) => e[s.schoolId]?.areaCode).filter(Boolean);
|
|
652
|
+
return [...new Set(t)].sort();
|
|
653
|
+
}
|
|
654
|
+
function Xe(a, e, t, s) {
|
|
655
|
+
return e ? [a.awayTeamId, a.homeTeamId].some((r) => we(t, s, r)?.areaCode === e) : !0;
|
|
656
|
+
}
|
|
657
|
+
function Je(a, e, t, s) {
|
|
658
|
+
const r = (l) => we(t, s, l)?.name || "", o = (l, d) => !l - !d || he(l, d), i = new Map((a || []).map((l) => [l, {
|
|
659
|
+
rank: e(l) || $e,
|
|
660
|
+
away: r(l.awayTeamId),
|
|
661
|
+
home: r(l.homeTeamId)
|
|
662
|
+
}]));
|
|
663
|
+
return [...i.keys()].sort((l, d) => {
|
|
664
|
+
const m = i.get(l), h = i.get(d);
|
|
665
|
+
return m.rank - h.rank || o(m.away, h.away) || o(m.home, h.home) || String(l.time || "").localeCompare(String(d.time || ""));
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function et(a, e) {
|
|
669
|
+
const t = new Map((a || []).map((r) => [r, e(r) || $e])), s = (r) => r.state === "live" ? 0 : 1;
|
|
670
|
+
return [...t.keys()].sort((r, o) => s(r) - s(o) || t.get(r) - t.get(o));
|
|
671
|
+
}
|
|
672
|
+
function tt(a, e) {
|
|
673
|
+
return a.gameType === "conference" && a.conferenceId ? e[a.conferenceId]?.name || "Conference" : a.gameType === "playoff" ? "Playoffs" : a.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
674
|
+
}
|
|
675
|
+
function st(a, e) {
|
|
676
|
+
const t = /* @__PURE__ */ new Map();
|
|
677
|
+
return (a || []).forEach((s) => {
|
|
678
|
+
const r = tt(s, e);
|
|
679
|
+
t.has(r) || t.set(r, []), t.get(r).push(s);
|
|
680
|
+
}), t;
|
|
681
|
+
}
|
|
682
|
+
const at = $`
|
|
683
|
+
.toolbar.filters { gap: 0.5rem 1.1rem; }
|
|
684
|
+
.filters [role="group"] { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
|
|
685
|
+
.filters .asof { margin-right: 0.1rem; }
|
|
686
|
+
/* A phone can't fit the label and six chips on one line; the label takes
|
|
687
|
+
its own row so the chips stay together instead of stranding the last. */
|
|
688
|
+
@media (max-width: 480px) { .filters .asof { flex-basis: 100%; } }
|
|
689
|
+
`;
|
|
690
|
+
class rt extends w {
|
|
691
|
+
static styles = [...A, at];
|
|
648
692
|
static properties = {
|
|
649
|
-
|
|
693
|
+
...w.properties,
|
|
650
694
|
sport: { type: String },
|
|
651
695
|
season: { type: String },
|
|
652
|
-
date: { type: String }
|
|
696
|
+
date: { type: String },
|
|
697
|
+
view: { type: String },
|
|
698
|
+
areaCode: { type: String, attribute: "area-code" }
|
|
653
699
|
};
|
|
654
700
|
constructor() {
|
|
655
|
-
super(), this.sport = "football", this.season = "", this.date = "", this._datePinned = !1;
|
|
701
|
+
super(), this.sport = "football", this.season = "", this.date = "", this.view = "", this.areaCode = "", this._datePinned = !1;
|
|
656
702
|
}
|
|
657
703
|
connectedCallback() {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
this._datePinned = !!this.date;
|
|
704
|
+
super.connectedCallback();
|
|
705
|
+
const e = new URLSearchParams(globalThis.location?.search || "");
|
|
706
|
+
!this.date && e.get("date") && (this.date = e.get("date")), !this.view && e.get("view") && (this.view = e.get("view")), !this.areaCode && e.get("area") && (this.areaCode = e.get("area")), this._datePinned = !!this.date;
|
|
663
707
|
}
|
|
664
708
|
async fetchData(e) {
|
|
665
|
-
const t = this.season || _(), [s, r, o, i,
|
|
709
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
666
710
|
e.listSchools(),
|
|
667
711
|
e.listTeams({ sport: this.sport }),
|
|
668
712
|
e.listConferences(),
|
|
669
713
|
e.listGames({ sport: this.sport, season: t }),
|
|
670
714
|
e.listRankings({ sport: this.sport })
|
|
671
715
|
]);
|
|
672
|
-
return this._datePinned || (this.date =
|
|
716
|
+
return this._datePinned || (this.date = ze(i.items.map((d) => d.date)), this._datePinned = !0), {
|
|
673
717
|
season: t,
|
|
674
718
|
schools: s.items,
|
|
675
719
|
teams: r.items,
|
|
676
720
|
conferences: o.items,
|
|
677
721
|
games: i.items,
|
|
678
|
-
rankings:
|
|
722
|
+
rankings: l.items
|
|
679
723
|
};
|
|
680
724
|
}
|
|
681
725
|
get ctx() {
|
|
682
726
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
683
727
|
teamsById: b(this.data.teams),
|
|
684
728
|
schoolsById: b(this.data.schools),
|
|
685
|
-
records:
|
|
729
|
+
records: R(this.data.games),
|
|
686
730
|
rankings: this.data.rankings,
|
|
687
731
|
hrefs: z(this),
|
|
688
732
|
sport: this.sport
|
|
689
733
|
}, this._ctxData = this.data), this._ctx;
|
|
690
734
|
}
|
|
735
|
+
/** Pick a view or an area (null leaves it alone) and deep-link the result. */
|
|
736
|
+
pick({ view: e = null, area: t = null }) {
|
|
737
|
+
e !== null && (this.view = e), t !== null && (this.areaCode = t);
|
|
738
|
+
try {
|
|
739
|
+
const s = new URL(globalThis.location.href), r = (o, i, l) => i && i !== l ? s.searchParams.set(o, i) : s.searchParams.delete(o);
|
|
740
|
+
r("view", oe(this.view), ye), r("area", this.areaCode, ""), globalThis.history?.replaceState(null, "", s);
|
|
741
|
+
} catch {
|
|
742
|
+
}
|
|
743
|
+
}
|
|
691
744
|
renderView() {
|
|
692
|
-
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
693
|
-
const
|
|
694
|
-
return
|
|
695
|
-
},
|
|
696
|
-
|
|
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);
|
|
701
|
-
}), n`
|
|
745
|
+
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((c) => c.date).filter(Boolean))].sort(), r = oe(this.view), o = Ze(this.data.teams, e.schoolsById), i = o.includes(this.areaCode) ? this.areaCode : "", l = (c) => {
|
|
746
|
+
const f = [c.awayTeamId, c.homeTeamId].map((u) => Q(e.rankings, e.teamsById, u, this.sport, c.date)).filter(Boolean);
|
|
747
|
+
return f.length ? Math.min(...f) : null;
|
|
748
|
+
}, d = this.data.games.filter((c) => c.date === this.date), m = d.filter((c) => Xe(c, i, e.teamsById, e.schoolsById)), h = r === "conferences" ? st(et(m, l), t) : new Map(m.length ? [[i ? `All games · ${i}` : "All games", Je(m, l, e.teamsById, e.schoolsById)]] : []);
|
|
749
|
+
return n`
|
|
702
750
|
${j(this, e, {
|
|
703
751
|
title: n`${k(this.sport)} scores & schedules`,
|
|
704
|
-
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${
|
|
752
|
+
sub: n`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
705
753
|
teams: this.data.teams
|
|
706
754
|
})}
|
|
707
|
-
${
|
|
708
|
-
${
|
|
755
|
+
${B(this, n`
|
|
756
|
+
${D(this)}
|
|
709
757
|
<div class="toolbar">
|
|
710
758
|
<label class="asof" for="datesel">Date</label>
|
|
711
|
-
<select id="datesel" @change=${(
|
|
712
|
-
this.date =
|
|
759
|
+
<select id="datesel" @change=${(c) => {
|
|
760
|
+
this.date = c.target.value;
|
|
713
761
|
}}>
|
|
714
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
715
|
-
${x(
|
|
762
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((c) => n`<option value=${c} ?selected=${c === this.date}>
|
|
763
|
+
${x(c, { weekday: "short", month: "short", day: "numeric" })}${c === V() ? " · today" : ""}
|
|
716
764
|
</option>`)}
|
|
717
765
|
</select>
|
|
718
766
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -724,13 +772,30 @@ class We extends $ {
|
|
|
724
772
|
this.date = s[s.indexOf(this.date) + 1];
|
|
725
773
|
}}>Next →</button>
|
|
726
774
|
<span class="spacer"></span>
|
|
727
|
-
<span class="asof"
|
|
775
|
+
<span class="asof">${r === "conferences" ? "Live games first" : "Ranked matchups first, then A–Z by road team"}
|
|
776
|
+
· <a href=${de(e.hrefs)}>report a score</a> to see it update here</span>
|
|
777
|
+
</div>
|
|
778
|
+
<div class="toolbar filters">
|
|
779
|
+
<div role="group" aria-label="Scoreboard view">
|
|
780
|
+
${[["all", "All games"], ["conferences", "Conferences view"]].map(([c, f]) => n`<button
|
|
781
|
+
class="chip ${r === c ? "on" : ""}" aria-pressed=${r === c ? "true" : "false"}
|
|
782
|
+
@click=${() => this.pick({ view: c })}>${f}</button>`)}
|
|
783
|
+
</div>
|
|
784
|
+
${o.length ? n`
|
|
785
|
+
<div role="group" aria-label="Filter by area code">
|
|
786
|
+
<span class="asof">Area code</span>
|
|
787
|
+
${o.map((c) => n`<button class="chip ${i === c ? "on" : ""}"
|
|
788
|
+
aria-pressed=${i === c ? "true" : "false"}
|
|
789
|
+
@click=${() => this.pick({ area: i === c ? "" : c })}>${c}</button>`)}
|
|
790
|
+
</div>` : p}
|
|
728
791
|
</div>
|
|
729
|
-
${
|
|
730
|
-
${
|
|
731
|
-
<
|
|
792
|
+
${d.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
793
|
+
${d.length && !m.length ? n`<p class="empty">No ${this.sport} games in the ${i} area code on this date.
|
|
794
|
+
<button class="chip" @click=${() => this.pick({ area: "" })}>Every area</button></p>` : p}
|
|
795
|
+
${[...h.entries()].map(([c, f]) => n`
|
|
796
|
+
<div class="section-title">${c}</div>
|
|
732
797
|
<div class="card"><ul class="gamelist">
|
|
733
|
-
${
|
|
798
|
+
${f.map((u) => this.renderGame(e, u))}
|
|
734
799
|
</ul></div>
|
|
735
800
|
`)}
|
|
736
801
|
`)}
|
|
@@ -740,10 +805,10 @@ class We extends $ {
|
|
|
740
805
|
// a lone score column on the far right read as detached from the teams).
|
|
741
806
|
// Scheduled games carry their start time on the status pill alone.
|
|
742
807
|
renderGame(e, t) {
|
|
743
|
-
const s = t.state === "final" || t.state === "live", r = (i,
|
|
808
|
+
const s = t.state === "final" || t.state === "live", r = (i, l, d = p) => n`<span class="side">${O(e, i, t.date)}${s ? n`<span class="score">${l}</span>` : p}${d}</span>`, o = We(t);
|
|
744
809
|
return n`
|
|
745
810
|
<li>
|
|
746
|
-
${
|
|
811
|
+
${E(t)}
|
|
747
812
|
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
748
813
|
${o ? n`<span class="ff">${F(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
749
814
|
<span class="where">${t.venue || ""}</span>
|
|
@@ -753,11 +818,11 @@ class We extends $ {
|
|
|
753
818
|
`;
|
|
754
819
|
}
|
|
755
820
|
}
|
|
756
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
757
|
-
class
|
|
758
|
-
static styles =
|
|
821
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", rt);
|
|
822
|
+
class ot extends w {
|
|
823
|
+
static styles = A;
|
|
759
824
|
static properties = {
|
|
760
|
-
|
|
825
|
+
...w.properties,
|
|
761
826
|
sport: { type: String },
|
|
762
827
|
gender: { type: String },
|
|
763
828
|
season: { type: String },
|
|
@@ -779,7 +844,7 @@ class Ve extends $ {
|
|
|
779
844
|
return e.length < 2 ? "" : e.includes(this.pickedGender) ? this.pickedGender : e[0];
|
|
780
845
|
}
|
|
781
846
|
async fetchData(e) {
|
|
782
|
-
const t = this.season || _(), [s, r, o, i,
|
|
847
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
783
848
|
e.listConferences({ active: !0 }),
|
|
784
849
|
e.listSchools(),
|
|
785
850
|
// Deliberately NOT gender-filtered: the sub-nav decides whether to
|
|
@@ -798,24 +863,24 @@ class Ve extends $ {
|
|
|
798
863
|
schools: r.items,
|
|
799
864
|
teams: o.items,
|
|
800
865
|
games: i.items,
|
|
801
|
-
rankings:
|
|
866
|
+
rankings: l.items
|
|
802
867
|
};
|
|
803
868
|
}
|
|
804
869
|
get ctx() {
|
|
805
870
|
return (!this._ctx || this._ctxData !== this.data || this._ctxGender !== this.viewGender) && (this._ctx = {
|
|
806
871
|
teamsById: b(this.data.teams),
|
|
807
872
|
schoolsById: b(this.data.schools),
|
|
808
|
-
records:
|
|
873
|
+
records: R(this.data.games),
|
|
809
874
|
rankings: this.data.rankings,
|
|
810
875
|
hrefs: z(this),
|
|
811
876
|
sport: this.sport,
|
|
812
877
|
// The teams this view stands for — one side of a gendered
|
|
813
878
|
// sport, or all of them when the sport fields only one.
|
|
814
|
-
teams:
|
|
879
|
+
teams: fe(this.data.teams, this.viewGender)
|
|
815
880
|
}, this._ctxData = this.data, this._ctxGender = this.viewGender), this._ctx;
|
|
816
881
|
}
|
|
817
882
|
renderView() {
|
|
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(
|
|
883
|
+
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(he);
|
|
819
884
|
return n`
|
|
820
885
|
${j(this, e, {
|
|
821
886
|
title: n`${t ? `${k(t)} ` : ""}${k(this.sport)} standings`,
|
|
@@ -825,8 +890,8 @@ class Ve extends $ {
|
|
|
825
890
|
// gender-scoped list would always look like one side.
|
|
826
891
|
teams: this.data.teams
|
|
827
892
|
})}
|
|
828
|
-
${
|
|
829
|
-
${
|
|
893
|
+
${B(this, n`
|
|
894
|
+
${D(this)}
|
|
830
895
|
<div class="toolbar">
|
|
831
896
|
${s.length === 2 ? n`
|
|
832
897
|
<div role="group" aria-label="Boys or girls standings">
|
|
@@ -856,7 +921,7 @@ class Ve extends $ {
|
|
|
856
921
|
renderConference(e, t) {
|
|
857
922
|
const s = e.teams.filter((i) => i.conferenceId === t.id);
|
|
858
923
|
if (!s.length) return p;
|
|
859
|
-
const r = this.query.trim().toLowerCase(), o =
|
|
924
|
+
const r = this.query.trim().toLowerCase(), o = ge(s, e.records);
|
|
860
925
|
return n`
|
|
861
926
|
<div class="card">
|
|
862
927
|
<div class="card-head">
|
|
@@ -871,7 +936,7 @@ class Ve extends $ {
|
|
|
871
936
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
872
937
|
</tr></thead>
|
|
873
938
|
<tbody>
|
|
874
|
-
${o.map((i,
|
|
939
|
+
${o.map((i, l) => this.renderRow(e, i, l, r))}
|
|
875
940
|
</tbody>
|
|
876
941
|
</table></div>
|
|
877
942
|
</div>
|
|
@@ -880,34 +945,34 @@ class Ve extends $ {
|
|
|
880
945
|
renderRow(e, t, s, r) {
|
|
881
946
|
const o = e.schoolsById[t.team.schoolId], i = o?.name || t.team.name || "TBD";
|
|
882
947
|
if (r && !i.toLowerCase().includes(r)) return p;
|
|
883
|
-
const
|
|
948
|
+
const l = t.rec.pf - t.rec.pa, d = K(this.data.games, t.team.id), m = () => {
|
|
884
949
|
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
885
950
|
};
|
|
886
951
|
return n`
|
|
887
|
-
<tr class="rowlink" @click=${(
|
|
888
|
-
|
|
952
|
+
<tr class="rowlink" @click=${(h) => {
|
|
953
|
+
h.target.closest("a") || m();
|
|
889
954
|
}}>
|
|
890
955
|
<td class="mut">${s + 1}</td>
|
|
891
956
|
<td class="teamcell">
|
|
892
|
-
${C(o)}${
|
|
957
|
+
${C(o)}${Z(e, t.team.id, null)}
|
|
893
958
|
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${i}</a>
|
|
894
959
|
</td>
|
|
895
|
-
<td class="num">${
|
|
960
|
+
<td class="num">${I(t.rec, !0)}</td>
|
|
896
961
|
<td class="num">${ae(t.confPct)}</td>
|
|
897
|
-
<td class="num">${
|
|
962
|
+
<td class="num">${I(t.rec)}</td>
|
|
898
963
|
<td class="num">${ae(t.overallPct)}</td>
|
|
899
964
|
<td class="num">${t.rec.pf}</td>
|
|
900
965
|
<td class="num">${t.rec.pa}</td>
|
|
901
|
-
<td class="num" style="color:${
|
|
966
|
+
<td class="num" style="color:${l >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${l > 0 ? "+" : ""}${l}</td>
|
|
902
967
|
<td>${U(t.rec.results) || "·"}</td>
|
|
903
|
-
<td>${
|
|
904
|
-
<td>${
|
|
968
|
+
<td>${X(e, t.team.id)}</td>
|
|
969
|
+
<td>${be(e, d, t.team.id)}</td>
|
|
905
970
|
</tr>
|
|
906
971
|
`;
|
|
907
972
|
}
|
|
908
973
|
}
|
|
909
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
910
|
-
const
|
|
974
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ot);
|
|
975
|
+
const nt = $`
|
|
911
976
|
.hero1 {
|
|
912
977
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
913
978
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -924,10 +989,10 @@ const Ye = w`
|
|
|
924
989
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
925
990
|
.sparkline { vertical-align: middle; }
|
|
926
991
|
`;
|
|
927
|
-
class
|
|
928
|
-
static styles = [...
|
|
992
|
+
class it extends w {
|
|
993
|
+
static styles = [...A, nt];
|
|
929
994
|
static properties = {
|
|
930
|
-
|
|
995
|
+
...w.properties,
|
|
931
996
|
sport: { type: String },
|
|
932
997
|
gender: { type: String },
|
|
933
998
|
season: { type: String },
|
|
@@ -942,73 +1007,73 @@ class Ke extends $ {
|
|
|
942
1007
|
e && (this.pollDate = e);
|
|
943
1008
|
}
|
|
944
1009
|
async fetchData(e) {
|
|
945
|
-
const t = this.season || _(), [s, r, o, i,
|
|
1010
|
+
const t = this.season || _(), [s, r, o, i, l] = await Promise.all([
|
|
946
1011
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
947
1012
|
e.listSchools(),
|
|
948
1013
|
e.listTeams({ sport: this.sport }),
|
|
949
1014
|
e.listConferences(),
|
|
950
1015
|
e.listGames({ sport: this.sport, season: t })
|
|
951
|
-
]),
|
|
1016
|
+
]), d = s.items.filter((m) => !this.gender || !m.gender || m.gender === this.gender).sort((m, h) => h.effectiveDate.localeCompare(m.effectiveDate));
|
|
952
1017
|
return {
|
|
953
1018
|
season: t,
|
|
954
|
-
polls:
|
|
1019
|
+
polls: d,
|
|
955
1020
|
schools: r.items,
|
|
956
1021
|
teams: o.items,
|
|
957
1022
|
conferences: i.items,
|
|
958
|
-
games:
|
|
1023
|
+
games: l.items
|
|
959
1024
|
};
|
|
960
1025
|
}
|
|
961
1026
|
get ctx() {
|
|
962
1027
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
963
1028
|
teamsById: b(this.data.teams),
|
|
964
1029
|
schoolsById: b(this.data.schools),
|
|
965
|
-
records:
|
|
1030
|
+
records: R(this.data.games),
|
|
966
1031
|
rankings: this.data.polls,
|
|
967
1032
|
hrefs: z(this),
|
|
968
1033
|
sport: this.sport
|
|
969
1034
|
}, this._ctxData = this.data), this._ctx;
|
|
970
1035
|
}
|
|
971
1036
|
sparkline(e, t, s) {
|
|
972
|
-
const
|
|
973
|
-
const u = (
|
|
1037
|
+
const l = t.map((c, f) => {
|
|
1038
|
+
const u = (c.teamIds || []).indexOf(e);
|
|
974
1039
|
if (u === -1) return null;
|
|
975
1040
|
const y = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, v = 3 + u / 24 * 20;
|
|
976
1041
|
return { x: y, y: v };
|
|
977
|
-
}),
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
|
|
981
|
-
}),
|
|
982
|
-
const
|
|
1042
|
+
}), d = [];
|
|
1043
|
+
let m = [];
|
|
1044
|
+
if (l.forEach((c) => {
|
|
1045
|
+
c ? m.push(c) : m.length && (d.push(m), m = []);
|
|
1046
|
+
}), m.length && d.push(m), !d.length) return p;
|
|
1047
|
+
const h = l[s];
|
|
983
1048
|
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
984
|
-
${
|
|
985
|
-
points=${
|
|
986
|
-
${
|
|
1049
|
+
${d.map((c) => ee`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
1050
|
+
points=${c.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
1051
|
+
${h ? ee`<circle cx=${h.x.toFixed(1)} cy=${h.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
987
1052
|
</svg>`;
|
|
988
1053
|
}
|
|
989
1054
|
movement(e, t, s) {
|
|
990
|
-
const r =
|
|
1055
|
+
const r = Ve(e, t, s);
|
|
991
1056
|
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>`;
|
|
992
1057
|
}
|
|
993
1058
|
renderView() {
|
|
994
1059
|
const e = this.ctx, t = this.data.polls;
|
|
995
1060
|
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
996
|
-
const s = Math.max(0, t.findIndex((
|
|
1061
|
+
const s = Math.max(0, t.findIndex((c) => c.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, i = t.slice().reverse(), l = i.indexOf(r), d = b(this.data.conferences), m = (r.teamIds || [])[0], h = m ? T(e, m) : null;
|
|
997
1062
|
return n`
|
|
998
1063
|
${j(this, e, {
|
|
999
1064
|
title: n`${k(this.sport)} Top 25`,
|
|
1000
1065
|
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
1001
1066
|
teams: this.data.teams
|
|
1002
1067
|
})}
|
|
1003
|
-
${
|
|
1004
|
-
${
|
|
1068
|
+
${B(this, n`
|
|
1069
|
+
${D(this)}
|
|
1005
1070
|
<div class="toolbar">
|
|
1006
1071
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1007
|
-
<select id="pollsel" @change=${(
|
|
1008
|
-
this.pollDate =
|
|
1072
|
+
<select id="pollsel" @change=${(c) => {
|
|
1073
|
+
this.pollDate = c.target.value;
|
|
1009
1074
|
}}>
|
|
1010
|
-
${t.map((
|
|
1011
|
-
${x(
|
|
1075
|
+
${t.map((c, f) => n`<option value=${c.effectiveDate} ?selected=${c === r}>
|
|
1076
|
+
${x(c.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
1012
1077
|
</option>`)}
|
|
1013
1078
|
</select>
|
|
1014
1079
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -1022,14 +1087,14 @@ class Ke extends $ {
|
|
|
1022
1087
|
<span class="spacer"></span>
|
|
1023
1088
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1024
1089
|
</div>
|
|
1025
|
-
${
|
|
1090
|
+
${h ? this.renderHero(e, r, o, m, h, d) : p}
|
|
1026
1091
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1027
1092
|
<thead><tr>
|
|
1028
1093
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1029
1094
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1030
1095
|
</tr></thead>
|
|
1031
1096
|
<tbody>
|
|
1032
|
-
${(r.teamIds || []).map((
|
|
1097
|
+
${(r.teamIds || []).map((c, f) => f === 0 || !c ? p : this.renderRow(e, r, o, i, l, d, c, f + 1))}
|
|
1033
1098
|
</tbody>
|
|
1034
1099
|
</table></div></div>
|
|
1035
1100
|
<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>
|
|
@@ -1037,50 +1102,50 @@ class Ke extends $ {
|
|
|
1037
1102
|
`;
|
|
1038
1103
|
}
|
|
1039
1104
|
renderHero(e, t, s, r, o, i) {
|
|
1040
|
-
const
|
|
1105
|
+
const l = e.records[r], d = re(e.records, r), m = i[e.teamsById[r]?.conferenceId], h = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1041
1106
|
return n`
|
|
1042
|
-
<div class="hero1" style="background:${
|
|
1107
|
+
<div class="hero1" style="background:${h}">
|
|
1043
1108
|
<div class="bigrank">#1</div>
|
|
1044
1109
|
${C(o, 64)}
|
|
1045
1110
|
<div>
|
|
1046
1111
|
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1047
1112
|
<div class="facts">
|
|
1048
|
-
${
|
|
1049
|
-
· streak ${U(
|
|
1050
|
-
${
|
|
1113
|
+
${I(l)} overall${m ? n` · ${I(l, !0)} ${m.name}` : p}
|
|
1114
|
+
· streak ${U(l?.results) || "·"}
|
|
1115
|
+
${d ? n` · last: ${d.mark} ${d.my}-${d.their} vs ${L(e, d.opp)}` : p}
|
|
1051
1116
|
${this.movement(t, s, r)}
|
|
1052
1117
|
</div>
|
|
1053
1118
|
</div>
|
|
1054
1119
|
</div>
|
|
1055
1120
|
`;
|
|
1056
1121
|
}
|
|
1057
|
-
renderRow(e, t, s, r, o, i,
|
|
1058
|
-
const
|
|
1059
|
-
if (!
|
|
1060
|
-
const
|
|
1061
|
-
location.href = g(e.hrefs.school, { id:
|
|
1122
|
+
renderRow(e, t, s, r, o, i, l, d) {
|
|
1123
|
+
const m = T(e, l);
|
|
1124
|
+
if (!m) return p;
|
|
1125
|
+
const h = e.records[l], c = re(e.records, l), f = K(this.data.games, l), u = i[e.teamsById[l]?.conferenceId], y = () => {
|
|
1126
|
+
location.href = g(e.hrefs.school, { id: m.id });
|
|
1062
1127
|
};
|
|
1063
1128
|
return n`
|
|
1064
1129
|
<tr class="rowlink" @click=${(v) => {
|
|
1065
1130
|
v.target.closest("a") || y();
|
|
1066
1131
|
}}>
|
|
1067
|
-
<td class="num" style="font-weight:700">${
|
|
1068
|
-
<td>${this.movement(t, s,
|
|
1069
|
-
<td class="teamcell">${C(
|
|
1070
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1071
|
-
<td class="num">${
|
|
1132
|
+
<td class="num" style="font-weight:700">${d}</td>
|
|
1133
|
+
<td>${this.movement(t, s, l)}</td>
|
|
1134
|
+
<td class="teamcell">${C(m)}<a href=${g(e.hrefs.school, { id: m.id })}>${m.name}</a>
|
|
1135
|
+
<span class="mut" style="font-size:0.78rem">${m.mascot || ""}</span></td>
|
|
1136
|
+
<td class="num">${I(h)}</td>
|
|
1072
1137
|
<td class="mut">${u?.name || "Independent"}</td>
|
|
1073
|
-
<td>${
|
|
1074
|
-
<b style="color:${
|
|
1075
|
-
${
|
|
1076
|
-
<td>${
|
|
1077
|
-
<td>${this.sparkline(
|
|
1138
|
+
<td>${c ? n`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: c.gameId })}>
|
|
1139
|
+
<b style="color:${c.mark === "W" ? "var(--hsot-win)" : c.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${c.mark}</b>
|
|
1140
|
+
${c.my}-${c.their} vs ${L(e, c.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1141
|
+
<td>${be(e, f, l)}</td>
|
|
1142
|
+
<td>${this.sparkline(l, r, o)}</td>
|
|
1078
1143
|
</tr>
|
|
1079
1144
|
`;
|
|
1080
1145
|
}
|
|
1081
1146
|
}
|
|
1082
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1083
|
-
const
|
|
1147
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", it);
|
|
1148
|
+
const lt = $`
|
|
1084
1149
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1085
1150
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1086
1151
|
.schoolhero .crest {
|
|
@@ -1134,10 +1199,10 @@ const Qe = w`
|
|
|
1134
1199
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1135
1200
|
}
|
|
1136
1201
|
`;
|
|
1137
|
-
class
|
|
1138
|
-
static styles = [...
|
|
1202
|
+
class ct extends w {
|
|
1203
|
+
static styles = [...A, lt];
|
|
1139
1204
|
static properties = {
|
|
1140
|
-
|
|
1205
|
+
...w.properties,
|
|
1141
1206
|
schoolId: { type: String, attribute: "school-id" },
|
|
1142
1207
|
sport: { type: String },
|
|
1143
1208
|
gender: { type: String },
|
|
@@ -1153,26 +1218,26 @@ class Xe extends $ {
|
|
|
1153
1218
|
t && !this.sport && (this.sport = t), s && !this.gender && (this.gender = s);
|
|
1154
1219
|
}
|
|
1155
1220
|
async fetchData(e) {
|
|
1156
|
-
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football",
|
|
1157
|
-
|
|
1158
|
-
|
|
1221
|
+
const t = this.season || _(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, i = this.sport || "football", l = o.find((v) => v.id === this.activeTeamId) || o.find((v) => v.sport === i && pe(v, this.gender)) || o.find((v) => v.sport === i) || o[0] || null, [d, m, h, c, f, u, y] = await Promise.all([
|
|
1222
|
+
l ? e.listGames({ sport: l.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1223
|
+
l ? e.listTeams({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1159
1224
|
e.listSchools(),
|
|
1160
1225
|
e.listConferences(),
|
|
1161
|
-
|
|
1162
|
-
|
|
1226
|
+
l ? e.listRankings({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1227
|
+
l ? e.listRosters({ teamId: l.id }) : Promise.resolve({ items: [] }),
|
|
1163
1228
|
// teamId is the public surface's one players filter (roster
|
|
1164
1229
|
// membership) — never fetch the whole collection.
|
|
1165
|
-
|
|
1230
|
+
l ? e.listPlayers({ teamId: l.id }) : Promise.resolve({ items: [] })
|
|
1166
1231
|
]);
|
|
1167
1232
|
return {
|
|
1168
1233
|
season: t,
|
|
1169
1234
|
school: s,
|
|
1170
1235
|
teams: o,
|
|
1171
|
-
active:
|
|
1172
|
-
games:
|
|
1173
|
-
allTeams:
|
|
1174
|
-
schools:
|
|
1175
|
-
conferences:
|
|
1236
|
+
active: l,
|
|
1237
|
+
games: d.items,
|
|
1238
|
+
allTeams: m.items,
|
|
1239
|
+
schools: h.items,
|
|
1240
|
+
conferences: c.items,
|
|
1176
1241
|
rankings: f.items,
|
|
1177
1242
|
roster: u.items.find((v) => v.season === t) || null,
|
|
1178
1243
|
players: y.items
|
|
@@ -1182,7 +1247,7 @@ class Xe extends $ {
|
|
|
1182
1247
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1183
1248
|
teamsById: b(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1184
1249
|
schoolsById: b(this.data.schools),
|
|
1185
|
-
records:
|
|
1250
|
+
records: R(this.data.games),
|
|
1186
1251
|
rankings: this.data.rankings,
|
|
1187
1252
|
hrefs: z(this),
|
|
1188
1253
|
sport: this.data.active?.sport || "football"
|
|
@@ -1199,7 +1264,7 @@ class Xe extends $ {
|
|
|
1199
1264
|
renderView() {
|
|
1200
1265
|
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1201
1266
|
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1202
|
-
const o = this.ctx, i = G(e.colorPrimary || "#030711"),
|
|
1267
|
+
const o = this.ctx, i = G(e.colorPrimary || "#030711"), l = (e.adm || [])[0], d = b(this.data.conferences), m = s ? d[s.conferenceId] : null;
|
|
1203
1268
|
return n`
|
|
1204
1269
|
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${i}">
|
|
1205
1270
|
<div class="inner">
|
|
@@ -1209,8 +1274,8 @@ class Xe extends $ {
|
|
|
1209
1274
|
<div class="facts">
|
|
1210
1275
|
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1211
1276
|
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1212
|
-
${
|
|
1213
|
-
${
|
|
1277
|
+
${m ? n`<span><b>Conference</b>${m.name}</span>` : p}
|
|
1278
|
+
${l ? n`<span><b>Enrollment</b>${l.value.toLocaleString()} (${l.season} ADM)</span>` : p}
|
|
1214
1279
|
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1215
1280
|
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1216
1281
|
</div>
|
|
@@ -1219,40 +1284,40 @@ class Xe extends $ {
|
|
|
1219
1284
|
</div>
|
|
1220
1285
|
<div class="band">
|
|
1221
1286
|
<nav class="tabs" aria-label="Teams">
|
|
1222
|
-
${t.map((
|
|
1223
|
-
|
|
1224
|
-
}}>${
|
|
1287
|
+
${t.map((h) => h.id === s?.id ? n`<a class="on" href="#" aria-current="page" @click=${(c) => c.preventDefault()}>${h.name}</a>` : n`<a href="#" @click=${(c) => {
|
|
1288
|
+
c.preventDefault(), this.switchTeam(h);
|
|
1289
|
+
}}>${h.name}</a>`)}
|
|
1225
1290
|
</nav>
|
|
1226
1291
|
</div>
|
|
1227
|
-
${
|
|
1228
|
-
${
|
|
1229
|
-
${s ? this.renderTeam(o, s,
|
|
1292
|
+
${B(this, n`
|
|
1293
|
+
${D(this)}
|
|
1294
|
+
${s ? this.renderTeam(o, s, m, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1230
1295
|
`)}
|
|
1231
1296
|
`;
|
|
1232
1297
|
}
|
|
1233
1298
|
renderTeam(e, t, s, r) {
|
|
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,
|
|
1299
|
+
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, l = s ? fe(this.data.allTeams.filter((c) => c.conferenceId === s.id), t.gender) : [], d = s ? ge(l, e.records).findIndex((c) => c.team.id === t.id) + 1 : 0, m = Q(e.rankings, e.teamsById, t.id, t.sport, null), h = this.data.games.filter((c) => c.homeTeamId === t.id || c.awayTeamId === t.id).sort((c, f) => String(c.date).localeCompare(String(f.date)));
|
|
1235
1300
|
return n`
|
|
1236
1301
|
<div class="tiles">
|
|
1237
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1238
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1239
|
-
<div class="s">${
|
|
1302
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${I(o)}</div><div class="s">${i} games played</div></div>
|
|
1303
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${I(o, !0)}</div>
|
|
1304
|
+
<div class="s">${d ? `${Ae(d)} of ${l.length}` : "·"}</div></div>
|
|
1240
1305
|
<div class="tile"><div class="k">Points</div><div class="v">${i ? (o.pf / i).toFixed(1) : "0.0"}</div>
|
|
1241
1306
|
<div class="s">scored per game · ${i ? (o.pa / i).toFixed(1) : "0.0"} allowed</div></div>
|
|
1242
1307
|
<div class="tile"><div class="k">Streak</div><div class="v">${U(o.results) || "·"}</div>
|
|
1243
|
-
<div class="s">last 5: ${
|
|
1244
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1308
|
+
<div class="s">last 5: ${X(e, t.id)}</div></div>
|
|
1309
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${m ? `#${m}` : "NR"}</div>
|
|
1245
1310
|
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1246
1311
|
</div>
|
|
1247
1312
|
${(t.championships || []).length ? n`
|
|
1248
1313
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1249
|
-
${t.championships.map((
|
|
1314
|
+
${t.championships.map((c) => n`<span class="pill champ">★ ${c.season} ${c.title} champion${c.classification ? ` · ${c.classification}` : ""}${c.region ? ` · ${c.region}` : ""}</span>`)}
|
|
1250
1315
|
</div>` : p}
|
|
1251
1316
|
<div class="cols">
|
|
1252
1317
|
<div>
|
|
1253
1318
|
<div class="section-title">Schedule & results</div>
|
|
1254
1319
|
<div class="card">
|
|
1255
|
-
${
|
|
1320
|
+
${h.length ? n`<ul class="gamelist">${h.map((c) => this.renderGameRow(e, t, c))}</ul>` : n`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1256
1321
|
</div>
|
|
1257
1322
|
</div>
|
|
1258
1323
|
<div>
|
|
@@ -1263,20 +1328,20 @@ class Xe extends $ {
|
|
|
1263
1328
|
`;
|
|
1264
1329
|
}
|
|
1265
1330
|
renderGameRow(e, t, s) {
|
|
1266
|
-
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore,
|
|
1267
|
-
let
|
|
1331
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, i = r ? s.homeScore : s.awayScore, l = r ? s.awayScore : s.homeScore;
|
|
1332
|
+
let d = n`<span class="mut">${W(s.time)}</span>`;
|
|
1268
1333
|
if (s.state === "final") {
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1271
|
-
} else s.state === "live" && (
|
|
1272
|
-
const
|
|
1334
|
+
const h = H(s), c = h === "tie" ? "T" : h === (r ? "home" : "away") ? "W" : "L";
|
|
1335
|
+
d = n`<span class=${c}>${c}</span> ${i}-${l}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1336
|
+
} else s.state === "live" && (d = n`<span style="color:var(--hsot-red)">${i}-${l}</span>`);
|
|
1337
|
+
const m = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1273
1338
|
return n`
|
|
1274
1339
|
<li>
|
|
1275
1340
|
<span class="d">${x(s.date)}</span>
|
|
1276
|
-
${
|
|
1277
|
-
<span class="res">${
|
|
1341
|
+
${me(s).kind === "sched" ? p : E(s)}
|
|
1342
|
+
<span class="res">${d}</span>
|
|
1278
1343
|
<span class="opp">${r ? "vs" : "at"} ${O(e, o, s.date)}
|
|
1279
|
-
<span class="pill type">${
|
|
1344
|
+
<span class="pill type">${m}</span>
|
|
1280
1345
|
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1281
1346
|
</span>
|
|
1282
1347
|
<span class="where">${s.venue || ""}</span>
|
|
@@ -1288,25 +1353,25 @@ class Xe extends $ {
|
|
|
1288
1353
|
const s = this.data.roster;
|
|
1289
1354
|
if (!s)
|
|
1290
1355
|
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1291
|
-
const r =
|
|
1356
|
+
const r = Ke(s, 560), o = this.data.school?.name || "", i = b(this.data.players), l = s.entries.slice().sort((m, h) => (m.number || 0) - (h.number || 0)), d = l.some((m) => i[m.playerId]?.college);
|
|
1292
1357
|
return n`
|
|
1293
1358
|
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1294
1359
|
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1295
1360
|
<div class="tablewrap"><table class="data roster">
|
|
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>${
|
|
1361
|
+
<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>${d ? n`<th>College</th>` : p}</tr></thead>
|
|
1297
1362
|
<tbody>
|
|
1298
|
-
${
|
|
1299
|
-
const
|
|
1300
|
-
if (!
|
|
1301
|
-
const
|
|
1363
|
+
${l.map((m) => {
|
|
1364
|
+
const h = i[m.playerId];
|
|
1365
|
+
if (!h) return p;
|
|
1366
|
+
const c = Fe(m), f = [c, h.classOf].filter(Boolean).join(" · ") || "·";
|
|
1302
1367
|
return n`<tr>
|
|
1303
|
-
<td class="num mut">${
|
|
1304
|
-
<td class="player" style="font-weight:500">${
|
|
1305
|
-
<td class="pos">${
|
|
1306
|
-
<td class="cls mut">${
|
|
1307
|
-
<td class="num">${
|
|
1308
|
-
<td class="num">${
|
|
1309
|
-
${
|
|
1368
|
+
<td class="num mut">${m.number ?? "·"}</td>
|
|
1369
|
+
<td class="player" style="font-weight:500">${h.firstName} ${h.lastName}<span class="sub">${f}</span></td>
|
|
1370
|
+
<td class="pos">${c || "·"}</td>
|
|
1371
|
+
<td class="cls mut">${h.classOf || "·"}</td>
|
|
1372
|
+
<td class="num">${De(h.heightIn)}</td>
|
|
1373
|
+
<td class="num">${h.weightLb || "·"}</td>
|
|
1374
|
+
${d ? n`<td class="college">${h.college || "·"}</td>` : p}
|
|
1310
1375
|
</tr>`;
|
|
1311
1376
|
})}
|
|
1312
1377
|
</tbody>
|
|
@@ -1314,8 +1379,8 @@ class Xe extends $ {
|
|
|
1314
1379
|
`;
|
|
1315
1380
|
}
|
|
1316
1381
|
}
|
|
1317
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1318
|
-
const
|
|
1382
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", ct);
|
|
1383
|
+
const xe = {
|
|
1319
1384
|
football: ["quarters", 4],
|
|
1320
1385
|
flag_football: ["quarters", 4],
|
|
1321
1386
|
basketball: ["quarters", 4],
|
|
@@ -1326,57 +1391,57 @@ const ve = {
|
|
|
1326
1391
|
softball: ["innings", 7],
|
|
1327
1392
|
volleyball: ["sets", 3]
|
|
1328
1393
|
};
|
|
1329
|
-
function
|
|
1330
|
-
return (
|
|
1394
|
+
function ke(a) {
|
|
1395
|
+
return (xe[a] || ["quarters", 4])[0];
|
|
1331
1396
|
}
|
|
1332
1397
|
function J(a) {
|
|
1333
|
-
return (
|
|
1398
|
+
return (xe[a] || ["quarters", 4])[1];
|
|
1334
1399
|
}
|
|
1335
|
-
function
|
|
1336
|
-
const t =
|
|
1400
|
+
function dt(a, e) {
|
|
1401
|
+
const t = ke(a), s = J(a);
|
|
1337
1402
|
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1338
1403
|
const r = e - s;
|
|
1339
1404
|
return `OT${r > 1 ? r : ""}`;
|
|
1340
1405
|
}
|
|
1341
|
-
function
|
|
1406
|
+
function ht(a, e) {
|
|
1342
1407
|
const t = String(a ?? "").trim();
|
|
1343
1408
|
let s;
|
|
1344
|
-
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ?
|
|
1409
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? ke(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;
|
|
1345
1410
|
}
|
|
1346
|
-
const
|
|
1347
|
-
function
|
|
1411
|
+
const N = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1412
|
+
function mt(a) {
|
|
1348
1413
|
const e = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1349
1414
|
if (!e.length) return null;
|
|
1350
1415
|
const t = a.sport, s = /* @__PURE__ */ new Map();
|
|
1351
|
-
for (const
|
|
1352
|
-
const f =
|
|
1416
|
+
for (const c of e) {
|
|
1417
|
+
const f = ht(c?.period, t), u = N(c?.homeScore), y = N(c?.awayScore);
|
|
1353
1418
|
if (!f || u === null || y === null) return null;
|
|
1354
1419
|
const v = s.get(f) || { home: 0, away: 0 };
|
|
1355
1420
|
v.home = Math.max(v.home, u), v.away = Math.max(v.away, y), s.set(f, v);
|
|
1356
1421
|
}
|
|
1357
1422
|
const r = Math.max(...s.keys()), o = [];
|
|
1358
|
-
let i = !0,
|
|
1359
|
-
for (let
|
|
1360
|
-
const f = s.get(
|
|
1361
|
-
(u < 0 || y < 0) && (i = !1), o.push({ period:
|
|
1423
|
+
let i = !0, l = { home: 0, away: 0 };
|
|
1424
|
+
for (let c = 1; c <= r; c += 1) {
|
|
1425
|
+
const f = s.get(c) || l, u = f.home - l.home, y = f.away - l.away;
|
|
1426
|
+
(u < 0 || y < 0) && (i = !1), o.push({ period: c, home: Math.max(u, 0), away: Math.max(y, 0) }), l = { home: Math.max(f.home, l.home), away: Math.max(f.away, l.away) };
|
|
1362
1427
|
}
|
|
1363
|
-
const
|
|
1364
|
-
return i = i &&
|
|
1428
|
+
const d = N(a.homeScore) ?? 0, m = N(a.awayScore) ?? 0, h = i && l.home === d && l.away === m;
|
|
1429
|
+
return i = i && l.home <= d && l.away <= m, { periods: o, reconciled: h, consistent: i };
|
|
1365
1430
|
}
|
|
1366
|
-
function
|
|
1431
|
+
function pt(a) {
|
|
1367
1432
|
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1368
|
-
const e =
|
|
1433
|
+
const e = mt(a);
|
|
1369
1434
|
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1370
1435
|
}
|
|
1371
|
-
const
|
|
1372
|
-
function
|
|
1436
|
+
const ft = "https://api.wral.com/search";
|
|
1437
|
+
function ut(a) {
|
|
1373
1438
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1374
1439
|
}
|
|
1375
|
-
function
|
|
1376
|
-
const t = String(a ||
|
|
1440
|
+
function gt(a, e) {
|
|
1441
|
+
const t = String(a || ft).replace(/\/+$/, ""), s = new URLSearchParams({ query: ut(e), sort: "score", lang: "en" });
|
|
1377
1442
|
return `${t}/v1/query?${s}`;
|
|
1378
1443
|
}
|
|
1379
|
-
function
|
|
1444
|
+
function Ie(a) {
|
|
1380
1445
|
try {
|
|
1381
1446
|
const e = new URL(a);
|
|
1382
1447
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1391,13 +1456,13 @@ function ye(a) {
|
|
|
1391
1456
|
}
|
|
1392
1457
|
return { uri: a, title: a };
|
|
1393
1458
|
}
|
|
1394
|
-
async function
|
|
1395
|
-
const r = await ((...
|
|
1459
|
+
async function vt(a, e, t) {
|
|
1460
|
+
const r = await ((...l) => fetch(...l))(gt(a, e));
|
|
1396
1461
|
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1397
|
-
const o = await r.json(), i = new Map((o.items || []).map((
|
|
1398
|
-
return e.map((
|
|
1462
|
+
const o = await r.json(), i = new Map((o.items || []).map((l) => [l.uri, l]));
|
|
1463
|
+
return e.map((l) => i.get(l) || Ie(l));
|
|
1399
1464
|
}
|
|
1400
|
-
const
|
|
1465
|
+
const bt = $`
|
|
1401
1466
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1402
1467
|
.breadcrumbs a { text-decoration: none; }
|
|
1403
1468
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1453,10 +1518,10 @@ const nt = w`
|
|
|
1453
1518
|
.cols { grid-template-columns: 1fr; }
|
|
1454
1519
|
}
|
|
1455
1520
|
`;
|
|
1456
|
-
class
|
|
1457
|
-
static styles = [...
|
|
1521
|
+
class yt extends w {
|
|
1522
|
+
static styles = [...A, bt];
|
|
1458
1523
|
static properties = {
|
|
1459
|
-
|
|
1524
|
+
...w.properties,
|
|
1460
1525
|
gameId: { type: String, attribute: "game-id" },
|
|
1461
1526
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1462
1527
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
@@ -1474,7 +1539,7 @@ class it extends $ {
|
|
|
1474
1539
|
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
1475
1540
|
}
|
|
1476
1541
|
async fetchData(e) {
|
|
1477
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i,
|
|
1542
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, i, l, d, m] = await Promise.all([
|
|
1478
1543
|
e.listSchools(),
|
|
1479
1544
|
e.listTeams({ sport: t.sport }),
|
|
1480
1545
|
e.listConferences(),
|
|
@@ -1484,23 +1549,23 @@ class it extends $ {
|
|
|
1484
1549
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1485
1550
|
// The embed drops the Coverage grid, so it skips the search
|
|
1486
1551
|
// round-trip entirely rather than fetching cards it will not render.
|
|
1487
|
-
s.length && !this.embed ?
|
|
1552
|
+
s.length && !this.embed ? vt(this.searchApi, s).catch(() => s.map(Ie)) : Promise.resolve([])
|
|
1488
1553
|
]);
|
|
1489
1554
|
return {
|
|
1490
1555
|
game: t,
|
|
1491
1556
|
schools: r.items,
|
|
1492
1557
|
teams: o.items,
|
|
1493
1558
|
conferences: i.items,
|
|
1494
|
-
rankings:
|
|
1495
|
-
games:
|
|
1496
|
-
coverage:
|
|
1559
|
+
rankings: l.items,
|
|
1560
|
+
games: d.items,
|
|
1561
|
+
coverage: m
|
|
1497
1562
|
};
|
|
1498
1563
|
}
|
|
1499
1564
|
get ctx() {
|
|
1500
1565
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1501
1566
|
teamsById: b(this.data.teams),
|
|
1502
1567
|
schoolsById: b(this.data.schools),
|
|
1503
|
-
records:
|
|
1568
|
+
records: R(this.data.games),
|
|
1504
1569
|
rankings: this.data.rankings,
|
|
1505
1570
|
hrefs: z(this),
|
|
1506
1571
|
sport: this.data.game.sport
|
|
@@ -1509,10 +1574,10 @@ class it extends $ {
|
|
|
1509
1574
|
renderView() {
|
|
1510
1575
|
const e = this.data.game;
|
|
1511
1576
|
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
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),
|
|
1577
|
+
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), l = (h) => e.state === "final" && i !== h && i !== "tie" ? "opacity:0.45" : "", d = e.conferenceId ? s[e.conferenceId] : null, m = this.data.games.filter((h) => h.id !== e.id && h.state === "final" && h.gameType !== "scrimmage" && (h.homeTeamId === e.homeTeamId && h.awayTeamId === e.awayTeamId || h.homeTeamId === e.awayTeamId && h.awayTeamId === e.homeTeamId));
|
|
1513
1578
|
return n`
|
|
1514
|
-
${
|
|
1515
|
-
${
|
|
1579
|
+
${B(this, n`
|
|
1580
|
+
${D(this)}
|
|
1516
1581
|
${this.embed ? p : n`
|
|
1517
1582
|
<p class="breadcrumbs">
|
|
1518
1583
|
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${k(e.sport)}</a> /
|
|
@@ -1524,21 +1589,21 @@ class it extends $ {
|
|
|
1524
1589
|
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1525
1590
|
<div class="mid">
|
|
1526
1591
|
<div class="bigscore">
|
|
1527
|
-
<span style=${
|
|
1592
|
+
<span style=${l("away")}>${e.awayScore}</span>
|
|
1528
1593
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1529
|
-
<span style=${
|
|
1594
|
+
<span style=${l("home")}>${e.homeScore}</span>
|
|
1530
1595
|
</div>
|
|
1531
|
-
<div class="status">${
|
|
1596
|
+
<div class="status">${E(e)}</div>
|
|
1532
1597
|
<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"}
|
|
1533
1598
|
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1534
1599
|
<div class="status">
|
|
1535
|
-
<span class="pill type">${e.gameType === "conference" ? `${
|
|
1600
|
+
<span class="pill type">${e.gameType === "conference" ? `${d?.name || "Conference"} game` : e.gameType}</span>
|
|
1536
1601
|
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1537
|
-
${(e.tags || []).map((
|
|
1602
|
+
${(e.tags || []).map((h) => n`<span class="pill type">${h}</span>`)}
|
|
1538
1603
|
</div>
|
|
1539
1604
|
${this.embed ? p : n`
|
|
1540
1605
|
<div class="status">
|
|
1541
|
-
<a href=${
|
|
1606
|
+
<a href=${de(t.hrefs, e.id)}>Report a score for this game</a>
|
|
1542
1607
|
</div>`}
|
|
1543
1608
|
</div>
|
|
1544
1609
|
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
@@ -1554,14 +1619,14 @@ class it extends $ {
|
|
|
1554
1619
|
${(this.data.coverage || []).length ? n`
|
|
1555
1620
|
<div class="section-title">Coverage</div>
|
|
1556
1621
|
<div class="covgrid">
|
|
1557
|
-
${this.data.coverage.map((
|
|
1558
|
-
<a class="card covcard" href=${
|
|
1559
|
-
${
|
|
1622
|
+
${this.data.coverage.map((h) => n`
|
|
1623
|
+
<a class="card covcard" href=${h.uri}>
|
|
1624
|
+
${h.image ? n`<img class="covimg" src=${h.image} alt="" loading="lazy" />` : p}
|
|
1560
1625
|
<div class="covbody">
|
|
1561
|
-
<div class="covtitle">${
|
|
1562
|
-
${
|
|
1563
|
-
${
|
|
1564
|
-
<div class="covmeta">${[
|
|
1626
|
+
<div class="covtitle">${h.videoDuration ? n`<span class="pill live" style="animation:none">Video</span> ` : p}${h.photos ? n`<span class="pill live" style="animation:none">Photos</span> ` : p}${h.title || h.uri}</div>
|
|
1627
|
+
${h.description ? n`<p class="covdesc">${h.description}</p>` : p}
|
|
1628
|
+
${h.author || h.publishedTime ? n`
|
|
1629
|
+
<div class="covmeta">${[h.author, h.publishedTime ? new Date(h.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1565
1630
|
` : p}
|
|
1566
1631
|
</div>
|
|
1567
1632
|
</a>
|
|
@@ -1569,15 +1634,15 @@ class it extends $ {
|
|
|
1569
1634
|
</div>` : p}
|
|
1570
1635
|
<div class="section-title">Season context</div>
|
|
1571
1636
|
<div class="cols">
|
|
1572
|
-
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([
|
|
1637
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([h, c]) => this.renderContext(t, h, c))}
|
|
1573
1638
|
</div>
|
|
1574
|
-
${
|
|
1639
|
+
${m.length ? n`
|
|
1575
1640
|
<div class="section-title">Head to head this season</div>
|
|
1576
1641
|
<div class="card"><ul class="gamelist">
|
|
1577
|
-
${
|
|
1578
|
-
<span class="d">${x(
|
|
1579
|
-
<span class="opp">${F(t,
|
|
1580
|
-
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id:
|
|
1642
|
+
${m.map((h) => n`<li>
|
|
1643
|
+
<span class="d">${x(h.date)}</span>${E(h)}
|
|
1644
|
+
<span class="opp">${F(t, h.awayTeamId)} ${h.awayScore}, ${F(t, h.homeTeamId)} ${h.homeScore}</span>
|
|
1645
|
+
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: h.id })}>Box score →</a>
|
|
1581
1646
|
</li>`)}
|
|
1582
1647
|
</ul></div>` : p}`}
|
|
1583
1648
|
`)}
|
|
@@ -1585,37 +1650,37 @@ class it extends $ {
|
|
|
1585
1650
|
}
|
|
1586
1651
|
teamBlock(e, t, s, r, o) {
|
|
1587
1652
|
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1588
|
-
const i = e.teamsById[s],
|
|
1653
|
+
const i = e.teamsById[s], l = e.records[s], d = M(r, 58);
|
|
1589
1654
|
return n`
|
|
1590
1655
|
<div class="teamblock ${o ? "right" : ""}">
|
|
1591
|
-
${
|
|
1656
|
+
${d ? n`<img class="crest logo" alt="" loading="lazy" src=${d} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${G(r.colorPrimary || "#030711")}">${Y(r)}</span>`}
|
|
1592
1657
|
<div>
|
|
1593
|
-
<div class="tname">${
|
|
1594
|
-
<div class="trec">${r.mascot || ""} · ${
|
|
1658
|
+
<div class="tname">${Z(e, s, t.date)}<a href=${g(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1659
|
+
<div class="trec">${r.mascot || ""} · ${I(l)}${i?.conferenceId ? n` · ${I(l, !0)} conf` : p}</div>
|
|
1595
1660
|
</div>
|
|
1596
1661
|
</div>
|
|
1597
1662
|
`;
|
|
1598
1663
|
}
|
|
1599
1664
|
renderLineScore(e, t, s) {
|
|
1600
|
-
const r =
|
|
1665
|
+
const r = pt(e);
|
|
1601
1666
|
if (!r)
|
|
1602
1667
|
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1603
|
-
const o = Math.max(J(e.sport), ...r.map((
|
|
1604
|
-
const
|
|
1605
|
-
return
|
|
1606
|
-
},
|
|
1668
|
+
const o = Math.max(J(e.sport), ...r.map((m) => m.period)), i = (m) => dt(e.sport, m), l = (m, h) => {
|
|
1669
|
+
const c = r.find((f) => f.period === h);
|
|
1670
|
+
return c ? c[m] : e.state === "final" ? 0 : "·";
|
|
1671
|
+
}, d = (m, h, c) => n`
|
|
1607
1672
|
<tr>
|
|
1608
|
-
<td class="teamcell">${C(
|
|
1609
|
-
${Array.from({ length: o }, (f, u) => n`<td class="num">${
|
|
1610
|
-
<td class="num" style="font-weight:700">${
|
|
1673
|
+
<td class="teamcell">${C(m, 20)}${m?.abbr || "TBD"}</td>
|
|
1674
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${l(h, u + 1)}</td>`)}
|
|
1675
|
+
<td class="num" style="font-weight:700">${c}</td>
|
|
1611
1676
|
</tr>`;
|
|
1612
1677
|
return n`
|
|
1613
1678
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1614
1679
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1615
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
1680
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (m, h) => n`<th class="num">${i(h + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1616
1681
|
<tbody>
|
|
1617
|
-
${
|
|
1618
|
-
${
|
|
1682
|
+
${d(t, "away", e.awayScore)}
|
|
1683
|
+
${d(s, "home", e.homeScore)}
|
|
1619
1684
|
</tbody>
|
|
1620
1685
|
</table>
|
|
1621
1686
|
</div>
|
|
@@ -1654,7 +1719,7 @@ class it extends $ {
|
|
|
1654
1719
|
<div class="card ctxcard">
|
|
1655
1720
|
<div class="who">${C(s)}${s.name}</div>
|
|
1656
1721
|
<div class="row">
|
|
1657
|
-
<span>Last 5: ${
|
|
1722
|
+
<span>Last 5: ${X(e, t)}</span>
|
|
1658
1723
|
<span>Streak: <b>${r ? U(r.results) : "·"}</b></span>
|
|
1659
1724
|
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1660
1725
|
<span>Next: ${o ? n`${x(o.date, { month: "numeric", day: "numeric" })}
|
|
@@ -1664,9 +1729,9 @@ class it extends $ {
|
|
|
1664
1729
|
`;
|
|
1665
1730
|
}
|
|
1666
1731
|
}
|
|
1667
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1668
|
-
const
|
|
1669
|
-
class
|
|
1732
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", yt);
|
|
1733
|
+
const $t = 250, wt = 2;
|
|
1734
|
+
class xt extends ce {
|
|
1670
1735
|
static properties = {
|
|
1671
1736
|
api: { type: String },
|
|
1672
1737
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1677,7 +1742,7 @@ class dt extends le {
|
|
|
1677
1742
|
activeIndex: { state: !0 },
|
|
1678
1743
|
searched: { state: !0 }
|
|
1679
1744
|
};
|
|
1680
|
-
static styles =
|
|
1745
|
+
static styles = $`
|
|
1681
1746
|
:host {
|
|
1682
1747
|
display: block;
|
|
1683
1748
|
position: relative;
|
|
@@ -1746,11 +1811,11 @@ class dt extends le {
|
|
|
1746
1811
|
}
|
|
1747
1812
|
onInput(e) {
|
|
1748
1813
|
const t = e.target.value.trim();
|
|
1749
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1814
|
+
if (clearTimeout(this.debounceTimer), t.length < wt) {
|
|
1750
1815
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1751
1816
|
return;
|
|
1752
1817
|
}
|
|
1753
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1818
|
+
this.debounceTimer = setTimeout(() => this.search(t), $t);
|
|
1754
1819
|
}
|
|
1755
1820
|
async search(e) {
|
|
1756
1821
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1843,37 +1908,37 @@ class dt extends le {
|
|
|
1843
1908
|
`;
|
|
1844
1909
|
}
|
|
1845
1910
|
}
|
|
1846
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1847
|
-
function
|
|
1848
|
-
const t = new Map(a.map((
|
|
1849
|
-
for (const
|
|
1850
|
-
|
|
1851
|
-
const o = a.filter((
|
|
1852
|
-
function d
|
|
1853
|
-
const
|
|
1854
|
-
if (!
|
|
1855
|
-
const
|
|
1856
|
-
return { game:
|
|
1911
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", xt);
|
|
1912
|
+
function Se(a, e) {
|
|
1913
|
+
const t = new Map(a.map((d) => [d.id, d])), s = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
1914
|
+
for (const d of e || [])
|
|
1915
|
+
d.outcome === "winner" && (s.has(d.targetGameId) || s.set(d.targetGameId, []), s.get(d.targetGameId).push(d), r.has(d.sourceGameId) || r.set(d.sourceGameId, []), r.get(d.sourceGameId).push(d));
|
|
1916
|
+
const o = a.filter((d) => !r.has(d.id)), i = (d) => d.targetSlot === "home" ? 0 : 1;
|
|
1917
|
+
function l(d) {
|
|
1918
|
+
const m = t.get(d);
|
|
1919
|
+
if (!m) return null;
|
|
1920
|
+
const c = [...s.get(d) || []].sort((f, u) => i(f) - i(u)).map((f) => l(f.sourceGameId)).filter(Boolean);
|
|
1921
|
+
return { game: m, children: c, bracketGroup: m.bracketGroup };
|
|
1857
1922
|
}
|
|
1858
|
-
return o.length === 1 ?
|
|
1923
|
+
return o.length === 1 ? l(o[0].id) : o.map((d) => l(d.id));
|
|
1859
1924
|
}
|
|
1860
|
-
function
|
|
1925
|
+
function Te(a, e = [], t = 0) {
|
|
1861
1926
|
if (!a) return e;
|
|
1862
1927
|
e[t] || (e[t] = []), e[t].push(a.game);
|
|
1863
|
-
for (const s of a.children || [])
|
|
1928
|
+
for (const s of a.children || []) Te(s, e, t + 1);
|
|
1864
1929
|
return e;
|
|
1865
1930
|
}
|
|
1866
|
-
const
|
|
1867
|
-
function
|
|
1868
|
-
const s =
|
|
1931
|
+
const kt = (a) => Math.max(1, Math.round(Math.log2(a || 2)));
|
|
1932
|
+
function It({ round: a, perGroup: e, groupCount: t = 1 }) {
|
|
1933
|
+
const s = kt(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - a;
|
|
1869
1934
|
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${a}`;
|
|
1870
1935
|
}
|
|
1871
|
-
function
|
|
1936
|
+
function St(a) {
|
|
1872
1937
|
if (!a || !a.length) return "setup";
|
|
1873
1938
|
const e = Math.max(...a.map((s) => s.round ?? 0)), t = a.filter((s) => (s.round ?? 0) === e);
|
|
1874
1939
|
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";
|
|
1875
1940
|
}
|
|
1876
|
-
function
|
|
1941
|
+
function Tt(a, e) {
|
|
1877
1942
|
const t = a?.groupNames || [];
|
|
1878
1943
|
if (t.length >= 2) {
|
|
1879
1944
|
const r = t.map((o) => ({ key: o, name: o }));
|
|
@@ -1882,62 +1947,62 @@ function ft(a, e) {
|
|
|
1882
1947
|
const s = [...new Set((e || []).map((r) => r.bracketGroup).filter(Boolean))];
|
|
1883
1948
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
1884
1949
|
}
|
|
1885
|
-
const
|
|
1950
|
+
const Ct = (a, e) => e?.key == null ? [...a || []] : (a || []).filter((t) => t.bracketGroup === e.key), ne = (a) => {
|
|
1886
1951
|
const e = /(\d+)\s*$/.exec(a.label || "");
|
|
1887
1952
|
return e ? Number(e[1]) : 1 / 0;
|
|
1888
|
-
},
|
|
1889
|
-
function
|
|
1953
|
+
}, ie = (a, e) => ne(a) - ne(e) || String(a.id).localeCompare(String(e.id));
|
|
1954
|
+
function Bt(a, e) {
|
|
1890
1955
|
if (a.every((r) => Number.isInteger(r.round))) return (r) => r.round;
|
|
1891
|
-
const t =
|
|
1956
|
+
const t = Se(a, e), s = /* @__PURE__ */ new Map();
|
|
1892
1957
|
for (const r of Array.isArray(t) ? t : [t]) {
|
|
1893
|
-
const o =
|
|
1894
|
-
o.forEach((
|
|
1958
|
+
const o = Te(r), i = o.length - 1;
|
|
1959
|
+
o.forEach((l, d) => l.forEach((m) => s.set(m.id, i - d + 1)));
|
|
1895
1960
|
}
|
|
1896
1961
|
return (r) => Number.isInteger(r.round) ? r.round : s.get(r.id) || 1;
|
|
1897
1962
|
}
|
|
1898
|
-
function
|
|
1899
|
-
const s =
|
|
1963
|
+
function Dt(a, e, t) {
|
|
1964
|
+
const s = Ct(a, t);
|
|
1900
1965
|
if (!s.length) return [];
|
|
1901
|
-
const r =
|
|
1902
|
-
for (const
|
|
1903
|
-
const
|
|
1904
|
-
o.has(
|
|
1966
|
+
const r = Bt(a || [], e || []), o = /* @__PURE__ */ new Map();
|
|
1967
|
+
for (const m of s) {
|
|
1968
|
+
const h = r(m);
|
|
1969
|
+
o.has(h) || o.set(h, []), o.get(h).push(m);
|
|
1905
1970
|
}
|
|
1906
1971
|
const i = /* @__PURE__ */ new Map();
|
|
1907
|
-
for (const
|
|
1908
|
-
|
|
1909
|
-
const
|
|
1910
|
-
let
|
|
1911
|
-
for (const
|
|
1912
|
-
let
|
|
1913
|
-
if (
|
|
1914
|
-
const
|
|
1915
|
-
const u = (i.get(f.id) || []).map((y) =>
|
|
1972
|
+
for (const m of e || [])
|
|
1973
|
+
m.outcome === "winner" && (i.has(m.targetGameId) || i.set(m.targetGameId, []), i.get(m.targetGameId).push(m.sourceGameId));
|
|
1974
|
+
const l = [];
|
|
1975
|
+
let d = null;
|
|
1976
|
+
for (const m of [...o.keys()].sort((h, c) => h - c)) {
|
|
1977
|
+
let h = [...o.get(m)];
|
|
1978
|
+
if (d) {
|
|
1979
|
+
const c = (f) => {
|
|
1980
|
+
const u = (i.get(f.id) || []).map((y) => d.get(y)).filter((y) => y !== void 0);
|
|
1916
1981
|
return u.length ? Math.min(...u) : 1 / 0;
|
|
1917
1982
|
};
|
|
1918
|
-
|
|
1983
|
+
h.sort((f, u) => c(f) - c(u) || ie(f, u));
|
|
1919
1984
|
} else
|
|
1920
|
-
|
|
1921
|
-
|
|
1985
|
+
h.sort(ie);
|
|
1986
|
+
d = new Map(h.map((c, f) => [c.id, f])), l.push({ round: m, games: h });
|
|
1922
1987
|
}
|
|
1923
|
-
return
|
|
1988
|
+
return l;
|
|
1924
1989
|
}
|
|
1925
|
-
function
|
|
1990
|
+
function Ft(a, e, t) {
|
|
1926
1991
|
const s = a[`${e}TeamId`] || null, r = (t || []).find((i) => i.gameId === a.id && i.slot === e), o = a[`${e}Seed`] ?? r?.seed ?? null;
|
|
1927
1992
|
return { teamId: s, seed: o, bye: !s && !!r?.isBye };
|
|
1928
1993
|
}
|
|
1929
|
-
function
|
|
1994
|
+
function Ce(a) {
|
|
1930
1995
|
const e = H(a);
|
|
1931
1996
|
return e === "home" || e === "away" ? e : null;
|
|
1932
1997
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const t =
|
|
1998
|
+
function zt(a, e) {
|
|
1999
|
+
const t = Se(a || [], e || []);
|
|
1935
2000
|
if (!t || Array.isArray(t)) return null;
|
|
1936
|
-
const s =
|
|
2001
|
+
const s = Ce(t.game);
|
|
1937
2002
|
return s && t.game[`${s}TeamId`] || null;
|
|
1938
2003
|
}
|
|
1939
|
-
const
|
|
1940
|
-
function
|
|
2004
|
+
const le = { active: 0, setup: 1, complete: 2 };
|
|
2005
|
+
function At(a, { id: e, param: t } = {}) {
|
|
1941
2006
|
const s = a || [];
|
|
1942
2007
|
if (!s.length) return null;
|
|
1943
2008
|
for (const r of [e, t]) {
|
|
@@ -1945,9 +2010,9 @@ function $t(a, { id: e, param: t } = {}) {
|
|
|
1945
2010
|
const o = s.find((i) => i.id === r);
|
|
1946
2011
|
if (o) return o;
|
|
1947
2012
|
}
|
|
1948
|
-
return [...s].sort((r, o) => (
|
|
2013
|
+
return [...s].sort((r, o) => (le[r.status] ?? 3) - (le[o.status] ?? 3) || String(r.name || "").localeCompare(String(o.name || "")))[0];
|
|
1949
2014
|
}
|
|
1950
|
-
const
|
|
2015
|
+
const Pt = $`
|
|
1951
2016
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
1952
2017
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
1953
2018
|
.roundhead {
|
|
@@ -1993,10 +2058,10 @@ const wt = w`
|
|
|
1993
2058
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
1994
2059
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
1995
2060
|
`;
|
|
1996
|
-
class
|
|
1997
|
-
static styles = [
|
|
2061
|
+
class Et extends w {
|
|
2062
|
+
static styles = [A, Pt];
|
|
1998
2063
|
static properties = {
|
|
1999
|
-
|
|
2064
|
+
...w.properties,
|
|
2000
2065
|
sport: { type: String },
|
|
2001
2066
|
season: { type: String },
|
|
2002
2067
|
tournamentId: { type: String, attribute: "tournament-id" },
|
|
@@ -2007,9 +2072,9 @@ class xt extends $ {
|
|
|
2007
2072
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
2008
2073
|
}
|
|
2009
2074
|
async fetchData(e) {
|
|
2010
|
-
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o =
|
|
2075
|
+
const t = this.season || _(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, r = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = At(s, { id: this.picked || this.tournamentId, param: r });
|
|
2011
2076
|
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
2012
|
-
const [i,
|
|
2077
|
+
const [i, l, d, m, h] = await Promise.all([
|
|
2013
2078
|
e.listSeedings(o.id),
|
|
2014
2079
|
e.listEdges(o.id),
|
|
2015
2080
|
e.listGames({ tournamentId: o.id }),
|
|
@@ -2021,10 +2086,10 @@ class xt extends $ {
|
|
|
2021
2086
|
tournaments: s,
|
|
2022
2087
|
tournament: o,
|
|
2023
2088
|
seedings: i.items,
|
|
2024
|
-
edges:
|
|
2025
|
-
games:
|
|
2026
|
-
schools:
|
|
2027
|
-
teams:
|
|
2089
|
+
edges: l.items,
|
|
2090
|
+
games: d.items,
|
|
2091
|
+
schools: m.items,
|
|
2092
|
+
teams: h.items
|
|
2028
2093
|
};
|
|
2029
2094
|
}
|
|
2030
2095
|
get ctx() {
|
|
@@ -2056,41 +2121,41 @@ class xt extends $ {
|
|
|
2056
2121
|
teams: e.teams
|
|
2057
2122
|
});
|
|
2058
2123
|
if (!e.tournament)
|
|
2059
|
-
return n`${s}${
|
|
2060
|
-
${
|
|
2124
|
+
return n`${s}${B(this, n`
|
|
2125
|
+
${D(this)}
|
|
2061
2126
|
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2062
2127
|
`)}`;
|
|
2063
|
-
const r =
|
|
2128
|
+
const r = Tt(e.tournament, e.games), o = r.find((c) => c.key === this.group) || r[0], i = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, l = (Number(e.tournament.size) || 0) / i, d = Dt(e.games, e.edges, o), m = St(e.games), h = zt(e.games, e.edges);
|
|
2064
2129
|
return n`
|
|
2065
2130
|
${s}
|
|
2066
|
-
${
|
|
2067
|
-
${
|
|
2131
|
+
${B(this, n`
|
|
2132
|
+
${D(this)}
|
|
2068
2133
|
<div class="toolbar">
|
|
2069
2134
|
${e.tournaments.length > 1 ? n`
|
|
2070
2135
|
<div role="group" aria-label="Tournament">
|
|
2071
|
-
${e.tournaments.map((
|
|
2072
|
-
@click=${() => this.pick(
|
|
2136
|
+
${e.tournaments.map((c) => n`<button class="chip ${c.id === e.tournament.id ? "on" : ""}"
|
|
2137
|
+
@click=${() => this.pick(c.id)}>${c.name}</button>`)}
|
|
2073
2138
|
</div>` : p}
|
|
2074
2139
|
${r.length > 1 ? n`
|
|
2075
2140
|
<div role="tablist" aria-label="Bracket group">
|
|
2076
|
-
${r.map((
|
|
2077
|
-
aria-selected=${
|
|
2141
|
+
${r.map((c) => n`<button class="chip ${c.key === o.key ? "on" : ""}" role="tab"
|
|
2142
|
+
aria-selected=${c.key === o.key ? "true" : "false"}
|
|
2078
2143
|
@click=${() => {
|
|
2079
|
-
this.group =
|
|
2080
|
-
}}>${
|
|
2144
|
+
this.group = c.key;
|
|
2145
|
+
}}>${c.name}</button>`)}
|
|
2081
2146
|
</div>` : p}
|
|
2082
2147
|
<span class="spacer"></span>
|
|
2083
|
-
<span class="pill ${
|
|
2148
|
+
<span class="pill ${m === "complete" ? "final" : m === "active" ? "class" : "type"}">${m === "complete" ? "Complete" : m === "active" ? "In progress" : "Bracket set"}</span>
|
|
2084
2149
|
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2085
2150
|
</div>
|
|
2086
|
-
${
|
|
2087
|
-
${C(T(t,
|
|
2088
|
-
${
|
|
2151
|
+
${h ? n`<div class="champ"><span class="pill champ">Champion</span>
|
|
2152
|
+
${C(T(t, h), 26)}<span class="tname">${O(t, h)}</span></div>` : p}
|
|
2153
|
+
${d.length ? n`
|
|
2089
2154
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2090
|
-
${
|
|
2155
|
+
${d.map((c) => n`
|
|
2091
2156
|
<section class="round">
|
|
2092
|
-
<h3 class="roundhead">${
|
|
2093
|
-
<div class="games">${
|
|
2157
|
+
<h3 class="roundhead">${It({ round: c.round, perGroup: l, groupCount: i })}</h3>
|
|
2158
|
+
<div class="games">${c.games.map((f) => this.renderMatchup(t, f))}</div>
|
|
2094
2159
|
</section>`)}
|
|
2095
2160
|
</div>` : n`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
2096
2161
|
`)}
|
|
@@ -2103,7 +2168,7 @@ class xt extends $ {
|
|
|
2103
2168
|
${this.renderSlot(e, t, "home")}
|
|
2104
2169
|
${this.renderSlot(e, t, "away")}
|
|
2105
2170
|
<footer class="mfoot">
|
|
2106
|
-
${
|
|
2171
|
+
${E(t)}
|
|
2107
2172
|
${t.label ? n`<span class="label">${t.label}</span>` : p}
|
|
2108
2173
|
<span class="spacer"></span>
|
|
2109
2174
|
${s ? n`<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : p}
|
|
@@ -2112,40 +2177,40 @@ class xt extends $ {
|
|
|
2112
2177
|
`;
|
|
2113
2178
|
}
|
|
2114
2179
|
renderSlot(e, t, s) {
|
|
2115
|
-
const { teamId: r, seed: o, bye: i } =
|
|
2180
|
+
const { teamId: r, seed: o, bye: i } = Ft(t, s, this.data.seedings), l = Ce(t), d = t.state === "live" || t.state === "final";
|
|
2116
2181
|
return n`
|
|
2117
|
-
<div class="slot ${
|
|
2182
|
+
<div class="slot ${l ? l === s ? "winner" : "loser" : ""}">
|
|
2118
2183
|
<span class="seed">${o ?? ""}</span>
|
|
2119
2184
|
${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
|
-
${
|
|
2185
|
+
${d ? n`<span class="score">${t[`${s}Score`] ?? 0}</span>` : p}
|
|
2121
2186
|
</div>
|
|
2122
2187
|
`;
|
|
2123
2188
|
}
|
|
2124
2189
|
}
|
|
2125
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2190
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", Et);
|
|
2126
2191
|
export {
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2192
|
+
P as D,
|
|
2193
|
+
yt as H,
|
|
2194
|
+
Et as a,
|
|
2195
|
+
it as b,
|
|
2196
|
+
ct as c,
|
|
2197
|
+
xt as d,
|
|
2198
|
+
rt as e,
|
|
2199
|
+
ot as f,
|
|
2200
|
+
Tt as g,
|
|
2201
|
+
Se as h,
|
|
2202
|
+
zt as i,
|
|
2203
|
+
R as j,
|
|
2204
|
+
St as k,
|
|
2140
2205
|
g as l,
|
|
2141
2206
|
H as m,
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2207
|
+
Nt as n,
|
|
2208
|
+
It as o,
|
|
2209
|
+
Ve as p,
|
|
2210
|
+
Dt as q,
|
|
2211
|
+
I as r,
|
|
2212
|
+
ge as s,
|
|
2148
2213
|
U as t,
|
|
2149
2214
|
Q as u,
|
|
2150
|
-
|
|
2215
|
+
Te as v
|
|
2151
2216
|
};
|