@sensiblestats/widget-react 0.156.0 → 0.157.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -38,7 +38,7 @@ __export(index_exports, {
38
38
  module.exports = __toCommonJS(index_exports);
39
39
 
40
40
  // src/StatsWidget.tsx
41
- var import_react123 = require("react");
41
+ var import_react124 = require("react");
42
42
  var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
43
43
 
44
44
  // src/strings/tag.ts
@@ -1422,7 +1422,7 @@ function parseCustomTotal(text2, format2) {
1422
1422
  }
1423
1423
 
1424
1424
  // src/version.generated.ts
1425
- var WIDGET_REACT_VERSION = "0.156.0";
1425
+ var WIDGET_REACT_VERSION = "0.157.0";
1426
1426
 
1427
1427
  // src/config.ts
1428
1428
  var COLOR_KEYS = ["accent", "cta", "surface", "ink"];
@@ -8457,6 +8457,14 @@ function useMobileBinding(args) {
8457
8457
  });
8458
8458
  return () => binding.onHandle(null);
8459
8459
  }, [binding]);
8460
+ const { labels, theme } = args;
8461
+ const labelsKey = labels ? JSON.stringify([labels.launcher, labels.dismiss]) : "";
8462
+ (0, import_react56.useEffect)(() => {
8463
+ if (labels) binding?.onLabels?.(labels);
8464
+ }, [binding, labelsKey]);
8465
+ (0, import_react56.useEffect)(() => {
8466
+ if (theme) binding?.onTheme?.(theme);
8467
+ }, [binding, theme]);
8460
8468
  const onCloseRequested = (0, import_react56.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
8461
8469
  const onRegisterBack = (0, import_react56.useCallback)((fn) => {
8462
8470
  backRef.current = fn;
@@ -8532,11 +8540,33 @@ function webTeaserBinding(host, deliver, drawsLauncher) {
8532
8540
  };
8533
8541
  }
8534
8542
 
8535
- // src/openTelemetry.ts
8543
+ // src/resolvedTheme.ts
8536
8544
  var import_react57 = require("react");
8545
+ var QUERY = "(prefers-color-scheme: dark)";
8546
+ function systemDark() {
8547
+ try {
8548
+ return typeof window.matchMedia === "function" && window.matchMedia(QUERY).matches;
8549
+ } catch {
8550
+ return false;
8551
+ }
8552
+ }
8553
+ function subscribe(onChange) {
8554
+ if (typeof window.matchMedia !== "function") return () => {
8555
+ };
8556
+ const query = window.matchMedia(QUERY);
8557
+ query.addEventListener("change", onChange);
8558
+ return () => query.removeEventListener("change", onChange);
8559
+ }
8560
+ function useResolvedTheme(choice) {
8561
+ const dark = (0, import_react57.useSyncExternalStore)(subscribe, systemDark, () => false);
8562
+ return choice === "auto" ? dark ? "dark" : "light" : choice;
8563
+ }
8564
+
8565
+ // src/openTelemetry.ts
8566
+ var import_react58 = require("react");
8537
8567
  function useOpenTelemetry(log, isOpen) {
8538
- const openLoggedRef = (0, import_react57.useRef)(false);
8539
- (0, import_react57.useEffect)(() => {
8568
+ const openLoggedRef = (0, import_react58.useRef)(false);
8569
+ (0, import_react58.useEffect)(() => {
8540
8570
  if (!isOpen) {
8541
8571
  openLoggedRef.current = false;
8542
8572
  return;
@@ -8548,13 +8578,13 @@ function useOpenTelemetry(log, isOpen) {
8548
8578
  }
8549
8579
 
8550
8580
  // src/components/ChatFab.tsx
8551
- var import_react59 = require("react");
8581
+ var import_react60 = require("react");
8552
8582
 
8553
8583
  // src/components/BrandMark.tsx
8554
- var import_react58 = require("react");
8584
+ var import_react59 = require("react");
8555
8585
  var import_jsx_runtime34 = require("react/jsx-runtime");
8556
8586
  function BrandMark({ logoUrl, className }) {
8557
- const [failed, setFailed] = (0, import_react58.useState)(false);
8587
+ const [failed, setFailed] = (0, import_react59.useState)(false);
8558
8588
  if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SsMark, { className });
8559
8589
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
8560
8590
  }
@@ -8598,9 +8628,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
8598
8628
  const bubble = popupText ?? greeting;
8599
8629
  const hidden = busy && !label;
8600
8630
  const track = useTrack();
8601
- const [intro, setIntro] = (0, import_react59.useState)(false);
8602
- const armedRef = (0, import_react59.useRef)(introAllowed);
8603
- (0, import_react59.useEffect)(() => {
8631
+ const [intro, setIntro] = (0, import_react60.useState)(false);
8632
+ const armedRef = (0, import_react60.useRef)(introAllowed);
8633
+ (0, import_react60.useEffect)(() => {
8604
8634
  if (armedRef.current && bubble) {
8605
8635
  armedRef.current = false;
8606
8636
  setIntro(true);
@@ -8621,23 +8651,23 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
8621
8651
  }
8622
8652
 
8623
8653
  // src/components/BubblePrice.tsx
8624
- var import_react60 = require("react");
8654
+ var import_react61 = require("react");
8625
8655
  var import_jsx_runtime37 = require("react/jsx-runtime");
8626
8656
  function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
8627
- const selections = (0, import_react60.useMemo)(() => [price.selection], [price.selection]);
8657
+ const selections = (0, import_react61.useMemo)(() => [price.selection], [price.selection]);
8628
8658
  const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
8629
8659
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "ss-w-greeting-pick", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, rowLabel: price.label || price.selection.label, sport, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 }) });
8630
8660
  }
8631
8661
 
8632
8662
  // src/components/MobileBubblePrice.tsx
8633
- var import_react61 = require("react");
8663
+ var import_react62 = require("react");
8634
8664
  function MobileBubblePrice(props) {
8635
8665
  const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
8636
8666
  const marks = useSettledMarks();
8637
- const latest = (0, import_react61.useRef)({ props, add, marks });
8667
+ const latest = (0, import_react62.useRef)({ props, add, marks });
8638
8668
  latest.current = { props, add, marks };
8639
8669
  const { onRegister, inFlight: inFlight2 } = props;
8640
- (0, import_react61.useEffect)(() => {
8670
+ (0, import_react62.useEffect)(() => {
8641
8671
  onRegister(() => {
8642
8672
  const { props: p, add: run, marks: m } = latest.current;
8643
8673
  const id = p.price.selection.matchOddsId;
@@ -8673,10 +8703,10 @@ function MobileBubblePrice(props) {
8673
8703
  }
8674
8704
 
8675
8705
  // src/components/ChatPanel.tsx
8676
- var import_react122 = require("react");
8706
+ var import_react123 = require("react");
8677
8707
 
8678
8708
  // src/components/ChatHeader.tsx
8679
- var import_react62 = require("react");
8709
+ var import_react63 = require("react");
8680
8710
  var import_jsx_runtime38 = require("react/jsx-runtime");
8681
8711
  function ChatHeader({
8682
8712
  onClose,
@@ -8692,18 +8722,18 @@ function ChatHeader({
8692
8722
  onOpenFavourites,
8693
8723
  favouritesLabel
8694
8724
  }) {
8695
- const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
8696
- const wrapRef = (0, import_react62.useRef)(null);
8697
- const kebabRef = (0, import_react62.useRef)(null);
8698
- const firstItemRef = (0, import_react62.useRef)(null);
8725
+ const [menuOpen, setMenuOpen] = (0, import_react63.useState)(false);
8726
+ const wrapRef = (0, import_react63.useRef)(null);
8727
+ const kebabRef = (0, import_react63.useRef)(null);
8728
+ const firstItemRef = (0, import_react63.useRef)(null);
8699
8729
  const hasNew = !!(canReset && onNewConversation);
8700
8730
  const hasSettings = !!onOpenSettings;
8701
8731
  const hasFavourites = !!onOpenFavourites;
8702
8732
  const hasMenu = hasFavourites || hasNew || hasSettings;
8703
- (0, import_react62.useEffect)(() => {
8733
+ (0, import_react63.useEffect)(() => {
8704
8734
  if (menuOpen) firstItemRef.current?.focus();
8705
8735
  }, [menuOpen]);
8706
- (0, import_react62.useEffect)(() => {
8736
+ (0, import_react63.useEffect)(() => {
8707
8737
  if (!menuOpen) return;
8708
8738
  const onPointer = (e) => {
8709
8739
  if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
@@ -8791,10 +8821,10 @@ function ChatHeader({
8791
8821
  }
8792
8822
 
8793
8823
  // src/components/MessageList.tsx
8794
- var import_react77 = require("react");
8824
+ var import_react78 = require("react");
8795
8825
 
8796
8826
  // src/components/ChatMessage.tsx
8797
- var import_react76 = require("react");
8827
+ var import_react77 = require("react");
8798
8828
 
8799
8829
  // src/components/Markdown.tsx
8800
8830
  var import_react_markdown = __toESM(require("react-markdown"), 1);
@@ -8812,7 +8842,7 @@ function Markdown({ text: text2 }) {
8812
8842
  }
8813
8843
 
8814
8844
  // src/components/EntityCardList.tsx
8815
- var import_react63 = require("react");
8845
+ var import_react64 = require("react");
8816
8846
  var import_jsx_runtime40 = require("react/jsx-runtime");
8817
8847
  var MAX_VISIBLE = 3;
8818
8848
  var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
@@ -8915,7 +8945,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
8915
8945
  )) });
8916
8946
  }
8917
8947
  function EntityCardItem({ c }) {
8918
- const [active, setActive] = (0, import_react63.useState)(0);
8948
+ const [active, setActive] = (0, import_react64.useState)(0);
8919
8949
  const hasBody = c.scopes.length > 0;
8920
8950
  if (!hasBody) {
8921
8951
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
@@ -8930,7 +8960,7 @@ function EntityCardItem({ c }) {
8930
8960
  ] });
8931
8961
  }
8932
8962
  function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
8933
- const [expanded, setExpanded] = (0, import_react63.useState)(false);
8963
+ const [expanded, setExpanded] = (0, import_react64.useState)(false);
8934
8964
  if (cards.length === 0) return null;
8935
8965
  const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
8936
8966
  const overflow = cards.length - MAX_VISIBLE;
@@ -9079,20 +9109,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
9079
9109
  }
9080
9110
 
9081
9111
  // src/components/ComboCardList.tsx
9082
- var import_react66 = require("react");
9112
+ var import_react67 = require("react");
9083
9113
 
9084
9114
  // src/components/AddAllToSlipButton.tsx
9085
- var import_react64 = require("react");
9115
+ var import_react65 = require("react");
9086
9116
  var import_jsx_runtime43 = require("react/jsx-runtime");
9087
9117
  function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
9088
9118
  const add = useSlipAdd(slip, ui);
9089
9119
  const slipState = useSlipState();
9090
9120
  const log = useEventLog();
9091
9121
  const track = useTrack();
9092
- const [pending, setPending] = (0, import_react64.useState)(false);
9093
- const [settledLocal, setSettledLocal] = (0, import_react64.useState)({});
9094
- const [toast, setToast] = (0, import_react64.useState)(null);
9095
- const dismiss = (0, import_react64.useCallback)(() => setToast(null), []);
9122
+ const [pending, setPending] = (0, import_react65.useState)(false);
9123
+ const [settledLocal, setSettledLocal] = (0, import_react65.useState)({});
9124
+ const [toast, setToast] = (0, import_react65.useState)(null);
9125
+ const dismiss = (0, import_react65.useCallback)(() => setToast(null), []);
9096
9126
  if (!slip.onAddToSlip || legs.length < 2) return null;
9097
9127
  const settled = slipState ? slipState.settled : settledLocal;
9098
9128
  const open = legs.filter((leg) => !settled[slipKey(leg)]);
@@ -9165,10 +9195,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
9165
9195
  }
9166
9196
 
9167
9197
  // src/presetToolsContext.ts
9168
- var import_react65 = require("react");
9169
- var PresetToolsContext = (0, import_react65.createContext)(null);
9198
+ var import_react66 = require("react");
9199
+ var PresetToolsContext = (0, import_react66.createContext)(null);
9170
9200
  function usePresetTools() {
9171
- return (0, import_react65.useContext)(PresetToolsContext);
9201
+ return (0, import_react66.useContext)(PresetToolsContext);
9172
9202
  }
9173
9203
 
9174
9204
  // src/components/ComboCardList.tsx
@@ -9182,7 +9212,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
9182
9212
  const showPin = !!monitor && leg.pinEnabled;
9183
9213
  const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
9184
9214
  const line = leg.statText ?? factText;
9185
- const noteId = (0, import_react66.useId)();
9215
+ const noteId = (0, import_react67.useId)();
9186
9216
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
9187
9217
  leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
9188
9218
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
@@ -9806,7 +9836,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
9806
9836
  }
9807
9837
 
9808
9838
  // src/components/NflInsightList.tsx
9809
- var import_react67 = require("react");
9839
+ var import_react68 = require("react");
9810
9840
 
9811
9841
  // src/strings/types.ts
9812
9842
  var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
@@ -9823,7 +9853,7 @@ function teamImage(vm, abbr) {
9823
9853
  return void 0;
9824
9854
  }
9825
9855
  function Badge({ abbr, url }) {
9826
- const [failed, setFailed] = (0, import_react67.useState)(false);
9856
+ const [failed, setFailed] = (0, import_react68.useState)(false);
9827
9857
  if (url && !failed) {
9828
9858
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
9829
9859
  }
@@ -10434,7 +10464,7 @@ function TennisInsightList({ insights, ui }) {
10434
10464
  }
10435
10465
 
10436
10466
  // src/components/CompactOddsList.tsx
10437
- var import_react68 = require("react");
10467
+ var import_react69 = require("react");
10438
10468
  var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
10439
10469
 
10440
10470
  // src/compactList.ts
@@ -10556,11 +10586,11 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
10556
10586
  ] });
10557
10587
  }
10558
10588
  function CompactOddsList({ list, ui, slip, monitor }) {
10559
- const [shown2, setShown] = (0, import_react68.useState)(COMPACT_PAGE);
10589
+ const [shown2, setShown] = (0, import_react69.useState)(COMPACT_PAGE);
10560
10590
  const hidden = list.rowCount - shown2;
10561
- const [focusIndex, setFocusIndex] = (0, import_react68.useState)(null);
10562
- const focusRef = (0, import_react68.useRef)(null);
10563
- (0, import_react68.useEffect)(() => {
10591
+ const [focusIndex, setFocusIndex] = (0, import_react69.useState)(null);
10592
+ const focusRef = (0, import_react69.useRef)(null);
10593
+ (0, import_react69.useEffect)(() => {
10564
10594
  if (focusIndex !== null) focusRef.current?.focus();
10565
10595
  }, [focusIndex]);
10566
10596
  let left = shown2;
@@ -10832,7 +10862,7 @@ function FixtureCard({ card, ui }) {
10832
10862
  }
10833
10863
 
10834
10864
  // src/components/dashboard/CountdownCard.tsx
10835
- var import_react69 = require("react");
10865
+ var import_react70 = require("react");
10836
10866
  var import_jsx_runtime54 = require("react/jsx-runtime");
10837
10867
  var DAY_MS3 = 864e5;
10838
10868
  function remainingSegments(kickoffUnix, nowMs, withSeconds) {
@@ -10851,12 +10881,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
10851
10881
  function CountdownCard({ card, ui }) {
10852
10882
  const { data } = card;
10853
10883
  const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
10854
- const [nowMs, setNowMs] = (0, import_react69.useState)(() => Date.now());
10855
- const [reduced] = (0, import_react69.useState)(
10884
+ const [nowMs, setNowMs] = (0, import_react70.useState)(() => Date.now());
10885
+ const [reduced] = (0, import_react70.useState)(
10856
10886
  () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
10857
10887
  );
10858
10888
  const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
10859
- (0, import_react69.useEffect)(() => {
10889
+ (0, import_react70.useEffect)(() => {
10860
10890
  if (reduced) return;
10861
10891
  const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
10862
10892
  return () => window.clearInterval(id);
@@ -10864,7 +10894,7 @@ function CountdownCard({ card, ui }) {
10864
10894
  const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
10865
10895
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
10866
10896
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
10867
- segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react69.Fragment, { children: [
10897
+ segments ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react70.Fragment, { children: [
10868
10898
  i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
10869
10899
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
10870
10900
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
@@ -10875,7 +10905,7 @@ function CountdownCard({ card, ui }) {
10875
10905
  }
10876
10906
 
10877
10907
  // src/components/dashboard/InjuriesCard.tsx
10878
- var import_react70 = require("react");
10908
+ var import_react71 = require("react");
10879
10909
  var import_jsx_runtime55 = require("react/jsx-runtime");
10880
10910
  var SHOWN = 3;
10881
10911
  function ColHead({ name, crestUrl }) {
@@ -10898,7 +10928,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
10898
10928
  }
10899
10929
  function InjuriesCard({ card, ui }) {
10900
10930
  const { data } = card;
10901
- const [expanded, setExpanded] = (0, import_react70.useState)(false);
10931
+ const [expanded, setExpanded] = (0, import_react71.useState)(false);
10902
10932
  const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
10903
10933
  const limit = expanded ? void 0 : SHOWN;
10904
10934
  const { showMore, showLess } = ui;
@@ -11003,7 +11033,7 @@ function LinksCard({ card }) {
11003
11033
  }
11004
11034
 
11005
11035
  // src/components/dashboard/PostMatchResultCard.tsx
11006
- var import_react71 = require("react");
11036
+ var import_react72 = require("react");
11007
11037
  var import_jsx_runtime61 = require("react/jsx-runtime");
11008
11038
  function initials3(name) {
11009
11039
  return name.trim().slice(0, 3).toUpperCase();
@@ -11013,7 +11043,7 @@ function PostMatchCrest({
11013
11043
  name,
11014
11044
  side
11015
11045
  }) {
11016
- const [failed, setFailed] = (0, import_react71.useState)(false);
11046
+ const [failed, setFailed] = (0, import_react72.useState)(false);
11017
11047
  const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
11018
11048
  if (url && !failed) {
11019
11049
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -11212,10 +11242,10 @@ function RestingFormCard({ card }) {
11212
11242
  }
11213
11243
 
11214
11244
  // src/components/dashboard/LiveScoreCard.tsx
11215
- var import_react73 = require("react");
11245
+ var import_react74 = require("react");
11216
11246
 
11217
11247
  // src/useLiveClock.ts
11218
- var import_react72 = require("react");
11248
+ var import_react73 = require("react");
11219
11249
  var TICK_MS = 6e4;
11220
11250
  var MAX_LIVE_TICK_MINUTES = 15;
11221
11251
  function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
@@ -11224,10 +11254,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
11224
11254
  return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
11225
11255
  }
11226
11256
  function useLiveClock(minute, clockRunning, receivedAtMs) {
11227
- const [displayMinute, setDisplayMinute] = (0, import_react72.useState)(
11257
+ const [displayMinute, setDisplayMinute] = (0, import_react73.useState)(
11228
11258
  () => computeDisplayMinute(minute, clockRunning, receivedAtMs)
11229
11259
  );
11230
- (0, import_react72.useEffect)(() => {
11260
+ (0, import_react73.useEffect)(() => {
11231
11261
  setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
11232
11262
  if (!clockRunning) return;
11233
11263
  const id = window.setInterval(() => {
@@ -11244,7 +11274,7 @@ function initials5(name) {
11244
11274
  return name.trim().slice(0, 3).toUpperCase();
11245
11275
  }
11246
11276
  function LiveCrest({ url, name, side }) {
11247
- const [failed, setFailed] = (0, import_react73.useState)(false);
11277
+ const [failed, setFailed] = (0, import_react74.useState)(false);
11248
11278
  const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
11249
11279
  if (url && !failed) {
11250
11280
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -11266,7 +11296,7 @@ function LiveScoreCard({
11266
11296
  }) {
11267
11297
  const { data } = card;
11268
11298
  const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
11269
- const seedRef = (0, import_react73.useRef)(null);
11299
+ const seedRef = (0, import_react74.useRef)(null);
11270
11300
  if (!seedRef.current || seedRef.current.key !== seedKey) {
11271
11301
  seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
11272
11302
  }
@@ -11312,7 +11342,7 @@ function LiveScoreCard({
11312
11342
  }
11313
11343
 
11314
11344
  // src/components/dashboard/LiveTimelineCard.tsx
11315
- var import_react74 = require("react");
11345
+ var import_react75 = require("react");
11316
11346
  var import_jsx_runtime71 = require("react/jsx-runtime");
11317
11347
  var SHOWN2 = 3;
11318
11348
  function EventIcon({ type }) {
@@ -11354,7 +11384,7 @@ function EventRow({ e }) {
11354
11384
  ] });
11355
11385
  }
11356
11386
  function LiveTimelineCard({ card, ui }) {
11357
- const [expanded, setExpanded] = (0, import_react74.useState)(false);
11387
+ const [expanded, setExpanded] = (0, import_react75.useState)(false);
11358
11388
  const events = card.data.events;
11359
11389
  if (!events || events.length === 0) return null;
11360
11390
  const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
@@ -11378,7 +11408,7 @@ function LiveTimelineCard({ card, ui }) {
11378
11408
  }
11379
11409
 
11380
11410
  // src/components/dashboard/MomentumWave.tsx
11381
- var import_react75 = require("react");
11411
+ var import_react76 = require("react");
11382
11412
  var import_jsx_runtime72 = require("react/jsx-runtime");
11383
11413
  var WIDTH = 270;
11384
11414
  var HEIGHT = 56;
@@ -11403,7 +11433,7 @@ function MomentumWave({
11403
11433
  }) {
11404
11434
  if (points.length === 0) return null;
11405
11435
  const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
11406
- const clipId = (0, import_react75.useId)();
11436
+ const clipId = (0, import_react76.useId)();
11407
11437
  const topClipId = `${clipId}-top`;
11408
11438
  const bottomClipId = `${clipId}-bottom`;
11409
11439
  const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
@@ -11553,7 +11583,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
11553
11583
  // src/components/ChatMessage.tsx
11554
11584
  var import_jsx_runtime75 = require("react/jsx-runtime");
11555
11585
  function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
11556
- const [sport, setSport] = (0, import_react76.useState)(null);
11586
+ const [sport, setSport] = (0, import_react77.useState)(null);
11557
11587
  if (message.role === "user") {
11558
11588
  return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
11559
11589
  }
@@ -11612,11 +11642,11 @@ function turnAnchor(messages) {
11612
11642
  function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
11613
11643
  const { state, send } = controller;
11614
11644
  const { oddsFormat } = useOddsSettings();
11615
- const listRef = (0, import_react77.useRef)(null);
11616
- const endRef = (0, import_react77.useRef)(null);
11617
- const pinnedRef = (0, import_react77.useRef)(true);
11618
- const anchoredTurnRef = (0, import_react77.useRef)(null);
11619
- (0, import_react77.useEffect)(() => {
11645
+ const listRef = (0, import_react78.useRef)(null);
11646
+ const endRef = (0, import_react78.useRef)(null);
11647
+ const pinnedRef = (0, import_react78.useRef)(true);
11648
+ const anchoredTurnRef = (0, import_react78.useRef)(null);
11649
+ (0, import_react78.useEffect)(() => {
11620
11650
  const anchor = turnAnchor(state.messages);
11621
11651
  const list = listRef.current;
11622
11652
  if (anchor && anchor.turnId !== anchoredTurnRef.current) {
@@ -11675,13 +11705,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
11675
11705
  }
11676
11706
 
11677
11707
  // src/components/ChatInput.tsx
11678
- var import_react78 = require("react");
11708
+ var import_react79 = require("react");
11679
11709
  var import_jsx_runtime78 = require("react/jsx-runtime");
11680
- var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
11681
- const [value, setValue] = (0, import_react78.useState)("");
11682
- const textareaRef = (0, import_react78.useRef)(null);
11683
- const stopRef = (0, import_react78.useRef)(null);
11684
- const textBoxWantsFocusRef = (0, import_react78.useRef)(false);
11710
+ var ChatInput = (0, import_react79.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
11711
+ const [value, setValue] = (0, import_react79.useState)("");
11712
+ const textareaRef = (0, import_react79.useRef)(null);
11713
+ const stopRef = (0, import_react79.useRef)(null);
11714
+ const textBoxWantsFocusRef = (0, import_react79.useRef)(false);
11685
11715
  const submit = () => {
11686
11716
  if (disabled) return;
11687
11717
  const t = value.trim();
@@ -11695,7 +11725,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11695
11725
  submit();
11696
11726
  }
11697
11727
  };
11698
- (0, import_react78.useImperativeHandle)(ref, () => ({
11728
+ (0, import_react79.useImperativeHandle)(ref, () => ({
11699
11729
  focus() {
11700
11730
  const box = textareaRef.current;
11701
11731
  if (box && !box.disabled) {
@@ -11707,7 +11737,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11707
11737
  stopRef.current?.focus();
11708
11738
  }
11709
11739
  }), []);
11710
- (0, import_react78.useEffect)(() => {
11740
+ (0, import_react79.useEffect)(() => {
11711
11741
  if (streaming || disabled || !textBoxWantsFocusRef.current) return;
11712
11742
  textBoxWantsFocusRef.current = false;
11713
11743
  const box = textareaRef.current;
@@ -11738,7 +11768,7 @@ var ChatInput = (0, import_react78.forwardRef)(function ChatInput2({ placeholder
11738
11768
  });
11739
11769
 
11740
11770
  // src/components/TabBar.tsx
11741
- var import_react79 = require("react");
11771
+ var import_react80 = require("react");
11742
11772
  var import_jsx_runtime79 = require("react/jsx-runtime");
11743
11773
  var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
11744
11774
  var FOCUS_EDGE = 24;
@@ -11761,16 +11791,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11761
11791
  ...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
11762
11792
  ];
11763
11793
  const track = useTrack();
11764
- const listRef = (0, import_react79.useRef)(null);
11794
+ const listRef = (0, import_react80.useRef)(null);
11765
11795
  const activeTab = monitor.activeTab;
11766
- (0, import_react79.useEffect)(() => {
11796
+ (0, import_react80.useEffect)(() => {
11767
11797
  const el = listRef.current?.querySelector("[data-on]");
11768
11798
  if (!el || typeof el.scrollIntoView !== "function") return;
11769
11799
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
11770
11800
  el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
11771
11801
  }, [activeTab]);
11772
11802
  const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
11773
- (0, import_react79.useLayoutEffect)(() => {
11803
+ (0, import_react80.useLayoutEffect)(() => {
11774
11804
  const strip = listRef.current;
11775
11805
  if (!strip) return;
11776
11806
  const measure = () => {
@@ -11794,7 +11824,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11794
11824
  fonts?.removeEventListener?.("loadingdone", measure);
11795
11825
  };
11796
11826
  }, [labelSignature]);
11797
- const pointerDown = (0, import_react79.useRef)(false);
11827
+ const pointerDown = (0, import_react80.useRef)(false);
11798
11828
  const keepFocusedTabInView = (e) => {
11799
11829
  const strip = e.currentTarget;
11800
11830
  const tab = e.target;
@@ -11854,7 +11884,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
11854
11884
  }
11855
11885
 
11856
11886
  // src/components/MonitorTabs.tsx
11857
- var import_react92 = require("react");
11887
+ var import_react93 = require("react");
11858
11888
 
11859
11889
  // src/components/MarketAccordion.tsx
11860
11890
  var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
@@ -11916,7 +11946,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
11916
11946
  }
11917
11947
 
11918
11948
  // src/components/MonitorFormH2H.tsx
11919
- var import_react80 = require("react");
11949
+ var import_react81 = require("react");
11920
11950
  var import_jsx_runtime81 = require("react/jsx-runtime");
11921
11951
  function resultClass2(result) {
11922
11952
  if (result === "W") return "ss-w-h2h-result--win";
@@ -11932,7 +11962,7 @@ function FormDots({ form, ui }) {
11932
11962
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
11933
11963
  }
11934
11964
  function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
11935
- const [expanded, setExpanded] = (0, import_react80.useState)(false);
11965
+ const [expanded, setExpanded] = (0, import_react81.useState)(false);
11936
11966
  const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
11937
11967
  if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
11938
11968
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_jsx_runtime81.Fragment, {});
@@ -12010,10 +12040,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
12010
12040
  }
12011
12041
 
12012
12042
  // src/components/CompLogo.tsx
12013
- var import_react81 = require("react");
12043
+ var import_react82 = require("react");
12014
12044
  var import_jsx_runtime82 = require("react/jsx-runtime");
12015
12045
  function CompLogo({ url }) {
12016
- const [failed, setFailed] = (0, import_react81.useState)(null);
12046
+ const [failed, setFailed] = (0, import_react82.useState)(null);
12017
12047
  if (!url || failed === url) return null;
12018
12048
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
12019
12049
  }
@@ -12171,7 +12201,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
12171
12201
  }
12172
12202
 
12173
12203
  // src/components/NbaMonitorCard.tsx
12174
- var import_react85 = require("react");
12204
+ var import_react86 = require("react");
12175
12205
 
12176
12206
  // src/sportLabel.ts
12177
12207
  var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
@@ -12181,7 +12211,7 @@ var sportLabel = (ui, sport) => {
12181
12211
  };
12182
12212
 
12183
12213
  // src/components/NbaFormSection.tsx
12184
- var import_react82 = require("react");
12214
+ var import_react83 = require("react");
12185
12215
 
12186
12216
  // src/components/NbaFormRest.tsx
12187
12217
  var import_jsx_runtime85 = require("react/jsx-runtime");
@@ -12281,8 +12311,8 @@ function Row3({ game, abbr, tonight, ui }) {
12281
12311
  ] });
12282
12312
  }
12283
12313
  function NbaFormSection({ match, monitor, ui }) {
12284
- const [open, setOpen] = (0, import_react82.useState)(false);
12285
- const [side, setSide] = (0, import_react82.useState)("away");
12314
+ const [open, setOpen] = (0, import_react83.useState)(false);
12315
+ const [side, setSide] = (0, import_react83.useState)("away");
12286
12316
  const form = useNbaForm(match, monitor);
12287
12317
  const b = match.basketball;
12288
12318
  if (!form || !b || !form.home && !form.away) return null;
@@ -12327,10 +12357,10 @@ function NbaFormSection({ match, monitor, ui }) {
12327
12357
  }
12328
12358
 
12329
12359
  // src/components/NbaPropsSection.tsx
12330
- var import_react84 = require("react");
12360
+ var import_react85 = require("react");
12331
12361
 
12332
12362
  // src/components/PropsPieces.tsx
12333
- var import_react83 = require("react");
12363
+ var import_react84 = require("react");
12334
12364
  var import_jsx_runtime87 = require("react/jsx-runtime");
12335
12365
  var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
12336
12366
  var hasLiveLine = (p) => p.live != null || p.nflLive != null;
@@ -12343,9 +12373,9 @@ function preKickoff(match) {
12343
12373
  return Number.isFinite(kickoff) && Date.now() < kickoff;
12344
12374
  }
12345
12375
  function usePreKickoff(match) {
12346
- const [, setTick] = (0, import_react83.useState)(0);
12376
+ const [, setTick] = (0, import_react84.useState)(0);
12347
12377
  const pre = preKickoff(match);
12348
- (0, import_react83.useEffect)(() => {
12378
+ (0, import_react84.useEffect)(() => {
12349
12379
  if (!pre || !match.kickoffUtc) return;
12350
12380
  const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
12351
12381
  const id = setTimeout(() => setTick((t) => t + 1), wait);
@@ -12359,7 +12389,7 @@ function usePropsOpen(match, monitor, descriptor) {
12359
12389
  const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
12360
12390
  const live = match.phase === "live";
12361
12391
  const open = pre || live;
12362
- (0, import_react83.useEffect)(() => {
12392
+ (0, import_react84.useEffect)(() => {
12363
12393
  if (!open) return;
12364
12394
  if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
12365
12395
  else monitor.loadPlayerProps?.(match.matchId);
@@ -12437,7 +12467,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
12437
12467
  function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
12438
12468
  const player = livePlayer(bundle, given);
12439
12469
  const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
12440
- const [picked, setPicked] = (0, import_react83.useState)(null);
12470
+ const [picked, setPicked] = (0, import_react84.useState)(null);
12441
12471
  const active = stats.find((s) => s.stat === picked) ?? stats[0];
12442
12472
  const sample = active?.games?.length ?? 0;
12443
12473
  const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
@@ -12486,8 +12516,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
12486
12516
  ] });
12487
12517
  }
12488
12518
  function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
12489
- const [openId, setOpenId] = (0, import_react83.useState)(null);
12490
- const [brokenShots, setBrokenShots] = (0, import_react83.useState)(/* @__PURE__ */ new Set());
12519
+ const [openId, setOpenId] = (0, import_react84.useState)(null);
12520
+ const [brokenShots, setBrokenShots] = (0, import_react84.useState)(/* @__PURE__ */ new Set());
12491
12521
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
12492
12522
  const p = livePlayer(bundle, given);
12493
12523
  const isOpen = openId === p.playerId;
@@ -12533,12 +12563,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
12533
12563
  }
12534
12564
  var BOX_QUIET_MS = 12e4;
12535
12565
  function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
12536
- const [tick, setTick] = (0, import_react83.useState)(0);
12566
+ const [tick, setTick] = (0, import_react84.useState)(0);
12537
12567
  const time = clock2(boxAsOfUtc, ui);
12538
12568
  const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
12539
12569
  const valid = !Number.isNaN(at2);
12540
12570
  const onBreak = atBreak(match);
12541
- (0, import_react83.useEffect)(() => {
12571
+ (0, import_react84.useEffect)(() => {
12542
12572
  if (!valid || onBreak) return;
12543
12573
  const age2 = Date.now() - at2;
12544
12574
  const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
@@ -12599,12 +12629,12 @@ var nbaDescriptor = (ui, match) => ({
12599
12629
  tenGameBars: false
12600
12630
  });
12601
12631
  function StatsClock2({ bundle, match, ui }) {
12602
- const [tick, setTick] = (0, import_react84.useState)(0);
12632
+ const [tick, setTick] = (0, import_react85.useState)(0);
12603
12633
  const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
12604
12634
  const time = clock2(bundle.boxAsOfUtc, ui);
12605
12635
  const valid = !Number.isNaN(at2) && time !== "";
12606
12636
  const onBreak = atBreak(match);
12607
- (0, import_react84.useEffect)(() => {
12637
+ (0, import_react85.useEffect)(() => {
12608
12638
  if (!valid || onBreak) return;
12609
12639
  const age2 = Date.now() - at2;
12610
12640
  const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
@@ -12618,7 +12648,7 @@ function StatsClock2({ bundle, match, ui }) {
12618
12648
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
12619
12649
  }
12620
12650
  function NbaPropsSection({ match, monitor, ui, slip }) {
12621
- const [side, setSide] = (0, import_react84.useState)("home");
12651
+ const [side, setSide] = (0, import_react85.useState)("home");
12622
12652
  const descriptor = nbaDescriptor(ui, match);
12623
12653
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
12624
12654
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -12656,7 +12686,7 @@ function city(teamName, nickname) {
12656
12686
  return name.slice(0, name.length - nickname.length).trim() || null;
12657
12687
  }
12658
12688
  function BadgeCrest({ url, abbreviation }) {
12659
- const [failed, setFailed] = (0, import_react85.useState)(false);
12689
+ const [failed, setFailed] = (0, import_react86.useState)(false);
12660
12690
  if (url && !failed) {
12661
12691
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
12662
12692
  }
@@ -12791,7 +12821,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
12791
12821
  }
12792
12822
 
12793
12823
  // src/components/NflFormSection.tsx
12794
- var import_react86 = require("react");
12824
+ var import_react87 = require("react");
12795
12825
  var import_jsx_runtime90 = require("react/jsx-runtime");
12796
12826
  var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
12797
12827
  var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
@@ -12844,7 +12874,7 @@ function H2hRow({ game, home, ui }) {
12844
12874
  ] });
12845
12875
  }
12846
12876
  function NflFormSection({ match, monitor, ui }) {
12847
- const [segment, setSegment] = (0, import_react86.useState)("away");
12877
+ const [segment, setSegment] = (0, import_react87.useState)("away");
12848
12878
  const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
12849
12879
  const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
12850
12880
  const form = bundle?.form;
@@ -12877,7 +12907,7 @@ function NflFormSection({ match, monitor, ui }) {
12877
12907
  }
12878
12908
 
12879
12909
  // src/components/NflPropsSection.tsx
12880
- var import_react87 = require("react");
12910
+ var import_react88 = require("react");
12881
12911
  var import_jsx_runtime91 = require("react/jsx-runtime");
12882
12912
  var TRENDS_SHOWN = 3;
12883
12913
  var SCORERS_SHOWN = 8;
@@ -12950,7 +12980,7 @@ function ShowMore({ label, onClick }) {
12950
12980
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
12951
12981
  }
12952
12982
  function Trends({ bundle, facts, descriptor, ui, slip }) {
12953
- const [all, setAll] = (0, import_react87.useState)(false);
12983
+ const [all, setAll] = (0, import_react88.useState)(false);
12954
12984
  const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
12955
12985
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
12956
12986
  /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
@@ -12983,7 +13013,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
12983
13013
  ] });
12984
13014
  }
12985
13015
  function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
12986
- const [all, setAll] = (0, import_react87.useState)(false);
13016
+ const [all, setAll] = (0, import_react88.useState)(false);
12987
13017
  const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
12988
13018
  const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
12989
13019
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "ss-w-props-scorers", children: [
@@ -13013,7 +13043,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
13013
13043
  ] });
13014
13044
  }
13015
13045
  function NflPropsSection({ match, monitor, ui, slip }) {
13016
- const [tab, setTab] = (0, import_react87.useState)(null);
13046
+ const [tab, setTab] = (0, import_react88.useState)(null);
13017
13047
  const descriptor = nflDescriptor(ui);
13018
13048
  const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
13019
13049
  if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
@@ -13213,14 +13243,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
13213
13243
  }
13214
13244
 
13215
13245
  // src/components/TennisMonitorCard.tsx
13216
- var import_react90 = require("react");
13246
+ var import_react91 = require("react");
13217
13247
  var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
13218
13248
 
13219
13249
  // src/components/TennisFixtureRow.tsx
13220
13250
  var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
13221
13251
 
13222
13252
  // src/components/FixtureRow.tsx
13223
- var import_react88 = require("react");
13253
+ var import_react89 = require("react");
13224
13254
  var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
13225
13255
  var import_jsx_runtime95 = require("react/jsx-runtime");
13226
13256
  function splitAtFirstSpace(label) {
@@ -13234,7 +13264,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
13234
13264
  return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
13235
13265
  }
13236
13266
  function Side2({ name, crest, abbr, away = false }) {
13237
- const [failed, setFailed] = (0, import_react88.useState)(false);
13267
+ const [failed, setFailed] = (0, import_react89.useState)(false);
13238
13268
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
13239
13269
  crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime95.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_runtime95.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
13240
13270
  /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { className: "ss-w-drow-nm", children: name })
@@ -13476,7 +13506,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
13476
13506
  }
13477
13507
 
13478
13508
  // src/components/TennisStatsTables.tsx
13479
- var import_react89 = require("react");
13509
+ var import_react90 = require("react");
13480
13510
  var import_jsx_runtime98 = require("react/jsx-runtime");
13481
13511
  function formatStat(row, value, locale) {
13482
13512
  if (value == null) return "\u2013";
@@ -13514,8 +13544,8 @@ function Tables({ table, labels, names, locale }) {
13514
13544
  ] });
13515
13545
  }
13516
13546
  function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
13517
- const [tab, setTab] = (0, import_react89.useState)("match");
13518
- (0, import_react89.useEffect)(() => {
13547
+ const [tab, setTab] = (0, import_react90.useState)("match");
13548
+ (0, import_react90.useEffect)(() => {
13519
13549
  setTab("match");
13520
13550
  }, [resetKey]);
13521
13551
  const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
@@ -13546,7 +13576,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
13546
13576
  ] }),
13547
13577
  today.rows.map((r) => {
13548
13578
  const f = (v) => formatStat({ kind: "pct" }, v, locale);
13549
- return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_react89.Fragment, { children: [
13579
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(import_react90.Fragment, { children: [
13550
13580
  /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
13551
13581
  /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
13552
13582
  f(r.p1Today),
@@ -13681,7 +13711,7 @@ function HeadToHead({ t, ui }) {
13681
13711
  ] });
13682
13712
  }
13683
13713
  function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
13684
- const lastTables = (0, import_react90.useRef)(null);
13714
+ const lastTables = (0, import_react91.useRef)(null);
13685
13715
  const t = match.tennis;
13686
13716
  if (!t) return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
13687
13717
  const preMatch = match.phase === "preMatch";
@@ -13761,7 +13791,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
13761
13791
  }
13762
13792
 
13763
13793
  // src/components/ScoreboardStrip.tsx
13764
- var import_react91 = require("react");
13794
+ var import_react92 = require("react");
13765
13795
  var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
13766
13796
  var import_jsx_runtime100 = require("react/jsx-runtime");
13767
13797
  function nbaStatus(m, ui) {
@@ -13856,8 +13886,8 @@ function rowsFor(m) {
13856
13886
  ];
13857
13887
  }
13858
13888
  function useStripScroll(selectedKey) {
13859
- const stripRef = (0, import_react91.useRef)(null);
13860
- (0, import_react91.useEffect)(() => {
13889
+ const stripRef = (0, import_react92.useRef)(null);
13890
+ (0, import_react92.useEffect)(() => {
13861
13891
  const strip = stripRef.current;
13862
13892
  const pressed = strip?.querySelector('[aria-pressed="true"]');
13863
13893
  if (!strip || !pressed) return;
@@ -14031,7 +14061,7 @@ function OddsLiveStrip({ m, ui }) {
14031
14061
  ] });
14032
14062
  }
14033
14063
  function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
14034
- const seedIndex = (0, import_react92.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
14064
+ const seedIndex = (0, import_react93.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
14035
14065
  const tiles = orderTiles(
14036
14066
  monitor.pins,
14037
14067
  monitor.snapshot,
@@ -14103,7 +14133,7 @@ function TrendsPanel({ monitor, ui, slip }) {
14103
14133
  }
14104
14134
 
14105
14135
  // src/components/LivePanel.tsx
14106
- var import_react95 = require("react");
14136
+ var import_react96 = require("react");
14107
14137
  var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
14108
14138
 
14109
14139
  // src/scheduleView.ts
@@ -14278,20 +14308,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
14278
14308
  }
14279
14309
 
14280
14310
  // src/components/MatchSheet.tsx
14281
- var import_react94 = require("react");
14311
+ var import_react95 = require("react");
14282
14312
  var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
14283
14313
 
14284
14314
  // src/useModalDialog.ts
14285
- var import_react93 = require("react");
14315
+ var import_react94 = require("react");
14286
14316
  var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
14287
14317
  function useModalDialog(onClose, opts = {}) {
14288
- const dialogRef = (0, import_react93.useRef)(null);
14289
- const onCloseRef = (0, import_react93.useRef)(onClose);
14318
+ const dialogRef = (0, import_react94.useRef)(null);
14319
+ const onCloseRef = (0, import_react94.useRef)(onClose);
14290
14320
  onCloseRef.current = onClose;
14291
- const openerRef = (0, import_react93.useRef)(opts.opener);
14321
+ const openerRef = (0, import_react94.useRef)(opts.opener);
14292
14322
  openerRef.current = opts.opener;
14293
14323
  const restore = opts.restoreFocus ?? true;
14294
- (0, import_react93.useEffect)(() => {
14324
+ (0, import_react94.useEffect)(() => {
14295
14325
  const dialog = dialogRef.current;
14296
14326
  const root = dialog?.getRootNode();
14297
14327
  const focusedAtMount = root?.activeElement ?? null;
@@ -14302,7 +14332,7 @@ function useModalDialog(onClose, opts = {}) {
14302
14332
  if (target instanceof HTMLElement) target.focus({ preventScroll: true });
14303
14333
  };
14304
14334
  }, []);
14305
- (0, import_react93.useEffect)(() => {
14335
+ (0, import_react94.useEffect)(() => {
14306
14336
  const onKey = (e) => {
14307
14337
  if (e.key !== "Escape") return;
14308
14338
  e.stopPropagation();
@@ -14343,8 +14373,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
14343
14373
  function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
14344
14374
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
14345
14375
  const log = useEventLog();
14346
- const titleId = (0, import_react94.useId)();
14347
- const [limitHit, setLimitHit] = (0, import_react94.useState)(false);
14376
+ const titleId = (0, import_react95.useId)();
14377
+ const [limitHit, setLimitHit] = (0, import_react95.useState)(false);
14348
14378
  const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
14349
14379
  const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
14350
14380
  const followable = pinSport !== "tennis" || tour !== void 0;
@@ -14445,10 +14475,10 @@ var OPEN_TOP_GROUPS = 2;
14445
14475
  var QUIET_ROWS = 4;
14446
14476
  function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
14447
14477
  const { groups, states, stale } = discovery;
14448
- const [mine, setMine] = (0, import_react95.useState)(false);
14449
- const [toggled, setToggled] = (0, import_react95.useState)(/* @__PURE__ */ new Map());
14450
- const [sheet, setSheet] = (0, import_react95.useState)(null);
14451
- const pinnedKeys = (0, import_react95.useMemo)(
14478
+ const [mine, setMine] = (0, import_react96.useState)(false);
14479
+ const [toggled, setToggled] = (0, import_react96.useState)(/* @__PURE__ */ new Map());
14480
+ const [sheet, setSheet] = (0, import_react96.useState)(null);
14481
+ const pinnedKeys = (0, import_react96.useMemo)(
14452
14482
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
14453
14483
  [monitor.pins]
14454
14484
  );
@@ -14554,20 +14584,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
14554
14584
  }
14555
14585
 
14556
14586
  // src/components/ScheduleMatchesPanel.tsx
14557
- var import_react99 = require("react");
14587
+ var import_react100 = require("react");
14558
14588
  var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
14559
14589
 
14560
14590
  // src/useTennisRowPrices.ts
14561
- var import_react96 = require("react");
14591
+ var import_react97 = require("react");
14562
14592
  var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
14563
14593
  var TENNIS_PRICE_POLL_MS = 6e4;
14564
14594
  function useTennisRowPrices(a) {
14565
- const [state, setState] = (0, import_react96.useState)({ byId: null, stale: false });
14566
- const getPricesRef = (0, import_react96.useRef)(a.getPrices);
14595
+ const [state, setState] = (0, import_react97.useState)({ byId: null, stale: false });
14596
+ const getPricesRef = (0, import_react97.useRef)(a.getPrices);
14567
14597
  getPricesRef.current = a.getPrices;
14568
- const latest = (0, import_react96.useRef)(0);
14598
+ const latest = (0, import_react97.useRef)(0);
14569
14599
  const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
14570
- (0, import_react96.useEffect)(() => {
14600
+ (0, import_react97.useEffect)(() => {
14571
14601
  if (!a.enabled || idsKey === "") {
14572
14602
  latest.current++;
14573
14603
  setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
@@ -14605,11 +14635,11 @@ function useTennisRowPrices(a) {
14605
14635
  }
14606
14636
 
14607
14637
  // src/components/DayStrip.tsx
14608
- var import_react97 = require("react");
14638
+ var import_react98 = require("react");
14609
14639
  var import_jsx_runtime109 = require("react/jsx-runtime");
14610
14640
  function DayStrip({ chips, selected, onSelect, ui, locale }) {
14611
- const listRef = (0, import_react97.useRef)(null);
14612
- (0, import_react97.useEffect)(() => {
14641
+ const listRef = (0, import_react98.useRef)(null);
14642
+ (0, import_react98.useEffect)(() => {
14613
14643
  const el = listRef.current?.querySelector('[aria-pressed="true"]');
14614
14644
  if (!el || typeof el.scrollIntoView !== "function") return;
14615
14645
  const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
@@ -14638,7 +14668,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
14638
14668
  }
14639
14669
 
14640
14670
  // src/components/games/ui/SearchField.tsx
14641
- var import_react98 = require("react");
14671
+ var import_react99 = require("react");
14642
14672
 
14643
14673
  // src/components/games/ui/icons.tsx
14644
14674
  var import_jsx_runtime110 = require("react/jsx-runtime");
@@ -14677,8 +14707,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
14677
14707
  // src/components/games/ui/SearchField.tsx
14678
14708
  var import_jsx_runtime111 = require("react/jsx-runtime");
14679
14709
  function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
14680
- const localRef = (0, import_react98.useRef)(null);
14681
- const setInputRef = (0, import_react98.useCallback)((node) => {
14710
+ const localRef = (0, import_react99.useRef)(null);
14711
+ const setInputRef = (0, import_react99.useCallback)((node) => {
14682
14712
  localRef.current = node;
14683
14713
  if (typeof inputRef === "function") inputRef(node);
14684
14714
  else if (inputRef) inputRef.current = node;
@@ -14724,18 +14754,18 @@ var TOP_ROW_CAP = 3;
14724
14754
  var SKELETON_ROWS = 3;
14725
14755
  function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
14726
14756
  const { localDate: today, states, stale } = discovery;
14727
- const searchId = (0, import_react99.useId)();
14728
- const [query, setQuery] = (0, import_react99.useState)("");
14729
- const [toggled, setToggled] = (0, import_react99.useState)(/* @__PURE__ */ new Map());
14730
- const [expanded, setExpanded] = (0, import_react99.useState)(/* @__PURE__ */ new Set());
14731
- const listRef = (0, import_react99.useRef)(null);
14732
- const [sheet, setSheet] = (0, import_react99.useState)(null);
14757
+ const searchId = (0, import_react100.useId)();
14758
+ const [query, setQuery] = (0, import_react100.useState)("");
14759
+ const [toggled, setToggled] = (0, import_react100.useState)(/* @__PURE__ */ new Map());
14760
+ const [expanded, setExpanded] = (0, import_react100.useState)(/* @__PURE__ */ new Set());
14761
+ const listRef = (0, import_react100.useRef)(null);
14762
+ const [sheet, setSheet] = (0, import_react100.useState)(null);
14733
14763
  const { chips, selected } = loaded;
14734
- (0, import_react99.useEffect)(() => {
14764
+ (0, import_react100.useEffect)(() => {
14735
14765
  if (selected !== day) onDay(selected);
14736
14766
  }, [day, selected, onDay]);
14737
14767
  const isToday = selected === today;
14738
- const pinnedKeys = (0, import_react99.useMemo)(
14768
+ const pinnedKeys = (0, import_react100.useMemo)(
14739
14769
  () => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
14740
14770
  [monitor.pins]
14741
14771
  );
@@ -14873,7 +14903,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
14873
14903
  }
14874
14904
 
14875
14905
  // src/components/GamesPanel.tsx
14876
- var import_react114 = require("react");
14906
+ var import_react115 = require("react");
14877
14907
 
14878
14908
  // src/components/GamesLoginWall.tsx
14879
14909
  var import_jsx_runtime113 = require("react/jsx-runtime");
@@ -14882,7 +14912,7 @@ function GamesLoginWall({ ui }) {
14882
14912
  }
14883
14913
 
14884
14914
  // src/components/GamesHub.tsx
14885
- var import_react100 = require("react");
14915
+ var import_react101 = require("react");
14886
14916
 
14887
14917
  // src/components/games/ui/gameMeta.ts
14888
14918
  function prettifyGameId(gameId) {
@@ -15033,8 +15063,8 @@ function pickHeroGame(games) {
15033
15063
  }
15034
15064
  var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
15035
15065
  function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
15036
- const [, setTick] = (0, import_react100.useState)(0);
15037
- (0, import_react100.useEffect)(() => {
15066
+ const [, setTick] = (0, import_react101.useState)(0);
15067
+ (0, import_react101.useEffect)(() => {
15038
15068
  const id = setInterval(() => setTick((t) => t + 1), 6e4);
15039
15069
  return () => clearInterval(id);
15040
15070
  }, []);
@@ -15094,10 +15124,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
15094
15124
  }
15095
15125
 
15096
15126
  // src/components/GameScreenHost.tsx
15097
- var import_react112 = require("react");
15127
+ var import_react113 = require("react");
15098
15128
 
15099
15129
  // src/useGamePlay.ts
15100
- var import_react101 = require("react");
15130
+ var import_react102 = require("react");
15101
15131
  function toSubmitResult(payload) {
15102
15132
  return {
15103
15133
  // 'pending' means the play is recorded but awaiting resolution (fixture games)
@@ -15109,17 +15139,17 @@ function toSubmitResult(payload) {
15109
15139
  };
15110
15140
  }
15111
15141
  function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
15112
- const [result, setResult] = (0, import_react101.useState)(null);
15113
- const [submitting, setSubmitting] = (0, import_react101.useState)(false);
15114
- const [rawStatus, setRawStatus] = (0, import_react101.useState)(null);
15115
- const inFlightRef = (0, import_react101.useRef)(false);
15116
- const convRef = (0, import_react101.useRef)(conversation);
15142
+ const [result, setResult] = (0, import_react102.useState)(null);
15143
+ const [submitting, setSubmitting] = (0, import_react102.useState)(false);
15144
+ const [rawStatus, setRawStatus] = (0, import_react102.useState)(null);
15145
+ const inFlightRef = (0, import_react102.useRef)(false);
15146
+ const convRef = (0, import_react102.useRef)(conversation);
15117
15147
  convRef.current = conversation;
15118
- const optsRef = (0, import_react101.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
15148
+ const optsRef = (0, import_react102.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
15119
15149
  optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
15120
- const resultRef = (0, import_react101.useRef)(null);
15150
+ const resultRef = (0, import_react102.useRef)(null);
15121
15151
  resultRef.current = result;
15122
- const refetch = (0, import_react101.useCallback)(async () => {
15152
+ const refetch = (0, import_react102.useCallback)(async () => {
15123
15153
  const conv = convRef.current;
15124
15154
  if (!conv) return;
15125
15155
  const opts = optsRef.current;
@@ -15135,7 +15165,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
15135
15165
  } catch {
15136
15166
  }
15137
15167
  }, []);
15138
- const submit = (0, import_react101.useCallback)(async (answerJson) => {
15168
+ const submit = (0, import_react102.useCallback)(async (answerJson) => {
15139
15169
  const conv = convRef.current;
15140
15170
  if (!conv || inFlightRef.current) return;
15141
15171
  inFlightRef.current = true;
@@ -15162,14 +15192,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
15162
15192
  setSubmitting(false);
15163
15193
  }
15164
15194
  }, [refetch]);
15165
- const hydrate = (0, import_react101.useCallback)(() => {
15195
+ const hydrate = (0, import_react102.useCallback)(() => {
15166
15196
  void refetch();
15167
15197
  }, [refetch]);
15168
15198
  return { result, submitting, submit, hydrate, rawStatus };
15169
15199
  }
15170
15200
 
15171
15201
  // src/components/games/MysteryTigerGame.tsx
15172
- var import_react103 = require("react");
15202
+ var import_react104 = require("react");
15173
15203
 
15174
15204
  // src/components/games/nationFlags.ts
15175
15205
  var FLAGS = {
@@ -15380,7 +15410,7 @@ function isNationCode(flag) {
15380
15410
  }
15381
15411
 
15382
15412
  // src/components/games/PlayerAvatar.tsx
15383
- var import_react102 = require("react");
15413
+ var import_react103 = require("react");
15384
15414
  var import_jsx_runtime118 = require("react/jsx-runtime");
15385
15415
  function initialsOf(name) {
15386
15416
  const parts2 = name.trim().split(/\s+/).filter(Boolean);
@@ -15398,7 +15428,7 @@ function PlayerAvatar({
15398
15428
  imagePath,
15399
15429
  className
15400
15430
  }) {
15401
- const [failed, setFailed] = (0, import_react102.useState)(false);
15431
+ const [failed, setFailed] = (0, import_react103.useState)(false);
15402
15432
  const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
15403
15433
  return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
15404
15434
  }
@@ -15642,8 +15672,8 @@ function MysteryTigerGame({
15642
15672
  onBack
15643
15673
  }) {
15644
15674
  const t = ui.games.mysteryTiger;
15645
- const [query, setQuery] = (0, import_react103.useState)("");
15646
- const inputId = (0, import_react103.useId)();
15675
+ const [query, setQuery] = (0, import_react104.useState)("");
15676
+ const inputId = (0, import_react104.useId)();
15647
15677
  const clientState = parseClientState(result?.clientStateJson);
15648
15678
  const guessResults = clientState?.guessResults ?? [];
15649
15679
  const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
@@ -15904,13 +15934,13 @@ function HigherOrLowerGame({
15904
15934
  }
15905
15935
 
15906
15936
  // src/components/games/CareerPathGame.tsx
15907
- var import_react105 = require("react");
15937
+ var import_react106 = require("react");
15908
15938
 
15909
15939
  // src/components/games/ui/CrestShield.tsx
15910
- var import_react104 = require("react");
15940
+ var import_react105 = require("react");
15911
15941
  var import_jsx_runtime129 = require("react/jsx-runtime");
15912
15942
  function CrestShield({ src, name, size = 28 }) {
15913
- const [failed, setFailed] = (0, import_react104.useState)(false);
15943
+ const [failed, setFailed] = (0, import_react105.useState)(false);
15914
15944
  if (src && !isPlaceholderImage(src) && !failed) {
15915
15945
  return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
15916
15946
  }
@@ -15942,8 +15972,8 @@ function CareerPathGame({
15942
15972
  }) {
15943
15973
  const s = ui.games.careerPath;
15944
15974
  const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
15945
- const [query, setQuery] = (0, import_react105.useState)("");
15946
- const inputId = (0, import_react105.useId)();
15975
+ const [query, setQuery] = (0, import_react106.useState)("");
15976
+ const inputId = (0, import_react106.useId)();
15947
15977
  const clientState = parseClientState3(result?.clientStateJson);
15948
15978
  const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
15949
15979
  const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
@@ -16049,7 +16079,7 @@ function CareerPathGame({
16049
16079
  }
16050
16080
 
16051
16081
  // src/components/games/BeatTheGridGame.tsx
16052
- var import_react106 = __toESM(require("react"), 1);
16082
+ var import_react107 = __toESM(require("react"), 1);
16053
16083
 
16054
16084
  // src/components/games/ui/OptionList.tsx
16055
16085
  var import_jsx_runtime131 = require("react/jsx-runtime");
@@ -16138,10 +16168,10 @@ function SearchSheet({
16138
16168
  ui
16139
16169
  }) {
16140
16170
  const s = ui.games.beatTheGrid;
16141
- const [query, setQuery] = (0, import_react106.useState)("");
16142
- const inputId = (0, import_react106.useId)();
16143
- const inputRef = (0, import_react106.useRef)(null);
16144
- (0, import_react106.useEffect)(() => {
16171
+ const [query, setQuery] = (0, import_react107.useState)("");
16172
+ const inputId = (0, import_react107.useId)();
16173
+ const inputRef = (0, import_react107.useRef)(null);
16174
+ (0, import_react107.useEffect)(() => {
16145
16175
  inputRef.current?.focus();
16146
16176
  }, [row, col]);
16147
16177
  const filtered = playerPool.filter(
@@ -16206,7 +16236,7 @@ function BeatTheGridGame({
16206
16236
  }) {
16207
16237
  const s = ui.games.beatTheGrid;
16208
16238
  const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
16209
- const [activeCell, setActiveCell] = (0, import_react106.useState)(null);
16239
+ const [activeCell, setActiveCell] = (0, import_react107.useState)(null);
16210
16240
  const clientState = parseClientState4(result?.clientStateJson);
16211
16241
  const filledCells = clientState?.cells ?? [];
16212
16242
  const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
@@ -16280,7 +16310,7 @@ function BeatTheGridGame({
16280
16310
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { "aria-hidden": "true", children: abbr }),
16281
16311
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "ss-g-sr", children: rowLabel })
16282
16312
  ] });
16283
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_react106.default.Fragment, { children: [
16313
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_react107.default.Fragment, { children: [
16284
16314
  /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
16285
16315
  cols.map((colLabel, colIdx) => {
16286
16316
  const filled = findCellResult(filledCells, rowIdx, colIdx);
@@ -16361,7 +16391,7 @@ function BeatTheGridGame({
16361
16391
  }
16362
16392
 
16363
16393
  // src/components/games/GuessTheXiGame.tsx
16364
- var import_react107 = require("react");
16394
+ var import_react108 = require("react");
16365
16395
 
16366
16396
  // src/components/games/ui/PitchSvg.tsx
16367
16397
  var import_jsx_runtime133 = require("react/jsx-runtime");
@@ -16450,8 +16480,8 @@ function GuessTheXiGame({
16450
16480
  onBack
16451
16481
  }) {
16452
16482
  const t = ui.games.guessTheXi;
16453
- const [query, setQuery] = (0, import_react107.useState)("");
16454
- const inputId = (0, import_react107.useId)();
16483
+ const [query, setQuery] = (0, import_react108.useState)("");
16484
+ const inputId = (0, import_react108.useId)();
16455
16485
  const clientState = parseClientState5(result?.clientStateJson);
16456
16486
  const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
16457
16487
  const solved = clientState?.status === "solved";
@@ -16593,7 +16623,7 @@ function GuessTheXiGame({
16593
16623
  }
16594
16624
 
16595
16625
  // src/components/games/DailyQuizGame.tsx
16596
- var import_react108 = require("react");
16626
+ var import_react109 = require("react");
16597
16627
  var import_jsx_runtime135 = require("react/jsx-runtime");
16598
16628
  function parseClientState6(json) {
16599
16629
  if (!json) return null;
@@ -16634,8 +16664,8 @@ function DailyQuizGame({
16634
16664
  }) {
16635
16665
  const s = ui.games.dailyQuiz;
16636
16666
  const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
16637
- const [selections, setSelections] = (0, import_react108.useState)(/* @__PURE__ */ new Map());
16638
- const [page, setPage] = (0, import_react108.useState)(0);
16667
+ const [selections, setSelections] = (0, import_react109.useState)(/* @__PURE__ */ new Map());
16668
+ const [page, setPage] = (0, import_react109.useState)(0);
16639
16669
  const clientState = parseClientState6(result?.clientStateJson);
16640
16670
  const results2 = clientState?.results ?? [];
16641
16671
  const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
@@ -16745,7 +16775,7 @@ function DailyQuizGame({
16745
16775
  }
16746
16776
 
16747
16777
  // src/components/games/MatchdayPredictorGame.tsx
16748
- var import_react109 = require("react");
16778
+ var import_react110 = require("react");
16749
16779
  var import_jsx_runtime136 = require("react/jsx-runtime");
16750
16780
  var SCORER_SEARCH_THRESHOLD = 9;
16751
16781
  function parseClientState7(json) {
@@ -16841,12 +16871,12 @@ function MatchdayPredictorGame({
16841
16871
  onBack
16842
16872
  }) {
16843
16873
  const t = ui.games.predictor;
16844
- const [homeScore, setHomeScore] = (0, import_react109.useState)(0);
16845
- const [awayScore, setAwayScore] = (0, import_react109.useState)(0);
16846
- const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react109.useState)(null);
16847
- const [lastEdited, setLastEdited] = (0, import_react109.useState)("home");
16848
- const [query, setQuery] = (0, import_react109.useState)("");
16849
- const searchId = (0, import_react109.useId)();
16874
+ const [homeScore, setHomeScore] = (0, import_react110.useState)(0);
16875
+ const [awayScore, setAwayScore] = (0, import_react110.useState)(0);
16876
+ const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react110.useState)(null);
16877
+ const [lastEdited, setLastEdited] = (0, import_react110.useState)("home");
16878
+ const [query, setQuery] = (0, import_react110.useState)("");
16879
+ const searchId = (0, import_react110.useId)();
16850
16880
  const clientState = parseClientState7(result?.clientStateJson);
16851
16881
  const alreadyPlayed = result?.alreadyPlayed === true;
16852
16882
  const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
@@ -17013,7 +17043,7 @@ function MatchdayPredictorGame({
17013
17043
  }
17014
17044
 
17015
17045
  // src/components/games/StartingXiGame.tsx
17016
- var import_react110 = require("react");
17046
+ var import_react111 = require("react");
17017
17047
  var import_jsx_runtime137 = require("react/jsx-runtime");
17018
17048
  var POINTS_PER_STARTER = 8;
17019
17049
  var XI_SIZE = 11;
@@ -17057,10 +17087,10 @@ function StartingXiGame({
17057
17087
  lockAtUtc
17058
17088
  }) {
17059
17089
  const t = ui.games.startingXi;
17060
- const [slotPlayers, setSlotPlayers] = (0, import_react110.useState)(() => Array(XI_SIZE).fill(null));
17061
- const [active, setActive] = (0, import_react110.useState)(0);
17062
- const [query, setQuery] = (0, import_react110.useState)("");
17063
- const searchId = (0, import_react110.useId)();
17090
+ const [slotPlayers, setSlotPlayers] = (0, import_react111.useState)(() => Array(XI_SIZE).fill(null));
17091
+ const [active, setActive] = (0, import_react111.useState)(0);
17092
+ const [query, setQuery] = (0, import_react111.useState)("");
17093
+ const searchId = (0, import_react111.useId)();
17064
17094
  const clientState = parseClientState8(result?.clientStateJson);
17065
17095
  const alreadyPlayed = result?.alreadyPlayed === true;
17066
17096
  const header = /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
@@ -17199,7 +17229,7 @@ function StartingXiGame({
17199
17229
  }
17200
17230
 
17201
17231
  // src/components/games/StatLadderGame.tsx
17202
- var import_react111 = require("react");
17232
+ var import_react112 = require("react");
17203
17233
  var import_jsx_runtime138 = require("react/jsx-runtime");
17204
17234
  function ladderClue(ladder) {
17205
17235
  const mystery = ladder.find((r) => r.rank === 2);
@@ -17236,9 +17266,9 @@ function StatLadderGame({
17236
17266
  onBack
17237
17267
  }) {
17238
17268
  const t = ui.games.statLadder;
17239
- const [query, setQuery] = (0, import_react111.useState)("");
17240
- const [selectedId, setSelectedId] = (0, import_react111.useState)(null);
17241
- const searchId = (0, import_react111.useId)();
17269
+ const [query, setQuery] = (0, import_react112.useState)("");
17270
+ const [selectedId, setSelectedId] = (0, import_react112.useState)(null);
17271
+ const searchId = (0, import_react112.useId)();
17242
17272
  const clientState = parseClientState9(result?.clientStateJson);
17243
17273
  const revealed = clientState != null;
17244
17274
  const header = /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
@@ -17444,8 +17474,8 @@ function GameScreenHost({
17444
17474
  ui
17445
17475
  }) {
17446
17476
  const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
17447
- const [configJson, setConfigJson] = (0, import_react112.useState)(null);
17448
- (0, import_react112.useEffect)(() => {
17477
+ const [configJson, setConfigJson] = (0, import_react113.useState)(null);
17478
+ (0, import_react113.useEffect)(() => {
17449
17479
  setConfigJson(null);
17450
17480
  if (!conversation) return;
17451
17481
  let cancelled = false;
@@ -17468,12 +17498,12 @@ function GameScreenHost({
17468
17498
  fixtureId: fixtureId || void 0,
17469
17499
  locale: ui.hostTag
17470
17500
  });
17471
- (0, import_react112.useEffect)(() => {
17501
+ (0, import_react113.useEffect)(() => {
17472
17502
  if (conversation) hydrate();
17473
17503
  }, [conversation, gameId]);
17474
- const hydrateRef = (0, import_react112.useRef)(hydrate);
17504
+ const hydrateRef = (0, import_react113.useRef)(hydrate);
17475
17505
  hydrateRef.current = hydrate;
17476
- (0, import_react112.useEffect)(() => {
17506
+ (0, import_react113.useEffect)(() => {
17477
17507
  if (!FIXTURE_GAME_IDS.has(gameId)) return;
17478
17508
  if (rawStatus !== "pending") return;
17479
17509
  const timerId = setInterval(() => {
@@ -17586,7 +17616,7 @@ function GameScreenHost({
17586
17616
  }
17587
17617
 
17588
17618
  // src/components/Leaderboard.tsx
17589
- var import_react113 = require("react");
17619
+ var import_react114 = require("react");
17590
17620
 
17591
17621
  // src/components/LeaderboardRow.tsx
17592
17622
  var import_jsx_runtime141 = require("react/jsx-runtime");
@@ -17673,7 +17703,7 @@ function Leaderboard({
17673
17703
  ui,
17674
17704
  onPlay
17675
17705
  }) {
17676
- const [segment, setSegment] = (0, import_react113.useState)("weekly");
17706
+ const [segment, setSegment] = (0, import_react114.useState)("weekly");
17677
17707
  const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
17678
17708
  const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
17679
17709
  const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
@@ -17778,9 +17808,9 @@ function GamesPanel({
17778
17808
  leaderboardLoading,
17779
17809
  refreshHub
17780
17810
  }) {
17781
- const [selected, setSelected] = (0, import_react114.useState)(null);
17782
- const [segment, setSegment] = (0, import_react114.useState)("play");
17783
- (0, import_react114.useEffect)(() => {
17811
+ const [selected, setSelected] = (0, import_react115.useState)(null);
17812
+ const [segment, setSegment] = (0, import_react115.useState)("play");
17813
+ (0, import_react115.useEffect)(() => {
17784
17814
  ensureGamesFonts();
17785
17815
  }, []);
17786
17816
  if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(GamesLoginWall, { ui });
@@ -17844,10 +17874,10 @@ function GamesPanel({
17844
17874
  }
17845
17875
 
17846
17876
  // src/components/FavouritesPanel.tsx
17847
- var import_react117 = require("react");
17877
+ var import_react118 = require("react");
17848
17878
 
17849
17879
  // src/components/FavouriteChips.tsx
17850
- var import_react115 = require("react");
17880
+ var import_react116 = require("react");
17851
17881
  var import_jsx_runtime146 = require("react/jsx-runtime");
17852
17882
  async function toggleWithNotice(controller, kind, id, onNotice) {
17853
17883
  const outcome = await controller.toggle(kind, id);
@@ -17893,12 +17923,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
17893
17923
  ] });
17894
17924
  }
17895
17925
  function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
17896
- const [confirming, setConfirming] = (0, import_react115.useState)(false);
17926
+ const [confirming, setConfirming] = (0, import_react116.useState)(false);
17897
17927
  const data = controller.data;
17898
- (0, import_react115.useEffect)(() => {
17928
+ (0, import_react116.useEffect)(() => {
17899
17929
  setConfirming(false);
17900
17930
  }, [sport]);
17901
- (0, import_react115.useEffect)(() => {
17931
+ (0, import_react116.useEffect)(() => {
17902
17932
  if (!confirming) return;
17903
17933
  const onPointerDown = (e) => {
17904
17934
  if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
@@ -17952,21 +17982,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
17952
17982
  }
17953
17983
 
17954
17984
  // src/components/FavouritesSearch.tsx
17955
- var import_react116 = require("react");
17985
+ var import_react117 = require("react");
17956
17986
  var import_jsx_runtime147 = require("react/jsx-runtime");
17957
17987
  var MIN_LETTERS = 2;
17958
17988
  var MAX_LENGTH = 64;
17959
17989
  var DEBOUNCE_MS = 250;
17960
17990
  function FavouritesSearch({ controller, ui, sport, onNotice }) {
17961
- const [query, setQuery] = (0, import_react116.useState)("");
17962
- const [answer, setAnswer] = (0, import_react116.useState)(null);
17963
- const controllerRef = (0, import_react116.useRef)(controller);
17991
+ const [query, setQuery] = (0, import_react117.useState)("");
17992
+ const [answer, setAnswer] = (0, import_react117.useState)(null);
17993
+ const controllerRef = (0, import_react117.useRef)(controller);
17964
17994
  controllerRef.current = controller;
17965
17995
  const trimmed = query.trim();
17966
17996
  const queryKey = `${sport}|${trimmed}`;
17967
17997
  const results2 = answer?.key === queryKey ? answer.rows : [];
17968
17998
  const settled = answer?.key === queryKey;
17969
- (0, import_react116.useEffect)(() => {
17999
+ (0, import_react117.useEffect)(() => {
17970
18000
  setAnswer(null);
17971
18001
  if (trimmed.length < MIN_LETTERS) return;
17972
18002
  let cancelled = false;
@@ -18029,13 +18059,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
18029
18059
  // src/components/FavouritesPanel.tsx
18030
18060
  var import_jsx_runtime148 = require("react/jsx-runtime");
18031
18061
  function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
18032
- const [notice, setNotice] = (0, import_react117.useState)(null);
18033
- const refreshRef = (0, import_react117.useRef)(controller.refresh);
18062
+ const [notice, setNotice] = (0, import_react118.useState)(null);
18063
+ const refreshRef = (0, import_react118.useRef)(controller.refresh);
18034
18064
  refreshRef.current = controller.refresh;
18035
- (0, import_react117.useEffect)(() => {
18065
+ (0, import_react118.useEffect)(() => {
18036
18066
  void refreshRef.current();
18037
18067
  }, []);
18038
- (0, import_react117.useEffect)(() => {
18068
+ (0, import_react118.useEffect)(() => {
18039
18069
  setNotice(null);
18040
18070
  }, [sport]);
18041
18071
  const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
@@ -18061,11 +18091,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
18061
18091
  }
18062
18092
 
18063
18093
  // src/components/PresetTools.tsx
18064
- var import_react118 = require("react");
18094
+ var import_react119 = require("react");
18065
18095
  var import_jsx_runtime149 = require("react/jsx-runtime");
18066
18096
  function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
18067
18097
  const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
18068
- const titleId = (0, import_react118.useId)();
18098
+ const titleId = (0, import_react119.useId)();
18069
18099
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
18070
18100
  /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "ss-w-tool-head", children: [
18071
18101
  /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
@@ -18115,9 +18145,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
18115
18145
  const totalOptions = comboTotals(grid);
18116
18146
  const totals = totalOptions.map((o) => o.value);
18117
18147
  const legChoices = comboLegChoices(grid);
18118
- const [total, setTotal] = (0, import_react118.useState)(() => nearest(totals, initialTotal));
18119
- const [legs, setLegs] = (0, import_react118.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
18120
- const [announcement, setAnnouncement] = (0, import_react118.useState)("");
18148
+ const [total, setTotal] = (0, import_react119.useState)(() => nearest(totals, initialTotal));
18149
+ const [legs, setLegs] = (0, import_react119.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
18150
+ const [announcement, setAnnouncement] = (0, import_react119.useState)("");
18121
18151
  const cell2 = findCombo(grid, total, legs);
18122
18152
  const minLegs = legChoices[0] ?? legs;
18123
18153
  const maxLegs = legChoices[legChoices.length - 1] ?? legs;
@@ -18156,7 +18186,7 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
18156
18186
  }
18157
18187
 
18158
18188
  // src/components/dashboard/v8/SentenceBuilder.tsx
18159
- var import_react119 = require("react");
18189
+ var import_react120 = require("react");
18160
18190
  var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
18161
18191
  var import_jsx_runtime151 = require("react/jsx-runtime");
18162
18192
  var TOTALS = ["any", "3", "5", "10", "20", "50"];
@@ -18197,8 +18227,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18197
18227
  const opening = openingGames(preset);
18198
18228
  const gamesOptions = opening.options;
18199
18229
  const marketOptions = usableMarkets(preset);
18200
- const [fingerprint] = (0, import_react119.useState)(() => JSON.stringify(preset));
18201
- const [saved] = (0, import_react119.useState)(() => {
18230
+ const [fingerprint] = (0, import_react120.useState)(() => JSON.stringify(preset));
18231
+ const [saved] = (0, import_react120.useState)(() => {
18202
18232
  const kept = memory3?.savedView(sport);
18203
18233
  return kept && kept.fingerprint === fingerprint ? kept : null;
18204
18234
  });
@@ -18213,9 +18243,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18213
18243
  // The server never widens by itself: an all-games preset with no ids asks for it.
18214
18244
  widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
18215
18245
  };
18216
- const [view, setView] = (0, import_react119.useState)(() => saved?.view ?? openingView);
18217
- const autoWidened = (0, import_react119.useRef)(false);
18218
- const [widenedNote, setWidenedNote] = (0, import_react119.useState)(saved?.widenedNote ?? false);
18246
+ const [view, setView] = (0, import_react120.useState)(() => saved?.view ?? openingView);
18247
+ const autoWidened = (0, import_react120.useRef)(false);
18248
+ const [widenedNote, setWidenedNote] = (0, import_react120.useState)(saved?.widenedNote ?? false);
18219
18249
  const track = useTrack();
18220
18250
  const requestFor = (v, extra) => ({
18221
18251
  sport,
@@ -18231,18 +18261,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18231
18261
  ...operatorUserId ? { operatorUserId } : {},
18232
18262
  ...anonymousUserId ? { anonymousUserId } : {}
18233
18263
  });
18234
- const [editing, setEditing] = (0, import_react119.useState)(false);
18235
- const [draft, setDraft] = (0, import_react119.useState)("");
18236
- const [invalid, setInvalid] = (0, import_react119.useState)(null);
18237
- const inputRef = (0, import_react119.useRef)(null);
18238
- const pencilRef = (0, import_react119.useRef)(null);
18239
- const noteId = (0, import_react119.useId)();
18240
- const customId = (0, import_react119.useId)();
18241
- (0, import_react119.useEffect)(() => {
18264
+ const [editing, setEditing] = (0, import_react120.useState)(false);
18265
+ const [draft, setDraft] = (0, import_react120.useState)("");
18266
+ const [invalid, setInvalid] = (0, import_react120.useState)(null);
18267
+ const inputRef = (0, import_react120.useRef)(null);
18268
+ const pencilRef = (0, import_react120.useRef)(null);
18269
+ const noteId = (0, import_react120.useId)();
18270
+ const customId = (0, import_react120.useId)();
18271
+ (0, import_react120.useEffect)(() => {
18242
18272
  if (editing) inputRef.current?.focus();
18243
18273
  }, [editing]);
18244
18274
  const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
18245
- (0, import_react119.useEffect)(() => {
18275
+ (0, import_react120.useEffect)(() => {
18246
18276
  if (view.legs === 1) {
18247
18277
  setEditing(false);
18248
18278
  setDraft("");
@@ -18258,16 +18288,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18258
18288
  setEditing(false);
18259
18289
  pencilRef.current?.focus();
18260
18290
  };
18261
- const [first] = (0, import_react119.useState)(() => requestFor(view));
18291
+ const [first] = (0, import_react120.useState)(() => requestFor(view));
18262
18292
  const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
18263
- const [shown2, setShown] = (0, import_react119.useState)(null);
18293
+ const [shown2, setShown] = (0, import_react120.useState)(null);
18264
18294
  if (grid === null) {
18265
18295
  if (shown2 !== null && status2 === "ready") setShown(null);
18266
18296
  } else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
18267
18297
  setShown(shownAfter(shown2, grid, answeredFor));
18268
18298
  }
18269
- const lastRequest = (0, import_react119.useRef)(first);
18270
- (0, import_react119.useEffect)(() => {
18299
+ const lastRequest = (0, import_react120.useRef)(first);
18300
+ (0, import_react120.useEffect)(() => {
18271
18301
  void request(lastRequest.current);
18272
18302
  }, [request]);
18273
18303
  const send = (req) => {
@@ -18305,7 +18335,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18305
18335
  };
18306
18336
  const canNarrow = preset.matchIds.length > 0;
18307
18337
  const ready = status2 === "ready" && grid !== null;
18308
- const [tapped, setTapped] = (0, import_react119.useState)(null);
18338
+ const [tapped, setTapped] = (0, import_react120.useState)(null);
18309
18339
  const busy = tapped !== null && status2 === "loading" && shown2 !== null;
18310
18340
  const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
18311
18341
  const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
@@ -18314,8 +18344,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18314
18344
  ...[preset.legs, suggested].filter((n) => n !== null && n > 4)
18315
18345
  ])).sort((a, b) => a - b);
18316
18346
  const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
18317
- const sectionRef = (0, import_react119.useRef)(null);
18318
- (0, import_react119.useEffect)(() => {
18347
+ const sectionRef = (0, import_react120.useRef)(null);
18348
+ (0, import_react120.useEffect)(() => {
18319
18349
  if (tapped === null || status2 !== "ready") return;
18320
18350
  setTapped(null);
18321
18351
  const root = sectionRef.current;
@@ -18332,14 +18362,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18332
18362
  }, [tapped, status2]);
18333
18363
  const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
18334
18364
  useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
18335
- const [startedNote, setStartedNote] = (0, import_react119.useState)(false);
18365
+ const [startedNote, setStartedNote] = (0, import_react120.useState)(false);
18336
18366
  const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
18337
- (0, import_react119.useEffect)(() => {
18367
+ (0, import_react120.useEffect)(() => {
18338
18368
  if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
18339
18369
  }, [startedNote, status2, anyStarted]);
18340
18370
  const market = rows?.[0]?.market;
18341
- const [seen2, setSeen] = (0, import_react119.useState)(null);
18342
- (0, import_react119.useEffect)(() => {
18371
+ const [seen2, setSeen] = (0, import_react120.useState)(null);
18372
+ (0, import_react120.useEffect)(() => {
18343
18373
  if (market) setSeen(market);
18344
18374
  }, [market]);
18345
18375
  const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
@@ -18383,14 +18413,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
18383
18413
  };
18384
18414
  };
18385
18415
  const canWiden = gamesOptions === null || allGames !== null;
18386
- (0, import_react119.useEffect)(() => {
18416
+ (0, import_react120.useEffect)(() => {
18387
18417
  if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
18388
18418
  autoWidened.current = true;
18389
18419
  const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
18390
18420
  commit(next, true);
18391
18421
  send(requestFor(next));
18392
18422
  }, [empty2, singles, widened, canWiden, view]);
18393
- (0, import_react119.useEffect)(() => {
18423
+ (0, import_react120.useEffect)(() => {
18394
18424
  if (coolOff) onCoolOff?.(sport);
18395
18425
  }, [coolOff, onCoolOff, sport]);
18396
18426
  if (coolOff) return null;
@@ -18857,10 +18887,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
18857
18887
  }
18858
18888
 
18859
18889
  // src/components/PlayerPhoto.tsx
18860
- var import_react120 = require("react");
18890
+ var import_react121 = require("react");
18861
18891
  var import_jsx_runtime157 = require("react/jsx-runtime");
18862
18892
  function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
18863
- const [failed, setFailed] = (0, import_react120.useState)(false);
18893
+ const [failed, setFailed] = (0, import_react121.useState)(false);
18864
18894
  const box = { width: size, height: size };
18865
18895
  if (photoUrl && !failed) {
18866
18896
  return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
@@ -18895,7 +18925,7 @@ function MiniPitch({ positionCode }) {
18895
18925
  }
18896
18926
 
18897
18927
  // src/components/PerformanceBars.tsx
18898
- var import_react121 = require("react");
18928
+ var import_react122 = require("react");
18899
18929
  var import_jsx_runtime159 = require("react/jsx-runtime");
18900
18930
  var GROUPS = ["shooting", "passing", "possession", "defending"];
18901
18931
  function finite4(v) {
@@ -18941,7 +18971,7 @@ function unrankedLine(ui, reason) {
18941
18971
  }
18942
18972
  }
18943
18973
  function PerformanceBars({ performance, competitionName, strings }) {
18944
- const [mode, setMode] = (0, import_react121.useState)("total");
18974
+ const [mode, setMode] = (0, import_react122.useState)("total");
18945
18975
  const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
18946
18976
  if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
18947
18977
  const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
@@ -19150,8 +19180,8 @@ function SettingsSheet({ ui, onClose }) {
19150
19180
  var import_jsx_runtime162 = require("react/jsx-runtime");
19151
19181
  var FULLSCREEN_QUERY = "(max-width: 639px)";
19152
19182
  function useIsModal() {
19153
- const [modal, setModal] = (0, import_react122.useState)(false);
19154
- (0, import_react122.useEffect)(() => {
19183
+ const [modal, setModal] = (0, import_react123.useState)(false);
19184
+ (0, import_react123.useEffect)(() => {
19155
19185
  if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
19156
19186
  const mql = window.matchMedia(FULLSCREEN_QUERY);
19157
19187
  const sync = () => setModal(mql.matches);
@@ -19165,12 +19195,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
19165
19195
  var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
19166
19196
  function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
19167
19197
  const { state, close, stop, send, reset } = controller;
19168
- const [squadView, setSquadView] = (0, import_react122.useState)("roster");
19169
- const [selectedPlayerId, setSelectedPlayerId] = (0, import_react122.useState)(null);
19198
+ const [squadView, setSquadView] = (0, import_react123.useState)("roster");
19199
+ const [selectedPlayerId, setSelectedPlayerId] = (0, import_react123.useState)(null);
19170
19200
  const clearPlayerDetail = clubPlayerDetailResult?.clear;
19171
19201
  const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
19172
- const squadLayerRef = (0, import_react122.useRef)(null);
19173
- const squadScrollRef = (0, import_react122.useRef)(null);
19202
+ const squadLayerRef = (0, import_react123.useRef)(null);
19203
+ const squadScrollRef = (0, import_react123.useRef)(null);
19174
19204
  const selectPlayer = (playerId) => {
19175
19205
  squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
19176
19206
  setSelectedPlayerId(playerId);
@@ -19180,7 +19210,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19180
19210
  setSelectedPlayerId(null);
19181
19211
  clearPlayerDetail?.();
19182
19212
  };
19183
- (0, import_react122.useLayoutEffect)(() => {
19213
+ (0, import_react123.useLayoutEffect)(() => {
19184
19214
  if (selectedPlayerId !== null || squadScrollRef.current === null) return;
19185
19215
  const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
19186
19216
  if (list) list.scrollTop = squadScrollRef.current;
@@ -19193,7 +19223,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19193
19223
  const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
19194
19224
  const tabs = monitor ?? (hasBuilder ? tabState : void 0);
19195
19225
  const activeTab = tabs?.activeTab;
19196
- (0, import_react122.useEffect)(() => {
19226
+ (0, import_react123.useEffect)(() => {
19197
19227
  if (activeTab === "squad" || selectedPlayerId === null) return;
19198
19228
  setSelectedPlayerId(null);
19199
19229
  clearPlayerDetail?.();
@@ -19202,11 +19232,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19202
19232
  const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
19203
19233
  const favouritesAskedOpen = favourites?.open ?? false;
19204
19234
  const setFavouritesOpen = favourites?.onOpenChange;
19205
- (0, import_react122.useEffect)(() => {
19235
+ (0, import_react123.useEffect)(() => {
19206
19236
  if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
19207
19237
  }, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
19208
19238
  const storedTab = tabState?.activeTab;
19209
- (0, import_react122.useEffect)(() => {
19239
+ (0, import_react123.useEffect)(() => {
19210
19240
  const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
19211
19241
  if (unreachable) setMonitorTab?.("chat");
19212
19242
  }, [storedTab, hasBuilder, monitor, setMonitorTab]);
@@ -19215,12 +19245,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19215
19245
  const closeTab = tabs?.activeTab ?? "chat";
19216
19246
  const lastMessage = state.messages[state.messages.length - 1];
19217
19247
  const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
19218
- const closeWith = (0, import_react122.useCallback)((method) => {
19248
+ const closeWith = (0, import_react123.useCallback)((method) => {
19219
19249
  track({ name: "widget_close", method, tab: closeTab, answering });
19220
19250
  if (onCloseRequested) onCloseRequested();
19221
19251
  else close();
19222
19252
  }, [track, closeTab, answering, close, onCloseRequested]);
19223
- (0, import_react122.useEffect)(() => {
19253
+ (0, import_react123.useEffect)(() => {
19224
19254
  const onKey = (e) => {
19225
19255
  if (e.key === "Escape") closeWith("escape");
19226
19256
  };
@@ -19236,78 +19266,78 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19236
19266
  tabs?.setActiveTab("chat");
19237
19267
  send(text2, { grounding, source });
19238
19268
  };
19239
- (0, import_react122.useEffect)(() => {
19269
+ (0, import_react123.useEffect)(() => {
19240
19270
  if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
19241
19271
  }, [monitor, state.isStreaming, state.messages.length]);
19242
19272
  const onChatTab = !tabs || tabs.activeTab === "chat";
19243
- const inputRef = (0, import_react122.useRef)(null);
19244
- const limitRef = (0, import_react122.useRef)(null);
19245
- const typedSendRef = (0, import_react122.useRef)(false);
19246
- const focusAfterCloseRef = (0, import_react122.useRef)(null);
19247
- const [tool, setTool] = (0, import_react122.useState)(null);
19248
- const panelRef = (0, import_react122.useRef)(null);
19249
- const [settingsOpen, setSettingsOpen] = (0, import_react122.useState)(false);
19250
- const openSettings = (0, import_react122.useCallback)(() => {
19273
+ const inputRef = (0, import_react123.useRef)(null);
19274
+ const limitRef = (0, import_react123.useRef)(null);
19275
+ const typedSendRef = (0, import_react123.useRef)(false);
19276
+ const focusAfterCloseRef = (0, import_react123.useRef)(null);
19277
+ const [tool, setTool] = (0, import_react123.useState)(null);
19278
+ const panelRef = (0, import_react123.useRef)(null);
19279
+ const [settingsOpen, setSettingsOpen] = (0, import_react123.useState)(false);
19280
+ const openSettings = (0, import_react123.useCallback)(() => {
19251
19281
  setTool(null);
19252
19282
  setFavouritesOpen?.(false);
19253
19283
  setSettingsOpen(true);
19254
19284
  }, [setFavouritesOpen]);
19255
- const closeSettings = (0, import_react122.useCallback)(() => {
19285
+ const closeSettings = (0, import_react123.useCallback)(() => {
19256
19286
  setSettingsOpen(false);
19257
19287
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
19258
19288
  }, []);
19259
- const openFavourites = (0, import_react122.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
19260
- const closeFavourites = (0, import_react122.useCallback)(() => {
19289
+ const openFavourites = (0, import_react123.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
19290
+ const closeFavourites = (0, import_react123.useCallback)(() => {
19261
19291
  setFavouritesOpen?.(false);
19262
19292
  panelRef.current?.querySelector(".ss-w-kebab")?.focus();
19263
19293
  }, [setFavouritesOpen]);
19264
- (0, import_react122.useEffect)(() => {
19294
+ (0, import_react123.useEffect)(() => {
19265
19295
  if (!favouritesOpen) return;
19266
19296
  setTool(null);
19267
19297
  setSettingsOpen(false);
19268
19298
  }, [favouritesOpen]);
19269
19299
  const paused = isPaused(state.limit);
19270
- (0, import_react122.useEffect)(() => {
19300
+ (0, import_react123.useEffect)(() => {
19271
19301
  if (paused) setTool(null);
19272
19302
  }, [paused]);
19273
- (0, import_react122.useEffect)(() => {
19303
+ (0, import_react123.useEffect)(() => {
19274
19304
  if (!paused) return;
19275
19305
  if (typedSendRef.current) limitRef.current?.focus();
19276
19306
  typedSendRef.current = false;
19277
19307
  }, [paused]);
19278
- const openTool = (0, import_react122.useCallback)((next) => {
19308
+ const openTool = (0, import_react123.useCallback)((next) => {
19279
19309
  setTool(next);
19280
19310
  }, []);
19281
- const toolsValue = (0, import_react122.useMemo)(
19311
+ const toolsValue = (0, import_react123.useMemo)(
19282
19312
  () => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
19283
19313
  [presetGrid, paused, openTool, ui.presets.changeCombo]
19284
19314
  );
19285
- const closeTool = (0, import_react122.useCallback)(() => {
19315
+ const closeTool = (0, import_react123.useCallback)(() => {
19286
19316
  focusAfterCloseRef.current = "composer";
19287
19317
  setTool(null);
19288
19318
  }, []);
19289
- const sendAsk = (0, import_react122.useCallback)((ask) => {
19319
+ const sendAsk = (0, import_react123.useCallback)((ask) => {
19290
19320
  focusAfterCloseRef.current = "composer";
19291
19321
  setTool(null);
19292
19322
  tabs?.setActiveTab("chat");
19293
19323
  send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
19294
19324
  }, [tabs, send]);
19295
- const formatKickoff = (0, import_react122.useCallback)((kickoffUtc) => {
19325
+ const formatKickoff = (0, import_react123.useCallback)((kickoffUtc) => {
19296
19326
  const k = ui.bettingKickoff(kickoffUtc);
19297
19327
  return `${k.dayLabel} ${k.time}`;
19298
19328
  }, [ui]);
19299
- (0, import_react122.useEffect)(() => {
19329
+ (0, import_react123.useEffect)(() => {
19300
19330
  if (tool) return;
19301
19331
  const target = focusAfterCloseRef.current;
19302
19332
  focusAfterCloseRef.current = null;
19303
19333
  if (target === "composer") inputRef.current?.focus();
19304
19334
  }, [tool]);
19305
- (0, import_react122.useEffect)(() => {
19335
+ (0, import_react123.useEffect)(() => {
19306
19336
  if (!tool || onChatTab && presetGrid) return;
19307
19337
  focusAfterCloseRef.current = "composer";
19308
19338
  setTool(null);
19309
19339
  }, [tool, onChatTab, presetGrid]);
19310
- const backRef = (0, import_react122.useRef)(() => false);
19340
+ const backRef = (0, import_react123.useRef)(() => false);
19311
19341
  backRef.current = () => {
19312
19342
  if (favouritesOpen) {
19313
19343
  closeFavourites();
@@ -19331,7 +19361,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
19331
19361
  }
19332
19362
  return false;
19333
19363
  };
19334
- (0, import_react122.useEffect)(() => {
19364
+ (0, import_react123.useEffect)(() => {
19335
19365
  if (!onRegisterBack) return;
19336
19366
  onRegisterBack(() => backRef.current());
19337
19367
  return () => onRegisterBack(null);
@@ -22436,19 +22466,19 @@ function injectStyles(root) {
22436
22466
  function StatsWidget(props) {
22437
22467
  const injectedClient = "client" in props ? props.client : void 0;
22438
22468
  const cfg = props.config;
22439
- const onUnavailableRef = (0, import_react123.useRef)(cfg?.onUnavailable);
22469
+ const onUnavailableRef = (0, import_react124.useRef)(cfg?.onUnavailable);
22440
22470
  onUnavailableRef.current = cfg?.onUnavailable;
22441
- const built = (0, import_react123.useMemo)(() => buildClient(props, (reason) => {
22471
+ const built = (0, import_react124.useMemo)(() => buildClient(props, (reason) => {
22442
22472
  try {
22443
22473
  onUnavailableRef.current?.(reason);
22444
22474
  } catch {
22445
22475
  }
22446
22476
  }), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]);
22447
- const trackingRef = (0, import_react123.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
22448
- const track = (0, import_react123.useMemo)(() => createTracker(() => trackingRef.current), []);
22449
- const eventTextRef = (0, import_react123.useRef)(false);
22477
+ const trackingRef = (0, import_react124.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
22478
+ const track = (0, import_react124.useMemo)(() => createTracker(() => trackingRef.current), []);
22479
+ const eventTextRef = (0, import_react124.useRef)(false);
22450
22480
  eventTextRef.current = cfg?.eventText === true;
22451
- const logger = (0, import_react123.useMemo)(() => {
22481
+ const logger = (0, import_react124.useMemo)(() => {
22452
22482
  if (!built) return null;
22453
22483
  const raw = built.client.createEventLogger({
22454
22484
  operatorUserId: cfg?.userContext?.operatorUserId,
@@ -22458,27 +22488,27 @@ function StatsWidget(props) {
22458
22488
  }, [built?.client, track]);
22459
22489
  const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
22460
22490
  const stringsPending = widgetStrings.strings === void 0;
22461
- const ui = (0, import_react123.useMemo)(
22491
+ const ui = (0, import_react124.useMemo)(
22462
22492
  () => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
22463
22493
  [props.config, widgetStrings.strings]
22464
22494
  );
22465
22495
  const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
22466
- const rootRef = (0, import_react123.useRef)(null);
22467
- const introDoneRef = (0, import_react123.useRef)(false);
22468
- const markIntroDone = (0, import_react123.useCallback)(() => {
22496
+ const rootRef = (0, import_react124.useRef)(null);
22497
+ const introDoneRef = (0, import_react124.useRef)(false);
22498
+ const markIntroDone = (0, import_react124.useCallback)(() => {
22469
22499
  introDoneRef.current = true;
22470
22500
  }, []);
22471
22501
  const language = injectedClient ? void 0 : hostTag(cfg);
22472
22502
  const threadLanguage = familyOf(language);
22473
22503
  const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${cfg?.userContext?.anonymousUserId ? `:a=${cfg.userContext.anonymousUserId}` : ""}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
22474
- const sportScope = (0, import_react123.useMemo)(
22504
+ const sportScope = (0, import_react124.useMemo)(
22475
22505
  () => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
22476
22506
  [cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
22477
22507
  );
22478
- const chatTracking = (0, import_react123.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
22508
+ const chatTracking = (0, import_react124.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
22479
22509
  const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
22480
22510
  const panelOpen = controller.state.isOpen && !stringsPending;
22481
- const liveCardWatches = (0, import_react123.useMemo)(() => {
22511
+ const liveCardWatches = (0, import_react124.useMemo)(() => {
22482
22512
  const seen2 = /* @__PURE__ */ new Set();
22483
22513
  const out = [];
22484
22514
  for (const msg of controller.state.messages) {
@@ -22504,19 +22534,19 @@ function StatsWidget(props) {
22504
22534
  });
22505
22535
  const operatorUserId = cfg?.userContext?.operatorUserId;
22506
22536
  const anonymousUserId = cfg?.userContext?.anonymousUserId;
22507
- const getSchedule = (0, import_react123.useCallback)(
22537
+ const getSchedule = (0, import_react124.useCallback)(
22508
22538
  (localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
22509
22539
  [built, operatorUserId, anonymousUserId]
22510
22540
  );
22511
- const getStates = (0, import_react123.useCallback)(
22541
+ const getStates = (0, import_react124.useCallback)(
22512
22542
  (matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
22513
22543
  [built, requestTag]
22514
22544
  );
22515
- const getTennisPrices = (0, import_react123.useCallback)(
22545
+ const getTennisPrices = (0, import_react124.useCallback)(
22516
22546
  (keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
22517
22547
  [built, requestTag]
22518
22548
  );
22519
- const pinnedMatchIds = (0, import_react123.useMemo)(
22549
+ const pinnedMatchIds = (0, import_react124.useMemo)(
22520
22550
  () => footballMatchPinIds(monitor.pins),
22521
22551
  [monitor.pins]
22522
22552
  );
@@ -22530,13 +22560,13 @@ function StatsWidget(props) {
22530
22560
  pinnedMatchIds,
22531
22561
  timeZone: ui.timeZone
22532
22562
  });
22533
- const offeredSports = (0, import_react123.useMemo)(() => {
22563
+ const offeredSports = (0, import_react124.useMemo)(() => {
22534
22564
  const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
22535
22565
  for (const g of discovery.groups) seen2.add(g.sport ?? "football");
22536
22566
  return [...seen2];
22537
22567
  }, [discovery.matchDays, discovery.groups]);
22538
22568
  const scheduleSport = useScheduleSport(offeredSports);
22539
- const [liveLeague, setLiveLeague] = (0, import_react123.useState)(null);
22569
+ const [liveLeague, setLiveLeague] = (0, import_react124.useState)(null);
22540
22570
  const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
22541
22571
  const matchesLoaded = useMatchesDay({
22542
22572
  discovery,
@@ -22546,8 +22576,8 @@ function StatsWidget(props) {
22546
22576
  enabled: panelOpen && monitor.activeTab === "matches",
22547
22577
  timeZone: ui.timeZone
22548
22578
  });
22549
- const prevLiveSnapshotRef = (0, import_react123.useRef)(monitor.snapshot);
22550
- (0, import_react123.useEffect)(() => {
22579
+ const prevLiveSnapshotRef = (0, import_react124.useRef)(monitor.snapshot);
22580
+ (0, import_react124.useEffect)(() => {
22551
22581
  const snap = monitor.snapshot;
22552
22582
  if (!snap || snap === prevLiveSnapshotRef.current) return;
22553
22583
  prevLiveSnapshotRef.current = snap;
@@ -22587,14 +22617,14 @@ function StatsWidget(props) {
22587
22617
  const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
22588
22618
  const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
22589
22619
  const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
22590
- const [favSportPick, setFavSportPick] = (0, import_react123.useState)(null);
22591
- const latestGreeting = (0, import_react123.useMemo)(() => {
22620
+ const [favSportPick, setFavSportPick] = (0, import_react124.useState)(null);
22621
+ const latestGreeting = (0, import_react124.useMemo)(() => {
22592
22622
  for (const m of [...controller.state.messages].reverse()) {
22593
22623
  if (m.role === "assistant" && m.defaultSport !== void 0) return m;
22594
22624
  }
22595
22625
  return null;
22596
22626
  }, [controller.state.messages]);
22597
- const favSportOptions = (0, import_react123.useMemo)(
22627
+ const favSportOptions = (0, import_react124.useMemo)(
22598
22628
  () => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
22599
22629
  [latestGreeting]
22600
22630
  );
@@ -22603,20 +22633,20 @@ function StatsWidget(props) {
22603
22633
  const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
22604
22634
  const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
22605
22635
  const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
22606
- const [builderSportPick, setBuilderSportPick] = (0, import_react123.useState)(null);
22607
- const builderGreeting = (0, import_react123.useMemo)(
22636
+ const [builderSportPick, setBuilderSportPick] = (0, import_react124.useState)(null);
22637
+ const builderGreeting = (0, import_react124.useMemo)(
22608
22638
  () => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
22609
22639
  [controller.state.messages]
22610
22640
  );
22611
- const [coolOff, setCoolOff] = (0, import_react123.useState)(null);
22612
- const onBuilderCoolOff = (0, import_react123.useCallback)((sport) => {
22641
+ const [coolOff, setCoolOff] = (0, import_react124.useState)(null);
22642
+ const onBuilderCoolOff = (0, import_react124.useCallback)((sport) => {
22613
22643
  if (!builderGreeting) return;
22614
22644
  setCoolOff((prev) => {
22615
22645
  const sports = prev?.greeting === builderGreeting ? prev.sports : [];
22616
22646
  return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
22617
22647
  });
22618
22648
  }, [builderGreeting]);
22619
- const builderOptions = (0, import_react123.useMemo)(() => {
22649
+ const builderOptions = (0, import_react124.useMemo)(() => {
22620
22650
  const greeting = builderGreeting;
22621
22651
  if (!greeting) return [];
22622
22652
  const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
@@ -22633,7 +22663,7 @@ function StatsWidget(props) {
22633
22663
  return options.filter((o) => !cooled.includes(o.sport));
22634
22664
  }, [builderGreeting, coolOff, ui]);
22635
22665
  const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
22636
- const [panelEverOpened, setPanelEverOpened] = (0, import_react123.useState)(panelOpen);
22666
+ const [panelEverOpened, setPanelEverOpened] = (0, import_react124.useState)(panelOpen);
22637
22667
  if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
22638
22668
  const favourites = useFavourites({
22639
22669
  conversation: built?.conversation ?? null,
@@ -22645,16 +22675,16 @@ function StatsWidget(props) {
22645
22675
  onChanged: discovery.refreshSchedule
22646
22676
  });
22647
22677
  const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
22648
- const [favouritesOpen, setFavouritesOpen] = (0, import_react123.useState)(false);
22678
+ const [favouritesOpen, setFavouritesOpen] = (0, import_react124.useState)(false);
22649
22679
  if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
22650
- const getPricePresets = (0, import_react123.useCallback)(
22680
+ const getPricePresets = (0, import_react124.useCallback)(
22651
22681
  (locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
22652
22682
  [built]
22653
22683
  );
22654
22684
  const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
22655
22685
  const markLiveActivity = monitor.markLiveActivity;
22656
- const prevLiveCountRef = (0, import_react123.useRef)(0);
22657
- (0, import_react123.useEffect)(() => {
22686
+ const prevLiveCountRef = (0, import_react124.useRef)(0);
22687
+ (0, import_react124.useEffect)(() => {
22658
22688
  const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
22659
22689
  prevLiveCountRef.current = discovery.liveCount;
22660
22690
  if (rose) markLiveActivity();
@@ -22668,7 +22698,7 @@ function StatsWidget(props) {
22668
22698
  closePanel: controller.close
22669
22699
  });
22670
22700
  const markAdded = hostEvents.markAdded;
22671
- const slip = (0, import_react123.useMemo)(
22701
+ const slip = (0, import_react124.useMemo)(
22672
22702
  () => {
22673
22703
  const handler = props.config?.onAddToSlip;
22674
22704
  return {
@@ -22688,7 +22718,7 @@ function StatsWidget(props) {
22688
22718
  },
22689
22719
  [props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
22690
22720
  );
22691
- const onDashboardTap = (0, import_react123.useMemo)(
22721
+ const onDashboardTap = (0, import_react124.useMemo)(
22692
22722
  () => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
22693
22723
  [built, logger]
22694
22724
  );
@@ -22702,21 +22732,22 @@ function StatsWidget(props) {
22702
22732
  log: logger
22703
22733
  })
22704
22734
  }));
22705
- const dismissPopupRef = (0, import_react123.useRef)(() => {
22735
+ const dismissPopupRef = (0, import_react124.useRef)(() => {
22706
22736
  });
22707
- const onCtaRef = (0, import_react123.useRef)(() => {
22737
+ const onCtaRef = (0, import_react124.useRef)(() => {
22708
22738
  });
22709
- const onTeaserTapRef = (0, import_react123.useRef)(() => {
22739
+ const onTeaserTapRef = (0, import_react124.useRef)(() => {
22710
22740
  });
22711
22741
  const bubble = controller.state.greetingBubble;
22712
22742
  const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
22713
22743
  const bubbleGame = !stringsPending && controller.state.popupText && bubble?.game ? instantMs(bubble.startsAtUtc) === null ? bubble.game : ui.v2GameLine(bubble.game, bubble.startsAtUtc) : void 0;
22714
22744
  const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
22715
- const onTeaserRef = (0, import_react123.useRef)(cfg?.onTeaser);
22745
+ const onTeaserRef = (0, import_react124.useRef)(cfg?.onTeaser);
22716
22746
  onTeaserRef.current = cfg?.onTeaser;
22717
22747
  const wantsTeaser = cfg?.launcher === false || cfg?.onTeaser !== void 0;
22718
- const webBinding = (0, import_react123.useMemo)(() => wantsTeaser ? webTeaserBinding(props.host, (teaser2) => onTeaserRef.current?.(teaser2), cfg?.launcher === false) : void 0, [wantsTeaser, props.host, cfg?.launcher]);
22748
+ const webBinding = (0, import_react124.useMemo)(() => wantsTeaser ? webTeaserBinding(props.host, (teaser2) => onTeaserRef.current?.(teaser2), cfg?.launcher === false) : void 0, [wantsTeaser, props.host, cfg?.launcher]);
22719
22749
  const hostDrawsLauncher = props.mobile !== void 0 || cfg?.launcher === false;
22750
+ const resolvedTheme = useResolvedTheme(oddsSettings.userTheme ?? ui.theme);
22720
22751
  const mobile = useMobileBinding({
22721
22752
  binding: props.mobile ?? webBinding,
22722
22753
  panelOpen,
@@ -22733,21 +22764,23 @@ function StatsWidget(props) {
22733
22764
  asks,
22734
22765
  open: controller.open,
22735
22766
  close: controller.close,
22736
- dismissPopup: () => dismissPopupRef.current()
22767
+ dismissPopup: () => dismissPopupRef.current(),
22768
+ labels: stringsPending ? null : { launcher: ui.launcherLabel, dismiss: ui.dismissGreeting },
22769
+ theme: resolvedTheme
22737
22770
  });
22738
22771
  const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, hostDrawsLauncher ? mobile.confirmedShown : void 0);
22739
22772
  dismissPopupRef.current = dismissPopup;
22740
22773
  const greetingMeta = latestGreetingMeta(controller.state.messages);
22741
22774
  useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, hostDrawsLauncher ? mobile.confirmedShown : void 0);
22742
- const [highlight, setHighlight] = (0, import_react123.useState)(null);
22743
- const clearHighlight = (0, import_react123.useCallback)(() => setHighlight(null), []);
22744
- (0, import_react123.useEffect)(() => {
22775
+ const [highlight, setHighlight] = (0, import_react124.useState)(null);
22776
+ const clearHighlight = (0, import_react124.useCallback)(() => setHighlight(null), []);
22777
+ (0, import_react124.useEffect)(() => {
22745
22778
  if (!panelOpen) setHighlight(null);
22746
22779
  }, [panelOpen]);
22747
- const highlightRequest = (0, import_react123.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
22780
+ const highlightRequest = (0, import_react124.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
22748
22781
  const { open: openFromCta, state: { greetingBubble } } = controller;
22749
22782
  const setTab = monitor.setActiveTab;
22750
- const logCtaClick = (0, import_react123.useCallback)(() => {
22783
+ const logCtaClick = (0, import_react124.useCallback)(() => {
22751
22784
  if (!logger || !greetingMeta) return;
22752
22785
  logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
22753
22786
  }, [logger, greetingMeta]);
@@ -22764,12 +22797,12 @@ function StatsWidget(props) {
22764
22797
  if (!bubbleCta) logCtaClick();
22765
22798
  openFromCta();
22766
22799
  };
22767
- const onCta = (0, import_react123.useCallback)(() => onCtaRef.current(), []);
22800
+ const onCta = (0, import_react124.useCallback)(() => onCtaRef.current(), []);
22768
22801
  useOpenTelemetry(logger, panelOpen);
22769
- const onControlRef = (0, import_react123.useRef)(props.onControl);
22802
+ const onControlRef = (0, import_react124.useRef)(props.onControl);
22770
22803
  onControlRef.current = props.onControl;
22771
22804
  const { open: openPanel, close: closePanel } = controller;
22772
- (0, import_react123.useEffect)(() => {
22805
+ (0, import_react124.useEffect)(() => {
22773
22806
  onControlRef.current?.({ open: openPanel, close: closePanel });
22774
22807
  return () => onControlRef.current?.(null);
22775
22808
  }, [openPanel, closePanel]);
@@ -22786,11 +22819,11 @@ function StatsWidget(props) {
22786
22819
  page: cfg?.page
22787
22820
  }
22788
22821
  };
22789
- (0, import_react123.useEffect)(() => {
22822
+ (0, import_react124.useEffect)(() => {
22790
22823
  if (!logger) return;
22791
22824
  logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
22792
22825
  }, [logger, operatorUserId, anonymousUserId, conversationId]);
22793
- (0, import_react123.useEffect)(() => {
22826
+ (0, import_react124.useEffect)(() => {
22794
22827
  if (!logger) return;
22795
22828
  logger.resume();
22796
22829
  const onHide = () => {
@@ -22808,15 +22841,15 @@ function StatsWidget(props) {
22808
22841
  logger.dispose();
22809
22842
  };
22810
22843
  }, [logger]);
22811
- (0, import_react123.useEffect)(() => {
22844
+ (0, import_react124.useEffect)(() => {
22812
22845
  if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
22813
22846
  const node = rootRef.current?.getRootNode();
22814
22847
  if (node) injectStyles(node);
22815
22848
  }, [built, ui.injectStyles, widgetStrings.state]);
22816
22849
  const holds = useSessionHolds();
22817
22850
  const builderConversation = built?.conversation ?? null;
22818
- const builderMemory = (0, import_react123.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
22819
- const personalGreeting = (0, import_react123.useMemo)(() => ({
22851
+ const builderMemory = (0, import_react124.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
22852
+ const personalGreeting = (0, import_react124.useMemo)(() => ({
22820
22853
  favourites: favouritesEnabled && monitor.enabled ? favourites : null,
22821
22854
  conversation: built?.conversation ?? null,
22822
22855
  openFavourites: () => setFavouritesOpen(true),