@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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/StatsWidget.tsx
2
- import { useCallback as useCallback27, useEffect as useEffect52, useMemo as useMemo13, useRef as useRef43, useState as useState79 } from "react";
2
+ import { useCallback as useCallback27, useEffect as useEffect53, useMemo as useMemo13, useRef as useRef45, useState as useState79 } from "react";
3
3
  import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
4
4
 
5
5
  // src/strings/tag.ts
@@ -1285,7 +1285,7 @@ function parseOddsFormat(value) {
1285
1285
  }
1286
1286
 
1287
1287
  // src/version.generated.ts
1288
- var WIDGET_REACT_VERSION = "0.130.0";
1288
+ var WIDGET_REACT_VERSION = "0.131.0";
1289
1289
 
1290
1290
  // src/config.ts
1291
1291
  function hostTag(cfg) {
@@ -2154,7 +2154,7 @@ function comboLegToSlipSelection(leg, conversationId) {
2154
2154
  if (leg.quotedAtUtc !== void 0) selection.quotedAtUtc = leg.quotedAtUtc;
2155
2155
  if (leg.sport !== void 0) selection.sport = leg.sport;
2156
2156
  if (conversationId !== void 0) selection.conversationId = conversationId;
2157
- return withMatch(selection, { home: leg.homeTeamName, away: leg.awayTeamName, kickoffUtc: leg.kickoffUtc, marketLabel: leg.market });
2157
+ return withMatch(selection, { home: leg.homeTeamName, away: leg.awayTeamName, kickoffUtc: leg.kickoffUtc, marketLabel: leg.market, player: leg.player });
2158
2158
  }
2159
2159
  var isNum = (v) => typeof v === "number" && Number.isFinite(v);
2160
2160
  var isObj = (v) => typeof v === "object" && v !== null;
@@ -2287,7 +2287,37 @@ function toNbaSlipSelection(vm, key, conversationId) {
2287
2287
  sport: "basketball"
2288
2288
  };
2289
2289
  if (conversationId !== void 0) selection.conversationId = conversationId;
2290
- return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc });
2290
+ return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc, ...nbaPropOf(vm.evidence, key) });
2291
+ }
2292
+ function nbaPropOf(evidence, key) {
2293
+ switch (evidence.kind) {
2294
+ case "prop_reason":
2295
+ return { player: evidence.propReason.playerName, marketLabel: evidence.propReason.statLabel };
2296
+ case "vs_opponent":
2297
+ return { player: evidence.vsOpponent.playerName, marketLabel: evidence.vsOpponent.statLabel };
2298
+ case "teammate_out": {
2299
+ const row = evidence.teammateOut.rows.find((r) => r.selectionKey === key);
2300
+ return row ? { player: row.playerName, marketLabel: row.statLabel } : null;
2301
+ }
2302
+ case "co_hit": {
2303
+ const leg = evidence.coHit.legs.find((l) => l.selectionKey === key);
2304
+ return leg ? { player: leg.playerName, marketLabel: leg.statLabel } : null;
2305
+ }
2306
+ case "ladder": {
2307
+ const stat = evidence.ladder.stats.find((st) => st.rungs.some((r) => r.selectionKey === key));
2308
+ return stat ? { player: evidence.ladder.playerName, marketLabel: stat.statLabel } : null;
2309
+ }
2310
+ case "quarter_ladder": {
2311
+ const stat = evidence.quarterLadder.stats.find((st) => st.rungs.some((r) => r.selectionKey === key));
2312
+ return stat ? { player: evidence.quarterLadder.playerName, marketLabel: stat.statLabel } : null;
2313
+ }
2314
+ case "matchup": {
2315
+ const pos = evidence.matchup.position;
2316
+ return pos?.playerName && (pos.overSelectionKey === key || pos.underSelectionKey === key) ? { player: pos.playerName, marketLabel: pos.statLabel } : null;
2317
+ }
2318
+ default:
2319
+ return null;
2320
+ }
2291
2321
  }
2292
2322
  function nbaCoHitLegs(vm, conversationId) {
2293
2323
  if (vm.evidence.kind !== "co_hit") return [];
@@ -2301,7 +2331,8 @@ function nbaCoHitLegs(vm, conversationId) {
2301
2331
  homeTeamName: vm.homeTeamName ?? "",
2302
2332
  awayTeamName: vm.awayTeamName ?? "",
2303
2333
  kickoffUtc: vm.kickoffUtc ?? void 0,
2304
- market: vm.title,
2334
+ market: leg.statLabel,
2335
+ player: leg.playerName,
2305
2336
  marketDeveloperName: s.marketDeveloperName,
2306
2337
  selection: s.selectionLabel,
2307
2338
  selectionLabel: s.selectionLabel,
@@ -2407,7 +2438,17 @@ function toNflSlipSelection(vm, key, nowMs, conversationId) {
2407
2438
  sport: "americanfootball"
2408
2439
  };
2409
2440
  if (conversationId !== void 0) selection.conversationId = conversationId;
2410
- return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc });
2441
+ return withMatch(selection, { home: vm.homeTeamName, away: vm.awayTeamName, kickoffUtc: vm.kickoffUtc, ...nflPropOf(vm.evidence) });
2442
+ }
2443
+ function nflPropOf(evidence) {
2444
+ switch (evidence.kind) {
2445
+ case "prop_reason":
2446
+ return { player: evidence.propReason.playerName, marketLabel: evidence.propReason.propLabel };
2447
+ case "ladder":
2448
+ return { player: evidence.ladder.playerName, marketLabel: evidence.ladder.propLabel };
2449
+ default:
2450
+ return null;
2451
+ }
2411
2452
  }
2412
2453
 
2413
2454
  // src/slipKey.ts
