@sensiblestats/widget-react 0.130.1 → 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.1";
1326
+ var WIDGET_REACT_VERSION = "0.131.0";
1327
1327
 
1328
1328
  // src/config.ts
1329
1329
  function hostTag(cfg) {
@@ -6040,7 +6040,7 @@ function useSlipAdd(slip, ui) {
6040
6040
  const handler = slip.onAddToSlip;
6041
6041
  const rawLabels = !!ui?.rawBettingLabels;
6042
6042
  const operatorFormat = ui?.oddsFormat ?? "decimal";
6043
- return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line }) => {
6043
+ return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
6044
6044
  if (!handler) return { kind: "failed" };
6045
6045
  const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
6046
6046
  const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
@@ -6055,11 +6055,13 @@ function useSlipAdd(slip, ui) {
6055
6055
  matchId: out.matchId,
6056
6056
  odds: out.oddsDecimal,
6057
6057
  ...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
6058
- ...out.sport !== void 0 ? { sport: out.sport } : {}
6058
+ ...out.sport !== void 0 ? { sport: out.sport } : {},
6059
+ ...fact ? { factKey: fact.factKey } : {}
6059
6060
  };
6061
+ const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
6060
6062
  track({ name: "add_to_slip_click", ...clickFields });
6061
6063
  if (marketDeveloperName !== void 0) {
6062
- 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 });
6063
6065
  }
6064
6066
  try {
6065
6067
  const raw = await withTimeout(Promise.resolve(handler(out)));
@@ -6074,7 +6076,8 @@ function useSlipAdd(slip, ui) {
6074
6076
  entityId: marketDeveloperName,
6075
6077
  outcome: slipOutcome(result),
6076
6078
  ...pick,
6077
- ...sportField
6079
+ ...sportField,
6080
+ ...factTag
6078
6081
  });
6079
6082
  }
6080
6083
  if (slipState) {
@@ -6087,7 +6090,7 @@ function useSlipAdd(slip, ui) {
6087
6090
  } catch {
6088
6091
  track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
6089
6092
  if (marketDeveloperName !== void 0) {
6090
- 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 });
6091
6094
  }
6092
6095
  return { kind: "failed" };
6093
6096
  }
@@ -6110,7 +6113,7 @@ function Toast({ toast, onDismiss }) {
6110
6113
 
6111
6114
  // src/components/AddToSlipButton.tsx
6112
6115
  var import_jsx_runtime6 = require("react/jsx-runtime");
6113
- function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
6116
+ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
6114
6117
  const [pending, setPending] = (0, import_react27.useState)(false);
6115
6118
  const [settledLocal, setSettledLocal] = (0, import_react27.useState)(false);
6116
6119
  const [toast, setToast] = (0, import_react27.useState)(null);
@@ -6124,7 +6127,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
6124
6127
  const onClick = async () => {
6125
6128
  setPending(true);
6126
6129
  try {
6127
- const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
6130
+ const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
6128
6131
  if (outcome.kind === "failed") {
6129
6132
  setToast({ kind: "error", text: ui.slipFailed });
6130
6133
  return;
@@ -7123,11 +7126,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
7123
7126
  var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
7124
7127
  var MAX_TEAM_CARDS = 3;
7125
7128
  function oneCardPerGame(cards) {
7126
- const seen = /* @__PURE__ */ new Set();
7129
+ const seen2 = /* @__PURE__ */ new Set();
7127
7130
  return cards.filter((c) => {
7128
7131
  if (!c.matchId) return true;
7129
- if (seen.has(c.matchId)) return false;
7130
- seen.add(c.matchId);
7132
+ if (seen2.has(c.matchId)) return false;
7133
+ seen2.add(c.matchId);
7131
7134
  return true;
7132
7135
  });
7133
7136
  }
@@ -7456,7 +7459,9 @@ var WIRE_TO_PUBLIC = {
7456
7459
  slip_remove: null,
7457
7460
  bet_placed: null,
7458
7461
  match_view: null,
7459
- popup_opened: null
7462
+ popup_opened: null,
7463
+ fact_view: null,
7464
+ fact_ask: null
7460
7465
  };
7461
7466
 
7462
7467
  // src/popupTelemetry.ts
@@ -7564,7 +7569,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7564
7569
  }
7565
7570
 
7566
7571
  // src/components/ChatPanel.tsx
7567
- var import_react101 = require("react");
7572
+ var import_react102 = require("react");
7568
7573
 
7569
7574
  // src/components/ChatHeader.tsx
7570
7575
  var import_react45 = require("react");
@@ -8953,15 +8958,15 @@ function pathRounds(e) {
8953
8958
  const base = h - pad.b;
8954
8959
  const plotH = h - pad.t - pad.b;
8955
8960
  const { lo, span } = roundSpan(e);
8956
- const seen = /* @__PURE__ */ new Map();
8961
+ const seen2 = /* @__PURE__ */ new Map();
8957
8962
  for (const ev of e.events) {
8958
8963
  if (ev.roundIndex < 0) continue;
8959
8964
  const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
8960
8965
  const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
8961
- if (short !== "" && !seen.has(idx)) seen.set(idx, short);
8966
+ if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
8962
8967
  }
8963
8968
  const kept = [];
8964
- 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])) {
8965
8970
  const y = round22(base - (roundIndex - lo + 1) / span * plotH);
8966
8971
  const last = kept[kept.length - 1];
8967
8972
  if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
@@ -10552,7 +10557,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10552
10557
  }
10553
10558
 
10554
10559
  // src/components/MonitorTabs.tsx
10555
- var import_react71 = require("react");
10560
+ var import_react72 = require("react");
10556
10561
 
10557
10562
  // src/components/MarketAccordion.tsx
10558
10563
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
@@ -10614,16 +10619,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
10614
10619
  }
10615
10620
 
10616
10621
  // src/components/LiveFactBlock.tsx
10622
+ var import_react62 = require("react");
10623
+
10624
+ // src/useFactView.ts
10617
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
10618
10669
  var import_jsx_runtime70 = require("react/jsx-runtime");
10619
10670
  function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10620
- const [expanded, setExpanded] = (0, import_react61.useState)(false);
10671
+ const [expanded, setExpanded] = (0, import_react62.useState)(false);
10621
10672
  const { oddsFormat } = useOddsSettings();
10673
+ const log = useEventLog();
10674
+ const sectionRef = (0, import_react62.useRef)(null);
10622
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);
10623
10678
  if (!current) return null;
10624
10679
  const m = current.market;
10625
10680
  const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
10626
- 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: [
10627
10682
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-fact-k", children: [
10628
10683
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: ui.liveFactLabel }),
10629
10684
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ss-w-fact-min", children: [
@@ -10649,7 +10704,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10649
10704
  marketDeveloperName: m.marketDeveloperName,
10650
10705
  selectionLabel: m.selectionLabel,
10651
10706
  slip,
10652
- ui
10707
+ ui,
10708
+ fact: { id: current.id, factKey: current.factKey }
10653
10709
  }
10654
10710
  )
10655
10711
  ] })
@@ -10667,7 +10723,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10667
10723
  {
10668
10724
  type: "button",
10669
10725
  className: "ss-w-fact-link",
10670
- 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
+ },
10671
10730
  children: ui.liveFactAsk
10672
10731
  }
10673
10732
  ),
@@ -10686,7 +10745,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
10686
10745
  }
10687
10746
 
10688
10747
  // src/components/MonitorFormH2H.tsx
10689
- var import_react62 = require("react");
10748
+ var import_react63 = require("react");
10690
10749
  var import_jsx_runtime71 = require("react/jsx-runtime");
10691
10750
  function resultClass2(result) {
10692
10751
  if (result === "W") return "ss-w-h2h-result--win";
@@ -10702,7 +10761,7 @@ function FormDots({ form, ui }) {
10702
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)) });
10703
10762
  }
10704
10763
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
10705
- const [expanded, setExpanded] = (0, import_react62.useState)(false);
10764
+ const [expanded, setExpanded] = (0, import_react63.useState)(false);
10706
10765
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
10707
10766
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
10708
10767
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, {});
@@ -10935,7 +10994,7 @@ var sportLabel = (ui, sport) => {
10935
10994
  };
10936
10995
 
10937
10996
  // src/components/NbaFormSection.tsx
10938
- var import_react63 = require("react");
10997
+ var import_react64 = require("react");
10939
10998
 
10940
10999
  // src/components/NbaFormRest.tsx
10941
11000
  var import_jsx_runtime74 = require("react/jsx-runtime");
@@ -11034,8 +11093,8 @@ function Row2({ game, abbr, tonight, ui }) {
11034
11093
  ] });
11035
11094
  }
