@wral/hsot-data 0.2.0 → 0.4.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 +43 -4
- package/dist/client.mjs +49 -0
- package/dist/define.mjs +1 -1
- package/dist/define.standalone.js +1273 -1196
- package/dist/{hsot-brackets-D5cwGage.js → hsot-brackets-Bqk0gI3J.js} +679 -648
- package/dist/index.mjs +16 -15
- package/package.json +2 -1
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
constructor(
|
|
4
|
-
if (this._$cssResult$ = !0, s !==
|
|
5
|
-
this.cssText =
|
|
1
|
+
const J = globalThis, pe = J.ShadowRoot && (J.ShadyCSS === void 0 || J.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, me = /* @__PURE__ */ Symbol(), _e = /* @__PURE__ */ new WeakMap();
|
|
2
|
+
let je = class {
|
|
3
|
+
constructor(e, t, s) {
|
|
4
|
+
if (this._$cssResult$ = !0, s !== me) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
5
|
+
this.cssText = e, this.t = t;
|
|
6
6
|
}
|
|
7
7
|
get styleSheet() {
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
const s =
|
|
12
|
-
s && (
|
|
8
|
+
let e = this.o;
|
|
9
|
+
const t = this.t;
|
|
10
|
+
if (pe && e === void 0) {
|
|
11
|
+
const s = t !== void 0 && t.length === 1;
|
|
12
|
+
s && (e = _e.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), s && _e.set(t, e));
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return e;
|
|
15
15
|
}
|
|
16
16
|
toString() {
|
|
17
17
|
return this.cssText;
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const $t = (r) => new je(typeof r == "string" ? r : r + "", void 0, me), w = (r, ...e) => {
|
|
21
|
+
const t = r.length === 1 ? r[0] : e.reduce((s, a, o) => s + ((n) => {
|
|
22
22
|
if (n._$cssResult$ === !0) return n.cssText;
|
|
23
23
|
if (typeof n == "number") return n;
|
|
24
24
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
25
|
-
})(
|
|
26
|
-
return new
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
else for (const
|
|
30
|
-
const s = document.createElement("style"),
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
let
|
|
35
|
-
for (const s of
|
|
36
|
-
return
|
|
37
|
-
})(
|
|
38
|
-
const { is:
|
|
39
|
-
switch (
|
|
25
|
+
})(a) + r[o + 1], r[0]);
|
|
26
|
+
return new je(t, r, me);
|
|
27
|
+
}, bt = (r, e) => {
|
|
28
|
+
if (pe) r.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
|
29
|
+
else for (const t of e) {
|
|
30
|
+
const s = document.createElement("style"), a = J.litNonce;
|
|
31
|
+
a !== void 0 && s.setAttribute("nonce", a), s.textContent = t.cssText, r.appendChild(s);
|
|
32
|
+
}
|
|
33
|
+
}, Te = pe ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((e) => {
|
|
34
|
+
let t = "";
|
|
35
|
+
for (const s of e.cssRules) t += s.cssText;
|
|
36
|
+
return $t(t);
|
|
37
|
+
})(r) : r;
|
|
38
|
+
const { is: yt, defineProperty: wt, getOwnPropertyDescriptor: xt, getOwnPropertyNames: kt, getOwnPropertySymbols: St, getPrototypeOf: _t } = Object, ae = globalThis, Ae = ae.trustedTypes, Tt = Ae ? Ae.emptyScript : "", At = ae.reactiveElementPolyfillSupport, G = (r, e) => r, de = { toAttribute(r, e) {
|
|
39
|
+
switch (e) {
|
|
40
40
|
case Boolean:
|
|
41
|
-
|
|
41
|
+
r = r ? Tt : null;
|
|
42
42
|
break;
|
|
43
43
|
case Object:
|
|
44
44
|
case Array:
|
|
45
|
-
|
|
45
|
+
r = r == null ? r : JSON.stringify(r);
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
}, fromAttribute(
|
|
49
|
-
let
|
|
50
|
-
switch (
|
|
47
|
+
return r;
|
|
48
|
+
}, fromAttribute(r, e) {
|
|
49
|
+
let t = r;
|
|
50
|
+
switch (e) {
|
|
51
51
|
case Boolean:
|
|
52
|
-
|
|
52
|
+
t = r !== null;
|
|
53
53
|
break;
|
|
54
54
|
case Number:
|
|
55
|
-
|
|
55
|
+
t = r === null ? null : Number(r);
|
|
56
56
|
break;
|
|
57
57
|
case Object:
|
|
58
58
|
case Array:
|
|
59
59
|
try {
|
|
60
|
-
|
|
60
|
+
t = JSON.parse(r);
|
|
61
61
|
} catch {
|
|
62
|
-
|
|
62
|
+
t = null;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
return
|
|
66
|
-
} },
|
|
67
|
-
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"),
|
|
65
|
+
return t;
|
|
66
|
+
} }, qe = (r, e) => !yt(r, e), Ie = { attribute: !0, type: String, converter: de, reflect: !1, useDefault: !1, hasChanged: qe };
|
|
67
|
+
Symbol.metadata ??= /* @__PURE__ */ Symbol("metadata"), ae.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
68
68
|
let z = class extends HTMLElement {
|
|
69
|
-
static addInitializer(
|
|
70
|
-
this._$Ei(), (this.l ??= []).push(
|
|
69
|
+
static addInitializer(e) {
|
|
70
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
71
71
|
}
|
|
72
72
|
static get observedAttributes() {
|
|
73
73
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
74
74
|
}
|
|
75
|
-
static createProperty(
|
|
76
|
-
if (
|
|
77
|
-
const s = /* @__PURE__ */ Symbol(),
|
|
78
|
-
|
|
75
|
+
static createProperty(e, t = Ie) {
|
|
76
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
77
|
+
const s = /* @__PURE__ */ Symbol(), a = this.getPropertyDescriptor(e, s, t);
|
|
78
|
+
a !== void 0 && wt(this.prototype, e, a);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
static getPropertyDescriptor(
|
|
82
|
-
const { get:
|
|
83
|
-
return this[
|
|
81
|
+
static getPropertyDescriptor(e, t, s) {
|
|
82
|
+
const { get: a, set: o } = xt(this.prototype, e) ?? { get() {
|
|
83
|
+
return this[t];
|
|
84
84
|
}, set(n) {
|
|
85
|
-
this[
|
|
85
|
+
this[t] = n;
|
|
86
86
|
} };
|
|
87
|
-
return { get:
|
|
88
|
-
const i =
|
|
89
|
-
o?.call(this, n), this.requestUpdate(
|
|
87
|
+
return { get: a, set(n) {
|
|
88
|
+
const i = a?.call(this);
|
|
89
|
+
o?.call(this, n), this.requestUpdate(e, i, s);
|
|
90
90
|
}, configurable: !0, enumerable: !0 };
|
|
91
91
|
}
|
|
92
|
-
static getPropertyOptions(
|
|
93
|
-
return this.elementProperties.get(
|
|
92
|
+
static getPropertyOptions(e) {
|
|
93
|
+
return this.elementProperties.get(e) ?? Ie;
|
|
94
94
|
}
|
|
95
95
|
static _$Ei() {
|
|
96
|
-
if (this.hasOwnProperty(
|
|
97
|
-
const
|
|
98
|
-
|
|
96
|
+
if (this.hasOwnProperty(G("elementProperties"))) return;
|
|
97
|
+
const e = _t(this);
|
|
98
|
+
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
99
99
|
}
|
|
100
100
|
static finalize() {
|
|
101
|
-
if (this.hasOwnProperty(
|
|
102
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
101
|
+
if (this.hasOwnProperty(G("finalized"))) return;
|
|
102
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(G("properties"))) {
|
|
103
|
+
const t = this.properties, s = [...kt(t), ...St(t)];
|
|
104
|
+
for (const a of s) this.createProperty(a, t[a]);
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
106
|
+
const e = this[Symbol.metadata];
|
|
107
|
+
if (e !== null) {
|
|
108
|
+
const t = litPropertyMetadata.get(e);
|
|
109
|
+
if (t !== void 0) for (const [s, a] of t) this.elementProperties.set(s, a);
|
|
110
110
|
}
|
|
111
111
|
this._$Eh = /* @__PURE__ */ new Map();
|
|
112
|
-
for (const [
|
|
113
|
-
const
|
|
114
|
-
|
|
112
|
+
for (const [t, s] of this.elementProperties) {
|
|
113
|
+
const a = this._$Eu(t, s);
|
|
114
|
+
a !== void 0 && this._$Eh.set(a, t);
|
|
115
115
|
}
|
|
116
116
|
this.elementStyles = this.finalizeStyles(this.styles);
|
|
117
117
|
}
|
|
118
|
-
static finalizeStyles(
|
|
119
|
-
const
|
|
120
|
-
if (Array.isArray(
|
|
121
|
-
const s = new Set(
|
|
122
|
-
for (const
|
|
123
|
-
} else
|
|
124
|
-
return
|
|
118
|
+
static finalizeStyles(e) {
|
|
119
|
+
const t = [];
|
|
120
|
+
if (Array.isArray(e)) {
|
|
121
|
+
const s = new Set(e.flat(1 / 0).reverse());
|
|
122
|
+
for (const a of s) t.unshift(Te(a));
|
|
123
|
+
} else e !== void 0 && t.push(Te(e));
|
|
124
|
+
return t;
|
|
125
125
|
}
|
|
126
|
-
static _$Eu(
|
|
127
|
-
const s =
|
|
128
|
-
return s === !1 ? void 0 : typeof s == "string" ? s : typeof
|
|
126
|
+
static _$Eu(e, t) {
|
|
127
|
+
const s = t.attribute;
|
|
128
|
+
return s === !1 ? void 0 : typeof s == "string" ? s : typeof e == "string" ? e.toLowerCase() : void 0;
|
|
129
129
|
}
|
|
130
130
|
constructor() {
|
|
131
131
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
132
132
|
}
|
|
133
133
|
_$Ev() {
|
|
134
|
-
this._$ES = new Promise((
|
|
134
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((e) => e(this));
|
|
135
135
|
}
|
|
136
|
-
addController(
|
|
137
|
-
(this._$EO ??= /* @__PURE__ */ new Set()).add(
|
|
136
|
+
addController(e) {
|
|
137
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
138
138
|
}
|
|
139
|
-
removeController(
|
|
140
|
-
this._$EO?.delete(
|
|
139
|
+
removeController(e) {
|
|
140
|
+
this._$EO?.delete(e);
|
|
141
141
|
}
|
|
142
142
|
_$E_() {
|
|
143
|
-
const
|
|
144
|
-
for (const s of
|
|
145
|
-
|
|
143
|
+
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
144
|
+
for (const s of t.keys()) this.hasOwnProperty(s) && (e.set(s, this[s]), delete this[s]);
|
|
145
|
+
e.size > 0 && (this._$Ep = e);
|
|
146
146
|
}
|
|
147
147
|
createRenderRoot() {
|
|
148
|
-
const
|
|
149
|
-
return
|
|
148
|
+
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
149
|
+
return bt(e, this.constructor.elementStyles), e;
|
|
150
150
|
}
|
|
151
151
|
connectedCallback() {
|
|
152
|
-
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((
|
|
152
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((e) => e.hostConnected?.());
|
|
153
153
|
}
|
|
154
|
-
enableUpdating(
|
|
154
|
+
enableUpdating(e) {
|
|
155
155
|
}
|
|
156
156
|
disconnectedCallback() {
|
|
157
|
-
this._$EO?.forEach((
|
|
157
|
+
this._$EO?.forEach((e) => e.hostDisconnected?.());
|
|
158
158
|
}
|
|
159
|
-
attributeChangedCallback(
|
|
160
|
-
this._$AK(
|
|
159
|
+
attributeChangedCallback(e, t, s) {
|
|
160
|
+
this._$AK(e, s);
|
|
161
161
|
}
|
|
162
|
-
_$ET(
|
|
163
|
-
const s = this.constructor.elementProperties.get(
|
|
164
|
-
if (
|
|
165
|
-
const o = (s.converter?.toAttribute !== void 0 ? s.converter :
|
|
166
|
-
this._$Em =
|
|
162
|
+
_$ET(e, t) {
|
|
163
|
+
const s = this.constructor.elementProperties.get(e), a = this.constructor._$Eu(e, s);
|
|
164
|
+
if (a !== void 0 && s.reflect === !0) {
|
|
165
|
+
const o = (s.converter?.toAttribute !== void 0 ? s.converter : de).toAttribute(t, s.type);
|
|
166
|
+
this._$Em = e, o == null ? this.removeAttribute(a) : this.setAttribute(a, o), this._$Em = null;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
_$AK(
|
|
170
|
-
const s = this.constructor,
|
|
171
|
-
if (
|
|
172
|
-
const o = s.getPropertyOptions(
|
|
173
|
-
this._$Em =
|
|
174
|
-
const i = n.fromAttribute(
|
|
175
|
-
this[
|
|
169
|
+
_$AK(e, t) {
|
|
170
|
+
const s = this.constructor, a = s._$Eh.get(e);
|
|
171
|
+
if (a !== void 0 && this._$Em !== a) {
|
|
172
|
+
const o = s.getPropertyOptions(a), n = typeof o.converter == "function" ? { fromAttribute: o.converter } : o.converter?.fromAttribute !== void 0 ? o.converter : de;
|
|
173
|
+
this._$Em = a;
|
|
174
|
+
const i = n.fromAttribute(t, o.type);
|
|
175
|
+
this[a] = i ?? this._$Ej?.get(a) ?? i, this._$Em = null;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
requestUpdate(
|
|
179
|
-
if (
|
|
178
|
+
requestUpdate(e, t, s, a = !1, o) {
|
|
179
|
+
if (e !== void 0) {
|
|
180
180
|
const n = this.constructor;
|
|
181
|
-
if (
|
|
182
|
-
this.C(
|
|
181
|
+
if (a === !1 && (o = this[e]), s ??= n.getPropertyOptions(e), !((s.hasChanged ?? qe)(o, t) || s.useDefault && s.reflect && o === this._$Ej?.get(e) && !this.hasAttribute(n._$Eu(e, s)))) return;
|
|
182
|
+
this.C(e, t, s);
|
|
183
183
|
}
|
|
184
184
|
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
185
185
|
}
|
|
186
|
-
C(
|
|
187
|
-
s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(
|
|
186
|
+
C(e, t, { useDefault: s, reflect: a, wrapped: o }, n) {
|
|
187
|
+
s && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? t ?? this[e]), o !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || s || (t = void 0), this._$AL.set(e, t)), a === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
188
188
|
}
|
|
189
189
|
async _$EP() {
|
|
190
190
|
this.isUpdatePending = !0;
|
|
191
191
|
try {
|
|
192
192
|
await this._$ES;
|
|
193
|
-
} catch (
|
|
194
|
-
Promise.reject(
|
|
193
|
+
} catch (t) {
|
|
194
|
+
Promise.reject(t);
|
|
195
195
|
}
|
|
196
|
-
const
|
|
197
|
-
return
|
|
196
|
+
const e = this.scheduleUpdate();
|
|
197
|
+
return e != null && await e, !this.isUpdatePending;
|
|
198
198
|
}
|
|
199
199
|
scheduleUpdate() {
|
|
200
200
|
return this.performUpdate();
|
|
@@ -203,28 +203,28 @@ let z = class extends HTMLElement {
|
|
|
203
203
|
if (!this.isUpdatePending) return;
|
|
204
204
|
if (!this.hasUpdated) {
|
|
205
205
|
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
206
|
-
for (const [
|
|
206
|
+
for (const [a, o] of this._$Ep) this[a] = o;
|
|
207
207
|
this._$Ep = void 0;
|
|
208
208
|
}
|
|
209
209
|
const s = this.constructor.elementProperties;
|
|
210
|
-
if (s.size > 0) for (const [
|
|
211
|
-
const { wrapped: n } = o, i = this[
|
|
212
|
-
n !== !0 || this._$AL.has(
|
|
210
|
+
if (s.size > 0) for (const [a, o] of s) {
|
|
211
|
+
const { wrapped: n } = o, i = this[a];
|
|
212
|
+
n !== !0 || this._$AL.has(a) || i === void 0 || this.C(a, void 0, o, i);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
let
|
|
216
|
-
const
|
|
215
|
+
let e = !1;
|
|
216
|
+
const t = this._$AL;
|
|
217
217
|
try {
|
|
218
|
-
|
|
218
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach((s) => s.hostUpdate?.()), this.update(t)) : this._$EM();
|
|
219
219
|
} catch (s) {
|
|
220
|
-
throw
|
|
220
|
+
throw e = !1, this._$EM(), s;
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
e && this._$AE(t);
|
|
223
223
|
}
|
|
224
|
-
willUpdate(
|
|
224
|
+
willUpdate(e) {
|
|
225
225
|
}
|
|
226
|
-
_$AE(
|
|
227
|
-
this._$EO?.forEach((
|
|
226
|
+
_$AE(e) {
|
|
227
|
+
this._$EO?.forEach((t) => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
228
228
|
}
|
|
229
229
|
_$EM() {
|
|
230
230
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
@@ -235,83 +235,83 @@ let z = class extends HTMLElement {
|
|
|
235
235
|
getUpdateComplete() {
|
|
236
236
|
return this._$ES;
|
|
237
237
|
}
|
|
238
|
-
shouldUpdate(
|
|
238
|
+
shouldUpdate(e) {
|
|
239
239
|
return !0;
|
|
240
240
|
}
|
|
241
|
-
update(
|
|
242
|
-
this._$Eq &&= this._$Eq.forEach((
|
|
241
|
+
update(e) {
|
|
242
|
+
this._$Eq &&= this._$Eq.forEach((t) => this._$ET(t, this[t])), this._$EM();
|
|
243
243
|
}
|
|
244
|
-
updated(
|
|
244
|
+
updated(e) {
|
|
245
245
|
}
|
|
246
|
-
firstUpdated(
|
|
246
|
+
firstUpdated(e) {
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
z.elementStyles = [], z.shadowRootOptions = { mode: "open" }, z[
|
|
250
|
-
const
|
|
251
|
-
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
252
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
253
|
-
function
|
|
254
|
-
if (!
|
|
255
|
-
return
|
|
256
|
-
}
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
let
|
|
260
|
-
for (let i = 0; i <
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
for (; u <
|
|
264
|
-
const f = n === A &&
|
|
265
|
-
o += n === H ?
|
|
266
|
-
}
|
|
267
|
-
return [
|
|
249
|
+
z.elementStyles = [], z.shadowRootOptions = { mode: "open" }, z[G("elementProperties")] = /* @__PURE__ */ new Map(), z[G("finalized")] = /* @__PURE__ */ new Map(), At?.({ ReactiveElement: z }), (ae.reactiveElementVersions ??= []).push("2.1.2");
|
|
250
|
+
const ue = globalThis, Ee = (r) => r, X = ue.trustedTypes, Ce = X ? X.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, We = "$lit$", _ = `lit$${Math.random().toFixed(9).slice(2)}$`, Ve = "?" + _, It = `<${Ve}>`, E = document, j = () => E.createComment(""), q = (r) => r === null || typeof r != "object" && typeof r != "function", fe = Array.isArray, Et = (r) => fe(r) || typeof r?.[Symbol.iterator] == "function", ce = `[
|
|
251
|
+
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Pe = /-->/g, Be = />/g, A = RegExp(`>|${ce}(?:([^\\s"'>=/]+)(${ce}*=${ce}*(?:[^
|
|
252
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), De = /'/g, ze = /"/g, Ye = /^(?:script|style|textarea|title)$/i, Ke = (r) => (e, ...t) => ({ _$litType$: r, strings: e, values: t }), l = Ke(1), Re = Ke(2), M = /* @__PURE__ */ Symbol.for("lit-noChange"), m = /* @__PURE__ */ Symbol.for("lit-nothing"), Ne = /* @__PURE__ */ new WeakMap(), I = E.createTreeWalker(E, 129);
|
|
253
|
+
function Qe(r, e) {
|
|
254
|
+
if (!fe(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
255
|
+
return Ce !== void 0 ? Ce.createHTML(e) : e;
|
|
256
|
+
}
|
|
257
|
+
const Ct = (r, e) => {
|
|
258
|
+
const t = r.length - 1, s = [];
|
|
259
|
+
let a, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = H;
|
|
260
|
+
for (let i = 0; i < t; i++) {
|
|
261
|
+
const c = r[i];
|
|
262
|
+
let d, h, p = -1, u = 0;
|
|
263
|
+
for (; u < c.length && (n.lastIndex = u, h = n.exec(c), h !== null); ) u = n.lastIndex, n === H ? h[1] === "!--" ? n = Pe : h[1] !== void 0 ? n = Be : h[2] !== void 0 ? (Ye.test(h[2]) && (a = RegExp("</" + h[2], "g")), n = A) : h[3] !== void 0 && (n = A) : n === A ? h[0] === ">" ? (n = a ?? H, p = -1) : h[1] === void 0 ? p = -2 : (p = n.lastIndex - h[2].length, d = h[1], n = h[3] === void 0 ? A : h[3] === '"' ? ze : De) : n === ze || n === De ? n = A : n === Pe || n === Be ? n = H : (n = A, a = void 0);
|
|
264
|
+
const f = n === A && r[i + 1].startsWith("/>") ? " " : "";
|
|
265
|
+
o += n === H ? c + It : p >= 0 ? (s.push(d), c.slice(0, p) + We + c.slice(p) + _ + f) : c + _ + (p === -2 ? i : f);
|
|
266
|
+
}
|
|
267
|
+
return [Qe(r, o + (r[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), s];
|
|
268
268
|
};
|
|
269
|
-
class
|
|
270
|
-
constructor({ strings:
|
|
271
|
-
let
|
|
269
|
+
class W {
|
|
270
|
+
constructor({ strings: e, _$litType$: t }, s) {
|
|
271
|
+
let a;
|
|
272
272
|
this.parts = [];
|
|
273
273
|
let o = 0, n = 0;
|
|
274
|
-
const i =
|
|
275
|
-
if (this.el =
|
|
274
|
+
const i = e.length - 1, c = this.parts, [d, h] = Ct(e, t);
|
|
275
|
+
if (this.el = W.createElement(d, s), I.currentNode = this.el.content, t === 2 || t === 3) {
|
|
276
276
|
const p = this.el.content.firstChild;
|
|
277
277
|
p.replaceWith(...p.childNodes);
|
|
278
278
|
}
|
|
279
|
-
for (; (
|
|
280
|
-
if (
|
|
281
|
-
if (
|
|
282
|
-
const u =
|
|
283
|
-
|
|
284
|
-
} else p.startsWith(
|
|
285
|
-
if (
|
|
286
|
-
const p =
|
|
279
|
+
for (; (a = I.nextNode()) !== null && c.length < i; ) {
|
|
280
|
+
if (a.nodeType === 1) {
|
|
281
|
+
if (a.hasAttributes()) for (const p of a.getAttributeNames()) if (p.endsWith(We)) {
|
|
282
|
+
const u = h[n++], f = a.getAttribute(p).split(_), v = /([.?@])?(.*)/.exec(u);
|
|
283
|
+
c.push({ type: 1, index: o, name: v[2], strings: f, ctor: v[1] === "." ? Bt : v[1] === "?" ? Dt : v[1] === "@" ? zt : oe }), a.removeAttribute(p);
|
|
284
|
+
} else p.startsWith(_) && (c.push({ type: 6, index: o }), a.removeAttribute(p));
|
|
285
|
+
if (Ye.test(a.tagName)) {
|
|
286
|
+
const p = a.textContent.split(_), u = p.length - 1;
|
|
287
287
|
if (u > 0) {
|
|
288
|
-
|
|
289
|
-
for (let f = 0; f < u; f++)
|
|
290
|
-
|
|
288
|
+
a.textContent = X ? X.emptyScript : "";
|
|
289
|
+
for (let f = 0; f < u; f++) a.append(p[f], j()), I.nextNode(), c.push({ type: 2, index: ++o });
|
|
290
|
+
a.append(p[u], j());
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
} else if (
|
|
293
|
+
} else if (a.nodeType === 8) if (a.data === Ve) c.push({ type: 2, index: o });
|
|
294
294
|
else {
|
|
295
295
|
let p = -1;
|
|
296
|
-
for (; (p =
|
|
296
|
+
for (; (p = a.data.indexOf(_, p + 1)) !== -1; ) c.push({ type: 7, index: o }), p += _.length - 1;
|
|
297
297
|
}
|
|
298
298
|
o++;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
static createElement(
|
|
302
|
-
const s =
|
|
303
|
-
return s.innerHTML =
|
|
301
|
+
static createElement(e, t) {
|
|
302
|
+
const s = E.createElement("template");
|
|
303
|
+
return s.innerHTML = e, s;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
function F(
|
|
307
|
-
if (
|
|
308
|
-
let
|
|
309
|
-
const o =
|
|
310
|
-
return
|
|
306
|
+
function F(r, e, t = r, s) {
|
|
307
|
+
if (e === M) return e;
|
|
308
|
+
let a = s !== void 0 ? t._$Co?.[s] : t._$Cl;
|
|
309
|
+
const o = q(e) ? void 0 : e._$litDirective$;
|
|
310
|
+
return a?.constructor !== o && (a?._$AO?.(!1), o === void 0 ? a = void 0 : (a = new o(r), a._$AT(r, t, s)), s !== void 0 ? (t._$Co ??= [])[s] = a : t._$Cl = a), a !== void 0 && (e = F(r, a._$AS(r, e.values), a, s)), e;
|
|
311
311
|
}
|
|
312
|
-
class
|
|
313
|
-
constructor(
|
|
314
|
-
this._$AV = [], this._$AN = void 0, this._$AD =
|
|
312
|
+
class Pt {
|
|
313
|
+
constructor(e, t) {
|
|
314
|
+
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
315
315
|
}
|
|
316
316
|
get parentNode() {
|
|
317
317
|
return this._$AM.parentNode;
|
|
@@ -319,35 +319,35 @@ class Te {
|
|
|
319
319
|
get _$AU() {
|
|
320
320
|
return this._$AM._$AU;
|
|
321
321
|
}
|
|
322
|
-
u(
|
|
323
|
-
const { el: { content:
|
|
324
|
-
|
|
325
|
-
let o =
|
|
326
|
-
for (;
|
|
327
|
-
if (n ===
|
|
328
|
-
let
|
|
329
|
-
|
|
322
|
+
u(e) {
|
|
323
|
+
const { el: { content: t }, parts: s } = this._$AD, a = (e?.creationScope ?? E).importNode(t, !0);
|
|
324
|
+
I.currentNode = a;
|
|
325
|
+
let o = I.nextNode(), n = 0, i = 0, c = s[0];
|
|
326
|
+
for (; c !== void 0; ) {
|
|
327
|
+
if (n === c.index) {
|
|
328
|
+
let d;
|
|
329
|
+
c.type === 2 ? d = new Y(o, o.nextSibling, this, e) : c.type === 1 ? d = new c.ctor(o, c.name, c.strings, this, e) : c.type === 6 && (d = new Rt(o, this, e)), this._$AV.push(d), c = s[++i];
|
|
330
330
|
}
|
|
331
|
-
n !==
|
|
331
|
+
n !== c?.index && (o = I.nextNode(), n++);
|
|
332
332
|
}
|
|
333
|
-
return
|
|
333
|
+
return I.currentNode = E, a;
|
|
334
334
|
}
|
|
335
|
-
p(
|
|
336
|
-
let
|
|
337
|
-
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(
|
|
335
|
+
p(e) {
|
|
336
|
+
let t = 0;
|
|
337
|
+
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(e, s, t), t += s.strings.length - 2) : s._$AI(e[t])), t++;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
class
|
|
340
|
+
class Y {
|
|
341
341
|
get _$AU() {
|
|
342
342
|
return this._$AM?._$AU ?? this._$Cv;
|
|
343
343
|
}
|
|
344
|
-
constructor(
|
|
345
|
-
this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA =
|
|
344
|
+
constructor(e, t, s, a) {
|
|
345
|
+
this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = s, this.options = a, this._$Cv = a?.isConnected ?? !0;
|
|
346
346
|
}
|
|
347
347
|
get parentNode() {
|
|
348
|
-
let
|
|
349
|
-
const
|
|
350
|
-
return
|
|
348
|
+
let e = this._$AA.parentNode;
|
|
349
|
+
const t = this._$AM;
|
|
350
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
351
351
|
}
|
|
352
352
|
get startNode() {
|
|
353
353
|
return this._$AA;
|
|
@@ -355,135 +355,135 @@ class V {
|
|
|
355
355
|
get endNode() {
|
|
356
356
|
return this._$AB;
|
|
357
357
|
}
|
|
358
|
-
_$AI(
|
|
359
|
-
|
|
358
|
+
_$AI(e, t = this) {
|
|
359
|
+
e = F(this, e, t), q(e) ? e === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : e !== this._$AH && e !== M && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Et(e) ? this.k(e) : this._(e);
|
|
360
360
|
}
|
|
361
|
-
O(
|
|
362
|
-
return this._$AA.parentNode.insertBefore(
|
|
361
|
+
O(e) {
|
|
362
|
+
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
363
363
|
}
|
|
364
|
-
T(
|
|
365
|
-
this._$AH !==
|
|
364
|
+
T(e) {
|
|
365
|
+
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
366
366
|
}
|
|
367
|
-
_(
|
|
368
|
-
this._$AH !== m &&
|
|
367
|
+
_(e) {
|
|
368
|
+
this._$AH !== m && q(this._$AH) ? this._$AA.nextSibling.data = e : this.T(E.createTextNode(e)), this._$AH = e;
|
|
369
369
|
}
|
|
370
|
-
$(
|
|
371
|
-
const { values:
|
|
372
|
-
if (this._$AH?._$AD ===
|
|
370
|
+
$(e) {
|
|
371
|
+
const { values: t, _$litType$: s } = e, a = typeof s == "number" ? this._$AC(e) : (s.el === void 0 && (s.el = W.createElement(Qe(s.h, s.h[0]), this.options)), s);
|
|
372
|
+
if (this._$AH?._$AD === a) this._$AH.p(t);
|
|
373
373
|
else {
|
|
374
|
-
const o = new
|
|
375
|
-
o.p(
|
|
374
|
+
const o = new Pt(a, this), n = o.u(this.options);
|
|
375
|
+
o.p(t), this.T(n), this._$AH = o;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
_$AC(
|
|
379
|
-
let
|
|
380
|
-
return
|
|
381
|
-
}
|
|
382
|
-
k(
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
let s,
|
|
386
|
-
for (const o of
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
_$AR(
|
|
390
|
-
for (this._$AP?.(!1, !0,
|
|
391
|
-
const s =
|
|
392
|
-
|
|
378
|
+
_$AC(e) {
|
|
379
|
+
let t = Ne.get(e.strings);
|
|
380
|
+
return t === void 0 && Ne.set(e.strings, t = new W(e)), t;
|
|
381
|
+
}
|
|
382
|
+
k(e) {
|
|
383
|
+
fe(this._$AH) || (this._$AH = [], this._$AR());
|
|
384
|
+
const t = this._$AH;
|
|
385
|
+
let s, a = 0;
|
|
386
|
+
for (const o of e) a === t.length ? t.push(s = new Y(this.O(j()), this.O(j()), this, this.options)) : s = t[a], s._$AI(o), a++;
|
|
387
|
+
a < t.length && (this._$AR(s && s._$AB.nextSibling, a), t.length = a);
|
|
388
|
+
}
|
|
389
|
+
_$AR(e = this._$AA.nextSibling, t) {
|
|
390
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
|
|
391
|
+
const s = Ee(e).nextSibling;
|
|
392
|
+
Ee(e).remove(), e = s;
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
setConnected(
|
|
396
|
-
this._$AM === void 0 && (this._$Cv =
|
|
395
|
+
setConnected(e) {
|
|
396
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
class
|
|
399
|
+
class oe {
|
|
400
400
|
get tagName() {
|
|
401
401
|
return this.element.tagName;
|
|
402
402
|
}
|
|
403
403
|
get _$AU() {
|
|
404
404
|
return this._$AM._$AU;
|
|
405
405
|
}
|
|
406
|
-
constructor(
|
|
407
|
-
this.type = 1, this._$AH = m, this._$AN = void 0, this.element =
|
|
406
|
+
constructor(e, t, s, a, o) {
|
|
407
|
+
this.type = 1, this._$AH = m, this._$AN = void 0, this.element = e, this.name = t, this._$AM = a, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = m;
|
|
408
408
|
}
|
|
409
|
-
_$AI(
|
|
409
|
+
_$AI(e, t = this, s, a) {
|
|
410
410
|
const o = this.strings;
|
|
411
411
|
let n = !1;
|
|
412
|
-
if (o === void 0)
|
|
412
|
+
if (o === void 0) e = F(this, e, t, 0), n = !q(e) || e !== this._$AH && e !== M, n && (this._$AH = e);
|
|
413
413
|
else {
|
|
414
|
-
const i =
|
|
415
|
-
let
|
|
416
|
-
for (
|
|
414
|
+
const i = e;
|
|
415
|
+
let c, d;
|
|
416
|
+
for (e = o[0], c = 0; c < o.length - 1; c++) d = F(this, i[s + c], t, c), d === M && (d = this._$AH[c]), n ||= !q(d) || d !== this._$AH[c], d === m ? e = m : e !== m && (e += (d ?? "") + o[c + 1]), this._$AH[c] = d;
|
|
417
417
|
}
|
|
418
|
-
n && !
|
|
418
|
+
n && !a && this.j(e);
|
|
419
419
|
}
|
|
420
|
-
j(
|
|
421
|
-
|
|
420
|
+
j(e) {
|
|
421
|
+
e === m ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
class
|
|
424
|
+
class Bt extends oe {
|
|
425
425
|
constructor() {
|
|
426
426
|
super(...arguments), this.type = 3;
|
|
427
427
|
}
|
|
428
|
-
j(
|
|
429
|
-
this.element[this.name] =
|
|
428
|
+
j(e) {
|
|
429
|
+
this.element[this.name] = e === m ? void 0 : e;
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
class
|
|
432
|
+
class Dt extends oe {
|
|
433
433
|
constructor() {
|
|
434
434
|
super(...arguments), this.type = 4;
|
|
435
435
|
}
|
|
436
|
-
j(
|
|
437
|
-
this.element.toggleAttribute(this.name, !!
|
|
436
|
+
j(e) {
|
|
437
|
+
this.element.toggleAttribute(this.name, !!e && e !== m);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
class
|
|
441
|
-
constructor(
|
|
442
|
-
super(
|
|
440
|
+
class zt extends oe {
|
|
441
|
+
constructor(e, t, s, a, o) {
|
|
442
|
+
super(e, t, s, a, o), this.type = 5;
|
|
443
443
|
}
|
|
444
|
-
_$AI(
|
|
445
|
-
if ((
|
|
446
|
-
const s = this._$AH,
|
|
447
|
-
|
|
444
|
+
_$AI(e, t = this) {
|
|
445
|
+
if ((e = F(this, e, t, 0) ?? m) === M) return;
|
|
446
|
+
const s = this._$AH, a = e === m && s !== m || e.capture !== s.capture || e.once !== s.once || e.passive !== s.passive, o = e !== m && (s === m || a);
|
|
447
|
+
a && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
448
448
|
}
|
|
449
|
-
handleEvent(
|
|
450
|
-
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element,
|
|
449
|
+
handleEvent(e) {
|
|
450
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class
|
|
454
|
-
constructor(
|
|
455
|
-
this.element =
|
|
453
|
+
class Rt {
|
|
454
|
+
constructor(e, t, s) {
|
|
455
|
+
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = s;
|
|
456
456
|
}
|
|
457
457
|
get _$AU() {
|
|
458
458
|
return this._$AM._$AU;
|
|
459
459
|
}
|
|
460
|
-
_$AI(
|
|
461
|
-
F(this,
|
|
460
|
+
_$AI(e) {
|
|
461
|
+
F(this, e);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
const s =
|
|
468
|
-
let
|
|
469
|
-
if (
|
|
470
|
-
const o =
|
|
471
|
-
s._$litPart$ =
|
|
464
|
+
const Nt = ue.litHtmlPolyfillSupport;
|
|
465
|
+
Nt?.(W, Y), (ue.litHtmlVersions ??= []).push("3.3.3");
|
|
466
|
+
const Mt = (r, e, t) => {
|
|
467
|
+
const s = t?.renderBefore ?? e;
|
|
468
|
+
let a = s._$litPart$;
|
|
469
|
+
if (a === void 0) {
|
|
470
|
+
const o = t?.renderBefore ?? null;
|
|
471
|
+
s._$litPart$ = a = new Y(e.insertBefore(j(), o), o, void 0, t ?? {});
|
|
472
472
|
}
|
|
473
|
-
return
|
|
473
|
+
return a._$AI(r), a;
|
|
474
474
|
};
|
|
475
|
-
const
|
|
475
|
+
const ge = globalThis;
|
|
476
476
|
class N extends z {
|
|
477
477
|
constructor() {
|
|
478
478
|
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
479
479
|
}
|
|
480
480
|
createRenderRoot() {
|
|
481
|
-
const
|
|
482
|
-
return this.renderOptions.renderBefore ??=
|
|
481
|
+
const e = super.createRenderRoot();
|
|
482
|
+
return this.renderOptions.renderBefore ??= e.firstChild, e;
|
|
483
483
|
}
|
|
484
|
-
update(
|
|
485
|
-
const
|
|
486
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(
|
|
484
|
+
update(e) {
|
|
485
|
+
const t = this.render();
|
|
486
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = Mt(t, this.renderRoot, this.renderOptions);
|
|
487
487
|
}
|
|
488
488
|
connectedCallback() {
|
|
489
489
|
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
@@ -495,38 +495,38 @@ class N extends z {
|
|
|
495
495
|
return M;
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
N._$litElement$ = !0, N.finalized = !0,
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
(
|
|
502
|
-
const
|
|
503
|
-
function
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const
|
|
507
|
-
return
|
|
508
|
-
}
|
|
509
|
-
function
|
|
510
|
-
if (!
|
|
511
|
-
const s =
|
|
498
|
+
N._$litElement$ = !0, N.finalized = !0, ge.litElementHydrateSupport?.({ LitElement: N });
|
|
499
|
+
const Ft = ge.litElementPolyfillSupport;
|
|
500
|
+
Ft?.({ LitElement: N });
|
|
501
|
+
(ge.litElementVersions ??= []).push("4.2.2");
|
|
502
|
+
const Ot = 50;
|
|
503
|
+
function Ut(r = {}) {
|
|
504
|
+
const e = Object.entries(r).filter(([, s]) => s != null && s !== "");
|
|
505
|
+
if (!e.length) return "";
|
|
506
|
+
const t = new URLSearchParams();
|
|
507
|
+
return e.forEach(([s, a]) => t.set(s, String(a))), `?${t.toString()}`;
|
|
508
|
+
}
|
|
509
|
+
function Ht({ baseUrl: r, token: e = "", fetchFn: t } = {}) {
|
|
510
|
+
if (!r) throw new Error("createClient requires a baseUrl");
|
|
511
|
+
const s = r.replace(/\/+$/, ""), a = t || ((...i) => fetch(...i));
|
|
512
512
|
async function o(i) {
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
const
|
|
518
|
-
throw
|
|
513
|
+
const c = { Accept: "application/json" };
|
|
514
|
+
e && (c.Authorization = `Bearer ${e}`);
|
|
515
|
+
const d = await a(`${s}${i}`, { headers: c });
|
|
516
|
+
if (!d.ok) {
|
|
517
|
+
const h = new Error(`api-hsot ${d.status} on ${i}`);
|
|
518
|
+
throw h.status = d.status, h;
|
|
519
519
|
}
|
|
520
|
-
return
|
|
521
|
-
}
|
|
522
|
-
async function n(i,
|
|
523
|
-
const
|
|
524
|
-
let
|
|
525
|
-
for (let p = 0; p <
|
|
526
|
-
const u =
|
|
527
|
-
if (
|
|
520
|
+
return d.json();
|
|
521
|
+
}
|
|
522
|
+
async function n(i, c = {}) {
|
|
523
|
+
const d = [];
|
|
524
|
+
let h = null;
|
|
525
|
+
for (let p = 0; p < Ot; p += 1) {
|
|
526
|
+
const u = Ut(h ? { ...c, cursor: h } : c), f = await o(`${i}${u}`);
|
|
527
|
+
if (d.push(...f.items || []), h = f.nextCursor || null, !h) break;
|
|
528
528
|
}
|
|
529
|
-
return { items:
|
|
529
|
+
return { items: d, total: d.length, nextCursor: null };
|
|
530
530
|
}
|
|
531
531
|
return {
|
|
532
532
|
listSchools: (i) => n("/schools", i),
|
|
@@ -539,140 +539,159 @@ function Me({ baseUrl: a, token: t = "", fetchFn: e } = {}) {
|
|
|
539
539
|
listGames: (i) => n("/games", i),
|
|
540
540
|
getGame: (i) => o(`/games/${i}`),
|
|
541
541
|
listTournaments: (i) => n("/tournaments", i),
|
|
542
|
-
listSeedings: (i,
|
|
543
|
-
listEdges: (i,
|
|
542
|
+
listSeedings: (i, c) => n(`/tournaments/${i}/seedings`, c),
|
|
543
|
+
listEdges: (i, c) => n(`/tournaments/${i}/edges`, c),
|
|
544
544
|
listRankings: (i) => n("/rankings", i),
|
|
545
545
|
listSports: () => o("/sports")
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
|
-
const
|
|
548
|
+
const L = {
|
|
549
549
|
game: "/{sport}/game/{id}/",
|
|
550
550
|
school: "/school/{id}/",
|
|
551
|
-
section: "/{sport}/{view}/"
|
|
551
|
+
section: "/{sport}/{view}/",
|
|
552
|
+
// The "Report a Score" page; {id} is the game being reported on, and
|
|
553
|
+
// reportHref() drops the parameter when there is none.
|
|
554
|
+
report: "/report-a-score/?game={id}"
|
|
552
555
|
};
|
|
553
|
-
function
|
|
554
|
-
return String(
|
|
556
|
+
function g(r, e) {
|
|
557
|
+
return String(r).replace(/\{(\w+)\}/g, (t, s) => e[s] !== void 0 && e[s] !== null ? String(e[s]) : t);
|
|
555
558
|
}
|
|
556
|
-
function O(
|
|
559
|
+
function O(r) {
|
|
557
560
|
return {
|
|
558
|
-
game:
|
|
559
|
-
school:
|
|
560
|
-
section:
|
|
561
|
+
game: r.getAttribute("game-href") || L.game,
|
|
562
|
+
school: r.getAttribute("school-href") || L.school,
|
|
563
|
+
section: r.getAttribute("section-href") || L.section,
|
|
564
|
+
report: r.getAttribute("report-href") || L.report
|
|
561
565
|
};
|
|
562
566
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
return
|
|
585
|
-
}
|
|
586
|
-
function
|
|
587
|
-
const
|
|
588
|
-
return
|
|
589
|
-
}
|
|
590
|
-
function
|
|
591
|
-
const e =
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const
|
|
606
|
-
return
|
|
567
|
+
function Ze(r, e = "") {
|
|
568
|
+
const t = g(r.report || L.report, { id: e || "" });
|
|
569
|
+
return e ? t : t.replace(/([?&])game=(?=&|$)/, "$1").replace(/[?&]$/, "").replace(/\?&/, "?");
|
|
570
|
+
}
|
|
571
|
+
const k = (r) => r ? r.charAt(0).toUpperCase() + r.slice(1) : "";
|
|
572
|
+
function x(r, e) {
|
|
573
|
+
if (!r) return "TBD";
|
|
574
|
+
const [t, s, a] = String(r).split("-").map(Number);
|
|
575
|
+
return !t || !s || !a ? "TBD" : new Date(t, s - 1, a).toLocaleDateString("en-US", e || { weekday: "short", month: "short", day: "numeric" });
|
|
576
|
+
}
|
|
577
|
+
function ve(r) {
|
|
578
|
+
if (!r) return "";
|
|
579
|
+
const [e, t] = String(r).split(":").map(Number);
|
|
580
|
+
if (Number.isNaN(e)) return "";
|
|
581
|
+
const s = e >= 12 ? "PM" : "AM";
|
|
582
|
+
return `${(e + 11) % 12 + 1}:${String(t || 0).padStart(2, "0")} ${s}`;
|
|
583
|
+
}
|
|
584
|
+
function Lt(r) {
|
|
585
|
+
return r ? `${Math.floor(r / 12)}-${r % 12}` : "·";
|
|
586
|
+
}
|
|
587
|
+
function Gt(r) {
|
|
588
|
+
return (Array.isArray(r?.positions) ? r.positions : String(r?.position ?? "").split(/[/,]/)).map((t) => String(t ?? "").trim()).filter(Boolean).join("/");
|
|
589
|
+
}
|
|
590
|
+
function K(r = /* @__PURE__ */ new Date()) {
|
|
591
|
+
const e = r.getFullYear();
|
|
592
|
+
return r.getMonth() >= 6 ? `${e}-${e + 1}` : `${e - 1}-${e}`;
|
|
593
|
+
}
|
|
594
|
+
function $e(r = /* @__PURE__ */ new Date()) {
|
|
595
|
+
const e = (t) => String(t).padStart(2, "0");
|
|
596
|
+
return `${r.getFullYear()}-${e(r.getMonth() + 1)}-${e(r.getDate())}`;
|
|
597
|
+
}
|
|
598
|
+
function jt(r, e = $e()) {
|
|
599
|
+
const t = [...new Set((r || []).filter(Boolean))].sort();
|
|
600
|
+
if (!t.length || t.includes(e)) return e;
|
|
601
|
+
const s = t.filter((a) => a < e);
|
|
602
|
+
return s.length ? s[s.length - 1] : t[0];
|
|
603
|
+
}
|
|
604
|
+
function be(r) {
|
|
605
|
+
return r ? (r.abbr || r.name || "?").slice(0, 4).toUpperCase() : "?";
|
|
606
|
+
}
|
|
607
|
+
function ee(r) {
|
|
608
|
+
if (!r || !/^#[0-9a-fA-F]{6}$/.test(r)) return "#FFFFFF";
|
|
609
|
+
const e = parseInt(r.slice(1), 16), t = e >> 16 & 255, s = e >> 8 & 255, a = e & 255;
|
|
610
|
+
return 0.299 * t + 0.587 * s + 0.114 * a > 150 ? "#0F1B33" : "#FFFFFF";
|
|
611
|
+
}
|
|
612
|
+
const qt = (r) => {
|
|
613
|
+
const e = ["th", "st", "nd", "rd"], t = r % 100;
|
|
614
|
+
return r + (e[(t - 20) % 10] || e[t] || e[0]);
|
|
607
615
|
};
|
|
608
|
-
function
|
|
609
|
-
const
|
|
616
|
+
function Me(r, e) {
|
|
617
|
+
const t = (o) => {
|
|
610
618
|
const n = /^\d+/.exec(String(o ?? ""));
|
|
611
619
|
return n ? Number(n[0]) : null;
|
|
612
|
-
}, s =
|
|
613
|
-
return s !== null &&
|
|
620
|
+
}, s = t(r), a = t(e);
|
|
621
|
+
return s !== null && a !== null && s !== a ? a - s : s !== null && a === null ? -1 : s === null && a !== null ? 1 : String(r ?? "").localeCompare(String(e ?? ""), "en", { sensitivity: "base" });
|
|
614
622
|
}
|
|
615
|
-
function
|
|
616
|
-
const
|
|
617
|
-
return
|
|
623
|
+
function Wt(r, e) {
|
|
624
|
+
const t = (s) => String(s?.name ?? s ?? "");
|
|
625
|
+
return t(r).localeCompare(t(e), "en", { numeric: !0, sensitivity: "base" });
|
|
618
626
|
}
|
|
619
|
-
function
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
return { kind: "live", label:
|
|
627
|
+
function Je(r) {
|
|
628
|
+
if (r.state === "live") {
|
|
629
|
+
const e = [r.period, r.clock].filter(Boolean).join(" ");
|
|
630
|
+
return { kind: "live", label: e ? `Live · ${e}` : "Live" };
|
|
623
631
|
}
|
|
624
|
-
if (
|
|
625
|
-
const
|
|
626
|
-
return
|
|
632
|
+
if (r.state === "final") {
|
|
633
|
+
const e = [];
|
|
634
|
+
return r.finish === "overtime" && e.push("OT"), r.finish === "shootout" && e.push("PK-SO"), r.forfeit && r.forfeit !== "none" && e.push("Forfeit"), { kind: "final", label: `Final${e.length ? ` · ${e.join(" · ")}` : ""}` };
|
|
627
635
|
}
|
|
628
|
-
return
|
|
636
|
+
return r.state === "postponed" ? { kind: "warn", label: "Postponed" } : r.state === "canceled" ? { kind: "warn", label: "Canceled" } : { kind: "sched", label: `${x(r.date, { month: "short", day: "numeric" })} · ${ve(r.time)}`.replace(/ · $/, "") };
|
|
637
|
+
}
|
|
638
|
+
const Vt = ["boys", "girls"];
|
|
639
|
+
function Xe(r, e) {
|
|
640
|
+
return e ? r ? r.gender === e || r.gender === "coed" : !1 : !0;
|
|
641
|
+
}
|
|
642
|
+
function et(r, e) {
|
|
643
|
+
return e ? (r || []).filter((t) => Xe(t, e)) : r || [];
|
|
629
644
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
645
|
+
function he(r) {
|
|
646
|
+
const e = new Set((r || []).map((t) => t && t.gender));
|
|
647
|
+
return Vt.filter((t) => e.has(t));
|
|
648
|
+
}
|
|
649
|
+
const Yt = (r) => he(r).length === 2, Kt = /* @__PURE__ */ new Set(["game", "story", "page", "forum", "video", "gallery"]);
|
|
650
|
+
function T(r) {
|
|
651
|
+
let e = String(r || "").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/#?]*/i, "");
|
|
652
|
+
const t = e.indexOf("#");
|
|
634
653
|
let s = "";
|
|
635
|
-
|
|
636
|
-
let
|
|
637
|
-
return
|
|
638
|
-
}
|
|
639
|
-
function
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
642
|
-
const
|
|
643
|
-
return
|
|
644
|
-
}
|
|
645
|
-
function
|
|
646
|
-
if (!
|
|
647
|
-
const s =
|
|
654
|
+
t !== -1 && (s = e.slice(t).split("?")[0], e = e.slice(0, t));
|
|
655
|
+
let a = e.split("?")[0] + s;
|
|
656
|
+
return a = a.replace(/([^:])\/{2,}/g, "$1/").replace(/^\/{2,}/, "/"), a = a.replace(/^\/(?=#)/, ""), a.length > 1 && (a = a.replace(/\/+$/, "")), a.toLowerCase();
|
|
657
|
+
}
|
|
658
|
+
function tt() {
|
|
659
|
+
const r = globalThis.location;
|
|
660
|
+
if (!r) return "";
|
|
661
|
+
const e = (r.hash || "").startsWith("#/") ? r.hash : "";
|
|
662
|
+
return T((r.pathname || "") + e);
|
|
663
|
+
}
|
|
664
|
+
function Qt(r, e, t) {
|
|
665
|
+
if (!t) return null;
|
|
666
|
+
const s = T(r);
|
|
648
667
|
if (!s) return null;
|
|
649
|
-
const
|
|
650
|
-
if (s ===
|
|
651
|
-
const n =
|
|
668
|
+
const a = T(g(e.game, { sport: t, id: "" })), o = T(g(e.school, { id: "" }));
|
|
669
|
+
if (s === a || s.startsWith(`${a}/`) || s === o || s.startsWith(`${o}/`)) return null;
|
|
670
|
+
const n = T(g(e.section, { sport: t, view: "" }));
|
|
652
671
|
if (s === n) return "";
|
|
653
672
|
if (!s.startsWith(`${n}/`)) return null;
|
|
654
|
-
const i = s.slice(n.length + 1),
|
|
655
|
-
return
|
|
673
|
+
const i = s.slice(n.length + 1), c = i.split("/");
|
|
674
|
+
return c.length > 2 || c.some((d) => !/^[a-z][a-z-]*$/.test(d)) || Kt.has(c[0]) ? null : i;
|
|
656
675
|
}
|
|
657
|
-
function
|
|
658
|
-
const s = (
|
|
676
|
+
function Zt(r, e, t) {
|
|
677
|
+
const s = (o) => g(t.section, { sport: r, view: o }).replace(/([^:])\/{2,}/g, "$1/"), a = Yt(e) ? [
|
|
659
678
|
{ label: "Boys Standings", href: s("boys/standings") },
|
|
660
679
|
{ label: "Girls Standings", href: s("girls/standings") }
|
|
661
680
|
] : [{ label: "Standings", href: s("standings") }];
|
|
662
681
|
return [
|
|
663
|
-
{ label: `${
|
|
682
|
+
{ label: `${k(r)} Home`, href: s("") },
|
|
664
683
|
{ label: "Scores/Schedule", href: s("scores") },
|
|
665
684
|
{ label: "Playoff Brackets", href: s("brackets") },
|
|
666
|
-
...
|
|
685
|
+
...a,
|
|
667
686
|
{ label: "Polls & Rankings", href: s("rankings") }
|
|
668
687
|
];
|
|
669
688
|
}
|
|
670
|
-
function
|
|
671
|
-
const
|
|
672
|
-
for (const s of
|
|
673
|
-
|
|
689
|
+
function Jt(r, e = tt()) {
|
|
690
|
+
const t = T(e);
|
|
691
|
+
for (const s of r.querySelectorAll(':scope > a[slot="nav"]'))
|
|
692
|
+
t && T(s.getAttribute("href")) === t ? s.setAttribute("aria-current", "page") : s.removeAttribute("aria-current");
|
|
674
693
|
}
|
|
675
|
-
class
|
|
694
|
+
class y extends N {
|
|
676
695
|
static properties = {
|
|
677
696
|
api: { type: String },
|
|
678
697
|
refreshInterval: { type: Number, attribute: "refresh-interval" },
|
|
@@ -687,11 +706,11 @@ class b extends N {
|
|
|
687
706
|
super(), this.api = "", this.refreshInterval = 0, this.promoHref = "", this.promoImage = "", this.promoAlt = "", this.data = null, this.loading = !1, this.error = "", this._client = null, this._refreshId = null;
|
|
688
707
|
}
|
|
689
708
|
/** Injected client wins; otherwise build a fetch client from the api attribute. */
|
|
690
|
-
set client(
|
|
691
|
-
this._client =
|
|
709
|
+
set client(e) {
|
|
710
|
+
this._client = e, this.isConnected && this.load();
|
|
692
711
|
}
|
|
693
712
|
get client() {
|
|
694
|
-
return this._client ? this._client : this.api ?
|
|
713
|
+
return this._client ? this._client : this.api ? Ht({ baseUrl: this.api }) : null;
|
|
695
714
|
}
|
|
696
715
|
connectedCallback() {
|
|
697
716
|
super.connectedCallback(), this._setupInterval();
|
|
@@ -702,43 +721,43 @@ class b extends N {
|
|
|
702
721
|
firstUpdated() {
|
|
703
722
|
this.load();
|
|
704
723
|
}
|
|
705
|
-
updated(
|
|
706
|
-
|
|
724
|
+
updated(e) {
|
|
725
|
+
e.has("api") && e.get("api") !== void 0 && e.get("api") !== this.api && this.load(), e.has("refreshInterval") && this._setupInterval(), Jt(this);
|
|
707
726
|
}
|
|
708
727
|
async load() {
|
|
709
|
-
const
|
|
710
|
-
if (!
|
|
728
|
+
const e = this.client;
|
|
729
|
+
if (!e) {
|
|
711
730
|
this.error = "not-configured";
|
|
712
731
|
return;
|
|
713
732
|
}
|
|
714
733
|
this.loading = !0, this.error = "";
|
|
715
734
|
try {
|
|
716
|
-
this.data = await this.fetchData(
|
|
717
|
-
} catch (
|
|
718
|
-
console.error(`[${this.tagName.toLowerCase()}]`,
|
|
735
|
+
this.data = await this.fetchData(e);
|
|
736
|
+
} catch (t) {
|
|
737
|
+
console.error(`[${this.tagName.toLowerCase()}]`, t), this.error = "load-failed";
|
|
719
738
|
} finally {
|
|
720
739
|
this.loading = !1;
|
|
721
740
|
}
|
|
722
741
|
}
|
|
723
|
-
async fetchData(
|
|
742
|
+
async fetchData(e) {
|
|
724
743
|
return null;
|
|
725
744
|
}
|
|
726
745
|
_setupInterval() {
|
|
727
746
|
this._clearInterval();
|
|
728
|
-
const
|
|
729
|
-
|
|
747
|
+
const e = Number(this.refreshInterval) || 0;
|
|
748
|
+
e > 0 && (this._refreshId = setInterval(() => this.load(), e));
|
|
730
749
|
}
|
|
731
750
|
_clearInterval() {
|
|
732
751
|
this._refreshId && (clearInterval(this._refreshId), this._refreshId = null);
|
|
733
752
|
}
|
|
734
753
|
render() {
|
|
735
|
-
return this.error === "not-configured" ?
|
|
754
|
+
return this.error === "not-configured" ? l`<div class="error">This component needs an <code>api</code> attribute (the api-hsot public read-surface base URL) or an injected client.</div>` : this.error ? l`<div class="error">Unable to load right now. <button class="chip" @click=${() => this.load()}>Retry</button></div>` : this.data ? this.renderView() : l`<div class="loading" role="status">Loading…</div>`;
|
|
736
755
|
}
|
|
737
756
|
renderView() {
|
|
738
|
-
return
|
|
757
|
+
return l``;
|
|
739
758
|
}
|
|
740
759
|
}
|
|
741
|
-
const
|
|
760
|
+
const b = (r) => Object.fromEntries((r || []).map((e) => [e.id, e])), Xt = w`
|
|
742
761
|
:host {
|
|
743
762
|
--hsot-red: var(--color-red, #D1232A);
|
|
744
763
|
--hsot-red-deep: var(--color-red-dark, #951C21);
|
|
@@ -776,7 +795,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
776
795
|
outline-offset: 1px;
|
|
777
796
|
}
|
|
778
797
|
.mut { color: var(--hsot-gray-5); }
|
|
779
|
-
`,
|
|
798
|
+
`, es = w`
|
|
780
799
|
.band { background: var(--hsot-white); color: var(--hsot-black); }
|
|
781
800
|
.band .inner { max-width: 1366px; margin: 0 auto; padding: 1.1rem 1.25rem 0; }
|
|
782
801
|
.band h1, .band h2.bandtitle {
|
|
@@ -825,7 +844,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
825
844
|
@media (max-width: 720px) {
|
|
826
845
|
.band h1, .band h2.bandtitle, .band.section h1, .band.section h2.bandtitle { font-size: 1.8rem; }
|
|
827
846
|
}
|
|
828
|
-
`,
|
|
847
|
+
`, ts = w`
|
|
829
848
|
.view { max-width: 1366px; margin: 0 auto; padding: 1.25rem; box-sizing: border-box; }
|
|
830
849
|
/* Optional right rail (slot="rail" light-DOM children): a divided 300px
|
|
831
850
|
column on desktop, stacked under the view content on smaller screens. */
|
|
@@ -889,7 +908,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
889
908
|
.error { padding: 1.2rem 1rem; color: var(--hsot-red-deep); font-size: 0.9rem; }
|
|
890
909
|
.note { font-size: 0.8125rem; color: var(--hsot-gray-5); margin: 0.6rem 0 0; }
|
|
891
910
|
.loading { padding: 1.2rem; color: var(--hsot-gray-5); font-family: var(--hsot-heading-font); }
|
|
892
|
-
`,
|
|
911
|
+
`, ss = w`
|
|
893
912
|
.pill {
|
|
894
913
|
display: inline-block; font-family: var(--hsot-heading-font); font-weight: 700;
|
|
895
914
|
font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em;
|
|
@@ -904,7 +923,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
904
923
|
.pill.champ { background: var(--hsot-straw); color: #6b5900; }
|
|
905
924
|
@keyframes hsot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
|
|
906
925
|
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
|
|
907
|
-
`,
|
|
926
|
+
`, rs = w`
|
|
908
927
|
.tablewrap { overflow-x: auto; }
|
|
909
928
|
table.data { font-family: var(--hsot-heading-font); font-size: 14px; border-collapse: collapse; width: 100%; }
|
|
910
929
|
table.data th {
|
|
@@ -922,7 +941,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
922
941
|
table.data tbody tr.rowlink:hover { background: var(--hsot-gray-1); }
|
|
923
942
|
table.data td.teamcell a { color: inherit; text-decoration: none; font-weight: 500; }
|
|
924
943
|
table.data td.teamcell a:hover { text-decoration: underline; }
|
|
925
|
-
`,
|
|
944
|
+
`, as = w`
|
|
926
945
|
.swatch {
|
|
927
946
|
display: inline-flex; align-items: center; justify-content: center;
|
|
928
947
|
width: 26px; height: 26px; border-radius: 50%;
|
|
@@ -946,7 +965,7 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
946
965
|
.dot.W { background: var(--hsot-win); }
|
|
947
966
|
.dot.L { background: var(--hsot-loss); }
|
|
948
967
|
.dot.T { background: var(--hsot-tie); }
|
|
949
|
-
`,
|
|
968
|
+
`, os = w`
|
|
950
969
|
ul.gamelist { list-style: none; margin: 0; padding: 0; }
|
|
951
970
|
.gamelist li {
|
|
952
971
|
display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 1rem;
|
|
@@ -996,177 +1015,177 @@ const $ = (a) => Object.fromEntries((a || []).map((t) => [t.id, t])), Ve = y`
|
|
|
996
1015
|
.gamelist .ff { color: var(--hsot-gray-5); font-size: 0.78rem; font-style: italic; }
|
|
997
1016
|
.gamelist .where { color: var(--hsot-gray-5); font-size: 0.78rem; }
|
|
998
1017
|
.gamelist a.box { font-size: 0.78rem; }
|
|
999
|
-
`, U = [
|
|
1000
|
-
function
|
|
1001
|
-
return
|
|
1002
|
-
}
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1005
|
-
}
|
|
1006
|
-
function
|
|
1007
|
-
const
|
|
1008
|
-
for (const o of
|
|
1009
|
-
const n =
|
|
1010
|
-
for (const
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1018
|
+
`, U = [Xt, es, ts, ss, rs, as, os];
|
|
1019
|
+
function ne(r) {
|
|
1020
|
+
return r.state !== "final" ? null : r.forfeit === "home" ? "away" : r.forfeit === "away" || r.homeScore > r.awayScore ? "home" : r.awayScore > r.homeScore ? "away" : r.tiebreakWinner && r.tiebreakWinner !== "none" ? r.tiebreakWinner : "tie";
|
|
1021
|
+
}
|
|
1022
|
+
function ns(r) {
|
|
1023
|
+
return r && (r.forfeit === "home" || r.forfeit === "away") ? r.forfeit : null;
|
|
1024
|
+
}
|
|
1025
|
+
function Q(r, e) {
|
|
1026
|
+
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]), a = r.filter((o) => o.state === "final" && o.gameType !== "scrimmage" && !0).sort((o, n) => String(o.date).localeCompare(String(n.date)));
|
|
1027
|
+
for (const o of a) {
|
|
1028
|
+
const n = ne(o), i = o.gameType === "conference";
|
|
1029
|
+
for (const c of ["home", "away"]) {
|
|
1030
|
+
const d = c === "home" ? o.homeTeamId : o.awayTeamId;
|
|
1031
|
+
if (!d) continue;
|
|
1032
|
+
const h = s(d), p = c === "home" ? o.homeScore : o.awayScore, u = c === "home" ? o.awayScore : o.homeScore;
|
|
1033
|
+
h.pf += p, h.pa += u;
|
|
1015
1034
|
let f = "T";
|
|
1016
|
-
n === "tie" ? (
|
|
1035
|
+
n === "tie" ? (h.t += 1, i && (h.ct += 1)) : n === c ? (h.w += 1, i && (h.cw += 1), f = "W") : (h.l += 1, i && (h.cl += 1), f = "L"), h.results.push({ gameId: o.id, date: o.date, mark: f, my: p, their: u, opp: c === "home" ? o.awayTeamId : o.homeTeamId, conf: i });
|
|
1017
1036
|
}
|
|
1018
1037
|
}
|
|
1019
|
-
return
|
|
1038
|
+
return t;
|
|
1020
1039
|
}
|
|
1021
|
-
function
|
|
1022
|
-
if (!
|
|
1023
|
-
const
|
|
1024
|
-
let
|
|
1025
|
-
for (let s =
|
|
1026
|
-
return
|
|
1027
|
-
}
|
|
1028
|
-
const
|
|
1029
|
-
const s =
|
|
1030
|
-
return s ? (
|
|
1031
|
-
},
|
|
1032
|
-
function
|
|
1033
|
-
if (!
|
|
1034
|
-
const
|
|
1035
|
-
return `${
|
|
1036
|
-
}
|
|
1037
|
-
function
|
|
1038
|
-
return
|
|
1039
|
-
const s = t
|
|
1040
|
-
return { team:
|
|
1041
|
-
}).sort((
|
|
1042
|
-
}
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1045
|
-
}
|
|
1046
|
-
function
|
|
1047
|
-
const
|
|
1048
|
-
return
|
|
1049
|
-
}
|
|
1050
|
-
function
|
|
1051
|
-
const o = t
|
|
1040
|
+
function ie(r) {
|
|
1041
|
+
if (!r || !r.length) return "";
|
|
1042
|
+
const e = r[r.length - 1].mark;
|
|
1043
|
+
let t = 0;
|
|
1044
|
+
for (let s = r.length - 1; s >= 0 && r[s].mark === e; s -= 1) t += 1;
|
|
1045
|
+
return e + t;
|
|
1046
|
+
}
|
|
1047
|
+
const Fe = (r, e, t) => {
|
|
1048
|
+
const s = r + e + t;
|
|
1049
|
+
return s ? (r + t / 2) / s : 0;
|
|
1050
|
+
}, Oe = (r) => r.toFixed(3).replace("0.", ".");
|
|
1051
|
+
function S(r, e = !1) {
|
|
1052
|
+
if (!r) return "0-0";
|
|
1053
|
+
const t = e ? r.cw : r.w, s = e ? r.cl : r.l, a = e ? r.ct : r.t;
|
|
1054
|
+
return `${t}-${s}${a ? `-${a}` : ""}`;
|
|
1055
|
+
}
|
|
1056
|
+
function st(r, e) {
|
|
1057
|
+
return r.map((t) => {
|
|
1058
|
+
const s = e[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] };
|
|
1059
|
+
return { team: t, rec: s, confPct: Fe(s.cw, s.cl, s.ct), overallPct: Fe(s.w, s.l, s.t) };
|
|
1060
|
+
}).sort((t, s) => s.confPct - t.confPct || s.overallPct - t.overallPct || s.rec.pf - s.rec.pa - (t.rec.pf - t.rec.pa));
|
|
1061
|
+
}
|
|
1062
|
+
function ye(r, e) {
|
|
1063
|
+
return r.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;
|
|
1064
|
+
}
|
|
1065
|
+
function Ue(r, e) {
|
|
1066
|
+
const t = r[e];
|
|
1067
|
+
return t && t.results.length ? t.results[t.results.length - 1] : null;
|
|
1068
|
+
}
|
|
1069
|
+
function we(r, e, t, s, a) {
|
|
1070
|
+
const o = e[t];
|
|
1052
1071
|
if (!o) return null;
|
|
1053
1072
|
const n = /* @__PURE__ */ new Map();
|
|
1054
|
-
for (const
|
|
1055
|
-
if (
|
|
1056
|
-
const
|
|
1057
|
-
(!
|
|
1073
|
+
for (const c of r || []) {
|
|
1074
|
+
if (c.sport !== s || a && c.effectiveDate > a || c.gender && o.gender !== c.gender && o.gender !== "coed") continue;
|
|
1075
|
+
const d = c.gender || "", h = n.get(d);
|
|
1076
|
+
(!h || c.effectiveDate > h.effectiveDate) && n.set(d, c);
|
|
1058
1077
|
}
|
|
1059
1078
|
let i = null;
|
|
1060
|
-
for (const
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1079
|
+
for (const c of n.values()) {
|
|
1080
|
+
const d = (c.teamIds || []).indexOf(t);
|
|
1081
|
+
d !== -1 && (!i || c.effectiveDate > i.effectiveDate) && (i = { poll: c, rank: d + 1 });
|
|
1063
1082
|
}
|
|
1064
1083
|
return i ? i.rank : null;
|
|
1065
1084
|
}
|
|
1066
|
-
function
|
|
1067
|
-
if (!
|
|
1068
|
-
const s = (
|
|
1085
|
+
function is(r, e, t) {
|
|
1086
|
+
if (!r) return { kind: "none", delta: 0 };
|
|
1087
|
+
const s = (r.teamIds || []).indexOf(t) + 1;
|
|
1069
1088
|
if (!s) return { kind: "none", delta: 0 };
|
|
1070
|
-
if (!
|
|
1071
|
-
const
|
|
1072
|
-
if (!
|
|
1073
|
-
const o =
|
|
1089
|
+
if (!e) return { kind: "same", delta: 0 };
|
|
1090
|
+
const a = (e.teamIds || []).indexOf(t) + 1;
|
|
1091
|
+
if (!a) return { kind: "new", delta: 0 };
|
|
1092
|
+
const o = a - s;
|
|
1074
1093
|
return o > 0 ? { kind: "up", delta: o } : o < 0 ? { kind: "down", delta: -o } : { kind: "same", delta: 0 };
|
|
1075
1094
|
}
|
|
1076
|
-
function
|
|
1077
|
-
return /^https?:\/\//i.test(String(
|
|
1095
|
+
function ls(r) {
|
|
1096
|
+
return /^https?:\/\//i.test(String(r || ""));
|
|
1078
1097
|
}
|
|
1079
|
-
function
|
|
1080
|
-
if (!
|
|
1098
|
+
function rt(r, { w: e, h: t } = {}) {
|
|
1099
|
+
if (!ls(r)) return "";
|
|
1081
1100
|
const s = [];
|
|
1082
|
-
|
|
1083
|
-
const
|
|
1084
|
-
return `${
|
|
1101
|
+
e && s.push(`w=${Math.max(1, Math.round(e))}`), t && s.push(`h=${Math.max(1, Math.round(t))}`), s.push("f=webp");
|
|
1102
|
+
const a = r.includes("?") ? "&" : "?";
|
|
1103
|
+
return `${r}${a}${s.join("&")}`;
|
|
1085
1104
|
}
|
|
1086
|
-
function
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1105
|
+
function te(r, e) {
|
|
1106
|
+
const t = e * 2;
|
|
1107
|
+
return rt(r?.logoAssetId, { w: t, h: t });
|
|
1089
1108
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1109
|
+
function cs(r, e) {
|
|
1110
|
+
return rt(r?.photoAssetId, { w: e * 2 });
|
|
1092
1111
|
}
|
|
1093
|
-
function
|
|
1094
|
-
const o =
|
|
1095
|
-
return
|
|
1112
|
+
function le(r, e, { title: t, sub: s, teams: a }) {
|
|
1113
|
+
const o = tt(), i = !!r.querySelector(':scope > a[slot="nav"]') || Qt(o, e.hrefs, e.sport) !== null;
|
|
1114
|
+
return l`
|
|
1096
1115
|
<div class="band section">
|
|
1097
1116
|
<div class="inner">
|
|
1098
|
-
<h1>${
|
|
1099
|
-
${s ?
|
|
1117
|
+
<h1>${t}</h1>
|
|
1118
|
+
${s ? l`<p class="sub">${s}</p>` : m}
|
|
1100
1119
|
</div>
|
|
1101
|
-
${i ?
|
|
1102
|
-
<nav class="sectionnav" aria-label="${
|
|
1120
|
+
${i ? l`
|
|
1121
|
+
<nav class="sectionnav" aria-label="${k(e.sport)} section">
|
|
1103
1122
|
<div class="navrow">
|
|
1104
1123
|
<slot name="nav">
|
|
1105
|
-
${
|
|
1106
|
-
aria-current=${o &&
|
|
1124
|
+
${Zt(e.sport, a, e.hrefs).map((c) => l`<a href=${c.href}
|
|
1125
|
+
aria-current=${o && T(c.href) === o ? "page" : m}>${c.label}</a>`)}
|
|
1107
1126
|
</slot>
|
|
1108
1127
|
</div>
|
|
1109
1128
|
</nav>` : m}
|
|
1110
1129
|
</div>
|
|
1111
1130
|
`;
|
|
1112
1131
|
}
|
|
1113
|
-
const C = (
|
|
1114
|
-
const
|
|
1115
|
-
return
|
|
1116
|
-
}, R = (
|
|
1117
|
-
function
|
|
1118
|
-
if (!
|
|
1119
|
-
const
|
|
1120
|
-
if (
|
|
1121
|
-
return
|
|
1122
|
-
src=${
|
|
1123
|
-
const s =
|
|
1124
|
-
return
|
|
1125
|
-
style="width:${
|
|
1126
|
-
>${
|
|
1127
|
-
}
|
|
1128
|
-
function
|
|
1129
|
-
const s =
|
|
1130
|
-
return s ?
|
|
1131
|
-
}
|
|
1132
|
-
function
|
|
1133
|
-
const s = C(
|
|
1134
|
-
return s ?
|
|
1135
|
-
}
|
|
1136
|
-
function
|
|
1137
|
-
const s =
|
|
1138
|
-
if (!s || !s.results.length) return
|
|
1139
|
-
const
|
|
1140
|
-
return
|
|
1141
|
-
${
|
|
1142
|
-
title="${o.mark} ${o.my}-${o.their} vs ${R(
|
|
1143
|
-
href=${
|
|
1132
|
+
const C = (r, e) => {
|
|
1133
|
+
const t = r.teamsById[e];
|
|
1134
|
+
return t ? r.schoolsById[t.schoolId] : null;
|
|
1135
|
+
}, R = (r, e) => C(r, e)?.name || "TBD", se = (r, e) => C(r, e)?.abbr || "TBD";
|
|
1136
|
+
function P(r, e = 26) {
|
|
1137
|
+
if (!r) return m;
|
|
1138
|
+
const t = te(r, e);
|
|
1139
|
+
if (t)
|
|
1140
|
+
return l`<img class="swatch logo" aria-hidden="true" alt="" loading="lazy"
|
|
1141
|
+
src=${t} style="width:${e}px;height:${e}px" />`;
|
|
1142
|
+
const s = r.colorPrimary || "#030711", a = ee(s);
|
|
1143
|
+
return l`<span class="swatch" aria-hidden="true"
|
|
1144
|
+
style="width:${e}px;height:${e}px;background:${s};color:${a};font-size:${Math.max(8, e * 0.28)}px"
|
|
1145
|
+
>${be(r)}</span>`;
|
|
1146
|
+
}
|
|
1147
|
+
function xe(r, e, t) {
|
|
1148
|
+
const s = we(r.rankings, r.teamsById, e, r.sport, t);
|
|
1149
|
+
return s ? l`<span class="rankbadge">#${s}</span>` : m;
|
|
1150
|
+
}
|
|
1151
|
+
function re(r, e, t) {
|
|
1152
|
+
const s = C(r, e);
|
|
1153
|
+
return s ? l`${xe(r, e, t)}<a href=${g(r.hrefs.school, { id: s.id })}>${s.name}</a>` : l`<span class="mut">TBD</span>`;
|
|
1154
|
+
}
|
|
1155
|
+
function ke(r, e, t = 5) {
|
|
1156
|
+
const s = r.records[e];
|
|
1157
|
+
if (!s || !s.results.length) return l`<span class="mut">·</span>`;
|
|
1158
|
+
const a = s.results.slice(-1 * t);
|
|
1159
|
+
return l`<span class="dots" role="img" aria-label="last ${a.length} results">
|
|
1160
|
+
${a.map((o) => l`<a class="dot ${o.mark}"
|
|
1161
|
+
title="${o.mark} ${o.my}-${o.their} vs ${R(r, o.opp)}"
|
|
1162
|
+
href=${g(r.hrefs.game, { sport: r.sport, id: o.gameId })}>${o.mark}</a>`)}
|
|
1144
1163
|
</span>`;
|
|
1145
1164
|
}
|
|
1146
|
-
function
|
|
1147
|
-
return
|
|
1148
|
-
<div class="viewmain">${
|
|
1165
|
+
function B(r, e) {
|
|
1166
|
+
return r.querySelector(':scope > [slot="rail"]') ? l`<div class="view withrail">
|
|
1167
|
+
<div class="viewmain">${e}</div>
|
|
1149
1168
|
<aside class="viewrail"><slot name="rail"></slot></aside>
|
|
1150
|
-
</div>` :
|
|
1169
|
+
</div>` : l`<div class="view">${e}</div>`;
|
|
1151
1170
|
}
|
|
1152
|
-
function D(
|
|
1153
|
-
if (!
|
|
1154
|
-
const
|
|
1155
|
-
return
|
|
1171
|
+
function D(r) {
|
|
1172
|
+
if (!r.promoImage) return m;
|
|
1173
|
+
const e = l`<img src=${r.promoImage} alt=${r.promoAlt || "Sponsor"}>`;
|
|
1174
|
+
return l`<div class="promo">${r.promoHref ? l`<a href=${r.promoHref} target="_blank" rel="sponsored noopener">${e}</a>` : e}</div>`;
|
|
1156
1175
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const
|
|
1159
|
-
return
|
|
1176
|
+
function V(r) {
|
|
1177
|
+
const e = Je(r);
|
|
1178
|
+
return l`<span class="pill ${e.kind}">${e.label}</span>`;
|
|
1160
1179
|
}
|
|
1161
|
-
function
|
|
1162
|
-
if (!
|
|
1163
|
-
const s =
|
|
1164
|
-
return
|
|
1180
|
+
function at(r, e, t) {
|
|
1181
|
+
if (!e) return l`<span class="mut">·</span>`;
|
|
1182
|
+
const s = e.homeTeamId === t ? e.awayTeamId : e.homeTeamId, a = e.homeTeamId === t ? "vs" : "at";
|
|
1183
|
+
return l`${e.state === "live" ? l`<span class="pill live">Live</span> ` : l`${x(e.date, { month: "numeric", day: "numeric" })} `}${a} ${se(r, s)}`;
|
|
1165
1184
|
}
|
|
1166
|
-
class
|
|
1185
|
+
class ot extends y {
|
|
1167
1186
|
static styles = U;
|
|
1168
1187
|
static properties = {
|
|
1169
|
-
...
|
|
1188
|
+
...y.properties,
|
|
1170
1189
|
sport: { type: String },
|
|
1171
1190
|
season: { type: String },
|
|
1172
1191
|
date: { type: String }
|
|
@@ -1176,23 +1195,23 @@ class ee extends b {
|
|
|
1176
1195
|
}
|
|
1177
1196
|
connectedCallback() {
|
|
1178
1197
|
if (super.connectedCallback(), !this.date) {
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1198
|
+
const e = new URLSearchParams(globalThis.location?.search || "").get("date");
|
|
1199
|
+
e && (this.date = e);
|
|
1181
1200
|
}
|
|
1182
1201
|
this._datePinned = !!this.date;
|
|
1183
1202
|
}
|
|
1184
|
-
async fetchData(
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1203
|
+
async fetchData(e) {
|
|
1204
|
+
const t = this.season || K(), [s, a, o, n, i] = await Promise.all([
|
|
1205
|
+
e.listSchools(),
|
|
1206
|
+
e.listTeams({ sport: this.sport }),
|
|
1207
|
+
e.listConferences(),
|
|
1208
|
+
e.listGames({ sport: this.sport, season: t }),
|
|
1209
|
+
e.listRankings({ sport: this.sport })
|
|
1191
1210
|
]);
|
|
1192
|
-
return this._datePinned || (this.date =
|
|
1193
|
-
season:
|
|
1211
|
+
return this._datePinned || (this.date = jt(n.items.map((c) => c.date)), this._datePinned = !0), {
|
|
1212
|
+
season: t,
|
|
1194
1213
|
schools: s.items,
|
|
1195
|
-
teams:
|
|
1214
|
+
teams: a.items,
|
|
1196
1215
|
conferences: o.items,
|
|
1197
1216
|
games: n.items,
|
|
1198
1217
|
rankings: i.items
|
|
@@ -1200,39 +1219,39 @@ class ee extends b {
|
|
|
1200
1219
|
}
|
|
1201
1220
|
get ctx() {
|
|
1202
1221
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1203
|
-
teamsById:
|
|
1204
|
-
schoolsById:
|
|
1205
|
-
records:
|
|
1222
|
+
teamsById: b(this.data.teams),
|
|
1223
|
+
schoolsById: b(this.data.schools),
|
|
1224
|
+
records: Q(this.data.games),
|
|
1206
1225
|
rankings: this.data.rankings,
|
|
1207
1226
|
hrefs: O(this),
|
|
1208
1227
|
sport: this.sport
|
|
1209
1228
|
}, this._ctxData = this.data), this._ctx;
|
|
1210
1229
|
}
|
|
1211
1230
|
renderView() {
|
|
1212
|
-
const
|
|
1213
|
-
const
|
|
1214
|
-
return
|
|
1215
|
-
}, n = this.data.games.filter((
|
|
1216
|
-
n.sort((
|
|
1217
|
-
const
|
|
1218
|
-
return n.forEach((
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
}),
|
|
1222
|
-
${
|
|
1223
|
-
title:
|
|
1224
|
-
sub:
|
|
1231
|
+
const e = this.ctx, t = b(this.data.conferences), s = [...new Set(this.data.games.map((d) => d.date).filter(Boolean))].sort(), a = Number.MAX_SAFE_INTEGER, o = (d) => {
|
|
1232
|
+
const h = [d.awayTeamId, d.homeTeamId].map((p) => we(e.rankings, e.teamsById, p, this.sport, d.date)).filter(Boolean);
|
|
1233
|
+
return h.length ? Math.min(...h) : a;
|
|
1234
|
+
}, n = this.data.games.filter((d) => d.date === this.date), i = new Map(n.map((d) => [d, o(d)]));
|
|
1235
|
+
n.sort((d, h) => (d.state === "live" ? 0 : 1) - (h.state === "live" ? 0 : 1) || i.get(d) - i.get(h));
|
|
1236
|
+
const c = /* @__PURE__ */ new Map();
|
|
1237
|
+
return n.forEach((d) => {
|
|
1238
|
+
const h = d.gameType === "conference" && d.conferenceId ? t[d.conferenceId]?.name || "Conference" : d.gameType === "playoff" ? "Playoffs" : d.gameType === "scrimmage" ? "Scrimmages" : "Nonconference";
|
|
1239
|
+
c.has(h) || c.set(h, []), c.get(h).push(d);
|
|
1240
|
+
}), l`
|
|
1241
|
+
${le(this, e, {
|
|
1242
|
+
title: l`${k(this.sport)} scores & schedules`,
|
|
1243
|
+
sub: l`${x(this.date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })} · ${n.length} games`,
|
|
1225
1244
|
teams: this.data.teams
|
|
1226
1245
|
})}
|
|
1227
|
-
${
|
|
1246
|
+
${B(this, l`
|
|
1228
1247
|
${D(this)}
|
|
1229
1248
|
<div class="toolbar">
|
|
1230
1249
|
<label class="asof" for="datesel">Date</label>
|
|
1231
|
-
<select id="datesel" @change=${(
|
|
1232
|
-
this.date =
|
|
1250
|
+
<select id="datesel" @change=${(d) => {
|
|
1251
|
+
this.date = d.target.value;
|
|
1233
1252
|
}}>
|
|
1234
|
-
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((
|
|
1235
|
-
${
|
|
1253
|
+
${(s.includes(this.date) ? s : [...s, this.date].sort()).map((d) => l`<option value=${d} ?selected=${d === this.date}>
|
|
1254
|
+
${x(d, { weekday: "short", month: "short", day: "numeric" })}${d === $e() ? " · today" : ""}
|
|
1236
1255
|
</option>`)}
|
|
1237
1256
|
</select>
|
|
1238
1257
|
<button class="chip" ?disabled=${s.indexOf(this.date) <= 0}
|
|
@@ -1244,13 +1263,13 @@ class ee extends b {
|
|
|
1244
1263
|
this.date = s[s.indexOf(this.date) + 1];
|
|
1245
1264
|
}}>Next →</button>
|
|
1246
1265
|
<span class="spacer"></span>
|
|
1247
|
-
<span class="asof">Live games first · report a score to see it update here</span>
|
|
1266
|
+
<span class="asof">Live games first · <a href=${Ze(e.hrefs)}>report a score</a> to see it update here</span>
|
|
1248
1267
|
</div>
|
|
1249
|
-
${n.length ? m :
|
|
1250
|
-
${[...
|
|
1251
|
-
<div class="section-title">${
|
|
1268
|
+
${n.length ? m : l`<p class="empty">No ${this.sport} games on this date.</p>`}
|
|
1269
|
+
${[...c.entries()].map(([d, h]) => l`
|
|
1270
|
+
<div class="section-title">${d}</div>
|
|
1252
1271
|
<div class="card"><ul class="gamelist">
|
|
1253
|
-
${
|
|
1272
|
+
${h.map((p) => this.renderGame(e, p))}
|
|
1254
1273
|
</ul></div>
|
|
1255
1274
|
`)}
|
|
1256
1275
|
`)}
|
|
@@ -1259,97 +1278,129 @@ class ee extends b {
|
|
|
1259
1278
|
// Each team's score rides in a block beside its name (reader feedback:
|
|
1260
1279
|
// a lone score column on the far right read as detached from the teams).
|
|
1261
1280
|
// Scheduled games carry their start time on the status pill alone.
|
|
1262
|
-
renderGame(
|
|
1263
|
-
const s =
|
|
1264
|
-
return
|
|
1281
|
+
renderGame(e, t) {
|
|
1282
|
+
const s = t.state === "final" || t.state === "live", a = (n, i, c = m) => l`<span class="side">${re(e, n, t.date)}${s ? l`<span class="score">${i}</span>` : m}${c}</span>`, o = ns(t);
|
|
1283
|
+
return l`
|
|
1265
1284
|
<li>
|
|
1266
|
-
${
|
|
1267
|
-
<span class="opp matchup">${
|
|
1268
|
-
${o ?
|
|
1269
|
-
<span class="where">${
|
|
1270
|
-
${
|
|
1271
|
-
<a class="box" href=${
|
|
1285
|
+
${V(t)}
|
|
1286
|
+
<span class="opp matchup">${a(t.awayTeamId, t.awayScore, l`<span class="at">at</span>`)}${a(t.homeTeamId, t.homeScore)}</span>
|
|
1287
|
+
${o ? l`<span class="ff">${R(e, o === "home" ? t.homeTeamId : t.awayTeamId)} forfeited</span>` : m}
|
|
1288
|
+
<span class="where">${t.venue || ""}</span>
|
|
1289
|
+
${t.broadcast ? l`<span class="pill class">${t.broadcast}</span>` : m}
|
|
1290
|
+
<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score →</a>
|
|
1272
1291
|
</li>
|
|
1273
1292
|
`;
|
|
1274
1293
|
}
|
|
1275
1294
|
}
|
|
1276
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores",
|
|
1277
|
-
class
|
|
1295
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-scores") && globalThis.customElements.define("hsot-scores", ot);
|
|
1296
|
+
class nt extends y {
|
|
1278
1297
|
static styles = U;
|
|
1279
1298
|
static properties = {
|
|
1280
|
-
...
|
|
1299
|
+
...y.properties,
|
|
1281
1300
|
sport: { type: String },
|
|
1301
|
+
gender: { type: String },
|
|
1282
1302
|
season: { type: String },
|
|
1283
1303
|
classFilter: { state: !0 },
|
|
1284
|
-
query: { state: !0 }
|
|
1304
|
+
query: { state: !0 },
|
|
1305
|
+
pickedGender: { state: !0 }
|
|
1285
1306
|
};
|
|
1286
1307
|
constructor() {
|
|
1287
|
-
super(), this.sport = "football", this.season = "", this.classFilter = "All", this.query = "";
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1308
|
+
super(), this.sport = "football", this.gender = "", this.season = "", this.classFilter = "All", this.query = "", this.pickedGender = "";
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* The side the table shows: the pinned `gender`, else the reader's pick,
|
|
1312
|
+
* else the first side fielded. '' only for a sport with one side, where
|
|
1313
|
+
* there is nothing to scope.
|
|
1314
|
+
*/
|
|
1315
|
+
get viewGender() {
|
|
1316
|
+
if (this.gender) return this.gender;
|
|
1317
|
+
const e = he(this.data?.teams);
|
|
1318
|
+
return e.length < 2 ? "" : e.includes(this.pickedGender) ? this.pickedGender : e[0];
|
|
1319
|
+
}
|
|
1320
|
+
async fetchData(e) {
|
|
1321
|
+
const t = this.season || K(), [s, a, o, n, i] = await Promise.all([
|
|
1322
|
+
e.listConferences({ active: !0 }),
|
|
1323
|
+
e.listSchools(),
|
|
1324
|
+
// Deliberately NOT gender-filtered: the sub-nav decides whether to
|
|
1325
|
+
// offer Boys/Girls standings from the sides the sport fields, so it
|
|
1326
|
+
// needs the whole sport. The table filters below.
|
|
1327
|
+
e.listTeams({ sport: this.sport }),
|
|
1328
|
+
// Games carry no gender (it lives on the team they are played by),
|
|
1329
|
+
// so this stays the sport's season. Records key off team ids, and a
|
|
1330
|
+
// team only appears in its own side's games.
|
|
1331
|
+
e.listGames({ sport: this.sport, season: t }),
|
|
1332
|
+
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} })
|
|
1296
1333
|
]);
|
|
1297
1334
|
return {
|
|
1298
|
-
season:
|
|
1335
|
+
season: t,
|
|
1299
1336
|
conferences: s.items,
|
|
1300
|
-
schools:
|
|
1337
|
+
schools: a.items,
|
|
1301
1338
|
teams: o.items,
|
|
1302
1339
|
games: n.items,
|
|
1303
1340
|
rankings: i.items
|
|
1304
1341
|
};
|
|
1305
1342
|
}
|
|
1306
1343
|
get ctx() {
|
|
1307
|
-
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1308
|
-
teamsById:
|
|
1309
|
-
schoolsById:
|
|
1310
|
-
records:
|
|
1344
|
+
return (!this._ctx || this._ctxData !== this.data || this._ctxGender !== this.viewGender) && (this._ctx = {
|
|
1345
|
+
teamsById: b(this.data.teams),
|
|
1346
|
+
schoolsById: b(this.data.schools),
|
|
1347
|
+
records: Q(this.data.games),
|
|
1311
1348
|
rankings: this.data.rankings,
|
|
1312
1349
|
hrefs: O(this),
|
|
1313
|
-
sport: this.sport
|
|
1314
|
-
|
|
1350
|
+
sport: this.sport,
|
|
1351
|
+
// The teams this view stands for — one side of a gendered
|
|
1352
|
+
// sport, or all of them when the sport fields only one.
|
|
1353
|
+
teams: et(this.data.teams, this.viewGender)
|
|
1354
|
+
}, this._ctxData = this.data, this._ctxGender = this.viewGender), this._ctx;
|
|
1315
1355
|
}
|
|
1316
1356
|
renderView() {
|
|
1317
|
-
const
|
|
1318
|
-
return
|
|
1319
|
-
${
|
|
1320
|
-
title:
|
|
1321
|
-
sub:
|
|
1357
|
+
const e = this.ctx, t = this.viewGender, s = this.gender ? [] : he(this.data.teams), a = ["All", ...[...new Set(this.data.conferences.flatMap((n) => n.classifications || []))].sort(Me)].slice(0, 9), o = this.data.conferences.filter((n) => n.active !== !1).filter((n) => this.classFilter === "All" || (n.classifications || []).includes(this.classFilter)).sort(Wt);
|
|
1358
|
+
return l`
|
|
1359
|
+
${le(this, e, {
|
|
1360
|
+
title: l`${t ? `${k(t)} ` : ""}${k(this.sport)} standings`,
|
|
1361
|
+
sub: l`${this.data.season} season · every conference, computed live from reported results`,
|
|
1362
|
+
// The WHOLE sport, not this view's side: the sub-nav offers the
|
|
1363
|
+
// Boys/Girls split only when both are fielded, and a
|
|
1364
|
+
// gender-scoped list would always look like one side.
|
|
1322
1365
|
teams: this.data.teams
|
|
1323
1366
|
})}
|
|
1324
|
-
${
|
|
1367
|
+
${B(this, l`
|
|
1325
1368
|
${D(this)}
|
|
1326
1369
|
<div class="toolbar">
|
|
1370
|
+
${s.length === 2 ? l`
|
|
1371
|
+
<div role="group" aria-label="Boys or girls standings">
|
|
1372
|
+
${s.map((n) => l`<button class="chip ${t === n ? "on" : ""}"
|
|
1373
|
+
aria-pressed=${t === n ? "true" : "false"}
|
|
1374
|
+
@click=${() => {
|
|
1375
|
+
this.pickedGender = n;
|
|
1376
|
+
}}>${k(n)}</button>`)}
|
|
1377
|
+
</div>` : m}
|
|
1327
1378
|
<div role="group" aria-label="Classification filter">
|
|
1328
|
-
${
|
|
1379
|
+
${a.map((n) => l`<button class="chip ${this.classFilter === n ? "on" : ""}"
|
|
1329
1380
|
@click=${() => {
|
|
1330
|
-
this.classFilter =
|
|
1331
|
-
}}>${
|
|
1381
|
+
this.classFilter = n;
|
|
1382
|
+
}}>${n}</button>`)}
|
|
1332
1383
|
</div>
|
|
1333
1384
|
<input type="search" placeholder="Find a school…" aria-label="Find a school"
|
|
1334
|
-
.value=${this.query} @input=${(
|
|
1335
|
-
this.query =
|
|
1385
|
+
.value=${this.query} @input=${(n) => {
|
|
1386
|
+
this.query = n.target.value;
|
|
1336
1387
|
}}>
|
|
1337
1388
|
<span class="spacer"></span>
|
|
1338
|
-
<span class="asof">Records through ${
|
|
1389
|
+
<span class="asof">Records through ${x($e(), { month: "long", day: "numeric" })} · conference games count toward both records · scrimmages toward neither</span>
|
|
1339
1390
|
</div>
|
|
1340
|
-
${
|
|
1391
|
+
${o.map((n) => this.renderConference(e, n))}
|
|
1341
1392
|
`)}
|
|
1342
1393
|
`;
|
|
1343
1394
|
}
|
|
1344
|
-
renderConference(
|
|
1345
|
-
const s =
|
|
1395
|
+
renderConference(e, t) {
|
|
1396
|
+
const s = e.teams.filter((n) => n.conferenceId === t.id);
|
|
1346
1397
|
if (!s.length) return m;
|
|
1347
|
-
const
|
|
1348
|
-
return
|
|
1398
|
+
const a = this.query.trim().toLowerCase(), o = st(s, e.records);
|
|
1399
|
+
return l`
|
|
1349
1400
|
<div class="card">
|
|
1350
1401
|
<div class="card-head">
|
|
1351
|
-
<h2>${
|
|
1352
|
-
${[...
|
|
1402
|
+
<h2>${t.name}</h2>
|
|
1403
|
+
${[...t.classifications || []].sort(Me).map((n) => l`<span class="pill class">${n}</span>`)}
|
|
1353
1404
|
<span class="meta">${o.length} teams · membership derives from teams</span>
|
|
1354
1405
|
</div>
|
|
1355
1406
|
<div class="tablewrap"><table class="data">
|
|
@@ -1359,43 +1410,43 @@ class se extends b {
|
|
|
1359
1410
|
<th>Streak</th><th>Last 5</th><th>Next</th>
|
|
1360
1411
|
</tr></thead>
|
|
1361
1412
|
<tbody>
|
|
1362
|
-
${o.map((n, i) => this.renderRow(
|
|
1413
|
+
${o.map((n, i) => this.renderRow(e, n, i, a))}
|
|
1363
1414
|
</tbody>
|
|
1364
1415
|
</table></div>
|
|
1365
1416
|
</div>
|
|
1366
1417
|
`;
|
|
1367
1418
|
}
|
|
1368
|
-
renderRow(
|
|
1369
|
-
const o =
|
|
1370
|
-
if (
|
|
1371
|
-
const i =
|
|
1372
|
-
location.href =
|
|
1419
|
+
renderRow(e, t, s, a) {
|
|
1420
|
+
const o = e.schoolsById[t.team.schoolId], n = o?.name || t.team.name || "TBD";
|
|
1421
|
+
if (a && !n.toLowerCase().includes(a)) return m;
|
|
1422
|
+
const i = t.rec.pf - t.rec.pa, c = ye(this.data.games, t.team.id), d = () => {
|
|
1423
|
+
location.href = g(e.hrefs.school, { id: t.team.schoolId });
|
|
1373
1424
|
};
|
|
1374
|
-
return
|
|
1375
|
-
<tr class="rowlink" @click=${(
|
|
1376
|
-
|
|
1425
|
+
return l`
|
|
1426
|
+
<tr class="rowlink" @click=${(h) => {
|
|
1427
|
+
h.target.closest("a") || d();
|
|
1377
1428
|
}}>
|
|
1378
1429
|
<td class="mut">${s + 1}</td>
|
|
1379
1430
|
<td class="teamcell">
|
|
1380
|
-
${
|
|
1381
|
-
<a href=${
|
|
1431
|
+
${P(o)}${xe(e, t.team.id, null)}
|
|
1432
|
+
<a href=${g(e.hrefs.school, { id: t.team.schoolId })}>${n}</a>
|
|
1382
1433
|
</td>
|
|
1383
|
-
<td class="num">${
|
|
1384
|
-
<td class="num">${
|
|
1385
|
-
<td class="num">${
|
|
1386
|
-
<td class="num">${
|
|
1387
|
-
<td class="num">${
|
|
1388
|
-
<td class="num">${
|
|
1434
|
+
<td class="num">${S(t.rec, !0)}</td>
|
|
1435
|
+
<td class="num">${Oe(t.confPct)}</td>
|
|
1436
|
+
<td class="num">${S(t.rec)}</td>
|
|
1437
|
+
<td class="num">${Oe(t.overallPct)}</td>
|
|
1438
|
+
<td class="num">${t.rec.pf}</td>
|
|
1439
|
+
<td class="num">${t.rec.pa}</td>
|
|
1389
1440
|
<td class="num" style="color:${i >= 0 ? "var(--hsot-win)" : "var(--hsot-loss)"}">${i > 0 ? "+" : ""}${i}</td>
|
|
1390
|
-
<td>${
|
|
1391
|
-
<td>${
|
|
1392
|
-
<td>${
|
|
1441
|
+
<td>${ie(t.rec.results) || "·"}</td>
|
|
1442
|
+
<td>${ke(e, t.team.id)}</td>
|
|
1443
|
+
<td>${at(e, c, t.team.id)}</td>
|
|
1393
1444
|
</tr>
|
|
1394
1445
|
`;
|
|
1395
1446
|
}
|
|
1396
1447
|
}
|
|
1397
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings",
|
|
1398
|
-
const
|
|
1448
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-standings") && globalThis.customElements.define("hsot-standings", nt);
|
|
1449
|
+
const ds = w`
|
|
1399
1450
|
.hero1 {
|
|
1400
1451
|
border-radius: var(--hsot-radius-md); color: var(--hsot-white);
|
|
1401
1452
|
padding: 1.3rem 1.4rem; display: flex; align-items: center; gap: 1.2rem;
|
|
@@ -1412,10 +1463,10 @@ const rs = y`
|
|
|
1412
1463
|
.delta.new { background: var(--hsot-straw); color: #6b5900; border-radius: var(--hsot-radius-xs); padding: 0.1rem 0.3rem; font-size: 0.7rem; }
|
|
1413
1464
|
.sparkline { vertical-align: middle; }
|
|
1414
1465
|
`;
|
|
1415
|
-
class
|
|
1416
|
-
static styles = [...U,
|
|
1466
|
+
class it extends y {
|
|
1467
|
+
static styles = [...U, ds];
|
|
1417
1468
|
static properties = {
|
|
1418
|
-
...
|
|
1469
|
+
...y.properties,
|
|
1419
1470
|
sport: { type: String },
|
|
1420
1471
|
gender: { type: String },
|
|
1421
1472
|
season: { type: String },
|
|
@@ -1426,21 +1477,21 @@ class ae extends b {
|
|
|
1426
1477
|
}
|
|
1427
1478
|
connectedCallback() {
|
|
1428
1479
|
super.connectedCallback();
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1431
|
-
}
|
|
1432
|
-
async fetchData(
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
]),
|
|
1480
|
+
const e = new URLSearchParams(globalThis.location?.search || "").get("poll");
|
|
1481
|
+
e && (this.pollDate = e);
|
|
1482
|
+
}
|
|
1483
|
+
async fetchData(e) {
|
|
1484
|
+
const t = this.season || K(), [s, a, o, n, i] = await Promise.all([
|
|
1485
|
+
e.listRankings({ sport: this.sport, ...this.gender ? { gender: this.gender } : {} }),
|
|
1486
|
+
e.listSchools(),
|
|
1487
|
+
e.listTeams({ sport: this.sport }),
|
|
1488
|
+
e.listConferences(),
|
|
1489
|
+
e.listGames({ sport: this.sport, season: t })
|
|
1490
|
+
]), c = s.items.filter((d) => !this.gender || !d.gender || d.gender === this.gender).sort((d, h) => h.effectiveDate.localeCompare(d.effectiveDate));
|
|
1440
1491
|
return {
|
|
1441
|
-
season:
|
|
1442
|
-
polls:
|
|
1443
|
-
schools:
|
|
1492
|
+
season: t,
|
|
1493
|
+
polls: c,
|
|
1494
|
+
schools: a.items,
|
|
1444
1495
|
teams: o.items,
|
|
1445
1496
|
conferences: n.items,
|
|
1446
1497
|
games: i.items
|
|
@@ -1448,127 +1499,127 @@ class ae extends b {
|
|
|
1448
1499
|
}
|
|
1449
1500
|
get ctx() {
|
|
1450
1501
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1451
|
-
teamsById:
|
|
1452
|
-
schoolsById:
|
|
1453
|
-
records:
|
|
1502
|
+
teamsById: b(this.data.teams),
|
|
1503
|
+
schoolsById: b(this.data.schools),
|
|
1504
|
+
records: Q(this.data.games),
|
|
1454
1505
|
rankings: this.data.polls,
|
|
1455
1506
|
hrefs: O(this),
|
|
1456
1507
|
sport: this.sport
|
|
1457
1508
|
}, this._ctxData = this.data), this._ctx;
|
|
1458
1509
|
}
|
|
1459
|
-
sparkline(
|
|
1460
|
-
const i =
|
|
1461
|
-
const f = (p.teamIds || []).indexOf(
|
|
1510
|
+
sparkline(e, t, s) {
|
|
1511
|
+
const i = t.map((p, u) => {
|
|
1512
|
+
const f = (p.teamIds || []).indexOf(e);
|
|
1462
1513
|
if (f === -1) return null;
|
|
1463
|
-
const
|
|
1464
|
-
return { x:
|
|
1465
|
-
}),
|
|
1466
|
-
let
|
|
1514
|
+
const v = t.length === 1 ? 96 / 2 : u / (t.length - 1) * 90 + 3, $ = 3 + f / 24 * 20;
|
|
1515
|
+
return { x: v, y: $ };
|
|
1516
|
+
}), c = [];
|
|
1517
|
+
let d = [];
|
|
1467
1518
|
if (i.forEach((p) => {
|
|
1468
|
-
p ?
|
|
1469
|
-
}),
|
|
1470
|
-
const
|
|
1471
|
-
return
|
|
1472
|
-
${
|
|
1519
|
+
p ? d.push(p) : d.length && (c.push(d), d = []);
|
|
1520
|
+
}), d.length && c.push(d), !c.length) return m;
|
|
1521
|
+
const h = i[s];
|
|
1522
|
+
return l`<svg class="sparkline" width=${96} height=${26} viewBox="0 0 ${96} ${26}" role="img" aria-label="rank history">
|
|
1523
|
+
${c.map((p) => Re`<polyline fill="none" stroke="var(--hsot-red)" stroke-width="2"
|
|
1473
1524
|
points=${p.map((u) => `${u.x.toFixed(1)},${u.y.toFixed(1)}`).join(" ")}></polyline>`)}
|
|
1474
|
-
${
|
|
1525
|
+
${h ? Re`<circle cx=${h.x.toFixed(1)} cy=${h.y.toFixed(1)} r="3" fill="var(--hsot-black)"></circle>` : m}
|
|
1475
1526
|
</svg>`;
|
|
1476
1527
|
}
|
|
1477
|
-
movement(
|
|
1478
|
-
const
|
|
1479
|
-
return
|
|
1528
|
+
movement(e, t, s) {
|
|
1529
|
+
const a = is(e, t, s);
|
|
1530
|
+
return a.kind === "up" ? l`<span class="delta up">▲ ${a.delta}</span>` : a.kind === "down" ? l`<span class="delta down">▼ ${a.delta}</span>` : a.kind === "new" ? l`<span class="delta new">NEW</span>` : a.kind === "same" ? l`<span class="delta same">—</span>` : l`<span class="delta same">·</span>`;
|
|
1480
1531
|
}
|
|
1481
1532
|
renderView() {
|
|
1482
|
-
const
|
|
1483
|
-
if (!
|
|
1484
|
-
const s = Math.max(0,
|
|
1485
|
-
return
|
|
1486
|
-
${
|
|
1487
|
-
title:
|
|
1488
|
-
sub:
|
|
1533
|
+
const e = this.ctx, t = this.data.polls;
|
|
1534
|
+
if (!t.length) return l`<div class="view"><p class="empty">No ${this.sport} polls published yet this season.</p></div>`;
|
|
1535
|
+
const s = Math.max(0, t.findIndex((p) => p.effectiveDate === this.pollDate)), a = t[s] || t[0], o = t[s + 1] || null, n = t.slice().reverse(), i = n.indexOf(a), c = b(this.data.conferences), d = (a.teamIds || [])[0], h = d ? C(e, d) : null;
|
|
1536
|
+
return l`
|
|
1537
|
+
${le(this, e, {
|
|
1538
|
+
title: l`${k(this.sport)} Top 25`,
|
|
1539
|
+
sub: l`The HighSchoolOT poll · updated weekly · ${t.length} polls this season`,
|
|
1489
1540
|
teams: this.data.teams
|
|
1490
1541
|
})}
|
|
1491
|
-
${
|
|
1542
|
+
${B(this, l`
|
|
1492
1543
|
${D(this)}
|
|
1493
1544
|
<div class="toolbar">
|
|
1494
1545
|
<label class="asof" for="pollsel">Poll of</label>
|
|
1495
1546
|
<select id="pollsel" @change=${(p) => {
|
|
1496
1547
|
this.pollDate = p.target.value;
|
|
1497
1548
|
}}>
|
|
1498
|
-
${
|
|
1499
|
-
${
|
|
1549
|
+
${t.map((p, u) => l`<option value=${p.effectiveDate} ?selected=${p === a}>
|
|
1550
|
+
${x(p.effectiveDate, { month: "long", day: "numeric", year: "numeric" })}${u === 0 ? " · current" : ""}
|
|
1500
1551
|
</option>`)}
|
|
1501
1552
|
</select>
|
|
1502
|
-
<button class="chip" ?disabled=${s >=
|
|
1553
|
+
<button class="chip" ?disabled=${s >= t.length - 1}
|
|
1503
1554
|
@click=${() => {
|
|
1504
|
-
this.pollDate =
|
|
1555
|
+
this.pollDate = t[s + 1].effectiveDate;
|
|
1505
1556
|
}}>← Older</button>
|
|
1506
1557
|
<button class="chip" ?disabled=${s <= 0}
|
|
1507
1558
|
@click=${() => {
|
|
1508
|
-
this.pollDate =
|
|
1559
|
+
this.pollDate = t[s - 1].effectiveDate;
|
|
1509
1560
|
}}>Newer →</button>
|
|
1510
1561
|
<span class="spacer"></span>
|
|
1511
1562
|
<span class="asof">Movement vs. the previous poll · sparkline = season rank history</span>
|
|
1512
1563
|
</div>
|
|
1513
|
-
${
|
|
1564
|
+
${h ? this.renderHero(e, a, o, d, h, c) : m}
|
|
1514
1565
|
<div class="card"><div class="tablewrap"><table class="data">
|
|
1515
1566
|
<thead><tr>
|
|
1516
1567
|
<th class="num">Rk</th><th>Mvmt</th><th>Team</th><th class="num">Record</th>
|
|
1517
1568
|
<th>Conference</th><th>Last result</th><th>Next</th><th>Season</th>
|
|
1518
1569
|
</tr></thead>
|
|
1519
1570
|
<tbody>
|
|
1520
|
-
${(
|
|
1571
|
+
${(a.teamIds || []).map((p, u) => u === 0 || !p ? m : this.renderRow(e, a, o, n, i, c, p, u + 1))}
|
|
1521
1572
|
</tbody>
|
|
1522
1573
|
</table></div></div>
|
|
1523
1574
|
<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>
|
|
1524
1575
|
`)}
|
|
1525
1576
|
`;
|
|
1526
1577
|
}
|
|
1527
|
-
renderHero(
|
|
1528
|
-
const i =
|
|
1529
|
-
return
|
|
1530
|
-
<div class="hero1" style="background:${
|
|
1578
|
+
renderHero(e, t, s, a, o, n) {
|
|
1579
|
+
const i = e.records[a], c = Ue(e.records, a), d = n[e.teamsById[a]?.conferenceId], h = `linear-gradient(120deg, ${o.colorPrimary || "#030711"} 0%, var(--hsot-black) 85%)`;
|
|
1580
|
+
return l`
|
|
1581
|
+
<div class="hero1" style="background:${h}">
|
|
1531
1582
|
<div class="bigrank">#1</div>
|
|
1532
|
-
${
|
|
1583
|
+
${P(o, 64)}
|
|
1533
1584
|
<div>
|
|
1534
|
-
<h2><a href=${
|
|
1585
|
+
<h2><a href=${g(e.hrefs.school, { id: o.id })}>${o.name} ${o.mascot || ""}</a></h2>
|
|
1535
1586
|
<div class="facts">
|
|
1536
|
-
${
|
|
1537
|
-
· streak ${
|
|
1538
|
-
${
|
|
1539
|
-
${this.movement(
|
|
1587
|
+
${S(i)} overall${d ? l` · ${S(i, !0)} ${d.name}` : m}
|
|
1588
|
+
· streak ${ie(i?.results) || "·"}
|
|
1589
|
+
${c ? l` · last: ${c.mark} ${c.my}-${c.their} vs ${se(e, c.opp)}` : m}
|
|
1590
|
+
${this.movement(t, s, a)}
|
|
1540
1591
|
</div>
|
|
1541
1592
|
</div>
|
|
1542
1593
|
</div>
|
|
1543
1594
|
`;
|
|
1544
1595
|
}
|
|
1545
|
-
renderRow(
|
|
1546
|
-
const
|
|
1547
|
-
if (!
|
|
1548
|
-
const
|
|
1549
|
-
location.href =
|
|
1596
|
+
renderRow(e, t, s, a, o, n, i, c) {
|
|
1597
|
+
const d = C(e, i);
|
|
1598
|
+
if (!d) return m;
|
|
1599
|
+
const h = e.records[i], p = Ue(e.records, i), u = ye(this.data.games, i), f = n[e.teamsById[i]?.conferenceId], v = () => {
|
|
1600
|
+
location.href = g(e.hrefs.school, { id: d.id });
|
|
1550
1601
|
};
|
|
1551
|
-
return
|
|
1552
|
-
<tr class="rowlink" @click=${(
|
|
1553
|
-
|
|
1602
|
+
return l`
|
|
1603
|
+
<tr class="rowlink" @click=${($) => {
|
|
1604
|
+
$.target.closest("a") || v();
|
|
1554
1605
|
}}>
|
|
1555
|
-
<td class="num" style="font-weight:700">${
|
|
1556
|
-
<td>${this.movement(
|
|
1557
|
-
<td class="teamcell">${
|
|
1558
|
-
<span class="mut" style="font-size:0.78rem">${
|
|
1559
|
-
<td class="num">${
|
|
1606
|
+
<td class="num" style="font-weight:700">${c}</td>
|
|
1607
|
+
<td>${this.movement(t, s, i)}</td>
|
|
1608
|
+
<td class="teamcell">${P(d)}<a href=${g(e.hrefs.school, { id: d.id })}>${d.name}</a>
|
|
1609
|
+
<span class="mut" style="font-size:0.78rem">${d.mascot || ""}</span></td>
|
|
1610
|
+
<td class="num">${S(h)}</td>
|
|
1560
1611
|
<td class="mut">${f?.name || "Independent"}</td>
|
|
1561
|
-
<td>${p ?
|
|
1612
|
+
<td>${p ? l`<a class="box" style="text-decoration:none" href=${g(e.hrefs.game, { sport: this.sport, id: p.gameId })}>
|
|
1562
1613
|
<b style="color:${p.mark === "W" ? "var(--hsot-win)" : p.mark === "L" ? "var(--hsot-loss)" : "var(--hsot-tie)"}">${p.mark}</b>
|
|
1563
|
-
${p.my}-${p.their} vs ${
|
|
1564
|
-
<td>${
|
|
1565
|
-
<td>${this.sparkline(i,
|
|
1614
|
+
${p.my}-${p.their} vs ${se(e, p.opp)}</a>` : l`<span class="mut">·</span>`}</td>
|
|
1615
|
+
<td>${at(e, u, i)}</td>
|
|
1616
|
+
<td>${this.sparkline(i, a, o)}</td>
|
|
1566
1617
|
</tr>
|
|
1567
1618
|
`;
|
|
1568
1619
|
}
|
|
1569
1620
|
}
|
|
1570
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings",
|
|
1571
|
-
const
|
|
1621
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-rankings") && globalThis.customElements.define("hsot-rankings", it);
|
|
1622
|
+
const hs = w`
|
|
1572
1623
|
.schoolhero { color: var(--hsot-white); padding: 1.6rem 1.25rem 1.3rem; }
|
|
1573
1624
|
.schoolhero .inner { max-width: 1366px; margin: 0 auto; display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
|
|
1574
1625
|
.schoolhero .crest {
|
|
@@ -1622,173 +1673,179 @@ const os = y`
|
|
|
1622
1673
|
table.data.roster .sub { display: block; font-weight: 400; font-size: 0.78rem; color: var(--hsot-gray-5); }
|
|
1623
1674
|
}
|
|
1624
1675
|
`;
|
|
1625
|
-
class
|
|
1626
|
-
static styles = [...U,
|
|
1676
|
+
class lt extends y {
|
|
1677
|
+
static styles = [...U, hs];
|
|
1627
1678
|
static properties = {
|
|
1628
|
-
...
|
|
1679
|
+
...y.properties,
|
|
1629
1680
|
schoolId: { type: String, attribute: "school-id" },
|
|
1630
1681
|
sport: { type: String },
|
|
1682
|
+
gender: { type: String },
|
|
1631
1683
|
season: { type: String },
|
|
1632
1684
|
activeTeamId: { state: !0 }
|
|
1633
1685
|
};
|
|
1634
1686
|
constructor() {
|
|
1635
|
-
super(), this.schoolId = "", this.sport = "", this.season = "", this.activeTeamId = "";
|
|
1687
|
+
super(), this.schoolId = "", this.sport = "", this.gender = "", this.season = "", this.activeTeamId = "";
|
|
1636
1688
|
}
|
|
1637
1689
|
connectedCallback() {
|
|
1638
1690
|
super.connectedCallback();
|
|
1639
|
-
const
|
|
1640
|
-
t && !this.sport && (this.sport = t);
|
|
1641
|
-
}
|
|
1642
|
-
async fetchData(
|
|
1643
|
-
const
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1691
|
+
const e = new URLSearchParams(globalThis.location?.search || ""), t = e.get("sport"), s = e.get("gender");
|
|
1692
|
+
t && !this.sport && (this.sport = t), s && !this.gender && (this.gender = s);
|
|
1693
|
+
}
|
|
1694
|
+
async fetchData(e) {
|
|
1695
|
+
const t = this.season || K(), s = await e.getSchool(this.schoolId), o = (await e.listTeams({ schoolId: this.schoolId })).items, n = this.sport || "football", i = o.find(($) => $.id === this.activeTeamId) || o.find(($) => $.sport === n && Xe($, this.gender)) || o.find(($) => $.sport === n) || o[0] || null, [c, d, h, p, u, f, v] = await Promise.all([
|
|
1696
|
+
i ? e.listGames({ sport: i.sport, season: t }) : Promise.resolve({ items: [] }),
|
|
1697
|
+
i ? e.listTeams({ sport: i.sport }) : Promise.resolve({ items: [] }),
|
|
1698
|
+
e.listSchools(),
|
|
1699
|
+
e.listConferences(),
|
|
1700
|
+
i ? e.listRankings({ sport: i.sport }) : Promise.resolve({ items: [] }),
|
|
1701
|
+
i ? e.listRosters({ teamId: i.id }) : Promise.resolve({ items: [] }),
|
|
1650
1702
|
// teamId is the public surface's one players filter (roster
|
|
1651
1703
|
// membership) — never fetch the whole collection.
|
|
1652
|
-
|
|
1704
|
+
i ? e.listPlayers({ teamId: i.id }) : Promise.resolve({ items: [] })
|
|
1653
1705
|
]);
|
|
1654
1706
|
return {
|
|
1655
|
-
season:
|
|
1707
|
+
season: t,
|
|
1656
1708
|
school: s,
|
|
1657
1709
|
teams: o,
|
|
1658
|
-
active:
|
|
1659
|
-
games:
|
|
1660
|
-
allTeams:
|
|
1661
|
-
schools:
|
|
1662
|
-
conferences:
|
|
1663
|
-
rankings:
|
|
1664
|
-
roster:
|
|
1665
|
-
players:
|
|
1710
|
+
active: i,
|
|
1711
|
+
games: c.items,
|
|
1712
|
+
allTeams: d.items,
|
|
1713
|
+
schools: h.items,
|
|
1714
|
+
conferences: p.items,
|
|
1715
|
+
rankings: u.items,
|
|
1716
|
+
roster: f.items.find(($) => $.season === t) || null,
|
|
1717
|
+
players: v.items
|
|
1666
1718
|
};
|
|
1667
1719
|
}
|
|
1668
1720
|
get ctx() {
|
|
1669
1721
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1670
|
-
teamsById:
|
|
1671
|
-
schoolsById:
|
|
1672
|
-
records:
|
|
1722
|
+
teamsById: b(this.data.allTeams.length ? this.data.allTeams : this.data.teams),
|
|
1723
|
+
schoolsById: b(this.data.schools),
|
|
1724
|
+
records: Q(this.data.games),
|
|
1673
1725
|
rankings: this.data.rankings,
|
|
1674
1726
|
hrefs: O(this),
|
|
1675
1727
|
sport: this.data.active?.sport || "football"
|
|
1676
1728
|
}, this._ctxData = this.data), this._ctx;
|
|
1677
1729
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1730
|
+
/**
|
|
1731
|
+
* Open a team's tab. The team id is what selects it — sport alone is
|
|
1732
|
+
* ambiguous on a gendered sport — with sport and gender kept in step so
|
|
1733
|
+
* the rest of the view and a shared ?sport=&gender= link agree with it.
|
|
1734
|
+
*/
|
|
1735
|
+
switchTeam(e) {
|
|
1736
|
+
e && (this.activeTeamId = e.id, this.sport = e.sport, this.gender = e.gender || "", this.load());
|
|
1680
1737
|
}
|
|
1681
1738
|
renderView() {
|
|
1682
|
-
const { school:
|
|
1683
|
-
if (!
|
|
1684
|
-
const o = this.ctx, n =
|
|
1685
|
-
return
|
|
1686
|
-
<div class="schoolhero" style="background:linear-gradient(115deg, ${
|
|
1739
|
+
const { school: e, teams: t, active: s, season: a } = this.data;
|
|
1740
|
+
if (!e) return l`<div class="view"><p class="empty">School not found.</p></div>`;
|
|
1741
|
+
const o = this.ctx, n = ee(e.colorPrimary || "#030711"), i = (e.adm || [])[0], c = b(this.data.conferences), d = s ? c[s.conferenceId] : null;
|
|
1742
|
+
return l`
|
|
1743
|
+
<div class="schoolhero" style="background:linear-gradient(115deg, ${e.colorPrimary || "#030711"} 0%, ${e.colorPrimary || "#030711"} 55%, var(--hsot-black) 100%);color:${n}">
|
|
1687
1744
|
<div class="inner">
|
|
1688
|
-
${
|
|
1745
|
+
${te(e, 84) ? l`<img class="crest logo" alt="" loading="lazy" src=${te(e, 84)} />` : l`<div class="crest" style="background:${e.colorSecondary || "#7C7C7C"};color:${ee(e.colorSecondary || "#7C7C7C")}">${be(e)}</div>`}
|
|
1689
1746
|
<div style="min-width:260px">
|
|
1690
|
-
<h1>${
|
|
1747
|
+
<h1>${e.name} <span class="mascot">${e.mascot || ""}</span></h1>
|
|
1691
1748
|
<div class="facts">
|
|
1692
|
-
${
|
|
1693
|
-
${
|
|
1694
|
-
${
|
|
1695
|
-
${i ?
|
|
1696
|
-
${
|
|
1697
|
-
${
|
|
1749
|
+
${e.location ? l`<span><b>Location</b>${e.location}${e.county ? l` · ${e.county} County` : m}</span>` : m}
|
|
1750
|
+
${e.association ? l`<span><b>League</b>${e.association}${e.classification ? l` · ${e.classification}` : m}</span>` : m}
|
|
1751
|
+
${d ? l`<span><b>Conference</b>${d.name}</span>` : m}
|
|
1752
|
+
${i ? l`<span><b>Enrollment</b>${i.value.toLocaleString()} (${i.season} ADM)</span>` : m}
|
|
1753
|
+
${e.openingYear ? l`<span><b>Opened</b>${e.openingYear}</span>` : m}
|
|
1754
|
+
${e.areaCode ? l`<span><b>Area</b>${e.areaCode}</span>` : m}
|
|
1698
1755
|
</div>
|
|
1699
1756
|
</div>
|
|
1700
1757
|
</div>
|
|
1701
1758
|
</div>
|
|
1702
1759
|
<div class="band">
|
|
1703
1760
|
<nav class="tabs" aria-label="Teams">
|
|
1704
|
-
${
|
|
1705
|
-
p.preventDefault(), this.
|
|
1706
|
-
}}>${
|
|
1761
|
+
${t.map((h) => h.id === s?.id ? l`<a class="on" href="#" aria-current="page" @click=${(p) => p.preventDefault()}>${h.name}</a>` : l`<a href="#" @click=${(p) => {
|
|
1762
|
+
p.preventDefault(), this.switchTeam(h);
|
|
1763
|
+
}}>${h.name}</a>`)}
|
|
1707
1764
|
</nav>
|
|
1708
1765
|
</div>
|
|
1709
|
-
${
|
|
1766
|
+
${B(this, l`
|
|
1710
1767
|
${D(this)}
|
|
1711
|
-
${s ? this.renderTeam(o, s,
|
|
1768
|
+
${s ? this.renderTeam(o, s, d, a) : l`<p class="empty">No teams recorded for this school yet.</p>`}
|
|
1712
1769
|
`)}
|
|
1713
1770
|
`;
|
|
1714
1771
|
}
|
|
1715
|
-
renderTeam(
|
|
1716
|
-
const o =
|
|
1717
|
-
return
|
|
1772
|
+
renderTeam(e, t, s, a) {
|
|
1773
|
+
const o = e.records[t.id] || { w: 0, l: 0, t: 0, cw: 0, cl: 0, ct: 0, pf: 0, pa: 0, results: [] }, n = o.w + o.l + o.t, i = s ? et(this.data.allTeams.filter((p) => p.conferenceId === s.id), t.gender) : [], c = s ? st(i, e.records).findIndex((p) => p.team.id === t.id) + 1 : 0, d = we(e.rankings, e.teamsById, t.id, t.sport, null), h = this.data.games.filter((p) => p.homeTeamId === t.id || p.awayTeamId === t.id).sort((p, u) => String(p.date).localeCompare(String(u.date)));
|
|
1774
|
+
return l`
|
|
1718
1775
|
<div class="tiles">
|
|
1719
|
-
<div class="tile"><div class="k">Overall</div><div class="v">${
|
|
1720
|
-
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${
|
|
1721
|
-
<div class="s">${
|
|
1776
|
+
<div class="tile"><div class="k">Overall</div><div class="v">${S(o)}</div><div class="s">${n} games played</div></div>
|
|
1777
|
+
<div class="tile"><div class="k">${s?.name || "Conference"}</div><div class="v">${S(o, !0)}</div>
|
|
1778
|
+
<div class="s">${c ? `${qt(c)} of ${i.length}` : "·"}</div></div>
|
|
1722
1779
|
<div class="tile"><div class="k">Points</div><div class="v">${n ? (o.pf / n).toFixed(1) : "0.0"}</div>
|
|
1723
1780
|
<div class="s">scored per game · ${n ? (o.pa / n).toFixed(1) : "0.0"} allowed</div></div>
|
|
1724
|
-
<div class="tile"><div class="k">Streak</div><div class="v">${
|
|
1725
|
-
<div class="s">last 5: ${
|
|
1726
|
-
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${
|
|
1727
|
-
<div class="s"><a href=${
|
|
1781
|
+
<div class="tile"><div class="k">Streak</div><div class="v">${ie(o.results) || "·"}</div>
|
|
1782
|
+
<div class="s">last 5: ${ke(e, t.id)}</div></div>
|
|
1783
|
+
<div class="tile"><div class="k">HSOT Top 25</div><div class="v">${d ? `#${d}` : "NR"}</div>
|
|
1784
|
+
<div class="s"><a href=${g(e.hrefs.section, { sport: t.sport, view: "rankings" })}>full poll</a></div></div>
|
|
1728
1785
|
</div>
|
|
1729
|
-
${(
|
|
1786
|
+
${(t.championships || []).length ? l`
|
|
1730
1787
|
<div style="margin:-0.2rem 0 1rem;display:flex;gap:0.4rem;flex-wrap:wrap">
|
|
1731
|
-
${
|
|
1788
|
+
${t.championships.map((p) => l`<span class="pill champ">★ ${p.season} ${p.title} champion${p.classification ? ` · ${p.classification}` : ""}${p.region ? ` · ${p.region}` : ""}</span>`)}
|
|
1732
1789
|
</div>` : m}
|
|
1733
1790
|
<div class="cols">
|
|
1734
1791
|
<div>
|
|
1735
1792
|
<div class="section-title">Schedule & results</div>
|
|
1736
1793
|
<div class="card">
|
|
1737
|
-
${
|
|
1794
|
+
${h.length ? l`<ul class="gamelist">${h.map((p) => this.renderGameRow(e, t, p))}</ul>` : l`<p class="empty">No ${t.sport} games recorded for ${a}.</p>`}
|
|
1738
1795
|
</div>
|
|
1739
1796
|
</div>
|
|
1740
1797
|
<div>
|
|
1741
|
-
<div class="section-title">Roster · ${
|
|
1742
|
-
<div class="card">${this.renderRoster(
|
|
1798
|
+
<div class="section-title">Roster · ${a}</div>
|
|
1799
|
+
<div class="card">${this.renderRoster(t, a)}</div>
|
|
1743
1800
|
</div>
|
|
1744
1801
|
</div>
|
|
1745
1802
|
`;
|
|
1746
1803
|
}
|
|
1747
|
-
renderGameRow(
|
|
1748
|
-
const
|
|
1749
|
-
let
|
|
1804
|
+
renderGameRow(e, t, s) {
|
|
1805
|
+
const a = s.homeTeamId === t.id, o = a ? s.awayTeamId : s.homeTeamId, n = a ? s.homeScore : s.awayScore, i = a ? s.awayScore : s.homeScore;
|
|
1806
|
+
let c = l`<span class="mut">${ve(s.time)}</span>`;
|
|
1750
1807
|
if (s.state === "final") {
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1753
|
-
} else s.state === "live" && (
|
|
1754
|
-
const
|
|
1755
|
-
return
|
|
1808
|
+
const h = ne(s), p = h === "tie" ? "T" : h === (a ? "home" : "away") ? "W" : "L";
|
|
1809
|
+
c = l`<span class=${p}>${p}</span> ${n}-${i}${s.finish === "overtime" ? l` <span class="mut">OT</span>` : m}${s.forfeit && s.forfeit !== "none" ? l` <span class="mut">FF</span>` : m}`;
|
|
1810
|
+
} else s.state === "live" && (c = l`<span style="color:var(--hsot-red)">${n}-${i}</span>`);
|
|
1811
|
+
const d = s.gameType === "conference" ? "Conf" : s.gameType === "nonconference" ? "Non-conf" : s.gameType === "playoff" ? `Playoff${s.label ? ` · ${s.label}` : ""}` : "Scrimmage";
|
|
1812
|
+
return l`
|
|
1756
1813
|
<li>
|
|
1757
|
-
<span class="d">${
|
|
1758
|
-
${
|
|
1759
|
-
<span class="res">${
|
|
1760
|
-
<span class="opp">${
|
|
1761
|
-
<span class="pill type">${
|
|
1762
|
-
${s.broadcast ?
|
|
1814
|
+
<span class="d">${x(s.date)}</span>
|
|
1815
|
+
${Je(s).kind === "sched" ? m : V(s)}
|
|
1816
|
+
<span class="res">${c}</span>
|
|
1817
|
+
<span class="opp">${a ? "vs" : "at"} ${re(e, o, s.date)}
|
|
1818
|
+
<span class="pill type">${d}</span>
|
|
1819
|
+
${s.broadcast ? l`<span class="pill class">${s.broadcast}</span>` : m}
|
|
1763
1820
|
</span>
|
|
1764
1821
|
<span class="where">${s.venue || ""}</span>
|
|
1765
|
-
<a class="box" href=${
|
|
1822
|
+
<a class="box" href=${g(e.hrefs.game, { sport: t.sport, id: s.id })}>Box score →</a>
|
|
1766
1823
|
</li>
|
|
1767
1824
|
`;
|
|
1768
1825
|
}
|
|
1769
|
-
renderRoster(
|
|
1826
|
+
renderRoster(e, t) {
|
|
1770
1827
|
const s = this.data.roster;
|
|
1771
1828
|
if (!s)
|
|
1772
|
-
return
|
|
1773
|
-
const
|
|
1774
|
-
return
|
|
1775
|
-
${
|
|
1776
|
-
alt="${o} ${
|
|
1829
|
+
return l`<p class="empty">Roster not published for ${t}.</p>`;
|
|
1830
|
+
const a = cs(s, 560), o = this.data.school?.name || "", n = b(this.data.players), i = s.entries.slice().sort((d, h) => (d.number || 0) - (h.number || 0)), c = i.some((d) => n[d.playerId]?.college);
|
|
1831
|
+
return l`
|
|
1832
|
+
${a ? l`<img class="rosterphoto" src=${a} loading="lazy" decoding="async"
|
|
1833
|
+
alt="${o} ${e.name} ${t} team photo" />` : m}
|
|
1777
1834
|
<div class="tablewrap"><table class="data roster">
|
|
1778
|
-
<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>${
|
|
1835
|
+
<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>${c ? l`<th>College</th>` : m}</tr></thead>
|
|
1779
1836
|
<tbody>
|
|
1780
|
-
${i.map((
|
|
1781
|
-
const
|
|
1782
|
-
if (!
|
|
1783
|
-
const p =
|
|
1784
|
-
return
|
|
1785
|
-
<td class="num mut">${
|
|
1786
|
-
<td class="player" style="font-weight:500">${
|
|
1837
|
+
${i.map((d) => {
|
|
1838
|
+
const h = n[d.playerId];
|
|
1839
|
+
if (!h) return m;
|
|
1840
|
+
const p = Gt(d), u = [p, h.classOf].filter(Boolean).join(" · ") || "·";
|
|
1841
|
+
return l`<tr>
|
|
1842
|
+
<td class="num mut">${d.number ?? "·"}</td>
|
|
1843
|
+
<td class="player" style="font-weight:500">${h.firstName} ${h.lastName}<span class="sub">${u}</span></td>
|
|
1787
1844
|
<td class="pos">${p || "·"}</td>
|
|
1788
|
-
<td class="cls mut">${
|
|
1789
|
-
<td class="num">${
|
|
1790
|
-
<td class="num">${
|
|
1791
|
-
${
|
|
1845
|
+
<td class="cls mut">${h.classOf || "·"}</td>
|
|
1846
|
+
<td class="num">${Lt(h.heightIn)}</td>
|
|
1847
|
+
<td class="num">${h.weightLb || "·"}</td>
|
|
1848
|
+
${c ? l`<td class="college">${h.college || "·"}</td>` : m}
|
|
1792
1849
|
</tr>`;
|
|
1793
1850
|
})}
|
|
1794
1851
|
</tbody>
|
|
@@ -1796,8 +1853,8 @@ class re extends b {
|
|
|
1796
1853
|
`;
|
|
1797
1854
|
}
|
|
1798
1855
|
}
|
|
1799
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school",
|
|
1800
|
-
const
|
|
1856
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school") && globalThis.customElements.define("hsot-school", lt);
|
|
1857
|
+
const ct = {
|
|
1801
1858
|
football: ["quarters", 4],
|
|
1802
1859
|
flag_football: ["quarters", 4],
|
|
1803
1860
|
basketball: ["quarters", 4],
|
|
@@ -1808,78 +1865,78 @@ const oe = {
|
|
|
1808
1865
|
softball: ["innings", 7],
|
|
1809
1866
|
volleyball: ["sets", 3]
|
|
1810
1867
|
};
|
|
1811
|
-
function
|
|
1812
|
-
return (
|
|
1868
|
+
function dt(r) {
|
|
1869
|
+
return (ct[r] || ["quarters", 4])[0];
|
|
1813
1870
|
}
|
|
1814
|
-
function
|
|
1815
|
-
return (
|
|
1871
|
+
function Se(r) {
|
|
1872
|
+
return (ct[r] || ["quarters", 4])[1];
|
|
1816
1873
|
}
|
|
1817
|
-
function
|
|
1818
|
-
const
|
|
1819
|
-
if (
|
|
1820
|
-
const
|
|
1821
|
-
return `OT${
|
|
1874
|
+
function ps(r, e) {
|
|
1875
|
+
const t = dt(r), s = Se(r);
|
|
1876
|
+
if (e <= s || t === "innings" || t === "sets") return String(e);
|
|
1877
|
+
const a = e - s;
|
|
1878
|
+
return `OT${a > 1 ? a : ""}`;
|
|
1822
1879
|
}
|
|
1823
|
-
function
|
|
1824
|
-
const
|
|
1880
|
+
function ms(r, e) {
|
|
1881
|
+
const t = String(r ?? "").trim();
|
|
1825
1882
|
let s;
|
|
1826
|
-
return (s = /^(\d+)Q$/i.exec(
|
|
1827
|
-
}
|
|
1828
|
-
const
|
|
1829
|
-
function
|
|
1830
|
-
const
|
|
1831
|
-
if (!
|
|
1832
|
-
const
|
|
1833
|
-
for (const p of
|
|
1834
|
-
const u =
|
|
1835
|
-
if (!u || f === null ||
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1838
|
-
}
|
|
1839
|
-
const
|
|
1883
|
+
return (s = /^(\d+)Q$/i.exec(t)) || (s = /^(\d+)H$/i.exec(t)) ? Number(s[1]) : /^half$/i.test(t) ? dt(e) === "halves" ? 1 : 2 : (s = /^(\d*)OT(\d*)$/i.exec(t)) ? Se(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;
|
|
1884
|
+
}
|
|
1885
|
+
const Z = (r) => Number.isInteger(r) && r >= 0 ? r : null;
|
|
1886
|
+
function us(r) {
|
|
1887
|
+
const e = Array.isArray(r?.scoringPlays) ? r.scoringPlays : [];
|
|
1888
|
+
if (!e.length) return null;
|
|
1889
|
+
const t = r.sport, s = /* @__PURE__ */ new Map();
|
|
1890
|
+
for (const p of e) {
|
|
1891
|
+
const u = ms(p?.period, t), f = Z(p?.homeScore), v = Z(p?.awayScore);
|
|
1892
|
+
if (!u || f === null || v === null) return null;
|
|
1893
|
+
const $ = s.get(u) || { home: 0, away: 0 };
|
|
1894
|
+
$.home = Math.max($.home, f), $.away = Math.max($.away, v), s.set(u, $);
|
|
1895
|
+
}
|
|
1896
|
+
const a = Math.max(...s.keys()), o = [];
|
|
1840
1897
|
let n = !0, i = { home: 0, away: 0 };
|
|
1841
|
-
for (let p = 1; p <=
|
|
1842
|
-
const u = s.get(p) || i, f = u.home - i.home,
|
|
1843
|
-
(f < 0 ||
|
|
1898
|
+
for (let p = 1; p <= a; p += 1) {
|
|
1899
|
+
const u = s.get(p) || i, f = u.home - i.home, v = u.away - i.away;
|
|
1900
|
+
(f < 0 || v < 0) && (n = !1), o.push({ period: p, home: Math.max(f, 0), away: Math.max(v, 0) }), i = { home: Math.max(u.home, i.home), away: Math.max(u.away, i.away) };
|
|
1844
1901
|
}
|
|
1845
|
-
const
|
|
1846
|
-
return n = n && i.home <=
|
|
1902
|
+
const c = Z(r.homeScore) ?? 0, d = Z(r.awayScore) ?? 0, h = n && i.home === c && i.away === d;
|
|
1903
|
+
return n = n && i.home <= c && i.away <= d, { periods: o, reconciled: h, consistent: n };
|
|
1847
1904
|
}
|
|
1848
|
-
function
|
|
1849
|
-
if (Array.isArray(
|
|
1850
|
-
const
|
|
1851
|
-
return
|
|
1905
|
+
function fs(r) {
|
|
1906
|
+
if (Array.isArray(r?.periodScores) && r.periodScores.length) return r.periodScores;
|
|
1907
|
+
const e = us(r);
|
|
1908
|
+
return e ? r.state === "final" ? e.reconciled ? e.periods : null : e.consistent ? e.periods : null : null;
|
|
1852
1909
|
}
|
|
1853
|
-
const
|
|
1854
|
-
function
|
|
1855
|
-
return
|
|
1910
|
+
const gs = "https://api.wral.com/search";
|
|
1911
|
+
function vs(r) {
|
|
1912
|
+
return r.map((e) => `uri:"${e}"`).join(" OR ");
|
|
1856
1913
|
}
|
|
1857
|
-
function
|
|
1858
|
-
const
|
|
1859
|
-
return `${
|
|
1914
|
+
function $s(r, e) {
|
|
1915
|
+
const t = String(r || gs).replace(/\/+$/, ""), s = new URLSearchParams({ query: vs(e), sort: "score", lang: "en" });
|
|
1916
|
+
return `${t}/v1/query?${s}`;
|
|
1860
1917
|
}
|
|
1861
|
-
function
|
|
1918
|
+
function ht(r) {
|
|
1862
1919
|
try {
|
|
1863
|
-
const
|
|
1864
|
-
if (/(^|\.)smugmug\.com$/i.test(
|
|
1865
|
-
const
|
|
1920
|
+
const e = new URL(r);
|
|
1921
|
+
if (/(^|\.)smugmug\.com$/i.test(e.hostname)) {
|
|
1922
|
+
const t = e.pathname.split("/").filter(Boolean).pop() || "", s = !t || /^[ni]-[A-Za-z0-9]+$/.test(t);
|
|
1866
1923
|
return {
|
|
1867
|
-
uri:
|
|
1868
|
-
title: s ?
|
|
1924
|
+
uri: r,
|
|
1925
|
+
title: s ? r : decodeURIComponent(t).replace(/-/g, " "),
|
|
1869
1926
|
photos: !0
|
|
1870
1927
|
};
|
|
1871
1928
|
}
|
|
1872
1929
|
} catch {
|
|
1873
1930
|
}
|
|
1874
|
-
return { uri:
|
|
1931
|
+
return { uri: r, title: r };
|
|
1875
1932
|
}
|
|
1876
|
-
async function
|
|
1877
|
-
const
|
|
1878
|
-
if (!
|
|
1879
|
-
const o = await
|
|
1880
|
-
return
|
|
1933
|
+
async function bs(r, e, t) {
|
|
1934
|
+
const a = await ((...i) => fetch(...i))($s(r, e));
|
|
1935
|
+
if (!a.ok) throw new Error(`search answered ${a.status}`);
|
|
1936
|
+
const o = await a.json(), n = new Map((o.items || []).map((i) => [i.uri, i]));
|
|
1937
|
+
return e.map((i) => n.get(i) || ht(i));
|
|
1881
1938
|
}
|
|
1882
|
-
const
|
|
1939
|
+
const ys = w`
|
|
1883
1940
|
.breadcrumbs { font-size: 0.8125rem; margin: 0.9rem 0 0; color: var(--hsot-gray-5); }
|
|
1884
1941
|
.breadcrumbs a { text-decoration: none; }
|
|
1885
1942
|
.scorehead { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; padding: 1.4rem 1rem; }
|
|
@@ -1922,6 +1979,9 @@ const us = y`
|
|
|
1922
1979
|
table.plays-table td.play { white-space: normal; min-width: 12rem; }
|
|
1923
1980
|
/* Game notes are typed with line breaks the desk means to keep. */
|
|
1924
1981
|
.gamenote { padding: 0 1rem 0.9rem; text-align: center; white-space: pre-line; }
|
|
1982
|
+
/* The embed's way out to everything it drops (Coverage, season context,
|
|
1983
|
+
head to head) — the data page still renders all of it. */
|
|
1984
|
+
.fullbox { margin: 0.9rem 0 0; text-align: center; font-size: 0.875rem; }
|
|
1925
1985
|
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
|
|
1926
1986
|
.ctxcard { padding: 0.85rem 1rem; }
|
|
1927
1987
|
.ctxcard .who { font-family: var(--hsot-heading-font); font-weight: 700; margin-bottom: 0.4rem; }
|
|
@@ -1932,98 +1992,115 @@ const us = y`
|
|
|
1932
1992
|
.cols { grid-template-columns: 1fr; }
|
|
1933
1993
|
}
|
|
1934
1994
|
`;
|
|
1935
|
-
class
|
|
1936
|
-
static styles = [...U,
|
|
1995
|
+
class pt extends y {
|
|
1996
|
+
static styles = [...U, ys];
|
|
1937
1997
|
static properties = {
|
|
1938
|
-
...
|
|
1998
|
+
...y.properties,
|
|
1939
1999
|
gameId: { type: String, attribute: "game-id" },
|
|
1940
2000
|
// The public site search that resolves Game.coverageUrls into cards
|
|
1941
2001
|
// (DEV-1236). Shared cross-stage by design — see the studio host's
|
|
1942
2002
|
// registry — so the prod default is right everywhere; the attribute
|
|
1943
2003
|
// exists for the same reason the href templates do.
|
|
1944
|
-
searchApi: { type: String, attribute: "search-api" }
|
|
2004
|
+
searchApi: { type: String, attribute: "search-api" },
|
|
2005
|
+
// Story pages embed the box score in the article column, where the page
|
|
2006
|
+
// chrome (breadcrumbs, the report-a-score line) and the cross-links
|
|
2007
|
+
// (Coverage, Season context, head-to-head) belong to the data page, not
|
|
2008
|
+
// the recap. `embed` keeps the score head, line score and scoring plays,
|
|
2009
|
+
// and links out to the full box score for the rest.
|
|
2010
|
+
embed: { type: Boolean }
|
|
1945
2011
|
};
|
|
1946
2012
|
constructor() {
|
|
1947
|
-
super(), this.gameId = "", this.searchApi = "";
|
|
1948
|
-
}
|
|
1949
|
-
async fetchData(
|
|
1950
|
-
const
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
2013
|
+
super(), this.gameId = "", this.searchApi = "", this.embed = !1;
|
|
2014
|
+
}
|
|
2015
|
+
async fetchData(e) {
|
|
2016
|
+
const t = await e.getGame(this.gameId), s = Array.isArray(t.coverageUrls) ? t.coverageUrls : [], [a, o, n, i, c, d] = await Promise.all([
|
|
2017
|
+
e.listSchools(),
|
|
2018
|
+
e.listTeams({ sport: t.sport }),
|
|
2019
|
+
e.listConferences(),
|
|
2020
|
+
e.listRankings({ sport: t.sport }),
|
|
2021
|
+
e.listGames({ sport: t.sport, season: t.season }),
|
|
1956
2022
|
// A search outage must not blank the box score — degrade to bare
|
|
1957
2023
|
// links (fetchCoverage already degrades per-URL index misses).
|
|
1958
|
-
|
|
2024
|
+
// The embed drops the Coverage grid, so it skips the search
|
|
2025
|
+
// round-trip entirely rather than fetching cards it will not render.
|
|
2026
|
+
s.length && !this.embed ? bs(this.searchApi, s).catch(() => s.map(ht)) : Promise.resolve([])
|
|
1959
2027
|
]);
|
|
1960
2028
|
return {
|
|
1961
|
-
game:
|
|
1962
|
-
schools:
|
|
2029
|
+
game: t,
|
|
2030
|
+
schools: a.items,
|
|
1963
2031
|
teams: o.items,
|
|
1964
2032
|
conferences: n.items,
|
|
1965
2033
|
rankings: i.items,
|
|
1966
|
-
games:
|
|
1967
|
-
coverage:
|
|
2034
|
+
games: c.items,
|
|
2035
|
+
coverage: d
|
|
1968
2036
|
};
|
|
1969
2037
|
}
|
|
1970
2038
|
get ctx() {
|
|
1971
2039
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
1972
|
-
teamsById:
|
|
1973
|
-
schoolsById:
|
|
1974
|
-
records:
|
|
2040
|
+
teamsById: b(this.data.teams),
|
|
2041
|
+
schoolsById: b(this.data.schools),
|
|
2042
|
+
records: Q(this.data.games),
|
|
1975
2043
|
rankings: this.data.rankings,
|
|
1976
2044
|
hrefs: O(this),
|
|
1977
2045
|
sport: this.data.game.sport
|
|
1978
2046
|
}, this._ctxData = this.data), this._ctx;
|
|
1979
2047
|
}
|
|
1980
2048
|
renderView() {
|
|
1981
|
-
const
|
|
1982
|
-
if (!
|
|
1983
|
-
const
|
|
1984
|
-
return
|
|
1985
|
-
${
|
|
2049
|
+
const e = this.data.game;
|
|
2050
|
+
if (!e) return l`<div class="view"><p class="empty">Game not found.</p></div>`;
|
|
2051
|
+
const t = this.ctx, s = b(this.data.conferences), a = 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, n = ne(e), i = (h) => e.state === "final" && n !== h && n !== "tie" ? "opacity:0.45" : "", c = e.conferenceId ? s[e.conferenceId] : null, d = this.data.games.filter((h) => h.id !== e.id && h.state === "final" && h.gameType !== "scrimmage" && (h.homeTeamId === e.homeTeamId && h.awayTeamId === e.awayTeamId || h.homeTeamId === e.awayTeamId && h.awayTeamId === e.homeTeamId));
|
|
2052
|
+
return l`
|
|
2053
|
+
${B(this, l`
|
|
1986
2054
|
${D(this)}
|
|
1987
|
-
|
|
1988
|
-
<
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2055
|
+
${this.embed ? m : l`
|
|
2056
|
+
<p class="breadcrumbs">
|
|
2057
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>${k(e.sport)}</a> /
|
|
2058
|
+
<a href=${g(t.hrefs.section, { sport: e.sport, view: "scores" })}>Scores/Schedules</a> /
|
|
2059
|
+
${R(t, e.awayTeamId)} at ${R(t, e.homeTeamId)}
|
|
2060
|
+
</p>`}
|
|
1992
2061
|
<div class="card">
|
|
1993
2062
|
<div class="scorehead">
|
|
1994
|
-
${this.teamBlock(
|
|
2063
|
+
${this.teamBlock(t, e, e.awayTeamId, a, !1)}
|
|
1995
2064
|
<div class="mid">
|
|
1996
2065
|
<div class="bigscore">
|
|
1997
|
-
<span style=${i("away")}>${
|
|
2066
|
+
<span style=${i("away")}>${e.awayScore}</span>
|
|
1998
2067
|
<span class="mut" style="font-size:1.6rem">–</span>
|
|
1999
|
-
<span style=${i("home")}>${
|
|
2068
|
+
<span style=${i("home")}>${e.homeScore}</span>
|
|
2000
2069
|
</div>
|
|
2001
|
-
<div class="status">${
|
|
2002
|
-
<div class="status">${
|
|
2003
|
-
${
|
|
2070
|
+
<div class="status">${V(e)}</div>
|
|
2071
|
+
<div class="status">${x(e.date, { weekday: "short", month: "short", day: "numeric", year: "numeric" })}${e.state === "scheduled" && e.time ? l` · ${ve(e.time)}` : m} · ${e.venue || "Venue TBD"}
|
|
2072
|
+
${e.broadcast ? l` · <span class="pill class">${e.broadcast}</span>` : m}</div>
|
|
2004
2073
|
<div class="status">
|
|
2005
|
-
<span class="pill type">${
|
|
2006
|
-
${
|
|
2007
|
-
${(
|
|
2074
|
+
<span class="pill type">${e.gameType === "conference" ? `${c?.name || "Conference"} game` : e.gameType}</span>
|
|
2075
|
+
${e.label ? l`<span class="pill type">Bracket ${e.label}</span>` : m}
|
|
2076
|
+
${(e.tags || []).map((h) => l`<span class="pill type">${h}</span>`)}
|
|
2008
2077
|
</div>
|
|
2078
|
+
${this.embed ? m : l`
|
|
2079
|
+
<div class="status">
|
|
2080
|
+
<a href=${Ze(t.hrefs, e.id)}>Report a score for this game</a>
|
|
2081
|
+
</div>`}
|
|
2009
2082
|
</div>
|
|
2010
|
-
${this.teamBlock(
|
|
2083
|
+
${this.teamBlock(t, e, e.homeTeamId, o, !0)}
|
|
2011
2084
|
</div>
|
|
2012
|
-
${this.renderLineScore(
|
|
2013
|
-
${this.renderScoringPlays(
|
|
2014
|
-
${
|
|
2085
|
+
${this.renderLineScore(e, a, o)}
|
|
2086
|
+
${this.renderScoringPlays(e, a, o)}
|
|
2087
|
+
${e.notes ? l`<p class="note gamenote">${e.notes}</p>` : m}
|
|
2015
2088
|
</div>
|
|
2016
|
-
${
|
|
2089
|
+
${this.embed ? l`
|
|
2090
|
+
<p class="fullbox">
|
|
2091
|
+
<a href=${g(t.hrefs.game, { sport: e.sport, id: e.id })}>Full box score →</a>
|
|
2092
|
+
</p>` : l`
|
|
2093
|
+
${(this.data.coverage || []).length ? l`
|
|
2017
2094
|
<div class="section-title">Coverage</div>
|
|
2018
2095
|
<div class="covgrid">
|
|
2019
|
-
${this.data.coverage.map((
|
|
2020
|
-
<a class="card covcard" href=${
|
|
2021
|
-
${
|
|
2096
|
+
${this.data.coverage.map((h) => l`
|
|
2097
|
+
<a class="card covcard" href=${h.uri}>
|
|
2098
|
+
${h.image ? l`<img class="covimg" src=${h.image} alt="" loading="lazy" />` : m}
|
|
2022
2099
|
<div class="covbody">
|
|
2023
|
-
<div class="covtitle">${
|
|
2024
|
-
${
|
|
2025
|
-
${
|
|
2026
|
-
<div class="covmeta">${[
|
|
2100
|
+
<div class="covtitle">${h.videoDuration ? l`<span class="pill live" style="animation:none">Video</span> ` : m}${h.photos ? l`<span class="pill live" style="animation:none">Photos</span> ` : m}${h.title || h.uri}</div>
|
|
2101
|
+
${h.description ? l`<p class="covdesc">${h.description}</p>` : m}
|
|
2102
|
+
${h.author || h.publishedTime ? l`
|
|
2103
|
+
<div class="covmeta">${[h.author, h.publishedTime ? new Date(h.publishedTime).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" }) : ""].filter(Boolean).join(" · ")}</div>
|
|
2027
2104
|
` : m}
|
|
2028
2105
|
</div>
|
|
2029
2106
|
</a>
|
|
@@ -2031,73 +2108,73 @@ class le extends b {
|
|
|
2031
2108
|
</div>` : m}
|
|
2032
2109
|
<div class="section-title">Season context</div>
|
|
2033
2110
|
<div class="cols">
|
|
2034
|
-
${[[
|
|
2111
|
+
${[[e.awayTeamId, a], [e.homeTeamId, o]].map(([h, p]) => this.renderContext(t, h, p))}
|
|
2035
2112
|
</div>
|
|
2036
|
-
${
|
|
2113
|
+
${d.length ? l`
|
|
2037
2114
|
<div class="section-title">Head to head this season</div>
|
|
2038
2115
|
<div class="card"><ul class="gamelist">
|
|
2039
|
-
${
|
|
2040
|
-
<span class="d">${
|
|
2041
|
-
<span class="opp">${R(
|
|
2042
|
-
<a class="box" href=${
|
|
2116
|
+
${d.map((h) => l`<li>
|
|
2117
|
+
<span class="d">${x(h.date)}</span>${V(h)}
|
|
2118
|
+
<span class="opp">${R(t, h.awayTeamId)} ${h.awayScore}, ${R(t, h.homeTeamId)} ${h.homeScore}</span>
|
|
2119
|
+
<a class="box" href=${g(t.hrefs.game, { sport: e.sport, id: h.id })}>Box score →</a>
|
|
2043
2120
|
</li>`)}
|
|
2044
|
-
</ul></div>` : m}
|
|
2121
|
+
</ul></div>` : m}`}
|
|
2045
2122
|
`)}
|
|
2046
2123
|
`;
|
|
2047
2124
|
}
|
|
2048
|
-
teamBlock(
|
|
2049
|
-
if (!
|
|
2050
|
-
const n =
|
|
2051
|
-
return
|
|
2125
|
+
teamBlock(e, t, s, a, o) {
|
|
2126
|
+
if (!a) return l`<div class="teamblock ${o ? "right" : ""}"><div class="tname">TBD</div></div>`;
|
|
2127
|
+
const n = e.teamsById[s], i = e.records[s], c = te(a, 58);
|
|
2128
|
+
return l`
|
|
2052
2129
|
<div class="teamblock ${o ? "right" : ""}">
|
|
2053
|
-
${
|
|
2130
|
+
${c ? l`<img class="crest logo" alt="" loading="lazy" src=${c} />` : l`<span class="crest" style="background:${a.colorPrimary || "#030711"};color:${ee(a.colorPrimary || "#030711")}">${be(a)}</span>`}
|
|
2054
2131
|
<div>
|
|
2055
|
-
<div class="tname">${
|
|
2056
|
-
<div class="trec">${
|
|
2132
|
+
<div class="tname">${xe(e, s, t.date)}<a href=${g(e.hrefs.school, { id: a.id })}>${a.name}</a></div>
|
|
2133
|
+
<div class="trec">${a.mascot || ""} · ${S(i)}${n?.conferenceId ? l` · ${S(i, !0)} conf` : m}</div>
|
|
2057
2134
|
</div>
|
|
2058
2135
|
</div>
|
|
2059
2136
|
`;
|
|
2060
2137
|
}
|
|
2061
|
-
renderLineScore(
|
|
2062
|
-
const
|
|
2063
|
-
if (!
|
|
2064
|
-
return
|
|
2065
|
-
const o = Math.max(
|
|
2066
|
-
const p =
|
|
2067
|
-
return p ? p[
|
|
2068
|
-
},
|
|
2138
|
+
renderLineScore(e, t, s) {
|
|
2139
|
+
const a = fs(e);
|
|
2140
|
+
if (!a)
|
|
2141
|
+
return e.state === "scheduled" ? l`<p class="empty" style="text-align:center">Period scoring will appear once the game starts.</p>` : m;
|
|
2142
|
+
const o = Math.max(Se(e.sport), ...a.map((d) => d.period)), n = (d) => ps(e.sport, d), i = (d, h) => {
|
|
2143
|
+
const p = a.find((u) => u.period === h);
|
|
2144
|
+
return p ? p[d] : e.state === "final" ? 0 : "·";
|
|
2145
|
+
}, c = (d, h, p) => l`
|
|
2069
2146
|
<tr>
|
|
2070
|
-
<td class="teamcell">${
|
|
2071
|
-
${Array.from({ length: o }, (u, f) =>
|
|
2147
|
+
<td class="teamcell">${P(d, 20)}${d?.abbr || "TBD"}</td>
|
|
2148
|
+
${Array.from({ length: o }, (u, f) => l`<td class="num">${i(h, f + 1)}</td>`)}
|
|
2072
2149
|
<td class="num" style="font-weight:700">${p}</td>
|
|
2073
2150
|
</tr>`;
|
|
2074
|
-
return
|
|
2151
|
+
return l`
|
|
2075
2152
|
<div class="tablewrap" style="border-top:1px solid var(--hsot-gray-2)">
|
|
2076
2153
|
<table class="data" style="max-width:560px;margin:0.6rem auto 0.9rem">
|
|
2077
|
-
<thead><tr><th>Team</th>${Array.from({ length: o }, (
|
|
2154
|
+
<thead><tr><th>Team</th>${Array.from({ length: o }, (d, h) => l`<th class="num">${n(h + 1)}</th>`)}<th class="num">T</th></tr></thead>
|
|
2078
2155
|
<tbody>
|
|
2079
|
-
${
|
|
2080
|
-
${
|
|
2156
|
+
${c(t, "away", e.awayScore)}
|
|
2157
|
+
${c(s, "home", e.homeScore)}
|
|
2081
2158
|
</tbody>
|
|
2082
2159
|
</table>
|
|
2083
2160
|
</div>
|
|
2084
2161
|
`;
|
|
2085
2162
|
}
|
|
2086
|
-
renderScoringPlays(
|
|
2087
|
-
const
|
|
2088
|
-
if (!
|
|
2163
|
+
renderScoringPlays(e, t, s) {
|
|
2164
|
+
const a = Array.isArray(e.scoringPlays) ? e.scoringPlays : [];
|
|
2165
|
+
if (!a.length) return m;
|
|
2089
2166
|
const o = (n) => [n.period, n.clock].filter(Boolean).join(" ");
|
|
2090
|
-
return
|
|
2167
|
+
return l`
|
|
2091
2168
|
<div class="plays">
|
|
2092
2169
|
<div class="plays-title">Scoring plays</div>
|
|
2093
2170
|
<div class="tablewrap">
|
|
2094
2171
|
<table class="data plays-table">
|
|
2095
2172
|
<thead><tr>
|
|
2096
2173
|
<th>When</th><th>Play</th>
|
|
2097
|
-
<th class="num">${
|
|
2174
|
+
<th class="num">${t?.abbr || "Away"}</th><th class="num">${s?.abbr || "Home"}</th>
|
|
2098
2175
|
</tr></thead>
|
|
2099
2176
|
<tbody>
|
|
2100
|
-
${
|
|
2177
|
+
${a.map((n) => l`<tr>
|
|
2101
2178
|
<td class="when">${o(n) || "·"}</td>
|
|
2102
2179
|
<td class="play">${n.description || "·"}</td>
|
|
2103
2180
|
<td class="num">${n.awayScore}</td>
|
|
@@ -2109,26 +2186,26 @@ class le extends b {
|
|
|
2109
2186
|
</div>
|
|
2110
2187
|
`;
|
|
2111
2188
|
}
|
|
2112
|
-
renderContext(
|
|
2189
|
+
renderContext(e, t, s) {
|
|
2113
2190
|
if (!s) return m;
|
|
2114
|
-
const
|
|
2115
|
-
return
|
|
2191
|
+
const a = e.records[t], o = ye(this.data.games, t);
|
|
2192
|
+
return l`
|
|
2116
2193
|
<div class="card ctxcard">
|
|
2117
|
-
<div class="who">${
|
|
2194
|
+
<div class="who">${P(s)}${s.name}</div>
|
|
2118
2195
|
<div class="row">
|
|
2119
|
-
<span>Last 5: ${
|
|
2120
|
-
<span>Streak: <b>${
|
|
2121
|
-
<span>PF/PA: <b>${
|
|
2122
|
-
<span>Next: ${o ?
|
|
2123
|
-
${o.homeTeamId ===
|
|
2196
|
+
<span>Last 5: ${ke(e, t)}</span>
|
|
2197
|
+
<span>Streak: <b>${a ? ie(a.results) : "·"}</b></span>
|
|
2198
|
+
<span>PF/PA: <b>${a ? `${a.pf} / ${a.pa}` : "·"}</b></span>
|
|
2199
|
+
<span>Next: ${o ? l`${x(o.date, { month: "numeric", day: "numeric" })}
|
|
2200
|
+
${o.homeTeamId === t ? "vs" : "at"} ${se(e, o.homeTeamId === t ? o.awayTeamId : o.homeTeamId)}` : "·"}</span>
|
|
2124
2201
|
</div>
|
|
2125
2202
|
</div>
|
|
2126
2203
|
`;
|
|
2127
2204
|
}
|
|
2128
2205
|
}
|
|
2129
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore",
|
|
2130
|
-
const
|
|
2131
|
-
class
|
|
2206
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-boxscore") && globalThis.customElements.define("hsot-boxscore", pt);
|
|
2207
|
+
const ws = 250, xs = 2;
|
|
2208
|
+
class mt extends N {
|
|
2132
2209
|
static properties = {
|
|
2133
2210
|
api: { type: String },
|
|
2134
2211
|
schoolHref: { type: String, attribute: "school-href" },
|
|
@@ -2139,7 +2216,7 @@ class ce extends N {
|
|
|
2139
2216
|
activeIndex: { state: !0 },
|
|
2140
2217
|
searched: { state: !0 }
|
|
2141
2218
|
};
|
|
2142
|
-
static styles =
|
|
2219
|
+
static styles = w`
|
|
2143
2220
|
:host {
|
|
2144
2221
|
display: block;
|
|
2145
2222
|
position: relative;
|
|
@@ -2206,41 +2283,41 @@ class ce extends N {
|
|
|
2206
2283
|
disconnectedCallback() {
|
|
2207
2284
|
super.disconnectedCallback(), clearTimeout(this.debounceTimer), this.abortController?.abort();
|
|
2208
2285
|
}
|
|
2209
|
-
onInput(
|
|
2210
|
-
const
|
|
2211
|
-
if (clearTimeout(this.debounceTimer),
|
|
2286
|
+
onInput(e) {
|
|
2287
|
+
const t = e.target.value.trim();
|
|
2288
|
+
if (clearTimeout(this.debounceTimer), t.length < xs) {
|
|
2212
2289
|
this.abortController?.abort(), this.results = [], this.open = !1, this.searched = !1;
|
|
2213
2290
|
return;
|
|
2214
2291
|
}
|
|
2215
|
-
this.debounceTimer = setTimeout(() => this.search(
|
|
2292
|
+
this.debounceTimer = setTimeout(() => this.search(t), ws);
|
|
2216
2293
|
}
|
|
2217
|
-
async search(
|
|
2294
|
+
async search(e) {
|
|
2218
2295
|
this.abortController?.abort(), this.abortController = new AbortController();
|
|
2219
2296
|
try {
|
|
2220
|
-
const
|
|
2297
|
+
const t = `${this.api}/schools?q=${encodeURIComponent(e)}&limit=${this.limit}`, s = await fetch(t, {
|
|
2221
2298
|
signal: this.abortController.signal
|
|
2222
2299
|
});
|
|
2223
2300
|
if (!s.ok)
|
|
2224
2301
|
return;
|
|
2225
|
-
const
|
|
2226
|
-
this.results =
|
|
2227
|
-
} catch (
|
|
2228
|
-
|
|
2302
|
+
const a = await s.json();
|
|
2303
|
+
this.results = a.items || [], this.activeIndex = -1, this.searched = !0, this.open = !0;
|
|
2304
|
+
} catch (t) {
|
|
2305
|
+
t.name !== "AbortError" && console.warn("school search failed", t);
|
|
2229
2306
|
}
|
|
2230
2307
|
}
|
|
2231
|
-
onKeyDown(
|
|
2232
|
-
if (
|
|
2308
|
+
onKeyDown(e) {
|
|
2309
|
+
if (e.key === "Escape") {
|
|
2233
2310
|
this.open = !1;
|
|
2234
2311
|
return;
|
|
2235
2312
|
}
|
|
2236
2313
|
if (!(!this.open || !this.results.length))
|
|
2237
|
-
if (
|
|
2238
|
-
|
|
2239
|
-
else if (
|
|
2240
|
-
|
|
2241
|
-
const
|
|
2242
|
-
this.activeIndex = (this.activeIndex - 1 +
|
|
2243
|
-
} else
|
|
2314
|
+
if (e.key === "ArrowDown")
|
|
2315
|
+
e.preventDefault(), this.activeIndex = (this.activeIndex + 1) % this.results.length;
|
|
2316
|
+
else if (e.key === "ArrowUp") {
|
|
2317
|
+
e.preventDefault();
|
|
2318
|
+
const t = this.results.length;
|
|
2319
|
+
this.activeIndex = (this.activeIndex - 1 + t) % t;
|
|
2320
|
+
} else e.key === "Enter" && (e.preventDefault(), this.go(this.results[this.activeIndex] || this.results[0]));
|
|
2244
2321
|
}
|
|
2245
2322
|
onBlur() {
|
|
2246
2323
|
setTimeout(() => {
|
|
@@ -2250,50 +2327,50 @@ class ce extends N {
|
|
|
2250
2327
|
onFocus() {
|
|
2251
2328
|
this.results.length && (this.open = !0);
|
|
2252
2329
|
}
|
|
2253
|
-
go(
|
|
2254
|
-
|
|
2330
|
+
go(e) {
|
|
2331
|
+
e && (globalThis.location.href = this.schoolHref.replace("{id}", e.id));
|
|
2255
2332
|
}
|
|
2256
|
-
where(
|
|
2257
|
-
return [
|
|
2333
|
+
where(e) {
|
|
2334
|
+
return [e.location, e.county && `${e.county} County`].filter(Boolean).join(" — ");
|
|
2258
2335
|
}
|
|
2259
|
-
renderOption(
|
|
2260
|
-
const s = this.where(
|
|
2261
|
-
o.preventDefault(), this.go(
|
|
2336
|
+
renderOption(e, t) {
|
|
2337
|
+
const s = this.where(e), a = (o) => {
|
|
2338
|
+
o.preventDefault(), this.go(e);
|
|
2262
2339
|
};
|
|
2263
|
-
return
|
|
2340
|
+
return l`
|
|
2264
2341
|
<li
|
|
2265
|
-
id="school-option-${
|
|
2342
|
+
id="school-option-${t}"
|
|
2266
2343
|
role="option"
|
|
2267
|
-
aria-selected="${
|
|
2268
|
-
@pointerdown="${
|
|
2344
|
+
aria-selected="${t === this.activeIndex ? "true" : "false"}"
|
|
2345
|
+
@pointerdown="${a}"
|
|
2269
2346
|
@mousemove="${() => {
|
|
2270
|
-
this.activeIndex =
|
|
2347
|
+
this.activeIndex = t;
|
|
2271
2348
|
}}"
|
|
2272
2349
|
>
|
|
2273
|
-
<span class="name">${
|
|
2274
|
-
${s ?
|
|
2350
|
+
<span class="name">${e.name}</span>
|
|
2351
|
+
${s ? l`<span class="where">${s}</span>` : m}
|
|
2275
2352
|
</li>
|
|
2276
2353
|
`;
|
|
2277
2354
|
}
|
|
2278
2355
|
renderListbox() {
|
|
2279
|
-
const
|
|
2280
|
-
return
|
|
2356
|
+
const e = this.searched && !this.results.length, t = l`<li class="empty">No schools found</li>`;
|
|
2357
|
+
return l`
|
|
2281
2358
|
<ul id="school-search-listbox" role="listbox" aria-label="Schools">
|
|
2282
|
-
${this.results.map((s,
|
|
2283
|
-
${
|
|
2359
|
+
${this.results.map((s, a) => this.renderOption(s, a))}
|
|
2360
|
+
${e ? t : m}
|
|
2284
2361
|
</ul>
|
|
2285
2362
|
`;
|
|
2286
2363
|
}
|
|
2287
2364
|
render() {
|
|
2288
|
-
const
|
|
2289
|
-
return
|
|
2365
|
+
const e = this.activeIndex >= 0 ? `school-option-${this.activeIndex}` : "";
|
|
2366
|
+
return l`
|
|
2290
2367
|
<input
|
|
2291
2368
|
type="text"
|
|
2292
2369
|
role="combobox"
|
|
2293
2370
|
aria-label="Find your school"
|
|
2294
2371
|
aria-expanded="${this.open ? "true" : "false"}"
|
|
2295
2372
|
aria-controls="school-search-listbox"
|
|
2296
|
-
aria-activedescendant="${
|
|
2373
|
+
aria-activedescendant="${e}"
|
|
2297
2374
|
autocomplete="off"
|
|
2298
2375
|
placeholder="${this.placeholder}"
|
|
2299
2376
|
@input="${this.onInput}"
|
|
@@ -2305,111 +2382,111 @@ class ce extends N {
|
|
|
2305
2382
|
`;
|
|
2306
2383
|
}
|
|
2307
2384
|
}
|
|
2308
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search",
|
|
2309
|
-
function
|
|
2310
|
-
const
|
|
2311
|
-
for (const
|
|
2312
|
-
|
|
2313
|
-
const o =
|
|
2314
|
-
function i(
|
|
2315
|
-
const
|
|
2316
|
-
if (!
|
|
2317
|
-
const p = [...s.get(
|
|
2318
|
-
return { game:
|
|
2319
|
-
}
|
|
2320
|
-
return o.length === 1 ? i(o[0].id) : o.map((
|
|
2321
|
-
}
|
|
2322
|
-
function
|
|
2323
|
-
if (!
|
|
2324
|
-
t
|
|
2325
|
-
for (const s of
|
|
2326
|
-
return
|
|
2385
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-school-search") && globalThis.customElements.define("hsot-school-search", mt);
|
|
2386
|
+
function ut(r, e) {
|
|
2387
|
+
const t = new Map(r.map((c) => [c.id, c])), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
2388
|
+
for (const c of e || [])
|
|
2389
|
+
c.outcome === "winner" && (s.has(c.targetGameId) || s.set(c.targetGameId, []), s.get(c.targetGameId).push(c), a.has(c.sourceGameId) || a.set(c.sourceGameId, []), a.get(c.sourceGameId).push(c));
|
|
2390
|
+
const o = r.filter((c) => !a.has(c.id)), n = (c) => c.targetSlot === "home" ? 0 : 1;
|
|
2391
|
+
function i(c) {
|
|
2392
|
+
const d = t.get(c);
|
|
2393
|
+
if (!d) return null;
|
|
2394
|
+
const p = [...s.get(c) || []].sort((u, f) => n(u) - n(f)).map((u) => i(u.sourceGameId)).filter(Boolean);
|
|
2395
|
+
return { game: d, children: p, bracketGroup: d.bracketGroup };
|
|
2396
|
+
}
|
|
2397
|
+
return o.length === 1 ? i(o[0].id) : o.map((c) => i(c.id));
|
|
2398
|
+
}
|
|
2399
|
+
function ft(r, e = [], t = 0) {
|
|
2400
|
+
if (!r) return e;
|
|
2401
|
+
e[t] || (e[t] = []), e[t].push(r.game);
|
|
2402
|
+
for (const s of r.children || []) ft(s, e, t + 1);
|
|
2403
|
+
return e;
|
|
2327
2404
|
}
|
|
2328
|
-
const
|
|
2329
|
-
function
|
|
2330
|
-
const s =
|
|
2331
|
-
return o === 0 ?
|
|
2405
|
+
const ks = (r) => Math.max(1, Math.round(Math.log2(r || 2)));
|
|
2406
|
+
function Ss({ round: r, perGroup: e, groupCount: t = 1 }) {
|
|
2407
|
+
const s = ks(e), o = (t === 4 ? s + 2 : t === 2 ? s + 1 : s) - r;
|
|
2408
|
+
return o === 0 ? t > 1 ? "Championship" : "Final" : o === 1 ? "Semifinal" : `Round ${r}`;
|
|
2332
2409
|
}
|
|
2333
|
-
function
|
|
2334
|
-
if (!
|
|
2335
|
-
const
|
|
2336
|
-
return
|
|
2410
|
+
function _s(r) {
|
|
2411
|
+
if (!r || !r.length) return "setup";
|
|
2412
|
+
const e = Math.max(...r.map((s) => s.round ?? 0)), t = r.filter((s) => (s.round ?? 0) === e);
|
|
2413
|
+
return t.length && t.every((s) => s.state === "final") ? "complete" : r.some((s) => s.state !== "scheduled" || s.homeScore || s.awayScore || s.round === 1 && (s.homeTeamId || s.awayTeamId)) ? "active" : "setup";
|
|
2337
2414
|
}
|
|
2338
|
-
function
|
|
2339
|
-
const
|
|
2340
|
-
if (
|
|
2341
|
-
const
|
|
2342
|
-
return (
|
|
2415
|
+
function Ts(r, e) {
|
|
2416
|
+
const t = r?.groupNames || [];
|
|
2417
|
+
if (t.length >= 2) {
|
|
2418
|
+
const a = t.map((o) => ({ key: o, name: o }));
|
|
2419
|
+
return (e || []).some((o) => o.bracketGroup === "Championship") && a.push({ key: "Championship", name: "Championship" }), a;
|
|
2343
2420
|
}
|
|
2344
|
-
const s = [...new Set((
|
|
2421
|
+
const s = [...new Set((e || []).map((a) => a.bracketGroup).filter(Boolean))];
|
|
2345
2422
|
return [{ key: null, name: s.length === 1 ? s[0] : "Bracket" }];
|
|
2346
2423
|
}
|
|
2347
|
-
const
|
|
2348
|
-
const
|
|
2349
|
-
return
|
|
2350
|
-
},
|
|
2351
|
-
function
|
|
2352
|
-
if (
|
|
2353
|
-
const
|
|
2354
|
-
for (const
|
|
2355
|
-
const o =
|
|
2356
|
-
o.forEach((i,
|
|
2357
|
-
}
|
|
2358
|
-
return (
|
|
2359
|
-
}
|
|
2360
|
-
function
|
|
2361
|
-
const s =
|
|
2424
|
+
const As = (r, e) => e?.key == null ? [...r || []] : (r || []).filter((t) => t.bracketGroup === e.key), He = (r) => {
|
|
2425
|
+
const e = /(\d+)\s*$/.exec(r.label || "");
|
|
2426
|
+
return e ? Number(e[1]) : 1 / 0;
|
|
2427
|
+
}, Le = (r, e) => He(r) - He(e) || String(r.id).localeCompare(String(e.id));
|
|
2428
|
+
function Is(r, e) {
|
|
2429
|
+
if (r.every((a) => Number.isInteger(a.round))) return (a) => a.round;
|
|
2430
|
+
const t = ut(r, e), s = /* @__PURE__ */ new Map();
|
|
2431
|
+
for (const a of Array.isArray(t) ? t : [t]) {
|
|
2432
|
+
const o = ft(a), n = o.length - 1;
|
|
2433
|
+
o.forEach((i, c) => i.forEach((d) => s.set(d.id, n - c + 1)));
|
|
2434
|
+
}
|
|
2435
|
+
return (a) => Number.isInteger(a.round) ? a.round : s.get(a.id) || 1;
|
|
2436
|
+
}
|
|
2437
|
+
function Es(r, e, t) {
|
|
2438
|
+
const s = As(r, t);
|
|
2362
2439
|
if (!s.length) return [];
|
|
2363
|
-
const
|
|
2364
|
-
for (const
|
|
2365
|
-
const
|
|
2366
|
-
o.has(
|
|
2440
|
+
const a = Is(r || [], e || []), o = /* @__PURE__ */ new Map();
|
|
2441
|
+
for (const d of s) {
|
|
2442
|
+
const h = a(d);
|
|
2443
|
+
o.has(h) || o.set(h, []), o.get(h).push(d);
|
|
2367
2444
|
}
|
|
2368
2445
|
const n = /* @__PURE__ */ new Map();
|
|
2369
|
-
for (const
|
|
2370
|
-
|
|
2446
|
+
for (const d of e || [])
|
|
2447
|
+
d.outcome === "winner" && (n.has(d.targetGameId) || n.set(d.targetGameId, []), n.get(d.targetGameId).push(d.sourceGameId));
|
|
2371
2448
|
const i = [];
|
|
2372
|
-
let
|
|
2373
|
-
for (const
|
|
2374
|
-
let
|
|
2375
|
-
if (
|
|
2449
|
+
let c = null;
|
|
2450
|
+
for (const d of [...o.keys()].sort((h, p) => h - p)) {
|
|
2451
|
+
let h = [...o.get(d)];
|
|
2452
|
+
if (c) {
|
|
2376
2453
|
const p = (u) => {
|
|
2377
|
-
const f = (n.get(u.id) || []).map((
|
|
2454
|
+
const f = (n.get(u.id) || []).map((v) => c.get(v)).filter((v) => v !== void 0);
|
|
2378
2455
|
return f.length ? Math.min(...f) : 1 / 0;
|
|
2379
2456
|
};
|
|
2380
|
-
|
|
2457
|
+
h.sort((u, f) => p(u) - p(f) || Le(u, f));
|
|
2381
2458
|
} else
|
|
2382
|
-
|
|
2383
|
-
|
|
2459
|
+
h.sort(Le);
|
|
2460
|
+
c = new Map(h.map((p, u) => [p.id, u])), i.push({ round: d, games: h });
|
|
2384
2461
|
}
|
|
2385
2462
|
return i;
|
|
2386
2463
|
}
|
|
2387
|
-
function
|
|
2388
|
-
const s =
|
|
2389
|
-
return { teamId: s, seed: o, bye: !s && !!
|
|
2464
|
+
function Cs(r, e, t) {
|
|
2465
|
+
const s = r[`${e}TeamId`] || null, a = (t || []).find((n) => n.gameId === r.id && n.slot === e), o = r[`${e}Seed`] ?? a?.seed ?? null;
|
|
2466
|
+
return { teamId: s, seed: o, bye: !s && !!a?.isBye };
|
|
2390
2467
|
}
|
|
2391
|
-
function
|
|
2392
|
-
const
|
|
2393
|
-
return
|
|
2468
|
+
function gt(r) {
|
|
2469
|
+
const e = ne(r);
|
|
2470
|
+
return e === "home" || e === "away" ? e : null;
|
|
2394
2471
|
}
|
|
2395
|
-
function
|
|
2396
|
-
const
|
|
2397
|
-
if (!
|
|
2398
|
-
const s =
|
|
2399
|
-
return s &&
|
|
2472
|
+
function Ps(r, e) {
|
|
2473
|
+
const t = ut(r || [], e || []);
|
|
2474
|
+
if (!t || Array.isArray(t)) return null;
|
|
2475
|
+
const s = gt(t.game);
|
|
2476
|
+
return s && t.game[`${s}TeamId`] || null;
|
|
2400
2477
|
}
|
|
2401
|
-
const
|
|
2402
|
-
function
|
|
2403
|
-
const s =
|
|
2478
|
+
const Ge = { active: 0, setup: 1, complete: 2 };
|
|
2479
|
+
function Bs(r, { id: e, param: t } = {}) {
|
|
2480
|
+
const s = r || [];
|
|
2404
2481
|
if (!s.length) return null;
|
|
2405
|
-
for (const
|
|
2406
|
-
if (!
|
|
2407
|
-
const o = s.find((n) => n.id ===
|
|
2482
|
+
for (const a of [e, t]) {
|
|
2483
|
+
if (!a) continue;
|
|
2484
|
+
const o = s.find((n) => n.id === a);
|
|
2408
2485
|
if (o) return o;
|
|
2409
2486
|
}
|
|
2410
|
-
return [...s].sort((
|
|
2487
|
+
return [...s].sort((a, o) => (Ge[a.status] ?? 3) - (Ge[o.status] ?? 3) || String(a.name || "").localeCompare(String(o.name || "")))[0];
|
|
2411
2488
|
}
|
|
2412
|
-
const
|
|
2489
|
+
const Ds = w`
|
|
2413
2490
|
.bracket { display: flex; gap: 1rem; align-items: stretch; overflow-x: auto; padding-bottom: 0.5rem; }
|
|
2414
2491
|
.round { flex: 0 0 250px; display: flex; flex-direction: column; min-width: 0; }
|
|
2415
2492
|
.roundhead {
|
|
@@ -2455,10 +2532,10 @@ const Ts = y`
|
|
|
2455
2532
|
.champ .tname a { color: inherit; text-decoration: none; font-weight: 700; }
|
|
2456
2533
|
@media (max-width: 720px) { .round { flex-basis: 215px; } }
|
|
2457
2534
|
`;
|
|
2458
|
-
class
|
|
2459
|
-
static styles = [U,
|
|
2535
|
+
class vt extends y {
|
|
2536
|
+
static styles = [U, Ds];
|
|
2460
2537
|
static properties = {
|
|
2461
|
-
...
|
|
2538
|
+
...y.properties,
|
|
2462
2539
|
sport: { type: String },
|
|
2463
2540
|
season: { type: String },
|
|
2464
2541
|
tournamentId: { type: String, attribute: "tournament-id" },
|
|
@@ -2468,31 +2545,31 @@ class me extends b {
|
|
|
2468
2545
|
constructor() {
|
|
2469
2546
|
super(), this.sport = "football", this.season = "", this.tournamentId = "", this.picked = "", this.group = null;
|
|
2470
2547
|
}
|
|
2471
|
-
async fetchData(
|
|
2472
|
-
const
|
|
2473
|
-
if (!o) return { season:
|
|
2474
|
-
const [n, i,
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2548
|
+
async fetchData(e) {
|
|
2549
|
+
const t = this.season || K(), s = (await e.listTournaments({ sport: this.sport, season: t })).items, a = new URLSearchParams(globalThis.location?.search || "").get("tournament"), o = Bs(s, { id: this.picked || this.tournamentId, param: a });
|
|
2550
|
+
if (!o) return { season: t, tournaments: s, tournament: null };
|
|
2551
|
+
const [n, i, c, d, h] = await Promise.all([
|
|
2552
|
+
e.listSeedings(o.id),
|
|
2553
|
+
e.listEdges(o.id),
|
|
2554
|
+
e.listGames({ tournamentId: o.id }),
|
|
2555
|
+
e.listSchools(),
|
|
2556
|
+
e.listTeams({ sport: this.sport })
|
|
2480
2557
|
]);
|
|
2481
2558
|
return {
|
|
2482
|
-
season:
|
|
2559
|
+
season: t,
|
|
2483
2560
|
tournaments: s,
|
|
2484
2561
|
tournament: o,
|
|
2485
2562
|
seedings: n.items,
|
|
2486
2563
|
edges: i.items,
|
|
2487
|
-
games:
|
|
2488
|
-
schools:
|
|
2489
|
-
teams:
|
|
2564
|
+
games: c.items,
|
|
2565
|
+
schools: d.items,
|
|
2566
|
+
teams: h.items
|
|
2490
2567
|
};
|
|
2491
2568
|
}
|
|
2492
2569
|
get ctx() {
|
|
2493
2570
|
return (!this._ctx || this._ctxData !== this.data) && (this._ctx = {
|
|
2494
|
-
teamsById:
|
|
2495
|
-
schoolsById:
|
|
2571
|
+
teamsById: b(this.data.teams),
|
|
2572
|
+
schoolsById: b(this.data.schools),
|
|
2496
2573
|
records: {},
|
|
2497
2574
|
rankings: [],
|
|
2498
2575
|
hrefs: O(this),
|
|
@@ -2500,107 +2577,107 @@ class me extends b {
|
|
|
2500
2577
|
}, this._ctxData = this.data), this._ctx;
|
|
2501
2578
|
}
|
|
2502
2579
|
/** Switch tournaments: remember the pick, deep-link it, reload the scoped data. */
|
|
2503
|
-
pick(
|
|
2504
|
-
if (
|
|
2505
|
-
this.picked =
|
|
2580
|
+
pick(e) {
|
|
2581
|
+
if (e !== this.data?.tournament?.id) {
|
|
2582
|
+
this.picked = e, this.group = null;
|
|
2506
2583
|
try {
|
|
2507
|
-
const
|
|
2508
|
-
|
|
2584
|
+
const t = new URL(globalThis.location.href);
|
|
2585
|
+
t.searchParams.set("tournament", e), globalThis.history?.replaceState(null, "", t);
|
|
2509
2586
|
} catch {
|
|
2510
2587
|
}
|
|
2511
2588
|
this.load();
|
|
2512
2589
|
}
|
|
2513
2590
|
}
|
|
2514
2591
|
renderView() {
|
|
2515
|
-
const
|
|
2516
|
-
title:
|
|
2517
|
-
sub:
|
|
2518
|
-
teams:
|
|
2592
|
+
const e = this.data, t = this.ctx, s = le(this, t, {
|
|
2593
|
+
title: l`${k(this.sport)} playoff brackets`,
|
|
2594
|
+
sub: e.tournament ? l`${e.tournament.name} · ${e.season} season` : l`${e.season} season`,
|
|
2595
|
+
teams: e.teams
|
|
2519
2596
|
});
|
|
2520
|
-
if (!
|
|
2521
|
-
return
|
|
2597
|
+
if (!e.tournament)
|
|
2598
|
+
return l`${s}${B(this, l`
|
|
2522
2599
|
${D(this)}
|
|
2523
|
-
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${
|
|
2600
|
+
<div class="card"><div class="empty">No ${this.sport} brackets have been published for the ${e.season} season yet.</div></div>
|
|
2524
2601
|
`)}`;
|
|
2525
|
-
const
|
|
2526
|
-
return
|
|
2602
|
+
const a = Ts(e.tournament, e.games), o = a.find((p) => p.key === this.group) || a[0], n = (e.tournament.groupNames || []).length >= 2 ? e.tournament.groupNames.length : 1, i = (Number(e.tournament.size) || 0) / n, c = Es(e.games, e.edges, o), d = _s(e.games), h = Ps(e.games, e.edges);
|
|
2603
|
+
return l`
|
|
2527
2604
|
${s}
|
|
2528
|
-
${
|
|
2605
|
+
${B(this, l`
|
|
2529
2606
|
${D(this)}
|
|
2530
2607
|
<div class="toolbar">
|
|
2531
|
-
${
|
|
2608
|
+
${e.tournaments.length > 1 ? l`
|
|
2532
2609
|
<div role="group" aria-label="Tournament">
|
|
2533
|
-
${
|
|
2610
|
+
${e.tournaments.map((p) => l`<button class="chip ${p.id === e.tournament.id ? "on" : ""}"
|
|
2534
2611
|
@click=${() => this.pick(p.id)}>${p.name}</button>`)}
|
|
2535
2612
|
</div>` : m}
|
|
2536
|
-
${
|
|
2613
|
+
${a.length > 1 ? l`
|
|
2537
2614
|
<div role="tablist" aria-label="Bracket group">
|
|
2538
|
-
${
|
|
2615
|
+
${a.map((p) => l`<button class="chip ${p.key === o.key ? "on" : ""}" role="tab"
|
|
2539
2616
|
aria-selected=${p.key === o.key ? "true" : "false"}
|
|
2540
2617
|
@click=${() => {
|
|
2541
2618
|
this.group = p.key;
|
|
2542
2619
|
}}>${p.name}</button>`)}
|
|
2543
2620
|
</div>` : m}
|
|
2544
2621
|
<span class="spacer"></span>
|
|
2545
|
-
<span class="pill ${
|
|
2546
|
-
<span class="asof">${
|
|
2622
|
+
<span class="pill ${d === "complete" ? "final" : d === "active" ? "class" : "type"}">${d === "complete" ? "Complete" : d === "active" ? "In progress" : "Bracket set"}</span>
|
|
2623
|
+
<span class="asof">${e.tournament.size}-team ${String(e.tournament.format || "").replace(/_/g, " ")}</span>
|
|
2547
2624
|
</div>
|
|
2548
|
-
${
|
|
2549
|
-
${
|
|
2550
|
-
${
|
|
2625
|
+
${h ? l`<div class="champ"><span class="pill champ">Champion</span>
|
|
2626
|
+
${P(C(t, h), 26)}<span class="tname">${re(t, h)}</span></div>` : m}
|
|
2627
|
+
${c.length ? l`
|
|
2551
2628
|
<div class="bracket" role="region" aria-label="${o.name} bracket">
|
|
2552
|
-
${
|
|
2629
|
+
${c.map((p) => l`
|
|
2553
2630
|
<section class="round">
|
|
2554
|
-
<h3 class="roundhead">${
|
|
2555
|
-
<div class="games">${p.games.map((u) => this.renderMatchup(
|
|
2631
|
+
<h3 class="roundhead">${Ss({ round: p.round, perGroup: i, groupCount: n })}</h3>
|
|
2632
|
+
<div class="games">${p.games.map((u) => this.renderMatchup(t, u))}</div>
|
|
2556
2633
|
</section>`)}
|
|
2557
|
-
</div>` :
|
|
2634
|
+
</div>` : l`<div class="card"><div class="empty">This bracket has no games yet.</div></div>`}
|
|
2558
2635
|
`)}
|
|
2559
2636
|
`;
|
|
2560
2637
|
}
|
|
2561
|
-
renderMatchup(
|
|
2562
|
-
const s =
|
|
2563
|
-
return
|
|
2564
|
-
<article class="matchup ${
|
|
2565
|
-
${this.renderSlot(
|
|
2566
|
-
${this.renderSlot(
|
|
2638
|
+
renderMatchup(e, t) {
|
|
2639
|
+
const s = t.homeTeamId && t.awayTeamId || t.state === "final" || t.state === "live";
|
|
2640
|
+
return l`
|
|
2641
|
+
<article class="matchup ${t.state}" aria-label="${t.label || "Matchup"}">
|
|
2642
|
+
${this.renderSlot(e, t, "home")}
|
|
2643
|
+
${this.renderSlot(e, t, "away")}
|
|
2567
2644
|
<footer class="mfoot">
|
|
2568
|
-
${
|
|
2569
|
-
${
|
|
2645
|
+
${V(t)}
|
|
2646
|
+
${t.label ? l`<span class="label">${t.label}</span>` : m}
|
|
2570
2647
|
<span class="spacer"></span>
|
|
2571
|
-
${s ?
|
|
2648
|
+
${s ? l`<a class="box" href=${g(e.hrefs.game, { sport: this.sport, id: t.id })}>Box score</a>` : m}
|
|
2572
2649
|
</footer>
|
|
2573
2650
|
</article>
|
|
2574
2651
|
`;
|
|
2575
2652
|
}
|
|
2576
|
-
renderSlot(
|
|
2577
|
-
const { teamId:
|
|
2578
|
-
return
|
|
2653
|
+
renderSlot(e, t, s) {
|
|
2654
|
+
const { teamId: a, seed: o, bye: n } = Cs(t, s, this.data.seedings), i = gt(t), c = t.state === "live" || t.state === "final";
|
|
2655
|
+
return l`
|
|
2579
2656
|
<div class="slot ${i ? i === s ? "winner" : "loser" : ""}">
|
|
2580
2657
|
<span class="seed">${o ?? ""}</span>
|
|
2581
|
-
${
|
|
2582
|
-
${
|
|
2658
|
+
${a ? l`${P(C(e, a), 22)}<span class="tname">${re(e, a, t.date)}</span>` : n ? l`<span class="tname bye">Bye</span>` : l`<span class="tname mut">TBD</span>`}
|
|
2659
|
+
${c ? l`<span class="score">${t[`${s}Score`] ?? 0}</span>` : m}
|
|
2583
2660
|
</div>
|
|
2584
2661
|
`;
|
|
2585
2662
|
}
|
|
2586
2663
|
}
|
|
2587
|
-
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets",
|
|
2588
|
-
const
|
|
2589
|
-
"hsot-scores":
|
|
2590
|
-
"hsot-standings":
|
|
2591
|
-
"hsot-rankings":
|
|
2592
|
-
"hsot-school":
|
|
2593
|
-
"hsot-boxscore":
|
|
2594
|
-
"hsot-school-search":
|
|
2595
|
-
"hsot-brackets":
|
|
2664
|
+
globalThis?.customElements && !globalThis.customElements.get("hsot-brackets") && globalThis.customElements.define("hsot-brackets", vt);
|
|
2665
|
+
const zs = {
|
|
2666
|
+
"hsot-scores": ot,
|
|
2667
|
+
"hsot-standings": nt,
|
|
2668
|
+
"hsot-rankings": it,
|
|
2669
|
+
"hsot-school": lt,
|
|
2670
|
+
"hsot-boxscore": pt,
|
|
2671
|
+
"hsot-school-search": mt,
|
|
2672
|
+
"hsot-brackets": vt
|
|
2596
2673
|
};
|
|
2597
|
-
function
|
|
2598
|
-
const
|
|
2599
|
-
if (
|
|
2600
|
-
for (const [
|
|
2601
|
-
|
|
2674
|
+
function Rs() {
|
|
2675
|
+
const r = globalThis?.customElements;
|
|
2676
|
+
if (r)
|
|
2677
|
+
for (const [e, t] of Object.entries(zs))
|
|
2678
|
+
r.get(e) || r.define(e, t);
|
|
2602
2679
|
}
|
|
2603
|
-
typeof window < "u" && globalThis.customElements &&
|
|
2680
|
+
typeof window < "u" && globalThis.customElements && Rs();
|
|
2604
2681
|
export {
|
|
2605
|
-
|
|
2682
|
+
Rs as defineAll
|
|
2606
2683
|
};
|