@@ -5961,7 +6002,7 @@ function useSlipAdd(slip, ui) {
5961
6002
  const handler = slip.onAddToSlip;
5962
6003
  const rawLabels = !!ui?.rawBettingLabels;
5963
6004
  const operatorFormat = ui?.oddsFormat ?? "decimal";
5964
- return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
6005
+ return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
5965
6006
  if (!handler) return { kind: "failed" };
5966
6007
  const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
5967
6008
  const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
@@ -5976,11 +6017,13 @@ function useSlipAdd(slip, ui) {
5976
6017
  matchId: out.matchId,
5977
6018
  odds: out.oddsDecimal,
5978
6019
  ...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
5979
- ...out.sport !== void 0 ? { sport: out.sport } : {}
6020
+ ...out.sport !== void 0 ? { sport: out.sport } : {},
6021
+ ...fact ? { factKey: fact.factKey } : {}
5980
6022
  };
6023
+ const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
5981
6024
  track({ name: "add_to_slip_click", ...clickFields });
5982
6025
  if (marketDeveloperName !== void 0) {
5983
- log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
6026
+ log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField, ...factTag });
5984
6027
  }
5985
6028
  try {
5986
6029
  const raw = await withTimeout(Promise.resolve(handler(out)));
@@ -5995,7 +6038,8 @@ function useSlipAdd(slip, ui) {
5995
6038
  entityId: marketDeveloperName,
5996
6039
  outcome: slipOutcome(result),
5997
6040
  ...pick,
5998
- ...sportField
6041
+ ...sportField,
6042
+ ...factTag
5999
6043
  });
6000
6044
  }
6001
6045
  if (slipState) {
@@ -6008,7 +6052,7 @@ function useSlipAdd(slip, ui) {
6008
6052
  } catch {
6009
6053
  track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
6010
6054
  if (marketDeveloperName !== void 0) {
6011
- log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
6055
+ log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField, ...factTag });
6012
6056
  }
6013
6057
  return { kind: "failed" };
6014
6058
  }
@@ -6031,7 +6075,7 @@ function Toast({ toast, onDismiss }) {
6031
6075
 
6032
6076
  // src/components/AddToSlipButton.tsx
6033
6077
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
6034
- function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
6078
+ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
6035
6079
  const [pending, setPending] = useState18(false);
6036
6080
  const [settledLocal, setSettledLocal] = useState18(false);
6037
6081
  const [toast, setToast] = useState18(null);
@@ -6045,7 +6089,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
6045
6089
  const onClick = async () => {
6046
6090
  setPending(true);
6047
6091
  try {
6048
- const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
6092
+ const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
6049
6093
  if (outcome.kind === "failed") {
6050
6094
  setToast({ kind: "error", text: ui.slipFailed });
6051
6095
  return;
@@ -7044,11 +7088,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
7044
7088
  var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
7045
7089
  var MAX_TEAM_CARDS = 3;
7046
7090
  function oneCardPerGame(cards) {
7047
- const seen = /* @__PURE__ */ new Set();
7091
+ const seen2 = /* @__PURE__ */ new Set();
7048
7092
  return cards.filter((c) => {
7049
7093
  if (!c.matchId) return true;
7050
- if (seen.has(c.matchId)) return false;
7051
- seen.add(c.matchId);
7094
+ if (seen2.has(c.matchId)) return false;
7095
+ seen2.add(c.matchId);
7052
7096
  return true;
7053
7097
  });
7054
7098
  }
@@ -7377,7 +7421,9 @@ var WIRE_TO_PUBLIC = {
7377
7421
  slip_remove: null,
7378
7422
  bet_placed: null,
7379
7423
  match_view: null,
7380
- popup_opened: null
7424
+ popup_opened: null,
7425
+ fact_view: null,
7426
+ fact_ask: null
7381
7427
  };
7382
7428
 
7383
7429
  // src/popupTelemetry.ts
@@ -7485,7 +7531,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7485
7531
  }
7486
7532
 
7487
7533
  // src/components/ChatPanel.tsx
7488
- import { useCallback as useCallback26, useEffect as useEffect51, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef42, useState as useState78 } from "react";
7534
+ import { useCallback as useCallback26, useEffect as useEffect52, useLayoutEffect as useLayoutEffect2, useMemo as useMemo12, useRef as useRef44, useState as useState78 } from "react";
7489
7535
 
7490
7536
  // src/components/ChatHeader.tsx
7491
7537
  import { useEffect as useEffect27, useRef as useRef22, useState as useState32 } from "react";
@@ -8874,15 +8920,15 @@ function pathRounds(e) {
8874
8920
  const base = h - pad.b;
8875
8921
  const plotH = h - pad.t - pad.b;
8876
8922
  const { lo, span } = roundSpan(e);
8877
- const seen = /* @__PURE__ */ new Map();
8923
+ const seen2 = /* @__PURE__ */ new Map();
8878
8924
  for (const ev of e.events) {
8879
8925
  if (ev.roundIndex < 0) continue;
8880
8926
  const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
8881
8927
  const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
8882
- if (short !== "" && !seen.has(idx)) seen.set(idx, short);
8928
+ if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
8883
8929
  }
8884
8930
  const kept = [];
8885
- for (const [roundIndex, label] of [...seen.entries()].sort((a, b) => b[0] - a[0])) {
8931
+ for (const [roundIndex, label] of [...seen2.entries()].sort((a, b) => b[0] - a[0])) {
8886
8932
  const y = round22(base - (roundIndex - lo + 1) / span * plotH);
8887
8933
  const last = kept[kept.length - 1];
8888
8934
  if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
@@ -10535,16 +10581,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
10535
10581
  }
10536
10582
 
10537
10583
  // src/components/LiveFactBlock.tsx
10538
- import { useState as useState44 } from "react";
10584
+ import { useRef as useRef29, useState as useState44 } from "react";
10585
+
10586
+ // src/useFactView.ts
10587
+ import { useEffect as useEffect34, useRef as useRef28 } from "react";
10588
+ var DWELL_MS = 1e3;
10589
+ var seen = /* @__PURE__ */ new Set();
10590
+ function useFactView(ref, fact, entity2) {
10591
+ const log = useEventLog();
10592
+ const entityRef = useRef28(entity2);
10593
+ entityRef.current = entity2;
10594
+ const id = fact?.id;
10595
+ const factKey = fact?.factKey;
10596
+ useEffect34(() => {
10597
+ if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
10598
+ const el = ref.current;
10599
+ if (!el) return;
10600
+ let timer;
10601
+ const fire = () => {
10602
+ if (seen.has(id)) return;
10603
+ seen.add(id);
10604
+ log.log({ name: "fact_view", ...entityRef.current, factId: String(id), factKey });
10605
+ };
10606
+ const clear = () => {
10607
+ if (timer !== void 0) {
10608
+ clearTimeout(timer);
10609
+ timer = void 0;
10610
+ }
10611
+ };
10612
+ if (typeof IntersectionObserver === "undefined") {
10613
+ timer = setTimeout(fire, DWELL_MS);
10614
+ return clear;
10615
+ }
10616
+ const io = new IntersectionObserver((entries) => {
10617
+ const visible = entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5);
10618
+ if (visible) {
10619
+ if (timer === void 0) timer = setTimeout(fire, DWELL_MS);
10620
+ } else clear();
10621
+ }, { threshold: [0, 0.5] });
10622
+ io.observe(el);
10623
+ return () => {
10624
+ clear();
10625
+ io.disconnect();
10626
+ };
10627
+ }, [id, factKey, log, ref]);
10628
+ }
10629
+
10630
+ // src/components/LiveFactBlock.tsx
10539
10631
  import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
10540
10632
  function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10541
10633
  const [expanded, setExpanded] = useState44(false);
10542
10634
  const { oddsFormat } = useOddsSettings();
10635
+ const log = useEventLog();
10636
+ const sectionRef = useRef29(null);
10543
10637
  const [current, ...earlier] = facts;
10638
+ const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
10639
+ useFactView(sectionRef, current, entity2);
10544
10640
  if (!current) return null;
10545
10641
  const m = current.market;
10546
10642
  const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
10547
- return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10643
+ return /* @__PURE__ */ jsxs65("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
10548
10644
  /* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
10549
10645
  /* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
10550
10646
  /* @__PURE__ */ jsxs65("span", { className: "ss-w-fact-min", children: [
@@ -10570,7 +10666,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10570
10666
  marketDeveloperName: m.marketDeveloperName,
10571
10667
  selectionLabel: m.selectionLabel,
10572
10668
  slip,
10573
- ui
10669
+ ui,
10670
+ fact: { id: current.id, factKey: current.factKey }
10574
10671
  }
10575
10672
  )
10576
10673
  ] })
@@ -10588,7 +10685,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10588
10685
  {
10589
10686
  type: "button",
10590
10687
  className: "ss-w-fact-link",
10591
- onClick: () => onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) }),
10688
+ onClick: () => {
10689
+ log?.log({ name: "fact_ask", ...entity2, factId: String(current.id), factKey: current.factKey });
10690
+ onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) });
10691
+ },
10592
10692
  children: ui.liveFactAsk
