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