@sensiblestats/widget-react 0.130.0 → 0.131.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_react102 = require("react");
40
+ var import_react103 = require("react");
41
41
  var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
42
42
 
43
43
  // src/strings/tag.ts
@@ -1323,7 +1323,7 @@ function parseOddsFormat(value) {
1323
1323
  }
1324
1324
 
1325
1325
  // src/version.generated.ts
1326
- var WIDGET_REACT_VERSION = "0.130.0";
1326
+ var WIDGET_REACT_VERSION = "0.131.0";
1327
1327
 
1328
1328
  // src/config.ts
1329
1329
  function hostTag(cfg) {
@@ -2192,7 +2192,7 @@ function comboLegToSlipSelection(leg, conversationId) {
2192
2192
  if (leg.quotedAtUtc !== void 0) selection.quotedAtUtc = leg.quotedAtUtc;
2193
2193
  if (leg.sport !== void 0) selection.sport = leg.sport;
2194
2194
  if (conversationId !== void 0) selection.conversationId = conversationId;
2195
- return withMatch(selection, { home: leg.homeTeamName, away: leg.awayTeamName, kickoffUtc: leg.kickoffUtc, marketLabel: leg.market });
2195
+ return withMatch(selection, { home: leg.homeTeamName, away: leg.awayTeamName, kickoffUtc: leg.kickoffUtc, marketLabel: leg.market, player: leg.player });
2196
2196
  }
2197
2197
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
2198
2198
  var isObj = (v) => typeof v === "object" && v !== null;
@@ -2325,7 +2325,37 @@ function toNbaSlipSelection(vm, key, conversationId) {
2325
2325
  sport: "basketball"
2326
2326
  };
2327
2327
  if (conversationId !== void 0) selection.conversationId = conversationId;
2328
- return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc });
2328
+ return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc, ...nbaPropOf(vm.evidence, key) });
2329
+ }
2330
+ function nbaPropOf(evidence, key) {
2331
+ switch (evidence.kind) {
2332
+ case "prop_reason":
2333
+ return { player: evidence.propReason.playerName, marketLabel: evidence.propReason.statLabel };
2334
+ case "vs_opponent":
2335
+ return { player: evidence.vsOpponent.playerName, marketLabel: evidence.vsOpponent.statLabel };
2336
+ case "teammate_out": {
2337
+ const row = evidence.teammateOut.rows.find((r) => r.selectionKey === key);
2338
+ return row ? { player: row.playerName, marketLabel: row.statLabel } : null;
2339
+ }
2340
+ case "co_hit": {
2341
+ const leg = evidence.coHit.legs.find((l) => l.selectionKey === key);
2342
+ return leg ? { player: leg.playerName, marketLabel: leg.statLabel } : null;
2343
+ }
2344
+ case "ladder": {
2345
+ const stat = evidence.ladder.stats.find((st) => st.rungs.some((r) => r.selectionKey === key));
2346
+ return stat ? { player: evidence.ladder.playerName, marketLabel: stat.statLabel } : null;
2347
+ }
2348
+ case "quarter_ladder": {
2349
+ const stat = evidence.quarterLadder.stats.find((st) => st.rungs.some((r) => r.selectionKey === key));
2350
+ return stat ? { player: evidence.quarterLadder.playerName, marketLabel: stat.statLabel } : null;
2351
+ }
2352
+ case "matchup": {
2353
+ const pos = evidence.matchup.position;
2354
+ return pos?.playerName && (pos.overSelectionKey === key || pos.underSelectionKey === key) ? { player: pos.playerName, marketLabel: pos.statLabel } : null;
2355
+ }
2356
+ default:
2357
+ return null;
2358
+ }
2329
2359
  }
2330
2360
  function nbaCoHitLegs(vm, conversationId) {
2331
2361
  if (vm.evidence.kind !== "co_hit") return [];
@@ -2339,7 +2369,8 @@ function nbaCoHitLegs(vm, conversationId) {
2339
2369
  homeTeamName: vm.homeTeamName ?? "",
2340
2370
  awayTeamName: vm.awayTeamName ?? "",
2341
2371
  kickoffUtc: vm.kickoffUtc ?? void 0,
2342
- market: vm.title,
2372
+ market: leg.statLabel,
2373
+ player: leg.playerName,
2343
2374
  marketDeveloperName: s.marketDeveloperName,
2344
2375
  selection: s.selectionLabel,
2345
2376
  selectionLabel: s.selectionLabel,
@@ -2445,7 +2476,17 @@ function toNflSlipSelection(vm, key, nowMs, conversationId) {
2445
2476
  sport: "americanfootball"
2446
2477
  };
2447
2478
  if (conversationId !== void 0) selection.conversationId = conversationId;
2448
- return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc });
2479
+ return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc, ...nflPropOf(vm.evidence) });
2480
+ }
2481
+ function nflPropOf(evidence) {
2482
+ switch (evidence.kind) {
2483
+ case "prop_reason":
2484
+ return { player: evidence.propReason.playerName, marketLabel: evidence.propReason.propLabel };
2485
+ case "ladder":
2486
+ return { player: evidence.ladder.playerName, marketLabel: evidence.ladder.propLabel };
2487
+ default:
2488
+ return null;
2489
+ }
2449
2490
  }
2450
2491
 
2451
2492
  // src/slipKey.ts
@@ -5999,7 +6040,7 @@ function useSlipAdd(slip, ui) {
5999
6040
  const handler = slip.onAddToSlip;
6000
6041
  const rawLabels = !!ui?.rawBettingLabels;
6001
6042
  const operatorFormat = ui?.oddsFormat ?? "decimal";
6002
- return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line }) => {
6043
+ return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
6003
6044
  if (!handler) return { kind: "failed" };
6004
6045
  const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
6005
6046
  const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
@@ -6014,11 +6055,13 @@ function useSlipAdd(slip, ui) {
6014
6055
  matchId: out.matchId,
6015
6056
  odds: out.oddsDecimal,
6016
6057
  ...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
6017
- ...out.sport !== void 0 ? { sport: out.sport } : {}
6058
+ ...out.sport !== void 0 ? { sport: out.sport } : {},
6059
+ ...fact ? { factKey: fact.factKey } : {}
6018
6060
  };
6061
+ const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
6019
6062
  track({ name: "add_to_slip_click", ...clickFields });
6020
6063
  if (marketDeveloperName !== void 0) {
6021
- log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
6064
+ log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField, ...factTag });
6022
6065
  }
6023
6066
  try {
6024
6067
  const raw = await withTimeout(Promise.resolve(handler(out)));
@@ -6033,7 +6076,8 @@ function useSlipAdd(slip, ui) {
6033
6076
  entityId: marketDeveloperName,
6034
6077
  outcome: slipOutcome(result),
6035
6078
  ...pick,
6036
- ...sportField
6079
+ ...sportField,
6080
+ ...factTag
6037
6081
  });
6038
6082
  }
6039
6083
  if (slipState) {
@@ -6046,7 +6090,7 @@ function useSlipAdd(slip, ui) {
6046
6090
  } catch {
6047
6091
  track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
6048
6092
  if (marketDeveloperName !== void 0) {
6049
- log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
6093
+ log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField, ...factTag });
6050
6094
  }
6051
6095
  return { kind: "failed" };
6052
6096
  }
@@ -6069,7 +6113,7 @@ function Toast({ toast, onDismiss }) {
6069
6113
 
6070
6114
  // src/components/AddToSlipButton.tsx
6071
6115
  var import_jsx_runtime6 = require("react/jsx-runtime");
6072
- function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
6116
+ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
6073
6117
  const [pending, setPending] = (0, import_react27.useState)(false);
6074
6118
  const [settledLocal, setSettledLocal] = (0, import_react27.useState)(false);
6075
6119
  const [toast, setToast] = (0, import_react27.useState)(null);
@@ -6083,7 +6127,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
6083
6127
  const onClick = async () => {
6084
6128
  setPending(true);
6085
6129
  try {
6086
- const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
6130
+ const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
6087
6131
  if (outcome.kind === "failed") {
6088
6132
  setToast({ kind: "error", text: ui.slipFailed });
6089
6133
  return;
@@ -7082,11 +7126,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
7082
7126
  var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
7083
7127
  var MAX_TEAM_CARDS = 3;
7084
7128
  function oneCardPerGame(cards) {
7085
- const seen = /* @__PURE__ */ new Set();
7129
+ const seen2 = /* @__PURE__ */ new Set();
7086
7130
  return cards.filter((c) => {
7087
7131
  if (!c.matchId) return true;
7088
- if (seen.has(c.matchId)) return false;
7089
- seen.add(c.matchId);
7132
+ if (seen2.has(c.matchId)) return false;
7133
+ seen2.add(c.matchId);
7090
7134
  return true;
7091
7135
  });
7092
7136
  }
@@ -7415,7 +7459,9 @@ var WIRE_TO_PUBLIC = {
7415
7459
  slip_remove: null,
7416
7460
  bet_placed: null,
7417
7461
  match_view: null,
7418
- popup_opened: null
7462
+ popup_opened: null,
7463
+ fact_view: null,
7464
+ fact_ask: null
7419
7465
  };
7420
7466
 
7421
7467
  // src/popupTelemetry.ts
@@ -7523,7 +7569,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7523
7569
  }
7524
7570
 
7525
7571
  // src/components/ChatPanel.tsx
7526
- var import_react101 = require("react");
7572
+ var import_react102 = require("react");
7527
7573
 
7528
7574
  // src/components/ChatHeader.tsx
7529
7575
  var import_react45 = require("react");
@@ -8912,15 +8958,15 @@ function pathRounds(e) {
8912
8958
  const base = h - pad.b;
8913
8959
  const plotH = h - pad.t - pad.b;
8914
8960
  const { lo, span } = roundSpan(e);
8915
- const seen = /* @__PURE__ */ new Map();
8961
+ const seen2 = /* @__PURE__ */ new Map();
8916
8962
  for (const ev of e.events) {
8917
8963
  if (ev.roundIndex < 0) continue;
8918
8964
  const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
8919
8965
  const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
8920
- if (short !== "" && !seen.has(idx)) seen.set(idx, short);
8966
+ if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
8921
8967
  }
8922
8968
  const kept = [];
8923
- for (const [roundIndex, label] of [...seen.entries()].sort((a, b) => b[0] - a[0])) {
8969
+ for (const [roundIndex, label] of [...seen2.entries()].sort((a, b) => b[0] - a[0])) {
8924
8970
  const y = round22(base - (roundIndex - lo + 1) / span * plotH);
8925
8971
  const last = kept[kept.length - 1];
8926
8972
  if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
@@ -10511,7 +10557,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10511
10557
  }
10512
10558
 
10513
10559
  // src/components/MonitorTabs.tsx
10514
- var import_react71 = require("react");
10560
+ var import_react72 = require("react");
10515
10561
 
10516
10562
  // src/components/MarketAccordion.tsx
10517
10563
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
@@ -10573,16 +10619,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
10573
10619
  }
10574
10620
 
10575
10621
  // src/components/LiveFactBlock.tsx
10622
+ var import_react62 = require("react");
10623
+
10624
+ // src/useFactView.ts
10576
10625
  var import_react61 = require("react");
10626
+ var DWELL_MS = 1e3;
10627
+ var seen = /* @__PURE__ */ new Set();
10628
+ function useFactView(ref, fact, entity2) {
10629
+ const log = useEventLog();
10630
+ const entityRef = (0, import_react61.useRef)(entity2);
10631
+ entityRef.current = entity2;
10632
+ const id = fact?.id;
10633
+ const factKey = fact?.factKey;
10634
+ (0, import_react61.useEffect)(() => {
10635
+ if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
10636
+ const el = ref.current;
10637
+ if (!el) return;
10638
+ let timer;
10639
+ const fire = () => {
10640
+ if (seen.has(id)) return;
10641
+ seen.add(id);
10642
+ log.log({ name: "fact_view", ...entityRef.current, factId: String(id), factKey });
10643
+ };
10644
+ const clear = () => {
10645
+ if (timer !== void 0) {
10646
+ clearTimeout(timer);
10647
+ timer = void 0;
10648
+ }
10649
+ };
10650
+ if (typeof IntersectionObserver === "undefined") {
10651
+ timer = setTimeout(fire, DWELL_MS);
10652
+ return clear;
10653
+ }
10654
+ const io = new IntersectionObserver((entries) => {
10655
+ const visible = entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5);
10656
+ if (visible) {
10657
+ if (timer === void 0) timer = setTimeout(fire, DWELL_MS);
10658
+ } else clear();
10659
+ }, { threshold: [0, 0.5] });
10660
+ io.observe(el);
10661
+ return () => {
10662
+ clear();
10663
+ io.disconnect();
10664
+ };
10665
+ }, [id, factKey, log, ref]);
10666
+ }
10667
+
10668
+ // src/components/LiveFactBlock.tsx
10577
10669
  var import_jsx_runtime70 = require("react/jsx-runtime");
10578
10670
  function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10579
- const [expanded, setExpanded] = (0, import_react61.useState)(false);
10671
+ const [expanded, setExpanded] = (0, import_react62.useState)(false);
10580
10672
  const { oddsFormat } = useOddsSettings();
10673
+ const log = useEventLog();
10674
+ const sectionRef = (0, import_react62.useRef)(null);
10581
10675
  const [current, ...earlier] = facts;
10676
+ const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
10677
+ useFactView(sectionRef, current, entity2);
10582
10678
  if (!current) return null;
10583
10679
  const m = current.market;
10584
10680
  const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
10585
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10681
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10586
10682
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-fact-k", children: [
10587
10683
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: ui.liveFactLabel }),
10588
10684
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ss-w-fact-min", children: [
@@ -10608,7 +10704,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10608
10704
  marketDeveloperName: m.marketDeveloperName,
10609
10705
  selectionLabel: m.selectionLabel,
10610
10706
  slip,
10611
- ui
10707
+ ui,
10708
+ fact: { id: current.id, factKey: current.factKey }
10612
10709
  }
