@sensiblestats/widget-react 0.138.1 → 0.139.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 +19 -0
- package/dist/index.cjs +332 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +168 -149
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/package.json +2 -2
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_react108 = require("react");
|
|
42
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -246,6 +246,7 @@ var BUNDLED_EN_GB = {
|
|
|
246
246
|
"widget.v8Paused": "No priced games in this sport right now. Stats and questions still work.",
|
|
247
247
|
"widget.v8NoGamesToday": "No games today",
|
|
248
248
|
"widget.v8Miss": "No combo comes near that total in these games.",
|
|
249
|
+
"widget.v8Nearest": "No combo lands on that total in these games. This is the closest.",
|
|
249
250
|
"widget.v8UseAllGames": "Use all games",
|
|
250
251
|
"widget.v8BuilderShow": "Show me",
|
|
251
252
|
"widget.v8BuilderIn": "in",
|
|
@@ -1337,7 +1338,7 @@ function parseOddsFormat(value) {
|
|
|
1337
1338
|
}
|
|
1338
1339
|
|
|
1339
1340
|
// src/version.generated.ts
|
|
1340
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1341
|
+
var WIDGET_REACT_VERSION = "0.139.0";
|
|
1341
1342
|
|
|
1342
1343
|
// src/config.ts
|
|
1343
1344
|
function hostTag(cfg) {
|
|
@@ -1637,6 +1638,7 @@ function normalizeUi(cfg, loaded) {
|
|
|
1637
1638
|
v8PausedNext: strings.v8PausedNext,
|
|
1638
1639
|
v8NoGamesToday: strings.v8NoGamesToday,
|
|
1639
1640
|
v8Miss: strings.v8Miss,
|
|
1641
|
+
v8Nearest: strings.v8Nearest,
|
|
1640
1642
|
v8UseAllGames: strings.v8UseAllGames,
|
|
1641
1643
|
v8Out: strings.v8Out,
|
|
1642
1644
|
v8More: strings.v8More,
|
|
@@ -2501,6 +2503,9 @@ function toNflInsightVM(card) {
|
|
|
2501
2503
|
competition: str(card.competitionName),
|
|
2502
2504
|
kickoffLabel: str(card.kickoffLabel),
|
|
2503
2505
|
kickoffUtc: str(card.kickoffUtc) ?? null,
|
|
2506
|
+
homeTeamImage: str(card.homeTeamImagePath),
|
|
2507
|
+
awayTeamImage: str(card.awayTeamImagePath),
|
|
2508
|
+
competitionImage: str(card.competitionImagePath),
|
|
2504
2509
|
addToSlipEnabled: card.addToSlipEnabled === true,
|
|
2505
2510
|
disclaimer: str(card.disclaimer),
|
|
2506
2511
|
selections,
|
|
@@ -7853,7 +7858,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7853
7858
|
}
|
|
7854
7859
|
|
|
7855
7860
|
// src/components/ChatPanel.tsx
|
|
7856
|
-
var
|
|
7861
|
+
var import_react107 = require("react");
|
|
7857
7862
|
|
|
7858
7863
|
// src/components/ChatHeader.tsx
|
|
7859
7864
|
var import_react49 = require("react");
|
|
@@ -7971,10 +7976,10 @@ function ChatHeader({
|
|
|
7971
7976
|
}
|
|
7972
7977
|
|
|
7973
7978
|
// src/components/MessageList.tsx
|
|
7974
|
-
var
|
|
7979
|
+
var import_react63 = require("react");
|
|
7975
7980
|
|
|
7976
7981
|
// src/components/ChatMessage.tsx
|
|
7977
|
-
var
|
|
7982
|
+
var import_react62 = require("react");
|
|
7978
7983
|
|
|
7979
7984
|
// src/components/Markdown.tsx
|
|
7980
7985
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8922,6 +8927,9 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
8922
8927
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ss-w-nba-cards", children: insights.map((vm, i) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(NbaCard, { vm, ui, slip, monitor }, `${vm.id}:${i}`)) });
|
|
8923
8928
|
}
|
|
8924
8929
|
|
|
8930
|
+
// src/components/NflInsightList.tsx
|
|
8931
|
+
var import_react53 = require("react");
|
|
8932
|
+
|
|
8925
8933
|
// src/strings/types.ts
|
|
8926
8934
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
8927
8935
|
|
|
@@ -8930,7 +8938,11 @@ var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
|
8930
8938
|
var oneDecimal2 = (n, ui) => formatNumber(n, ui.locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 });
|
|
8931
8939
|
var cap = (text2, ui) => text2 ? upperCase(text2.charAt(0), ui.locale) + text2.slice(1) : text2;
|
|
8932
8940
|
var lineNumber = (line) => Number(line.replace("\u2212", "-").replace(",", "."));
|
|
8933
|
-
function Badge({ abbr }) {
|
|
8941
|
+
function Badge({ abbr, url }) {
|
|
8942
|
+
const [failed, setFailed] = (0, import_react53.useState)(false);
|
|
8943
|
+
if (url && !failed) {
|
|
8944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
8945
|
+
}
|
|
8934
8946
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-badge", children: abbr });
|
|
8935
8947
|
}
|
|
8936
8948
|
function Price({ vm, selection, label, ui, slip, nowMs }) {
|
|
@@ -8971,12 +8983,12 @@ function Head2({ vm, ui, monitor }) {
|
|
|
8971
8983
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ss-w-nfl-head-l", children: [
|
|
8972
8984
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "ss-w-nfl-meta", children: [
|
|
8973
8985
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "ss-w-nfl-side", children: [
|
|
8974
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr }),
|
|
8986
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr, url: vm.homeTeamImage }),
|
|
8975
8987
|
vm.homeTeamName ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: vm.homeTeamName }) : null
|
|
8976
8988
|
] }),
|
|
8977
8989
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-sep", "aria-hidden": "true", children: "\xB7" }),
|
|
8978
8990
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "ss-w-nfl-side", children: [
|
|
8979
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr }),
|
|
8991
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr, url: vm.awayTeamImage }),
|
|
8980
8992
|
vm.awayTeamName ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: vm.awayTeamName }) : null
|
|
8981
8993
|
] }),
|
|
8982
8994
|
vm.kickoffLabel ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ss-w-nfl-kick", children: vm.kickoffLabel }) : null
|
|
@@ -9050,8 +9062,8 @@ function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
|
9050
9062
|
const nfl = ui.nfl;
|
|
9051
9063
|
const { oddsFormat } = useOddsSettings();
|
|
9052
9064
|
const who = (side) => {
|
|
9053
|
-
if (side === "home") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr });
|
|
9054
|
-
if (side === "away") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr });
|
|
9065
|
+
if (side === "home") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.homeAbbr, url: vm.homeTeamImage });
|
|
9066
|
+
if (side === "away") return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Badge, { abbr: vm.awayAbbr, url: vm.awayTeamImage });
|
|
9055
9067
|
return cap(side === "under" ? nfl.under : nfl.over, ui);
|
|
9056
9068
|
};
|
|
9057
9069
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ss-w-nfl-lm", children: [
|
|
@@ -9538,7 +9550,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
9538
9550
|
}
|
|
9539
9551
|
|
|
9540
9552
|
// src/components/CompactOddsList.tsx
|
|
9541
|
-
var
|
|
9553
|
+
var import_react54 = require("react");
|
|
9542
9554
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
9543
9555
|
|
|
9544
9556
|
// src/compactList.ts
|
|
@@ -9660,11 +9672,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
9660
9672
|
] });
|
|
9661
9673
|
}
|
|
9662
9674
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
9663
|
-
const [shown2, setShown] = (0,
|
|
9675
|
+
const [shown2, setShown] = (0, import_react54.useState)(COMPACT_PAGE);
|
|
9664
9676
|
const hidden = list.rowCount - shown2;
|
|
9665
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
9666
|
-
const focusRef = (0,
|
|
9667
|
-
(0,
|
|
9677
|
+
const [focusIndex, setFocusIndex] = (0, import_react54.useState)(null);
|
|
9678
|
+
const focusRef = (0, import_react54.useRef)(null);
|
|
9679
|
+
(0, import_react54.useEffect)(() => {
|
|
9668
9680
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
9669
9681
|
}, [focusIndex]);
|
|
9670
9682
|
let left = shown2;
|
|
@@ -9899,7 +9911,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9899
9911
|
}
|
|
9900
9912
|
|
|
9901
9913
|
// src/components/dashboard/CountdownCard.tsx
|
|
9902
|
-
var
|
|
9914
|
+
var import_react55 = require("react");
|
|
9903
9915
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
9904
9916
|
var DAY_MS3 = 864e5;
|
|
9905
9917
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -9918,12 +9930,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9918
9930
|
function CountdownCard({ card, ui }) {
|
|
9919
9931
|
const { data } = card;
|
|
9920
9932
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
9921
|
-
const [nowMs, setNowMs] = (0,
|
|
9922
|
-
const [reduced] = (0,
|
|
9933
|
+
const [nowMs, setNowMs] = (0, import_react55.useState)(() => Date.now());
|
|
9934
|
+
const [reduced] = (0, import_react55.useState)(
|
|
9923
9935
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9924
9936
|
);
|
|
9925
9937
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9926
|
-
(0,
|
|
9938
|
+
(0, import_react55.useEffect)(() => {
|
|
9927
9939
|
if (reduced) return;
|
|
9928
9940
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
9929
9941
|
return () => window.clearInterval(id);
|
|
@@ -9931,7 +9943,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9931
9943
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
9932
9944
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
9933
9945
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
9934
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
9946
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react55.Fragment, { children: [
|
|
9935
9947
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
9936
9948
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
9937
9949
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -9942,7 +9954,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9942
9954
|
}
|
|
9943
9955
|
|
|
9944
9956
|
// src/components/dashboard/InjuriesCard.tsx
|
|
9945
|
-
var
|
|
9957
|
+
var import_react56 = require("react");
|
|
9946
9958
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9947
9959
|
var SHOWN = 3;
|
|
9948
9960
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9965,7 +9977,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9965
9977
|
}
|
|
9966
9978
|
function InjuriesCard({ card, ui }) {
|
|
9967
9979
|
const { data } = card;
|
|
9968
|
-
const [expanded, setExpanded] = (0,
|
|
9980
|
+
const [expanded, setExpanded] = (0, import_react56.useState)(false);
|
|
9969
9981
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9970
9982
|
const limit = expanded ? void 0 : SHOWN;
|
|
9971
9983
|
const { showMore, showLess } = ui;
|
|
@@ -10070,7 +10082,7 @@ function LinksCard({ card }) {
|
|
|
10070
10082
|
}
|
|
10071
10083
|
|
|
10072
10084
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
10073
|
-
var
|
|
10085
|
+
var import_react57 = require("react");
|
|
10074
10086
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10075
10087
|
function initials3(name) {
|
|
10076
10088
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -10080,7 +10092,7 @@ function PostMatchCrest({
|
|
|
10080
10092
|
name,
|
|
10081
10093
|
side
|
|
10082
10094
|
}) {
|
|
10083
|
-
const [failed, setFailed] = (0,
|
|
10095
|
+
const [failed, setFailed] = (0, import_react57.useState)(false);
|
|
10084
10096
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
10085
10097
|
if (url && !failed) {
|
|
10086
10098
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10279,10 +10291,10 @@ function RestingFormCard({ card }) {
|
|
|
10279
10291
|
}
|
|
10280
10292
|
|
|
10281
10293
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10282
|
-
var
|
|
10294
|
+
var import_react59 = require("react");
|
|
10283
10295
|
|
|
10284
10296
|
// src/useLiveClock.ts
|
|
10285
|
-
var
|
|
10297
|
+
var import_react58 = require("react");
|
|
10286
10298
|
var TICK_MS = 6e4;
|
|
10287
10299
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10288
10300
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10291,10 +10303,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
10291
10303
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
10292
10304
|
}
|
|
10293
10305
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
10294
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10306
|
+
const [displayMinute, setDisplayMinute] = (0, import_react58.useState)(
|
|
10295
10307
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10296
10308
|
);
|
|
10297
|
-
(0,
|
|
10309
|
+
(0, import_react58.useEffect)(() => {
|
|
10298
10310
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10299
10311
|
if (!clockRunning) return;
|
|
10300
10312
|
const id = window.setInterval(() => {
|
|
@@ -10311,7 +10323,7 @@ function initials5(name) {
|
|
|
10311
10323
|
return name.trim().slice(0, 3).toUpperCase();
|
|
10312
10324
|
}
|
|
10313
10325
|
function LiveCrest({ url, name, side }) {
|
|
10314
|
-
const [failed, setFailed] = (0,
|
|
10326
|
+
const [failed, setFailed] = (0, import_react59.useState)(false);
|
|
10315
10327
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
10316
10328
|
if (url && !failed) {
|
|
10317
10329
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10333,7 +10345,7 @@ function LiveScoreCard({
|
|
|
10333
10345
|
}) {
|
|
10334
10346
|
const { data } = card;
|
|
10335
10347
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10336
|
-
const seedRef = (0,
|
|
10348
|
+
const seedRef = (0, import_react59.useRef)(null);
|
|
10337
10349
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10338
10350
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10339
10351
|
}
|
|
@@ -10379,7 +10391,7 @@ function LiveScoreCard({
|
|
|
10379
10391
|
}
|
|
10380
10392
|
|
|
10381
10393
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10382
|
-
var
|
|
10394
|
+
var import_react60 = require("react");
|
|
10383
10395
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10384
10396
|
var SHOWN2 = 3;
|
|
10385
10397
|
function EventIcon({ type }) {
|
|
@@ -10421,7 +10433,7 @@ function EventRow({ e }) {
|
|
|
10421
10433
|
] });
|
|
10422
10434
|
}
|
|
10423
10435
|
function LiveTimelineCard({ card, ui }) {
|
|
10424
|
-
const [expanded, setExpanded] = (0,
|
|
10436
|
+
const [expanded, setExpanded] = (0, import_react60.useState)(false);
|
|
10425
10437
|
const events = card.data.events;
|
|
10426
10438
|
if (!events || events.length === 0) return null;
|
|
10427
10439
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -10445,7 +10457,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
10445
10457
|
}
|
|
10446
10458
|
|
|
10447
10459
|
// src/components/dashboard/MomentumWave.tsx
|
|
10448
|
-
var
|
|
10460
|
+
var import_react61 = require("react");
|
|
10449
10461
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10450
10462
|
var WIDTH = 270;
|
|
10451
10463
|
var HEIGHT = 56;
|
|
@@ -10470,7 +10482,7 @@ function MomentumWave({
|
|
|
10470
10482
|
}) {
|
|
10471
10483
|
if (points.length === 0) return null;
|
|
10472
10484
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
10473
|
-
const clipId = (0,
|
|
10485
|
+
const clipId = (0, import_react61.useId)();
|
|
10474
10486
|
const topClipId = `${clipId}-top`;
|
|
10475
10487
|
const bottomClipId = `${clipId}-bottom`;
|
|
10476
10488
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -10620,7 +10632,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
10620
10632
|
// src/components/ChatMessage.tsx
|
|
10621
10633
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
10622
10634
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
10623
|
-
const [sport, setSport] = (0,
|
|
10635
|
+
const [sport, setSport] = (0, import_react62.useState)(null);
|
|
10624
10636
|
if (message.role === "user") {
|
|
10625
10637
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
10626
10638
|
}
|
|
@@ -10674,11 +10686,11 @@ function turnAnchor(messages) {
|
|
|
10674
10686
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
10675
10687
|
const { state, send } = controller;
|
|
10676
10688
|
const { oddsFormat } = useOddsSettings();
|
|
10677
|
-
const listRef = (0,
|
|
10678
|
-
const endRef = (0,
|
|
10679
|
-
const pinnedRef = (0,
|
|
10680
|
-
const anchoredTurnRef = (0,
|
|
10681
|
-
(0,
|
|
10689
|
+
const listRef = (0, import_react63.useRef)(null);
|
|
10690
|
+
const endRef = (0, import_react63.useRef)(null);
|
|
10691
|
+
const pinnedRef = (0, import_react63.useRef)(true);
|
|
10692
|
+
const anchoredTurnRef = (0, import_react63.useRef)(null);
|
|
10693
|
+
(0, import_react63.useEffect)(() => {
|
|
10682
10694
|
const anchor = turnAnchor(state.messages);
|
|
10683
10695
|
const list = listRef.current;
|
|
10684
10696
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -10737,13 +10749,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
10737
10749
|
}
|
|
10738
10750
|
|
|
10739
10751
|
// src/components/ChatInput.tsx
|
|
10740
|
-
var
|
|
10752
|
+
var import_react64 = require("react");
|
|
10741
10753
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10742
|
-
var ChatInput = (0,
|
|
10743
|
-
const [value, setValue] = (0,
|
|
10744
|
-
const textareaRef = (0,
|
|
10745
|
-
const stopRef = (0,
|
|
10746
|
-
const textBoxWantsFocusRef = (0,
|
|
10754
|
+
var ChatInput = (0, import_react64.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
10755
|
+
const [value, setValue] = (0, import_react64.useState)("");
|
|
10756
|
+
const textareaRef = (0, import_react64.useRef)(null);
|
|
10757
|
+
const stopRef = (0, import_react64.useRef)(null);
|
|
10758
|
+
const textBoxWantsFocusRef = (0, import_react64.useRef)(false);
|
|
10747
10759
|
const submit = () => {
|
|
10748
10760
|
if (disabled) return;
|
|
10749
10761
|
const t = value.trim();
|
|
@@ -10757,7 +10769,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10757
10769
|
submit();
|
|
10758
10770
|
}
|
|
10759
10771
|
};
|
|
10760
|
-
(0,
|
|
10772
|
+
(0, import_react64.useImperativeHandle)(ref, () => ({
|
|
10761
10773
|
focus() {
|
|
10762
10774
|
const box = textareaRef.current;
|
|
10763
10775
|
if (box && !box.disabled) {
|
|
@@ -10769,7 +10781,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10769
10781
|
stopRef.current?.focus();
|
|
10770
10782
|
}
|
|
10771
10783
|
}), []);
|
|
10772
|
-
(0,
|
|
10784
|
+
(0, import_react64.useEffect)(() => {
|
|
10773
10785
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
10774
10786
|
textBoxWantsFocusRef.current = false;
|
|
10775
10787
|
const box = textareaRef.current;
|
|
@@ -10800,7 +10812,7 @@ var ChatInput = (0, import_react63.forwardRef)(function ChatInput2({ placeholder
|
|
|
10800
10812
|
});
|
|
10801
10813
|
|
|
10802
10814
|
// src/components/TabBar.tsx
|
|
10803
|
-
var
|
|
10815
|
+
var import_react65 = require("react");
|
|
10804
10816
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10805
10817
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6];
|
|
10806
10818
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled }) {
|
|
@@ -10822,16 +10834,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10822
10834
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
10823
10835
|
];
|
|
10824
10836
|
const track = useTrack();
|
|
10825
|
-
const listRef = (0,
|
|
10837
|
+
const listRef = (0, import_react65.useRef)(null);
|
|
10826
10838
|
const activeTab = monitor.activeTab;
|
|
10827
|
-
(0,
|
|
10839
|
+
(0, import_react65.useEffect)(() => {
|
|
10828
10840
|
const el = listRef.current?.querySelector("[data-on]");
|
|
10829
10841
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
10830
10842
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10831
10843
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
10832
10844
|
}, [activeTab]);
|
|
10833
10845
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
10834
|
-
(0,
|
|
10846
|
+
(0, import_react65.useLayoutEffect)(() => {
|
|
10835
10847
|
const strip = listRef.current;
|
|
10836
10848
|
if (!strip) return;
|
|
10837
10849
|
const measure = () => {
|
|
@@ -10879,7 +10891,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10879
10891
|
}
|
|
10880
10892
|
|
|
10881
10893
|
// src/components/MonitorTabs.tsx
|
|
10882
|
-
var
|
|
10894
|
+
var import_react77 = require("react");
|
|
10883
10895
|
|
|
10884
10896
|
// src/components/MarketAccordion.tsx
|
|
10885
10897
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10941,7 +10953,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10941
10953
|
}
|
|
10942
10954
|
|
|
10943
10955
|
// src/components/MonitorFormH2H.tsx
|
|
10944
|
-
var
|
|
10956
|
+
var import_react66 = require("react");
|
|
10945
10957
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10946
10958
|
function resultClass2(result) {
|
|
10947
10959
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10957,7 +10969,7 @@ function FormDots({ form, ui }) {
|
|
|
10957
10969
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10958
10970
|
}
|
|
10959
10971
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10960
|
-
const [expanded, setExpanded] = (0,
|
|
10972
|
+
const [expanded, setExpanded] = (0, import_react66.useState)(false);
|
|
10961
10973
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10962
10974
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10963
10975
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, {});
|
|
@@ -11184,7 +11196,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11184
11196
|
}
|
|
11185
11197
|
|
|
11186
11198
|
// src/components/NbaMonitorCard.tsx
|
|
11187
|
-
var
|
|
11199
|
+
var import_react70 = require("react");
|
|
11188
11200
|
|
|
11189
11201
|
// src/sportLabel.ts
|
|
11190
11202
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -11194,7 +11206,7 @@ var sportLabel = (ui, sport) => {
|
|
|
11194
11206
|
};
|
|
11195
11207
|
|
|
11196
11208
|
// src/components/NbaFormSection.tsx
|
|
11197
|
-
var
|
|
11209
|
+
var import_react67 = require("react");
|
|
11198
11210
|
|
|
11199
11211
|
// src/components/NbaFormRest.tsx
|
|
11200
11212
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
@@ -11293,8 +11305,8 @@ function Row2({ game, abbr, tonight, ui }) {
|
|
|
11293
11305
|
] });
|
|
11294
11306
|
}
|
|
11295
11307
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11296
|
-
const [open, setOpen] = (0,
|
|
11297
|
-
const [side, setSide] = (0,
|
|
11308
|
+
const [open, setOpen] = (0, import_react67.useState)(false);
|
|
11309
|
+
const [side, setSide] = (0, import_react67.useState)("away");
|
|
11298
11310
|
const form = useNbaForm(match, monitor);
|
|
11299
11311
|
const b = match.basketball;
|
|
11300
11312
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11336,10 +11348,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11336
11348
|
}
|
|
11337
11349
|
|
|
11338
11350
|
// src/components/NbaPropsSection.tsx
|
|
11339
|
-
var
|
|
11351
|
+
var import_react69 = require("react");
|
|
11340
11352
|
|
|
11341
11353
|
// src/components/PropsPieces.tsx
|
|
11342
|
-
var
|
|
11354
|
+
var import_react68 = require("react");
|
|
11343
11355
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11344
11356
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11345
11357
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11352,9 +11364,9 @@ function preKickoff(match) {
|
|
|
11352
11364
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
11353
11365
|
}
|
|
11354
11366
|
function usePreKickoff(match) {
|
|
11355
|
-
const [, setTick] = (0,
|
|
11367
|
+
const [, setTick] = (0, import_react68.useState)(0);
|
|
11356
11368
|
const pre = preKickoff(match);
|
|
11357
|
-
(0,
|
|
11369
|
+
(0, import_react68.useEffect)(() => {
|
|
11358
11370
|
if (!pre || !match.kickoffUtc) return;
|
|
11359
11371
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11360
11372
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11368,7 +11380,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11368
11380
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11369
11381
|
const live = match.phase === "live";
|
|
11370
11382
|
const open = pre || live;
|
|
11371
|
-
(0,
|
|
11383
|
+
(0, import_react68.useEffect)(() => {
|
|
11372
11384
|
if (!open) return;
|
|
11373
11385
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11374
11386
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11446,7 +11458,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
11446
11458
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
11447
11459
|
const player = livePlayer(bundle, given);
|
|
11448
11460
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
11449
|
-
const [picked, setPicked] = (0,
|
|
11461
|
+
const [picked, setPicked] = (0, import_react68.useState)(null);
|
|
11450
11462
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
11451
11463
|
const sample = active?.games?.length ?? 0;
|
|
11452
11464
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -11495,8 +11507,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11495
11507
|
] });
|
|
11496
11508
|
}
|
|
11497
11509
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11498
|
-
const [openId, setOpenId] = (0,
|
|
11499
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
11510
|
+
const [openId, setOpenId] = (0, import_react68.useState)(null);
|
|
11511
|
+
const [brokenShots, setBrokenShots] = (0, import_react68.useState)(/* @__PURE__ */ new Set());
|
|
11500
11512
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11501
11513
|
const p = livePlayer(bundle, given);
|
|
11502
11514
|
const isOpen = openId === p.playerId;
|
|
@@ -11542,12 +11554,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11542
11554
|
}
|
|
11543
11555
|
var BOX_QUIET_MS = 12e4;
|
|
11544
11556
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
11545
|
-
const [tick, setTick] = (0,
|
|
11557
|
+
const [tick, setTick] = (0, import_react68.useState)(0);
|
|
11546
11558
|
const time = clock2(boxAsOfUtc, ui);
|
|
11547
11559
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11548
11560
|
const valid = !Number.isNaN(at2);
|
|
11549
11561
|
const onBreak = atBreak(match);
|
|
11550
|
-
(0,
|
|
11562
|
+
(0, import_react68.useEffect)(() => {
|
|
11551
11563
|
if (!valid || onBreak) return;
|
|
11552
11564
|
const age2 = Date.now() - at2;
|
|
11553
11565
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11608,12 +11620,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
11608
11620
|
tenGameBars: false
|
|
11609
11621
|
});
|
|
11610
11622
|
function StatsClock2({ bundle, match, ui }) {
|
|
11611
|
-
const [tick, setTick] = (0,
|
|
11623
|
+
const [tick, setTick] = (0, import_react69.useState)(0);
|
|
11612
11624
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
11613
11625
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11614
11626
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11615
11627
|
const onBreak = atBreak(match);
|
|
11616
|
-
(0,
|
|
11628
|
+
(0, import_react69.useEffect)(() => {
|
|
11617
11629
|
if (!valid || onBreak) return;
|
|
11618
11630
|
const age2 = Date.now() - at2;
|
|
11619
11631
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11627,7 +11639,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11627
11639
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
11628
11640
|
}
|
|
11629
11641
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
11630
|
-
const [side, setSide] = (0,
|
|
11642
|
+
const [side, setSide] = (0, import_react69.useState)("home");
|
|
11631
11643
|
const descriptor = nbaDescriptor(ui, match);
|
|
11632
11644
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11633
11645
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11665,7 +11677,7 @@ function city(teamName, nickname) {
|
|
|
11665
11677
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
11666
11678
|
}
|
|
11667
11679
|
function BadgeCrest({ url, abbreviation }) {
|
|
11668
|
-
const [failed, setFailed] = (0,
|
|
11680
|
+
const [failed, setFailed] = (0, import_react70.useState)(false);
|
|
11669
11681
|
if (url && !failed) {
|
|
11670
11682
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
11671
11683
|
}
|
|
@@ -11783,7 +11795,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11783
11795
|
}
|
|
11784
11796
|
|
|
11785
11797
|
// src/components/NflFormSection.tsx
|
|
11786
|
-
var
|
|
11798
|
+
var import_react71 = require("react");
|
|
11787
11799
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11788
11800
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11789
11801
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11835,7 +11847,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11835
11847
|
] });
|
|
11836
11848
|
}
|
|
11837
11849
|
function NflFormSection({ match, monitor, ui }) {
|
|
11838
|
-
const [segment, setSegment] = (0,
|
|
11850
|
+
const [segment, setSegment] = (0, import_react71.useState)("away");
|
|
11839
11851
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11840
11852
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11841
11853
|
const form = bundle?.form;
|
|
@@ -11868,7 +11880,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11868
11880
|
}
|
|
11869
11881
|
|
|
11870
11882
|
// src/components/NflPropsSection.tsx
|
|
11871
|
-
var
|
|
11883
|
+
var import_react72 = require("react");
|
|
11872
11884
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
11873
11885
|
var TRENDS_SHOWN = 3;
|
|
11874
11886
|
var SCORERS_SHOWN = 8;
|
|
@@ -11941,7 +11953,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11941
11953
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11942
11954
|
}
|
|
11943
11955
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11944
|
-
const [all, setAll] = (0,
|
|
11956
|
+
const [all, setAll] = (0, import_react72.useState)(false);
|
|
11945
11957
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11946
11958
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11947
11959
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11974,7 +11986,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11974
11986
|
] });
|
|
11975
11987
|
}
|
|
11976
11988
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11977
|
-
const [all, setAll] = (0,
|
|
11989
|
+
const [all, setAll] = (0, import_react72.useState)(false);
|
|
11978
11990
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11979
11991
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11980
11992
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11988,9 +12000,12 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11988
12000
|
const sample = s.anytimeStat.games?.length ?? 0;
|
|
11989
12001
|
const meta = sample > 0 && s.anytime.hits != null ? `${abbreviations[s.player.side]} \xB7 ${fillNfl(ui.nfl.propsScoredIn, { h: s.anytime.hits, n: sample })}` : abbreviations[s.player.side];
|
|
11990
12002
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "ss-w-props-scorer", children: [
|
|
11991
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-
|
|
11992
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
11993
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.
|
|
12003
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-scorer-who", children: [
|
|
12004
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Pic, { src: s.player.imagePath, kind: "player" }),
|
|
12005
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ss-w-props-pn", children: [
|
|
12006
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-name", children: s.player.name }),
|
|
12007
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ss-w-props-scorer-meta", children: meta })
|
|
12008
|
+
] })
|
|
11994
12009
|
] }),
|
|
11995
12010
|
cell2(s.player.name, ui.nfl.propsAnytime, s.anytime, s.anytimeStat),
|
|
11996
12011
|
cell2(s.player.name, "2+", s.two, s.anytimeStat),
|
|
@@ -12001,7 +12016,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
12001
12016
|
] });
|
|
12002
12017
|
}
|
|
12003
12018
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
12004
|
-
const [tab, setTab] = (0,
|
|
12019
|
+
const [tab, setTab] = (0, import_react72.useState)(null);
|
|
12005
12020
|
const descriptor = nflDescriptor(ui);
|
|
12006
12021
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12007
12022
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12143,13 +12158,13 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12143
12158
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(PinToggle, { ui, monitor, pin: { kind: "match", matchId: match.matchId, sport: "americanfootball" } })
|
|
12144
12159
|
] }),
|
|
12145
12160
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "ss-w-nbamon-main", children: [
|
|
12146
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.awayAbbreviation, nickname: f.awayNickname, teamName: match.awayTeamName, away: true }),
|
|
12161
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.awayAbbreviation, nickname: f.awayNickname, teamName: match.awayTeamName, crestUrl: match.awayCrestUrl, away: true }),
|
|
12147
12162
|
scored ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "ss-w-mon-score", children: [
|
|
12148
12163
|
match.awayScore ?? 0,
|
|
12149
12164
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("i", { children: "\u2013" }),
|
|
12150
12165
|
match.homeScore ?? 0
|
|
12151
12166
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "ss-w-mon-vs", children: ui.venue.away }),
|
|
12152
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.homeAbbreviation, nickname: f.homeNickname, teamName: match.homeTeamName })
|
|
12167
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Side, { abbreviation: f.homeAbbreviation, nickname: f.homeNickname, teamName: match.homeTeamName, crestUrl: match.homeCrestUrl })
|
|
12153
12168
|
] }),
|
|
12154
12169
|
scored && /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("table", { className: "ss-w-nbamon-ls", children: [
|
|
12155
12170
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { children: [
|
|
@@ -12187,14 +12202,14 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
12187
12202
|
}
|
|
12188
12203
|
|
|
12189
12204
|
// src/components/TennisMonitorCard.tsx
|
|
12190
|
-
var
|
|
12205
|
+
var import_react75 = require("react");
|
|
12191
12206
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12192
12207
|
|
|
12193
12208
|
// src/components/TennisFixtureRow.tsx
|
|
12194
12209
|
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
12195
12210
|
|
|
12196
12211
|
// src/components/FixtureRow.tsx
|
|
12197
|
-
var
|
|
12212
|
+
var import_react73 = require("react");
|
|
12198
12213
|
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
12199
12214
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
12200
12215
|
function splitAtFirstSpace(label) {
|
|
@@ -12208,7 +12223,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
12208
12223
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
12209
12224
|
}
|
|
12210
12225
|
function Side2({ name, crest, abbr, away = false }) {
|
|
12211
|
-
const [failed, setFailed] = (0,
|
|
12226
|
+
const [failed, setFailed] = (0, import_react73.useState)(false);
|
|
12212
12227
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
12213
12228
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime85.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_runtime85.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
12214
12229
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -12450,7 +12465,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12450
12465
|
}
|
|
12451
12466
|
|
|
12452
12467
|
// src/components/TennisStatsTables.tsx
|
|
12453
|
-
var
|
|
12468
|
+
var import_react74 = require("react");
|
|
12454
12469
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12455
12470
|
function formatStat(row, value, locale) {
|
|
12456
12471
|
if (value == null) return "\u2013";
|
|
@@ -12488,8 +12503,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12488
12503
|
] });
|
|
12489
12504
|
}
|
|
12490
12505
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12491
|
-
const [tab, setTab] = (0,
|
|
12492
|
-
(0,
|
|
12506
|
+
const [tab, setTab] = (0, import_react74.useState)("match");
|
|
12507
|
+
(0, import_react74.useEffect)(() => {
|
|
12493
12508
|
setTab("match");
|
|
12494
12509
|
}, [resetKey]);
|
|
12495
12510
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12520,7 +12535,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12520
12535
|
] }),
|
|
12521
12536
|
today.rows.map((r) => {
|
|
12522
12537
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12523
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
12538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_react74.Fragment, { children: [
|
|
12524
12539
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12525
12540
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12526
12541
|
f(r.p1Today),
|
|
@@ -12655,7 +12670,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12655
12670
|
] });
|
|
12656
12671
|
}
|
|
12657
12672
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12658
|
-
const lastTables = (0,
|
|
12673
|
+
const lastTables = (0, import_react75.useRef)(null);
|
|
12659
12674
|
const t = match.tennis;
|
|
12660
12675
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12661
12676
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12735,7 +12750,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12735
12750
|
}
|
|
12736
12751
|
|
|
12737
12752
|
// src/components/ScoreboardStrip.tsx
|
|
12738
|
-
var
|
|
12753
|
+
var import_react76 = require("react");
|
|
12739
12754
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12740
12755
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12741
12756
|
function nbaStatus(m, ui) {
|
|
@@ -12830,8 +12845,8 @@ function rowsFor(m) {
|
|
|
12830
12845
|
];
|
|
12831
12846
|
}
|
|
12832
12847
|
function useStripScroll(selectedKey) {
|
|
12833
|
-
const stripRef = (0,
|
|
12834
|
-
(0,
|
|
12848
|
+
const stripRef = (0, import_react76.useRef)(null);
|
|
12849
|
+
(0, import_react76.useEffect)(() => {
|
|
12835
12850
|
const strip = stripRef.current;
|
|
12836
12851
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12837
12852
|
if (!strip || !pressed) return;
|
|
@@ -13005,7 +13020,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
13005
13020
|
] });
|
|
13006
13021
|
}
|
|
13007
13022
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
13008
|
-
const seedIndex = (0,
|
|
13023
|
+
const seedIndex = (0, import_react77.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
13009
13024
|
const tiles = orderTiles(
|
|
13010
13025
|
monitor.pins,
|
|
13011
13026
|
monitor.snapshot,
|
|
@@ -13077,7 +13092,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
13077
13092
|
}
|
|
13078
13093
|
|
|
13079
13094
|
// src/components/LivePanel.tsx
|
|
13080
|
-
var
|
|
13095
|
+
var import_react80 = require("react");
|
|
13081
13096
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
13082
13097
|
|
|
13083
13098
|
// src/scheduleView.ts
|
|
@@ -13252,20 +13267,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13252
13267
|
}
|
|
13253
13268
|
|
|
13254
13269
|
// src/components/MatchSheet.tsx
|
|
13255
|
-
var
|
|
13270
|
+
var import_react79 = require("react");
|
|
13256
13271
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
13257
13272
|
|
|
13258
13273
|
// src/useModalDialog.ts
|
|
13259
|
-
var
|
|
13274
|
+
var import_react78 = require("react");
|
|
13260
13275
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13261
13276
|
function useModalDialog(onClose, opts = {}) {
|
|
13262
|
-
const dialogRef = (0,
|
|
13263
|
-
const onCloseRef = (0,
|
|
13277
|
+
const dialogRef = (0, import_react78.useRef)(null);
|
|
13278
|
+
const onCloseRef = (0, import_react78.useRef)(onClose);
|
|
13264
13279
|
onCloseRef.current = onClose;
|
|
13265
|
-
const openerRef = (0,
|
|
13280
|
+
const openerRef = (0, import_react78.useRef)(opts.opener);
|
|
13266
13281
|
openerRef.current = opts.opener;
|
|
13267
13282
|
const restore = opts.restoreFocus ?? true;
|
|
13268
|
-
(0,
|
|
13283
|
+
(0, import_react78.useEffect)(() => {
|
|
13269
13284
|
const dialog = dialogRef.current;
|
|
13270
13285
|
const root = dialog?.getRootNode();
|
|
13271
13286
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13276,7 +13291,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13276
13291
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13277
13292
|
};
|
|
13278
13293
|
}, []);
|
|
13279
|
-
(0,
|
|
13294
|
+
(0, import_react78.useEffect)(() => {
|
|
13280
13295
|
const onKey = (e) => {
|
|
13281
13296
|
if (e.key !== "Escape") return;
|
|
13282
13297
|
e.stopPropagation();
|
|
@@ -13317,8 +13332,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13317
13332
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13318
13333
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13319
13334
|
const log = useEventLog();
|
|
13320
|
-
const titleId = (0,
|
|
13321
|
-
const [limitHit, setLimitHit] = (0,
|
|
13335
|
+
const titleId = (0, import_react79.useId)();
|
|
13336
|
+
const [limitHit, setLimitHit] = (0, import_react79.useState)(false);
|
|
13322
13337
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13323
13338
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13324
13339
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13419,10 +13434,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13419
13434
|
var QUIET_ROWS = 4;
|
|
13420
13435
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13421
13436
|
const { groups, states, stale } = discovery;
|
|
13422
|
-
const [mine, setMine] = (0,
|
|
13423
|
-
const [toggled, setToggled] = (0,
|
|
13424
|
-
const [sheet, setSheet] = (0,
|
|
13425
|
-
const pinnedKeys = (0,
|
|
13437
|
+
const [mine, setMine] = (0, import_react80.useState)(false);
|
|
13438
|
+
const [toggled, setToggled] = (0, import_react80.useState)(/* @__PURE__ */ new Map());
|
|
13439
|
+
const [sheet, setSheet] = (0, import_react80.useState)(null);
|
|
13440
|
+
const pinnedKeys = (0, import_react80.useMemo)(
|
|
13426
13441
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13427
13442
|
[monitor.pins]
|
|
13428
13443
|
);
|
|
@@ -13528,20 +13543,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13528
13543
|
}
|
|
13529
13544
|
|
|
13530
13545
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13531
|
-
var
|
|
13546
|
+
var import_react84 = require("react");
|
|
13532
13547
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13533
13548
|
|
|
13534
13549
|
// src/useTennisRowPrices.ts
|
|
13535
|
-
var
|
|
13550
|
+
var import_react81 = require("react");
|
|
13536
13551
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13537
13552
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13538
13553
|
function useTennisRowPrices(a) {
|
|
13539
|
-
const [state, setState] = (0,
|
|
13540
|
-
const getPricesRef = (0,
|
|
13554
|
+
const [state, setState] = (0, import_react81.useState)({ byId: null, stale: false });
|
|
13555
|
+
const getPricesRef = (0, import_react81.useRef)(a.getPrices);
|
|
13541
13556
|
getPricesRef.current = a.getPrices;
|
|
13542
|
-
const latest = (0,
|
|
13557
|
+
const latest = (0, import_react81.useRef)(0);
|
|
13543
13558
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13544
|
-
(0,
|
|
13559
|
+
(0, import_react81.useEffect)(() => {
|
|
13545
13560
|
if (!a.enabled || idsKey === "") {
|
|
13546
13561
|
latest.current++;
|
|
13547
13562
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13579,11 +13594,11 @@ function useTennisRowPrices(a) {
|
|
|
13579
13594
|
}
|
|
13580
13595
|
|
|
13581
13596
|
// src/components/DayStrip.tsx
|
|
13582
|
-
var
|
|
13597
|
+
var import_react82 = require("react");
|
|
13583
13598
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13584
13599
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13585
|
-
const listRef = (0,
|
|
13586
|
-
(0,
|
|
13600
|
+
const listRef = (0, import_react82.useRef)(null);
|
|
13601
|
+
(0, import_react82.useEffect)(() => {
|
|
13587
13602
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13588
13603
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13589
13604
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13612,7 +13627,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13612
13627
|
}
|
|
13613
13628
|
|
|
13614
13629
|
// src/components/games/ui/SearchField.tsx
|
|
13615
|
-
var
|
|
13630
|
+
var import_react83 = require("react");
|
|
13616
13631
|
|
|
13617
13632
|
// src/components/games/ui/icons.tsx
|
|
13618
13633
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
@@ -13651,8 +13666,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13651
13666
|
// src/components/games/ui/SearchField.tsx
|
|
13652
13667
|
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
13653
13668
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13654
|
-
const localRef = (0,
|
|
13655
|
-
const setInputRef = (0,
|
|
13669
|
+
const localRef = (0, import_react83.useRef)(null);
|
|
13670
|
+
const setInputRef = (0, import_react83.useCallback)((node) => {
|
|
13656
13671
|
localRef.current = node;
|
|
13657
13672
|
if (typeof inputRef === "function") inputRef(node);
|
|
13658
13673
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13698,18 +13713,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13698
13713
|
var SKELETON_ROWS = 3;
|
|
13699
13714
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13700
13715
|
const { localDate: today, states, stale } = discovery;
|
|
13701
|
-
const searchId = (0,
|
|
13702
|
-
const [query, setQuery] = (0,
|
|
13703
|
-
const [toggled, setToggled] = (0,
|
|
13704
|
-
const [expanded, setExpanded] = (0,
|
|
13705
|
-
const listRef = (0,
|
|
13706
|
-
const [sheet, setSheet] = (0,
|
|
13716
|
+
const searchId = (0, import_react84.useId)();
|
|
13717
|
+
const [query, setQuery] = (0, import_react84.useState)("");
|
|
13718
|
+
const [toggled, setToggled] = (0, import_react84.useState)(/* @__PURE__ */ new Map());
|
|
13719
|
+
const [expanded, setExpanded] = (0, import_react84.useState)(/* @__PURE__ */ new Set());
|
|
13720
|
+
const listRef = (0, import_react84.useRef)(null);
|
|
13721
|
+
const [sheet, setSheet] = (0, import_react84.useState)(null);
|
|
13707
13722
|
const { chips, selected } = loaded;
|
|
13708
|
-
(0,
|
|
13723
|
+
(0, import_react84.useEffect)(() => {
|
|
13709
13724
|
if (selected !== day) onDay(selected);
|
|
13710
13725
|
}, [day, selected, onDay]);
|
|
13711
13726
|
const isToday = selected === today;
|
|
13712
|
-
const pinnedKeys = (0,
|
|
13727
|
+
const pinnedKeys = (0, import_react84.useMemo)(
|
|
13713
13728
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13714
13729
|
[monitor.pins]
|
|
13715
13730
|
);
|
|
@@ -13847,7 +13862,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13847
13862
|
}
|
|
13848
13863
|
|
|
13849
13864
|
// src/components/GamesPanel.tsx
|
|
13850
|
-
var
|
|
13865
|
+
var import_react99 = require("react");
|
|
13851
13866
|
|
|
13852
13867
|
// src/components/GamesLoginWall.tsx
|
|
13853
13868
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
@@ -13856,7 +13871,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13856
13871
|
}
|
|
13857
13872
|
|
|
13858
13873
|
// src/components/GamesHub.tsx
|
|
13859
|
-
var
|
|
13874
|
+
var import_react85 = require("react");
|
|
13860
13875
|
|
|
13861
13876
|
// src/components/games/ui/gameMeta.ts
|
|
13862
13877
|
function prettifyGameId(gameId) {
|
|
@@ -14007,8 +14022,8 @@ function pickHeroGame(games) {
|
|
|
14007
14022
|
}
|
|
14008
14023
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14009
14024
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14010
|
-
const [, setTick] = (0,
|
|
14011
|
-
(0,
|
|
14025
|
+
const [, setTick] = (0, import_react85.useState)(0);
|
|
14026
|
+
(0, import_react85.useEffect)(() => {
|
|
14012
14027
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14013
14028
|
return () => clearInterval(id);
|
|
14014
14029
|
}, []);
|
|
@@ -14068,10 +14083,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14068
14083
|
}
|
|
14069
14084
|
|
|
14070
14085
|
// src/components/GameScreenHost.tsx
|
|
14071
|
-
var
|
|
14086
|
+
var import_react97 = require("react");
|
|
14072
14087
|
|
|
14073
14088
|
// src/useGamePlay.ts
|
|
14074
|
-
var
|
|
14089
|
+
var import_react86 = require("react");
|
|
14075
14090
|
function toSubmitResult(payload) {
|
|
14076
14091
|
return {
|
|
14077
14092
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14083,17 +14098,17 @@ function toSubmitResult(payload) {
|
|
|
14083
14098
|
};
|
|
14084
14099
|
}
|
|
14085
14100
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
14086
|
-
const [result, setResult] = (0,
|
|
14087
|
-
const [submitting, setSubmitting] = (0,
|
|
14088
|
-
const [rawStatus, setRawStatus] = (0,
|
|
14089
|
-
const inFlightRef = (0,
|
|
14090
|
-
const convRef = (0,
|
|
14101
|
+
const [result, setResult] = (0, import_react86.useState)(null);
|
|
14102
|
+
const [submitting, setSubmitting] = (0, import_react86.useState)(false);
|
|
14103
|
+
const [rawStatus, setRawStatus] = (0, import_react86.useState)(null);
|
|
14104
|
+
const inFlightRef = (0, import_react86.useRef)(false);
|
|
14105
|
+
const convRef = (0, import_react86.useRef)(conversation);
|
|
14091
14106
|
convRef.current = conversation;
|
|
14092
|
-
const optsRef = (0,
|
|
14107
|
+
const optsRef = (0, import_react86.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14093
14108
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14094
|
-
const resultRef = (0,
|
|
14109
|
+
const resultRef = (0, import_react86.useRef)(null);
|
|
14095
14110
|
resultRef.current = result;
|
|
14096
|
-
const refetch = (0,
|
|
14111
|
+
const refetch = (0, import_react86.useCallback)(async () => {
|
|
14097
14112
|
const conv = convRef.current;
|
|
14098
14113
|
if (!conv) return;
|
|
14099
14114
|
const opts = optsRef.current;
|
|
@@ -14109,7 +14124,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14109
14124
|
} catch {
|
|
14110
14125
|
}
|
|
14111
14126
|
}, []);
|
|
14112
|
-
const submit = (0,
|
|
14127
|
+
const submit = (0, import_react86.useCallback)(async (answerJson) => {
|
|
14113
14128
|
const conv = convRef.current;
|
|
14114
14129
|
if (!conv || inFlightRef.current) return;
|
|
14115
14130
|
inFlightRef.current = true;
|
|
@@ -14136,14 +14151,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14136
14151
|
setSubmitting(false);
|
|
14137
14152
|
}
|
|
14138
14153
|
}, [refetch]);
|
|
14139
|
-
const hydrate = (0,
|
|
14154
|
+
const hydrate = (0, import_react86.useCallback)(() => {
|
|
14140
14155
|
void refetch();
|
|
14141
14156
|
}, [refetch]);
|
|
14142
14157
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14143
14158
|
}
|
|
14144
14159
|
|
|
14145
14160
|
// src/components/games/MysteryTigerGame.tsx
|
|
14146
|
-
var
|
|
14161
|
+
var import_react88 = require("react");
|
|
14147
14162
|
|
|
14148
14163
|
// src/components/games/nationFlags.ts
|
|
14149
14164
|
var FLAGS = {
|
|
@@ -14354,7 +14369,7 @@ function isNationCode(flag) {
|
|
|
14354
14369
|
}
|
|
14355
14370
|
|
|
14356
14371
|
// src/components/games/PlayerAvatar.tsx
|
|
14357
|
-
var
|
|
14372
|
+
var import_react87 = require("react");
|
|
14358
14373
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
14359
14374
|
function initialsOf(name) {
|
|
14360
14375
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14372,7 +14387,7 @@ function PlayerAvatar({
|
|
|
14372
14387
|
imagePath,
|
|
14373
14388
|
className
|
|
14374
14389
|
}) {
|
|
14375
|
-
const [failed, setFailed] = (0,
|
|
14390
|
+
const [failed, setFailed] = (0, import_react87.useState)(false);
|
|
14376
14391
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14377
14392
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14378
14393
|
}
|
|
@@ -14616,8 +14631,8 @@ function MysteryTigerGame({
|
|
|
14616
14631
|
onBack
|
|
14617
14632
|
}) {
|
|
14618
14633
|
const t = ui.games.mysteryTiger;
|
|
14619
|
-
const [query, setQuery] = (0,
|
|
14620
|
-
const inputId = (0,
|
|
14634
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
14635
|
+
const inputId = (0, import_react88.useId)();
|
|
14621
14636
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14622
14637
|
const guessResults = clientState?.guessResults ?? [];
|
|
14623
14638
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14878,13 +14893,13 @@ function HigherOrLowerGame({
|
|
|
14878
14893
|
}
|
|
14879
14894
|
|
|
14880
14895
|
// src/components/games/CareerPathGame.tsx
|
|
14881
|
-
var
|
|
14896
|
+
var import_react90 = require("react");
|
|
14882
14897
|
|
|
14883
14898
|
// src/components/games/ui/CrestShield.tsx
|
|
14884
|
-
var
|
|
14899
|
+
var import_react89 = require("react");
|
|
14885
14900
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
14886
14901
|
function CrestShield({ src, name, size = 28 }) {
|
|
14887
|
-
const [failed, setFailed] = (0,
|
|
14902
|
+
const [failed, setFailed] = (0, import_react89.useState)(false);
|
|
14888
14903
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14889
14904
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14890
14905
|
}
|
|
@@ -14916,8 +14931,8 @@ function CareerPathGame({
|
|
|
14916
14931
|
}) {
|
|
14917
14932
|
const s = ui.games.careerPath;
|
|
14918
14933
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14919
|
-
const [query, setQuery] = (0,
|
|
14920
|
-
const inputId = (0,
|
|
14934
|
+
const [query, setQuery] = (0, import_react90.useState)("");
|
|
14935
|
+
const inputId = (0, import_react90.useId)();
|
|
14921
14936
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14922
14937
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14923
14938
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -15023,7 +15038,7 @@ function CareerPathGame({
|
|
|
15023
15038
|
}
|
|
15024
15039
|
|
|
15025
15040
|
// src/components/games/BeatTheGridGame.tsx
|
|
15026
|
-
var
|
|
15041
|
+
var import_react91 = __toESM(require("react"), 1);
|
|
15027
15042
|
|
|
15028
15043
|
// src/components/games/ui/OptionList.tsx
|
|
15029
15044
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
@@ -15112,10 +15127,10 @@ function SearchSheet({
|
|
|
15112
15127
|
ui
|
|
15113
15128
|
}) {
|
|
15114
15129
|
const s = ui.games.beatTheGrid;
|
|
15115
|
-
const [query, setQuery] = (0,
|
|
15116
|
-
const inputId = (0,
|
|
15117
|
-
const inputRef = (0,
|
|
15118
|
-
(0,
|
|
15130
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15131
|
+
const inputId = (0, import_react91.useId)();
|
|
15132
|
+
const inputRef = (0, import_react91.useRef)(null);
|
|
15133
|
+
(0, import_react91.useEffect)(() => {
|
|
15119
15134
|
inputRef.current?.focus();
|
|
15120
15135
|
}, [row, col]);
|
|
15121
15136
|
const filtered = playerPool.filter(
|
|
@@ -15180,7 +15195,7 @@ function BeatTheGridGame({
|
|
|
15180
15195
|
}) {
|
|
15181
15196
|
const s = ui.games.beatTheGrid;
|
|
15182
15197
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15183
|
-
const [activeCell, setActiveCell] = (0,
|
|
15198
|
+
const [activeCell, setActiveCell] = (0, import_react91.useState)(null);
|
|
15184
15199
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15185
15200
|
const filledCells = clientState?.cells ?? [];
|
|
15186
15201
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15254,7 +15269,7 @@ function BeatTheGridGame({
|
|
|
15254
15269
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15255
15270
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15256
15271
|
] });
|
|
15257
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
|
|
15272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_react91.default.Fragment, { children: [
|
|
15258
15273
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15259
15274
|
cols.map((colLabel, colIdx) => {
|
|
15260
15275
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15335,7 +15350,7 @@ function BeatTheGridGame({
|
|
|
15335
15350
|
}
|
|
15336
15351
|
|
|
15337
15352
|
// src/components/games/GuessTheXiGame.tsx
|
|
15338
|
-
var
|
|
15353
|
+
var import_react92 = require("react");
|
|
15339
15354
|
|
|
15340
15355
|
// src/components/games/ui/PitchSvg.tsx
|
|
15341
15356
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
@@ -15424,8 +15439,8 @@ function GuessTheXiGame({
|
|
|
15424
15439
|
onBack
|
|
15425
15440
|
}) {
|
|
15426
15441
|
const t = ui.games.guessTheXi;
|
|
15427
|
-
const [query, setQuery] = (0,
|
|
15428
|
-
const inputId = (0,
|
|
15442
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
15443
|
+
const inputId = (0, import_react92.useId)();
|
|
15429
15444
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15430
15445
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15431
15446
|
const solved = clientState?.status === "solved";
|
|
@@ -15567,7 +15582,7 @@ function GuessTheXiGame({
|
|
|
15567
15582
|
}
|
|
15568
15583
|
|
|
15569
15584
|
// src/components/games/DailyQuizGame.tsx
|
|
15570
|
-
var
|
|
15585
|
+
var import_react93 = require("react");
|
|
15571
15586
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15572
15587
|
function parseClientState6(json) {
|
|
15573
15588
|
if (!json) return null;
|
|
@@ -15608,8 +15623,8 @@ function DailyQuizGame({
|
|
|
15608
15623
|
}) {
|
|
15609
15624
|
const s = ui.games.dailyQuiz;
|
|
15610
15625
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15611
|
-
const [selections, setSelections] = (0,
|
|
15612
|
-
const [page, setPage] = (0,
|
|
15626
|
+
const [selections, setSelections] = (0, import_react93.useState)(/* @__PURE__ */ new Map());
|
|
15627
|
+
const [page, setPage] = (0, import_react93.useState)(0);
|
|
15613
15628
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15614
15629
|
const results2 = clientState?.results ?? [];
|
|
15615
15630
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15719,7 +15734,7 @@ function DailyQuizGame({
|
|
|
15719
15734
|
}
|
|
15720
15735
|
|
|
15721
15736
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15722
|
-
var
|
|
15737
|
+
var import_react94 = require("react");
|
|
15723
15738
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15724
15739
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15725
15740
|
function parseClientState7(json) {
|
|
@@ -15815,12 +15830,12 @@ function MatchdayPredictorGame({
|
|
|
15815
15830
|
onBack
|
|
15816
15831
|
}) {
|
|
15817
15832
|
const t = ui.games.predictor;
|
|
15818
|
-
const [homeScore, setHomeScore] = (0,
|
|
15819
|
-
const [awayScore, setAwayScore] = (0,
|
|
15820
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15821
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15822
|
-
const [query, setQuery] = (0,
|
|
15823
|
-
const searchId = (0,
|
|
15833
|
+
const [homeScore, setHomeScore] = (0, import_react94.useState)(0);
|
|
15834
|
+
const [awayScore, setAwayScore] = (0, import_react94.useState)(0);
|
|
15835
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react94.useState)(null);
|
|
15836
|
+
const [lastEdited, setLastEdited] = (0, import_react94.useState)("home");
|
|
15837
|
+
const [query, setQuery] = (0, import_react94.useState)("");
|
|
15838
|
+
const searchId = (0, import_react94.useId)();
|
|
15824
15839
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15825
15840
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15826
15841
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -15987,7 +16002,7 @@ function MatchdayPredictorGame({
|
|
|
15987
16002
|
}
|
|
15988
16003
|
|
|
15989
16004
|
// src/components/games/StartingXiGame.tsx
|
|
15990
|
-
var
|
|
16005
|
+
var import_react95 = require("react");
|
|
15991
16006
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15992
16007
|
var POINTS_PER_STARTER = 8;
|
|
15993
16008
|
var XI_SIZE = 11;
|
|
@@ -16031,10 +16046,10 @@ function StartingXiGame({
|
|
|
16031
16046
|
lockAtUtc
|
|
16032
16047
|
}) {
|
|
16033
16048
|
const t = ui.games.startingXi;
|
|
16034
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
16035
|
-
const [active, setActive] = (0,
|
|
16036
|
-
const [query, setQuery] = (0,
|
|
16037
|
-
const searchId = (0,
|
|
16049
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react95.useState)(() => Array(XI_SIZE).fill(null));
|
|
16050
|
+
const [active, setActive] = (0, import_react95.useState)(0);
|
|
16051
|
+
const [query, setQuery] = (0, import_react95.useState)("");
|
|
16052
|
+
const searchId = (0, import_react95.useId)();
|
|
16038
16053
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
16039
16054
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16040
16055
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
@@ -16173,7 +16188,7 @@ function StartingXiGame({
|
|
|
16173
16188
|
}
|
|
16174
16189
|
|
|
16175
16190
|
// src/components/games/StatLadderGame.tsx
|
|
16176
|
-
var
|
|
16191
|
+
var import_react96 = require("react");
|
|
16177
16192
|
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
16178
16193
|
function ladderClue(ladder) {
|
|
16179
16194
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16210,9 +16225,9 @@ function StatLadderGame({
|
|
|
16210
16225
|
onBack
|
|
16211
16226
|
}) {
|
|
16212
16227
|
const t = ui.games.statLadder;
|
|
16213
|
-
const [query, setQuery] = (0,
|
|
16214
|
-
const [selectedId, setSelectedId] = (0,
|
|
16215
|
-
const searchId = (0,
|
|
16228
|
+
const [query, setQuery] = (0, import_react96.useState)("");
|
|
16229
|
+
const [selectedId, setSelectedId] = (0, import_react96.useState)(null);
|
|
16230
|
+
const searchId = (0, import_react96.useId)();
|
|
16216
16231
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16217
16232
|
const revealed = clientState != null;
|
|
16218
16233
|
const header = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16418,8 +16433,8 @@ function GameScreenHost({
|
|
|
16418
16433
|
ui
|
|
16419
16434
|
}) {
|
|
16420
16435
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16421
|
-
const [configJson, setConfigJson] = (0,
|
|
16422
|
-
(0,
|
|
16436
|
+
const [configJson, setConfigJson] = (0, import_react97.useState)(null);
|
|
16437
|
+
(0, import_react97.useEffect)(() => {
|
|
16423
16438
|
setConfigJson(null);
|
|
16424
16439
|
if (!conversation) return;
|
|
16425
16440
|
let cancelled = false;
|
|
@@ -16442,12 +16457,12 @@ function GameScreenHost({
|
|
|
16442
16457
|
fixtureId: fixtureId || void 0,
|
|
16443
16458
|
locale: ui.hostTag
|
|
16444
16459
|
});
|
|
16445
|
-
(0,
|
|
16460
|
+
(0, import_react97.useEffect)(() => {
|
|
16446
16461
|
if (conversation) hydrate();
|
|
16447
16462
|
}, [conversation, gameId]);
|
|
16448
|
-
const hydrateRef = (0,
|
|
16463
|
+
const hydrateRef = (0, import_react97.useRef)(hydrate);
|
|
16449
16464
|
hydrateRef.current = hydrate;
|
|
16450
|
-
(0,
|
|
16465
|
+
(0, import_react97.useEffect)(() => {
|
|
16451
16466
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16452
16467
|
if (rawStatus !== "pending") return;
|
|
16453
16468
|
const timerId = setInterval(() => {
|
|
@@ -16560,7 +16575,7 @@ function GameScreenHost({
|
|
|
16560
16575
|
}
|
|
16561
16576
|
|
|
16562
16577
|
// src/components/Leaderboard.tsx
|
|
16563
|
-
var
|
|
16578
|
+
var import_react98 = require("react");
|
|
16564
16579
|
|
|
16565
16580
|
// src/components/LeaderboardRow.tsx
|
|
16566
16581
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16647,7 +16662,7 @@ function Leaderboard({
|
|
|
16647
16662
|
ui,
|
|
16648
16663
|
onPlay
|
|
16649
16664
|
}) {
|
|
16650
|
-
const [segment, setSegment] = (0,
|
|
16665
|
+
const [segment, setSegment] = (0, import_react98.useState)("weekly");
|
|
16651
16666
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16652
16667
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16653
16668
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16752,9 +16767,9 @@ function GamesPanel({
|
|
|
16752
16767
|
leaderboardLoading,
|
|
16753
16768
|
refreshHub
|
|
16754
16769
|
}) {
|
|
16755
|
-
const [selected, setSelected] = (0,
|
|
16756
|
-
const [segment, setSegment] = (0,
|
|
16757
|
-
(0,
|
|
16770
|
+
const [selected, setSelected] = (0, import_react99.useState)(null);
|
|
16771
|
+
const [segment, setSegment] = (0, import_react99.useState)("play");
|
|
16772
|
+
(0, import_react99.useEffect)(() => {
|
|
16758
16773
|
ensureGamesFonts();
|
|
16759
16774
|
}, []);
|
|
16760
16775
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(GamesLoginWall, { ui });
|
|
@@ -16818,10 +16833,10 @@ function GamesPanel({
|
|
|
16818
16833
|
}
|
|
16819
16834
|
|
|
16820
16835
|
// src/components/FavouritesPanel.tsx
|
|
16821
|
-
var
|
|
16836
|
+
var import_react102 = require("react");
|
|
16822
16837
|
|
|
16823
16838
|
// src/components/FavouriteChips.tsx
|
|
16824
|
-
var
|
|
16839
|
+
var import_react100 = require("react");
|
|
16825
16840
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16826
16841
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16827
16842
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16868,12 +16883,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16868
16883
|
] });
|
|
16869
16884
|
}
|
|
16870
16885
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16871
|
-
const [confirming, setConfirming] = (0,
|
|
16886
|
+
const [confirming, setConfirming] = (0, import_react100.useState)(false);
|
|
16872
16887
|
const data = controller.data;
|
|
16873
|
-
(0,
|
|
16888
|
+
(0, import_react100.useEffect)(() => {
|
|
16874
16889
|
setConfirming(false);
|
|
16875
16890
|
}, [sport]);
|
|
16876
|
-
(0,
|
|
16891
|
+
(0, import_react100.useEffect)(() => {
|
|
16877
16892
|
if (!confirming) return;
|
|
16878
16893
|
const onPointerDown = (e) => {
|
|
16879
16894
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16927,21 +16942,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16927
16942
|
}
|
|
16928
16943
|
|
|
16929
16944
|
// src/components/FavouritesSearch.tsx
|
|
16930
|
-
var
|
|
16945
|
+
var import_react101 = require("react");
|
|
16931
16946
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16932
16947
|
var MIN_LETTERS = 2;
|
|
16933
16948
|
var MAX_LENGTH = 64;
|
|
16934
16949
|
var DEBOUNCE_MS = 250;
|
|
16935
16950
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16936
|
-
const [query, setQuery] = (0,
|
|
16937
|
-
const [answer, setAnswer] = (0,
|
|
16938
|
-
const controllerRef = (0,
|
|
16951
|
+
const [query, setQuery] = (0, import_react101.useState)("");
|
|
16952
|
+
const [answer, setAnswer] = (0, import_react101.useState)(null);
|
|
16953
|
+
const controllerRef = (0, import_react101.useRef)(controller);
|
|
16939
16954
|
controllerRef.current = controller;
|
|
16940
16955
|
const trimmed = query.trim();
|
|
16941
16956
|
const queryKey = `${sport}|${trimmed}`;
|
|
16942
16957
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16943
16958
|
const settled = answer?.key === queryKey;
|
|
16944
|
-
(0,
|
|
16959
|
+
(0, import_react101.useEffect)(() => {
|
|
16945
16960
|
setAnswer(null);
|
|
16946
16961
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16947
16962
|
let cancelled = false;
|
|
@@ -17004,13 +17019,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17004
17019
|
// src/components/FavouritesPanel.tsx
|
|
17005
17020
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
17006
17021
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17007
|
-
const [notice, setNotice] = (0,
|
|
17008
|
-
const refreshRef = (0,
|
|
17022
|
+
const [notice, setNotice] = (0, import_react102.useState)(null);
|
|
17023
|
+
const refreshRef = (0, import_react102.useRef)(controller.refresh);
|
|
17009
17024
|
refreshRef.current = controller.refresh;
|
|
17010
|
-
(0,
|
|
17025
|
+
(0, import_react102.useEffect)(() => {
|
|
17011
17026
|
void refreshRef.current();
|
|
17012
17027
|
}, []);
|
|
17013
|
-
(0,
|
|
17028
|
+
(0, import_react102.useEffect)(() => {
|
|
17014
17029
|
setNotice(null);
|
|
17015
17030
|
}, [sport]);
|
|
17016
17031
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17036,11 +17051,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
17036
17051
|
}
|
|
17037
17052
|
|
|
17038
17053
|
// src/components/PresetTools.tsx
|
|
17039
|
-
var
|
|
17054
|
+
var import_react103 = require("react");
|
|
17040
17055
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
17041
17056
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17042
17057
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17043
|
-
const titleId = (0,
|
|
17058
|
+
const titleId = (0, import_react103.useId)();
|
|
17044
17059
|
return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17045
17060
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17046
17061
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17090,9 +17105,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17090
17105
|
const totalOptions = comboTotals(grid);
|
|
17091
17106
|
const totals = totalOptions.map((o) => o.value);
|
|
17092
17107
|
const legChoices = comboLegChoices(grid);
|
|
17093
|
-
const [total, setTotal] = (0,
|
|
17094
|
-
const [legs, setLegs] = (0,
|
|
17095
|
-
const [announcement, setAnnouncement] = (0,
|
|
17108
|
+
const [total, setTotal] = (0, import_react103.useState)(() => nearest(totals, initialTotal));
|
|
17109
|
+
const [legs, setLegs] = (0, import_react103.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17110
|
+
const [announcement, setAnnouncement] = (0, import_react103.useState)("");
|
|
17096
17111
|
const cell2 = findCombo(grid, total, legs);
|
|
17097
17112
|
const minLegs = legChoices[0] ?? legs;
|
|
17098
17113
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17131,7 +17146,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17131
17146
|
}
|
|
17132
17147
|
|
|
17133
17148
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17134
|
-
var
|
|
17149
|
+
var import_react104 = require("react");
|
|
17135
17150
|
var import_jsx_runtime141 = require("react/jsx-runtime");
|
|
17136
17151
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
17137
17152
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -17157,8 +17172,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17157
17172
|
const opening = openingGames(preset);
|
|
17158
17173
|
const gamesOptions = opening.options;
|
|
17159
17174
|
const marketOptions = usableMarkets(preset);
|
|
17160
|
-
const [fingerprint] = (0,
|
|
17161
|
-
const [saved] = (0,
|
|
17175
|
+
const [fingerprint] = (0, import_react104.useState)(() => JSON.stringify(preset));
|
|
17176
|
+
const [saved] = (0, import_react104.useState)(() => {
|
|
17162
17177
|
const kept = memory3?.savedView(sport);
|
|
17163
17178
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
17164
17179
|
});
|
|
@@ -17172,9 +17187,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17172
17187
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
17173
17188
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17174
17189
|
};
|
|
17175
|
-
const [view, setView] = (0,
|
|
17176
|
-
const autoWidened = (0,
|
|
17177
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
17190
|
+
const [view, setView] = (0, import_react104.useState)(() => saved?.view ?? openingView);
|
|
17191
|
+
const autoWidened = (0, import_react104.useRef)(false);
|
|
17192
|
+
const [widenedNote, setWidenedNote] = (0, import_react104.useState)(saved?.widenedNote ?? false);
|
|
17178
17193
|
const requestFor = (v) => ({
|
|
17179
17194
|
sport,
|
|
17180
17195
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -17186,10 +17201,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17186
17201
|
...operatorUserId ? { operatorUserId } : {},
|
|
17187
17202
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17188
17203
|
});
|
|
17189
|
-
const [first] = (0,
|
|
17204
|
+
const [first] = (0, import_react104.useState)(() => requestFor(view));
|
|
17190
17205
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
17191
|
-
const lastRequest = (0,
|
|
17192
|
-
(0,
|
|
17206
|
+
const lastRequest = (0, import_react104.useRef)(first);
|
|
17207
|
+
(0, import_react104.useEffect)(() => {
|
|
17193
17208
|
void request(lastRequest.current);
|
|
17194
17209
|
}, [request]);
|
|
17195
17210
|
const send = (req) => {
|
|
@@ -17213,7 +17228,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17213
17228
|
ask(next);
|
|
17214
17229
|
};
|
|
17215
17230
|
const canNarrow = preset.matchIds.length > 0;
|
|
17216
|
-
const suggested = grid?.status === "miss" ? grid.legCountThatLands : null;
|
|
17231
|
+
const suggested = grid?.status === "miss" || grid?.nearest === true ? grid.legCountThatLands : null;
|
|
17217
17232
|
const legButtons = Array.from(/* @__PURE__ */ new Set([
|
|
17218
17233
|
...BASE_LEGS,
|
|
17219
17234
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
@@ -17222,14 +17237,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17222
17237
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
17223
17238
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17224
17239
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17225
|
-
const [startedNote, setStartedNote] = (0,
|
|
17240
|
+
const [startedNote, setStartedNote] = (0, import_react104.useState)(false);
|
|
17226
17241
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17227
|
-
(0,
|
|
17242
|
+
(0, import_react104.useEffect)(() => {
|
|
17228
17243
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
17229
17244
|
}, [startedNote, status2, anyStarted]);
|
|
17230
17245
|
const market = rows?.[0]?.market;
|
|
17231
|
-
const [seen2, setSeen] = (0,
|
|
17232
|
-
(0,
|
|
17246
|
+
const [seen2, setSeen] = (0, import_react104.useState)(null);
|
|
17247
|
+
(0, import_react104.useEffect)(() => {
|
|
17233
17248
|
if (market) setSeen(market);
|
|
17234
17249
|
}, [market]);
|
|
17235
17250
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -17242,14 +17257,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17242
17257
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
17243
17258
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
17244
17259
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
17245
|
-
(0,
|
|
17260
|
+
(0, import_react104.useEffect)(() => {
|
|
17246
17261
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
17247
17262
|
autoWidened.current = true;
|
|
17248
17263
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
17249
17264
|
commit(next, true);
|
|
17250
17265
|
send(requestFor(next));
|
|
17251
17266
|
}, [empty2, singles, widened, canWiden, view]);
|
|
17252
|
-
(0,
|
|
17267
|
+
(0, import_react104.useEffect)(() => {
|
|
17253
17268
|
if (coolOff) onCoolOff?.(sport);
|
|
17254
17269
|
}, [coolOff, onCoolOff, sport]);
|
|
17255
17270
|
if (coolOff) return null;
|
|
@@ -17354,7 +17369,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
17354
17369
|
] }) : null,
|
|
17355
17370
|
rows && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
|
|
17356
17371
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)("div", { className: "ss-w-v8-builder-rows", children: [
|
|
17372
|
+
grid?.nearest === true ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "nearest", children: ui.v8Nearest }) : null,
|
|
17357
17373
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)("ol", { className: "ss-w-combo-legs", role: "list", children: rows.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ComboLegRow, { leg, addToSlipEnabled: !!slip.onAddToSlip, ui, slip: rowSlip, hold: !confirmed, closed: !preMatchOpen(leg.kickoffUtc, Date.now()) }, leg.key)) }),
|
|
17374
|
+
grid && grid.requestedLegs > 1 && grid.total !== null && grid.totalFormats !== null && grid.multiplication !== null ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)("div", { className: "ss-w-combo-math", children: oddsFormat === "decimal" ? grid.multiplication : formatOdds(grid.totalFormats, oddsFormat) }) : null,
|
|
17358
17375
|
grid && grid.requestedLegs > 1 ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(AddAllToSlipButton, { legs: rows, slip: rowSlip, ui, labels: { add: ui.v8AddAll, done: ui.allInSlip }, combo, sizeless: true, hold: !confirmed, onStartedGame: () => {
|
|
17359
17376
|
setStartedNote(true);
|
|
17360
17377
|
void request(lastRequest.current);
|
|
@@ -17652,10 +17669,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17652
17669
|
}
|
|
17653
17670
|
|
|
17654
17671
|
// src/components/PlayerPhoto.tsx
|
|
17655
|
-
var
|
|
17672
|
+
var import_react105 = require("react");
|
|
17656
17673
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17657
17674
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17658
|
-
const [failed, setFailed] = (0,
|
|
17675
|
+
const [failed, setFailed] = (0, import_react105.useState)(false);
|
|
17659
17676
|
const box = { width: size, height: size };
|
|
17660
17677
|
if (photoUrl && !failed) {
|
|
17661
17678
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17690,7 +17707,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17690
17707
|
}
|
|
17691
17708
|
|
|
17692
17709
|
// src/components/PerformanceBars.tsx
|
|
17693
|
-
var
|
|
17710
|
+
var import_react106 = require("react");
|
|
17694
17711
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
17695
17712
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17696
17713
|
function finite4(v) {
|
|
@@ -17736,7 +17753,7 @@ function unrankedLine(ui, reason) {
|
|
|
17736
17753
|
}
|
|
17737
17754
|
}
|
|
17738
17755
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17739
|
-
const [mode, setMode] = (0,
|
|
17756
|
+
const [mode, setMode] = (0, import_react106.useState)("total");
|
|
17740
17757
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17741
17758
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17742
17759
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17945,8 +17962,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17945
17962
|
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
17946
17963
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17947
17964
|
function useIsModal() {
|
|
17948
|
-
const [modal, setModal] = (0,
|
|
17949
|
-
(0,
|
|
17965
|
+
const [modal, setModal] = (0, import_react107.useState)(false);
|
|
17966
|
+
(0, import_react107.useEffect)(() => {
|
|
17950
17967
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17951
17968
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17952
17969
|
const sync = () => setModal(mql.matches);
|
|
@@ -17960,12 +17977,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
17960
17977
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17961
17978
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17962
17979
|
const { state, close, stop, send, reset } = controller;
|
|
17963
|
-
const [squadView, setSquadView] = (0,
|
|
17964
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17980
|
+
const [squadView, setSquadView] = (0, import_react107.useState)("roster");
|
|
17981
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react107.useState)(null);
|
|
17965
17982
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17966
17983
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17967
|
-
const squadLayerRef = (0,
|
|
17968
|
-
const squadScrollRef = (0,
|
|
17984
|
+
const squadLayerRef = (0, import_react107.useRef)(null);
|
|
17985
|
+
const squadScrollRef = (0, import_react107.useRef)(null);
|
|
17969
17986
|
const selectPlayer = (playerId) => {
|
|
17970
17987
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17971
17988
|
setSelectedPlayerId(playerId);
|
|
@@ -17975,7 +17992,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17975
17992
|
setSelectedPlayerId(null);
|
|
17976
17993
|
clearPlayerDetail?.();
|
|
17977
17994
|
};
|
|
17978
|
-
(0,
|
|
17995
|
+
(0, import_react107.useLayoutEffect)(() => {
|
|
17979
17996
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17980
17997
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17981
17998
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17988,7 +18005,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17988
18005
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17989
18006
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17990
18007
|
const activeTab = tabs?.activeTab;
|
|
17991
|
-
(0,
|
|
18008
|
+
(0, import_react107.useEffect)(() => {
|
|
17992
18009
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17993
18010
|
setSelectedPlayerId(null);
|
|
17994
18011
|
clearPlayerDetail?.();
|
|
@@ -17997,11 +18014,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17997
18014
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
17998
18015
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
17999
18016
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18000
|
-
(0,
|
|
18017
|
+
(0, import_react107.useEffect)(() => {
|
|
18001
18018
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18002
18019
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18003
18020
|
const storedTab = tabState?.activeTab;
|
|
18004
|
-
(0,
|
|
18021
|
+
(0, import_react107.useEffect)(() => {
|
|
18005
18022
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18006
18023
|
if (unreachable) setMonitorTab?.("chat");
|
|
18007
18024
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18010,12 +18027,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18010
18027
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
18011
18028
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
18012
18029
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
18013
|
-
const closeWith = (0,
|
|
18030
|
+
const closeWith = (0, import_react107.useCallback)((method) => {
|
|
18014
18031
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
18015
18032
|
if (onCloseRequested) onCloseRequested();
|
|
18016
18033
|
else close();
|
|
18017
18034
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18018
|
-
(0,
|
|
18035
|
+
(0, import_react107.useEffect)(() => {
|
|
18019
18036
|
const onKey = (e) => {
|
|
18020
18037
|
if (e.key === "Escape") closeWith("escape");
|
|
18021
18038
|
};
|
|
@@ -18031,80 +18048,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18031
18048
|
tabs?.setActiveTab("chat");
|
|
18032
18049
|
send(text2, { grounding, source });
|
|
18033
18050
|
};
|
|
18034
|
-
(0,
|
|
18051
|
+
(0, import_react107.useEffect)(() => {
|
|
18035
18052
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
18036
18053
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
18037
18054
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
18038
|
-
const inputRef = (0,
|
|
18039
|
-
const limitRef = (0,
|
|
18040
|
-
const typedSendRef = (0,
|
|
18041
|
-
const focusAfterCloseRef = (0,
|
|
18042
|
-
const [tool, setTool] = (0,
|
|
18043
|
-
const panelRef = (0,
|
|
18055
|
+
const inputRef = (0, import_react107.useRef)(null);
|
|
18056
|
+
const limitRef = (0, import_react107.useRef)(null);
|
|
18057
|
+
const typedSendRef = (0, import_react107.useRef)(false);
|
|
18058
|
+
const focusAfterCloseRef = (0, import_react107.useRef)(null);
|
|
18059
|
+
const [tool, setTool] = (0, import_react107.useState)(null);
|
|
18060
|
+
const panelRef = (0, import_react107.useRef)(null);
|
|
18044
18061
|
const settings = useOddsSettings();
|
|
18045
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
18062
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react107.useState)(false);
|
|
18046
18063
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
18047
|
-
const openSettings = (0,
|
|
18064
|
+
const openSettings = (0, import_react107.useCallback)(() => {
|
|
18048
18065
|
setTool(null);
|
|
18049
18066
|
setFavouritesOpen?.(false);
|
|
18050
18067
|
setSettingsOpen(true);
|
|
18051
18068
|
}, [setFavouritesOpen]);
|
|
18052
|
-
const closeSettings = (0,
|
|
18069
|
+
const closeSettings = (0, import_react107.useCallback)(() => {
|
|
18053
18070
|
setSettingsOpen(false);
|
|
18054
18071
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18055
18072
|
}, []);
|
|
18056
|
-
const openFavourites = (0,
|
|
18057
|
-
const closeFavourites = (0,
|
|
18073
|
+
const openFavourites = (0, import_react107.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
18074
|
+
const closeFavourites = (0, import_react107.useCallback)(() => {
|
|
18058
18075
|
setFavouritesOpen?.(false);
|
|
18059
18076
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18060
18077
|
}, [setFavouritesOpen]);
|
|
18061
|
-
(0,
|
|
18078
|
+
(0, import_react107.useEffect)(() => {
|
|
18062
18079
|
if (!favouritesOpen) return;
|
|
18063
18080
|
setTool(null);
|
|
18064
18081
|
setSettingsOpen(false);
|
|
18065
18082
|
}, [favouritesOpen]);
|
|
18066
18083
|
const paused = isPaused(state.limit);
|
|
18067
|
-
(0,
|
|
18084
|
+
(0, import_react107.useEffect)(() => {
|
|
18068
18085
|
if (paused) setTool(null);
|
|
18069
18086
|
}, [paused]);
|
|
18070
|
-
(0,
|
|
18087
|
+
(0, import_react107.useEffect)(() => {
|
|
18071
18088
|
if (!paused) return;
|
|
18072
18089
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
18073
18090
|
typedSendRef.current = false;
|
|
18074
18091
|
}, [paused]);
|
|
18075
|
-
const openTool = (0,
|
|
18092
|
+
const openTool = (0, import_react107.useCallback)((next) => {
|
|
18076
18093
|
setTool(next);
|
|
18077
18094
|
}, []);
|
|
18078
|
-
const toolsValue = (0,
|
|
18095
|
+
const toolsValue = (0, import_react107.useMemo)(
|
|
18079
18096
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
18080
18097
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
18081
18098
|
);
|
|
18082
|
-
const closeTool = (0,
|
|
18099
|
+
const closeTool = (0, import_react107.useCallback)(() => {
|
|
18083
18100
|
focusAfterCloseRef.current = "composer";
|
|
18084
18101
|
setTool(null);
|
|
18085
18102
|
}, []);
|
|
18086
|
-
const sendAsk = (0,
|
|
18103
|
+
const sendAsk = (0, import_react107.useCallback)((ask) => {
|
|
18087
18104
|
focusAfterCloseRef.current = "composer";
|
|
18088
18105
|
setTool(null);
|
|
18089
18106
|
tabs?.setActiveTab("chat");
|
|
18090
18107
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
18091
18108
|
}, [tabs, send]);
|
|
18092
|
-
const formatKickoff = (0,
|
|
18109
|
+
const formatKickoff = (0, import_react107.useCallback)((kickoffUtc) => {
|
|
18093
18110
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
18094
18111
|
return `${k.dayLabel} ${k.time}`;
|
|
18095
18112
|
}, [ui]);
|
|
18096
|
-
(0,
|
|
18113
|
+
(0, import_react107.useEffect)(() => {
|
|
18097
18114
|
if (tool) return;
|
|
18098
18115
|
const target = focusAfterCloseRef.current;
|
|
18099
18116
|
focusAfterCloseRef.current = null;
|
|
18100
18117
|
if (target === "composer") inputRef.current?.focus();
|
|
18101
18118
|
}, [tool]);
|
|
18102
|
-
(0,
|
|
18119
|
+
(0, import_react107.useEffect)(() => {
|
|
18103
18120
|
if (!tool || onChatTab && presetGrid) return;
|
|
18104
18121
|
focusAfterCloseRef.current = "composer";
|
|
18105
18122
|
setTool(null);
|
|
18106
18123
|
}, [tool, onChatTab, presetGrid]);
|
|
18107
|
-
const backRef = (0,
|
|
18124
|
+
const backRef = (0, import_react107.useRef)(() => false);
|
|
18108
18125
|
backRef.current = () => {
|
|
18109
18126
|
if (favouritesOpen) {
|
|
18110
18127
|
closeFavourites();
|
|
@@ -18128,7 +18145,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18128
18145
|
}
|
|
18129
18146
|
return false;
|
|
18130
18147
|
};
|
|
18131
|
-
(0,
|
|
18148
|
+
(0, import_react107.useEffect)(() => {
|
|
18132
18149
|
if (!onRegisterBack) return;
|
|
18133
18150
|
onRegisterBack(() => backRef.current());
|
|
18134
18151
|
return () => onRegisterBack(null);
|
|
@@ -18787,6 +18804,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18787
18804
|
.ss-w-nfl-kick { margin-left: auto; white-space: nowrap; }
|
|
18788
18805
|
.ss-w-nfl-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
18789
18806
|
.ss-w-nfl-badge { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 16px; padding: 0 3px; border-radius: 4px; font-size: 9px; font-weight: 800; letter-spacing: .02em; line-height: 1; color: var(--ss-w-ink); background: var(--ss-w-bubble); border: 1px solid var(--ss-w-line); box-sizing: border-box; }
|
|
18807
|
+
.ss-w-nfl-badge--img { min-width: 0; width: 16px; padding: 1px; object-fit: contain; }
|
|
18808
|
+
.ss-w-props-scorer-who { display: flex; align-items: center; min-width: 0; }
|
|
18790
18809
|
.ss-w-nfl-who { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-weight: 600; font-size: 13px; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
18791
18810
|
.ss-w-nfl-pos { font-size: 10px; font-weight: 600; color: var(--ss-w-faint); border: 1px solid var(--ss-w-line); border-radius: 999px; padding: 0 6px; }
|
|
18792
18811
|
.ss-w-nfl-n { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ss-w-ink); text-align: right; white-space: nowrap; }
|
|
@@ -21109,12 +21128,12 @@ function injectStyles(root) {
|
|
|
21109
21128
|
function StatsWidget(props) {
|
|
21110
21129
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
21111
21130
|
const cfg = props.config;
|
|
21112
|
-
const built = (0,
|
|
21113
|
-
const trackingRef = (0,
|
|
21114
|
-
const track = (0,
|
|
21115
|
-
const eventTextRef = (0,
|
|
21131
|
+
const built = (0, import_react108.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
21132
|
+
const trackingRef = (0, import_react108.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
21133
|
+
const track = (0, import_react108.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
21134
|
+
const eventTextRef = (0, import_react108.useRef)(false);
|
|
21116
21135
|
eventTextRef.current = cfg?.eventText === true;
|
|
21117
|
-
const logger = (0,
|
|
21136
|
+
const logger = (0, import_react108.useMemo)(() => {
|
|
21118
21137
|
if (!built) return null;
|
|
21119
21138
|
const raw = built.client.createEventLogger({
|
|
21120
21139
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -21124,27 +21143,27 @@ function StatsWidget(props) {
|
|
|
21124
21143
|
}, [built?.client, track]);
|
|
21125
21144
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
21126
21145
|
const stringsPending = widgetStrings.strings === void 0;
|
|
21127
|
-
const ui = (0,
|
|
21146
|
+
const ui = (0, import_react108.useMemo)(
|
|
21128
21147
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
21129
21148
|
[props.config, widgetStrings.strings]
|
|
21130
21149
|
);
|
|
21131
21150
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
21132
|
-
const rootRef = (0,
|
|
21133
|
-
const introDoneRef = (0,
|
|
21134
|
-
const markIntroDone = (0,
|
|
21151
|
+
const rootRef = (0, import_react108.useRef)(null);
|
|
21152
|
+
const introDoneRef = (0, import_react108.useRef)(false);
|
|
21153
|
+
const markIntroDone = (0, import_react108.useCallback)(() => {
|
|
21135
21154
|
introDoneRef.current = true;
|
|
21136
21155
|
}, []);
|
|
21137
21156
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
21138
21157
|
const threadLanguage = familyOf(language);
|
|
21139
21158
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
21140
|
-
const sportScope = (0,
|
|
21159
|
+
const sportScope = (0, import_react108.useMemo)(
|
|
21141
21160
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
21142
21161
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
21143
21162
|
);
|
|
21144
|
-
const chatTracking = (0,
|
|
21163
|
+
const chatTracking = (0, import_react108.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
21145
21164
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
21146
21165
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
21147
|
-
const liveCardWatches = (0,
|
|
21166
|
+
const liveCardWatches = (0, import_react108.useMemo)(() => {
|
|
21148
21167
|
const seen2 = /* @__PURE__ */ new Set();
|
|
21149
21168
|
const out = [];
|
|
21150
21169
|
for (const msg of controller.state.messages) {
|
|
@@ -21170,19 +21189,19 @@ function StatsWidget(props) {
|
|
|
21170
21189
|
});
|
|
21171
21190
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
21172
21191
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
21173
|
-
const getSchedule = (0,
|
|
21192
|
+
const getSchedule = (0, import_react108.useCallback)(
|
|
21174
21193
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
21175
21194
|
[built, operatorUserId, anonymousUserId]
|
|
21176
21195
|
);
|
|
21177
|
-
const getStates = (0,
|
|
21196
|
+
const getStates = (0, import_react108.useCallback)(
|
|
21178
21197
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
21179
21198
|
[built, requestTag]
|
|
21180
21199
|
);
|
|
21181
|
-
const getTennisPrices = (0,
|
|
21200
|
+
const getTennisPrices = (0, import_react108.useCallback)(
|
|
21182
21201
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
21183
21202
|
[built, requestTag]
|
|
21184
21203
|
);
|
|
21185
|
-
const pinnedMatchIds = (0,
|
|
21204
|
+
const pinnedMatchIds = (0, import_react108.useMemo)(
|
|
21186
21205
|
() => footballMatchPinIds(monitor.pins),
|
|
21187
21206
|
[monitor.pins]
|
|
21188
21207
|
);
|
|
@@ -21196,13 +21215,13 @@ function StatsWidget(props) {
|
|
|
21196
21215
|
pinnedMatchIds,
|
|
21197
21216
|
timeZone: ui.timeZone
|
|
21198
21217
|
});
|
|
21199
|
-
const offeredSports = (0,
|
|
21218
|
+
const offeredSports = (0, import_react108.useMemo)(() => {
|
|
21200
21219
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
21201
21220
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
21202
21221
|
return [...seen2];
|
|
21203
21222
|
}, [discovery.matchDays, discovery.groups]);
|
|
21204
21223
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
21205
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
21224
|
+
const [liveLeague, setLiveLeague] = (0, import_react108.useState)(null);
|
|
21206
21225
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
21207
21226
|
const matchesLoaded = useMatchesDay({
|
|
21208
21227
|
discovery,
|
|
@@ -21212,8 +21231,8 @@ function StatsWidget(props) {
|
|
|
21212
21231
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
21213
21232
|
timeZone: ui.timeZone
|
|
21214
21233
|
});
|
|
21215
|
-
const prevLiveSnapshotRef = (0,
|
|
21216
|
-
(0,
|
|
21234
|
+
const prevLiveSnapshotRef = (0, import_react108.useRef)(monitor.snapshot);
|
|
21235
|
+
(0, import_react108.useEffect)(() => {
|
|
21217
21236
|
const snap = monitor.snapshot;
|
|
21218
21237
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
21219
21238
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -21253,14 +21272,14 @@ function StatsWidget(props) {
|
|
|
21253
21272
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21254
21273
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
21255
21274
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
21256
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
21257
|
-
const latestGreeting = (0,
|
|
21275
|
+
const [favSportPick, setFavSportPick] = (0, import_react108.useState)(null);
|
|
21276
|
+
const latestGreeting = (0, import_react108.useMemo)(() => {
|
|
21258
21277
|
for (const m of [...controller.state.messages].reverse()) {
|
|
21259
21278
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
21260
21279
|
}
|
|
21261
21280
|
return null;
|
|
21262
21281
|
}, [controller.state.messages]);
|
|
21263
|
-
const favSportOptions = (0,
|
|
21282
|
+
const favSportOptions = (0, import_react108.useMemo)(
|
|
21264
21283
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
21265
21284
|
[latestGreeting]
|
|
21266
21285
|
);
|
|
@@ -21269,20 +21288,20 @@ function StatsWidget(props) {
|
|
|
21269
21288
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
21270
21289
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
21271
21290
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
21272
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
21273
|
-
const builderGreeting = (0,
|
|
21291
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react108.useState)(null);
|
|
21292
|
+
const builderGreeting = (0, import_react108.useMemo)(
|
|
21274
21293
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
21275
21294
|
[controller.state.messages]
|
|
21276
21295
|
);
|
|
21277
|
-
const [coolOff, setCoolOff] = (0,
|
|
21278
|
-
const onBuilderCoolOff = (0,
|
|
21296
|
+
const [coolOff, setCoolOff] = (0, import_react108.useState)(null);
|
|
21297
|
+
const onBuilderCoolOff = (0, import_react108.useCallback)((sport) => {
|
|
21279
21298
|
if (!builderGreeting) return;
|
|
21280
21299
|
setCoolOff((prev) => {
|
|
21281
21300
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
21282
21301
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
21283
21302
|
});
|
|
21284
21303
|
}, [builderGreeting]);
|
|
21285
|
-
const builderOptions = (0,
|
|
21304
|
+
const builderOptions = (0, import_react108.useMemo)(() => {
|
|
21286
21305
|
const greeting = builderGreeting;
|
|
21287
21306
|
if (!greeting) return [];
|
|
21288
21307
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -21295,7 +21314,7 @@ function StatsWidget(props) {
|
|
|
21295
21314
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
21296
21315
|
}, [builderGreeting, coolOff, ui]);
|
|
21297
21316
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
21298
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21317
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react108.useState)(panelOpen);
|
|
21299
21318
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
21300
21319
|
const favourites = useFavourites({
|
|
21301
21320
|
conversation: built?.conversation ?? null,
|
|
@@ -21307,16 +21326,16 @@ function StatsWidget(props) {
|
|
|
21307
21326
|
onChanged: discovery.refreshSchedule
|
|
21308
21327
|
});
|
|
21309
21328
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
21310
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
21329
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react108.useState)(false);
|
|
21311
21330
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
21312
|
-
const getPricePresets = (0,
|
|
21331
|
+
const getPricePresets = (0, import_react108.useCallback)(
|
|
21313
21332
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
21314
21333
|
[built]
|
|
21315
21334
|
);
|
|
21316
21335
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
21317
21336
|
const markLiveActivity = monitor.markLiveActivity;
|
|
21318
|
-
const prevLiveCountRef = (0,
|
|
21319
|
-
(0,
|
|
21337
|
+
const prevLiveCountRef = (0, import_react108.useRef)(0);
|
|
21338
|
+
(0, import_react108.useEffect)(() => {
|
|
21320
21339
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
21321
21340
|
prevLiveCountRef.current = discovery.liveCount;
|
|
21322
21341
|
if (rose) markLiveActivity();
|
|
@@ -21330,7 +21349,7 @@ function StatsWidget(props) {
|
|
|
21330
21349
|
closePanel: controller.close
|
|
21331
21350
|
});
|
|
21332
21351
|
const markAdded = hostEvents.markAdded;
|
|
21333
|
-
const slip = (0,
|
|
21352
|
+
const slip = (0, import_react108.useMemo)(
|
|
21334
21353
|
() => {
|
|
21335
21354
|
const handler = props.config?.onAddToSlip;
|
|
21336
21355
|
return {
|
|
@@ -21350,7 +21369,7 @@ function StatsWidget(props) {
|
|
|
21350
21369
|
},
|
|
21351
21370
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
21352
21371
|
);
|
|
21353
|
-
const onDashboardTap = (0,
|
|
21372
|
+
const onDashboardTap = (0, import_react108.useMemo)(
|
|
21354
21373
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
21355
21374
|
[built, logger]
|
|
21356
21375
|
);
|
|
@@ -21364,7 +21383,7 @@ function StatsWidget(props) {
|
|
|
21364
21383
|
log: logger
|
|
21365
21384
|
})
|
|
21366
21385
|
}));
|
|
21367
|
-
const dismissPopupRef = (0,
|
|
21386
|
+
const dismissPopupRef = (0, import_react108.useRef)(() => {
|
|
21368
21387
|
});
|
|
21369
21388
|
const mobile = useMobileBinding({
|
|
21370
21389
|
binding: props.mobile,
|
|
@@ -21378,10 +21397,10 @@ function StatsWidget(props) {
|
|
|
21378
21397
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21379
21398
|
dismissPopupRef.current = dismissPopup;
|
|
21380
21399
|
useOpenTelemetry(logger, panelOpen);
|
|
21381
|
-
const onControlRef = (0,
|
|
21400
|
+
const onControlRef = (0, import_react108.useRef)(props.onControl);
|
|
21382
21401
|
onControlRef.current = props.onControl;
|
|
21383
21402
|
const { open: openPanel, close: closePanel } = controller;
|
|
21384
|
-
(0,
|
|
21403
|
+
(0, import_react108.useEffect)(() => {
|
|
21385
21404
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21386
21405
|
return () => onControlRef.current?.(null);
|
|
21387
21406
|
}, [openPanel, closePanel]);
|
|
@@ -21398,11 +21417,11 @@ function StatsWidget(props) {
|
|
|
21398
21417
|
page: cfg?.page
|
|
21399
21418
|
}
|
|
21400
21419
|
};
|
|
21401
|
-
(0,
|
|
21420
|
+
(0, import_react108.useEffect)(() => {
|
|
21402
21421
|
if (!logger) return;
|
|
21403
21422
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21404
21423
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21405
|
-
(0,
|
|
21424
|
+
(0, import_react108.useEffect)(() => {
|
|
21406
21425
|
if (!logger) return;
|
|
21407
21426
|
logger.resume();
|
|
21408
21427
|
const onHide = () => {
|
|
@@ -21420,15 +21439,15 @@ function StatsWidget(props) {
|
|
|
21420
21439
|
logger.dispose();
|
|
21421
21440
|
};
|
|
21422
21441
|
}, [logger]);
|
|
21423
|
-
(0,
|
|
21442
|
+
(0, import_react108.useEffect)(() => {
|
|
21424
21443
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21425
21444
|
const node = rootRef.current?.getRootNode();
|
|
21426
21445
|
if (node) injectStyles(node);
|
|
21427
21446
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21428
21447
|
const holds = useSessionHolds();
|
|
21429
21448
|
const builderConversation = built?.conversation ?? null;
|
|
21430
|
-
const builderMemory = (0,
|
|
21431
|
-
const personalGreeting = (0,
|
|
21449
|
+
const builderMemory = (0, import_react108.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21450
|
+
const personalGreeting = (0, import_react108.useMemo)(() => ({
|
|
21432
21451
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21433
21452
|
conversation: built?.conversation ?? null,
|
|
21434
21453
|
openFavourites: () => setFavouritesOpen(true),
|