@wral/hsot-data 0.1.14 → 0.1.15
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 +1 -1
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +548 -495
- package/dist/{hsot-school-search-CtMiZfDB.js → hsot-school-search-CPsDpIgS.js} +595 -542
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { LitElement as ae, html as n, css as y, nothing as p, svg as Z } from "lit";
|
|
2
|
+
const pe = 50;
|
|
3
|
+
function fe(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 ue({ 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 || ((...i) => fetch(...i));
|
|
12
|
+
async function o(i) {
|
|
13
13
|
const h = { Accept: "application/json" };
|
|
14
14
|
e && (h.Authorization = `Bearer ${e}`);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const c = new Error(`api-hsot ${
|
|
18
|
-
throw c.status =
|
|
15
|
+
const d = await r(`${s}${i}`, { headers: h });
|
|
16
|
+
if (!d.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${d.status} on ${i}`);
|
|
18
|
+
throw c.status = d.status, c;
|
|
19
19
|
}
|
|
20
|
-
return
|
|
20
|
+
return d.json();
|
|
21
21
|
}
|
|
22
|
-
async function
|
|
23
|
-
const
|
|
22
|
+
async function l(i, h = {}) {
|
|
23
|
+
const d = [];
|
|
24
24
|
let c = null;
|
|
25
|
-
for (let m = 0; m <
|
|
26
|
-
const f =
|
|
27
|
-
if (
|
|
25
|
+
for (let m = 0; m < pe; m += 1) {
|
|
26
|
+
const f = fe(c ? { ...h, cursor: c } : h), u = await o(`${i}${f}`);
|
|
27
|
+
if (d.push(...u.items || []), c = u.nextCursor || null, !c) break;
|
|
28
28
|
}
|
|
29
|
-
return { items:
|
|
29
|
+
return { items: d, total: d.length, nextCursor: null };
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
|
-
listSchools: (
|
|
33
|
-
getSchool: (
|
|
34
|
-
listTeams: (
|
|
35
|
-
getTeam: (
|
|
36
|
-
listConferences: (
|
|
37
|
-
listPlayers: (
|
|
38
|
-
listRosters: (
|
|
39
|
-
listGames: (
|
|
40
|
-
getGame: (
|
|
41
|
-
listTournaments: (
|
|
42
|
-
listSeedings: (
|
|
43
|
-
listRankings: (
|
|
44
|
-
listSports: () =>
|
|
32
|
+
listSchools: (i) => l("/schools", i),
|
|
33
|
+
getSchool: (i) => o(`/schools/${i}`),
|
|
34
|
+
listTeams: (i) => l("/teams", i),
|
|
35
|
+
getTeam: (i) => o(`/teams/${i}`),
|
|
36
|
+
listConferences: (i) => l("/conferences", i),
|
|
37
|
+
listPlayers: (i) => l("/players", i),
|
|
38
|
+
listRosters: (i) => l("/rosters", i),
|
|
39
|
+
listGames: (i) => l("/games", i),
|
|
40
|
+
getGame: (i) => o(`/games/${i}`),
|
|
41
|
+
listTournaments: (i) => l("/tournaments", i),
|
|
42
|
+
listSeedings: (i, h) => l(`/tournaments/${i}/seedings`, h),
|
|
43
|
+
listRankings: (i) => l("/rankings", i),
|
|
44
|
+
listSports: () => o("/sports")
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const O = {
|
|
48
48
|
game: "/{sport}/game/{id}/",
|
|
49
49
|
school: "/school/{id}/",
|
|
50
50
|
section: "/{sport}/{view}/"
|
|
51
51
|
};
|
|
52
|
-
function
|
|
52
|
+
function g(a, e) {
|
|
53
53
|
return String(a).replace(/\{(\w+)\}/g, (t, s) => e[s] !== void 0 && e[s] !== null ? String(e[s]) : t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function F(a) {
|
|
56
56
|
return {
|
|
57
|
-
game: a.getAttribute("game-href") ||
|
|
58
|
-
school: a.getAttribute("school-href") ||
|
|
59
|
-
section: a.getAttribute("section-href") ||
|
|
57
|
+
game: a.getAttribute("game-href") || O.game,
|
|
58
|
+
school: a.getAttribute("school-href") || O.school,
|
|
59
|
+
section: a.getAttribute("section-href") || O.section
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
function
|
|
62
|
+
const I = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
63
|
+
function $(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,50 +72,50 @@ 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 ge(a) {
|
|
76
76
|
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ve(a) {
|
|
79
79
|
return (Array.isArray(a?.positions) ? a.positions : String(a?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function M(a = /* @__PURE__ */ new Date()) {
|
|
82
82
|
const e = a.getFullYear();
|
|
83
83
|
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function j(a = /* @__PURE__ */ new Date()) {
|
|
86
86
|
const e = (t) => String(t).padStart(2, "0");
|
|
87
87
|
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function be(a, e = j()) {
|
|
90
90
|
const t = [...new Set((a || []).filter(Boolean))].sort();
|
|
91
91
|
if (!t.length || t.includes(e)) return e;
|
|
92
|
-
const s = t.filter((
|
|
92
|
+
const s = t.filter((r) => r < e);
|
|
93
93
|
return s.length ? s[s.length - 1] : t[0];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function q(a) {
|
|
96
96
|
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function _(a) {
|
|
99
99
|
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
100
|
-
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255,
|
|
101
|
-
return 0.299 * t + 0.587 * s + 0.114 *
|
|
100
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, r = e & 255;
|
|
101
|
+
return 0.299 * t + 0.587 * s + 0.114 * r > 150 ? "#0F1B33" : "#FFFFFF";
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const ye = (a) => {
|
|
104
104
|
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
105
105
|
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
106
106
|
};
|
|
107
|
-
function
|
|
108
|
-
const t = (
|
|
109
|
-
const
|
|
110
|
-
return
|
|
111
|
-
}, s = t(a),
|
|
112
|
-
return s !== null &&
|
|
107
|
+
function J(a, e) {
|
|
108
|
+
const t = (o) => {
|
|
109
|
+
const l = /^\d+/.exec(String(o ?? ""));
|
|
110
|
+
return l ? Number(l[0]) : null;
|
|
111
|
+
}, s = t(a), r = t(e);
|
|
112
|
+
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" });
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function $e(a, e) {
|
|
115
115
|
const t = (s) => String(s?.name ?? s ?? "");
|
|
116
116
|
return t(a).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function re(a) {
|
|
119
119
|
if (a.state === "live") {
|
|
120
120
|
const e = [a.period, a.clock].filter(Boolean).join(" ");
|
|
121
121
|
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
@@ -124,54 +124,54 @@ function se(a) {
|
|
|
124
124
|
const e = [];
|
|
125
125
|
return a.finish === "overtime" && e.push("OT"), a.finish === "shootout" && e.push("PK-SO"), a.forfeit && a.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
|
|
126
126
|
}
|
|
127
|
-
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${
|
|
127
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${U(a.time)}`.replace(/ · $/, "") };
|
|
128
128
|
}
|
|
129
|
-
const
|
|
130
|
-
function
|
|
129
|
+
const we = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
130
|
+
function S(a) {
|
|
131
131
|
let e = String(a || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
132
132
|
const t = e.indexOf("#");
|
|
133
133
|
let s = "";
|
|
134
134
|
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
135
|
-
let
|
|
136
|
-
return
|
|
135
|
+
let r = e.split("?")[0] + s;
|
|
136
|
+
return r = r.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), r = r.replace(/^\/(?=#)/, ""), r.length > 1 && (r = r.replace(/\/+$/, "")), r.toLowerCase();
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function oe() {
|
|
139
139
|
const a = globalThis.location;
|
|
140
140
|
if (!a) return "";
|
|
141
141
|
const e = (a.hash || "").startsWith("#/") ? a.hash : "";
|
|
142
|
-
return
|
|
142
|
+
return S((a.pathname || "") + e);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function xe(a, e, t) {
|
|
145
145
|
if (!t) return null;
|
|
146
|
-
const s =
|
|
146
|
+
const s = S(a);
|
|
147
147
|
if (!s) return null;
|
|
148
|
-
const
|
|
149
|
-
if (s ===
|
|
150
|
-
const
|
|
151
|
-
if (s ===
|
|
152
|
-
if (!s.startsWith(`${
|
|
153
|
-
const
|
|
154
|
-
return h.length > 2 || h.some((
|
|
148
|
+
const r = S(g(e.game, { sport: t, id: "" })), o = S(g(e.school, { id: "" }));
|
|
149
|
+
if (s === r || s.startsWith(`${r}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
150
|
+
const l = S(g(e.section, { sport: t, view: "" }));
|
|
151
|
+
if (s === l) return "";
|
|
152
|
+
if (!s.startsWith(`${l}/`)) return null;
|
|
153
|
+
const i = s.slice(l.length + 1), h = i.split("/");
|
|
154
|
+
return h.length > 2 || h.some((d) => !/^[a-z][a-z-]*$/.test(d)) || we.has(h[0]) ? null : i;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
const s = (
|
|
156
|
+
function ke(a, e, t) {
|
|
157
|
+
const s = (l) => g(t.section, { sport: a, view: l }).replace(/([^:])\/{2,}/g, "$1/"), o = new Set((e || []).map((l) => l && l.gender).filter((l) => l === "boys" || l === "girls")).size === 2 ? [
|
|
158
158
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
159
159
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
160
160
|
] : [{ label: "Standings", href: s("standings") }];
|
|
161
161
|
return [
|
|
162
|
-
{ label: `${
|
|
162
|
+
{ label: `${I(a)} Home`, href: s("") },
|
|
163
163
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
164
164
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
165
|
-
...
|
|
165
|
+
...o,
|
|
166
166
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
167
167
|
];
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
const t =
|
|
169
|
+
function Se(a, e = oe()) {
|
|
170
|
+
const t = S(e);
|
|
171
171
|
for (const s of a.querySelectorAll(':scope > a[slot="nav"]'))
|
|
172
|
-
t &&
|
|
172
|
+
t && S(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
173
173
|
}
|
|
174
|
-
class
|
|
174
|
+
class w extends ae {
|
|
175
175
|
static properties = {
|
|
176
176
|
api: { type: String },
|
|
177
177
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -190,7 +190,7 @@ class $ extends te {
|
|
|
190
190
|
this._client = e, this.isConnected && this.load();
|
|
191
191
|
}
|
|
192
192
|
get client() {
|
|
193
|
-
return this._client ? this._client : this.api ?
|
|
193
|
+
return this._client ? this._client : this.api ? ue({ baseUrl: this.api }) : null;
|
|
194
194
|
}
|
|
195
195
|
connectedCallback() {
|
|
196
196
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -202,7 +202,7 @@ class $ extends te {
|
|
|
202
202
|
this.load();
|
|
203
203
|
}
|
|
204
204
|
updated(e) {
|
|
205
|
-
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(),
|
|
205
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), Se(this);
|
|
206
206
|
}
|
|
207
207
|
async load() {
|
|
208
208
|
const e = this.client;
|
|
@@ -231,13 +231,13 @@ class $ extends te {
|
|
|
231
231
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
232
232
|
}
|
|
233
233
|
render() {
|
|
234
|
-
return this.error === "not-configured" ?
|
|
234
|
+
return this.error === "not-configured" ? n`<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 ? n`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : n`<div class="loading" role="status">Loading…</div>`;
|
|
235
235
|
}
|
|
236
236
|
renderView() {
|
|
237
|
-
return
|
|
237
|
+
return n``;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])),
|
|
240
|
+
const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), Te = y`
|
|
241
241
|
:host {
|
|
242
242
|
--hsot-red: var(--color-red, #D1232A);
|
|
243
243
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -275,7 +275,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
275
275
|
outline-offset: 1px;
|
|
276
276
|
}
|
|
277
277
|
.mut { color: var(--hsot-gray-5); }
|
|
278
|
-
`,
|
|
278
|
+
`, Ie = y`
|
|
279
279
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
280
280
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
281
281
|
.band h1, .band h2.bandtitle {
|
|
@@ -324,7 +324,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
324
324
|
@media (max-width: 720px) {
|
|
325
325
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
326
326
|
}
|
|
327
|
-
`,
|
|
327
|
+
`, Ce = y`
|
|
328
328
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
329
329
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
330
330
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -388,7 +388,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
388
388
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
389
389
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
390
390
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
391
|
-
`,
|
|
391
|
+
`, De = y`
|
|
392
392
|
.pill {
|
|
393
393
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
394
394
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -403,7 +403,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
403
403
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
404
404
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
405
405
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
406
|
-
`,
|
|
406
|
+
`, Fe = y`
|
|
407
407
|
.tablewrap { overflow-x: auto; }
|
|
408
408
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
409
409
|
table.data th {
|
|
@@ -421,7 +421,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
421
421
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
422
422
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
423
423
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
424
|
-
`,
|
|
424
|
+
`, ze = y`
|
|
425
425
|
.swatch {
|
|
426
426
|
display: inline-flex; align-items: center; justify-content: center;
|
|
427
427
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -445,7 +445,7 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
445
445
|
.dot.W { background: var(--hsot-win); }
|
|
446
446
|
.dot.L { background: var(--hsot-loss); }
|
|
447
447
|
.dot.T { background: var(--hsot-tie); }
|
|
448
|
-
`,
|
|
448
|
+
`, Pe = y`
|
|
449
449
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
450
450
|
.gamelist li {
|
|
451
451
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -495,183 +495,183 @@ const v = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), we = b`
|
|
|
495
495
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
496
496
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
497
497
|
.gamelist a.box { font-size: 0.78rem; }
|
|
498
|
-
`,
|
|
498
|
+
`, z = [Te, Ie, Ce, De, Fe, ze, Pe];
|
|
499
499
|
function G(a) {
|
|
500
500
|
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";
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function Be(a) {
|
|
503
503
|
return a && (a.forfeit === "home" || a.forfeit === "away") ? a.forfeit : null;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
const t = {}, s = (
|
|
507
|
-
for (const
|
|
508
|
-
const
|
|
505
|
+
function P(a, e) {
|
|
506
|
+
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, l) => String(o.date).localeCompare(String(l.date)));
|
|
507
|
+
for (const o of r) {
|
|
508
|
+
const l = G(o), i = o.gameType === "conference";
|
|
509
509
|
for (const h of ["home", "away"]) {
|
|
510
|
-
const
|
|
511
|
-
if (!
|
|
512
|
-
const c = s(
|
|
510
|
+
const d = h === "home" ? o.homeTeamId : o.awayTeamId;
|
|
511
|
+
if (!d) continue;
|
|
512
|
+
const c = s(d), m = h === "home" ? o.homeScore : o.awayScore, f = h === "home" ? o.awayScore : o.homeScore;
|
|
513
513
|
c.pf += m, c.pa += f;
|
|
514
|
-
let
|
|
515
|
-
|
|
514
|
+
let u = "T";
|
|
515
|
+
l === "tie" ? (c.t += 1, i && (c.ct += 1)) : l === h ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: o.id, date: o.date, mark: u, my: m, their: f, opp: h === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
return t;
|
|
519
519
|
}
|
|
520
|
-
function
|
|
520
|
+
function H(a) {
|
|
521
521
|
if (!a || !a.length) return "";
|
|
522
522
|
const e = a[a.length - 1].mark;
|
|
523
523
|
let t = 0;
|
|
524
524
|
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
525
525
|
return e + t;
|
|
526
526
|
}
|
|
527
|
-
const
|
|
527
|
+
const ee = (a, e, t) => {
|
|
528
528
|
const s = a + e + t;
|
|
529
529
|
return s ? (a + t / 2) / s : 0;
|
|
530
|
-
},
|
|
531
|
-
function
|
|
530
|
+
}, te = (a) => a.toFixed(3).replace("0.", ".");
|
|
531
|
+
function k(a, e = !1) {
|
|
532
532
|
if (!a) return "0-0";
|
|
533
|
-
const t = e ? a.cw : a.w, s = e ? a.cl : a.l,
|
|
534
|
-
return `${t}-${s}${
|
|
533
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, r = e ? a.ct : a.t;
|
|
534
|
+
return `${t}-${s}${r ? `-${r}` : ""}`;
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function ne(a, e) {
|
|
537
537
|
return a.map((t) => {
|
|
538
538
|
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
539
|
-
return { team: t, rec: s, confPct:
|
|
539
|
+
return { team: t, rec: s, confPct: ee(s.cw, s.cl, s.ct), overallPct: ee(s.w, s.l, s.t) };
|
|
540
540
|
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function W(a, e) {
|
|
543
543
|
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;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function se(a, e) {
|
|
546
546
|
const t = a[e];
|
|
547
547
|
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
let
|
|
551
|
-
for (const
|
|
552
|
-
|
|
553
|
-
return
|
|
549
|
+
function st(a, e, t, s = "") {
|
|
550
|
+
let r = null;
|
|
551
|
+
for (const o of a || [])
|
|
552
|
+
o.sport === e && (t && o.effectiveDate > t || s && o.gender && o.gender !== s || (!r || o.effectiveDate > r.effectiveDate) && (r = o));
|
|
553
|
+
return r;
|
|
554
554
|
}
|
|
555
|
-
function
|
|
556
|
-
const
|
|
557
|
-
if (!
|
|
558
|
-
const
|
|
555
|
+
function V(a, e, t, s, r) {
|
|
556
|
+
const o = e[t];
|
|
557
|
+
if (!o) return null;
|
|
558
|
+
const l = /* @__PURE__ */ new Map();
|
|
559
559
|
for (const h of a || []) {
|
|
560
|
-
if (h.sport !== s ||
|
|
561
|
-
const
|
|
562
|
-
(!c || h.effectiveDate > c.effectiveDate) &&
|
|
560
|
+
if (h.sport !== s || r && h.effectiveDate > r || h.gender && o.gender !== h.gender && o.gender !== "coed") continue;
|
|
561
|
+
const d = h.gender || "", c = l.get(d);
|
|
562
|
+
(!c || h.effectiveDate > c.effectiveDate) && l.set(d, h);
|
|
563
563
|
}
|
|
564
|
-
let
|
|
565
|
-
for (const h of
|
|
566
|
-
const
|
|
567
|
-
|
|
564
|
+
let i = null;
|
|
565
|
+
for (const h of l.values()) {
|
|
566
|
+
const d = (h.teamIds || []).indexOf(t);
|
|
567
|
+
d !== -1 && (!i || h.effectiveDate > i.effectiveDate) && (i = { poll: h, rank: d + 1 });
|
|
568
568
|
}
|
|
569
|
-
return
|
|
569
|
+
return i ? i.rank : null;
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function Ae(a, e, t) {
|
|
572
572
|
if (!a) return { kind: "none", delta: 0 };
|
|
573
573
|
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
574
574
|
if (!s) return { kind: "none", delta: 0 };
|
|
575
575
|
if (!e) return { kind: "same", delta: 0 };
|
|
576
|
-
const
|
|
577
|
-
if (!
|
|
578
|
-
const
|
|
579
|
-
return
|
|
576
|
+
const r = (e.teamIds || []).indexOf(t) + 1;
|
|
577
|
+
if (!r) return { kind: "new", delta: 0 };
|
|
578
|
+
const o = r - s;
|
|
579
|
+
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Ee(a) {
|
|
582
582
|
return /^https?:\/\//i.test(String(a || ""));
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
if (!
|
|
584
|
+
function ie(a, { w: e, h: t } = {}) {
|
|
585
|
+
if (!Ee(a)) return "";
|
|
586
586
|
const s = [];
|
|
587
587
|
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
588
|
-
const
|
|
589
|
-
return `${a}${
|
|
588
|
+
const r = a.includes("?") ? "&" : "?";
|
|
589
|
+
return `${a}${r}${s.join("&")}`;
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function R(a, e) {
|
|
592
592
|
const t = e * 2;
|
|
593
|
-
return
|
|
593
|
+
return ie(a?.logoAssetId, { w: t, h: t });
|
|
594
594
|
}
|
|
595
|
-
function
|
|
596
|
-
return
|
|
595
|
+
function _e(a, e) {
|
|
596
|
+
return ie(a?.photoAssetId, { w: e * 2 });
|
|
597
597
|
}
|
|
598
|
-
function
|
|
599
|
-
const
|
|
600
|
-
return
|
|
598
|
+
function Y(a, e, { title: t, sub: s, teams: r }) {
|
|
599
|
+
const o = oe(), i = !!a.querySelector(':scope > a[slot="nav"]') || xe(o, e.hrefs, e.sport) !== null;
|
|
600
|
+
return n`
|
|
601
601
|
<div class="band section">
|
|
602
602
|
<div class="inner">
|
|
603
603
|
<h1>${t}</h1>
|
|
604
|
-
${s ?
|
|
604
|
+
${s ? n`<p class="sub">${s}</p>` : p}
|
|
605
605
|
</div>
|
|
606
|
-
${
|
|
607
|
-
<nav class="sectionnav" aria-label="${
|
|
606
|
+
${i ? n`
|
|
607
|
+
<nav class="sectionnav" aria-label="${I(e.sport)} section">
|
|
608
608
|
<div class="navrow">
|
|
609
609
|
<slot name="nav">
|
|
610
|
-
${
|
|
611
|
-
aria-current=${
|
|
610
|
+
${ke(e.sport, r, e.hrefs).map((h) => n`<a href=${h.href}
|
|
611
|
+
aria-current=${o && S(h.href) === o ? "page" : p}>${h.label}</a>`)}
|
|
612
612
|
</slot>
|
|
613
613
|
</div>
|
|
614
614
|
</nav>` : p}
|
|
615
615
|
</div>
|
|
616
616
|
`;
|
|
617
617
|
}
|
|
618
|
-
const
|
|
618
|
+
const C = (a, e) => {
|
|
619
619
|
const t = a.teamsById[e];
|
|
620
620
|
return t ? a.schoolsById[t.schoolId] : null;
|
|
621
|
-
},
|
|
622
|
-
function
|
|
621
|
+
}, T = (a, e) => C(a, e)?.name || "TBD", N = (a, e) => C(a, e)?.abbr || "TBD";
|
|
622
|
+
function D(a, e = 26) {
|
|
623
623
|
if (!a) return p;
|
|
624
|
-
const t =
|
|
624
|
+
const t = R(a, e);
|
|
625
625
|
if (t)
|
|
626
|
-
return
|
|
626
|
+
return n`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
627
627
|
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
628
|
-
const s = a.colorPrimary || "#030711",
|
|
629
|
-
return
|
|
630
|
-
style="width:${e}px;height:${e}px;background:${s};color:${
|
|
631
|
-
>${
|
|
628
|
+
const s = a.colorPrimary || "#030711", r = _(s);
|
|
629
|
+
return n`<span class="swatch" aria-hidden="true"
|
|
630
|
+
style="width:${e}px;height:${e}px;background:${s};color:${r};font-size:${Math.max(8, e * 0.28)}px"
|
|
631
|
+
>${q(a)}</span>`;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
const s =
|
|
635
|
-
return s ?
|
|
633
|
+
function Q(a, e, t) {
|
|
634
|
+
const s = V(a.rankings, a.teamsById, e, a.sport, t);
|
|
635
|
+
return s ? n`<span class="rankbadge">#${s}</span>` : p;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
const s =
|
|
639
|
-
return s ?
|
|
637
|
+
function le(a, e, t) {
|
|
638
|
+
const s = C(a, e);
|
|
639
|
+
return s ? n`${Q(a, e, t)}<a href=${g(a.hrefs.school, { id: s.id })}>${s.name}</a>` : n`<span class="mut">TBD</span>`;
|
|
640
640
|
}
|
|
641
641
|
function K(a, e, t = 5) {
|
|
642
642
|
const s = a.records[e];
|
|
643
|
-
if (!s || !s.results.length) return
|
|
644
|
-
const
|
|
645
|
-
return
|
|
646
|
-
${
|
|
647
|
-
title="${
|
|
648
|
-
href=${
|
|
643
|
+
if (!s || !s.results.length) return n`<span class="mut">·</span>`;
|
|
644
|
+
const r = s.results.slice(-1 * t);
|
|
645
|
+
return n`<span class="dots" role="img" aria-label="last ${r.length} results">
|
|
646
|
+
${r.map((o) => n`<a class="dot ${o.mark}"
|
|
647
|
+
title="${o.mark} ${o.my}-${o.their} vs ${T(a, o.opp)}"
|
|
648
|
+
href=${g(a.hrefs.game, { sport: a.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
649
649
|
</span>`;
|
|
650
650
|
}
|
|
651
651
|
function B(a, e) {
|
|
652
|
-
return a.querySelector(':scope > [slot="rail"]') ?
|
|
652
|
+
return a.querySelector(':scope > [slot="rail"]') ? n`<div class="view withrail">
|
|
653
653
|
<div class="viewmain">${e}</div>
|
|
654
654
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
655
|
-
</div>` :
|
|
655
|
+
</div>` : n`<div class="view">${e}</div>`;
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function A(a) {
|
|
658
658
|
if (!a.promoImage) return p;
|
|
659
|
-
const e =
|
|
660
|
-
return
|
|
659
|
+
const e = n`<img src=${a.promoImage} alt=${a.promoAlt || "Sponsor"}>`;
|
|
660
|
+
return n`<div class="promo">${a.promoHref ? n`<a href=${a.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
663
|
-
const e =
|
|
664
|
-
return
|
|
662
|
+
function L(a) {
|
|
663
|
+
const e = re(a);
|
|
664
|
+
return n`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
665
665
|
}
|
|
666
|
-
function
|
|
667
|
-
if (!e) return
|
|
668
|
-
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId,
|
|
669
|
-
return
|
|
666
|
+
function ce(a, e, t) {
|
|
667
|
+
if (!e) return n`<span class="mut">·</span>`;
|
|
668
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, r = e.homeTeamId === t ? "vs" : "at";
|
|
669
|
+
return n`${e.state === "live" ? n`<span class="pill live">Live</span> ` : n`${$(e.date, { month: "numeric", day: "numeric" })} `}${r} ${N(a, s)}`;
|
|
670
670
|
}
|
|
671
|
-
class
|
|
672
|
-
static styles =
|
|
671
|
+
class Re extends w {
|
|
672
|
+
static styles = z;
|
|
673
673
|
static properties = {
|
|
674
|
-
|
|
674
|
+
...w.properties,
|
|
675
675
|
sport: { type: String },
|
|
676
676
|
season: { type: String },
|
|
677
677
|
date: { type: String }
|
|
@@ -687,57 +687,57 @@ class Pe extends $ {
|
|
|
687
687
|
this._datePinned = !!this.date;
|
|
688
688
|
}
|
|
689
689
|
async fetchData(e) {
|
|
690
|
-
const t = this.season ||
|
|
690
|
+
const t = this.season || M(), [s, r, o, l, i] = await Promise.all([
|
|
691
691
|
e.listSchools(),
|
|
692
692
|
e.listTeams({ sport: this.sport }),
|
|
693
693
|
e.listConferences(),
|
|
694
694
|
e.listGames({ sport: this.sport, season: t }),
|
|
695
695
|
e.listRankings({ sport: this.sport })
|
|
696
696
|
]);
|
|
697
|
-
return this._datePinned || (this.date =
|
|
697
|
+
return this._datePinned || (this.date = be(l.items.map((h) => h.date)), this._datePinned = !0), {
|
|
698
698
|
season: t,
|
|
699
699
|
schools: s.items,
|
|
700
|
-
teams:
|
|
701
|
-
conferences:
|
|
702
|
-
games:
|
|
703
|
-
rankings:
|
|
700
|
+
teams: r.items,
|
|
701
|
+
conferences: o.items,
|
|
702
|
+
games: l.items,
|
|
703
|
+
rankings: i.items
|
|
704
704
|
};
|
|
705
705
|
}
|
|
706
706
|
get ctx() {
|
|
707
707
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
708
708
|
teamsById: v(this.data.teams),
|
|
709
709
|
schoolsById: v(this.data.schools),
|
|
710
|
-
records:
|
|
710
|
+
records: P(this.data.games),
|
|
711
711
|
rankings: this.data.rankings,
|
|
712
|
-
hrefs:
|
|
712
|
+
hrefs: F(this),
|
|
713
713
|
sport: this.sport
|
|
714
714
|
}, this._ctxData = this.data), this._ctx;
|
|
715
715
|
}
|
|
716
716
|
renderView() {
|
|
717
|
-
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((
|
|
718
|
-
const c = [
|
|
719
|
-
return c.length ? Math.min(...c) :
|
|
720
|
-
},
|
|
721
|
-
|
|
717
|
+
const e = this.ctx, t = v(this.data.conferences), s = [...new Set(this.data.games.map((d) => d.date).filter(Boolean))].sort(), r = Number.MAX_SAFE_INTEGER, o = (d) => {
|
|
718
|
+
const c = [d.awayTeamId, d.homeTeamId].map((m) => V(e.rankings, e.teamsById, m, this.sport, d.date)).filter(Boolean);
|
|
719
|
+
return c.length ? Math.min(...c) : r;
|
|
720
|
+
}, l = this.data.games.filter((d) => d.date === this.date), i = new Map(l.map((d) => [d, o(d)]));
|
|
721
|
+
l.sort((d, c) => (d.state === "live" ? 0 : 1) - (c.state === "live" ? 0 : 1) || i.get(d) - i.get(c));
|
|
722
722
|
const h = /* @__PURE__ */ new Map();
|
|
723
|
-
return
|
|
724
|
-
const c =
|
|
725
|
-
h.has(c) || h.set(c, []), h.get(c).push(
|
|
726
|
-
}),
|
|
727
|
-
${
|
|
728
|
-
title:
|
|
729
|
-
sub:
|
|
723
|
+
return l.forEach((d) => {
|
|
724
|
+
const c = d.gameType === "conference" && d.conferenceId ? t[d.conferenceId]?.name || "Conference" : d.gameType === "playoff" ? "Playoffs" : d.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
725
|
+
h.has(c) || h.set(c, []), h.get(c).push(d);
|
|
726
|
+
}), n`
|
|
727
|
+
${Y(this, e, {
|
|
728
|
+
title: n`${I(this.sport)} scores & schedules`,
|
|
729
|
+
sub: n`${$(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${l.length} games`,
|
|
730
730
|
teams: this.data.teams
|
|
731
731
|
})}
|
|
732
|
-
${B(this,
|
|
733
|
-
${
|
|
732
|
+
${B(this, n`
|
|
733
|
+
${A(this)}
|
|
734
734
|
<div class="toolbar">
|
|
735
735
|
<label class="asof" for="datesel">Date</label>
|
|
736
|
-
<select id="datesel" @change=${(
|
|
737
|
-
this.date =
|
|
736
|
+
<select id="datesel" @change=${(d) => {
|
|
737
|
+
this.date = d.target.value;
|
|
738
738
|
}}>
|
|
739
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
740
|
-
${
|
|
739
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((d) => n`<option value=${d} ?selected=${d === this.date}>
|
|
740
|
+
${$(d, { weekday: "short", month: "short", day: "numeric" })}${d === j() ? " · today" : ""}
|
|
741
741
|
</option>`)}
|
|
742
742
|
</select>
|
|
743
743
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -751,9 +751,9 @@ class Pe extends $ {
|
|
|
751
751
|
<span class="spacer"></span>
|
|
752
752
|
<span class="asof">Live games first · report a score to see it update here</span>
|
|
753
753
|
</div>
|
|
754
|
-
${
|
|
755
|
-
${[...h.entries()].map(([
|
|
756
|
-
<div class="section-title">${
|
|
754
|
+
${l.length ? p : n`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
755
|
+
${[...h.entries()].map(([d, c]) => n`
|
|
756
|
+
<div class="section-title">${d}</div>
|
|
757
757
|
<div class="card"><ul class="gamelist">
|
|
758
758
|
${c.map((m) => this.renderGame(e, m))}
|
|
759
759
|
</ul></div>
|
|
@@ -765,24 +765,24 @@ class Pe extends $ {
|
|
|
765
765
|
// a lone score column on the far right read as detached from the teams).
|
|
766
766
|
// Scheduled games carry their start time on the status pill alone.
|
|
767
767
|
renderGame(e, t) {
|
|
768
|
-
const s = t.state === "final" || t.state === "live",
|
|
769
|
-
return
|
|
768
|
+
const s = t.state === "final" || t.state === "live", r = (l, i, h = p) => n`<span class="side">${le(e, l, t.date)}${s ? n`<span class="score">${i}</span>` : p}${h}</span>`, o = Be(t);
|
|
769
|
+
return n`
|
|
770
770
|
<li>
|
|
771
|
-
${
|
|
772
|
-
<span class="opp matchup">${
|
|
773
|
-
${
|
|
771
|
+
${L(t)}
|
|
772
|
+
<span class="opp matchup">${r(t.awayTeamId, t.awayScore, n`<span class="at">at</span>`)}${r(t.homeTeamId, t.homeScore)}</span>
|
|
773
|
+
${o ? n`<span class="ff">${T(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : p}
|
|
774
774
|
<span class="where">${t.venue || ""}</span>
|
|
775
|
-
${t.broadcast ?
|
|
776
|
-
<a class="box" href=${
|
|
775
|
+
${t.broadcast ? n`<span class="pill class">${t.broadcast}</span>` : p}
|
|
776
|
+
<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
777
777
|
</li>
|
|
778
778
|
`;
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
782
|
-
class
|
|
783
|
-
static styles =
|
|
781
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", Re);
|
|
782
|
+
class Ne extends w {
|
|
783
|
+
static styles = z;
|
|
784
784
|
static properties = {
|
|
785
|
-
|
|
785
|
+
...w.properties,
|
|
786
786
|
sport: { type: String },
|
|
787
787
|
season: { type: String },
|
|
788
788
|
classFilter: { state: !0 },
|
|
@@ -792,7 +792,7 @@ class Ae extends $ {
|
|
|
792
792
|
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
793
793
|
}
|
|
794
794
|
async fetchData(e) {
|
|
795
|
-
const t = this.season ||
|
|
795
|
+
const t = this.season || M(), [s, r, o, l, i] = await Promise.all([
|
|
796
796
|
e.listConferences({ active: !0 }),
|
|
797
797
|
e.listSchools(),
|
|
798
798
|
e.listTeams({ sport: this.sport }),
|
|
@@ -802,60 +802,60 @@ class Ae extends $ {
|
|
|
802
802
|
return {
|
|
803
803
|
season: t,
|
|
804
804
|
conferences: s.items,
|
|
805
|
-
schools:
|
|
806
|
-
teams:
|
|
807
|
-
games:
|
|
808
|
-
rankings:
|
|
805
|
+
schools: r.items,
|
|
806
|
+
teams: o.items,
|
|
807
|
+
games: l.items,
|
|
808
|
+
rankings: i.items
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
811
|
get ctx() {
|
|
812
812
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
813
813
|
teamsById: v(this.data.teams),
|
|
814
814
|
schoolsById: v(this.data.schools),
|
|
815
|
-
records:
|
|
815
|
+
records: P(this.data.games),
|
|
816
816
|
rankings: this.data.rankings,
|
|
817
|
-
hrefs:
|
|
817
|
+
hrefs: F(this),
|
|
818
818
|
sport: this.sport
|
|
819
819
|
}, this._ctxData = this.data), this._ctx;
|
|
820
820
|
}
|
|
821
821
|
renderView() {
|
|
822
|
-
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((
|
|
823
|
-
return
|
|
824
|
-
${
|
|
825
|
-
title:
|
|
826
|
-
sub:
|
|
822
|
+
const e = this.ctx, t = ["All", ...[...new Set(this.data.conferences.flatMap((r) => r.classifications || []))].sort(J)].slice(0, 9), s = this.data.conferences.filter((r) => r.active !== !1).filter((r) => this.classFilter === "All" || (r.classifications || []).includes(this.classFilter)).sort($e);
|
|
823
|
+
return n`
|
|
824
|
+
${Y(this, e, {
|
|
825
|
+
title: n`${I(this.sport)} standings`,
|
|
826
|
+
sub: n`${this.data.season} season · every conference, computed live from reported results`,
|
|
827
827
|
teams: this.data.teams
|
|
828
828
|
})}
|
|
829
|
-
${B(this,
|
|
830
|
-
${
|
|
829
|
+
${B(this, n`
|
|
830
|
+
${A(this)}
|
|
831
831
|
<div class="toolbar">
|
|
832
832
|
<div role="group" aria-label="Classification filter">
|
|
833
|
-
${t.map((
|
|
833
|
+
${t.map((r) => n`<button class="chip ${this.classFilter === r ? "on" : ""}"
|
|
834
834
|
@click=${() => {
|
|
835
|
-
this.classFilter =
|
|
836
|
-
}}>${
|
|
835
|
+
this.classFilter = r;
|
|
836
|
+
}}>${r}</button>`)}
|
|
837
837
|
</div>
|
|
838
838
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
839
|
-
.value=${this.query} @input=${(
|
|
840
|
-
this.query =
|
|
839
|
+
.value=${this.query} @input=${(r) => {
|
|
840
|
+
this.query = r.target.value;
|
|
841
841
|
}}>
|
|
842
842
|
<span class="spacer"></span>
|
|
843
|
-
<span class="asof">Records through ${
|
|
843
|
+
<span class="asof">Records through ${$(j(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
844
844
|
</div>
|
|
845
|
-
${s.map((
|
|
845
|
+
${s.map((r) => this.renderConference(e, r))}
|
|
846
846
|
`)}
|
|
847
847
|
`;
|
|
848
848
|
}
|
|
849
849
|
renderConference(e, t) {
|
|
850
|
-
const s = this.data.teams.filter((
|
|
850
|
+
const s = this.data.teams.filter((l) => l.conferenceId === t.id);
|
|
851
851
|
if (!s.length) return p;
|
|
852
|
-
const
|
|
853
|
-
return
|
|
852
|
+
const r = this.query.trim().toLowerCase(), o = ne(s, e.records);
|
|
853
|
+
return n`
|
|
854
854
|
<div class="card">
|
|
855
855
|
<div class="card-head">
|
|
856
856
|
<h2>${t.name}</h2>
|
|
857
|
-
${[...t.classifications || []].sort(
|
|
858
|
-
<span class="meta">${
|
|
857
|
+
${[...t.classifications || []].sort(J).map((l) => n`<span class="pill class">${l}</span>`)}
|
|
858
|
+
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
859
859
|
</div>
|
|
860
860
|
<div class="tablewrap"><table class="data">
|
|
861
861
|
<thead><tr>
|
|
@@ -864,43 +864,43 @@ class Ae extends $ {
|
|
|
864
864
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
865
865
|
</tr></thead>
|
|
866
866
|
<tbody>
|
|
867
|
-
${
|
|
867
|
+
${o.map((l, i) => this.renderRow(e, l, i, r))}
|
|
868
868
|
</tbody>
|
|
869
869
|
</table></div>
|
|
870
870
|
</div>
|
|
871
871
|
`;
|
|
872
872
|
}
|
|
873
|
-
renderRow(e, t, s,
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
876
|
-
const
|
|
877
|
-
location.href =
|
|
873
|
+
renderRow(e, t, s, r) {
|
|
874
|
+
const o = e.schoolsById[t.team.schoolId], l = o?.name || t.team.name || "TBD";
|
|
875
|
+
if (r && !l.toLowerCase().includes(r)) return p;
|
|
876
|
+
const i = t.rec.pf - t.rec.pa, h = W(this.data.games, t.team.id), d = () => {
|
|
877
|
+
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
878
878
|
};
|
|
879
|
-
return
|
|
879
|
+
return n`
|
|
880
880
|
<tr class="rowlink" @click=${(c) => {
|
|
881
|
-
c.target.closest("a") ||
|
|
881
|
+
c.target.closest("a") || d();
|
|
882
882
|
}}>
|
|
883
883
|
<td class="mut">${s + 1}</td>
|
|
884
884
|
<td class="teamcell">
|
|
885
|
-
${
|
|
886
|
-
<a href=${
|
|
885
|
+
${D(o)}${Q(e, t.team.id, null)}
|
|
886
|
+
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${l}</a>
|
|
887
887
|
</td>
|
|
888
|
-
<td class="num">${
|
|
889
|
-
<td class="num">${
|
|
890
|
-
<td class="num">${
|
|
891
|
-
<td class="num">${
|
|
888
|
+
<td class="num">${k(t.rec, !0)}</td>
|
|
889
|
+
<td class="num">${te(t.confPct)}</td>
|
|
890
|
+
<td class="num">${k(t.rec)}</td>
|
|
891
|
+
<td class="num">${te(t.overallPct)}</td>
|
|
892
892
|
<td class="num">${t.rec.pf}</td>
|
|
893
893
|
<td class="num">${t.rec.pa}</td>
|
|
894
|
-
<td class="num" style="color:${
|
|
895
|
-
<td>${
|
|
894
|
+
<td class="num" style="color:${i >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${i > 0 ? "+" : ""}${i}</td>
|
|
895
|
+
<td>${H(t.rec.results) || "·"}</td>
|
|
896
896
|
<td>${K(e, t.team.id)}</td>
|
|
897
|
-
<td>${
|
|
897
|
+
<td>${ce(e, h, t.team.id)}</td>
|
|
898
898
|
</tr>
|
|
899
899
|
`;
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
903
|
-
const
|
|
902
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", Ne);
|
|
903
|
+
const Le = y`
|
|
904
904
|
.hero1 {
|
|
905
905
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
906
906
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -917,10 +917,10 @@ const Ee = b`
|
|
|
917
917
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
918
918
|
.sparkline { vertical-align: middle; }
|
|
919
919
|
`;
|
|
920
|
-
class
|
|
921
|
-
static styles = [...
|
|
920
|
+
class Me extends w {
|
|
921
|
+
static styles = [...z, Le];
|
|
922
922
|
static properties = {
|
|
923
|
-
|
|
923
|
+
...w.properties,
|
|
924
924
|
sport: { type: String },
|
|
925
925
|
gender: { type: String },
|
|
926
926
|
season: { type: String },
|
|
@@ -935,73 +935,73 @@ class _e extends $ {
|
|
|
935
935
|
e && (this.pollDate = e);
|
|
936
936
|
}
|
|
937
937
|
async fetchData(e) {
|
|
938
|
-
const t = this.season ||
|
|
938
|
+
const t = this.season || M(), [s, r, o, l, i] = await Promise.all([
|
|
939
939
|
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
940
940
|
e.listSchools(),
|
|
941
941
|
e.listTeams({ sport: this.sport }),
|
|
942
942
|
e.listConferences(),
|
|
943
943
|
e.listGames({ sport: this.sport, season: t })
|
|
944
|
-
]), h = s.items.filter((
|
|
944
|
+
]), h = s.items.filter((d) => !this.gender || !d.gender || d.gender === this.gender).sort((d, c) => c.effectiveDate.localeCompare(d.effectiveDate));
|
|
945
945
|
return {
|
|
946
946
|
season: t,
|
|
947
947
|
polls: h,
|
|
948
|
-
schools:
|
|
949
|
-
teams:
|
|
950
|
-
conferences:
|
|
951
|
-
games:
|
|
948
|
+
schools: r.items,
|
|
949
|
+
teams: o.items,
|
|
950
|
+
conferences: l.items,
|
|
951
|
+
games: i.items
|
|
952
952
|
};
|
|
953
953
|
}
|
|
954
954
|
get ctx() {
|
|
955
955
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
956
956
|
teamsById: v(this.data.teams),
|
|
957
957
|
schoolsById: v(this.data.schools),
|
|
958
|
-
records:
|
|
958
|
+
records: P(this.data.games),
|
|
959
959
|
rankings: this.data.polls,
|
|
960
|
-
hrefs:
|
|
960
|
+
hrefs: F(this),
|
|
961
961
|
sport: this.sport
|
|
962
962
|
}, this._ctxData = this.data), this._ctx;
|
|
963
963
|
}
|
|
964
964
|
sparkline(e, t, s) {
|
|
965
|
-
const
|
|
966
|
-
const
|
|
967
|
-
if (
|
|
968
|
-
const
|
|
969
|
-
return { x:
|
|
965
|
+
const i = t.map((m, f) => {
|
|
966
|
+
const u = (m.teamIds || []).indexOf(e);
|
|
967
|
+
if (u === -1) return null;
|
|
968
|
+
const b = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, x = 3 + u / 24 * 20;
|
|
969
|
+
return { x: b, y: x };
|
|
970
970
|
}), h = [];
|
|
971
|
-
let
|
|
972
|
-
if (
|
|
973
|
-
m ?
|
|
974
|
-
}),
|
|
975
|
-
const c =
|
|
976
|
-
return
|
|
977
|
-
${h.map((m) =>
|
|
971
|
+
let d = [];
|
|
972
|
+
if (i.forEach((m) => {
|
|
973
|
+
m ? d.push(m) : d.length && (h.push(d), d = []);
|
|
974
|
+
}), d.length && h.push(d), !h.length) return p;
|
|
975
|
+
const c = i[s];
|
|
976
|
+
return n`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
977
|
+
${h.map((m) => Z`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
978
978
|
points=${m.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
979
|
-
${c ?
|
|
979
|
+
${c ? Z`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
980
980
|
</svg>`;
|
|
981
981
|
}
|
|
982
982
|
movement(e, t, s) {
|
|
983
|
-
const
|
|
984
|
-
return
|
|
983
|
+
const r = Ae(e, t, s);
|
|
984
|
+
return r.kind === "up" ? n`<span class="delta up">▲ ${r.delta}</span>` : r.kind === "down" ? n`<span class="delta down">▼ ${r.delta}</span>` : r.kind === "new" ? n`<span class="delta new">NEW</span>` : r.kind === "same" ? n`<span class="delta same">—</span>` : n`<span class="delta same">·</span>`;
|
|
985
985
|
}
|
|
986
986
|
renderView() {
|
|
987
987
|
const e = this.ctx, t = this.data.polls;
|
|
988
|
-
if (!t.length) return
|
|
989
|
-
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)),
|
|
990
|
-
return
|
|
991
|
-
${
|
|
992
|
-
title:
|
|
993
|
-
sub:
|
|
988
|
+
if (!t.length) return n`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
989
|
+
const s = Math.max(0, t.findIndex((m) => m.effectiveDate === this.pollDate)), r = t[s] || t[0], o = t[s + 1] || null, l = t.slice().reverse(), i = l.indexOf(r), h = v(this.data.conferences), d = (r.teamIds || [])[0], c = d ? C(e, d) : null;
|
|
990
|
+
return n`
|
|
991
|
+
${Y(this, e, {
|
|
992
|
+
title: n`${I(this.sport)} Top 25`,
|
|
993
|
+
sub: n`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
994
994
|
teams: this.data.teams
|
|
995
995
|
})}
|
|
996
|
-
${B(this,
|
|
997
|
-
${
|
|
996
|
+
${B(this, n`
|
|
997
|
+
${A(this)}
|
|
998
998
|
<div class="toolbar">
|
|
999
999
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1000
1000
|
<select id="pollsel" @change=${(m) => {
|
|
1001
1001
|
this.pollDate = m.target.value;
|
|
1002
1002
|
}}>
|
|
1003
|
-
${t.map((m, f) =>
|
|
1004
|
-
${
|
|
1003
|
+
${t.map((m, f) => n`<option value=${m.effectiveDate} ?selected=${m === r}>
|
|
1004
|
+
${$(m.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
1005
1005
|
</option>`)}
|
|
1006
1006
|
</select>
|
|
1007
1007
|
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
@@ -1015,65 +1015,65 @@ class _e extends $ {
|
|
|
1015
1015
|
<span class="spacer"></span>
|
|
1016
1016
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1017
1017
|
</div>
|
|
1018
|
-
${c ? this.renderHero(e,
|
|
1018
|
+
${c ? this.renderHero(e, r, o, d, c, h) : p}
|
|
1019
1019
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1020
1020
|
<thead><tr>
|
|
1021
1021
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1022
1022
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1023
1023
|
</tr></thead>
|
|
1024
1024
|
<tbody>
|
|
1025
|
-
${(
|
|
1025
|
+
${(r.teamIds || []).map((m, f) => f === 0 || !m ? p : this.renderRow(e, r, o, l, i, h, m, f + 1))}
|
|
1026
1026
|
</tbody>
|
|
1027
1027
|
</table></div></div>
|
|
1028
1028
|
<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>
|
|
1029
1029
|
`)}
|
|
1030
1030
|
`;
|
|
1031
1031
|
}
|
|
1032
|
-
renderHero(e, t, s,
|
|
1033
|
-
const
|
|
1034
|
-
return
|
|
1032
|
+
renderHero(e, t, s, r, o, l) {
|
|
1033
|
+
const i = e.records[r], h = se(e.records, r), d = l[e.teamsById[r]?.conferenceId], c = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1034
|
+
return n`
|
|
1035
1035
|
<div class="hero1" style="background:${c}">
|
|
1036
1036
|
<div class="bigrank">#1</div>
|
|
1037
|
-
${
|
|
1037
|
+
${D(o, 64)}
|
|
1038
1038
|
<div>
|
|
1039
|
-
<h2><a href=${
|
|
1039
|
+
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1040
1040
|
<div class="facts">
|
|
1041
|
-
${
|
|
1042
|
-
· streak ${
|
|
1043
|
-
${h ?
|
|
1044
|
-
${this.movement(t, s,
|
|
1041
|
+
${k(i)} overall${d ? n` · ${k(i, !0)} ${d.name}` : p}
|
|
1042
|
+
· streak ${H(i?.results) || "·"}
|
|
1043
|
+
${h ? n` · last: ${h.mark} ${h.my}-${h.their} vs ${N(e, h.opp)}` : p}
|
|
1044
|
+
${this.movement(t, s, r)}
|
|
1045
1045
|
</div>
|
|
1046
1046
|
</div>
|
|
1047
1047
|
</div>
|
|
1048
1048
|
`;
|
|
1049
1049
|
}
|
|
1050
|
-
renderRow(e, t, s,
|
|
1051
|
-
const
|
|
1052
|
-
if (!
|
|
1053
|
-
const c = e.records[
|
|
1054
|
-
location.href =
|
|
1050
|
+
renderRow(e, t, s, r, o, l, i, h) {
|
|
1051
|
+
const d = C(e, i);
|
|
1052
|
+
if (!d) return p;
|
|
1053
|
+
const c = e.records[i], m = se(e.records, i), f = W(this.data.games, i), u = l[e.teamsById[i]?.conferenceId], b = () => {
|
|
1054
|
+
location.href = g(e.hrefs.school, { id: d.id });
|
|
1055
1055
|
};
|
|
1056
|
-
return
|
|
1057
|
-
<tr class="rowlink" @click=${(
|
|
1058
|
-
|
|
1056
|
+
return n`
|
|
1057
|
+
<tr class="rowlink" @click=${(x) => {
|
|
1058
|
+
x.target.closest("a") || b();
|
|
1059
1059
|
}}>
|
|
1060
1060
|
<td class="num" style="font-weight:700">${h}</td>
|
|
1061
|
-
<td>${this.movement(t, s,
|
|
1062
|
-
<td class="teamcell">${
|
|
1063
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1064
|
-
<td class="num">${
|
|
1065
|
-
<td class="mut">${
|
|
1066
|
-
<td>${m ?
|
|
1061
|
+
<td>${this.movement(t, s, i)}</td>
|
|
1062
|
+
<td class="teamcell">${D(d)}<a href=${g(e.hrefs.school, { id: d.id })}>${d.name}</a>
|
|
1063
|
+
<span class="mut" style="font-size:0.78rem">${d.mascot || ""}</span></td>
|
|
1064
|
+
<td class="num">${k(c)}</td>
|
|
1065
|
+
<td class="mut">${u?.name || "Independent"}</td>
|
|
1066
|
+
<td>${m ? n`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: m.gameId })}>
|
|
1067
1067
|
<b style="color:${m.mark === "W" ? "var(--hsot-win)" : m.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${m.mark}</b>
|
|
1068
|
-
${m.my}-${m.their} vs ${
|
|
1069
|
-
<td>${
|
|
1070
|
-
<td>${this.sparkline(
|
|
1068
|
+
${m.my}-${m.their} vs ${N(e, m.opp)}</a>` : n`<span class="mut">·</span>`}</td>
|
|
1069
|
+
<td>${ce(e, f, i)}</td>
|
|
1070
|
+
<td>${this.sparkline(i, r, o)}</td>
|
|
1071
1071
|
</tr>
|
|
1072
1072
|
`;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1076
|
-
const
|
|
1075
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", Me);
|
|
1076
|
+
const He = y`
|
|
1077
1077
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1078
1078
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1079
1079
|
.schoolhero .crest {
|
|
@@ -1127,10 +1127,10 @@ const Re = b`
|
|
|
1127
1127
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1128
1128
|
}
|
|
1129
1129
|
`;
|
|
1130
|
-
class
|
|
1131
|
-
static styles = [...
|
|
1130
|
+
class Oe extends w {
|
|
1131
|
+
static styles = [...z, He];
|
|
1132
1132
|
static properties = {
|
|
1133
|
-
|
|
1133
|
+
...w.properties,
|
|
1134
1134
|
schoolId: { type: String, attribute: "school-id" },
|
|
1135
1135
|
sport: { type: String },
|
|
1136
1136
|
season: { type: String },
|
|
@@ -1145,38 +1145,38 @@ class Ne extends $ {
|
|
|
1145
1145
|
e && !this.sport && (this.sport = e);
|
|
1146
1146
|
}
|
|
1147
1147
|
async fetchData(e) {
|
|
1148
|
-
const t = this.season ||
|
|
1149
|
-
|
|
1150
|
-
|
|
1148
|
+
const t = this.season || M(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, l = o.find((b) => b.sport === (this.sport || "football")) || o[0] || null, [i, h, d, c, m, f, u] = await Promise.all([
|
|
1149
|
+
l ? e.listGames({ sport: l.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1150
|
+
l ? e.listTeams({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1151
1151
|
e.listSchools(),
|
|
1152
1152
|
e.listConferences(),
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
l ? e.listRankings({ sport: l.sport }) : Promise.resolve({ items: [] }),
|
|
1154
|
+
l ? e.listRosters({ teamId: l.id }) : Promise.resolve({ items: [] }),
|
|
1155
1155
|
// teamId is the public surface's one players filter (roster
|
|
1156
1156
|
// membership) — never fetch the whole collection.
|
|
1157
|
-
|
|
1157
|
+
l ? e.listPlayers({ teamId: l.id }) : Promise.resolve({ items: [] })
|
|
1158
1158
|
]);
|
|
1159
1159
|
return {
|
|
1160
1160
|
season: t,
|
|
1161
1161
|
school: s,
|
|
1162
|
-
teams:
|
|
1163
|
-
active:
|
|
1164
|
-
games:
|
|
1162
|
+
teams: o,
|
|
1163
|
+
active: l,
|
|
1164
|
+
games: i.items,
|
|
1165
1165
|
allTeams: h.items,
|
|
1166
|
-
schools:
|
|
1166
|
+
schools: d.items,
|
|
1167
1167
|
conferences: c.items,
|
|
1168
1168
|
rankings: m.items,
|
|
1169
|
-
roster: f.items.find((
|
|
1170
|
-
players:
|
|
1169
|
+
roster: f.items.find((b) => b.season === t) || null,
|
|
1170
|
+
players: u.items
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
1173
|
get ctx() {
|
|
1174
1174
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1175
1175
|
teamsById: v(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1176
1176
|
schoolsById: v(this.data.schools),
|
|
1177
|
-
records:
|
|
1177
|
+
records: P(this.data.games),
|
|
1178
1178
|
rankings: this.data.rankings,
|
|
1179
|
-
hrefs:
|
|
1179
|
+
hrefs: F(this),
|
|
1180
1180
|
sport: this.data.active?.sport || "football"
|
|
1181
1181
|
}, this._ctxData = this.data), this._ctx;
|
|
1182
1182
|
}
|
|
@@ -1184,116 +1184,116 @@ class Ne extends $ {
|
|
|
1184
1184
|
this.sport = e, this.load();
|
|
1185
1185
|
}
|
|
1186
1186
|
renderView() {
|
|
1187
|
-
const { school: e, teams: t, active: s, season:
|
|
1188
|
-
if (!e) return
|
|
1189
|
-
const
|
|
1190
|
-
return
|
|
1191
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${
|
|
1187
|
+
const { school: e, teams: t, active: s, season: r } = this.data;
|
|
1188
|
+
if (!e) return n`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1189
|
+
const o = this.ctx, l = _(e.colorPrimary || "#030711"), i = (e.adm || [])[0], h = v(this.data.conferences), d = s ? h[s.conferenceId] : null;
|
|
1190
|
+
return n`
|
|
1191
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${l}">
|
|
1192
1192
|
<div class="inner">
|
|
1193
|
-
${
|
|
1193
|
+
${R(e, 84) ? n`<img class="crest logo" alt="" loading="lazy" src=${R(e, 84)} />` : n`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${_(e.colorSecondary || "#7C7C7C")}">${q(e)}</div>`}
|
|
1194
1194
|
<div style="min-width:260px">
|
|
1195
1195
|
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1196
1196
|
<div class="facts">
|
|
1197
|
-
${e.location ?
|
|
1198
|
-
${e.association ?
|
|
1199
|
-
${
|
|
1200
|
-
${
|
|
1201
|
-
${e.openingYear ?
|
|
1202
|
-
${e.areaCode ?
|
|
1197
|
+
${e.location ? n`<span><b>Location</b>${e.location}${e.county ? n` · ${e.county} County` : p}</span>` : p}
|
|
1198
|
+
${e.association ? n`<span><b>League</b>${e.association}${e.classification ? n` · ${e.classification}` : p}</span>` : p}
|
|
1199
|
+
${d ? n`<span><b>Conference</b>${d.name}</span>` : p}
|
|
1200
|
+
${i ? n`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : p}
|
|
1201
|
+
${e.openingYear ? n`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
1202
|
+
${e.areaCode ? n`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
1203
1203
|
</div>
|
|
1204
1204
|
</div>
|
|
1205
1205
|
</div>
|
|
1206
1206
|
</div>
|
|
1207
1207
|
<div class="band">
|
|
1208
1208
|
<nav class="tabs" aria-label="Teams">
|
|
1209
|
-
${t.map((c) => c.id === s?.id ?
|
|
1209
|
+
${t.map((c) => c.id === s?.id ? n`<a class="on" href="#" @click=${(m) => m.preventDefault()}>${c.name}</a>` : n`<a href="#" @click=${(m) => {
|
|
1210
1210
|
m.preventDefault(), this.switchSport(c.sport);
|
|
1211
1211
|
}}>${c.name}</a>`)}
|
|
1212
1212
|
</nav>
|
|
1213
1213
|
</div>
|
|
1214
|
-
${B(this,
|
|
1215
|
-
${
|
|
1216
|
-
${s ? this.renderTeam(
|
|
1214
|
+
${B(this, n`
|
|
1215
|
+
${A(this)}
|
|
1216
|
+
${s ? this.renderTeam(o, s, d, r) : n`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1217
1217
|
`)}
|
|
1218
1218
|
`;
|
|
1219
1219
|
}
|
|
1220
|
-
renderTeam(e, t, s,
|
|
1221
|
-
const
|
|
1222
|
-
return
|
|
1220
|
+
renderTeam(e, t, s, r) {
|
|
1221
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, l = o.w + o.l + o.t, i = s ? this.data.allTeams.filter((m) => m.conferenceId === s.id) : [], h = s ? ne(i, e.records).findIndex((m) => m.team.id === t.id) + 1 : 0, d = V(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)));
|
|
1222
|
+
return n`
|
|
1223
1223
|
<div class="tiles">
|
|
1224
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1225
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1226
|
-
<div class="s">${h ? `${
|
|
1227
|
-
<div class="tile"><div class="k">Points</div><div class="v">${
|
|
1228
|
-
<div class="s">scored per game · ${
|
|
1229
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1224
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${k(o)}</div><div class="s">${l} games played</div></div>
|
|
1225
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${k(o, !0)}</div>
|
|
1226
|
+
<div class="s">${h ? `${ye(h)} of ${i.length}` : "·"}</div></div>
|
|
1227
|
+
<div class="tile"><div class="k">Points</div><div class="v">${l ? (o.pf / l).toFixed(1) : "0.0"}</div>
|
|
1228
|
+
<div class="s">scored per game · ${l ? (o.pa / l).toFixed(1) : "0.0"} allowed</div></div>
|
|
1229
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${H(o.results) || "·"}</div>
|
|
1230
1230
|
<div class="s">last 5: ${K(e, t.id)}</div></div>
|
|
1231
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1232
|
-
<div class="s"><a href=${
|
|
1231
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${d ? `#${d}` : "NR"}</div>
|
|
1232
|
+
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1233
1233
|
</div>
|
|
1234
|
-
${(t.championships || []).length ?
|
|
1234
|
+
${(t.championships || []).length ? n`
|
|
1235
1235
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1236
|
-
${t.championships.map((m) =>
|
|
1236
|
+
${t.championships.map((m) => n`<span class="pill champ">★ ${m.season} ${m.title} champion${m.classification ? ` · ${m.classification}` : ""}${m.region ? ` · ${m.region}` : ""}</span>`)}
|
|
1237
1237
|
</div>` : p}
|
|
1238
1238
|
<div class="cols">
|
|
1239
1239
|
<div>
|
|
1240
1240
|
<div class="section-title">Schedule & results</div>
|
|
1241
1241
|
<div class="card">
|
|
1242
|
-
${c.length ?
|
|
1242
|
+
${c.length ? n`<ul class="gamelist">${c.map((m) => this.renderGameRow(e, t, m))}</ul>` : n`<p class="empty">No ${t.sport} games recorded for ${r}.</p>`}
|
|
1243
1243
|
</div>
|
|
1244
1244
|
</div>
|
|
1245
1245
|
<div>
|
|
1246
|
-
<div class="section-title">Roster · ${
|
|
1247
|
-
<div class="card">${this.renderRoster(t,
|
|
1246
|
+
<div class="section-title">Roster · ${r}</div>
|
|
1247
|
+
<div class="card">${this.renderRoster(t, r)}</div>
|
|
1248
1248
|
</div>
|
|
1249
1249
|
</div>
|
|
1250
1250
|
`;
|
|
1251
1251
|
}
|
|
1252
1252
|
renderGameRow(e, t, s) {
|
|
1253
|
-
const
|
|
1254
|
-
let h =
|
|
1253
|
+
const r = s.homeTeamId === t.id, o = r ? s.awayTeamId : s.homeTeamId, l = r ? s.homeScore : s.awayScore, i = r ? s.awayScore : s.homeScore;
|
|
1254
|
+
let h = n`<span class="mut">${U(s.time)}</span>`;
|
|
1255
1255
|
if (s.state === "final") {
|
|
1256
|
-
const c = G(s), m = c === "tie" ? "T" : c === (
|
|
1257
|
-
h =
|
|
1258
|
-
} else s.state === "live" && (h =
|
|
1259
|
-
const
|
|
1260
|
-
return
|
|
1256
|
+
const c = G(s), m = c === "tie" ? "T" : c === (r ? "home" : "away") ? "W" : "L";
|
|
1257
|
+
h = n`<span class=${m}>${m}</span> ${l}-${i}${s.finish === "overtime" ? n` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? n` <span class="mut">FF</span>` : p}`;
|
|
1258
|
+
} else s.state === "live" && (h = n`<span style="color:var(--hsot-red)">${l}-${i}</span>`);
|
|
1259
|
+
const d = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1260
|
+
return n`
|
|
1261
1261
|
<li>
|
|
1262
|
-
<span class="d">${
|
|
1263
|
-
${
|
|
1262
|
+
<span class="d">${$(s.date)}</span>
|
|
1263
|
+
${re(s).kind === "sched" ? p : L(s)}
|
|
1264
1264
|
<span class="res">${h}</span>
|
|
1265
|
-
<span class="opp">${
|
|
1266
|
-
<span class="pill type">${
|
|
1267
|
-
${s.broadcast ?
|
|
1265
|
+
<span class="opp">${r ? "vs" : "at"} ${le(e, o, s.date)}
|
|
1266
|
+
<span class="pill type">${d}</span>
|
|
1267
|
+
${s.broadcast ? n`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1268
1268
|
</span>
|
|
1269
1269
|
<span class="where">${s.venue || ""}</span>
|
|
1270
|
-
<a class="box" href=${
|
|
1270
|
+
<a class="box" href=${g(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1271
1271
|
</li>
|
|
1272
1272
|
`;
|
|
1273
1273
|
}
|
|
1274
1274
|
renderRoster(e, t) {
|
|
1275
1275
|
const s = this.data.roster;
|
|
1276
1276
|
if (!s)
|
|
1277
|
-
return
|
|
1278
|
-
const
|
|
1279
|
-
return
|
|
1280
|
-
${
|
|
1281
|
-
alt="${
|
|
1277
|
+
return n`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1278
|
+
const r = _e(s, 560), o = this.data.school?.name || "", l = v(this.data.players), i = s.entries.slice().sort((d, c) => (d.number || 0) - (c.number || 0)), h = i.some((d) => l[d.playerId]?.college);
|
|
1279
|
+
return n`
|
|
1280
|
+
${r ? n`<img class="rosterphoto" src=${r} loading="lazy" decoding="async"
|
|
1281
|
+
alt="${o} ${e.name} ${t} team photo" />` : p}
|
|
1282
1282
|
<div class="tablewrap"><table class="data roster">
|
|
1283
|
-
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ?
|
|
1283
|
+
<thead><tr><th class="num">No.</th><th>Player</th><th class="pos">Pos</th><th class="cls">Class</th><th class="num">Ht</th><th class="num">Wt</th>${h ? n`<th>College</th>` : p}</tr></thead>
|
|
1284
1284
|
<tbody>
|
|
1285
|
-
${
|
|
1286
|
-
const c = d
|
|
1285
|
+
${i.map((d) => {
|
|
1286
|
+
const c = l[d.playerId];
|
|
1287
1287
|
if (!c) return p;
|
|
1288
|
-
const m =
|
|
1289
|
-
return
|
|
1290
|
-
<td class="num mut">${
|
|
1288
|
+
const m = ve(d), f = [m, c.classOf].filter(Boolean).join(" · ") || "·";
|
|
1289
|
+
return n`<tr>
|
|
1290
|
+
<td class="num mut">${d.number ?? "·"}</td>
|
|
1291
1291
|
<td class="player" style="font-weight:500">${c.firstName} ${c.lastName}<span class="sub">${f}</span></td>
|
|
1292
1292
|
<td class="pos">${m || "·"}</td>
|
|
1293
1293
|
<td class="cls mut">${c.classOf || "·"}</td>
|
|
1294
|
-
<td class="num">${
|
|
1294
|
+
<td class="num">${ge(c.heightIn)}</td>
|
|
1295
1295
|
<td class="num">${c.weightLb || "·"}</td>
|
|
1296
|
-
${h ?
|
|
1296
|
+
${h ? n`<td class="college">${c.college || "·"}</td>` : p}
|
|
1297
1297
|
</tr>`;
|
|
1298
1298
|
})}
|
|
1299
1299
|
</tbody>
|
|
@@ -1301,16 +1301,69 @@ class Ne extends $ {
|
|
|
1301
1301
|
`;
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1304
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", Oe);
|
|
1305
|
+
const de = {
|
|
1306
|
+
football: ["quarters", 4],
|
|
1307
|
+
flag_football: ["quarters", 4],
|
|
1308
|
+
basketball: ["quarters", 4],
|
|
1309
|
+
lacrosse: ["quarters", 4],
|
|
1310
|
+
field_hockey: ["quarters", 4],
|
|
1311
|
+
soccer: ["halves", 2],
|
|
1312
|
+
baseball: ["innings", 7],
|
|
1313
|
+
softball: ["innings", 7],
|
|
1314
|
+
volleyball: ["sets", 3]
|
|
1315
|
+
};
|
|
1316
|
+
function he(a) {
|
|
1317
|
+
return (de[a] || ["quarters", 4])[0];
|
|
1318
|
+
}
|
|
1319
|
+
function X(a) {
|
|
1320
|
+
return (de[a] || ["quarters", 4])[1];
|
|
1321
|
+
}
|
|
1322
|
+
function Ue(a, e) {
|
|
1323
|
+
const t = he(a), s = X(a);
|
|
1324
|
+
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1325
|
+
const r = e - s;
|
|
1326
|
+
return `OT${r > 1 ? r : ""}`;
|
|
1327
|
+
}
|
|
1328
|
+
function je(a, e) {
|
|
1329
|
+
const t = String(a ?? "").trim();
|
|
1330
|
+
let s;
|
|
1331
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? he(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? X(e) + Number(s[1] || s[2] || 1) : (s = /^[TB](\d+)$/i.exec(t)) || (s = /^(\d+)(?:st|nd|rd|th)\s*set$/i.exec(t)) || (s = /^set\s*(\d+)$/i.exec(t)) ? Number(s[1]) : null;
|
|
1332
|
+
}
|
|
1333
|
+
const E = (a) => Number.isInteger(a) && a >= 0 ? a : null;
|
|
1334
|
+
function qe(a) {
|
|
1335
|
+
const e = Array.isArray(a?.scoringPlays) ? a.scoringPlays : [];
|
|
1336
|
+
if (!e.length) return null;
|
|
1337
|
+
const t = a.sport, s = /* @__PURE__ */ new Map();
|
|
1338
|
+
for (const m of e) {
|
|
1339
|
+
const f = je(m?.period, t), u = E(m?.homeScore), b = E(m?.awayScore);
|
|
1340
|
+
if (!f || u === null || b === null) return null;
|
|
1341
|
+
const x = s.get(f) || { home: 0, away: 0 };
|
|
1342
|
+
x.home = Math.max(x.home, u), x.away = Math.max(x.away, b), s.set(f, x);
|
|
1343
|
+
}
|
|
1344
|
+
const r = Math.max(...s.keys()), o = [];
|
|
1345
|
+
let l = !0, i = { home: 0, away: 0 };
|
|
1346
|
+
for (let m = 1; m <= r; m += 1) {
|
|
1347
|
+
const f = s.get(m) || i, u = f.home - i.home, b = f.away - i.away;
|
|
1348
|
+
(u < 0 || b < 0) && (l = !1), o.push({ period: m, home: Math.max(u, 0), away: Math.max(b, 0) }), i = { home: Math.max(f.home, i.home), away: Math.max(f.away, i.away) };
|
|
1349
|
+
}
|
|
1350
|
+
const h = E(a.homeScore) ?? 0, d = E(a.awayScore) ?? 0, c = l && i.home === h && i.away === d;
|
|
1351
|
+
return l = l && i.home <= h && i.away <= d, { periods: o, reconciled: c, consistent: l };
|
|
1352
|
+
}
|
|
1353
|
+
function Ge(a) {
|
|
1354
|
+
if (Array.isArray(a?.periodScores) && a.periodScores.length) return a.periodScores;
|
|
1355
|
+
const e = qe(a);
|
|
1356
|
+
return e ? a.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1357
|
+
}
|
|
1358
|
+
const We = "https://api.wral.com/search";
|
|
1359
|
+
function Ve(a) {
|
|
1307
1360
|
return a.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1308
1361
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const t = String(a ||
|
|
1362
|
+
function Ye(a, e) {
|
|
1363
|
+
const t = String(a || We).replace(/\/+$/, ""), s = new URLSearchParams({ query: Ve(e), sort: "score", lang: "en" });
|
|
1311
1364
|
return `${t}/v1/query?${s}`;
|
|
1312
1365
|
}
|
|
1313
|
-
function
|
|
1366
|
+
function me(a) {
|
|
1314
1367
|
try {
|
|
1315
1368
|
const e = new URL(a);
|
|
1316
1369
|
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
@@ -1325,13 +1378,13 @@ function le(a) {
|
|
|
1325
1378
|
}
|
|
1326
1379
|
return { uri: a, title: a };
|
|
1327
1380
|
}
|
|
1328
|
-
async function
|
|
1329
|
-
const
|
|
1330
|
-
if (!
|
|
1331
|
-
const
|
|
1332
|
-
return e.map((
|
|
1381
|
+
async function Qe(a, e, t) {
|
|
1382
|
+
const r = await ((...i) => fetch(...i))(Ye(a, e));
|
|
1383
|
+
if (!r.ok) throw new Error(`search answered ${r.status}`);
|
|
1384
|
+
const o = await r.json(), l = new Map((o.items || []).map((i) => [i.uri, i]));
|
|
1385
|
+
return e.map((i) => l.get(i) || me(i));
|
|
1333
1386
|
}
|
|
1334
|
-
const
|
|
1387
|
+
const Ke = y`
|
|
1335
1388
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1336
1389
|
.breadcrumbs a { text-decoration: none; }
|
|
1337
1390
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1384,10 +1437,10 @@ const Me = b`
|
|
|
1384
1437
|
.cols { grid-template-columns: 1fr; }
|
|
1385
1438
|
}
|
|
1386
1439
|
`;
|
|
1387
|
-
class
|
|
1388
|
-
static styles = [...
|
|
1440
|
+
class Xe extends w {
|
|
1441
|
+
static styles = [...z, Ke];
|
|
1389
1442
|
static properties = {
|
|
1390
|
-
|
|
1443
|
+
...w.properties,
|
|
1391
1444
|
gameId: { type: String, attribute: "game-id" },
|
|
1392
1445
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1393
1446
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
@@ -1399,7 +1452,7 @@ class je extends $ {
|
|
|
1399
1452
|
super(), this.gameId = "", this.searchApi = "";
|
|
1400
1453
|
}
|
|
1401
1454
|
async fetchData(e) {
|
|
1402
|
-
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [
|
|
1455
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [r, o, l, i, h, d] = await Promise.all([
|
|
1403
1456
|
e.listSchools(),
|
|
1404
1457
|
e.listTeams({ sport: t.sport }),
|
|
1405
1458
|
e.listConferences(),
|
|
@@ -1407,74 +1460,74 @@ class je extends $ {
|
|
|
1407
1460
|
e.listGames({ sport: t.sport, season: t.season }),
|
|
1408
1461
|
// A search outage must not blank the box score — degrade to bare
|
|
1409
1462
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1410
|
-
s.length ?
|
|
1463
|
+
s.length ? Qe(this.searchApi, s).catch(() => s.map(me)) : Promise.resolve([])
|
|
1411
1464
|
]);
|
|
1412
1465
|
return {
|
|
1413
1466
|
game: t,
|
|
1414
|
-
schools:
|
|
1415
|
-
teams:
|
|
1416
|
-
conferences:
|
|
1417
|
-
rankings:
|
|
1467
|
+
schools: r.items,
|
|
1468
|
+
teams: o.items,
|
|
1469
|
+
conferences: l.items,
|
|
1470
|
+
rankings: i.items,
|
|
1418
1471
|
games: h.items,
|
|
1419
|
-
coverage:
|
|
1472
|
+
coverage: d
|
|
1420
1473
|
};
|
|
1421
1474
|
}
|
|
1422
1475
|
get ctx() {
|
|
1423
1476
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1424
1477
|
teamsById: v(this.data.teams),
|
|
1425
1478
|
schoolsById: v(this.data.schools),
|
|
1426
|
-
records:
|
|
1479
|
+
records: P(this.data.games),
|
|
1427
1480
|
rankings: this.data.rankings,
|
|
1428
|
-
hrefs:
|
|
1481
|
+
hrefs: F(this),
|
|
1429
1482
|
sport: this.data.game.sport
|
|
1430
1483
|
}, this._ctxData = this.data), this._ctx;
|
|
1431
1484
|
}
|
|
1432
1485
|
renderView() {
|
|
1433
1486
|
const e = this.data.game;
|
|
1434
|
-
if (!e) return
|
|
1435
|
-
const t = this.ctx, s = v(this.data.conferences),
|
|
1436
|
-
return
|
|
1437
|
-
${B(this,
|
|
1438
|
-
${
|
|
1487
|
+
if (!e) return n`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1488
|
+
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, l = G(e), i = (c) => e.state === "final" && l !== c && l !== "tie" ? "opacity:0.45" : "", h = e.conferenceId ? s[e.conferenceId] : null, d = 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));
|
|
1489
|
+
return n`
|
|
1490
|
+
${B(this, n`
|
|
1491
|
+
${A(this)}
|
|
1439
1492
|
<p class="breadcrumbs">
|
|
1440
|
-
<a href=${
|
|
1441
|
-
<a href=${
|
|
1442
|
-
${
|
|
1493
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${I(e.sport)}</a> /
|
|
1494
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1495
|
+
${T(t, e.awayTeamId)} at ${T(t, e.homeTeamId)}
|
|
1443
1496
|
</p>
|
|
1444
1497
|
<div class="card">
|
|
1445
1498
|
<div class="scorehead">
|
|
1446
|
-
${this.teamBlock(t, e, e.awayTeamId,
|
|
1499
|
+
${this.teamBlock(t, e, e.awayTeamId, r, !1)}
|
|
1447
1500
|
<div class="mid">
|
|
1448
1501
|
<div class="bigscore">
|
|
1449
|
-
<span style=${
|
|
1502
|
+
<span style=${i("away")}>${e.awayScore}</span>
|
|
1450
1503
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1451
|
-
<span style=${
|
|
1504
|
+
<span style=${i("home")}>${e.homeScore}</span>
|
|
1452
1505
|
</div>
|
|
1453
|
-
<div class="status">${
|
|
1454
|
-
<div class="status">${
|
|
1455
|
-
${e.broadcast ?
|
|
1506
|
+
<div class="status">${L(e)}</div>
|
|
1507
|
+
<div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? n` · ${U(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1508
|
+
${e.broadcast ? n` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1456
1509
|
<div class="status">
|
|
1457
1510
|
<span class="pill type">${e.gameType === "conference" ? `${h?.name || "Conference"} game` : e.gameType}</span>
|
|
1458
|
-
${e.label ?
|
|
1459
|
-
${(e.tags || []).map((c) =>
|
|
1511
|
+
${e.label ? n`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1512
|
+
${(e.tags || []).map((c) => n`<span class="pill type">${c}</span>`)}
|
|
1460
1513
|
</div>
|
|
1461
1514
|
</div>
|
|
1462
|
-
${this.teamBlock(t, e, e.homeTeamId,
|
|
1515
|
+
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
1463
1516
|
</div>
|
|
1464
|
-
${this.renderLineScore(e,
|
|
1465
|
-
${this.renderScoringPlays(e,
|
|
1466
|
-
${e.notes ?
|
|
1517
|
+
${this.renderLineScore(e, r, o)}
|
|
1518
|
+
${this.renderScoringPlays(e, r, o)}
|
|
1519
|
+
${e.notes ? n`<p class="note gamenote">${e.notes}</p>` : p}
|
|
1467
1520
|
</div>
|
|
1468
|
-
${(this.data.coverage || []).length ?
|
|
1521
|
+
${(this.data.coverage || []).length ? n`
|
|
1469
1522
|
<div class="section-title">Coverage</div>
|
|
1470
1523
|
<div class="covgrid">
|
|
1471
|
-
${this.data.coverage.map((c) =>
|
|
1524
|
+
${this.data.coverage.map((c) => n`
|
|
1472
1525
|
<a class="card covcard" href=${c.uri}>
|
|
1473
|
-
${c.image ?
|
|
1526
|
+
${c.image ? n`<img class="covimg" src=${c.image} alt="" loading="lazy" />` : p}
|
|
1474
1527
|
<div class="covbody">
|
|
1475
|
-
<div class="covtitle">${c.videoDuration ?
|
|
1476
|
-
${c.description ?
|
|
1477
|
-
${c.author || c.publishedTime ?
|
|
1528
|
+
<div class="covtitle">${c.videoDuration ? n`<span class="pill live" style="animation:none">Video</span> ` : p}${c.photos ? n`<span class="pill live" style="animation:none">Photos</span> ` : p}${c.title || c.uri}</div>
|
|
1529
|
+
${c.description ? n`<p class="covdesc">${c.description}</p>` : p}
|
|
1530
|
+
${c.author || c.publishedTime ? n`
|
|
1478
1531
|
<div class="covmeta">${[c.author, c.publishedTime ? new Date(c.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
1479
1532
|
` : p}
|
|
1480
1533
|
</div>
|
|
@@ -1483,50 +1536,50 @@ class je extends $ {
|
|
|
1483
1536
|
</div>` : p}
|
|
1484
1537
|
<div class="section-title">Season context</div>
|
|
1485
1538
|
<div class="cols">
|
|
1486
|
-
${[[e.awayTeamId,
|
|
1539
|
+
${[[e.awayTeamId, r], [e.homeTeamId, o]].map(([c, m]) => this.renderContext(t, c, m))}
|
|
1487
1540
|
</div>
|
|
1488
|
-
${
|
|
1541
|
+
${d.length ? n`
|
|
1489
1542
|
<div class="section-title">Head to head this season</div>
|
|
1490
1543
|
<div class="card"><ul class="gamelist">
|
|
1491
|
-
${
|
|
1492
|
-
<span class="d">${
|
|
1493
|
-
<span class="opp">${
|
|
1494
|
-
<a class="box" href=${
|
|
1544
|
+
${d.map((c) => n`<li>
|
|
1545
|
+
<span class="d">${$(c.date)}</span>${L(c)}
|
|
1546
|
+
<span class="opp">${T(t, c.awayTeamId)} ${c.awayScore}, ${T(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1547
|
+
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1495
1548
|
</li>`)}
|
|
1496
1549
|
</ul></div>` : p}
|
|
1497
1550
|
`)}
|
|
1498
1551
|
`;
|
|
1499
1552
|
}
|
|
1500
|
-
teamBlock(e, t, s,
|
|
1501
|
-
if (!
|
|
1502
|
-
const
|
|
1503
|
-
return
|
|
1504
|
-
<div class="teamblock ${
|
|
1505
|
-
${h ?
|
|
1553
|
+
teamBlock(e, t, s, r, o) {
|
|
1554
|
+
if (!r) return n`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1555
|
+
const l = e.teamsById[s], i = e.records[s], h = R(r, 58);
|
|
1556
|
+
return n`
|
|
1557
|
+
<div class="teamblock ${o ? "right" : ""}">
|
|
1558
|
+
${h ? n`<img class="crest logo" alt="" loading="lazy" src=${h} />` : n`<span class="crest" style="background:${r.colorPrimary || "#030711"};color:${_(r.colorPrimary || "#030711")}">${q(r)}</span>`}
|
|
1506
1559
|
<div>
|
|
1507
|
-
<div class="tname">${
|
|
1508
|
-
<div class="trec">${
|
|
1560
|
+
<div class="tname">${Q(e, s, t.date)}<a href=${g(e.hrefs.school, { id: r.id })}>${r.name}</a></div>
|
|
1561
|
+
<div class="trec">${r.mascot || ""} · ${k(i)}${l?.conferenceId ? n` · ${k(i, !0)} conf` : p}</div>
|
|
1509
1562
|
</div>
|
|
1510
1563
|
</div>
|
|
1511
1564
|
`;
|
|
1512
1565
|
}
|
|
1513
1566
|
renderLineScore(e, t, s) {
|
|
1514
|
-
const
|
|
1515
|
-
if (!
|
|
1516
|
-
return
|
|
1517
|
-
const
|
|
1518
|
-
const m =
|
|
1519
|
-
return m ? m[
|
|
1520
|
-
}, h = (
|
|
1567
|
+
const r = Ge(e);
|
|
1568
|
+
if (!r)
|
|
1569
|
+
return e.state === "scheduled" ? n`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : p;
|
|
1570
|
+
const o = Math.max(X(e.sport), ...r.map((d) => d.period)), l = (d) => Ue(e.sport, d), i = (d, c) => {
|
|
1571
|
+
const m = r.find((f) => f.period === c);
|
|
1572
|
+
return m ? m[d] : e.state === "final" ? 0 : "·";
|
|
1573
|
+
}, h = (d, c, m) => n`
|
|
1521
1574
|
<tr>
|
|
1522
|
-
<td class="teamcell">${
|
|
1523
|
-
${Array.from({ length:
|
|
1575
|
+
<td class="teamcell">${D(d, 20)}${d?.abbr || "TBD"}</td>
|
|
1576
|
+
${Array.from({ length: o }, (f, u) => n`<td class="num">${i(c, u + 1)}</td>`)}
|
|
1524
1577
|
<td class="num" style="font-weight:700">${m}</td>
|
|
1525
1578
|
</tr>`;
|
|
1526
|
-
return
|
|
1579
|
+
return n`
|
|
1527
1580
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1528
1581
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1529
|
-
<thead><tr><th>Team</th>${Array.from({ length:
|
|
1582
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (d, c) => n`<th class="num">${l(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1530
1583
|
<tbody>
|
|
1531
1584
|
${h(t, "away", e.awayScore)}
|
|
1532
1585
|
${h(s, "home", e.homeScore)}
|
|
@@ -1536,10 +1589,10 @@ class je extends $ {
|
|
|
1536
1589
|
`;
|
|
1537
1590
|
}
|
|
1538
1591
|
renderScoringPlays(e, t, s) {
|
|
1539
|
-
const
|
|
1540
|
-
if (!
|
|
1541
|
-
const
|
|
1542
|
-
return
|
|
1592
|
+
const r = Array.isArray(e.scoringPlays) ? e.scoringPlays : [];
|
|
1593
|
+
if (!r.length) return p;
|
|
1594
|
+
const o = (l) => [l.period, l.clock].filter(Boolean).join(" ");
|
|
1595
|
+
return n`
|
|
1543
1596
|
<div class="plays">
|
|
1544
1597
|
<div class="plays-title">Scoring plays</div>
|
|
1545
1598
|
<div class="tablewrap">
|
|
@@ -1549,11 +1602,11 @@ class je extends $ {
|
|
|
1549
1602
|
<th class="num">${t?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
1550
1603
|
</tr></thead>
|
|
1551
1604
|
<tbody>
|
|
1552
|
-
${
|
|
1553
|
-
<td class="when">${
|
|
1554
|
-
<td class="play">${
|
|
1555
|
-
<td class="num">${
|
|
1556
|
-
<td class="num">${
|
|
1605
|
+
${r.map((l) => n`<tr>
|
|
1606
|
+
<td class="when">${o(l) || "·"}</td>
|
|
1607
|
+
<td class="play">${l.description || "·"}</td>
|
|
1608
|
+
<td class="num">${l.awayScore}</td>
|
|
1609
|
+
<td class="num">${l.homeScore}</td>
|
|
1557
1610
|
</tr>`)}
|
|
1558
1611
|
</tbody>
|
|
1559
1612
|
</table>
|
|
@@ -1563,24 +1616,24 @@ class je extends $ {
|
|
|
1563
1616
|
}
|
|
1564
1617
|
renderContext(e, t, s) {
|
|
1565
1618
|
if (!s) return p;
|
|
1566
|
-
const
|
|
1567
|
-
return
|
|
1619
|
+
const r = e.records[t], o = W(this.data.games, t);
|
|
1620
|
+
return n`
|
|
1568
1621
|
<div class="card ctxcard">
|
|
1569
|
-
<div class="who">${
|
|
1622
|
+
<div class="who">${D(s)}${s.name}</div>
|
|
1570
1623
|
<div class="row">
|
|
1571
1624
|
<span>Last 5: ${K(e, t)}</span>
|
|
1572
|
-
<span>Streak: <b>${
|
|
1573
|
-
<span>PF/PA: <b>${
|
|
1574
|
-
<span>Next: ${
|
|
1575
|
-
${
|
|
1625
|
+
<span>Streak: <b>${r ? H(r.results) : "·"}</b></span>
|
|
1626
|
+
<span>PF/PA: <b>${r ? `${r.pf} / ${r.pa}` : "·"}</b></span>
|
|
1627
|
+
<span>Next: ${o ? n`${$(o.date, { month: "numeric", day: "numeric" })}
|
|
1628
|
+
${o.homeTeamId === t ? "vs" : "at"} ${N(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
1576
1629
|
</div>
|
|
1577
1630
|
</div>
|
|
1578
1631
|
`;
|
|
1579
1632
|
}
|
|
1580
1633
|
}
|
|
1581
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
1582
|
-
const
|
|
1583
|
-
class
|
|
1634
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", Xe);
|
|
1635
|
+
const Ze = 250, Je = 2;
|
|
1636
|
+
class et extends ae {
|
|
1584
1637
|
static properties = {
|
|
1585
1638
|
api: { type: String },
|
|
1586
1639
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -1591,7 +1644,7 @@ class We extends te {
|
|
|
1591
1644
|
activeIndex: { state: !0 },
|
|
1592
1645
|
searched: { state: !0 }
|
|
1593
1646
|
};
|
|
1594
|
-
static styles =
|
|
1647
|
+
static styles = y`
|
|
1595
1648
|
:host {
|
|
1596
1649
|
display: block;
|
|
1597
1650
|
position: relative;
|
|
@@ -1660,11 +1713,11 @@ class We extends te {
|
|
|
1660
1713
|
}
|
|
1661
1714
|
onInput(e) {
|
|
1662
1715
|
const t = e.target.value.trim();
|
|
1663
|
-
if (clearTimeout(this.debounceTimer), t.length <
|
|
1716
|
+
if (clearTimeout(this.debounceTimer), t.length < Je) {
|
|
1664
1717
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
1665
1718
|
return;
|
|
1666
1719
|
}
|
|
1667
|
-
this.debounceTimer = setTimeout(() => this.search(t),
|
|
1720
|
+
this.debounceTimer = setTimeout(() => this.search(t), Ze);
|
|
1668
1721
|
}
|
|
1669
1722
|
async search(e) {
|
|
1670
1723
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
@@ -1674,8 +1727,8 @@ class We extends te {
|
|
|
1674
1727
|
});
|
|
1675
1728
|
if (!s.ok)
|
|
1676
1729
|
return;
|
|
1677
|
-
const
|
|
1678
|
-
this.results =
|
|
1730
|
+
const r = await s.json();
|
|
1731
|
+
this.results = r.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
1679
1732
|
} catch (t) {
|
|
1680
1733
|
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
1681
1734
|
}
|
|
@@ -1709,36 +1762,36 @@ class We extends te {
|
|
|
1709
1762
|
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
1710
1763
|
}
|
|
1711
1764
|
renderOption(e, t) {
|
|
1712
|
-
const s = this.where(e),
|
|
1713
|
-
|
|
1765
|
+
const s = this.where(e), r = (o) => {
|
|
1766
|
+
o.preventDefault(), this.go(e);
|
|
1714
1767
|
};
|
|
1715
|
-
return
|
|
1768
|
+
return n`
|
|
1716
1769
|
<li
|
|
1717
1770
|
id="school-option-${t}"
|
|
1718
1771
|
role="option"
|
|
1719
1772
|
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
1720
|
-
@pointerdown="${
|
|
1773
|
+
@pointerdown="${r}"
|
|
1721
1774
|
@mousemove="${() => {
|
|
1722
1775
|
this.activeIndex = t;
|
|
1723
1776
|
}}"
|
|
1724
1777
|
>
|
|
1725
1778
|
<span class="name">${e.name}</span>
|
|
1726
|
-
${s ?
|
|
1779
|
+
${s ? n`<span class="where">${s}</span>` : p}
|
|
1727
1780
|
</li>
|
|
1728
1781
|
`;
|
|
1729
1782
|
}
|
|
1730
1783
|
renderListbox() {
|
|
1731
|
-
const e = this.searched && !this.results.length, t =
|
|
1732
|
-
return
|
|
1784
|
+
const e = this.searched && !this.results.length, t = n`<li class="empty">No schools found</li>`;
|
|
1785
|
+
return n`
|
|
1733
1786
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
1734
|
-
${this.results.map((s,
|
|
1787
|
+
${this.results.map((s, r) => this.renderOption(s, r))}
|
|
1735
1788
|
${e ? t : p}
|
|
1736
1789
|
</ul>
|
|
1737
1790
|
`;
|
|
1738
1791
|
}
|
|
1739
1792
|
render() {
|
|
1740
1793
|
const e = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
1741
|
-
return
|
|
1794
|
+
return n`
|
|
1742
1795
|
<input
|
|
1743
1796
|
type="text"
|
|
1744
1797
|
role="combobox"
|
|
@@ -1757,23 +1810,23 @@ class We extends te {
|
|
|
1757
1810
|
`;
|
|
1758
1811
|
}
|
|
1759
1812
|
}
|
|
1760
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
1813
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", et);
|
|
1761
1814
|
export {
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1815
|
+
O as D,
|
|
1816
|
+
Xe as H,
|
|
1817
|
+
Me as a,
|
|
1818
|
+
Oe as b,
|
|
1819
|
+
et as c,
|
|
1820
|
+
Re as d,
|
|
1821
|
+
Ne as e,
|
|
1822
|
+
P as f,
|
|
1823
|
+
ue as g,
|
|
1824
|
+
g as h,
|
|
1772
1825
|
G as i,
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1826
|
+
st as j,
|
|
1827
|
+
H as k,
|
|
1828
|
+
Ae as p,
|
|
1829
|
+
k as r,
|
|
1830
|
+
ne as s,
|
|
1831
|
+
V as t
|
|
1779
1832
|
};
|