10593
10693
  }
10594
10694
  ),
@@ -10998,10 +11098,10 @@ function NbaFormSection({ match, monitor, ui }) {
10998
11098
  }
10999
11099
 
11000
11100
  // src/components/NbaPropsSection.tsx
11001
- import { useEffect as useEffect35, useState as useState48 } from "react";
11101
+ import { useEffect as useEffect36, useState as useState48 } from "react";
11002
11102
 
11003
11103
  // src/components/PropsPieces.tsx
11004
- import { useEffect as useEffect34, useState as useState47 } from "react";
11104
+ import { useEffect as useEffect35, useState as useState47 } from "react";
11005
11105
  import { Fragment as Fragment15, jsx as jsx76, jsxs as jsxs71 } from "react/jsx-runtime";
11006
11106
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11007
11107
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11016,7 +11116,7 @@ function preKickoff(match) {
11016
11116
  function usePreKickoff(match) {
11017
11117
  const [, setTick] = useState47(0);
11018
11118
  const pre = preKickoff(match);
11019
- useEffect34(() => {
11119
+ useEffect35(() => {
11020
11120
  if (!pre || !match.kickoffUtc) return;
11021
11121
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11022
11122
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11030,7 +11130,7 @@ function usePropsOpen(match, monitor, descriptor) {
11030
11130
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11031
11131
  const live = match.phase === "live";
11032
11132
  const open = pre || live;
11033
- useEffect34(() => {
11133
+ useEffect35(() => {
11034
11134
  if (!open) return;
11035
11135
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11036
11136
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11199,7 +11299,7 @@ function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11199
11299
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11200
11300
  const valid = !Number.isNaN(at2);
11201
11301
  const onBreak = atBreak(match);
11202
- useEffect34(() => {
11302
+ useEffect35(() => {
11203
11303
  if (!valid || onBreak) return;
11204
11304
  const age2 = Date.now() - at2;
11205
11305
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11265,7 +11365,7 @@ function StatsClock2({ bundle, match, ui }) {
11265
11365
  const time = clock2(bundle.boxAsOfUtc, ui);
11266
11366
  const valid = !Number.isNaN(at2) && time !== "";
11267
11367
  const onBreak = atBreak(match);
11268
- useEffect35(() => {
11368
+ useEffect36(() => {
11269
11369
  if (!valid || onBreak) return;
11270
11370
  const age2 = Date.now() - at2;
11271
11371
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11832,7 +11932,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
11832
11932
  }
11833
11933
 
11834
11934
  // src/components/TennisMonitorCard.tsx
11835
- import { useRef as useRef28 } from "react";
11935
+ import { useRef as useRef30 } from "react";
11836
11936
  import { toWireSport as toWireSport5 } from "@sensiblestats/widget-sdk";
11837
11937
 
11838
11938
  // src/components/TennisFixtureRow.tsx
@@ -12093,7 +12193,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12093
12193
  }
12094
12194
 
12095
12195
  // src/components/TennisStatsTables.tsx
12096
- import { Fragment as Fragment22, useEffect as useEffect36, useState as useState51 } from "react";
12196
+ import { Fragment as Fragment22, useEffect as useEffect37, useState as useState51 } from "react";
12097
12197
  import { Fragment as Fragment23, jsx as jsx87, jsxs as jsxs82 } from "react/jsx-runtime";
12098
12198
  function formatStat(row, value, locale) {
12099
12199
  if (value == null) return "\u2013";
@@ -12132,7 +12232,7 @@ function Tables({ table, labels, names, locale }) {
12132
12232
  }
12133
12233
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12134
12234
  const [tab, setTab] = useState51("match");
12135
- useEffect36(() => {
12235
+ useEffect37(() => {
12136
12236
  setTab("match");
12137
12237
  }, [resetKey]);
12138
12238
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12298,7 +12398,7 @@ function HeadToHead({ t, ui }) {
12298
12398
  ] });
12299
12399
  }
12300
12400
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12301
- const lastTables = useRef28(null);
12401
+ const lastTables = useRef30(null);
12302
12402
  const t = match.tennis;
12303
12403
  if (!t) return /* @__PURE__ */ jsx88(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12304
12404
  const preMatch = match.phase === "preMatch";
@@ -12378,7 +12478,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12378
12478
  }
12379
12479
 
12380
12480
  // src/components/ScoreboardStrip.tsx
12381
- import { useEffect as useEffect37, useRef as useRef29 } from "react";
12481
+ import { useEffect as useEffect38, useRef as useRef31 } from "react";
12382
12482
  import { sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
12383
12483
  import { jsx as jsx89, jsxs as jsxs84 } from "react/jsx-runtime";
12384
12484
  function nbaStatus(m, ui) {
@@ -12473,8 +12573,8 @@ function rowsFor(m) {
12473
12573
  ];
12474
12574
  }
12475
12575
  function useStripScroll(selectedKey) {
12476
- const stripRef = useRef29(null);
12477
- useEffect37(() => {
12576
+ const stripRef = useRef31(null);
12577
+ useEffect38(() => {
12478
12578
  const strip = stripRef.current;
12479
12579
  const pressed = strip?.querySelector('[aria-pressed="true"]');
12480
12580
  if (!strip || !pressed) return;
@@ -12899,16 +12999,16 @@ import { useId as useId2, useState as useState52 } from "react";
12899
12999
  import { localIdOf as localIdOf4, qualifiedId as qualifiedId2, slipSportOf as slipSportOf9, toWireSport as toWireSport6 } from "@sensiblestats/widget-sdk";
12900
13000
 
12901
13001
  // src/useModalDialog.ts
12902
- import { useEffect as useEffect38, useRef as useRef30 } from "react";
13002
+ import { useEffect as useEffect39, useRef as useRef32 } from "react";
12903
13003
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12904
13004
  function useModalDialog(onClose, opts = {}) {
12905
- const dialogRef = useRef30(null);
12906
- const onCloseRef = useRef30(onClose);
13005
+ const dialogRef = useRef32(null);
13006
+ const onCloseRef = useRef32(onClose);
12907
13007
  onCloseRef.current = onClose;
12908
- const openerRef = useRef30(opts.opener);
13008
+ const openerRef = useRef32(opts.opener);
12909
13009
  openerRef.current = opts.opener;
12910
13010
  const restore = opts.restoreFocus ?? true;
12911
- useEffect38(() => {
13011
+ useEffect39(() => {
12912
13012
  const dialog = dialogRef.current;
12913
13013
  const root = dialog?.getRootNode();
12914
13014
  const focusedAtMount = root?.activeElement ?? null;
@@ -12919,7 +13019,7 @@ function useModalDialog(onClose, opts = {}) {
12919
13019
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
12920
13020
  };
12921
13021
  }, []);
12922
- useEffect38(() => {
13022
+ useEffect39(() => {
12923
13023
  const onKey = (e) => {
12924
13024
  if (e.key !== "Escape") return;
12925
13025
  e.stopPropagation();
@@ -13171,20 +13271,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13171
13271
  }
13172
13272
 
13173
13273
  // src/components/ScheduleMatchesPanel.tsx
13174
- import { useEffect as useEffect41, useId as useId3, useMemo as useMemo11, useRef as useRef34, useState as useState55 } from "react";
13274
+ import { useEffect as useEffect42, useId as useId3, useMemo as useMemo11, useRef as useRef36, useState as useState55 } from "react";
13175
13275
  import { matchKey as matchKey10 } from "@sensiblestats/widget-sdk";
13176
13276
 
13177
13277
  // src/useTennisRowPrices.ts
13178
- import { useEffect as useEffect39, useRef as useRef31, useState as useState54 } from "react";
13278
+ import { useEffect as useEffect40, useRef as useRef33, useState as useState54 } from "react";
13179
13279
  import { matchKey as matchKey9 } from "@sensiblestats/widget-sdk";
13180
13280
  var TENNIS_PRICE_POLL_MS = 6e4;
13181
13281
  function useTennisRowPrices(a) {
13182
13282
  const [state, setState] = useState54({ byId: null, stale: false });
13183
- const getPricesRef = useRef31(a.getPrices);
13283
+ const getPricesRef = useRef33(a.getPrices);
13184
13284
  getPricesRef.current = a.getPrices;
13185
- const latest = useRef31(0);
13285
+ const latest = useRef33(0);
13186
13286
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13187
- useEffect39(() => {
13287
+ useEffect40(() => {
13188
13288
  if (!a.enabled || idsKey === "") {
13189
13289
  latest.current++;
13190
13290
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13222,11 +13322,11 @@ function useTennisRowPrices(a) {
13222
13322
  }
13223
13323
 
13224
13324
  // src/components/DayStrip.tsx
13225
- import { useEffect as useEffect40, useRef as useRef32 } from "react";
13325
+ import { useEffect as useEffect41, useRef as useRef34 } from "react";
13226
13326
  import { jsx as jsx98, jsxs as jsxs92 } from "react/jsx-runtime";
13227
13327
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13228
- const listRef = useRef32(null);
13229
- useEffect40(() => {
13328
+ const listRef = useRef34(null);
13329
+ useEffect41(() => {
13230
13330
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13231
13331
  if (!el || typeof el.scrollIntoView !== "function") return;
13232
13332
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13255,7 +13355,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13255
13355
  }
13256
13356
 
13257
13357
  // src/components/games/ui/SearchField.tsx
13258
- import { useCallback as useCallback24, useRef as useRef33 } from "react";
13358
+ import { useCallback as useCallback24, useRef as useRef35 } from "react";
13259
13359
 
13260
13360
  // src/components/games/ui/icons.tsx
13261
13361
  import { jsx as jsx99 } from "react/jsx-runtime";
@@ -13294,7 +13394,7 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ jsx99("path", { d:
13294
13394
  // src/components/games/ui/SearchField.tsx
13295
13395
  import { jsx as jsx100, jsxs as jsxs93 } from "react/jsx-runtime";
13296
13396
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13297
- const localRef = useRef33(null);
13397
+ const localRef = useRef35(null);
13298
13398
  const setInputRef = useCallback24((node) => {
13299
13399
  localRef.current = node;
13300
13400
  if (typeof inputRef === "function") inputRef(node);
@@ -13345,10 +13445,10 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13345
13445
  const [query, setQuery] = useState55("");
13346
13446
  const [toggled, setToggled] = useState55(/* @__PURE__ */ new Map());
13347
13447
  const [expanded, setExpanded] = useState55(/* @__PURE__ */ new Set());
13348
- const listRef = useRef34(null);
13448
+ const listRef = useRef36(null);
13349
13449
  const [sheet, setSheet] = useState55(null);
13350
13450
  const { chips, selected } = loaded;
13351
- useEffect41(() => {
13451
+ useEffect42(() => {
13352
13452
  if (selected !== day) onDay(selected);
13353
13453
  }, [day, selected, onDay]);
13354
13454
  const isToday = selected === today;
@@ -13490,7 +13590,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13490
13590
  }
13491
13591
 
13492
13592
  // src/components/GamesPanel.tsx
13493
- import { useEffect as useEffect45, useState as useState70 } from "react";
13593
+ import { useEffect as useEffect46, useState as useState70 } from "react";
13494
13594
 
13495
13595
  // src/components/GamesLoginWall.tsx
13496
13596
  import { jsx as jsx102 } from "react/jsx-runtime";
@@ -13499,7 +13599,7 @@ function GamesLoginWall({ ui }) {
13499
13599
  }
13500
13600
 
13501
13601
  // src/components/GamesHub.tsx
13502
- import { useEffect as useEffect42, useState as useState56 } from "react";
13602
+ import { useEffect as useEffect43, useState as useState56 } from "react";
13503
13603
 
13504
13604
  // src/components/games/ui/gameMeta.ts
13505
13605
  function prettifyGameId(gameId) {
@@ -13651,7 +13751,7 @@ function pickHeroGame(games) {
13651
13751
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
13652
13752
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13653
13753
  const [, setTick] = useState56(0);
13654
- useEffect42(() => {
13754
+ useEffect43(() => {
13655
13755
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
13656
13756
  return () => clearInterval(id);
13657
13757
  }, []);
@@ -13711,10 +13811,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13711
13811
  }
13712
13812
 
13713
13813
  // src/components/GameScreenHost.tsx
13714
- import { useEffect as useEffect44, useRef as useRef37, useState as useState68 } from "react";
13814
+ import { useEffect as useEffect45, useRef as useRef39, useState as useState68 } from "react";
13715
13815
 
13716
13816
  // src/useGamePlay.ts
13717
- import { useCallback as useCallback25, useRef as useRef35, useState as useState57 } from "react";
13817
+ import { useCallback as useCallback25, useRef as useRef37, useState as useState57 } from "react";
13718
13818
  function toSubmitResult(payload) {
13719
13819
  return {
13720
13820
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -13729,12 +13829,12 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13729
13829
  const [result, setResult] = useState57(null);
13730
13830
  const [submitting, setSubmitting] = useState57(false);
13731
13831
  const [rawStatus, setRawStatus] = useState57(null);
13732
- const inFlightRef = useRef35(false);
13733
- const convRef = useRef35(conversation);
13832
+ const inFlightRef = useRef37(false);
13833
+ const convRef = useRef37(conversation);
13734
13834
  convRef.current = conversation;
13735
- const optsRef = useRef35({ gameId, gameDay, fixtureId, locale, refresh });
13835
+ const optsRef = useRef37({ gameId, gameDay, fixtureId, locale, refresh });
13736
13836
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
13737
- const resultRef = useRef35(null);
13837
+ const resultRef = useRef37(null);
13738
13838
  resultRef.current = result;
13739
13839
  const refetch = useCallback25(async () => {
13740
13840
  const conv = convRef.current;
@@ -14666,7 +14766,7 @@ function CareerPathGame({
14666
14766
  }
14667
14767
 
14668
14768
  // src/components/games/BeatTheGridGame.tsx
14669
- import React, { useEffect as useEffect43, useId as useId6, useRef as useRef36, useState as useState62 } from "react";
14769
+ import React, { useEffect as useEffect44, useId as useId6, useRef as useRef38, useState as useState62 } from "react";
14670
14770
 
14671
14771
  // src/components/games/ui/OptionList.tsx
14672
14772
  import { jsx as jsx120 } from "react/jsx-runtime";
@@ -14757,8 +14857,8 @@ function SearchSheet({
14757
14857
  const s = ui.games.beatTheGrid;
14758
14858
  const [query, setQuery] = useState62("");
14759
14859
  const inputId = useId6();
14760
- const inputRef = useRef36(null);
14761
- useEffect43(() => {
14860
+ const inputRef = useRef38(null);
14861
+ useEffect44(() => {
14762
14862
  inputRef.current?.focus();
14763
14863
  }, [row, col]);
14764
14864
  const filtered = playerPool.filter(
@@ -16062,7 +16162,7 @@ function GameScreenHost({
16062
16162
  }) {
16063
16163
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16064
16164
  const [configJson, setConfigJson] = useState68(null);
16065
- useEffect44(() => {
16165
+ useEffect45(() => {
16066
16166
  setConfigJson(null);
16067
16167
  if (!conversation) return;
16068
16168
  let cancelled = false;
@@ -16085,12 +16185,12 @@ function GameScreenHost({
16085
16185
  fixtureId: fixtureId || void 0,
16086
16186
  locale: ui.hostTag
16087
16187
  });
16088
- useEffect44(() => {
16188
+ useEffect45(() => {
16089
16189
  if (conversation) hydrate();
16090
16190
  }, [conversation, gameId]);
16091
- const hydrateRef = useRef37(hydrate);
16191
+ const hydrateRef = useRef39(hydrate);
16092
16192
  hydrateRef.current = hydrate;
16093
- useEffect44(() => {
16193
+ useEffect45(() => {
16094
16194
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16095
16195
  if (rawStatus !== "pending") return;
16096
16196
  const timerId = setInterval(() => {
@@ -16397,7 +16497,7 @@ function GamesPanel({
16397
16497
  }) {
16398
16498
  const [selected, setSelected] = useState70(null);
16399
16499
  const [segment, setSegment] = useState70("play");
16400
- useEffect45(() => {
16500
+ useEffect46(() => {
16401
16501
  ensureGamesFonts();
16402
16502
  }, []);
16403
16503
  if (!loggedIn) return /* @__PURE__ */ jsx134(GamesLoginWall, { ui });
@@ -16461,10 +16561,10 @@ function GamesPanel({
16461
16561
  }
16462
16562
 
16463
16563
  // src/components/FavouritesPanel.tsx
16464
- import { useEffect as useEffect48, useRef as useRef39, useState as useState73 } from "react";
16564
+ import { useEffect as useEffect49, useRef as useRef41, useState as useState73 } from "react";
16465
16565
 
16466
16566
  // src/components/FavouriteChips.tsx
16467
- import { useEffect as useEffect46, useState as useState71 } from "react";
16567
+ import { useEffect as useEffect47, useState as useState71 } from "react";
16468
16568
  import { Fragment as Fragment41, jsx as jsx135, jsxs as jsxs120 } from "react/jsx-runtime";
16469
16569
  async function toggleWithNotice(controller, kind, id, onNotice) {
16470
16570
  const outcome = await controller.toggle(kind, id);
@@ -16513,10 +16613,10 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
16513
16613
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
16514
16614
  const [confirming, setConfirming] = useState71(false);
16515
16615
  const data = controller.data;
16516
- useEffect46(() => {
16616
+ useEffect47(() => {
16517
16617
  setConfirming(false);
16518
16618
  }, [sport]);
16519
- useEffect46(() => {
16619
+ useEffect47(() => {
16520
16620
  if (!confirming) return;
16521
16621
  const onPointerDown = (e) => {
16522
16622
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -16570,7 +16670,7 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
16570
16670
  }
16571
16671
 
16572
16672
  // src/components/FavouritesSearch.tsx
16573
- import { useEffect as useEffect47, useRef as useRef38, useState as useState72 } from "react";
16673
+ import { useEffect as useEffect48, useRef as useRef40, useState as useState72 } from "react";
16574
16674
  import { jsx as jsx136, jsxs as jsxs121 } from "react/jsx-runtime";
16575
16675
  var MIN_LETTERS = 2;
16576
16676
  var MAX_LENGTH = 64;
@@ -16578,13 +16678,13 @@ var DEBOUNCE_MS = 250;
16578
16678
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
16579
16679
  const [query, setQuery] = useState72("");
16580
16680
  const [answer, setAnswer] = useState72(null);
16581
- const controllerRef = useRef38(controller);
16681
+ const controllerRef = useRef40(controller);
16582
16682
  controllerRef.current = controller;
16583
16683
  const trimmed = query.trim();
16584
16684
  const queryKey = `${sport}|${trimmed}`;
16585
16685
  const results2 = answer?.key === queryKey ? answer.rows : [];
16586
16686
  const settled = answer?.key === queryKey;
16587
- useEffect47(() => {
16687
+ useEffect48(() => {
16588
16688
  setAnswer(null);
16589
16689
  if (trimmed.length < MIN_LETTERS) return;
16590
16690
  let cancelled = false;
@@ -16648,12 +16748,12 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
16648
16748
  import { jsx as jsx137, jsxs as jsxs122 } from "react/jsx-runtime";
16649
16749
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16650
16750
  const [notice, setNotice] = useState73(null);
16651
- const refreshRef = useRef39(controller.refresh);
16751
+ const refreshRef = useRef41(controller.refresh);
16652
16752
  refreshRef.current = controller.refresh;
16653
- useEffect48(() => {
16753
+ useEffect49(() => {
16654
16754
  void refreshRef.current();
16655
16755
  }, []);
16656
- useEffect48(() => {
16756
+ useEffect49(() => {
16657
16757
  setNotice(null);
16658
16758
  }, [sport]);
16659
16759
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -16679,7 +16779,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16679
16779
  }
16680
16780
 
16681
16781
  // src/components/dashboard/v8/SentenceBuilder.tsx
16682
- import { useEffect as useEffect49, useRef as useRef40, useState as useState74 } from "react";
16782
+ import { useEffect as useEffect50, useRef as useRef42, useState as useState74 } from "react";
16683
16783
  import { Fragment as Fragment42, jsx as jsx138, jsxs as jsxs123 } from "react/jsx-runtime";
16684
16784
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
16685
16785
  var BASE_LEGS = [1, 2, 3, 4];
@@ -16721,7 +16821,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16721
16821
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
16722
16822
  };
16723
16823
  const [view, setView] = useState74(() => saved?.view ?? openingView);
16724
- const autoWidened = useRef40(false);
16824
+ const autoWidened = useRef42(false);
16725
16825
  const [widenedNote, setWidenedNote] = useState74(saved?.widenedNote ?? false);
16726
16826
  const requestFor = (v) => ({
16727
16827
  sport,
@@ -16736,8 +16836,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16736
16836
  });
16737
16837
  const [first] = useState74(() => requestFor(view));
16738
16838
  const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
16739
- const lastRequest = useRef40(first);
16740
- useEffect49(() => {
16839
+ const lastRequest = useRef42(first);
16840
+ useEffect50(() => {
16741
16841
  void request(lastRequest.current);
16742
16842
  }, [request]);
16743
16843
  const send = (req) => {
@@ -16772,15 +16872,15 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16772
16872
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
16773
16873
  const [startedNote, setStartedNote] = useState74(false);
16774
16874
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
16775
- useEffect49(() => {
16875
+ useEffect50(() => {
16776
16876
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
16777
16877
  }, [startedNote, status2, anyStarted]);
16778
16878
  const market = rows?.[0]?.market;
16779
- const [seen, setSeen] = useState74(null);
16780
- useEffect49(() => {
16879
+ const [seen2, setSeen] = useState74(null);
16880
+ useEffect50(() => {
16781
16881
  if (market) setSeen(market);
16782
16882
  }, [market]);
16783
- const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
16883
+ const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
16784
16884
  const paused = ready && grid.status === "paused";
16785
16885
  const coolOff = status2 === "ready" && grid === null;
16786
16886
  const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
@@ -16790,14 +16890,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16790
16890
  const quotedAt = rows ? oldestQuote(rows) : null;
16791
16891
  const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
16792
16892
  const canWiden = gamesOptions === null || allGames !== null;
16793
- useEffect49(() => {
16893
+ useEffect50(() => {
16794
16894
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
16795
16895
  autoWidened.current = true;
16796
16896
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
16797
16897
  commit(next, true);
16798
16898
  send(requestFor(next));
16799
16899
  }, [empty2, singles, widened, canWiden, view]);
16800
- useEffect49(() => {
16900
+ useEffect50(() => {
16801
16901
  if (coolOff) onCoolOff?.(sport);
16802
16902
  }, [coolOff, onCoolOff, sport]);
16803
16903
  if (coolOff) return null;
@@ -17583,7 +17683,7 @@ import { Fragment as Fragment46, jsx as jsx150, jsxs as jsxs133 } from "react/js
17583
17683
  var FULLSCREEN_QUERY = "(max-width: 639px)";
17584
17684
  function useIsModal() {
17585
17685
  const [modal, setModal] = useState78(false);
17586
- useEffect51(() => {
17686
+ useEffect52(() => {
17587
17687
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
17588
17688
  const mql = window.matchMedia(FULLSCREEN_QUERY);
17589
17689
  const sync = () => setModal(mql.matches);
@@ -17601,8 +17701,8 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17601
17701
  const [selectedPlayerId, setSelectedPlayerId] = useState78(null);
17602
17702
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
17603
17703
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
17604
- const squadLayerRef = useRef42(null);
17605
- const squadScrollRef = useRef42(null);
17704
+ const squadLayerRef = useRef44(null);
17705
+ const squadScrollRef = useRef44(null);
17606
17706
  const selectPlayer = (playerId) => {
17607
17707
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
17608
17708
  setSelectedPlayerId(playerId);
@@ -17625,16 +17725,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17625
17725
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
17626
17726
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
17627
17727
  const activeTab = tabs?.activeTab;
17628
- useEffect51(() => {
17728
+ useEffect52(() => {
17629
17729
  if (activeTab === "squad" || selectedPlayerId === null) return;
17630
17730
  setSelectedPlayerId(null);
17631
17731
  clearPlayerDetail?.();
17632
17732
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
17633
- useEffect51(() => {
17733
+ useEffect52(() => {
17634
17734
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
17635
17735
  }, [activeTab, favouritesEnabled, setMonitorTab]);
17636
17736
  const storedTab = tabState?.activeTab;
17637
- useEffect51(() => {
17737
+ useEffect52(() => {
17638
17738
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
17639
17739
  if (unreachable) setMonitorTab?.("chat");
17640
17740
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -17647,7 +17747,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17647
17747
  track({ name: "widget_close", method, tab: closeTab, answering });
17648
17748
  close();
17649
17749
  }, [track, closeTab, answering, close]);
17650
- useEffect51(() => {
17750
+ useEffect52(() => {
17651
17751
  const onKey = (e) => {
17652
17752
  if (e.key === "Escape") closeWith("escape");
17653
17753
  };
@@ -17663,16 +17763,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17663
17763
  tabs?.setActiveTab("chat");
17664
17764
  send(text2, { grounding, source });
17665
17765
  };
17666
- useEffect51(() => {
17766
+ useEffect52(() => {
17667
17767
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
17668
17768
  }, [monitor, state.isStreaming, state.messages.length]);
17669
17769
  const onChatTab = !tabs || tabs.activeTab === "chat";
17670
- const inputRef = useRef42(null);
17671
- const limitRef = useRef42(null);
17672
- const typedSendRef = useRef42(false);
17673
- const focusAfterCloseRef = useRef42(null);
17770
+ const inputRef = useRef44(null);
17771
+ const limitRef = useRef44(null);
17772
+ const typedSendRef = useRef44(false);
17773
+ const focusAfterCloseRef = useRef44(null);
17674
17774
  const [tool, setTool] = useState78(null);
17675
- const panelRef = useRef42(null);
17775
+ const panelRef = useRef44(null);
17676
17776
  const settings = useOddsSettings();
17677
17777
  const [settingsOpen, setSettingsOpen] = useState78(false);
17678
17778
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
@@ -17685,10 +17785,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17685
17785
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
17686
17786
  }, []);
17687
17787
  const paused = isPaused(state.limit);
17688
- useEffect51(() => {
17788
+ useEffect52(() => {
17689
17789
  if (paused) setTool(null);
17690
17790
  }, [paused]);
17691
- useEffect51(() => {
17791
+ useEffect52(() => {
17692
17792
  if (!paused) return;
17693
17793
  if (typedSendRef.current) limitRef.current?.focus();
17694
17794
  typedSendRef.current = false;
@@ -17714,13 +17814,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17714
17814
  const k = ui.bettingKickoff(kickoffUtc);
17715
17815
  return `${k.dayLabel} ${k.time}`;
17716
17816
  }, [ui]);
17717
- useEffect51(() => {
17817
+ useEffect52(() => {
17718
17818
  if (tool) return;
17719
17819
  const target = focusAfterCloseRef.current;
17720
17820
  focusAfterCloseRef.current = null;
17721
17821
  if (target === "composer") inputRef.current?.focus();
17722
17822
  }, [tool]);
17723
- useEffect51(() => {
17823
+ useEffect52(() => {
17724
17824
  if (!tool || onChatTab && presetGrid) return;
17725
17825
  focusAfterCloseRef.current = "composer";
17726
17826
  setTool(null);
@@ -20673,9 +20773,9 @@ function StatsWidget(props) {
20673
20773
  const injectedClient = "client" in props ? props.client : void 0;
20674
20774
  const cfg = props.config;
20675
20775
  const built = useMemo13(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20676
- const trackingRef = useRef43({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20776
+ const trackingRef = useRef45({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20677
20777
  const track = useMemo13(() => createTracker(() => trackingRef.current), []);
20678
- const eventTextRef = useRef43(false);
20778
+ const eventTextRef = useRef45(false);
20679
20779
  eventTextRef.current = cfg?.eventText === true;
20680
20780
  const logger = useMemo13(() => {
20681
20781
  if (!built) return null;
@@ -20692,8 +20792,8 @@ function StatsWidget(props) {
20692
20792
  [props.config, widgetStrings.strings]
20693
20793
  );
20694
20794
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
20695
- const rootRef = useRef43(null);
20696
- const introDoneRef = useRef43(false);
20795
+ const rootRef = useRef45(null);
20796
+ const introDoneRef = useRef45(false);
20697
20797
  const markIntroDone = useCallback27(() => {
20698
20798
  introDoneRef.current = true;
20699
20799
  }, []);
@@ -20708,13 +20808,13 @@ function StatsWidget(props) {
20708
20808
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
20709
20809
  const panelOpen = controller.state.isOpen && !stringsPending;
20710
20810
  const liveCardWatches = useMemo13(() => {
20711
- const seen = /* @__PURE__ */ new Set();
20811
+ const seen2 = /* @__PURE__ */ new Set();
20712
20812
  const out = [];
20713
20813
  for (const msg of controller.state.messages) {
20714
20814
  if (msg.role !== "assistant") continue;
20715
20815
  for (const vm of msg.marketOdds) {
20716
- if (vm.live == null || seen.has(vm.matchId)) continue;
20717
- seen.add(vm.matchId);
20816
+ if (vm.live == null || seen2.has(vm.matchId)) continue;
20817
+ seen2.add(vm.matchId);
20718
20818
  out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
20719
20819
  }
20720
20820
  }
@@ -20760,9 +20860,9 @@ function StatsWidget(props) {
20760
20860
  timeZone: ui.timeZone
20761
20861
  });
20762
20862
  const offeredSports = useMemo13(() => {
20763
- const seen = new Set(discovery.matchDays.map((d) => d.sport));
20764
- for (const g of discovery.groups) seen.add(g.sport ?? "football");
20765
- return [...seen];
20863
+ const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
20864
+ for (const g of discovery.groups) seen2.add(g.sport ?? "football");
20865
+ return [...seen2];
20766
20866
  }, [discovery.matchDays, discovery.groups]);
20767
20867
  const scheduleSport = useScheduleSport(offeredSports);
20768
20868
  const [liveLeague, setLiveLeague] = useState79(null);
@@ -20775,8 +20875,8 @@ function StatsWidget(props) {
20775
20875
  enabled: panelOpen && monitor.activeTab === "matches",
20776
20876
  timeZone: ui.timeZone
20777
20877
  });
20778
- const prevLiveSnapshotRef = useRef43(monitor.snapshot);
20779
- useEffect52(() => {
20878
+ const prevLiveSnapshotRef = useRef45(monitor.snapshot);
20879
+ useEffect53(() => {
20780
20880
  const snap = monitor.snapshot;
20781
20881
  if (!snap || snap === prevLiveSnapshotRef.current) return;
20782
20882
  prevLiveSnapshotRef.current = snap;
@@ -20876,8 +20976,8 @@ function StatsWidget(props) {
20876
20976
  );
20877
20977
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
20878
20978
  const markLiveActivity = monitor.markLiveActivity;
20879
- const prevLiveCountRef = useRef43(0);
20880
- useEffect52(() => {
20979
+ const prevLiveCountRef = useRef45(0);
20980
+ useEffect53(() => {
20881
20981
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
20882
20982
  prevLiveCountRef.current = discovery.liveCount;
20883
20983
  if (rose) markLiveActivity();
@@ -20927,10 +21027,10 @@ function StatsWidget(props) {
20927
21027
  log: logger
20928
21028
  })
20929
21029
  }));
20930
- const onControlRef = useRef43(props.onControl);
21030
+ const onControlRef = useRef45(props.onControl);
20931
21031
  onControlRef.current = props.onControl;
20932
21032
  const { open: openPanel, close: closePanel } = controller;
20933
- useEffect52(() => {
21033
+ useEffect53(() => {
20934
21034
  onControlRef.current?.({ open: openPanel, close: closePanel });
20935
21035
  return () => onControlRef.current?.(null);
20936
21036
  }, [openPanel, closePanel]);
@@ -20947,11 +21047,11 @@ function StatsWidget(props) {
20947
21047
  page: cfg?.page
20948
21048
  }
20949
21049
  };
20950
- useEffect52(() => {
21050
+ useEffect53(() => {
20951
21051
  if (!logger) return;
20952
21052
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
20953
21053
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
20954
- useEffect52(() => {
21054
+ useEffect53(() => {
20955
21055
  if (!logger) return;
20956
21056
  logger.resume();
20957
21057
  const onHide = () => {
@@ -20969,7 +21069,7 @@ function StatsWidget(props) {
20969
21069
  logger.dispose();
20970
21070
  };
20971
21071
  }, [logger]);
20972
- useEffect52(() => {
21072
+ useEffect53(() => {
20973
21073
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
20974
21074
  const node = rootRef.current?.getRootNode();
20975
21075
  if (node) injectStyles(node);