@sensiblestats/widget-react 0.104.0 → 0.105.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 +11 -0
- package/dist/index.cjs +230 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +110 -96
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
|
|
39
39
|
// src/StatsWidget.tsx
|
|
40
|
-
var
|
|
40
|
+
var import_react79 = require("react");
|
|
41
41
|
var import_widget_sdk30 = require("@sensiblestats/widget-sdk");
|
|
42
42
|
|
|
43
43
|
// src/kickoff.ts
|
|
@@ -1208,7 +1208,7 @@ function isEnglishLocale(locale) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
1210
|
// src/version.generated.ts
|
|
1211
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1211
|
+
var WIDGET_REACT_VERSION = "0.105.0";
|
|
1212
1212
|
|
|
1213
1213
|
// src/config.ts
|
|
1214
1214
|
function normalizeUi(cfg) {
|
|
@@ -4704,7 +4704,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
4704
4704
|
}
|
|
4705
4705
|
|
|
4706
4706
|
// src/components/ChatPanel.tsx
|
|
4707
|
-
var
|
|
4707
|
+
var import_react78 = require("react");
|
|
4708
4708
|
|
|
4709
4709
|
// src/components/ChatHeader.tsx
|
|
4710
4710
|
var import_react21 = require("react");
|
|
@@ -4783,6 +4783,9 @@ function ChatHeader({
|
|
|
4783
4783
|
}
|
|
4784
4784
|
|
|
4785
4785
|
// src/components/MessageList.tsx
|
|
4786
|
+
var import_react46 = require("react");
|
|
4787
|
+
|
|
4788
|
+
// src/components/ChatMessage.tsx
|
|
4786
4789
|
var import_react45 = require("react");
|
|
4787
4790
|
|
|
4788
4791
|
// src/components/Markdown.tsx
|
|
@@ -6806,16 +6809,23 @@ var LAYOUT_CLASSES = {
|
|
|
6806
6809
|
function layoutClass(layout) {
|
|
6807
6810
|
return Object.prototype.hasOwnProperty.call(LAYOUT_CLASSES, layout) ? LAYOUT_CLASSES[layout] : LAYOUT_CLASSES.goal;
|
|
6808
6811
|
}
|
|
6809
|
-
function
|
|
6812
|
+
function switchSets(dashboards) {
|
|
6813
|
+
return dashboards && dashboards.length >= 2 ? dashboards : null;
|
|
6814
|
+
}
|
|
6815
|
+
function initialSport(sets, defaultSport) {
|
|
6816
|
+
return (sets?.some((s) => s.sport === defaultSport) ? defaultSport : sets?.[0]?.sport) ?? "";
|
|
6817
|
+
}
|
|
6818
|
+
function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel }) {
|
|
6810
6819
|
const log = useEventLog();
|
|
6811
6820
|
const scope = useSportScope();
|
|
6812
|
-
const sets = dashboards
|
|
6813
|
-
const [selected, setSelected] = (0, import_react37.useState)(() => (sets
|
|
6821
|
+
const sets = switchSets(dashboards);
|
|
6822
|
+
const [selected, setSelected] = (0, import_react37.useState)(() => initialSport(sets, defaultSport));
|
|
6814
6823
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
6815
6824
|
const shown = active ? active.dashboard : dashboard;
|
|
6816
6825
|
const select = (sport) => {
|
|
6817
6826
|
if (sport === selected) return;
|
|
6818
6827
|
setSelected(sport);
|
|
6828
|
+
onSportChange?.(sport);
|
|
6819
6829
|
if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
|
|
6820
6830
|
log?.log({ name: "dashboard_sport_switch", outcome: sport });
|
|
6821
6831
|
};
|
|
@@ -7654,6 +7664,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
7654
7664
|
// src/components/ChatMessage.tsx
|
|
7655
7665
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7656
7666
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
7667
|
+
const [sport, setSport] = (0, import_react45.useState)(null);
|
|
7657
7668
|
if (message.role === "user") {
|
|
7658
7669
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
7659
7670
|
}
|
|
@@ -7661,9 +7672,12 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
|
7661
7672
|
onAct({ message: card.actionLabel, actionRef: card.actionRef, label: card.actionLabel || card.title || "" });
|
|
7662
7673
|
};
|
|
7663
7674
|
const compact = toCompactList(message.marketOdds);
|
|
7675
|
+
const sets = message.greetingDashboard ? switchSets(message.greetingDashboards) : null;
|
|
7676
|
+
const setChips = sets?.some((s) => s.suggestedActions) ? sets.find((s) => s.sport === (sport ?? initialSport(sets, message.defaultSport)))?.suggestedActions ?? [] : null;
|
|
7677
|
+
const actions = setChips ? setChips.map((c) => toActionVM({ ...c })) : message.actions;
|
|
7664
7678
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ss-w-msg ss-w-bot", "data-msg-id": message.id, children: [
|
|
7665
7679
|
message.text && !message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Markdown, { text: message.text }) : null,
|
|
7666
|
-
message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
|
|
7680
|
+
message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, onSportChange: setSport, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
|
|
7667
7681
|
message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
|
|
7668
7682
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
|
|
7669
7683
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
|
|
@@ -7672,7 +7686,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
|
7672
7686
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
|
|
7673
7687
|
compact ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
|
|
7674
7688
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
|
|
7675
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions
|
|
7689
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions, loading: false, disabled, onAct })
|
|
7676
7690
|
] });
|
|
7677
7691
|
}
|
|
7678
7692
|
|
|
@@ -7699,11 +7713,11 @@ function turnAnchor(messages) {
|
|
|
7699
7713
|
}
|
|
7700
7714
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
7701
7715
|
const { state, send } = controller;
|
|
7702
|
-
const listRef = (0,
|
|
7703
|
-
const endRef = (0,
|
|
7704
|
-
const pinnedRef = (0,
|
|
7705
|
-
const anchoredTurnRef = (0,
|
|
7706
|
-
(0,
|
|
7716
|
+
const listRef = (0, import_react46.useRef)(null);
|
|
7717
|
+
const endRef = (0, import_react46.useRef)(null);
|
|
7718
|
+
const pinnedRef = (0, import_react46.useRef)(true);
|
|
7719
|
+
const anchoredTurnRef = (0, import_react46.useRef)(null);
|
|
7720
|
+
(0, import_react46.useEffect)(() => {
|
|
7707
7721
|
const anchor = turnAnchor(state.messages);
|
|
7708
7722
|
const list = listRef.current;
|
|
7709
7723
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -7760,13 +7774,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
7760
7774
|
}
|
|
7761
7775
|
|
|
7762
7776
|
// src/components/ChatInput.tsx
|
|
7763
|
-
var
|
|
7777
|
+
var import_react47 = require("react");
|
|
7764
7778
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
7765
|
-
var ChatInput = (0,
|
|
7766
|
-
const [value, setValue] = (0,
|
|
7767
|
-
const textareaRef = (0,
|
|
7768
|
-
const stopRef = (0,
|
|
7769
|
-
const textBoxWantsFocusRef = (0,
|
|
7779
|
+
var ChatInput = (0, import_react47.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
|
|
7780
|
+
const [value, setValue] = (0, import_react47.useState)("");
|
|
7781
|
+
const textareaRef = (0, import_react47.useRef)(null);
|
|
7782
|
+
const stopRef = (0, import_react47.useRef)(null);
|
|
7783
|
+
const textBoxWantsFocusRef = (0, import_react47.useRef)(false);
|
|
7770
7784
|
const submit = () => {
|
|
7771
7785
|
if (disabled) return;
|
|
7772
7786
|
const t = value.trim();
|
|
@@ -7780,7 +7794,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
|
|
|
7780
7794
|
submit();
|
|
7781
7795
|
}
|
|
7782
7796
|
};
|
|
7783
|
-
(0,
|
|
7797
|
+
(0, import_react47.useImperativeHandle)(ref, () => ({
|
|
7784
7798
|
focus() {
|
|
7785
7799
|
const box = textareaRef.current;
|
|
7786
7800
|
if (box && !box.disabled) {
|
|
@@ -7792,7 +7806,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
|
|
|
7792
7806
|
stopRef.current?.focus();
|
|
7793
7807
|
}
|
|
7794
7808
|
}), []);
|
|
7795
|
-
(0,
|
|
7809
|
+
(0, import_react47.useEffect)(() => {
|
|
7796
7810
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
7797
7811
|
textBoxWantsFocusRef.current = false;
|
|
7798
7812
|
const box = textareaRef.current;
|
|
@@ -7824,7 +7838,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
|
|
|
7824
7838
|
});
|
|
7825
7839
|
|
|
7826
7840
|
// src/components/TabBar.tsx
|
|
7827
|
-
var
|
|
7841
|
+
var import_react48 = require("react");
|
|
7828
7842
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7829
7843
|
function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, gamesEnabled, clubEnabled }) {
|
|
7830
7844
|
const tabs = [
|
|
@@ -7840,9 +7854,9 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
|
|
|
7840
7854
|
],
|
|
7841
7855
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
7842
7856
|
];
|
|
7843
|
-
const listRef = (0,
|
|
7857
|
+
const listRef = (0, import_react48.useRef)(null);
|
|
7844
7858
|
const activeTab = monitor.activeTab;
|
|
7845
|
-
(0,
|
|
7859
|
+
(0, import_react48.useEffect)(() => {
|
|
7846
7860
|
const el = listRef.current?.querySelector("[data-on]");
|
|
7847
7861
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
7848
7862
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -7872,7 +7886,7 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
|
|
|
7872
7886
|
}
|
|
7873
7887
|
|
|
7874
7888
|
// src/components/MonitorTabs.tsx
|
|
7875
|
-
var
|
|
7889
|
+
var import_react53 = require("react");
|
|
7876
7890
|
|
|
7877
7891
|
// src/components/MarketAccordion.tsx
|
|
7878
7892
|
var import_widget_sdk22 = require("@sensiblestats/widget-sdk");
|
|
@@ -7934,10 +7948,10 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
7934
7948
|
}
|
|
7935
7949
|
|
|
7936
7950
|
// src/components/LiveFactBlock.tsx
|
|
7937
|
-
var
|
|
7951
|
+
var import_react49 = require("react");
|
|
7938
7952
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
7939
7953
|
function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
7940
|
-
const [expanded, setExpanded] = (0,
|
|
7954
|
+
const [expanded, setExpanded] = (0, import_react49.useState)(false);
|
|
7941
7955
|
const [current, ...earlier] = facts;
|
|
7942
7956
|
if (!current) return null;
|
|
7943
7957
|
const m = current.market;
|
|
@@ -8005,7 +8019,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
8005
8019
|
}
|
|
8006
8020
|
|
|
8007
8021
|
// src/components/MonitorFormH2H.tsx
|
|
8008
|
-
var
|
|
8022
|
+
var import_react50 = require("react");
|
|
8009
8023
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
8010
8024
|
function resultClass2(result) {
|
|
8011
8025
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -8021,7 +8035,7 @@ function FormDots({ form, ui }) {
|
|
|
8021
8035
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
8022
8036
|
}
|
|
8023
8037
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
8024
|
-
const [expanded, setExpanded] = (0,
|
|
8038
|
+
const [expanded, setExpanded] = (0, import_react50.useState)(false);
|
|
8025
8039
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
8026
8040
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
8027
8041
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, {});
|
|
@@ -8254,7 +8268,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
8254
8268
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
8255
8269
|
|
|
8256
8270
|
// src/components/NbaPropsSection.tsx
|
|
8257
|
-
var
|
|
8271
|
+
var import_react51 = require("react");
|
|
8258
8272
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8259
8273
|
var STAT_ORDER = ["points", "rebounds", "assists", "threes"];
|
|
8260
8274
|
var MAX_TIMER_MS = 2147483647;
|
|
@@ -8316,7 +8330,7 @@ function Last5({ games, stat, line, ui }) {
|
|
|
8316
8330
|
}
|
|
8317
8331
|
function PlayerPanel({ player, bundle, ui, slip }) {
|
|
8318
8332
|
const stats = STAT_ORDER.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
8319
|
-
const [picked, setPicked] = (0,
|
|
8333
|
+
const [picked, setPicked] = (0, import_react51.useState)(null);
|
|
8320
8334
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
8321
8335
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-props-panel", children: [
|
|
8322
8336
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-chips", children: stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
@@ -8353,7 +8367,7 @@ function PlayerPanel({ player, bundle, ui, slip }) {
|
|
|
8353
8367
|
] });
|
|
8354
8368
|
}
|
|
8355
8369
|
function Roster({ bundle, players, side, ui, slip }) {
|
|
8356
|
-
const [openId, setOpenId] = (0,
|
|
8370
|
+
const [openId, setOpenId] = (0, import_react51.useState)(null);
|
|
8357
8371
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-list", children: players.map((p) => {
|
|
8358
8372
|
const isOpen = openId === p.playerId;
|
|
8359
8373
|
const main = p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine);
|
|
@@ -8384,15 +8398,15 @@ function Roster({ bundle, players, side, ui, slip }) {
|
|
|
8384
8398
|
}) });
|
|
8385
8399
|
}
|
|
8386
8400
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
8387
|
-
const [side, setSide] = (0,
|
|
8388
|
-
const [, setTick] = (0,
|
|
8401
|
+
const [side, setSide] = (0, import_react51.useState)("home");
|
|
8402
|
+
const [, setTick] = (0, import_react51.useState)(0);
|
|
8389
8403
|
const pre = preTip(match);
|
|
8390
8404
|
const live = match.phase === "live";
|
|
8391
8405
|
const open = pre || live;
|
|
8392
|
-
(0,
|
|
8406
|
+
(0, import_react51.useEffect)(() => {
|
|
8393
8407
|
if (open) monitor.loadPlayerProps?.(match.matchId);
|
|
8394
8408
|
}, [match.matchId, match.asOfUtc, open]);
|
|
8395
|
-
(0,
|
|
8409
|
+
(0, import_react51.useEffect)(() => {
|
|
8396
8410
|
if (!pre || !match.kickoffUtc) return;
|
|
8397
8411
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
8398
8412
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -8617,7 +8631,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
8617
8631
|
}
|
|
8618
8632
|
|
|
8619
8633
|
// src/components/ScoreboardStrip.tsx
|
|
8620
|
-
var
|
|
8634
|
+
var import_react52 = require("react");
|
|
8621
8635
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
8622
8636
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
8623
8637
|
function nbaStatus(m, ui) {
|
|
@@ -8692,8 +8706,8 @@ function rowsFor(m) {
|
|
|
8692
8706
|
];
|
|
8693
8707
|
}
|
|
8694
8708
|
function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
8695
|
-
const stripRef = (0,
|
|
8696
|
-
(0,
|
|
8709
|
+
const stripRef = (0, import_react52.useRef)(null);
|
|
8710
|
+
(0, import_react52.useEffect)(() => {
|
|
8697
8711
|
const strip = stripRef.current;
|
|
8698
8712
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
8699
8713
|
if (!strip || !pressed) return;
|
|
@@ -8805,7 +8819,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
8805
8819
|
] });
|
|
8806
8820
|
}
|
|
8807
8821
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
8808
|
-
const seedIndex = (0,
|
|
8822
|
+
const seedIndex = (0, import_react53.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
8809
8823
|
const tiles = orderTiles(
|
|
8810
8824
|
monitor.pins,
|
|
8811
8825
|
monitor.snapshot,
|
|
@@ -8871,7 +8885,7 @@ function OddsPanel({ monitor, ui, slip }) {
|
|
|
8871
8885
|
}
|
|
8872
8886
|
|
|
8873
8887
|
// src/components/TodayPanel.tsx
|
|
8874
|
-
var
|
|
8888
|
+
var import_react57 = require("react");
|
|
8875
8889
|
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
8876
8890
|
|
|
8877
8891
|
// src/placement.ts
|
|
@@ -8936,11 +8950,11 @@ function matchingFixtures(group, query) {
|
|
|
8936
8950
|
}
|
|
8937
8951
|
|
|
8938
8952
|
// src/useStarTap.ts
|
|
8939
|
-
var
|
|
8953
|
+
var import_react54 = require("react");
|
|
8940
8954
|
function useStarTap(starLeague) {
|
|
8941
|
-
const [pendingId, setPendingId] = (0,
|
|
8942
|
-
const pendingRef = (0,
|
|
8943
|
-
const tap = (0,
|
|
8955
|
+
const [pendingId, setPendingId] = (0, import_react54.useState)(null);
|
|
8956
|
+
const pendingRef = (0, import_react54.useRef)(null);
|
|
8957
|
+
const tap = (0, import_react54.useCallback)(async (competitionId, next) => {
|
|
8944
8958
|
if (pendingRef.current !== null) return false;
|
|
8945
8959
|
pendingRef.current = competitionId;
|
|
8946
8960
|
setPendingId(competitionId);
|
|
@@ -8999,7 +9013,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
8999
9013
|
}
|
|
9000
9014
|
|
|
9001
9015
|
// src/components/LeagueDetail.tsx
|
|
9002
|
-
var
|
|
9016
|
+
var import_react55 = require("react");
|
|
9003
9017
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
9004
9018
|
|
|
9005
9019
|
// src/components/FixtureRow.tsx
|
|
@@ -9062,11 +9076,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9062
9076
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
9063
9077
|
var STAR_PATH2 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1-6.47L2.5 9.35l6.5-.95z";
|
|
9064
9078
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
9065
|
-
const [toast, setToast] = (0,
|
|
9066
|
-
(0,
|
|
9079
|
+
const [toast, setToast] = (0, import_react55.useState)(null);
|
|
9080
|
+
(0, import_react55.useEffect)(() => {
|
|
9067
9081
|
setToast(null);
|
|
9068
9082
|
}, [group.competitionId]);
|
|
9069
|
-
(0,
|
|
9083
|
+
(0, import_react55.useEffect)(() => {
|
|
9070
9084
|
if (toast === null) return;
|
|
9071
9085
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
9072
9086
|
return () => clearTimeout(id);
|
|
@@ -9219,7 +9233,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
|
|
|
9219
9233
|
}
|
|
9220
9234
|
|
|
9221
9235
|
// src/components/games/ui/SearchField.tsx
|
|
9222
|
-
var
|
|
9236
|
+
var import_react56 = require("react");
|
|
9223
9237
|
|
|
9224
9238
|
// src/components/games/ui/icons.tsx
|
|
9225
9239
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -9258,8 +9272,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
9258
9272
|
// src/components/games/ui/SearchField.tsx
|
|
9259
9273
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
9260
9274
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
9261
|
-
const localRef = (0,
|
|
9262
|
-
const setInputRef = (0,
|
|
9275
|
+
const localRef = (0, import_react56.useRef)(null);
|
|
9276
|
+
const setInputRef = (0, import_react56.useCallback)((node) => {
|
|
9263
9277
|
localRef.current = node;
|
|
9264
9278
|
if (typeof inputRef === "function") inputRef(node);
|
|
9265
9279
|
else if (inputRef) inputRef.current = node;
|
|
@@ -9303,23 +9317,23 @@ function SearchField({ id, label, labelHidden = false, placeholder, value, onCha
|
|
|
9303
9317
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
9304
9318
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
9305
9319
|
const { groups, states, stale, starLeague } = discovery;
|
|
9306
|
-
const searchId = (0,
|
|
9307
|
-
const [query, setQuery] = (0,
|
|
9308
|
-
const [selectedCompetitionId, setSelectedCompetitionId] = (0,
|
|
9309
|
-
const [toast, setToast] = (0,
|
|
9310
|
-
(0,
|
|
9320
|
+
const searchId = (0, import_react57.useId)();
|
|
9321
|
+
const [query, setQuery] = (0, import_react57.useState)("");
|
|
9322
|
+
const [selectedCompetitionId, setSelectedCompetitionId] = (0, import_react57.useState)(null);
|
|
9323
|
+
const [toast, setToast] = (0, import_react57.useState)(null);
|
|
9324
|
+
(0, import_react57.useEffect)(() => {
|
|
9311
9325
|
if (toast === null) return;
|
|
9312
9326
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
9313
9327
|
return () => clearTimeout(id);
|
|
9314
9328
|
}, [toast]);
|
|
9315
9329
|
const visibleGroups = visibleGroupsOf(groups, states);
|
|
9316
|
-
const pinnedMatchIds = (0,
|
|
9330
|
+
const pinnedMatchIds = (0, import_react57.useMemo)(
|
|
9317
9331
|
() => footballMatchPinIds(monitor.pins),
|
|
9318
9332
|
[monitor.pins]
|
|
9319
9333
|
);
|
|
9320
|
-
const placement = (0,
|
|
9334
|
+
const placement = (0, import_react57.useMemo)(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
|
|
9321
9335
|
const starTap = useStarTap(starLeague);
|
|
9322
|
-
const gridStarTap = (0,
|
|
9336
|
+
const gridStarTap = (0, import_react57.useMemo)(() => ({
|
|
9323
9337
|
pendingId: starTap.pendingId,
|
|
9324
9338
|
tap: async (competitionId, next) => {
|
|
9325
9339
|
const ok = await starTap.tap(competitionId, next);
|
|
@@ -9353,7 +9367,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9353
9367
|
}
|
|
9354
9368
|
const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
|
|
9355
9369
|
const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
|
|
9356
|
-
(0,
|
|
9370
|
+
(0, import_react57.useEffect)(() => {
|
|
9357
9371
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
9358
9372
|
}, [selectedCompetitionId, openGroup]);
|
|
9359
9373
|
const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get((0, import_widget_sdk29.matchKey)(m.sport, m.matchId)), stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
|
|
@@ -9509,7 +9523,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9509
9523
|
}
|
|
9510
9524
|
|
|
9511
9525
|
// src/components/GamesPanel.tsx
|
|
9512
|
-
var
|
|
9526
|
+
var import_react72 = require("react");
|
|
9513
9527
|
|
|
9514
9528
|
// src/components/GamesLoginWall.tsx
|
|
9515
9529
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
@@ -9518,7 +9532,7 @@ function GamesLoginWall({ ui }) {
|
|
|
9518
9532
|
}
|
|
9519
9533
|
|
|
9520
9534
|
// src/components/GamesHub.tsx
|
|
9521
|
-
var
|
|
9535
|
+
var import_react58 = require("react");
|
|
9522
9536
|
|
|
9523
9537
|
// src/components/games/ui/gameMeta.ts
|
|
9524
9538
|
function prettifyGameId(gameId) {
|
|
@@ -9669,8 +9683,8 @@ function pickHeroGame(games) {
|
|
|
9669
9683
|
}
|
|
9670
9684
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
9671
9685
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
9672
|
-
const [, setTick] = (0,
|
|
9673
|
-
(0,
|
|
9686
|
+
const [, setTick] = (0, import_react58.useState)(0);
|
|
9687
|
+
(0, import_react58.useEffect)(() => {
|
|
9674
9688
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
9675
9689
|
return () => clearInterval(id);
|
|
9676
9690
|
}, []);
|
|
@@ -9730,10 +9744,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
9730
9744
|
}
|
|
9731
9745
|
|
|
9732
9746
|
// src/components/GameScreenHost.tsx
|
|
9733
|
-
var
|
|
9747
|
+
var import_react70 = require("react");
|
|
9734
9748
|
|
|
9735
9749
|
// src/useGamePlay.ts
|
|
9736
|
-
var
|
|
9750
|
+
var import_react59 = require("react");
|
|
9737
9751
|
function toSubmitResult(payload) {
|
|
9738
9752
|
return {
|
|
9739
9753
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -9745,17 +9759,17 @@ function toSubmitResult(payload) {
|
|
|
9745
9759
|
};
|
|
9746
9760
|
}
|
|
9747
9761
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
9748
|
-
const [result, setResult] = (0,
|
|
9749
|
-
const [submitting, setSubmitting] = (0,
|
|
9750
|
-
const [rawStatus, setRawStatus] = (0,
|
|
9751
|
-
const inFlightRef = (0,
|
|
9752
|
-
const convRef = (0,
|
|
9762
|
+
const [result, setResult] = (0, import_react59.useState)(null);
|
|
9763
|
+
const [submitting, setSubmitting] = (0, import_react59.useState)(false);
|
|
9764
|
+
const [rawStatus, setRawStatus] = (0, import_react59.useState)(null);
|
|
9765
|
+
const inFlightRef = (0, import_react59.useRef)(false);
|
|
9766
|
+
const convRef = (0, import_react59.useRef)(conversation);
|
|
9753
9767
|
convRef.current = conversation;
|
|
9754
|
-
const optsRef = (0,
|
|
9768
|
+
const optsRef = (0, import_react59.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
9755
9769
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
9756
|
-
const resultRef = (0,
|
|
9770
|
+
const resultRef = (0, import_react59.useRef)(null);
|
|
9757
9771
|
resultRef.current = result;
|
|
9758
|
-
const refetch = (0,
|
|
9772
|
+
const refetch = (0, import_react59.useCallback)(async () => {
|
|
9759
9773
|
const conv = convRef.current;
|
|
9760
9774
|
if (!conv) return;
|
|
9761
9775
|
const opts = optsRef.current;
|
|
@@ -9771,7 +9785,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
9771
9785
|
} catch {
|
|
9772
9786
|
}
|
|
9773
9787
|
}, []);
|
|
9774
|
-
const submit = (0,
|
|
9788
|
+
const submit = (0, import_react59.useCallback)(async (answerJson) => {
|
|
9775
9789
|
const conv = convRef.current;
|
|
9776
9790
|
if (!conv || inFlightRef.current) return;
|
|
9777
9791
|
inFlightRef.current = true;
|
|
@@ -9798,14 +9812,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
9798
9812
|
setSubmitting(false);
|
|
9799
9813
|
}
|
|
9800
9814
|
}, [refetch]);
|
|
9801
|
-
const hydrate = (0,
|
|
9815
|
+
const hydrate = (0, import_react59.useCallback)(() => {
|
|
9802
9816
|
void refetch();
|
|
9803
9817
|
}, [refetch]);
|
|
9804
9818
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
9805
9819
|
}
|
|
9806
9820
|
|
|
9807
9821
|
// src/components/games/MysteryTigerGame.tsx
|
|
9808
|
-
var
|
|
9822
|
+
var import_react61 = require("react");
|
|
9809
9823
|
|
|
9810
9824
|
// src/components/games/nationFlags.ts
|
|
9811
9825
|
var FLAGS = {
|
|
@@ -10016,7 +10030,7 @@ function isNationCode(flag) {
|
|
|
10016
10030
|
}
|
|
10017
10031
|
|
|
10018
10032
|
// src/components/games/PlayerAvatar.tsx
|
|
10019
|
-
var
|
|
10033
|
+
var import_react60 = require("react");
|
|
10020
10034
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
10021
10035
|
function initialsOf(name) {
|
|
10022
10036
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -10034,7 +10048,7 @@ function PlayerAvatar({
|
|
|
10034
10048
|
imagePath,
|
|
10035
10049
|
className
|
|
10036
10050
|
}) {
|
|
10037
|
-
const [failed, setFailed] = (0,
|
|
10051
|
+
const [failed, setFailed] = (0, import_react60.useState)(false);
|
|
10038
10052
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
10039
10053
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
10040
10054
|
}
|
|
@@ -10275,8 +10289,8 @@ function MysteryTigerGame({
|
|
|
10275
10289
|
onBack
|
|
10276
10290
|
}) {
|
|
10277
10291
|
const t = ui.games.mysteryTiger;
|
|
10278
|
-
const [query, setQuery] = (0,
|
|
10279
|
-
const inputId = (0,
|
|
10292
|
+
const [query, setQuery] = (0, import_react61.useState)("");
|
|
10293
|
+
const inputId = (0, import_react61.useId)();
|
|
10280
10294
|
const clientState = parseClientState(result?.clientStateJson);
|
|
10281
10295
|
const guessResults = clientState?.guessResults ?? [];
|
|
10282
10296
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -10537,13 +10551,13 @@ function HigherOrLowerGame({
|
|
|
10537
10551
|
}
|
|
10538
10552
|
|
|
10539
10553
|
// src/components/games/CareerPathGame.tsx
|
|
10540
|
-
var
|
|
10554
|
+
var import_react63 = require("react");
|
|
10541
10555
|
|
|
10542
10556
|
// src/components/games/ui/CrestShield.tsx
|
|
10543
|
-
var
|
|
10557
|
+
var import_react62 = require("react");
|
|
10544
10558
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
10545
10559
|
function CrestShield({ src, name, size = 28 }) {
|
|
10546
|
-
const [failed, setFailed] = (0,
|
|
10560
|
+
const [failed, setFailed] = (0, import_react62.useState)(false);
|
|
10547
10561
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
10548
10562
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
10549
10563
|
}
|
|
@@ -10575,8 +10589,8 @@ function CareerPathGame({
|
|
|
10575
10589
|
}) {
|
|
10576
10590
|
const s = ui.games.careerPath;
|
|
10577
10591
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
10578
|
-
const [query, setQuery] = (0,
|
|
10579
|
-
const inputId = (0,
|
|
10592
|
+
const [query, setQuery] = (0, import_react63.useState)("");
|
|
10593
|
+
const inputId = (0, import_react63.useId)();
|
|
10580
10594
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
10581
10595
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
10582
10596
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -10682,7 +10696,7 @@ function CareerPathGame({
|
|
|
10682
10696
|
}
|
|
10683
10697
|
|
|
10684
10698
|
// src/components/games/BeatTheGridGame.tsx
|
|
10685
|
-
var
|
|
10699
|
+
var import_react64 = __toESM(require("react"), 1);
|
|
10686
10700
|
|
|
10687
10701
|
// src/components/games/ui/OptionList.tsx
|
|
10688
10702
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
@@ -10771,10 +10785,10 @@ function SearchSheet({
|
|
|
10771
10785
|
ui
|
|
10772
10786
|
}) {
|
|
10773
10787
|
const s = ui.games.beatTheGrid;
|
|
10774
|
-
const [query, setQuery] = (0,
|
|
10775
|
-
const inputId = (0,
|
|
10776
|
-
const inputRef = (0,
|
|
10777
|
-
(0,
|
|
10788
|
+
const [query, setQuery] = (0, import_react64.useState)("");
|
|
10789
|
+
const inputId = (0, import_react64.useId)();
|
|
10790
|
+
const inputRef = (0, import_react64.useRef)(null);
|
|
10791
|
+
(0, import_react64.useEffect)(() => {
|
|
10778
10792
|
inputRef.current?.focus();
|
|
10779
10793
|
}, [row, col]);
|
|
10780
10794
|
const filtered = playerPool.filter(
|
|
@@ -10839,7 +10853,7 @@ function BeatTheGridGame({
|
|
|
10839
10853
|
}) {
|
|
10840
10854
|
const s = ui.games.beatTheGrid;
|
|
10841
10855
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
10842
|
-
const [activeCell, setActiveCell] = (0,
|
|
10856
|
+
const [activeCell, setActiveCell] = (0, import_react64.useState)(null);
|
|
10843
10857
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
10844
10858
|
const filledCells = clientState?.cells ?? [];
|
|
10845
10859
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -10913,7 +10927,7 @@ function BeatTheGridGame({
|
|
|
10913
10927
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
10914
10928
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
10915
10929
|
] });
|
|
10916
|
-
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
10930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_react64.default.Fragment, { children: [
|
|
10917
10931
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
10918
10932
|
cols.map((colLabel, colIdx) => {
|
|
10919
10933
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -10994,7 +11008,7 @@ function BeatTheGridGame({
|
|
|
10994
11008
|
}
|
|
10995
11009
|
|
|
10996
11010
|
// src/components/games/GuessTheXiGame.tsx
|
|
10997
|
-
var
|
|
11011
|
+
var import_react65 = require("react");
|
|
10998
11012
|
|
|
10999
11013
|
// src/components/games/ui/PitchSvg.tsx
|
|
11000
11014
|
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
@@ -11083,8 +11097,8 @@ function GuessTheXiGame({
|
|
|
11083
11097
|
onBack
|
|
11084
11098
|
}) {
|
|
11085
11099
|
const t = ui.games.guessTheXi;
|
|
11086
|
-
const [query, setQuery] = (0,
|
|
11087
|
-
const inputId = (0,
|
|
11100
|
+
const [query, setQuery] = (0, import_react65.useState)("");
|
|
11101
|
+
const inputId = (0, import_react65.useId)();
|
|
11088
11102
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
11089
11103
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
11090
11104
|
const solved = clientState?.status === "solved";
|
|
@@ -11226,7 +11240,7 @@ function GuessTheXiGame({
|
|
|
11226
11240
|
}
|
|
11227
11241
|
|
|
11228
11242
|
// src/components/games/DailyQuizGame.tsx
|
|
11229
|
-
var
|
|
11243
|
+
var import_react66 = require("react");
|
|
11230
11244
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
11231
11245
|
function parseClientState6(json) {
|
|
11232
11246
|
if (!json) return null;
|
|
@@ -11267,8 +11281,8 @@ function DailyQuizGame({
|
|
|
11267
11281
|
}) {
|
|
11268
11282
|
const s = ui.games.dailyQuiz;
|
|
11269
11283
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
11270
|
-
const [selections, setSelections] = (0,
|
|
11271
|
-
const [page, setPage] = (0,
|
|
11284
|
+
const [selections, setSelections] = (0, import_react66.useState)(/* @__PURE__ */ new Map());
|
|
11285
|
+
const [page, setPage] = (0, import_react66.useState)(0);
|
|
11272
11286
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
11273
11287
|
const results = clientState?.results ?? [];
|
|
11274
11288
|
const isRevealed = results.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -11378,7 +11392,7 @@ function DailyQuizGame({
|
|
|
11378
11392
|
}
|
|
11379
11393
|
|
|
11380
11394
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
11381
|
-
var
|
|
11395
|
+
var import_react67 = require("react");
|
|
11382
11396
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
11383
11397
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
11384
11398
|
function parseClientState7(json) {
|
|
@@ -11474,12 +11488,12 @@ function MatchdayPredictorGame({
|
|
|
11474
11488
|
onBack
|
|
11475
11489
|
}) {
|
|
11476
11490
|
const t = ui.games.predictor;
|
|
11477
|
-
const [homeScore, setHomeScore] = (0,
|
|
11478
|
-
const [awayScore, setAwayScore] = (0,
|
|
11479
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
11480
|
-
const [lastEdited, setLastEdited] = (0,
|
|
11481
|
-
const [query, setQuery] = (0,
|
|
11482
|
-
const searchId = (0,
|
|
11491
|
+
const [homeScore, setHomeScore] = (0, import_react67.useState)(0);
|
|
11492
|
+
const [awayScore, setAwayScore] = (0, import_react67.useState)(0);
|
|
11493
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react67.useState)(null);
|
|
11494
|
+
const [lastEdited, setLastEdited] = (0, import_react67.useState)("home");
|
|
11495
|
+
const [query, setQuery] = (0, import_react67.useState)("");
|
|
11496
|
+
const searchId = (0, import_react67.useId)();
|
|
11483
11497
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
11484
11498
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
11485
11499
|
const header = /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
@@ -11646,7 +11660,7 @@ function MatchdayPredictorGame({
|
|
|
11646
11660
|
}
|
|
11647
11661
|
|
|
11648
11662
|
// src/components/games/StartingXiGame.tsx
|
|
11649
|
-
var
|
|
11663
|
+
var import_react68 = require("react");
|
|
11650
11664
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
11651
11665
|
var POINTS_PER_STARTER = 8;
|
|
11652
11666
|
var XI_SIZE = 11;
|
|
@@ -11690,10 +11704,10 @@ function StartingXiGame({
|
|
|
11690
11704
|
lockAtUtc
|
|
11691
11705
|
}) {
|
|
11692
11706
|
const t = ui.games.startingXi;
|
|
11693
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
11694
|
-
const [active, setActive] = (0,
|
|
11695
|
-
const [query, setQuery] = (0,
|
|
11696
|
-
const searchId = (0,
|
|
11707
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react68.useState)(() => Array(XI_SIZE).fill(null));
|
|
11708
|
+
const [active, setActive] = (0, import_react68.useState)(0);
|
|
11709
|
+
const [query, setQuery] = (0, import_react68.useState)("");
|
|
11710
|
+
const searchId = (0, import_react68.useId)();
|
|
11697
11711
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
11698
11712
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
11699
11713
|
const header = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
@@ -11832,7 +11846,7 @@ function StartingXiGame({
|
|
|
11832
11846
|
}
|
|
11833
11847
|
|
|
11834
11848
|
// src/components/games/StatLadderGame.tsx
|
|
11835
|
-
var
|
|
11849
|
+
var import_react69 = require("react");
|
|
11836
11850
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
11837
11851
|
function ladderClue(ladder) {
|
|
11838
11852
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -11869,9 +11883,9 @@ function StatLadderGame({
|
|
|
11869
11883
|
onBack
|
|
11870
11884
|
}) {
|
|
11871
11885
|
const t = ui.games.statLadder;
|
|
11872
|
-
const [query, setQuery] = (0,
|
|
11873
|
-
const [selectedId, setSelectedId] = (0,
|
|
11874
|
-
const searchId = (0,
|
|
11886
|
+
const [query, setQuery] = (0, import_react69.useState)("");
|
|
11887
|
+
const [selectedId, setSelectedId] = (0, import_react69.useState)(null);
|
|
11888
|
+
const searchId = (0, import_react69.useId)();
|
|
11875
11889
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
11876
11890
|
const revealed = clientState != null;
|
|
11877
11891
|
const header = /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -12077,8 +12091,8 @@ function GameScreenHost({
|
|
|
12077
12091
|
ui
|
|
12078
12092
|
}) {
|
|
12079
12093
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
12080
|
-
const [configJson, setConfigJson] = (0,
|
|
12081
|
-
(0,
|
|
12094
|
+
const [configJson, setConfigJson] = (0, import_react70.useState)(null);
|
|
12095
|
+
(0, import_react70.useEffect)(() => {
|
|
12082
12096
|
setConfigJson(null);
|
|
12083
12097
|
if (!conversation) return;
|
|
12084
12098
|
let cancelled = false;
|
|
@@ -12101,12 +12115,12 @@ function GameScreenHost({
|
|
|
12101
12115
|
fixtureId: fixtureId || void 0,
|
|
12102
12116
|
locale: ui.games.lang
|
|
12103
12117
|
});
|
|
12104
|
-
(0,
|
|
12118
|
+
(0, import_react70.useEffect)(() => {
|
|
12105
12119
|
if (conversation) hydrate();
|
|
12106
12120
|
}, [conversation, gameId]);
|
|
12107
|
-
const hydrateRef = (0,
|
|
12121
|
+
const hydrateRef = (0, import_react70.useRef)(hydrate);
|
|
12108
12122
|
hydrateRef.current = hydrate;
|
|
12109
|
-
(0,
|
|
12123
|
+
(0, import_react70.useEffect)(() => {
|
|
12110
12124
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
12111
12125
|
if (rawStatus !== "pending") return;
|
|
12112
12126
|
const timerId = setInterval(() => {
|
|
@@ -12219,7 +12233,7 @@ function GameScreenHost({
|
|
|
12219
12233
|
}
|
|
12220
12234
|
|
|
12221
12235
|
// src/components/Leaderboard.tsx
|
|
12222
|
-
var
|
|
12236
|
+
var import_react71 = require("react");
|
|
12223
12237
|
|
|
12224
12238
|
// src/components/LeaderboardRow.tsx
|
|
12225
12239
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -12304,7 +12318,7 @@ function Leaderboard({
|
|
|
12304
12318
|
ui,
|
|
12305
12319
|
onPlay
|
|
12306
12320
|
}) {
|
|
12307
|
-
const [segment, setSegment] = (0,
|
|
12321
|
+
const [segment, setSegment] = (0, import_react71.useState)("weekly");
|
|
12308
12322
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
12309
12323
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
12310
12324
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -12407,9 +12421,9 @@ function GamesPanel({
|
|
|
12407
12421
|
leaderboardLoading,
|
|
12408
12422
|
refreshHub
|
|
12409
12423
|
}) {
|
|
12410
|
-
const [selected, setSelected] = (0,
|
|
12411
|
-
const [segment, setSegment] = (0,
|
|
12412
|
-
(0,
|
|
12424
|
+
const [selected, setSelected] = (0, import_react72.useState)(null);
|
|
12425
|
+
const [segment, setSegment] = (0, import_react72.useState)("play");
|
|
12426
|
+
(0, import_react72.useEffect)(() => {
|
|
12413
12427
|
ensureGamesFonts();
|
|
12414
12428
|
}, []);
|
|
12415
12429
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(GamesLoginWall, { ui });
|
|
@@ -12710,10 +12724,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
12710
12724
|
}
|
|
12711
12725
|
|
|
12712
12726
|
// src/components/PlayerPhoto.tsx
|
|
12713
|
-
var
|
|
12727
|
+
var import_react73 = require("react");
|
|
12714
12728
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
12715
12729
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
12716
|
-
const [failed, setFailed] = (0,
|
|
12730
|
+
const [failed, setFailed] = (0, import_react73.useState)(false);
|
|
12717
12731
|
const box = { width: size, height: size };
|
|
12718
12732
|
if (photoUrl && !failed) {
|
|
12719
12733
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -12748,7 +12762,7 @@ function MiniPitch({ positionCode }) {
|
|
|
12748
12762
|
}
|
|
12749
12763
|
|
|
12750
12764
|
// src/components/PerformanceBars.tsx
|
|
12751
|
-
var
|
|
12765
|
+
var import_react74 = require("react");
|
|
12752
12766
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
12753
12767
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
12754
12768
|
function finite3(v) {
|
|
@@ -12794,7 +12808,7 @@ function unrankedLine(ui, reason) {
|
|
|
12794
12808
|
}
|
|
12795
12809
|
}
|
|
12796
12810
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
12797
|
-
const [mode, setMode] = (0,
|
|
12811
|
+
const [mode, setMode] = (0, import_react74.useState)("total");
|
|
12798
12812
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
12799
12813
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
12800
12814
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -12966,10 +12980,10 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
12966
12980
|
}
|
|
12967
12981
|
|
|
12968
12982
|
// src/components/PresetSpeedDial.tsx
|
|
12969
|
-
var
|
|
12983
|
+
var import_react75 = require("react");
|
|
12970
12984
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
12971
12985
|
function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
|
|
12972
|
-
const pillsId = (0,
|
|
12986
|
+
const pillsId = (0, import_react75.useId)();
|
|
12973
12987
|
const tabIndex = expanded ? 0 : -1;
|
|
12974
12988
|
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { ref: rootRef, className: "ss-w-dial", children: [
|
|
12975
12989
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
|
|
@@ -13003,16 +13017,16 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
|
|
|
13003
13017
|
}
|
|
13004
13018
|
|
|
13005
13019
|
// src/components/PresetTools.tsx
|
|
13006
|
-
var
|
|
13020
|
+
var import_react76 = require("react");
|
|
13007
13021
|
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
13008
13022
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13009
13023
|
function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
13010
|
-
const dialogRef = (0,
|
|
13011
|
-
const titleId = (0,
|
|
13012
|
-
(0,
|
|
13024
|
+
const dialogRef = (0, import_react76.useRef)(null);
|
|
13025
|
+
const titleId = (0, import_react76.useId)();
|
|
13026
|
+
(0, import_react76.useEffect)(() => {
|
|
13013
13027
|
dialogRef.current?.focus();
|
|
13014
13028
|
}, []);
|
|
13015
|
-
(0,
|
|
13029
|
+
(0, import_react76.useEffect)(() => {
|
|
13016
13030
|
const onKey = (e) => {
|
|
13017
13031
|
if (e.key !== "Escape") return;
|
|
13018
13032
|
e.stopPropagation();
|
|
@@ -13054,7 +13068,7 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
|
13054
13068
|
function fillTemplate(template, slots) {
|
|
13055
13069
|
return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
|
|
13056
13070
|
const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
|
|
13057
|
-
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
13071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react76.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
|
|
13058
13072
|
});
|
|
13059
13073
|
}
|
|
13060
13074
|
function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty = true, onChoose }) {
|
|
@@ -13123,15 +13137,15 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13123
13137
|
const totals = comboTotals(grid);
|
|
13124
13138
|
const legChoices = comboLegChoices(grid);
|
|
13125
13139
|
const count = FIXED_SINGLES_COUNT;
|
|
13126
|
-
const [maxPrice, setMaxPrice] = (0,
|
|
13127
|
-
const [minPrice, setMinPrice] = (0,
|
|
13128
|
-
const [start] = (0,
|
|
13129
|
-
const [total, setTotal] = (0,
|
|
13130
|
-
const [legs, setLegs] = (0,
|
|
13131
|
-
const [bigStart] = (0,
|
|
13132
|
-
const [bigTotal, setBigTotal] = (0,
|
|
13133
|
-
const [bigLegs, setBigLegs] = (0,
|
|
13134
|
-
const [announcement, setAnnouncement] = (0,
|
|
13140
|
+
const [maxPrice, setMaxPrice] = (0, import_react76.useState)(() => startSingles(grid.singles, limits, START.maxPrice, count));
|
|
13141
|
+
const [minPrice, setMinPrice] = (0, import_react76.useState)(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
|
|
13142
|
+
const [start] = (0, import_react76.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
|
|
13143
|
+
const [total, setTotal] = (0, import_react76.useState)(start.total);
|
|
13144
|
+
const [legs, setLegs] = (0, import_react76.useState)(start.legs);
|
|
13145
|
+
const [bigStart] = (0, import_react76.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
|
|
13146
|
+
const [bigTotal, setBigTotal] = (0, import_react76.useState)(bigStart.total);
|
|
13147
|
+
const [bigLegs, setBigLegs] = (0, import_react76.useState)(bigStart.legs);
|
|
13148
|
+
const [announcement, setAnnouncement] = (0, import_react76.useState)("");
|
|
13135
13149
|
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
13136
13150
|
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
13137
13151
|
const comboCell = findCombo(grid, total, legs);
|
|
@@ -13175,7 +13189,7 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13175
13189
|
const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
|
|
13176
13190
|
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
13177
13191
|
const markets = grid.markets ?? [];
|
|
13178
|
-
const [marketIdx, setMarketIdx] = (0,
|
|
13192
|
+
const [marketIdx, setMarketIdx] = (0, import_react76.useState)(0);
|
|
13179
13193
|
const marketCell = markets[marketIdx] ?? null;
|
|
13180
13194
|
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
13181
13195
|
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
@@ -13256,14 +13270,14 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13256
13270
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
13257
13271
|
const totals = comboTotals(grid);
|
|
13258
13272
|
const legChoices = comboLegChoices(grid);
|
|
13259
|
-
const [start] = (0,
|
|
13260
|
-
const [total, setTotal] = (0,
|
|
13261
|
-
const [legs, setLegs] = (0,
|
|
13273
|
+
const [start] = (0, import_react76.useState)(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
|
|
13274
|
+
const [total, setTotal] = (0, import_react76.useState)(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
|
|
13275
|
+
const [legs, setLegs] = (0, import_react76.useState)(() => {
|
|
13262
13276
|
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
13263
13277
|
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
13264
13278
|
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
13265
13279
|
});
|
|
13266
|
-
const [announcement, setAnnouncement] = (0,
|
|
13280
|
+
const [announcement, setAnnouncement] = (0, import_react76.useState)("");
|
|
13267
13281
|
const cell2 = findCombo(grid, total, legs);
|
|
13268
13282
|
const minLegs = legChoices[0] ?? legs;
|
|
13269
13283
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -13296,7 +13310,7 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
13296
13310
|
}
|
|
13297
13311
|
|
|
13298
13312
|
// src/usePresetDial.ts
|
|
13299
|
-
var
|
|
13313
|
+
var import_react77 = require("react");
|
|
13300
13314
|
function sendInFlight(messages, isStreaming) {
|
|
13301
13315
|
const last = messages[messages.length - 1];
|
|
13302
13316
|
return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
|
|
@@ -13310,25 +13324,25 @@ function lastUserId(messages) {
|
|
|
13310
13324
|
}
|
|
13311
13325
|
var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
|
|
13312
13326
|
function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
|
|
13313
|
-
const [expanded, setExpanded] = (0,
|
|
13314
|
-
const fold = (0,
|
|
13315
|
-
const toggle = (0,
|
|
13327
|
+
const [expanded, setExpanded] = (0, import_react77.useState)(() => !sendInFlight(messages, isStreaming));
|
|
13328
|
+
const fold = (0, import_react77.useCallback)(() => setExpanded(false), []);
|
|
13329
|
+
const toggle = (0, import_react77.useCallback)(() => setExpanded((e) => !e), []);
|
|
13316
13330
|
const currentUserId = lastUserId(messages);
|
|
13317
|
-
const userIdRef = (0,
|
|
13318
|
-
(0,
|
|
13331
|
+
const userIdRef = (0, import_react77.useRef)(currentUserId);
|
|
13332
|
+
(0, import_react77.useEffect)(() => {
|
|
13319
13333
|
if (currentUserId === userIdRef.current) return;
|
|
13320
13334
|
userIdRef.current = currentUserId;
|
|
13321
13335
|
setExpanded(false);
|
|
13322
13336
|
}, [currentUserId]);
|
|
13323
|
-
const tabRef = (0,
|
|
13324
|
-
(0,
|
|
13337
|
+
const tabRef = (0, import_react77.useRef)(activeTab);
|
|
13338
|
+
(0, import_react77.useEffect)(() => {
|
|
13325
13339
|
if (activeTab === tabRef.current) return;
|
|
13326
13340
|
tabRef.current = activeTab;
|
|
13327
13341
|
setExpanded(false);
|
|
13328
13342
|
}, [activeTab]);
|
|
13329
|
-
const expandedRef = (0,
|
|
13343
|
+
const expandedRef = (0, import_react77.useRef)(expanded);
|
|
13330
13344
|
expandedRef.current = expanded;
|
|
13331
|
-
(0,
|
|
13345
|
+
(0, import_react77.useEffect)(() => {
|
|
13332
13346
|
const onEscape = (e) => {
|
|
13333
13347
|
const dial = dialRef.current;
|
|
13334
13348
|
if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
|
|
@@ -13341,7 +13355,7 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
|
|
|
13341
13355
|
window.addEventListener("keydown", onEscape, true);
|
|
13342
13356
|
return () => window.removeEventListener("keydown", onEscape, true);
|
|
13343
13357
|
}, [dialRef, dialButtonRef]);
|
|
13344
|
-
(0,
|
|
13358
|
+
(0, import_react77.useEffect)(() => {
|
|
13345
13359
|
if (!expanded) return;
|
|
13346
13360
|
const layer = layerRef.current;
|
|
13347
13361
|
const inDial = (e) => {
|
|
@@ -13396,8 +13410,8 @@ function markToolSeen() {
|
|
|
13396
13410
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
13397
13411
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
13398
13412
|
function useIsModal() {
|
|
13399
|
-
const [modal, setModal] = (0,
|
|
13400
|
-
(0,
|
|
13413
|
+
const [modal, setModal] = (0, import_react78.useState)(false);
|
|
13414
|
+
(0, import_react78.useEffect)(() => {
|
|
13401
13415
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
13402
13416
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
13403
13417
|
const sync = () => setModal(mql.matches);
|
|
@@ -13411,12 +13425,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
13411
13425
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
13412
13426
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid }) {
|
|
13413
13427
|
const { state, close, stop, send, reset } = controller;
|
|
13414
|
-
const [squadView, setSquadView] = (0,
|
|
13415
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
13428
|
+
const [squadView, setSquadView] = (0, import_react78.useState)("roster");
|
|
13429
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react78.useState)(null);
|
|
13416
13430
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
13417
13431
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
13418
|
-
const squadLayerRef = (0,
|
|
13419
|
-
const squadScrollRef = (0,
|
|
13432
|
+
const squadLayerRef = (0, import_react78.useRef)(null);
|
|
13433
|
+
const squadScrollRef = (0, import_react78.useRef)(null);
|
|
13420
13434
|
const selectPlayer = (playerId) => {
|
|
13421
13435
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
13422
13436
|
setSelectedPlayerId(playerId);
|
|
@@ -13426,20 +13440,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
13426
13440
|
setSelectedPlayerId(null);
|
|
13427
13441
|
clearPlayerDetail?.();
|
|
13428
13442
|
};
|
|
13429
|
-
(0,
|
|
13443
|
+
(0, import_react78.useLayoutEffect)(() => {
|
|
13430
13444
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
13431
13445
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
13432
13446
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
13433
13447
|
squadScrollRef.current = null;
|
|
13434
13448
|
}, [selectedPlayerId]);
|
|
13435
13449
|
const activeTab = monitor?.activeTab;
|
|
13436
|
-
(0,
|
|
13450
|
+
(0, import_react78.useEffect)(() => {
|
|
13437
13451
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
13438
13452
|
setSelectedPlayerId(null);
|
|
13439
13453
|
clearPlayerDetail?.();
|
|
13440
13454
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
13441
13455
|
const isModal = useIsModal();
|
|
13442
|
-
(0,
|
|
13456
|
+
(0, import_react78.useEffect)(() => {
|
|
13443
13457
|
const onKey = (e) => {
|
|
13444
13458
|
if (e.key === "Escape") close();
|
|
13445
13459
|
};
|
|
@@ -13455,19 +13469,19 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
13455
13469
|
monitor?.setActiveTab("chat");
|
|
13456
13470
|
send(text, { grounding });
|
|
13457
13471
|
};
|
|
13458
|
-
(0,
|
|
13472
|
+
(0, import_react78.useEffect)(() => {
|
|
13459
13473
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
13460
13474
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
13461
13475
|
const onChatTab = !monitor || monitor.activeTab === "chat";
|
|
13462
|
-
const layerRef = (0,
|
|
13463
|
-
const dialRef = (0,
|
|
13464
|
-
const dialButtonRef = (0,
|
|
13465
|
-
const inputRef = (0,
|
|
13466
|
-
const limitRef = (0,
|
|
13467
|
-
const typedSendRef = (0,
|
|
13468
|
-
const focusAfterCloseRef = (0,
|
|
13469
|
-
const [tool, setTool] = (0,
|
|
13470
|
-
const [toolSeen, setToolSeen] = (0,
|
|
13476
|
+
const layerRef = (0, import_react78.useRef)(null);
|
|
13477
|
+
const dialRef = (0, import_react78.useRef)(null);
|
|
13478
|
+
const dialButtonRef = (0, import_react78.useRef)(null);
|
|
13479
|
+
const inputRef = (0, import_react78.useRef)(null);
|
|
13480
|
+
const limitRef = (0, import_react78.useRef)(null);
|
|
13481
|
+
const typedSendRef = (0, import_react78.useRef)(false);
|
|
13482
|
+
const focusAfterCloseRef = (0, import_react78.useRef)(null);
|
|
13483
|
+
const [tool, setTool] = (0, import_react78.useState)(null);
|
|
13484
|
+
const [toolSeen, setToolSeen] = (0, import_react78.useState)(readToolSeen);
|
|
13471
13485
|
const dial = usePresetDial({
|
|
13472
13486
|
layerRef,
|
|
13473
13487
|
dialRef,
|
|
@@ -13479,47 +13493,47 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
13479
13493
|
const { fold } = dial;
|
|
13480
13494
|
const paused = isPaused(state.limit);
|
|
13481
13495
|
const showDial = !!presetGrid && onChatTab && !tool && !paused;
|
|
13482
|
-
(0,
|
|
13496
|
+
(0, import_react78.useEffect)(() => {
|
|
13483
13497
|
if (paused) setTool(null);
|
|
13484
13498
|
}, [paused]);
|
|
13485
|
-
(0,
|
|
13499
|
+
(0, import_react78.useEffect)(() => {
|
|
13486
13500
|
if (!paused) return;
|
|
13487
13501
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
13488
13502
|
typedSendRef.current = false;
|
|
13489
13503
|
}, [paused]);
|
|
13490
|
-
const openTool = (0,
|
|
13504
|
+
const openTool = (0, import_react78.useCallback)((next) => {
|
|
13491
13505
|
fold();
|
|
13492
13506
|
markToolSeen();
|
|
13493
13507
|
setToolSeen(true);
|
|
13494
13508
|
setTool(next);
|
|
13495
13509
|
}, [fold]);
|
|
13496
|
-
const onPill = (0,
|
|
13497
|
-
const toolsValue = (0,
|
|
13510
|
+
const onPill = (0, import_react78.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
|
|
13511
|
+
const toolsValue = (0, import_react78.useMemo)(
|
|
13498
13512
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
13499
13513
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
13500
13514
|
);
|
|
13501
|
-
const closeTool = (0,
|
|
13515
|
+
const closeTool = (0, import_react78.useCallback)(() => {
|
|
13502
13516
|
focusAfterCloseRef.current = "dial";
|
|
13503
13517
|
setTool(null);
|
|
13504
13518
|
}, []);
|
|
13505
|
-
const sendAsk = (0,
|
|
13519
|
+
const sendAsk = (0, import_react78.useCallback)((ask) => {
|
|
13506
13520
|
focusAfterCloseRef.current = "composer";
|
|
13507
13521
|
setTool(null);
|
|
13508
13522
|
monitor?.setActiveTab("chat");
|
|
13509
13523
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset });
|
|
13510
13524
|
}, [monitor, send]);
|
|
13511
|
-
const formatKickoff = (0,
|
|
13525
|
+
const formatKickoff = (0, import_react78.useCallback)((kickoffUtc) => {
|
|
13512
13526
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
13513
13527
|
return `${k.dayLabel} ${k.time}`;
|
|
13514
13528
|
}, [ui]);
|
|
13515
|
-
(0,
|
|
13529
|
+
(0, import_react78.useEffect)(() => {
|
|
13516
13530
|
if (tool) return;
|
|
13517
13531
|
const target = focusAfterCloseRef.current;
|
|
13518
13532
|
focusAfterCloseRef.current = null;
|
|
13519
13533
|
if (target === "dial") dialButtonRef.current?.focus();
|
|
13520
13534
|
else if (target === "composer") inputRef.current?.focus();
|
|
13521
13535
|
}, [tool]);
|
|
13522
|
-
(0,
|
|
13536
|
+
(0, import_react78.useEffect)(() => {
|
|
13523
13537
|
if (!tool || onChatTab && presetGrid) return;
|
|
13524
13538
|
focusAfterCloseRef.current = "composer";
|
|
13525
13539
|
setTool(null);
|
|
@@ -15894,28 +15908,28 @@ function injectStyles(root) {
|
|
|
15894
15908
|
function StatsWidget(props) {
|
|
15895
15909
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
15896
15910
|
const cfg = props.config;
|
|
15897
|
-
const built = (0,
|
|
15898
|
-
const logger = (0,
|
|
15911
|
+
const built = (0, import_react79.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
15912
|
+
const logger = (0, import_react79.useMemo)(
|
|
15899
15913
|
() => built ? built.client.createEventLogger({
|
|
15900
15914
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
15901
15915
|
anonymousUserId: cfg?.userContext?.anonymousUserId
|
|
15902
15916
|
}) : null,
|
|
15903
15917
|
[built?.client]
|
|
15904
15918
|
);
|
|
15905
|
-
const ui = (0,
|
|
15906
|
-
const rootRef = (0,
|
|
15907
|
-
const introDoneRef = (0,
|
|
15908
|
-
const markIntroDone = (0,
|
|
15919
|
+
const ui = (0, import_react79.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
15920
|
+
const rootRef = (0, import_react79.useRef)(null);
|
|
15921
|
+
const introDoneRef = (0, import_react79.useRef)(false);
|
|
15922
|
+
const markIntroDone = (0, import_react79.useCallback)(() => {
|
|
15909
15923
|
introDoneRef.current = true;
|
|
15910
15924
|
}, []);
|
|
15911
15925
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
|
|
15912
|
-
const sportScope = (0,
|
|
15926
|
+
const sportScope = (0, import_react79.useMemo)(
|
|
15913
15927
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
15914
15928
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
15915
15929
|
);
|
|
15916
15930
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope);
|
|
15917
|
-
const [hasToday, setHasToday] = (0,
|
|
15918
|
-
const liveCardWatches = (0,
|
|
15931
|
+
const [hasToday, setHasToday] = (0, import_react79.useState)(false);
|
|
15932
|
+
const liveCardWatches = (0, import_react79.useMemo)(() => {
|
|
15919
15933
|
const seen = /* @__PURE__ */ new Set();
|
|
15920
15934
|
const out = [];
|
|
15921
15935
|
for (const msg of controller.state.messages) {
|
|
@@ -15942,19 +15956,19 @@ function StatsWidget(props) {
|
|
|
15942
15956
|
});
|
|
15943
15957
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
15944
15958
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
15945
|
-
const getSchedule = (0,
|
|
15959
|
+
const getSchedule = (0, import_react79.useCallback)(
|
|
15946
15960
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
15947
15961
|
[built, operatorUserId, anonymousUserId]
|
|
15948
15962
|
);
|
|
15949
|
-
const postLeagueStar = (0,
|
|
15963
|
+
const postLeagueStar = (0, import_react79.useCallback)(
|
|
15950
15964
|
(competitionId, starred) => built ? built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
15951
15965
|
[built, operatorUserId, anonymousUserId]
|
|
15952
15966
|
);
|
|
15953
|
-
const getStates = (0,
|
|
15967
|
+
const getStates = (0, import_react79.useCallback)(
|
|
15954
15968
|
(matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
|
|
15955
15969
|
[built]
|
|
15956
15970
|
);
|
|
15957
|
-
const pinnedMatchIds = (0,
|
|
15971
|
+
const pinnedMatchIds = (0, import_react79.useMemo)(
|
|
15958
15972
|
() => footballMatchPinIds(monitor.pins),
|
|
15959
15973
|
[monitor.pins]
|
|
15960
15974
|
);
|
|
@@ -15969,11 +15983,11 @@ function StatsWidget(props) {
|
|
|
15969
15983
|
pinnedMatchIds
|
|
15970
15984
|
});
|
|
15971
15985
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
15972
|
-
(0,
|
|
15986
|
+
(0, import_react79.useEffect)(() => {
|
|
15973
15987
|
setHasToday(todayHasContent);
|
|
15974
15988
|
}, [todayHasContent]);
|
|
15975
|
-
const prevLiveSnapshotRef = (0,
|
|
15976
|
-
(0,
|
|
15989
|
+
const prevLiveSnapshotRef = (0, import_react79.useRef)(monitor.snapshot);
|
|
15990
|
+
(0, import_react79.useEffect)(() => {
|
|
15977
15991
|
const snap = monitor.snapshot;
|
|
15978
15992
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
15979
15993
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -16013,14 +16027,14 @@ function StatsWidget(props) {
|
|
|
16013
16027
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
16014
16028
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
16015
16029
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
16016
|
-
const getPricePresets = (0,
|
|
16030
|
+
const getPricePresets = (0, import_react79.useCallback)(
|
|
16017
16031
|
(locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
|
|
16018
16032
|
[built]
|
|
16019
16033
|
);
|
|
16020
16034
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
16021
16035
|
const markTodayActivity = monitor.markTodayActivity;
|
|
16022
|
-
const prevLiveCountRef = (0,
|
|
16023
|
-
(0,
|
|
16036
|
+
const prevLiveCountRef = (0, import_react79.useRef)(0);
|
|
16037
|
+
(0, import_react79.useEffect)(() => {
|
|
16024
16038
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
16025
16039
|
prevLiveCountRef.current = discovery.liveCount;
|
|
16026
16040
|
if (rose) markTodayActivity();
|
|
@@ -16034,7 +16048,7 @@ function StatsWidget(props) {
|
|
|
16034
16048
|
closePanel: controller.close
|
|
16035
16049
|
});
|
|
16036
16050
|
const markAdded = hostEvents.markAdded;
|
|
16037
|
-
const slip = (0,
|
|
16051
|
+
const slip = (0, import_react79.useMemo)(
|
|
16038
16052
|
() => {
|
|
16039
16053
|
const handler = props.config?.onAddToSlip;
|
|
16040
16054
|
return {
|
|
@@ -16054,7 +16068,7 @@ function StatsWidget(props) {
|
|
|
16054
16068
|
},
|
|
16055
16069
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
16056
16070
|
);
|
|
16057
|
-
const onDashboardTap = (0,
|
|
16071
|
+
const onDashboardTap = (0, import_react79.useMemo)(
|
|
16058
16072
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
16059
16073
|
[built, logger]
|
|
16060
16074
|
);
|
|
@@ -16071,11 +16085,11 @@ function StatsWidget(props) {
|
|
|
16071
16085
|
})
|
|
16072
16086
|
}));
|
|
16073
16087
|
const conversationId = controller.state.conversationId ?? void 0;
|
|
16074
|
-
(0,
|
|
16088
|
+
(0, import_react79.useEffect)(() => {
|
|
16075
16089
|
if (!logger) return;
|
|
16076
16090
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
16077
16091
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
16078
|
-
(0,
|
|
16092
|
+
(0, import_react79.useEffect)(() => {
|
|
16079
16093
|
if (!logger) return;
|
|
16080
16094
|
logger.resume();
|
|
16081
16095
|
const onHide = () => {
|
|
@@ -16093,7 +16107,7 @@ function StatsWidget(props) {
|
|
|
16093
16107
|
logger.dispose();
|
|
16094
16108
|
};
|
|
16095
16109
|
}, [logger]);
|
|
16096
|
-
(0,
|
|
16110
|
+
(0, import_react79.useEffect)(() => {
|
|
16097
16111
|
if (!built || !ui.injectStyles) return;
|
|
16098
16112
|
const node = rootRef.current?.getRootNode();
|
|
16099
16113
|
if (node) injectStyles(node);
|