@sensiblestats/widget-react 0.103.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/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 import_react78 = require("react");
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.103.0";
1211
+ var WIDGET_REACT_VERSION = "0.105.0";
1212
1212
 
1213
1213
  // src/config.ts
1214
1214
  function normalizeUi(cfg) {
@@ -4636,6 +4636,9 @@ var DASHBOARD_EMOJI = {
4636
4636
  plus: "\u2795",
4637
4637
  scale: "\u2696\uFE0F",
4638
4638
  rebound: "\u{1F64C}",
4639
+ gridiron: "\u{1F3C8}",
4640
+ run: "\u{1F3C3}",
4641
+ catch: "\u{1F9E4}",
4639
4642
  assist: "\u{1F91D}",
4640
4643
  injury: "\u{1FA79}",
4641
4644
  stopwatch: "\u23F1\uFE0F",
@@ -4701,7 +4704,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
4701
4704
  }
4702
4705
 
4703
4706
  // src/components/ChatPanel.tsx
4704
- var import_react77 = require("react");
4707
+ var import_react78 = require("react");
4705
4708
 
4706
4709
  // src/components/ChatHeader.tsx
4707
4710
  var import_react21 = require("react");
@@ -4780,6 +4783,9 @@ function ChatHeader({
4780
4783
  }
4781
4784
 
4782
4785
  // src/components/MessageList.tsx
4786
+ var import_react46 = require("react");
4787
+
4788
+ // src/components/ChatMessage.tsx
4783
4789
  var import_react45 = require("react");
4784
4790
 
4785
4791
  // src/components/Markdown.tsx
@@ -6803,16 +6809,23 @@ var LAYOUT_CLASSES = {
6803
6809
  function layoutClass(layout) {
6804
6810
  return Object.prototype.hasOwnProperty.call(LAYOUT_CLASSES, layout) ? LAYOUT_CLASSES[layout] : LAYOUT_CLASSES.goal;
6805
6811
  }
6806
- function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, oddsLabel, liveLabel: liveLabel3, sportGroupLabel }) {
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 }) {
6807
6819
  const log = useEventLog();
6808
6820
  const scope = useSportScope();
6809
- const sets = dashboards && dashboards.length >= 2 ? dashboards : null;
6810
- const [selected, setSelected] = (0, import_react37.useState)(() => (sets?.some((s) => s.sport === defaultSport) ? defaultSport : sets?.[0]?.sport) ?? "");
6821
+ const sets = switchSets(dashboards);
6822
+ const [selected, setSelected] = (0, import_react37.useState)(() => initialSport(sets, defaultSport));
6811
6823
  const active = sets?.find((s) => s.sport === selected) ?? null;
6812
6824
  const shown = active ? active.dashboard : dashboard;
6813
6825
  const select = (sport) => {
6814
6826
  if (sport === selected) return;
6815
6827
  setSelected(sport);
6828
+ onSportChange?.(sport);
6816
6829
  if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
6817
6830
  log?.log({ name: "dashboard_sport_switch", outcome: sport });
6818
6831
  };
@@ -7651,6 +7664,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
7651
7664
  // src/components/ChatMessage.tsx
7652
7665
  var import_jsx_runtime49 = require("react/jsx-runtime");
7653
7666
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7667
+ const [sport, setSport] = (0, import_react45.useState)(null);
7654
7668
  if (message.role === "user") {
7655
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 }) });
7656
7670
  }
@@ -7658,9 +7672,12 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7658
7672
  onAct({ message: card.actionLabel, actionRef: card.actionRef, label: card.actionLabel || card.title || "" });
7659
7673
  };
7660
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;
7661
7678
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ss-w-msg ss-w-bot", "data-msg-id": message.id, children: [
7662
7679
  message.text && !message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Markdown, { text: message.text }) : null,
7663
- 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,
7664
7681
  message.clubFanDashboard ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
7665
7682
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
7666
7683
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
@@ -7669,7 +7686,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
7669
7686
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
7670
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 }),
7671
7688
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
7672
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions: message.actions, loading: false, disabled, onAct })
7689
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ActionButtons, { actions, loading: false, disabled, onAct })
7673
7690
  ] });
7674
7691
  }
7675
7692
 
@@ -7696,11 +7713,11 @@ function turnAnchor(messages) {
7696
7713
  }
7697
7714
  function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
7698
7715
  const { state, send } = controller;
7699
- const listRef = (0, import_react45.useRef)(null);
7700
- const endRef = (0, import_react45.useRef)(null);
7701
- const pinnedRef = (0, import_react45.useRef)(true);
7702
- const anchoredTurnRef = (0, import_react45.useRef)(null);
7703
- (0, import_react45.useEffect)(() => {
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)(() => {
7704
7721
  const anchor = turnAnchor(state.messages);
7705
7722
  const list = listRef.current;
7706
7723
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -7757,13 +7774,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
7757
7774
  }
7758
7775
 
7759
7776
  // src/components/ChatInput.tsx
7760
- var import_react46 = require("react");
7777
+ var import_react47 = require("react");
7761
7778
  var import_jsx_runtime52 = require("react/jsx-runtime");
7762
- var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
7763
- const [value, setValue] = (0, import_react46.useState)("");
7764
- const textareaRef = (0, import_react46.useRef)(null);
7765
- const stopRef = (0, import_react46.useRef)(null);
7766
- const textBoxWantsFocusRef = (0, import_react46.useRef)(false);
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);
7767
7784
  const submit = () => {
7768
7785
  if (disabled) return;
7769
7786
  const t = value.trim();
@@ -7777,7 +7794,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7777
7794
  submit();
7778
7795
  }
7779
7796
  };