10613
10710
  )
10614
10711
  ] })
@@ -10626,7 +10723,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10626
10723
  {
10627
10724
  type: "button",
10628
10725
  className: "ss-w-fact-link",
10629
- onClick: () => onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) }),
10726
+ onClick: () => {
10727
+ log?.log({ name: "fact_ask", ...entity2, factId: String(current.id), factKey: current.factKey });
10728
+ onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) });
10729
+ },
10630
10730
  children: ui.liveFactAsk
10631
10731
  }
10632
10732
  ),
@@ -10645,7 +10745,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10645
10745
  }
10646
10746
 
10647
10747
  // src/components/MonitorFormH2H.tsx
10648
- var import_react62 = require("react");
10748
+ var import_react63 = require("react");
10649
10749
  var import_jsx_runtime71 = require("react/jsx-runtime");
10650
10750
  function resultClass2(result) {
10651
10751
  if (result === "W") return "ss-w-h2h-result--win";
@@ -10661,7 +10761,7 @@ function FormDots({ form, ui }) {
10661
10761
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
10662
10762
  }
10663
10763
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
10664
- const [expanded, setExpanded] = (0, import_react62.useState)(false);
10764
+ const [expanded, setExpanded] = (0, import_react63.useState)(false);
10665
10765
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
10666
10766
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
10667
10767
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, {});
@@ -10894,7 +10994,7 @@ var sportLabel = (ui, sport) => {
10894
10994
  };
10895
10995
 
10896
10996
  // src/components/NbaFormSection.tsx
10897
- var import_react63 = require("react");
10997
+ var import_react64 = require("react");
10898
10998
 
10899
10999
  // src/components/NbaFormRest.tsx
10900
11000
  var import_jsx_runtime74 = require("react/jsx-runtime");
@@ -10993,8 +11093,8 @@ function Row2({ game, abbr, tonight, ui }) {
10993
11093
  ] });
10994
11094
  }
