@sensiblestats/widget-react 0.104.0 → 0.106.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/CHANGELOG.md +22 -0
- package/dist/index.cjs +242 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +122 -106
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as useCallback24, useEffect as useEffect37, useMemo as useMemo7, useRef as useRef33, useState as
|
|
2
|
+
import { useCallback as useCallback24, useEffect as useEffect37, useMemo as useMemo7, useRef as useRef33, useState as useState61 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/kickoff.ts
|
|
@@ -1170,7 +1170,7 @@ function isEnglishLocale(locale) {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
1172
|
// src/version.generated.ts
|
|
1173
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1173
|
+
var WIDGET_REACT_VERSION = "0.106.0";
|
|
1174
1174
|
|
|
1175
1175
|
// src/config.ts
|
|
1176
1176
|
function normalizeUi(cfg) {
|
|
@@ -2985,7 +2985,7 @@ import { matchKey as matchKey2 } from "@sensiblestats/widget-sdk";
|
|
|
2985
2985
|
|
|
2986
2986
|
// src/scheduleCache.ts
|
|
2987
2987
|
var PREFIX2 = "ss-w-schedule:";
|
|
2988
|
-
var SCHEMA_VERSION =
|
|
2988
|
+
var SCHEMA_VERSION = 4;
|
|
2989
2989
|
var TTL_MS3 = 6 * 36e5;
|
|
2990
2990
|
function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
|
|
2991
2991
|
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
|
|
@@ -3063,6 +3063,7 @@ var TERMINAL_PHASES = /* @__PURE__ */ new Set(["fullTime", "postponed"]);
|
|
|
3063
3063
|
function dueMatchIds(groups, states, nowMs) {
|
|
3064
3064
|
const football = /* @__PURE__ */ new Set();
|
|
3065
3065
|
const nba = /* @__PURE__ */ new Set();
|
|
3066
|
+
const nfl = /* @__PURE__ */ new Set();
|
|
3066
3067
|
for (const group of groups) {
|
|
3067
3068
|
for (const match of group.matches) {
|
|
3068
3069
|
if (nowMs - match.kickoffUnix * 1e3 < 0) continue;
|
|
@@ -3071,9 +3072,10 @@ function dueMatchIds(groups, states, nowMs) {
|
|
|
3071
3072
|
const sport = sportKeyOf(match.sport);
|
|
3072
3073
|
if (sport === "football") football.add(match.matchId);
|
|
3073
3074
|
else if (sport === "basketball") nba.add(match.matchId);
|
|
3075
|
+
else if (sport === "americanfootball") nfl.add(match.matchId);
|
|
3074
3076
|
}
|
|
3075
3077
|
}
|
|
3076
|
-
return { football: [...football], nba: [...nba] };
|
|
3078
|
+
return { football: [...football], nba: [...nba], nfl: [...nfl] };
|
|
3077
3079
|
}
|
|
3078
3080
|
|
|
3079
3081
|
// src/useMatchDiscovery.ts
|
|
@@ -3135,9 +3137,9 @@ function useMatchDiscovery(opts) {
|
|
|
3135
3137
|
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
|
|
3136
3138
|
const tick = useCallback2(async () => {
|
|
3137
3139
|
const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
|
|
3138
|
-
if (ids.football.length === 0 && ids.nba.length === 0) return;
|
|
3140
|
+
if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0) return;
|
|
3139
3141
|
try {
|
|
3140
|
-
const payload = await getStatesRef.current(ids.football, ids.nba);
|
|
3142
|
+
const payload = await getStatesRef.current(ids.football, ids.nba, ids.nfl);
|
|
3141
3143
|
if (!payload) return;
|
|
3142
3144
|
setStates((prev) => {
|
|
3143
3145
|
const next = new Map(prev);
|
|
@@ -4666,7 +4668,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
4666
4668
|
}
|
|
4667
4669
|
|
|
4668
4670
|
// src/components/ChatPanel.tsx
|
|
4669
|
-
import { useCallback as useCallback23, useEffect as useEffect36, useLayoutEffect, useMemo as useMemo6, useRef as useRef32, useState as
|
|
4671
|
+
import { useCallback as useCallback23, useEffect as useEffect36, useLayoutEffect, useMemo as useMemo6, useRef as useRef32, useState as useState60 } from "react";
|
|
4670
4672
|
|
|
4671
4673
|
// src/components/ChatHeader.tsx
|
|
4672
4674
|
import { useEffect as useEffect16, useRef as useRef17, useState as useState15 } from "react";
|
|
@@ -4747,6 +4749,9 @@ function ChatHeader({
|
|
|
4747
4749
|
// src/components/MessageList.tsx
|
|
4748
4750
|
import { useEffect as useEffect23, useRef as useRef21 } from "react";
|
|
4749
4751
|
|
|
4752
|
+
// src/components/ChatMessage.tsx
|
|
4753
|
+
import { useState as useState33 } from "react";
|
|
4754
|
+
|
|
4750
4755
|
// src/components/Markdown.tsx
|
|
4751
4756
|
import ReactMarkdown from "react-markdown";
|
|
4752
4757
|
import remarkGfm from "remark-gfm";
|
|
@@ -6768,16 +6773,23 @@ var LAYOUT_CLASSES = {
|
|
|
6768
6773
|
function layoutClass(layout) {
|
|
6769
6774
|
return Object.prototype.hasOwnProperty.call(LAYOUT_CLASSES, layout) ? LAYOUT_CLASSES[layout] : LAYOUT_CLASSES.goal;
|
|
6770
6775
|
}
|
|
6771
|
-
function
|
|
6776
|
+
function switchSets(dashboards) {
|
|
6777
|
+
return dashboards && dashboards.length >= 2 ? dashboards : null;
|
|
6778
|
+
}
|
|
6779
|
+
function initialSport(sets, defaultSport) {
|
|
6780
|
+
return (sets?.some((s) => s.sport === defaultSport) ? defaultSport : sets?.[0]?.sport) ?? "";
|
|
6781
|
+
}
|
|
6782
|
+
function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel }) {
|
|
6772
6783
|
const log = useEventLog();
|
|
6773
6784
|
const scope = useSportScope();
|
|
6774
|
-
const sets = dashboards
|
|
6775
|
-
const [selected, setSelected] = useState26(() => (sets
|
|
6785
|
+
const sets = switchSets(dashboards);
|
|
6786
|
+
const [selected, setSelected] = useState26(() => initialSport(sets, defaultSport));
|
|
6776
6787
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
6777
6788
|
const shown = active ? active.dashboard : dashboard;
|
|
6778
6789
|
const select = (sport) => {
|
|
6779
6790
|
if (sport === selected) return;
|
|
6780
6791
|
setSelected(sport);
|
|
6792
|
+
onSportChange?.(sport);
|
|
6781
6793
|
if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
|
|
6782
6794
|
log?.log({ name: "dashboard_sport_switch", outcome: sport });
|
|
6783
6795
|
};
|
|
@@ -7616,6 +7628,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
7616
7628
|
// src/components/ChatMessage.tsx
|
|
7617
7629
|
import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
7618
7630
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
7631
|
+
const [sport, setSport] = useState33(null);
|
|
7619
7632
|
if (message.role === "user") {
|
|
7620
7633
|
return /* @__PURE__ */ jsx49("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ jsx49("div", { className: "ss-w-bubble", children: message.text }) });
|
|
7621
7634
|
}
|
|
@@ -7623,9 +7636,12 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
|
7623
7636
|
onAct({ message: card.actionLabel, actionRef: card.actionRef, label: card.actionLabel || card.title || "" });
|
|
7624
7637
|
};
|
|
7625
7638
|
const compact = toCompactList(message.marketOdds);
|
|
7639
|
+
const sets = message.greetingDashboard ? switchSets(message.greetingDashboards) : null;
|
|
7640
|
+
const setChips = sets?.some((s) => s.suggestedActions) ? sets.find((s) => s.sport === (sport ?? initialSport(sets, message.defaultSport)))?.suggestedActions ?? [] : null;
|
|
7641
|
+
const actions = setChips ? setChips.map((c) => toActionVM({ ...c })) : message.actions;
|
|
7626
7642
|
return /* @__PURE__ */ jsxs45("div", { className: "ss-w-msg ss-w-bot", "data-msg-id": message.id, children: [
|
|
7627
7643
|
message.text && !message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ jsx49(Markdown, { text: message.text }) : null,
|
|
7628
|
-
message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ jsx49(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
|
|
7644
|
+
message.greetingDashboard && !message.clubFanDashboard ? /* @__PURE__ */ jsx49(GreetingDashboard, { dashboard: message.greetingDashboard, dashboards: message.greetingDashboards, defaultSport: message.defaultSport, onTap, onSportChange: setSport, oddsLabel: ui?.oddsLabel, liveLabel: ui?.liveLabel, sportGroupLabel: ui?.sportGroupLabel }) : null,
|
|
7629
7645
|
message.clubFanDashboard ? /* @__PURE__ */ jsx49(ClubFanDashboard, { dashboard: message.clubFanDashboard, onTap: onFanDashboardTap, ui }) : null,
|
|
7630
7646
|
/* @__PURE__ */ jsx49(EntityCardList, { cards: message.cards, disabled, showLessLabel: ui?.showLess, showMoreLabel: ui?.showMore }),
|
|
7631
7647
|
/* @__PURE__ */ jsx49(BettingInsightList, { insights: message.insights, ui, slip, monitor }),
|
|
@@ -7634,7 +7650,7 @@ function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
|
7634
7650
|
/* @__PURE__ */ jsx49(ComboCardList, { cards: message.comboCards ?? [], ui, slip, monitor }),
|
|
7635
7651
|
compact ? /* @__PURE__ */ jsx49(CompactOddsList, { list: compact, ui, slip, monitor }) : /* @__PURE__ */ jsx49(MarketOddsCardList, { cards: message.marketOdds, ui, slip, monitor }),
|
|
7636
7652
|
/* @__PURE__ */ jsx49(OddsMovementCardList, { cards: message.oddsMovement, ui, monitor }),
|
|
7637
|
-
/* @__PURE__ */ jsx49(ActionButtons, { actions
|
|
7653
|
+
/* @__PURE__ */ jsx49(ActionButtons, { actions, loading: false, disabled, onAct })
|
|
7638
7654
|
] });
|
|
7639
7655
|
}
|
|
7640
7656
|
|
|
@@ -7722,10 +7738,10 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
7722
7738
|
}
|
|
7723
7739
|
|
|
7724
7740
|
// src/components/ChatInput.tsx
|
|
7725
|
-
import { forwardRef, useEffect as useEffect24, useImperativeHandle, useRef as useRef22, useState as
|
|
7741
|
+
import { forwardRef, useEffect as useEffect24, useImperativeHandle, useRef as useRef22, useState as useState34 } from "react";
|
|
7726
7742
|
import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
7727
7743
|
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
|
|
7728
|
-
const [value, setValue] =
|
|
7744
|
+
const [value, setValue] = useState34("");
|
|
7729
7745
|
const textareaRef = useRef22(null);
|
|
7730
7746
|
const stopRef = useRef22(null);
|
|
7731
7747
|
const textBoxWantsFocusRef = useRef22(false);
|
|
@@ -7896,10 +7912,10 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
7896
7912
|
}
|
|
7897
7913
|
|
|
7898
7914
|
// src/components/LiveFactBlock.tsx
|
|
7899
|
-
import { useState as
|
|
7915
|
+
import { useState as useState35 } from "react";
|
|
7900
7916
|
import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
7901
7917
|
function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
7902
|
-
const [expanded, setExpanded] =
|
|
7918
|
+
const [expanded, setExpanded] = useState35(false);
|
|
7903
7919
|
const [current, ...earlier] = facts;
|
|
7904
7920
|
if (!current) return null;
|
|
7905
7921
|
const m = current.market;
|
|
@@ -7967,7 +7983,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
7967
7983
|
}
|
|
7968
7984
|
|
|
7969
7985
|
// src/components/MonitorFormH2H.tsx
|
|
7970
|
-
import { useState as
|
|
7986
|
+
import { useState as useState36 } from "react";
|
|
7971
7987
|
import { Fragment as Fragment11, jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
7972
7988
|
function resultClass2(result) {
|
|
7973
7989
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -7983,7 +7999,7 @@ function FormDots({ form, ui }) {
|
|
|
7983
7999
|
return /* @__PURE__ */ jsx56("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ jsx56("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
7984
8000
|
}
|
|
7985
8001
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
7986
|
-
const [expanded, setExpanded] =
|
|
8002
|
+
const [expanded, setExpanded] = useState36(false);
|
|
7987
8003
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
7988
8004
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
7989
8005
|
return /* @__PURE__ */ jsx56(Fragment11, {});
|
|
@@ -8216,7 +8232,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
8216
8232
|
import { SPORTS as SPORTS5 } from "@sensiblestats/widget-sdk";
|
|
8217
8233
|
|
|
8218
8234
|
// src/components/NbaPropsSection.tsx
|
|
8219
|
-
import { useEffect as useEffect26, useState as
|
|
8235
|
+
import { useEffect as useEffect26, useState as useState37 } from "react";
|
|
8220
8236
|
import { Fragment as Fragment12, jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
8221
8237
|
var STAT_ORDER = ["points", "rebounds", "assists", "threes"];
|
|
8222
8238
|
var MAX_TIMER_MS = 2147483647;
|
|
@@ -8278,7 +8294,7 @@ function Last5({ games, stat, line, ui }) {
|
|
|
8278
8294
|
}
|
|
8279
8295
|
function PlayerPanel({ player, bundle, ui, slip }) {
|
|
8280
8296
|
const stats = STAT_ORDER.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
8281
|
-
const [picked, setPicked] =
|
|
8297
|
+
const [picked, setPicked] = useState37(null);
|
|
8282
8298
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
8283
8299
|
return /* @__PURE__ */ jsxs54("div", { className: "ss-w-props-panel", children: [
|
|
8284
8300
|
/* @__PURE__ */ jsx59("div", { className: "ss-w-props-chips", children: stats.map((s) => /* @__PURE__ */ jsx59(
|
|
@@ -8315,7 +8331,7 @@ function PlayerPanel({ player, bundle, ui, slip }) {
|
|
|
8315
8331
|
] });
|
|
8316
8332
|
}
|
|
8317
8333
|
function Roster({ bundle, players, side, ui, slip }) {
|
|
8318
|
-
const [openId, setOpenId] =
|
|
8334
|
+
const [openId, setOpenId] = useState37(null);
|
|
8319
8335
|
return /* @__PURE__ */ jsx59("div", { className: "ss-w-props-list", children: players.map((p) => {
|
|
8320
8336
|
const isOpen = openId === p.playerId;
|
|
8321
8337
|
const main = p.stats.find((s) => s.stat === "points" && hasMainLine(s)) ?? p.stats.find(hasMainLine);
|
|
@@ -8346,8 +8362,8 @@ function Roster({ bundle, players, side, ui, slip }) {
|
|
|
8346
8362
|
}) });
|
|
8347
8363
|
}
|
|
8348
8364
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
8349
|
-
const [side, setSide] =
|
|
8350
|
-
const [, setTick] =
|
|
8365
|
+
const [side, setSide] = useState37("home");
|
|
8366
|
+
const [, setTick] = useState37(0);
|
|
8351
8367
|
const pre = preTip(match);
|
|
8352
8368
|
const live = match.phase === "live";
|
|
8353
8369
|
const open = pre || live;
|
|
@@ -8833,7 +8849,7 @@ function OddsPanel({ monitor, ui, slip }) {
|
|
|
8833
8849
|
}
|
|
8834
8850
|
|
|
8835
8851
|
// src/components/TodayPanel.tsx
|
|
8836
|
-
import { useEffect as useEffect29, useId as useId2, useMemo as useMemo5, useState as
|
|
8852
|
+
import { useEffect as useEffect29, useId as useId2, useMemo as useMemo5, useState as useState40 } from "react";
|
|
8837
8853
|
import { matchKey as matchKey7 } from "@sensiblestats/widget-sdk";
|
|
8838
8854
|
|
|
8839
8855
|
// src/placement.ts
|
|
@@ -8898,9 +8914,9 @@ function matchingFixtures(group, query) {
|
|
|
8898
8914
|
}
|
|
8899
8915
|
|
|
8900
8916
|
// src/useStarTap.ts
|
|
8901
|
-
import { useCallback as useCallback19, useRef as useRef25, useState as
|
|
8917
|
+
import { useCallback as useCallback19, useRef as useRef25, useState as useState38 } from "react";
|
|
8902
8918
|
function useStarTap(starLeague) {
|
|
8903
|
-
const [pendingId, setPendingId] =
|
|
8919
|
+
const [pendingId, setPendingId] = useState38(null);
|
|
8904
8920
|
const pendingRef = useRef25(null);
|
|
8905
8921
|
const tap = useCallback19(async (competitionId, next) => {
|
|
8906
8922
|
if (pendingRef.current !== null) return false;
|
|
@@ -8961,7 +8977,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
8961
8977
|
}
|
|
8962
8978
|
|
|
8963
8979
|
// src/components/LeagueDetail.tsx
|
|
8964
|
-
import { useEffect as useEffect28, useState as
|
|
8980
|
+
import { useEffect as useEffect28, useState as useState39 } from "react";
|
|
8965
8981
|
import { matchKey as matchKey5 } from "@sensiblestats/widget-sdk";
|
|
8966
8982
|
|
|
8967
8983
|
// src/components/FixtureRow.tsx
|
|
@@ -8991,11 +9007,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
8991
9007
|
const score = hasScore ? `${state.homeScore}\u2013${state.awayScore}` : void 0;
|
|
8992
9008
|
const ticked = state?.phase === "live" ? state.minuteLabel ?? null : null;
|
|
8993
9009
|
const when = state?.isHalfTime && !stale ? ui.halfTime : isLive ? ticked ?? "\u2014" : state?.phase === "live" ? "\u2014" : kickoffLabel(match.kickoffUnix);
|
|
8994
|
-
const
|
|
9010
|
+
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
8995
9011
|
const pinSport = slipSportOf8(match.sport);
|
|
8996
9012
|
const liveTone = isLive || state?.isHalfTime;
|
|
8997
|
-
const clockParts =
|
|
8998
|
-
const dayMarker =
|
|
9013
|
+
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
9014
|
+
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? new Intl.DateTimeFormat(ui.locale === "tr" ? "tr-TR" : "en-GB", { weekday: "short" }).format(new Date(match.kickoffUnix * 1e3)) : null;
|
|
8999
9015
|
const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
|
|
9000
9016
|
const whenClass = [
|
|
9001
9017
|
"ss-w-drow-when",
|
|
@@ -9005,9 +9021,9 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9005
9021
|
return /* @__PURE__ */ jsxs60("div", { className: liveTone ? "ss-w-drow ss-w-drow--live" : "ss-w-drow", children: [
|
|
9006
9022
|
/* @__PURE__ */ jsx65("span", { className: whenClass, children: twoLines ? twoLines.map((line, i) => /* @__PURE__ */ jsx65("span", { children: line }, i)) : when }),
|
|
9007
9023
|
/* @__PURE__ */ jsxs60("span", { className: "ss-w-drow-fx", children: [
|
|
9008
|
-
/* @__PURE__ */ jsx65(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr:
|
|
9024
|
+
/* @__PURE__ */ jsx65(Side2, { name: match.homeTeamName, crest: match.homeTeamImagePath, abbr: isUsSport ? match.homeTeamAbbr ?? void 0 : void 0 }),
|
|
9009
9025
|
/* @__PURE__ */ jsx65("span", { className: hasScore ? "ss-w-drow-sc" : "ss-w-drow-sc ss-w-drow-sc--idle", children: score ?? "\u2013" }),
|
|
9010
|
-
/* @__PURE__ */ jsx65(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr:
|
|
9026
|
+
/* @__PURE__ */ jsx65(Side2, { name: match.awayTeamName, crest: match.awayTeamImagePath, abbr: isUsSport ? match.awayTeamAbbr ?? void 0 : void 0, away: true })
|
|
9011
9027
|
] }),
|
|
9012
9028
|
/* @__PURE__ */ jsx65(
|
|
9013
9029
|
PinToggle,
|
|
@@ -9024,7 +9040,7 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
9024
9040
|
import { jsx as jsx66, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
9025
9041
|
var STAR_PATH2 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1-6.47L2.5 9.35l6.5-.95z";
|
|
9026
9042
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
9027
|
-
const [toast, setToast] =
|
|
9043
|
+
const [toast, setToast] = useState39(null);
|
|
9028
9044
|
useEffect28(() => {
|
|
9029
9045
|
setToast(null);
|
|
9030
9046
|
}, [group.competitionId]);
|
|
@@ -9266,9 +9282,9 @@ import { Fragment as Fragment16, jsx as jsx70, jsxs as jsxs64 } from "react/jsx-
|
|
|
9266
9282
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
9267
9283
|
const { groups, states, stale, starLeague } = discovery;
|
|
9268
9284
|
const searchId = useId2();
|
|
9269
|
-
const [query, setQuery] =
|
|
9270
|
-
const [selectedCompetitionId, setSelectedCompetitionId] =
|
|
9271
|
-
const [toast, setToast] =
|
|
9285
|
+
const [query, setQuery] = useState40("");
|
|
9286
|
+
const [selectedCompetitionId, setSelectedCompetitionId] = useState40(null);
|
|
9287
|
+
const [toast, setToast] = useState40(null);
|
|
9272
9288
|
useEffect29(() => {
|
|
9273
9289
|
if (toast === null) return;
|
|
9274
9290
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
@@ -9471,7 +9487,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
9471
9487
|
}
|
|
9472
9488
|
|
|
9473
9489
|
// src/components/GamesPanel.tsx
|
|
9474
|
-
import { useEffect as useEffect33, useState as
|
|
9490
|
+
import { useEffect as useEffect33, useState as useState55 } from "react";
|
|
9475
9491
|
|
|
9476
9492
|
// src/components/GamesLoginWall.tsx
|
|
9477
9493
|
import { jsx as jsx71 } from "react/jsx-runtime";
|
|
@@ -9480,7 +9496,7 @@ function GamesLoginWall({ ui }) {
|
|
|
9480
9496
|
}
|
|
9481
9497
|
|
|
9482
9498
|
// src/components/GamesHub.tsx
|
|
9483
|
-
import { useEffect as useEffect30, useState as
|
|
9499
|
+
import { useEffect as useEffect30, useState as useState41 } from "react";
|
|
9484
9500
|
|
|
9485
9501
|
// src/components/games/ui/gameMeta.ts
|
|
9486
9502
|
function prettifyGameId(gameId) {
|
|
@@ -9631,7 +9647,7 @@ function pickHeroGame(games) {
|
|
|
9631
9647
|
}
|
|
9632
9648
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
9633
9649
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
9634
|
-
const [, setTick] =
|
|
9650
|
+
const [, setTick] = useState41(0);
|
|
9635
9651
|
useEffect30(() => {
|
|
9636
9652
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
9637
9653
|
return () => clearInterval(id);
|
|
@@ -9692,10 +9708,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
9692
9708
|
}
|
|
9693
9709
|
|
|
9694
9710
|
// src/components/GameScreenHost.tsx
|
|
9695
|
-
import { useEffect as useEffect32, useRef as useRef29, useState as
|
|
9711
|
+
import { useEffect as useEffect32, useRef as useRef29, useState as useState53 } from "react";
|
|
9696
9712
|
|
|
9697
9713
|
// src/useGamePlay.ts
|
|
9698
|
-
import { useCallback as useCallback21, useRef as useRef27, useState as
|
|
9714
|
+
import { useCallback as useCallback21, useRef as useRef27, useState as useState42 } from "react";
|
|
9699
9715
|
function toSubmitResult(payload) {
|
|
9700
9716
|
return {
|
|
9701
9717
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -9707,9 +9723,9 @@ function toSubmitResult(payload) {
|
|
|
9707
9723
|
};
|
|
9708
9724
|
}
|
|
9709
9725
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
9710
|
-
const [result, setResult] =
|
|
9711
|
-
const [submitting, setSubmitting] =
|
|
9712
|
-
const [rawStatus, setRawStatus] =
|
|
9726
|
+
const [result, setResult] = useState42(null);
|
|
9727
|
+
const [submitting, setSubmitting] = useState42(false);
|
|
9728
|
+
const [rawStatus, setRawStatus] = useState42(null);
|
|
9713
9729
|
const inFlightRef = useRef27(false);
|
|
9714
9730
|
const convRef = useRef27(conversation);
|
|
9715
9731
|
convRef.current = conversation;
|
|
@@ -9767,7 +9783,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
9767
9783
|
}
|
|
9768
9784
|
|
|
9769
9785
|
// src/components/games/MysteryTigerGame.tsx
|
|
9770
|
-
import { useState as
|
|
9786
|
+
import { useState as useState44, useId as useId3 } from "react";
|
|
9771
9787
|
|
|
9772
9788
|
// src/components/games/nationFlags.ts
|
|
9773
9789
|
var FLAGS = {
|
|
@@ -9978,7 +9994,7 @@ function isNationCode(flag) {
|
|
|
9978
9994
|
}
|
|
9979
9995
|
|
|
9980
9996
|
// src/components/games/PlayerAvatar.tsx
|
|
9981
|
-
import { useState as
|
|
9997
|
+
import { useState as useState43 } from "react";
|
|
9982
9998
|
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
9983
9999
|
function initialsOf(name) {
|
|
9984
10000
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -9996,7 +10012,7 @@ function PlayerAvatar({
|
|
|
9996
10012
|
imagePath,
|
|
9997
10013
|
className
|
|
9998
10014
|
}) {
|
|
9999
|
-
const [failed, setFailed] =
|
|
10015
|
+
const [failed, setFailed] = useState43(false);
|
|
10000
10016
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
10001
10017
|
return /* @__PURE__ */ jsx76("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ jsx76("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ jsx76("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
10002
10018
|
}
|
|
@@ -10237,7 +10253,7 @@ function MysteryTigerGame({
|
|
|
10237
10253
|
onBack
|
|
10238
10254
|
}) {
|
|
10239
10255
|
const t = ui.games.mysteryTiger;
|
|
10240
|
-
const [query, setQuery] =
|
|
10256
|
+
const [query, setQuery] = useState44("");
|
|
10241
10257
|
const inputId = useId3();
|
|
10242
10258
|
const clientState = parseClientState(result?.clientStateJson);
|
|
10243
10259
|
const guessResults = clientState?.guessResults ?? [];
|
|
@@ -10499,13 +10515,13 @@ function HigherOrLowerGame({
|
|
|
10499
10515
|
}
|
|
10500
10516
|
|
|
10501
10517
|
// src/components/games/CareerPathGame.tsx
|
|
10502
|
-
import { useState as
|
|
10518
|
+
import { useState as useState46, useId as useId4 } from "react";
|
|
10503
10519
|
|
|
10504
10520
|
// src/components/games/ui/CrestShield.tsx
|
|
10505
|
-
import { useState as
|
|
10521
|
+
import { useState as useState45 } from "react";
|
|
10506
10522
|
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
10507
10523
|
function CrestShield({ src, name, size = 28 }) {
|
|
10508
|
-
const [failed, setFailed] =
|
|
10524
|
+
const [failed, setFailed] = useState45(false);
|
|
10509
10525
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
10510
10526
|
return /* @__PURE__ */ jsx87("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
10511
10527
|
}
|
|
@@ -10537,7 +10553,7 @@ function CareerPathGame({
|
|
|
10537
10553
|
}) {
|
|
10538
10554
|
const s = ui.games.careerPath;
|
|
10539
10555
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
10540
|
-
const [query, setQuery] =
|
|
10556
|
+
const [query, setQuery] = useState46("");
|
|
10541
10557
|
const inputId = useId4();
|
|
10542
10558
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
10543
10559
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
@@ -10644,7 +10660,7 @@ function CareerPathGame({
|
|
|
10644
10660
|
}
|
|
10645
10661
|
|
|
10646
10662
|
// src/components/games/BeatTheGridGame.tsx
|
|
10647
|
-
import React, { useEffect as useEffect31, useId as useId5, useRef as useRef28, useState as
|
|
10663
|
+
import React, { useEffect as useEffect31, useId as useId5, useRef as useRef28, useState as useState47 } from "react";
|
|
10648
10664
|
|
|
10649
10665
|
// src/components/games/ui/OptionList.tsx
|
|
10650
10666
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
@@ -10733,7 +10749,7 @@ function SearchSheet({
|
|
|
10733
10749
|
ui
|
|
10734
10750
|
}) {
|
|
10735
10751
|
const s = ui.games.beatTheGrid;
|
|
10736
|
-
const [query, setQuery] =
|
|
10752
|
+
const [query, setQuery] = useState47("");
|
|
10737
10753
|
const inputId = useId5();
|
|
10738
10754
|
const inputRef = useRef28(null);
|
|
10739
10755
|
useEffect31(() => {
|
|
@@ -10801,7 +10817,7 @@ function BeatTheGridGame({
|
|
|
10801
10817
|
}) {
|
|
10802
10818
|
const s = ui.games.beatTheGrid;
|
|
10803
10819
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
10804
|
-
const [activeCell, setActiveCell] =
|
|
10820
|
+
const [activeCell, setActiveCell] = useState47(null);
|
|
10805
10821
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
10806
10822
|
const filledCells = clientState?.cells ?? [];
|
|
10807
10823
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -10956,7 +10972,7 @@ function BeatTheGridGame({
|
|
|
10956
10972
|
}
|
|
10957
10973
|
|
|
10958
10974
|
// src/components/games/GuessTheXiGame.tsx
|
|
10959
|
-
import { useState as
|
|
10975
|
+
import { useState as useState48, useId as useId6 } from "react";
|
|
10960
10976
|
|
|
10961
10977
|
// src/components/games/ui/PitchSvg.tsx
|
|
10962
10978
|
import { Fragment as Fragment25, jsx as jsx91, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
@@ -11045,7 +11061,7 @@ function GuessTheXiGame({
|
|
|
11045
11061
|
onBack
|
|
11046
11062
|
}) {
|
|
11047
11063
|
const t = ui.games.guessTheXi;
|
|
11048
|
-
const [query, setQuery] =
|
|
11064
|
+
const [query, setQuery] = useState48("");
|
|
11049
11065
|
const inputId = useId6();
|
|
11050
11066
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
11051
11067
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
@@ -11188,7 +11204,7 @@ function GuessTheXiGame({
|
|
|
11188
11204
|
}
|
|
11189
11205
|
|
|
11190
11206
|
// src/components/games/DailyQuizGame.tsx
|
|
11191
|
-
import { useState as
|
|
11207
|
+
import { useState as useState49 } from "react";
|
|
11192
11208
|
import { Fragment as Fragment27, jsx as jsx93, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
11193
11209
|
function parseClientState6(json) {
|
|
11194
11210
|
if (!json) return null;
|
|
@@ -11229,8 +11245,8 @@ function DailyQuizGame({
|
|
|
11229
11245
|
}) {
|
|
11230
11246
|
const s = ui.games.dailyQuiz;
|
|
11231
11247
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
11232
|
-
const [selections, setSelections] =
|
|
11233
|
-
const [page, setPage] =
|
|
11248
|
+
const [selections, setSelections] = useState49(/* @__PURE__ */ new Map());
|
|
11249
|
+
const [page, setPage] = useState49(0);
|
|
11234
11250
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
11235
11251
|
const results = clientState?.results ?? [];
|
|
11236
11252
|
const isRevealed = results.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -11340,7 +11356,7 @@ function DailyQuizGame({
|
|
|
11340
11356
|
}
|
|
11341
11357
|
|
|
11342
11358
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
11343
|
-
import { useId as useId7, useState as
|
|
11359
|
+
import { useId as useId7, useState as useState50 } from "react";
|
|
11344
11360
|
import { jsx as jsx94, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
11345
11361
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
11346
11362
|
function parseClientState7(json) {
|
|
@@ -11436,11 +11452,11 @@ function MatchdayPredictorGame({
|
|
|
11436
11452
|
onBack
|
|
11437
11453
|
}) {
|
|
11438
11454
|
const t = ui.games.predictor;
|
|
11439
|
-
const [homeScore, setHomeScore] =
|
|
11440
|
-
const [awayScore, setAwayScore] =
|
|
11441
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] =
|
|
11442
|
-
const [lastEdited, setLastEdited] =
|
|
11443
|
-
const [query, setQuery] =
|
|
11455
|
+
const [homeScore, setHomeScore] = useState50(0);
|
|
11456
|
+
const [awayScore, setAwayScore] = useState50(0);
|
|
11457
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = useState50(null);
|
|
11458
|
+
const [lastEdited, setLastEdited] = useState50("home");
|
|
11459
|
+
const [query, setQuery] = useState50("");
|
|
11444
11460
|
const searchId = useId7();
|
|
11445
11461
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
11446
11462
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -11608,7 +11624,7 @@ function MatchdayPredictorGame({
|
|
|
11608
11624
|
}
|
|
11609
11625
|
|
|
11610
11626
|
// src/components/games/StartingXiGame.tsx
|
|
11611
|
-
import { useId as useId8, useState as
|
|
11627
|
+
import { useId as useId8, useState as useState51 } from "react";
|
|
11612
11628
|
import { Fragment as Fragment28, jsx as jsx95, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
11613
11629
|
var POINTS_PER_STARTER = 8;
|
|
11614
11630
|
var XI_SIZE = 11;
|
|
@@ -11652,9 +11668,9 @@ function StartingXiGame({
|
|
|
11652
11668
|
lockAtUtc
|
|
11653
11669
|
}) {
|
|
11654
11670
|
const t = ui.games.startingXi;
|
|
11655
|
-
const [slotPlayers, setSlotPlayers] =
|
|
11656
|
-
const [active, setActive] =
|
|
11657
|
-
const [query, setQuery] =
|
|
11671
|
+
const [slotPlayers, setSlotPlayers] = useState51(() => Array(XI_SIZE).fill(null));
|
|
11672
|
+
const [active, setActive] = useState51(0);
|
|
11673
|
+
const [query, setQuery] = useState51("");
|
|
11658
11674
|
const searchId = useId8();
|
|
11659
11675
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
11660
11676
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -11794,7 +11810,7 @@ function StartingXiGame({
|
|
|
11794
11810
|
}
|
|
11795
11811
|
|
|
11796
11812
|
// src/components/games/StatLadderGame.tsx
|
|
11797
|
-
import { useId as useId9, useState as
|
|
11813
|
+
import { useId as useId9, useState as useState52 } from "react";
|
|
11798
11814
|
import { jsx as jsx96, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
11799
11815
|
function ladderClue(ladder) {
|
|
11800
11816
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -11831,8 +11847,8 @@ function StatLadderGame({
|
|
|
11831
11847
|
onBack
|
|
11832
11848
|
}) {
|
|
11833
11849
|
const t = ui.games.statLadder;
|
|
11834
|
-
const [query, setQuery] =
|
|
11835
|
-
const [selectedId, setSelectedId] =
|
|
11850
|
+
const [query, setQuery] = useState52("");
|
|
11851
|
+
const [selectedId, setSelectedId] = useState52(null);
|
|
11836
11852
|
const searchId = useId9();
|
|
11837
11853
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
11838
11854
|
const revealed = clientState != null;
|
|
@@ -12039,7 +12055,7 @@ function GameScreenHost({
|
|
|
12039
12055
|
ui
|
|
12040
12056
|
}) {
|
|
12041
12057
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
12042
|
-
const [configJson, setConfigJson] =
|
|
12058
|
+
const [configJson, setConfigJson] = useState53(null);
|
|
12043
12059
|
useEffect32(() => {
|
|
12044
12060
|
setConfigJson(null);
|
|
12045
12061
|
if (!conversation) return;
|
|
@@ -12181,7 +12197,7 @@ function GameScreenHost({
|
|
|
12181
12197
|
}
|
|
12182
12198
|
|
|
12183
12199
|
// src/components/Leaderboard.tsx
|
|
12184
|
-
import { useState as
|
|
12200
|
+
import { useState as useState54 } from "react";
|
|
12185
12201
|
|
|
12186
12202
|
// src/components/LeaderboardRow.tsx
|
|
12187
12203
|
import { jsx as jsx99, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
@@ -12266,7 +12282,7 @@ function Leaderboard({
|
|
|
12266
12282
|
ui,
|
|
12267
12283
|
onPlay
|
|
12268
12284
|
}) {
|
|
12269
|
-
const [segment, setSegment] =
|
|
12285
|
+
const [segment, setSegment] = useState54("weekly");
|
|
12270
12286
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
12271
12287
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
12272
12288
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -12369,8 +12385,8 @@ function GamesPanel({
|
|
|
12369
12385
|
leaderboardLoading,
|
|
12370
12386
|
refreshHub
|
|
12371
12387
|
}) {
|
|
12372
|
-
const [selected, setSelected] =
|
|
12373
|
-
const [segment, setSegment] =
|
|
12388
|
+
const [selected, setSelected] = useState55(null);
|
|
12389
|
+
const [segment, setSegment] = useState55("play");
|
|
12374
12390
|
useEffect33(() => {
|
|
12375
12391
|
ensureGamesFonts();
|
|
12376
12392
|
}, []);
|
|
@@ -12672,10 +12688,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
12672
12688
|
}
|
|
12673
12689
|
|
|
12674
12690
|
// src/components/PlayerPhoto.tsx
|
|
12675
|
-
import { useState as
|
|
12691
|
+
import { useState as useState56 } from "react";
|
|
12676
12692
|
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
12677
12693
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
12678
|
-
const [failed, setFailed] =
|
|
12694
|
+
const [failed, setFailed] = useState56(false);
|
|
12679
12695
|
const box = { width: size, height: size };
|
|
12680
12696
|
if (photoUrl && !failed) {
|
|
12681
12697
|
return /* @__PURE__ */ jsx108("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -12710,7 +12726,7 @@ function MiniPitch({ positionCode }) {
|
|
|
12710
12726
|
}
|
|
12711
12727
|
|
|
12712
12728
|
// src/components/PerformanceBars.tsx
|
|
12713
|
-
import { useState as
|
|
12729
|
+
import { useState as useState57 } from "react";
|
|
12714
12730
|
import { jsx as jsx110, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
12715
12731
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
12716
12732
|
function finite3(v) {
|
|
@@ -12756,7 +12772,7 @@ function unrankedLine(ui, reason) {
|
|
|
12756
12772
|
}
|
|
12757
12773
|
}
|
|
12758
12774
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
12759
|
-
const [mode, setMode] =
|
|
12775
|
+
const [mode, setMode] = useState57("total");
|
|
12760
12776
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
12761
12777
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
12762
12778
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -12965,7 +12981,7 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
|
|
|
12965
12981
|
}
|
|
12966
12982
|
|
|
12967
12983
|
// src/components/PresetTools.tsx
|
|
12968
|
-
import { Fragment as Fragment32, useEffect as useEffect34, useId as useId11, useRef as useRef30, useState as
|
|
12984
|
+
import { Fragment as Fragment32, useEffect as useEffect34, useId as useId11, useRef as useRef30, useState as useState58 } from "react";
|
|
12969
12985
|
import { Fragment as Fragment33, jsx as jsx113, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
12970
12986
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
12971
12987
|
function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
@@ -13085,15 +13101,15 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13085
13101
|
const totals = comboTotals(grid);
|
|
13086
13102
|
const legChoices = comboLegChoices(grid);
|
|
13087
13103
|
const count = FIXED_SINGLES_COUNT;
|
|
13088
|
-
const [maxPrice, setMaxPrice] =
|
|
13089
|
-
const [minPrice, setMinPrice] =
|
|
13090
|
-
const [start] =
|
|
13091
|
-
const [total, setTotal] =
|
|
13092
|
-
const [legs, setLegs] =
|
|
13093
|
-
const [bigStart] =
|
|
13094
|
-
const [bigTotal, setBigTotal] =
|
|
13095
|
-
const [bigLegs, setBigLegs] =
|
|
13096
|
-
const [announcement, setAnnouncement] =
|
|
13104
|
+
const [maxPrice, setMaxPrice] = useState58(() => startSingles(grid.singles, limits, START.maxPrice, count));
|
|
13105
|
+
const [minPrice, setMinPrice] = useState58(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
|
|
13106
|
+
const [start] = useState58(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
|
|
13107
|
+
const [total, setTotal] = useState58(start.total);
|
|
13108
|
+
const [legs, setLegs] = useState58(start.legs);
|
|
13109
|
+
const [bigStart] = useState58(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
|
|
13110
|
+
const [bigTotal, setBigTotal] = useState58(bigStart.total);
|
|
13111
|
+
const [bigLegs, setBigLegs] = useState58(bigStart.legs);
|
|
13112
|
+
const [announcement, setAnnouncement] = useState58("");
|
|
13097
13113
|
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
13098
13114
|
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
13099
13115
|
const comboCell = findCombo(grid, total, legs);
|
|
@@ -13137,7 +13153,7 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13137
13153
|
const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
|
|
13138
13154
|
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
13139
13155
|
const markets = grid.markets ?? [];
|
|
13140
|
-
const [marketIdx, setMarketIdx] =
|
|
13156
|
+
const [marketIdx, setMarketIdx] = useState58(0);
|
|
13141
13157
|
const marketCell = markets[marketIdx] ?? null;
|
|
13142
13158
|
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
13143
13159
|
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
@@ -13218,14 +13234,14 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
13218
13234
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
13219
13235
|
const totals = comboTotals(grid);
|
|
13220
13236
|
const legChoices = comboLegChoices(grid);
|
|
13221
|
-
const [start] =
|
|
13222
|
-
const [total, setTotal] =
|
|
13223
|
-
const [legs, setLegs] =
|
|
13237
|
+
const [start] = useState58(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
|
|
13238
|
+
const [total, setTotal] = useState58(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
|
|
13239
|
+
const [legs, setLegs] = useState58(() => {
|
|
13224
13240
|
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
13225
13241
|
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
13226
13242
|
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
13227
13243
|
});
|
|
13228
|
-
const [announcement, setAnnouncement] =
|
|
13244
|
+
const [announcement, setAnnouncement] = useState58("");
|
|
13229
13245
|
const cell2 = findCombo(grid, total, legs);
|
|
13230
13246
|
const minLegs = legChoices[0] ?? legs;
|
|
13231
13247
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -13258,7 +13274,7 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
13258
13274
|
}
|
|
13259
13275
|
|
|
13260
13276
|
// src/usePresetDial.ts
|
|
13261
|
-
import { useCallback as useCallback22, useEffect as useEffect35, useRef as useRef31, useState as
|
|
13277
|
+
import { useCallback as useCallback22, useEffect as useEffect35, useRef as useRef31, useState as useState59 } from "react";
|
|
13262
13278
|
function sendInFlight(messages, isStreaming) {
|
|
13263
13279
|
const last = messages[messages.length - 1];
|
|
13264
13280
|
return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
|
|
@@ -13272,7 +13288,7 @@ function lastUserId(messages) {
|
|
|
13272
13288
|
}
|
|
13273
13289
|
var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
|
|
13274
13290
|
function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
|
|
13275
|
-
const [expanded, setExpanded] =
|
|
13291
|
+
const [expanded, setExpanded] = useState59(() => !sendInFlight(messages, isStreaming));
|
|
13276
13292
|
const fold = useCallback22(() => setExpanded(false), []);
|
|
13277
13293
|
const toggle = useCallback22(() => setExpanded((e) => !e), []);
|
|
13278
13294
|
const currentUserId = lastUserId(messages);
|
|
@@ -13358,7 +13374,7 @@ function markToolSeen() {
|
|
|
13358
13374
|
import { Fragment as Fragment34, jsx as jsx114, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
13359
13375
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
13360
13376
|
function useIsModal() {
|
|
13361
|
-
const [modal, setModal] =
|
|
13377
|
+
const [modal, setModal] = useState60(false);
|
|
13362
13378
|
useEffect36(() => {
|
|
13363
13379
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
13364
13380
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
@@ -13373,8 +13389,8 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
13373
13389
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
13374
13390
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid }) {
|
|
13375
13391
|
const { state, close, stop, send, reset } = controller;
|
|
13376
|
-
const [squadView, setSquadView] =
|
|
13377
|
-
const [selectedPlayerId, setSelectedPlayerId] =
|
|
13392
|
+
const [squadView, setSquadView] = useState60("roster");
|
|
13393
|
+
const [selectedPlayerId, setSelectedPlayerId] = useState60(null);
|
|
13378
13394
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
13379
13395
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
13380
13396
|
const squadLayerRef = useRef32(null);
|
|
@@ -13428,8 +13444,8 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
13428
13444
|
const limitRef = useRef32(null);
|
|
13429
13445
|
const typedSendRef = useRef32(false);
|
|
13430
13446
|
const focusAfterCloseRef = useRef32(null);
|
|
13431
|
-
const [tool, setTool] =
|
|
13432
|
-
const [toolSeen, setToolSeen] =
|
|
13447
|
+
const [tool, setTool] = useState60(null);
|
|
13448
|
+
const [toolSeen, setToolSeen] = useState60(readToolSeen);
|
|
13433
13449
|
const dial = usePresetDial({
|
|
13434
13450
|
layerRef,
|
|
13435
13451
|
dialRef,
|
|
@@ -15876,7 +15892,7 @@ function StatsWidget(props) {
|
|
|
15876
15892
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
15877
15893
|
);
|
|
15878
15894
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope);
|
|
15879
|
-
const [hasToday, setHasToday] =
|
|
15895
|
+
const [hasToday, setHasToday] = useState61(false);
|
|
15880
15896
|
const liveCardWatches = useMemo7(() => {
|
|
15881
15897
|
const seen = /* @__PURE__ */ new Set();
|
|
15882
15898
|
const out = [];
|
|
@@ -15913,7 +15929,7 @@ function StatsWidget(props) {
|
|
|
15913
15929
|
[built, operatorUserId, anonymousUserId]
|
|
15914
15930
|
);
|
|
15915
15931
|
const getStates = useCallback24(
|
|
15916
|
-
(matchIds, nbaGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds) : Promise.resolve(null),
|
|
15932
|
+
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
15917
15933
|
[built]
|
|
15918
15934
|
);
|
|
15919
15935
|
const pinnedMatchIds = useMemo7(
|