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