@sensiblestats/widget-react 0.144.0 → 0.145.1

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
@@ -38,8 +38,8 @@ __export(index_exports, {
38
38
  module.exports = __toCommonJS(index_exports);
39
39
 
40
40
  // src/StatsWidget.tsx
41
- var import_react113 = require("react");
42
- var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
41
+ var import_react114 = require("react");
42
+ var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
43
43
 
44
44
  // src/strings/tag.ts
45
45
  function familyOf(tag2) {
@@ -260,6 +260,10 @@ var BUNDLED_EN_GB = {
260
260
  "widget.v8BuilderCustomRange": "Enter a total above 1.01 and up to 1000.",
261
261
  "widget.v8BuilderCustomUnreadable": "Type the total like {example}.",
262
262
  "widget.v8BuilderCustomEdit": "Your total {total}, edit",
263
+ "widget.v8BuilderAnother": "Another combo",
264
+ "widget.v8BuilderSwap": "Swap {leg}",
265
+ "widget.v8BuilderSwapLeg": "{pair}, {market}",
266
+ "widget.v8BuilderSwapNone": "No other game fits here.",
263
267
  "widget.v8BuilderLoading": "Loading\u2026",
264
268
  "widget.v8BuilderError": "Couldn't load this right now.",
265
269
  "widget.v8BuilderRetry": "Try again",
@@ -1156,6 +1160,9 @@ var ROW_LEAVES = {
1156
1160
  v8BuilderCustomPlaceholder: (c) => (example) => c.t("widget.v8BuilderCustomPlaceholder", { example }),
1157
1161
  v8BuilderCustomUnreadable: (c) => (example) => c.t("widget.v8BuilderCustomUnreadable", { example }),
1158
1162
  v8BuilderCustomEdit: (c) => (total) => c.t("widget.v8BuilderCustomEdit", { total }),
1163
+ v8Pair: (c) => (home, away) => c.t("widget.addAllPartial.pair", { home, away }),
1164
+ v8BuilderSwapLeg: (c) => (pair, market) => c.t("widget.v8BuilderSwapLeg", { pair, market }),
1165
+ v8BuilderSwap: (c) => (leg) => c.t("widget.v8BuilderSwap", { leg }),
1159
1166
  v8Follow: (c) => (name) => c.t("widget.v8Follow", { name }),
1160
1167
  v8PricesAsOf: (c) => (time) => c.t("widget.v8PricesAsOf", { time }),
1161
1168
  v8InjuryAsOf: (c) => (time) => c.t("widget.v8InjuryAsOf", { time }),
@@ -1371,7 +1378,7 @@ function parseCustomTotal(text2, format2) {
1371
1378
  }
1372
1379
 
1373
1380
  // src/version.generated.ts
1374
- var WIDGET_REACT_VERSION = "0.144.0";
1381
+ var WIDGET_REACT_VERSION = "0.145.1";
1375
1382
 
1376
1383
  // src/config.ts
1377
1384
  function hostTag(cfg) {
@@ -1687,6 +1694,11 @@ function normalizeUi(cfg, loaded) {
1687
1694
  v8BuilderCustomRange: strings.v8BuilderCustomRange,
1688
1695
  v8BuilderCustomUnreadable: strings.v8BuilderCustomUnreadable,
1689
1696
  v8BuilderCustomEdit: strings.v8BuilderCustomEdit,
1697
+ v8BuilderAnother: strings.v8BuilderAnother,
1698
+ v8Pair: strings.v8Pair,
1699
+ v8BuilderSwapLeg: strings.v8BuilderSwapLeg,
1700
+ v8BuilderSwap: strings.v8BuilderSwap,
1701
+ v8BuilderSwapNone: strings.v8BuilderSwapNone,
1690
1702
  v8BuilderLoading: strings.v8BuilderLoading,
1691
1703
  v8BuilderError: strings.v8BuilderError,
1692
1704
  v8BuilderRetry: strings.v8BuilderRetry,
@@ -5947,7 +5959,13 @@ var import_react24 = require("react");
5947
5959
  // src/builderMemory.ts
5948
5960
  var GRID_TTL_MS = 5 * 6e4;
5949
5961
  var hasReadableQuote = (grid) => grid.legs.some((leg) => !Number.isNaN(Date.parse(leg.quotedAtUtc)));
5950
- var gridKey = (locale, req) => `${locale ?? ""}|${JSON.stringify(req)}`;
5962
+ var sortedIds = (ids) => ids && ids.length > 0 ? [...ids].sort((a, b) => a - b) : void 0;
5963
+ var gridKey = (locale, req) => {
5964
+ const { variant, keep, swapped, ...rest } = req;
5965
+ const keepIds = sortedIds(keep);
5966
+ const swappedIds = sortedIds(swapped);
5967
+ return `${locale ?? ""}|${JSON.stringify({ ...rest, ...variant ? { variant } : {}, ...keepIds ? { keep: keepIds } : {}, ...swappedIds ? { swapped: swappedIds } : {} })}`;
5968
+ };
5951
5969
  function createBuilderMemory(now = Date.now) {
5952
5970
  const views = /* @__PURE__ */ new Map();
5953
5971
  const grids = /* @__PURE__ */ new Map();
@@ -7978,7 +7996,7 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
7978
7996
  }
7979
7997
 
7980
7998
  // src/components/ChatPanel.tsx
7981
- var import_react112 = require("react");
7999
+ var import_react113 = require("react");
7982
8000
 
7983
8001
  // src/components/ChatHeader.tsx
7984
8002
  var import_react53 = require("react");
@@ -8096,10 +8114,10 @@ function ChatHeader({
8096
8114
  }
8097
8115
 
8098
8116
  // src/components/MessageList.tsx
8099
- var import_react67 = require("react");
8117
+ var import_react68 = require("react");
8100
8118
 
8101
8119
  // src/components/ChatMessage.tsx
8102
- var import_react66 = require("react");
8120
+ var import_react67 = require("react");
8103
8121
 
8104
8122
  // src/components/Markdown.tsx
8105
8123
  var import_react_markdown = __toESM(require("react-markdown"), 1);
@@ -8335,6 +8353,9 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
8335
8353
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "ss-w-binsights", children: insights.map((it) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(InsightCard, { it, ui, slip, monitor }, it.id)) });
8336
8354
  }
8337
8355
 
8356
+ // src/components/ComboCardList.tsx
8357
+ var import_react57 = require("react");
8358
+
8338
8359
  // src/components/AddAllToSlipButton.tsx
8339
8360
  var import_react55 = require("react");
8340
8361
  var import_jsx_runtime36 = require("react/jsx-runtime");
@@ -8427,7 +8448,7 @@ function usePresetTools() {
8427
8448
 
8428
8449
  // src/components/ComboCardList.tsx
8429
8450
  var import_jsx_runtime37 = require("react/jsx-runtime");
8430
- function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed }) {
8451
+ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, swap }) {
8431
8452
  const { oddsFormat } = useOddsSettings();
8432
8453
  const odds = formatOdds(leg.priceForms, oddsFormat);
8433
8454
  const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
@@ -8436,6 +8457,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
8436
8457
  const showPin = !!monitor && leg.pinEnabled;
8437
8458
  const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
8438
8459
  const line = leg.statText ?? factText;
8460
+ const noteId = (0, import_react57.useId)();
8439
8461
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("li", { className: "ss-w-combo-leg", children: [
8440
8462
  leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
8441
8463
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
@@ -8469,8 +8491,15 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
8469
8491
  ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${odds}`,
8470
8492
  hold
8471
8493
  }
8472
- )
8494
+ ),
8495
+ swap ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("button", { type: "button", className: "ss-w-combo-leg-swap", "aria-label": swap.label, "aria-describedby": noteId, "data-focus": swap.focusKey, disabled: swap.disabled, onClick: swap.onSwap, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: [
8496
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M17 3l4 4-4 4" }),
8497
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M3 7h18" }),
8498
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M7 21l-4-4 4-4" }),
8499
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M21 17H3" })
8500
+ ] }) }) : null
8473
8501
  ] }),
8502
+ swap ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { id: noteId, className: "ss-w-combo-leg-swapnone", "data-kind": "swap-none", role: "status", children: swap.note ?? "" }) : null,
8474
8503
  line ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "ss-w-combo-leg-stat", children: line }) : null
8475
8504
  ] });
8476
8505
  }
@@ -9050,7 +9079,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
9050
9079
  }
9051
9080
 
9052
9081
  // src/components/NflInsightList.tsx
9053
- var import_react57 = require("react");
9082
+ var import_react58 = require("react");
9054
9083
 
9055
9084
  // src/strings/types.ts
9056
9085
  var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
@@ -9067,7 +9096,7 @@ function teamImage(vm, abbr) {
9067
9096
  return void 0;
9068
9097
  }
9069
9098
  function Badge({ abbr, url }) {
9070
- const [failed, setFailed] = (0, import_react57.useState)(false);
9099
+ const [failed, setFailed] = (0, import_react58.useState)(false);
9071
9100
  if (url && !failed) {
9072
9101
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
9073
9102
  }
@@ -9678,7 +9707,7 @@ function TennisInsightList({ insights, ui }) {
9678
9707
  }
9679
9708
 
9680
9709
  // src/components/CompactOddsList.tsx
9681
- var import_react58 = require("react");
9710
+ var import_react59 = require("react");
9682
9711
  var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
9683
9712
 
9684
9713
  // src/compactList.ts
@@ -9800,11 +9829,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
9800
9829
  ] });
9801
9830
  }
9802
9831
  function CompactOddsList({ list, ui, slip, monitor }) {
9803
- const [shown2, setShown] = (0, import_react58.useState)(COMPACT_PAGE);
9832
+ const [shown2, setShown] = (0, import_react59.useState)(COMPACT_PAGE);
9804
9833
  const hidden = list.rowCount - shown2;
9805
- const [focusIndex, setFocusIndex] = (0, import_react58.useState)(null);
9806
- const focusRef = (0, import_react58.useRef)(null);
9807
- (0, import_react58.useEffect)(() => {
9834
+ const [focusIndex, setFocusIndex] = (0, import_react59.useState)(null);
9835
+ const focusRef = (0, import_react59.useRef)(null);
9836
+ (0, import_react59.useEffect)(() => {
9808
9837
  if (focusIndex !== null) focusRef.current?.focus();
9809
9838
  }, [focusIndex]);
9810
9839
  let left = shown2;
@@ -10039,7 +10068,7 @@ function FixtureCard({ card, ui }) {
10039
10068
  }
10040
10069
 
10041
10070
  // src/components/dashboard/CountdownCard.tsx
10042
- var import_react59 = require("react");
10071
+ var import_react60 = require("react");
10043
10072
  var import_jsx_runtime45 = require("react/jsx-runtime");
10044
10073
  var DAY_MS3 = 864e5;
10045
10074
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
@@ -10058,12 +10087,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
10058
10087
  function CountdownCard({ card, ui }) {
10059
10088
  const { data } = card;
10060
10089
  const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
10061
- const [nowMs, setNowMs] = (0, import_react59.useState)(() => Date.now());
10062
- const [reduced] = (0, import_react59.useState)(
10090
+ const [nowMs, setNowMs] = (0, import_react60.useState)(() => Date.now());
10091
+ const [reduced] = (0, import_react60.useState)(
10063
10092
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
10064
10093
  );
10065
10094
  const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
10066
- (0, import_react59.useEffect)(() => {
10095
+ (0, import_react60.useEffect)(() => {
10067
10096
  if (reduced) return;
10068
10097
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
10069
10098
  return () => window.clearInterval(id);
@@ -10071,7 +10100,7 @@ function CountdownCard({ card, ui }) {
10071
10100
  const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
10072
10101
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
10073
10102
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
10074
- segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react59.Fragment, { children: [
10103
+ segments ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react60.Fragment, { children: [
10075
10104
  i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
10076
10105
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
10077
10106
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
@@ -10082,7 +10111,7 @@ function CountdownCard({ card, ui }) {
10082
10111
  }
10083
10112
 
10084
10113
  // src/components/dashboard/InjuriesCard.tsx
10085
- var import_react60 = require("react");
10114
+ var import_react61 = require("react");
10086
10115
  var import_jsx_runtime46 = require("react/jsx-runtime");
10087
10116
  var SHOWN = 3;
10088
10117
  function ColHead({ name, crestUrl }) {
@@ -10105,7 +10134,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
10105
10134
  }
10106
10135
  function InjuriesCard({ card, ui }) {
10107
10136
  const { data } = card;
10108
- const [expanded, setExpanded] = (0, import_react60.useState)(false);
10137
+ const [expanded, setExpanded] = (0, import_react61.useState)(false);
10109
10138
  const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
10110
10139
  const limit = expanded ? void 0 : SHOWN;
10111
10140
  const { showMore, showLess } = ui;
@@ -10210,7 +10239,7 @@ function LinksCard({ card }) {
10210
10239
  }
10211
10240
 
10212
10241
  // src/components/dashboard/PostMatchResultCard.tsx
10213
- var import_react61 = require("react");
10242
+ var import_react62 = require("react");
10214
10243
  var import_jsx_runtime52 = require("react/jsx-runtime");
10215
10244
  function initials3(name) {
10216
10245
  return name.trim().slice(0, 3).toUpperCase();
@@ -10220,7 +10249,7 @@ function PostMatchCrest({
10220
10249
  name,
10221
10250
  side
10222
10251
  }) {
10223
- const [failed, setFailed] = (0, import_react61.useState)(false);
10252
+ const [failed, setFailed] = (0, import_react62.useState)(false);
10224
10253
  const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
10225
10254
  if (url && !failed) {
10226
10255
  return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -10419,10 +10448,10 @@ function RestingFormCard({ card }) {
10419
10448
  }
10420
10449
 
10421
10450
  // src/components/dashboard/LiveScoreCard.tsx
10422
- var import_react63 = require("react");
10451
+ var import_react64 = require("react");
10423
10452
 
10424
10453
  // src/useLiveClock.ts
10425
- var import_react62 = require("react");
10454
+ var import_react63 = require("react");
10426
10455
  var TICK_MS = 6e4;
10427
10456
  var MAX_LIVE_TICK_MINUTES = 15;
10428
10457
  function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
@@ -10431,10 +10460,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
10431
10460
  return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
10432
10461
  }
10433
10462
  function useLiveClock(minute, clockRunning, receivedAtMs) {
10434
- const [displayMinute, setDisplayMinute] = (0, import_react62.useState)(
10463
+ const [displayMinute, setDisplayMinute] = (0, import_react63.useState)(
10435
10464
  () => computeDisplayMinute(minute, clockRunning, receivedAtMs)
10436
10465
  );
10437
- (0, import_react62.useEffect)(() => {
10466
+ (0, import_react63.useEffect)(() => {
10438
10467
  setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
10439
10468
  if (!clockRunning) return;
10440
10469
  const id = window.setInterval(() => {
@@ -10451,7 +10480,7 @@ function initials5(name) {
10451
10480
  return name.trim().slice(0, 3).toUpperCase();
10452
10481
  }
10453
10482
  function LiveCrest({ url, name, side }) {
10454
- const [failed, setFailed] = (0, import_react63.useState)(false);
10483
+ const [failed, setFailed] = (0, import_react64.useState)(false);
10455
10484
  const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
10456
10485
  if (url && !failed) {
10457
10486
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -10473,7 +10502,7 @@ function LiveScoreCard({
10473
10502
  }) {
10474
10503
  const { data } = card;
10475
10504
  const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
10476
- const seedRef = (0, import_react63.useRef)(null);
10505
+ const seedRef = (0, import_react64.useRef)(null);
10477
10506
  if (!seedRef.current || seedRef.current.key !== seedKey) {
10478
10507
  seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
10479
10508
  }
@@ -10519,7 +10548,7 @@ function LiveScoreCard({
10519
10548
  }
10520
10549
 
10521
10550
  // src/components/dashboard/LiveTimelineCard.tsx
10522
- var import_react64 = require("react");
10551
+ var import_react65 = require("react");
10523
10552
  var import_jsx_runtime62 = require("react/jsx-runtime");
10524
10553
  var SHOWN2 = 3;
10525
10554
  function EventIcon({ type }) {
@@ -10561,12 +10590,12 @@ function EventRow({ e }) {
10561
10590
  ] });
10562
10591
  }
10563
10592
  function LiveTimelineCard({ card, ui }) {
10564
- const [expanded, setExpanded] = (0, import_react64.useState)(false);
10593
+ const [expanded, setExpanded] = (0, import_react65.useState)(false);
10565
10594
  const events = card.data.events;
10566
10595
  if (!events || events.length === 0) return null;
10567
- const sorted = [...events].sort((a, b) => b.minute - a.minute);
10568
- const rest = sorted.length - SHOWN2;
10569
- const shown2 = expanded ? sorted : sorted.slice(0, SHOWN2);
10596
+ const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
10597
+ const rest = sorted2.length - SHOWN2;
10598
+ const shown2 = expanded ? sorted2 : sorted2.slice(0, SHOWN2);
10570
10599
  const { showMore, showLess } = ui;
10571
10600
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ss-w-fandash-card ss-w-fandash-live-timeline", children: [
10572
10601
  card.title ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
@@ -10585,7 +10614,7 @@ function LiveTimelineCard({ card, ui }) {
10585
10614
  }
10586
10615
 
10587
10616
  // src/components/dashboard/MomentumWave.tsx
10588
- var import_react65 = require("react");
10617
+ var import_react66 = require("react");
10589
10618
  var import_jsx_runtime63 = require("react/jsx-runtime");
10590
10619
  var WIDTH = 270;
10591
10620
  var HEIGHT = 56;
@@ -10610,7 +10639,7 @@ function MomentumWave({
10610
10639
  }) {
10611
10640
  if (points.length === 0) return null;
10612
10641
  const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
10613
- const clipId = (0, import_react65.useId)();
10642
+ const clipId = (0, import_react66.useId)();
10614
10643
  const topClipId = `${clipId}-top`;
10615
10644
  const bottomClipId = `${clipId}-bottom`;
10616
10645
  const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
@@ -10760,7 +10789,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
10760
10789
  // src/components/ChatMessage.tsx
10761
10790
  var import_jsx_runtime66 = require("react/jsx-runtime");
10762
10791
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
10763
- const [sport, setSport] = (0, import_react66.useState)(null);
10792
+ const [sport, setSport] = (0, import_react67.useState)(null);
10764
10793
  if (message.role === "user") {
10765
10794
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
10766
10795
  }
@@ -10814,11 +10843,11 @@ function turnAnchor(messages) {
10814
10843
  function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
10815
10844
  const { state, send } = controller;
10816
10845
  const { oddsFormat } = useOddsSettings();
10817
- const listRef = (0, import_react67.useRef)(null);
10818
- const endRef = (0, import_react67.useRef)(null);
10819
- const pinnedRef = (0, import_react67.useRef)(true);
10820
- const anchoredTurnRef = (0, import_react67.useRef)(null);
10821
- (0, import_react67.useEffect)(() => {
10846
+ const listRef = (0, import_react68.useRef)(null);
10847
+ const endRef = (0, import_react68.useRef)(null);
10848
+ const pinnedRef = (0, import_react68.useRef)(true);
10849
+ const anchoredTurnRef = (0, import_react68.useRef)(null);
10850
+ (0, import_react68.useEffect)(() => {
10822
10851
  const anchor = turnAnchor(state.messages);
10823
10852
  const list = listRef.current;
10824
10853
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -10877,13 +10906,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
10877
10906
  }
10878
10907
 
10879
10908
  // src/components/ChatInput.tsx
10880
- var import_react68 = require("react");
10909
+ var import_react69 = require("react");
10881
10910
  var import_jsx_runtime69 = require("react/jsx-runtime");
10882
- var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
10883
- const [value, setValue] = (0, import_react68.useState)("");
10884
- const textareaRef = (0, import_react68.useRef)(null);
10885
- const stopRef = (0, import_react68.useRef)(null);
10886
- const textBoxWantsFocusRef = (0, import_react68.useRef)(false);
10911
+ var ChatInput = (0, import_react69.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
10912
+ const [value, setValue] = (0, import_react69.useState)("");
10913
+ const textareaRef = (0, import_react69.useRef)(null);
10914
+ const stopRef = (0, import_react69.useRef)(null);
10915
+ const textBoxWantsFocusRef = (0, import_react69.useRef)(false);
10887
10916
  const submit = () => {
10888
10917
  if (disabled) return;
10889
10918
  const t = value.trim();
@@ -10897,7 +10926,7 @@ var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder
10897
10926
  submit();
10898
10927
  }
10899
10928
  };
10900
- (0, import_react68.useImperativeHandle)(ref, () => ({
10929
+ (0, import_react69.useImperativeHandle)(ref, () => ({
10901
10930
  focus() {
10902
10931
  const box = textareaRef.current;
10903
10932
  if (box && !box.disabled) {
@@ -10909,7 +10938,7 @@ var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder
10909
10938
  stopRef.current?.focus();
10910
10939
  }
10911
10940
  }), []);
10912
- (0, import_react68.useEffect)(() => {
10941
+ (0, import_react69.useEffect)(() => {
10913
10942
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
10914
10943
  textBoxWantsFocusRef.current = false;
10915
10944
  const box = textareaRef.current;
@@ -10940,7 +10969,7 @@ var ChatInput = (0, import_react68.forwardRef)(function ChatInput2({ placeholder
10940
10969
  });
10941
10970
 
10942
10971
  // src/components/TabBar.tsx
10943
- var import_react69 = require("react");
10972
+ var import_react70 = require("react");
10944
10973
  var import_jsx_runtime70 = require("react/jsx-runtime");
10945
10974
  var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
10946
10975
  var FOCUS_EDGE = 24;
@@ -10963,16 +10992,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10963
10992
  ...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
10964
10993
  ];
10965
10994
  const track = useTrack();
10966
- const listRef = (0, import_react69.useRef)(null);
10995
+ const listRef = (0, import_react70.useRef)(null);
10967
10996
  const activeTab = monitor.activeTab;
10968
- (0, import_react69.useEffect)(() => {
10997
+ (0, import_react70.useEffect)(() => {
10969
10998
  const el = listRef.current?.querySelector("[data-on]");
10970
10999
  if (!el || typeof el.scrollIntoView !== "function") return;
10971
11000
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
10972
11001
  el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
10973
11002
  }, [activeTab]);
10974
11003
  const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
10975
- (0, import_react69.useLayoutEffect)(() => {
11004
+ (0, import_react70.useLayoutEffect)(() => {
10976
11005
  const strip = listRef.current;
10977
11006
  if (!strip) return;
10978
11007
  const measure = () => {
@@ -10996,7 +11025,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
10996
11025
  fonts?.removeEventListener?.("loadingdone", measure);
10997
11026
  };
10998
11027
  }, [labelSignature]);
10999
- const pointerDown = (0, import_react69.useRef)(false);
11028
+ const pointerDown = (0, import_react70.useRef)(false);
11000
11029
  const keepFocusedTabInView = (e) => {
11001
11030
  const strip = e.currentTarget;
11002
11031
  const tab = e.target;
@@ -11056,7 +11085,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11056
11085
  }
11057
11086
 
11058
11087
  // src/components/MonitorTabs.tsx
11059
- var import_react82 = require("react");
11088
+ var import_react83 = require("react");
11060
11089
 
11061
11090
  // src/components/MarketAccordion.tsx
11062
11091
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
@@ -11118,7 +11147,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
11118
11147
  }
11119
11148
 
11120
11149
  // src/components/MonitorFormH2H.tsx
11121
- var import_react70 = require("react");
11150
+ var import_react71 = require("react");
11122
11151
  var import_jsx_runtime72 = require("react/jsx-runtime");
11123
11152
  function resultClass2(result) {
11124
11153
  if (result === "W") return "ss-w-h2h-result--win";
@@ -11134,7 +11163,7 @@ function FormDots({ form, ui }) {
11134
11163
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
11135
11164
  }
11136
11165
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
11137
- const [expanded, setExpanded] = (0, import_react70.useState)(false);
11166
+ const [expanded, setExpanded] = (0, import_react71.useState)(false);
11138
11167
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
11139
11168
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
11140
11169
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, {});
@@ -11212,10 +11241,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
11212
11241
  }
11213
11242
 
11214
11243
  // src/components/CompLogo.tsx
11215
- var import_react71 = require("react");
11244
+ var import_react72 = require("react");
11216
11245
  var import_jsx_runtime73 = require("react/jsx-runtime");
11217
11246
  function CompLogo({ url }) {
11218
- const [failed, setFailed] = (0, import_react71.useState)(null);
11247
+ const [failed, setFailed] = (0, import_react72.useState)(null);
11219
11248
  if (!url || failed === url) return null;
11220
11249
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
11221
11250
  }
@@ -11373,7 +11402,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
11373
11402
  }
11374
11403
 
11375
11404
  // src/components/NbaMonitorCard.tsx
11376
- var import_react75 = require("react");
11405
+ var import_react76 = require("react");
11377
11406
 
11378
11407
  // src/sportLabel.ts
11379
11408
  var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
@@ -11383,7 +11412,7 @@ var sportLabel = (ui, sport) => {
11383
11412
  };
11384
11413
 
11385
11414
  // src/components/NbaFormSection.tsx
11386
- var import_react72 = require("react");
11415
+ var import_react73 = require("react");
11387
11416
 
11388
11417
  // src/components/NbaFormRest.tsx
11389
11418
  var import_jsx_runtime76 = require("react/jsx-runtime");
@@ -11483,8 +11512,8 @@ function Row2({ game, abbr, tonight, ui }) {
11483
11512
  ] });
11484
11513
  }
11485
11514
  function NbaFormSection({ match, monitor, ui }) {
11486
- const [open, setOpen] = (0, import_react72.useState)(false);
11487
- const [side, setSide] = (0, import_react72.useState)("away");
11515
+ const [open, setOpen] = (0, import_react73.useState)(false);
11516
+ const [side, setSide] = (0, import_react73.useState)("away");
11488
11517
  const form = useNbaForm(match, monitor);
11489
11518
  const b = match.basketball;
11490
11519
  if (!form || !b || !form.home && !form.away) return null;
@@ -11529,10 +11558,10 @@ function NbaFormSection({ match, monitor, ui }) {
11529
11558
  }
11530
11559
 
11531
11560
  // src/components/NbaPropsSection.tsx
11532
- var import_react74 = require("react");
11561
+ var import_react75 = require("react");
11533
11562
 
11534
11563
  // src/components/PropsPieces.tsx
11535
- var import_react73 = require("react");
11564
+ var import_react74 = require("react");
11536
11565
  var import_jsx_runtime78 = require("react/jsx-runtime");
11537
11566
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
11538
11567
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -11545,9 +11574,9 @@ function preKickoff(match) {
11545
11574
  return Number.isFinite(kickoff) && Date.now() < kickoff;
11546
11575
  }
11547
11576
  function usePreKickoff(match) {
11548
- const [, setTick] = (0, import_react73.useState)(0);
11577
+ const [, setTick] = (0, import_react74.useState)(0);
11549
11578
  const pre = preKickoff(match);
11550
- (0, import_react73.useEffect)(() => {
11579
+ (0, import_react74.useEffect)(() => {
11551
11580
  if (!pre || !match.kickoffUtc) return;
11552
11581
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
11553
11582
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -11561,7 +11590,7 @@ function usePropsOpen(match, monitor, descriptor) {
11561
11590
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
11562
11591
  const live = match.phase === "live";
11563
11592
  const open = pre || live;
11564
- (0, import_react73.useEffect)(() => {
11593
+ (0, import_react74.useEffect)(() => {
11565
11594
  if (!open) return;
11566
11595
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
11567
11596
  else monitor.loadPlayerProps?.(match.matchId);
@@ -11639,7 +11668,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
11639
11668
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11640
11669
  const player = livePlayer(bundle, given);
11641
11670
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
11642
- const [picked, setPicked] = (0, import_react73.useState)(null);
11671
+ const [picked, setPicked] = (0, import_react74.useState)(null);
11643
11672
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
11644
11673
  const sample = active?.games?.length ?? 0;
11645
11674
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -11688,8 +11717,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
11688
11717
  ] });
11689
11718
  }
11690
11719
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11691
- const [openId, setOpenId] = (0, import_react73.useState)(null);
11692
- const [brokenShots, setBrokenShots] = (0, import_react73.useState)(/* @__PURE__ */ new Set());
11720
+ const [openId, setOpenId] = (0, import_react74.useState)(null);
11721
+ const [brokenShots, setBrokenShots] = (0, import_react74.useState)(/* @__PURE__ */ new Set());
11693
11722
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
11694
11723
  const p = livePlayer(bundle, given);
11695
11724
  const isOpen = openId === p.playerId;
@@ -11735,12 +11764,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
11735
11764
  }
11736
11765
  var BOX_QUIET_MS = 12e4;
11737
11766
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
11738
- const [tick, setTick] = (0, import_react73.useState)(0);
11767
+ const [tick, setTick] = (0, import_react74.useState)(0);
11739
11768
  const time = clock2(boxAsOfUtc, ui);
11740
11769
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
11741
11770
  const valid = !Number.isNaN(at2);
11742
11771
  const onBreak = atBreak(match);
11743
- (0, import_react73.useEffect)(() => {
11772
+ (0, import_react74.useEffect)(() => {
11744
11773
  if (!valid || onBreak) return;
11745
11774
  const age2 = Date.now() - at2;
11746
11775
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -11801,12 +11830,12 @@ var nbaDescriptor = (ui, match) => ({
11801
11830
  tenGameBars: false
11802
11831
  });
11803
11832
  function StatsClock2({ bundle, match, ui }) {
11804
- const [tick, setTick] = (0, import_react74.useState)(0);
11833
+ const [tick, setTick] = (0, import_react75.useState)(0);
11805
11834
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
11806
11835
  const time = clock2(bundle.boxAsOfUtc, ui);
11807
11836
  const valid = !Number.isNaN(at2) && time !== "";
11808
11837
  const onBreak = atBreak(match);
11809
- (0, import_react74.useEffect)(() => {
11838
+ (0, import_react75.useEffect)(() => {
11810
11839
  if (!valid || onBreak) return;
11811
11840
  const age2 = Date.now() - at2;
11812
11841
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -11820,7 +11849,7 @@ function StatsClock2({ bundle, match, ui }) {
11820
11849
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
11821
11850
  }
11822
11851
  function NbaPropsSection({ match, monitor, ui, slip }) {
11823
- const [side, setSide] = (0, import_react74.useState)("home");
11852
+ const [side, setSide] = (0, import_react75.useState)("home");
11824
11853
  const descriptor = nbaDescriptor(ui, match);
11825
11854
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
11826
11855
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -11858,7 +11887,7 @@ function city(teamName, nickname) {
11858
11887
  return name.slice(0, name.length - nickname.length).trim() || null;
11859
11888
  }
11860
11889
  function BadgeCrest({ url, abbreviation }) {
11861
- const [failed, setFailed] = (0, import_react75.useState)(false);
11890
+ const [failed, setFailed] = (0, import_react76.useState)(false);
11862
11891
  if (url && !failed) {
11863
11892
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
11864
11893
  }
@@ -11982,7 +12011,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
11982
12011
  }
11983
12012
 
11984
12013
  // src/components/NflFormSection.tsx
11985
- var import_react76 = require("react");
12014
+ var import_react77 = require("react");
11986
12015
  var import_jsx_runtime81 = require("react/jsx-runtime");
11987
12016
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
11988
12017
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -12035,7 +12064,7 @@ function H2hRow({ game, home, ui }) {
12035
12064
  ] });
12036
12065
  }
12037
12066
  function NflFormSection({ match, monitor, ui }) {
12038
- const [segment, setSegment] = (0, import_react76.useState)("away");
12067
+ const [segment, setSegment] = (0, import_react77.useState)("away");
12039
12068
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
12040
12069
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
12041
12070
  const form = bundle?.form;
@@ -12068,7 +12097,7 @@ function NflFormSection({ match, monitor, ui }) {
12068
12097
  }
12069
12098
 
12070
12099
  // src/components/NflPropsSection.tsx
12071
- var import_react77 = require("react");
12100
+ var import_react78 = require("react");
12072
12101
  var import_jsx_runtime82 = require("react/jsx-runtime");
12073
12102
  var TRENDS_SHOWN = 3;
12074
12103
  var SCORERS_SHOWN = 8;
@@ -12141,7 +12170,7 @@ function ShowMore({ label, onClick }) {
12141
12170
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
12142
12171
  }
12143
12172
  function Trends({ bundle, facts, descriptor, ui, slip }) {
12144
- const [all, setAll] = (0, import_react77.useState)(false);
12173
+ const [all, setAll] = (0, import_react78.useState)(false);
12145
12174
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
12146
12175
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
12147
12176
  /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -12174,7 +12203,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
12174
12203
  ] });
12175
12204
  }
12176
12205
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
12177
- const [all, setAll] = (0, import_react77.useState)(false);
12206
+ const [all, setAll] = (0, import_react78.useState)(false);
12178
12207
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
12179
12208
  const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
12180
12209
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "ss-w-props-scorers", children: [
@@ -12204,7 +12233,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
12204
12233
  ] });
12205
12234
  }
12206
12235
  function NflPropsSection({ match, monitor, ui, slip }) {
12207
- const [tab, setTab] = (0, import_react77.useState)(null);
12236
+ const [tab, setTab] = (0, import_react78.useState)(null);
12208
12237
  const descriptor = nflDescriptor(ui);
12209
12238
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
12210
12239
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -12393,14 +12422,14 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
12393
12422
  }
12394
12423
 
12395
12424
  // src/components/TennisMonitorCard.tsx
12396
- var import_react80 = require("react");
12425
+ var import_react81 = require("react");
12397
12426
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
12398
12427
 
12399
12428
  // src/components/TennisFixtureRow.tsx
12400
12429
  var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
12401
12430
 
12402
12431
  // src/components/FixtureRow.tsx
12403
- var import_react78 = require("react");
12432
+ var import_react79 = require("react");
12404
12433
  var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
12405
12434
  var import_jsx_runtime86 = require("react/jsx-runtime");
12406
12435
  function splitAtFirstSpace(label) {
@@ -12414,7 +12443,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
12414
12443
  return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
12415
12444
  }
12416
12445
  function Side2({ name, crest, abbr, away = false }) {
12417
- const [failed, setFailed] = (0, import_react78.useState)(false);
12446
+ const [failed, setFailed] = (0, import_react79.useState)(false);
12418
12447
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
12419
12448
  crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
12420
12449
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "ss-w-drow-nm", children: name })
@@ -12656,7 +12685,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
12656
12685
  }
12657
12686
 
12658
12687
  // src/components/TennisStatsTables.tsx
12659
- var import_react79 = require("react");
12688
+ var import_react80 = require("react");
12660
12689
  var import_jsx_runtime89 = require("react/jsx-runtime");
12661
12690
  function formatStat(row, value, locale) {
12662
12691
  if (value == null) return "\u2013";
@@ -12694,8 +12723,8 @@ function Tables({ table, labels, names, locale }) {
12694
12723
  ] });
12695
12724
  }
12696
12725
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
12697
- const [tab, setTab] = (0, import_react79.useState)("match");
12698
- (0, import_react79.useEffect)(() => {
12726
+ const [tab, setTab] = (0, import_react80.useState)("match");
12727
+ (0, import_react80.useEffect)(() => {
12699
12728
  setTab("match");
12700
12729
  }, [resetKey]);
12701
12730
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -12726,7 +12755,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
12726
12755
  ] }),
12727
12756
  today.rows.map((r) => {
12728
12757
  const f = (v) => formatStat({ kind: "pct" }, v, locale);
12729
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_react79.Fragment, { children: [
12758
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_react80.Fragment, { children: [
12730
12759
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
12731
12760
  /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
12732
12761
  f(r.p1Today),
@@ -12861,7 +12890,7 @@ function HeadToHead({ t, ui }) {
12861
12890
  ] });
12862
12891
  }
12863
12892
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12864
- const lastTables = (0, import_react80.useRef)(null);
12893
+ const lastTables = (0, import_react81.useRef)(null);
12865
12894
  const t = match.tennis;
12866
12895
  if (!t) return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
12867
12896
  const preMatch = match.phase === "preMatch";
@@ -12941,7 +12970,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
12941
12970
  }
12942
12971
 
12943
12972
  // src/components/ScoreboardStrip.tsx
12944
- var import_react81 = require("react");
12973
+ var import_react82 = require("react");
12945
12974
  var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
12946
12975
  var import_jsx_runtime91 = require("react/jsx-runtime");
12947
12976
  function nbaStatus(m, ui) {
@@ -13036,8 +13065,8 @@ function rowsFor(m) {
13036
13065
  ];
13037
13066
  }
13038
13067
  function useStripScroll(selectedKey) {
13039
- const stripRef = (0, import_react81.useRef)(null);
13040
- (0, import_react81.useEffect)(() => {
13068
+ const stripRef = (0, import_react82.useRef)(null);
13069
+ (0, import_react82.useEffect)(() => {
13041
13070
  const strip = stripRef.current;
13042
13071
  const pressed = strip?.querySelector('[aria-pressed="true"]');
13043
13072
  if (!strip || !pressed) return;
@@ -13211,7 +13240,7 @@ function OddsLiveStrip({ m, ui }) {
13211
13240
  ] });
13212
13241
  }
13213
13242
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
13214
- const seedIndex = (0, import_react82.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
13243
+ const seedIndex = (0, import_react83.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
13215
13244
  const tiles = orderTiles(
13216
13245
  monitor.pins,
13217
13246
  monitor.snapshot,
@@ -13283,7 +13312,7 @@ function TrendsPanel({ monitor, ui, slip }) {
13283
13312
  }
13284
13313
 
13285
13314
  // src/components/LivePanel.tsx
13286
- var import_react85 = require("react");
13315
+ var import_react86 = require("react");
13287
13316
  var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
13288
13317
 
13289
13318
  // src/scheduleView.ts
@@ -13458,20 +13487,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
13458
13487
  }
13459
13488
 
13460
13489
  // src/components/MatchSheet.tsx
13461
- var import_react84 = require("react");
13490
+ var import_react85 = require("react");
13462
13491
  var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
13463
13492
 
13464
13493
  // src/useModalDialog.ts
13465
- var import_react83 = require("react");
13494
+ var import_react84 = require("react");
13466
13495
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
13467
13496
  function useModalDialog(onClose, opts = {}) {
13468
- const dialogRef = (0, import_react83.useRef)(null);
13469
- const onCloseRef = (0, import_react83.useRef)(onClose);
13497
+ const dialogRef = (0, import_react84.useRef)(null);
13498
+ const onCloseRef = (0, import_react84.useRef)(onClose);
13470
13499
  onCloseRef.current = onClose;
13471
- const openerRef = (0, import_react83.useRef)(opts.opener);
13500
+ const openerRef = (0, import_react84.useRef)(opts.opener);
13472
13501
  openerRef.current = opts.opener;
13473
13502
  const restore = opts.restoreFocus ?? true;
13474
- (0, import_react83.useEffect)(() => {
13503
+ (0, import_react84.useEffect)(() => {
13475
13504
  const dialog = dialogRef.current;
13476
13505
  const root = dialog?.getRootNode();
13477
13506
  const focusedAtMount = root?.activeElement ?? null;
@@ -13482,7 +13511,7 @@ function useModalDialog(onClose, opts = {}) {
13482
13511
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
13483
13512
  };
13484
13513
  }, []);
13485
- (0, import_react83.useEffect)(() => {
13514
+ (0, import_react84.useEffect)(() => {
13486
13515
  const onKey = (e) => {
13487
13516
  if (e.key !== "Escape") return;
13488
13517
  e.stopPropagation();
@@ -13523,8 +13552,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
13523
13552
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
13524
13553
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
13525
13554
  const log = useEventLog();
13526
- const titleId = (0, import_react84.useId)();
13527
- const [limitHit, setLimitHit] = (0, import_react84.useState)(false);
13555
+ const titleId = (0, import_react85.useId)();
13556
+ const [limitHit, setLimitHit] = (0, import_react85.useState)(false);
13528
13557
  const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
13529
13558
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
13530
13559
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -13625,10 +13654,10 @@ var OPEN_TOP_GROUPS = 2;
13625
13654
  var QUIET_ROWS = 4;
13626
13655
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
13627
13656
  const { groups, states, stale } = discovery;
13628
- const [mine, setMine] = (0, import_react85.useState)(false);
13629
- const [toggled, setToggled] = (0, import_react85.useState)(/* @__PURE__ */ new Map());
13630
- const [sheet, setSheet] = (0, import_react85.useState)(null);
13631
- const pinnedKeys = (0, import_react85.useMemo)(
13657
+ const [mine, setMine] = (0, import_react86.useState)(false);
13658
+ const [toggled, setToggled] = (0, import_react86.useState)(/* @__PURE__ */ new Map());
13659
+ const [sheet, setSheet] = (0, import_react86.useState)(null);
13660
+ const pinnedKeys = (0, import_react86.useMemo)(
13632
13661
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
13633
13662
  [monitor.pins]
13634
13663
  );
@@ -13734,20 +13763,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
13734
13763
  }
13735
13764
 
13736
13765
  // src/components/ScheduleMatchesPanel.tsx
13737
- var import_react89 = require("react");
13766
+ var import_react90 = require("react");
13738
13767
  var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
13739
13768
 
13740
13769
  // src/useTennisRowPrices.ts
13741
- var import_react86 = require("react");
13770
+ var import_react87 = require("react");
13742
13771
  var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
13743
13772
  var TENNIS_PRICE_POLL_MS = 6e4;
13744
13773
  function useTennisRowPrices(a) {
13745
- const [state, setState] = (0, import_react86.useState)({ byId: null, stale: false });
13746
- const getPricesRef = (0, import_react86.useRef)(a.getPrices);
13774
+ const [state, setState] = (0, import_react87.useState)({ byId: null, stale: false });
13775
+ const getPricesRef = (0, import_react87.useRef)(a.getPrices);
13747
13776
  getPricesRef.current = a.getPrices;
13748
- const latest = (0, import_react86.useRef)(0);
13777
+ const latest = (0, import_react87.useRef)(0);
13749
13778
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
13750
- (0, import_react86.useEffect)(() => {
13779
+ (0, import_react87.useEffect)(() => {
13751
13780
  if (!a.enabled || idsKey === "") {
13752
13781
  latest.current++;
13753
13782
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -13785,11 +13814,11 @@ function useTennisRowPrices(a) {
13785
13814
  }
13786
13815
 
13787
13816
  // src/components/DayStrip.tsx
13788
- var import_react87 = require("react");
13817
+ var import_react88 = require("react");
13789
13818
  var import_jsx_runtime100 = require("react/jsx-runtime");
13790
13819
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
13791
- const listRef = (0, import_react87.useRef)(null);
13792
- (0, import_react87.useEffect)(() => {
13820
+ const listRef = (0, import_react88.useRef)(null);
13821
+ (0, import_react88.useEffect)(() => {
13793
13822
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
13794
13823
  if (!el || typeof el.scrollIntoView !== "function") return;
13795
13824
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -13818,7 +13847,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
13818
13847
  }
13819
13848
 
13820
13849
  // src/components/games/ui/SearchField.tsx
13821
- var import_react88 = require("react");
13850
+ var import_react89 = require("react");
13822
13851
 
13823
13852
  // src/components/games/ui/icons.tsx
13824
13853
  var import_jsx_runtime101 = require("react/jsx-runtime");
@@ -13857,8 +13886,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
13857
13886
  // src/components/games/ui/SearchField.tsx
13858
13887
  var import_jsx_runtime102 = require("react/jsx-runtime");
13859
13888
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
13860
- const localRef = (0, import_react88.useRef)(null);
13861
- const setInputRef = (0, import_react88.useCallback)((node) => {
13889
+ const localRef = (0, import_react89.useRef)(null);
13890
+ const setInputRef = (0, import_react89.useCallback)((node) => {
13862
13891
  localRef.current = node;
13863
13892
  if (typeof inputRef === "function") inputRef(node);
13864
13893
  else if (inputRef) inputRef.current = node;
@@ -13904,18 +13933,18 @@ var TOP_ROW_CAP = 3;
13904
13933
  var SKELETON_ROWS = 3;
13905
13934
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
13906
13935
  const { localDate: today, states, stale } = discovery;
13907
- const searchId = (0, import_react89.useId)();
13908
- const [query, setQuery] = (0, import_react89.useState)("");
13909
- const [toggled, setToggled] = (0, import_react89.useState)(/* @__PURE__ */ new Map());
13910
- const [expanded, setExpanded] = (0, import_react89.useState)(/* @__PURE__ */ new Set());
13911
- const listRef = (0, import_react89.useRef)(null);
13912
- const [sheet, setSheet] = (0, import_react89.useState)(null);
13936
+ const searchId = (0, import_react90.useId)();
13937
+ const [query, setQuery] = (0, import_react90.useState)("");
13938
+ const [toggled, setToggled] = (0, import_react90.useState)(/* @__PURE__ */ new Map());
13939
+ const [expanded, setExpanded] = (0, import_react90.useState)(/* @__PURE__ */ new Set());
13940
+ const listRef = (0, import_react90.useRef)(null);
13941
+ const [sheet, setSheet] = (0, import_react90.useState)(null);
13913
13942
  const { chips, selected } = loaded;
13914
- (0, import_react89.useEffect)(() => {
13943
+ (0, import_react90.useEffect)(() => {
13915
13944
  if (selected !== day) onDay(selected);
13916
13945
  }, [day, selected, onDay]);
13917
13946
  const isToday = selected === today;
13918
- const pinnedKeys = (0, import_react89.useMemo)(
13947
+ const pinnedKeys = (0, import_react90.useMemo)(
13919
13948
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
13920
13949
  [monitor.pins]
13921
13950
  );
@@ -14053,7 +14082,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
14053
14082
  }
14054
14083
 
14055
14084
  // src/components/GamesPanel.tsx
14056
- var import_react104 = require("react");
14085
+ var import_react105 = require("react");
14057
14086
 
14058
14087
  // src/components/GamesLoginWall.tsx
14059
14088
  var import_jsx_runtime104 = require("react/jsx-runtime");
@@ -14062,7 +14091,7 @@ function GamesLoginWall({ ui }) {
14062
14091
  }
14063
14092
 
14064
14093
  // src/components/GamesHub.tsx
14065
- var import_react90 = require("react");
14094
+ var import_react91 = require("react");
14066
14095
 
14067
14096
  // src/components/games/ui/gameMeta.ts
14068
14097
  function prettifyGameId(gameId) {
@@ -14213,8 +14242,8 @@ function pickHeroGame(games) {
14213
14242
  }
14214
14243
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
14215
14244
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
14216
- const [, setTick] = (0, import_react90.useState)(0);
14217
- (0, import_react90.useEffect)(() => {
14245
+ const [, setTick] = (0, import_react91.useState)(0);
14246
+ (0, import_react91.useEffect)(() => {
14218
14247
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
14219
14248
  return () => clearInterval(id);
14220
14249
  }, []);
@@ -14274,10 +14303,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
14274
14303
  }
14275
14304
 
14276
14305
  // src/components/GameScreenHost.tsx
14277
- var import_react102 = require("react");
14306
+ var import_react103 = require("react");
14278
14307
 
14279
14308
  // src/useGamePlay.ts
14280
- var import_react91 = require("react");
14309
+ var import_react92 = require("react");
14281
14310
  function toSubmitResult(payload) {
14282
14311
  return {
14283
14312
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -14289,17 +14318,17 @@ function toSubmitResult(payload) {
14289
14318
  };
14290
14319
  }
14291
14320
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
14292
- const [result, setResult] = (0, import_react91.useState)(null);
14293
- const [submitting, setSubmitting] = (0, import_react91.useState)(false);
14294
- const [rawStatus, setRawStatus] = (0, import_react91.useState)(null);
14295
- const inFlightRef = (0, import_react91.useRef)(false);
14296
- const convRef = (0, import_react91.useRef)(conversation);
14321
+ const [result, setResult] = (0, import_react92.useState)(null);
14322
+ const [submitting, setSubmitting] = (0, import_react92.useState)(false);
14323
+ const [rawStatus, setRawStatus] = (0, import_react92.useState)(null);
14324
+ const inFlightRef = (0, import_react92.useRef)(false);
14325
+ const convRef = (0, import_react92.useRef)(conversation);
14297
14326
  convRef.current = conversation;
14298
- const optsRef = (0, import_react91.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
14327
+ const optsRef = (0, import_react92.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
14299
14328
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
14300
- const resultRef = (0, import_react91.useRef)(null);
14329
+ const resultRef = (0, import_react92.useRef)(null);
14301
14330
  resultRef.current = result;
14302
- const refetch = (0, import_react91.useCallback)(async () => {
14331
+ const refetch = (0, import_react92.useCallback)(async () => {
14303
14332
  const conv = convRef.current;
14304
14333
  if (!conv) return;
14305
14334
  const opts = optsRef.current;
@@ -14315,7 +14344,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
14315
14344
  } catch {
14316
14345
  }
14317
14346
  }, []);
14318
- const submit = (0, import_react91.useCallback)(async (answerJson) => {
14347
+ const submit = (0, import_react92.useCallback)(async (answerJson) => {
14319
14348
  const conv = convRef.current;
14320
14349
  if (!conv || inFlightRef.current) return;
14321
14350
  inFlightRef.current = true;
@@ -14342,14 +14371,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
14342
14371
  setSubmitting(false);
14343
14372
  }
14344
14373
  }, [refetch]);
14345
- const hydrate = (0, import_react91.useCallback)(() => {
14374
+ const hydrate = (0, import_react92.useCallback)(() => {
14346
14375
  void refetch();
14347
14376
  }, [refetch]);
14348
14377
  return { result, submitting, submit, hydrate, rawStatus };
14349
14378
  }
14350
14379
 
14351
14380
  // src/components/games/MysteryTigerGame.tsx
14352
- var import_react93 = require("react");
14381
+ var import_react94 = require("react");
14353
14382
 
14354
14383
  // src/components/games/nationFlags.ts
14355
14384
  var FLAGS = {
@@ -14560,7 +14589,7 @@ function isNationCode(flag) {
14560
14589
  }
14561
14590
 
14562
14591
  // src/components/games/PlayerAvatar.tsx
14563
- var import_react92 = require("react");
14592
+ var import_react93 = require("react");
14564
14593
  var import_jsx_runtime109 = require("react/jsx-runtime");
14565
14594
  function initialsOf(name) {
14566
14595
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -14578,7 +14607,7 @@ function PlayerAvatar({
14578
14607
  imagePath,
14579
14608
  className
14580
14609
  }) {
14581
- const [failed, setFailed] = (0, import_react92.useState)(false);
14610
+ const [failed, setFailed] = (0, import_react93.useState)(false);
14582
14611
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
14583
14612
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
14584
14613
  }
@@ -14822,8 +14851,8 @@ function MysteryTigerGame({
14822
14851
  onBack
14823
14852
  }) {
14824
14853
  const t = ui.games.mysteryTiger;
14825
- const [query, setQuery] = (0, import_react93.useState)("");
14826
- const inputId = (0, import_react93.useId)();
14854
+ const [query, setQuery] = (0, import_react94.useState)("");
14855
+ const inputId = (0, import_react94.useId)();
14827
14856
  const clientState = parseClientState(result?.clientStateJson);
14828
14857
  const guessResults = clientState?.guessResults ?? [];
14829
14858
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -15084,13 +15113,13 @@ function HigherOrLowerGame({
15084
15113
  }
15085
15114
 
15086
15115
  // src/components/games/CareerPathGame.tsx
15087
- var import_react95 = require("react");
15116
+ var import_react96 = require("react");
15088
15117
 
15089
15118
  // src/components/games/ui/CrestShield.tsx
15090
- var import_react94 = require("react");
15119
+ var import_react95 = require("react");
15091
15120
  var import_jsx_runtime120 = require("react/jsx-runtime");
15092
15121
  function CrestShield({ src, name, size = 28 }) {
15093
- const [failed, setFailed] = (0, import_react94.useState)(false);
15122
+ const [failed, setFailed] = (0, import_react95.useState)(false);
15094
15123
  if (src && !isPlaceholderImage(src) && !failed) {
15095
15124
  return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
15096
15125
  }
@@ -15122,8 +15151,8 @@ function CareerPathGame({
15122
15151
  }) {
15123
15152
  const s = ui.games.careerPath;
15124
15153
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
15125
- const [query, setQuery] = (0, import_react95.useState)("");
15126
- const inputId = (0, import_react95.useId)();
15154
+ const [query, setQuery] = (0, import_react96.useState)("");
15155
+ const inputId = (0, import_react96.useId)();
15127
15156
  const clientState = parseClientState3(result?.clientStateJson);
15128
15157
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
15129
15158
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -15229,7 +15258,7 @@ function CareerPathGame({
15229
15258
  }
15230
15259
 
15231
15260
  // src/components/games/BeatTheGridGame.tsx
15232
- var import_react96 = __toESM(require("react"), 1);
15261
+ var import_react97 = __toESM(require("react"), 1);
15233
15262
 
15234
15263
  // src/components/games/ui/OptionList.tsx
15235
15264
  var import_jsx_runtime122 = require("react/jsx-runtime");
@@ -15318,10 +15347,10 @@ function SearchSheet({
15318
15347
  ui
15319
15348
  }) {
15320
15349
  const s = ui.games.beatTheGrid;
15321
- const [query, setQuery] = (0, import_react96.useState)("");
15322
- const inputId = (0, import_react96.useId)();
15323
- const inputRef = (0, import_react96.useRef)(null);
15324
- (0, import_react96.useEffect)(() => {
15350
+ const [query, setQuery] = (0, import_react97.useState)("");
15351
+ const inputId = (0, import_react97.useId)();
15352
+ const inputRef = (0, import_react97.useRef)(null);
15353
+ (0, import_react97.useEffect)(() => {
15325
15354
  inputRef.current?.focus();
15326
15355
  }, [row, col]);
15327
15356
  const filtered = playerPool.filter(
@@ -15386,7 +15415,7 @@ function BeatTheGridGame({
15386
15415
  }) {
15387
15416
  const s = ui.games.beatTheGrid;
15388
15417
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
15389
- const [activeCell, setActiveCell] = (0, import_react96.useState)(null);
15418
+ const [activeCell, setActiveCell] = (0, import_react97.useState)(null);
15390
15419
  const clientState = parseClientState4(result?.clientStateJson);
15391
15420
  const filledCells = clientState?.cells ?? [];
15392
15421
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -15460,7 +15489,7 @@ function BeatTheGridGame({
15460
15489
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { "aria-hidden": "true", children: abbr }),
15461
15490
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "ss-g-sr", children: rowLabel })
15462
15491
  ] });
15463
- return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_react96.default.Fragment, { children: [
15492
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_react97.default.Fragment, { children: [
15464
15493
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
15465
15494
  cols.map((colLabel, colIdx) => {
15466
15495
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -15541,7 +15570,7 @@ function BeatTheGridGame({
15541
15570
  }
15542
15571
 
15543
15572
  // src/components/games/GuessTheXiGame.tsx
15544
- var import_react97 = require("react");
15573
+ var import_react98 = require("react");
15545
15574
 
15546
15575
  // src/components/games/ui/PitchSvg.tsx
15547
15576
  var import_jsx_runtime124 = require("react/jsx-runtime");
@@ -15630,8 +15659,8 @@ function GuessTheXiGame({
15630
15659
  onBack
15631
15660
  }) {
15632
15661
  const t = ui.games.guessTheXi;
15633
- const [query, setQuery] = (0, import_react97.useState)("");
15634
- const inputId = (0, import_react97.useId)();
15662
+ const [query, setQuery] = (0, import_react98.useState)("");
15663
+ const inputId = (0, import_react98.useId)();
15635
15664
  const clientState = parseClientState5(result?.clientStateJson);
15636
15665
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
15637
15666
  const solved = clientState?.status === "solved";
@@ -15773,7 +15802,7 @@ function GuessTheXiGame({
15773
15802
  }
15774
15803
 
15775
15804
  // src/components/games/DailyQuizGame.tsx
15776
- var import_react98 = require("react");
15805
+ var import_react99 = require("react");
15777
15806
  var import_jsx_runtime126 = require("react/jsx-runtime");
15778
15807
  function parseClientState6(json) {
15779
15808
  if (!json) return null;
@@ -15814,8 +15843,8 @@ function DailyQuizGame({
15814
15843
  }) {
15815
15844
  const s = ui.games.dailyQuiz;
15816
15845
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
15817
- const [selections, setSelections] = (0, import_react98.useState)(/* @__PURE__ */ new Map());
15818
- const [page, setPage] = (0, import_react98.useState)(0);
15846
+ const [selections, setSelections] = (0, import_react99.useState)(/* @__PURE__ */ new Map());
15847
+ const [page, setPage] = (0, import_react99.useState)(0);
15819
15848
  const clientState = parseClientState6(result?.clientStateJson);
15820
15849
  const results2 = clientState?.results ?? [];
15821
15850
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -15925,7 +15954,7 @@ function DailyQuizGame({
15925
15954
  }
15926
15955
 
15927
15956
  // src/components/games/MatchdayPredictorGame.tsx
15928
- var import_react99 = require("react");
15957
+ var import_react100 = require("react");
15929
15958
  var import_jsx_runtime127 = require("react/jsx-runtime");
15930
15959
  var SCORER_SEARCH_THRESHOLD = 9;
15931
15960
  function parseClientState7(json) {
@@ -16021,12 +16050,12 @@ function MatchdayPredictorGame({
16021
16050
  onBack
16022
16051
  }) {
16023
16052
  const t = ui.games.predictor;
16024
- const [homeScore, setHomeScore] = (0, import_react99.useState)(0);
16025
- const [awayScore, setAwayScore] = (0, import_react99.useState)(0);
16026
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react99.useState)(null);
16027
- const [lastEdited, setLastEdited] = (0, import_react99.useState)("home");
16028
- const [query, setQuery] = (0, import_react99.useState)("");
16029
- const searchId = (0, import_react99.useId)();
16053
+ const [homeScore, setHomeScore] = (0, import_react100.useState)(0);
16054
+ const [awayScore, setAwayScore] = (0, import_react100.useState)(0);
16055
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react100.useState)(null);
16056
+ const [lastEdited, setLastEdited] = (0, import_react100.useState)("home");
16057
+ const [query, setQuery] = (0, import_react100.useState)("");
16058
+ const searchId = (0, import_react100.useId)();
16030
16059
  const clientState = parseClientState7(result?.clientStateJson);
16031
16060
  const alreadyPlayed = result?.alreadyPlayed === true;
16032
16061
  const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
@@ -16193,7 +16222,7 @@ function MatchdayPredictorGame({
16193
16222
  }
16194
16223
 
16195
16224
  // src/components/games/StartingXiGame.tsx
16196
- var import_react100 = require("react");
16225
+ var import_react101 = require("react");
16197
16226
  var import_jsx_runtime128 = require("react/jsx-runtime");
16198
16227
  var POINTS_PER_STARTER = 8;
16199
16228
  var XI_SIZE = 11;
@@ -16237,10 +16266,10 @@ function StartingXiGame({
16237
16266
  lockAtUtc
16238
16267
  }) {
16239
16268
  const t = ui.games.startingXi;
16240
- const [slotPlayers, setSlotPlayers] = (0, import_react100.useState)(() => Array(XI_SIZE).fill(null));
16241
- const [active, setActive] = (0, import_react100.useState)(0);
16242
- const [query, setQuery] = (0, import_react100.useState)("");
16243
- const searchId = (0, import_react100.useId)();
16269
+ const [slotPlayers, setSlotPlayers] = (0, import_react101.useState)(() => Array(XI_SIZE).fill(null));
16270
+ const [active, setActive] = (0, import_react101.useState)(0);
16271
+ const [query, setQuery] = (0, import_react101.useState)("");
16272
+ const searchId = (0, import_react101.useId)();
16244
16273
  const clientState = parseClientState8(result?.clientStateJson);
16245
16274
  const alreadyPlayed = result?.alreadyPlayed === true;
16246
16275
  const header = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
@@ -16379,7 +16408,7 @@ function StartingXiGame({
16379
16408
  }
16380
16409
 
16381
16410
  // src/components/games/StatLadderGame.tsx
16382
- var import_react101 = require("react");
16411
+ var import_react102 = require("react");
16383
16412
  var import_jsx_runtime129 = require("react/jsx-runtime");
16384
16413
  function ladderClue(ladder) {
16385
16414
  const mystery = ladder.find((r) => r.rank === 2);
@@ -16416,9 +16445,9 @@ function StatLadderGame({
16416
16445
  onBack
16417
16446
  }) {
16418
16447
  const t = ui.games.statLadder;
16419
- const [query, setQuery] = (0, import_react101.useState)("");
16420
- const [selectedId, setSelectedId] = (0, import_react101.useState)(null);
16421
- const searchId = (0, import_react101.useId)();
16448
+ const [query, setQuery] = (0, import_react102.useState)("");
16449
+ const [selectedId, setSelectedId] = (0, import_react102.useState)(null);
16450
+ const searchId = (0, import_react102.useId)();
16422
16451
  const clientState = parseClientState9(result?.clientStateJson);
16423
16452
  const revealed = clientState != null;
16424
16453
  const header = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
@@ -16624,8 +16653,8 @@ function GameScreenHost({
16624
16653
  ui
16625
16654
  }) {
16626
16655
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
16627
- const [configJson, setConfigJson] = (0, import_react102.useState)(null);
16628
- (0, import_react102.useEffect)(() => {
16656
+ const [configJson, setConfigJson] = (0, import_react103.useState)(null);
16657
+ (0, import_react103.useEffect)(() => {
16629
16658
  setConfigJson(null);
16630
16659
  if (!conversation) return;
16631
16660
  let cancelled = false;
@@ -16648,12 +16677,12 @@ function GameScreenHost({
16648
16677
  fixtureId: fixtureId || void 0,
16649
16678
  locale: ui.hostTag
16650
16679
  });
16651
- (0, import_react102.useEffect)(() => {
16680
+ (0, import_react103.useEffect)(() => {
16652
16681
  if (conversation) hydrate();
16653
16682
  }, [conversation, gameId]);
16654
- const hydrateRef = (0, import_react102.useRef)(hydrate);
16683
+ const hydrateRef = (0, import_react103.useRef)(hydrate);
16655
16684
  hydrateRef.current = hydrate;
16656
- (0, import_react102.useEffect)(() => {
16685
+ (0, import_react103.useEffect)(() => {
16657
16686
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
16658
16687
  if (rawStatus !== "pending") return;
16659
16688
  const timerId = setInterval(() => {
@@ -16766,7 +16795,7 @@ function GameScreenHost({
16766
16795
  }
16767
16796
 
16768
16797
  // src/components/Leaderboard.tsx
16769
- var import_react103 = require("react");
16798
+ var import_react104 = require("react");
16770
16799
 
16771
16800
  // src/components/LeaderboardRow.tsx
16772
16801
  var import_jsx_runtime132 = require("react/jsx-runtime");
@@ -16853,7 +16882,7 @@ function Leaderboard({
16853
16882
  ui,
16854
16883
  onPlay
16855
16884
  }) {
16856
- const [segment, setSegment] = (0, import_react103.useState)("weekly");
16885
+ const [segment, setSegment] = (0, import_react104.useState)("weekly");
16857
16886
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
16858
16887
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
16859
16888
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -16958,9 +16987,9 @@ function GamesPanel({
16958
16987
  leaderboardLoading,
16959
16988
  refreshHub
16960
16989
  }) {
16961
- const [selected, setSelected] = (0, import_react104.useState)(null);
16962
- const [segment, setSegment] = (0, import_react104.useState)("play");
16963
- (0, import_react104.useEffect)(() => {
16990
+ const [selected, setSelected] = (0, import_react105.useState)(null);
16991
+ const [segment, setSegment] = (0, import_react105.useState)("play");
16992
+ (0, import_react105.useEffect)(() => {
16964
16993
  ensureGamesFonts();
16965
16994
  }, []);
16966
16995
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(GamesLoginWall, { ui });
@@ -17024,10 +17053,10 @@ function GamesPanel({
17024
17053
  }
17025
17054
 
17026
17055
  // src/components/FavouritesPanel.tsx
17027
- var import_react107 = require("react");
17056
+ var import_react108 = require("react");
17028
17057
 
17029
17058
  // src/components/FavouriteChips.tsx
17030
- var import_react105 = require("react");
17059
+ var import_react106 = require("react");
17031
17060
  var import_jsx_runtime137 = require("react/jsx-runtime");
17032
17061
  async function toggleWithNotice(controller, kind, id, onNotice) {
17033
17062
  const outcome = await controller.toggle(kind, id);
@@ -17073,12 +17102,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
17073
17102
  ] });
17074
17103
  }
17075
17104
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
17076
- const [confirming, setConfirming] = (0, import_react105.useState)(false);
17105
+ const [confirming, setConfirming] = (0, import_react106.useState)(false);
17077
17106
  const data = controller.data;
17078
- (0, import_react105.useEffect)(() => {
17107
+ (0, import_react106.useEffect)(() => {
17079
17108
  setConfirming(false);
17080
17109
  }, [sport]);
17081
- (0, import_react105.useEffect)(() => {
17110
+ (0, import_react106.useEffect)(() => {
17082
17111
  if (!confirming) return;
17083
17112
  const onPointerDown = (e) => {
17084
17113
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -17132,21 +17161,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
17132
17161
  }
17133
17162
 
17134
17163
  // src/components/FavouritesSearch.tsx
17135
- var import_react106 = require("react");
17164
+ var import_react107 = require("react");
17136
17165
  var import_jsx_runtime138 = require("react/jsx-runtime");
17137
17166
  var MIN_LETTERS = 2;
17138
17167
  var MAX_LENGTH = 64;
17139
17168
  var DEBOUNCE_MS = 250;
17140
17169
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
17141
- const [query, setQuery] = (0, import_react106.useState)("");
17142
- const [answer, setAnswer] = (0, import_react106.useState)(null);
17143
- const controllerRef = (0, import_react106.useRef)(controller);
17170
+ const [query, setQuery] = (0, import_react107.useState)("");
17171
+ const [answer, setAnswer] = (0, import_react107.useState)(null);
17172
+ const controllerRef = (0, import_react107.useRef)(controller);
17144
17173
  controllerRef.current = controller;
17145
17174
  const trimmed = query.trim();
17146
17175
  const queryKey = `${sport}|${trimmed}`;
17147
17176
  const results2 = answer?.key === queryKey ? answer.rows : [];
17148
17177
  const settled = answer?.key === queryKey;
17149
- (0, import_react106.useEffect)(() => {
17178
+ (0, import_react107.useEffect)(() => {
17150
17179
  setAnswer(null);
17151
17180
  if (trimmed.length < MIN_LETTERS) return;
17152
17181
  let cancelled = false;
@@ -17209,13 +17238,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
17209
17238
  // src/components/FavouritesPanel.tsx
17210
17239
  var import_jsx_runtime139 = require("react/jsx-runtime");
17211
17240
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
17212
- const [notice, setNotice] = (0, import_react107.useState)(null);
17213
- const refreshRef = (0, import_react107.useRef)(controller.refresh);
17241
+ const [notice, setNotice] = (0, import_react108.useState)(null);
17242
+ const refreshRef = (0, import_react108.useRef)(controller.refresh);
17214
17243
  refreshRef.current = controller.refresh;
17215
- (0, import_react107.useEffect)(() => {
17244
+ (0, import_react108.useEffect)(() => {
17216
17245
  void refreshRef.current();
17217
17246
  }, []);
17218
- (0, import_react107.useEffect)(() => {
17247
+ (0, import_react108.useEffect)(() => {
17219
17248
  setNotice(null);
17220
17249
  }, [sport]);
17221
17250
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -17241,11 +17270,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
17241
17270
  }
17242
17271
 
17243
17272
  // src/components/PresetTools.tsx
17244
- var import_react108 = require("react");
17273
+ var import_react109 = require("react");
17245
17274
  var import_jsx_runtime140 = require("react/jsx-runtime");
17246
17275
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
17247
17276
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
17248
- const titleId = (0, import_react108.useId)();
17277
+ const titleId = (0, import_react109.useId)();
17249
17278
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
17250
17279
  /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)("div", { className: "ss-w-tool-head", children: [
17251
17280
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
@@ -17295,9 +17324,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
17295
17324
  const totalOptions = comboTotals(grid);
17296
17325
  const totals = totalOptions.map((o) => o.value);
17297
17326
  const legChoices = comboLegChoices(grid);
17298
- const [total, setTotal] = (0, import_react108.useState)(() => nearest(totals, initialTotal));
17299
- const [legs, setLegs] = (0, import_react108.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17300
- const [announcement, setAnnouncement] = (0, import_react108.useState)("");
17327
+ const [total, setTotal] = (0, import_react109.useState)(() => nearest(totals, initialTotal));
17328
+ const [legs, setLegs] = (0, import_react109.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
17329
+ const [announcement, setAnnouncement] = (0, import_react109.useState)("");
17301
17330
  const cell2 = findCombo(grid, total, legs);
17302
17331
  const minLegs = legChoices[0] ?? legs;
17303
17332
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -17336,7 +17365,8 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
17336
17365
  }
17337
17366
 
17338
17367
  // src/components/dashboard/v8/SentenceBuilder.tsx
17339
- var import_react109 = require("react");
17368
+ var import_react110 = require("react");
17369
+ var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
17340
17370
  var import_jsx_runtime142 = require("react/jsx-runtime");
17341
17371
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
17342
17372
  var BASE_LEGS = [1, 2, 3, 4];
@@ -17347,6 +17377,20 @@ var totalLabel = (t, options, format2, ui) => {
17347
17377
  const option = options.find((o) => o.key === t);
17348
17378
  return t === "any" || !option ? ui.v8BuilderAny : formatOdds(option.formats, format2);
17349
17379
  };
17380
+ var NO_BASE = { variant: 0, variants: 1, requested: 0, supported: false };
17381
+ function shownAfter(prev, grid, req) {
17382
+ if (grid.status === "noSwap" && prev) {
17383
+ const failed = prev.grid.legs.map((l) => l.matchOddsId).find((id) => !req.keep?.includes(id));
17384
+ const noSwap = failed === void 0 || prev.noSwap.includes(failed) ? prev.noSwap : [...prev.noSwap, failed];
17385
+ return { ...prev, seen: grid, seenReq: req, noSwap };
17386
+ }
17387
+ const swap = (req.keep?.length ?? 0) > 0;
17388
+ const ids = grid.legs.map((l) => l.matchOddsId);
17389
+ const trusted = !swap || (req.keep ?? []).every((id) => ids.includes(id));
17390
+ const base = swap && trusted ? prev?.base ?? NO_BASE : grid.status === "ok" ? { variant: grid.variant ?? 0, variants: grid.variants ?? 1, requested: swap ? grid.variant ?? 0 : req.variant ?? 0, supported: typeof grid.variants === "number" } : NO_BASE;
17391
+ return { seen: grid, seenReq: req, grid, req, trusted, noSwap: [], base };
17392
+ }
17393
+ var sorted = (ids) => [...new Set(ids)].sort((a, b) => a - b);
17350
17394
  var sameIds = (a, b) => a.length === b.length && a.every((id) => b.includes(id));
17351
17395
  function openingGames(preset) {
17352
17396
  const options = preset.gamesOptions && preset.gamesOptions.length > 0 ? preset.gamesOptions : null;
@@ -17362,8 +17406,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17362
17406
  const opening = openingGames(preset);
17363
17407
  const gamesOptions = opening.options;
17364
17408
  const marketOptions = usableMarkets(preset);
17365
- const [fingerprint] = (0, import_react109.useState)(() => JSON.stringify(preset));
17366
- const [saved] = (0, import_react109.useState)(() => {
17409
+ const [fingerprint] = (0, import_react110.useState)(() => JSON.stringify(preset));
17410
+ const [saved] = (0, import_react110.useState)(() => {
17367
17411
  const kept = memory3?.savedView(sport);
17368
17412
  return kept && kept.fingerprint === fingerprint ? kept : null;
17369
17413
  });
@@ -17378,10 +17422,11 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17378
17422
  // The server never widens by itself: an all-games preset with no ids asks for it.
17379
17423
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
17380
17424
  };
17381
- const [view, setView] = (0, import_react109.useState)(() => saved?.view ?? openingView);
17382
- const autoWidened = (0, import_react109.useRef)(false);
17383
- const [widenedNote, setWidenedNote] = (0, import_react109.useState)(saved?.widenedNote ?? false);
17384
- const requestFor = (v) => ({
17425
+ const [view, setView] = (0, import_react110.useState)(() => saved?.view ?? openingView);
17426
+ const autoWidened = (0, import_react110.useRef)(false);
17427
+ const [widenedNote, setWidenedNote] = (0, import_react110.useState)(saved?.widenedNote ?? false);
17428
+ const track = useTrack();
17429
+ const requestFor = (v, extra) => ({
17385
17430
  sport,
17386
17431
  ...v.marketKey !== null ? { marketKey: v.marketKey } : {},
17387
17432
  matchIds: v.widen ? [] : v.matchIds,
@@ -17389,21 +17434,24 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17389
17434
  // The total row is hidden for Singles, so a total picked earlier must not narrow them; the pick stays in state for the way back.
17390
17435
  total: v.legs === 1 ? "any" : v.custom?.decimal ?? v.total,
17391
17436
  widen: v.widen,
17437
+ ...extra?.variant ? { variant: extra.variant } : {},
17438
+ ...extra?.keep?.length ? { keep: sorted(extra.keep) } : {},
17439
+ ...extra?.swapped?.length ? { swapped: [...new Set(extra.swapped)].slice(-import_widget_sdk38.MAX_SWAPPED_IDS) } : {},
17392
17440
  ...operatorUserId ? { operatorUserId } : {},
17393
17441
  ...anonymousUserId ? { anonymousUserId } : {}
17394
17442
  });
17395
- const [editing, setEditing] = (0, import_react109.useState)(false);
17396
- const [draft, setDraft] = (0, import_react109.useState)("");
17397
- const [invalid, setInvalid] = (0, import_react109.useState)(null);
17398
- const inputRef = (0, import_react109.useRef)(null);
17399
- const pencilRef = (0, import_react109.useRef)(null);
17400
- const noteId = (0, import_react109.useId)();
17401
- const customId = (0, import_react109.useId)();
17402
- (0, import_react109.useEffect)(() => {
17443
+ const [editing, setEditing] = (0, import_react110.useState)(false);
17444
+ const [draft, setDraft] = (0, import_react110.useState)("");
17445
+ const [invalid, setInvalid] = (0, import_react110.useState)(null);
17446
+ const inputRef = (0, import_react110.useRef)(null);
17447
+ const pencilRef = (0, import_react110.useRef)(null);
17448
+ const noteId = (0, import_react110.useId)();
17449
+ const customId = (0, import_react110.useId)();
17450
+ (0, import_react110.useEffect)(() => {
17403
17451
  if (editing) inputRef.current?.focus();
17404
17452
  }, [editing]);
17405
17453
  const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
17406
- (0, import_react109.useEffect)(() => {
17454
+ (0, import_react110.useEffect)(() => {
17407
17455
  if (view.legs === 1) {
17408
17456
  setEditing(false);
17409
17457
  setDraft("");
@@ -17419,10 +17467,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17419
17467
  setEditing(false);
17420
17468
  pencilRef.current?.focus();
17421
17469
  };
17422
- const [first] = (0, import_react109.useState)(() => requestFor(view));
17423
- const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
17424
- const lastRequest = (0, import_react109.useRef)(first);
17425
- (0, import_react109.useEffect)(() => {
17470
+ const [first] = (0, import_react110.useState)(() => requestFor(view));
17471
+ const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
17472
+ const [shown2, setShown] = (0, import_react110.useState)(null);
17473
+ if (grid === null) {
17474
+ if (shown2 !== null && status2 === "ready") setShown(null);
17475
+ } else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
17476
+ setShown(shownAfter(shown2, grid, answeredFor));
17477
+ }
17478
+ const lastRequest = (0, import_react110.useRef)(first);
17479
+ (0, import_react110.useEffect)(() => {
17426
17480
  void request(lastRequest.current);
17427
17481
  }, [request]);
17428
17482
  const send = (req) => {
@@ -17437,6 +17491,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17437
17491
  const ask = (next) => {
17438
17492
  setStartedNote(false);
17439
17493
  autoWidened.current = false;
17494
+ setTapped(null);
17440
17495
  commit(next, false);
17441
17496
  send(requestFor(next));
17442
17497
  };
@@ -17458,43 +17513,93 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17458
17513
  ask(next);
17459
17514
  };
17460
17515
  const canNarrow = preset.matchIds.length > 0;
17461
- const suggested = grid?.status === "miss" || grid?.nearest === true ? grid.legCountThatLands : null;
17516
+ const ready = status2 === "ready" && grid !== null;
17517
+ const [tapped, setTapped] = (0, import_react110.useState)(null);
17518
+ const busy = tapped !== null && status2 === "loading" && shown2 !== null;
17519
+ const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
17520
+ const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
17462
17521
  const legButtons = Array.from(/* @__PURE__ */ new Set([
17463
17522
  ...BASE_LEGS,
17464
17523
  ...[preset.legs, suggested].filter((n) => n !== null && n > 4)
17465
17524
  ])).sort((a, b) => a - b);
17466
- const ready = status2 === "ready" && grid !== null;
17467
- const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
17525
+ const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
17526
+ const sectionRef = (0, import_react110.useRef)(null);
17527
+ (0, import_react110.useEffect)(() => {
17528
+ if (tapped === null || status2 !== "ready") return;
17529
+ setTapped(null);
17530
+ const root = sectionRef.current;
17531
+ if (!root) return;
17532
+ const at2 = document.activeElement;
17533
+ const mine = Array.from(root.querySelectorAll(".ss-w-combo-legs, .ss-w-v8-builder-actions"));
17534
+ if (at2 && at2 !== document.body && !mine.some((n) => n.contains(at2))) return;
17535
+ const pick = (key) => {
17536
+ const b = root.querySelector(`[data-focus="${key}"]`);
17537
+ return b && !b.disabled ? b : null;
17538
+ };
17539
+ const list = root.querySelector(".ss-w-combo-legs");
17540
+ (pick(tapped) ?? pick("another") ?? list ?? root)?.focus();
17541
+ }, [tapped, status2]);
17468
17542
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
17469
17543
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
17470
- const [startedNote, setStartedNote] = (0, import_react109.useState)(false);
17544
+ const [startedNote, setStartedNote] = (0, import_react110.useState)(false);
17471
17545
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
17472
- (0, import_react109.useEffect)(() => {
17546
+ (0, import_react110.useEffect)(() => {
17473
17547
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
17474
17548
  }, [startedNote, status2, anyStarted]);
17475
17549
  const market = rows?.[0]?.market;
17476
- const [seen2, setSeen] = (0, import_react109.useState)(null);
17477
- (0, import_react109.useEffect)(() => {
17550
+ const [seen2, setSeen] = (0, import_react110.useState)(null);
17551
+ (0, import_react110.useEffect)(() => {
17478
17552
  if (market) setSeen(market);
17479
17553
  }, [market]);
17480
17554
  const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
17481
- const paused = ready && grid.status === "paused";
17555
+ const paused = g?.status === "paused";
17482
17556
  const coolOff = status2 === "ready" && grid === null;
17483
- const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
17484
- const widened = view.widen || ready && grid.widened;
17557
+ const empty2 = g !== null && (g.status === "miss" || g.status === "ok" && (rows === null || rows.length === 0));
17558
+ const widened = view.widen || g?.widened === true;
17485
17559
  const singles = view.legs === 1;
17486
17560
  const onOpeningChoice = view.marketKey === openingView.marketKey && view.widen === openingView.widen && view.gamesId === openingView.gamesId && sameIds(view.matchIds, openingView.matchIds);
17487
17561
  const quotedAt = rows ? oldestQuote(rows) : null;
17488
- const combo = ready && grid.total !== null ? { sport, totalChosen: view.custom ? "custom" : view.total, totalActual: grid.total } : void 0;
17562
+ const totalChosen = view.custom ? "custom" : view.total;
17563
+ const combo = g && g.total !== null ? { sport, totalChosen, totalActual: g.total } : void 0;
17564
+ const comboOn = rows !== null && rows.length > 1 && g !== null && g.requestedLegs > 1 && view.legs > 1;
17565
+ const base = shown2?.base ?? NO_BASE;
17566
+ const anotherOn = comboOn && base.variants > 1 && base.variant === base.requested % base.variants;
17567
+ const committedSwapped = shown2 && shown2.trusted && (shown2.req.keep?.length ?? 0) > 0 ? shown2.req.swapped ?? [] : [];
17568
+ const swapOn = comboOn && base.supported && g.nearest !== true && shown2?.trusted === true;
17569
+ const noSwapIds = shown2?.noSwap ?? [];
17570
+ const another = () => {
17571
+ const variant = (base.variant + 1) % base.variants;
17572
+ track({ name: "combo_variant_click", surface: "builder", sport, legs: view.legs, total: totalChosen, variant });
17573
+ setTapped("another");
17574
+ send(requestFor(view, { variant }));
17575
+ };
17576
+ const swapOf = (leg, all) => {
17577
+ if (!swapOn) return void 0;
17578
+ const stuck = noSwapIds.includes(leg.matchOddsId);
17579
+ const pair = ui.v8Pair(leg.homeTeamName, leg.awayTeamName);
17580
+ const sharesGame = all.some((l) => l !== leg && l.matchId === leg.matchId);
17581
+ const focusKey = `swap-${all.indexOf(leg)}`;
17582
+ return {
17583
+ focusKey,
17584
+ label: ui.v8BuilderSwap(sharesGame ? ui.v8BuilderSwapLeg(pair, leg.market) : pair),
17585
+ disabled: stuck || busy || !confirmed,
17586
+ note: stuck ? ui.v8BuilderSwapNone : void 0,
17587
+ onSwap: () => {
17588
+ track({ name: "combo_swap_click", surface: "builder", sport, legs: view.legs, total: totalChosen });
17589
+ setTapped(focusKey);
17590
+ send(requestFor(view, { keep: all.filter((l) => l !== leg).map((l) => l.matchOddsId), swapped: [...committedSwapped, leg.matchOddsId] }));
17591
+ }
17592
+ };
17593
+ };
17489
17594
  const canWiden = gamesOptions === null || allGames !== null;
17490
- (0, import_react109.useEffect)(() => {
17595
+ (0, import_react110.useEffect)(() => {
17491
17596
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
17492
17597
  autoWidened.current = true;
17493
17598
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
17494
17599
  commit(next, true);
17495
17600
  send(requestFor(next));
17496
17601
  }, [empty2, singles, widened, canWiden, view]);
17497
- (0, import_react109.useEffect)(() => {
17602
+ (0, import_react110.useEffect)(() => {
17498
17603
  if (coolOff) onCoolOff?.(sport);
17499
17604
  }, [coolOff, onCoolOff, sport]);
17500
17605
  if (coolOff) return null;
@@ -17503,7 +17608,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17503
17608
  const nextWhen = nextAtMs !== null && nextAtMs > Date.now() ? kickoffText(ui, preset.nextGamesAtUtc) : null;
17504
17609
  const phrase = preset.nextGamesAtUtc == null ? nextGames : null;
17505
17610
  const mineGames = gamesOptions?.find((o) => o.id === view.gamesId)?.mine === true;
17506
- return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("section", { className: "ss-w-v8-sec ss-w-v8-builder", "data-testid": "v8-builder", "aria-busy": status2 === "loading" || void 0, children: conversation && paused ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "paused", children: nextWhen ? ui.v8PausedNext(nextWhen) : /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
17611
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("section", { ref: sectionRef, tabIndex: -1, className: "ss-w-v8-sec ss-w-v8-builder", "data-testid": "v8-builder", "aria-busy": status2 === "loading" || void 0, children: conversation && paused ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "paused", children: nextWhen ? ui.v8PausedNext(nextWhen) : /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
17507
17612
  ui.v8Paused,
17508
17613
  phrase ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("span", { className: "ss-w-v8-builder-next", "data-testid": "v8-next-games", children: phrase }) : null
17509
17614
  ] }) }) : conversation ? /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
@@ -17652,13 +17757,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
17652
17757
  ] }) : null,
17653
17758
  rows && rows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
17654
17759
  /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", { className: "ss-w-v8-builder-rows", children: [
17655
- grid?.nearest === true ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "nearest", children: ui.v8Nearest }) : null,
17656
- /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("ol", { className: "ss-w-combo-legs", role: "list", children: rows.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(ComboLegRow, { leg, addToSlipEnabled: !!slip.onAddToSlip, ui, slip: rowSlip, hold: !confirmed, closed: !preMatchOpen(leg.kickoffUtc, Date.now()) }, leg.key)) }),
17657
- grid && grid.requestedLegs > 1 && grid.total !== null && grid.totalFormats !== null && grid.multiplication !== null ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "ss-w-combo-math", children: oddsFormat === "decimal" ? grid.multiplication : formatOdds(grid.totalFormats, oddsFormat) }) : null,
17658
- grid && grid.requestedLegs > 1 ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AddAllToSlipButton, { legs: rows, slip: rowSlip, ui, labels: { add: ui.v8AddAll, done: ui.allInSlip }, combo, sizeless: true, hold: !confirmed, onStartedGame: () => {
17659
- setStartedNote(true);
17660
- void request(lastRequest.current);
17661
- } }) : null
17760
+ g?.nearest === true ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "ss-w-v8-builder-note", "data-kind": "nearest", children: ui.v8Nearest }) : null,
17761
+ /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("ol", { className: "ss-w-combo-legs", role: "list", tabIndex: -1, "aria-busy": busy || void 0, children: rows.map((leg) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(ComboLegRow, { leg, addToSlipEnabled: !!slip.onAddToSlip, ui, slip: rowSlip, hold: !confirmed, closed: !preMatchOpen(leg.kickoffUtc, Date.now()), swap: swapOf(leg, rows) }, leg.key)) }),
17762
+ g && g.requestedLegs > 1 && g.total !== null && g.totalFormats !== null && g.multiplication !== null ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("div", { className: "ss-w-combo-math", children: oddsFormat === "decimal" ? g.multiplication : formatOdds(g.totalFormats, oddsFormat) }) : null,
17763
+ g && g.requestedLegs > 1 ? /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)("div", { className: "ss-w-v8-builder-actions", children: [
17764
+ anotherOn ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("button", { type: "button", className: "ss-w-v8-builder-another", "data-focus": "another", disabled: busy, onClick: another, children: ui.v8BuilderAnother }) : null,
17765
+ /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AddAllToSlipButton, { legs: rows, slip: rowSlip, ui, labels: { add: ui.v8AddAll, done: ui.allInSlip }, combo, sizeless: true, hold: !confirmed, onStartedGame: () => {
17766
+ setStartedNote(true);
17767
+ void request(lastRequest.current);
17768
+ } })
17769
+ ] }) : null
17662
17770
  ] }),
17663
17771
  quotedAt ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui), ui.timeZone)) }) : null
17664
17772
  ] }) : null
@@ -17958,10 +18066,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
17958
18066
  }
17959
18067
 
17960
18068
  // src/components/PlayerPhoto.tsx
17961
- var import_react110 = require("react");
18069
+ var import_react111 = require("react");
17962
18070
  var import_jsx_runtime148 = require("react/jsx-runtime");
17963
18071
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
17964
- const [failed, setFailed] = (0, import_react110.useState)(false);
18072
+ const [failed, setFailed] = (0, import_react111.useState)(false);
17965
18073
  const box = { width: size, height: size };
17966
18074
  if (photoUrl && !failed) {
17967
18075
  return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -17996,7 +18104,7 @@ function MiniPitch({ positionCode }) {
17996
18104
  }
17997
18105
 
17998
18106
  // src/components/PerformanceBars.tsx
17999
- var import_react111 = require("react");
18107
+ var import_react112 = require("react");
18000
18108
  var import_jsx_runtime150 = require("react/jsx-runtime");
18001
18109
  var GROUPS = ["shooting", "passing", "possession", "defending"];
18002
18110
  function finite4(v) {
@@ -18042,7 +18150,7 @@ function unrankedLine(ui, reason) {
18042
18150
  }
18043
18151
  }
18044
18152
  function PerformanceBars({ performance, competitionName, strings }) {
18045
- const [mode, setMode] = (0, import_react111.useState)("total");
18153
+ const [mode, setMode] = (0, import_react112.useState)("total");
18046
18154
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
18047
18155
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
18048
18156
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -18251,8 +18359,8 @@ function SettingsSheet({ ui, onClose }) {
18251
18359
  var import_jsx_runtime153 = require("react/jsx-runtime");
18252
18360
  var FULLSCREEN_QUERY = "(max-width: 639px)";
18253
18361
  function useIsModal() {
18254
- const [modal, setModal] = (0, import_react112.useState)(false);
18255
- (0, import_react112.useEffect)(() => {
18362
+ const [modal, setModal] = (0, import_react113.useState)(false);
18363
+ (0, import_react113.useEffect)(() => {
18256
18364
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
18257
18365
  const mql = window.matchMedia(FULLSCREEN_QUERY);
18258
18366
  const sync = () => setModal(mql.matches);
@@ -18266,12 +18374,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
18266
18374
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
18267
18375
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
18268
18376
  const { state, close, stop, send, reset } = controller;
18269
- const [squadView, setSquadView] = (0, import_react112.useState)("roster");
18270
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react112.useState)(null);
18377
+ const [squadView, setSquadView] = (0, import_react113.useState)("roster");
18378
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react113.useState)(null);
18271
18379
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
18272
18380
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
18273
- const squadLayerRef = (0, import_react112.useRef)(null);
18274
- const squadScrollRef = (0, import_react112.useRef)(null);
18381
+ const squadLayerRef = (0, import_react113.useRef)(null);
18382
+ const squadScrollRef = (0, import_react113.useRef)(null);
18275
18383
  const selectPlayer = (playerId) => {
18276
18384
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
18277
18385
  setSelectedPlayerId(playerId);
@@ -18281,7 +18389,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18281
18389
  setSelectedPlayerId(null);
18282
18390
  clearPlayerDetail?.();
18283
18391
  };
18284
- (0, import_react112.useLayoutEffect)(() => {
18392
+ (0, import_react113.useLayoutEffect)(() => {
18285
18393
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
18286
18394
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
18287
18395
  if (list) list.scrollTop = squadScrollRef.current;
@@ -18294,7 +18402,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18294
18402
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
18295
18403
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
18296
18404
  const activeTab = tabs?.activeTab;
18297
- (0, import_react112.useEffect)(() => {
18405
+ (0, import_react113.useEffect)(() => {
18298
18406
  if (activeTab === "squad" || selectedPlayerId === null) return;
18299
18407
  setSelectedPlayerId(null);
18300
18408
  clearPlayerDetail?.();
@@ -18303,11 +18411,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18303
18411
  const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
18304
18412
  const favouritesAskedOpen = favourites?.open ?? false;
18305
18413
  const setFavouritesOpen = favourites?.onOpenChange;
18306
- (0, import_react112.useEffect)(() => {
18414
+ (0, import_react113.useEffect)(() => {
18307
18415
  if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
18308
18416
  }, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
18309
18417
  const storedTab = tabState?.activeTab;
18310
- (0, import_react112.useEffect)(() => {
18418
+ (0, import_react113.useEffect)(() => {
18311
18419
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
18312
18420
  if (unreachable) setMonitorTab?.("chat");
18313
18421
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -18316,12 +18424,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18316
18424
  const closeTab = tabs?.activeTab ?? "chat";
18317
18425
  const lastMessage = state.messages[state.messages.length - 1];
18318
18426
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
18319
- const closeWith = (0, import_react112.useCallback)((method) => {
18427
+ const closeWith = (0, import_react113.useCallback)((method) => {
18320
18428
  track({ name: "widget_close", method, tab: closeTab, answering });
18321
18429
  if (onCloseRequested) onCloseRequested();
18322
18430
  else close();
18323
18431
  }, [track, closeTab, answering, close, onCloseRequested]);
18324
- (0, import_react112.useEffect)(() => {
18432
+ (0, import_react113.useEffect)(() => {
18325
18433
  const onKey = (e) => {
18326
18434
  if (e.key === "Escape") closeWith("escape");
18327
18435
  };
@@ -18337,80 +18445,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18337
18445
  tabs?.setActiveTab("chat");
18338
18446
  send(text2, { grounding, source });
18339
18447
  };
18340
- (0, import_react112.useEffect)(() => {
18448
+ (0, import_react113.useEffect)(() => {
18341
18449
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
18342
18450
  }, [monitor, state.isStreaming, state.messages.length]);
18343
18451
  const onChatTab = !tabs || tabs.activeTab === "chat";
18344
- const inputRef = (0, import_react112.useRef)(null);
18345
- const limitRef = (0, import_react112.useRef)(null);
18346
- const typedSendRef = (0, import_react112.useRef)(false);
18347
- const focusAfterCloseRef = (0, import_react112.useRef)(null);
18348
- const [tool, setTool] = (0, import_react112.useState)(null);
18349
- const panelRef = (0, import_react112.useRef)(null);
18452
+ const inputRef = (0, import_react113.useRef)(null);
18453
+ const limitRef = (0, import_react113.useRef)(null);
18454
+ const typedSendRef = (0, import_react113.useRef)(false);
18455
+ const focusAfterCloseRef = (0, import_react113.useRef)(null);
18456
+ const [tool, setTool] = (0, import_react113.useState)(null);
18457
+ const panelRef = (0, import_react113.useRef)(null);
18350
18458
  const settings = useOddsSettings();
18351
- const [settingsOpen, setSettingsOpen] = (0, import_react112.useState)(false);
18459
+ const [settingsOpen, setSettingsOpen] = (0, import_react113.useState)(false);
18352
18460
  const hasSettings = settings.oddsOffered || !settings.themeLocked;
18353
- const openSettings = (0, import_react112.useCallback)(() => {
18461
+ const openSettings = (0, import_react113.useCallback)(() => {
18354
18462
  setTool(null);
18355
18463
  setFavouritesOpen?.(false);
18356
18464
  setSettingsOpen(true);
18357
18465
  }, [setFavouritesOpen]);
18358
- const closeSettings = (0, import_react112.useCallback)(() => {
18466
+ const closeSettings = (0, import_react113.useCallback)(() => {
18359
18467
  setSettingsOpen(false);
18360
18468
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
18361
18469
  }, []);
18362
- const openFavourites = (0, import_react112.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
18363
- const closeFavourites = (0, import_react112.useCallback)(() => {
18470
+ const openFavourites = (0, import_react113.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
18471
+ const closeFavourites = (0, import_react113.useCallback)(() => {
18364
18472
  setFavouritesOpen?.(false);
18365
18473
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
18366
18474
  }, [setFavouritesOpen]);
18367
- (0, import_react112.useEffect)(() => {
18475
+ (0, import_react113.useEffect)(() => {
18368
18476
  if (!favouritesOpen) return;
18369
18477
  setTool(null);
18370
18478
  setSettingsOpen(false);
18371
18479
  }, [favouritesOpen]);
18372
18480
  const paused = isPaused(state.limit);
18373
- (0, import_react112.useEffect)(() => {
18481
+ (0, import_react113.useEffect)(() => {
18374
18482
  if (paused) setTool(null);
18375
18483
  }, [paused]);
18376
- (0, import_react112.useEffect)(() => {
18484
+ (0, import_react113.useEffect)(() => {
18377
18485
  if (!paused) return;
18378
18486
  if (typedSendRef.current) limitRef.current?.focus();
18379
18487
  typedSendRef.current = false;
18380
18488
  }, [paused]);
18381
- const openTool = (0, import_react112.useCallback)((next) => {
18489
+ const openTool = (0, import_react113.useCallback)((next) => {
18382
18490
  setTool(next);
18383
18491
  }, []);
18384
- const toolsValue = (0, import_react112.useMemo)(
18492
+ const toolsValue = (0, import_react113.useMemo)(
18385
18493
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
18386
18494
  [presetGrid, paused, openTool, ui.presets.changeCombo]
18387
18495
  );
18388
- const closeTool = (0, import_react112.useCallback)(() => {
18496
+ const closeTool = (0, import_react113.useCallback)(() => {
18389
18497
  focusAfterCloseRef.current = "composer";
18390
18498
  setTool(null);
18391
18499
  }, []);
18392
- const sendAsk = (0, import_react112.useCallback)((ask) => {
18500
+ const sendAsk = (0, import_react113.useCallback)((ask) => {
18393
18501
  focusAfterCloseRef.current = "composer";
18394
18502
  setTool(null);
18395
18503
  tabs?.setActiveTab("chat");
18396
18504
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
18397
18505
  }, [tabs, send]);
18398
- const formatKickoff = (0, import_react112.useCallback)((kickoffUtc) => {
18506
+ const formatKickoff = (0, import_react113.useCallback)((kickoffUtc) => {
18399
18507
  const k = ui.bettingKickoff(kickoffUtc);
18400
18508
  return `${k.dayLabel} ${k.time}`;
18401
18509
  }, [ui]);
18402
- (0, import_react112.useEffect)(() => {
18510
+ (0, import_react113.useEffect)(() => {
18403
18511
  if (tool) return;
18404
18512
  const target = focusAfterCloseRef.current;
18405
18513
  focusAfterCloseRef.current = null;
18406
18514
  if (target === "composer") inputRef.current?.focus();
18407
18515
  }, [tool]);
18408
- (0, import_react112.useEffect)(() => {
18516
+ (0, import_react113.useEffect)(() => {
18409
18517
  if (!tool || onChatTab && presetGrid) return;
18410
18518
  focusAfterCloseRef.current = "composer";
18411
18519
  setTool(null);
18412
18520
  }, [tool, onChatTab, presetGrid]);
18413
- const backRef = (0, import_react112.useRef)(() => false);
18521
+ const backRef = (0, import_react113.useRef)(() => false);
18414
18522
  backRef.current = () => {
18415
18523
  if (favouritesOpen) {
18416
18524
  closeFavourites();
@@ -18434,7 +18542,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
18434
18542
  }
18435
18543
  return false;
18436
18544
  };
18437
- (0, import_react112.useEffect)(() => {
18545
+ (0, import_react113.useEffect)(() => {
18438
18546
  if (!onRegisterBack) return;
18439
18547
  onRegisterBack(() => backRef.current());
18440
18548
  return () => onRegisterBack(null);
@@ -19231,6 +19339,11 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
19231
19339
  .ss-w-combo-leg-pick .ss-w-slip-btn { flex: none; }
19232
19340
  .ss-w-combo-leg .ss-w-bi-team { white-space: normal; text-overflow: clip; overflow-wrap: break-word; line-height: 1.25; }
19233
19341
  .ss-w-combo-leg-pick .ss-w-toast { position: static; flex-basis: 100%; width: auto; max-width: none; box-shadow: none; }
19342
+ .ss-w-combo-leg-swap { flex: none; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 32px; height: 32px; margin-left: auto; padding: 0; border: 1px solid var(--ss-w-line); border-radius: 50%; background: transparent; color: var(--ss-w-ink); cursor: pointer; }
19343
+ .ss-w-combo-leg-swap:hover:not(:disabled) { border-color: var(--ss-w-accent); }
19344
+ .ss-w-combo-leg-swap:disabled { cursor: default; opacity: .4; }
19345
+ .ss-w-combo-leg-swapnone { margin: 0; font-size: 12px; line-height: 1.4; color: var(--ss-w-faint); }
19346
+ .ss-w-combo-leg-swapnone:empty { margin-top: -5px; }
19234
19347
  .ss-w-combo-leg-stat { font-size: 12px; line-height: 1.45; color: var(--ss-w-ink); background: var(--ss-w-bubble); border-radius: 8px; padding: 6px 9px; }
19235
19348
  .ss-w-combo-math { font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; line-height: 1.4; color: var(--ss-w-ink); text-align: right; background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
19236
19349
  .ss-w-combo-note { font-size: 11px; line-height: 1.4; color: var(--ss-w-faint); }
@@ -20322,6 +20435,10 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
20322
20435
  .ss-w-v8-builder > .ss-w-v8-builder-btn { align-self: flex-start; min-height: 40px; padding: 6px 14px; }
20323
20436
  .ss-w-v8-builder .ss-w-slip-btn { min-height: 36px; }
20324
20437
  .ss-w-v8-builder .ss-w-combo-addall .ss-w-slip-btn { min-height: 44px; }
20438
+ .ss-w-v8-builder-actions { display: flex; align-items: stretch; gap: 8px; }
20439
+ .ss-w-v8-builder-actions > .ss-w-combo-addall { flex: 1 1 0; min-width: 0; }
20440
+ .ss-w-v8-builder-another { flex: 0 1 auto; align-self: flex-start; max-width: 50%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--ss-w-line); border-radius: 22px; background: transparent; color: var(--ss-w-ink); font: inherit; font-size: 14px; font-weight: 650; line-height: 1.15; overflow-wrap: normal; word-break: normal; cursor: pointer; }
20441
+ .ss-w-v8-builder-another:hover { border-color: var(--ss-w-accent); }
20325
20442
  .ss-w-fav .ss-w-dash-sport { min-height: 36px; }
20326
20443
  .ss-w-v8-builder-note { margin: 0; font-size: 12.5px; line-height: 1.35; color: color-mix(in srgb, #fff 78%, var(--ss-w-nav)); }
20327
20444
  .ss-w-v8-builder-note[data-kind] { padding: 10px 12px; border-radius: 10px; background: var(--ss-v8-chip); color: #dce8e1; font-size: 13.5px; }
@@ -21418,7 +21535,7 @@ function buildClient(props) {
21418
21535
  return { client: props.client, conversation: props.client.conversation() };
21419
21536
  }
21420
21537
  const cfg = props.config;
21421
- const client = new import_widget_sdk38.StatsWidgetClient(toClientOptions(cfg));
21538
+ const client = new import_widget_sdk39.StatsWidgetClient(toClientOptions(cfg));
21422
21539
  return { client, conversation: client.conversation(toUserContext(cfg)) };
21423
21540
  } catch (err) {
21424
21541
  console.error("[StatsWidget] failed to initialize:", err instanceof Error ? err.message : err);
@@ -21436,12 +21553,12 @@ function injectStyles(root) {
21436
21553
  function StatsWidget(props) {
21437
21554
  const injectedClient = "client" in props ? props.client : void 0;
21438
21555
  const cfg = props.config;
21439
- const built = (0, import_react113.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
21440
- const trackingRef = (0, import_react113.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
21441
- const track = (0, import_react113.useMemo)(() => createTracker(() => trackingRef.current), []);
21442
- const eventTextRef = (0, import_react113.useRef)(false);
21556
+ const built = (0, import_react114.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
21557
+ const trackingRef = (0, import_react114.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
21558
+ const track = (0, import_react114.useMemo)(() => createTracker(() => trackingRef.current), []);
21559
+ const eventTextRef = (0, import_react114.useRef)(false);
21443
21560
  eventTextRef.current = cfg?.eventText === true;
21444
- const logger = (0, import_react113.useMemo)(() => {
21561
+ const logger = (0, import_react114.useMemo)(() => {
21445
21562
  if (!built) return null;
21446
21563
  const raw = built.client.createEventLogger({
21447
21564
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -21451,27 +21568,27 @@ function StatsWidget(props) {
21451
21568
  }, [built?.client, track]);
21452
21569
  const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
21453
21570
  const stringsPending = widgetStrings.strings === void 0;
21454
- const ui = (0, import_react113.useMemo)(
21571
+ const ui = (0, import_react114.useMemo)(
21455
21572
  () => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
21456
21573
  [props.config, widgetStrings.strings]
21457
21574
  );
21458
21575
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
21459
- const rootRef = (0, import_react113.useRef)(null);
21460
- const introDoneRef = (0, import_react113.useRef)(false);
21461
- const markIntroDone = (0, import_react113.useCallback)(() => {
21576
+ const rootRef = (0, import_react114.useRef)(null);
21577
+ const introDoneRef = (0, import_react114.useRef)(false);
21578
+ const markIntroDone = (0, import_react114.useCallback)(() => {
21462
21579
  introDoneRef.current = true;
21463
21580
  }, []);
21464
21581
  const language = injectedClient ? void 0 : hostTag(cfg);
21465
21582
  const threadLanguage = familyOf(language);
21466
21583
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
21467
- const sportScope = (0, import_react113.useMemo)(
21584
+ const sportScope = (0, import_react114.useMemo)(
21468
21585
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
21469
21586
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
21470
21587
  );
21471
- const chatTracking = (0, import_react113.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
21588
+ const chatTracking = (0, import_react114.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
21472
21589
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
21473
21590
  const panelOpen = controller.state.isOpen && !stringsPending;
21474
- const liveCardWatches = (0, import_react113.useMemo)(() => {
21591
+ const liveCardWatches = (0, import_react114.useMemo)(() => {
21475
21592
  const seen2 = /* @__PURE__ */ new Set();
21476
21593
  const out = [];
21477
21594
  for (const msg of controller.state.messages) {
@@ -21497,19 +21614,19 @@ function StatsWidget(props) {
21497
21614
  });
21498
21615
  const operatorUserId = cfg?.userContext?.operatorUserId;
21499
21616
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
21500
- const getSchedule = (0, import_react113.useCallback)(
21617
+ const getSchedule = (0, import_react114.useCallback)(
21501
21618
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
21502
21619
  [built, operatorUserId, anonymousUserId]
21503
21620
  );
21504
- const getStates = (0, import_react113.useCallback)(
21621
+ const getStates = (0, import_react114.useCallback)(
21505
21622
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
21506
21623
  [built, requestTag]
21507
21624
  );
21508
- const getTennisPrices = (0, import_react113.useCallback)(
21625
+ const getTennisPrices = (0, import_react114.useCallback)(
21509
21626
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
21510
21627
  [built, requestTag]
21511
21628
  );
21512
- const pinnedMatchIds = (0, import_react113.useMemo)(
21629
+ const pinnedMatchIds = (0, import_react114.useMemo)(
21513
21630
  () => footballMatchPinIds(monitor.pins),
21514
21631
  [monitor.pins]
21515
21632
  );
@@ -21523,13 +21640,13 @@ function StatsWidget(props) {
21523
21640
  pinnedMatchIds,
21524
21641
  timeZone: ui.timeZone
21525
21642
  });
21526
- const offeredSports = (0, import_react113.useMemo)(() => {
21643
+ const offeredSports = (0, import_react114.useMemo)(() => {
21527
21644
  const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
21528
21645
  for (const g of discovery.groups) seen2.add(g.sport ?? "football");
21529
21646
  return [...seen2];
21530
21647
  }, [discovery.matchDays, discovery.groups]);
21531
21648
  const scheduleSport = useScheduleSport(offeredSports);
21532
- const [liveLeague, setLiveLeague] = (0, import_react113.useState)(null);
21649
+ const [liveLeague, setLiveLeague] = (0, import_react114.useState)(null);
21533
21650
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
21534
21651
  const matchesLoaded = useMatchesDay({
21535
21652
  discovery,
@@ -21539,8 +21656,8 @@ function StatsWidget(props) {
21539
21656
  enabled: panelOpen && monitor.activeTab === "matches",
21540
21657
  timeZone: ui.timeZone
21541
21658
  });
21542
- const prevLiveSnapshotRef = (0, import_react113.useRef)(monitor.snapshot);
21543
- (0, import_react113.useEffect)(() => {
21659
+ const prevLiveSnapshotRef = (0, import_react114.useRef)(monitor.snapshot);
21660
+ (0, import_react114.useEffect)(() => {
21544
21661
  const snap = monitor.snapshot;
21545
21662
  if (!snap || snap === prevLiveSnapshotRef.current) return;
21546
21663
  prevLiveSnapshotRef.current = snap;
@@ -21580,14 +21697,14 @@ function StatsWidget(props) {
21580
21697
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
21581
21698
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
21582
21699
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
21583
- const [favSportPick, setFavSportPick] = (0, import_react113.useState)(null);
21584
- const latestGreeting = (0, import_react113.useMemo)(() => {
21700
+ const [favSportPick, setFavSportPick] = (0, import_react114.useState)(null);
21701
+ const latestGreeting = (0, import_react114.useMemo)(() => {
21585
21702
  for (const m of [...controller.state.messages].reverse()) {
21586
21703
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
21587
21704
  }
21588
21705
  return null;
21589
21706
  }, [controller.state.messages]);
21590
- const favSportOptions = (0, import_react113.useMemo)(
21707
+ const favSportOptions = (0, import_react114.useMemo)(
21591
21708
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
21592
21709
  [latestGreeting]
21593
21710
  );
@@ -21596,20 +21713,20 @@ function StatsWidget(props) {
21596
21713
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
21597
21714
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
21598
21715
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
21599
- const [builderSportPick, setBuilderSportPick] = (0, import_react113.useState)(null);
21600
- const builderGreeting = (0, import_react113.useMemo)(
21716
+ const [builderSportPick, setBuilderSportPick] = (0, import_react114.useState)(null);
21717
+ const builderGreeting = (0, import_react114.useMemo)(
21601
21718
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
21602
21719
  [controller.state.messages]
21603
21720
  );
21604
- const [coolOff, setCoolOff] = (0, import_react113.useState)(null);
21605
- const onBuilderCoolOff = (0, import_react113.useCallback)((sport) => {
21721
+ const [coolOff, setCoolOff] = (0, import_react114.useState)(null);
21722
+ const onBuilderCoolOff = (0, import_react114.useCallback)((sport) => {
21606
21723
  if (!builderGreeting) return;
21607
21724
  setCoolOff((prev) => {
21608
21725
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
21609
21726
  return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
21610
21727
  });
21611
21728
  }, [builderGreeting]);
21612
- const builderOptions = (0, import_react113.useMemo)(() => {
21729
+ const builderOptions = (0, import_react114.useMemo)(() => {
21613
21730
  const greeting = builderGreeting;
21614
21731
  if (!greeting) return [];
21615
21732
  const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
@@ -21622,7 +21739,7 @@ function StatsWidget(props) {
21622
21739
  return options.filter((o) => !cooled.includes(o.sport));
21623
21740
  }, [builderGreeting, coolOff, ui]);
21624
21741
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
21625
- const [panelEverOpened, setPanelEverOpened] = (0, import_react113.useState)(panelOpen);
21742
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react114.useState)(panelOpen);
21626
21743
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
21627
21744
  const favourites = useFavourites({
21628
21745
  conversation: built?.conversation ?? null,
@@ -21634,16 +21751,16 @@ function StatsWidget(props) {
21634
21751
  onChanged: discovery.refreshSchedule
21635
21752
  });
21636
21753
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
21637
- const [favouritesOpen, setFavouritesOpen] = (0, import_react113.useState)(false);
21754
+ const [favouritesOpen, setFavouritesOpen] = (0, import_react114.useState)(false);
21638
21755
  if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
21639
- const getPricePresets = (0, import_react113.useCallback)(
21756
+ const getPricePresets = (0, import_react114.useCallback)(
21640
21757
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
21641
21758
  [built]
21642
21759
  );
21643
21760
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
21644
21761
  const markLiveActivity = monitor.markLiveActivity;
21645
- const prevLiveCountRef = (0, import_react113.useRef)(0);
21646
- (0, import_react113.useEffect)(() => {
21762
+ const prevLiveCountRef = (0, import_react114.useRef)(0);
21763
+ (0, import_react114.useEffect)(() => {
21647
21764
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
21648
21765
  prevLiveCountRef.current = discovery.liveCount;
21649
21766
  if (rose) markLiveActivity();
@@ -21657,7 +21774,7 @@ function StatsWidget(props) {
21657
21774
  closePanel: controller.close
21658
21775
  });
21659
21776
  const markAdded = hostEvents.markAdded;
21660
- const slip = (0, import_react113.useMemo)(
21777
+ const slip = (0, import_react114.useMemo)(
21661
21778
  () => {
21662
21779
  const handler = props.config?.onAddToSlip;
21663
21780
  return {
@@ -21677,7 +21794,7 @@ function StatsWidget(props) {
21677
21794
  },
21678
21795
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
21679
21796
  );
21680
- const onDashboardTap = (0, import_react113.useMemo)(
21797
+ const onDashboardTap = (0, import_react114.useMemo)(
21681
21798
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
21682
21799
  [built, logger]
21683
21800
  );
@@ -21691,7 +21808,7 @@ function StatsWidget(props) {
21691
21808
  log: logger
21692
21809
  })
21693
21810
  }));
21694
- const dismissPopupRef = (0, import_react113.useRef)(() => {
21811
+ const dismissPopupRef = (0, import_react114.useRef)(() => {
21695
21812
  });
21696
21813
  const mobile = useMobileBinding({
21697
21814
  binding: props.mobile,
@@ -21706,15 +21823,15 @@ function StatsWidget(props) {
21706
21823
  dismissPopupRef.current = dismissPopup;
21707
21824
  const greetingMeta = latestGreetingMeta(controller.state.messages);
21708
21825
  useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, props.mobile ? void 0 : greetingMeta, mobile.confirmedShown);
21709
- const onBubbleClick = (0, import_react113.useCallback)(() => {
21826
+ const onBubbleClick = (0, import_react114.useCallback)(() => {
21710
21827
  if (!logger || !greetingMeta) return;
21711
21828
  logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
21712
21829
  }, [logger, greetingMeta]);
21713
21830
  useOpenTelemetry(logger, panelOpen);
21714
- const onControlRef = (0, import_react113.useRef)(props.onControl);
21831
+ const onControlRef = (0, import_react114.useRef)(props.onControl);
21715
21832
  onControlRef.current = props.onControl;
21716
21833
  const { open: openPanel, close: closePanel } = controller;
21717
- (0, import_react113.useEffect)(() => {
21834
+ (0, import_react114.useEffect)(() => {
21718
21835
  onControlRef.current?.({ open: openPanel, close: closePanel });
21719
21836
  return () => onControlRef.current?.(null);
21720
21837
  }, [openPanel, closePanel]);
@@ -21731,11 +21848,11 @@ function StatsWidget(props) {
21731
21848
  page: cfg?.page
21732
21849
  }
21733
21850
  };
21734
- (0, import_react113.useEffect)(() => {
21851
+ (0, import_react114.useEffect)(() => {
21735
21852
  if (!logger) return;
21736
21853
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
21737
21854
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
21738
- (0, import_react113.useEffect)(() => {
21855
+ (0, import_react114.useEffect)(() => {
21739
21856
  if (!logger) return;
21740
21857
  logger.resume();
21741
21858
  const onHide = () => {
@@ -21753,15 +21870,15 @@ function StatsWidget(props) {
21753
21870
  logger.dispose();
21754
21871
  };
21755
21872
  }, [logger]);
21756
- (0, import_react113.useEffect)(() => {
21873
+ (0, import_react114.useEffect)(() => {
21757
21874
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
21758
21875
  const node = rootRef.current?.getRootNode();
21759
21876
  if (node) injectStyles(node);
21760
21877
  }, [built, ui.injectStyles, widgetStrings.state]);
21761
21878
  const holds = useSessionHolds();
21762
21879
  const builderConversation = built?.conversation ?? null;
21763
- const builderMemory = (0, import_react113.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
21764
- const personalGreeting = (0, import_react113.useMemo)(() => ({
21880
+ const builderMemory = (0, import_react114.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
21881
+ const personalGreeting = (0, import_react114.useMemo)(() => ({
21765
21882
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
21766
21883
  conversation: built?.conversation ?? null,
21767
21884
  openFavourites: () => setFavouritesOpen(true),