11036
11095
  function NbaFormSection({ match, monitor, ui }) {
11037
- const [open, setOpen] = (0, import_react63.useState)(false);
11038
- 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");
11039
11098
  const form = useNbaForm(match, monitor);
11040
11099
  const b = match.basketball;
11041
11100
  if (!form || !b || !form.home && !form.away) return null;
@@ -11077,10 +11136,10 @@ function NbaFormSection({ match, monitor, ui }) {
11077
11136
  }
11078
11137
 
11079
11138
  // src/components/NbaPropsSection.tsx
11080
- var import_react65 = require("react");
11139
+ var import_react66 = require("react");
11081
11140
 
11082
11141
  // src/components/PropsPieces.tsx
11083
- var import_react64 = require("react");
11142
+ var import_react65 = require("react");
11084
11143
  var import_jsx_runtime76 = require("react/jsx-runtime");
11085
11144
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11086
11145
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11093,9 +11152,9 @@ function preKickoff(match) {
11093
11152
  return Number.isFinite(kickoff) && Date.now() < kickoff;
11094
11153
  }
11095
11154
  function usePreKickoff(match) {
11096
- const [, setTick] = (0, import_react64.useState)(0);
11155
+ const [, setTick] = (0, import_react65.useState)(0);
11097
11156
  const pre = preKickoff(match);
11098
- (0, import_react64.useEffect)(() => {
11157
+ (0, import_react65.useEffect)(() => {
11099
11158
  if (!pre || !match.kickoffUtc) return;
11100
11159
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11101
11160
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11109,7 +11168,7 @@ function usePropsOpen(match, monitor, descriptor) {
11109
11168
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11110
11169
  const live = match.phase === "live";
11111
11170
  const open = pre || live;
11112
- (0, import_react64.useEffect)(() => {
11171
+ (0, import_react65.useEffect)(() => {
11113
11172
  if (!open) return;
11114
11173
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11115
11174
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11187,7 +11246,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
11187
11246
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11188
11247
  const player = livePlayer(bundle, given);
11189
11248
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
11190
- const [picked, setPicked] = (0, import_react64.useState)(null);
11249
+ const [picked, setPicked] = (0, import_react65.useState)(null);
11191
11250
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
11192
11251
  const sample = active?.games?.length ?? 0;
11193
11252
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -11236,7 +11295,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11236
11295
  ] });
11237
11296
  }
11238
11297
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11239
- const [openId, setOpenId] = (0, import_react64.useState)(null);
11298
+ const [openId, setOpenId] = (0, import_react65.useState)(null);
11240
11299
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
11241
11300
  const p = livePlayer(bundle, given);
11242
11301
  const isOpen = openId === p.playerId;
@@ -11273,12 +11332,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11273
11332
  }
11274
11333
  var BOX_QUIET_MS = 12e4;
11275
11334
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11276
- const [tick, setTick] = (0, import_react64.useState)(0);
11335
+ const [tick, setTick] = (0, import_react65.useState)(0);
11277
11336
  const time = clock2(boxAsOfUtc, ui);
11278
11337
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11279
11338
  const valid = !Number.isNaN(at2);
11280
11339
  const onBreak = atBreak(match);
11281
- (0, import_react64.useEffect)(() => {
11340
+ (0, import_react65.useEffect)(() => {
11282
11341
  if (!valid || onBreak) return;
11283
11342
  const age2 = Date.now() - at2;
11284
11343
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11339,12 +11398,12 @@ var nbaDescriptor = (ui, match) => ({
11339
11398
  tenGameBars: false
11340
11399
  });
11341
11400
  function StatsClock2({ bundle, match, ui }) {
11342
- const [tick, setTick] = (0, import_react65.useState)(0);
11401
+ const [tick, setTick] = (0, import_react66.useState)(0);
11343
11402
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
11344
11403
  const time = clock2(bundle.boxAsOfUtc, ui);
11345
11404
  const valid = !Number.isNaN(at2) && time !== "";
11346
11405
  const onBreak = atBreak(match);
11347
- (0, import_react65.useEffect)(() => {
11406
+ (0, import_react66.useEffect)(() => {
11348
11407
  if (!valid || onBreak) return;
11349
11408
  const age2 = Date.now() - at2;
11350
11409
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11358,7 +11417,7 @@ function StatsClock2({ bundle, match, ui }) {
11358
11417
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
11359
11418
  }
11360
11419
  function NbaPropsSection({ match, monitor, ui, slip }) {
11361
- const [side, setSide] = (0, import_react65.useState)("home");
11420
+ const [side, setSide] = (0, import_react66.useState)("home");
11362
11421
  const descriptor = nbaDescriptor(ui, match);
11363
11422
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11364
11423
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11507,7 +11566,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
11507
11566
  }
11508
11567
 
11509
11568
  // src/components/NflFormSection.tsx
11510
- var import_react66 = require("react");
11569
+ var import_react67 = require("react");
11511
11570
  var import_jsx_runtime79 = require("react/jsx-runtime");
11512
11571
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
11513
11572
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -11559,7 +11618,7 @@ function H2hRow({ game, home, ui }) {
11559
11618
  ] });
11560
11619
  }
11561
11620
  function NflFormSection({ match, monitor, ui }) {
11562
- const [segment, setSegment] = (0, import_react66.useState)("away");
11621
+ const [segment, setSegment] = (0, import_react67.useState)("away");
11563
11622
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
11564
11623
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
11565
11624
  const form = bundle?.form;
@@ -11592,7 +11651,7 @@ function NflFormSection({ match, monitor, ui }) {
11592
11651
  }
11593
11652
 
11594
11653
  // src/components/NflPropsSection.tsx
11595
- var import_react67 = require("react");
11654
+ var import_react68 = require("react");
11596
11655
  var import_jsx_runtime80 = require("react/jsx-runtime");
11597
11656
  var TRENDS_SHOWN = 3;
11598
11657
  var SCORERS_SHOWN = 8;
@@ -11665,7 +11724,7 @@ function ShowMore({ label, onClick }) {
11665
11724
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
11666
11725
  }
11667
11726
  function Trends({ bundle, facts, descriptor, ui, slip }) {
11668
- const [all, setAll] = (0, import_react67.useState)(false);
11727
+ const [all, setAll] = (0, import_react68.useState)(false);
11669
11728
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
11670
11729
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
11671
11730
  /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -11698,7 +11757,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
11698
11757
  ] });
11699
11758
  }
11700
11759
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11701
- const [all, setAll] = (0, import_react67.useState)(false);
11760
+ const [all, setAll] = (0, import_react68.useState)(false);
11702
11761
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
11703
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" });
11704
11763
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
@@ -11725,7 +11784,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
11725
11784
  ] });
11726
11785
  }
11727
11786
  function NflPropsSection({ match, monitor, ui, slip }) {
11728
- const [tab, setTab] = (0, import_react67.useState)(null);
11787
+ const [tab, setTab] = (0, import_react68.useState)(null);
11729
11788
  const descriptor = nflDescriptor(ui);
11730
11789
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11731
11790
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11911,7 +11970,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
11911
11970
  }
11912
11971
 
11913
11972
  // src/components/TennisMonitorCard.tsx
11914
- var import_react69 = require("react");
11973
+ var import_react70 = require("react");
11915
11974
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
11916
11975
 
11917
11976
  // src/components/TennisFixtureRow.tsx
@@ -12172,7 +12231,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12172
12231
  }
12173
12232
 
12174
12233
  // src/components/TennisStatsTables.tsx
12175
- var import_react68 = require("react");
12234
+ var import_react69 = require("react");
12176
12235
  var import_jsx_runtime87 = require("react/jsx-runtime");
12177
12236
  function formatStat(row, value, locale) {
12178
12237
  if (value == null) return "\u2013";
@@ -12210,8 +12269,8 @@ function Tables({ table, labels, names, locale }) {
12210
12269
  ] });
12211
12270
  }
12212
12271
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12213
- const [tab, setTab] = (0, import_react68.useState)("match");
12214
- (0, import_react68.useEffect)(() => {
12272
+ const [tab, setTab] = (0, import_react69.useState)("match");
12273
+ (0, import_react69.useEffect)(() => {
12215
12274
  setTab("match");
12216
12275
  }, [resetKey]);
12217
12276
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12242,7 +12301,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
12242
12301
  ] }),
12243
12302
  today.rows.map((r) => {
12244
12303
  const f = (v) => formatStat({ kind: "pct" }, v, locale);
12245
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react68.Fragment, { children: [
12304
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react69.Fragment, { children: [
12246
12305
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
12247
12306
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
12248
12307
  f(r.p1Today),
@@ -12377,7 +12436,7 @@ function HeadToHead({ t, ui }) {
12377
12436
  ] });
12378
12437
  }
12379
12438
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12380
- const lastTables = (0, import_react69.useRef)(null);
12439
+ const lastTables = (0, import_react70.useRef)(null);
12381
12440
  const t = match.tennis;
12382
12441
  if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12383
12442
  const preMatch = match.phase === "preMatch";
@@ -12457,7 +12516,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12457
12516
  }
12458
12517
 
12459
12518
  // src/components/ScoreboardStrip.tsx
12460
- var import_react70 = require("react");
12519
+ var import_react71 = require("react");
12461
12520
  var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
12462
12521
  var import_jsx_runtime89 = require("react/jsx-runtime");
12463
12522
  function nbaStatus(m, ui) {
@@ -12552,8 +12611,8 @@ function rowsFor(m) {
12552
12611
  ];
12553
12612
  }
12554
12613
  function useStripScroll(selectedKey) {
12555
- const stripRef = (0, import_react70.useRef)(null);
12556
- (0, import_react70.useEffect)(() => {
12614
+ const stripRef = (0, import_react71.useRef)(null);
12615
+ (0, import_react71.useEffect)(() => {
12557
12616
  const strip = stripRef.current;
12558
12617
  const pressed = strip?.querySelector('[aria-pressed="true"]');
12559
12618
  if (!strip || !pressed) return;
@@ -12727,7 +12786,7 @@ function OddsLiveStrip({ m, ui }) {
12727
12786
  ] });
12728
12787
  }
12729
12788
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
12730
- const seedIndex = (0, import_react71.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
12789
+ const seedIndex = (0, import_react72.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
12731
12790
  const tiles = orderTiles(
12732
12791
  monitor.pins,
12733
12792
  monitor.snapshot,
@@ -12799,7 +12858,7 @@ function TrendsPanel({ monitor, ui, slip }) {
12799
12858
  }
12800
12859
 
12801
12860
  // src/components/LivePanel.tsx
12802
- var import_react74 = require("react");
12861
+ var import_react75 = require("react");
12803
12862
  var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
12804
12863
 
12805
12864
  // src/scheduleView.ts
@@ -12974,20 +13033,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
12974
13033
  }
12975
13034
 
12976
13035
  // src/components/MatchSheet.tsx
12977
- var import_react73 = require("react");
13036
+ var import_react74 = require("react");
12978
13037
  var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
12979
13038
 
12980
13039
  // src/useModalDialog.ts
12981
- var import_react72 = require("react");
13040
+ var import_react73 = require("react");
12982
13041
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
12983
13042
  function useModalDialog(onClose, opts = {}) {
12984
- const dialogRef = (0, import_react72.useRef)(null);
12985
- const onCloseRef = (0, import_react72.useRef)(onClose);
13043
+ const dialogRef = (0, import_react73.useRef)(null);
13044
+ const onCloseRef = (0, import_react73.useRef)(onClose);
12986
13045
  onCloseRef.current = onClose;
12987
- const openerRef = (0, import_react72.useRef)(opts.opener);
13046
+ const openerRef = (0, import_react73.useRef)(opts.opener);
12988
13047
  openerRef.current = opts.opener;
12989
13048
  const restore = opts.restoreFocus ?? true;
12990
- (0, import_react72.useEffect)(() => {
13049
+ (0, import_react73.useEffect)(() => {
12991
13050
  const dialog = dialogRef.current;
12992
13051
  const root = dialog?.getRootNode();
12993
13052
  const focusedAtMount = root?.activeElement ?? null;
@@ -12998,7 +13057,7 @@ function useModalDialog(onClose, opts = {}) {
12998
13057
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
12999
13058
  };
13000
13059
  }, []);
13001
- (0, import_react72.useEffect)(() => {
13060
+ (0, import_react73.useEffect)(() => {
13002
13061
  const onKey = (e) => {
13003
13062
  if (e.key !== "Escape") return;
13004
13063
  e.stopPropagation();
@@ -13039,8 +13098,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
13039
13098
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
13040
13099
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
13041
13100
  const log = useEventLog();
13042
- const titleId = (0, import_react73.useId)();
13043
- const [limitHit, setLimitHit] = (0, import_react73.useState)(false);
13101
+ const titleId = (0, import_react74.useId)();
13102
+ const [limitHit, setLimitHit] = (0, import_react74.useState)(false);
13044
13103
  const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
13045
13104
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
13046
13105
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -13141,10 +13200,10 @@ var OPEN_TOP_GROUPS = 2;
13141
13200
  var QUIET_ROWS = 4;
13142
13201
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
13143
13202
  const { groups, states, stale } = discovery;
13144
- const [mine, setMine] = (0, import_react74.useState)(false);
13145
- const [toggled, setToggled] = (0, import_react74.useState)(/* @__PURE__ */ new Map());
13146
- const [sheet, setSheet] = (0, import_react74.useState)(null);
13147
- 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)(
13148
13207
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
13149
13208
  [monitor.pins]
13150
13209
  );
@@ -13250,20 +13309,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13250
13309
  }
13251
13310
 
13252
13311
  // src/components/ScheduleMatchesPanel.tsx
13253
- var import_react78 = require("react");
13312
+ var import_react79 = require("react");
13254
13313
  var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
13255
13314
 
13256
13315
  // src/useTennisRowPrices.ts
13257
- var import_react75 = require("react");
13316
+ var import_react76 = require("react");
13258
13317
  var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
13259
13318
  var TENNIS_PRICE_POLL_MS = 6e4;
13260
13319
  function useTennisRowPrices(a) {
13261
- const [state, setState] = (0, import_react75.useState)({ byId: null, stale: false });
13262
- 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);
13263
13322
  getPricesRef.current = a.getPrices;
13264
- const latest = (0, import_react75.useRef)(0);
13323
+ const latest = (0, import_react76.useRef)(0);
13265
13324
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13266
- (0, import_react75.useEffect)(() => {
13325
+ (0, import_react76.useEffect)(() => {
13267
13326
  if (!a.enabled || idsKey === "") {
13268
13327
  latest.current++;
13269
13328
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13301,11 +13360,11 @@ function useTennisRowPrices(a) {
13301
13360
  }
13302
13361
 
13303
13362
  // src/components/DayStrip.tsx
13304
- var import_react76 = require("react");
13363
+ var import_react77 = require("react");
13305
13364
  var import_jsx_runtime98 = require("react/jsx-runtime");
13306
13365
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13307
- const listRef = (0, import_react76.useRef)(null);
13308
- (0, import_react76.useEffect)(() => {
13366
+ const listRef = (0, import_react77.useRef)(null);
13367
+ (0, import_react77.useEffect)(() => {
13309
13368
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13310
13369
  if (!el || typeof el.scrollIntoView !== "function") return;
13311
13370
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13334,7 +13393,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13334
13393
  }
13335
13394
 
13336
13395
  // src/components/games/ui/SearchField.tsx
13337
- var import_react77 = require("react");
13396
+ var import_react78 = require("react");
13338
13397
 
13339
13398
  // src/components/games/ui/icons.tsx
13340
13399
  var import_jsx_runtime99 = require("react/jsx-runtime");
@@ -13373,8 +13432,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
13373
13432
  // src/components/games/ui/SearchField.tsx
13374
13433
  var import_jsx_runtime100 = require("react/jsx-runtime");
13375
13434
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13376
- const localRef = (0, import_react77.useRef)(null);
13377
- const setInputRef = (0, import_react77.useCallback)((node) => {
13435
+ const localRef = (0, import_react78.useRef)(null);
13436
+ const setInputRef = (0, import_react78.useCallback)((node) => {
13378
13437
  localRef.current = node;
13379
13438
  if (typeof inputRef === "function") inputRef(node);
13380
13439
  else if (inputRef) inputRef.current = node;
@@ -13420,18 +13479,18 @@ var TOP_ROW_CAP = 3;
13420
13479
  var SKELETON_ROWS = 3;
13421
13480
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
13422
13481
  const { localDate: today, states, stale } = discovery;
13423
- const searchId = (0, import_react78.useId)();
13424
- const [query, setQuery] = (0, import_react78.useState)("");
13425
- const [toggled, setToggled] = (0, import_react78.useState)(/* @__PURE__ */ new Map());
13426
- const [expanded, setExpanded] = (0, import_react78.useState)(/* @__PURE__ */ new Set());
13427
- const listRef = (0, import_react78.useRef)(null);
13428
- 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);
13429
13488
  const { chips, selected } = loaded;
13430
- (0, import_react78.useEffect)(() => {
13489
+ (0, import_react79.useEffect)(() => {
13431
13490
  if (selected !== day) onDay(selected);
13432
13491
  }, [day, selected, onDay]);
13433
13492
  const isToday = selected === today;
13434
- const pinnedKeys = (0, import_react78.useMemo)(
13493
+ const pinnedKeys = (0, import_react79.useMemo)(
13435
13494
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
13436
13495
  [monitor.pins]
13437
13496
  );
@@ -13569,7 +13628,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
13569
13628
  }
13570
13629
 
13571
13630
  // src/components/GamesPanel.tsx
13572
- var import_react93 = require("react");
13631
+ var import_react94 = require("react");
13573
13632
 
13574
13633
  // src/components/GamesLoginWall.tsx
13575
13634
  var import_jsx_runtime102 = require("react/jsx-runtime");
@@ -13578,7 +13637,7 @@ function GamesLoginWall({ ui }) {
13578
13637
  }
13579
13638
 
13580
13639
  // src/components/GamesHub.tsx
13581
- var import_react79 = require("react");
13640
+ var import_react80 = require("react");
13582
13641
 
13583
13642
  // src/components/games/ui/gameMeta.ts
13584
13643
  function prettifyGameId(gameId) {
@@ -13729,8 +13788,8 @@ function pickHeroGame(games) {
13729
13788
  }
13730
13789
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
13731
13790
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13732
- const [, setTick] = (0, import_react79.useState)(0);
13733
- (0, import_react79.useEffect)(() => {
13791
+ const [, setTick] = (0, import_react80.useState)(0);
13792
+ (0, import_react80.useEffect)(() => {
13734
13793
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
13735
13794
  return () => clearInterval(id);
13736
13795
  }, []);
@@ -13790,10 +13849,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
13790
13849
  }
13791
13850
 
13792
13851
  // src/components/GameScreenHost.tsx
13793
- var import_react91 = require("react");
13852
+ var import_react92 = require("react");
13794
13853
 
13795
13854
  // src/useGamePlay.ts
13796
- var import_react80 = require("react");
13855
+ var import_react81 = require("react");
13797
13856
  function toSubmitResult(payload) {
13798
13857
  return {
13799
13858
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -13805,17 +13864,17 @@ function toSubmitResult(payload) {
13805
13864
  };
13806
13865
  }
13807
13866
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
13808
- const [result, setResult] = (0, import_react80.useState)(null);
13809
- const [submitting, setSubmitting] = (0, import_react80.useState)(false);
13810
- const [rawStatus, setRawStatus] = (0, import_react80.useState)(null);
13811
- const inFlightRef = (0, import_react80.useRef)(false);
13812
- 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);
13813
13872
  convRef.current = conversation;
13814
- const optsRef = (0, import_react80.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
13873
+ const optsRef = (0, import_react81.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
13815
13874
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
13816
- const resultRef = (0, import_react80.useRef)(null);
13875
+ const resultRef = (0, import_react81.useRef)(null);
13817
13876
  resultRef.current = result;
13818
- const refetch = (0, import_react80.useCallback)(async () => {
13877
+ const refetch = (0, import_react81.useCallback)(async () => {
13819
13878
  const conv = convRef.current;
13820
13879
  if (!conv) return;
13821
13880
  const opts = optsRef.current;
@@ -13831,7 +13890,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13831
13890
  } catch {
13832
13891
  }
13833
13892
  }, []);
13834
- const submit = (0, import_react80.useCallback)(async (answerJson) => {
13893
+ const submit = (0, import_react81.useCallback)(async (answerJson) => {
13835
13894
  const conv = convRef.current;
13836
13895
  if (!conv || inFlightRef.current) return;
13837
13896
  inFlightRef.current = true;
@@ -13858,14 +13917,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
13858
13917
  setSubmitting(false);
13859
13918
  }
13860
13919
  }, [refetch]);
13861
- const hydrate = (0, import_react80.useCallback)(() => {
13920
+ const hydrate = (0, import_react81.useCallback)(() => {
13862
13921
  void refetch();
13863
13922
  }, [refetch]);
13864
13923
  return { result, submitting, submit, hydrate, rawStatus };
13865
13924
  }
13866
13925
 
13867
13926
  // src/components/games/MysteryTigerGame.tsx
13868
- var import_react82 = require("react");
13927
+ var import_react83 = require("react");
13869
13928
 
13870
13929
  // src/components/games/nationFlags.ts
13871
13930
  var FLAGS = {
@@ -14076,7 +14135,7 @@ function isNationCode(flag) {
14076
14135
  }
14077
14136
 
14078
14137
  // src/components/games/PlayerAvatar.tsx
14079
- var import_react81 = require("react");
14138
+ var import_react82 = require("react");
14080
14139
  var import_jsx_runtime107 = require("react/jsx-runtime");
14081
14140
  function initialsOf(name) {
14082
14141
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -14094,7 +14153,7 @@ function PlayerAvatar({
14094
14153
  imagePath,
14095
14154
  className
14096
14155
  }) {
14097
- const [failed, setFailed] = (0, import_react81.useState)(false);
14156
+ const [failed, setFailed] = (0, import_react82.useState)(false);
14098
14157
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
14099
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) }) });
14100
14159
  }
@@ -14338,8 +14397,8 @@ function MysteryTigerGame({
14338
14397
  onBack
14339
14398
  }) {
14340
14399
  const t = ui.games.mysteryTiger;
14341
- const [query, setQuery] = (0, import_react82.useState)("");
14342
- const inputId = (0, import_react82.useId)();
14400
+ const [query, setQuery] = (0, import_react83.useState)("");
14401
+ const inputId = (0, import_react83.useId)();
14343
14402
  const clientState = parseClientState(result?.clientStateJson);
14344
14403
  const guessResults = clientState?.guessResults ?? [];
14345
14404
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -14600,13 +14659,13 @@ function HigherOrLowerGame({
14600
14659
  }
14601
14660
 
14602
14661
  // src/components/games/CareerPathGame.tsx
14603
- var import_react84 = require("react");
14662
+ var import_react85 = require("react");
14604
14663
 
14605
14664
  // src/components/games/ui/CrestShield.tsx
14606
- var import_react83 = require("react");
14665
+ var import_react84 = require("react");
14607
14666
  var import_jsx_runtime118 = require("react/jsx-runtime");
14608
14667
  function CrestShield({ src, name, size = 28 }) {
14609
- const [failed, setFailed] = (0, import_react83.useState)(false);
14668
+ const [failed, setFailed] = (0, import_react84.useState)(false);
14610
14669
  if (src && !isPlaceholderImage(src) && !failed) {
14611
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) });
14612
14671
  }
@@ -14638,8 +14697,8 @@ function CareerPathGame({
14638
14697
  }) {
14639
14698
  const s = ui.games.careerPath;
14640
14699
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
14641
- const [query, setQuery] = (0, import_react84.useState)("");
14642
- const inputId = (0, import_react84.useId)();
14700
+ const [query, setQuery] = (0, import_react85.useState)("");
14701
+ const inputId = (0, import_react85.useId)();
14643
14702
  const clientState = parseClientState3(result?.clientStateJson);
14644
14703
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
14645
14704
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -14745,7 +14804,7 @@ function CareerPathGame({
14745
14804
  }
14746
14805
 
14747
14806
  // src/components/games/BeatTheGridGame.tsx
14748
- var import_react85 = __toESM(require("react"), 1);
14807
+ var import_react86 = __toESM(require("react"), 1);
14749
14808
 
14750
14809
  // src/components/games/ui/OptionList.tsx
14751
14810
  var import_jsx_runtime120 = require("react/jsx-runtime");
@@ -14834,10 +14893,10 @@ function SearchSheet({
14834
14893
  ui
14835
14894
  }) {
14836
14895
  const s = ui.games.beatTheGrid;
14837
- const [query, setQuery] = (0, import_react85.useState)("");
14838
- const inputId = (0, import_react85.useId)();
14839
- const inputRef = (0, import_react85.useRef)(null);
14840
- (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)(() => {
14841
14900
  inputRef.current?.focus();
14842
14901
  }, [row, col]);
14843
14902
  const filtered = playerPool.filter(
@@ -14902,7 +14961,7 @@ function BeatTheGridGame({
14902
14961
  }) {
14903
14962
  const s = ui.games.beatTheGrid;
14904
14963
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
14905
- const [activeCell, setActiveCell] = (0, import_react85.useState)(null);
14964
+ const [activeCell, setActiveCell] = (0, import_react86.useState)(null);
14906
14965
  const clientState = parseClientState4(result?.clientStateJson);
14907
14966
  const filledCells = clientState?.cells ?? [];
14908
14967
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -14976,7 +15035,7 @@ function BeatTheGridGame({
14976
15035
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
14977
15036
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
14978
15037
  ] });
14979
- 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: [
14980
15039
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
14981
15040
  cols.map((colLabel, colIdx) => {
14982
15041
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -15057,7 +15116,7 @@ function BeatTheGridGame({
15057
15116
  }
15058
15117
 
15059
15118
  // src/components/games/GuessTheXiGame.tsx
15060
- var import_react86 = require("react");
15119
+ var import_react87 = require("react");
15061
15120
 
15062
15121
  // src/components/games/ui/PitchSvg.tsx
15063
15122
  var import_jsx_runtime122 = require("react/jsx-runtime");
@@ -15146,8 +15205,8 @@ function GuessTheXiGame({
15146
15205
  onBack
15147
15206
  }) {
15148
15207
  const t = ui.games.guessTheXi;
15149
- const [query, setQuery] = (0, import_react86.useState)("");
15150
- const inputId = (0, import_react86.useId)();
15208
+ const [query, setQuery] = (0, import_react87.useState)("");
15209
+ const inputId = (0, import_react87.useId)();
15151
15210
  const clientState = parseClientState5(result?.clientStateJson);
15152
15211
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
15153
15212
  const solved = clientState?.status === "solved";
@@ -15289,7 +15348,7 @@ function GuessTheXiGame({
15289
15348
  }
15290
15349
 
15291
15350
  // src/components/games/DailyQuizGame.tsx
15292
- var import_react87 = require("react");
15351
+ var import_react88 = require("react");
15293
15352
  var import_jsx_runtime124 = require("react/jsx-runtime");
15294
15353
  function parseClientState6(json) {
15295
15354
  if (!json) return null;
@@ -15330,8 +15389,8 @@ function DailyQuizGame({
15330
15389
  }) {
15331
15390
  const s = ui.games.dailyQuiz;
15332
15391
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
15333
- const [selections, setSelections] = (0, import_react87.useState)(/* @__PURE__ */ new Map());
15334
- 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);
15335
15394
  const clientState = parseClientState6(result?.clientStateJson);
15336
15395
  const results2 = clientState?.results ?? [];
15337
15396
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -15441,7 +15500,7 @@ function DailyQuizGame({
15441
15500
  }
15442
15501
 
15443
15502
  // src/components/games/MatchdayPredictorGame.tsx
15444
- var import_react88 = require("react");
15503
+ var import_react89 = require("react");
15445
15504
  var import_jsx_runtime125 = require("react/jsx-runtime");
15446
15505
  var SCORER_SEARCH_THRESHOLD = 9;
15447
15506
  function parseClientState7(json) {
@@ -15537,12 +15596,12 @@ function MatchdayPredictorGame({
15537
15596
  onBack
15538
15597
  }) {
15539
15598
  const t = ui.games.predictor;
15540
- const [homeScore, setHomeScore] = (0, import_react88.useState)(0);
15541
- const [awayScore, setAwayScore] = (0, import_react88.useState)(0);
15542
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react88.useState)(null);
15543
- const [lastEdited, setLastEdited] = (0, import_react88.useState)("home");
15544
- const [query, setQuery] = (0, import_react88.useState)("");
15545
- 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)();
15546
15605
  const clientState = parseClientState7(result?.clientStateJson);
15547
15606
  const alreadyPlayed = result?.alreadyPlayed === true;
15548
15607
  const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
@@ -15709,7 +15768,7 @@ function MatchdayPredictorGame({
15709
15768
  }
15710
15769
 
15711
15770
  // src/components/games/StartingXiGame.tsx
15712
- var import_react89 = require("react");
15771
+ var import_react90 = require("react");
15713
15772
  var import_jsx_runtime126 = require("react/jsx-runtime");
15714
15773
  var POINTS_PER_STARTER = 8;
15715
15774
  var XI_SIZE = 11;
@@ -15753,10 +15812,10 @@ function StartingXiGame({
15753
15812
  lockAtUtc
15754
15813
  }) {
15755
15814
  const t = ui.games.startingXi;
15756
- const [slotPlayers, setSlotPlayers] = (0, import_react89.useState)(() => Array(XI_SIZE).fill(null));
15757
- const [active, setActive] = (0, import_react89.useState)(0);
15758
- const [query, setQuery] = (0, import_react89.useState)("");
15759
- 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)();
15760
15819
  const clientState = parseClientState8(result?.clientStateJson);
15761
15820
  const alreadyPlayed = result?.alreadyPlayed === true;
15762
15821
  const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
@@ -15895,7 +15954,7 @@ function StartingXiGame({
15895
15954
  }
15896
15955
 
15897
15956
  // src/components/games/StatLadderGame.tsx
15898
- var import_react90 = require("react");
15957
+ var import_react91 = require("react");
15899
15958
  var import_jsx_runtime127 = require("react/jsx-runtime");
15900
15959
  function ladderClue(ladder) {
15901
15960
  const mystery = ladder.find((r) => r.rank === 2);
@@ -15932,9 +15991,9 @@ function StatLadderGame({
15932
15991
  onBack
15933
15992
  }) {
15934
15993
  const t = ui.games.statLadder;
15935
- const [query, setQuery] = (0, import_react90.useState)("");
15936
- const [selectedId, setSelectedId] = (0, import_react90.useState)(null);
15937
- 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)();
15938
15997
  const clientState = parseClientState9(result?.clientStateJson);
15939
15998
  const revealed = clientState != null;
15940
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 });
@@ -16140,8 +16199,8 @@ function GameScreenHost({
16140
16199
  ui
16141
16200
  }) {
16142
16201
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16143
- const [configJson, setConfigJson] = (0, import_react91.useState)(null);
16144
- (0, import_react91.useEffect)(() => {
16202
+ const [configJson, setConfigJson] = (0, import_react92.useState)(null);
16203
+ (0, import_react92.useEffect)(() => {
16145
16204
  setConfigJson(null);
16146
16205
  if (!conversation) return;
16147
16206
  let cancelled = false;
@@ -16164,12 +16223,12 @@ function GameScreenHost({
16164
16223
  fixtureId: fixtureId || void 0,
16165
16224
  locale: ui.hostTag
16166
16225
  });
16167
- (0, import_react91.useEffect)(() => {
16226
+ (0, import_react92.useEffect)(() => {
16168
16227
  if (conversation) hydrate();
16169
16228
  }, [conversation, gameId]);
16170
- const hydrateRef = (0, import_react91.useRef)(hydrate);
16229
+ const hydrateRef = (0, import_react92.useRef)(hydrate);
16171
16230
  hydrateRef.current = hydrate;
16172
- (0, import_react91.useEffect)(() => {
16231
+ (0, import_react92.useEffect)(() => {
16173
16232
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16174
16233
  if (rawStatus !== "pending") return;
16175
16234
  const timerId = setInterval(() => {
@@ -16282,7 +16341,7 @@ function GameScreenHost({
16282
16341
  }
16283
16342
 
16284
16343
  // src/components/Leaderboard.tsx
16285
- var import_react92 = require("react");
16344
+ var import_react93 = require("react");
16286
16345
 
16287
16346
  // src/components/LeaderboardRow.tsx
16288
16347
  var import_jsx_runtime130 = require("react/jsx-runtime");
@@ -16369,7 +16428,7 @@ function Leaderboard({
16369
16428
  ui,
16370
16429
  onPlay
16371
16430
  }) {
16372
- const [segment, setSegment] = (0, import_react92.useState)("weekly");
16431
+ const [segment, setSegment] = (0, import_react93.useState)("weekly");
16373
16432
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
16374
16433
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
16375
16434
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -16474,9 +16533,9 @@ function GamesPanel({
16474
16533
  leaderboardLoading,
16475
16534
  refreshHub
16476
16535
  }) {
16477
- const [selected, setSelected] = (0, import_react93.useState)(null);
16478
- const [segment, setSegment] = (0, import_react93.useState)("play");
16479
- (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)(() => {
16480
16539
  ensureGamesFonts();
16481
16540
  }, []);
16482
16541
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
@@ -16540,10 +16599,10 @@ function GamesPanel({
16540
16599
  }
16541
16600
 
16542
16601
  // src/components/FavouritesPanel.tsx
16543
- var import_react96 = require("react");
16602
+ var import_react97 = require("react");
16544
16603
 
16545
16604
  // src/components/FavouriteChips.tsx
16546
- var import_react94 = require("react");
16605
+ var import_react95 = require("react");
16547
16606
  var import_jsx_runtime135 = require("react/jsx-runtime");
16548
16607
  async function toggleWithNotice(controller, kind, id, onNotice) {
16549
16608
  const outcome = await controller.toggle(kind, id);
@@ -16590,12 +16649,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
16590
16649
  ] });
16591
16650
  }
16592
16651
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
16593
- const [confirming, setConfirming] = (0, import_react94.useState)(false);
16652
+ const [confirming, setConfirming] = (0, import_react95.useState)(false);
16594
16653
  const data = controller.data;
16595
- (0, import_react94.useEffect)(() => {
16654
+ (0, import_react95.useEffect)(() => {
16596
16655
  setConfirming(false);
16597
16656
  }, [sport]);
16598
- (0, import_react94.useEffect)(() => {
16657
+ (0, import_react95.useEffect)(() => {
16599
16658
  if (!confirming) return;
16600
16659
  const onPointerDown = (e) => {
16601
16660
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -16649,21 +16708,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
16649
16708
  }
16650
16709
 
16651
16710
  // src/components/FavouritesSearch.tsx
16652
- var import_react95 = require("react");
16711
+ var import_react96 = require("react");
16653
16712
  var import_jsx_runtime136 = require("react/jsx-runtime");
16654
16713
  var MIN_LETTERS = 2;
16655
16714
  var MAX_LENGTH = 64;
16656
16715
  var DEBOUNCE_MS = 250;
16657
16716
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
16658
- const [query, setQuery] = (0, import_react95.useState)("");
16659
- const [answer, setAnswer] = (0, import_react95.useState)(null);
16660
- 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);
16661
16720
  controllerRef.current = controller;
16662
16721
  const trimmed = query.trim();
16663
16722
  const queryKey = `${sport}|${trimmed}`;
16664
16723
  const results2 = answer?.key === queryKey ? answer.rows : [];
16665
16724
  const settled = answer?.key === queryKey;
16666
- (0, import_react95.useEffect)(() => {
16725
+ (0, import_react96.useEffect)(() => {
16667
16726
  setAnswer(null);
16668
16727
  if (trimmed.length < MIN_LETTERS) return;
16669
16728
  let cancelled = false;
@@ -16726,13 +16785,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
16726
16785
  // src/components/FavouritesPanel.tsx
16727
16786
  var import_jsx_runtime137 = require("react/jsx-runtime");
16728
16787
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16729
- const [notice, setNotice] = (0, import_react96.useState)(null);
16730
- 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);
16731
16790
  refreshRef.current = controller.refresh;
16732
- (0, import_react96.useEffect)(() => {
16791
+ (0, import_react97.useEffect)(() => {
16733
16792
  void refreshRef.current();
16734
16793
  }, []);
16735
- (0, import_react96.useEffect)(() => {
16794
+ (0, import_react97.useEffect)(() => {
16736
16795
  setNotice(null);
16737
16796
  }, [sport]);
16738
16797
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -16758,7 +16817,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
16758
16817
  }
16759
16818
 
16760
16819
  // src/components/dashboard/v8/SentenceBuilder.tsx
16761
- var import_react97 = require("react");
16820
+ var import_react98 = require("react");
16762
16821
  var import_jsx_runtime138 = require("react/jsx-runtime");
16763
16822
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
16764
16823
  var BASE_LEGS = [1, 2, 3, 4];
@@ -16784,8 +16843,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16784
16843
  const opening = openingGames(preset);
16785
16844
  const gamesOptions = opening.options;
16786
16845
  const marketOptions = usableMarkets(preset);
16787
- const [fingerprint] = (0, import_react97.useState)(() => JSON.stringify(preset));
16788
- const [saved] = (0, import_react97.useState)(() => {
16846
+ const [fingerprint] = (0, import_react98.useState)(() => JSON.stringify(preset));
16847
+ const [saved] = (0, import_react98.useState)(() => {
16789
16848
  const kept = memory3?.savedView(sport);
16790
16849
  return kept && kept.fingerprint === fingerprint ? kept : null;
16791
16850
  });
@@ -16799,9 +16858,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16799
16858
  // The server never widens by itself: an all-games preset with no ids asks for it.
16800
16859
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
16801
16860
  };
16802
- const [view, setView] = (0, import_react97.useState)(() => saved?.view ?? openingView);
16803
- const autoWidened = (0, import_react97.useRef)(false);
16804
- 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);
16805
16864
  const requestFor = (v) => ({
16806
16865
  sport,
16807
16866
  ...v.marketKey !== null ? { marketKey: v.marketKey } : {},
@@ -16813,10 +16872,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16813
16872
  ...operatorUserId ? { operatorUserId } : {},
16814
16873
  ...anonymousUserId ? { anonymousUserId } : {}
16815
16874
  });
16816
- const [first] = (0, import_react97.useState)(() => requestFor(view));
16875
+ const [first] = (0, import_react98.useState)(() => requestFor(view));
16817
16876
  const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
16818
- const lastRequest = (0, import_react97.useRef)(first);
16819
- (0, import_react97.useEffect)(() => {
16877
+ const lastRequest = (0, import_react98.useRef)(first);
16878
+ (0, import_react98.useEffect)(() => {
16820
16879
  void request(lastRequest.current);
16821
16880
  }, [request]);
16822
16881
  const send = (req) => {
@@ -16849,17 +16908,17 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16849
16908
  const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
16850
16909
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
16851
16910
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
16852
- const [startedNote, setStartedNote] = (0, import_react97.useState)(false);
16911
+ const [startedNote, setStartedNote] = (0, import_react98.useState)(false);
16853
16912
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
16854
- (0, import_react97.useEffect)(() => {
16913
+ (0, import_react98.useEffect)(() => {
16855
16914
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
16856
16915
  }, [startedNote, status2, anyStarted]);
16857
16916
  const market = rows?.[0]?.market;
16858
- const [seen, setSeen] = (0, import_react97.useState)(null);
16859
- (0, import_react97.useEffect)(() => {
16917
+ const [seen2, setSeen] = (0, import_react98.useState)(null);
16918
+ (0, import_react98.useEffect)(() => {
16860
16919
  if (market) setSeen(market);
16861
16920
  }, [market]);
16862
- 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;
16863
16922
  const paused = ready && grid.status === "paused";
16864
16923
  const coolOff = status2 === "ready" && grid === null;
16865
16924
  const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
@@ -16869,14 +16928,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
16869
16928
  const quotedAt = rows ? oldestQuote(rows) : null;
16870
16929
  const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
16871
16930
  const canWiden = gamesOptions === null || allGames !== null;
16872
- (0, import_react97.useEffect)(() => {
16931
+ (0, import_react98.useEffect)(() => {
16873
16932
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
16874
16933
  autoWidened.current = true;
16875
16934
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
16876
16935
  commit(next, true);
16877
16936
  send(requestFor(next));
16878
16937
  }, [empty2, singles, widened, canWiden, view]);
16879
- (0, import_react97.useEffect)(() => {
16938
+ (0, import_react98.useEffect)(() => {
16880
16939
  if (coolOff) onCoolOff?.(sport);
16881
16940
  }, [coolOff, onCoolOff, sport]);
16882
16941
  if (coolOff) return null;
@@ -17279,10 +17338,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
17279
17338
  }
17280
17339
 
17281
17340
  // src/components/PlayerPhoto.tsx
17282
- var import_react98 = require("react");
17341
+ var import_react99 = require("react");
17283
17342
  var import_jsx_runtime144 = require("react/jsx-runtime");
17284
17343
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
17285
- const [failed, setFailed] = (0, import_react98.useState)(false);
17344
+ const [failed, setFailed] = (0, import_react99.useState)(false);
17286
17345
  const box = { width: size, height: size };
17287
17346
  if (photoUrl && !failed) {
17288
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) });
@@ -17317,7 +17376,7 @@ function MiniPitch({ positionCode }) {
17317
17376
  }
17318
17377
 
17319
17378
  // src/components/PerformanceBars.tsx
17320
- var import_react99 = require("react");
17379
+ var import_react100 = require("react");
17321
17380
  var import_jsx_runtime146 = require("react/jsx-runtime");
17322
17381
  var GROUPS = ["shooting", "passing", "possession", "defending"];
17323
17382
  function finite4(v) {
@@ -17363,7 +17422,7 @@ function unrankedLine(ui, reason) {
17363
17422
  }
17364
17423
  }
17365
17424
  function PerformanceBars({ performance, competitionName, strings }) {
17366
- const [mode, setMode] = (0, import_react99.useState)("total");
17425
+ const [mode, setMode] = (0, import_react100.useState)("total");
17367
17426
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
17368
17427
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
17369
17428
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -17535,11 +17594,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
17535
17594
  }
17536
17595
 
17537
17596
  // src/components/PresetTools.tsx
17538
- var import_react100 = require("react");
17597
+ var import_react101 = require("react");
17539
17598
  var import_jsx_runtime148 = require("react/jsx-runtime");
17540
17599
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17541
17600
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
17542
- const titleId = (0, import_react100.useId)();
17601
+ const titleId = (0, import_react101.useId)();
17543
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: [
17544
17603
  /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
17545
17604
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
@@ -17589,9 +17648,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
17589
17648
  const totalOptions = comboTotals(grid);
17590
17649
  const totals = totalOptions.map((o) => o.value);
17591
17650
  const legChoices = comboLegChoices(grid);
17592
- const [total, setTotal] = (0, import_react100.useState)(() => nearest(totals, initialTotal));
17593
- const [legs, setLegs] = (0, import_react100.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17594
- 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)("");
17595
17654
  const cell2 = findCombo(grid, total, legs);
17596
17655
  const minLegs = legChoices[0] ?? legs;
17597
17656
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -17661,8 +17720,8 @@ function SettingsSheet({ ui, onClose }) {
17661
17720
  var import_jsx_runtime150 = require("react/jsx-runtime");
17662
17721
  var FULLSCREEN_QUERY = "(max-width: 639px)";
17663
17722
  function useIsModal() {
17664
- const [modal, setModal] = (0, import_react101.useState)(false);
17665
- (0, import_react101.useEffect)(() => {
17723
+ const [modal, setModal] = (0, import_react102.useState)(false);
17724
+ (0, import_react102.useEffect)(() => {
17666
17725
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
17667
17726
  const mql = window.matchMedia(FULLSCREEN_QUERY);
17668
17727
  const sync = () => setModal(mql.matches);
@@ -17676,12 +17735,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
17676
17735
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
17677
17736
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
17678
17737
  const { state, close, stop, send, reset } = controller;
17679
- const [squadView, setSquadView] = (0, import_react101.useState)("roster");
17680
- 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);
17681
17740
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
17682
17741
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
17683
- const squadLayerRef = (0, import_react101.useRef)(null);
17684
- const squadScrollRef = (0, import_react101.useRef)(null);
17742
+ const squadLayerRef = (0, import_react102.useRef)(null);
17743
+ const squadScrollRef = (0, import_react102.useRef)(null);
17685
17744
  const selectPlayer = (playerId) => {
17686
17745
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
17687
17746
  setSelectedPlayerId(playerId);
@@ -17691,7 +17750,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17691
17750
  setSelectedPlayerId(null);
17692
17751
  clearPlayerDetail?.();
17693
17752
  };
17694
- (0, import_react101.useLayoutEffect)(() => {
17753
+ (0, import_react102.useLayoutEffect)(() => {
17695
17754
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
17696
17755
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
17697
17756
  if (list) list.scrollTop = squadScrollRef.current;
@@ -17704,16 +17763,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17704
17763
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
17705
17764
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
17706
17765
  const activeTab = tabs?.activeTab;
17707
- (0, import_react101.useEffect)(() => {
17766
+ (0, import_react102.useEffect)(() => {
17708
17767
  if (activeTab === "squad" || selectedPlayerId === null) return;
17709
17768
  setSelectedPlayerId(null);
17710
17769
  clearPlayerDetail?.();
17711
17770
  }, [activeTab, selectedPlayerId, clearPlayerDetail]);
17712
- (0, import_react101.useEffect)(() => {
17771
+ (0, import_react102.useEffect)(() => {
17713
17772
  if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
17714
17773
  }, [activeTab, favouritesEnabled, setMonitorTab]);
17715
17774
  const storedTab = tabState?.activeTab;
17716
- (0, import_react101.useEffect)(() => {
17775
+ (0, import_react102.useEffect)(() => {
17717
17776
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
17718
17777
  if (unreachable) setMonitorTab?.("chat");
17719
17778
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -17722,11 +17781,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17722
17781
  const closeTab = tabs?.activeTab ?? "chat";
17723
17782
  const lastMessage = state.messages[state.messages.length - 1];
17724
17783
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
17725
- const closeWith = (0, import_react101.useCallback)((method) => {
17784
+ const closeWith = (0, import_react102.useCallback)((method) => {
17726
17785
  track({ name: "widget_close", method, tab: closeTab, answering });
17727
17786
  close();
17728
17787
  }, [track, closeTab, answering, close]);
17729
- (0, import_react101.useEffect)(() => {
17788
+ (0, import_react102.useEffect)(() => {
17730
17789
  const onKey = (e) => {
17731
17790
  if (e.key === "Escape") closeWith("escape");
17732
17791
  };
@@ -17742,64 +17801,64 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
17742
17801
  tabs?.setActiveTab("chat");
17743
17802
  send(text2, { grounding, source });
17744
17803
  };
17745
- (0, import_react101.useEffect)(() => {
17804
+ (0, import_react102.useEffect)(() => {
17746
17805
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
17747
17806
  }, [monitor, state.isStreaming, state.messages.length]);
17748
17807
  const onChatTab = !tabs || tabs.activeTab === "chat";
17749
- const inputRef = (0, import_react101.useRef)(null);
17750
- const limitRef = (0, import_react101.useRef)(null);
17751
- const typedSendRef = (0, import_react101.useRef)(false);
17752
- const focusAfterCloseRef = (0, import_react101.useRef)(null);
17753
- const [tool, setTool] = (0, import_react101.useState)(null);
17754
- 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);
17755
17814
  const settings = useOddsSettings();
17756
- const [settingsOpen, setSettingsOpen] = (0, import_react101.useState)(false);
17815
+ const [settingsOpen, setSettingsOpen] = (0, import_react102.useState)(false);
17757
17816
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
17758
- const openSettings = (0, import_react101.useCallback)(() => {
17817
+ const openSettings = (0, import_react102.useCallback)(() => {
17759
17818
  setTool(null);
17760
17819
  setSettingsOpen(true);
17761
17820
  }, []);
17762
- const closeSettings = (0, import_react101.useCallback)(() => {
17821
+ const closeSettings = (0, import_react102.useCallback)(() => {
17763
17822
  setSettingsOpen(false);
17764
17823
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
17765
17824
  }, []);
17766
17825
  const paused = isPaused(state.limit);
17767
- (0, import_react101.useEffect)(() => {
17826
+ (0, import_react102.useEffect)(() => {
17768
17827
  if (paused) setTool(null);
17769
17828
  }, [paused]);
17770
- (0, import_react101.useEffect)(() => {
17829
+ (0, import_react102.useEffect)(() => {
17771
17830
  if (!paused) return;
17772
17831
  if (typedSendRef.current) limitRef.current?.focus();
17773
17832
  typedSendRef.current = false;
17774
17833
  }, [paused]);
17775
- const openTool = (0, import_react101.useCallback)((next) => {
17834
+ const openTool = (0, import_react102.useCallback)((next) => {
17776
17835
  setTool(next);
17777
17836
  }, []);
17778
- const toolsValue = (0, import_react101.useMemo)(
17837
+ const toolsValue = (0, import_react102.useMemo)(
17779
17838
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
17780
17839
  [presetGrid, paused, openTool, ui.presets.changeCombo]
17781
17840
  );
17782
- const closeTool = (0, import_react101.useCallback)(() => {
17841
+ const closeTool = (0, import_react102.useCallback)(() => {
17783
17842
  focusAfterCloseRef.current = "composer";
17784
17843
  setTool(null);
17785
17844
  }, []);
17786
- const sendAsk = (0, import_react101.useCallback)((ask) => {
17845
+ const sendAsk = (0, import_react102.useCallback)((ask) => {
17787
17846
  focusAfterCloseRef.current = "composer";
17788
17847
  setTool(null);
17789
17848
  tabs?.setActiveTab("chat");
17790
17849
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
17791
17850
  }, [tabs, send]);
17792
- const formatKickoff = (0, import_react101.useCallback)((kickoffUtc) => {
17851
+ const formatKickoff = (0, import_react102.useCallback)((kickoffUtc) => {
17793
17852
  const k = ui.bettingKickoff(kickoffUtc);
17794
17853
  return `${k.dayLabel} ${k.time}`;
17795
17854
  }, [ui]);
17796
- (0, import_react101.useEffect)(() => {
17855
+ (0, import_react102.useEffect)(() => {
17797
17856
  if (tool) return;
17798
17857
  const target = focusAfterCloseRef.current;
17799
17858
  focusAfterCloseRef.current = null;
17800
17859
  if (target === "composer") inputRef.current?.focus();
17801
17860
  }, [tool]);
17802
- (0, import_react101.useEffect)(() => {
17861
+ (0, import_react102.useEffect)(() => {
17803
17862
  if (!tool || onChatTab && presetGrid) return;
17804
17863
  focusAfterCloseRef.current = "composer";
17805
17864
  setTool(null);
@@ -20751,12 +20810,12 @@ function injectStyles(root) {
20751
20810
  function StatsWidget(props) {
20752
20811
  const injectedClient = "client" in props ? props.client : void 0;
20753
20812
  const cfg = props.config;
20754
- const built = (0, import_react102.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
20755
- const trackingRef = (0, import_react102.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
20756
- const track = (0, import_react102.useMemo)(() => createTracker(() => trackingRef.current), []);
20757
- 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);
20758
20817
  eventTextRef.current = cfg?.eventText === true;
20759
- const logger = (0, import_react102.useMemo)(() => {
20818
+ const logger = (0, import_react103.useMemo)(() => {
20760
20819
  if (!built) return null;
20761
20820
  const raw = built.client.createEventLogger({
20762
20821
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -20766,34 +20825,34 @@ function StatsWidget(props) {
20766
20825
  }, [built?.client, track]);
20767
20826
  const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
20768
20827
  const stringsPending = widgetStrings.strings === void 0;
20769
- const ui = (0, import_react102.useMemo)(
20828
+ const ui = (0, import_react103.useMemo)(
20770
20829
  () => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
20771
20830
  [props.config, widgetStrings.strings]
20772
20831
  );
20773
20832
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
20774
- const rootRef = (0, import_react102.useRef)(null);
20775
- const introDoneRef = (0, import_react102.useRef)(false);
20776
- 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)(() => {
20777
20836
  introDoneRef.current = true;
20778
20837
  }, []);
20779
20838
  const language = injectedClient ? void 0 : hostTag(cfg);
20780
20839
  const threadLanguage = familyOf(language);
20781
20840
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
20782
- const sportScope = (0, import_react102.useMemo)(
20841
+ const sportScope = (0, import_react103.useMemo)(
20783
20842
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
20784
20843
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
20785
20844
  );
20786
- const chatTracking = (0, import_react102.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
20845
+ const chatTracking = (0, import_react103.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
20787
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);
20788
20847
  const panelOpen = controller.state.isOpen && !stringsPending;
20789
- const liveCardWatches = (0, import_react102.useMemo)(() => {
20790
- const seen = /* @__PURE__ */ new Set();
20848
+ const liveCardWatches = (0, import_react103.useMemo)(() => {
20849
+ const seen2 = /* @__PURE__ */ new Set();
20791
20850
  const out = [];
20792
20851
  for (const msg of controller.state.messages) {
20793
20852
  if (msg.role !== "assistant") continue;
20794
20853
  for (const vm of msg.marketOdds) {
20795
- if (vm.live == null || seen.has(vm.matchId)) continue;
20796
- seen.add(vm.matchId);
20854
+ if (vm.live == null || seen2.has(vm.matchId)) continue;
20855
+ seen2.add(vm.matchId);
20797
20856
  out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
20798
20857
  }
20799
20858
  }
@@ -20812,19 +20871,19 @@ function StatsWidget(props) {
20812
20871
  });
20813
20872
  const operatorUserId = cfg?.userContext?.operatorUserId;
20814
20873
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
20815
- const getSchedule = (0, import_react102.useCallback)(
20874
+ const getSchedule = (0, import_react103.useCallback)(
20816
20875
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
20817
20876
  [built, operatorUserId, anonymousUserId]
20818
20877
  );
20819
- const getStates = (0, import_react102.useCallback)(
20878
+ const getStates = (0, import_react103.useCallback)(
20820
20879
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
20821
20880
  [built, requestTag]
20822
20881
  );
20823
- const getTennisPrices = (0, import_react102.useCallback)(
20882
+ const getTennisPrices = (0, import_react103.useCallback)(
20824
20883
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
20825
20884
  [built, requestTag]
20826
20885
  );
20827
- const pinnedMatchIds = (0, import_react102.useMemo)(
20886
+ const pinnedMatchIds = (0, import_react103.useMemo)(
20828
20887
  () => footballMatchPinIds(monitor.pins),
20829
20888
  [monitor.pins]
20830
20889
  );
@@ -20838,13 +20897,13 @@ function StatsWidget(props) {
20838
20897
  pinnedMatchIds,
20839
20898
  timeZone: ui.timeZone
20840
20899
  });
20841
- const offeredSports = (0, import_react102.useMemo)(() => {
20842
- const seen = new Set(discovery.matchDays.map((d) => d.sport));
20843
- for (const g of discovery.groups) seen.add(g.sport ?? "football");
20844
- 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];
20845
20904
  }, [discovery.matchDays, discovery.groups]);
20846
20905
  const scheduleSport = useScheduleSport(offeredSports);
20847
- const [liveLeague, setLiveLeague] = (0, import_react102.useState)(null);
20906
+ const [liveLeague, setLiveLeague] = (0, import_react103.useState)(null);
20848
20907
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
20849
20908
  const matchesLoaded = useMatchesDay({
20850
20909
  discovery,
@@ -20854,8 +20913,8 @@ function StatsWidget(props) {
20854
20913
  enabled: panelOpen && monitor.activeTab === "matches",
20855
20914
  timeZone: ui.timeZone
20856
20915
  });
20857
- const prevLiveSnapshotRef = (0, import_react102.useRef)(monitor.snapshot);
20858
- (0, import_react102.useEffect)(() => {
20916
+ const prevLiveSnapshotRef = (0, import_react103.useRef)(monitor.snapshot);
20917
+ (0, import_react103.useEffect)(() => {
20859
20918
  const snap = monitor.snapshot;
20860
20919
  if (!snap || snap === prevLiveSnapshotRef.current) return;
20861
20920
  prevLiveSnapshotRef.current = snap;
@@ -20895,14 +20954,14 @@ function StatsWidget(props) {
20895
20954
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20896
20955
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
20897
20956
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
20898
- const [favSportPick, setFavSportPick] = (0, import_react102.useState)(null);
20899
- const latestGreeting = (0, import_react102.useMemo)(() => {
20957
+ const [favSportPick, setFavSportPick] = (0, import_react103.useState)(null);
20958
+ const latestGreeting = (0, import_react103.useMemo)(() => {
20900
20959
  for (const m of [...controller.state.messages].reverse()) {
20901
20960
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
20902
20961
  }
20903
20962
  return null;
20904
20963
  }, [controller.state.messages]);
20905
- const favSportOptions = (0, import_react102.useMemo)(
20964
+ const favSportOptions = (0, import_react103.useMemo)(
20906
20965
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
20907
20966
  [latestGreeting]
20908
20967
  );
@@ -20911,20 +20970,20 @@ function StatsWidget(props) {
20911
20970
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
20912
20971
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
20913
20972
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
20914
- const [builderSportPick, setBuilderSportPick] = (0, import_react102.useState)(null);
20915
- const builderGreeting = (0, import_react102.useMemo)(
20973
+ const [builderSportPick, setBuilderSportPick] = (0, import_react103.useState)(null);
20974
+ const builderGreeting = (0, import_react103.useMemo)(
20916
20975
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
20917
20976
  [controller.state.messages]
20918
20977
  );
20919
- const [coolOff, setCoolOff] = (0, import_react102.useState)(null);
20920
- const onBuilderCoolOff = (0, import_react102.useCallback)((sport) => {
20978
+ const [coolOff, setCoolOff] = (0, import_react103.useState)(null);
20979
+ const onBuilderCoolOff = (0, import_react103.useCallback)((sport) => {
20921
20980
  if (!builderGreeting) return;
20922
20981
  setCoolOff((prev) => {
20923
20982
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
20924
20983
  return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
20925
20984
  });
20926
20985
  }, [builderGreeting]);
20927
- const builderOptions = (0, import_react102.useMemo)(() => {
20986
+ const builderOptions = (0, import_react103.useMemo)(() => {
20928
20987
  const greeting = builderGreeting;
20929
20988
  if (!greeting) return [];
20930
20989
  const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
@@ -20937,7 +20996,7 @@ function StatsWidget(props) {
20937
20996
  return options.filter((o) => !cooled.includes(o.sport));
20938
20997
  }, [builderGreeting, coolOff, ui]);
20939
20998
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
20940
- const [panelEverOpened, setPanelEverOpened] = (0, import_react102.useState)(panelOpen);
20999
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react103.useState)(panelOpen);
20941
21000
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
20942
21001
  const favourites = useFavourites({
20943
21002
  conversation: built?.conversation ?? null,
@@ -20949,14 +21008,14 @@ function StatsWidget(props) {
20949
21008
  onChanged: discovery.refreshSchedule
20950
21009
  });
20951
21010
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
20952
- const getPricePresets = (0, import_react102.useCallback)(
21011
+ const getPricePresets = (0, import_react103.useCallback)(
20953
21012
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
20954
21013
  [built]
20955
21014
  );
20956
21015
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
20957
21016
  const markLiveActivity = monitor.markLiveActivity;
20958
- const prevLiveCountRef = (0, import_react102.useRef)(0);
20959
- (0, import_react102.useEffect)(() => {
21017
+ const prevLiveCountRef = (0, import_react103.useRef)(0);
21018
+ (0, import_react103.useEffect)(() => {
20960
21019
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
20961
21020
  prevLiveCountRef.current = discovery.liveCount;
20962
21021
  if (rose) markLiveActivity();
@@ -20970,7 +21029,7 @@ function StatsWidget(props) {
20970
21029
  closePanel: controller.close
20971
21030
  });
20972
21031
  const markAdded = hostEvents.markAdded;
20973
- const slip = (0, import_react102.useMemo)(
21032
+ const slip = (0, import_react103.useMemo)(
20974
21033
  () => {
20975
21034
  const handler = props.config?.onAddToSlip;
20976
21035
  return {
@@ -20990,7 +21049,7 @@ function StatsWidget(props) {
20990
21049
  },
20991
21050
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
20992
21051
  );
20993
- const onDashboardTap = (0, import_react102.useMemo)(
21052
+ const onDashboardTap = (0, import_react103.useMemo)(
20994
21053
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
20995
21054
  [built, logger]
20996
21055
  );
@@ -21006,10 +21065,10 @@ function StatsWidget(props) {
21006
21065
  log: logger
21007
21066
  })
21008
21067
  }));
21009
- const onControlRef = (0, import_react102.useRef)(props.onControl);
21068
+ const onControlRef = (0, import_react103.useRef)(props.onControl);
21010
21069
  onControlRef.current = props.onControl;
21011
21070
  const { open: openPanel, close: closePanel } = controller;
21012
- (0, import_react102.useEffect)(() => {
21071
+ (0, import_react103.useEffect)(() => {
21013
21072
  onControlRef.current?.({ open: openPanel, close: closePanel });
21014
21073
  return () => onControlRef.current?.(null);
21015
21074
  }, [openPanel, closePanel]);
@@ -21026,11 +21085,11 @@ function StatsWidget(props) {
21026
21085
  page: cfg?.page
21027
21086
  }
21028
21087
  };
21029
- (0, import_react102.useEffect)(() => {
21088
+ (0, import_react103.useEffect)(() => {
21030
21089
  if (!logger) return;
21031
21090
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
21032
21091
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
21033
- (0, import_react102.useEffect)(() => {
21092
+ (0, import_react103.useEffect)(() => {
21034
21093
  if (!logger) return;
21035
21094
  logger.resume();
21036
21095
  const onHide = () => {
@@ -21048,15 +21107,15 @@ function StatsWidget(props) {
21048
21107
  logger.dispose();
21049
21108
  };
21050
21109
  }, [logger]);
21051
- (0, import_react102.useEffect)(() => {
21110
+ (0, import_react103.useEffect)(() => {
21052
21111
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
21053
21112
  const node = rootRef.current?.getRootNode();
21054
21113
  if (node) injectStyles(node);
21055
21114
  }, [built, ui.injectStyles, widgetStrings.state]);
21056
21115
  const holds = useSessionHolds();
21057
21116
  const builderConversation = built?.conversation ?? null;
21058
- const builderMemory = (0, import_react102.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
21059
- 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)(() => ({
21060
21119
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
21061
21120
  conversation: built?.conversation ?? null,
21062
21121
  openFavourites: () => monitor.setActiveTab("favourites"),