@wral/hsot-data 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/dist/define.mjs +18 -0
- package/dist/define.standalone.js +1724 -0
- package/dist/hsot-boxscore-BYV62gYv.js +1231 -0
- package/dist/index.mjs +19 -0
- package/package.json +36 -0
|
@@ -0,0 +1,1231 @@
|
|
|
1
|
+
import { LitElement as J, html as l, css as b, nothing as p, svg as W } from "lit";
|
|
2
|
+
const Z = 50;
|
|
3
|
+
function ee(a = {}) {
|
|
4
|
+
const e = Object.entries(a).filter(([, s]) => s != null && s !== "");
|
|
5
|
+
if (!e.length) return "";
|
|
6
|
+
const t = new URLSearchParams();
|
|
7
|
+
return e.forEach(([s, o]) => t.set(s, String(o))), `?${t.toString()}`;
|
|
8
|
+
}
|
|
9
|
+
function te({ baseUrl: a, token: e = "", fetchFn: t } = {}) {
|
|
10
|
+
if (!a) throw new Error("createClient requires a baseUrl");
|
|
11
|
+
const s = a.replace(/\/+$/, ""), o = t || ((...i) => fetch(...i));
|
|
12
|
+
async function r(i) {
|
|
13
|
+
const m = { Accept: "application/json" };
|
|
14
|
+
e && (m.Authorization = `Bearer ${e}`);
|
|
15
|
+
const h = await o(`${s}${i}`, { headers: m });
|
|
16
|
+
if (!h.ok) {
|
|
17
|
+
const c = new Error(`api-hsot ${h.status} on ${i}`);
|
|
18
|
+
throw c.status = h.status, c;
|
|
19
|
+
}
|
|
20
|
+
return h.json();
|
|
21
|
+
}
|
|
22
|
+
async function n(i, m = {}) {
|
|
23
|
+
const h = [];
|
|
24
|
+
let c = null;
|
|
25
|
+
for (let d = 0; d < Z; d += 1) {
|
|
26
|
+
const f = ee(c ? { ...m, cursor: c } : m), u = await r(`${i}${f}`);
|
|
27
|
+
if (h.push(...u.items || []), c = u.nextCursor || null, !c) break;
|
|
28
|
+
}
|
|
29
|
+
return { items: h, total: h.length, nextCursor: null };
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
listSchools: (i) => n("/schools", i),
|
|
33
|
+
getSchool: (i) => r(`/schools/${i}`),
|
|
34
|
+
listTeams: (i) => n("/teams", i),
|
|
35
|
+
getTeam: (i) => r(`/teams/${i}`),
|
|
36
|
+
listConferences: (i) => n("/conferences", i),
|
|
37
|
+
listPlayers: (i) => n("/players", i),
|
|
38
|
+
listRosters: (i) => n("/rosters", i),
|
|
39
|
+
listGames: (i) => n("/games", i),
|
|
40
|
+
getGame: (i) => r(`/games/${i}`),
|
|
41
|
+
listTournaments: (i) => n("/tournaments", i),
|
|
42
|
+
listSeedings: (i, m) => n(`/tournaments/${i}/seedings`, m),
|
|
43
|
+
listRankings: (i) => n("/rankings", i),
|
|
44
|
+
listSports: () => r("/sports")
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
class y extends J {
|
|
48
|
+
static properties = {
|
|
49
|
+
api: { type: String },
|
|
50
|
+
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
51
|
+
data: { state: !0 },
|
|
52
|
+
loading: { state: !0 },
|
|
53
|
+
error: { state: !0 }
|
|
54
|
+
};
|
|
55
|
+
constructor() {
|
|
56
|
+
super(), this.api = "", this.refreshInterval = 0, this.data = null, this.loading = !1, this.error = "", this._client = null, this._refreshId = null;
|
|
57
|
+
}
|
|
58
|
+
/** Injected client wins; otherwise build a fetch client from the api attribute. */
|
|
59
|
+
set client(e) {
|
|
60
|
+
this._client = e, this.isConnected && this.load();
|
|
61
|
+
}
|
|
62
|
+
get client() {
|
|
63
|
+
return this._client ? this._client : this.api ? te({ baseUrl: this.api }) : null;
|
|
64
|
+
}
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
super.connectedCallback(), this._setupInterval();
|
|
67
|
+
}
|
|
68
|
+
disconnectedCallback() {
|
|
69
|
+
super.disconnectedCallback(), this._clearInterval();
|
|
70
|
+
}
|
|
71
|
+
firstUpdated() {
|
|
72
|
+
this.load();
|
|
73
|
+
}
|
|
74
|
+
updated(e) {
|
|
75
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval();
|
|
76
|
+
}
|
|
77
|
+
async load() {
|
|
78
|
+
const e = this.client;
|
|
79
|
+
if (!e) {
|
|
80
|
+
this.error = "not-configured";
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.loading = !0, this.error = "";
|
|
84
|
+
try {
|
|
85
|
+
this.data = await this.fetchData(e);
|
|
86
|
+
} catch (t) {
|
|
87
|
+
console.error(`[${this.tagName.toLowerCase()}]`, t), this.error = "load-failed";
|
|
88
|
+
} finally {
|
|
89
|
+
this.loading = !1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async fetchData(e) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
_setupInterval() {
|
|
96
|
+
this._clearInterval();
|
|
97
|
+
const e = Number(this.refreshInterval) || 0;
|
|
98
|
+
e > 0 && (this._refreshId = setInterval(() => this.load(), e));
|
|
99
|
+
}
|
|
100
|
+
_clearInterval() {
|
|
101
|
+
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
102
|
+
}
|
|
103
|
+
render() {
|
|
104
|
+
return this.error === "not-configured" ? l`<div class="error">This component needs an <code>api</code> attribute (the api-hsot v1 base URL) or an injected client.</div>` : this.error ? l`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : l`<div class="loading" role="status">Loading…</div>`;
|
|
105
|
+
}
|
|
106
|
+
renderView() {
|
|
107
|
+
return l``;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const g = (a) => Object.fromEntries((a || []).map((e) => [e.id, e])), se = b`
|
|
111
|
+
:host {
|
|
112
|
+
--hsot-red: var(--color-red, #D1232A);
|
|
113
|
+
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
114
|
+
--hsot-red-tint: #FAE9EA;
|
|
115
|
+
--hsot-black: var(--color-black, #030711);
|
|
116
|
+
--hsot-white: var(--color-white, #FFFFFF);
|
|
117
|
+
--hsot-gray-1: var(--color-gray-1, #F7F5F4);
|
|
118
|
+
--hsot-gray-2: var(--color-gray-2, #E7E5E4);
|
|
119
|
+
--hsot-gray-3: var(--color-gray-3, #D7D4D2);
|
|
120
|
+
--hsot-gray-4: var(--color-gray-4, #7C7C7C);
|
|
121
|
+
--hsot-gray-5: var(--color-gray-5, #6C6C6C);
|
|
122
|
+
--hsot-gray-6: var(--color-gray-6, #565454);
|
|
123
|
+
--hsot-gray-8: var(--color-gray-8, #263238);
|
|
124
|
+
--hsot-straw: var(--color-straw, #fff5ba);
|
|
125
|
+
--hsot-win: var(--color-green-dark, #66A208);
|
|
126
|
+
--hsot-loss: var(--color-red, #D1232A);
|
|
127
|
+
--hsot-tie: var(--color-gray-4, #7C7C7C);
|
|
128
|
+
--hsot-heading-font: var(--heading-font-family, 'IBM Plex Sans Condensed', 'Helvetica Neue', Helvetica, sans-serif);
|
|
129
|
+
--hsot-body-font: var(--body-font-family, Roboto, 'Helvetica Neue', Helvetica, sans-serif);
|
|
130
|
+
--hsot-radius-xs: var(--radius-xs, 0.15rem);
|
|
131
|
+
--hsot-radius-sm: var(--radius-sm, 0.3125rem);
|
|
132
|
+
--hsot-radius-md: var(--radius-md, 0.5rem);
|
|
133
|
+
display: block;
|
|
134
|
+
font-family: var(--hsot-body-font);
|
|
135
|
+
color: var(--hsot-black);
|
|
136
|
+
font-size: 1rem;
|
|
137
|
+
}
|
|
138
|
+
a { color: var(--hsot-red-deep); }
|
|
139
|
+
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
|
|
140
|
+
outline: 2px solid var(--hsot-red);
|
|
141
|
+
outline-offset: 1px;
|
|
142
|
+
}
|
|
143
|
+
.mut { color: var(--hsot-gray-5); }
|
|
144
|
+
`, ae = b`
|
|
145
|
+
.band { background: var(--hsot-black); color: var(--hsot-white); }
|
|
146
|
+
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
147
|
+
.band h1, .band h2.bandtitle {
|
|
148
|
+
margin: 0; font-family: var(--hsot-heading-font); font-size: 2.4rem; font-weight: 500;
|
|
149
|
+
letter-spacing: -0.035em; line-height: 1.1; text-transform: capitalize; color: var(--hsot-white);
|
|
150
|
+
}
|
|
151
|
+
.band .sub { margin: 0.25rem 0 0.9rem; color: rgba(255,255,255,0.75); font-size: 0.95rem; }
|
|
152
|
+
.band nav.tabs {
|
|
153
|
+
display: flex; gap: 1rem; border-top: 1px solid rgba(255,255,255,0.2);
|
|
154
|
+
max-width: 1366px; margin: 0 auto; padding: 0 1.25rem; overflow-x: auto;
|
|
155
|
+
}
|
|
156
|
+
.band nav.tabs a, .band nav.tabs span {
|
|
157
|
+
font-family: var(--hsot-heading-font); font-weight: 500; font-size: 0.875rem;
|
|
158
|
+
text-transform: uppercase; text-decoration: none; color: var(--hsot-white);
|
|
159
|
+
padding: 0.55rem 0.15rem; white-space: nowrap; border-bottom: 3px solid transparent;
|
|
160
|
+
}
|
|
161
|
+
.band nav.tabs a.on { border-bottom-color: var(--hsot-red); }
|
|
162
|
+
.band nav.tabs span.off { color: rgba(255,255,255,0.45); cursor: not-allowed; }
|
|
163
|
+
@media (max-width: 720px) { .band h1, .band h2.bandtitle { font-size: 1.8rem; } }
|
|
164
|
+
`, re = b`
|
|
165
|
+
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
166
|
+
.toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0 0 1.1rem; }
|
|
167
|
+
.toolbar .spacer { flex: 1; }
|
|
168
|
+
.asof { font-size: 0.8125rem; color: var(--hsot-gray-5); }
|
|
169
|
+
button.chip {
|
|
170
|
+
font-family: var(--hsot-heading-font); font-weight: 500; font-size: 0.8125rem;
|
|
171
|
+
text-transform: uppercase; border: 1px solid var(--hsot-gray-3);
|
|
172
|
+
background: var(--hsot-white); color: var(--hsot-gray-6);
|
|
173
|
+
border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer;
|
|
174
|
+
}
|
|
175
|
+
button.chip.on { background: var(--hsot-red); border-color: var(--hsot-red); color: var(--hsot-white); }
|
|
176
|
+
button.chip[disabled] { opacity: 0.45; cursor: not-allowed; }
|
|
177
|
+
input[type=search], select {
|
|
178
|
+
font-family: var(--hsot-body-font); font-size: 0.9rem;
|
|
179
|
+
border: 1px solid var(--hsot-gray-3); border-radius: var(--hsot-radius-sm);
|
|
180
|
+
padding: 0.42rem 0.65rem; background: var(--hsot-white); color: inherit;
|
|
181
|
+
}
|
|
182
|
+
.card {
|
|
183
|
+
background: var(--hsot-white); border: 1px solid var(--hsot-gray-2);
|
|
184
|
+
border-radius: var(--hsot-radius-md); overflow: hidden; margin-bottom: 1.25rem;
|
|
185
|
+
}
|
|
186
|
+
.card .card-head {
|
|
187
|
+
display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
|
|
188
|
+
padding: 0.8rem 1rem 0.6rem; border-bottom: 3px solid var(--hsot-gray-2);
|
|
189
|
+
}
|
|
190
|
+
.card .card-head h2, .card .card-head h3 {
|
|
191
|
+
margin: 0; font-family: var(--hsot-heading-font); font-size: 1.25rem; color: var(--hsot-black);
|
|
192
|
+
}
|
|
193
|
+
.card .card-head .meta { font-size: 0.8125rem; color: var(--hsot-gray-5); }
|
|
194
|
+
.section-title {
|
|
195
|
+
color: var(--hsot-black); font-size: 1.0625rem; font-weight: 600; line-height: 1;
|
|
196
|
+
padding: 0 0 0.1875rem 1.25rem; position: relative; text-transform: uppercase;
|
|
197
|
+
font-family: var(--hsot-body-font); margin: 1.6rem 0 0.7rem;
|
|
198
|
+
}
|
|
199
|
+
.section-title::before {
|
|
200
|
+
color: var(--hsot-red); content: "·"; font-size: 2.5em; height: 1em; line-height: 1;
|
|
201
|
+
margin-right: 0.3125rem; position: absolute; top: -0.75rem; left: 0;
|
|
202
|
+
}
|
|
203
|
+
.empty { padding: 1.2rem 1rem; color: var(--hsot-gray-5); font-size: 0.9rem; }
|
|
204
|
+
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
205
|
+
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
206
|
+
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
207
|
+
`, oe = b`
|
|
208
|
+
.pill {
|
|
209
|
+
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
210
|
+
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
211
|
+
border-radius: var(--hsot-radius-md); padding: 0.14rem 0.45rem; vertical-align: middle;
|
|
212
|
+
}
|
|
213
|
+
.pill.class { background: var(--hsot-red-tint); color: var(--hsot-red-deep); }
|
|
214
|
+
.pill.live { background: var(--hsot-red); color: var(--hsot-white); animation: hsot-pulse 1.6s ease-in-out infinite; }
|
|
215
|
+
.pill.final { background: var(--hsot-gray-8); color: var(--hsot-white); }
|
|
216
|
+
.pill.sched { background: var(--hsot-white); color: var(--hsot-gray-6); border: 1px solid var(--hsot-gray-3); }
|
|
217
|
+
.pill.warn { background: var(--color-orange, #FF9505); color: var(--hsot-black); }
|
|
218
|
+
.pill.type { background: var(--hsot-gray-1); color: var(--hsot-gray-6); border: 1px solid var(--hsot-gray-2); }
|
|
219
|
+
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
220
|
+
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
221
|
+
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
222
|
+
`, ne = b`
|
|
223
|
+
.tablewrap { overflow-x: auto; }
|
|
224
|
+
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
225
|
+
table.data th {
|
|
226
|
+
background: var(--hsot-black); color: var(--hsot-white);
|
|
227
|
+
border-right: 1px solid rgba(255,255,255,0.15); text-align: left;
|
|
228
|
+
font-weight: 500; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.04em;
|
|
229
|
+
padding: 8px 12px; white-space: nowrap;
|
|
230
|
+
}
|
|
231
|
+
table.data th:last-child { border-right: none; }
|
|
232
|
+
table.data thead { border-bottom: 3px solid var(--hsot-red); }
|
|
233
|
+
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
|
|
234
|
+
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--hsot-gray-2); white-space: nowrap; }
|
|
235
|
+
table.data tbody tr:last-child td { border-bottom: none; }
|
|
236
|
+
table.data tbody tr.rowlink { cursor: pointer; }
|
|
237
|
+
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
238
|
+
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
239
|
+
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
240
|
+
`, ie = b`
|
|
241
|
+
.swatch {
|
|
242
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
243
|
+
width: 26px; height: 26px; border-radius: 50%;
|
|
244
|
+
font-family: var(--hsot-heading-font); font-weight: 700; font-size: 0.55rem;
|
|
245
|
+
margin-right: 0.5rem; vertical-align: middle; flex: none;
|
|
246
|
+
}
|
|
247
|
+
.rankbadge { font-weight: 700; color: var(--hsot-red-deep); font-size: 0.8em; margin-right: 0.22rem; }
|
|
248
|
+
.dots { display: inline-flex; gap: 3px; }
|
|
249
|
+
.dot {
|
|
250
|
+
width: 17px; height: 17px; border-radius: 50%;
|
|
251
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
252
|
+
color: var(--hsot-white); font-family: var(--hsot-heading-font);
|
|
253
|
+
font-size: 0.6rem; font-weight: 700; text-decoration: none;
|
|
254
|
+
}
|
|
255
|
+
.dot.W { background: var(--hsot-win); }
|
|
256
|
+
.dot.L { background: var(--hsot-loss); }
|
|
257
|
+
.dot.T { background: var(--hsot-tie); }
|
|
258
|
+
`, le = b`
|
|
259
|
+
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
260
|
+
.gamelist li {
|
|
261
|
+
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
262
|
+
border-bottom: 1px solid var(--hsot-gray-2); font-size: 0.9rem; flex-wrap: wrap;
|
|
263
|
+
}
|
|
264
|
+
.gamelist li:last-child { border-bottom: none; }
|
|
265
|
+
.gamelist .d { width: 84px; flex: none; color: var(--hsot-gray-5); font-size: 0.8rem; }
|
|
266
|
+
.gamelist .res { width: 86px; flex: none; font-family: var(--hsot-heading-font); font-weight: 700; }
|
|
267
|
+
.gamelist .res .W { color: var(--hsot-win); }
|
|
268
|
+
.gamelist .res .L { color: var(--hsot-loss); }
|
|
269
|
+
.gamelist .res .T { color: var(--hsot-tie); }
|
|
270
|
+
.gamelist .opp { flex: 1; min-width: 180px; }
|
|
271
|
+
.gamelist .opp a { text-decoration: none; color: inherit; font-weight: 500; }
|
|
272
|
+
.gamelist .opp a:hover { text-decoration: underline; }
|
|
273
|
+
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
274
|
+
.gamelist a.box { font-size: 0.78rem; }
|
|
275
|
+
`, S = [se, ae, re, oe, ne, ie, le];
|
|
276
|
+
function G(a) {
|
|
277
|
+
return a.state !== "final" ? null : a.forfeit && a.forfeit !== "none" ? a.forfeit : a.homeScore > a.awayScore ? "home" : a.awayScore > a.homeScore ? "away" : a.tiebreakWinner && a.tiebreakWinner !== "none" ? a.tiebreakWinner : "tie";
|
|
278
|
+
}
|
|
279
|
+
function C(a, e) {
|
|
280
|
+
const t = {}, s = (r) => (t[r] = t[r] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, t[r]), o = a.filter((r) => r.state === "final" && r.gameType !== "scrimmage" && (!e || r.date <= e)).sort((r, n) => String(r.date).localeCompare(String(n.date)));
|
|
281
|
+
for (const r of o) {
|
|
282
|
+
const n = G(r), i = r.gameType === "conference";
|
|
283
|
+
for (const m of ["home", "away"]) {
|
|
284
|
+
const h = m === "home" ? r.homeTeamId : r.awayTeamId;
|
|
285
|
+
if (!h) continue;
|
|
286
|
+
const c = s(h), d = m === "home" ? r.homeScore : r.awayScore, f = m === "home" ? r.awayScore : r.homeScore;
|
|
287
|
+
c.pf += d, c.pa += f;
|
|
288
|
+
let u = "T";
|
|
289
|
+
n === "tie" ? (c.t += 1, i && (c.ct += 1)) : n === m ? (c.w += 1, i && (c.cw += 1), u = "W") : (c.l += 1, i && (c.cl += 1), u = "L"), c.results.push({ gameId: r.id, date: r.date, mark: u, my: d, their: f, opp: m === "home" ? r.awayTeamId : r.homeTeamId, conf: i });
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return t;
|
|
293
|
+
}
|
|
294
|
+
function z(a) {
|
|
295
|
+
if (!a || !a.length) return "";
|
|
296
|
+
const e = a[a.length - 1].mark;
|
|
297
|
+
let t = 0;
|
|
298
|
+
for (let s = a.length - 1; s >= 0 && a[s].mark === e; s -= 1) t += 1;
|
|
299
|
+
return e + t;
|
|
300
|
+
}
|
|
301
|
+
const q = (a, e, t) => {
|
|
302
|
+
const s = a + e + t;
|
|
303
|
+
return s ? (a + t / 2) / s : 0;
|
|
304
|
+
}, V = (a) => a.toFixed(3).replace("0.", ".");
|
|
305
|
+
function w(a, e = !1) {
|
|
306
|
+
if (!a) return "0-0";
|
|
307
|
+
const t = e ? a.cw : a.w, s = e ? a.cl : a.l, o = e ? a.ct : a.t;
|
|
308
|
+
return `${t}-${s}${o ? `-${o}` : ""}`;
|
|
309
|
+
}
|
|
310
|
+
function K(a, e) {
|
|
311
|
+
return a.map((t) => {
|
|
312
|
+
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
313
|
+
return { team: t, rec: s, confPct: q(s.cw, s.cl, s.ct), overallPct: q(s.w, s.l, s.t) };
|
|
314
|
+
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
315
|
+
}
|
|
316
|
+
function H(a, e) {
|
|
317
|
+
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;
|
|
318
|
+
}
|
|
319
|
+
function Y(a, e) {
|
|
320
|
+
const t = a[e];
|
|
321
|
+
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
322
|
+
}
|
|
323
|
+
const L = {
|
|
324
|
+
game: "/{sport}/game/{id}/",
|
|
325
|
+
school: "/school/{id}/",
|
|
326
|
+
section: "/{sport}/{view}/"
|
|
327
|
+
};
|
|
328
|
+
function v(a, e) {
|
|
329
|
+
return String(a).replace(/\{(\w+)\}/g, (t, s) => e[s] !== void 0 && e[s] !== null ? String(e[s]) : t);
|
|
330
|
+
}
|
|
331
|
+
function D(a) {
|
|
332
|
+
return {
|
|
333
|
+
game: a.getAttribute("game-href") || L.game,
|
|
334
|
+
school: a.getAttribute("school-href") || L.school,
|
|
335
|
+
section: a.getAttribute("section-href") || L.section
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
const _ = (a) => a ? a.charAt(0).toUpperCase() + a.slice(1) : "";
|
|
339
|
+
function $(a, e) {
|
|
340
|
+
if (!a) return "TBD";
|
|
341
|
+
const [t, s, o] = String(a).split("-").map(Number);
|
|
342
|
+
return !t || !s || !o ? "TBD" : new Date(t, s - 1, o).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
343
|
+
}
|
|
344
|
+
function R(a) {
|
|
345
|
+
if (!a) return "";
|
|
346
|
+
const [e, t] = String(a).split(":").map(Number);
|
|
347
|
+
if (Number.isNaN(e)) return "";
|
|
348
|
+
const s = e >= 12 ? "PM" : "AM";
|
|
349
|
+
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
350
|
+
}
|
|
351
|
+
function ce(a) {
|
|
352
|
+
return a ? `${Math.floor(a / 12)}-${a % 12}` : "·";
|
|
353
|
+
}
|
|
354
|
+
function A(a = /* @__PURE__ */ new Date()) {
|
|
355
|
+
const e = a.getFullYear();
|
|
356
|
+
return a.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
357
|
+
}
|
|
358
|
+
function N(a = /* @__PURE__ */ new Date()) {
|
|
359
|
+
const e = (t) => String(t).padStart(2, "0");
|
|
360
|
+
return `${a.getFullYear()}-${e(a.getMonth() + 1)}-${e(a.getDate())}`;
|
|
361
|
+
}
|
|
362
|
+
function M(a) {
|
|
363
|
+
return a ? (a.abbr || a.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
364
|
+
}
|
|
365
|
+
function F(a) {
|
|
366
|
+
if (!a || !/^#[0-9a-fA-F]{6}$/.test(a)) return "#FFFFFF";
|
|
367
|
+
const e = parseInt(a.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, o = e & 255;
|
|
368
|
+
return 0.299 * t + 0.587 * s + 0.114 * o > 150 ? "#0F1B33" : "#FFFFFF";
|
|
369
|
+
}
|
|
370
|
+
const de = (a) => {
|
|
371
|
+
const e = ["th", "st", "nd", "rd"], t = a % 100;
|
|
372
|
+
return a + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
373
|
+
};
|
|
374
|
+
function he(a) {
|
|
375
|
+
if (a.state === "live") return { kind: "live", label: `Live · ${a.period || ""}`.replace(/ · $/, "") };
|
|
376
|
+
if (a.state === "final") {
|
|
377
|
+
const e = [];
|
|
378
|
+
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(" · ")}` : ""}` };
|
|
379
|
+
}
|
|
380
|
+
return a.state === "postponed" ? { kind: "warn", label: "Postponed" } : a.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${$(a.date, { month: "short", day: "numeric" })} · ${R(a.time)}`.replace(/ · $/, "") };
|
|
381
|
+
}
|
|
382
|
+
function ke(a, e, t, s = "") {
|
|
383
|
+
let o = null;
|
|
384
|
+
for (const r of a || [])
|
|
385
|
+
r.sport === e && (t && r.effectiveDate > t || s && r.gender && r.gender !== s || (!o || r.effectiveDate > o.effectiveDate) && (o = r));
|
|
386
|
+
return o;
|
|
387
|
+
}
|
|
388
|
+
function Q(a, e, t, s, o) {
|
|
389
|
+
const r = e[t];
|
|
390
|
+
if (!r) return null;
|
|
391
|
+
const n = /* @__PURE__ */ new Map();
|
|
392
|
+
for (const m of a || []) {
|
|
393
|
+
if (m.sport !== s || o && m.effectiveDate > o || m.gender && r.gender !== m.gender && r.gender !== "coed") continue;
|
|
394
|
+
const h = m.gender || "", c = n.get(h);
|
|
395
|
+
(!c || m.effectiveDate > c.effectiveDate) && n.set(h, m);
|
|
396
|
+
}
|
|
397
|
+
let i = null;
|
|
398
|
+
for (const m of n.values()) {
|
|
399
|
+
const h = (m.teamIds || []).indexOf(t);
|
|
400
|
+
h !== -1 && (!i || m.effectiveDate > i.effectiveDate) && (i = { poll: m, rank: h + 1 });
|
|
401
|
+
}
|
|
402
|
+
return i ? i.rank : null;
|
|
403
|
+
}
|
|
404
|
+
function me(a, e, t) {
|
|
405
|
+
if (!a) return { kind: "none", delta: 0 };
|
|
406
|
+
const s = (a.teamIds || []).indexOf(t) + 1;
|
|
407
|
+
if (!s) return { kind: "none", delta: 0 };
|
|
408
|
+
if (!e) return { kind: "same", delta: 0 };
|
|
409
|
+
const o = (e.teamIds || []).indexOf(t) + 1;
|
|
410
|
+
if (!o) return { kind: "new", delta: 0 };
|
|
411
|
+
const r = o - s;
|
|
412
|
+
return r > 0 ? { kind: "up", delta: r } : r < 0 ? { kind: "down", delta: -r } : { kind: "same", delta: 0 };
|
|
413
|
+
}
|
|
414
|
+
const T = (a, e) => {
|
|
415
|
+
const t = a.teamsById[e];
|
|
416
|
+
return t ? a.schoolsById[t.schoolId] : null;
|
|
417
|
+
}, x = (a, e) => T(a, e)?.name || "TBD", B = (a, e) => T(a, e)?.abbr || "TBD";
|
|
418
|
+
function I(a, e = 26) {
|
|
419
|
+
if (!a) return p;
|
|
420
|
+
const t = a.colorPrimary || "#030711", s = F(t);
|
|
421
|
+
return l`<span class="swatch" aria-hidden="true"
|
|
422
|
+
style="width:${e}px;height:${e}px;background:${t};color:${s};font-size:${Math.max(8, e * 0.28)}px"
|
|
423
|
+
>${M(a)}</span>`;
|
|
424
|
+
}
|
|
425
|
+
function U(a, e, t) {
|
|
426
|
+
const s = Q(a.rankings, a.teamsById, e, a.sport, t);
|
|
427
|
+
return s ? l`<span class="rankbadge">#${s}</span>` : p;
|
|
428
|
+
}
|
|
429
|
+
function O(a, e, t) {
|
|
430
|
+
const s = T(a, e);
|
|
431
|
+
return s ? l`${U(a, e, t)}<a href=${v(a.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
|
|
432
|
+
}
|
|
433
|
+
function j(a, e, t = 5) {
|
|
434
|
+
const s = a.records[e];
|
|
435
|
+
if (!s || !s.results.length) return l`<span class="mut">·</span>`;
|
|
436
|
+
const o = s.results.slice(-1 * t);
|
|
437
|
+
return l`<span class="dots" role="img" aria-label="last ${o.length} results">
|
|
438
|
+
${o.map((r) => l`<a class="dot ${r.mark}"
|
|
439
|
+
title="${r.mark} ${r.my}-${r.their} vs ${x(a, r.opp)}"
|
|
440
|
+
href=${v(a.hrefs.game, { sport: a.sport, id: r.gameId })}>${r.mark}</a>`)}
|
|
441
|
+
</span>`;
|
|
442
|
+
}
|
|
443
|
+
function P(a) {
|
|
444
|
+
const e = he(a);
|
|
445
|
+
return l`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
446
|
+
}
|
|
447
|
+
function X(a, e, t) {
|
|
448
|
+
if (!e) return l`<span class="mut">·</span>`;
|
|
449
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, o = e.homeTeamId === t ? "vs" : "at";
|
|
450
|
+
return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${$(e.date, { month: "numeric", day: "numeric" })} `}${o} ${B(a, s)}`;
|
|
451
|
+
}
|
|
452
|
+
class pe extends y {
|
|
453
|
+
static styles = S;
|
|
454
|
+
static properties = {
|
|
455
|
+
...y.properties,
|
|
456
|
+
sport: { type: String },
|
|
457
|
+
season: { type: String },
|
|
458
|
+
date: { type: String }
|
|
459
|
+
};
|
|
460
|
+
constructor() {
|
|
461
|
+
super(), this.sport = "football", this.season = "", this.date = "";
|
|
462
|
+
}
|
|
463
|
+
connectedCallback() {
|
|
464
|
+
if (super.connectedCallback(), !this.date) {
|
|
465
|
+
const e = new URLSearchParams(globalThis.location?.search || "").get("date");
|
|
466
|
+
this.date = e || N();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
async fetchData(e) {
|
|
470
|
+
const t = this.season || A(), [s, o, r, n, i] = await Promise.all([
|
|
471
|
+
e.listSchools(),
|
|
472
|
+
e.listTeams({ sport: this.sport }),
|
|
473
|
+
e.listConferences(),
|
|
474
|
+
e.listGames({ sport: this.sport, season: t }),
|
|
475
|
+
e.listRankings({ sport: this.sport })
|
|
476
|
+
]);
|
|
477
|
+
return {
|
|
478
|
+
season: t,
|
|
479
|
+
schools: s.items,
|
|
480
|
+
teams: o.items,
|
|
481
|
+
conferences: r.items,
|
|
482
|
+
games: n.items,
|
|
483
|
+
rankings: i.items
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
get ctx() {
|
|
487
|
+
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
488
|
+
teamsById: g(this.data.teams),
|
|
489
|
+
schoolsById: g(this.data.schools),
|
|
490
|
+
records: C(this.data.games),
|
|
491
|
+
rankings: this.data.rankings,
|
|
492
|
+
hrefs: D(this),
|
|
493
|
+
sport: this.sport
|
|
494
|
+
}, this._ctxData = this.data), this._ctx;
|
|
495
|
+
}
|
|
496
|
+
renderView() {
|
|
497
|
+
const e = this.ctx, t = g(this.data.conferences), s = [...new Set(this.data.games.map((n) => n.date).filter(Boolean))].sort(), o = this.data.games.filter((n) => n.date === this.date).sort((n, i) => (n.state === "live" ? -1 : 1) - (i.state === "live" ? -1 : 1)), r = /* @__PURE__ */ new Map();
|
|
498
|
+
return o.forEach((n) => {
|
|
499
|
+
const i = n.gameType === "conference" && n.conferenceId ? t[n.conferenceId]?.name || "Conference" : n.gameType === "playoff" ? "Playoffs" : n.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
500
|
+
r.has(i) || r.set(i, []), r.get(i).push(n);
|
|
501
|
+
}), l`
|
|
502
|
+
<div class="band">
|
|
503
|
+
<div class="inner">
|
|
504
|
+
<h1>${_(this.sport)} scores & schedules</h1>
|
|
505
|
+
<p class="sub">${$(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${o.length} games</p>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
<div class="view">
|
|
509
|
+
<div class="toolbar">
|
|
510
|
+
<label class="asof" for="datesel">Date</label>
|
|
511
|
+
<select id="datesel" @change=${(n) => {
|
|
512
|
+
this.date = n.target.value;
|
|
513
|
+
}}>
|
|
514
|
+
${s.map((n) => l`<option value=${n} ?selected=${n === this.date}>
|
|
515
|
+
${$(n, { weekday: "short", month: "short", day: "numeric" })}${n === N() ? " · today" : ""}
|
|
516
|
+
</option>`)}
|
|
517
|
+
</select>
|
|
518
|
+
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
519
|
+
@click=${() => {
|
|
520
|
+
this.date = s[s.indexOf(this.date) - 1];
|
|
521
|
+
}}>← Prev</button>
|
|
522
|
+
<button class="chip" ?disabled=${s.indexOf(this.date) < 0 || s.indexOf(this.date) >= s.length - 1}
|
|
523
|
+
@click=${() => {
|
|
524
|
+
this.date = s[s.indexOf(this.date) + 1];
|
|
525
|
+
}}>Next →</button>
|
|
526
|
+
<span class="spacer"></span>
|
|
527
|
+
<span class="asof">Live games first · report a score to see it update here</span>
|
|
528
|
+
</div>
|
|
529
|
+
${o.length ? p : l`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
530
|
+
${[...r.entries()].map(([n, i]) => l`
|
|
531
|
+
<div class="section-title">${n}</div>
|
|
532
|
+
<div class="card"><ul class="gamelist">
|
|
533
|
+
${i.map((m) => this.renderGame(e, m))}
|
|
534
|
+
</ul></div>
|
|
535
|
+
`)}
|
|
536
|
+
</div>
|
|
537
|
+
`;
|
|
538
|
+
}
|
|
539
|
+
renderGame(e, t) {
|
|
540
|
+
const s = t.state === "final" || t.state === "live" ? `${t.awayScore}-${t.homeScore}` : R(t.time);
|
|
541
|
+
return l`
|
|
542
|
+
<li>
|
|
543
|
+
${P(t)}
|
|
544
|
+
<span class="opp">${O(e, t.awayTeamId, t.date)} at ${O(e, t.homeTeamId, t.date)}</span>
|
|
545
|
+
<span class="res" style="width:auto">${s}</span>
|
|
546
|
+
<span class="where">${t.venue || ""}</span>
|
|
547
|
+
${t.broadcast ? l`<span class="pill class">${t.broadcast}</span>` : p}
|
|
548
|
+
<a class="box" href=${v(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
549
|
+
</li>
|
|
550
|
+
`;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", pe);
|
|
554
|
+
class fe extends y {
|
|
555
|
+
static styles = S;
|
|
556
|
+
static properties = {
|
|
557
|
+
...y.properties,
|
|
558
|
+
sport: { type: String },
|
|
559
|
+
season: { type: String },
|
|
560
|
+
classFilter: { state: !0 },
|
|
561
|
+
query: { state: !0 }
|
|
562
|
+
};
|
|
563
|
+
constructor() {
|
|
564
|
+
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
565
|
+
}
|
|
566
|
+
async fetchData(e) {
|
|
567
|
+
const t = this.season || A(), [s, o, r, n, i] = await Promise.all([
|
|
568
|
+
e.listConferences({ active: !0 }),
|
|
569
|
+
e.listSchools(),
|
|
570
|
+
e.listTeams({ sport: this.sport }),
|
|
571
|
+
e.listGames({ sport: this.sport, season: t }),
|
|
572
|
+
e.listRankings({ sport: this.sport })
|
|
573
|
+
]);
|
|
574
|
+
return {
|
|
575
|
+
season: t,
|
|
576
|
+
conferences: s.items,
|
|
577
|
+
schools: o.items,
|
|
578
|
+
teams: r.items,
|
|
579
|
+
games: n.items,
|
|
580
|
+
rankings: i.items
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
get ctx() {
|
|
584
|
+
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
585
|
+
teamsById: g(this.data.teams),
|
|
586
|
+
schoolsById: g(this.data.schools),
|
|
587
|
+
records: C(this.data.games),
|
|
588
|
+
rankings: this.data.rankings,
|
|
589
|
+
hrefs: D(this),
|
|
590
|
+
sport: this.sport
|
|
591
|
+
}, this._ctxData = this.data), this._ctx;
|
|
592
|
+
}
|
|
593
|
+
renderView() {
|
|
594
|
+
const e = this.ctx, t = ["All", ...new Set(this.data.conferences.flatMap((o) => o.classifications || []))].slice(0, 9), s = this.data.conferences.filter((o) => o.active !== !1).filter((o) => this.classFilter === "All" || (o.classifications || []).includes(this.classFilter));
|
|
595
|
+
return l`
|
|
596
|
+
<div class="band">
|
|
597
|
+
<div class="inner">
|
|
598
|
+
<h1>${_(this.sport)} standings</h1>
|
|
599
|
+
<p class="sub">${this.data.season} season · every conference, computed live from reported results</p>
|
|
600
|
+
</div>
|
|
601
|
+
</div>
|
|
602
|
+
<div class="view">
|
|
603
|
+
<div class="toolbar">
|
|
604
|
+
<div role="group" aria-label="Classification filter">
|
|
605
|
+
${t.map((o) => l`<button class="chip ${this.classFilter === o ? "on" : ""}"
|
|
606
|
+
@click=${() => {
|
|
607
|
+
this.classFilter = o;
|
|
608
|
+
}}>${o}</button>`)}
|
|
609
|
+
</div>
|
|
610
|
+
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
611
|
+
.value=${this.query} @input=${(o) => {
|
|
612
|
+
this.query = o.target.value;
|
|
613
|
+
}}>
|
|
614
|
+
<span class="spacer"></span>
|
|
615
|
+
<span class="asof">Records through ${$(N(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
616
|
+
</div>
|
|
617
|
+
${s.map((o) => this.renderConference(e, o))}
|
|
618
|
+
</div>
|
|
619
|
+
`;
|
|
620
|
+
}
|
|
621
|
+
renderConference(e, t) {
|
|
622
|
+
const s = this.data.teams.filter((n) => n.conferenceId === t.id);
|
|
623
|
+
if (!s.length) return p;
|
|
624
|
+
const o = this.query.trim().toLowerCase(), r = K(s, e.records);
|
|
625
|
+
return l`
|
|
626
|
+
<div class="card">
|
|
627
|
+
<div class="card-head">
|
|
628
|
+
<h2>${t.name}</h2>
|
|
629
|
+
${(t.classifications || []).map((n) => l`<span class="pill class">${n}</span>`)}
|
|
630
|
+
<span class="meta">${r.length} teams · membership derives from teams</span>
|
|
631
|
+
</div>
|
|
632
|
+
<div class="tablewrap"><table class="data">
|
|
633
|
+
<thead><tr>
|
|
634
|
+
<th>#</th><th>Team</th><th class="num">Conf</th><th class="num">Pct</th>
|
|
635
|
+
<th class="num">Overall</th><th class="num">Pct</th><th class="num">PF</th><th class="num">PA</th><th class="num">Diff</th>
|
|
636
|
+
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
637
|
+
</tr></thead>
|
|
638
|
+
<tbody>
|
|
639
|
+
${r.map((n, i) => this.renderRow(e, n, i, o))}
|
|
640
|
+
</tbody>
|
|
641
|
+
</table></div>
|
|
642
|
+
</div>
|
|
643
|
+
`;
|
|
644
|
+
}
|
|
645
|
+
renderRow(e, t, s, o) {
|
|
646
|
+
const r = e.schoolsById[t.team.schoolId], n = r?.name || t.team.name || "TBD";
|
|
647
|
+
if (o && !n.toLowerCase().includes(o)) return p;
|
|
648
|
+
const i = t.rec.pf - t.rec.pa, m = H(this.data.games, t.team.id), h = (t.team.championships || []).map((d) => l`
|
|
649
|
+
<span class="pill champ" title="${d.season} ${d.title} champion">★ ${d.season} ${d.title}</span>`), c = () => {
|
|
650
|
+
location.href = v(e.hrefs.school, { id: t.team.schoolId });
|
|
651
|
+
};
|
|
652
|
+
return l`
|
|
653
|
+
<tr class="rowlink" @click=${(d) => {
|
|
654
|
+
d.target.closest("a") || c();
|
|
655
|
+
}}>
|
|
656
|
+
<td class="mut">${s + 1}</td>
|
|
657
|
+
<td class="teamcell">
|
|
658
|
+
${I(r)}${U(e, t.team.id, null)}
|
|
659
|
+
<a href=${v(e.hrefs.school, { id: t.team.schoolId })}>${n}</a> ${h}
|
|
660
|
+
</td>
|
|
661
|
+
<td class="num">${w(t.rec, !0)}</td>
|
|
662
|
+
<td class="num">${V(t.confPct)}</td>
|
|
663
|
+
<td class="num">${w(t.rec)}</td>
|
|
664
|
+
<td class="num">${V(t.overallPct)}</td>
|
|
665
|
+
<td class="num">${t.rec.pf}</td>
|
|
666
|
+
<td class="num">${t.rec.pa}</td>
|
|
667
|
+
<td class="num" style="color:${i >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${i > 0 ? "+" : ""}${i}</td>
|
|
668
|
+
<td>${z(t.rec.results) || "·"}</td>
|
|
669
|
+
<td>${j(e, t.team.id)}</td>
|
|
670
|
+
<td>${X(e, m, t.team.id)}</td>
|
|
671
|
+
</tr>
|
|
672
|
+
`;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", fe);
|
|
676
|
+
const ue = b`
|
|
677
|
+
.hero1 {
|
|
678
|
+
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
679
|
+
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
680
|
+
margin-bottom: 1.1rem; flex-wrap: wrap;
|
|
681
|
+
}
|
|
682
|
+
.hero1 .bigrank { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 3.4rem; line-height: 1; opacity: 0.9; }
|
|
683
|
+
.hero1 h2 { margin: 0; font-family: var(--hsot-heading-font); font-size: 2rem; font-weight: 700; }
|
|
684
|
+
.hero1 a { color: inherit; }
|
|
685
|
+
.hero1 .facts { font-size: 0.95rem; opacity: 0.92; }
|
|
686
|
+
.delta { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
|
|
687
|
+
.delta.up { color: var(--hsot-win); }
|
|
688
|
+
.delta.down { color: var(--hsot-loss); }
|
|
689
|
+
.delta.same { color: var(--hsot-gray-4); }
|
|
690
|
+
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
691
|
+
.sparkline { vertical-align: middle; }
|
|
692
|
+
`;
|
|
693
|
+
class ge extends y {
|
|
694
|
+
static styles = [...S, ue];
|
|
695
|
+
static properties = {
|
|
696
|
+
...y.properties,
|
|
697
|
+
sport: { type: String },
|
|
698
|
+
gender: { type: String },
|
|
699
|
+
season: { type: String },
|
|
700
|
+
pollDate: { state: !0 }
|
|
701
|
+
};
|
|
702
|
+
constructor() {
|
|
703
|
+
super(), this.sport = "football", this.gender = "", this.season = "", this.pollDate = "";
|
|
704
|
+
}
|
|
705
|
+
connectedCallback() {
|
|
706
|
+
super.connectedCallback();
|
|
707
|
+
const e = new URLSearchParams(globalThis.location?.search || "").get("poll");
|
|
708
|
+
e && (this.pollDate = e);
|
|
709
|
+
}
|
|
710
|
+
async fetchData(e) {
|
|
711
|
+
const t = this.season || A(), [s, o, r, n, i] = await Promise.all([
|
|
712
|
+
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
713
|
+
e.listSchools(),
|
|
714
|
+
e.listTeams({ sport: this.sport }),
|
|
715
|
+
e.listConferences(),
|
|
716
|
+
e.listGames({ sport: this.sport, season: t })
|
|
717
|
+
]), m = s.items.filter((h) => !this.gender || !h.gender || h.gender === this.gender).sort((h, c) => c.effectiveDate.localeCompare(h.effectiveDate));
|
|
718
|
+
return {
|
|
719
|
+
season: t,
|
|
720
|
+
polls: m,
|
|
721
|
+
schools: o.items,
|
|
722
|
+
teams: r.items,
|
|
723
|
+
conferences: n.items,
|
|
724
|
+
games: i.items
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
get ctx() {
|
|
728
|
+
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
729
|
+
teamsById: g(this.data.teams),
|
|
730
|
+
schoolsById: g(this.data.schools),
|
|
731
|
+
records: C(this.data.games),
|
|
732
|
+
rankings: this.data.polls,
|
|
733
|
+
hrefs: D(this),
|
|
734
|
+
sport: this.sport
|
|
735
|
+
}, this._ctxData = this.data), this._ctx;
|
|
736
|
+
}
|
|
737
|
+
sparkline(e, t, s) {
|
|
738
|
+
const i = t.map((d, f) => {
|
|
739
|
+
const u = (d.teamIds || []).indexOf(e);
|
|
740
|
+
if (u === -1) return null;
|
|
741
|
+
const k = t.length === 1 ? 96 / 2 : f / (t.length - 1) * 90 + 3, E = 3 + u / 24 * 20;
|
|
742
|
+
return { x: k, y: E };
|
|
743
|
+
}), m = [];
|
|
744
|
+
let h = [];
|
|
745
|
+
if (i.forEach((d) => {
|
|
746
|
+
d ? h.push(d) : h.length && (m.push(h), h = []);
|
|
747
|
+
}), h.length && m.push(h), !m.length) return p;
|
|
748
|
+
const c = i[s];
|
|
749
|
+
return l`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
750
|
+
${m.map((d) => W`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
751
|
+
points=${d.map((f) => `${f.x.toFixed(1)},${f.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
752
|
+
${c ? W`<circle cx=${c.x.toFixed(1)} cy=${c.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : p}
|
|
753
|
+
</svg>`;
|
|
754
|
+
}
|
|
755
|
+
movement(e, t, s) {
|
|
756
|
+
const o = me(e, t, s);
|
|
757
|
+
return o.kind === "up" ? l`<span class="delta up">▲ ${o.delta}</span>` : o.kind === "down" ? l`<span class="delta down">▼ ${o.delta}</span>` : o.kind === "new" ? l`<span class="delta new">NEW</span>` : o.kind === "same" ? l`<span class="delta same">—</span>` : l`<span class="delta same">·</span>`;
|
|
758
|
+
}
|
|
759
|
+
renderView() {
|
|
760
|
+
const e = this.ctx, t = this.data.polls;
|
|
761
|
+
if (!t.length) return l`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
762
|
+
const s = Math.max(0, t.findIndex((d) => d.effectiveDate === this.pollDate)), o = t[s] || t[0], r = t[s + 1] || null, n = t.slice().reverse(), i = n.indexOf(o), m = g(this.data.conferences), h = (o.teamIds || [])[0], c = h ? T(e, h) : null;
|
|
763
|
+
return l`
|
|
764
|
+
<div class="band">
|
|
765
|
+
<div class="inner">
|
|
766
|
+
<h1>${_(this.sport)} Top 25</h1>
|
|
767
|
+
<p class="sub">The HighSchoolOT poll · updated weekly · ${t.length} polls this season</p>
|
|
768
|
+
</div>
|
|
769
|
+
</div>
|
|
770
|
+
<div class="view">
|
|
771
|
+
<div class="toolbar">
|
|
772
|
+
<label class="asof" for="pollsel">Poll of</label>
|
|
773
|
+
<select id="pollsel" @change=${(d) => {
|
|
774
|
+
this.pollDate = d.target.value;
|
|
775
|
+
}}>
|
|
776
|
+
${t.map((d, f) => l`<option value=${d.effectiveDate} ?selected=${d === o}>
|
|
777
|
+
${$(d.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${f === 0 ? " · current" : ""}
|
|
778
|
+
</option>`)}
|
|
779
|
+
</select>
|
|
780
|
+
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
781
|
+
@click=${() => {
|
|
782
|
+
this.pollDate = t[s + 1].effectiveDate;
|
|
783
|
+
}}>← Older</button>
|
|
784
|
+
<button class="chip" ?disabled=${s <= 0}
|
|
785
|
+
@click=${() => {
|
|
786
|
+
this.pollDate = t[s - 1].effectiveDate;
|
|
787
|
+
}}>Newer →</button>
|
|
788
|
+
<span class="spacer"></span>
|
|
789
|
+
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
790
|
+
</div>
|
|
791
|
+
${c ? this.renderHero(e, o, r, h, c, m) : p}
|
|
792
|
+
<div class="card"><div class="tablewrap"><table class="data">
|
|
793
|
+
<thead><tr>
|
|
794
|
+
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
795
|
+
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
796
|
+
</tr></thead>
|
|
797
|
+
<tbody>
|
|
798
|
+
${(o.teamIds || []).map((d, f) => f === 0 || !d ? p : this.renderRow(e, o, r, n, i, m, d, f + 1))}
|
|
799
|
+
</tbody>
|
|
800
|
+
</table></div></div>
|
|
801
|
+
<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>
|
|
802
|
+
</div>
|
|
803
|
+
`;
|
|
804
|
+
}
|
|
805
|
+
renderHero(e, t, s, o, r, n) {
|
|
806
|
+
const i = e.records[o], m = Y(e.records, o), h = n[e.teamsById[o]?.conferenceId], c = `linear-gradient(120deg, ${r.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
807
|
+
return l`
|
|
808
|
+
<div class="hero1" style="background:${c}">
|
|
809
|
+
<div class="bigrank">#1</div>
|
|
810
|
+
${I(r, 64)}
|
|
811
|
+
<div>
|
|
812
|
+
<h2><a href=${v(e.hrefs.school, { id: r.id })}>${r.name} ${r.mascot || ""}</a></h2>
|
|
813
|
+
<div class="facts">
|
|
814
|
+
${w(i)} overall${h ? l` · ${w(i, !0)} ${h.name}` : p}
|
|
815
|
+
· streak ${z(i?.results) || "·"}
|
|
816
|
+
${m ? l` · last: ${m.mark} ${m.my}-${m.their} vs ${B(e, m.opp)}` : p}
|
|
817
|
+
${this.movement(t, s, o)}
|
|
818
|
+
</div>
|
|
819
|
+
</div>
|
|
820
|
+
</div>
|
|
821
|
+
`;
|
|
822
|
+
}
|
|
823
|
+
renderRow(e, t, s, o, r, n, i, m) {
|
|
824
|
+
const h = T(e, i);
|
|
825
|
+
if (!h) return p;
|
|
826
|
+
const c = e.records[i], d = Y(e.records, i), f = H(this.data.games, i), u = n[e.teamsById[i]?.conferenceId], k = () => {
|
|
827
|
+
location.href = v(e.hrefs.school, { id: h.id });
|
|
828
|
+
};
|
|
829
|
+
return l`
|
|
830
|
+
<tr class="rowlink" @click=${(E) => {
|
|
831
|
+
E.target.closest("a") || k();
|
|
832
|
+
}}>
|
|
833
|
+
<td class="num" style="font-weight:700">${m}</td>
|
|
834
|
+
<td>${this.movement(t, s, i)}</td>
|
|
835
|
+
<td class="teamcell">${I(h)}<a href=${v(e.hrefs.school, { id: h.id })}>${h.name}</a>
|
|
836
|
+
<span class="mut" style="font-size:0.78rem">${h.mascot || ""}</span></td>
|
|
837
|
+
<td class="num">${w(c)}</td>
|
|
838
|
+
<td class="mut">${u?.name || "Independent"}</td>
|
|
839
|
+
<td>${d ? l`<a class="box" style="text-decoration:none" href=${v(e.hrefs.game, { sport: this.sport, id: d.gameId })}>
|
|
840
|
+
<b style="color:${d.mark === "W" ? "var(--hsot-win)" : d.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${d.mark}</b>
|
|
841
|
+
${d.my}-${d.their} vs ${B(e, d.opp)}</a>` : l`<span class="mut">·</span>`}</td>
|
|
842
|
+
<td>${X(e, f, i)}</td>
|
|
843
|
+
<td>${this.sparkline(i, o, r)}</td>
|
|
844
|
+
</tr>
|
|
845
|
+
`;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", ge);
|
|
849
|
+
const ve = b`
|
|
850
|
+
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
851
|
+
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
852
|
+
.schoolhero .crest {
|
|
853
|
+
width: 84px; height: 84px; border-radius: 50%; flex: none;
|
|
854
|
+
display: flex; align-items: center; justify-content: center;
|
|
855
|
+
font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.5rem;
|
|
856
|
+
border: 3px solid rgba(255,255,255,0.6);
|
|
857
|
+
}
|
|
858
|
+
.schoolhero h1 { margin: 0; font-family: var(--hsot-heading-font); font-size: 2.6rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
|
|
859
|
+
.schoolhero .mascot { font-size: 1.05rem; opacity: 0.85; font-family: var(--hsot-heading-font); text-transform: uppercase; letter-spacing: 0.06em; }
|
|
860
|
+
.schoolhero .facts { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin-top: 0.55rem; font-size: 0.85rem; opacity: 0.95; }
|
|
861
|
+
.schoolhero .facts b { font-weight: 500; opacity: 0.75; margin-right: 0.3rem; font-family: var(--hsot-heading-font); text-transform: uppercase; font-size: 0.72rem; }
|
|
862
|
+
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
|
|
863
|
+
.tile { background: var(--hsot-white); border: 1px solid var(--hsot-gray-2); border-radius: var(--hsot-radius-md); padding: 0.75rem 0.9rem; }
|
|
864
|
+
.tile .k { font-family: var(--hsot-heading-font); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em; font-weight: 700; color: var(--hsot-red-deep); }
|
|
865
|
+
.tile .v { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.7rem; line-height: 1.15; color: var(--hsot-black); }
|
|
866
|
+
.tile .s { font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
867
|
+
.cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.25rem; }
|
|
868
|
+
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .schoolhero h1 { font-size: 1.9rem; } }
|
|
869
|
+
`;
|
|
870
|
+
class $e extends y {
|
|
871
|
+
static styles = [...S, ve];
|
|
872
|
+
static properties = {
|
|
873
|
+
...y.properties,
|
|
874
|
+
schoolId: { type: String, attribute: "school-id" },
|
|
875
|
+
sport: { type: String },
|
|
876
|
+
season: { type: String },
|
|
877
|
+
activeTeamId: { state: !0 }
|
|
878
|
+
};
|
|
879
|
+
constructor() {
|
|
880
|
+
super(), this.schoolId = "", this.sport = "", this.season = "", this.activeTeamId = "";
|
|
881
|
+
}
|
|
882
|
+
connectedCallback() {
|
|
883
|
+
super.connectedCallback();
|
|
884
|
+
const e = new URLSearchParams(globalThis.location?.search || "").get("sport");
|
|
885
|
+
e && !this.sport && (this.sport = e);
|
|
886
|
+
}
|
|
887
|
+
async fetchData(e) {
|
|
888
|
+
const t = this.season || A(), s = await e.getSchool(this.schoolId), r = (await e.listTeams({ schoolId: this.schoolId })).items, n = r.find((k) => k.sport === (this.sport || "football")) || r[0] || null, [i, m, h, c, d, f, u] = await Promise.all([
|
|
889
|
+
n ? e.listGames({ sport: n.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
890
|
+
n ? e.listTeams({ sport: n.sport }) : Promise.resolve({ items: [] }),
|
|
891
|
+
e.listSchools(),
|
|
892
|
+
e.listConferences(),
|
|
893
|
+
n ? e.listRankings({ sport: n.sport }) : Promise.resolve({ items: [] }),
|
|
894
|
+
n ? e.listRosters({ teamId: n.id }) : Promise.resolve({ items: [] }),
|
|
895
|
+
n ? e.listPlayers() : Promise.resolve({ items: [] })
|
|
896
|
+
]);
|
|
897
|
+
return {
|
|
898
|
+
season: t,
|
|
899
|
+
school: s,
|
|
900
|
+
teams: r,
|
|
901
|
+
active: n,
|
|
902
|
+
games: i.items,
|
|
903
|
+
allTeams: m.items,
|
|
904
|
+
schools: h.items,
|
|
905
|
+
conferences: c.items,
|
|
906
|
+
rankings: d.items,
|
|
907
|
+
roster: f.items.find((k) => k.season === t) || null,
|
|
908
|
+
players: u.items
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
get ctx() {
|
|
912
|
+
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
913
|
+
teamsById: g(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
914
|
+
schoolsById: g(this.data.schools),
|
|
915
|
+
records: C(this.data.games),
|
|
916
|
+
rankings: this.data.rankings,
|
|
917
|
+
hrefs: D(this),
|
|
918
|
+
sport: this.data.active?.sport || "football"
|
|
919
|
+
}, this._ctxData = this.data), this._ctx;
|
|
920
|
+
}
|
|
921
|
+
switchSport(e) {
|
|
922
|
+
this.sport = e, this.load();
|
|
923
|
+
}
|
|
924
|
+
renderView() {
|
|
925
|
+
const { school: e, teams: t, active: s, season: o } = this.data;
|
|
926
|
+
if (!e) return l`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
927
|
+
const r = this.ctx, n = F(e.colorPrimary || "#030711"), i = (e.adm || [])[0], m = g(this.data.conferences), h = s ? m[s.conferenceId] : null;
|
|
928
|
+
return l`
|
|
929
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${n}">
|
|
930
|
+
<div class="inner">
|
|
931
|
+
<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${F(e.colorSecondary || "#7C7C7C")}">${M(e)}</div>
|
|
932
|
+
<div style="min-width:260px">
|
|
933
|
+
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
934
|
+
<div class="facts">
|
|
935
|
+
${e.location ? l`<span><b>Location</b>${e.location}${e.county ? l` · ${e.county} County` : p}</span>` : p}
|
|
936
|
+
${e.association ? l`<span><b>League</b>${e.association}${e.classification ? l` · ${e.classification}` : p}</span>` : p}
|
|
937
|
+
${h ? l`<span><b>Conference</b>${h.name}</span>` : p}
|
|
938
|
+
${i ? l`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : p}
|
|
939
|
+
${e.openingYear ? l`<span><b>Opened</b>${e.openingYear}</span>` : p}
|
|
940
|
+
${e.areaCode ? l`<span><b>Area</b>${e.areaCode}</span>` : p}
|
|
941
|
+
${e.tagSlug ? l`<span><b>Tag</b>#${e.tagSlug}</span>` : p}
|
|
942
|
+
</div>
|
|
943
|
+
</div>
|
|
944
|
+
</div>
|
|
945
|
+
</div>
|
|
946
|
+
<div class="band">
|
|
947
|
+
<nav class="tabs" aria-label="Teams">
|
|
948
|
+
${t.map((c) => c.id === s?.id ? l`<a class="on" href="#" @click=${(d) => d.preventDefault()}>${c.name}</a>` : l`<a href="#" @click=${(d) => {
|
|
949
|
+
d.preventDefault(), this.switchSport(c.sport);
|
|
950
|
+
}}>${c.name}</a>`)}
|
|
951
|
+
</nav>
|
|
952
|
+
</div>
|
|
953
|
+
<div class="view">
|
|
954
|
+
${s ? this.renderTeam(r, s, h, o) : l`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
955
|
+
</div>
|
|
956
|
+
`;
|
|
957
|
+
}
|
|
958
|
+
renderTeam(e, t, s, o) {
|
|
959
|
+
const r = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = r.w + r.l + r.t, i = s ? this.data.allTeams.filter((d) => d.conferenceId === s.id) : [], m = s ? K(i, e.records).findIndex((d) => d.team.id === t.id) + 1 : 0, h = Q(e.rankings, e.teamsById, t.id, t.sport, null), c = this.data.games.filter((d) => d.homeTeamId === t.id || d.awayTeamId === t.id).sort((d, f) => String(d.date).localeCompare(String(f.date)));
|
|
960
|
+
return l`
|
|
961
|
+
<div class="tiles">
|
|
962
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${w(r)}</div><div class="s">${n} games played</div></div>
|
|
963
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${w(r, !0)}</div>
|
|
964
|
+
<div class="s">${m ? `${de(m)} of ${i.length}` : "·"}</div></div>
|
|
965
|
+
<div class="tile"><div class="k">Points</div><div class="v">${n ? (r.pf / n).toFixed(1) : "0.0"}</div>
|
|
966
|
+
<div class="s">scored per game · ${n ? (r.pa / n).toFixed(1) : "0.0"} allowed</div></div>
|
|
967
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${z(r.results) || "·"}</div>
|
|
968
|
+
<div class="s">last 5: ${j(e, t.id)}</div></div>
|
|
969
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${h ? `#${h}` : "NR"}</div>
|
|
970
|
+
<div class="s"><a href=${v(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
971
|
+
</div>
|
|
972
|
+
${(t.championships || []).length ? l`
|
|
973
|
+
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
974
|
+
${t.championships.map((d) => l`<span class="pill champ">★ ${d.season} ${d.title} champion${d.classification ? ` · ${d.classification}` : ""}${d.region ? ` · ${d.region}` : ""}</span>`)}
|
|
975
|
+
</div>` : p}
|
|
976
|
+
<div class="cols">
|
|
977
|
+
<div>
|
|
978
|
+
<div class="section-title">Schedule & results</div>
|
|
979
|
+
<div class="card">
|
|
980
|
+
${c.length ? l`<ul class="gamelist">${c.map((d) => this.renderGameRow(e, t, d))}</ul>` : l`<p class="empty">No ${t.sport} games recorded for ${o}.</p>`}
|
|
981
|
+
</div>
|
|
982
|
+
</div>
|
|
983
|
+
<div>
|
|
984
|
+
<div class="section-title">Roster · ${o}</div>
|
|
985
|
+
<div class="card">${this.renderRoster(o)}</div>
|
|
986
|
+
</div>
|
|
987
|
+
</div>
|
|
988
|
+
`;
|
|
989
|
+
}
|
|
990
|
+
renderGameRow(e, t, s) {
|
|
991
|
+
const o = s.homeTeamId === t.id, r = o ? s.awayTeamId : s.homeTeamId, n = o ? s.homeScore : s.awayScore, i = o ? s.awayScore : s.homeScore;
|
|
992
|
+
let m = l`<span class="mut">${R(s.time)}</span>`;
|
|
993
|
+
if (s.state === "final") {
|
|
994
|
+
const c = G(s), d = c === "tie" ? "T" : c === (o ? "home" : "away") ? "W" : "L";
|
|
995
|
+
m = l`<span class=${d}>${d}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : p}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : p}`;
|
|
996
|
+
} else s.state === "live" && (m = l`<span style="color:var(--hsot-red)">${n}-${i}</span>`);
|
|
997
|
+
const h = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
998
|
+
return l`
|
|
999
|
+
<li>
|
|
1000
|
+
<span class="d">${$(s.date)}</span>
|
|
1001
|
+
${P(s)}
|
|
1002
|
+
<span class="res">${m}</span>
|
|
1003
|
+
<span class="opp">${o ? "vs" : "at"} ${O(e, r, s.date)}
|
|
1004
|
+
<span class="pill type">${h}</span>
|
|
1005
|
+
${s.broadcast ? l`<span class="pill class">${s.broadcast}</span>` : p}
|
|
1006
|
+
</span>
|
|
1007
|
+
<span class="where">${s.venue || ""}</span>
|
|
1008
|
+
<a class="box" href=${v(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1009
|
+
</li>
|
|
1010
|
+
`;
|
|
1011
|
+
}
|
|
1012
|
+
renderRoster(e) {
|
|
1013
|
+
const t = this.data.roster;
|
|
1014
|
+
if (!t)
|
|
1015
|
+
return l`<p class="empty">Roster not published for ${e}.</p>`;
|
|
1016
|
+
const s = g(this.data.players), o = t.entries.slice().sort((r, n) => (r.number || 0) - (n.number || 0));
|
|
1017
|
+
return l`
|
|
1018
|
+
<div class="tablewrap"><table class="data">
|
|
1019
|
+
<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></tr></thead>
|
|
1020
|
+
<tbody>
|
|
1021
|
+
${o.map((r) => {
|
|
1022
|
+
const n = s[r.playerId];
|
|
1023
|
+
return n ? l`<tr>
|
|
1024
|
+
<td class="num mut">${r.number ?? "·"}</td>
|
|
1025
|
+
<td style="font-weight:500">${n.firstName} ${n.lastName}</td>
|
|
1026
|
+
<td>${r.position || "·"}</td>
|
|
1027
|
+
<td class="mut">${n.classOf || "·"}</td>
|
|
1028
|
+
<td class="num">${ce(n.heightIn)}</td>
|
|
1029
|
+
<td class="num">${n.weightLb || "·"}</td>
|
|
1030
|
+
</tr>` : p;
|
|
1031
|
+
})}
|
|
1032
|
+
</tbody>
|
|
1033
|
+
</table></div>
|
|
1034
|
+
`;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", $e);
|
|
1038
|
+
const ye = b`
|
|
1039
|
+
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1040
|
+
.breadcrumbs a { text-decoration: none; }
|
|
1041
|
+
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
1042
|
+
.scorehead .teamblock { display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
|
|
1043
|
+
.scorehead .teamblock.right { flex-direction: row-reverse; text-align: right; }
|
|
1044
|
+
.scorehead .crest {
|
|
1045
|
+
width: 58px; height: 58px; border-radius: 50%; flex: none;
|
|
1046
|
+
display: flex; align-items: center; justify-content: center;
|
|
1047
|
+
font-family: var(--hsot-heading-font); font-weight: 700; color: var(--hsot-white);
|
|
1048
|
+
}
|
|
1049
|
+
.scorehead .tname { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 1.15rem; line-height: 1.15; }
|
|
1050
|
+
.scorehead .tname a { color: inherit; text-decoration: none; }
|
|
1051
|
+
.scorehead .trec { font-size: 0.8rem; color: var(--hsot-gray-5); }
|
|
1052
|
+
.scorehead .mid { text-align: center; }
|
|
1053
|
+
.scorehead .bigscore { font-family: var(--hsot-heading-font); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--hsot-black); white-space: nowrap; }
|
|
1054
|
+
.scorehead .status { margin-top: 0.3rem; font-size: 0.8rem; color: var(--hsot-gray-5); }
|
|
1055
|
+
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1056
|
+
.ctxcard { padding: 0.85rem 1rem; }
|
|
1057
|
+
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
1058
|
+
.ctxcard .row { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: 0.85rem; }
|
|
1059
|
+
@media (max-width: 640px) {
|
|
1060
|
+
.scorehead { grid-template-columns: 1fr; text-align: center; }
|
|
1061
|
+
.scorehead .teamblock, .scorehead .teamblock.right { flex-direction: column; text-align: center; }
|
|
1062
|
+
.cols { grid-template-columns: 1fr; }
|
|
1063
|
+
}
|
|
1064
|
+
`;
|
|
1065
|
+
class be extends y {
|
|
1066
|
+
static styles = [...S, ye];
|
|
1067
|
+
static properties = {
|
|
1068
|
+
...y.properties,
|
|
1069
|
+
gameId: { type: String, attribute: "game-id" }
|
|
1070
|
+
};
|
|
1071
|
+
constructor() {
|
|
1072
|
+
super(), this.gameId = "";
|
|
1073
|
+
}
|
|
1074
|
+
async fetchData(e) {
|
|
1075
|
+
const t = await e.getGame(this.gameId), [s, o, r, n, i] = await Promise.all([
|
|
1076
|
+
e.listSchools(),
|
|
1077
|
+
e.listTeams({ sport: t.sport }),
|
|
1078
|
+
e.listConferences(),
|
|
1079
|
+
e.listRankings({ sport: t.sport }),
|
|
1080
|
+
e.listGames({ sport: t.sport, season: t.season })
|
|
1081
|
+
]);
|
|
1082
|
+
return {
|
|
1083
|
+
game: t,
|
|
1084
|
+
schools: s.items,
|
|
1085
|
+
teams: o.items,
|
|
1086
|
+
conferences: r.items,
|
|
1087
|
+
rankings: n.items,
|
|
1088
|
+
games: i.items
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
get ctx() {
|
|
1092
|
+
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1093
|
+
teamsById: g(this.data.teams),
|
|
1094
|
+
schoolsById: g(this.data.schools),
|
|
1095
|
+
records: C(this.data.games),
|
|
1096
|
+
rankings: this.data.rankings,
|
|
1097
|
+
hrefs: D(this),
|
|
1098
|
+
sport: this.data.game.sport
|
|
1099
|
+
}, this._ctxData = this.data), this._ctx;
|
|
1100
|
+
}
|
|
1101
|
+
renderView() {
|
|
1102
|
+
const e = this.data.game;
|
|
1103
|
+
if (!e) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
1104
|
+
const t = this.ctx, s = g(this.data.conferences), o = t.teamsById[e.awayTeamId] ? t.schoolsById[t.teamsById[e.awayTeamId].schoolId] : null, r = t.teamsById[e.homeTeamId] ? t.schoolsById[t.teamsById[e.homeTeamId].schoolId] : null, n = G(e), i = (c) => e.state === "final" && n !== c && n !== "tie" ? "opacity:0.45" : "", m = e.conferenceId ? s[e.conferenceId] : null, h = 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));
|
|
1105
|
+
return l`
|
|
1106
|
+
<div class="view">
|
|
1107
|
+
<p class="breadcrumbs">
|
|
1108
|
+
<a href=${v(t.hrefs.section, { sport: e.sport, view: "scores" })}>${_(e.sport)}</a> /
|
|
1109
|
+
<a href=${v(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
1110
|
+
${x(t, e.awayTeamId)} at ${x(t, e.homeTeamId)}
|
|
1111
|
+
</p>
|
|
1112
|
+
<div class="card">
|
|
1113
|
+
<div class="scorehead">
|
|
1114
|
+
${this.teamBlock(t, e, e.awayTeamId, o, !1)}
|
|
1115
|
+
<div class="mid">
|
|
1116
|
+
<div class="bigscore">
|
|
1117
|
+
<span style=${i("away")}>${e.awayScore}</span>
|
|
1118
|
+
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1119
|
+
<span style=${i("home")}>${e.homeScore}</span>
|
|
1120
|
+
</div>
|
|
1121
|
+
<div class="status">${P(e)}</div>
|
|
1122
|
+
<div class="status">${$(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${R(e.time)}` : p} · ${e.venue || "Venue TBD"}
|
|
1123
|
+
${e.broadcast ? l` · <span class="pill class">${e.broadcast}</span>` : p}</div>
|
|
1124
|
+
<div class="status">
|
|
1125
|
+
<span class="pill type">${e.gameType === "conference" ? `${m?.name || "Conference"} game` : e.gameType}</span>
|
|
1126
|
+
${e.label ? l`<span class="pill type">Bracket ${e.label}</span>` : p}
|
|
1127
|
+
${(e.tags || []).map((c) => l`<span class="pill type">${c}</span>`)}
|
|
1128
|
+
</div>
|
|
1129
|
+
</div>
|
|
1130
|
+
${this.teamBlock(t, e, e.homeTeamId, r, !0)}
|
|
1131
|
+
</div>
|
|
1132
|
+
${this.renderLineScore(e, o, r)}
|
|
1133
|
+
${e.notes ? l`<p class="note" style="padding:0 1rem 0.9rem;text-align:center">${e.notes}</p>` : p}
|
|
1134
|
+
</div>
|
|
1135
|
+
${e.storyAssetId || e.videoAssetId ? l`
|
|
1136
|
+
<div class="section-title">Coverage</div>
|
|
1137
|
+
<div class="card" style="padding:0.8rem 1rem;display:flex;gap:0.5rem;flex-wrap:wrap;align-items:center">
|
|
1138
|
+
${e.storyAssetId ? l`<span class="pill class" title="Game.storyAssetId">Game story · ${e.storyAssetId}</span>` : p}
|
|
1139
|
+
${e.videoAssetId ? l`<span class="pill class" title="Game.videoAssetId">Highlights · ${e.videoAssetId}</span>` : p}
|
|
1140
|
+
<span class="asof">Story and video ride the Game resource as Studio asset references.</span>
|
|
1141
|
+
</div>` : p}
|
|
1142
|
+
<div class="section-title">Season context</div>
|
|
1143
|
+
<div class="cols">
|
|
1144
|
+
${[[e.awayTeamId, o], [e.homeTeamId, r]].map(([c, d]) => this.renderContext(t, c, d))}
|
|
1145
|
+
</div>
|
|
1146
|
+
${h.length ? l`
|
|
1147
|
+
<div class="section-title">Head to head this season</div>
|
|
1148
|
+
<div class="card"><ul class="gamelist">
|
|
1149
|
+
${h.map((c) => l`<li>
|
|
1150
|
+
<span class="d">${$(c.date)}</span>${P(c)}
|
|
1151
|
+
<span class="opp">${x(t, c.awayTeamId)} ${c.awayScore}, ${x(t, c.homeTeamId)} ${c.homeScore}</span>
|
|
1152
|
+
<a class="box" href=${v(t.hrefs.game, { sport: e.sport, id: c.id })}>Box score →</a>
|
|
1153
|
+
</li>`)}
|
|
1154
|
+
</ul></div>` : p}
|
|
1155
|
+
</div>
|
|
1156
|
+
`;
|
|
1157
|
+
}
|
|
1158
|
+
teamBlock(e, t, s, o, r) {
|
|
1159
|
+
if (!o) return l`<div class="teamblock ${r ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
1160
|
+
const n = e.teamsById[s], i = e.records[s];
|
|
1161
|
+
return l`
|
|
1162
|
+
<div class="teamblock ${r ? "right" : ""}">
|
|
1163
|
+
<span class="crest" style="background:${o.colorPrimary || "#030711"};color:${F(o.colorPrimary || "#030711")}">${M(o)}</span>
|
|
1164
|
+
<div>
|
|
1165
|
+
<div class="tname">${U(e, s, t.date)}<a href=${v(e.hrefs.school, { id: o.id })}>${o.name}</a></div>
|
|
1166
|
+
<div class="trec">${o.mascot || ""} · ${w(i)}${n?.conferenceId ? l` · ${w(i, !0)} conf` : p}</div>
|
|
1167
|
+
</div>
|
|
1168
|
+
</div>
|
|
1169
|
+
`;
|
|
1170
|
+
}
|
|
1171
|
+
renderLineScore(e, t, s) {
|
|
1172
|
+
const o = e.periodScores || [];
|
|
1173
|
+
if (!o.length)
|
|
1174
|
+
return l`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>`;
|
|
1175
|
+
const r = Math.max(4, ...o.map((h) => h.period)), n = (h) => h <= 4 ? String(h) : `OT${h > 5 ? h - 4 : ""}`, i = (h, c) => {
|
|
1176
|
+
const d = o.find((f) => f.period === c);
|
|
1177
|
+
return d ? d[h] : e.state === "final" ? 0 : "·";
|
|
1178
|
+
}, m = (h, c, d) => l`
|
|
1179
|
+
<tr>
|
|
1180
|
+
<td class="teamcell">${I(h, 20)}${h?.abbr || "TBD"}</td>
|
|
1181
|
+
${Array.from({ length: r }, (f, u) => l`<td class="num">${i(c, u + 1)}</td>`)}
|
|
1182
|
+
<td class="num" style="font-weight:700">${d}</td>
|
|
1183
|
+
</tr>`;
|
|
1184
|
+
return l`
|
|
1185
|
+
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
1186
|
+
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
1187
|
+
<thead><tr><th>Team</th>${Array.from({ length: r }, (h, c) => l`<th class="num">${n(c + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
1188
|
+
<tbody>
|
|
1189
|
+
${m(t, "away", e.awayScore)}
|
|
1190
|
+
${m(s, "home", e.homeScore)}
|
|
1191
|
+
</tbody>
|
|
1192
|
+
</table>
|
|
1193
|
+
</div>
|
|
1194
|
+
`;
|
|
1195
|
+
}
|
|
1196
|
+
renderContext(e, t, s) {
|
|
1197
|
+
if (!s) return p;
|
|
1198
|
+
const o = e.records[t], r = H(this.data.games, t);
|
|
1199
|
+
return l`
|
|
1200
|
+
<div class="card ctxcard">
|
|
1201
|
+
<div class="who">${I(s)}${s.name}</div>
|
|
1202
|
+
<div class="row">
|
|
1203
|
+
<span>Last 5: ${j(e, t)}</span>
|
|
1204
|
+
<span>Streak: <b>${o ? z(o.results) : "·"}</b></span>
|
|
1205
|
+
<span>PF/PA: <b>${o ? `${o.pf} / ${o.pa}` : "·"}</b></span>
|
|
1206
|
+
<span>Next: ${r ? l`${$(r.date, { month: "numeric", day: "numeric" })}
|
|
1207
|
+
${r.homeTeamId === t ? "vs" : "at"} ${B(e, r.homeTeamId === t ? r.awayTeamId : r.homeTeamId)}` : "·"}</span>
|
|
1208
|
+
</div>
|
|
1209
|
+
</div>
|
|
1210
|
+
`;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", be);
|
|
1214
|
+
export {
|
|
1215
|
+
L as D,
|
|
1216
|
+
be as H,
|
|
1217
|
+
ge as a,
|
|
1218
|
+
$e as b,
|
|
1219
|
+
pe as c,
|
|
1220
|
+
fe as d,
|
|
1221
|
+
C as e,
|
|
1222
|
+
te as f,
|
|
1223
|
+
v as g,
|
|
1224
|
+
G as h,
|
|
1225
|
+
ke as i,
|
|
1226
|
+
z as j,
|
|
1227
|
+
me as p,
|
|
1228
|
+
w as r,
|
|
1229
|
+
K as s,
|
|
1230
|
+
Q as t
|
|
1231
|
+
};
|