10995
11095
  function NbaFormSection({ match, monitor, ui }) {
10996
- const [open, setOpen] = (0, import_react63.useState)(false);
10997
- const [side, setSide] = (0, import_react63.useState)("away");
11096
+ const [open, setOpen] = (0, import_react64.useState)(false);
11097
+ const [side, setSide] = (0, import_react64.useState)("away");
10998
11098
  const form = useNbaForm(match, monitor);
10999
11099
  const b = match.basketball;
11000
11100
  if (!form || !b || !form.home && !form.away) return null;
@@ -11036,10 +11136,10 @@ function NbaFormSection({ match, monitor, ui }) {
11036
11136
  }
11037
11137
 
11038
11138
  // src/components/NbaPropsSection.tsx
11039
- var import_react65 = require("react");
11139
+ var import_react66 = require("react");
11040
11140
 
11041
11141
  // src/components/PropsPieces.tsx
11042
- var import_react64 = require("react");
11142
+ var import_react65 = require("react");
11043
11143
  var import_jsx_runtime76 = require("react/jsx-runtime");
11044
11144
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11045
11145
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11052,9 +11152,9 @@ function preKickoff(match) {
11052
11152
  return Number.isFinite(kickoff) && Date.now() < kickoff;
11053
11153
  }
11054
11154
  function usePreKickoff(match) {
11055
- const [, setTick] = (0, import_react64.useState)(0);
11155
+ const [, setTick] = (0, import_react65.useState)(0);
11056
11156
  const pre = preKickoff(match);
11057
- (0, import_react64.useEffect)(() => {
11157
+ (0, import_react65.useEffect)(() => {
11058
11158
  if (!pre || !match.kickoffUtc) return;
11059
11159
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11060
11160
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11068,7 +11168,7 @@ function usePropsOpen(match, monitor, descriptor) {
11068
11168
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11069
11169
  const live = match.phase === "live";
11070
11170
  const open = pre || live;
11071
- (0, import_react64.useEffect)(() => {
11171
+ (0, import_react65.useEffect)(() => {
11072
11172
  if (!open) return;
11073
11173
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11074
11174
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11146,7 +11246,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
11146
11246
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11147
11247
  const player = livePlayer(bundle, given);
11148
11248
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
11149
- const [picked, setPicked] = (0, import_react64.useState)(null);
11249
+ const [picked, setPicked] = (0, import_react65.useState)(null);
11150
11250
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
11151
11251
  const sample = active?.games?.length ?? 0;
11152
11252
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -11195,7 +11295,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11195
11295
  ] });
11196
11296
  }
11197
11297
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11198
- const [openId, setOpenId] = (0, import_react64.useState)(null);
11298
+ const [openId, setOpenId] = (0, import_react65.useState)(null);
11199
11299
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
11200
11300
  const p = livePlayer(bundle, given);
11201
11301
  const isOpen = openId === p.playerId;
@@ -11232,12 +11332,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11232
11332
  }
11233
11333
  var BOX_QUIET_MS = 12e4;
11234
11334
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11235
- const [tick, setTick] = (0, import_react64.useState)(0);
11335
+ const [tick, setTick] = (0, import_react65.useState)(0);
11236
11336
  const time = clock2(boxAsOfUtc, ui);
11237
11337
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11238
11338
  const valid = !Number.isNaN(at2);
11239
11339
  const onBreak = atBreak(match);
11240
- (0, import_react64.useEffect)(() => {
11340
+ (0, import_react65.useEffect)(() => {
11241
11341
  if (!valid || onBreak) return;
11242
11342
  const age2 = Date.now() - at2;
11243
11343
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11298,12 +11398,12 @@ var nbaDescriptor = (ui, match) => ({
11298
11398
  tenGameBars: false
11299
11399
  });
11300
11400
  function StatsClock2({ bundle, match, ui }) {
11301
- const [tick, setTick] = (0, import_react65.useState)(0);
11401
+ const [tick, setTick] = (0, import_react66.useState)(0);
11302
11402
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
11303
11403
  const time = clock2(bundle.boxAsOfUtc, ui);
11304
11404
  const valid = !Number.isNaN(at2) && time !== "";
11305
11405
  const onBreak = atBreak(match);
11306
- (0, import_react65.useEffect)(() => {
11406
+ (0, import_react66.useEffect)(() => {
11307
11407
  if (!valid || onBreak) return;
11308
11408
  const age2 = Date.now() - at2;
11309
11409
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11317,7 +11417,7 @@ function StatsClock2({ bundle, match, ui }) {
11317
11417
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
11318
11418
  }
11319
11419
  function NbaPropsSection({ match, monitor, ui, slip }) {
11320
- const [side, setSide] = (0, import_react65.useState)("home");
11420
+ const [side, setSide] = (0, import_react66.useState)("home");
11321
11421
  const descriptor = nbaDescriptor(ui, match);
11322
11422
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11323
11423
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11466,7 +11566,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
11466
11566
  }
11467
11567
 
11468
11568
  // src/components/NflFormSection.tsx
11469
- var import_react66 = require("react");
11569
+ var import_react67 = require("react");
11470
11570
  var import_jsx_runtime79 = require("react/jsx-runtime");
11471
11571
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
11472
11572
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -11518,7 +11618,7 @@ function H2hRow({ game, home, ui }) {
11518
11618
  ] });
11519
11619
  }
11520
11620
  function NflFormSection({ match, monitor, ui }) {
11521
- const [segment, setSegment] = (0, import_react66.useState)("away");
11621
+ const [segment, setSegment] = (0, import_react67.useState)("away");
11522
11622
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
11523
11623
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
11524
11624
  const form = bundle?.form;
@@ -11551,7 +11651,7 @@ function NflFormSection({ match, monitor, ui }) {
11551
11651
  }
11552
11652
 
11553
11653
  // src/components/NflPropsSection.tsx
11554
- var import_react67 = require("react");
11654
+ var import_react68 = require("react");
11555
11655
  var import_jsx_runtime80 = require("react/jsx-runtime");
11556
11656
  var TRENDS_SHOWN = 3;
11557
11657
  var SCORERS_SHOWN = 8;
@@ -11624,7 +11724,7 @@ function ShowMore({ label, onClick }) {
11624
11724
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
11625
11725
  }
11626
11726
  function Trends({ bundle, facts, descriptor, ui, slip }) {
11627
- const [all, setAll] = (0, import_react67.useState)(false);
11727
+ const [all, setAll] = (0, import_react68.useState)(false);
11628
11728
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
11629
11729
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
11630
11730
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -11657,7 +11757,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
11657
11757
  ] });
11658
11758
  }
11659
11759
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11660
- const [all, setAll] = (0, import_react67.useState)(false);
11760
+ const [all, setAll] = (0, import_react68.useState)(false);
11661
11761
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
11662
11762
  const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
11663
11763
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
@@ -11684,7 +11784,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11684
11784
  ] });
11685
11785
  }
11686
11786
  function NflPropsSection({ match, monitor, ui, slip }) {
11687
- const [tab, setTab] = (0, import_react67.useState)(null);
11787
+ const [tab, setTab] = (0, import_react68.useState)(null);
11688
11788
  const descriptor = nflDescriptor(ui);
11689
11789
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11690
11790
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11870,7 +11970,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
11870
11970
  }
11871
11971
 
11872
11972
  // src/components/TennisMonitorCard.tsx
11873
- var import_react69 = require("react");
11973
+ var import_react70 = require("react");
11874
11974
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
11875
11975
 
11876
11976
  // src/components/TennisFixtureRow.tsx
@@ -12131,7 +12231,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12131
12231
  }
12132
12232
 
12133
12233
  // src/components/TennisStatsTables.tsx
12134
- var import_react68 = require("react");
12234
+ var import_react69 = require("react");
12135
12235
  var import_jsx_runtime87 = require("react/jsx-runtime");
12136
12236
  function formatStat(row, value, locale) {
12137
12237
  if (value == null) return "\u2013";
@@ -12169,8 +12269,8 @@ function Tables({ table, labels, names, locale }) {
12169
12269
  ] });
12170
12270
  }
12171
12271
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12172
- const [tab, setTab] = (0, import_react68.useState)("match");
12173
- (0, import_react68.useEffect)(() => {
12272
+ const [tab, setTab] = (0, import_react69.useState)("match");
12273
+ (0, import_react69.useEffect)(() => {
12174
12274
  setTab("match");
12175
12275
  }, [resetKey]);
12176
12276
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12201,7 +12301,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
12201
12301
  ] }),
12202
12302
  today.rows.map((r) => {
12203
12303
  const f = (v) => formatStat({ kind: "pct" }, v, locale);
12204
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react68.Fragment, { children: [
12304
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react69.Fragment, { children: [
12205
12305
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
12206
12306
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
12207
12307
  f(r.p1Today),
@@ -12336,7 +12436,7 @@ function HeadToHead({ t, ui }) {
12336
12436
  ] });
12337
12437
  }
12338
12438
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12339
- const lastTables = (0, import_react69.useRef)(null);
12439
+ const lastTables = (0, import_react70.useRef)(null);
12340
12440
  const t = match.tennis;
12341
12441
  if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12342
12442
  const preMatch = match.phase === "preMatch";
@@ -12416,7 +12516,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12416
12516
  }
12417
12517
 
12418
12518
  // src/components/ScoreboardStrip.tsx
12419
- var import_react70 = require("react");
12519
+ var import_react71 = require("react");
12420
12520
  var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
12421
12521
  var import_jsx_runtime89 = require("react/jsx-runtime");
12422
12522
  function nbaStatus(m, ui) {
@@ -12511,8 +12611,8 @@ function rowsFor(m) {
12511
12611
  ];
12512
12612
  }
12513
12613
  function useStripScroll(selectedKey) {
12514
- const stripRef = (0, import_react70.useRef)(null);
12515
- (0, import_react70.useEffect)(() => {
12614
+ const stripRef = (0, import_react71.useRef)(null);
12615
+ (0, import_react71.useEffect)(() => {
12516
12616
  const strip = stripRef.current;
12517
12617
  const pressed = strip?.querySelector('[aria-pressed="true"]');
12518
12618
  if (!strip || !pressed) return;
@@ -12686,7 +12786,7 @@ function OddsLiveStrip({ m, ui }) {
12686
12786
  ] });
12687
12787
  }
12688
12788
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
12689
- const seedIndex = (0, import_react71.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
12789
+ const seedIndex = (0, import_react72.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
12690
12790
  const tiles = orderTiles(
12691
12791
  monitor.pins,
12692
12792
  monitor.snapshot,
@@ -12758,7 +12858,7 @@ function TrendsPanel({ monitor, ui, slip }) {
12758
12858
  }
12759
12859
 
12760
12860
  // src/components/LivePanel.tsx
12761
- var import_react74 = require("react");
12861
+ var import_react75 = require("react");
12762
12862
  var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
12763
12863
 
12764
12864
  // src/scheduleView.ts
@@ -12933,20 +13033,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
12933
13033
  }
12934
13034
 
12935
13035
  // src/components/MatchSheet.tsx
12936
- var import_react73 = require("react");
13036
+ var import_react74 = require("react");
12937
13037
  var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
12938
13038
 
12939
13039
  // src/useModalDialog.ts
12940
- var import_react72 = require("react");
13040
+ var import_react73 = require("react");
12941
13041
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12942
13042
  function useModalDialog(onClose, opts = {}) {
12943
- const dialogRef = (0, import_react72.useRef)(null);
12944
- const onCloseRef = (0, import_react72.useRef)(onClose);
13043
+ const dialogRef = (0, import_react73.useRef)(null);
13044
+ const onCloseRef = (0, import_react73.useRef)(onClose);
12945
13045
  onCloseRef.current = onClose;
12946
- const openerRef = (0, import_react72.useRef)(opts.opener);
13046
+ const openerRef = (0, import_react73.useRef)(opts.opener);
12947
13047
  openerRef.current = opts.opener;
12948
13048
  const restore = opts.restoreFocus ?? true;
12949
- (0, import_react72.useEffect)(() => {
13049
+ (0, import_react73.useEffect)(() => {
12950
13050
  const dialog = dialogRef.current;
12951
13051
  const root = dialog?.getRootNode();
12952
13052
  const focusedAtMount = root?.activeElement ?? null;
@@ -12957,7 +13057,7 @@ function useModalDialog(onClose, opts = {}) {
12957
13057
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
12958
13058
  };
12959
13059
  }, []);
12960
- (0, import_react72.useEffect)(() => {
13060
+ (0, import_react73.useEffect)(() => {
12961
13061
  const onKey = (e) => {
12962
13062
  if (e.key !== "Escape") return;
12963
13063
  e.stopPropagation();
@@ -12998,8 +13098,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
12998
13098
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
12999
13099
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
13000
13100
  const log = useEventLog();
13001
- const titleId = (0, import_react73.useId)();
13002
- const [limitHit, setLimitHit] = (0, import_react73.useState)(false);
13101
+ const titleId = (0, import_react74.useId)();
13102
+ const [limitHit, setLimitHit] = (0, import_react74.useState)(false);
13003
13103
  const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
13004
13104
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
13005
13105
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -13100,10 +13200,10 @@ var OPEN_TOP_GROUPS = 2;
13100
13200
  var QUIET_ROWS = 4;
13101
13201
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
13102
13202
  const { groups, states, stale } = discovery;
13103
- const [mine, setMine] = (0, import_react74.useState)(false);
13104
- const [toggled, setToggled] = (0, import_react74.useState)(/* @__PURE__ */ new Map());
13105
- const [sheet, setSheet] = (0, import_react74.useState)(null);
13106
- const pinnedKeys = (0, import_react74.useMemo)(
13203
+ const [mine, setMine] = (0, import_react75.useState)(false);
13204
+ const [toggled, setToggled] = (0, import_react75.useState)(/* @__PURE__ */ new Map());
13205
+ const [sheet, setSheet] = (0, import_react75.useState)(null);
13206
+ const pinnedKeys = (0, import_react75.useMemo)(
13107
13207
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
13108
13208
  [monitor.pins]
13109
13209
  );
@@ -13209,20 +13309,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13209
13309
  }
13210
13310
 
13211
13311
  // src/components/ScheduleMatchesPanel.tsx
13212
- var import_react78 = require("react");
13312
+ var import_react79 = require("react");
13213
13313
  var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
13214
13314
 
13215
13315
  // src/useTennisRowPrices.ts
13216
- var import_react75 = require("react");
13316
+ var import_react76 = require("react");
13217
13317
  var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
13218
13318
  var TENNIS_PRICE_POLL_MS = 6e4;
13219
13319
  function useTennisRowPrices(a) {
13220
- const [state, setState] = (0, import_react75.useState)({ byId: null, stale: false });
13221
- const getPricesRef = (0, import_react75.useRef)(a.getPrices);
13320
+ const [state, setState] = (0, import_react76.useState)({ byId: null, stale: false });
13321
+ const getPricesRef = (0, import_react76.useRef)(a.getPrices);
13222
13322
  getPricesRef.current = a.getPrices;
13223
- const latest = (0, import_react75.useRef)(0);
13323
+ const latest = (0, import_react76.useRef)(0);
13224
13324
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13225
- (0, import_react75.useEffect)(() => {
13325
+ (0, import_react76.useEffect)(() => {
13226
13326
  if (!a.enabled || idsKey === "") {
13227
13327
  latest.current++;
13228
13328
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13260,11 +13360,11 @@ function useTennisRowPrices(a) {
13260
13360
  }
13261
13361
 
13262
13362
  // src/components/DayStrip.tsx
13263
- var import_react76 = require("react");
13363
+ var import_react77 = require("react");
13264
13364
  var import_jsx_runtime98 = require("react/jsx-runtime");
13265
13365
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13266
- const listRef = (0, import_react76.useRef)(null);
13267
- (0, import_react76.useEffect)(() => {
13366
+ const listRef = (0, import_react77.useRef)(null);
13367
+ (0, import_react77.useEffect)(() => {
13268
13368
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13269
13369
  if (!el || typeof el.scrollIntoView !== "function") return;
13270
13370
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13293,7 +13393,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13293
13393
  }
13294
13394
 
13295
13395
  // src/components/games/ui/SearchField.tsx
13296
- var import_react77 = require("react");
13396
+ var import_react78 = require("react");
13297
13397
 
13298
13398
  // src/components/games/ui/icons.tsx
13299
13399
  var import_jsx_runtime99 = require("react/jsx-runtime");
@@ -13332,8 +13432,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
13332
13432
  // src/components/games/ui/SearchField.tsx
13333
13433
  var import_jsx_runtime100 = require("react/jsx-runtime");
13334
13434
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13335
- const localRef = (0, import_react77.useRef)(null);
13336
- const setInputRef = (0, import_react77.useCallback)((node) => {
13435
+ const localRef = (0, import_react78.useRef)(null);
13436
+ const setInputRef = (0, import_react78.useCallback)((node) => {
13337
13437
  localRef.current = node;
13338
13438
  if (typeof inputRef === "function") inputRef(node);
13339
13439
  else if (inputRef) inputRef.current = node;
@@ -13379,18 +13479,18 @@ var TOP_ROW_CAP = 3;
13379
13479
  var SKELETON_ROWS = 3;
13380
13480
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
13381
13481
  const { localDate: today, states, stale } = discovery;
13382
- const searchId = (0, import_react78.useId)();
13383
- const [query, setQuery] = (0, import_react78.useState)("");
13384
- const [toggled, setToggled] = (0, import_react78.useState)(/* @__PURE__ */ new Map());
13385
- const [expanded, setExpanded] = (0, import_react78.useState)(/* @__PURE__ */ new Set());
13386
- const listRef = (0, import_react78.useRef)(null);
13387
- const [sheet, setSheet] = (0, import_react78.useState)(null);
13482
+ const searchId = (0, import_react79.useId)();
13483
+ const [query, setQuery] = (0, import_react79.useState)("");
13484
+ const [toggled, setToggled] = (0, import_react79.useState)(/* @__PURE__ */ new Map());
13485
+ const [expanded, setExpanded] = (0, import_react79.useState)(/* @__PURE__ */ new Set());
13486
+ const listRef = (0, import_react79.useRef)(null);
13487
+ const [sheet, setSheet] = (0, import_react79.useState)(null);
13388
13488
  const { chips, selected } = loaded;
13389
- (0, import_react78.useEffect)(() => {
13489
+ (0, import_react79.useEffect)(() => {
13390
13490
  if (selected !== day) onDay(selected);
13391
13491
  }, [day, selected, onDay]);
13392
13492
  const isToday = selected === today;
13393
- const pinnedKeys = (0, import_react78.useMemo)(
13493
+ const pinnedKeys = (0, import_react79.useMemo)(
13394
13494
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
13395
13495
  [monitor.pins]
13396
13496
  );
@@ -13528,7 +13628,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13528
13628
  }
13529
13629
 
13530
13630
  // src/components/GamesPanel.tsx
13531
- var import_react93 = require("react");
13631
+ var import_react94 = require("react");
13532
13632
 
13533
13633
  // src/components/GamesLoginWall.tsx
13534
13634
  var import_jsx_runtime102 = require("react/jsx-runtime");
@@ -13537,7 +13637,7 @@ function GamesLoginWall({ ui }) {
13537
13637
  }
13538
13638
 
13539
13639
  // src/components/GamesHub.tsx
13540
- var import_react79 = require("react");
13640
+ var import_react80 = require("react");
13541
13641
 
13542
13642
  // src/components/games/ui/gameMeta.ts
13543
13643
  function prettifyGameId(gameId) {
@@ -13688,8 +13788,8 @@ function pickHeroGame(games) {
13688
13788
  }
13689
13789
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
13690
13790
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13691
- const [, setTick] = (0, import_react79.useState)(0);
13692
- (0, import_react79.useEffect)(() => {
13791
+ const [, setTick] = (0, import_react80.useState)(0);
13792
+ (0, import_react80.useEffect)(() => {
13693
13793
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
13694
13794
  return () => clearInterval(id);
13695
13795
  }, []);
@@ -13749,10 +13849,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13749
13849
  }
13750
13850
 
13751
13851
  // src/components/GameScreenHost.tsx
13752
- var import_react91 = require("react");
13852
+ var import_react92 = require("react");
13753
13853
 
13754
13854
  // src/useGamePlay.ts
13755
- var import_react80 = require("react");
13855
+ var import_react81 = require("react");
13756
13856
  function toSubmitResult(payload) {
13757
13857
  return {
13758
13858
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -13764,17 +13864,17 @@ function toSubmitResult(payload) {
13764
13864
  };
13765
13865
  }
13766
13866
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
13767
- const [result, setResult] = (0, import_react80.useState)(null);
13768
- const [submitting, setSubmitting] = (0, import_react80.useState)(false);
13769
- const [rawStatus, setRawStatus] = (0, import_react80.useState)(null);
13770
- const inFlightRef = (0, import_react80.useRef)(false);
13771
- const convRef = (0, import_react80.useRef)(conversation);
13867
+ const [result, setResult] = (0, import_react81.useState)(null);
13868
+ const [submitting, setSubmitting] = (0, import_react81.useState)(false);
13869
+ const [rawStatus, setRawStatus] = (0, import_react81.useState)(null);
13870
+ const inFlightRef = (0, import_react81.useRef)(false);
13871
+ const convRef = (0, import_react81.useRef)(conversation);
13772
13872
  convRef.current = conversation;
13773
- const optsRef = (0, import_react80.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
13873
+ const optsRef = (0, import_react81.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
13774
13874
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
13775
- const resultRef = (0, import_react80.useRef)(null);
13875
+ const resultRef = (0, import_react81.useRef)(null);
13776
13876
  resultRef.current = result;
13777
- const refetch = (0, import_react80.useCallback)(async () => {
13877
+ const refetch = (0, import_react81.useCallback)(async () => {
13778
13878
  const conv = convRef.current;
13779
13879
  if (!conv) return;
13780
13880
  const opts = optsRef.current;
@@ -13790,7 +13890,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13790
13890
  } catch {
13791
13891
  }
13792
13892
  }, []);
13793
- const submit = (0, import_react80.useCallback)(async (answerJson) => {
13893
+ const submit = (0, import_react81.useCallback)(async (answerJson) => {
13794
13894
  const conv = convRef.current;
13795
13895
  if (!conv || inFlightRef.current) return;
13796
13896
  inFlightRef.current = true;
@@ -13817,14 +13917,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13817
13917
  setSubmitting(false);
13818
13918
  }
13819
13919
  }, [refetch]);
13820
- const hydrate = (0, import_react80.useCallback)(() => {
13920
+ const hydrate = (0, import_react81.useCallback)(() => {
13821
13921
  void refetch();
13822
13922
  }, [refetch]);
13823
13923
  return { result, submitting, submit, hydrate, rawStatus };
13824
13924
  }
13825
13925
 
13826
13926
  // src/components/games/MysteryTigerGame.tsx
13827
- var import_react82 = require("react");
13927
+ var import_react83 = require("react");
13828
13928
 
13829
13929
  // src/components/games/nationFlags.ts
13830
13930
  var FLAGS = {
@@ -14035,7 +14135,7 @@ function isNationCode(flag) {
14035
14135
  }
14036
14136
 
14037
14137
  // src/components/games/PlayerAvatar.tsx
14038
- var import_react81 = require("react");
14138
+ var import_react82 = require("react");
14039
14139
  var import_jsx_runtime107 = require("react/jsx-runtime");
14040
14140
  function initialsOf(name) {
14041
14141
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -14053,7 +14153,7 @@ function PlayerAvatar({
14053
14153
  imagePath,
14054
14154
  className
14055
14155
  }) {
14056
- const [failed, setFailed] = (0, import_react81.useState)(false);
14156
+ const [failed, setFailed] = (0, import_react82.useState)(false);
14057
14157
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
14058
14158
  return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
14059
14159
  }
@@ -14297,8 +14397,8 @@ function MysteryTigerGame({
14297
14397
  onBack
14298
14398
  }) {
14299
14399
  const t = ui.games.mysteryTiger;
14300
- const [query, setQuery] = (0, import_react82.useState)("");
14301
- const inputId = (0, import_react82.useId)();
14400
+ const [query, setQuery] = (0, import_react83.useState)("");
14401
+ const inputId = (0, import_react83.useId)();
14302
14402
  const clientState = parseClientState(result?.clientStateJson);
14303
14403
  const guessResults = clientState?.guessResults ?? [];
14304
14404
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -14559,13 +14659,13 @@ function HigherOrLowerGame({
14559
14659
  }
14560
14660
 
14561
14661
  // src/components/games/CareerPathGame.tsx
14562
- var import_react84 = require("react");
14662
+ var import_react85 = require("react");
14563
14663
 
14564
14664
  // src/components/games/ui/CrestShield.tsx
14565
- var import_react83 = require("react");
14665
+ var import_react84 = require("react");
14566
14666
  var import_jsx_runtime118 = require("react/jsx-runtime");
14567
14667
  function CrestShield({ src, name, size = 28 }) {
14568
- const [failed, setFailed] = (0, import_react83.useState)(false);
14668
+ const [failed, setFailed] = (0, import_react84.useState)(false);
14569
14669
  if (src && !isPlaceholderImage(src) && !failed) {
14570
14670
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
14571
14671
  }
@@ -14597,8 +14697,8 @@ function CareerPathGame({
14597
14697
  }) {
14598
14698
  const s = ui.games.careerPath;
14599
14699
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
14600
- const [query, setQuery] = (0, import_react84.useState)("");
14601
- const inputId = (0, import_react84.useId)();
14700
+ const [query, setQuery] = (0, import_react85.useState)("");
14701
+ const inputId = (0, import_react85.useId)();
14602
14702
  const clientState = parseClientState3(result?.clientStateJson);
14603
14703
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
14604
14704
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -14704,7 +14804,7 @@ function CareerPathGame({
14704
14804
  }
14705
14805
 
14706
14806
  // src/components/games/BeatTheGridGame.tsx
14707
- var import_react85 = __toESM(require("react"), 1);
14807
+ var import_react86 = __toESM(require("react"), 1);
14708
14808
 
14709
14809
  // src/components/games/ui/OptionList.tsx
14710
14810
  var import_jsx_runtime120 = require("react/jsx-runtime");
@@ -14793,10 +14893,10 @@ function SearchSheet({
14793
14893
  ui
14794
14894
  }) {
14795
14895
  const s = ui.games.beatTheGrid;
14796
- const [query, setQuery] = (0, import_react85.useState)("");
14797
- const inputId = (0, import_react85.useId)();
14798
- const inputRef = (0, import_react85.useRef)(null);
14799
- (0, import_react85.useEffect)(() => {
14896
+ const [query, setQuery] = (0, import_react86.useState)("");
14897
+ const inputId = (0, import_react86.useId)();
14898
+ const inputRef = (0, import_react86.useRef)(null);
14899
+ (0, import_react86.useEffect)(() => {
14800
14900
  inputRef.current?.focus();
14801
14901
  }, [row, col]);
14802
14902
  const filtered = playerPool.filter(
@@ -14861,7 +14961,7 @@ function BeatTheGridGame({
14861
14961
  }) {
14862
14962
  const s = ui.games.beatTheGrid;
14863
14963
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
14864
- const [activeCell, setActiveCell] = (0, import_react85.useState)(null);
14964
+ const [activeCell, setActiveCell] = (0, import_react86.useState)(null);
14865
14965
  const clientState = parseClientState4(result?.clientStateJson);
14866
14966
  const filledCells = clientState?.cells ?? [];
14867
14967
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -14935,7 +15035,7 @@ function BeatTheGridGame({
14935
15035
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
14936
15036
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
14937
15037
  ] });
14938
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react85.default.Fragment, { children: [
15038
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react86.default.Fragment, { children: [
14939
15039
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
14940
15040
  cols.map((colLabel, colIdx) => {
14941
15041
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -15016,7 +15116,7 @@ function BeatTheGridGame({
15016
15116
  }
15017
15117
 
15018
15118
  // src/components/games/GuessTheXiGame.tsx
15019
- var import_react86 = require("react");
15119
+ var import_react87 = require("react");
15020
15120
 
15021
15121
  // src/components/games/ui/PitchSvg.tsx
15022
15122
  var import_jsx_runtime122 = require("react/jsx-runtime");
@@ -15105,8 +15205,8 @@ function GuessTheXiGame({
15105
15205
  onBack
15106
15206
  }) {
15107
15207
  const t = ui.games.guessTheXi;
15108
- const [query, setQuery] = (0, import_react86.useState)("");
15109
- const inputId = (0, import_react86.useId)();
15208
+ const [query, setQuery] = (0, import_react87.useState)("");
15209
+ const inputId = (0, import_react87.useId)();
15110
15210
  const clientState = parseClientState5(result?.clientStateJson);
15111
15211
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
15112
15212
  const solved = clientState?.status === "solved";
@@ -15248,7 +15348,7 @@ function GuessTheXiGame({
15248
15348
  }
15249
15349
 
15250
15350
  // src/components/games/DailyQuizGame.tsx
15251
- var import_react87 = require("react");
15351
+ var import_react88 = require("react");
15252
15352
  var import_jsx_runtime124 = require("react/jsx-runtime");
15253
15353
  function parseClientState6(json) {
15254
15354
  if (!json) return null;
@@ -15289,8 +15389,8 @@ function DailyQuizGame({
15289
15389
  }) {
15290
15390
  const s = ui.games.dailyQuiz;
15291
15391
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
15292
- const [selections, setSelections] = (0, import_react87.useState)(/* @__PURE__ */ new Map());
15293
- const [page, setPage] = (0, import_react87.useState)(0);
15392
+ const [selections, setSelections] = (0, import_react88.useState)(/* @__PURE__ */ new Map());
15393
+ const [page, setPage] = (0, import_react88.useState)(0);
15294
15394
  const clientState = parseClientState6(result?.clientStateJson);
15295
15395
  const results2 = clientState?.results ?? [];
15296
15396
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -15400,7 +15500,7 @@ function DailyQuizGame({
15400
15500
  }
15401
15501
 
15402
15502
  // src/components/games/MatchdayPredictorGame.tsx
15403
- var import_react88 = require("react");
15503
+ var import_react89 = require("react");
15404
15504
  var import_jsx_runtime125 = require("react/jsx-runtime");
15405
15505
  var SCORER_SEARCH_THRESHOLD = 9;
15406
15506
  function parseClientState7(json) {
@@ -15496,12 +15596,12 @@ function MatchdayPredictorGame({
15496
15596
  onBack
15497
15597
  }) {
15498
15598
  const t = ui.games.predictor;
15499
- const [homeScore, setHomeScore] = (0, import_react88.useState)(0);
15500
- const [awayScore, setAwayScore] = (0, import_react88.useState)(0);
15501
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react88.useState)(null);
15502
- const [lastEdited, setLastEdited] = (0, import_react88.useState)("home");
15503
- const [query, setQuery] = (0, import_react88.useState)("");
15504
- const searchId = (0, import_react88.useId)();
15599
+ const [homeScore, setHomeScore] = (0, import_react89.useState)(0);
15600
+ const [awayScore, setAwayScore] = (0, import_react89.useState)(0);
15601
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react89.useState)(null);
15602
+ const [lastEdited, setLastEdited] = (0, import_react89.useState)("home");
15603
+ const [query, setQuery] = (0, import_react89.useState)("");
15604
+ const searchId = (0, import_react89.useId)();
15505
15605
  const clientState = parseClientState7(result?.clientStateJson);
15506
15606
  const alreadyPlayed = result?.alreadyPlayed === true;
15507
15607
  const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
@@ -15668,7 +15768,7 @@ function MatchdayPredictorGame({
15668
15768
  }
15669
15769
 
15670
15770
  // src/components/games/StartingXiGame.tsx
15671
- var import_react89 = require("react");
15771
+ var import_react90 = require("react");
15672
15772
  var import_jsx_runtime126 = require("react/jsx-runtime");
15673
15773
  var POINTS_PER_STARTER = 8;
15674
15774
  var XI_SIZE = 11;
@@ -15712,10 +15812,10 @@ function StartingXiGame({
15712
15812
  lockAtUtc
15713
15813
  }) {
15714
15814
  const t = ui.games.startingXi;
15715
- const [slotPlayers, setSlotPlayers] = (0, import_react89.useState)(() => Array(XI_SIZE).fill(null));
15716
- const [active, setActive] = (0, import_react89.useState)(0);
15717
- const [query, setQuery] = (0, import_react89.useState)("");
15718
- const searchId = (0, import_react89.useId)();
15815
+ const [slotPlayers, setSlotPlayers] = (0, import_react90.useState)(() => Array(XI_SIZE).fill(null));
15816
+ const [active, setActive] = (0, import_react90.useState)(0);
15817
+ const [query, setQuery] = (0, import_react90.useState)("");
15818
+ const searchId = (0, import_react90.useId)();
15719
15819
  const clientState = parseClientState8(result?.clientStateJson);
15720
15820
  const alreadyPlayed = result?.alreadyPlayed === true;
15721
15821
  const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
@@ -15854,7 +15954,7 @@ function StartingXiGame({
15854
15954
  }
15855
15955
 
15856
15956
  // src/components/games/StatLadderGame.tsx
15857
- var import_react90 = require("react");
15957
+ var import_react91 = require("react");
15858
15958
  var import_jsx_runtime127 = require("react/jsx-runtime");
15859
15959
  function ladderClue(ladder) {
15860
15960
  const mystery = ladder.find((r) => r.rank === 2);
@@ -15891,9 +15991,9 @@ function StatLadderGame({
15891
15991
  onBack
15892
15992
  }) {
15893
15993
  const t = ui.games.statLadder;
15894
- const [query, setQuery] = (0, import_react90.useState)("");
15895
- const [selectedId, setSelectedId] = (0, import_react90.useState)(null);
15896
- const searchId = (0, import_react90.useId)();
15994
+ const [query, setQuery] = (0, import_react91.useState)("");
15995
+ const [selectedId, setSelectedId] = (0, import_react91.useState)(null);
15996
+ const searchId = (0, import_react91.useId)();
15897
15997
  const clientState = parseClientState9(result?.clientStateJson);
15898
15998
  const revealed = clientState != null;
15899
15999
  const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
@@ -16099,8 +16199,8 @@ function GameScreenHost({
16099
16199
  ui
16100
16200
  }) {
16101
16201
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16102
- const [configJson, setConfigJson] = (0, import_react91.useState)(null);
16103
- (0, import_react91.useEffect)(() => {
16202
+ const [configJson, setConfigJson] = (0, import_react92.useState)(null);
16203
+ (0, import_react92.useEffect)(() => {
16104
16204
  setConfigJson(null);
16105
16205
  if (!conversation) return;
16106
16206
  let cancelled = false;
@@ -16123,12 +16223,12 @@ function GameScreenHost({
16123
16223
  fixtureId: fixtureId || void 0,
16124
16224
  locale: ui.hostTag
16125
16225
  });
16126
- (0, import_react91.useEffect)(() => {
16226
+ (0, import_react92.useEffect)(() => {
16127
16227
  if (conversation) hydrate();
16128
16228
  }, [conversation, gameId]);
16129
- const hydrateRef = (0, import_react91.useRef)(hydrate);
16229
+ const hydrateRef = (0, import_react92.useRef)(hydrate);
16130
16230
  hydrateRef.current = hydrate;
16131
- (0, import_react91.useEffect)(() => {
16231
+ (0, import_react92.useEffect)(() => {
16132
16232
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16133
16233
  if (rawStatus !== "pending") return;
16134
16234
  const timerId = setInterval(() => {
@@ -16241,7 +16341,7 @@ function GameScreenHost({
16241
16341
  }
16242
16342
 
16243
16343
  // src/components/Leaderboard.tsx
16244
- var import_react92 = require("react");
16344
+ var import_react93 = require("react");
16245
16345
 
16246
16346
  // src/components/LeaderboardRow.tsx
16247
16347
  var import_jsx_runtime130 = require("react/jsx-runtime");
@@ -16328,7 +16428,7 @@ function Leaderboard({
16328
16428
  ui,
16329
16429
  onPlay
16330
16430
  }) {
16331
- const [segment, setSegment] = (0, import_react92.useState)("weekly");
16431
+ const [segment, setSegment] = (0, import_react93.useState)("weekly");
16332
16432
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
16333
16433
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
16334
16434
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -16433,9 +16533,9 @@ function GamesPanel({
16433
16533
  leaderboardLoading,
16434
16534
  refreshHub
16435
16535
  }) {
16436
- const [selected, setSelected] = (0, import_react93.useState)(null);
16437
- const [segment, setSegment] = (0, import_react93.useState)("play");
16438
- (0, import_react93.useEffect)(() => {
16536
+ const [selected, setSelected] = (0, import_react94.useState)(null);
16537
+ const [segment, setSegment] = (0, import_react94.useState)("play");
16538
+ (0, import_react94.useEffect)(() => {
16439
16539
  ensureGamesFonts();
16440
16540
  }, []);
16441
16541
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
@@ -16499,10 +16599,10 @@ function GamesPanel({
16499
16599
  }
16500
16600
 
16501
16601
  // src/components/FavouritesPanel.tsx
16502
- var import_react96 = require("react");
16602
+ var import_react97 = require("react");
16503
16603
 
16504
16604
  // src/components/FavouriteChips.tsx
16505
- var import_react94 = require("react");
16605
+ var import_react95 = require("react");
16506
16606
  var import_jsx_runtime135 = require("react/jsx-runtime");
16507
16607
  async function toggleWithNotice(controller, kind, id, onNotice) {
16508
16608
  const outcome = await controller.toggle(kind, id);
@@ -16549,12 +16649,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
16549
16649
  ] });
16550
16650
  }
16551
16651
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
16552
- const [confirming, setConfirming] = (0, import_react94.useState)(false);
16652
+ const [confirming, setConfirming] = (0, import_react95.useState)(false);
16553
16653
  const data = controller.data;
16554
- (0, import_react94.useEffect)(() => {
16654
+ (0, import_react95.useEffect)(() => {
16555
16655
  setConfirming(false);
16556
16656
  }, [sport]);
16557
- (0, import_react94.useEffect)(() => {
16657
+ (0, import_react95.useEffect)(() => {
16558
16658
  if (!confirming) return;
16559
16659
  const onPointerDown = (e) => {
16560
16660
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -16608,21 +16708,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
16608
16708
  }
16609
16709
 
16610
16710
  // src/components/FavouritesSearch.tsx
16611
- var import_react95 = require("react");
16711
+ var import_react96 = require("react");
16612
16712
  var import_jsx_runtime136 = require("react/jsx-runtime");
16613
16713
  var MIN_LETTERS = 2;
16614
16714
  var MAX_LENGTH = 64;
16615
16715
  var DEBOUNCE_MS = 250;
16616
16716
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
16617
- const [query, setQuery] = (0, import_react95.useState)("");
16618
- const [answer, setAnswer] = (0, import_react95.useState)(null);
16619
- const controllerRef = (0, import_react95.useRef)(controller);
16717
+ const [query, setQuery] = (0, import_react96.useState)("");
16718
+ const [answer, setAnswer] = (0, import_react96.useState)(null);
16719
+ const controllerRef = (0, import_react96.useRef)(controller);
16620
16720
  controllerRef.current = controller;
16621
16721
  const trimmed = query.trim();
16622
16722
  const queryKey = `${sport}|${trimmed}`;
16623
16723
  const results2 = answer?.key === queryKey ? answer.rows : [];
16624
16724
  const settled = answer?.key === queryKey;
16625
- (0, import_react95.useEffect)(() => {
16725
+ (0, import_react96.useEffect)(() => {
16626
16726
  setAnswer(null);
16627
16727
  if (trimmed.length < MIN_LETTERS) return;
16628
16728
  let cancelled = false;
@@ -16685,13 +16785,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
16685
16785
  // src/components/FavouritesPanel.tsx
16686
16786
  var import_jsx_runtime137 = require("react/jsx-runtime");
16687
16787
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16688
- const [notice, setNotice] = (0, import_react96.useState)(null);
16689
- const refreshRef = (0, import_react96.useRef)(controller.refresh);
16788
+ const [notice, setNotice] = (0, import_react97.useState)(null);
16789
+ const refreshRef = (0, import_react97.useRef)(controller.refresh);
16690
16790
  refreshRef.current = controller.refresh;
16691
- (0, import_react96.useEffect)(() => {
16791
+ (0, import_react97.useEffect)(() => {
16692
16792
  void refreshRef.current();
16693
16793
  }, []);
16694
- (0, import_react96.useEffect)(() => {
16794
+ (0, import_react97.useEffect)(() => {
16695
16795
  setNotice(null);
16696
16796
  }, [sport]);
16697
16797
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -16717,7 +16817,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16717
16817
  }
16718
16818
 
16719
16819
  // src/components/dashboard/v8/SentenceBuilder.tsx
16720
- var import_react97 = require("react");
16820
+ var import_react98 = require("react");
16721
16821
  var import_jsx_runtime138 = require("react/jsx-runtime");
16722
16822
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
16723
16823
  var BASE_LEGS = [1, 2, 3, 4];
@@ -16743,8 +16843,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16743
16843
  const opening = openingGames(preset);
16744
16844
  const gamesOptions = opening.options;
16745
16845
  const marketOptions = usableMarkets(preset);
16746
- const [fingerprint] = (0, import_react97.useState)(() => JSON.stringify(preset));
16747
- const [saved] = (0, import_react97.useState)(() => {
16846
+ const [fingerprint] = (0, import_react98.useState)(() => JSON.stringify(preset));
16847
+ const [saved] = (0, import_react98.useState)(() => {
16748
16848
  const kept = memory3?.savedView(sport);
16749
16849
  return kept && kept.fingerprint === fingerprint ? kept : null;
16750
16850
  });
@@ -16758,9 +16858,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16758
16858
  // The server never widens by itself: an all-games preset with no ids asks for it.
16759
16859
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
16760
16860
  };
16761
- const [view, setView] = (0, import_react97.useState)(() => saved?.view ?? openingView);
16762
- const autoWidened = (0, import_react97.useRef)(false);
16763
- const [widenedNote, setWidenedNote] = (0, import_react97.useState)(saved?.widenedNote ?? false);
16861
+ const [view, setView] = (0, import_react98.useState)(() => saved?.view ?? openingView);
16862
+ const autoWidened = (0, import_react98.useRef)(false);
16863
+ const [widenedNote, setWidenedNote] = (0, import_react98.useState)(saved?.widenedNote ?? false);
16764
16864
  const requestFor = (v) => ({
16765
16865
  sport,
16766
16866
  ...v.marketKey !== null ? { marketKey: v.marketKey } : {},
@@ -16772,10 +16872,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16772
16872
  ...operatorUserId ? { operatorUserId } : {},
16773
16873
  ...anonymousUserId ? { anonymousUserId } : {}
16774
16874
  });
16775
- const [first] = (0, import_react97.useState)(() => requestFor(view));
16875
+ const [first] = (0, import_react98.useState)(() => requestFor(view));
16776
16876
  const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
16777
- const lastRequest = (0, import_react97.useRef)(first);
16778
- (0, import_react97.useEffect)(() => {
16877
+ const lastRequest = (0, import_react98.useRef)(first);
16878
+ (0, import_react98.useEffect)(() => {
16779
16879
  void request(lastRequest.current);
16780
16880
  }, [request]);
16781
16881
  const send = (req) => {
@@ -16808,17 +16908,17 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16808
16908
  const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
16809
16909
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
16810
16910
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
16811
- const [startedNote, setStartedNote] = (0, import_react97.useState)(false);
16911
+ const [startedNote, setStartedNote] = (0, import_react98.useState)(false);
16812
16912
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
16813
- (0, import_react97.useEffect)(() => {
16913
+ (0, import_react98.useEffect)(() => {
16814
16914
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
16815
16915
  }, [startedNote, status2, anyStarted]);
16816
16916
  const market = rows?.[0]?.market;
16817
- const [seen, setSeen] = (0, import_react97.useState)(null);
16818
- (0, import_react97.useEffect)(() => {
16917
+ const [seen2, setSeen] = (0, import_react98.useState)(null);
16918
+ (0, import_react98.useEffect)(() => {
16819
16919
  if (market) setSeen(market);
16820
16920
  }, [market]);
16821
- const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
16921
+ const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
16822
16922
  const paused = ready && grid.status === "paused";
16823
16923
  const coolOff = status2 === "ready" && grid === null;
16824
16924
  const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
@@ -16828,14 +16928,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16828
16928
  const quotedAt = rows ? oldestQuote(rows) : null;
16829
16929
  const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
16830
16930
  const canWiden = gamesOptions === null || allGames !== null;
16831
- (0, import_react97.useEffect)(() => {
16931
+ (0, import_react98.useEffect)(() => {
16832
16932
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
16833
16933
  autoWidened.current = true;
16834
16934
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
16835
16935
  commit(next, true);
16836
16936
  send(requestFor(next));
16837
16937
  }, [empty2, singles, widened, canWiden, view]);
16838
- (0, import_react97.useEffect)(() => {
16938
+ (0, import_react98.useEffect)(() => {
16839
16939
  if (coolOff) onCoolOff?.(sport);
16840
16940
  }, [coolOff, onCoolOff, sport]);
16841
16941
  if (coolOff) return null;
@@ -17238,10 +17338,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
17238
17338
  }
17239
17339
 
17240
17340
  // src/components/PlayerPhoto.tsx
17241
- var import_react98 = require("react");
17341
+ var import_react99 = require("react");
17242
17342
  var import_jsx_runtime144 = require("react/jsx-runtime");
17243
17343
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
17244
- const [failed, setFailed] = (0, import_react98.useState)(false);
17344
+ const [failed, setFailed] = (0, import_react99.useState)(false);
17245
17345
  const box = { width: size, height: size };
17246
17346
  if (photoUrl && !failed) {
17247
17347
  return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -17276,7 +17376,7 @@ function MiniPitch({ positionCode }) {
17276
17376
  }
17277
17377
 
17278
17378
  // src/components/PerformanceBars.tsx
17279
- var import_react99 = require("react");
17379
+ var import_react100 = require("react");
17280
17380
  var import_jsx_runtime146 = require("react/jsx-runtime");
17281
17381
  var GROUPS = ["shooting", "passing", "possession", "defending"];
17282
17382
  function finite4(v) {
@@ -17322,7 +17422,7 @@ function unrankedLine(ui, reason) {
17322
17422
  }
17323
17423
  }
17324
17424
  function PerformanceBars({ performance, competitionName, strings }) {
17325
- const [mode, setMode] = (0, import_react99.useState)("total");
17425
+ const [mode, setMode] = (0, import_react100.useState)("total");
17326
17426
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
17327
17427
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
17328
17428
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -17494,11 +17594,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
17494
17594
  }
17495
17595
 
17496
17596
  // src/components/PresetTools.tsx
17497
- var import_react100 = require("react");
17597
+ var import_react101 = require("react");
17498
17598
  var import_jsx_runtime148 = require("react/jsx-runtime");
17499
17599
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17500
17600
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
17501
- const titleId = (0, import_react100.useId)();
17601
+ const titleId = (0, import_react101.useId)();
17502
17602
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
17503
17603
  /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
17504
17604
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
@@ -17548,9 +17648,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
17548
17648
  const totalOptions = comboTotals(grid);
17549
17649
  const totals = totalOptions.map((o) => o.value);
17550
17650
  const legChoices = comboLegChoices(grid);
17551
- const [total, setTotal] = (0, import_react100.useState)(() => nearest(totals, initialTotal));
17552
- const [legs, setLegs] = (0, import_react100.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17553
- const [announcement, setAnnouncement] = (0, import_react100.useState)("");
17651
+ const [total, setTotal] = (0, import_react101.useState)(() => nearest(totals, initialTotal));
17652
+ const [legs, setLegs] = (0, import_react101.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17653
+ const [announcement, setAnnouncement] = (0, import_react101.useState)("");
17554
17654
  const cell2 = findCombo(grid, total, legs);
17555
17655
  const minLegs = legChoices[0] ?? legs;
17556
17656
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -17620,8 +17720,8 @@ function SettingsSheet({ ui, onClose }) {
17620
17720
  var import_jsx_runtime150 = require("react/jsx-runtime");
17621
17721
  var FULLSCREEN_QUERY = "(max-width: 639px)";
17622
17722
  function useIsModal() {
17623
- const [modal, setModal] = (0, import_react101.useState)(false);
17624
- (0, import_react101.useEffect)(() => {
17723
+ const [modal, setModal] = (0, import_react102.useState)(false);
17724
+ (0, import_react102.useEffect)(() => {
17625
17725
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
17626
17726
  const mql = window.matchMedia(FULLSCREEN_QUERY);
17627
17727
  const sync = () => setModal(mql.matches);
@@ -17635,12 +17735,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
17635
17735
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
17636
17736
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
17637
17737
  const { state, close, stop, send, reset } = controller;
17638
- const [squadView, setSquadView] = (0, import_react101.useState)("roster");
17639
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react101.useState)(null);
17738
+ const [squadView, setSquadView] = (0, import_react102.useState)("roster");
17739
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react102.useState)(null);
17640
17740
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
17641
17741
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
17642
- const squadLayerRef = (0, import_react101.useRef)(null);
17643
- const squadScrollRef = (0, import_react101.useRef)(null);
17742
+ const squadLayerRef = (0, import_react102.useRef)(null);
17743
+ const squadScrollRef = (0, import_react102.useRef)(null);
17644
17744
  const selectPlayer = (playerId) => {
17645
17745
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
17646
17746
  setSelectedPlayerId(playerId);
@@ -17650,7 +17750,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17650
17750
  setSelectedPlayerId(null);
17651
17751
  clearPlayerDetail?.();
17652
17752
  };
17653
- (0, import_react101.useLayoutEffect)(() => {
17753
+ (0, import_react102.useLayoutEffect)(() => {
17654
17754
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
17655
17755
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
17656
17756
  if (list) list.scrollTop = squadScrollRef.current;
@@ -17663,16 +17763,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17663
17763
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
17664
17764
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
17665
17765
  const activeTab = tabs?.activeTab;
17666
- (0, import_react101.useEffect)(() => {
17766
+ (0, import_react102.useEffect)(() => {
17667
17767
  if (activeTab === "squad" || selectedPlayerId === null) return;
17668
17768
  setSelectedPlayerId(null);
17669
17769
  clearPlayerDetail?.();
17670
17770
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
17671
- (0, import_react101.useEffect)(() => {
17771
+ (0, import_react102.useEffect)(() => {
17672
17772
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
17673
17773
  }, [activeTab, favouritesEnabled, setMonitorTab]);
17674
17774
  const storedTab = tabState?.activeTab;
17675
- (0, import_react101.useEffect)(() => {
17775
+ (0, import_react102.useEffect)(() => {
17676
17776
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
17677
17777
  if (unreachable) setMonitorTab?.("chat");
17678
17778
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -17681,11 +17781,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17681
17781
  const closeTab = tabs?.activeTab ?? "chat";
17682
17782
  const lastMessage = state.messages[state.messages.length - 1];
17683
17783
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
17684
- const closeWith = (0, import_react101.useCallback)((method) => {
17784
+ const closeWith = (0, import_react102.useCallback)((method) => {
17685
17785
  track({ name: "widget_close", method, tab: closeTab, answering });
17686
17786
  close();
17687
17787
  }, [track, closeTab, answering, close]);
17688
- (0, import_react101.useEffect)(() => {
17788
+ (0, import_react102.useEffect)(() => {
17689
17789
  const onKey = (e) => {
17690
17790
  if (e.key === "Escape") closeWith("escape");
17691
17791
  };
@@ -17701,64 +17801,64 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17701
17801
  tabs?.setActiveTab("chat");
17702
17802
  send(text2, { grounding, source });
17703
17803
  };
17704
- (0, import_react101.useEffect)(() => {
17804
+ (0, import_react102.useEffect)(() => {
17705
17805
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
17706
17806
  }, [monitor, state.isStreaming, state.messages.length]);
17707
17807
  const onChatTab = !tabs || tabs.activeTab === "chat";
17708
- const inputRef = (0, import_react101.useRef)(null);
17709
- const limitRef = (0, import_react101.useRef)(null);
17710
- const typedSendRef = (0, import_react101.useRef)(false);
17711
- const focusAfterCloseRef = (0, import_react101.useRef)(null);
17712
- const [tool, setTool] = (0, import_react101.useState)(null);
17713
- const panelRef = (0, import_react101.useRef)(null);
17808
+ const inputRef = (0, import_react102.useRef)(null);
17809
+ const limitRef = (0, import_react102.useRef)(null);
17810
+ const typedSendRef = (0, import_react102.useRef)(false);
17811
+ const focusAfterCloseRef = (0, import_react102.useRef)(null);
17812
+ const [tool, setTool] = (0, import_react102.useState)(null);
17813
+ const panelRef = (0, import_react102.useRef)(null);
17714
17814
  const settings = useOddsSettings();
17715
- const [settingsOpen, setSettingsOpen] = (0, import_react101.useState)(false);
17815
+ const [settingsOpen, setSettingsOpen] = (0, import_react102.useState)(false);
17716
17816
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
17717
- const openSettings = (0, import_react101.useCallback)(() => {
17817
+ const openSettings = (0, import_react102.useCallback)(() => {
17718
17818
  setTool(null);
17719
17819
  setSettingsOpen(true);
17720
17820
  }, []);
17721
- const closeSettings = (0, import_react101.useCallback)(() => {
17821
+ const closeSettings = (0, import_react102.useCallback)(() => {
17722
17822
  setSettingsOpen(false);
17723
17823
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
17724
17824
  }, []);
17725
17825
  const paused = isPaused(state.limit);
17726
- (0, import_react101.useEffect)(() => {
17826
+ (0, import_react102.useEffect)(() => {
17727
17827
  if (paused) setTool(null);
17728
17828
  }, [paused]);
17729
- (0, import_react101.useEffect)(() => {
17829
+ (0, import_react102.useEffect)(() => {
17730
17830
  if (!paused) return;
17731
17831
  if (typedSendRef.current) limitRef.current?.focus();
17732
17832
  typedSendRef.current = false;
17733
17833
  }, [paused]);
17734
- const openTool = (0, import_react101.useCallback)((next) => {
17834
+ const openTool = (0, import_react102.useCallback)((next) => {
17735
17835
  setTool(next);
17736
17836
  }, []);
17737
- const toolsValue = (0, import_react101.useMemo)(
17837
+ const toolsValue = (0, import_react102.useMemo)(
17738
17838
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
17739
17839
  [presetGrid, paused, openTool, ui.presets.changeCombo]
17740
17840
  );
17741
- const closeTool = (0, import_react101.useCallback)(() => {
17841
+ const closeTool = (0, import_react102.useCallback)(() => {
17742
17842
  focusAfterCloseRef.current = "composer";
17743
17843
  setTool(null);
17744
17844
  }, []);
17745
- const sendAsk = (0, import_react101.useCallback)((ask) => {
17845
+ const sendAsk = (0, import_react102.useCallback)((ask) => {
17746
17846
  focusAfterCloseRef.current = "composer";
17747
17847
  setTool(null);
17748
17848
  tabs?.setActiveTab("chat");
17749
17849
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
17750
17850
  }, [tabs, send]);
17751
- const formatKickoff = (0, import_react101.useCallback)((kickoffUtc) => {
17851
+ const formatKickoff = (0, import_react102.useCallback)((kickoffUtc) => {
17752
17852
  const k = ui.bettingKickoff(kickoffUtc);
17753
17853
  return `${k.dayLabel} ${k.time}`;
17754
17854
  }, [ui]);
17755
- (0, import_react101.useEffect)(() => {
17855
+ (0, import_react102.useEffect)(() => {
17756
17856
  if (tool) return;
17757
17857
  const target = focusAfterCloseRef.current;
17758
17858
  focusAfterCloseRef.current = null;
17759
17859
  if (target === "composer") inputRef.current?.focus();
17760
17860
  }, [tool]);
17761
- (0, import_react101.useEffect)(() => {
17861
+ (0, import_react102.useEffect)(() => {
17762
17862
  if (!tool || onChatTab && presetGrid) return;
17763
17863
  focusAfterCloseRef.current = "composer";
17764
17864
  setTool(null);
@@ -20710,12 +20810,12 @@ function injectStyles(root) {
20710
20810
  function StatsWidget(props) {
20711
20811
  const injectedClient = "client" in props ? props.client : void 0;
20712
20812
  const cfg = props.config;
20713
- const built = (0, import_react102.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20714
- const trackingRef = (0, import_react102.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20715
- const track = (0, import_react102.useMemo)(() => createTracker(() => trackingRef.current), []);
20716
- const eventTextRef = (0, import_react102.useRef)(false);
20813
+ const built = (0, import_react103.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20814
+ const trackingRef = (0, import_react103.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20815
+ const track = (0, import_react103.useMemo)(() => createTracker(() => trackingRef.current), []);
20816
+ const eventTextRef = (0, import_react103.useRef)(false);
20717
20817
  eventTextRef.current = cfg?.eventText === true;
20718
- const logger = (0, import_react102.useMemo)(() => {
20818
+ const logger = (0, import_react103.useMemo)(() => {
20719
20819
  if (!built) return null;
20720
20820
  const raw = built.client.createEventLogger({
20721
20821
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -20725,34 +20825,34 @@ function StatsWidget(props) {
20725
20825
  }, [built?.client, track]);
20726
20826
  const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
20727
20827
  const stringsPending = widgetStrings.strings === void 0;
20728
- const ui = (0, import_react102.useMemo)(
20828
+ const ui = (0, import_react103.useMemo)(
20729
20829
  () => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
20730
20830
  [props.config, widgetStrings.strings]
20731
20831
  );
20732
20832
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
20733
- const rootRef = (0, import_react102.useRef)(null);
20734
- const introDoneRef = (0, import_react102.useRef)(false);
20735
- const markIntroDone = (0, import_react102.useCallback)(() => {
20833
+ const rootRef = (0, import_react103.useRef)(null);
20834
+ const introDoneRef = (0, import_react103.useRef)(false);
20835
+ const markIntroDone = (0, import_react103.useCallback)(() => {
20736
20836
  introDoneRef.current = true;
20737
20837
  }, []);
20738
20838
  const language = injectedClient ? void 0 : hostTag(cfg);
20739
20839
  const threadLanguage = familyOf(language);
20740
20840
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
20741
- const sportScope = (0, import_react102.useMemo)(
20841
+ const sportScope = (0, import_react103.useMemo)(
20742
20842
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
20743
20843
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
20744
20844
  );
20745
- const chatTracking = (0, import_react102.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
20845
+ const chatTracking = (0, import_react103.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
20746
20846
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
20747
20847
  const panelOpen = controller.state.isOpen && !stringsPending;
20748
- const liveCardWatches = (0, import_react102.useMemo)(() => {
20749
- const seen = /* @__PURE__ */ new Set();
20848
+ const liveCardWatches = (0, import_react103.useMemo)(() => {
20849
+ const seen2 = /* @__PURE__ */ new Set();
20750
20850
  const out = [];
20751
20851
  for (const msg of controller.state.messages) {
20752
20852
  if (msg.role !== "assistant") continue;
20753
20853
  for (const vm of msg.marketOdds) {
20754
- if (vm.live == null || seen.has(vm.matchId)) continue;
20755
- seen.add(vm.matchId);
20854
+ if (vm.live == null || seen2.has(vm.matchId)) continue;
20855
+ seen2.add(vm.matchId);
20756
20856
  out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
20757
20857
  }
20758
20858
  }
@@ -20771,19 +20871,19 @@ function StatsWidget(props) {
20771
20871
  });
20772
20872
  const operatorUserId = cfg?.userContext?.operatorUserId;
20773
20873
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
20774
- const getSchedule = (0, import_react102.useCallback)(
20874
+ const getSchedule = (0, import_react103.useCallback)(
20775
20875
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
20776
20876
  [built, operatorUserId, anonymousUserId]
20777
20877
  );
20778
- const getStates = (0, import_react102.useCallback)(
20878
+ const getStates = (0, import_react103.useCallback)(
20779
20879
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
20780
20880
  [built, requestTag]
20781
20881
  );
20782
- const getTennisPrices = (0, import_react102.useCallback)(
20882
+ const getTennisPrices = (0, import_react103.useCallback)(
20783
20883
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
20784
20884
  [built, requestTag]
20785
20885
  );
20786
- const pinnedMatchIds = (0, import_react102.useMemo)(
20886
+ const pinnedMatchIds = (0, import_react103.useMemo)(
20787
20887
  () => footballMatchPinIds(monitor.pins),
20788
20888
  [monitor.pins]
20789
20889
  );
@@ -20797,13 +20897,13 @@ function StatsWidget(props) {
20797
20897
  pinnedMatchIds,
20798
20898
  timeZone: ui.timeZone
20799
20899
  });
20800
- const offeredSports = (0, import_react102.useMemo)(() => {
20801
- const seen = new Set(discovery.matchDays.map((d) => d.sport));
20802
- for (const g of discovery.groups) seen.add(g.sport ?? "football");
20803
- return [...seen];
20900
+ const offeredSports = (0, import_react103.useMemo)(() => {
20901
+ const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
20902
+ for (const g of discovery.groups) seen2.add(g.sport ?? "football");
20903
+ return [...seen2];
20804
20904
  }, [discovery.matchDays, discovery.groups]);
20805
20905
  const scheduleSport = useScheduleSport(offeredSports);
20806
- const [liveLeague, setLiveLeague] = (0, import_react102.useState)(null);
20906
+ const [liveLeague, setLiveLeague] = (0, import_react103.useState)(null);
20807
20907
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
20808
20908
  const matchesLoaded = useMatchesDay({
20809
20909
  discovery,
@@ -20813,8 +20913,8 @@ function StatsWidget(props) {
20813
20913
  enabled: panelOpen && monitor.activeTab === "matches",
20814
20914
  timeZone: ui.timeZone
20815
20915
  });
20816
- const prevLiveSnapshotRef = (0, import_react102.useRef)(monitor.snapshot);
20817
- (0, import_react102.useEffect)(() => {
20916
+ const prevLiveSnapshotRef = (0, import_react103.useRef)(monitor.snapshot);
20917
+ (0, import_react103.useEffect)(() => {
20818
20918
  const snap = monitor.snapshot;
20819
20919
  if (!snap || snap === prevLiveSnapshotRef.current) return;
20820
20920
  prevLiveSnapshotRef.current = snap;
@@ -20854,14 +20954,14 @@ function StatsWidget(props) {
20854
20954
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20855
20955
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20856
20956
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
20857
- const [favSportPick, setFavSportPick] = (0, import_react102.useState)(null);
20858
- const latestGreeting = (0, import_react102.useMemo)(() => {
20957
+ const [favSportPick, setFavSportPick] = (0, import_react103.useState)(null);
20958
+ const latestGreeting = (0, import_react103.useMemo)(() => {
20859
20959
  for (const m of [...controller.state.messages].reverse()) {
20860
20960
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
20861
20961
  }
20862
20962
  return null;
20863
20963
  }, [controller.state.messages]);
20864
- const favSportOptions = (0, import_react102.useMemo)(
20964
+ const favSportOptions = (0, import_react103.useMemo)(
20865
20965
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
20866
20966
  [latestGreeting]
20867
20967
  );
@@ -20870,20 +20970,20 @@ function StatsWidget(props) {
20870
20970
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
20871
20971
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
20872
20972
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
20873
- const [builderSportPick, setBuilderSportPick] = (0, import_react102.useState)(null);
20874
- const builderGreeting = (0, import_react102.useMemo)(
20973
+ const [builderSportPick, setBuilderSportPick] = (0, import_react103.useState)(null);
20974
+ const builderGreeting = (0, import_react103.useMemo)(
20875
20975
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
20876
20976
  [controller.state.messages]
20877
20977
  );
20878
- const [coolOff, setCoolOff] = (0, import_react102.useState)(null);
20879
- const onBuilderCoolOff = (0, import_react102.useCallback)((sport) => {
20978
+ const [coolOff, setCoolOff] = (0, import_react103.useState)(null);
20979
+ const onBuilderCoolOff = (0, import_react103.useCallback)((sport) => {
20880
20980
  if (!builderGreeting) return;
20881
20981
  setCoolOff((prev) => {
20882
20982
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
20883
20983
  return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
20884
20984
  });
20885
20985
  }, [builderGreeting]);
20886
- const builderOptions = (0, import_react102.useMemo)(() => {
20986
+ const builderOptions = (0, import_react103.useMemo)(() => {
20887
20987
  const greeting = builderGreeting;
20888
20988
  if (!greeting) return [];
20889
20989
  const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
@@ -20896,7 +20996,7 @@ function StatsWidget(props) {
20896
20996
  return options.filter((o) => !cooled.includes(o.sport));
20897
20997
  }, [builderGreeting, coolOff, ui]);
20898
20998
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
20899
- const [panelEverOpened, setPanelEverOpened] = (0, import_react102.useState)(panelOpen);
20999
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react103.useState)(panelOpen);
20900
21000
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
20901
21001
  const favourites = useFavourites({
20902
21002
  conversation: built?.conversation ?? null,
@@ -20908,14 +21008,14 @@ function StatsWidget(props) {
20908
21008
  onChanged: discovery.refreshSchedule
20909
21009
  });
20910
21010
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
20911
- const getPricePresets = (0, import_react102.useCallback)(
21011
+ const getPricePresets = (0, import_react103.useCallback)(
20912
21012
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
20913
21013
  [built]
20914
21014
  );
20915
21015
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
20916
21016
  const markLiveActivity = monitor.markLiveActivity;
20917
- const prevLiveCountRef = (0, import_react102.useRef)(0);
20918
- (0, import_react102.useEffect)(() => {
21017
+ const prevLiveCountRef = (0, import_react103.useRef)(0);
21018
+ (0, import_react103.useEffect)(() => {
20919
21019
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
20920
21020
  prevLiveCountRef.current = discovery.liveCount;
20921
21021
  if (rose) markLiveActivity();
@@ -20929,7 +21029,7 @@ function StatsWidget(props) {
20929
21029
  closePanel: controller.close
20930
21030
  });
20931
21031
  const markAdded = hostEvents.markAdded;
20932
- const slip = (0, import_react102.useMemo)(
21032
+ const slip = (0, import_react103.useMemo)(
20933
21033
  () => {
20934
21034
  const handler = props.config?.onAddToSlip;
20935
21035
  return {
@@ -20949,7 +21049,7 @@ function StatsWidget(props) {
20949
21049
  },
20950
21050
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
20951
21051
  );
20952
- const onDashboardTap = (0, import_react102.useMemo)(
21052
+ const onDashboardTap = (0, import_react103.useMemo)(
20953
21053
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
20954
21054
  [built, logger]
20955
21055
  );
@@ -20965,10 +21065,10 @@ function StatsWidget(props) {
20965
21065
  log: logger
20966
21066
  })
20967
21067
  }));
20968
- const onControlRef = (0, import_react102.useRef)(props.onControl);
21068
+ const onControlRef = (0, import_react103.useRef)(props.onControl);
20969
21069
  onControlRef.current = props.onControl;
20970
21070
  const { open: openPanel, close: closePanel } = controller;
20971
- (0, import_react102.useEffect)(() => {
21071
+ (0, import_react103.useEffect)(() => {
20972
21072
  onControlRef.current?.({ open: openPanel, close: closePanel });
20973
21073
  return () => onControlRef.current?.(null);
20974
21074
  }, [openPanel, closePanel]);
@@ -20985,11 +21085,11 @@ function StatsWidget(props) {
20985
21085
  page: cfg?.page
20986
21086
  }
20987
21087
  };
20988
- (0, import_react102.useEffect)(() => {
21088
+ (0, import_react103.useEffect)(() => {
20989
21089
  if (!logger) return;
20990
21090
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
20991
21091
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
20992
- (0, import_react102.useEffect)(() => {
21092
+ (0, import_react103.useEffect)(() => {
20993
21093
  if (!logger) return;
20994
21094
  logger.resume();
20995
21095
  const onHide = () => {
@@ -21007,15 +21107,15 @@ function StatsWidget(props) {
21007
21107
  logger.dispose();
21008
21108
  };
21009
21109
  }, [logger]);
21010
- (0, import_react102.useEffect)(() => {
21110
+ (0, import_react103.useEffect)(() => {
21011
21111
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
21012
21112
  const node = rootRef.current?.getRootNode();
21013
21113
  if (node) injectStyles(node);
21014
21114
  }, [built, ui.injectStyles, widgetStrings.state]);
21015
21115
  const holds = useSessionHolds();
21016
21116
  const builderConversation = built?.conversation ?? null;
21017
- const builderMemory = (0, import_react102.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
21018
- const personalGreeting = (0, import_react102.useMemo)(() => ({
21117
+ const builderMemory = (0, import_react103.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
21118
+ const personalGreeting = (0, import_react103.useMemo)(() => ({
21019
21119
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
21020
21120
  conversation: built?.conversation ?? null,
21021
21121
  openFavourites: () => monitor.setActiveTab("favourites"),