@sensiblestats/widget-react 0.151.0 → 0.152.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +440 -364
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +230 -154
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/StatsWidget.tsx
|
|
41
|
-
var
|
|
41
|
+
var import_react123 = require("react");
|
|
42
42
|
var import_widget_sdk40 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -1386,7 +1386,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
|
|
1388
1388
|
// src/version.generated.ts
|
|
1389
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1389
|
+
var WIDGET_REACT_VERSION = "0.152.0";
|
|
1390
1390
|
|
|
1391
1391
|
// src/config.ts
|
|
1392
1392
|
function hostTag(cfg) {
|
|
@@ -8228,14 +8228,16 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown)
|
|
|
8228
8228
|
var import_react55 = require("react");
|
|
8229
8229
|
var CLEARED = { text: null, asks: [] };
|
|
8230
8230
|
function useMobileBinding(args) {
|
|
8231
|
-
const { binding, panelOpen, popupText, asks, cta } = args;
|
|
8231
|
+
const { binding, panelOpen, popupText, asks, cta, price } = args;
|
|
8232
8232
|
const latest = (0, import_react55.useRef)(args);
|
|
8233
8233
|
latest.current = args;
|
|
8234
8234
|
const bindingRef = (0, import_react55.useRef)(binding);
|
|
8235
8235
|
bindingRef.current = binding;
|
|
8236
8236
|
const backRef = (0, import_react55.useRef)(null);
|
|
8237
|
+
const priceRef = (0, import_react55.useRef)(null);
|
|
8238
|
+
const priceInFlight = (0, import_react55.useRef)(/* @__PURE__ */ new Set()).current;
|
|
8237
8239
|
const [confirmedShown, setConfirmedShown] = (0, import_react55.useState)(null);
|
|
8238
|
-
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta]);
|
|
8240
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta, price]);
|
|
8239
8241
|
const reported = (0, import_react55.useRef)({ binding: void 0, key: "" });
|
|
8240
8242
|
(0, import_react55.useEffect)(() => {
|
|
8241
8243
|
if (!binding) return;
|
|
@@ -8243,7 +8245,7 @@ function useMobileBinding(args) {
|
|
|
8243
8245
|
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
8244
8246
|
reported.current = { binding, key: teaserKey };
|
|
8245
8247
|
if (teaserKey === "" && prev.binding !== binding) return;
|
|
8246
|
-
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {} });
|
|
8248
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {}, ...price ? { price } : {} });
|
|
8247
8249
|
}, [binding, teaserKey]);
|
|
8248
8250
|
(0, import_react55.useEffect)(() => {
|
|
8249
8251
|
if (!binding) return;
|
|
@@ -8259,6 +8261,12 @@ function useMobileBinding(args) {
|
|
|
8259
8261
|
tapCta: () => {
|
|
8260
8262
|
if (latest.current.cta) latest.current.onCta();
|
|
8261
8263
|
},
|
|
8264
|
+
tapTeaser: () => latest.current.onTeaserTap(),
|
|
8265
|
+
tapPrice: (matchOddsId) => {
|
|
8266
|
+
const { panelOpen: open, popupText: text2, price: shown2 } = latest.current;
|
|
8267
|
+
if (open || !text2 || shown2?.matchOddsId !== matchOddsId) return;
|
|
8268
|
+
priceRef.current?.();
|
|
8269
|
+
},
|
|
8262
8270
|
dismissTeaser: () => latest.current.dismissPopup(),
|
|
8263
8271
|
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
8264
8272
|
back: () => backRef.current?.() ?? false
|
|
@@ -8269,8 +8277,12 @@ function useMobileBinding(args) {
|
|
|
8269
8277
|
const onRegisterBack = (0, import_react55.useCallback)((fn) => {
|
|
8270
8278
|
backRef.current = fn;
|
|
8271
8279
|
}, []);
|
|
8272
|
-
|
|
8273
|
-
|
|
8280
|
+
const onRegisterPrice = (0, import_react55.useCallback)((fn) => {
|
|
8281
|
+
priceRef.current = fn;
|
|
8282
|
+
}, []);
|
|
8283
|
+
const onPriceResult = (0, import_react55.useCallback)((result) => bindingRef.current?.onPriceResult(result), []);
|
|
8284
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0, onRegisterPrice: void 0, onPriceResult: void 0, priceInFlight: void 0 };
|
|
8285
|
+
return { confirmedShown, onCloseRequested, onRegisterBack, onRegisterPrice, onPriceResult, priceInFlight };
|
|
8274
8286
|
}
|
|
8275
8287
|
|
|
8276
8288
|
// src/openTelemetry.ts
|
|
@@ -8372,11 +8384,44 @@ function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
|
|
|
8372
8384
|
] });
|
|
8373
8385
|
}
|
|
8374
8386
|
|
|
8387
|
+
// src/components/MobileBubblePrice.tsx
|
|
8388
|
+
var import_react60 = require("react");
|
|
8389
|
+
function MobileBubblePrice(props) {
|
|
8390
|
+
const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
|
|
8391
|
+
const latest = (0, import_react60.useRef)({ props, add });
|
|
8392
|
+
latest.current = { props, add };
|
|
8393
|
+
const { onRegister, inFlight: inFlight2 } = props;
|
|
8394
|
+
(0, import_react60.useEffect)(() => {
|
|
8395
|
+
onRegister(() => {
|
|
8396
|
+
const { props: p, add: run } = latest.current;
|
|
8397
|
+
const id = p.price.selection.matchOddsId;
|
|
8398
|
+
if (inFlight2.has(id)) return;
|
|
8399
|
+
const report = (r) => {
|
|
8400
|
+
const now = latest.current.props;
|
|
8401
|
+
try {
|
|
8402
|
+
now.onResult({ matchOddsId: id, outcome: r.outcome, text: r.toast?.text ?? (r.outcome === "gone" ? now.ui.v2PriceGone : null) });
|
|
8403
|
+
} catch {
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
if (!run) {
|
|
8407
|
+
report({ outcome: "failed" });
|
|
8408
|
+
return;
|
|
8409
|
+
}
|
|
8410
|
+
inFlight2.add(id);
|
|
8411
|
+
run(p.matchId, p.price.market, p.price.selection, p.hook).then(report, () => report({ outcome: "failed" })).finally(() => {
|
|
8412
|
+
inFlight2.delete(id);
|
|
8413
|
+
});
|
|
8414
|
+
});
|
|
8415
|
+
return () => onRegister(null);
|
|
8416
|
+
}, [onRegister, inFlight2]);
|
|
8417
|
+
return null;
|
|
8418
|
+
}
|
|
8419
|
+
|
|
8375
8420
|
// src/components/ChatPanel.tsx
|
|
8376
|
-
var
|
|
8421
|
+
var import_react122 = require("react");
|
|
8377
8422
|
|
|
8378
8423
|
// src/components/ChatHeader.tsx
|
|
8379
|
-
var
|
|
8424
|
+
var import_react61 = require("react");
|
|
8380
8425
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8381
8426
|
function ChatHeader({
|
|
8382
8427
|
onClose,
|
|
@@ -8392,18 +8437,18 @@ function ChatHeader({
|
|
|
8392
8437
|
onOpenFavourites,
|
|
8393
8438
|
favouritesLabel
|
|
8394
8439
|
}) {
|
|
8395
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
8396
|
-
const wrapRef = (0,
|
|
8397
|
-
const kebabRef = (0,
|
|
8398
|
-
const firstItemRef = (0,
|
|
8440
|
+
const [menuOpen, setMenuOpen] = (0, import_react61.useState)(false);
|
|
8441
|
+
const wrapRef = (0, import_react61.useRef)(null);
|
|
8442
|
+
const kebabRef = (0, import_react61.useRef)(null);
|
|
8443
|
+
const firstItemRef = (0, import_react61.useRef)(null);
|
|
8399
8444
|
const hasNew = !!(canReset && onNewConversation);
|
|
8400
8445
|
const hasSettings = !!onOpenSettings;
|
|
8401
8446
|
const hasFavourites = !!onOpenFavourites;
|
|
8402
8447
|
const hasMenu = hasFavourites || hasNew || hasSettings;
|
|
8403
|
-
(0,
|
|
8448
|
+
(0, import_react61.useEffect)(() => {
|
|
8404
8449
|
if (menuOpen) firstItemRef.current?.focus();
|
|
8405
8450
|
}, [menuOpen]);
|
|
8406
|
-
(0,
|
|
8451
|
+
(0, import_react61.useEffect)(() => {
|
|
8407
8452
|
if (!menuOpen) return;
|
|
8408
8453
|
const onPointer = (e) => {
|
|
8409
8454
|
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
@@ -8491,10 +8536,10 @@ function ChatHeader({
|
|
|
8491
8536
|
}
|
|
8492
8537
|
|
|
8493
8538
|
// src/components/MessageList.tsx
|
|
8494
|
-
var
|
|
8539
|
+
var import_react76 = require("react");
|
|
8495
8540
|
|
|
8496
8541
|
// src/components/ChatMessage.tsx
|
|
8497
|
-
var
|
|
8542
|
+
var import_react75 = require("react");
|
|
8498
8543
|
|
|
8499
8544
|
// src/components/Markdown.tsx
|
|
8500
8545
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8512,7 +8557,7 @@ function Markdown({ text: text2 }) {
|
|
|
8512
8557
|
}
|
|
8513
8558
|
|
|
8514
8559
|
// src/components/EntityCardList.tsx
|
|
8515
|
-
var
|
|
8560
|
+
var import_react62 = require("react");
|
|
8516
8561
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8517
8562
|
var MAX_VISIBLE = 3;
|
|
8518
8563
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -8615,7 +8660,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
8615
8660
|
)) });
|
|
8616
8661
|
}
|
|
8617
8662
|
function EntityCardItem({ c }) {
|
|
8618
|
-
const [active, setActive] = (0,
|
|
8663
|
+
const [active, setActive] = (0, import_react62.useState)(0);
|
|
8619
8664
|
const hasBody = c.scopes.length > 0;
|
|
8620
8665
|
if (!hasBody) {
|
|
8621
8666
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -8630,7 +8675,7 @@ function EntityCardItem({ c }) {
|
|
|
8630
8675
|
] });
|
|
8631
8676
|
}
|
|
8632
8677
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
8633
|
-
const [expanded, setExpanded] = (0,
|
|
8678
|
+
const [expanded, setExpanded] = (0, import_react62.useState)(false);
|
|
8634
8679
|
if (cards.length === 0) return null;
|
|
8635
8680
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
8636
8681
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -8779,20 +8824,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
8779
8824
|
}
|
|
8780
8825
|
|
|
8781
8826
|
// src/components/ComboCardList.tsx
|
|
8782
|
-
var
|
|
8827
|
+
var import_react65 = require("react");
|
|
8783
8828
|
|
|
8784
8829
|
// src/components/AddAllToSlipButton.tsx
|
|
8785
|
-
var
|
|
8830
|
+
var import_react63 = require("react");
|
|
8786
8831
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
8787
8832
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
8788
8833
|
const add = useSlipAdd(slip, ui);
|
|
8789
8834
|
const slipState = useSlipState();
|
|
8790
8835
|
const log = useEventLog();
|
|
8791
8836
|
const track = useTrack();
|
|
8792
|
-
const [pending, setPending] = (0,
|
|
8793
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
8794
|
-
const [toast, setToast] = (0,
|
|
8795
|
-
const dismiss = (0,
|
|
8837
|
+
const [pending, setPending] = (0, import_react63.useState)(false);
|
|
8838
|
+
const [settledLocal, setSettledLocal] = (0, import_react63.useState)({});
|
|
8839
|
+
const [toast, setToast] = (0, import_react63.useState)(null);
|
|
8840
|
+
const dismiss = (0, import_react63.useCallback)(() => setToast(null), []);
|
|
8796
8841
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
8797
8842
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
8798
8843
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -8865,10 +8910,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
8865
8910
|
}
|
|
8866
8911
|
|
|
8867
8912
|
// src/presetToolsContext.ts
|
|
8868
|
-
var
|
|
8869
|
-
var PresetToolsContext = (0,
|
|
8913
|
+
var import_react64 = require("react");
|
|
8914
|
+
var PresetToolsContext = (0, import_react64.createContext)(null);
|
|
8870
8915
|
function usePresetTools() {
|
|
8871
|
-
return (0,
|
|
8916
|
+
return (0, import_react64.useContext)(PresetToolsContext);
|
|
8872
8917
|
}
|
|
8873
8918
|
|
|
8874
8919
|
// src/components/ComboCardList.tsx
|
|
@@ -8882,7 +8927,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
|
|
|
8882
8927
|
const showPin = !!monitor && leg.pinEnabled;
|
|
8883
8928
|
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
8884
8929
|
const line = leg.statText ?? factText;
|
|
8885
|
-
const noteId = (0,
|
|
8930
|
+
const noteId = (0, import_react65.useId)();
|
|
8886
8931
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
8887
8932
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
8888
8933
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -9506,7 +9551,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
9506
9551
|
}
|
|
9507
9552
|
|
|
9508
9553
|
// src/components/NflInsightList.tsx
|
|
9509
|
-
var
|
|
9554
|
+
var import_react66 = require("react");
|
|
9510
9555
|
|
|
9511
9556
|
// src/strings/types.ts
|
|
9512
9557
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
@@ -9523,7 +9568,7 @@ function teamImage(vm, abbr) {
|
|
|
9523
9568
|
return void 0;
|
|
9524
9569
|
}
|
|
9525
9570
|
function Badge({ abbr, url }) {
|
|
9526
|
-
const [failed, setFailed] = (0,
|
|
9571
|
+
const [failed, setFailed] = (0, import_react66.useState)(false);
|
|
9527
9572
|
if (url && !failed) {
|
|
9528
9573
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
9529
9574
|
}
|
|
@@ -10134,7 +10179,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10134
10179
|
}
|
|
10135
10180
|
|
|
10136
10181
|
// src/components/CompactOddsList.tsx
|
|
10137
|
-
var
|
|
10182
|
+
var import_react67 = require("react");
|
|
10138
10183
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
10139
10184
|
|
|
10140
10185
|
// src/compactList.ts
|
|
@@ -10256,11 +10301,11 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10256
10301
|
] });
|
|
10257
10302
|
}
|
|
10258
10303
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
10259
|
-
const [shown2, setShown] = (0,
|
|
10304
|
+
const [shown2, setShown] = (0, import_react67.useState)(COMPACT_PAGE);
|
|
10260
10305
|
const hidden = list.rowCount - shown2;
|
|
10261
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
10262
|
-
const focusRef = (0,
|
|
10263
|
-
(0,
|
|
10306
|
+
const [focusIndex, setFocusIndex] = (0, import_react67.useState)(null);
|
|
10307
|
+
const focusRef = (0, import_react67.useRef)(null);
|
|
10308
|
+
(0, import_react67.useEffect)(() => {
|
|
10264
10309
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
10265
10310
|
}, [focusIndex]);
|
|
10266
10311
|
let left = shown2;
|
|
@@ -10495,7 +10540,7 @@ function FixtureCard({ card, ui }) {
|
|
|
10495
10540
|
}
|
|
10496
10541
|
|
|
10497
10542
|
// src/components/dashboard/CountdownCard.tsx
|
|
10498
|
-
var
|
|
10543
|
+
var import_react68 = require("react");
|
|
10499
10544
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10500
10545
|
var DAY_MS3 = 864e5;
|
|
10501
10546
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -10514,12 +10559,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
10514
10559
|
function CountdownCard({ card, ui }) {
|
|
10515
10560
|
const { data } = card;
|
|
10516
10561
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
10517
|
-
const [nowMs, setNowMs] = (0,
|
|
10518
|
-
const [reduced] = (0,
|
|
10562
|
+
const [nowMs, setNowMs] = (0, import_react68.useState)(() => Date.now());
|
|
10563
|
+
const [reduced] = (0, import_react68.useState)(
|
|
10519
10564
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
10520
10565
|
);
|
|
10521
10566
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
10522
|
-
(0,
|
|
10567
|
+
(0, import_react68.useEffect)(() => {
|
|
10523
10568
|
if (reduced) return;
|
|
10524
10569
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
10525
10570
|
return () => window.clearInterval(id);
|
|
@@ -10527,7 +10572,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10527
10572
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
10528
10573
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
10529
10574
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
10530
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10575
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react68.Fragment, { children: [
|
|
10531
10576
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
10532
10577
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
10533
10578
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -10538,7 +10583,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10538
10583
|
}
|
|
10539
10584
|
|
|
10540
10585
|
// src/components/dashboard/InjuriesCard.tsx
|
|
10541
|
-
var
|
|
10586
|
+
var import_react69 = require("react");
|
|
10542
10587
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10543
10588
|
var SHOWN = 3;
|
|
10544
10589
|
function ColHead({ name, crestUrl }) {
|
|
@@ -10561,7 +10606,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
10561
10606
|
}
|
|
10562
10607
|
function InjuriesCard({ card, ui }) {
|
|
10563
10608
|
const { data } = card;
|
|
10564
|
-
const [expanded, setExpanded] = (0,
|
|
10609
|
+
const [expanded, setExpanded] = (0, import_react69.useState)(false);
|
|
10565
10610
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
10566
10611
|
const limit = expanded ? void 0 : SHOWN;
|
|
10567
10612
|
const { showMore, showLess } = ui;
|
|
@@ -10666,7 +10711,7 @@ function LinksCard({ card }) {
|
|
|
10666
10711
|
}
|
|
10667
10712
|
|
|
10668
10713
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
10669
|
-
var
|
|
10714
|
+
var import_react70 = require("react");
|
|
10670
10715
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10671
10716
|
function initials3(name) {
|
|
10672
10717
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -10676,7 +10721,7 @@ function PostMatchCrest({
|
|
|
10676
10721
|
name,
|
|
10677
10722
|
side
|
|
10678
10723
|
}) {
|
|
10679
|
-
const [failed, setFailed] = (0,
|
|
10724
|
+
const [failed, setFailed] = (0, import_react70.useState)(false);
|
|
10680
10725
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
10681
10726
|
if (url && !failed) {
|
|
10682
10727
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10875,10 +10920,10 @@ function RestingFormCard({ card }) {
|
|
|
10875
10920
|
}
|
|
10876
10921
|
|
|
10877
10922
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10878
|
-
var
|
|
10923
|
+
var import_react72 = require("react");
|
|
10879
10924
|
|
|
10880
10925
|
// src/useLiveClock.ts
|
|
10881
|
-
var
|
|
10926
|
+
var import_react71 = require("react");
|
|
10882
10927
|
var TICK_MS = 6e4;
|
|
10883
10928
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10884
10929
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10887,10 +10932,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
10887
10932
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
10888
10933
|
}
|
|
10889
10934
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
10890
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10935
|
+
const [displayMinute, setDisplayMinute] = (0, import_react71.useState)(
|
|
10891
10936
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10892
10937
|
);
|
|
10893
|
-
(0,
|
|
10938
|
+
(0, import_react71.useEffect)(() => {
|
|
10894
10939
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10895
10940
|
if (!clockRunning) return;
|
|
10896
10941
|
const id = window.setInterval(() => {
|
|
@@ -10907,7 +10952,7 @@ function initials5(name) {
|
|
|
10907
10952
|
return name.trim().slice(0, 3).toUpperCase();
|
|
10908
10953
|
}
|
|
10909
10954
|
function LiveCrest({ url, name, side }) {
|
|
10910
|
-
const [failed, setFailed] = (0,
|
|
10955
|
+
const [failed, setFailed] = (0, import_react72.useState)(false);
|
|
10911
10956
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
10912
10957
|
if (url && !failed) {
|
|
10913
10958
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10929,7 +10974,7 @@ function LiveScoreCard({
|
|
|
10929
10974
|
}) {
|
|
10930
10975
|
const { data } = card;
|
|
10931
10976
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10932
|
-
const seedRef = (0,
|
|
10977
|
+
const seedRef = (0, import_react72.useRef)(null);
|
|
10933
10978
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10934
10979
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10935
10980
|
}
|
|
@@ -10975,7 +11020,7 @@ function LiveScoreCard({
|
|
|
10975
11020
|
}
|
|
10976
11021
|
|
|
10977
11022
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10978
|
-
var
|
|
11023
|
+
var import_react73 = require("react");
|
|
10979
11024
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10980
11025
|
var SHOWN2 = 3;
|
|
10981
11026
|
function EventIcon({ type }) {
|
|
@@ -11017,7 +11062,7 @@ function EventRow({ e }) {
|
|
|
11017
11062
|
] });
|
|
11018
11063
|
}
|
|
11019
11064
|
function LiveTimelineCard({ card, ui }) {
|
|
11020
|
-
const [expanded, setExpanded] = (0,
|
|
11065
|
+
const [expanded, setExpanded] = (0, import_react73.useState)(false);
|
|
11021
11066
|
const events = card.data.events;
|
|
11022
11067
|
if (!events || events.length === 0) return null;
|
|
11023
11068
|
const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -11041,7 +11086,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
11041
11086
|
}
|
|
11042
11087
|
|
|
11043
11088
|
// src/components/dashboard/MomentumWave.tsx
|
|
11044
|
-
var
|
|
11089
|
+
var import_react74 = require("react");
|
|
11045
11090
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
11046
11091
|
var WIDTH = 270;
|
|
11047
11092
|
var HEIGHT = 56;
|
|
@@ -11066,7 +11111,7 @@ function MomentumWave({
|
|
|
11066
11111
|
}) {
|
|
11067
11112
|
if (points.length === 0) return null;
|
|
11068
11113
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
11069
|
-
const clipId = (0,
|
|
11114
|
+
const clipId = (0, import_react74.useId)();
|
|
11070
11115
|
const topClipId = `${clipId}-top`;
|
|
11071
11116
|
const bottomClipId = `${clipId}-bottom`;
|
|
11072
11117
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -11216,7 +11261,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
11216
11261
|
// src/components/ChatMessage.tsx
|
|
11217
11262
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11218
11263
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
11219
|
-
const [sport, setSport] = (0,
|
|
11264
|
+
const [sport, setSport] = (0, import_react75.useState)(null);
|
|
11220
11265
|
if (message.role === "user") {
|
|
11221
11266
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
11222
11267
|
}
|
|
@@ -11271,11 +11316,11 @@ function turnAnchor(messages) {
|
|
|
11271
11316
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
11272
11317
|
const { state, send } = controller;
|
|
11273
11318
|
const { oddsFormat } = useOddsSettings();
|
|
11274
|
-
const listRef = (0,
|
|
11275
|
-
const endRef = (0,
|
|
11276
|
-
const pinnedRef = (0,
|
|
11277
|
-
const anchoredTurnRef = (0,
|
|
11278
|
-
(0,
|
|
11319
|
+
const listRef = (0, import_react76.useRef)(null);
|
|
11320
|
+
const endRef = (0, import_react76.useRef)(null);
|
|
11321
|
+
const pinnedRef = (0, import_react76.useRef)(true);
|
|
11322
|
+
const anchoredTurnRef = (0, import_react76.useRef)(null);
|
|
11323
|
+
(0, import_react76.useEffect)(() => {
|
|
11279
11324
|
const anchor = turnAnchor(state.messages);
|
|
11280
11325
|
const list = listRef.current;
|
|
11281
11326
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -11334,13 +11379,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
11334
11379
|
}
|
|
11335
11380
|
|
|
11336
11381
|
// src/components/ChatInput.tsx
|
|
11337
|
-
var
|
|
11382
|
+
var import_react77 = require("react");
|
|
11338
11383
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11339
|
-
var ChatInput = (0,
|
|
11340
|
-
const [value, setValue] = (0,
|
|
11341
|
-
const textareaRef = (0,
|
|
11342
|
-
const stopRef = (0,
|
|
11343
|
-
const textBoxWantsFocusRef = (0,
|
|
11384
|
+
var ChatInput = (0, import_react77.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
11385
|
+
const [value, setValue] = (0, import_react77.useState)("");
|
|
11386
|
+
const textareaRef = (0, import_react77.useRef)(null);
|
|
11387
|
+
const stopRef = (0, import_react77.useRef)(null);
|
|
11388
|
+
const textBoxWantsFocusRef = (0, import_react77.useRef)(false);
|
|
11344
11389
|
const submit = () => {
|
|
11345
11390
|
if (disabled) return;
|
|
11346
11391
|
const t = value.trim();
|
|
@@ -11354,7 +11399,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11354
11399
|
submit();
|
|
11355
11400
|
}
|
|
11356
11401
|
};
|
|
11357
|
-
(0,
|
|
11402
|
+
(0, import_react77.useImperativeHandle)(ref, () => ({
|
|
11358
11403
|
focus() {
|
|
11359
11404
|
const box = textareaRef.current;
|
|
11360
11405
|
if (box && !box.disabled) {
|
|
@@ -11366,7 +11411,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11366
11411
|
stopRef.current?.focus();
|
|
11367
11412
|
}
|
|
11368
11413
|
}), []);
|
|
11369
|
-
(0,
|
|
11414
|
+
(0, import_react77.useEffect)(() => {
|
|
11370
11415
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
11371
11416
|
textBoxWantsFocusRef.current = false;
|
|
11372
11417
|
const box = textareaRef.current;
|
|
@@ -11397,7 +11442,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11397
11442
|
});
|
|
11398
11443
|
|
|
11399
11444
|
// src/components/TabBar.tsx
|
|
11400
|
-
var
|
|
11445
|
+
var import_react78 = require("react");
|
|
11401
11446
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11402
11447
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
11403
11448
|
var FOCUS_EDGE = 24;
|
|
@@ -11420,16 +11465,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11420
11465
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
11421
11466
|
];
|
|
11422
11467
|
const track = useTrack();
|
|
11423
|
-
const listRef = (0,
|
|
11468
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
11424
11469
|
const activeTab = monitor.activeTab;
|
|
11425
|
-
(0,
|
|
11470
|
+
(0, import_react78.useEffect)(() => {
|
|
11426
11471
|
const el = listRef.current?.querySelector("[data-on]");
|
|
11427
11472
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
11428
11473
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11429
11474
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
11430
11475
|
}, [activeTab]);
|
|
11431
11476
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
11432
|
-
(0,
|
|
11477
|
+
(0, import_react78.useLayoutEffect)(() => {
|
|
11433
11478
|
const strip = listRef.current;
|
|
11434
11479
|
if (!strip) return;
|
|
11435
11480
|
const measure = () => {
|
|
@@ -11453,7 +11498,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11453
11498
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
11454
11499
|
};
|
|
11455
11500
|
}, [labelSignature]);
|
|
11456
|
-
const pointerDown = (0,
|
|
11501
|
+
const pointerDown = (0, import_react78.useRef)(false);
|
|
11457
11502
|
const keepFocusedTabInView = (e) => {
|
|
11458
11503
|
const strip = e.currentTarget;
|
|
11459
11504
|
const tab = e.target;
|
|
@@ -11513,7 +11558,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11513
11558
|
}
|
|
11514
11559
|
|
|
11515
11560
|
// src/components/MonitorTabs.tsx
|
|
11516
|
-
var
|
|
11561
|
+
var import_react91 = require("react");
|
|
11517
11562
|
|
|
11518
11563
|
// src/components/MarketAccordion.tsx
|
|
11519
11564
|
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
@@ -11575,7 +11620,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11575
11620
|
}
|
|
11576
11621
|
|
|
11577
11622
|
// src/components/MonitorFormH2H.tsx
|
|
11578
|
-
var
|
|
11623
|
+
var import_react79 = require("react");
|
|
11579
11624
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11580
11625
|
function resultClass2(result) {
|
|
11581
11626
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -11591,7 +11636,7 @@ function FormDots({ form, ui }) {
|
|
|
11591
11636
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
11592
11637
|
}
|
|
11593
11638
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
11594
|
-
const [expanded, setExpanded] = (0,
|
|
11639
|
+
const [expanded, setExpanded] = (0, import_react79.useState)(false);
|
|
11595
11640
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
11596
11641
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
11597
11642
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, {});
|
|
@@ -11669,10 +11714,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
|
11669
11714
|
}
|
|
11670
11715
|
|
|
11671
11716
|
// src/components/CompLogo.tsx
|
|
11672
|
-
var
|
|
11717
|
+
var import_react80 = require("react");
|
|
11673
11718
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11674
11719
|
function CompLogo({ url }) {
|
|
11675
|
-
const [failed, setFailed] = (0,
|
|
11720
|
+
const [failed, setFailed] = (0, import_react80.useState)(null);
|
|
11676
11721
|
if (!url || failed === url) return null;
|
|
11677
11722
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
|
|
11678
11723
|
}
|
|
@@ -11830,7 +11875,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11830
11875
|
}
|
|
11831
11876
|
|
|
11832
11877
|
// src/components/NbaMonitorCard.tsx
|
|
11833
|
-
var
|
|
11878
|
+
var import_react84 = require("react");
|
|
11834
11879
|
|
|
11835
11880
|
// src/sportLabel.ts
|
|
11836
11881
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -11840,7 +11885,7 @@ var sportLabel = (ui, sport) => {
|
|
|
11840
11885
|
};
|
|
11841
11886
|
|
|
11842
11887
|
// src/components/NbaFormSection.tsx
|
|
11843
|
-
var
|
|
11888
|
+
var import_react81 = require("react");
|
|
11844
11889
|
|
|
11845
11890
|
// src/components/NbaFormRest.tsx
|
|
11846
11891
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
@@ -11940,8 +11985,8 @@ function Row3({ game, abbr, tonight, ui }) {
|
|
|
11940
11985
|
] });
|
|
11941
11986
|
}
|
|
11942
11987
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11943
|
-
const [open, setOpen] = (0,
|
|
11944
|
-
const [side, setSide] = (0,
|
|
11988
|
+
const [open, setOpen] = (0, import_react81.useState)(false);
|
|
11989
|
+
const [side, setSide] = (0, import_react81.useState)("away");
|
|
11945
11990
|
const form = useNbaForm(match, monitor);
|
|
11946
11991
|
const b = match.basketball;
|
|
11947
11992
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11986,10 +12031,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11986
12031
|
}
|
|
11987
12032
|
|
|
11988
12033
|
// src/components/NbaPropsSection.tsx
|
|
11989
|
-
var
|
|
12034
|
+
var import_react83 = require("react");
|
|
11990
12035
|
|
|
11991
12036
|
// src/components/PropsPieces.tsx
|
|
11992
|
-
var
|
|
12037
|
+
var import_react82 = require("react");
|
|
11993
12038
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11994
12039
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11995
12040
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -12002,9 +12047,9 @@ function preKickoff(match) {
|
|
|
12002
12047
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
12003
12048
|
}
|
|
12004
12049
|
function usePreKickoff(match) {
|
|
12005
|
-
const [, setTick] = (0,
|
|
12050
|
+
const [, setTick] = (0, import_react82.useState)(0);
|
|
12006
12051
|
const pre = preKickoff(match);
|
|
12007
|
-
(0,
|
|
12052
|
+
(0, import_react82.useEffect)(() => {
|
|
12008
12053
|
if (!pre || !match.kickoffUtc) return;
|
|
12009
12054
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
12010
12055
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -12018,7 +12063,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
12018
12063
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
12019
12064
|
const live = match.phase === "live";
|
|
12020
12065
|
const open = pre || live;
|
|
12021
|
-
(0,
|
|
12066
|
+
(0, import_react82.useEffect)(() => {
|
|
12022
12067
|
if (!open) return;
|
|
12023
12068
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
12024
12069
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -12096,7 +12141,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
12096
12141
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
12097
12142
|
const player = livePlayer(bundle, given);
|
|
12098
12143
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
12099
|
-
const [picked, setPicked] = (0,
|
|
12144
|
+
const [picked, setPicked] = (0, import_react82.useState)(null);
|
|
12100
12145
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
12101
12146
|
const sample = active?.games?.length ?? 0;
|
|
12102
12147
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -12145,8 +12190,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
12145
12190
|
] });
|
|
12146
12191
|
}
|
|
12147
12192
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
12148
|
-
const [openId, setOpenId] = (0,
|
|
12149
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
12193
|
+
const [openId, setOpenId] = (0, import_react82.useState)(null);
|
|
12194
|
+
const [brokenShots, setBrokenShots] = (0, import_react82.useState)(/* @__PURE__ */ new Set());
|
|
12150
12195
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
12151
12196
|
const p = livePlayer(bundle, given);
|
|
12152
12197
|
const isOpen = openId === p.playerId;
|
|
@@ -12192,12 +12237,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
12192
12237
|
}
|
|
12193
12238
|
var BOX_QUIET_MS = 12e4;
|
|
12194
12239
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
12195
|
-
const [tick, setTick] = (0,
|
|
12240
|
+
const [tick, setTick] = (0, import_react82.useState)(0);
|
|
12196
12241
|
const time = clock2(boxAsOfUtc, ui);
|
|
12197
12242
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
12198
12243
|
const valid = !Number.isNaN(at2);
|
|
12199
12244
|
const onBreak = atBreak(match);
|
|
12200
|
-
(0,
|
|
12245
|
+
(0, import_react82.useEffect)(() => {
|
|
12201
12246
|
if (!valid || onBreak) return;
|
|
12202
12247
|
const age2 = Date.now() - at2;
|
|
12203
12248
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12258,12 +12303,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
12258
12303
|
tenGameBars: false
|
|
12259
12304
|
});
|
|
12260
12305
|
function StatsClock2({ bundle, match, ui }) {
|
|
12261
|
-
const [tick, setTick] = (0,
|
|
12306
|
+
const [tick, setTick] = (0, import_react83.useState)(0);
|
|
12262
12307
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
12263
12308
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
12264
12309
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
12265
12310
|
const onBreak = atBreak(match);
|
|
12266
|
-
(0,
|
|
12311
|
+
(0, import_react83.useEffect)(() => {
|
|
12267
12312
|
if (!valid || onBreak) return;
|
|
12268
12313
|
const age2 = Date.now() - at2;
|
|
12269
12314
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12277,7 +12322,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
12277
12322
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
12278
12323
|
}
|
|
12279
12324
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
12280
|
-
const [side, setSide] = (0,
|
|
12325
|
+
const [side, setSide] = (0, import_react83.useState)("home");
|
|
12281
12326
|
const descriptor = nbaDescriptor(ui, match);
|
|
12282
12327
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12283
12328
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12315,7 +12360,7 @@ function city(teamName, nickname) {
|
|
|
12315
12360
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
12316
12361
|
}
|
|
12317
12362
|
function BadgeCrest({ url, abbreviation }) {
|
|
12318
|
-
const [failed, setFailed] = (0,
|
|
12363
|
+
const [failed, setFailed] = (0, import_react84.useState)(false);
|
|
12319
12364
|
if (url && !failed) {
|
|
12320
12365
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
12321
12366
|
}
|
|
@@ -12450,7 +12495,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12450
12495
|
}
|
|
12451
12496
|
|
|
12452
12497
|
// src/components/NflFormSection.tsx
|
|
12453
|
-
var
|
|
12498
|
+
var import_react85 = require("react");
|
|
12454
12499
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12455
12500
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
12456
12501
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -12503,7 +12548,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
12503
12548
|
] });
|
|
12504
12549
|
}
|
|
12505
12550
|
function NflFormSection({ match, monitor, ui }) {
|
|
12506
|
-
const [segment, setSegment] = (0,
|
|
12551
|
+
const [segment, setSegment] = (0, import_react85.useState)("away");
|
|
12507
12552
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
12508
12553
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
12509
12554
|
const form = bundle?.form;
|
|
@@ -12536,7 +12581,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
12536
12581
|
}
|
|
12537
12582
|
|
|
12538
12583
|
// src/components/NflPropsSection.tsx
|
|
12539
|
-
var
|
|
12584
|
+
var import_react86 = require("react");
|
|
12540
12585
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12541
12586
|
var TRENDS_SHOWN = 3;
|
|
12542
12587
|
var SCORERS_SHOWN = 8;
|
|
@@ -12609,7 +12654,7 @@ function ShowMore({ label, onClick }) {
|
|
|
12609
12654
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
12610
12655
|
}
|
|
12611
12656
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
12612
|
-
const [all, setAll] = (0,
|
|
12657
|
+
const [all, setAll] = (0, import_react86.useState)(false);
|
|
12613
12658
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
12614
12659
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
12615
12660
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -12642,7 +12687,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
12642
12687
|
] });
|
|
12643
12688
|
}
|
|
12644
12689
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
12645
|
-
const [all, setAll] = (0,
|
|
12690
|
+
const [all, setAll] = (0, import_react86.useState)(false);
|
|
12646
12691
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
12647
12692
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
12648
12693
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -12672,7 +12717,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
12672
12717
|
] });
|
|
12673
12718
|
}
|
|
12674
12719
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
12675
|
-
const [tab, setTab] = (0,
|
|
12720
|
+
const [tab, setTab] = (0, import_react86.useState)(null);
|
|
12676
12721
|
const descriptor = nflDescriptor(ui);
|
|
12677
12722
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12678
12723
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12872,14 +12917,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12872
12917
|
}
|
|
12873
12918
|
|
|
12874
12919
|
// src/components/TennisMonitorCard.tsx
|
|
12875
|
-
var
|
|
12920
|
+
var import_react89 = require("react");
|
|
12876
12921
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12877
12922
|
|
|
12878
12923
|
// src/components/TennisFixtureRow.tsx
|
|
12879
12924
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12880
12925
|
|
|
12881
12926
|
// src/components/FixtureRow.tsx
|
|
12882
|
-
var
|
|
12927
|
+
var import_react87 = require("react");
|
|
12883
12928
|
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
12884
12929
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12885
12930
|
function splitAtFirstSpace(label) {
|
|
@@ -12893,7 +12938,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
12893
12938
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
12894
12939
|
}
|
|
12895
12940
|
function Side2({ name, crest, abbr, away = false }) {
|
|
12896
|
-
const [failed, setFailed] = (0,
|
|
12941
|
+
const [failed, setFailed] = (0, import_react87.useState)(false);
|
|
12897
12942
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
12898
12943
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
12899
12944
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -13135,7 +13180,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
13135
13180
|
}
|
|
13136
13181
|
|
|
13137
13182
|
// src/components/TennisStatsTables.tsx
|
|
13138
|
-
var
|
|
13183
|
+
var import_react88 = require("react");
|
|
13139
13184
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13140
13185
|
function formatStat(row, value, locale) {
|
|
13141
13186
|
if (value == null) return "\u2013";
|
|
@@ -13173,8 +13218,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
13173
13218
|
] });
|
|
13174
13219
|
}
|
|
13175
13220
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
13176
|
-
const [tab, setTab] = (0,
|
|
13177
|
-
(0,
|
|
13221
|
+
const [tab, setTab] = (0, import_react88.useState)("match");
|
|
13222
|
+
(0, import_react88.useEffect)(() => {
|
|
13178
13223
|
setTab("match");
|
|
13179
13224
|
}, [resetKey]);
|
|
13180
13225
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -13205,7 +13250,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
13205
13250
|
] }),
|
|
13206
13251
|
today.rows.map((r) => {
|
|
13207
13252
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
13208
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
13253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_react88.Fragment, { children: [
|
|
13209
13254
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
13210
13255
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
13211
13256
|
f(r.p1Today),
|
|
@@ -13340,7 +13385,7 @@ function HeadToHead({ t, ui }) {
|
|
|
13340
13385
|
] });
|
|
13341
13386
|
}
|
|
13342
13387
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
13343
|
-
const lastTables = (0,
|
|
13388
|
+
const lastTables = (0, import_react89.useRef)(null);
|
|
13344
13389
|
const t = match.tennis;
|
|
13345
13390
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
13346
13391
|
const preMatch = match.phase === "preMatch";
|
|
@@ -13420,7 +13465,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13420
13465
|
}
|
|
13421
13466
|
|
|
13422
13467
|
// src/components/ScoreboardStrip.tsx
|
|
13423
|
-
var
|
|
13468
|
+
var import_react90 = require("react");
|
|
13424
13469
|
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
13425
13470
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13426
13471
|
function nbaStatus(m, ui) {
|
|
@@ -13515,8 +13560,8 @@ function rowsFor(m) {
|
|
|
13515
13560
|
];
|
|
13516
13561
|
}
|
|
13517
13562
|
function useStripScroll(selectedKey) {
|
|
13518
|
-
const stripRef = (0,
|
|
13519
|
-
(0,
|
|
13563
|
+
const stripRef = (0, import_react90.useRef)(null);
|
|
13564
|
+
(0, import_react90.useEffect)(() => {
|
|
13520
13565
|
const strip = stripRef.current;
|
|
13521
13566
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
13522
13567
|
if (!strip || !pressed) return;
|
|
@@ -13690,7 +13735,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
13690
13735
|
] });
|
|
13691
13736
|
}
|
|
13692
13737
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
13693
|
-
const seedIndex = (0,
|
|
13738
|
+
const seedIndex = (0, import_react91.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
13694
13739
|
const tiles = orderTiles(
|
|
13695
13740
|
monitor.pins,
|
|
13696
13741
|
monitor.snapshot,
|
|
@@ -13762,7 +13807,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
13762
13807
|
}
|
|
13763
13808
|
|
|
13764
13809
|
// src/components/LivePanel.tsx
|
|
13765
|
-
var
|
|
13810
|
+
var import_react94 = require("react");
|
|
13766
13811
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13767
13812
|
|
|
13768
13813
|
// src/scheduleView.ts
|
|
@@ -13937,20 +13982,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13937
13982
|
}
|
|
13938
13983
|
|
|
13939
13984
|
// src/components/MatchSheet.tsx
|
|
13940
|
-
var
|
|
13985
|
+
var import_react93 = require("react");
|
|
13941
13986
|
var import_widget_sdk34 = require("@sensiblestats/widget-sdk");
|
|
13942
13987
|
|
|
13943
13988
|
// src/useModalDialog.ts
|
|
13944
|
-
var
|
|
13989
|
+
var import_react92 = require("react");
|
|
13945
13990
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13946
13991
|
function useModalDialog(onClose, opts = {}) {
|
|
13947
|
-
const dialogRef = (0,
|
|
13948
|
-
const onCloseRef = (0,
|
|
13992
|
+
const dialogRef = (0, import_react92.useRef)(null);
|
|
13993
|
+
const onCloseRef = (0, import_react92.useRef)(onClose);
|
|
13949
13994
|
onCloseRef.current = onClose;
|
|
13950
|
-
const openerRef = (0,
|
|
13995
|
+
const openerRef = (0, import_react92.useRef)(opts.opener);
|
|
13951
13996
|
openerRef.current = opts.opener;
|
|
13952
13997
|
const restore = opts.restoreFocus ?? true;
|
|
13953
|
-
(0,
|
|
13998
|
+
(0, import_react92.useEffect)(() => {
|
|
13954
13999
|
const dialog = dialogRef.current;
|
|
13955
14000
|
const root = dialog?.getRootNode();
|
|
13956
14001
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13961,7 +14006,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13961
14006
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13962
14007
|
};
|
|
13963
14008
|
}, []);
|
|
13964
|
-
(0,
|
|
14009
|
+
(0, import_react92.useEffect)(() => {
|
|
13965
14010
|
const onKey = (e) => {
|
|
13966
14011
|
if (e.key !== "Escape") return;
|
|
13967
14012
|
e.stopPropagation();
|
|
@@ -14002,8 +14047,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
14002
14047
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
14003
14048
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
14004
14049
|
const log = useEventLog();
|
|
14005
|
-
const titleId = (0,
|
|
14006
|
-
const [limitHit, setLimitHit] = (0,
|
|
14050
|
+
const titleId = (0, import_react93.useId)();
|
|
14051
|
+
const [limitHit, setLimitHit] = (0, import_react93.useState)(false);
|
|
14007
14052
|
const pinSport = (0, import_widget_sdk34.slipSportOf)(match.sport);
|
|
14008
14053
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14009
14054
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -14104,10 +14149,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
14104
14149
|
var QUIET_ROWS = 4;
|
|
14105
14150
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
14106
14151
|
const { groups, states, stale } = discovery;
|
|
14107
|
-
const [mine, setMine] = (0,
|
|
14108
|
-
const [toggled, setToggled] = (0,
|
|
14109
|
-
const [sheet, setSheet] = (0,
|
|
14110
|
-
const pinnedKeys = (0,
|
|
14152
|
+
const [mine, setMine] = (0, import_react94.useState)(false);
|
|
14153
|
+
const [toggled, setToggled] = (0, import_react94.useState)(/* @__PURE__ */ new Map());
|
|
14154
|
+
const [sheet, setSheet] = (0, import_react94.useState)(null);
|
|
14155
|
+
const pinnedKeys = (0, import_react94.useMemo)(
|
|
14111
14156
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk36.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14112
14157
|
[monitor.pins]
|
|
14113
14158
|
);
|
|
@@ -14213,20 +14258,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14213
14258
|
}
|
|
14214
14259
|
|
|
14215
14260
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14216
|
-
var
|
|
14261
|
+
var import_react98 = require("react");
|
|
14217
14262
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
14218
14263
|
|
|
14219
14264
|
// src/useTennisRowPrices.ts
|
|
14220
|
-
var
|
|
14265
|
+
var import_react95 = require("react");
|
|
14221
14266
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14222
14267
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14223
14268
|
function useTennisRowPrices(a) {
|
|
14224
|
-
const [state, setState] = (0,
|
|
14225
|
-
const getPricesRef = (0,
|
|
14269
|
+
const [state, setState] = (0, import_react95.useState)({ byId: null, stale: false });
|
|
14270
|
+
const getPricesRef = (0, import_react95.useRef)(a.getPrices);
|
|
14226
14271
|
getPricesRef.current = a.getPrices;
|
|
14227
|
-
const latest = (0,
|
|
14272
|
+
const latest = (0, import_react95.useRef)(0);
|
|
14228
14273
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
14229
|
-
(0,
|
|
14274
|
+
(0, import_react95.useEffect)(() => {
|
|
14230
14275
|
if (!a.enabled || idsKey === "") {
|
|
14231
14276
|
latest.current++;
|
|
14232
14277
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -14264,11 +14309,11 @@ function useTennisRowPrices(a) {
|
|
|
14264
14309
|
}
|
|
14265
14310
|
|
|
14266
14311
|
// src/components/DayStrip.tsx
|
|
14267
|
-
var
|
|
14312
|
+
var import_react96 = require("react");
|
|
14268
14313
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14269
14314
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
14270
|
-
const listRef = (0,
|
|
14271
|
-
(0,
|
|
14315
|
+
const listRef = (0, import_react96.useRef)(null);
|
|
14316
|
+
(0, import_react96.useEffect)(() => {
|
|
14272
14317
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
14273
14318
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
14274
14319
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -14297,7 +14342,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
14297
14342
|
}
|
|
14298
14343
|
|
|
14299
14344
|
// src/components/games/ui/SearchField.tsx
|
|
14300
|
-
var
|
|
14345
|
+
var import_react97 = require("react");
|
|
14301
14346
|
|
|
14302
14347
|
// src/components/games/ui/icons.tsx
|
|
14303
14348
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
@@ -14336,8 +14381,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
14336
14381
|
// src/components/games/ui/SearchField.tsx
|
|
14337
14382
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
14338
14383
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
14339
|
-
const localRef = (0,
|
|
14340
|
-
const setInputRef = (0,
|
|
14384
|
+
const localRef = (0, import_react97.useRef)(null);
|
|
14385
|
+
const setInputRef = (0, import_react97.useCallback)((node) => {
|
|
14341
14386
|
localRef.current = node;
|
|
14342
14387
|
if (typeof inputRef === "function") inputRef(node);
|
|
14343
14388
|
else if (inputRef) inputRef.current = node;
|
|
@@ -14383,18 +14428,18 @@ var TOP_ROW_CAP = 3;
|
|
|
14383
14428
|
var SKELETON_ROWS = 3;
|
|
14384
14429
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
14385
14430
|
const { localDate: today, states, stale } = discovery;
|
|
14386
|
-
const searchId = (0,
|
|
14387
|
-
const [query, setQuery] = (0,
|
|
14388
|
-
const [toggled, setToggled] = (0,
|
|
14389
|
-
const [expanded, setExpanded] = (0,
|
|
14390
|
-
const listRef = (0,
|
|
14391
|
-
const [sheet, setSheet] = (0,
|
|
14431
|
+
const searchId = (0, import_react98.useId)();
|
|
14432
|
+
const [query, setQuery] = (0, import_react98.useState)("");
|
|
14433
|
+
const [toggled, setToggled] = (0, import_react98.useState)(/* @__PURE__ */ new Map());
|
|
14434
|
+
const [expanded, setExpanded] = (0, import_react98.useState)(/* @__PURE__ */ new Set());
|
|
14435
|
+
const listRef = (0, import_react98.useRef)(null);
|
|
14436
|
+
const [sheet, setSheet] = (0, import_react98.useState)(null);
|
|
14392
14437
|
const { chips, selected } = loaded;
|
|
14393
|
-
(0,
|
|
14438
|
+
(0, import_react98.useEffect)(() => {
|
|
14394
14439
|
if (selected !== day) onDay(selected);
|
|
14395
14440
|
}, [day, selected, onDay]);
|
|
14396
14441
|
const isToday = selected === today;
|
|
14397
|
-
const pinnedKeys = (0,
|
|
14442
|
+
const pinnedKeys = (0, import_react98.useMemo)(
|
|
14398
14443
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk38.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14399
14444
|
[monitor.pins]
|
|
14400
14445
|
);
|
|
@@ -14532,7 +14577,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14532
14577
|
}
|
|
14533
14578
|
|
|
14534
14579
|
// src/components/GamesPanel.tsx
|
|
14535
|
-
var
|
|
14580
|
+
var import_react113 = require("react");
|
|
14536
14581
|
|
|
14537
14582
|
// src/components/GamesLoginWall.tsx
|
|
14538
14583
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
@@ -14541,7 +14586,7 @@ function GamesLoginWall({ ui }) {
|
|
|
14541
14586
|
}
|
|
14542
14587
|
|
|
14543
14588
|
// src/components/GamesHub.tsx
|
|
14544
|
-
var
|
|
14589
|
+
var import_react99 = require("react");
|
|
14545
14590
|
|
|
14546
14591
|
// src/components/games/ui/gameMeta.ts
|
|
14547
14592
|
function prettifyGameId(gameId) {
|
|
@@ -14692,8 +14737,8 @@ function pickHeroGame(games) {
|
|
|
14692
14737
|
}
|
|
14693
14738
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14694
14739
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14695
|
-
const [, setTick] = (0,
|
|
14696
|
-
(0,
|
|
14740
|
+
const [, setTick] = (0, import_react99.useState)(0);
|
|
14741
|
+
(0, import_react99.useEffect)(() => {
|
|
14697
14742
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14698
14743
|
return () => clearInterval(id);
|
|
14699
14744
|
}, []);
|
|
@@ -14753,10 +14798,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14753
14798
|
}
|
|
14754
14799
|
|
|
14755
14800
|
// src/components/GameScreenHost.tsx
|
|
14756
|
-
var
|
|
14801
|
+
var import_react111 = require("react");
|
|
14757
14802
|
|
|
14758
14803
|
// src/useGamePlay.ts
|
|
14759
|
-
var
|
|
14804
|
+
var import_react100 = require("react");
|
|
14760
14805
|
function toSubmitResult(payload) {
|
|
14761
14806
|
return {
|
|
14762
14807
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14768,17 +14813,17 @@ function toSubmitResult(payload) {
|
|
|
14768
14813
|
};
|
|
14769
14814
|
}
|
|
14770
14815
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
14771
|
-
const [result, setResult] = (0,
|
|
14772
|
-
const [submitting, setSubmitting] = (0,
|
|
14773
|
-
const [rawStatus, setRawStatus] = (0,
|
|
14774
|
-
const inFlightRef = (0,
|
|
14775
|
-
const convRef = (0,
|
|
14816
|
+
const [result, setResult] = (0, import_react100.useState)(null);
|
|
14817
|
+
const [submitting, setSubmitting] = (0, import_react100.useState)(false);
|
|
14818
|
+
const [rawStatus, setRawStatus] = (0, import_react100.useState)(null);
|
|
14819
|
+
const inFlightRef = (0, import_react100.useRef)(false);
|
|
14820
|
+
const convRef = (0, import_react100.useRef)(conversation);
|
|
14776
14821
|
convRef.current = conversation;
|
|
14777
|
-
const optsRef = (0,
|
|
14822
|
+
const optsRef = (0, import_react100.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14778
14823
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14779
|
-
const resultRef = (0,
|
|
14824
|
+
const resultRef = (0, import_react100.useRef)(null);
|
|
14780
14825
|
resultRef.current = result;
|
|
14781
|
-
const refetch = (0,
|
|
14826
|
+
const refetch = (0, import_react100.useCallback)(async () => {
|
|
14782
14827
|
const conv = convRef.current;
|
|
14783
14828
|
if (!conv) return;
|
|
14784
14829
|
const opts = optsRef.current;
|
|
@@ -14794,7 +14839,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14794
14839
|
} catch {
|
|
14795
14840
|
}
|
|
14796
14841
|
}, []);
|
|
14797
|
-
const submit = (0,
|
|
14842
|
+
const submit = (0, import_react100.useCallback)(async (answerJson) => {
|
|
14798
14843
|
const conv = convRef.current;
|
|
14799
14844
|
if (!conv || inFlightRef.current) return;
|
|
14800
14845
|
inFlightRef.current = true;
|
|
@@ -14821,14 +14866,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14821
14866
|
setSubmitting(false);
|
|
14822
14867
|
}
|
|
14823
14868
|
}, [refetch]);
|
|
14824
|
-
const hydrate = (0,
|
|
14869
|
+
const hydrate = (0, import_react100.useCallback)(() => {
|
|
14825
14870
|
void refetch();
|
|
14826
14871
|
}, [refetch]);
|
|
14827
14872
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14828
14873
|
}
|
|
14829
14874
|
|
|
14830
14875
|
// src/components/games/MysteryTigerGame.tsx
|
|
14831
|
-
var
|
|
14876
|
+
var import_react102 = require("react");
|
|
14832
14877
|
|
|
14833
14878
|
// src/components/games/nationFlags.ts
|
|
14834
14879
|
var FLAGS = {
|
|
@@ -15039,7 +15084,7 @@ function isNationCode(flag) {
|
|
|
15039
15084
|
}
|
|
15040
15085
|
|
|
15041
15086
|
// src/components/games/PlayerAvatar.tsx
|
|
15042
|
-
var
|
|
15087
|
+
var import_react101 = require("react");
|
|
15043
15088
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
15044
15089
|
function initialsOf(name) {
|
|
15045
15090
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -15057,7 +15102,7 @@ function PlayerAvatar({
|
|
|
15057
15102
|
imagePath,
|
|
15058
15103
|
className
|
|
15059
15104
|
}) {
|
|
15060
|
-
const [failed, setFailed] = (0,
|
|
15105
|
+
const [failed, setFailed] = (0, import_react101.useState)(false);
|
|
15061
15106
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
15062
15107
|
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
15063
15108
|
}
|
|
@@ -15301,8 +15346,8 @@ function MysteryTigerGame({
|
|
|
15301
15346
|
onBack
|
|
15302
15347
|
}) {
|
|
15303
15348
|
const t = ui.games.mysteryTiger;
|
|
15304
|
-
const [query, setQuery] = (0,
|
|
15305
|
-
const inputId = (0,
|
|
15349
|
+
const [query, setQuery] = (0, import_react102.useState)("");
|
|
15350
|
+
const inputId = (0, import_react102.useId)();
|
|
15306
15351
|
const clientState = parseClientState(result?.clientStateJson);
|
|
15307
15352
|
const guessResults = clientState?.guessResults ?? [];
|
|
15308
15353
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -15563,13 +15608,13 @@ function HigherOrLowerGame({
|
|
|
15563
15608
|
}
|
|
15564
15609
|
|
|
15565
15610
|
// src/components/games/CareerPathGame.tsx
|
|
15566
|
-
var
|
|
15611
|
+
var import_react104 = require("react");
|
|
15567
15612
|
|
|
15568
15613
|
// src/components/games/ui/CrestShield.tsx
|
|
15569
|
-
var
|
|
15614
|
+
var import_react103 = require("react");
|
|
15570
15615
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15571
15616
|
function CrestShield({ src, name, size = 28 }) {
|
|
15572
|
-
const [failed, setFailed] = (0,
|
|
15617
|
+
const [failed, setFailed] = (0, import_react103.useState)(false);
|
|
15573
15618
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
15574
15619
|
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
15575
15620
|
}
|
|
@@ -15601,8 +15646,8 @@ function CareerPathGame({
|
|
|
15601
15646
|
}) {
|
|
15602
15647
|
const s = ui.games.careerPath;
|
|
15603
15648
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
15604
|
-
const [query, setQuery] = (0,
|
|
15605
|
-
const inputId = (0,
|
|
15649
|
+
const [query, setQuery] = (0, import_react104.useState)("");
|
|
15650
|
+
const inputId = (0, import_react104.useId)();
|
|
15606
15651
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
15607
15652
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
15608
15653
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -15708,7 +15753,7 @@ function CareerPathGame({
|
|
|
15708
15753
|
}
|
|
15709
15754
|
|
|
15710
15755
|
// src/components/games/BeatTheGridGame.tsx
|
|
15711
|
-
var
|
|
15756
|
+
var import_react105 = __toESM(require("react"), 1);
|
|
15712
15757
|
|
|
15713
15758
|
// src/components/games/ui/OptionList.tsx
|
|
15714
15759
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
@@ -15797,10 +15842,10 @@ function SearchSheet({
|
|
|
15797
15842
|
ui
|
|
15798
15843
|
}) {
|
|
15799
15844
|
const s = ui.games.beatTheGrid;
|
|
15800
|
-
const [query, setQuery] = (0,
|
|
15801
|
-
const inputId = (0,
|
|
15802
|
-
const inputRef = (0,
|
|
15803
|
-
(0,
|
|
15845
|
+
const [query, setQuery] = (0, import_react105.useState)("");
|
|
15846
|
+
const inputId = (0, import_react105.useId)();
|
|
15847
|
+
const inputRef = (0, import_react105.useRef)(null);
|
|
15848
|
+
(0, import_react105.useEffect)(() => {
|
|
15804
15849
|
inputRef.current?.focus();
|
|
15805
15850
|
}, [row, col]);
|
|
15806
15851
|
const filtered = playerPool.filter(
|
|
@@ -15865,7 +15910,7 @@ function BeatTheGridGame({
|
|
|
15865
15910
|
}) {
|
|
15866
15911
|
const s = ui.games.beatTheGrid;
|
|
15867
15912
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15868
|
-
const [activeCell, setActiveCell] = (0,
|
|
15913
|
+
const [activeCell, setActiveCell] = (0, import_react105.useState)(null);
|
|
15869
15914
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15870
15915
|
const filledCells = clientState?.cells ?? [];
|
|
15871
15916
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15939,7 +15984,7 @@ function BeatTheGridGame({
|
|
|
15939
15984
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15940
15985
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15941
15986
|
] });
|
|
15942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
15987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_react105.default.Fragment, { children: [
|
|
15943
15988
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15944
15989
|
cols.map((colLabel, colIdx) => {
|
|
15945
15990
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -16020,7 +16065,7 @@ function BeatTheGridGame({
|
|
|
16020
16065
|
}
|
|
16021
16066
|
|
|
16022
16067
|
// src/components/games/GuessTheXiGame.tsx
|
|
16023
|
-
var
|
|
16068
|
+
var import_react106 = require("react");
|
|
16024
16069
|
|
|
16025
16070
|
// src/components/games/ui/PitchSvg.tsx
|
|
16026
16071
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16109,8 +16154,8 @@ function GuessTheXiGame({
|
|
|
16109
16154
|
onBack
|
|
16110
16155
|
}) {
|
|
16111
16156
|
const t = ui.games.guessTheXi;
|
|
16112
|
-
const [query, setQuery] = (0,
|
|
16113
|
-
const inputId = (0,
|
|
16157
|
+
const [query, setQuery] = (0, import_react106.useState)("");
|
|
16158
|
+
const inputId = (0, import_react106.useId)();
|
|
16114
16159
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
16115
16160
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
16116
16161
|
const solved = clientState?.status === "solved";
|
|
@@ -16252,7 +16297,7 @@ function GuessTheXiGame({
|
|
|
16252
16297
|
}
|
|
16253
16298
|
|
|
16254
16299
|
// src/components/games/DailyQuizGame.tsx
|
|
16255
|
-
var
|
|
16300
|
+
var import_react107 = require("react");
|
|
16256
16301
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
16257
16302
|
function parseClientState6(json) {
|
|
16258
16303
|
if (!json) return null;
|
|
@@ -16293,8 +16338,8 @@ function DailyQuizGame({
|
|
|
16293
16338
|
}) {
|
|
16294
16339
|
const s = ui.games.dailyQuiz;
|
|
16295
16340
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
16296
|
-
const [selections, setSelections] = (0,
|
|
16297
|
-
const [page, setPage] = (0,
|
|
16341
|
+
const [selections, setSelections] = (0, import_react107.useState)(/* @__PURE__ */ new Map());
|
|
16342
|
+
const [page, setPage] = (0, import_react107.useState)(0);
|
|
16298
16343
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
16299
16344
|
const results2 = clientState?.results ?? [];
|
|
16300
16345
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -16404,7 +16449,7 @@ function DailyQuizGame({
|
|
|
16404
16449
|
}
|
|
16405
16450
|
|
|
16406
16451
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
16407
|
-
var
|
|
16452
|
+
var import_react108 = require("react");
|
|
16408
16453
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
16409
16454
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
16410
16455
|
function parseClientState7(json) {
|
|
@@ -16500,12 +16545,12 @@ function MatchdayPredictorGame({
|
|
|
16500
16545
|
onBack
|
|
16501
16546
|
}) {
|
|
16502
16547
|
const t = ui.games.predictor;
|
|
16503
|
-
const [homeScore, setHomeScore] = (0,
|
|
16504
|
-
const [awayScore, setAwayScore] = (0,
|
|
16505
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
16506
|
-
const [lastEdited, setLastEdited] = (0,
|
|
16507
|
-
const [query, setQuery] = (0,
|
|
16508
|
-
const searchId = (0,
|
|
16548
|
+
const [homeScore, setHomeScore] = (0, import_react108.useState)(0);
|
|
16549
|
+
const [awayScore, setAwayScore] = (0, import_react108.useState)(0);
|
|
16550
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react108.useState)(null);
|
|
16551
|
+
const [lastEdited, setLastEdited] = (0, import_react108.useState)("home");
|
|
16552
|
+
const [query, setQuery] = (0, import_react108.useState)("");
|
|
16553
|
+
const searchId = (0, import_react108.useId)();
|
|
16509
16554
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
16510
16555
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16511
16556
|
const header = /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
@@ -16672,7 +16717,7 @@ function MatchdayPredictorGame({
|
|
|
16672
16717
|
}
|
|
16673
16718
|
|
|
16674
16719
|
// src/components/games/StartingXiGame.tsx
|
|
16675
|
-
var
|
|
16720
|
+
var import_react109 = require("react");
|
|
16676
16721
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16677
16722
|
var POINTS_PER_STARTER = 8;
|
|
16678
16723
|
var XI_SIZE = 11;
|
|
@@ -16716,10 +16761,10 @@ function StartingXiGame({
|
|
|
16716
16761
|
lockAtUtc
|
|
16717
16762
|
}) {
|
|
16718
16763
|
const t = ui.games.startingXi;
|
|
16719
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
16720
|
-
const [active, setActive] = (0,
|
|
16721
|
-
const [query, setQuery] = (0,
|
|
16722
|
-
const searchId = (0,
|
|
16764
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react109.useState)(() => Array(XI_SIZE).fill(null));
|
|
16765
|
+
const [active, setActive] = (0, import_react109.useState)(0);
|
|
16766
|
+
const [query, setQuery] = (0, import_react109.useState)("");
|
|
16767
|
+
const searchId = (0, import_react109.useId)();
|
|
16723
16768
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
16724
16769
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16725
16770
|
const header = /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
@@ -16858,7 +16903,7 @@ function StartingXiGame({
|
|
|
16858
16903
|
}
|
|
16859
16904
|
|
|
16860
16905
|
// src/components/games/StatLadderGame.tsx
|
|
16861
|
-
var
|
|
16906
|
+
var import_react110 = require("react");
|
|
16862
16907
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16863
16908
|
function ladderClue(ladder) {
|
|
16864
16909
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16895,9 +16940,9 @@ function StatLadderGame({
|
|
|
16895
16940
|
onBack
|
|
16896
16941
|
}) {
|
|
16897
16942
|
const t = ui.games.statLadder;
|
|
16898
|
-
const [query, setQuery] = (0,
|
|
16899
|
-
const [selectedId, setSelectedId] = (0,
|
|
16900
|
-
const searchId = (0,
|
|
16943
|
+
const [query, setQuery] = (0, import_react110.useState)("");
|
|
16944
|
+
const [selectedId, setSelectedId] = (0, import_react110.useState)(null);
|
|
16945
|
+
const searchId = (0, import_react110.useId)();
|
|
16901
16946
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16902
16947
|
const revealed = clientState != null;
|
|
16903
16948
|
const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -17103,8 +17148,8 @@ function GameScreenHost({
|
|
|
17103
17148
|
ui
|
|
17104
17149
|
}) {
|
|
17105
17150
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
17106
|
-
const [configJson, setConfigJson] = (0,
|
|
17107
|
-
(0,
|
|
17151
|
+
const [configJson, setConfigJson] = (0, import_react111.useState)(null);
|
|
17152
|
+
(0, import_react111.useEffect)(() => {
|
|
17108
17153
|
setConfigJson(null);
|
|
17109
17154
|
if (!conversation) return;
|
|
17110
17155
|
let cancelled = false;
|
|
@@ -17127,12 +17172,12 @@ function GameScreenHost({
|
|
|
17127
17172
|
fixtureId: fixtureId || void 0,
|
|
17128
17173
|
locale: ui.hostTag
|
|
17129
17174
|
});
|
|
17130
|
-
(0,
|
|
17175
|
+
(0, import_react111.useEffect)(() => {
|
|
17131
17176
|
if (conversation) hydrate();
|
|
17132
17177
|
}, [conversation, gameId]);
|
|
17133
|
-
const hydrateRef = (0,
|
|
17178
|
+
const hydrateRef = (0, import_react111.useRef)(hydrate);
|
|
17134
17179
|
hydrateRef.current = hydrate;
|
|
17135
|
-
(0,
|
|
17180
|
+
(0, import_react111.useEffect)(() => {
|
|
17136
17181
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
17137
17182
|
if (rawStatus !== "pending") return;
|
|
17138
17183
|
const timerId = setInterval(() => {
|
|
@@ -17245,7 +17290,7 @@ function GameScreenHost({
|
|
|
17245
17290
|
}
|
|
17246
17291
|
|
|
17247
17292
|
// src/components/Leaderboard.tsx
|
|
17248
|
-
var
|
|
17293
|
+
var import_react112 = require("react");
|
|
17249
17294
|
|
|
17250
17295
|
// src/components/LeaderboardRow.tsx
|
|
17251
17296
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
@@ -17332,7 +17377,7 @@ function Leaderboard({
|
|
|
17332
17377
|
ui,
|
|
17333
17378
|
onPlay
|
|
17334
17379
|
}) {
|
|
17335
|
-
const [segment, setSegment] = (0,
|
|
17380
|
+
const [segment, setSegment] = (0, import_react112.useState)("weekly");
|
|
17336
17381
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
17337
17382
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
17338
17383
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -17437,9 +17482,9 @@ function GamesPanel({
|
|
|
17437
17482
|
leaderboardLoading,
|
|
17438
17483
|
refreshHub
|
|
17439
17484
|
}) {
|
|
17440
|
-
const [selected, setSelected] = (0,
|
|
17441
|
-
const [segment, setSegment] = (0,
|
|
17442
|
-
(0,
|
|
17485
|
+
const [selected, setSelected] = (0, import_react113.useState)(null);
|
|
17486
|
+
const [segment, setSegment] = (0, import_react113.useState)("play");
|
|
17487
|
+
(0, import_react113.useEffect)(() => {
|
|
17443
17488
|
ensureGamesFonts();
|
|
17444
17489
|
}, []);
|
|
17445
17490
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(GamesLoginWall, { ui });
|
|
@@ -17503,10 +17548,10 @@ function GamesPanel({
|
|
|
17503
17548
|
}
|
|
17504
17549
|
|
|
17505
17550
|
// src/components/FavouritesPanel.tsx
|
|
17506
|
-
var
|
|
17551
|
+
var import_react116 = require("react");
|
|
17507
17552
|
|
|
17508
17553
|
// src/components/FavouriteChips.tsx
|
|
17509
|
-
var
|
|
17554
|
+
var import_react114 = require("react");
|
|
17510
17555
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17511
17556
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
17512
17557
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -17552,12 +17597,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
17552
17597
|
] });
|
|
17553
17598
|
}
|
|
17554
17599
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
17555
|
-
const [confirming, setConfirming] = (0,
|
|
17600
|
+
const [confirming, setConfirming] = (0, import_react114.useState)(false);
|
|
17556
17601
|
const data = controller.data;
|
|
17557
|
-
(0,
|
|
17602
|
+
(0, import_react114.useEffect)(() => {
|
|
17558
17603
|
setConfirming(false);
|
|
17559
17604
|
}, [sport]);
|
|
17560
|
-
(0,
|
|
17605
|
+
(0, import_react114.useEffect)(() => {
|
|
17561
17606
|
if (!confirming) return;
|
|
17562
17607
|
const onPointerDown = (e) => {
|
|
17563
17608
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -17611,21 +17656,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
17611
17656
|
}
|
|
17612
17657
|
|
|
17613
17658
|
// src/components/FavouritesSearch.tsx
|
|
17614
|
-
var
|
|
17659
|
+
var import_react115 = require("react");
|
|
17615
17660
|
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
17616
17661
|
var MIN_LETTERS = 2;
|
|
17617
17662
|
var MAX_LENGTH = 64;
|
|
17618
17663
|
var DEBOUNCE_MS = 250;
|
|
17619
17664
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
17620
|
-
const [query, setQuery] = (0,
|
|
17621
|
-
const [answer, setAnswer] = (0,
|
|
17622
|
-
const controllerRef = (0,
|
|
17665
|
+
const [query, setQuery] = (0, import_react115.useState)("");
|
|
17666
|
+
const [answer, setAnswer] = (0, import_react115.useState)(null);
|
|
17667
|
+
const controllerRef = (0, import_react115.useRef)(controller);
|
|
17623
17668
|
controllerRef.current = controller;
|
|
17624
17669
|
const trimmed = query.trim();
|
|
17625
17670
|
const queryKey = `${sport}|${trimmed}`;
|
|
17626
17671
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
17627
17672
|
const settled = answer?.key === queryKey;
|
|
17628
|
-
(0,
|
|
17673
|
+
(0, import_react115.useEffect)(() => {
|
|
17629
17674
|
setAnswer(null);
|
|
17630
17675
|
if (trimmed.length < MIN_LETTERS) return;
|
|
17631
17676
|
let cancelled = false;
|
|
@@ -17688,13 +17733,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17688
17733
|
// src/components/FavouritesPanel.tsx
|
|
17689
17734
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17690
17735
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17691
|
-
const [notice, setNotice] = (0,
|
|
17692
|
-
const refreshRef = (0,
|
|
17736
|
+
const [notice, setNotice] = (0, import_react116.useState)(null);
|
|
17737
|
+
const refreshRef = (0, import_react116.useRef)(controller.refresh);
|
|
17693
17738
|
refreshRef.current = controller.refresh;
|
|
17694
|
-
(0,
|
|
17739
|
+
(0, import_react116.useEffect)(() => {
|
|
17695
17740
|
void refreshRef.current();
|
|
17696
17741
|
}, []);
|
|
17697
|
-
(0,
|
|
17742
|
+
(0, import_react116.useEffect)(() => {
|
|
17698
17743
|
setNotice(null);
|
|
17699
17744
|
}, [sport]);
|
|
17700
17745
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17720,11 +17765,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
17720
17765
|
}
|
|
17721
17766
|
|
|
17722
17767
|
// src/components/PresetTools.tsx
|
|
17723
|
-
var
|
|
17768
|
+
var import_react117 = require("react");
|
|
17724
17769
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17725
17770
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17726
17771
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17727
|
-
const titleId = (0,
|
|
17772
|
+
const titleId = (0, import_react117.useId)();
|
|
17728
17773
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17729
17774
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17730
17775
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17774,9 +17819,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17774
17819
|
const totalOptions = comboTotals(grid);
|
|
17775
17820
|
const totals = totalOptions.map((o) => o.value);
|
|
17776
17821
|
const legChoices = comboLegChoices(grid);
|
|
17777
|
-
const [total, setTotal] = (0,
|
|
17778
|
-
const [legs, setLegs] = (0,
|
|
17779
|
-
const [announcement, setAnnouncement] = (0,
|
|
17822
|
+
const [total, setTotal] = (0, import_react117.useState)(() => nearest(totals, initialTotal));
|
|
17823
|
+
const [legs, setLegs] = (0, import_react117.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17824
|
+
const [announcement, setAnnouncement] = (0, import_react117.useState)("");
|
|
17780
17825
|
const cell2 = findCombo(grid, total, legs);
|
|
17781
17826
|
const minLegs = legChoices[0] ?? legs;
|
|
17782
17827
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17815,10 +17860,10 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17815
17860
|
}
|
|
17816
17861
|
|
|
17817
17862
|
// src/components/BuilderPanel.tsx
|
|
17818
|
-
var
|
|
17863
|
+
var import_react119 = require("react");
|
|
17819
17864
|
|
|
17820
17865
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17821
|
-
var
|
|
17866
|
+
var import_react118 = require("react");
|
|
17822
17867
|
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
17823
17868
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
17824
17869
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
@@ -17859,9 +17904,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17859
17904
|
const opening = openingGames(preset);
|
|
17860
17905
|
const gamesOptions = opening.options;
|
|
17861
17906
|
const marketOptions = usableMarkets(preset);
|
|
17862
|
-
const [fingerprint] = (0,
|
|
17863
|
-
const [keepsMarket] = (0,
|
|
17864
|
-
const [saved] = (0,
|
|
17907
|
+
const [fingerprint] = (0, import_react118.useState)(() => JSON.stringify(preset));
|
|
17908
|
+
const [keepsMarket] = (0, import_react118.useState)(keepMarket);
|
|
17909
|
+
const [saved] = (0, import_react118.useState)(() => {
|
|
17865
17910
|
const kept = keepsMarket ? void 0 : memory3?.savedView(sport);
|
|
17866
17911
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
17867
17912
|
});
|
|
@@ -17876,9 +17921,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17876
17921
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
17877
17922
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17878
17923
|
};
|
|
17879
|
-
const [view, setView] = (0,
|
|
17880
|
-
const autoWidened = (0,
|
|
17881
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
17924
|
+
const [view, setView] = (0, import_react118.useState)(() => saved?.view ?? openingView);
|
|
17925
|
+
const autoWidened = (0, import_react118.useRef)(false);
|
|
17926
|
+
const [widenedNote, setWidenedNote] = (0, import_react118.useState)(saved?.widenedNote ?? false);
|
|
17882
17927
|
const track = useTrack();
|
|
17883
17928
|
const requestFor = (v, extra) => ({
|
|
17884
17929
|
sport,
|
|
@@ -17894,18 +17939,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17894
17939
|
...operatorUserId ? { operatorUserId } : {},
|
|
17895
17940
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17896
17941
|
});
|
|
17897
|
-
const [editing, setEditing] = (0,
|
|
17898
|
-
const [draft, setDraft] = (0,
|
|
17899
|
-
const [invalid, setInvalid] = (0,
|
|
17900
|
-
const inputRef = (0,
|
|
17901
|
-
const pencilRef = (0,
|
|
17902
|
-
const noteId = (0,
|
|
17903
|
-
const customId = (0,
|
|
17904
|
-
(0,
|
|
17942
|
+
const [editing, setEditing] = (0, import_react118.useState)(false);
|
|
17943
|
+
const [draft, setDraft] = (0, import_react118.useState)("");
|
|
17944
|
+
const [invalid, setInvalid] = (0, import_react118.useState)(null);
|
|
17945
|
+
const inputRef = (0, import_react118.useRef)(null);
|
|
17946
|
+
const pencilRef = (0, import_react118.useRef)(null);
|
|
17947
|
+
const noteId = (0, import_react118.useId)();
|
|
17948
|
+
const customId = (0, import_react118.useId)();
|
|
17949
|
+
(0, import_react118.useEffect)(() => {
|
|
17905
17950
|
if (editing) inputRef.current?.focus();
|
|
17906
17951
|
}, [editing]);
|
|
17907
17952
|
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
17908
|
-
(0,
|
|
17953
|
+
(0, import_react118.useEffect)(() => {
|
|
17909
17954
|
if (view.legs === 1) {
|
|
17910
17955
|
setEditing(false);
|
|
17911
17956
|
setDraft("");
|
|
@@ -17921,16 +17966,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17921
17966
|
setEditing(false);
|
|
17922
17967
|
pencilRef.current?.focus();
|
|
17923
17968
|
};
|
|
17924
|
-
const [first] = (0,
|
|
17969
|
+
const [first] = (0, import_react118.useState)(() => requestFor(view));
|
|
17925
17970
|
const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
17926
|
-
const [shown2, setShown] = (0,
|
|
17971
|
+
const [shown2, setShown] = (0, import_react118.useState)(null);
|
|
17927
17972
|
if (grid === null) {
|
|
17928
17973
|
if (shown2 !== null && status2 === "ready") setShown(null);
|
|
17929
17974
|
} else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
|
|
17930
17975
|
setShown(shownAfter(shown2, grid, answeredFor));
|
|
17931
17976
|
}
|
|
17932
|
-
const lastRequest = (0,
|
|
17933
|
-
(0,
|
|
17977
|
+
const lastRequest = (0, import_react118.useRef)(first);
|
|
17978
|
+
(0, import_react118.useEffect)(() => {
|
|
17934
17979
|
void request(lastRequest.current);
|
|
17935
17980
|
}, [request]);
|
|
17936
17981
|
const send = (req) => {
|
|
@@ -17968,7 +18013,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17968
18013
|
};
|
|
17969
18014
|
const canNarrow = preset.matchIds.length > 0;
|
|
17970
18015
|
const ready = status2 === "ready" && grid !== null;
|
|
17971
|
-
const [tapped, setTapped] = (0,
|
|
18016
|
+
const [tapped, setTapped] = (0, import_react118.useState)(null);
|
|
17972
18017
|
const busy = tapped !== null && status2 === "loading" && shown2 !== null;
|
|
17973
18018
|
const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
|
|
17974
18019
|
const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
|
|
@@ -17977,8 +18022,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17977
18022
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
17978
18023
|
])).sort((a, b) => a - b);
|
|
17979
18024
|
const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
|
|
17980
|
-
const sectionRef = (0,
|
|
17981
|
-
(0,
|
|
18025
|
+
const sectionRef = (0, import_react118.useRef)(null);
|
|
18026
|
+
(0, import_react118.useEffect)(() => {
|
|
17982
18027
|
if (tapped === null || status2 !== "ready") return;
|
|
17983
18028
|
setTapped(null);
|
|
17984
18029
|
const root = sectionRef.current;
|
|
@@ -17995,14 +18040,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17995
18040
|
}, [tapped, status2]);
|
|
17996
18041
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17997
18042
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17998
|
-
const [startedNote, setStartedNote] = (0,
|
|
18043
|
+
const [startedNote, setStartedNote] = (0, import_react118.useState)(false);
|
|
17999
18044
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
18000
|
-
(0,
|
|
18045
|
+
(0, import_react118.useEffect)(() => {
|
|
18001
18046
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
18002
18047
|
}, [startedNote, status2, anyStarted]);
|
|
18003
18048
|
const market = rows?.[0]?.market;
|
|
18004
|
-
const [seen2, setSeen] = (0,
|
|
18005
|
-
(0,
|
|
18049
|
+
const [seen2, setSeen] = (0, import_react118.useState)(null);
|
|
18050
|
+
(0, import_react118.useEffect)(() => {
|
|
18006
18051
|
if (market) setSeen(market);
|
|
18007
18052
|
}, [market]);
|
|
18008
18053
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -18046,14 +18091,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
18046
18091
|
};
|
|
18047
18092
|
};
|
|
18048
18093
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
18049
|
-
(0,
|
|
18094
|
+
(0, import_react118.useEffect)(() => {
|
|
18050
18095
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
18051
18096
|
autoWidened.current = true;
|
|
18052
18097
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
18053
18098
|
commit(next, true);
|
|
18054
18099
|
send(requestFor(next));
|
|
18055
18100
|
}, [empty2, singles, widened, canWiden, view]);
|
|
18056
|
-
(0,
|
|
18101
|
+
(0, import_react118.useEffect)(() => {
|
|
18057
18102
|
if (coolOff) onCoolOff?.(sport);
|
|
18058
18103
|
}, [coolOff, onCoolOff, sport]);
|
|
18059
18104
|
if (coolOff) return null;
|
|
@@ -18253,7 +18298,7 @@ function BuilderPanel({ options, sport, onSportChange, ui, slip, onCoolOff, onHa
|
|
|
18253
18298
|
const scope = useSportScope();
|
|
18254
18299
|
const active = options.find((o) => o.sport === sport) ?? options[0];
|
|
18255
18300
|
const handingOff = active?.keepMarket === true;
|
|
18256
|
-
(0,
|
|
18301
|
+
(0, import_react119.useEffect)(() => {
|
|
18257
18302
|
if (handingOff) onHandOffMounted?.();
|
|
18258
18303
|
}, [handingOff]);
|
|
18259
18304
|
if (!active) return null;
|
|
@@ -18525,10 +18570,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
18525
18570
|
}
|
|
18526
18571
|
|
|
18527
18572
|
// src/components/PlayerPhoto.tsx
|
|
18528
|
-
var
|
|
18573
|
+
var import_react120 = require("react");
|
|
18529
18574
|
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
18530
18575
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
18531
|
-
const [failed, setFailed] = (0,
|
|
18576
|
+
const [failed, setFailed] = (0, import_react120.useState)(false);
|
|
18532
18577
|
const box = { width: size, height: size };
|
|
18533
18578
|
if (photoUrl && !failed) {
|
|
18534
18579
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -18563,7 +18608,7 @@ function MiniPitch({ positionCode }) {
|
|
|
18563
18608
|
}
|
|
18564
18609
|
|
|
18565
18610
|
// src/components/PerformanceBars.tsx
|
|
18566
|
-
var
|
|
18611
|
+
var import_react121 = require("react");
|
|
18567
18612
|
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
18568
18613
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
18569
18614
|
function finite4(v) {
|
|
@@ -18609,7 +18654,7 @@ function unrankedLine(ui, reason) {
|
|
|
18609
18654
|
}
|
|
18610
18655
|
}
|
|
18611
18656
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
18612
|
-
const [mode, setMode] = (0,
|
|
18657
|
+
const [mode, setMode] = (0, import_react121.useState)("total");
|
|
18613
18658
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
18614
18659
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
18615
18660
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -18818,8 +18863,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
18818
18863
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
18819
18864
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
18820
18865
|
function useIsModal() {
|
|
18821
|
-
const [modal, setModal] = (0,
|
|
18822
|
-
(0,
|
|
18866
|
+
const [modal, setModal] = (0, import_react122.useState)(false);
|
|
18867
|
+
(0, import_react122.useEffect)(() => {
|
|
18823
18868
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
18824
18869
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
18825
18870
|
const sync = () => setModal(mql.matches);
|
|
@@ -18833,12 +18878,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
18833
18878
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
18834
18879
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
18835
18880
|
const { state, close, stop, send, reset } = controller;
|
|
18836
|
-
const [squadView, setSquadView] = (0,
|
|
18837
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
18881
|
+
const [squadView, setSquadView] = (0, import_react122.useState)("roster");
|
|
18882
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react122.useState)(null);
|
|
18838
18883
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
18839
18884
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
18840
|
-
const squadLayerRef = (0,
|
|
18841
|
-
const squadScrollRef = (0,
|
|
18885
|
+
const squadLayerRef = (0, import_react122.useRef)(null);
|
|
18886
|
+
const squadScrollRef = (0, import_react122.useRef)(null);
|
|
18842
18887
|
const selectPlayer = (playerId) => {
|
|
18843
18888
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
18844
18889
|
setSelectedPlayerId(playerId);
|
|
@@ -18848,7 +18893,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18848
18893
|
setSelectedPlayerId(null);
|
|
18849
18894
|
clearPlayerDetail?.();
|
|
18850
18895
|
};
|
|
18851
|
-
(0,
|
|
18896
|
+
(0, import_react122.useLayoutEffect)(() => {
|
|
18852
18897
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
18853
18898
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
18854
18899
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -18861,7 +18906,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18861
18906
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
18862
18907
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
18863
18908
|
const activeTab = tabs?.activeTab;
|
|
18864
|
-
(0,
|
|
18909
|
+
(0, import_react122.useEffect)(() => {
|
|
18865
18910
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
18866
18911
|
setSelectedPlayerId(null);
|
|
18867
18912
|
clearPlayerDetail?.();
|
|
@@ -18870,11 +18915,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18870
18915
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
18871
18916
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
18872
18917
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18873
|
-
(0,
|
|
18918
|
+
(0, import_react122.useEffect)(() => {
|
|
18874
18919
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18875
18920
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18876
18921
|
const storedTab = tabState?.activeTab;
|
|
18877
|
-
(0,
|
|
18922
|
+
(0, import_react122.useEffect)(() => {
|
|
18878
18923
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18879
18924
|
if (unreachable) setMonitorTab?.("chat");
|
|
18880
18925
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18883,12 +18928,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18883
18928
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
18884
18929
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
18885
18930
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
18886
|
-
const closeWith = (0,
|
|
18931
|
+
const closeWith = (0, import_react122.useCallback)((method) => {
|
|
18887
18932
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
18888
18933
|
if (onCloseRequested) onCloseRequested();
|
|
18889
18934
|
else close();
|
|
18890
18935
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18891
|
-
(0,
|
|
18936
|
+
(0, import_react122.useEffect)(() => {
|
|
18892
18937
|
const onKey = (e) => {
|
|
18893
18938
|
if (e.key === "Escape") closeWith("escape");
|
|
18894
18939
|
};
|
|
@@ -18904,80 +18949,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18904
18949
|
tabs?.setActiveTab("chat");
|
|
18905
18950
|
send(text2, { grounding, source });
|
|
18906
18951
|
};
|
|
18907
|
-
(0,
|
|
18952
|
+
(0, import_react122.useEffect)(() => {
|
|
18908
18953
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
18909
18954
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
18910
18955
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
18911
|
-
const inputRef = (0,
|
|
18912
|
-
const limitRef = (0,
|
|
18913
|
-
const typedSendRef = (0,
|
|
18914
|
-
const focusAfterCloseRef = (0,
|
|
18915
|
-
const [tool, setTool] = (0,
|
|
18916
|
-
const panelRef = (0,
|
|
18956
|
+
const inputRef = (0, import_react122.useRef)(null);
|
|
18957
|
+
const limitRef = (0, import_react122.useRef)(null);
|
|
18958
|
+
const typedSendRef = (0, import_react122.useRef)(false);
|
|
18959
|
+
const focusAfterCloseRef = (0, import_react122.useRef)(null);
|
|
18960
|
+
const [tool, setTool] = (0, import_react122.useState)(null);
|
|
18961
|
+
const panelRef = (0, import_react122.useRef)(null);
|
|
18917
18962
|
const settings = useOddsSettings();
|
|
18918
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
18963
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react122.useState)(false);
|
|
18919
18964
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
18920
|
-
const openSettings = (0,
|
|
18965
|
+
const openSettings = (0, import_react122.useCallback)(() => {
|
|
18921
18966
|
setTool(null);
|
|
18922
18967
|
setFavouritesOpen?.(false);
|
|
18923
18968
|
setSettingsOpen(true);
|
|
18924
18969
|
}, [setFavouritesOpen]);
|
|
18925
|
-
const closeSettings = (0,
|
|
18970
|
+
const closeSettings = (0, import_react122.useCallback)(() => {
|
|
18926
18971
|
setSettingsOpen(false);
|
|
18927
18972
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18928
18973
|
}, []);
|
|
18929
|
-
const openFavourites = (0,
|
|
18930
|
-
const closeFavourites = (0,
|
|
18974
|
+
const openFavourites = (0, import_react122.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
18975
|
+
const closeFavourites = (0, import_react122.useCallback)(() => {
|
|
18931
18976
|
setFavouritesOpen?.(false);
|
|
18932
18977
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18933
18978
|
}, [setFavouritesOpen]);
|
|
18934
|
-
(0,
|
|
18979
|
+
(0, import_react122.useEffect)(() => {
|
|
18935
18980
|
if (!favouritesOpen) return;
|
|
18936
18981
|
setTool(null);
|
|
18937
18982
|
setSettingsOpen(false);
|
|
18938
18983
|
}, [favouritesOpen]);
|
|
18939
18984
|
const paused = isPaused(state.limit);
|
|
18940
|
-
(0,
|
|
18985
|
+
(0, import_react122.useEffect)(() => {
|
|
18941
18986
|
if (paused) setTool(null);
|
|
18942
18987
|
}, [paused]);
|
|
18943
|
-
(0,
|
|
18988
|
+
(0, import_react122.useEffect)(() => {
|
|
18944
18989
|
if (!paused) return;
|
|
18945
18990
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
18946
18991
|
typedSendRef.current = false;
|
|
18947
18992
|
}, [paused]);
|
|
18948
|
-
const openTool = (0,
|
|
18993
|
+
const openTool = (0, import_react122.useCallback)((next) => {
|
|
18949
18994
|
setTool(next);
|
|
18950
18995
|
}, []);
|
|
18951
|
-
const toolsValue = (0,
|
|
18996
|
+
const toolsValue = (0, import_react122.useMemo)(
|
|
18952
18997
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
18953
18998
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
18954
18999
|
);
|
|
18955
|
-
const closeTool = (0,
|
|
19000
|
+
const closeTool = (0, import_react122.useCallback)(() => {
|
|
18956
19001
|
focusAfterCloseRef.current = "composer";
|
|
18957
19002
|
setTool(null);
|
|
18958
19003
|
}, []);
|
|
18959
|
-
const sendAsk = (0,
|
|
19004
|
+
const sendAsk = (0, import_react122.useCallback)((ask) => {
|
|
18960
19005
|
focusAfterCloseRef.current = "composer";
|
|
18961
19006
|
setTool(null);
|
|
18962
19007
|
tabs?.setActiveTab("chat");
|
|
18963
19008
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
18964
19009
|
}, [tabs, send]);
|
|
18965
|
-
const formatKickoff = (0,
|
|
19010
|
+
const formatKickoff = (0, import_react122.useCallback)((kickoffUtc) => {
|
|
18966
19011
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
18967
19012
|
return `${k.dayLabel} ${k.time}`;
|
|
18968
19013
|
}, [ui]);
|
|
18969
|
-
(0,
|
|
19014
|
+
(0, import_react122.useEffect)(() => {
|
|
18970
19015
|
if (tool) return;
|
|
18971
19016
|
const target = focusAfterCloseRef.current;
|
|
18972
19017
|
focusAfterCloseRef.current = null;
|
|
18973
19018
|
if (target === "composer") inputRef.current?.focus();
|
|
18974
19019
|
}, [tool]);
|
|
18975
|
-
(0,
|
|
19020
|
+
(0, import_react122.useEffect)(() => {
|
|
18976
19021
|
if (!tool || onChatTab && presetGrid) return;
|
|
18977
19022
|
focusAfterCloseRef.current = "composer";
|
|
18978
19023
|
setTool(null);
|
|
18979
19024
|
}, [tool, onChatTab, presetGrid]);
|
|
18980
|
-
const backRef = (0,
|
|
19025
|
+
const backRef = (0, import_react122.useRef)(() => false);
|
|
18981
19026
|
backRef.current = () => {
|
|
18982
19027
|
if (favouritesOpen) {
|
|
18983
19028
|
closeFavourites();
|
|
@@ -19001,7 +19046,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19001
19046
|
}
|
|
19002
19047
|
return false;
|
|
19003
19048
|
};
|
|
19004
|
-
(0,
|
|
19049
|
+
(0, import_react122.useEffect)(() => {
|
|
19005
19050
|
if (!onRegisterBack) return;
|
|
19006
19051
|
onRegisterBack(() => backRef.current());
|
|
19007
19052
|
return () => onRegisterBack(null);
|
|
@@ -22071,12 +22116,12 @@ function injectStyles(root) {
|
|
|
22071
22116
|
function StatsWidget(props) {
|
|
22072
22117
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
22073
22118
|
const cfg = props.config;
|
|
22074
|
-
const built = (0,
|
|
22075
|
-
const trackingRef = (0,
|
|
22076
|
-
const track = (0,
|
|
22077
|
-
const eventTextRef = (0,
|
|
22119
|
+
const built = (0, import_react123.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
22120
|
+
const trackingRef = (0, import_react123.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22121
|
+
const track = (0, import_react123.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22122
|
+
const eventTextRef = (0, import_react123.useRef)(false);
|
|
22078
22123
|
eventTextRef.current = cfg?.eventText === true;
|
|
22079
|
-
const logger = (0,
|
|
22124
|
+
const logger = (0, import_react123.useMemo)(() => {
|
|
22080
22125
|
if (!built) return null;
|
|
22081
22126
|
const raw = built.client.createEventLogger({
|
|
22082
22127
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -22086,27 +22131,27 @@ function StatsWidget(props) {
|
|
|
22086
22131
|
}, [built?.client, track]);
|
|
22087
22132
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22088
22133
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22089
|
-
const ui = (0,
|
|
22134
|
+
const ui = (0, import_react123.useMemo)(
|
|
22090
22135
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
22091
22136
|
[props.config, widgetStrings.strings]
|
|
22092
22137
|
);
|
|
22093
22138
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
22094
|
-
const rootRef = (0,
|
|
22095
|
-
const introDoneRef = (0,
|
|
22096
|
-
const markIntroDone = (0,
|
|
22139
|
+
const rootRef = (0, import_react123.useRef)(null);
|
|
22140
|
+
const introDoneRef = (0, import_react123.useRef)(false);
|
|
22141
|
+
const markIntroDone = (0, import_react123.useCallback)(() => {
|
|
22097
22142
|
introDoneRef.current = true;
|
|
22098
22143
|
}, []);
|
|
22099
22144
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
22100
22145
|
const threadLanguage = familyOf(language);
|
|
22101
22146
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
22102
|
-
const sportScope = (0,
|
|
22147
|
+
const sportScope = (0, import_react123.useMemo)(
|
|
22103
22148
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22104
22149
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22105
22150
|
);
|
|
22106
|
-
const chatTracking = (0,
|
|
22151
|
+
const chatTracking = (0, import_react123.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
22107
22152
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
22108
22153
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22109
|
-
const liveCardWatches = (0,
|
|
22154
|
+
const liveCardWatches = (0, import_react123.useMemo)(() => {
|
|
22110
22155
|
const seen2 = /* @__PURE__ */ new Set();
|
|
22111
22156
|
const out = [];
|
|
22112
22157
|
for (const msg of controller.state.messages) {
|
|
@@ -22132,19 +22177,19 @@ function StatsWidget(props) {
|
|
|
22132
22177
|
});
|
|
22133
22178
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
22134
22179
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
22135
|
-
const getSchedule = (0,
|
|
22180
|
+
const getSchedule = (0, import_react123.useCallback)(
|
|
22136
22181
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
22137
22182
|
[built, operatorUserId, anonymousUserId]
|
|
22138
22183
|
);
|
|
22139
|
-
const getStates = (0,
|
|
22184
|
+
const getStates = (0, import_react123.useCallback)(
|
|
22140
22185
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
22141
22186
|
[built, requestTag]
|
|
22142
22187
|
);
|
|
22143
|
-
const getTennisPrices = (0,
|
|
22188
|
+
const getTennisPrices = (0, import_react123.useCallback)(
|
|
22144
22189
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
22145
22190
|
[built, requestTag]
|
|
22146
22191
|
);
|
|
22147
|
-
const pinnedMatchIds = (0,
|
|
22192
|
+
const pinnedMatchIds = (0, import_react123.useMemo)(
|
|
22148
22193
|
() => footballMatchPinIds(monitor.pins),
|
|
22149
22194
|
[monitor.pins]
|
|
22150
22195
|
);
|
|
@@ -22158,13 +22203,13 @@ function StatsWidget(props) {
|
|
|
22158
22203
|
pinnedMatchIds,
|
|
22159
22204
|
timeZone: ui.timeZone
|
|
22160
22205
|
});
|
|
22161
|
-
const offeredSports = (0,
|
|
22206
|
+
const offeredSports = (0, import_react123.useMemo)(() => {
|
|
22162
22207
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
22163
22208
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
22164
22209
|
return [...seen2];
|
|
22165
22210
|
}, [discovery.matchDays, discovery.groups]);
|
|
22166
22211
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
22167
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
22212
|
+
const [liveLeague, setLiveLeague] = (0, import_react123.useState)(null);
|
|
22168
22213
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
22169
22214
|
const matchesLoaded = useMatchesDay({
|
|
22170
22215
|
discovery,
|
|
@@ -22174,8 +22219,8 @@ function StatsWidget(props) {
|
|
|
22174
22219
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
22175
22220
|
timeZone: ui.timeZone
|
|
22176
22221
|
});
|
|
22177
|
-
const prevLiveSnapshotRef = (0,
|
|
22178
|
-
(0,
|
|
22222
|
+
const prevLiveSnapshotRef = (0, import_react123.useRef)(monitor.snapshot);
|
|
22223
|
+
(0, import_react123.useEffect)(() => {
|
|
22179
22224
|
const snap = monitor.snapshot;
|
|
22180
22225
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
22181
22226
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -22215,14 +22260,14 @@ function StatsWidget(props) {
|
|
|
22215
22260
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22216
22261
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22217
22262
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
22218
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
22219
|
-
const latestGreeting = (0,
|
|
22263
|
+
const [favSportPick, setFavSportPick] = (0, import_react123.useState)(null);
|
|
22264
|
+
const latestGreeting = (0, import_react123.useMemo)(() => {
|
|
22220
22265
|
for (const m of [...controller.state.messages].reverse()) {
|
|
22221
22266
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
22222
22267
|
}
|
|
22223
22268
|
return null;
|
|
22224
22269
|
}, [controller.state.messages]);
|
|
22225
|
-
const favSportOptions = (0,
|
|
22270
|
+
const favSportOptions = (0, import_react123.useMemo)(
|
|
22226
22271
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
22227
22272
|
[latestGreeting]
|
|
22228
22273
|
);
|
|
@@ -22231,26 +22276,26 @@ function StatsWidget(props) {
|
|
|
22231
22276
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
22232
22277
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
22233
22278
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
22234
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
22235
|
-
const builderGreeting = (0,
|
|
22279
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react123.useState)(null);
|
|
22280
|
+
const builderGreeting = (0, import_react123.useMemo)(
|
|
22236
22281
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
22237
22282
|
[controller.state.messages]
|
|
22238
22283
|
);
|
|
22239
|
-
const [coolOff, setCoolOff] = (0,
|
|
22240
|
-
const onBuilderCoolOff = (0,
|
|
22284
|
+
const [coolOff, setCoolOff] = (0, import_react123.useState)(null);
|
|
22285
|
+
const onBuilderCoolOff = (0, import_react123.useCallback)((sport) => {
|
|
22241
22286
|
if (!builderGreeting) return;
|
|
22242
22287
|
setCoolOff((prev) => {
|
|
22243
22288
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
22244
22289
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
22245
22290
|
});
|
|
22246
22291
|
}, [builderGreeting]);
|
|
22247
|
-
const [handOffPending, setHandOffPending] = (0,
|
|
22248
|
-
const consumeHandOff = (0,
|
|
22249
|
-
const openTabFromChip = (0,
|
|
22292
|
+
const [handOffPending, setHandOffPending] = (0, import_react123.useState)(false);
|
|
22293
|
+
const consumeHandOff = (0, import_react123.useCallback)(() => setHandOffPending(false), []);
|
|
22294
|
+
const openTabFromChip = (0, import_react123.useCallback)((tab) => {
|
|
22250
22295
|
if (tab === "builder") setHandOffPending(true);
|
|
22251
22296
|
monitor.setActiveTab(tab);
|
|
22252
22297
|
}, [monitor.setActiveTab]);
|
|
22253
|
-
const builderOptions = (0,
|
|
22298
|
+
const builderOptions = (0, import_react123.useMemo)(() => {
|
|
22254
22299
|
const greeting = builderGreeting;
|
|
22255
22300
|
if (!greeting) return [];
|
|
22256
22301
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -22267,7 +22312,7 @@ function StatsWidget(props) {
|
|
|
22267
22312
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
22268
22313
|
}, [builderGreeting, coolOff, ui, handOffPending]);
|
|
22269
22314
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
22270
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
22315
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react123.useState)(panelOpen);
|
|
22271
22316
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
22272
22317
|
const favourites = useFavourites({
|
|
22273
22318
|
conversation: built?.conversation ?? null,
|
|
@@ -22279,16 +22324,16 @@ function StatsWidget(props) {
|
|
|
22279
22324
|
onChanged: discovery.refreshSchedule
|
|
22280
22325
|
});
|
|
22281
22326
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
22282
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
22327
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react123.useState)(false);
|
|
22283
22328
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
22284
|
-
const getPricePresets = (0,
|
|
22329
|
+
const getPricePresets = (0, import_react123.useCallback)(
|
|
22285
22330
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
22286
22331
|
[built]
|
|
22287
22332
|
);
|
|
22288
22333
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
22289
22334
|
const markLiveActivity = monitor.markLiveActivity;
|
|
22290
|
-
const prevLiveCountRef = (0,
|
|
22291
|
-
(0,
|
|
22335
|
+
const prevLiveCountRef = (0, import_react123.useRef)(0);
|
|
22336
|
+
(0, import_react123.useEffect)(() => {
|
|
22292
22337
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
22293
22338
|
prevLiveCountRef.current = discovery.liveCount;
|
|
22294
22339
|
if (rose) markLiveActivity();
|
|
@@ -22302,7 +22347,7 @@ function StatsWidget(props) {
|
|
|
22302
22347
|
closePanel: controller.close
|
|
22303
22348
|
});
|
|
22304
22349
|
const markAdded = hostEvents.markAdded;
|
|
22305
|
-
const slip = (0,
|
|
22350
|
+
const slip = (0, import_react123.useMemo)(
|
|
22306
22351
|
() => {
|
|
22307
22352
|
const handler = props.config?.onAddToSlip;
|
|
22308
22353
|
return {
|
|
@@ -22322,7 +22367,7 @@ function StatsWidget(props) {
|
|
|
22322
22367
|
},
|
|
22323
22368
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
22324
22369
|
);
|
|
22325
|
-
const onDashboardTap = (0,
|
|
22370
|
+
const onDashboardTap = (0, import_react123.useMemo)(
|
|
22326
22371
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
22327
22372
|
[built, logger]
|
|
22328
22373
|
);
|
|
@@ -22336,17 +22381,28 @@ function StatsWidget(props) {
|
|
|
22336
22381
|
log: logger
|
|
22337
22382
|
})
|
|
22338
22383
|
}));
|
|
22339
|
-
const dismissPopupRef = (0,
|
|
22384
|
+
const dismissPopupRef = (0, import_react123.useRef)(() => {
|
|
22340
22385
|
});
|
|
22341
|
-
const onCtaRef = (0,
|
|
22386
|
+
const onCtaRef = (0, import_react123.useRef)(() => {
|
|
22342
22387
|
});
|
|
22388
|
+
const onTeaserTapRef = (0, import_react123.useRef)(() => {
|
|
22389
|
+
});
|
|
22390
|
+
const bubble = controller.state.greetingBubble;
|
|
22391
|
+
const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
|
|
22343
22392
|
const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
|
|
22344
22393
|
const mobile = useMobileBinding({
|
|
22345
22394
|
binding: props.mobile,
|
|
22346
22395
|
panelOpen,
|
|
22347
22396
|
popupText: controller.state.popupText,
|
|
22348
22397
|
cta: bubbleCta,
|
|
22398
|
+
price: bubblePrice ? {
|
|
22399
|
+
matchOddsId: bubblePrice.price.selection.matchOddsId,
|
|
22400
|
+
marketLabel: bubblePrice.price.marketLabel,
|
|
22401
|
+
label: bubblePrice.price.selection.label,
|
|
22402
|
+
odds: formatOdds(bubblePrice.price.selection.formats, oddsSettings.oddsFormat)
|
|
22403
|
+
} : null,
|
|
22349
22404
|
onCta: () => onCtaRef.current(),
|
|
22405
|
+
onTeaserTap: () => onTeaserTapRef.current(),
|
|
22350
22406
|
asks,
|
|
22351
22407
|
open: controller.open,
|
|
22352
22408
|
close: controller.close,
|
|
@@ -22355,16 +22411,16 @@ function StatsWidget(props) {
|
|
|
22355
22411
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
22356
22412
|
dismissPopupRef.current = dismissPopup;
|
|
22357
22413
|
const greetingMeta = latestGreetingMeta(controller.state.messages);
|
|
22358
|
-
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText,
|
|
22359
|
-
const [highlight, setHighlight] = (0,
|
|
22360
|
-
const clearHighlight = (0,
|
|
22361
|
-
(0,
|
|
22414
|
+
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, mobile.confirmedShown);
|
|
22415
|
+
const [highlight, setHighlight] = (0, import_react123.useState)(null);
|
|
22416
|
+
const clearHighlight = (0, import_react123.useCallback)(() => setHighlight(null), []);
|
|
22417
|
+
(0, import_react123.useEffect)(() => {
|
|
22362
22418
|
if (!panelOpen) setHighlight(null);
|
|
22363
22419
|
}, [panelOpen]);
|
|
22364
|
-
const highlightRequest = (0,
|
|
22420
|
+
const highlightRequest = (0, import_react123.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
|
|
22365
22421
|
const { open: openFromCta, state: { greetingBubble } } = controller;
|
|
22366
22422
|
const setTab = monitor.setActiveTab;
|
|
22367
|
-
const logCtaClick = (0,
|
|
22423
|
+
const logCtaClick = (0, import_react123.useCallback)(() => {
|
|
22368
22424
|
if (!logger || !greetingMeta) return;
|
|
22369
22425
|
logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
|
|
22370
22426
|
}, [logger, greetingMeta]);
|
|
@@ -22375,12 +22431,18 @@ function StatsWidget(props) {
|
|
|
22375
22431
|
const matchId = greetingBubble?.matchId;
|
|
22376
22432
|
if (matchId) setHighlight((prev) => ({ matchId, token: (prev?.token ?? 0) + 1 }));
|
|
22377
22433
|
};
|
|
22378
|
-
|
|
22434
|
+
onTeaserTapRef.current = () => {
|
|
22435
|
+
if (!controller.state.popupText) return;
|
|
22436
|
+
track({ name: "bubble_click" });
|
|
22437
|
+
if (!bubbleCta) logCtaClick();
|
|
22438
|
+
openFromCta();
|
|
22439
|
+
};
|
|
22440
|
+
const onCta = (0, import_react123.useCallback)(() => onCtaRef.current(), []);
|
|
22379
22441
|
useOpenTelemetry(logger, panelOpen);
|
|
22380
|
-
const onControlRef = (0,
|
|
22442
|
+
const onControlRef = (0, import_react123.useRef)(props.onControl);
|
|
22381
22443
|
onControlRef.current = props.onControl;
|
|
22382
22444
|
const { open: openPanel, close: closePanel } = controller;
|
|
22383
|
-
(0,
|
|
22445
|
+
(0, import_react123.useEffect)(() => {
|
|
22384
22446
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
22385
22447
|
return () => onControlRef.current?.(null);
|
|
22386
22448
|
}, [openPanel, closePanel]);
|
|
@@ -22397,11 +22459,11 @@ function StatsWidget(props) {
|
|
|
22397
22459
|
page: cfg?.page
|
|
22398
22460
|
}
|
|
22399
22461
|
};
|
|
22400
|
-
(0,
|
|
22462
|
+
(0, import_react123.useEffect)(() => {
|
|
22401
22463
|
if (!logger) return;
|
|
22402
22464
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
22403
22465
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
22404
|
-
(0,
|
|
22466
|
+
(0, import_react123.useEffect)(() => {
|
|
22405
22467
|
if (!logger) return;
|
|
22406
22468
|
logger.resume();
|
|
22407
22469
|
const onHide = () => {
|
|
@@ -22419,15 +22481,15 @@ function StatsWidget(props) {
|
|
|
22419
22481
|
logger.dispose();
|
|
22420
22482
|
};
|
|
22421
22483
|
}, [logger]);
|
|
22422
|
-
(0,
|
|
22484
|
+
(0, import_react123.useEffect)(() => {
|
|
22423
22485
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
22424
22486
|
const node = rootRef.current?.getRootNode();
|
|
22425
22487
|
if (node) injectStyles(node);
|
|
22426
22488
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
22427
22489
|
const holds = useSessionHolds();
|
|
22428
22490
|
const builderConversation = built?.conversation ?? null;
|
|
22429
|
-
const builderMemory = (0,
|
|
22430
|
-
const personalGreeting = (0,
|
|
22491
|
+
const builderMemory = (0, import_react123.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
22492
|
+
const personalGreeting = (0, import_react123.useMemo)(() => ({
|
|
22431
22493
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
22432
22494
|
conversation: built?.conversation ?? null,
|
|
22433
22495
|
openFavourites: () => setFavouritesOpen(true),
|
|
@@ -22477,7 +22539,21 @@ function StatsWidget(props) {
|
|
|
22477
22539
|
onCloseRequested: mobile.onCloseRequested,
|
|
22478
22540
|
onRegisterBack: mobile.onRegisterBack
|
|
22479
22541
|
}
|
|
22480
|
-
) }) }) : props.mobile ?
|
|
22542
|
+
) }) }) : props.mobile ? bubblePrice && mobile.onRegisterPrice && mobile.onPriceResult && mobile.priceInFlight ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22543
|
+
MobileBubblePrice,
|
|
22544
|
+
{
|
|
22545
|
+
matchId: bubblePrice.matchId,
|
|
22546
|
+
price: bubblePrice.price,
|
|
22547
|
+
conversation: built?.conversation ?? null,
|
|
22548
|
+
slip,
|
|
22549
|
+
ui,
|
|
22550
|
+
hook: hookOf(greetingMeta),
|
|
22551
|
+
sport: bubblePrice.sport,
|
|
22552
|
+
inFlight: mobile.priceInFlight,
|
|
22553
|
+
onRegister: mobile.onRegisterPrice,
|
|
22554
|
+
onResult: mobile.onPriceResult
|
|
22555
|
+
}
|
|
22556
|
+
) : null : /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22481
22557
|
ChatFab,
|
|
22482
22558
|
{
|
|
22483
22559
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -22494,16 +22570,16 @@ function StatsWidget(props) {
|
|
|
22494
22570
|
cta: bubbleCta ?? void 0,
|
|
22495
22571
|
onCta,
|
|
22496
22572
|
onBubbleClick: logCtaClick,
|
|
22497
|
-
price:
|
|
22573
|
+
price: bubblePrice ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22498
22574
|
BubblePrice,
|
|
22499
22575
|
{
|
|
22500
|
-
matchId:
|
|
22501
|
-
price:
|
|
22576
|
+
matchId: bubblePrice.matchId,
|
|
22577
|
+
price: bubblePrice.price,
|
|
22502
22578
|
conversation: built?.conversation ?? null,
|
|
22503
22579
|
slip,
|
|
22504
22580
|
ui,
|
|
22505
22581
|
hook: hookOf(greetingMeta),
|
|
22506
|
-
sport:
|
|
22582
|
+
sport: bubblePrice.sport
|
|
22507
22583
|
}
|
|
22508
22584
|
) : void 0
|
|
22509
22585
|
}
|