7780
- (0, import_react46.useImperativeHandle)(ref, () => ({
7797
+ (0, import_react47.useImperativeHandle)(ref, () => ({
7781
7798
  focus() {
7782
7799
  const box = textareaRef.current;
7783
7800
  if (box && !box.disabled) {
@@ -7789,7 +7806,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7789
7806
  stopRef.current?.focus();
7790
7807
  }
7791
7808
  }), []);
7792
- (0, import_react46.useEffect)(() => {
7809
+ (0, import_react47.useEffect)(() => {
7793
7810
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
7794
7811
  textBoxWantsFocusRef.current = false;
7795
7812
  const box = textareaRef.current;
@@ -7821,7 +7838,7 @@ var ChatInput = (0, import_react46.forwardRef)(function ChatInput2({ placeholder
7821
7838
  });
7822
7839
 
7823
7840
  // src/components/TabBar.tsx
7824
- var import_react47 = require("react");
7841
+ var import_react48 = require("react");
7825
7842
  var import_jsx_runtime53 = require("react/jsx-runtime");
7826
7843
  function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, gamesEnabled, clubEnabled }) {
7827
7844
  const tabs = [
@@ -7837,9 +7854,9 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
7837
7854
  ],
7838
7855
  ...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
7839
7856
  ];
7840
- const listRef = (0, import_react47.useRef)(null);
7857
+ const listRef = (0, import_react48.useRef)(null);
7841
7858
  const activeTab = monitor.activeTab;
7842
- (0, import_react47.useEffect)(() => {
7859
+ (0, import_react48.useEffect)(() => {
7843
7860
  const el = listRef.current?.querySelector("[data-on]");
7844
7861
  if (!el || typeof el.scrollIntoView !== "function") return;
7845
7862
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -7869,7 +7886,7 @@ function TabBar({ monitor, ui, matchCount, oddsCount, todayCount, hasToday, game
7869
7886
  }
7870
7887
 
7871
7888
  // src/components/MonitorTabs.tsx
7872
- var import_react52 = require("react");
7889
+ var import_react53 = require("react");
7873
7890
 
7874
7891
  // src/components/MarketAccordion.tsx
7875
7892
  var import_widget_sdk22 = require("@sensiblestats/widget-sdk");
@@ -7931,10 +7948,10 @@ function MarketAccordion({ match, monitor, ui, slip }) {
7931
7948
  }
7932
7949
 
7933
7950
  // src/components/LiveFactBlock.tsx
7934
- var import_react48 = require("react");
7951
+ var import_react49 = require("react");
7935
7952
  var import_jsx_runtime55 = require("react/jsx-runtime");
7936
7953
  function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
7937
- const [expanded, setExpanded] = (0, import_react48.useState)(false);
7954
+ const [expanded, setExpanded] = (0, import_react49.useState)(false);
7938
7955
  const [current, ...earlier] = facts;
7939
7956
  if (!current) return null;
7940
7957
  const m = current.market;
@@ -8002,7 +8019,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
8002
8019
  }
8003
8020
 
8004
8021
  // src/components/MonitorFormH2H.tsx
8005
- var import_react49 = require("react");
8022
+ var import_react50 = require("react");
8006
8023
  var import_jsx_runtime56 = require("react/jsx-runtime");
8007
8024
  function resultClass2(result) {
8008
8025
  if (result === "W") return "ss-w-h2h-result--win";
@@ -8018,7 +8035,7 @@ function FormDots({ form, ui }) {
8018
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)) });
8019
8036
  }
8020
8037
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
8021
- const [expanded, setExpanded] = (0, import_react49.useState)(false);
8038
+ const [expanded, setExpanded] = (0, import_react50.useState)(false);
8022
8039
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
8023
8040
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
8024
8041
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, {});
@@ -8251,7 +8268,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
8251
8268
  var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
8252
8269
 
8253
8270
  // src/components/NbaPropsSection.tsx
8254
- var import_react50 = require("react");
8271
+ var import_react51 = require("react");
8255
8272
  var import_jsx_runtime59 = require("react/jsx-runtime");
8256
8273
  var STAT_ORDER = ["points", "rebounds", "assists", "threes"];
8257
8274
  var MAX_TIMER_MS = 2147483647;
@@ -8313,7 +8330,7 @@ function Last5({ games, stat, line, ui }) {
8313
8330
  }
8314
8331
  function PlayerPanel({ player, bundle, ui, slip }) {
8315
8332
  const stats = STAT_ORDER.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
8316
- const [picked, setPicked] = (0, import_react50.useState)(null);
8333
+ const [picked, setPicked] = (0, import_react51.useState)(null);
8317
8334
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
8318
8335
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ss-w-props-panel", children: [
8319
8336
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-chips", children: stats.map((s) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
@@ -8350,7 +8367,7 @@ function PlayerPanel({ player, bundle, ui, slip }) {
8350
8367
  ] });
8351
8368
  }
8352
8369
  function Roster({ bundle, players, side, ui, slip }) {
8353
- const [openId, setOpenId] = (0, import_react50.useState)(null);
8370
+ const [openId, setOpenId] = (0, import_react51.useState)(null);
8354
8371
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ss-w-props-list", children: players.map((p) => {
8355
8372
  const isOpen = openId === p.playerId;
8356
8373
  const main = p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine);
@@ -8381,15 +8398,15 @@ function Roster({ bundle, players, side, ui, slip }) {
8381
8398
  }) });
8382
8399
  }
8383
8400
  function NbaPropsSection({ match, monitor, ui, slip }) {
8384
- const [side, setSide] = (0, import_react50.useState)("home");
8385
- const [, setTick] = (0, import_react50.useState)(0);
8401
+ const [side, setSide] = (0, import_react51.useState)("home");
8402
+ const [, setTick] = (0, import_react51.useState)(0);
8386
8403
  const pre = preTip(match);
8387
8404
  const live = match.phase === "live";
8388
8405
  const open = pre || live;
8389
- (0, import_react50.useEffect)(() => {
8406
+ (0, import_react51.useEffect)(() => {
8390
8407
  if (open) monitor.loadPlayerProps?.(match.matchId);
8391
8408
  }, [match.matchId, match.asOfUtc, open]);
8392
- (0, import_react50.useEffect)(() => {
8409
+ (0, import_react51.useEffect)(() => {
8393
8410
  if (!pre || !match.kickoffUtc) return;
8394
8411
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
8395
8412
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -8614,7 +8631,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
8614
8631
  }
8615
8632
 
8616
8633
  // src/components/ScoreboardStrip.tsx
8617
- var import_react51 = require("react");
8634
+ var import_react52 = require("react");
8618
8635
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
8619
8636
  var import_jsx_runtime62 = require("react/jsx-runtime");
8620
8637
  function nbaStatus(m, ui) {
@@ -8689,8 +8706,8 @@ function rowsFor(m) {
8689
8706
  ];
8690
8707
  }
8691
8708
  function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
8692
- const stripRef = (0, import_react51.useRef)(null);
8693
- (0, import_react51.useEffect)(() => {
8709
+ const stripRef = (0, import_react52.useRef)(null);
8710
+ (0, import_react52.useEffect)(() => {
8694
8711
  const strip = stripRef.current;
8695
8712
  const pressed = strip?.querySelector('[aria-pressed="true"]');
8696
8713
  if (!strip || !pressed) return;
@@ -8802,7 +8819,7 @@ function OddsLiveStrip({ m, ui }) {
8802
8819
  ] });
8803
8820
  }
8804
8821
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
8805
- const seedIndex = (0, import_react52.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
8822
+ const seedIndex = (0, import_react53.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
8806
8823
  const tiles = orderTiles(
8807
8824
  monitor.pins,
8808
8825
  monitor.snapshot,
@@ -8868,7 +8885,7 @@ function OddsPanel({ monitor, ui, slip }) {
8868
8885
  }
8869
8886
 
8870
8887
  // src/components/TodayPanel.tsx
8871
- var import_react56 = require("react");
8888
+ var import_react57 = require("react");
8872
8889
  var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
8873
8890
 
8874
8891
  // src/placement.ts
@@ -8933,11 +8950,11 @@ function matchingFixtures(group, query) {
8933
8950
  }
8934
8951
 
8935
8952
  // src/useStarTap.ts
8936
- var import_react53 = require("react");
8953
+ var import_react54 = require("react");
8937
8954
  function useStarTap(starLeague) {
8938
- const [pendingId, setPendingId] = (0, import_react53.useState)(null);
8939
- const pendingRef = (0, import_react53.useRef)(null);
8940
- const tap = (0, import_react53.useCallback)(async (competitionId, next) => {
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) => {
8941
8958
  if (pendingRef.current !== null) return false;
8942
8959
  pendingRef.current = competitionId;
8943
8960
  setPendingId(competitionId);
@@ -8996,7 +9013,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
8996
9013
  }
8997
9014
 
8998
9015
  // src/components/LeagueDetail.tsx
8999
- var import_react54 = require("react");
9016
+ var import_react55 = require("react");
9000
9017
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
9001
9018
 
9002
9019
  // src/components/FixtureRow.tsx
@@ -9059,11 +9076,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
9059
9076
  var import_jsx_runtime66 = require("react/jsx-runtime");
9060
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";
9061
9078
  function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
9062
- const [toast, setToast] = (0, import_react54.useState)(null);
9063
- (0, import_react54.useEffect)(() => {
9079
+ const [toast, setToast] = (0, import_react55.useState)(null);
9080
+ (0, import_react55.useEffect)(() => {
9064
9081
  setToast(null);
9065
9082
  }, [group.competitionId]);
9066
- (0, import_react54.useEffect)(() => {
9083
+ (0, import_react55.useEffect)(() => {
9067
9084
  if (toast === null) return;
9068
9085
  const id = setTimeout(() => setToast(null), 4e3);
9069
9086
  return () => clearTimeout(id);
@@ -9216,7 +9233,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
9216
9233
  }
9217
9234
 
9218
9235
  // src/components/games/ui/SearchField.tsx
9219
- var import_react55 = require("react");
9236
+ var import_react56 = require("react");
9220
9237
 
9221
9238
  // src/components/games/ui/icons.tsx
9222
9239
  var import_jsx_runtime68 = require("react/jsx-runtime");
@@ -9255,8 +9272,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
9255
9272
  // src/components/games/ui/SearchField.tsx
9256
9273
  var import_jsx_runtime69 = require("react/jsx-runtime");
9257
9274
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
9258
- const localRef = (0, import_react55.useRef)(null);
9259
- const setInputRef = (0, import_react55.useCallback)((node) => {
9275
+ const localRef = (0, import_react56.useRef)(null);
9276
+ const setInputRef = (0, import_react56.useCallback)((node) => {
9260
9277
  localRef.current = node;
9261
9278
  if (typeof inputRef === "function") inputRef(node);
9262
9279
  else if (inputRef) inputRef.current = node;
@@ -9300,23 +9317,23 @@ function SearchField({ id, label, labelHidden = false, placeholder, value, onCha
9300
9317
  var import_jsx_runtime70 = require("react/jsx-runtime");
9301
9318
  function TodayPanel({ discovery, ui, monitor }) {
9302
9319
  const { groups, states, stale, starLeague } = discovery;
9303
- const searchId = (0, import_react56.useId)();
9304
- const [query, setQuery] = (0, import_react56.useState)("");
9305
- const [selectedCompetitionId, setSelectedCompetitionId] = (0, import_react56.useState)(null);
9306
- const [toast, setToast] = (0, import_react56.useState)(null);
9307
- (0, import_react56.useEffect)(() => {
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)(() => {
9308
9325
  if (toast === null) return;
9309
9326
  const id = setTimeout(() => setToast(null), 4e3);
9310
9327
  return () => clearTimeout(id);
9311
9328
  }, [toast]);
9312
9329
  const visibleGroups = visibleGroupsOf(groups, states);
9313
- const pinnedMatchIds = (0, import_react56.useMemo)(
9330
+ const pinnedMatchIds = (0, import_react57.useMemo)(
9314
9331
  () => footballMatchPinIds(monitor.pins),
9315
9332
  [monitor.pins]
9316
9333
  );
9317
- const placement = (0, import_react56.useMemo)(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
9334
+ const placement = (0, import_react57.useMemo)(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
9318
9335
  const starTap = useStarTap(starLeague);
9319
- const gridStarTap = (0, import_react56.useMemo)(() => ({
9336
+ const gridStarTap = (0, import_react57.useMemo)(() => ({
9320
9337
  pendingId: starTap.pendingId,
9321
9338
  tap: async (competitionId, next) => {
9322
9339
  const ok = await starTap.tap(competitionId, next);
@@ -9350,7 +9367,7 @@ function TodayPanel({ discovery, ui, monitor }) {
9350
9367
  }
9351
9368
  const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
9352
9369
  const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
9353
- (0, import_react56.useEffect)(() => {
9370
+ (0, import_react57.useEffect)(() => {
9354
9371
  if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
9355
9372
  }, [selectedCompetitionId, openGroup]);
9356
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);
@@ -9506,7 +9523,7 @@ function TodayPanel({ discovery, ui, monitor }) {
9506
9523
  }
9507
9524
 
9508
9525
  // src/components/GamesPanel.tsx
9509
- var import_react71 = require("react");
9526
+ var import_react72 = require("react");
9510
9527
 
9511
9528
  // src/components/GamesLoginWall.tsx
9512
9529
  var import_jsx_runtime71 = require("react/jsx-runtime");
@@ -9515,7 +9532,7 @@ function GamesLoginWall({ ui }) {
9515
9532
  }
9516
9533
 
9517
9534
  // src/components/GamesHub.tsx
9518
- var import_react57 = require("react");
9535
+ var import_react58 = require("react");
9519
9536
 
9520
9537
  // src/components/games/ui/gameMeta.ts
9521
9538
  function prettifyGameId(gameId) {
@@ -9666,8 +9683,8 @@ function pickHeroGame(games) {
9666
9683
  }
9667
9684
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
9668
9685
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
9669
- const [, setTick] = (0, import_react57.useState)(0);
9670
- (0, import_react57.useEffect)(() => {
9686
+ const [, setTick] = (0, import_react58.useState)(0);
9687
+ (0, import_react58.useEffect)(() => {
9671
9688
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
9672
9689
  return () => clearInterval(id);
9673
9690
  }, []);
@@ -9727,10 +9744,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
9727
9744
  }
9728
9745
 
9729
9746
  // src/components/GameScreenHost.tsx
9730
- var import_react69 = require("react");
9747
+ var import_react70 = require("react");
9731
9748
 
9732
9749
  // src/useGamePlay.ts
9733
- var import_react58 = require("react");
9750
+ var import_react59 = require("react");
9734
9751
  function toSubmitResult(payload) {
9735
9752
  return {
9736
9753
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -9742,17 +9759,17 @@ function toSubmitResult(payload) {
9742
9759
  };
9743
9760
  }
9744
9761
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
9745
- const [result, setResult] = (0, import_react58.useState)(null);
9746
- const [submitting, setSubmitting] = (0, import_react58.useState)(false);
9747
- const [rawStatus, setRawStatus] = (0, import_react58.useState)(null);
9748
- const inFlightRef = (0, import_react58.useRef)(false);
9749
- const convRef = (0, import_react58.useRef)(conversation);
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);
9750
9767
  convRef.current = conversation;
9751
- const optsRef = (0, import_react58.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
9768
+ const optsRef = (0, import_react59.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
9752
9769
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
9753
- const resultRef = (0, import_react58.useRef)(null);
9770
+ const resultRef = (0, import_react59.useRef)(null);
9754
9771
  resultRef.current = result;
9755
- const refetch = (0, import_react58.useCallback)(async () => {
9772
+ const refetch = (0, import_react59.useCallback)(async () => {
9756
9773
  const conv = convRef.current;
9757
9774
  if (!conv) return;
9758
9775
  const opts = optsRef.current;
@@ -9768,7 +9785,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
9768
9785
  } catch {
9769
9786
  }
9770
9787
  }, []);
9771
- const submit = (0, import_react58.useCallback)(async (answerJson) => {
9788
+ const submit = (0, import_react59.useCallback)(async (answerJson) => {
9772
9789
  const conv = convRef.current;
9773
9790
  if (!conv || inFlightRef.current) return;
9774
9791
  inFlightRef.current = true;
@@ -9795,14 +9812,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
9795
9812
  setSubmitting(false);
9796
9813
  }
9797
9814
  }, [refetch]);
9798
- const hydrate = (0, import_react58.useCallback)(() => {
9815
+ const hydrate = (0, import_react59.useCallback)(() => {
9799
9816
  void refetch();
9800
9817
  }, [refetch]);
9801
9818
  return { result, submitting, submit, hydrate, rawStatus };
9802
9819
  }
9803
9820
 
9804
9821
  // src/components/games/MysteryTigerGame.tsx
9805
- var import_react60 = require("react");
9822
+ var import_react61 = require("react");
9806
9823
 
9807
9824
  // src/components/games/nationFlags.ts
9808
9825
  var FLAGS = {
@@ -10013,7 +10030,7 @@ function isNationCode(flag) {
10013
10030
  }
10014
10031
 
10015
10032
  // src/components/games/PlayerAvatar.tsx
10016
- var import_react59 = require("react");
10033
+ var import_react60 = require("react");
10017
10034
  var import_jsx_runtime76 = require("react/jsx-runtime");
10018
10035
  function initialsOf(name) {
10019
10036
  const parts = name.trim().split(/\s+/).filter(Boolean);
@@ -10031,7 +10048,7 @@ function PlayerAvatar({
10031
10048
  imagePath,
10032
10049
  className
10033
10050
  }) {
10034
- const [failed, setFailed] = (0, import_react59.useState)(false);
10051
+ const [failed, setFailed] = (0, import_react60.useState)(false);
10035
10052
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
10036
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) }) });
10037
10054
  }
@@ -10272,8 +10289,8 @@ function MysteryTigerGame({
10272
10289
  onBack
10273
10290
  }) {
10274
10291
  const t = ui.games.mysteryTiger;
10275
- const [query, setQuery] = (0, import_react60.useState)("");
10276
- const inputId = (0, import_react60.useId)();
10292
+ const [query, setQuery] = (0, import_react61.useState)("");
10293
+ const inputId = (0, import_react61.useId)();
10277
10294
  const clientState = parseClientState(result?.clientStateJson);
10278
10295
  const guessResults = clientState?.guessResults ?? [];
10279
10296
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -10534,13 +10551,13 @@ function HigherOrLowerGame({
10534
10551
  }
10535
10552
 
10536
10553
  // src/components/games/CareerPathGame.tsx
10537
- var import_react62 = require("react");
10554
+ var import_react63 = require("react");
10538
10555
 
10539
10556
  // src/components/games/ui/CrestShield.tsx
10540
- var import_react61 = require("react");
10557
+ var import_react62 = require("react");
10541
10558
  var import_jsx_runtime87 = require("react/jsx-runtime");
10542
10559
  function CrestShield({ src, name, size = 28 }) {
10543
- const [failed, setFailed] = (0, import_react61.useState)(false);
10560
+ const [failed, setFailed] = (0, import_react62.useState)(false);
10544
10561
  if (src && !isPlaceholderImage(src) && !failed) {
10545
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) });
10546
10563
  }
@@ -10572,8 +10589,8 @@ function CareerPathGame({
10572
10589
  }) {
10573
10590
  const s = ui.games.careerPath;
10574
10591
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
10575
- const [query, setQuery] = (0, import_react62.useState)("");
10576
- const inputId = (0, import_react62.useId)();
10592
+ const [query, setQuery] = (0, import_react63.useState)("");
10593
+ const inputId = (0, import_react63.useId)();
10577
10594
  const clientState = parseClientState3(result?.clientStateJson);
10578
10595
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
10579
10596
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -10679,7 +10696,7 @@ function CareerPathGame({
10679
10696
  }
10680
10697
 
10681
10698
  // src/components/games/BeatTheGridGame.tsx
10682
- var import_react63 = __toESM(require("react"), 1);
10699
+ var import_react64 = __toESM(require("react"), 1);
10683
10700
 
10684
10701
  // src/components/games/ui/OptionList.tsx
10685
10702
  var import_jsx_runtime89 = require("react/jsx-runtime");
@@ -10768,10 +10785,10 @@ function SearchSheet({
10768
10785
  ui
10769
10786
  }) {
10770
10787
  const s = ui.games.beatTheGrid;
10771
- const [query, setQuery] = (0, import_react63.useState)("");
10772
- const inputId = (0, import_react63.useId)();
10773
- const inputRef = (0, import_react63.useRef)(null);
10774
- (0, import_react63.useEffect)(() => {
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)(() => {
10775
10792
  inputRef.current?.focus();
10776
10793
  }, [row, col]);
10777
10794
  const filtered = playerPool.filter(
@@ -10836,7 +10853,7 @@ function BeatTheGridGame({
10836
10853
  }) {
10837
10854
  const s = ui.games.beatTheGrid;
10838
10855
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
10839
- const [activeCell, setActiveCell] = (0, import_react63.useState)(null);
10856
+ const [activeCell, setActiveCell] = (0, import_react64.useState)(null);
10840
10857
  const clientState = parseClientState4(result?.clientStateJson);
10841
10858
  const filledCells = clientState?.cells ?? [];
10842
10859
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -10910,7 +10927,7 @@ function BeatTheGridGame({
10910
10927
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { "aria-hidden": "true", children: abbr }),
10911
10928
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "ss-g-sr", children: rowLabel })
10912
10929
  ] });
10913
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_react63.default.Fragment, { children: [
10930
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_react64.default.Fragment, { children: [
10914
10931
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
10915
10932
  cols.map((colLabel, colIdx) => {
10916
10933
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -10991,7 +11008,7 @@ function BeatTheGridGame({
10991
11008
  }
10992
11009
 
10993
11010
  // src/components/games/GuessTheXiGame.tsx
10994
- var import_react64 = require("react");
11011
+ var import_react65 = require("react");
10995
11012
 
10996
11013
  // src/components/games/ui/PitchSvg.tsx
10997
11014
  var import_jsx_runtime91 = require("react/jsx-runtime");
@@ -11080,8 +11097,8 @@ function GuessTheXiGame({
11080
11097
  onBack
11081
11098
  }) {
11082
11099
  const t = ui.games.guessTheXi;
11083
- const [query, setQuery] = (0, import_react64.useState)("");
11084
- const inputId = (0, import_react64.useId)();
11100
+ const [query, setQuery] = (0, import_react65.useState)("");
11101
+ const inputId = (0, import_react65.useId)();
11085
11102
  const clientState = parseClientState5(result?.clientStateJson);
11086
11103
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
11087
11104
  const solved = clientState?.status === "solved";
@@ -11223,7 +11240,7 @@ function GuessTheXiGame({
11223
11240
  }
11224
11241
 
11225
11242
  // src/components/games/DailyQuizGame.tsx
11226
- var import_react65 = require("react");
11243
+ var import_react66 = require("react");
11227
11244
  var import_jsx_runtime93 = require("react/jsx-runtime");
11228
11245
  function parseClientState6(json) {
11229
11246
  if (!json) return null;
@@ -11264,8 +11281,8 @@ function DailyQuizGame({
11264
11281
  }) {
11265
11282
  const s = ui.games.dailyQuiz;
11266
11283
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
11267
- const [selections, setSelections] = (0, import_react65.useState)(/* @__PURE__ */ new Map());
11268
- const [page, setPage] = (0, import_react65.useState)(0);
11284
+ const [selections, setSelections] = (0, import_react66.useState)(/* @__PURE__ */ new Map());
11285
+ const [page, setPage] = (0, import_react66.useState)(0);
11269
11286
  const clientState = parseClientState6(result?.clientStateJson);
11270
11287
  const results = clientState?.results ?? [];
11271
11288
  const isRevealed = results.length > 0 || result?.alreadyPlayed === true;
@@ -11375,7 +11392,7 @@ function DailyQuizGame({
11375
11392
  }
11376
11393
 
11377
11394
  // src/components/games/MatchdayPredictorGame.tsx
11378
- var import_react66 = require("react");
11395
+ var import_react67 = require("react");
11379
11396
  var import_jsx_runtime94 = require("react/jsx-runtime");
11380
11397
  var SCORER_SEARCH_THRESHOLD = 9;
11381
11398
  function parseClientState7(json) {
@@ -11471,12 +11488,12 @@ function MatchdayPredictorGame({
11471
11488
  onBack
11472
11489
  }) {
11473
11490
  const t = ui.games.predictor;
11474
- const [homeScore, setHomeScore] = (0, import_react66.useState)(0);
11475
- const [awayScore, setAwayScore] = (0, import_react66.useState)(0);
11476
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react66.useState)(null);
11477
- const [lastEdited, setLastEdited] = (0, import_react66.useState)("home");
11478
- const [query, setQuery] = (0, import_react66.useState)("");
11479
- const searchId = (0, import_react66.useId)();
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)();
11480
11497
  const clientState = parseClientState7(result?.clientStateJson);
11481
11498
  const alreadyPlayed = result?.alreadyPlayed === true;
11482
11499
  const header = /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
@@ -11643,7 +11660,7 @@ function MatchdayPredictorGame({
11643
11660
  }
11644
11661
 
11645
11662
  // src/components/games/StartingXiGame.tsx
11646
- var import_react67 = require("react");
11663
+ var import_react68 = require("react");
11647
11664
  var import_jsx_runtime95 = require("react/jsx-runtime");
11648
11665
  var POINTS_PER_STARTER = 8;
11649
11666
  var XI_SIZE = 11;
@@ -11687,10 +11704,10 @@ function StartingXiGame({
11687
11704
  lockAtUtc
11688
11705
  }) {
11689
11706
  const t = ui.games.startingXi;
11690
- const [slotPlayers, setSlotPlayers] = (0, import_react67.useState)(() => Array(XI_SIZE).fill(null));
11691
- const [active, setActive] = (0, import_react67.useState)(0);
11692
- const [query, setQuery] = (0, import_react67.useState)("");
11693
- const searchId = (0, import_react67.useId)();
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)();
11694
11711
  const clientState = parseClientState8(result?.clientStateJson);
11695
11712
  const alreadyPlayed = result?.alreadyPlayed === true;
11696
11713
  const header = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
@@ -11829,7 +11846,7 @@ function StartingXiGame({
11829
11846
  }
11830
11847
 
11831
11848
  // src/components/games/StatLadderGame.tsx
11832
- var import_react68 = require("react");
11849
+ var import_react69 = require("react");
11833
11850
  var import_jsx_runtime96 = require("react/jsx-runtime");
11834
11851
  function ladderClue(ladder) {
11835
11852
  const mystery = ladder.find((r) => r.rank === 2);
@@ -11866,9 +11883,9 @@ function StatLadderGame({
11866
11883
  onBack
11867
11884
  }) {
11868
11885
  const t = ui.games.statLadder;
11869
- const [query, setQuery] = (0, import_react68.useState)("");
11870
- const [selectedId, setSelectedId] = (0, import_react68.useState)(null);
11871
- const searchId = (0, import_react68.useId)();
11886
+ const [query, setQuery] = (0, import_react69.useState)("");
11887
+ const [selectedId, setSelectedId] = (0, import_react69.useState)(null);
11888
+ const searchId = (0, import_react69.useId)();
11872
11889
  const clientState = parseClientState9(result?.clientStateJson);
11873
11890
  const revealed = clientState != null;
11874
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 });
@@ -12074,8 +12091,8 @@ function GameScreenHost({
12074
12091
  ui
12075
12092
  }) {
12076
12093
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
12077
- const [configJson, setConfigJson] = (0, import_react69.useState)(null);
12078
- (0, import_react69.useEffect)(() => {
12094
+ const [configJson, setConfigJson] = (0, import_react70.useState)(null);
12095
+ (0, import_react70.useEffect)(() => {
12079
12096
  setConfigJson(null);
12080
12097
  if (!conversation) return;
12081
12098
  let cancelled = false;
@@ -12098,12 +12115,12 @@ function GameScreenHost({
12098
12115
  fixtureId: fixtureId || void 0,
12099
12116
  locale: ui.games.lang
12100
12117
  });
12101
- (0, import_react69.useEffect)(() => {
12118
+ (0, import_react70.useEffect)(() => {
12102
12119
  if (conversation) hydrate();
12103
12120
  }, [conversation, gameId]);
12104
- const hydrateRef = (0, import_react69.useRef)(hydrate);
12121
+ const hydrateRef = (0, import_react70.useRef)(hydrate);
12105
12122
  hydrateRef.current = hydrate;
12106
- (0, import_react69.useEffect)(() => {
12123
+ (0, import_react70.useEffect)(() => {
12107
12124
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
12108
12125
  if (rawStatus !== "pending") return;
12109
12126
  const timerId = setInterval(() => {
@@ -12216,7 +12233,7 @@ function GameScreenHost({
12216
12233
  }
12217
12234
 
12218
12235
  // src/components/Leaderboard.tsx
12219
- var import_react70 = require("react");
12236
+ var import_react71 = require("react");
12220
12237
 
12221
12238
  // src/components/LeaderboardRow.tsx
12222
12239
  var import_jsx_runtime99 = require("react/jsx-runtime");
@@ -12301,7 +12318,7 @@ function Leaderboard({
12301
12318
  ui,
12302
12319
  onPlay
12303
12320
  }) {
12304
- const [segment, setSegment] = (0, import_react70.useState)("weekly");
12321
+ const [segment, setSegment] = (0, import_react71.useState)("weekly");
12305
12322
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
12306
12323
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
12307
12324
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -12404,9 +12421,9 @@ function GamesPanel({
12404
12421
  leaderboardLoading,
12405
12422
  refreshHub
12406
12423
  }) {
12407
- const [selected, setSelected] = (0, import_react71.useState)(null);
12408
- const [segment, setSegment] = (0, import_react71.useState)("play");
12409
- (0, import_react71.useEffect)(() => {
12424
+ const [selected, setSelected] = (0, import_react72.useState)(null);
12425
+ const [segment, setSegment] = (0, import_react72.useState)("play");
12426
+ (0, import_react72.useEffect)(() => {
12410
12427
  ensureGamesFonts();
12411
12428
  }, []);
12412
12429
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(GamesLoginWall, { ui });
@@ -12707,10 +12724,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
12707
12724
  }
12708
12725
 
12709
12726
  // src/components/PlayerPhoto.tsx
12710
- var import_react72 = require("react");
12727
+ var import_react73 = require("react");
12711
12728
  var import_jsx_runtime108 = require("react/jsx-runtime");
12712
12729
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
12713
- const [failed, setFailed] = (0, import_react72.useState)(false);
12730
+ const [failed, setFailed] = (0, import_react73.useState)(false);
12714
12731
  const box = { width: size, height: size };
12715
12732
  if (photoUrl && !failed) {
12716
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) });
@@ -12745,7 +12762,7 @@ function MiniPitch({ positionCode }) {
12745
12762
  }
12746
12763
 
12747
12764
  // src/components/PerformanceBars.tsx
12748
- var import_react73 = require("react");
12765
+ var import_react74 = require("react");
12749
12766
  var import_jsx_runtime110 = require("react/jsx-runtime");
12750
12767
  var GROUPS = ["shooting", "passing", "possession", "defending"];
12751
12768
  function finite3(v) {
@@ -12791,7 +12808,7 @@ function unrankedLine(ui, reason) {
12791
12808
  }
12792
12809
  }
12793
12810
  function PerformanceBars({ performance, competitionName, strings }) {
12794
- const [mode, setMode] = (0, import_react73.useState)("total");
12811
+ const [mode, setMode] = (0, import_react74.useState)("total");
12795
12812
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
12796
12813
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
12797
12814
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -12963,10 +12980,10 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
12963
12980
  }
12964
12981
 
12965
12982
  // src/components/PresetSpeedDial.tsx
12966
- var import_react74 = require("react");
12983
+ var import_react75 = require("react");
12967
12984
  var import_jsx_runtime112 = require("react/jsx-runtime");
12968
12985
  function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
12969
- const pillsId = (0, import_react74.useId)();
12986
+ const pillsId = (0, import_react75.useId)();
12970
12987
  const tabIndex = expanded ? 0 : -1;
12971
12988
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { ref: rootRef, className: "ss-w-dial", children: [
12972
12989
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
@@ -13000,16 +13017,16 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
13000
13017
  }
13001
13018
 
13002
13019
  // src/components/PresetTools.tsx
13003
- var import_react75 = require("react");
13020
+ var import_react76 = require("react");
13004
13021
  var import_jsx_runtime113 = require("react/jsx-runtime");
13005
13022
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
13006
13023
  function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
13007
- const dialogRef = (0, import_react75.useRef)(null);
13008
- const titleId = (0, import_react75.useId)();
13009
- (0, import_react75.useEffect)(() => {
13024
+ const dialogRef = (0, import_react76.useRef)(null);
13025
+ const titleId = (0, import_react76.useId)();
13026
+ (0, import_react76.useEffect)(() => {
13010
13027
  dialogRef.current?.focus();
13011
13028
  }, []);
13012
- (0, import_react75.useEffect)(() => {
13029
+ (0, import_react76.useEffect)(() => {
13013
13030
  const onKey = (e) => {
13014
13031
  if (e.key !== "Escape") return;
13015
13032
  e.stopPropagation();
@@ -13051,7 +13068,7 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
13051
13068
  function fillTemplate(template, slots) {
13052
13069
  return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
13053
13070
  const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
13054
- return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react75.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
13071
+ return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_react76.Fragment, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
13055
13072
  });
13056
13073
  }
13057
13074
  function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty = true, onChoose }) {
@@ -13120,15 +13137,15 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13120
13137
  const totals = comboTotals(grid);
13121
13138
  const legChoices = comboLegChoices(grid);
13122
13139
  const count = FIXED_SINGLES_COUNT;
13123
- const [maxPrice, setMaxPrice] = (0, import_react75.useState)(() => startSingles(grid.singles, limits, START.maxPrice, count));
13124
- const [minPrice, setMinPrice] = (0, import_react75.useState)(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
13125
- const [start] = (0, import_react75.useState)(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
13126
- const [total, setTotal] = (0, import_react75.useState)(start.total);
13127
- const [legs, setLegs] = (0, import_react75.useState)(start.legs);
13128
- const [bigStart] = (0, import_react75.useState)(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
13129
- const [bigTotal, setBigTotal] = (0, import_react75.useState)(bigStart.total);
13130
- const [bigLegs, setBigLegs] = (0, import_react75.useState)(bigStart.legs);
13131
- const [announcement, setAnnouncement] = (0, import_react75.useState)("");
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)("");
13132
13149
  const maxCell = findSingles(grid.singles, maxPrice, count);
13133
13150
  const minCell = findSingles(grid.singlesFrom, minPrice, count);
13134
13151
  const comboCell = findCombo(grid, total, legs);
@@ -13172,7 +13189,7 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13172
13189
  const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
13173
13190
  const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
13174
13191
  const markets = grid.markets ?? [];
13175
- const [marketIdx, setMarketIdx] = (0, import_react75.useState)(0);
13192
+ const [marketIdx, setMarketIdx] = (0, import_react76.useState)(0);
13176
13193
  const marketCell = markets[marketIdx] ?? null;
13177
13194
  const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
13178
13195
  const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
@@ -13253,14 +13270,14 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
13253
13270
  function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
13254
13271
  const totals = comboTotals(grid);
13255
13272
  const legChoices = comboLegChoices(grid);
13256
- const [start] = (0, import_react75.useState)(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
13257
- const [total, setTotal] = (0, import_react75.useState)(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
13258
- const [legs, setLegs] = (0, import_react75.useState)(() => {
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)(() => {
13259
13276
  if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
13260
13277
  const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
13261
13278
  return legsForTotal(grid, nearest(totals, initialTotal), from);
13262
13279
  });
13263
- const [announcement, setAnnouncement] = (0, import_react75.useState)("");
13280
+ const [announcement, setAnnouncement] = (0, import_react76.useState)("");
13264
13281
  const cell2 = findCombo(grid, total, legs);
13265
13282
  const minLegs = legChoices[0] ?? legs;
13266
13283
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -13293,7 +13310,7 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
13293
13310
  }
13294
13311
 
13295
13312
  // src/usePresetDial.ts
13296
- var import_react76 = require("react");
13313
+ var import_react77 = require("react");
13297
13314
  function sendInFlight(messages, isStreaming) {
13298
13315
  const last = messages[messages.length - 1];
13299
13316
  return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
@@ -13307,25 +13324,25 @@ function lastUserId(messages) {
13307
13324
  }
13308
13325
  var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
13309
13326
  function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
13310
- const [expanded, setExpanded] = (0, import_react76.useState)(() => !sendInFlight(messages, isStreaming));
13311
- const fold = (0, import_react76.useCallback)(() => setExpanded(false), []);
13312
- const toggle = (0, import_react76.useCallback)(() => setExpanded((e) => !e), []);
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), []);
13313
13330
  const currentUserId = lastUserId(messages);
13314
- const userIdRef = (0, import_react76.useRef)(currentUserId);
13315
- (0, import_react76.useEffect)(() => {
13331
+ const userIdRef = (0, import_react77.useRef)(currentUserId);
13332
+ (0, import_react77.useEffect)(() => {
13316
13333
  if (currentUserId === userIdRef.current) return;
13317
13334
  userIdRef.current = currentUserId;
13318
13335
  setExpanded(false);
13319
13336
  }, [currentUserId]);
13320
- const tabRef = (0, import_react76.useRef)(activeTab);
13321
- (0, import_react76.useEffect)(() => {
13337
+ const tabRef = (0, import_react77.useRef)(activeTab);
13338
+ (0, import_react77.useEffect)(() => {
13322
13339
  if (activeTab === tabRef.current) return;
13323
13340
  tabRef.current = activeTab;
13324
13341
  setExpanded(false);
13325
13342
  }, [activeTab]);
13326
- const expandedRef = (0, import_react76.useRef)(expanded);
13343
+ const expandedRef = (0, import_react77.useRef)(expanded);
13327
13344
  expandedRef.current = expanded;
13328
- (0, import_react76.useEffect)(() => {
13345
+ (0, import_react77.useEffect)(() => {
13329
13346
  const onEscape = (e) => {
13330
13347
  const dial = dialRef.current;
13331
13348
  if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
@@ -13338,7 +13355,7 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
13338
13355
  window.addEventListener("keydown", onEscape, true);
13339
13356
  return () => window.removeEventListener("keydown", onEscape, true);
13340
13357
  }, [dialRef, dialButtonRef]);
13341
- (0, import_react76.useEffect)(() => {
13358
+ (0, import_react77.useEffect)(() => {
13342
13359
  if (!expanded) return;
13343
13360
  const layer = layerRef.current;
13344
13361
  const inDial = (e) => {
@@ -13393,8 +13410,8 @@ function markToolSeen() {
13393
13410
  var import_jsx_runtime114 = require("react/jsx-runtime");
13394
13411
  var FULLSCREEN_QUERY = "(max-width: 639px)";
13395
13412
  function useIsModal() {
13396
- const [modal, setModal] = (0, import_react77.useState)(false);
13397
- (0, import_react77.useEffect)(() => {
13413
+ const [modal, setModal] = (0, import_react78.useState)(false);
13414
+ (0, import_react78.useEffect)(() => {
13398
13415
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
13399
13416
  const mql = window.matchMedia(FULLSCREEN_QUERY);
13400
13417
  const sync = () => setModal(mql.matches);
@@ -13408,12 +13425,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
13408
13425
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
13409
13426
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid }) {
13410
13427
  const { state, close, stop, send, reset } = controller;
13411
- const [squadView, setSquadView] = (0, import_react77.useState)("roster");
13412
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react77.useState)(null);
13428
+ const [squadView, setSquadView] = (0, import_react78.useState)("roster");
13429
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react78.useState)(null);
13413
13430
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
13414
13431
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
13415
- const squadLayerRef = (0, import_react77.useRef)(null);
13416
- const squadScrollRef = (0, import_react77.useRef)(null);
13432
+ const squadLayerRef = (0, import_react78.useRef)(null);
13433
+ const squadScrollRef = (0, import_react78.useRef)(null);
13417
13434
  const selectPlayer = (playerId) => {
13418
13435
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
13419
13436
  setSelectedPlayerId(playerId);
@@ -13423,20 +13440,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13423
13440
  setSelectedPlayerId(null);
13424
13441
  clearPlayerDetail?.();
13425
13442
  };
13426
- (0, import_react77.useLayoutEffect)(() => {
13443
+ (0, import_react78.useLayoutEffect)(() => {
13427
13444
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
13428
13445
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
13429
13446
  if (list) list.scrollTop = squadScrollRef.current;
13430
13447
  squadScrollRef.current = null;
13431
13448
  }, [selectedPlayerId]);
13432
13449
  const activeTab = monitor?.activeTab;
13433
- (0, import_react77.useEffect)(() => {
13450
+ (0, import_react78.useEffect)(() => {
13434
13451
  if (activeTab === "squad" || selectedPlayerId === null) return;
13435
13452
  setSelectedPlayerId(null);
13436
13453
  clearPlayerDetail?.();
13437
13454
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
13438
13455
  const isModal = useIsModal();
13439
- (0, import_react77.useEffect)(() => {
13456
+ (0, import_react78.useEffect)(() => {
13440
13457
  const onKey = (e) => {
13441
13458
  if (e.key === "Escape") close();
13442
13459
  };
@@ -13452,19 +13469,19 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13452
13469
  monitor?.setActiveTab("chat");
13453
13470
  send(text, { grounding });
13454
13471
  };
13455
- (0, import_react77.useEffect)(() => {
13472
+ (0, import_react78.useEffect)(() => {
13456
13473
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
13457
13474
  }, [monitor, state.isStreaming, state.messages.length]);
13458
13475
  const onChatTab = !monitor || monitor.activeTab === "chat";
13459
- const layerRef = (0, import_react77.useRef)(null);
13460
- const dialRef = (0, import_react77.useRef)(null);
13461
- const dialButtonRef = (0, import_react77.useRef)(null);
13462
- const inputRef = (0, import_react77.useRef)(null);
13463
- const limitRef = (0, import_react77.useRef)(null);
13464
- const typedSendRef = (0, import_react77.useRef)(false);
13465
- const focusAfterCloseRef = (0, import_react77.useRef)(null);
13466
- const [tool, setTool] = (0, import_react77.useState)(null);
13467
- const [toolSeen, setToolSeen] = (0, import_react77.useState)(readToolSeen);
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);
13468
13485
  const dial = usePresetDial({
13469
13486
  layerRef,
13470
13487
  dialRef,
@@ -13476,47 +13493,47 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
13476
13493
  const { fold } = dial;
13477
13494
  const paused = isPaused(state.limit);
13478
13495
  const showDial = !!presetGrid && onChatTab && !tool && !paused;
13479
- (0, import_react77.useEffect)(() => {
13496
+ (0, import_react78.useEffect)(() => {
13480
13497
  if (paused) setTool(null);
13481
13498
  }, [paused]);
13482
- (0, import_react77.useEffect)(() => {
13499
+ (0, import_react78.useEffect)(() => {
13483
13500
  if (!paused) return;
13484
13501
  if (typedSendRef.current) limitRef.current?.focus();
13485
13502
  typedSendRef.current = false;
13486
13503
  }, [paused]);
13487
- const openTool = (0, import_react77.useCallback)((next) => {
13504
+ const openTool = (0, import_react78.useCallback)((next) => {
13488
13505
  fold();
13489
13506
  markToolSeen();
13490
13507
  setToolSeen(true);
13491
13508
  setTool(next);
13492
13509
  }, [fold]);
13493
- const onPill = (0, import_react77.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
13494
- const toolsValue = (0, import_react77.useMemo)(
13510
+ const onPill = (0, import_react78.useCallback)((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
13511
+ const toolsValue = (0, import_react78.useMemo)(
13495
13512
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
13496
13513
  [presetGrid, paused, openTool, ui.presets.changeCombo]
13497
13514
  );
13498
- const closeTool = (0, import_react77.useCallback)(() => {
13515
+ const closeTool = (0, import_react78.useCallback)(() => {
13499
13516
  focusAfterCloseRef.current = "dial";
13500
13517
  setTool(null);
13501
13518
  }, []);
13502
- const sendAsk = (0, import_react77.useCallback)((ask) => {
13519
+ const sendAsk = (0, import_react78.useCallback)((ask) => {
13503
13520
  focusAfterCloseRef.current = "composer";
13504
13521
  setTool(null);
13505
13522
  monitor?.setActiveTab("chat");
13506
13523
  send(ask.message, { displayText: ask.displayText, preset: ask.preset });
13507
13524
  }, [monitor, send]);
13508
- const formatKickoff = (0, import_react77.useCallback)((kickoffUtc) => {
13525
+ const formatKickoff = (0, import_react78.useCallback)((kickoffUtc) => {
13509
13526
  const k = ui.bettingKickoff(kickoffUtc);
13510
13527
  return `${k.dayLabel} ${k.time}`;
13511
13528
  }, [ui]);
13512
- (0, import_react77.useEffect)(() => {
13529
+ (0, import_react78.useEffect)(() => {
13513
13530
  if (tool) return;
13514
13531
  const target = focusAfterCloseRef.current;
13515
13532
  focusAfterCloseRef.current = null;
13516
13533
  if (target === "dial") dialButtonRef.current?.focus();
13517
13534
  else if (target === "composer") inputRef.current?.focus();
13518
13535
  }, [tool]);
13519
- (0, import_react77.useEffect)(() => {
13536
+ (0, import_react78.useEffect)(() => {
13520
13537
  if (!tool || onChatTab && presetGrid) return;
13521
13538
  focusAfterCloseRef.current = "composer";
13522
13539
  setTool(null);
@@ -15891,28 +15908,28 @@ function injectStyles(root) {
15891
15908
  function StatsWidget(props) {
15892
15909
  const injectedClient = "client" in props ? props.client : void 0;
15893
15910
  const cfg = props.config;
15894
- const built = (0, import_react78.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
15895
- const logger = (0, import_react78.useMemo)(
15911
+ const built = (0, import_react79.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
15912
+ const logger = (0, import_react79.useMemo)(
15896
15913
  () => built ? built.client.createEventLogger({
15897
15914
  operatorUserId: cfg?.userContext?.operatorUserId,
15898
15915
  anonymousUserId: cfg?.userContext?.anonymousUserId
15899
15916
  }) : null,
15900
15917
  [built?.client]
15901
15918
  );
15902
- const ui = (0, import_react78.useMemo)(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
15903
- const rootRef = (0, import_react78.useRef)(null);
15904
- const introDoneRef = (0, import_react78.useRef)(false);
15905
- const markIntroDone = (0, import_react78.useCallback)(() => {
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)(() => {
15906
15923
  introDoneRef.current = true;
15907
15924
  }, []);
15908
15925
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}`;
15909
- const sportScope = (0, import_react78.useMemo)(
15926
+ const sportScope = (0, import_react79.useMemo)(
15910
15927
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
15911
15928
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
15912
15929
  );
15913
15930
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope);
15914
- const [hasToday, setHasToday] = (0, import_react78.useState)(false);
15915
- const liveCardWatches = (0, import_react78.useMemo)(() => {
15931
+ const [hasToday, setHasToday] = (0, import_react79.useState)(false);
15932
+ const liveCardWatches = (0, import_react79.useMemo)(() => {
15916
15933
  const seen = /* @__PURE__ */ new Set();
15917
15934
  const out = [];
15918
15935
  for (const msg of controller.state.messages) {
@@ -15939,19 +15956,19 @@ function StatsWidget(props) {
15939
15956
  });
15940
15957
  const operatorUserId = cfg?.userContext?.operatorUserId;
15941
15958
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
15942
- const getSchedule = (0, import_react78.useCallback)(
15959
+ const getSchedule = (0, import_react79.useCallback)(
15943
15960
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
15944
15961
  [built, operatorUserId, anonymousUserId]
15945
15962
  );
15946
- const postLeagueStar = (0, import_react78.useCallback)(
15963
+ const postLeagueStar = (0, import_react79.useCallback)(
15947
15964
  (competitionId, starred) => built ? built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId) : Promise.resolve(null),
15948
15965
  [built, operatorUserId, anonymousUserId]
15949
15966
  );
15950
- const getStates = (0, import_react78.useCallback)(
15967
+ const getStates = (0, import_react79.useCallback)(
15951
15968
  (matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
15952
15969
  [built]
15953
15970
  );
15954
- const pinnedMatchIds = (0, import_react78.useMemo)(
15971
+ const pinnedMatchIds = (0, import_react79.useMemo)(
15955
15972
  () => footballMatchPinIds(monitor.pins),
15956
15973
  [monitor.pins]
15957
15974
  );
@@ -15966,11 +15983,11 @@ function StatsWidget(props) {
15966
15983
  pinnedMatchIds
15967
15984
  });
15968
15985
  const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
15969
- (0, import_react78.useEffect)(() => {
15986
+ (0, import_react79.useEffect)(() => {
15970
15987
  setHasToday(todayHasContent);
15971
15988
  }, [todayHasContent]);
15972
- const prevLiveSnapshotRef = (0, import_react78.useRef)(monitor.snapshot);
15973
- (0, import_react78.useEffect)(() => {
15989
+ const prevLiveSnapshotRef = (0, import_react79.useRef)(monitor.snapshot);
15990
+ (0, import_react79.useEffect)(() => {
15974
15991
  const snap = monitor.snapshot;
15975
15992
  if (!snap || snap === prevLiveSnapshotRef.current) return;
15976
15993
  prevLiveSnapshotRef.current = snap;
@@ -16010,14 +16027,14 @@ function StatsWidget(props) {
16010
16027
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
16011
16028
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
16012
16029
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
16013
- const getPricePresets = (0, import_react78.useCallback)(
16030
+ const getPricePresets = (0, import_react79.useCallback)(
16014
16031
  (locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
16015
16032
  [built]
16016
16033
  );
16017
16034
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
16018
16035
  const markTodayActivity = monitor.markTodayActivity;
16019
- const prevLiveCountRef = (0, import_react78.useRef)(0);
16020
- (0, import_react78.useEffect)(() => {
16036
+ const prevLiveCountRef = (0, import_react79.useRef)(0);
16037
+ (0, import_react79.useEffect)(() => {
16021
16038
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
16022
16039
  prevLiveCountRef.current = discovery.liveCount;
16023
16040
  if (rose) markTodayActivity();
@@ -16031,7 +16048,7 @@ function StatsWidget(props) {
16031
16048
  closePanel: controller.close
16032
16049
  });
16033
16050
  const markAdded = hostEvents.markAdded;
16034
- const slip = (0, import_react78.useMemo)(
16051
+ const slip = (0, import_react79.useMemo)(
16035
16052
  () => {
16036
16053
  const handler = props.config?.onAddToSlip;
16037
16054
  return {
@@ -16051,7 +16068,7 @@ function StatsWidget(props) {
16051
16068
  },
16052
16069
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
16053
16070
  );
16054
- const onDashboardTap = (0, import_react78.useMemo)(
16071
+ const onDashboardTap = (0, import_react79.useMemo)(
16055
16072
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
16056
16073
  [built, logger]
16057
16074
  );
@@ -16068,11 +16085,11 @@ function StatsWidget(props) {
16068
16085
  })
16069
16086
  }));
16070
16087
  const conversationId = controller.state.conversationId ?? void 0;
16071
- (0, import_react78.useEffect)(() => {
16088
+ (0, import_react79.useEffect)(() => {
16072
16089
  if (!logger) return;
16073
16090
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
16074
16091
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
16075
- (0, import_react78.useEffect)(() => {
16092
+ (0, import_react79.useEffect)(() => {
16076
16093
  if (!logger) return;
16077
16094
  logger.resume();
16078
16095
  const onHide = () => {
@@ -16090,7 +16107,7 @@ function StatsWidget(props) {
16090
16107
  logger.dispose();
16091
16108
  };
16092
16109
  }, [logger]);
16093
- (0, import_react78.useEffect)(() => {
16110
+ (0, import_react79.useEffect)(() => {
16094
16111
  if (!built || !ui.injectStyles) return;
16095
16112
  const node = rootRef.current?.getRootNode();
16096
16113
  if (node) injectStyles(node);