@wral/hsot-data 0.1.8 → 0.1.9
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 +4 -4
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +161 -146
- package/dist/{hsot-school-search-R6y64nMR.js → hsot-school-search-D1W24ixG.js} +431 -416
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { LitElement as ee, html as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { LitElement as ee, html as r, css as b, nothing as p, svg as Q } from "lit";
|
|
2
|
+
const le = 50;
|
|
3
|
+
function ce(a = {}) {
|
|
4
4
|
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
5
5
|
if (!e.length) return "";
|
|
6
6
|
const t = new URLSearchParams();
|
|
7
|
-
return e.forEach(([s,
|
|
7
|
+
return e.forEach(([s, o]) => t.set(s, String(o))), `?${t.toString()}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function de({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
10
|
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
|
-
const s = a.replace(/\/+$/, ""),
|
|
12
|
-
async function
|
|
11
|
+
const s = a.replace(/\/+$/, ""), o = t || ((...n) => fetch(...n));
|
|
12
|
+
async function i(n) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const
|
|
18
|
-
throw
|
|
15
|
+
const l = await o(`${s}${n}`, { headers: h });
|
|
16
|
+
if (!l.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${l.status} on ${n}`);
|
|
18
|
+
throw c.status = l.status, c;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
async function
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
27
|
-
if (
|
|
20
|
+
return l.json();
|
|
21
|
+
}
|
|
22
|
+
async function d(n, h = {}) {
|
|
23
|
+
const l = [];
|
|
24
|
+
let c = null;
|
|
25
|
+
for (let m = 0; m < le; m += 1) {
|
|
26
|
+
const f = ce(c ? { ...h, cursor: c } : h), g = await i(`${n}${f}`);
|
|
27
|
+
if (l.push(...g.items || []), c = g.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: l, total: l.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
listSchools: (n) =>
|
|
33
|
-
getSchool: (n) =>
|
|
34
|
-
listTeams: (n) =>
|
|
35
|
-
getTeam: (n) =>
|
|
36
|
-
listConferences: (n) =>
|
|
37
|
-
listPlayers: (n) =>
|
|
38
|
-
listRosters: (n) =>
|
|
39
|
-
listGames: (n) =>
|
|
40
|
-
getGame: (n) =>
|
|
41
|
-
listTournaments: (n) =>
|
|
42
|
-
listSeedings: (n, h) =>
|
|
43
|
-
listRankings: (n) =>
|
|
44
|
-
listSports: () =>
|
|
32
|
+
listSchools: (n) => d("/schools", n),
|
|
33
|
+
getSchool: (n) => i(`/schools/${n}`),
|
|
34
|
+
listTeams: (n) => d("/teams", n),
|
|
35
|
+
getTeam: (n) => i(`/teams/${n}`),
|
|
36
|
+
listConferences: (n) => d("/conferences", n),
|
|
37
|
+
listPlayers: (n) => d("/players", n),
|
|
38
|
+
listRosters: (n) => d("/rosters", n),
|
|
39
|
+
listGames: (n) => d("/games", n),
|
|
40
|
+
getGame: (n) => i(`/games/${n}`),
|
|
41
|
+
listTournaments: (n) => d("/tournaments", n),
|
|
42
|
+
listSeedings: (n, h) => d(`/tournaments/${n}/seedings`, h),
|
|
43
|
+
listRankings: (n) => d("/rankings", n),
|
|
44
|
+
listSports: () => i("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
const H = {
|
|
@@ -62,8 +62,8 @@ function D(a) {
|
|
|
62
62
|
const I = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
63
63
|
function y(a, e) {
|
|
64
64
|
if (!a) return "TBD";
|
|
65
|
-
const [t, s,
|
|
66
|
-
return !t || !s || !
|
|
65
|
+
const [t, s, o] = String(a).split("-").map(Number);
|
|
66
|
+
return !t || !s || !o ? "TBD" : new Date(t, s - 1, o).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
67
67
|
}
|
|
68
68
|
function U(a) {
|
|
69
69
|
if (!a) return "";
|
|
@@ -72,7 +72,7 @@ function U(a) {
|
|
|
72
72
|
const s = e >= 12 ? "PM" : "AM";
|
|
73
73
|
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function he(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
78
|
function N(a = /* @__PURE__ */ new Date()) {
|
|
@@ -83,10 +83,10 @@ function M(a = /* @__PURE__ */ new Date()) {
|
|
|
83
83
|
const e = (t) => String(t).padStart(2, "0");
|
|
84
84
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function me(a, e = M()) {
|
|
87
87
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
88
88
|
if (!t.length || t.includes(e)) return e;
|
|
89
|
-
const s = t.filter((
|
|
89
|
+
const s = t.filter((o) => o < e);
|
|
90
90
|
return s.length ? s[s.length - 1] : t[0];
|
|
91
91
|
}
|
|
92
92
|
function j(a) {
|
|
@@ -94,10 +94,10 @@ function j(a) {
|
|
|
94
94
|
}
|
|
95
95
|
function E(a) {
|
|
96
96
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
97
|
-
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255,
|
|
98
|
-
return 0.299 * t + 0.587 * s + 0.114 *
|
|
97
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
98
|
+
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
99
99
|
}
|
|
100
|
-
const
|
|
100
|
+
const pe = (a) => {
|
|
101
101
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
102
102
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
103
103
|
};
|
|
@@ -109,14 +109,14 @@ function te(a) {
|
|
|
109
109
|
}
|
|
110
110
|
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${y(a.date, { month: "short", day: "numeric" })} · ${U(a.time)}`.replace(/ · $/, "") };
|
|
111
111
|
}
|
|
112
|
-
const
|
|
112
|
+
const fe = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
113
113
|
function x(a) {
|
|
114
114
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
115
115
|
const t = e.indexOf("#");
|
|
116
116
|
let s = "";
|
|
117
117
|
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
118
|
-
let
|
|
119
|
-
return
|
|
118
|
+
let o = e.split("?")[0] + s;
|
|
119
|
+
return o = o.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), o = o.replace(/^\/(?=#)/, ""), o.length > 1 && (o = o.replace(/\/+$/, "")), o.toLowerCase();
|
|
120
120
|
}
|
|
121
121
|
function se() {
|
|
122
122
|
const a = globalThis.location;
|
|
@@ -124,20 +124,20 @@ function se() {
|
|
|
124
124
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
125
125
|
return x((a.pathname || "") + e);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ue(a, e, t) {
|
|
128
128
|
if (!t) return null;
|
|
129
129
|
const s = x(a);
|
|
130
130
|
if (!s) return null;
|
|
131
|
-
const
|
|
132
|
-
if (s ===
|
|
133
|
-
const
|
|
134
|
-
if (s ===
|
|
135
|
-
if (!s.startsWith(`${
|
|
136
|
-
const n = s.slice(
|
|
137
|
-
return h.length > 2 || h.some((
|
|
131
|
+
const o = x(u(e.game, { sport: t, id: "" })), i = x(u(e.school, { id: "" }));
|
|
132
|
+
if (s === o || s.startsWith(`${o}/`) || s === i || s.startsWith(`${i}/`)) return null;
|
|
133
|
+
const d = x(u(e.section, { sport: t, view: "" }));
|
|
134
|
+
if (s === d) return "";
|
|
135
|
+
if (!s.startsWith(`${d}/`)) return null;
|
|
136
|
+
const n = s.slice(d.length + 1), h = n.split("/");
|
|
137
|
+
return h.length > 2 || h.some((l) => !/^[a-z][a-z-]*$/.test(l)) || fe.has(h[0]) ? null : n;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
const s = (
|
|
139
|
+
function ge(a, e, t) {
|
|
140
|
+
const s = (d) => u(t.section, { sport: a, view: d }).replace(/([^:])\/{2,}/g, "$1/"), i = new Set((e || []).map((d) => d && d.gender).filter((d) => d === "boys" || d === "girls")).size === 2 ? [
|
|
141
141
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
142
142
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
143
143
|
] : [{ label: "Standings", href: s("standings") }];
|
|
@@ -145,11 +145,11 @@ function ue(a, e, t) {
|
|
|
145
145
|
{ label: `${I(a)} Home`, href: s("") },
|
|
146
146
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
147
147
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
148
|
-
...
|
|
148
|
+
...i,
|
|
149
149
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
150
150
|
];
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ve(a, e = se()) {
|
|
153
153
|
const t = x(e);
|
|
154
154
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
155
155
|
t && x(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
@@ -173,7 +173,7 @@ class $ extends ee {
|
|
|
173
173
|
this._client = e, this.isConnected && this.load();
|
|
174
174
|
}
|
|
175
175
|
get client() {
|
|
176
|
-
return this._client ? this._client : this.api ?
|
|
176
|
+
return this._client ? this._client : this.api ? de({ baseUrl: this.api }) : null;
|
|
177
177
|
}
|
|
178
178
|
connectedCallback() {
|
|
179
179
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -185,7 +185,7 @@ class $ extends ee {
|
|
|
185
185
|
this.load();
|
|
186
186
|
}
|
|
187
187
|
updated(e) {
|
|
188
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
188
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), ve(this);
|
|
189
189
|
}
|
|
190
190
|
async load() {
|
|
191
191
|
const e = this.client;
|
|
@@ -214,13 +214,13 @@ class $ extends ee {
|
|
|
214
214
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
215
215
|
}
|
|
216
216
|
render() {
|
|
217
|
-
return this.error === "not-configured" ?
|
|
217
|
+
return this.error === "not-configured" ? r`<div class="error">This component needs an <code>api</code> attribute (the api-hsot public read-surface base URL) or an injected client.</div>` : this.error ? r`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : r`<div class="loading" role="status">Loading…</div>`;
|
|
218
218
|
}
|
|
219
219
|
renderView() {
|
|
220
|
-
return
|
|
220
|
+
return r``;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
223
|
+
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), be = b`
|
|
224
224
|
:host {
|
|
225
225
|
--hsot-red: var(--color-red, #D1232A);
|
|
226
226
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -258,7 +258,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
258
258
|
outline-offset: 1px;
|
|
259
259
|
}
|
|
260
260
|
.mut { color: var(--hsot-gray-5); }
|
|
261
|
-
`,
|
|
261
|
+
`, ye = b`
|
|
262
262
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
263
263
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
264
264
|
.band h1, .band h2.bandtitle {
|
|
@@ -307,7 +307,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
307
307
|
@media (max-width: 720px) {
|
|
308
308
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
309
309
|
}
|
|
310
|
-
`,
|
|
310
|
+
`, $e = b`
|
|
311
311
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
312
312
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
313
313
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -371,7 +371,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
371
371
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
372
372
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
373
373
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
374
|
-
`,
|
|
374
|
+
`, we = b`
|
|
375
375
|
.pill {
|
|
376
376
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
377
377
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -386,7 +386,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
386
386
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
387
387
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
388
388
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
389
|
-
`,
|
|
389
|
+
`, xe = b`
|
|
390
390
|
.tablewrap { overflow-x: auto; }
|
|
391
391
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
392
392
|
table.data th {
|
|
@@ -404,7 +404,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
404
404
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
405
405
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
406
406
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
407
|
-
`,
|
|
407
|
+
`, ke = b`
|
|
408
408
|
.swatch {
|
|
409
409
|
display: inline-flex; align-items: center; justify-content: center;
|
|
410
410
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -428,7 +428,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
428
428
|
.dot.W { background: var(--hsot-win); }
|
|
429
429
|
.dot.L { background: var(--hsot-loss); }
|
|
430
430
|
.dot.T { background: var(--hsot-tie); }
|
|
431
|
-
`,
|
|
431
|
+
`, Te = b`
|
|
432
432
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
433
433
|
.gamelist li {
|
|
434
434
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -478,24 +478,24 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), ve = b`
|
|
|
478
478
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
479
479
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
480
480
|
.gamelist a.box { font-size: 0.78rem; }
|
|
481
|
-
`, F = [
|
|
481
|
+
`, F = [be, ye, $e, we, xe, ke, Te];
|
|
482
482
|
function G(a) {
|
|
483
483
|
return a.state !== "final" ? null : a.forfeit && a.forfeit !== "none" ? a.forfeit : a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function Ie(a) {
|
|
486
486
|
return !a || !a.forfeit || a.forfeit === "none" ? null : a.forfeit === "home" ? "away" : a.forfeit === "away" ? "home" : null;
|
|
487
487
|
}
|
|
488
488
|
function z(a, e) {
|
|
489
|
-
const t = {}, s = (
|
|
490
|
-
for (const
|
|
491
|
-
const
|
|
489
|
+
const t = {}, s = (i) => (t[i] = t[i] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[i]), o = a.filter((i) => i.state === "final" && i.gameType !== "scrimmage" && (!e || i.date <= e)).sort((i, d) => String(i.date).localeCompare(String(d.date)));
|
|
490
|
+
for (const i of o) {
|
|
491
|
+
const d = G(i), n = i.gameType === "conference";
|
|
492
492
|
for (const h of ["home", "away"]) {
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
495
|
-
const
|
|
496
|
-
|
|
493
|
+
const l = h === "home" ? i.homeTeamId : i.awayTeamId;
|
|
494
|
+
if (!l) continue;
|
|
495
|
+
const c = s(l), m = h === "home" ? i.homeScore : i.awayScore, f = h === "home" ? i.awayScore : i.homeScore;
|
|
496
|
+
c.pf += m, c.pa += f;
|
|
497
497
|
let g = "T";
|
|
498
|
-
|
|
498
|
+
d === "tie" ? (c.t += 1, n && (c.ct += 1)) : d === h ? (c.w += 1, n && (c.cw += 1), g = "W") : (c.l += 1, n && (c.cl += 1), g = "L"), c.results.push({ gameId: i.id, date: i.date, mark: g, my: m, their: f, opp: h === "home" ? i.awayTeamId : i.homeTeamId, conf: n });
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
return t;
|
|
@@ -513,8 +513,8 @@ const X = (a, e, t) => {
|
|
|
513
513
|
}, Z = (a) => a.toFixed(3).replace("0.", ".");
|
|
514
514
|
function w(a, e = !1) {
|
|
515
515
|
if (!a) return "0-0";
|
|
516
|
-
const t = e ? a.cw : a.w, s = e ? a.cl : a.l,
|
|
517
|
-
return `${t}-${s}${
|
|
516
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, o = e ? a.ct : a.t;
|
|
517
|
+
return `${t}-${s}${o ? `-${o}` : ""}`;
|
|
518
518
|
}
|
|
519
519
|
function ae(a, e) {
|
|
520
520
|
return a.map((t) => {
|
|
@@ -529,61 +529,69 @@ function J(a, e) {
|
|
|
529
529
|
const t = a[e];
|
|
530
530
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
let
|
|
534
|
-
for (const
|
|
535
|
-
|
|
536
|
-
return
|
|
532
|
+
function qe(a, e, t, s = "") {
|
|
533
|
+
let o = null;
|
|
534
|
+
for (const i of a || [])
|
|
535
|
+
i.sport === e && (t && i.effectiveDate > t || s && i.gender && i.gender !== s || (!o || i.effectiveDate > o.effectiveDate) && (o = i));
|
|
536
|
+
return o;
|
|
537
537
|
}
|
|
538
|
-
function W(a, e, t, s,
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
541
|
-
const
|
|
538
|
+
function W(a, e, t, s, o) {
|
|
539
|
+
const i = e[t];
|
|
540
|
+
if (!i) return null;
|
|
541
|
+
const d = /* @__PURE__ */ new Map();
|
|
542
542
|
for (const h of a || []) {
|
|
543
|
-
if (h.sport !== s ||
|
|
544
|
-
const
|
|
545
|
-
(!
|
|
543
|
+
if (h.sport !== s || o && h.effectiveDate > o || h.gender && i.gender !== h.gender && i.gender !== "coed") continue;
|
|
544
|
+
const l = h.gender || "", c = d.get(l);
|
|
545
|
+
(!c || h.effectiveDate > c.effectiveDate) && d.set(l, h);
|
|
546
546
|
}
|
|
547
547
|
let n = null;
|
|
548
|
-
for (const h of
|
|
549
|
-
const
|
|
550
|
-
|
|
548
|
+
for (const h of d.values()) {
|
|
549
|
+
const l = (h.teamIds || []).indexOf(t);
|
|
550
|
+
l !== -1 && (!n || h.effectiveDate > n.effectiveDate) && (n = { poll: h, rank: l + 1 });
|
|
551
551
|
}
|
|
552
552
|
return n ? n.rank : null;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Se(a, e, t) {
|
|
555
555
|
if (!a) return { kind: "none", delta: 0 };
|
|
556
556
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
557
557
|
if (!s) return { kind: "none", delta: 0 };
|
|
558
558
|
if (!e) return { kind: "same", delta: 0 };
|
|
559
|
-
const
|
|
560
|
-
if (!
|
|
561
|
-
const
|
|
562
|
-
return
|
|
559
|
+
const o = (e.teamIds || []).indexOf(t) + 1;
|
|
560
|
+
if (!o) return { kind: "new", delta: 0 };
|
|
561
|
+
const i = o - s;
|
|
562
|
+
return i > 0 ? { kind: "up", delta: i } : i < 0 ? { kind: "down", delta: -i } : { kind: "same", delta: 0 };
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function Ce(a) {
|
|
565
565
|
return /^https?:\/\//i.test(String(a || ""));
|
|
566
566
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
567
|
+
function oe(a, { w: e, h: t } = {}) {
|
|
568
|
+
if (!Ce(a)) return "";
|
|
569
|
+
const s = [];
|
|
570
|
+
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
571
|
+
const o = a.includes("?") ? "&" : "?";
|
|
572
|
+
return `${a}${o}${s.join("&")}`;
|
|
572
573
|
}
|
|
573
|
-
function
|
|
574
|
-
const
|
|
575
|
-
return
|
|
574
|
+
function A(a, e) {
|
|
575
|
+
const t = e * 2;
|
|
576
|
+
return oe(a?.logoAssetId, { w: t, h: t });
|
|
577
|
+
}
|
|
578
|
+
function De(a, e) {
|
|
579
|
+
return oe(a?.photoAssetId, { w: e * 2 });
|
|
580
|
+
}
|
|
581
|
+
function V(a, e, { title: t, sub: s, teams: o }) {
|
|
582
|
+
const i = se(), n = !!a.querySelector(':scope > a[slot="nav"]') || ue(i, e.hrefs, e.sport) !== null;
|
|
583
|
+
return r`
|
|
576
584
|
<div class="band section">
|
|
577
585
|
<div class="inner">
|
|
578
586
|
<h1>${t}</h1>
|
|
579
|
-
${s ?
|
|
587
|
+
${s ? r`<p class="sub">${s}</p>` : p}
|
|
580
588
|
</div>
|
|
581
|
-
${n ?
|
|
589
|
+
${n ? r`
|
|
582
590
|
<nav class="sectionnav" aria-label="${I(e.sport)} section">
|
|
583
591
|
<div class="navrow">
|
|
584
592
|
<slot name="nav">
|
|
585
|
-
${
|
|
586
|
-
aria-current=${
|
|
593
|
+
${ge(e.sport, o, e.hrefs).map((h) => r`<a href=${h.href}
|
|
594
|
+
aria-current=${i && x(h.href) === i ? "page" : p}>${h.label}</a>`)}
|
|
587
595
|
</slot>
|
|
588
596
|
</div>
|
|
589
597
|
</nav>` : p}
|
|
@@ -593,57 +601,57 @@ function V(a, e, { title: t, sub: s, teams: r }) {
|
|
|
593
601
|
const S = (a, e) => {
|
|
594
602
|
const t = a.teamsById[e];
|
|
595
603
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
596
|
-
}, T = (a, e) => S(a, e)?.name || "TBD",
|
|
604
|
+
}, T = (a, e) => S(a, e)?.name || "TBD", _ = (a, e) => S(a, e)?.abbr || "TBD";
|
|
597
605
|
function C(a, e = 26) {
|
|
598
606
|
if (!a) return p;
|
|
599
|
-
const t =
|
|
607
|
+
const t = A(a, e);
|
|
600
608
|
if (t)
|
|
601
|
-
return
|
|
609
|
+
return r`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
602
610
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
603
|
-
const s = a.colorPrimary || "#030711",
|
|
604
|
-
return
|
|
605
|
-
style="width:${e}px;height:${e}px;background:${s};color:${
|
|
611
|
+
const s = a.colorPrimary || "#030711", o = E(s);
|
|
612
|
+
return r`<span class="swatch" aria-hidden="true"
|
|
613
|
+
style="width:${e}px;height:${e}px;background:${s};color:${o};font-size:${Math.max(8, e * 0.28)}px"
|
|
606
614
|
>${j(a)}</span>`;
|
|
607
615
|
}
|
|
608
616
|
function Y(a, e, t) {
|
|
609
617
|
const s = W(a.rankings, a.teamsById, e, a.sport, t);
|
|
610
|
-
return s ?
|
|
618
|
+
return s ? r`<span class="rankbadge">#${s}</span>` : p;
|
|
611
619
|
}
|
|
612
620
|
function re(a, e, t) {
|
|
613
621
|
const s = S(a, e);
|
|
614
|
-
return s ?
|
|
622
|
+
return s ? r`${Y(a, e, t)}<a href=${u(a.hrefs.school, { id: s.id })}>${s.name}</a>` : r`<span class="mut">TBD</span>`;
|
|
615
623
|
}
|
|
616
624
|
function K(a, e, t = 5) {
|
|
617
625
|
const s = a.records[e];
|
|
618
|
-
if (!s || !s.results.length) return
|
|
619
|
-
const
|
|
620
|
-
return
|
|
621
|
-
${
|
|
622
|
-
title="${
|
|
623
|
-
href=${u(a.hrefs.game, { sport: a.sport, id:
|
|
626
|
+
if (!s || !s.results.length) return r`<span class="mut">·</span>`;
|
|
627
|
+
const o = s.results.slice(-1 * t);
|
|
628
|
+
return r`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
629
|
+
${o.map((i) => r`<a class="dot ${i.mark}"
|
|
630
|
+
title="${i.mark} ${i.my}-${i.their} vs ${T(a, i.opp)}"
|
|
631
|
+
href=${u(a.hrefs.game, { sport: a.sport, id: i.gameId })}>${i.mark}</a>`)}
|
|
624
632
|
</span>`;
|
|
625
633
|
}
|
|
626
634
|
function B(a, e) {
|
|
627
|
-
return a.querySelector(':scope > [slot="rail"]') ?
|
|
635
|
+
return a.querySelector(':scope > [slot="rail"]') ? r`<div class="view withrail">
|
|
628
636
|
<div class="viewmain">${e}</div>
|
|
629
637
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
630
|
-
</div>` :
|
|
638
|
+
</div>` : r`<div class="view">${e}</div>`;
|
|
631
639
|
}
|
|
632
640
|
function P(a) {
|
|
633
641
|
if (!a.promoImage) return p;
|
|
634
|
-
const e =
|
|
635
|
-
return
|
|
642
|
+
const e = r`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
643
|
+
return r`<div class="promo">${a.promoHref ? r`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
636
644
|
}
|
|
637
645
|
function R(a) {
|
|
638
646
|
const e = te(a);
|
|
639
|
-
return
|
|
647
|
+
return r`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
640
648
|
}
|
|
641
|
-
function
|
|
642
|
-
if (!e) return
|
|
643
|
-
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId,
|
|
644
|
-
return
|
|
649
|
+
function ie(a, e, t) {
|
|
650
|
+
if (!e) return r`<span class="mut">·</span>`;
|
|
651
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, o = e.homeTeamId === t ? "vs" : "at";
|
|
652
|
+
return r`${e.state === "live" ? r`<span class="pill live">Live</span> ` : r`${y(e.date, { month: "numeric", day: "numeric" })} `}${o} ${_(a, s)}`;
|
|
645
653
|
}
|
|
646
|
-
class
|
|
654
|
+
class Fe extends $ {
|
|
647
655
|
static styles = F;
|
|
648
656
|
static properties = {
|
|
649
657
|
...$.properties,
|
|
@@ -662,19 +670,19 @@ class Ce extends $ {
|
|
|
662
670
|
this._datePinned = !!this.date;
|
|
663
671
|
}
|
|
664
672
|
async fetchData(e) {
|
|
665
|
-
const t = this.season || N(), [s,
|
|
673
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
666
674
|
e.listSchools(),
|
|
667
675
|
e.listTeams({ sport: this.sport }),
|
|
668
676
|
e.listConferences(),
|
|
669
677
|
e.listGames({ sport: this.sport, season: t }),
|
|
670
678
|
e.listRankings({ sport: this.sport })
|
|
671
679
|
]);
|
|
672
|
-
return this._datePinned || (this.date =
|
|
680
|
+
return this._datePinned || (this.date = me(d.items.map((h) => h.date)), this._datePinned = !0), {
|
|
673
681
|
season: t,
|
|
674
682
|
schools: s.items,
|
|
675
|
-
teams:
|
|
676
|
-
conferences:
|
|
677
|
-
games:
|
|
683
|
+
teams: o.items,
|
|
684
|
+
conferences: i.items,
|
|
685
|
+
games: d.items,
|
|
678
686
|
rankings: n.items
|
|
679
687
|
};
|
|
680
688
|
}
|
|
@@ -689,30 +697,30 @@ class Ce extends $ {
|
|
|
689
697
|
}, this._ctxData = this.data), this._ctx;
|
|
690
698
|
}
|
|
691
699
|
renderView() {
|
|
692
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
693
|
-
const
|
|
694
|
-
return
|
|
695
|
-
},
|
|
696
|
-
|
|
700
|
+
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((l) => l.date).filter(Boolean))].sort(), o = Number.MAX_SAFE_INTEGER, i = (l) => {
|
|
701
|
+
const c = [l.awayTeamId, l.homeTeamId].map((m) => W(e.rankings, e.teamsById, m, this.sport, l.date)).filter(Boolean);
|
|
702
|
+
return c.length ? Math.min(...c) : o;
|
|
703
|
+
}, d = this.data.games.filter((l) => l.date === this.date), n = new Map(d.map((l) => [l, i(l)]));
|
|
704
|
+
d.sort((l, c) => (l.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || n.get(l) - n.get(c));
|
|
697
705
|
const h = /* @__PURE__ */ new Map();
|
|
698
|
-
return
|
|
699
|
-
const
|
|
700
|
-
h.has(
|
|
701
|
-
}),
|
|
706
|
+
return d.forEach((l) => {
|
|
707
|
+
const c = l.gameType === "conference" && l.conferenceId ? t[l.conferenceId]?.name || "Conference" : l.gameType === "playoff" ? "Playoffs" : l.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
708
|
+
h.has(c) || h.set(c, []), h.get(c).push(l);
|
|
709
|
+
}), r`
|
|
702
710
|
${V(this, e, {
|
|
703
|
-
title:
|
|
704
|
-
sub:
|
|
711
|
+
title: r`${I(this.sport)} scores & schedules`,
|
|
712
|
+
sub: r`${y(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${d.length} games`,
|
|
705
713
|
teams: this.data.teams
|
|
706
714
|
})}
|
|
707
|
-
${B(this,
|
|
715
|
+
${B(this, r`
|
|
708
716
|
${P(this)}
|
|
709
717
|
<div class="toolbar">
|
|
710
718
|
<label class="asof" for="datesel">Date</label>
|
|
711
|
-
<select id="datesel" @change=${(
|
|
712
|
-
this.date =
|
|
719
|
+
<select id="datesel" @change=${(l) => {
|
|
720
|
+
this.date = l.target.value;
|
|
713
721
|
}}>
|
|
714
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
715
|
-
${y(
|
|
722
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((l) => r`<option value=${l} ?selected=${l === this.date}>
|
|
723
|
+
${y(l, { weekday: "short", month: "short", day: "numeric" })}${l === M() ? " · today" : ""}
|
|
716
724
|
</option>`)}
|
|
717
725
|
</select>
|
|
718
726
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -726,11 +734,11 @@ class Ce extends $ {
|
|
|
726
734
|
<span class="spacer"></span>
|
|
727
735
|
<span class="asof">Live games first · report a score to see it update here</span>
|
|
728
736
|
</div>
|
|
729
|
-
${
|
|
730
|
-
${[...h.entries()].map(([
|
|
731
|
-
<div class="section-title">${
|
|
737
|
+
${d.length ? p : r`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
738
|
+
${[...h.entries()].map(([l, c]) => r`
|
|
739
|
+
<div class="section-title">${l}</div>
|
|
732
740
|
<div class="card"><ul class="gamelist">
|
|
733
|
-
${
|
|
741
|
+
${c.map((m) => this.renderGame(e, m))}
|
|
734
742
|
</ul></div>
|
|
735
743
|
`)}
|
|
736
744
|
`)}
|
|
@@ -740,21 +748,21 @@ class Ce extends $ {
|
|
|
740
748
|
// a lone score column on the far right read as detached from the teams).
|
|
741
749
|
// Scheduled games carry their start time on the status pill alone.
|
|
742
750
|
renderGame(e, t) {
|
|
743
|
-
const s = t.state === "final" || t.state === "live",
|
|
744
|
-
return
|
|
751
|
+
const s = t.state === "final" || t.state === "live", o = (d, n, h = p) => r`<span class="side">${re(e, d, t.date)}${s ? r`<span class="score">${n}</span>` : p}${h}</span>`, i = Ie(t);
|
|
752
|
+
return r`
|
|
745
753
|
<li>
|
|
746
754
|
${R(t)}
|
|
747
|
-
<span class="opp matchup">${
|
|
748
|
-
${
|
|
755
|
+
<span class="opp matchup">${o(t.awayTeamId, t.awayScore, r`<span class="at">at</span>`)}${o(t.homeTeamId, t.homeScore)}</span>
|
|
756
|
+
${i ? r`<span class="ff">${T(e, i === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
749
757
|
<span class="where">${t.venue || ""}</span>
|
|
750
|
-
${t.broadcast ?
|
|
758
|
+
${t.broadcast ? r`<span class="pill class">${t.broadcast}</span>` : p}
|
|
751
759
|
<a class="box" href=${u(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
752
760
|
</li>
|
|
753
761
|
`;
|
|
754
762
|
}
|
|
755
763
|
}
|
|
756
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
757
|
-
class
|
|
764
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Fe);
|
|
765
|
+
class ze extends $ {
|
|
758
766
|
static styles = F;
|
|
759
767
|
static properties = {
|
|
760
768
|
...$.properties,
|
|
@@ -767,7 +775,7 @@ class De extends $ {
|
|
|
767
775
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
768
776
|
}
|
|
769
777
|
async fetchData(e) {
|
|
770
|
-
const t = this.season || N(), [s,
|
|
778
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
771
779
|
e.listConferences({ active: !0 }),
|
|
772
780
|
e.listSchools(),
|
|
773
781
|
e.listTeams({ sport: this.sport }),
|
|
@@ -777,9 +785,9 @@ class De extends $ {
|
|
|
777
785
|
return {
|
|
778
786
|
season: t,
|
|
779
787
|
conferences: s.items,
|
|
780
|
-
schools:
|
|
781
|
-
teams:
|
|
782
|
-
games:
|
|
788
|
+
schools: o.items,
|
|
789
|
+
teams: i.items,
|
|
790
|
+
games: d.items,
|
|
783
791
|
rankings: n.items
|
|
784
792
|
};
|
|
785
793
|
}
|
|
@@ -794,43 +802,43 @@ class De extends $ {
|
|
|
794
802
|
}, this._ctxData = this.data), this._ctx;
|
|
795
803
|
}
|
|
796
804
|
renderView() {
|
|
797
|
-
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((
|
|
798
|
-
return
|
|
805
|
+
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((o) => o.classifications || []))].slice(0, 9), s = this.data.conferences.filter((o) => o.active !== !1).filter((o) => this.classFilter === "All" || (o.classifications || []).includes(this.classFilter));
|
|
806
|
+
return r`
|
|
799
807
|
${V(this, e, {
|
|
800
|
-
title:
|
|
801
|
-
sub:
|
|
808
|
+
title: r`${I(this.sport)} standings`,
|
|
809
|
+
sub: r`${this.data.season} season · every conference, computed live from reported results`,
|
|
802
810
|
teams: this.data.teams
|
|
803
811
|
})}
|
|
804
|
-
${B(this,
|
|
812
|
+
${B(this, r`
|
|
805
813
|
${P(this)}
|
|
806
814
|
<div class="toolbar">
|
|
807
815
|
<div role="group" aria-label="Classification filter">
|
|
808
|
-
${t.map((
|
|
816
|
+
${t.map((o) => r`<button class="chip ${this.classFilter === o ? "on" : ""}"
|
|
809
817
|
@click=${() => {
|
|
810
|
-
this.classFilter =
|
|
811
|
-
}}>${
|
|
818
|
+
this.classFilter = o;
|
|
819
|
+
}}>${o}</button>`)}
|
|
812
820
|
</div>
|
|
813
821
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
814
|
-
.value=${this.query} @input=${(
|
|
815
|
-
this.query =
|
|
822
|
+
.value=${this.query} @input=${(o) => {
|
|
823
|
+
this.query = o.target.value;
|
|
816
824
|
}}>
|
|
817
825
|
<span class="spacer"></span>
|
|
818
826
|
<span class="asof">Records through ${y(M(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
819
827
|
</div>
|
|
820
|
-
${s.map((
|
|
828
|
+
${s.map((o) => this.renderConference(e, o))}
|
|
821
829
|
`)}
|
|
822
830
|
`;
|
|
823
831
|
}
|
|
824
832
|
renderConference(e, t) {
|
|
825
|
-
const s = this.data.teams.filter((
|
|
833
|
+
const s = this.data.teams.filter((d) => d.conferenceId === t.id);
|
|
826
834
|
if (!s.length) return p;
|
|
827
|
-
const
|
|
828
|
-
return
|
|
835
|
+
const o = this.query.trim().toLowerCase(), i = ae(s, e.records);
|
|
836
|
+
return r`
|
|
829
837
|
<div class="card">
|
|
830
838
|
<div class="card-head">
|
|
831
839
|
<h2>${t.name}</h2>
|
|
832
|
-
${(t.classifications || []).map((
|
|
833
|
-
<span class="meta">${
|
|
840
|
+
${(t.classifications || []).map((d) => r`<span class="pill class">${d}</span>`)}
|
|
841
|
+
<span class="meta">${i.length} teams · membership derives from teams</span>
|
|
834
842
|
</div>
|
|
835
843
|
<div class="tablewrap"><table class="data">
|
|
836
844
|
<thead><tr>
|
|
@@ -839,27 +847,27 @@ class De extends $ {
|
|
|
839
847
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
840
848
|
</tr></thead>
|
|
841
849
|
<tbody>
|
|
842
|
-
${
|
|
850
|
+
${i.map((d, n) => this.renderRow(e, d, n, o))}
|
|
843
851
|
</tbody>
|
|
844
852
|
</table></div>
|
|
845
853
|
</div>
|
|
846
854
|
`;
|
|
847
855
|
}
|
|
848
|
-
renderRow(e, t, s,
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id),
|
|
852
|
-
<span class="pill champ" title="${m.season} ${m.title} champion">★ ${m.season} ${m.title}</span>`),
|
|
856
|
+
renderRow(e, t, s, o) {
|
|
857
|
+
const i = e.schoolsById[t.team.schoolId], d = i?.name || t.team.name || "TBD";
|
|
858
|
+
if (o && !d.toLowerCase().includes(o)) return p;
|
|
859
|
+
const n = t.rec.pf - t.rec.pa, h = q(this.data.games, t.team.id), l = (t.team.championships || []).map((m) => r`
|
|
860
|
+
<span class="pill champ" title="${m.season} ${m.title} champion">★ ${m.season} ${m.title}</span>`), c = () => {
|
|
853
861
|
location.href = u(e.hrefs.school, { id: t.team.schoolId });
|
|
854
862
|
};
|
|
855
|
-
return
|
|
863
|
+
return r`
|
|
856
864
|
<tr class="rowlink" @click=${(m) => {
|
|
857
|
-
m.target.closest("a") ||
|
|
865
|
+
m.target.closest("a") || c();
|
|
858
866
|
}}>
|
|
859
867
|
<td class="mut">${s + 1}</td>
|
|
860
868
|
<td class="teamcell">
|
|
861
|
-
${C(
|
|
862
|
-
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${
|
|
869
|
+
${C(i)}${Y(e, t.team.id, null)}
|
|
870
|
+
<a href=${u(e.hrefs.school, { id: t.team.schoolId })}>${d}</a> ${l}
|
|
863
871
|
</td>
|
|
864
872
|
<td class="num">${w(t.rec, !0)}</td>
|
|
865
873
|
<td class="num">${Z(t.confPct)}</td>
|
|
@@ -870,13 +878,13 @@ class De extends $ {
|
|
|
870
878
|
<td class="num" style="color:${n >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${n > 0 ? "+" : ""}${n}</td>
|
|
871
879
|
<td>${L(t.rec.results) || "·"}</td>
|
|
872
880
|
<td>${K(e, t.team.id)}</td>
|
|
873
|
-
<td>${
|
|
881
|
+
<td>${ie(e, h, t.team.id)}</td>
|
|
874
882
|
</tr>
|
|
875
883
|
`;
|
|
876
884
|
}
|
|
877
885
|
}
|
|
878
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
879
|
-
const
|
|
886
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", ze);
|
|
887
|
+
const Be = b`
|
|
880
888
|
.hero1 {
|
|
881
889
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
882
890
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -893,8 +901,8 @@ const Fe = b`
|
|
|
893
901
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
894
902
|
.sparkline { vertical-align: middle; }
|
|
895
903
|
`;
|
|
896
|
-
class
|
|
897
|
-
static styles = [...F,
|
|
904
|
+
class Pe extends $ {
|
|
905
|
+
static styles = [...F, Be];
|
|
898
906
|
static properties = {
|
|
899
907
|
...$.properties,
|
|
900
908
|
sport: { type: String },
|
|
@@ -911,19 +919,19 @@ class ze extends $ {
|
|
|
911
919
|
e && (this.pollDate = e);
|
|
912
920
|
}
|
|
913
921
|
async fetchData(e) {
|
|
914
|
-
const t = this.season || N(), [s,
|
|
922
|
+
const t = this.season || N(), [s, o, i, d, n] = await Promise.all([
|
|
915
923
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
916
924
|
e.listSchools(),
|
|
917
925
|
e.listTeams({ sport: this.sport }),
|
|
918
926
|
e.listConferences(),
|
|
919
927
|
e.listGames({ sport: this.sport, season: t })
|
|
920
|
-
]), h = s.items.filter((
|
|
928
|
+
]), h = s.items.filter((l) => !this.gender || !l.gender || l.gender === this.gender).sort((l, c) => c.effectiveDate.localeCompare(l.effectiveDate));
|
|
921
929
|
return {
|
|
922
930
|
season: t,
|
|
923
931
|
polls: h,
|
|
924
|
-
schools:
|
|
925
|
-
teams:
|
|
926
|
-
conferences:
|
|
932
|
+
schools: o.items,
|
|
933
|
+
teams: i.items,
|
|
934
|
+
conferences: d.items,
|
|
927
935
|
games: n.items
|
|
928
936
|
};
|
|
929
937
|
}
|
|
@@ -944,39 +952,39 @@ class ze extends $ {
|
|
|
944
952
|
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, O = 3 + g / 24 * 20;
|
|
945
953
|
return { x: k, y: O };
|
|
946
954
|
}), h = [];
|
|
947
|
-
let
|
|
955
|
+
let l = [];
|
|
948
956
|
if (n.forEach((m) => {
|
|
949
|
-
m ?
|
|
950
|
-
}),
|
|
951
|
-
const
|
|
952
|
-
return
|
|
957
|
+
m ? l.push(m) : l.length && (h.push(l), l = []);
|
|
958
|
+
}), l.length && h.push(l), !h.length) return p;
|
|
959
|
+
const c = n[s];
|
|
960
|
+
return r`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
953
961
|
${h.map((m) => Q`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
954
962
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
955
|
-
${
|
|
963
|
+
${c ? Q`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
956
964
|
</svg>`;
|
|
957
965
|
}
|
|
958
966
|
movement(e, t, s) {
|
|
959
|
-
const
|
|
960
|
-
return
|
|
967
|
+
const o = Se(e, t, s);
|
|
968
|
+
return o.kind === "up" ? r`<span class="delta up">▲ ${o.delta}</span>` : o.kind === "down" ? r`<span class="delta down">▼ ${o.delta}</span>` : o.kind === "new" ? r`<span class="delta new">NEW</span>` : o.kind === "same" ? r`<span class="delta same">—</span>` : r`<span class="delta same">·</span>`;
|
|
961
969
|
}
|
|
962
970
|
renderView() {
|
|
963
971
|
const e = this.ctx, t = this.data.polls;
|
|
964
|
-
if (!t.length) return
|
|
965
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)),
|
|
966
|
-
return
|
|
972
|
+
if (!t.length) return r`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
973
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), o = t[s] || t[0], i = t[s + 1] || null, d = t.slice().reverse(), n = d.indexOf(o), h = v(this.data.conferences), l = (o.teamIds || [])[0], c = l ? S(e, l) : null;
|
|
974
|
+
return r`
|
|
967
975
|
${V(this, e, {
|
|
968
|
-
title:
|
|
969
|
-
sub:
|
|
976
|
+
title: r`${I(this.sport)} Top 25`,
|
|
977
|
+
sub: r`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
970
978
|
teams: this.data.teams
|
|
971
979
|
})}
|
|
972
|
-
${B(this,
|
|
980
|
+
${B(this, r`
|
|
973
981
|
${P(this)}
|
|
974
982
|
<div class="toolbar">
|
|
975
983
|
<label class="asof" for="pollsel">Poll of</label>
|
|
976
984
|
<select id="pollsel" @change=${(m) => {
|
|
977
985
|
this.pollDate = m.target.value;
|
|
978
986
|
}}>
|
|
979
|
-
${t.map((m, f) =>
|
|
987
|
+
${t.map((m, f) => r`<option value=${m.effectiveDate} ?selected=${m === o}>
|
|
980
988
|
${y(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
981
989
|
</option>`)}
|
|
982
990
|
</select>
|
|
@@ -991,65 +999,65 @@ class ze extends $ {
|
|
|
991
999
|
<span class="spacer"></span>
|
|
992
1000
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
993
1001
|
</div>
|
|
994
|
-
${
|
|
1002
|
+
${c ? this.renderHero(e, o, i, l, c, h) : p}
|
|
995
1003
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
996
1004
|
<thead><tr>
|
|
997
1005
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
998
1006
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
999
1007
|
</tr></thead>
|
|
1000
1008
|
<tbody>
|
|
1001
|
-
${(
|
|
1009
|
+
${(o.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, o, i, d, n, h, m, f + 1))}
|
|
1002
1010
|
</tbody>
|
|
1003
1011
|
</table></div></div>
|
|
1004
1012
|
<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>
|
|
1005
1013
|
`)}
|
|
1006
1014
|
`;
|
|
1007
1015
|
}
|
|
1008
|
-
renderHero(e, t, s,
|
|
1009
|
-
const n = e.records[
|
|
1010
|
-
return
|
|
1011
|
-
<div class="hero1" style="background:${
|
|
1016
|
+
renderHero(e, t, s, o, i, d) {
|
|
1017
|
+
const n = e.records[o], h = J(e.records, o), l = d[e.teamsById[o]?.conferenceId], c = `linear-gradient(120deg, ${i.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1018
|
+
return r`
|
|
1019
|
+
<div class="hero1" style="background:${c}">
|
|
1012
1020
|
<div class="bigrank">#1</div>
|
|
1013
|
-
${C(
|
|
1021
|
+
${C(i, 64)}
|
|
1014
1022
|
<div>
|
|
1015
|
-
<h2><a href=${u(e.hrefs.school, { id:
|
|
1023
|
+
<h2><a href=${u(e.hrefs.school, { id: i.id })}>${i.name} ${i.mascot || ""}</a></h2>
|
|
1016
1024
|
<div class="facts">
|
|
1017
|
-
${w(n)} overall${
|
|
1025
|
+
${w(n)} overall${l ? r` · ${w(n, !0)} ${l.name}` : p}
|
|
1018
1026
|
· streak ${L(n?.results) || "·"}
|
|
1019
|
-
${h ?
|
|
1020
|
-
${this.movement(t, s,
|
|
1027
|
+
${h ? r` · last: ${h.mark} ${h.my}-${h.their} vs ${_(e, h.opp)}` : p}
|
|
1028
|
+
${this.movement(t, s, o)}
|
|
1021
1029
|
</div>
|
|
1022
1030
|
</div>
|
|
1023
1031
|
</div>
|
|
1024
1032
|
`;
|
|
1025
1033
|
}
|
|
1026
|
-
renderRow(e, t, s,
|
|
1027
|
-
const
|
|
1028
|
-
if (!
|
|
1029
|
-
const
|
|
1030
|
-
location.href = u(e.hrefs.school, { id:
|
|
1034
|
+
renderRow(e, t, s, o, i, d, n, h) {
|
|
1035
|
+
const l = S(e, n);
|
|
1036
|
+
if (!l) return p;
|
|
1037
|
+
const c = e.records[n], m = J(e.records, n), f = q(this.data.games, n), g = d[e.teamsById[n]?.conferenceId], k = () => {
|
|
1038
|
+
location.href = u(e.hrefs.school, { id: l.id });
|
|
1031
1039
|
};
|
|
1032
|
-
return
|
|
1040
|
+
return r`
|
|
1033
1041
|
<tr class="rowlink" @click=${(O) => {
|
|
1034
1042
|
O.target.closest("a") || k();
|
|
1035
1043
|
}}>
|
|
1036
1044
|
<td class="num" style="font-weight:700">${h}</td>
|
|
1037
1045
|
<td>${this.movement(t, s, n)}</td>
|
|
1038
|
-
<td class="teamcell">${C(
|
|
1039
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1040
|
-
<td class="num">${w(
|
|
1046
|
+
<td class="teamcell">${C(l)}<a href=${u(e.hrefs.school, { id: l.id })}>${l.name}</a>
|
|
1047
|
+
<span class="mut" style="font-size:0.78rem">${l.mascot || ""}</span></td>
|
|
1048
|
+
<td class="num">${w(c)}</td>
|
|
1041
1049
|
<td class="mut">${g?.name || "Independent"}</td>
|
|
1042
|
-
<td>${m ?
|
|
1050
|
+
<td>${m ? r`<a class="box" style="text-decoration:none" href=${u(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1043
1051
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1044
|
-
${m.my}-${m.their} vs ${
|
|
1045
|
-
<td>${
|
|
1046
|
-
<td>${this.sparkline(n,
|
|
1052
|
+
${m.my}-${m.their} vs ${_(e, m.opp)}</a>` : r`<span class="mut">·</span>`}</td>
|
|
1053
|
+
<td>${ie(e, f, n)}</td>
|
|
1054
|
+
<td>${this.sparkline(n, o, i)}</td>
|
|
1047
1055
|
</tr>
|
|
1048
1056
|
`;
|
|
1049
1057
|
}
|
|
1050
1058
|
}
|
|
1051
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1052
|
-
const
|
|
1059
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", Pe);
|
|
1060
|
+
const Ee = b`
|
|
1053
1061
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1054
1062
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1055
1063
|
.schoolhero .crest {
|
|
@@ -1072,10 +1080,14 @@ const Be = b`
|
|
|
1072
1080
|
.tile .v { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--hsot-black); }
|
|
1073
1081
|
.tile .s { font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1074
1082
|
.cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
|
|
1083
|
+
/* The season roster photo heads the roster card, above the table. Natural
|
|
1084
|
+
height: a team photo is never cropped to a box — the card's overflow
|
|
1085
|
+
rounds its top corners. */
|
|
1086
|
+
.rosterphoto { display: block; width: 100%; height: auto; background: var(--hsot-gray-1); border-bottom: 1px solid var(--hsot-gray-2); }
|
|
1075
1087
|
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
|
|
1076
1088
|
`;
|
|
1077
|
-
class
|
|
1078
|
-
static styles = [...F,
|
|
1089
|
+
class Ae extends $ {
|
|
1090
|
+
static styles = [...F, Ee];
|
|
1079
1091
|
static properties = {
|
|
1080
1092
|
...$.properties,
|
|
1081
1093
|
schoolId: { type: String, attribute: "school-id" },
|
|
@@ -1092,26 +1104,26 @@ class Pe extends $ {
|
|
|
1092
1104
|
e && !this.sport && (this.sport = e);
|
|
1093
1105
|
}
|
|
1094
1106
|
async fetchData(e) {
|
|
1095
|
-
const t = this.season || N(), s = await e.getSchool(this.schoolId),
|
|
1096
|
-
|
|
1097
|
-
|
|
1107
|
+
const t = this.season || N(), s = await e.getSchool(this.schoolId), i = (await e.listTeams({ schoolId: this.schoolId })).items, d = i.find((k) => k.sport === (this.sport || "football")) || i[0] || null, [n, h, l, c, m, f, g] = await Promise.all([
|
|
1108
|
+
d ? e.listGames({ sport: d.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1109
|
+
d ? e.listTeams({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1098
1110
|
e.listSchools(),
|
|
1099
1111
|
e.listConferences(),
|
|
1100
|
-
|
|
1101
|
-
|
|
1112
|
+
d ? e.listRankings({ sport: d.sport }) : Promise.resolve({ items: [] }),
|
|
1113
|
+
d ? e.listRosters({ teamId: d.id }) : Promise.resolve({ items: [] }),
|
|
1102
1114
|
// teamId is the public surface's one players filter (roster
|
|
1103
1115
|
// membership) — never fetch the whole collection.
|
|
1104
|
-
|
|
1116
|
+
d ? e.listPlayers({ teamId: d.id }) : Promise.resolve({ items: [] })
|
|
1105
1117
|
]);
|
|
1106
1118
|
return {
|
|
1107
1119
|
season: t,
|
|
1108
1120
|
school: s,
|
|
1109
|
-
teams:
|
|
1110
|
-
active:
|
|
1121
|
+
teams: i,
|
|
1122
|
+
active: d,
|
|
1111
1123
|
games: n.items,
|
|
1112
1124
|
allTeams: h.items,
|
|
1113
|
-
schools:
|
|
1114
|
-
conferences:
|
|
1125
|
+
schools: l.items,
|
|
1126
|
+
conferences: c.items,
|
|
1115
1127
|
rankings: m.items,
|
|
1116
1128
|
roster: f.items.find((k) => k.season === t) || null,
|
|
1117
1129
|
players: g.items
|
|
@@ -1131,111 +1143,114 @@ class Pe extends $ {
|
|
|
1131
1143
|
this.sport = e, this.load();
|
|
1132
1144
|
}
|
|
1133
1145
|
renderView() {
|
|
1134
|
-
const { school: e, teams: t, active: s, season:
|
|
1135
|
-
if (!e) return
|
|
1136
|
-
const
|
|
1137
|
-
return
|
|
1138
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${
|
|
1146
|
+
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
1147
|
+
if (!e) return r`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1148
|
+
const i = this.ctx, d = E(e.colorPrimary || "#030711"), n = (e.adm || [])[0], h = v(this.data.conferences), l = s ? h[s.conferenceId] : null;
|
|
1149
|
+
return r`
|
|
1150
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${d}">
|
|
1139
1151
|
<div class="inner">
|
|
1140
|
-
${
|
|
1152
|
+
${A(e, 84) ? r`<img class="crest logo" alt="" loading="lazy" src=${A(e, 84)} />` : r`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${E(e.colorSecondary || "#7C7C7C")}">${j(e)}</div>`}
|
|
1141
1153
|
<div style="min-width:260px">
|
|
1142
1154
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1143
1155
|
<div class="facts">
|
|
1144
|
-
${e.location ?
|
|
1145
|
-
${e.association ?
|
|
1146
|
-
${
|
|
1147
|
-
${n ?
|
|
1148
|
-
${e.openingYear ?
|
|
1149
|
-
${e.areaCode ?
|
|
1156
|
+
${e.location ? r`<span><b>Location</b>${e.location}${e.county ? r` · ${e.county} County` : p}</span>` : p}
|
|
1157
|
+
${e.association ? r`<span><b>League</b>${e.association}${e.classification ? r` · ${e.classification}` : p}</span>` : p}
|
|
1158
|
+
${l ? r`<span><b>Conference</b>${l.name}</span>` : p}
|
|
1159
|
+
${n ? r`<span><b>Enrollment</b>${n.value.toLocaleString()} (${n.season} ADM)</span>` : p}
|
|
1160
|
+
${e.openingYear ? r`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1161
|
+
${e.areaCode ? r`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1150
1162
|
</div>
|
|
1151
1163
|
</div>
|
|
1152
1164
|
</div>
|
|
1153
1165
|
</div>
|
|
1154
1166
|
<div class="band">
|
|
1155
1167
|
<nav class="tabs" aria-label="Teams">
|
|
1156
|
-
${t.map((
|
|
1157
|
-
m.preventDefault(), this.switchSport(
|
|
1158
|
-
}}>${
|
|
1168
|
+
${t.map((c) => c.id === s?.id ? r`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : r`<a href="#" @click=${(m) => {
|
|
1169
|
+
m.preventDefault(), this.switchSport(c.sport);
|
|
1170
|
+
}}>${c.name}</a>`)}
|
|
1159
1171
|
</nav>
|
|
1160
1172
|
</div>
|
|
1161
|
-
${B(this,
|
|
1173
|
+
${B(this, r`
|
|
1162
1174
|
${P(this)}
|
|
1163
|
-
${s ? this.renderTeam(
|
|
1175
|
+
${s ? this.renderTeam(i, s, l, o) : r`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1164
1176
|
`)}
|
|
1165
1177
|
`;
|
|
1166
1178
|
}
|
|
1167
|
-
renderTeam(e, t, s,
|
|
1168
|
-
const
|
|
1169
|
-
return
|
|
1179
|
+
renderTeam(e, t, s, o) {
|
|
1180
|
+
const i = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, d = i.w + i.l + i.t, n = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? ae(n, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, l = W(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((m) => m.homeTeamId === t.id || m.awayTeamId === t.id).sort((m, f) => String(m.date).localeCompare(String(f.date)));
|
|
1181
|
+
return r`
|
|
1170
1182
|
<div class="tiles">
|
|
1171
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${w(
|
|
1172
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(
|
|
1173
|
-
<div class="s">${h ? `${
|
|
1174
|
-
<div class="tile"><div class="k">Points</div><div class="v">${
|
|
1175
|
-
<div class="s">scored per game · ${
|
|
1176
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${L(
|
|
1183
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(i)}</div><div class="s">${d} games played</div></div>
|
|
1184
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(i, !0)}</div>
|
|
1185
|
+
<div class="s">${h ? `${pe(h)} of ${n.length}` : "·"}</div></div>
|
|
1186
|
+
<div class="tile"><div class="k">Points</div><div class="v">${d ? (i.pf / d).toFixed(1) : "0.0"}</div>
|
|
1187
|
+
<div class="s">scored per game · ${d ? (i.pa / d).toFixed(1) : "0.0"} allowed</div></div>
|
|
1188
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${L(i.results) || "·"}</div>
|
|
1177
1189
|
<div class="s">last 5: ${K(e, t.id)}</div></div>
|
|
1178
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1190
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${l ? `#${l}` : "NR"}</div>
|
|
1179
1191
|
<div class="s"><a href=${u(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1180
1192
|
</div>
|
|
1181
|
-
${(t.championships || []).length ?
|
|
1193
|
+
${(t.championships || []).length ? r`
|
|
1182
1194
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1183
|
-
${t.championships.map((m) =>
|
|
1195
|
+
${t.championships.map((m) => r`<span class="pill champ">★ ${m.season} ${m.title} champion${m.classification ? ` · ${m.classification}` : ""}${m.region ? ` · ${m.region}` : ""}</span>`)}
|
|
1184
1196
|
</div>` : p}
|
|
1185
1197
|
<div class="cols">
|
|
1186
1198
|
<div>
|
|
1187
1199
|
<div class="section-title">Schedule & results</div>
|
|
1188
1200
|
<div class="card">
|
|
1189
|
-
${
|
|
1201
|
+
${c.length ? r`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : r`<p class="empty">No ${t.sport} games recorded for ${o}.</p>`}
|
|
1190
1202
|
</div>
|
|
1191
1203
|
</div>
|
|
1192
1204
|
<div>
|
|
1193
|
-
<div class="section-title">Roster · ${
|
|
1194
|
-
<div class="card">${this.renderRoster(
|
|
1205
|
+
<div class="section-title">Roster · ${o}</div>
|
|
1206
|
+
<div class="card">${this.renderRoster(t, o)}</div>
|
|
1195
1207
|
</div>
|
|
1196
1208
|
</div>
|
|
1197
1209
|
`;
|
|
1198
1210
|
}
|
|
1199
1211
|
renderGameRow(e, t, s) {
|
|
1200
|
-
const
|
|
1201
|
-
let h =
|
|
1212
|
+
const o = s.homeTeamId === t.id, i = o ? s.awayTeamId : s.homeTeamId, d = o ? s.homeScore : s.awayScore, n = o ? s.awayScore : s.homeScore;
|
|
1213
|
+
let h = r`<span class="mut">${U(s.time)}</span>`;
|
|
1202
1214
|
if (s.state === "final") {
|
|
1203
|
-
const
|
|
1204
|
-
h =
|
|
1205
|
-
} else s.state === "live" && (h =
|
|
1206
|
-
const
|
|
1207
|
-
return
|
|
1215
|
+
const c = G(s), m = c === "tie" ? "T" : c === (o ? "home" : "away") ? "W" : "L";
|
|
1216
|
+
h = r`<span class=${m}>${m}</span> ${d}-${n}${s.finish === "overtime" ? r` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? r` <span class="mut">FF</span>` : p}`;
|
|
1217
|
+
} else s.state === "live" && (h = r`<span style="color:var(--hsot-red)">${d}-${n}</span>`);
|
|
1218
|
+
const l = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1219
|
+
return r`
|
|
1208
1220
|
<li>
|
|
1209
1221
|
<span class="d">${y(s.date)}</span>
|
|
1210
1222
|
${te(s).kind === "sched" ? p : R(s)}
|
|
1211
1223
|
<span class="res">${h}</span>
|
|
1212
|
-
<span class="opp">${
|
|
1213
|
-
<span class="pill type">${
|
|
1214
|
-
${s.broadcast ?
|
|
1224
|
+
<span class="opp">${o ? "vs" : "at"} ${re(e, i, s.date)}
|
|
1225
|
+
<span class="pill type">${l}</span>
|
|
1226
|
+
${s.broadcast ? r`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1215
1227
|
</span>
|
|
1216
1228
|
<span class="where">${s.venue || ""}</span>
|
|
1217
1229
|
<a class="box" href=${u(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1218
1230
|
</li>
|
|
1219
1231
|
`;
|
|
1220
1232
|
}
|
|
1221
|
-
renderRoster(e) {
|
|
1222
|
-
const
|
|
1223
|
-
if (!
|
|
1224
|
-
return
|
|
1225
|
-
const s = v(this.data.players),
|
|
1226
|
-
return
|
|
1233
|
+
renderRoster(e, t) {
|
|
1234
|
+
const s = this.data.roster;
|
|
1235
|
+
if (!s)
|
|
1236
|
+
return r`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1237
|
+
const o = De(s, 560), i = this.data.school?.name || "", d = v(this.data.players), n = s.entries.slice().sort((l, c) => (l.number || 0) - (c.number || 0)), h = n.some((l) => d[l.playerId]?.college);
|
|
1238
|
+
return r`
|
|
1239
|
+
${o ? r`<img class="rosterphoto" src=${o} loading="lazy" decoding="async"
|
|
1240
|
+
alt="${i} ${e.name} ${t} team photo" />` : p}
|
|
1227
1241
|
<div class="tablewrap"><table class="data">
|
|
1228
|
-
<thead><tr><th class="num">No.</th><th>Player</th><th>Pos</th><th>Class</th><th class="num">Ht</th><th class="num">Wt</th
|
|
1242
|
+
<thead><tr><th class="num">No.</th><th>Player</th><th>Pos</th><th>Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ? r`<th>College</th>` : p}</tr></thead>
|
|
1229
1243
|
<tbody>
|
|
1230
|
-
${
|
|
1231
|
-
const
|
|
1232
|
-
return
|
|
1233
|
-
<td class="num mut">${
|
|
1234
|
-
<td style="font-weight:500">${
|
|
1235
|
-
<td>${
|
|
1236
|
-
<td class="mut">${
|
|
1237
|
-
<td class="num">${
|
|
1238
|
-
<td class="num">${
|
|
1244
|
+
${n.map((l) => {
|
|
1245
|
+
const c = d[l.playerId];
|
|
1246
|
+
return c ? r`<tr>
|
|
1247
|
+
<td class="num mut">${l.number ?? "·"}</td>
|
|
1248
|
+
<td style="font-weight:500">${c.firstName} ${c.lastName}</td>
|
|
1249
|
+
<td>${l.position || "·"}</td>
|
|
1250
|
+
<td class="mut">${c.classOf || "·"}</td>
|
|
1251
|
+
<td class="num">${he(c.heightIn)}</td>
|
|
1252
|
+
<td class="num">${c.weightLb || "·"}</td>
|
|
1253
|
+
${h ? r`<td>${c.college || "·"}</td>` : p}
|
|
1239
1254
|
</tr>` : p;
|
|
1240
1255
|
})}
|
|
1241
1256
|
</tbody>
|
|
@@ -1243,16 +1258,16 @@ class Pe extends $ {
|
|
|
1243
1258
|
`;
|
|
1244
1259
|
}
|
|
1245
1260
|
}
|
|
1246
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1247
|
-
const
|
|
1248
|
-
function
|
|
1261
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Ae);
|
|
1262
|
+
const _e = "https://api.wral.com/search";
|
|
1263
|
+
function Re(a) {
|
|
1249
1264
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1250
1265
|
}
|
|
1251
|
-
function
|
|
1252
|
-
const t = String(a ||
|
|
1266
|
+
function Ne(a, e) {
|
|
1267
|
+
const t = String(a || _e).replace(/\/+$/, ""), s = new URLSearchParams({ query: Re(e), sort: "score", lang: "en" });
|
|
1253
1268
|
return `${t}/v1/query?${s}`;
|
|
1254
1269
|
}
|
|
1255
|
-
function
|
|
1270
|
+
function ne(a) {
|
|
1256
1271
|
try {
|
|
1257
1272
|
const e = new URL(a);
|
|
1258
1273
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1267,13 +1282,13 @@ function ie(a) {
|
|
|
1267
1282
|
}
|
|
1268
1283
|
return { uri: a, title: a };
|
|
1269
1284
|
}
|
|
1270
|
-
async function
|
|
1271
|
-
const
|
|
1272
|
-
if (!
|
|
1273
|
-
const
|
|
1274
|
-
return e.map((n) =>
|
|
1285
|
+
async function Le(a, e, t) {
|
|
1286
|
+
const o = await ((...n) => fetch(...n))(Ne(a, e));
|
|
1287
|
+
if (!o.ok) throw new Error(`search answered ${o.status}`);
|
|
1288
|
+
const i = await o.json(), d = new Map((i.items || []).map((n) => [n.uri, n]));
|
|
1289
|
+
return e.map((n) => d.get(n) || ne(n));
|
|
1275
1290
|
}
|
|
1276
|
-
const
|
|
1291
|
+
const Oe = b`
|
|
1277
1292
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1278
1293
|
.breadcrumbs a { text-decoration: none; }
|
|
1279
1294
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1312,8 +1327,8 @@ const Ne = b`
|
|
|
1312
1327
|
.cols { grid-template-columns: 1fr; }
|
|
1313
1328
|
}
|
|
1314
1329
|
`;
|
|
1315
|
-
class
|
|
1316
|
-
static styles = [...F,
|
|
1330
|
+
class He extends $ {
|
|
1331
|
+
static styles = [...F, Oe];
|
|
1317
1332
|
static properties = {
|
|
1318
1333
|
...$.properties,
|
|
1319
1334
|
gameId: { type: String, attribute: "game-id" },
|
|
@@ -1327,7 +1342,7 @@ class Le extends $ {
|
|
|
1327
1342
|
super(), this.gameId = "", this.searchApi = "";
|
|
1328
1343
|
}
|
|
1329
1344
|
async fetchData(e) {
|
|
1330
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [
|
|
1345
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [o, i, d, n, h, l] = await Promise.all([
|
|
1331
1346
|
e.listSchools(),
|
|
1332
1347
|
e.listTeams({ sport: t.sport }),
|
|
1333
1348
|
e.listConferences(),
|
|
@@ -1335,16 +1350,16 @@ class Le extends $ {
|
|
|
1335
1350
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1336
1351
|
// A search outage must not blank the box score — degrade to bare
|
|
1337
1352
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1338
|
-
s.length ?
|
|
1353
|
+
s.length ? Le(this.searchApi, s).catch(() => s.map(ne)) : Promise.resolve([])
|
|
1339
1354
|
]);
|
|
1340
1355
|
return {
|
|
1341
1356
|
game: t,
|
|
1342
|
-
schools:
|
|
1343
|
-
teams:
|
|
1344
|
-
conferences:
|
|
1357
|
+
schools: o.items,
|
|
1358
|
+
teams: i.items,
|
|
1359
|
+
conferences: d.items,
|
|
1345
1360
|
rankings: n.items,
|
|
1346
1361
|
games: h.items,
|
|
1347
|
-
coverage:
|
|
1362
|
+
coverage: l
|
|
1348
1363
|
};
|
|
1349
1364
|
}
|
|
1350
1365
|
get ctx() {
|
|
@@ -1359,10 +1374,10 @@ class Le extends $ {
|
|
|
1359
1374
|
}
|
|
1360
1375
|
renderView() {
|
|
1361
1376
|
const e = this.data.game;
|
|
1362
|
-
if (!e) return
|
|
1363
|
-
const t = this.ctx, s = v(this.data.conferences),
|
|
1364
|
-
return
|
|
1365
|
-
${B(this,
|
|
1377
|
+
if (!e) return r`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1378
|
+
const t = this.ctx, s = v(this.data.conferences), o = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, i = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, d = G(e), n = (c) => e.state === "final" && d !== c && d !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, l = this.data.games.filter((c) => c.id !== e.id && c.state === "final" && c.gameType !== "scrimmage" && (c.homeTeamId === e.homeTeamId && c.awayTeamId === e.awayTeamId || c.homeTeamId === e.awayTeamId && c.awayTeamId === e.homeTeamId));
|
|
1379
|
+
return r`
|
|
1380
|
+
${B(this, r`
|
|
1366
1381
|
${P(this)}
|
|
1367
1382
|
<p class="breadcrumbs">
|
|
1368
1383
|
<a href=${u(t.hrefs.section, { sport: e.sport, view: "scores" })}>${I(e.sport)}</a> /
|
|
@@ -1371,7 +1386,7 @@ class Le extends $ {
|
|
|
1371
1386
|
</p>
|
|
1372
1387
|
<div class="card">
|
|
1373
1388
|
<div class="scorehead">
|
|
1374
|
-
${this.teamBlock(t, e, e.awayTeamId,
|
|
1389
|
+
${this.teamBlock(t, e, e.awayTeamId, o, !1)}
|
|
1375
1390
|
<div class="mid">
|
|
1376
1391
|
<div class="bigscore">
|
|
1377
1392
|
<span style=${n("away")}>${e.awayScore}</span>
|
|
@@ -1379,30 +1394,30 @@ class Le extends $ {
|
|
|
1379
1394
|
<span style=${n("home")}>${e.homeScore}</span>
|
|
1380
1395
|
</div>
|
|
1381
1396
|
<div class="status">${R(e)}</div>
|
|
1382
|
-
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ?
|
|
1383
|
-
${e.broadcast ?
|
|
1397
|
+
<div class="status">${y(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? r` · ${U(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1398
|
+
${e.broadcast ? r` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1384
1399
|
<div class="status">
|
|
1385
1400
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1386
|
-
${e.label ?
|
|
1387
|
-
${(e.tags || []).map((
|
|
1401
|
+
${e.label ? r`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1402
|
+
${(e.tags || []).map((c) => r`<span class="pill type">${c}</span>`)}
|
|
1388
1403
|
</div>
|
|
1389
1404
|
</div>
|
|
1390
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1405
|
+
${this.teamBlock(t, e, e.homeTeamId, i, !0)}
|
|
1391
1406
|
</div>
|
|
1392
|
-
${this.renderLineScore(e,
|
|
1393
|
-
${e.notes ?
|
|
1407
|
+
${this.renderLineScore(e, o, i)}
|
|
1408
|
+
${e.notes ? r`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1394
1409
|
</div>
|
|
1395
|
-
${(this.data.coverage || []).length ?
|
|
1410
|
+
${(this.data.coverage || []).length ? r`
|
|
1396
1411
|
<div class="section-title">Coverage</div>
|
|
1397
1412
|
<div class="covgrid">
|
|
1398
|
-
${this.data.coverage.map((
|
|
1399
|
-
<a class="card covcard" href=${
|
|
1400
|
-
${
|
|
1413
|
+
${this.data.coverage.map((c) => r`
|
|
1414
|
+
<a class="card covcard" href=${c.uri}>
|
|
1415
|
+
${c.image ? r`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1401
1416
|
<div class="covbody">
|
|
1402
|
-
<div class="covtitle">${
|
|
1403
|
-
${
|
|
1404
|
-
${
|
|
1405
|
-
<div class="covmeta">${[
|
|
1417
|
+
<div class="covtitle">${c.videoDuration ? r`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? r`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
|
|
1418
|
+
${c.description ? r`<p class="covdesc">${c.description}</p>` : p}
|
|
1419
|
+
${c.author || c.publishedTime ? r`
|
|
1420
|
+
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1406
1421
|
` : p}
|
|
1407
1422
|
</div>
|
|
1408
1423
|
</a>
|
|
@@ -1410,50 +1425,50 @@ class Le extends $ {
|
|
|
1410
1425
|
</div>` : p}
|
|
1411
1426
|
<div class="section-title">Season context</div>
|
|
1412
1427
|
<div class="cols">
|
|
1413
|
-
${[[e.awayTeamId,
|
|
1428
|
+
${[[e.awayTeamId, o], [e.homeTeamId, i]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1414
1429
|
</div>
|
|
1415
|
-
${
|
|
1430
|
+
${l.length ? r`
|
|
1416
1431
|
<div class="section-title">Head to head this season</div>
|
|
1417
1432
|
<div class="card"><ul class="gamelist">
|
|
1418
|
-
${
|
|
1419
|
-
<span class="d">${y(
|
|
1420
|
-
<span class="opp">${T(t,
|
|
1421
|
-
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id:
|
|
1433
|
+
${l.map((c) => r`<li>
|
|
1434
|
+
<span class="d">${y(c.date)}</span>${R(c)}
|
|
1435
|
+
<span class="opp">${T(t, c.awayTeamId)} ${c.awayScore}, ${T(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1436
|
+
<a class="box" href=${u(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1422
1437
|
</li>`)}
|
|
1423
1438
|
</ul></div>` : p}
|
|
1424
1439
|
`)}
|
|
1425
1440
|
`;
|
|
1426
1441
|
}
|
|
1427
|
-
teamBlock(e, t, s,
|
|
1428
|
-
if (!
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1431
|
-
<div class="teamblock ${
|
|
1432
|
-
${h ?
|
|
1442
|
+
teamBlock(e, t, s, o, i) {
|
|
1443
|
+
if (!o) return r`<div class="teamblock ${i ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1444
|
+
const d = e.teamsById[s], n = e.records[s], h = A(o, 58);
|
|
1445
|
+
return r`
|
|
1446
|
+
<div class="teamblock ${i ? "right" : ""}">
|
|
1447
|
+
${h ? r`<img class="crest logo" alt="" loading="lazy" src=${h} />` : r`<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${E(o.colorPrimary || "#030711")}">${j(o)}</span>`}
|
|
1433
1448
|
<div>
|
|
1434
|
-
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id:
|
|
1435
|
-
<div class="trec">${
|
|
1449
|
+
<div class="tname">${Y(e, s, t.date)}<a href=${u(e.hrefs.school, { id: o.id })}>${o.name}</a></div>
|
|
1450
|
+
<div class="trec">${o.mascot || ""} · ${w(n)}${d?.conferenceId ? r` · ${w(n, !0)} conf` : p}</div>
|
|
1436
1451
|
</div>
|
|
1437
1452
|
</div>
|
|
1438
1453
|
`;
|
|
1439
1454
|
}
|
|
1440
1455
|
renderLineScore(e, t, s) {
|
|
1441
|
-
const
|
|
1442
|
-
if (!
|
|
1443
|
-
return
|
|
1444
|
-
const
|
|
1445
|
-
const m =
|
|
1446
|
-
return m ? m[
|
|
1447
|
-
}, h = (
|
|
1456
|
+
const o = e.periodScores || [];
|
|
1457
|
+
if (!o.length)
|
|
1458
|
+
return r`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1459
|
+
const i = Math.max(4, ...o.map((l) => l.period)), d = (l) => l <= 4 ? String(l) : `OT${l > 5 ? l - 4 : ""}`, n = (l, c) => {
|
|
1460
|
+
const m = o.find((f) => f.period === c);
|
|
1461
|
+
return m ? m[l] : e.state === "final" ? 0 : "·";
|
|
1462
|
+
}, h = (l, c, m) => r`
|
|
1448
1463
|
<tr>
|
|
1449
|
-
<td class="teamcell">${C(
|
|
1450
|
-
${Array.from({ length:
|
|
1464
|
+
<td class="teamcell">${C(l, 20)}${l?.abbr || "TBD"}</td>
|
|
1465
|
+
${Array.from({ length: i }, (f, g) => r`<td class="num">${n(c, g + 1)}</td>`)}
|
|
1451
1466
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1452
1467
|
</tr>`;
|
|
1453
|
-
return
|
|
1468
|
+
return r`
|
|
1454
1469
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1455
1470
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1456
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1471
|
+
<thead><tr><th>Team</th>${Array.from({ length: i }, (l, c) => r`<th class="num">${d(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1457
1472
|
<tbody>
|
|
1458
1473
|
${h(t, "away", e.awayScore)}
|
|
1459
1474
|
${h(s, "home", e.homeScore)}
|
|
@@ -1464,24 +1479,24 @@ class Le extends $ {
|
|
|
1464
1479
|
}
|
|
1465
1480
|
renderContext(e, t, s) {
|
|
1466
1481
|
if (!s) return p;
|
|
1467
|
-
const
|
|
1468
|
-
return
|
|
1482
|
+
const o = e.records[t], i = q(this.data.games, t);
|
|
1483
|
+
return r`
|
|
1469
1484
|
<div class="card ctxcard">
|
|
1470
1485
|
<div class="who">${C(s)}${s.name}</div>
|
|
1471
1486
|
<div class="row">
|
|
1472
1487
|
<span>Last 5: ${K(e, t)}</span>
|
|
1473
|
-
<span>Streak: <b>${
|
|
1474
|
-
<span>PF/PA: <b>${
|
|
1475
|
-
<span>Next: ${
|
|
1476
|
-
${
|
|
1488
|
+
<span>Streak: <b>${o ? L(o.results) : "·"}</b></span>
|
|
1489
|
+
<span>PF/PA: <b>${o ? `${o.pf} / ${o.pa}` : "·"}</b></span>
|
|
1490
|
+
<span>Next: ${i ? r`${y(i.date, { month: "numeric", day: "numeric" })}
|
|
1491
|
+
${i.homeTeamId === t ? "vs" : "at"} ${_(e, i.homeTeamId === t ? i.awayTeamId : i.homeTeamId)}` : "·"}</span>
|
|
1477
1492
|
</div>
|
|
1478
1493
|
</div>
|
|
1479
1494
|
`;
|
|
1480
1495
|
}
|
|
1481
1496
|
}
|
|
1482
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1483
|
-
const
|
|
1484
|
-
class
|
|
1497
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", He);
|
|
1498
|
+
const Ue = 250, Me = 2;
|
|
1499
|
+
class je extends ee {
|
|
1485
1500
|
static properties = {
|
|
1486
1501
|
api: { type: String },
|
|
1487
1502
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1561,11 +1576,11 @@ class Ue extends ee {
|
|
|
1561
1576
|
}
|
|
1562
1577
|
onInput(e) {
|
|
1563
1578
|
const t = e.target.value.trim();
|
|
1564
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1579
|
+
if (clearTimeout(this.debounceTimer), t.length < Me) {
|
|
1565
1580
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1566
1581
|
return;
|
|
1567
1582
|
}
|
|
1568
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1583
|
+
this.debounceTimer = setTimeout(() => this.search(t), Ue);
|
|
1569
1584
|
}
|
|
1570
1585
|
async search(e) {
|
|
1571
1586
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1575,8 +1590,8 @@ class Ue extends ee {
|
|
|
1575
1590
|
});
|
|
1576
1591
|
if (!s.ok)
|
|
1577
1592
|
return;
|
|
1578
|
-
const
|
|
1579
|
-
this.results =
|
|
1593
|
+
const o = await s.json();
|
|
1594
|
+
this.results = o.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
1580
1595
|
} catch (t) {
|
|
1581
1596
|
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
1582
1597
|
}
|
|
@@ -1610,36 +1625,36 @@ class Ue extends ee {
|
|
|
1610
1625
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1611
1626
|
}
|
|
1612
1627
|
renderOption(e, t) {
|
|
1613
|
-
const s = this.where(e),
|
|
1614
|
-
|
|
1628
|
+
const s = this.where(e), o = (i) => {
|
|
1629
|
+
i.preventDefault(), this.go(e);
|
|
1615
1630
|
};
|
|
1616
|
-
return
|
|
1631
|
+
return r`
|
|
1617
1632
|
<li
|
|
1618
1633
|
id="school-option-${t}"
|
|
1619
1634
|
role="option"
|
|
1620
1635
|
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
1621
|
-
@pointerdown="${
|
|
1636
|
+
@pointerdown="${o}"
|
|
1622
1637
|
@mousemove="${() => {
|
|
1623
1638
|
this.activeIndex = t;
|
|
1624
1639
|
}}"
|
|
1625
1640
|
>
|
|
1626
1641
|
<span class="name">${e.name}</span>
|
|
1627
|
-
${s ?
|
|
1642
|
+
${s ? r`<span class="where">${s}</span>` : p}
|
|
1628
1643
|
</li>
|
|
1629
1644
|
`;
|
|
1630
1645
|
}
|
|
1631
1646
|
renderListbox() {
|
|
1632
|
-
const e = this.searched && !this.results.length, t =
|
|
1633
|
-
return
|
|
1647
|
+
const e = this.searched && !this.results.length, t = r`<li class="empty">No schools found</li>`;
|
|
1648
|
+
return r`
|
|
1634
1649
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1635
|
-
${this.results.map((s,
|
|
1650
|
+
${this.results.map((s, o) => this.renderOption(s, o))}
|
|
1636
1651
|
${e ? t : p}
|
|
1637
1652
|
</ul>
|
|
1638
1653
|
`;
|
|
1639
1654
|
}
|
|
1640
1655
|
render() {
|
|
1641
1656
|
const e = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
1642
|
-
return
|
|
1657
|
+
return r`
|
|
1643
1658
|
<input
|
|
1644
1659
|
type="text"
|
|
1645
1660
|
role="combobox"
|
|
@@ -1658,22 +1673,22 @@ class Ue extends ee {
|
|
|
1658
1673
|
`;
|
|
1659
1674
|
}
|
|
1660
1675
|
}
|
|
1661
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1676
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", je);
|
|
1662
1677
|
export {
|
|
1663
1678
|
H as D,
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1679
|
+
He as H,
|
|
1680
|
+
Pe as a,
|
|
1681
|
+
Ae as b,
|
|
1682
|
+
je as c,
|
|
1683
|
+
Fe as d,
|
|
1684
|
+
ze as e,
|
|
1670
1685
|
z as f,
|
|
1671
|
-
|
|
1686
|
+
de as g,
|
|
1672
1687
|
u as h,
|
|
1673
1688
|
G as i,
|
|
1674
|
-
|
|
1689
|
+
qe as j,
|
|
1675
1690
|
L as k,
|
|
1676
|
-
|
|
1691
|
+
Se as p,
|
|
1677
1692
|
w as r,
|
|
1678
1693
|
ae as s,
|
|
1679
1694
|
W as t
|