@sensiblestats/widget-react 0.110.0 → 0.112.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 +24 -0
- package/README.md +10 -1
- package/dist/index.cjs +1152 -1365
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +946 -1159
- package/dist/index.js.map +1 -1
- package/dist/styles.css +16 -44
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as
|
|
2
|
+
import { useCallback as useCallback25, useEffect as useEffect45, useMemo as useMemo11, useRef as useRef37, useState as useState73 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/kickoff.ts
|
|
@@ -348,23 +348,25 @@ var STRINGS = {
|
|
|
348
348
|
gamePlay: "Play",
|
|
349
349
|
gameLocked: "Locked",
|
|
350
350
|
gameVoided: "Voided",
|
|
351
|
+
settings: {
|
|
352
|
+
title: "Settings",
|
|
353
|
+
close: "Close settings",
|
|
354
|
+
oddsLabel: "Odds format",
|
|
355
|
+
decimal: "Decimal",
|
|
356
|
+
fractional: "Fractional",
|
|
357
|
+
american: "American",
|
|
358
|
+
themeLabel: "Theme",
|
|
359
|
+
light: "Light",
|
|
360
|
+
dark: "Dark",
|
|
361
|
+
auto: "Auto",
|
|
362
|
+
sampleLabel: "Arsenal to win",
|
|
363
|
+
foot: "Applies to prices in this chat. Saved on this device."
|
|
364
|
+
},
|
|
351
365
|
presets: {
|
|
352
366
|
lang: "en",
|
|
353
|
-
setNumbers: "Set the numbers",
|
|
354
367
|
buildCombo: "Build a combo",
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
minPriceRow: "Picks from {price} up",
|
|
358
|
-
comboRow: "Combo of {legs} paying {total}",
|
|
359
|
-
bigComboRow: "Total {total} with {legs} matches",
|
|
360
|
-
readyCount: (n) => `${n} ready`,
|
|
361
|
-
readyAt: (total) => `ready at ${total.toFixed(2)}`,
|
|
362
|
-
maxPriceDisplay: (count, price) => `${count} picks, max ${price.toFixed(2)}`,
|
|
363
|
-
maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price.toFixed(2)} or less.`,
|
|
364
|
-
minPriceDisplay: (count, price) => `${count} picks from ${price.toFixed(2)} up`,
|
|
365
|
-
minPriceMessage: (count, price) => `Show me ${count} picks priced at ${price.toFixed(2)} or more.`,
|
|
366
|
-
comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total.toFixed(1)}`,
|
|
367
|
-
comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total.toFixed(1)}.`,
|
|
368
|
+
comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total}`,
|
|
369
|
+
comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total}.`,
|
|
368
370
|
unavailable: "Not available today.",
|
|
369
371
|
send: "Send",
|
|
370
372
|
close: "Close",
|
|
@@ -372,14 +374,7 @@ var STRINGS = {
|
|
|
372
374
|
matchesLabel: "Matches",
|
|
373
375
|
fewerMatches: "Fewer matches",
|
|
374
376
|
moreMatches: "More matches",
|
|
375
|
-
maxPriceName: "Max price",
|
|
376
|
-
minPriceName: "Lowest price",
|
|
377
|
-
notToday: " \xB7 not today",
|
|
378
377
|
changeCombo: "Change total or matches",
|
|
379
|
-
marketRow: "{market} picks today",
|
|
380
|
-
marketName: "Market",
|
|
381
|
-
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
382
|
-
marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`,
|
|
383
378
|
standoutAsk: "Standout matches today"
|
|
384
379
|
},
|
|
385
380
|
nba: {
|
|
@@ -1032,23 +1027,25 @@ var STRINGS = {
|
|
|
1032
1027
|
gamePlay: "Oyna",
|
|
1033
1028
|
gameLocked: "Kilitli",
|
|
1034
1029
|
gameVoided: "\u0130ptal edildi",
|
|
1030
|
+
settings: {
|
|
1031
|
+
title: "Ayarlar",
|
|
1032
|
+
close: "Ayarlar\u0131 kapat",
|
|
1033
|
+
oddsLabel: "Oran bi\xE7imi",
|
|
1034
|
+
decimal: "Ondal\u0131k",
|
|
1035
|
+
fractional: "Kesirli",
|
|
1036
|
+
american: "Amerikan",
|
|
1037
|
+
themeLabel: "Tema",
|
|
1038
|
+
light: "A\xE7\u0131k",
|
|
1039
|
+
dark: "Koyu",
|
|
1040
|
+
auto: "Otomatik",
|
|
1041
|
+
sampleLabel: "Arsenal kazan\u0131r",
|
|
1042
|
+
foot: "Bu sohbetteki oranlara uygulan\u0131r. Bu cihazda saklan\u0131r."
|
|
1043
|
+
},
|
|
1035
1044
|
presets: {
|
|
1036
1045
|
lang: "tr",
|
|
1037
|
-
setNumbers: "Say\u0131lar\u0131 belirle",
|
|
1038
1046
|
buildCombo: "Kombin olu\u015Ftur",
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
minPriceRow: "{price} ve \xFCzeri se\xE7imler",
|
|
1042
|
-
comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
|
|
1043
|
-
bigComboRow: "{legs} ma\xE7la toplam {total}",
|
|
1044
|
-
readyCount: (n) => `${n} haz\u0131r`,
|
|
1045
|
-
readyAt: (total) => `${total.toFixed(2)} ile haz\u0131r`,
|
|
1046
|
-
maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price.toFixed(2)}`,
|
|
1047
|
-
maxPriceMessage: (count, price) => `${price.toFixed(2)} veya alt\u0131 oranl\u0131 ${count} se\xE7im g\xF6ster.`,
|
|
1048
|
-
minPriceDisplay: (count, price) => `${count} se\xE7im, ${price.toFixed(2)} ve \xFCzeri`,
|
|
1049
|
-
minPriceMessage: (count, price) => `${price.toFixed(2)} veya \xFCzeri oranl\u0131 ${count} se\xE7im g\xF6ster.`,
|
|
1050
|
-
comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total.toFixed(1)}`,
|
|
1051
|
-
comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total.toFixed(1)} oranl\u0131 ${legs} ma\xE7l\u0131k bir kombin haz\u0131rla.`,
|
|
1047
|
+
comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total}`,
|
|
1048
|
+
comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total} oranl\u0131 ${legs} ma\xE7l\u0131k bir kombin haz\u0131rla.`,
|
|
1052
1049
|
unavailable: "Bug\xFCn mevcut de\u011Fil.",
|
|
1053
1050
|
send: "G\xF6nder",
|
|
1054
1051
|
close: "Kapat",
|
|
@@ -1056,14 +1053,7 @@ var STRINGS = {
|
|
|
1056
1053
|
matchesLabel: "Ma\xE7 say\u0131s\u0131",
|
|
1057
1054
|
fewerMatches: "Daha az ma\xE7",
|
|
1058
1055
|
moreMatches: "Daha fazla ma\xE7",
|
|
1059
|
-
maxPriceName: "En y\xFCksek oran",
|
|
1060
|
-
minPriceName: "En d\xFC\u015F\xFCk oran",
|
|
1061
|
-
notToday: " \xB7 bug\xFCn yok",
|
|
1062
1056
|
changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
|
|
1063
|
-
marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
|
|
1064
|
-
marketName: "Bahis t\xFCr\xFC",
|
|
1065
|
-
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
1066
|
-
marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`,
|
|
1067
1057
|
standoutAsk: "Bug\xFCn\xFCn \xF6ne \xE7\u0131kan ma\xE7lar\u0131"
|
|
1068
1058
|
},
|
|
1069
1059
|
nba: {
|
|
@@ -1426,14 +1416,28 @@ function isEnglishLocale(locale) {
|
|
|
1426
1416
|
return lang === null || lang === "en";
|
|
1427
1417
|
}
|
|
1428
1418
|
|
|
1419
|
+
// src/odds.ts
|
|
1420
|
+
function formatOdds(forms, format2) {
|
|
1421
|
+
return (format2 === "american" ? forms.american : format2 === "fractional" ? forms.fractional : forms.decimal) ?? forms.decimal;
|
|
1422
|
+
}
|
|
1423
|
+
function operatorOdds(forms, format2) {
|
|
1424
|
+
const text = format2 === "american" ? forms.american : format2 === "fractional" ? forms.fractional : forms.decimal;
|
|
1425
|
+
return text ? { format: format2, text } : void 0;
|
|
1426
|
+
}
|
|
1427
|
+
function parseOddsFormat(value) {
|
|
1428
|
+
const v = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
1429
|
+
return v === "decimal" || v === "american" || v === "fractional" ? v : void 0;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1429
1432
|
// src/version.generated.ts
|
|
1430
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1433
|
+
var WIDGET_REACT_VERSION = "0.112.0";
|
|
1431
1434
|
|
|
1432
1435
|
// src/config.ts
|
|
1433
1436
|
function normalizeUi(cfg) {
|
|
1434
1437
|
const strings = resolveLocaleStrings(cfg.locale);
|
|
1435
1438
|
return {
|
|
1436
1439
|
theme: cfg.theme ?? "auto",
|
|
1440
|
+
oddsFormat: parseOddsFormat(cfg.oddsFormat) ?? "decimal",
|
|
1437
1441
|
accent: cfg.accent,
|
|
1438
1442
|
logoUrl: cfg.logoUrl,
|
|
1439
1443
|
headerTitle: cfg.headerTitle,
|
|
@@ -1741,6 +1745,7 @@ function normalizeUi(cfg) {
|
|
|
1741
1745
|
gameVoided: strings.gameVoided,
|
|
1742
1746
|
games: strings.games,
|
|
1743
1747
|
presets: strings.presets,
|
|
1748
|
+
settings: strings.settings,
|
|
1744
1749
|
nba: strings.nba,
|
|
1745
1750
|
nfl: strings.nfl,
|
|
1746
1751
|
liveCard: strings.liveCard
|
|
@@ -1780,6 +1785,8 @@ function projectSeries(samples) {
|
|
|
1780
1785
|
const prices = samples.map((s) => s.price);
|
|
1781
1786
|
const pMin = Math.min(...prices);
|
|
1782
1787
|
const pMax = Math.max(...prices);
|
|
1788
|
+
const maxSample = samples.find((s) => s.price === pMax);
|
|
1789
|
+
const minSample = samples.find((s) => s.price === pMin);
|
|
1783
1790
|
let yMin;
|
|
1784
1791
|
let yMax;
|
|
1785
1792
|
if (pMax === pMin) {
|
|
@@ -1800,9 +1807,9 @@ function projectSeries(samples) {
|
|
|
1800
1807
|
// The real extremes, never the padded bounds: a gridline label is a price, and the padded
|
|
1801
1808
|
// bounds are prices nobody was ever offered. A flat series has one real extreme, not two —
|
|
1802
1809
|
// two identical gridlines would collide on both React key and rendered text.
|
|
1803
|
-
gridlines: pMax === pMin ? [{ y: y(pMax), price: pMax }] : [
|
|
1804
|
-
{ y: y(pMax), price: pMax },
|
|
1805
|
-
{ y: y(pMin), price: pMin }
|
|
1810
|
+
gridlines: pMax === pMin ? [{ y: y(pMax), price: pMax, forms: maxSample.forms }] : [
|
|
1811
|
+
{ y: y(pMax), price: pMax, forms: maxSample.forms },
|
|
1812
|
+
{ y: y(pMin), price: pMin, forms: minSample.forms }
|
|
1806
1813
|
],
|
|
1807
1814
|
viewBox: `0 0 ${CHART_VIEW_W} ${CHART_VIEW_H}`,
|
|
1808
1815
|
startMs: tMin,
|
|
@@ -1887,8 +1894,6 @@ function toInsightVM(insight) {
|
|
|
1887
1894
|
const selectionLabel = str(insight.selectionLabel);
|
|
1888
1895
|
const selectionLine = str(insight.line);
|
|
1889
1896
|
const selection = joinSelection(selectionLabel, selectionLine);
|
|
1890
|
-
const value = insight.odds?.value;
|
|
1891
|
-
const odds = typeof value === "number" && Number.isFinite(value) ? value.toFixed(2) : void 0;
|
|
1892
1897
|
const oddsValue = insight.odds?.value;
|
|
1893
1898
|
const matchOddsId = typeof insight.odds?.matchOddsId === "number" ? insight.odds.matchOddsId : void 0;
|
|
1894
1899
|
const home = str(insight.homeTeamName);
|
|
@@ -1902,7 +1907,8 @@ function toInsightVM(insight) {
|
|
|
1902
1907
|
id: str(insight.insightId) ?? `${str(insight.ruleId) ?? "insight"}:${num(insight.matchId) ?? ""}`,
|
|
1903
1908
|
market,
|
|
1904
1909
|
selection,
|
|
1905
|
-
odds,
|
|
1910
|
+
oddsForms: oddsValue !== void 0 && Number.isFinite(oddsValue) ? insight.odds?.valueFormats : void 0,
|
|
1911
|
+
previousOddsForms: previous !== void 0 && direction !== void 0 ? insight.odds?.previousValueFormats ?? void 0 : void 0,
|
|
1906
1912
|
// The wire payload carries bookmakerId (not a name); render a name only if one is present.
|
|
1907
1913
|
bookmaker: str(insight.odds?.bookmakerName),
|
|
1908
1914
|
isLive: insight.odds?.isLive === true,
|
|
@@ -1921,7 +1927,6 @@ function toInsightVM(insight) {
|
|
|
1921
1927
|
isMarketFloor: insight.isMarketFloor === true,
|
|
1922
1928
|
oddsDecimal: typeof oddsValue === "number" && Number.isFinite(oddsValue) ? oddsValue : void 0,
|
|
1923
1929
|
quotedAtUtc: str(insight.odds?.quotedAtUtc),
|
|
1924
|
-
previousOdds: previous !== void 0 && direction !== void 0 ? previous.toFixed(2) : void 0,
|
|
1925
1930
|
movementDirection: previous !== void 0 && direction !== void 0 ? direction : void 0,
|
|
1926
1931
|
homeTeamName: home,
|
|
1927
1932
|
awayTeamName: away,
|
|
@@ -1933,11 +1938,12 @@ function toInsightVM(insight) {
|
|
|
1933
1938
|
};
|
|
1934
1939
|
}
|
|
1935
1940
|
function toSlipSelection(vm, conversationId) {
|
|
1936
|
-
if (vm.matchOddsId === void 0 || vm.oddsDecimal === void 0) return null;
|
|
1941
|
+
if (vm.matchOddsId === void 0 || vm.oddsDecimal === void 0 || vm.oddsForms === void 0) return null;
|
|
1937
1942
|
const selection = {
|
|
1938
1943
|
matchOddsId: vm.matchOddsId,
|
|
1939
1944
|
matchId: vm.matchId,
|
|
1940
|
-
oddsDecimal: vm.oddsDecimal
|
|
1945
|
+
oddsDecimal: vm.oddsDecimal,
|
|
1946
|
+
forms: vm.oddsForms
|
|
1941
1947
|
};
|
|
1942
1948
|
if (vm.quotedAtUtc !== void 0) selection.quotedAtUtc = vm.quotedAtUtc;
|
|
1943
1949
|
if (vm.id !== void 0) selection.insightId = vm.id;
|
|
@@ -1958,19 +1964,19 @@ function toMarketOddsVM(card) {
|
|
|
1958
1964
|
displayLabel,
|
|
1959
1965
|
selectionLabel: str(r.selectionLabel),
|
|
1960
1966
|
line: str(r.line),
|
|
1961
|
-
odds: price !== void 0 ? price.toFixed(2) : "",
|
|
1962
1967
|
oddsDecimal: price,
|
|
1968
|
+
priceForms: r.priceFormats,
|
|
1969
|
+
previousPriceForms: previous !== void 0 && direction !== void 0 ? r.previousPriceFormats ?? void 0 : void 0,
|
|
1963
1970
|
matchOddsId: typeof r.matchOddsId === "number" ? r.matchOddsId : void 0,
|
|
1964
1971
|
quotedAtUtc: str(r.quotedAtUtc),
|
|
1965
1972
|
isMain: r.isMainLine !== false,
|
|
1966
1973
|
// === true, not !== false: a server that has not shipped the field yet leaves it undefined,
|
|
1967
1974
|
// and undefined must read as open rather than hiding every price on the card.
|
|
1968
1975
|
isSuspended: r.isSuspended === true,
|
|
1969
|
-
previousOdds: previous !== void 0 && direction !== void 0 ? previous.toFixed(2) : void 0,
|
|
1970
1976
|
movementDirection: previous !== void 0 && direction !== void 0 ? direction : void 0
|
|
1971
1977
|
};
|
|
1972
1978
|
};
|
|
1973
|
-
const vms = rows.map(toRow).filter((r) => (r.selectionLabel || r.line) && r.
|
|
1979
|
+
const vms = rows.map(toRow).filter((r) => (r.selectionLabel || r.line) && r.oddsDecimal !== void 0 && !r.isSuspended);
|
|
1974
1980
|
const home = str(card.homeTeamName);
|
|
1975
1981
|
const away = str(card.awayTeamName);
|
|
1976
1982
|
const sport = sportOf(card.sport);
|
|
@@ -2015,7 +2021,7 @@ function toOddsMovementVM(card) {
|
|
|
2015
2021
|
const price = typeof p.price === "number" && Number.isFinite(p.price) ? p.price : void 0;
|
|
2016
2022
|
const atMs = typeof p.atUtc === "string" ? Date.parse(p.atUtc) : NaN;
|
|
2017
2023
|
if (price === void 0 || Number.isNaN(atMs)) continue;
|
|
2018
|
-
samples.push({ atMs, price });
|
|
2024
|
+
samples.push({ atMs, price, forms: p.priceFormats });
|
|
2019
2025
|
}
|
|
2020
2026
|
samples.sort((a, b) => a.atMs - b.atMs);
|
|
2021
2027
|
const asNumber = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
@@ -2038,8 +2044,8 @@ function toOddsMovementVM(card) {
|
|
|
2038
2044
|
fixture: home && away ? `${home} vs ${away}` : void 0,
|
|
2039
2045
|
competition: str(card.competitionName),
|
|
2040
2046
|
bookmaker: str(card.bookmakerName),
|
|
2041
|
-
|
|
2042
|
-
|
|
2047
|
+
openingForms: opening !== void 0 ? card.openingPriceFormats : void 0,
|
|
2048
|
+
currentForms: current !== void 0 ? card.currentPriceFormats : void 0,
|
|
2043
2049
|
direction: card.movementDirection === "shortened" || card.movementDirection === "drifted" ? card.movementDirection : void 0,
|
|
2044
2050
|
windowHours: asNumber(card.windowHours) ?? 0,
|
|
2045
2051
|
excludedCount: asNumber(card.excludedSuspendedCount) ?? 0,
|
|
@@ -2054,7 +2060,7 @@ function toOddsMovementVM(card) {
|
|
|
2054
2060
|
function marketOddsRowToSlipSelection(vm, row, conversationId) {
|
|
2055
2061
|
if (row.matchOddsId === void 0 || row.oddsDecimal === void 0) return null;
|
|
2056
2062
|
if (!mayPinOrSlip(vm.sport)) return null;
|
|
2057
|
-
const selection = { matchOddsId: row.matchOddsId, matchId: vm.matchId, oddsDecimal: row.oddsDecimal };
|
|
2063
|
+
const selection = { matchOddsId: row.matchOddsId, matchId: vm.matchId, oddsDecimal: row.oddsDecimal, forms: row.priceForms };
|
|
2058
2064
|
if (row.quotedAtUtc !== void 0) selection.quotedAtUtc = row.quotedAtUtc;
|
|
2059
2065
|
const slipSport = slipSportOf(vm.sport);
|
|
2060
2066
|
if (slipSport) selection.sport = slipSport;
|
|
@@ -2093,8 +2099,8 @@ function toComboLegVM(leg) {
|
|
|
2093
2099
|
selection: joinSelection(selectionLabel, line) ?? selectionLabel,
|
|
2094
2100
|
selectionLabel,
|
|
2095
2101
|
line,
|
|
2096
|
-
odds: price.toFixed(2),
|
|
2097
2102
|
oddsDecimal: price,
|
|
2103
|
+
priceForms: leg.priceFormats,
|
|
2098
2104
|
matchOddsId,
|
|
2099
2105
|
quotedAtUtc: str(leg.quotedAtUtc),
|
|
2100
2106
|
...hasStat ? { insightId, statText } : {},
|
|
@@ -2115,6 +2121,7 @@ function toComboCardVM(card) {
|
|
|
2115
2121
|
id: str(card.comboId) ?? legs.map((l) => l.matchOddsId).join("-"),
|
|
2116
2122
|
legs,
|
|
2117
2123
|
multiplication,
|
|
2124
|
+
totalForms: card.totalFormats,
|
|
2118
2125
|
replacedNote: str(card.replacedNote),
|
|
2119
2126
|
addToSlipEnabled: card.addToSlipEnabled === true,
|
|
2120
2127
|
target: finite(card.target),
|
|
@@ -2125,7 +2132,8 @@ function comboLegToSlipSelection(leg, conversationId) {
|
|
|
2125
2132
|
const selection = {
|
|
2126
2133
|
matchOddsId: leg.matchOddsId,
|
|
2127
2134
|
matchId: leg.matchId,
|
|
2128
|
-
oddsDecimal: leg.oddsDecimal
|
|
2135
|
+
oddsDecimal: leg.oddsDecimal,
|
|
2136
|
+
forms: leg.priceForms
|
|
2129
2137
|
};
|
|
2130
2138
|
if (leg.insightId !== void 0) selection.insightId = leg.insightId;
|
|
2131
2139
|
if (leg.quotedAtUtc !== void 0) selection.quotedAtUtc = leg.quotedAtUtc;
|
|
@@ -2208,6 +2216,7 @@ function toNbaSlipSelection(vm, key, conversationId) {
|
|
|
2208
2216
|
matchOddsId: s.matchOddsId,
|
|
2209
2217
|
matchId: vm.matchId,
|
|
2210
2218
|
oddsDecimal: s.price,
|
|
2219
|
+
forms: s.priceFormats,
|
|
2211
2220
|
quotedAtUtc: s.quotedAtUtc,
|
|
2212
2221
|
insightId: vm.id,
|
|
2213
2222
|
sport: "basketball"
|
|
@@ -2231,8 +2240,8 @@ function nbaCoHitLegs(vm, conversationId) {
|
|
|
2231
2240
|
selection: s.selectionLabel,
|
|
2232
2241
|
selectionLabel: s.selectionLabel,
|
|
2233
2242
|
line: s.line ?? void 0,
|
|
2234
|
-
odds: s.price.toFixed(2),
|
|
2235
2243
|
oddsDecimal: s.price,
|
|
2244
|
+
priceForms: s.priceFormats,
|
|
2236
2245
|
matchOddsId: s.matchOddsId,
|
|
2237
2246
|
quotedAtUtc: s.quotedAtUtc,
|
|
2238
2247
|
insightId: vm.id,
|
|
@@ -2319,6 +2328,7 @@ function toNflSlipSelection(vm, key, nowMs, conversationId) {
|
|
|
2319
2328
|
matchOddsId: s.matchOddsId,
|
|
2320
2329
|
matchId: vm.matchId,
|
|
2321
2330
|
oddsDecimal: s.price,
|
|
2331
|
+
forms: s.priceFormats,
|
|
2322
2332
|
quotedAtUtc: s.quotedAtUtc,
|
|
2323
2333
|
insightId: vm.id,
|
|
2324
2334
|
sport: "americanfootball"
|
|
@@ -2381,11 +2391,14 @@ function slipPickFields(selection, label, line) {
|
|
|
2381
2391
|
return fields;
|
|
2382
2392
|
}
|
|
2383
2393
|
function chipSelection(market, matchId, conversationId) {
|
|
2384
|
-
if (!market || !market.addToSlipEnabled || typeof market.matchOddsId !== "number" || typeof market.price !== "number") return null;
|
|
2385
|
-
const selection = { matchOddsId: market.matchOddsId, matchId, oddsDecimal: market.price };
|
|
2394
|
+
if (!market || !market.addToSlipEnabled || typeof market.matchOddsId !== "number" || typeof market.price !== "number" || !market.priceFormats) return null;
|
|
2395
|
+
const selection = { matchOddsId: market.matchOddsId, matchId, oddsDecimal: market.price, forms: market.priceFormats };
|
|
2386
2396
|
if (conversationId !== void 0) selection.conversationId = conversationId;
|
|
2387
2397
|
return selection;
|
|
2388
2398
|
}
|
|
2399
|
+
function chipPriceText(market, format2) {
|
|
2400
|
+
return typeof market.price === "number" && market.priceFormats ? formatOdds(market.priceFormats, format2) : void 0;
|
|
2401
|
+
}
|
|
2389
2402
|
function chipSelectionText(market) {
|
|
2390
2403
|
return displayText(market.displayLabel) ?? market.selectionLabel;
|
|
2391
2404
|
}
|
|
@@ -2422,7 +2435,7 @@ function resultToToast(result, shownOdds, ui) {
|
|
|
2422
2435
|
case "duplicate":
|
|
2423
2436
|
return { kind: "success", text: ui.slipDuplicate };
|
|
2424
2437
|
case "price_changed":
|
|
2425
|
-
return result.accepted ? { kind: "success", text: ui.slipPriceChanged(shownOdds, result.
|
|
2438
|
+
return result.accepted ? { kind: "success", text: ui.slipPriceChanged(shownOdds, result.newOdds) } : { kind: "error", text: ui.slipPriceNotAccepted(shownOdds, result.newOdds) };
|
|
2426
2439
|
case "rejected":
|
|
2427
2440
|
if (result.reason === "login_required") return { kind: "error", text: ui.slipLoginRequired };
|
|
2428
2441
|
if (result.reason === "suspended") return { kind: "error", text: ui.slipSuspended };
|
|
@@ -2585,20 +2598,20 @@ function createMatchViews(storageKey, options = {}) {
|
|
|
2585
2598
|
const now = options.now ?? (() => Date.now());
|
|
2586
2599
|
const user = options.user;
|
|
2587
2600
|
let storage = options.storage;
|
|
2588
|
-
let
|
|
2601
|
+
let memory3 = empty();
|
|
2589
2602
|
const read2 = () => {
|
|
2590
2603
|
if (storage === void 0) storage = browserStorage();
|
|
2591
2604
|
if (storage) {
|
|
2592
2605
|
try {
|
|
2593
|
-
|
|
2606
|
+
memory3 = parse(storage.getItem(storageKey), user);
|
|
2594
2607
|
} catch {
|
|
2595
2608
|
storage = null;
|
|
2596
2609
|
}
|
|
2597
2610
|
}
|
|
2598
|
-
return
|
|
2611
|
+
return memory3;
|
|
2599
2612
|
};
|
|
2600
2613
|
const write = (state) => {
|
|
2601
|
-
|
|
2614
|
+
memory3 = state;
|
|
2602
2615
|
if (!storage) return;
|
|
2603
2616
|
try {
|
|
2604
2617
|
storage.setItem(storageKey, JSON.stringify({ v: 1, user, ...state }));
|
|
@@ -2695,20 +2708,20 @@ function browserStorage2() {
|
|
|
2695
2708
|
function createSlipLedger(storageKey, options = {}) {
|
|
2696
2709
|
const now = options.now ?? (() => Date.now());
|
|
2697
2710
|
let storage = options.storage;
|
|
2698
|
-
let
|
|
2711
|
+
let memory3 = [];
|
|
2699
2712
|
const read2 = () => {
|
|
2700
2713
|
if (storage === void 0) storage = browserStorage2();
|
|
2701
2714
|
if (storage) {
|
|
2702
2715
|
try {
|
|
2703
|
-
|
|
2716
|
+
memory3 = parse2(storage.getItem(storageKey));
|
|
2704
2717
|
} catch {
|
|
2705
2718
|
storage = null;
|
|
2706
2719
|
}
|
|
2707
2720
|
}
|
|
2708
|
-
return
|
|
2721
|
+
return memory3;
|
|
2709
2722
|
};
|
|
2710
2723
|
const write = (entries) => {
|
|
2711
|
-
|
|
2724
|
+
memory3 = entries;
|
|
2712
2725
|
if (!storage) return;
|
|
2713
2726
|
try {
|
|
2714
2727
|
storage.setItem(storageKey, JSON.stringify({ v: 1, entries }));
|
|
@@ -2884,7 +2897,7 @@ function createDashboardTapSignal(sendSignal, log) {
|
|
|
2884
2897
|
}
|
|
2885
2898
|
|
|
2886
2899
|
// src/theme.ts
|
|
2887
|
-
function themeAttrs(ui) {
|
|
2900
|
+
function themeAttrs(ui, userTheme) {
|
|
2888
2901
|
const style = {
|
|
2889
2902
|
"--ss-w-offset-x": `${ui.offset.x}px`,
|
|
2890
2903
|
"--ss-w-offset-y": `${ui.offset.y}px`,
|
|
@@ -2899,11 +2912,112 @@ function themeAttrs(ui) {
|
|
|
2899
2912
|
style["--ss-w-line"] = "color-mix(in srgb, var(--ss-w-ink) 12%, var(--ss-w-panel))";
|
|
2900
2913
|
style["--ss-w-faint"] = "color-mix(in srgb, var(--ss-w-ink) 55%, var(--ss-w-panel))";
|
|
2901
2914
|
}
|
|
2902
|
-
|
|
2915
|
+
const theme = ui.surface || ui.ink ? ui.theme : userTheme ?? ui.theme;
|
|
2916
|
+
return { "data-ss-w-theme": theme, "data-ss-w-pos": ui.position, style };
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
// src/oddsSettingsContext.ts
|
|
2920
|
+
import { createContext, useContext, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
2921
|
+
|
|
2922
|
+
// src/oddsSettings.ts
|
|
2923
|
+
var KEY = "ss-w-settings";
|
|
2924
|
+
var THEMES = ["light", "dark", "auto"];
|
|
2925
|
+
var memory = {};
|
|
2926
|
+
function readSettings() {
|
|
2927
|
+
let raw;
|
|
2928
|
+
try {
|
|
2929
|
+
raw = window.localStorage.getItem(KEY);
|
|
2930
|
+
} catch {
|
|
2931
|
+
return { ...memory };
|
|
2932
|
+
}
|
|
2933
|
+
if (raw === null) return { ...memory };
|
|
2934
|
+
try {
|
|
2935
|
+
const parsed = JSON.parse(raw);
|
|
2936
|
+
if (typeof parsed !== "object" || parsed === null || parsed.v !== 1) return {};
|
|
2937
|
+
const p = parsed;
|
|
2938
|
+
const out = {};
|
|
2939
|
+
const f = parseOddsFormat(p.oddsFormat);
|
|
2940
|
+
if (f) out.oddsFormat = f;
|
|
2941
|
+
if (typeof p.theme === "string" && THEMES.includes(p.theme)) out.theme = p.theme;
|
|
2942
|
+
return out;
|
|
2943
|
+
} catch {
|
|
2944
|
+
return {};
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
function writeSettings(patch) {
|
|
2948
|
+
const next = { ...readSettings() };
|
|
2949
|
+
if (patch.oddsFormat === null) delete next.oddsFormat;
|
|
2950
|
+
else if (patch.oddsFormat) next.oddsFormat = patch.oddsFormat;
|
|
2951
|
+
if (patch.theme === null) delete next.theme;
|
|
2952
|
+
else if (patch.theme) next.theme = patch.theme;
|
|
2953
|
+
memory = next;
|
|
2954
|
+
try {
|
|
2955
|
+
window.localStorage.setItem(KEY, JSON.stringify({ v: 1, ...next }));
|
|
2956
|
+
} catch {
|
|
2957
|
+
}
|
|
2958
|
+
return next;
|
|
2959
|
+
}
|
|
2960
|
+
var offeredKey = (operatorKey) => `ss-w-odds-offered:${operatorKey}`;
|
|
2961
|
+
function readOddsOffered(operatorKey) {
|
|
2962
|
+
try {
|
|
2963
|
+
const raw = window.localStorage.getItem(offeredKey(operatorKey));
|
|
2964
|
+
return raw === "true" ? true : raw === "false" ? false : void 0;
|
|
2965
|
+
} catch {
|
|
2966
|
+
return void 0;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
function writeOddsOffered(operatorKey, value) {
|
|
2970
|
+
try {
|
|
2971
|
+
window.localStorage.setItem(offeredKey(operatorKey), String(value));
|
|
2972
|
+
} catch {
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
// src/oddsSettingsContext.ts
|
|
2977
|
+
var OddsSettingsContext = createContext({
|
|
2978
|
+
oddsFormat: "decimal",
|
|
2979
|
+
theme: "auto",
|
|
2980
|
+
themeLocked: false,
|
|
2981
|
+
oddsOffered: true,
|
|
2982
|
+
setOddsFormat: () => {
|
|
2983
|
+
},
|
|
2984
|
+
setTheme: () => {
|
|
2985
|
+
}
|
|
2986
|
+
});
|
|
2987
|
+
var useOddsSettings = () => useContext(OddsSettingsContext);
|
|
2988
|
+
function useOddsSettingsState(ui, conversation, operatorKey) {
|
|
2989
|
+
const [stored, setStored] = useState2(readSettings);
|
|
2990
|
+
const [oddsOffered, setOddsOffered] = useState2(() => readOddsOffered(operatorKey) ?? true);
|
|
2991
|
+
useEffect2(() => {
|
|
2992
|
+
let live = true;
|
|
2993
|
+
conversation?.getWidgetSettings?.().then(
|
|
2994
|
+
(s) => {
|
|
2995
|
+
if (live && typeof s?.oddsOffered === "boolean") {
|
|
2996
|
+
writeOddsOffered(operatorKey, s.oddsOffered);
|
|
2997
|
+
setOddsOffered(s.oddsOffered);
|
|
2998
|
+
}
|
|
2999
|
+
},
|
|
3000
|
+
() => {
|
|
3001
|
+
}
|
|
3002
|
+
);
|
|
3003
|
+
return () => {
|
|
3004
|
+
live = false;
|
|
3005
|
+
};
|
|
3006
|
+
}, [conversation, operatorKey]);
|
|
3007
|
+
return useMemo2(() => ({
|
|
3008
|
+
oddsFormat: stored.oddsFormat ?? ui.oddsFormat,
|
|
3009
|
+
userOddsFormat: stored.oddsFormat,
|
|
3010
|
+
theme: stored.theme ?? ui.theme,
|
|
3011
|
+
userTheme: stored.theme,
|
|
3012
|
+
themeLocked: !!(ui.surface || ui.ink),
|
|
3013
|
+
oddsOffered,
|
|
3014
|
+
setOddsFormat: (f) => setStored(writeSettings({ oddsFormat: f })),
|
|
3015
|
+
setTheme: (t) => setStored(writeSettings({ theme: t }))
|
|
3016
|
+
}), [stored, ui.oddsFormat, ui.theme, ui.surface, ui.ink, oddsOffered]);
|
|
2903
3017
|
}
|
|
2904
3018
|
|
|
2905
3019
|
// src/useChatStream.ts
|
|
2906
|
-
import { useCallback as useCallback3, useEffect as
|
|
3020
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo4, useReducer as useReducer2, useRef as useRef4 } from "react";
|
|
2907
3021
|
import { LimitError as LimitError2, WidgetSdkError as WidgetSdkError2 } from "@sensiblestats/widget-sdk";
|
|
2908
3022
|
|
|
2909
3023
|
// src/reducer.ts
|
|
@@ -3140,7 +3254,7 @@ function reducer(state, action) {
|
|
|
3140
3254
|
}
|
|
3141
3255
|
|
|
3142
3256
|
// src/useLiveDashboardPoll.ts
|
|
3143
|
-
import { useEffect as
|
|
3257
|
+
import { useEffect as useEffect3, useReducer, useRef as useRef2 } from "react";
|
|
3144
3258
|
var POLL_INTERVAL_MS = 6e4;
|
|
3145
3259
|
var LEAD_MS = 12e4;
|
|
3146
3260
|
var GIVE_UP_MS = 30 * 6e4;
|
|
@@ -3188,7 +3302,7 @@ function useLiveDashboardPoll({ messages, dispatch, getLiveDashboard }) {
|
|
|
3188
3302
|
anchorRef.current = anchor;
|
|
3189
3303
|
const inFlightRef = useRef2(false);
|
|
3190
3304
|
const anchorKey = anchor ? `${anchor.messageId}:${anchor.kind}` : null;
|
|
3191
|
-
|
|
3305
|
+
useEffect3(() => {
|
|
3192
3306
|
if (!anchorKey || !anchorRef.current) return;
|
|
3193
3307
|
const tick = async () => {
|
|
3194
3308
|
if (inFlightRef.current) return;
|
|
@@ -3224,7 +3338,7 @@ function useLiveDashboardPoll({ messages, dispatch, getLiveDashboard }) {
|
|
|
3224
3338
|
}, POLL_INTERVAL_MS);
|
|
3225
3339
|
return () => window.clearInterval(id);
|
|
3226
3340
|
}, [anchorKey, dispatch, getLiveDashboard]);
|
|
3227
|
-
|
|
3341
|
+
useEffect3(() => {
|
|
3228
3342
|
if (anchorKey !== null) return;
|
|
3229
3343
|
const wakeAt = findEarliestWakeupMs(messages);
|
|
3230
3344
|
if (wakeAt === null) return;
|
|
@@ -3252,7 +3366,7 @@ function readConversation(storageKey, now) {
|
|
|
3252
3366
|
} catch {
|
|
3253
3367
|
return "corrupt";
|
|
3254
3368
|
}
|
|
3255
|
-
if (parsed?.v !==
|
|
3369
|
+
if (parsed?.v !== 2 || !Array.isArray(parsed.messages) || typeof parsed.updatedAt !== "number") return "corrupt";
|
|
3256
3370
|
if (now - parsed.updatedAt > TTL_MS) return "expired";
|
|
3257
3371
|
return { conversationId: parsed.conversationId ?? null, messages: parsed.messages };
|
|
3258
3372
|
}
|
|
@@ -3260,7 +3374,7 @@ function writeConversation(storageKey, conversationId, messages, now) {
|
|
|
3260
3374
|
let capped = messages.slice(-MAX_MESSAGES);
|
|
3261
3375
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
3262
3376
|
try {
|
|
3263
|
-
window.localStorage.setItem(storageKey, JSON.stringify({ v:
|
|
3377
|
+
window.localStorage.setItem(storageKey, JSON.stringify({ v: 2, updatedAt: now, conversationId, messages: capped }));
|
|
3264
3378
|
return;
|
|
3265
3379
|
} catch {
|
|
3266
3380
|
if (capped.length <= 1) return;
|
|
@@ -3286,18 +3400,29 @@ function tileDisplayText(tile) {
|
|
|
3286
3400
|
const subtitle = tile.subtitle?.trim();
|
|
3287
3401
|
return isPriceTile(tile) && subtitle ? subtitle : tile.title;
|
|
3288
3402
|
}
|
|
3403
|
+
var shown = (forms, format2) => forms ? formatOdds(forms, format2) : void 0;
|
|
3404
|
+
function tileForFormat(tile, format2) {
|
|
3405
|
+
return {
|
|
3406
|
+
...tile,
|
|
3407
|
+
title: shown(tile.titleFormats, format2) ?? tile.title,
|
|
3408
|
+
subtitle: shown(tile.subtitleFormats, format2) ?? tile.subtitle,
|
|
3409
|
+
badgeText: shown(tile.badgeFormats, format2) ?? tile.badgeText,
|
|
3410
|
+
actionValue: shown(tile.actionValueFormats, format2) ?? tile.actionValue
|
|
3411
|
+
};
|
|
3412
|
+
}
|
|
3289
3413
|
var MAX_PRICE_TILE_ID = "goal-preset-max-price";
|
|
3290
3414
|
var STANDOUT_TILE_ID = "goal-standout-matches";
|
|
3291
|
-
function bubbleAsks(messages, standoutLabel) {
|
|
3415
|
+
function bubbleAsks(messages, standoutLabel, format2) {
|
|
3292
3416
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3293
3417
|
const m = messages[i];
|
|
3294
3418
|
if (!m || m.role !== "assistant" || !m.isGreeting) continue;
|
|
3295
3419
|
const dashboard = m.greetingDashboard;
|
|
3296
3420
|
if (!dashboard || !dashboard.tiles.some(isPriceTile)) return [];
|
|
3297
3421
|
const asks = [];
|
|
3422
|
+
const tiles = dashboard.tiles.map((tile) => tileForFormat(tile, format2));
|
|
3298
3423
|
const add = (entityId, labelOf) => {
|
|
3299
|
-
const index =
|
|
3300
|
-
const tile =
|
|
3424
|
+
const index = tiles.findIndex((tile2) => tile2.signal?.entityId === entityId);
|
|
3425
|
+
const tile = tiles[index];
|
|
3301
3426
|
const label = tile ? labelOf(tile)?.trim() : void 0;
|
|
3302
3427
|
if (tile && label) asks.push({ tile, index, position: asks.length, layout: dashboard.layout, label });
|
|
3303
3428
|
};
|
|
@@ -3321,7 +3446,7 @@ import { SPORTS as SPORTS3 } from "@sensiblestats/widget-sdk";
|
|
|
3321
3446
|
var PREFIX = "ss-w-sport:";
|
|
3322
3447
|
var VERSION = 1;
|
|
3323
3448
|
var TTL_MS2 = 30 * 24 * 36e5;
|
|
3324
|
-
var
|
|
3449
|
+
var memory2 = /* @__PURE__ */ new Map();
|
|
3325
3450
|
function sportChoiceKey(operatorId, encodedUserKey2) {
|
|
3326
3451
|
return `${PREFIX}${operatorId}:${encodedUserKey2}`;
|
|
3327
3452
|
}
|
|
@@ -3334,7 +3459,7 @@ function load(key) {
|
|
|
3334
3459
|
if (raw) return raw;
|
|
3335
3460
|
} catch {
|
|
3336
3461
|
}
|
|
3337
|
-
return
|
|
3462
|
+
return memory2.get(key) ?? null;
|
|
3338
3463
|
}
|
|
3339
3464
|
function readSportChoice(operatorId, encodedUserKey2, now) {
|
|
3340
3465
|
const raw = load(sportChoiceKey(operatorId, encodedUserKey2));
|
|
@@ -3353,14 +3478,14 @@ function writeSportChoice(operatorId, encodedUserKey2, sport, now) {
|
|
|
3353
3478
|
const raw = JSON.stringify({ v: VERSION, sport, at: now });
|
|
3354
3479
|
try {
|
|
3355
3480
|
window.localStorage.setItem(key, raw);
|
|
3356
|
-
|
|
3481
|
+
memory2.delete(key);
|
|
3357
3482
|
} catch {
|
|
3358
|
-
|
|
3483
|
+
memory2.set(key, raw);
|
|
3359
3484
|
}
|
|
3360
3485
|
}
|
|
3361
3486
|
|
|
3362
3487
|
// src/useMatchDiscovery.ts
|
|
3363
|
-
import { useCallback as useCallback2, useEffect as
|
|
3488
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
|
|
3364
3489
|
import { matchKey as matchKey2 } from "@sensiblestats/widget-sdk";
|
|
3365
3490
|
|
|
3366
3491
|
// src/scheduleCache.ts
|
|
@@ -3472,24 +3597,24 @@ function localDateOf(now) {
|
|
|
3472
3597
|
return `${y}-${m}-${d}`;
|
|
3473
3598
|
}
|
|
3474
3599
|
function useMatchDiscovery(opts) {
|
|
3475
|
-
const [groups, setGroups] =
|
|
3476
|
-
const [states, setStates] =
|
|
3477
|
-
const [failures, setFailures] =
|
|
3600
|
+
const [groups, setGroups] = useState3([]);
|
|
3601
|
+
const [states, setStates] = useState3(() => /* @__PURE__ */ new Map());
|
|
3602
|
+
const [failures, setFailures] = useState3(0);
|
|
3478
3603
|
const groupsRef = useRef3(groups);
|
|
3479
3604
|
groupsRef.current = groups;
|
|
3480
3605
|
const statesRef = useRef3(states);
|
|
3481
3606
|
statesRef.current = states;
|
|
3482
3607
|
const getStatesRef = useRef3(opts.getStates);
|
|
3483
3608
|
getStatesRef.current = opts.getStates;
|
|
3484
|
-
const [localDate, setLocalDate] =
|
|
3485
|
-
|
|
3609
|
+
const [localDate, setLocalDate] = useState3(() => localDateOf(/* @__PURE__ */ new Date()));
|
|
3610
|
+
useEffect4(() => {
|
|
3486
3611
|
const id = setInterval(() => {
|
|
3487
3612
|
const next = localDateOf(/* @__PURE__ */ new Date());
|
|
3488
3613
|
setLocalDate((prev) => prev === next ? prev : next);
|
|
3489
3614
|
}, ROLLOVER_CHECK_MS);
|
|
3490
3615
|
return () => clearInterval(id);
|
|
3491
3616
|
}, []);
|
|
3492
|
-
|
|
3617
|
+
useEffect4(() => {
|
|
3493
3618
|
let cancelled = false;
|
|
3494
3619
|
const utcOffsetMinutes = -(/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
3495
3620
|
const key = encodedUserKey(opts.operatorUserId, opts.anonymousUserId);
|
|
@@ -3531,7 +3656,7 @@ function useMatchDiscovery(opts) {
|
|
|
3531
3656
|
setFailures((n) => n + 1);
|
|
3532
3657
|
}
|
|
3533
3658
|
}, []);
|
|
3534
|
-
|
|
3659
|
+
useEffect4(() => {
|
|
3535
3660
|
if (!opts.isOpen) return;
|
|
3536
3661
|
void tick();
|
|
3537
3662
|
const id = setInterval(() => {
|
|
@@ -3540,7 +3665,7 @@ function useMatchDiscovery(opts) {
|
|
|
3540
3665
|
return () => clearInterval(id);
|
|
3541
3666
|
}, [opts.isOpen, tick, groups]);
|
|
3542
3667
|
const stale = failures >= STALE_AFTER_FAILURES;
|
|
3543
|
-
const liveCount =
|
|
3668
|
+
const liveCount = useMemo3(
|
|
3544
3669
|
() => stale ? 0 : [...states.values()].filter((s) => s.phase === "live").length,
|
|
3545
3670
|
[states, stale]
|
|
3546
3671
|
);
|
|
@@ -3589,8 +3714,8 @@ var CARD_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
3589
3714
|
"combo_card",
|
|
3590
3715
|
"odds_movement"
|
|
3591
3716
|
]);
|
|
3592
|
-
function useChatStream(conversation, starterTexts, greetingMessage, storageKey, page, sportScope, language, options) {
|
|
3593
|
-
const boot =
|
|
3717
|
+
function useChatStream(conversation, starterTexts, greetingMessage, storageKey, page, sportScope, language, options, oddsFormat) {
|
|
3718
|
+
const boot = useMemo4(() => {
|
|
3594
3719
|
const payload = storageKey ? readConversation(storageKey, Date.now()) : null;
|
|
3595
3720
|
const restored = payload != null && payload !== "expired" && payload !== "corrupt";
|
|
3596
3721
|
const base = initialState(starterTexts.map(chipFromText));
|
|
@@ -3618,7 +3743,21 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3618
3743
|
languageRef.current = language;
|
|
3619
3744
|
const builtWithRef = useRef4({ conversation, language });
|
|
3620
3745
|
if (builtWithRef.current.conversation !== conversation) builtWithRef.current = { conversation, language };
|
|
3621
|
-
const
|
|
3746
|
+
const oddsFormatRef = useRef4(oddsFormat);
|
|
3747
|
+
oddsFormatRef.current = oddsFormat;
|
|
3748
|
+
const withLanguage = (input) => {
|
|
3749
|
+
const languageChanged = languageRef.current !== builtWithRef.current.language;
|
|
3750
|
+
const format2 = oddsFormatRef.current;
|
|
3751
|
+
if (!languageChanged && format2 === void 0) return input;
|
|
3752
|
+
return {
|
|
3753
|
+
...input,
|
|
3754
|
+
userContext: {
|
|
3755
|
+
...input.userContext,
|
|
3756
|
+
...languageChanged ? { defaultLanguage: languageRef.current } : {},
|
|
3757
|
+
...format2 !== void 0 ? { oddsFormat: format2 } : {}
|
|
3758
|
+
}
|
|
3759
|
+
};
|
|
3760
|
+
};
|
|
3622
3761
|
const greetedKeyRef = useRef4(null);
|
|
3623
3762
|
const greetingCancelledRef = useRef4(false);
|
|
3624
3763
|
const restoreSeededRef = useRef4(false);
|
|
@@ -3676,7 +3815,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3676
3815
|
const run = useCallback3((input, source, displayText2) => {
|
|
3677
3816
|
if (isPaused(stateRef.current.limit)) return;
|
|
3678
3817
|
const track = optionsRef.current?.track;
|
|
3679
|
-
const
|
|
3818
|
+
const shown2 = displayText2 ?? input.message;
|
|
3680
3819
|
const userId = nextId();
|
|
3681
3820
|
const assistantId = nextId();
|
|
3682
3821
|
activeTurnRef.current?.abandon();
|
|
@@ -3697,7 +3836,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3697
3836
|
};
|
|
3698
3837
|
activeTurnRef.current = turn;
|
|
3699
3838
|
dispatch({ kind: "USER_SENT", input, userId, assistantId, displayText: displayText2 });
|
|
3700
|
-
track?.({ name: "question_asked", turnId: turn.id, source, length:
|
|
3839
|
+
track?.({ name: "question_asked", turnId: turn.id, source, length: shown2.length, ...optionsRef.current?.eventText?.() ? { text: shown2 } : {} });
|
|
3701
3840
|
const handle = conversation.send(withLanguage(input));
|
|
3702
3841
|
handleRef.current = handle;
|
|
3703
3842
|
armFallbackTimer(() => {
|
|
@@ -3751,13 +3890,13 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3751
3890
|
dispatch({ kind: "STOP" });
|
|
3752
3891
|
}
|
|
3753
3892
|
}, [greetingMessage, conversation, consume, clearFallbackTimer, armFallbackTimer]);
|
|
3754
|
-
|
|
3893
|
+
useEffect5(() => {
|
|
3755
3894
|
if (greetedRef.current) return;
|
|
3756
3895
|
greetedRef.current = true;
|
|
3757
3896
|
fireGreeting();
|
|
3758
3897
|
}, [fireGreeting]);
|
|
3759
3898
|
const key = pageKey(page);
|
|
3760
|
-
|
|
3899
|
+
useEffect5(() => {
|
|
3761
3900
|
if (greetedKeyRef.current === null) return;
|
|
3762
3901
|
if (key === greetedKeyRef.current && !greetingCancelledRef.current) return;
|
|
3763
3902
|
if (stateRef.current.messages.some((m) => m.role === "user")) return;
|
|
@@ -3775,7 +3914,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3775
3914
|
return () => clearTimeout(timer);
|
|
3776
3915
|
}, [key, conversation, fireGreeting]);
|
|
3777
3916
|
const keyRef = useRef4(storageKey);
|
|
3778
|
-
|
|
3917
|
+
useEffect5(() => {
|
|
3779
3918
|
if (keyRef.current === storageKey) return;
|
|
3780
3919
|
keyRef.current = storageKey;
|
|
3781
3920
|
activeTurnRef.current?.abandon();
|
|
@@ -3796,17 +3935,17 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3796
3935
|
dispatch({ kind: "RESET" });
|
|
3797
3936
|
fireGreeting();
|
|
3798
3937
|
}, [storageKey, conversation, clearFallbackTimer, fireGreeting]);
|
|
3799
|
-
|
|
3938
|
+
useEffect5(() => {
|
|
3800
3939
|
if (!state.limit) return;
|
|
3801
3940
|
const delay = limitDelayMs(state.limit, Date.now());
|
|
3802
3941
|
if (delay === null) return;
|
|
3803
3942
|
const timer = setTimeout(() => dispatch({ kind: "LIMIT_EXPIRED" }), delay);
|
|
3804
3943
|
return () => clearTimeout(timer);
|
|
3805
3944
|
}, [state.limit]);
|
|
3806
|
-
|
|
3945
|
+
useEffect5(() => {
|
|
3807
3946
|
if (boot.stale && storageKey) clearConversation(storageKey);
|
|
3808
3947
|
}, []);
|
|
3809
|
-
|
|
3948
|
+
useEffect5(() => {
|
|
3810
3949
|
if (!storageKey || state.isStreaming) return;
|
|
3811
3950
|
if (hydratedRef.current) {
|
|
3812
3951
|
hydratedRef.current = false;
|
|
@@ -3823,7 +3962,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3823
3962
|
if (persistable.length === 0) return;
|
|
3824
3963
|
writeConversation(storageKey, state.conversationId, persistable, Date.now());
|
|
3825
3964
|
}, [storageKey, state.isStreaming, state.messages, state.conversationId]);
|
|
3826
|
-
|
|
3965
|
+
useEffect5(() => {
|
|
3827
3966
|
if (!storageKey) return;
|
|
3828
3967
|
const onStorage = (e) => {
|
|
3829
3968
|
if (e.key !== storageKey || e.storageArea !== window.localStorage) return;
|
|
@@ -3887,7 +4026,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3887
4026
|
}
|
|
3888
4027
|
|
|
3889
4028
|
// src/useLiveMonitor.ts
|
|
3890
|
-
import { useCallback as useCallback4, useEffect as
|
|
4029
|
+
import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef5, useState as useState5 } from "react";
|
|
3891
4030
|
|
|
3892
4031
|
// src/pinStore.ts
|
|
3893
4032
|
import { SPORTS as SPORTS4, sportOf as sportOf5 } from "@sensiblestats/widget-sdk";
|
|
@@ -4014,9 +4153,9 @@ function orderTiles(pins, snapshot, seedOf) {
|
|
|
4014
4153
|
}
|
|
4015
4154
|
|
|
4016
4155
|
// src/useTabs.ts
|
|
4017
|
-
import { useState as
|
|
4156
|
+
import { useState as useState4 } from "react";
|
|
4018
4157
|
function useTabs(initial = "chat") {
|
|
4019
|
-
const [activeTab, setActiveTab] =
|
|
4158
|
+
const [activeTab, setActiveTab] = useState4(initial);
|
|
4020
4159
|
return { activeTab, setActiveTab };
|
|
4021
4160
|
}
|
|
4022
4161
|
|
|
@@ -4039,7 +4178,7 @@ function priceForPin(snapshot, pin) {
|
|
|
4039
4178
|
const rows = market?.card?.rows;
|
|
4040
4179
|
if (!rows || rows.length === 0) return void 0;
|
|
4041
4180
|
const row = pin.matchOddsId != null ? rows.find((r) => r.matchOddsId === pin.matchOddsId) : rows[0];
|
|
4042
|
-
return row
|
|
4181
|
+
return row ? { value: row.price, forms: row.priceFormats } : void 0;
|
|
4043
4182
|
}
|
|
4044
4183
|
function phaseForPin(snapshot, pin) {
|
|
4045
4184
|
if (pin.kind === "match") return matchFor(snapshot, pin)?.phase;
|
|
@@ -4047,19 +4186,19 @@ function phaseForPin(snapshot, pin) {
|
|
|
4047
4186
|
}
|
|
4048
4187
|
function useLiveMonitor(opts) {
|
|
4049
4188
|
const sessionIdRef = useRef5(crypto.randomUUID());
|
|
4050
|
-
const [pins, setPins] =
|
|
4051
|
-
const [store] =
|
|
4052
|
-
const [enabled, setEnabled] =
|
|
4053
|
-
const [snapshot, setSnapshotState] =
|
|
4189
|
+
const [pins, setPins] = useState5([]);
|
|
4190
|
+
const [store] = useState5(() => createPinStore(opts.storageKey, sessionIdRef.current, setPins));
|
|
4191
|
+
const [enabled, setEnabled] = useState5(true);
|
|
4192
|
+
const [snapshot, setSnapshotState] = useState5(null);
|
|
4054
4193
|
const { activeTab, setActiveTab: setActiveTabState } = useTabs("chat");
|
|
4055
|
-
const [chatDot, setChatDot] =
|
|
4056
|
-
const [matchesDot, setMatchesDot] =
|
|
4057
|
-
const [trendsDot, setTrendsDot] =
|
|
4058
|
-
const [todayDot, setTodayDot] =
|
|
4059
|
-
const [lastViewedPrices, setLastViewedPrices] =
|
|
4060
|
-
const [openMarket, setOpenMarket] =
|
|
4061
|
-
const [selectedMatchKey, setSelectedMatchKey] =
|
|
4062
|
-
const [marketOdds, setMarketOdds] =
|
|
4194
|
+
const [chatDot, setChatDot] = useState5(false);
|
|
4195
|
+
const [matchesDot, setMatchesDot] = useState5(false);
|
|
4196
|
+
const [trendsDot, setTrendsDot] = useState5(false);
|
|
4197
|
+
const [todayDot, setTodayDot] = useState5(false);
|
|
4198
|
+
const [lastViewedPrices, setLastViewedPrices] = useState5({});
|
|
4199
|
+
const [openMarket, setOpenMarket] = useState5({});
|
|
4200
|
+
const [selectedMatchKey, setSelectedMatchKey] = useState5(null);
|
|
4201
|
+
const [marketOdds, setMarketOdds] = useState5({});
|
|
4063
4202
|
const pinsRef = useRef5(pins);
|
|
4064
4203
|
pinsRef.current = pins;
|
|
4065
4204
|
const watchesRef = useRef5(opts.watches ?? []);
|
|
@@ -4125,7 +4264,7 @@ function useLiveMonitor(opts) {
|
|
|
4125
4264
|
const getPlayerPropsRef = useRef5(opts.getPlayerProps);
|
|
4126
4265
|
getPlayerPropsRef.current = opts.getPlayerProps;
|
|
4127
4266
|
const playerPropsRef = useRef5({});
|
|
4128
|
-
const [playerProps, setPlayerProps] =
|
|
4267
|
+
const [playerProps, setPlayerProps] = useState5({});
|
|
4129
4268
|
const loadPlayerProps = useCallback4((matchId, sport) => {
|
|
4130
4269
|
const fn = getPlayerPropsRef.current;
|
|
4131
4270
|
if (!fn) return;
|
|
@@ -4201,7 +4340,7 @@ function useLiveMonitor(opts) {
|
|
|
4201
4340
|
const out = { ...prevMap };
|
|
4202
4341
|
for (const pin of marketPins) {
|
|
4203
4342
|
const price = priceForPin(next, pin);
|
|
4204
|
-
if (price !== void 0 && out[pin.key] !== price) {
|
|
4343
|
+
if (price !== void 0 && out[pin.key]?.value !== price.value) {
|
|
4205
4344
|
out[pin.key] = price;
|
|
4206
4345
|
changed = true;
|
|
4207
4346
|
}
|
|
@@ -4213,7 +4352,7 @@ function useLiveMonitor(opts) {
|
|
|
4213
4352
|
for (const pin of marketPins) {
|
|
4214
4353
|
const price = priceForPin(next, pin);
|
|
4215
4354
|
const last = lastViewedPricesRef.current[pin.key];
|
|
4216
|
-
if (price !== void 0 && last !== void 0 && price !== last) {
|
|
4355
|
+
if (price !== void 0 && last !== void 0 && price.value !== last.value) {
|
|
4217
4356
|
sawPriceMove = true;
|
|
4218
4357
|
break;
|
|
4219
4358
|
}
|
|
@@ -4286,14 +4425,14 @@ function useLiveMonitor(opts) {
|
|
|
4286
4425
|
const hinted = snapshotRef.current ? snapshotRef.current.nextPollSeconds * 1e3 : fallbackMs;
|
|
4287
4426
|
timerRef.current = window.setTimeout(() => void tick(), Math.max(MIN_POLL_MS, hinted));
|
|
4288
4427
|
};
|
|
4289
|
-
|
|
4428
|
+
useEffect6(() => {
|
|
4290
4429
|
mountedRef.current = true;
|
|
4291
4430
|
return () => {
|
|
4292
4431
|
mountedRef.current = false;
|
|
4293
4432
|
};
|
|
4294
4433
|
}, []);
|
|
4295
4434
|
const prevPinsLengthRef = useRef5(0);
|
|
4296
|
-
|
|
4435
|
+
useEffect6(() => {
|
|
4297
4436
|
const wasEmpty = prevPinsLengthRef.current === 0 && watchesRef.current.length === 0;
|
|
4298
4437
|
prevPinsLengthRef.current = pins.length;
|
|
4299
4438
|
if (pins.length === 0 && watchesRef.current.length === 0) {
|
|
@@ -4304,17 +4443,17 @@ function useLiveMonitor(opts) {
|
|
|
4304
4443
|
}, [pins.length, tick]);
|
|
4305
4444
|
const prevWatchesLengthRef = useRef5(0);
|
|
4306
4445
|
const watchesLength = opts.watches?.length ?? 0;
|
|
4307
|
-
|
|
4446
|
+
useEffect6(() => {
|
|
4308
4447
|
const wasEmpty = prevWatchesLengthRef.current === 0 && pinsRef.current.length === 0;
|
|
4309
4448
|
prevWatchesLengthRef.current = watchesLength;
|
|
4310
4449
|
if (wasEmpty && watchesLength > 0) void tick();
|
|
4311
4450
|
}, [watchesLength, tick]);
|
|
4312
|
-
|
|
4451
|
+
useEffect6(() => {
|
|
4313
4452
|
const matchPins = pins.filter((p) => p.kind === "match");
|
|
4314
4453
|
if (selectedRef.current !== null && matchPins.some((p) => p.key === selectedRef.current)) return;
|
|
4315
4454
|
chooseSelection(orderTiles(matchPins, snapshotRef.current)[0]?.pin.key ?? null);
|
|
4316
4455
|
}, [pins, chooseSelection]);
|
|
4317
|
-
|
|
4456
|
+
useEffect6(() => {
|
|
4318
4457
|
if (clubEnabled && (activeTab === "today" || activeTab === "following" || activeTab === "trends")) {
|
|
4319
4458
|
setActiveTabState("chat");
|
|
4320
4459
|
return;
|
|
@@ -4326,12 +4465,12 @@ function useLiveMonitor(opts) {
|
|
|
4326
4465
|
if (activeTab === "today" && !hasToday) setActiveTabState("chat");
|
|
4327
4466
|
}, [pins, activeTab, hasToday, clubEnabled]);
|
|
4328
4467
|
const prevIsOpenRef = useRef5(false);
|
|
4329
|
-
|
|
4468
|
+
useEffect6(() => {
|
|
4330
4469
|
const wasClosed = !prevIsOpenRef.current;
|
|
4331
4470
|
prevIsOpenRef.current = opts.isOpen;
|
|
4332
4471
|
if (wasClosed && opts.isOpen) void tick();
|
|
4333
4472
|
}, [opts.isOpen, tick]);
|
|
4334
|
-
|
|
4473
|
+
useEffect6(() => {
|
|
4335
4474
|
const onVisibility = () => {
|
|
4336
4475
|
if (document.visibilityState === "hidden") window.clearTimeout(timerRef.current);
|
|
4337
4476
|
else void tick();
|
|
@@ -4440,17 +4579,17 @@ function useLiveMonitor(opts) {
|
|
|
4440
4579
|
}
|
|
4441
4580
|
|
|
4442
4581
|
// src/useGames.ts
|
|
4443
|
-
import { useCallback as useCallback5, useEffect as
|
|
4582
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef6, useState as useState6 } from "react";
|
|
4444
4583
|
var GAMES_POLL_MS = 6e4;
|
|
4445
4584
|
var DEFAULT_TZ = "Europe/London";
|
|
4446
4585
|
function computeGameDay(timezone) {
|
|
4447
4586
|
return new Intl.DateTimeFormat("en-CA", { timeZone: timezone }).format(/* @__PURE__ */ new Date());
|
|
4448
4587
|
}
|
|
4449
4588
|
function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
4450
|
-
const [enabled, setEnabled] =
|
|
4451
|
-
const [games, setGames] =
|
|
4452
|
-
const [loading, setLoading] =
|
|
4453
|
-
const [refreshCount, setRefreshCount] =
|
|
4589
|
+
const [enabled, setEnabled] = useState6(false);
|
|
4590
|
+
const [games, setGames] = useState6([]);
|
|
4591
|
+
const [loading, setLoading] = useState6(false);
|
|
4592
|
+
const [refreshCount, setRefreshCount] = useState6(0);
|
|
4454
4593
|
const inFlightRef = useRef6(false);
|
|
4455
4594
|
const hardOffRef = useRef6(false);
|
|
4456
4595
|
const conversationRef = useRef6(conversation);
|
|
@@ -4458,7 +4597,7 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4458
4597
|
const tzRef = useRef6(operatorTimezone ?? DEFAULT_TZ);
|
|
4459
4598
|
tzRef.current = operatorTimezone ?? DEFAULT_TZ;
|
|
4460
4599
|
const ready = conversation != null;
|
|
4461
|
-
|
|
4600
|
+
useEffect7(() => {
|
|
4462
4601
|
if (hardOffRef.current) return;
|
|
4463
4602
|
let active = true;
|
|
4464
4603
|
const doFetch = async () => {
|
|
@@ -4508,15 +4647,15 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4508
4647
|
}
|
|
4509
4648
|
|
|
4510
4649
|
// src/useLeaderboard.ts
|
|
4511
|
-
import { useCallback as useCallback6, useEffect as
|
|
4650
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef7, useState as useState7 } from "react";
|
|
4512
4651
|
function useLeaderboard(conversation, { activeTab }) {
|
|
4513
|
-
const [data, setData] =
|
|
4514
|
-
const [loading, setLoading] =
|
|
4515
|
-
const [refreshCount, setRefreshCount] =
|
|
4652
|
+
const [data, setData] = useState7(null);
|
|
4653
|
+
const [loading, setLoading] = useState7(false);
|
|
4654
|
+
const [refreshCount, setRefreshCount] = useState7(0);
|
|
4516
4655
|
const inFlightRef = useRef7(false);
|
|
4517
4656
|
const conversationRef = useRef7(conversation);
|
|
4518
4657
|
conversationRef.current = conversation;
|
|
4519
|
-
|
|
4658
|
+
useEffect8(() => {
|
|
4520
4659
|
if (activeTab !== "games") return;
|
|
4521
4660
|
let active = true;
|
|
4522
4661
|
const doFetch = async () => {
|
|
@@ -4546,29 +4685,29 @@ function useLeaderboard(conversation, { activeTab }) {
|
|
|
4546
4685
|
}
|
|
4547
4686
|
|
|
4548
4687
|
// src/useClubFixtures.ts
|
|
4549
|
-
import { useCallback as useCallback7, useEffect as
|
|
4688
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useRef as useRef8, useState as useState8 } from "react";
|
|
4550
4689
|
var CLUB_PROBE_RETRY_MS = 15e3;
|
|
4551
4690
|
var CLUB_PROBE_MAX_ATTEMPTS = 3;
|
|
4552
4691
|
var CLUB_TAB_WAIT_MS = 2e3;
|
|
4553
4692
|
function useClubFixtures(conversation) {
|
|
4554
|
-
const [enabled, setEnabled] =
|
|
4555
|
-
const [settled, setSettled] =
|
|
4556
|
-
const [failed, setFailed] =
|
|
4557
|
-
const [waited, setWaited] =
|
|
4558
|
-
const [fixtures, setFixtures] =
|
|
4559
|
-
const [loading, setLoading] =
|
|
4560
|
-
const [refreshCount, setRefreshCount] =
|
|
4693
|
+
const [enabled, setEnabled] = useState8(false);
|
|
4694
|
+
const [settled, setSettled] = useState8(false);
|
|
4695
|
+
const [failed, setFailed] = useState8(false);
|
|
4696
|
+
const [waited, setWaited] = useState8(false);
|
|
4697
|
+
const [fixtures, setFixtures] = useState8([]);
|
|
4698
|
+
const [loading, setLoading] = useState8(false);
|
|
4699
|
+
const [refreshCount, setRefreshCount] = useState8(0);
|
|
4561
4700
|
const inFlightRef = useRef8(false);
|
|
4562
4701
|
const hardOffRef = useRef8(false);
|
|
4563
4702
|
const conversationRef = useRef8(conversation);
|
|
4564
4703
|
conversationRef.current = conversation;
|
|
4565
4704
|
const ready = conversation != null;
|
|
4566
|
-
|
|
4705
|
+
useEffect9(() => {
|
|
4567
4706
|
if (!ready) return;
|
|
4568
4707
|
const id = window.setTimeout(() => setWaited(true), CLUB_TAB_WAIT_MS);
|
|
4569
4708
|
return () => window.clearTimeout(id);
|
|
4570
4709
|
}, [ready]);
|
|
4571
|
-
|
|
4710
|
+
useEffect9(() => {
|
|
4572
4711
|
if (hardOffRef.current) return;
|
|
4573
4712
|
let active = true;
|
|
4574
4713
|
let retryTimeoutId;
|
|
@@ -4620,15 +4759,15 @@ function useClubFixtures(conversation) {
|
|
|
4620
4759
|
}
|
|
4621
4760
|
|
|
4622
4761
|
// src/useClubStandings.ts
|
|
4623
|
-
import { useCallback as useCallback8, useEffect as
|
|
4762
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useRef as useRef9, useState as useState9 } from "react";
|
|
4624
4763
|
function useClubStandings(conversation, { activeTab, enabled }) {
|
|
4625
|
-
const [data, setData] =
|
|
4626
|
-
const [loading, setLoading] =
|
|
4627
|
-
const [refreshCount, setRefreshCount] =
|
|
4764
|
+
const [data, setData] = useState9(null);
|
|
4765
|
+
const [loading, setLoading] = useState9(false);
|
|
4766
|
+
const [refreshCount, setRefreshCount] = useState9(0);
|
|
4628
4767
|
const inFlightRef = useRef9(false);
|
|
4629
4768
|
const conversationRef = useRef9(conversation);
|
|
4630
4769
|
conversationRef.current = conversation;
|
|
4631
|
-
|
|
4770
|
+
useEffect10(() => {
|
|
4632
4771
|
if (activeTab !== "standings" || !enabled) return;
|
|
4633
4772
|
let active = true;
|
|
4634
4773
|
const doFetch = async () => {
|
|
@@ -4659,15 +4798,15 @@ function useClubStandings(conversation, { activeTab, enabled }) {
|
|
|
4659
4798
|
}
|
|
4660
4799
|
|
|
4661
4800
|
// src/useClubSquad.ts
|
|
4662
|
-
import { useCallback as useCallback9, useEffect as
|
|
4801
|
+
import { useCallback as useCallback9, useEffect as useEffect11, useRef as useRef10, useState as useState10 } from "react";
|
|
4663
4802
|
function useClubSquad(conversation, { activeTab, enabled }) {
|
|
4664
|
-
const [data, setData] =
|
|
4665
|
-
const [loading, setLoading] =
|
|
4666
|
-
const [refreshCount, setRefreshCount] =
|
|
4803
|
+
const [data, setData] = useState10(null);
|
|
4804
|
+
const [loading, setLoading] = useState10(false);
|
|
4805
|
+
const [refreshCount, setRefreshCount] = useState10(0);
|
|
4667
4806
|
const inFlightRef = useRef10(false);
|
|
4668
4807
|
const conversationRef = useRef10(conversation);
|
|
4669
4808
|
conversationRef.current = conversation;
|
|
4670
|
-
|
|
4809
|
+
useEffect11(() => {
|
|
4671
4810
|
if (activeTab !== "squad" || !enabled) return;
|
|
4672
4811
|
let active = true;
|
|
4673
4812
|
const doFetch = async () => {
|
|
@@ -4698,18 +4837,18 @@ function useClubSquad(conversation, { activeTab, enabled }) {
|
|
|
4698
4837
|
}
|
|
4699
4838
|
|
|
4700
4839
|
// src/useClubSquadStats.ts
|
|
4701
|
-
import { useCallback as useCallback10, useEffect as
|
|
4840
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef11, useState as useState11 } from "react";
|
|
4702
4841
|
function useClubSquadStats(conversation, { activeTab, enabled }) {
|
|
4703
|
-
const [data, setData] =
|
|
4704
|
-
const [seasonName, setSeasonName] =
|
|
4705
|
-
const [competitionName, setCompetitionName] =
|
|
4706
|
-
const [matchesPlayed, setMatchesPlayed] =
|
|
4707
|
-
const [loading, setLoading] =
|
|
4708
|
-
const [refreshCount, setRefreshCount] =
|
|
4842
|
+
const [data, setData] = useState11(null);
|
|
4843
|
+
const [seasonName, setSeasonName] = useState11(null);
|
|
4844
|
+
const [competitionName, setCompetitionName] = useState11(null);
|
|
4845
|
+
const [matchesPlayed, setMatchesPlayed] = useState11(null);
|
|
4846
|
+
const [loading, setLoading] = useState11(false);
|
|
4847
|
+
const [refreshCount, setRefreshCount] = useState11(0);
|
|
4709
4848
|
const inFlightRef = useRef11(false);
|
|
4710
4849
|
const conversationRef = useRef11(conversation);
|
|
4711
4850
|
conversationRef.current = conversation;
|
|
4712
|
-
|
|
4851
|
+
useEffect12(() => {
|
|
4713
4852
|
if (activeTab !== "squad" || !enabled) return;
|
|
4714
4853
|
let active = true;
|
|
4715
4854
|
const doFetch = async () => {
|
|
@@ -4745,10 +4884,10 @@ function useClubSquadStats(conversation, { activeTab, enabled }) {
|
|
|
4745
4884
|
}
|
|
4746
4885
|
|
|
4747
4886
|
// src/useClubPlayerDetail.ts
|
|
4748
|
-
import { useCallback as useCallback11, useRef as useRef12, useState as
|
|
4887
|
+
import { useCallback as useCallback11, useRef as useRef12, useState as useState12 } from "react";
|
|
4749
4888
|
function useClubPlayerDetail(conversation) {
|
|
4750
|
-
const [data, setData] =
|
|
4751
|
-
const [loading, setLoading] =
|
|
4889
|
+
const [data, setData] = useState12(null);
|
|
4890
|
+
const [loading, setLoading] = useState12(false);
|
|
4752
4891
|
const requestSeqRef = useRef12(0);
|
|
4753
4892
|
const conversationRef = useRef12(conversation);
|
|
4754
4893
|
conversationRef.current = conversation;
|
|
@@ -4777,16 +4916,11 @@ function useClubPlayerDetail(conversation) {
|
|
|
4777
4916
|
}
|
|
4778
4917
|
|
|
4779
4918
|
// src/usePresetGrid.ts
|
|
4780
|
-
import { useEffect as
|
|
4919
|
+
import { useEffect as useEffect13, useRef as useRef13, useState as useState13 } from "react";
|
|
4781
4920
|
|
|
4782
4921
|
// src/presetGrid.ts
|
|
4783
|
-
var DEFAULT_SINGLES_LIMITS = [1.3, 1.5, 1.7, 2];
|
|
4784
|
-
var DEFAULT_SINGLES_FLOORS = [1.5, 2, 2.5, 3];
|
|
4785
|
-
var DEFAULT_COMBO_TOTALS = [3, 5, 10, 20, 50];
|
|
4786
|
-
var FIXED_SINGLES_COUNT = 3;
|
|
4787
4922
|
var MIN_COMBO_LEGS = 2;
|
|
4788
4923
|
var MAX_COMBO_LEGS = 6;
|
|
4789
|
-
var START = { maxPrice: 1.5, minPrice: 2, comboTotal: 5, comboLegs: 3 };
|
|
4790
4924
|
var finite2 = (v) => typeof v === "number" && Number.isFinite(v);
|
|
4791
4925
|
var cents = (n) => Math.round(n * 100);
|
|
4792
4926
|
function samePrice(a, b) {
|
|
@@ -4795,36 +4929,19 @@ function samePrice(a, b) {
|
|
|
4795
4929
|
function isPresetGrid(v) {
|
|
4796
4930
|
if (!v || typeof v !== "object") return false;
|
|
4797
4931
|
const g = v;
|
|
4798
|
-
return Array.isArray(g.
|
|
4932
|
+
return Array.isArray(g.combos) && Array.isArray(g.totalOptions) && finite2(g.maxLegs);
|
|
4799
4933
|
}
|
|
4800
4934
|
function drawable(p) {
|
|
4801
4935
|
return !!p && finite2(p.price) && finite2(p.matchOddsId) && finite2(p.matchId) && typeof p.homeTeamName === "string" && typeof p.awayTeamName === "string";
|
|
4802
4936
|
}
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
for (const n of [...defaults, ...present]) {
|
|
4806
|
-
if (finite2(n) && n > 0 && !out.some((m) => samePrice(m, n))) out.push(n);
|
|
4807
|
-
}
|
|
4808
|
-
return out.sort((a, b) => a - b);
|
|
4809
|
-
}
|
|
4810
|
-
function singlesLimits(grid) {
|
|
4811
|
-
return choices(DEFAULT_SINGLES_LIMITS, grid.singles.map((c) => c?.price));
|
|
4812
|
-
}
|
|
4813
|
-
function singlesFloors(grid) {
|
|
4814
|
-
return choices(DEFAULT_SINGLES_FLOORS, grid.singlesFrom.map((c) => c?.price));
|
|
4815
|
-
}
|
|
4816
|
-
function comboTotals(grid) {
|
|
4817
|
-
return choices(DEFAULT_COMBO_TOTALS, grid.combos.map((c) => c?.total));
|
|
4818
|
-
}
|
|
4937
|
+
var byValue = (options) => [...options].sort((a, b) => a.value - b.value);
|
|
4938
|
+
var comboTotals = (grid) => byValue(grid.totalOptions);
|
|
4819
4939
|
function comboLegChoices(grid) {
|
|
4820
4940
|
const max = Math.min(MAX_COMBO_LEGS, Math.floor(grid.maxLegs));
|
|
4821
4941
|
const out = [];
|
|
4822
4942
|
for (let n = MIN_COMBO_LEGS; n <= max; n++) out.push(n);
|
|
4823
4943
|
return out;
|
|
4824
4944
|
}
|
|
4825
|
-
function startValue(values, preferred) {
|
|
4826
|
-
return values.find((v) => samePrice(v, preferred)) ?? values[0] ?? preferred;
|
|
4827
|
-
}
|
|
4828
4945
|
function nearest(values, target) {
|
|
4829
4946
|
const first = values[0];
|
|
4830
4947
|
if (first === void 0) return target;
|
|
@@ -4838,10 +4955,6 @@ function clampLegs(values, legs) {
|
|
|
4838
4955
|
if (lo === void 0 || hi === void 0) return legs;
|
|
4839
4956
|
return Math.min(Math.max(Math.round(legs), lo), hi);
|
|
4840
4957
|
}
|
|
4841
|
-
function findSingles(cells, price, count) {
|
|
4842
|
-
const cell2 = cells.find((c) => !!c && finite2(c.price) && samePrice(c.price, price) && c.count === count);
|
|
4843
|
-
return cell2 && Array.isArray(cell2.picks) && cell2.picks.length === count && cell2.picks.every(drawable) ? cell2 : null;
|
|
4844
|
-
}
|
|
4845
4958
|
function findCombo(grid, total, legs) {
|
|
4846
4959
|
const cell2 = grid.combos.find((c) => !!c && finite2(c.total) && samePrice(c.total, total) && c.legs === legs);
|
|
4847
4960
|
const combo = cell2?.combo;
|
|
@@ -4862,65 +4975,22 @@ function legsForTotal(grid, total, legs) {
|
|
|
4862
4975
|
}
|
|
4863
4976
|
return best;
|
|
4864
4977
|
}
|
|
4865
|
-
function startSingles(cells, values, start, count) {
|
|
4866
|
-
const home = startValue(values, start);
|
|
4867
|
-
if (findSingles(cells, home, count)) return home;
|
|
4868
|
-
let best = null;
|
|
4869
|
-
for (const v of values) {
|
|
4870
|
-
if (!findSingles(cells, v, count)) continue;
|
|
4871
|
-
if (best === null || Math.abs(cents(v) - cents(start)) < Math.abs(cents(best) - cents(start))) best = v;
|
|
4872
|
-
}
|
|
4873
|
-
return best ?? home;
|
|
4874
|
-
}
|
|
4875
|
-
function startCombo(grid, totals, legChoices, startTotal, startLegs) {
|
|
4876
|
-
const home = { total: startValue(totals, startTotal), legs: startValue(legChoices, startLegs) };
|
|
4877
|
-
if (findCombo(grid, home.total, home.legs)) return home;
|
|
4878
|
-
let best = null;
|
|
4879
|
-
for (const t of totals) {
|
|
4880
|
-
if (!legChoices.some((n) => findCombo(grid, t, n))) continue;
|
|
4881
|
-
if (best === null || Math.abs(cents(t) - cents(startTotal)) < Math.abs(cents(best) - cents(startTotal))) best = t;
|
|
4882
|
-
}
|
|
4883
|
-
return best === null ? home : { total: best, legs: legsForTotal(grid, best, home.legs) };
|
|
4884
|
-
}
|
|
4885
4978
|
function idsOf(picks) {
|
|
4886
4979
|
return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
|
|
4887
4980
|
}
|
|
4888
|
-
function
|
|
4889
|
-
|
|
4890
|
-
message: s.maxPriceMessage(cell2.count, cell2.price),
|
|
4891
|
-
displayText: s.maxPriceDisplay(cell2.count, cell2.price),
|
|
4892
|
-
preset: { kind: "max_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4893
|
-
};
|
|
4894
|
-
}
|
|
4895
|
-
function minPriceAsk(cell2, s) {
|
|
4896
|
-
return {
|
|
4897
|
-
message: s.minPriceMessage(cell2.count, cell2.price),
|
|
4898
|
-
displayText: s.minPriceDisplay(cell2.count, cell2.price),
|
|
4899
|
-
preset: { kind: "min_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4900
|
-
};
|
|
4901
|
-
}
|
|
4902
|
-
function comboAsk(cell2, s) {
|
|
4981
|
+
function comboAsk(cell2, s, format2) {
|
|
4982
|
+
const total = formatOdds(cell2.totalFormats, format2);
|
|
4903
4983
|
return {
|
|
4904
|
-
message: s.comboMessage(cell2.legs,
|
|
4905
|
-
displayText: s.comboDisplay(cell2.legs,
|
|
4984
|
+
message: s.comboMessage(cell2.legs, total),
|
|
4985
|
+
displayText: s.comboDisplay(cell2.legs, total),
|
|
4906
4986
|
preset: { kind: "combo", total: cell2.total, legs: cell2.legs, ...idsOf(cell2.combo.legs) }
|
|
4907
4987
|
};
|
|
4908
4988
|
}
|
|
4909
|
-
function marketAsk(cell2, s) {
|
|
4910
|
-
return {
|
|
4911
|
-
message: s.marketMessage(cell2.marketLabel, cell2.selectionLabel ?? null, cell2.count),
|
|
4912
|
-
displayText: marketDisplay(cell2, s),
|
|
4913
|
-
preset: { kind: "market", marketDeveloperName: cell2.marketDeveloperName, ...idsOf(cell2.picks) }
|
|
4914
|
-
};
|
|
4915
|
-
}
|
|
4916
|
-
function marketDisplay(cell2, s) {
|
|
4917
|
-
return s.marketRow.replace("{market}", s.marketShort(cell2.marketDeveloperName, cell2.marketLabel, cell2.selectionLabel ?? null));
|
|
4918
|
-
}
|
|
4919
4989
|
|
|
4920
4990
|
// src/usePresetGrid.ts
|
|
4921
4991
|
var GRID_MAX_AGE_MS = 6e5;
|
|
4922
4992
|
function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
4923
|
-
const [grid, setGrid] =
|
|
4993
|
+
const [grid, setGrid] = useState13(null);
|
|
4924
4994
|
const keptRef = useRef13(null);
|
|
4925
4995
|
const localeRef = useRef13(locale);
|
|
4926
4996
|
const inFlightRef = useRef13(false);
|
|
@@ -4929,13 +4999,13 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
4929
4999
|
getRef.current = getPricePresets;
|
|
4930
5000
|
const nowRef = useRef13(now);
|
|
4931
5001
|
nowRef.current = now;
|
|
4932
|
-
|
|
5002
|
+
useEffect13(() => {
|
|
4933
5003
|
mountedRef.current = true;
|
|
4934
5004
|
return () => {
|
|
4935
5005
|
mountedRef.current = false;
|
|
4936
5006
|
};
|
|
4937
5007
|
}, []);
|
|
4938
|
-
|
|
5008
|
+
useEffect13(() => {
|
|
4939
5009
|
if (localeRef.current !== locale) {
|
|
4940
5010
|
localeRef.current = locale;
|
|
4941
5011
|
keptRef.current = null;
|
|
@@ -4963,11 +5033,11 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
4963
5033
|
return grid;
|
|
4964
5034
|
}
|
|
4965
5035
|
function hasAnyCell(grid) {
|
|
4966
|
-
return grid.
|
|
5036
|
+
return grid.combos.length > 0;
|
|
4967
5037
|
}
|
|
4968
5038
|
|
|
4969
5039
|
// src/useFavourites.ts
|
|
4970
|
-
import { useCallback as useCallback12, useEffect as
|
|
5040
|
+
import { useCallback as useCallback12, useEffect as useEffect14, useRef as useRef14, useState as useState14 } from "react";
|
|
4971
5041
|
var LIST_OF = { competition: "competitions", team: "teams", player: "players" };
|
|
4972
5042
|
var keyOf = (kind, id) => `${kind}:${id}`;
|
|
4973
5043
|
function idle(enabled) {
|
|
@@ -5022,8 +5092,8 @@ function revertStar(prev, before, kind, id, next) {
|
|
|
5022
5092
|
}
|
|
5023
5093
|
function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, enabled, track }) {
|
|
5024
5094
|
const live = enabled && conversation !== null;
|
|
5025
|
-
const [state, setState] =
|
|
5026
|
-
const [pendingKey, setPendingKey] =
|
|
5095
|
+
const [state, setState] = useState14(() => idle(live));
|
|
5096
|
+
const [pendingKey, setPendingKey] = useState14(null);
|
|
5027
5097
|
const stateRef = useRef14(state);
|
|
5028
5098
|
stateRef.current = state;
|
|
5029
5099
|
const scopeRef = useRef14(0);
|
|
@@ -5069,7 +5139,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5069
5139
|
inFlightRef.current = run;
|
|
5070
5140
|
return run;
|
|
5071
5141
|
}, [live, conversation, sport, operatorUserId, anonymousUserId, identityKey]);
|
|
5072
|
-
|
|
5142
|
+
useEffect14(() => {
|
|
5073
5143
|
scopeRef.current += 1;
|
|
5074
5144
|
inFlightRef.current = null;
|
|
5075
5145
|
pendingRef.current = null;
|
|
@@ -5079,7 +5149,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5079
5149
|
setState(refusedRef.current === identityKey ? { status: "refused", data: null, starred: /* @__PURE__ */ new Set() } : idle(live));
|
|
5080
5150
|
void load2();
|
|
5081
5151
|
}, [load2, live, identityKey]);
|
|
5082
|
-
|
|
5152
|
+
useEffect14(() => {
|
|
5083
5153
|
if (!live) return;
|
|
5084
5154
|
const onFocus = () => {
|
|
5085
5155
|
void load2();
|
|
@@ -5180,20 +5250,20 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5180
5250
|
}
|
|
5181
5251
|
|
|
5182
5252
|
// src/components/dashboard/GreetingDashboard.tsx
|
|
5183
|
-
import { useState as
|
|
5253
|
+
import { useState as useState28 } from "react";
|
|
5184
5254
|
|
|
5185
5255
|
// src/eventLogContext.ts
|
|
5186
|
-
import { createContext, useContext } from "react";
|
|
5187
|
-
var EventLogContext =
|
|
5256
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
5257
|
+
var EventLogContext = createContext2(null);
|
|
5188
5258
|
function useEventLog() {
|
|
5189
|
-
return
|
|
5259
|
+
return useContext2(EventLogContext);
|
|
5190
5260
|
}
|
|
5191
5261
|
|
|
5192
5262
|
// src/sportScopeContext.ts
|
|
5193
|
-
import { createContext as
|
|
5194
|
-
var SportScopeContext =
|
|
5263
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
5264
|
+
var SportScopeContext = createContext3(null);
|
|
5195
5265
|
function useSportScope() {
|
|
5196
|
-
return
|
|
5266
|
+
return useContext3(SportScopeContext);
|
|
5197
5267
|
}
|
|
5198
5268
|
|
|
5199
5269
|
// src/assets/logo.ts
|
|
@@ -5220,20 +5290,6 @@ function KebabIcon() {
|
|
|
5220
5290
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "1.6" })
|
|
5221
5291
|
] }) });
|
|
5222
5292
|
}
|
|
5223
|
-
function SlidersIcon() {
|
|
5224
|
-
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
5225
|
-
/* @__PURE__ */ jsx("path", { d: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1" }),
|
|
5226
|
-
/* @__PURE__ */ jsx("circle", { cx: "15", cy: "6", r: "2" }),
|
|
5227
|
-
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "2" }),
|
|
5228
|
-
/* @__PURE__ */ jsx("circle", { cx: "17", cy: "18", r: "2" })
|
|
5229
|
-
] }) });
|
|
5230
|
-
}
|
|
5231
|
-
function ComboIcon() {
|
|
5232
|
-
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round", children: [
|
|
5233
|
-
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "11", height: "11", rx: "2" }),
|
|
5234
|
-
/* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "11", height: "11", rx: "2" })
|
|
5235
|
-
] }) });
|
|
5236
|
-
}
|
|
5237
5293
|
var DASHBOARD_EMOJI = {
|
|
5238
5294
|
football: "\u26BD",
|
|
5239
5295
|
"goal-net": "\u{1F945}",
|
|
@@ -5269,11 +5325,6 @@ function DashboardIcon({ name }) {
|
|
|
5269
5325
|
// src/components/dashboard/DashboardTile.tsx
|
|
5270
5326
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5271
5327
|
var MAX_CRESTS = 3;
|
|
5272
|
-
var ODDS_TAIL = /\s*·\s*@(\d+(?:\.\d+)?)\s*$/;
|
|
5273
|
-
function splitOdds(subtitle) {
|
|
5274
|
-
const m = ODDS_TAIL.exec(subtitle);
|
|
5275
|
-
return m ? { text: subtitle.slice(0, m.index), odds: m[1] } : { text: subtitle };
|
|
5276
|
-
}
|
|
5277
5328
|
function codesOf(tile) {
|
|
5278
5329
|
return (tile.imageCodes ?? []).filter(Boolean);
|
|
5279
5330
|
}
|
|
@@ -5295,35 +5346,35 @@ var keepDashWithHome = (title) => title.replace(/ - /g, "\xA0- ");
|
|
|
5295
5346
|
function HeroTile({ tile, onTap, oddsLabel }) {
|
|
5296
5347
|
const crests = (tile.imageUrls ?? []).filter(Boolean).slice(0, 2);
|
|
5297
5348
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, 2) : [];
|
|
5298
|
-
const
|
|
5349
|
+
const { oddsFormat } = useOddsSettings();
|
|
5350
|
+
const price = tile.priceFormats ? formatOdds(tile.priceFormats, oddsFormat) : null;
|
|
5299
5351
|
return /* @__PURE__ */ jsxs2("button", { type: "button", className: "ss-w-dash-tile ss-w-dash-tile--full ss-w-dash-hero", onClick: onTap, children: [
|
|
5300
5352
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-top", children: [
|
|
5301
5353
|
tile.badgeText ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-badge", children: tile.badgeText }) : null,
|
|
5302
|
-
|
|
5354
|
+
price ? /* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-price", children: [
|
|
5303
5355
|
/* @__PURE__ */ jsxs2("span", { className: "ss-g-sr", children: [
|
|
5304
5356
|
oddsLabel,
|
|
5305
5357
|
" "
|
|
5306
5358
|
] }),
|
|
5307
|
-
|
|
5359
|
+
price
|
|
5308
5360
|
] }) : null,
|
|
5309
|
-
!
|
|
5361
|
+
!price && tile.meta ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash__meta", children: /* @__PURE__ */ jsx2(DotSeparated, { text: tile.meta }) }) : null,
|
|
5310
5362
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-chevron", children: /* @__PURE__ */ jsx2(ChevronIcon, {}) })
|
|
5311
5363
|
] }),
|
|
5312
5364
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-main", children: [
|
|
5313
5365
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-visual", "aria-hidden": "true", children: crests.length > 0 ? crests.map((url, i) => /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-crest", style: { backgroundImage: `url(${url})` } }, `${url}-${i}`)) : codes.length > 0 ? /* @__PURE__ */ jsx2(Marks, { codes }) : /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-icon", children: /* @__PURE__ */ jsx2(DashboardIcon, { name: tile.icon }) }) }),
|
|
5314
5366
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-body", children: [
|
|
5315
5367
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-title", children: keepDashWithHome(tile.title) }),
|
|
5316
|
-
|
|
5368
|
+
tile.subtitle ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-subtitle", children: tile.subtitle.includes(" \xB7 ") ? /* @__PURE__ */ jsx2(DotSeparated, { text: tile.subtitle }) : tile.subtitle }) : null
|
|
5317
5369
|
] })
|
|
5318
5370
|
] })
|
|
5319
5371
|
] });
|
|
5320
5372
|
}
|
|
5321
|
-
var PRICE_BADGE = /^\d+(?:[.,]\d+)?$/;
|
|
5322
5373
|
function DashboardTile({ tile, onTap, oddsLabel = "Odds", badgePlacement = "meta" }) {
|
|
5323
5374
|
if (tile.emphasis === "hero") return /* @__PURE__ */ jsx2(HeroTile, { tile, onTap, oddsLabel });
|
|
5324
5375
|
const spanClass = tile.span === "full" ? "ss-w-dash-tile--full" : "ss-w-dash-tile--half";
|
|
5325
5376
|
const crests = (tile.imageUrls ?? []).slice(0, MAX_CRESTS);
|
|
5326
|
-
const endBadge = badgePlacement === "end" && tile.badgeText &&
|
|
5377
|
+
const endBadge = badgePlacement === "end" && tile.badgeText && tile.badgeFormats ? tile.badgeText : null;
|
|
5327
5378
|
const metaBadge = endBadge ? null : tile.badgeText;
|
|
5328
5379
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, MAX_CRESTS) : [];
|
|
5329
5380
|
const hasMeta = Boolean(metaBadge) || crests.length > 0 || codes.length > 0;
|
|
@@ -5400,23 +5451,23 @@ function SportSwitch({ sports, selected, onSelect, liveLabel: liveLabel3 = "Live
|
|
|
5400
5451
|
}
|
|
5401
5452
|
|
|
5402
5453
|
// src/components/dashboard/v8/PersonalGreeting.tsx
|
|
5403
|
-
import { useState as
|
|
5454
|
+
import { useState as useState27 } from "react";
|
|
5404
5455
|
|
|
5405
5456
|
// src/personalGreetingContext.ts
|
|
5406
|
-
import { createContext as
|
|
5457
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo5, useState as useState15 } from "react";
|
|
5407
5458
|
function useSessionHolds() {
|
|
5408
|
-
const [dismissed, setDismissed] =
|
|
5409
|
-
const [followed, setFollowed] =
|
|
5410
|
-
return
|
|
5459
|
+
const [dismissed, setDismissed] = useState15(/* @__PURE__ */ new Set());
|
|
5460
|
+
const [followed, setFollowed] = useState15(/* @__PURE__ */ new Set());
|
|
5461
|
+
return useMemo5(() => ({
|
|
5411
5462
|
dismissed,
|
|
5412
5463
|
followed,
|
|
5413
5464
|
dismiss: (key) => setDismissed((prev) => prev.has(key) ? prev : new Set(prev).add(key)),
|
|
5414
5465
|
follow: (key) => setFollowed((prev) => prev.has(key) ? prev : new Set(prev).add(key))
|
|
5415
5466
|
}), [dismissed, followed]);
|
|
5416
5467
|
}
|
|
5417
|
-
var PersonalGreetingContext =
|
|
5468
|
+
var PersonalGreetingContext = createContext4(null);
|
|
5418
5469
|
function usePersonalGreeting() {
|
|
5419
|
-
return
|
|
5470
|
+
return useContext4(PersonalGreetingContext);
|
|
5420
5471
|
}
|
|
5421
5472
|
|
|
5422
5473
|
// src/components/dashboard/v8/AskCards.tsx
|
|
@@ -5429,10 +5480,10 @@ function AskCards({ asks, ui, ofYours, onAct }) {
|
|
|
5429
5480
|
}
|
|
5430
5481
|
|
|
5431
5482
|
// src/components/dashboard/v8/CardLine.tsx
|
|
5432
|
-
import { useEffect as
|
|
5483
|
+
import { useEffect as useEffect19, useMemo as useMemo6 } from "react";
|
|
5433
5484
|
|
|
5434
5485
|
// src/useBuilderGrid.ts
|
|
5435
|
-
import { useCallback as useCallback13, useEffect as
|
|
5486
|
+
import { useCallback as useCallback13, useEffect as useEffect15, useRef as useRef16, useState as useState16 } from "react";
|
|
5436
5487
|
|
|
5437
5488
|
// src/builderMemory.ts
|
|
5438
5489
|
var GRID_TTL_MS = 5 * 6e4;
|
|
@@ -5475,23 +5526,23 @@ function createBuilderMemory(now = Date.now) {
|
|
|
5475
5526
|
var PENDING_MAX_MS = 3e3;
|
|
5476
5527
|
var inFlight = /* @__PURE__ */ new WeakMap();
|
|
5477
5528
|
var newest = /* @__PURE__ */ new WeakMap();
|
|
5478
|
-
function shared(
|
|
5479
|
-
let flights = inFlight.get(
|
|
5480
|
-
if (!flights) inFlight.set(
|
|
5529
|
+
function shared(memory3, key, start) {
|
|
5530
|
+
let flights = inFlight.get(memory3);
|
|
5531
|
+
if (!flights) inFlight.set(memory3, flights = /* @__PURE__ */ new Map());
|
|
5481
5532
|
let flight = flights.get(key);
|
|
5482
5533
|
if (!flight) {
|
|
5483
5534
|
const own = flights;
|
|
5484
|
-
let order = newest.get(
|
|
5485
|
-
if (!order) newest.set(
|
|
5535
|
+
let order = newest.get(memory3);
|
|
5536
|
+
if (!order) newest.set(memory3, order = /* @__PURE__ */ new Map());
|
|
5486
5537
|
const previous = order.get(key);
|
|
5487
5538
|
const latest = () => order.get(key) === made;
|
|
5488
5539
|
const promise = start().then(
|
|
5489
5540
|
(g) => {
|
|
5490
|
-
if (latest())
|
|
5541
|
+
if (latest()) memory3.cacheGrid(key, g);
|
|
5491
5542
|
return g;
|
|
5492
5543
|
},
|
|
5493
5544
|
(e) => {
|
|
5494
|
-
if (latest())
|
|
5545
|
+
if (latest()) memory3.cacheGrid(key, null);
|
|
5495
5546
|
throw e;
|
|
5496
5547
|
}
|
|
5497
5548
|
).finally(() => {
|
|
@@ -5517,22 +5568,22 @@ async function settle(flight) {
|
|
|
5517
5568
|
if (heir) return { heir };
|
|
5518
5569
|
return { grid: await flight.promise };
|
|
5519
5570
|
}
|
|
5520
|
-
function forget(
|
|
5521
|
-
const flights = inFlight.get(
|
|
5571
|
+
function forget(memory3, key, flight) {
|
|
5572
|
+
const flights = inFlight.get(memory3);
|
|
5522
5573
|
if (flights?.get(key) === flight) flights.delete(key);
|
|
5523
5574
|
}
|
|
5524
|
-
function useBuilderGrid({ conversation, locale, memory:
|
|
5525
|
-
const [seed] =
|
|
5526
|
-
const [grid, setGrid] =
|
|
5527
|
-
const [status, setStatus] =
|
|
5528
|
-
const [confirmed, setConfirmed] =
|
|
5529
|
-
const [answered, setAnswered] =
|
|
5575
|
+
function useBuilderGrid({ conversation, locale, memory: memory3, initial }) {
|
|
5576
|
+
const [seed] = useState16(() => memory3 && conversation && initial ? memory3.cachedGrid(gridKey(locale, initial)) : void 0);
|
|
5577
|
+
const [grid, setGrid] = useState16(seed ?? null);
|
|
5578
|
+
const [status, setStatus] = useState16(seed ? "ready" : "idle");
|
|
5579
|
+
const [confirmed, setConfirmed] = useState16(false);
|
|
5580
|
+
const [answered, setAnswered] = useState16(seed && initial ? { req: initial, locale } : null);
|
|
5530
5581
|
const seq = useRef16(0);
|
|
5531
5582
|
const mounted = useRef16(true);
|
|
5532
5583
|
const hung = useRef16(void 0);
|
|
5533
5584
|
const waiting = useRef16(null);
|
|
5534
|
-
const memoryRef = useRef16(
|
|
5535
|
-
memoryRef.current =
|
|
5585
|
+
const memoryRef = useRef16(memory3);
|
|
5586
|
+
memoryRef.current = memory3;
|
|
5536
5587
|
const stopWaiting = useCallback13((release, keep) => {
|
|
5537
5588
|
window.clearTimeout(hung.current);
|
|
5538
5589
|
const w = waiting.current;
|
|
@@ -5541,7 +5592,7 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5541
5592
|
w.flight.waiters -= 1;
|
|
5542
5593
|
if (release && w.key !== keep && w.flight.waiters <= 0 && memoryRef.current) forget(memoryRef.current, w.key, w.flight);
|
|
5543
5594
|
}, []);
|
|
5544
|
-
|
|
5595
|
+
useEffect15(() => {
|
|
5545
5596
|
mounted.current = true;
|
|
5546
5597
|
return () => {
|
|
5547
5598
|
mounted.current = false;
|
|
@@ -5551,8 +5602,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5551
5602
|
const request = useCallback13(async (req) => {
|
|
5552
5603
|
if (!conversation) return;
|
|
5553
5604
|
const mine = ++seq.current;
|
|
5554
|
-
const key =
|
|
5555
|
-
const fresh = key &&
|
|
5605
|
+
const key = memory3 ? gridKey(locale, req) : null;
|
|
5606
|
+
const fresh = key && memory3 ? memory3.cachedGrid(key) : void 0;
|
|
5556
5607
|
stopWaiting(true, key);
|
|
5557
5608
|
if (fresh) {
|
|
5558
5609
|
setGrid(fresh);
|
|
@@ -5568,9 +5619,9 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5568
5619
|
hung.current = window.setTimeout(() => {
|
|
5569
5620
|
if (mine !== seq.current || !mounted.current) return;
|
|
5570
5621
|
waiting.current = null;
|
|
5571
|
-
if (key &&
|
|
5572
|
-
forget(
|
|
5573
|
-
|
|
5622
|
+
if (key && memory3 && own?.flight) {
|
|
5623
|
+
forget(memory3, key, own.flight);
|
|
5624
|
+
memory3.cacheGrid(key, null);
|
|
5574
5625
|
}
|
|
5575
5626
|
setGrid(null);
|
|
5576
5627
|
setAnswered({ req, locale });
|
|
@@ -5580,8 +5631,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5580
5631
|
let flight;
|
|
5581
5632
|
try {
|
|
5582
5633
|
let g;
|
|
5583
|
-
if (key &&
|
|
5584
|
-
flight = shared(
|
|
5634
|
+
if (key && memory3) {
|
|
5635
|
+
flight = shared(memory3, key, () => conversation.getBuilderGrid(locale, req));
|
|
5585
5636
|
flight.waiters += 1;
|
|
5586
5637
|
if (own) own.flight = flight;
|
|
5587
5638
|
for (; ; ) {
|
|
@@ -5618,35 +5669,40 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5618
5669
|
setStatus("error");
|
|
5619
5670
|
}
|
|
5620
5671
|
}
|
|
5621
|
-
}, [conversation, locale,
|
|
5672
|
+
}, [conversation, locale, memory3, stopWaiting]);
|
|
5622
5673
|
const answeredFor = answered && answered.locale === locale ? answered.req : null;
|
|
5623
5674
|
return { grid, answeredFor, status, confirmed, request };
|
|
5624
5675
|
}
|
|
5625
5676
|
|
|
5626
5677
|
// src/components/AddToSlipButton.tsx
|
|
5627
|
-
import { useCallback as useCallback15, useState as
|
|
5678
|
+
import { useCallback as useCallback15, useState as useState17 } from "react";
|
|
5628
5679
|
|
|
5629
5680
|
// src/slipAdd.ts
|
|
5630
5681
|
import { useCallback as useCallback14 } from "react";
|
|
5631
5682
|
import { isAddToSlipResult, toWireSport as toWireSport3 } from "@sensiblestats/widget-sdk";
|
|
5632
5683
|
|
|
5633
5684
|
// src/trackingContext.ts
|
|
5634
|
-
import { createContext as
|
|
5685
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
5635
5686
|
var noop = () => {
|
|
5636
5687
|
};
|
|
5637
|
-
var TrackingContext =
|
|
5688
|
+
var TrackingContext = createContext5(noop);
|
|
5638
5689
|
function useTrack() {
|
|
5639
|
-
return
|
|
5690
|
+
return useContext5(TrackingContext);
|
|
5640
5691
|
}
|
|
5641
5692
|
|
|
5642
5693
|
// src/slipStateContext.ts
|
|
5643
|
-
import { createContext as
|
|
5644
|
-
var SlipStateContext =
|
|
5694
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
5695
|
+
var SlipStateContext = createContext6(null);
|
|
5645
5696
|
function useSlipState() {
|
|
5646
|
-
return
|
|
5697
|
+
return useContext6(SlipStateContext);
|
|
5647
5698
|
}
|
|
5648
5699
|
|
|
5649
5700
|
// src/slipAdd.ts
|
|
5701
|
+
function toHostSelection(selection, operatorFormat) {
|
|
5702
|
+
const { forms, ...rest } = selection;
|
|
5703
|
+
const odds = operatorOdds(forms, operatorFormat);
|
|
5704
|
+
return odds ? { ...rest, odds } : rest;
|
|
5705
|
+
}
|
|
5650
5706
|
function withTimeout(value) {
|
|
5651
5707
|
return Promise.race([
|
|
5652
5708
|
value,
|
|
@@ -5669,24 +5725,26 @@ function useSlipAdd(slip, ui) {
|
|
|
5669
5725
|
const slipState = useSlipState();
|
|
5670
5726
|
const handler = slip.onAddToSlip;
|
|
5671
5727
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
5728
|
+
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
5672
5729
|
return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
5673
5730
|
if (!handler) return { kind: "failed" };
|
|
5674
|
-
const
|
|
5675
|
-
const
|
|
5731
|
+
const out = toHostSelection(selection, operatorFormat);
|
|
5732
|
+
const pick = slipPickFields(out, rawLabels ? selectionLabel : void 0, line);
|
|
5733
|
+
const wireSport = toWireSport3(out.sport);
|
|
5676
5734
|
const sportField = wireSport ? { sport: wireSport } : {};
|
|
5677
5735
|
const clickFields = {
|
|
5678
|
-
matchOddsId:
|
|
5679
|
-
matchId:
|
|
5680
|
-
odds:
|
|
5736
|
+
matchOddsId: out.matchOddsId,
|
|
5737
|
+
matchId: out.matchId,
|
|
5738
|
+
odds: out.oddsDecimal,
|
|
5681
5739
|
...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
|
|
5682
|
-
...
|
|
5740
|
+
...out.sport !== void 0 ? { sport: out.sport } : {}
|
|
5683
5741
|
};
|
|
5684
5742
|
track({ name: "add_to_slip_click", ...clickFields });
|
|
5685
5743
|
if (marketDeveloperName !== void 0) {
|
|
5686
5744
|
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
5687
5745
|
}
|
|
5688
5746
|
try {
|
|
5689
|
-
const raw = await withTimeout(Promise.resolve(handler(
|
|
5747
|
+
const raw = await withTimeout(Promise.resolve(handler(out)));
|
|
5690
5748
|
if (raw != null && !isAddToSlipResult(raw)) throw new Error("malformed add-to-slip result");
|
|
5691
5749
|
const result = withSafeMessage(raw ?? void 0);
|
|
5692
5750
|
track({ name: "add_to_slip_result", outcome: slipOutcome(result), ...clickFields });
|
|
@@ -5702,12 +5760,12 @@ function useSlipAdd(slip, ui) {
|
|
|
5702
5760
|
});
|
|
5703
5761
|
}
|
|
5704
5762
|
if (slipState) {
|
|
5705
|
-
if (isTerminal(result)) slipState.settle(slipKey(
|
|
5763
|
+
if (isTerminal(result)) slipState.settle(slipKey(out));
|
|
5706
5764
|
if (wasAdded(result) && marketDeveloperName !== void 0) {
|
|
5707
|
-
slipState.recordAdd({ selection, market: marketDeveloperName, pick });
|
|
5765
|
+
slipState.recordAdd({ selection: out, market: marketDeveloperName, pick });
|
|
5708
5766
|
}
|
|
5709
5767
|
}
|
|
5710
|
-
return { kind: "answered", result };
|
|
5768
|
+
return { kind: "answered", result, oldOdds: out.odds?.text ?? selection.forms.decimal };
|
|
5711
5769
|
} catch {
|
|
5712
5770
|
track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
|
|
5713
5771
|
if (marketDeveloperName !== void 0) {
|
|
@@ -5715,15 +5773,15 @@ function useSlipAdd(slip, ui) {
|
|
|
5715
5773
|
}
|
|
5716
5774
|
return { kind: "failed" };
|
|
5717
5775
|
}
|
|
5718
|
-
}, [handler, log, track, slipState, rawLabels]);
|
|
5776
|
+
}, [handler, log, track, slipState, rawLabels, operatorFormat]);
|
|
5719
5777
|
}
|
|
5720
5778
|
|
|
5721
5779
|
// src/components/Toast.tsx
|
|
5722
|
-
import { useEffect as
|
|
5780
|
+
import { useEffect as useEffect16 } from "react";
|
|
5723
5781
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
5724
5782
|
var DISMISS_MS = 4e3;
|
|
5725
5783
|
function Toast({ toast, onDismiss }) {
|
|
5726
|
-
|
|
5784
|
+
useEffect16(() => {
|
|
5727
5785
|
if (!toast) return;
|
|
5728
5786
|
const timer = setTimeout(onDismiss, DISMISS_MS);
|
|
5729
5787
|
return () => clearTimeout(timer);
|
|
@@ -5734,13 +5792,14 @@ function Toast({ toast, onDismiss }) {
|
|
|
5734
5792
|
|
|
5735
5793
|
// src/components/AddToSlipButton.tsx
|
|
5736
5794
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5737
|
-
function SlipButton({ selection,
|
|
5738
|
-
const [pending, setPending] =
|
|
5739
|
-
const [settledLocal, setSettledLocal] =
|
|
5740
|
-
const [toast, setToast] =
|
|
5795
|
+
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
|
|
5796
|
+
const [pending, setPending] = useState17(false);
|
|
5797
|
+
const [settledLocal, setSettledLocal] = useState17(false);
|
|
5798
|
+
const [toast, setToast] = useState17(null);
|
|
5741
5799
|
const dismiss = useCallback15(() => setToast(null), []);
|
|
5742
5800
|
const add = useSlipAdd(slip, ui);
|
|
5743
5801
|
const slipState = useSlipState();
|
|
5802
|
+
const { oddsFormat } = useOddsSettings();
|
|
5744
5803
|
const handler = slip.onAddToSlip;
|
|
5745
5804
|
if (!ui || !handler || !selection) return null;
|
|
5746
5805
|
const settled = slipState ? !!slipState.settled[slipKey(selection)] : settledLocal;
|
|
@@ -5752,7 +5811,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5752
5811
|
setToast({ kind: "error", text: ui.slipFailed });
|
|
5753
5812
|
return;
|
|
5754
5813
|
}
|
|
5755
|
-
setToast(resultToToast(outcome.result,
|
|
5814
|
+
setToast(resultToToast(outcome.result, outcome.oldOdds, ui));
|
|
5756
5815
|
if (!slipState) setSettledLocal(isTerminal(outcome.result));
|
|
5757
5816
|
} finally {
|
|
5758
5817
|
setPending(false);
|
|
@@ -5771,7 +5830,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5771
5830
|
children: [
|
|
5772
5831
|
settled ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
|
|
5773
5832
|
price.label ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-lab", children: price.label }) : null,
|
|
5774
|
-
/* @__PURE__ */ jsx6("span", { children:
|
|
5833
|
+
/* @__PURE__ */ jsx6("span", { children: formatOdds(selection.forms, oddsFormat) })
|
|
5775
5834
|
]
|
|
5776
5835
|
}
|
|
5777
5836
|
) : /* @__PURE__ */ jsx6(
|
|
@@ -5794,7 +5853,6 @@ function AddToSlipButton({ it, slip, ui }) {
|
|
|
5794
5853
|
SlipButton,
|
|
5795
5854
|
{
|
|
5796
5855
|
selection,
|
|
5797
|
-
shownOdds: it.odds ?? "",
|
|
5798
5856
|
marketDeveloperName: it.marketDeveloperName,
|
|
5799
5857
|
selectionLabel: it.selectionLabel,
|
|
5800
5858
|
line: it.line,
|
|
@@ -5841,11 +5899,11 @@ function oldestQuote(legs) {
|
|
|
5841
5899
|
}
|
|
5842
5900
|
|
|
5843
5901
|
// src/components/MarketOddsCardList.tsx
|
|
5844
|
-
import { useEffect as
|
|
5902
|
+
import { useEffect as useEffect18, useState as useState23 } from "react";
|
|
5845
5903
|
import { mayPinOrSlip as mayPinOrSlip4, slipSportOf as slipSportOf5, sportOf as sportOf8 } from "@sensiblestats/widget-sdk";
|
|
5846
5904
|
|
|
5847
5905
|
// src/nflKickoff.ts
|
|
5848
|
-
import { useEffect as
|
|
5906
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
5849
5907
|
import { sportOf as sportOf6 } from "@sensiblestats/widget-sdk";
|
|
5850
5908
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5851
5909
|
var isNfl = (sport) => sportOf6(sport) === "americanfootball";
|
|
@@ -5873,9 +5931,9 @@ function guardLegsPreMatch(slip, legs, ui) {
|
|
|
5873
5931
|
};
|
|
5874
5932
|
}
|
|
5875
5933
|
function useNextKickoffRender(kickoffs) {
|
|
5876
|
-
const [tick, setTick] =
|
|
5934
|
+
const [tick, setTick] = useState18(0);
|
|
5877
5935
|
const key = kickoffs.map((k) => k ?? "").join("|");
|
|
5878
|
-
|
|
5936
|
+
useEffect17(() => {
|
|
5879
5937
|
const now = Date.now();
|
|
5880
5938
|
const upcoming = key.split("|").map((k) => k ? Date.parse(k) : NaN).filter((ms) => ms > now);
|
|
5881
5939
|
if (upcoming.length === 0) return;
|
|
@@ -5908,14 +5966,14 @@ function OddsMovementBadge({
|
|
|
5908
5966
|
}
|
|
5909
5967
|
|
|
5910
5968
|
// src/components/Crest.tsx
|
|
5911
|
-
import { useState as
|
|
5969
|
+
import { useState as useState19 } from "react";
|
|
5912
5970
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
5913
5971
|
function initials(name) {
|
|
5914
5972
|
return (name ?? "").trim().slice(0, 1).toUpperCase() || "?";
|
|
5915
5973
|
}
|
|
5916
5974
|
function Crest({ url, name, kind, abbr }) {
|
|
5917
5975
|
const cls = kind === "comp" ? "ss-w-bi-comp-logo" : "ss-w-bi-crest";
|
|
5918
|
-
const [failed, setFailed] =
|
|
5976
|
+
const [failed, setFailed] = useState19(false);
|
|
5919
5977
|
if (url && !failed) {
|
|
5920
5978
|
return /* @__PURE__ */ jsx8("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
5921
5979
|
}
|
|
@@ -5924,7 +5982,7 @@ function Crest({ url, name, kind, abbr }) {
|
|
|
5924
5982
|
}
|
|
5925
5983
|
|
|
5926
5984
|
// src/components/PinToggle.tsx
|
|
5927
|
-
import { useCallback as useCallback16, useState as
|
|
5985
|
+
import { useCallback as useCallback16, useState as useState20 } from "react";
|
|
5928
5986
|
import { qualifiedId, toWireSport as toWireSport4 } from "@sensiblestats/widget-sdk";
|
|
5929
5987
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5930
5988
|
var PIN_GLYPHS = {
|
|
@@ -5933,7 +5991,7 @@ var PIN_GLYPHS = {
|
|
|
5933
5991
|
bookmark: { viewBox: "0 0 24 24", strokeWidth: 2, d: "M7 3h10a1.5 1.5 0 0 1 1.5 1.5V21l-6.5-3.6L5.5 21V4.5A1.5 1.5 0 0 1 7 3z" }
|
|
5934
5992
|
};
|
|
5935
5993
|
function PinToggle({ pin, monitor, ui, market }) {
|
|
5936
|
-
const [toast, setToast] =
|
|
5994
|
+
const [toast, setToast] = useState20(null);
|
|
5937
5995
|
const dismiss = useCallback16(() => setToast(null), []);
|
|
5938
5996
|
const log = useEventLog();
|
|
5939
5997
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6003,10 +6061,10 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
6003
6061
|
}
|
|
6004
6062
|
|
|
6005
6063
|
// src/components/PriceHistoryButton.tsx
|
|
6006
|
-
import { useCallback as useCallback17, useState as
|
|
6064
|
+
import { useCallback as useCallback17, useState as useState21 } from "react";
|
|
6007
6065
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6008
6066
|
function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
6009
|
-
const [toast, setToast] =
|
|
6067
|
+
const [toast, setToast] = useState21(null);
|
|
6010
6068
|
const dismiss = useCallback17(() => setToast(null), []);
|
|
6011
6069
|
const log = useEventLog();
|
|
6012
6070
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6034,7 +6092,7 @@ function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
|
6034
6092
|
}
|
|
6035
6093
|
|
|
6036
6094
|
// src/components/AllMarketsButton.tsx
|
|
6037
|
-
import { useCallback as useCallback18, useState as
|
|
6095
|
+
import { useCallback as useCallback18, useState as useState22 } from "react";
|
|
6038
6096
|
import { sportOf as sportOf7 } from "@sensiblestats/widget-sdk";
|
|
6039
6097
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6040
6098
|
function allMarketsCount(vm, monitor) {
|
|
@@ -6043,7 +6101,7 @@ function allMarketsCount(vm, monitor) {
|
|
|
6043
6101
|
}
|
|
6044
6102
|
function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
6045
6103
|
const log = useEventLog();
|
|
6046
|
-
const [toast, setToast] =
|
|
6104
|
+
const [toast, setToast] = useState22(null);
|
|
6047
6105
|
const dismiss = useCallback18(() => setToast(null), []);
|
|
6048
6106
|
const onClick = () => {
|
|
6049
6107
|
if (monitor.pinMatch({ matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName }) === "match_limit") {
|
|
@@ -6078,14 +6136,17 @@ function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
|
6078
6136
|
// src/components/MarketOddsCardList.tsx
|
|
6079
6137
|
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6080
6138
|
function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
6139
|
+
const { oddsFormat } = useOddsSettings();
|
|
6140
|
+
const odds = formatOdds(row.priceForms, oddsFormat);
|
|
6141
|
+
const previousOdds = row.previousPriceForms ? formatOdds(row.previousPriceForms, oddsFormat) : void 0;
|
|
6081
6142
|
const slipAllowed = vm.addToSlipEnabled && !suppressSlip && slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now());
|
|
6082
6143
|
const selection = slipAllowed ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
6083
6144
|
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: slipSportOf5(vm.sport) })];
|
|
6084
6145
|
return /* @__PURE__ */ jsxs10("div", { className: "ss-w-mo-row", children: [
|
|
6085
6146
|
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-sel", children: row.selection }),
|
|
6086
|
-
/* @__PURE__ */ jsx12(OddsMovementBadge, { previous:
|
|
6087
|
-
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-price", children:
|
|
6088
|
-
history && ui &&
|
|
6147
|
+
/* @__PURE__ */ jsx12(OddsMovementBadge, { previous: previousOdds, current: odds, direction: row.movementDirection, ui }),
|
|
6148
|
+
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-price", children: odds }),
|
|
6149
|
+
history && ui && previousOdds ? /* @__PURE__ */ jsx12(
|
|
6089
6150
|
PriceHistoryButton,
|
|
6090
6151
|
{
|
|
6091
6152
|
ui,
|
|
@@ -6098,7 +6159,7 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
6098
6159
|
"\u2713 ",
|
|
6099
6160
|
ui.inSlipLabel
|
|
6100
6161
|
] }) : null,
|
|
6101
|
-
!suppressSlip ? /* @__PURE__ */ jsx12(SlipButton, { selection,
|
|
6162
|
+
!suppressSlip ? /* @__PURE__ */ jsx12(SlipButton, { selection, marketDeveloperName: vm.marketDeveloperName, selectionLabel: row.selectionLabel, line: row.line, slip: guardNflKickoff(slip, vm, ui), ui }) : null
|
|
6102
6163
|
] });
|
|
6103
6164
|
}
|
|
6104
6165
|
var STALE_AFTER_MS = 12e4;
|
|
@@ -6106,7 +6167,7 @@ function fmtHhMm(iso, locale) {
|
|
|
6106
6167
|
return new Date(iso).toLocaleTimeString(intlLocale(locale), { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
6107
6168
|
}
|
|
6108
6169
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
6109
|
-
const [open, setOpen] =
|
|
6170
|
+
const [open, setOpen] = useState23(false);
|
|
6110
6171
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
6111
6172
|
const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
6112
6173
|
const kickoff = vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -6117,9 +6178,9 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6117
6178
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
6118
6179
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
6119
6180
|
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui?.locale ?? "en") : null;
|
|
6120
|
-
const [, setStaleTick] =
|
|
6181
|
+
const [, setStaleTick] = useState23(0);
|
|
6121
6182
|
const watchStale = live != null && !isClosed && !isStale;
|
|
6122
|
-
|
|
6183
|
+
useEffect18(() => {
|
|
6123
6184
|
if (!watchStale) return;
|
|
6124
6185
|
const id = window.setTimeout(() => setStaleTick((n) => n + 1), Math.max(0, asOfMs + STALE_AFTER_MS - Date.now()) + 1);
|
|
6125
6186
|
return () => window.clearTimeout(id);
|
|
@@ -6249,7 +6310,7 @@ var asOf = (iso, ui) => {
|
|
|
6249
6310
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId, coolOff }) {
|
|
6250
6311
|
const matchId = card.matchId;
|
|
6251
6312
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6252
|
-
const ask =
|
|
6313
|
+
const ask = useMemo6(() => canAdd2 && !coolOff && marketKey && matchId ? {
|
|
6253
6314
|
sport,
|
|
6254
6315
|
marketKey,
|
|
6255
6316
|
matchIds: [matchId],
|
|
@@ -6260,10 +6321,11 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6260
6321
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6261
6322
|
} : null, [canAdd2, coolOff, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6262
6323
|
const { grid, answeredFor, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, initial: ask });
|
|
6263
|
-
|
|
6324
|
+
useEffect19(() => {
|
|
6264
6325
|
if (ask) void request(ask);
|
|
6265
6326
|
}, [request, ask]);
|
|
6266
6327
|
useNextKickoffRender([card.startsAtUtc]);
|
|
6328
|
+
const { oddsFormat } = useOddsSettings();
|
|
6267
6329
|
const settled = answeredFor === ask;
|
|
6268
6330
|
const pending = ask !== null && conversation !== null && !settled;
|
|
6269
6331
|
if (!ask || !preMatchOpen(card.startsAtUtc, Date.now())) return null;
|
|
@@ -6286,20 +6348,19 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6286
6348
|
SlipButton,
|
|
6287
6349
|
{
|
|
6288
6350
|
selection,
|
|
6289
|
-
shownOdds: leg.odds,
|
|
6290
6351
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6291
6352
|
selectionLabel: leg.selectionLabel,
|
|
6292
6353
|
line: leg.line,
|
|
6293
6354
|
slip: guardPreMatch(slip, card.startsAtUtc, ui),
|
|
6294
6355
|
ui,
|
|
6295
|
-
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${leg.
|
|
6356
|
+
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${formatOdds(leg.priceForms, oddsFormat)}` }
|
|
6296
6357
|
}
|
|
6297
6358
|
)
|
|
6298
6359
|
] }) });
|
|
6299
6360
|
}
|
|
6300
6361
|
|
|
6301
6362
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6302
|
-
import { useEffect as
|
|
6363
|
+
import { useEffect as useEffect20, useMemo as useMemo7 } from "react";
|
|
6303
6364
|
|
|
6304
6365
|
// src/components/dashboard/v8/factLeg.ts
|
|
6305
6366
|
var isProp = (key) => key.toLowerCase().startsWith("prop_");
|
|
@@ -6327,10 +6388,10 @@ function legForFact(ref, grid, stars = []) {
|
|
|
6327
6388
|
|
|
6328
6389
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6329
6390
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6330
|
-
function FactPrice({ reference, ui, slip, conversation, memory:
|
|
6391
|
+
function FactPrice({ reference, ui, slip, conversation, memory: memory3, stars, enabled, operatorUserId, anonymousUserId }) {
|
|
6331
6392
|
const { sport, marketKey, matchId } = reference;
|
|
6332
6393
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6333
|
-
const ask =
|
|
6394
|
+
const ask = useMemo7(() => enabled && canAdd2 && marketKey && matchId ? {
|
|
6334
6395
|
sport,
|
|
6335
6396
|
marketKey,
|
|
6336
6397
|
matchIds: [matchId],
|
|
@@ -6341,8 +6402,8 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6341
6402
|
...operatorUserId ? { operatorUserId } : {},
|
|
6342
6403
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6343
6404
|
} : null, [enabled, canAdd2, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6344
|
-
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory:
|
|
6345
|
-
|
|
6405
|
+
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: ask });
|
|
6406
|
+
useEffect20(() => {
|
|
6346
6407
|
if (ask) void request(ask);
|
|
6347
6408
|
}, [request, ask]);
|
|
6348
6409
|
const settled = answeredFor === ask;
|
|
@@ -6351,6 +6412,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6351
6412
|
const index = answer ? legForFact(reference, answer, stars) : -1;
|
|
6352
6413
|
const leg = answer && index >= 0 ? legAt(answer, index, sport) ?? void 0 : void 0;
|
|
6353
6414
|
useNextKickoffRender([leg?.kickoffUtc]);
|
|
6415
|
+
const { oddsFormat } = useOddsSettings();
|
|
6354
6416
|
if (!ask) return null;
|
|
6355
6417
|
if (pending) return /* @__PURE__ */ jsx14("div", { className: "ss-w-v8-card-line ss-w-v8-card-line--pending ss-w-v8-fact-price", "aria-hidden": "true" });
|
|
6356
6418
|
if (!leg || !leg.quotedAtUtc || Number.isNaN(Date.parse(leg.quotedAtUtc))) return null;
|
|
@@ -6365,14 +6427,13 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6365
6427
|
SlipButton,
|
|
6366
6428
|
{
|
|
6367
6429
|
selection,
|
|
6368
|
-
shownOdds: leg.odds,
|
|
6369
6430
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6370
6431
|
selectionLabel: leg.selectionLabel,
|
|
6371
6432
|
line: leg.line,
|
|
6372
6433
|
slip: guardPreMatch(slip, leg.kickoffUtc, ui),
|
|
6373
6434
|
ui,
|
|
6374
6435
|
hold: !confirmed,
|
|
6375
|
-
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${leg.
|
|
6436
|
+
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${formatOdds(leg.priceForms, oddsFormat)}` }
|
|
6376
6437
|
}
|
|
6377
6438
|
)
|
|
6378
6439
|
] }) });
|
|
@@ -6380,7 +6441,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6380
6441
|
|
|
6381
6442
|
// src/components/dashboard/v8/FactsBlock.tsx
|
|
6382
6443
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6383
|
-
function FactsBlock({ facts, injury, ui, slip, conversation, memory:
|
|
6444
|
+
function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory3, stars, priced, operatorUserId, anonymousUserId }) {
|
|
6384
6445
|
const injuryText = injury?.text?.trim();
|
|
6385
6446
|
const injuryAt = injury && !Number.isNaN(Date.parse(injury.asOfUtc)) ? injury.asOfUtc : null;
|
|
6386
6447
|
if (facts.length === 0 && !(injuryText && injuryAt)) return null;
|
|
@@ -6388,7 +6449,7 @@ function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory2, st
|
|
|
6388
6449
|
/* @__PURE__ */ jsx15("h3", { className: "ss-w-v8-sec-title", children: ui.v8BeforeKickoff }),
|
|
6389
6450
|
facts.map((f, i) => /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", children: [
|
|
6390
6451
|
/* @__PURE__ */ jsx15("p", { className: "ss-w-v8-fact-text", children: f.text }),
|
|
6391
|
-
f.reference ? /* @__PURE__ */ jsx15(FactPrice, { reference: f.reference, ui, slip, conversation, memory:
|
|
6452
|
+
f.reference ? /* @__PURE__ */ jsx15(FactPrice, { reference: f.reference, ui, slip, conversation, memory: memory3, stars, enabled: priced, operatorUserId, anonymousUserId }) : null
|
|
6392
6453
|
] }, `${f.matchId ?? ""}:${f.marketKey}:${i}`)),
|
|
6393
6454
|
injuryText && injuryAt ? /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", "data-testid": "v8-injury", children: [
|
|
6394
6455
|
/* @__PURE__ */ jsx15("p", { className: "ss-w-v8-fact-text", children: injuryText }),
|
|
@@ -6408,14 +6469,14 @@ function FavouritesInvite({ ui, onOpen }) {
|
|
|
6408
6469
|
}
|
|
6409
6470
|
|
|
6410
6471
|
// src/components/dashboard/v8/useFollow.ts
|
|
6411
|
-
import { useState as
|
|
6472
|
+
import { useState as useState24 } from "react";
|
|
6412
6473
|
var isFavouriteKind = (kind) => kind === "team" || kind === "player" || kind === "competition";
|
|
6413
6474
|
var keyOf2 = (sport, t) => `${sport}:${t.kind}:${t.id}`;
|
|
6414
6475
|
function kindLabel(kind, ui) {
|
|
6415
6476
|
return kind === "competition" ? ui.favKindLeague : kind === "player" ? ui.favKindPlayer : ui.favKindTeam;
|
|
6416
6477
|
}
|
|
6417
6478
|
function useFollow(controller, ui, holds, sport) {
|
|
6418
|
-
const [notice, setNotice] =
|
|
6479
|
+
const [notice, setNotice] = useState24(null);
|
|
6419
6480
|
const isOpen = (t) => isFavouriteKind(t.kind) && !holds.followed.has(keyOf2(sport, t)) && !controller.isStarred(t.kind, t.id);
|
|
6420
6481
|
const follow = async (t) => {
|
|
6421
6482
|
if (!isFavouriteKind(t.kind)) return;
|
|
@@ -6683,19 +6744,19 @@ function shownFacts(personal, picked) {
|
|
|
6683
6744
|
}
|
|
6684
6745
|
|
|
6685
6746
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
6686
|
-
import { useEffect as
|
|
6747
|
+
import { useEffect as useEffect21, useLayoutEffect, useRef as useRef17, useState as useState26 } from "react";
|
|
6687
6748
|
|
|
6688
6749
|
// src/components/AddAllToSlipButton.tsx
|
|
6689
|
-
import { useCallback as useCallback19, useState as
|
|
6750
|
+
import { useCallback as useCallback19, useState as useState25 } from "react";
|
|
6690
6751
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6691
6752
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
6692
6753
|
const add = useSlipAdd(slip, ui);
|
|
6693
6754
|
const slipState = useSlipState();
|
|
6694
6755
|
const log = useEventLog();
|
|
6695
6756
|
const track = useTrack();
|
|
6696
|
-
const [pending, setPending] =
|
|
6697
|
-
const [settledLocal, setSettledLocal] =
|
|
6698
|
-
const [toast, setToast] =
|
|
6757
|
+
const [pending, setPending] = useState25(false);
|
|
6758
|
+
const [settledLocal, setSettledLocal] = useState25({});
|
|
6759
|
+
const [toast, setToast] = useState25(null);
|
|
6699
6760
|
const dismiss = useCallback19(() => setToast(null), []);
|
|
6700
6761
|
if (!ui || !slip.onAddToSlip || legs.length < 2) return null;
|
|
6701
6762
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
@@ -6769,15 +6830,17 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
6769
6830
|
}
|
|
6770
6831
|
|
|
6771
6832
|
// src/presetToolsContext.ts
|
|
6772
|
-
import { createContext as
|
|
6773
|
-
var PresetToolsContext =
|
|
6833
|
+
import { createContext as createContext7, useContext as useContext7 } from "react";
|
|
6834
|
+
var PresetToolsContext = createContext7(null);
|
|
6774
6835
|
function usePresetTools() {
|
|
6775
|
-
return
|
|
6836
|
+
return useContext7(PresetToolsContext);
|
|
6776
6837
|
}
|
|
6777
6838
|
|
|
6778
6839
|
// src/components/ComboCardList.tsx
|
|
6779
6840
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6780
6841
|
function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed }) {
|
|
6842
|
+
const { oddsFormat } = useOddsSettings();
|
|
6843
|
+
const odds = formatOdds(leg.priceForms, oddsFormat);
|
|
6781
6844
|
const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
|
|
6782
6845
|
const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
6783
6846
|
const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
|
|
@@ -6802,18 +6865,17 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6802
6865
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-market", children: leg.market }),
|
|
6803
6866
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-sel", children: leg.selection })
|
|
6804
6867
|
] }),
|
|
6805
|
-
closed ? null : /* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-price", children:
|
|
6868
|
+
closed ? null : /* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-price", children: odds }),
|
|
6806
6869
|
closed ? null : /* @__PURE__ */ jsx24(
|
|
6807
6870
|
SlipButton,
|
|
6808
6871
|
{
|
|
6809
6872
|
selection,
|
|
6810
|
-
shownOdds: leg.odds,
|
|
6811
6873
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6812
6874
|
selectionLabel: leg.selectionLabel,
|
|
6813
6875
|
line: leg.line,
|
|
6814
6876
|
slip,
|
|
6815
6877
|
ui,
|
|
6816
|
-
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${
|
|
6878
|
+
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${odds}`,
|
|
6817
6879
|
hold
|
|
6818
6880
|
}
|
|
6819
6881
|
)
|
|
@@ -6823,10 +6885,11 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6823
6885
|
}
|
|
6824
6886
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
6825
6887
|
const tools = usePresetTools();
|
|
6888
|
+
const { oddsFormat } = useOddsSettings();
|
|
6826
6889
|
const { target, legCount } = vm;
|
|
6827
6890
|
return /* @__PURE__ */ jsxs22("div", { className: "ss-w-combo", children: [
|
|
6828
6891
|
/* @__PURE__ */ jsx24("ol", { className: "ss-w-combo-legs", role: "list", children: vm.legs.map((leg) => /* @__PURE__ */ jsx24(ComboLegRow, { leg, addToSlipEnabled: vm.addToSlipEnabled, ui, slip, monitor }, leg.key)) }),
|
|
6829
|
-
/* @__PURE__ */ jsx24("div", { className: "ss-w-combo-math", children: vm.multiplication }),
|
|
6892
|
+
/* @__PURE__ */ jsx24("div", { className: "ss-w-combo-math", children: oddsFormat === "decimal" ? vm.multiplication : formatOdds(vm.totalForms, oddsFormat) }),
|
|
6830
6893
|
vm.replacedNote ? /* @__PURE__ */ jsx24("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
|
|
6831
6894
|
vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui, chatCombo: { total: vm.target !== void 0 ? String(vm.target) : "" } }) : null,
|
|
6832
6895
|
tools && target !== void 0 && legCount !== void 0 ? /* @__PURE__ */ jsx24("button", { type: "button", className: "ss-w-combo-change", onClick: () => tools.openBuilder(target, legCount), children: tools.changeLabel }) : null
|
|
@@ -6841,8 +6904,13 @@ function ComboCardList({ cards, ui, slip, monitor }) {
|
|
|
6841
6904
|
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6842
6905
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
6843
6906
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
6844
|
-
var
|
|
6845
|
-
var
|
|
6907
|
+
var isTotal = (v) => TOTALS.includes(v);
|
|
6908
|
+
var totalKeys = (preset) => ["any", ...preset.totalOptions.map((o) => o.key)].filter(isTotal);
|
|
6909
|
+
var asTotal = (v, keys) => isTotal(v) && keys.includes(v) ? v : "any";
|
|
6910
|
+
var totalLabel = (t, options, format2, ui) => {
|
|
6911
|
+
const option = options.find((o) => o.key === t);
|
|
6912
|
+
return t === "any" || !option ? ui.v8BuilderAny : formatOdds(option.formats, format2);
|
|
6913
|
+
};
|
|
6846
6914
|
var sameIds = (a, b) => a.length === b.length && a.every((id) => b.includes(id));
|
|
6847
6915
|
function openingGames(preset) {
|
|
6848
6916
|
const options = preset.gamesOptions && preset.gamesOptions.length > 0 ? preset.gamesOptions : null;
|
|
@@ -6851,31 +6919,33 @@ function openingGames(preset) {
|
|
|
6851
6919
|
return option ? { options, option } : { options: null, option: null };
|
|
6852
6920
|
}
|
|
6853
6921
|
var usableMarkets = (preset) => preset.marketOptions && preset.marketOptions.some((m) => m.key === preset.marketKey) ? preset.marketOptions : null;
|
|
6854
|
-
function SentenceBuilder({ preset, ui, conversation, memory:
|
|
6922
|
+
function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, sport, operatorUserId, anonymousUserId, onGames }) {
|
|
6923
|
+
const { oddsFormat } = useOddsSettings();
|
|
6924
|
+
const totals = totalKeys(preset);
|
|
6855
6925
|
const opening = openingGames(preset);
|
|
6856
6926
|
const gamesOptions = opening.options;
|
|
6857
6927
|
const marketOptions = usableMarkets(preset);
|
|
6858
|
-
const [fingerprint] =
|
|
6859
|
-
const [saved] =
|
|
6860
|
-
const kept =
|
|
6928
|
+
const [fingerprint] = useState26(() => JSON.stringify(preset));
|
|
6929
|
+
const [saved] = useState26(() => {
|
|
6930
|
+
const kept = memory3?.savedView(sport);
|
|
6861
6931
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
6862
6932
|
});
|
|
6863
6933
|
const openingView = {
|
|
6864
6934
|
legs: preset.legs,
|
|
6865
|
-
total: asTotal(preset.totalTarget),
|
|
6935
|
+
total: asTotal(preset.totalTarget, totals),
|
|
6866
6936
|
marketKey: preset.marketKey,
|
|
6867
6937
|
gamesId: opening.option?.id ?? null,
|
|
6868
6938
|
matchIds: opening.option ? opening.option.matchIds : preset.matchIds,
|
|
6869
6939
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
6870
6940
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
6871
6941
|
};
|
|
6872
|
-
const [view, setView] =
|
|
6873
|
-
const [chosen, setChosen] =
|
|
6942
|
+
const [view, setView] = useState26(() => saved?.view ?? openingView);
|
|
6943
|
+
const [chosen, setChosen] = useState26(() => saved?.chosen ?? (saved && !saved.widenedNote ? saved.view : openingView));
|
|
6874
6944
|
const pickedMatchId = chosen.widen ? gamesOptions?.find((o) => o.group === "game")?.matchIds[0] ?? null : chosen.matchIds[0] ?? null;
|
|
6875
6945
|
const pickedMatchIds = chosen.widen ? (gamesOptions ?? []).filter((o) => o.group === "game").flatMap((o) => o.matchIds) : chosen.matchIds;
|
|
6876
6946
|
const pickedOpening = chosen.widen === openingView.widen && chosen.gamesId === openingView.gamesId && sameIds(chosen.matchIds, openingView.matchIds);
|
|
6877
6947
|
const autoWidened = useRef17(false);
|
|
6878
|
-
const [widenedNote, setWidenedNote] =
|
|
6948
|
+
const [widenedNote, setWidenedNote] = useState26(saved?.widenedNote ?? false);
|
|
6879
6949
|
const requestFor = (v) => ({
|
|
6880
6950
|
sport,
|
|
6881
6951
|
marketKey: v.marketKey,
|
|
@@ -6887,10 +6957,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6887
6957
|
...operatorUserId ? { operatorUserId } : {},
|
|
6888
6958
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6889
6959
|
});
|
|
6890
|
-
const [first] =
|
|
6891
|
-
const { grid, status, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory:
|
|
6960
|
+
const [first] = useState26(() => requestFor(view));
|
|
6961
|
+
const { grid, status, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: first });
|
|
6892
6962
|
const lastRequest = useRef17(first);
|
|
6893
|
-
|
|
6963
|
+
useEffect21(() => {
|
|
6894
6964
|
void request(lastRequest.current);
|
|
6895
6965
|
}, [request]);
|
|
6896
6966
|
const send = (req) => {
|
|
@@ -6900,7 +6970,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6900
6970
|
const commit = (next, note, picked) => {
|
|
6901
6971
|
setView(next);
|
|
6902
6972
|
setWidenedNote(note);
|
|
6903
|
-
|
|
6973
|
+
memory3?.saveView(sport, { fingerprint, view: next, widenedNote: note, chosen: picked });
|
|
6904
6974
|
};
|
|
6905
6975
|
const ask = (next, pick) => {
|
|
6906
6976
|
setStartedNote(false);
|
|
@@ -6924,14 +6994,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6924
6994
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
6925
6995
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
6926
6996
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
6927
|
-
const [startedNote, setStartedNote] =
|
|
6997
|
+
const [startedNote, setStartedNote] = useState26(false);
|
|
6928
6998
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
6929
|
-
|
|
6999
|
+
useEffect21(() => {
|
|
6930
7000
|
if (startedNote && status === "ready" && !anyStarted) setStartedNote(false);
|
|
6931
7001
|
}, [startedNote, status, anyStarted]);
|
|
6932
7002
|
const market = rows?.[0]?.market;
|
|
6933
|
-
const [seen, setSeen] =
|
|
6934
|
-
|
|
7003
|
+
const [seen, setSeen] = useState26(null);
|
|
7004
|
+
useEffect21(() => {
|
|
6935
7005
|
if (market) setSeen(market);
|
|
6936
7006
|
}, [market]);
|
|
6937
7007
|
const marketName = marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
|
|
@@ -6944,7 +7014,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6944
7014
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
6945
7015
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
6946
7016
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
6947
|
-
|
|
7017
|
+
useEffect21(() => {
|
|
6948
7018
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
6949
7019
|
autoWidened.current = true;
|
|
6950
7020
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
@@ -7011,7 +7081,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7011
7081
|
] }),
|
|
7012
7082
|
view.legs > 1 ? /* @__PURE__ */ jsxs23("div", { className: "ss-w-v8-builder-ln ss-w-v8-builder-ln--total", children: [
|
|
7013
7083
|
/* @__PURE__ */ jsx25("span", { className: "ss-w-v8-builder-w", children: ui.v8BuilderTotal }),
|
|
7014
|
-
/* @__PURE__ */ jsx25("div", { className: "ss-w-v8-builder-btns", role: "group", "aria-label": ui.v8BuilderTotal, children:
|
|
7084
|
+
/* @__PURE__ */ jsx25("div", { className: "ss-w-v8-builder-btns", role: "group", "aria-label": ui.v8BuilderTotal, children: totals.map((t) => /* @__PURE__ */ jsx25(
|
|
7015
7085
|
"button",
|
|
7016
7086
|
{
|
|
7017
7087
|
type: "button",
|
|
@@ -7020,7 +7090,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7020
7090
|
onClick: () => {
|
|
7021
7091
|
if (view.total !== t) ask({ ...view, total: t });
|
|
7022
7092
|
},
|
|
7023
|
-
children: totalLabel(t, ui)
|
|
7093
|
+
children: totalLabel(t, preset.totalOptions, oddsFormat, ui)
|
|
7024
7094
|
},
|
|
7025
7095
|
t
|
|
7026
7096
|
)) })
|
|
@@ -7140,7 +7210,7 @@ function oneCardPerGame(cards) {
|
|
|
7140
7210
|
var MAX_IDLE_TEAMS = 2;
|
|
7141
7211
|
function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, onAct }) {
|
|
7142
7212
|
const ctx = usePersonalGreeting();
|
|
7143
|
-
const [pickedGames, setPickedGames] =
|
|
7213
|
+
const [pickedGames, setPickedGames] = useState27(null);
|
|
7144
7214
|
const scope = useSportScope();
|
|
7145
7215
|
const controller = ctx?.favourites && ctx.favourites.status !== "idle" && (scope?.operatorUserId || scope?.anonymousUserId) ? ctx.favourites : null;
|
|
7146
7216
|
const teamCards = oneCardPerGame((personal.teamCards ?? []).filter(teamCardHasContent)).slice(0, MAX_TEAM_CARDS);
|
|
@@ -7179,12 +7249,12 @@ function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, o
|
|
|
7179
7249
|
...(personal.idleTeams ?? []).map((t) => t.label),
|
|
7180
7250
|
...(controller?.data?.teams ?? []).map((t) => t.name)
|
|
7181
7251
|
];
|
|
7182
|
-
const
|
|
7183
|
-
const factsBlock =
|
|
7252
|
+
const shown2 = shownFacts(personal, pickedGames);
|
|
7253
|
+
const factsBlock = shown2 && (shown2.facts.length > 0 || shown2.injury) ? /* @__PURE__ */ jsx28(
|
|
7184
7254
|
FactsBlock,
|
|
7185
7255
|
{
|
|
7186
|
-
facts:
|
|
7187
|
-
injury:
|
|
7256
|
+
facts: shown2.facts,
|
|
7257
|
+
injury: shown2.injury,
|
|
7188
7258
|
ui,
|
|
7189
7259
|
slip,
|
|
7190
7260
|
conversation: ctx?.conversation ?? null,
|
|
@@ -7269,12 +7339,13 @@ function initialSport(sets, defaultSport) {
|
|
|
7269
7339
|
}
|
|
7270
7340
|
function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel, ui, slip, onAct }) {
|
|
7271
7341
|
const log = useEventLog();
|
|
7342
|
+
const { oddsFormat } = useOddsSettings();
|
|
7272
7343
|
const scope = useSportScope();
|
|
7273
7344
|
const sets = switchSets(dashboards);
|
|
7274
|
-
const [selected, setSelected] =
|
|
7345
|
+
const [selected, setSelected] = useState28(() => initialSport(sets, defaultSport));
|
|
7275
7346
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
7276
|
-
const
|
|
7277
|
-
const personal =
|
|
7347
|
+
const shown2 = active ? active.dashboard : dashboard;
|
|
7348
|
+
const personal = shown2.personal;
|
|
7278
7349
|
const starsElsewhere = (sets ?? []).some((s) => (s.dashboard.personal?.ribbon?.stars.length ?? 0) > 0);
|
|
7279
7350
|
const select = (sport) => {
|
|
7280
7351
|
if (sport === selected) return;
|
|
@@ -7283,25 +7354,25 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSport
|
|
|
7283
7354
|
if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
|
|
7284
7355
|
log?.log({ name: "dashboard_sport_switch", outcome: sport });
|
|
7285
7356
|
};
|
|
7286
|
-
const layout = layoutClass(
|
|
7357
|
+
const layout = layoutClass(shown2.layout);
|
|
7287
7358
|
const badgePlacement = layout === LAYOUT_CLASSES.goal ? "end" : "meta";
|
|
7288
7359
|
return /* @__PURE__ */ jsxs27("div", { className: `ss-w-dash ${layout}`, children: [
|
|
7289
7360
|
sets ? /* @__PURE__ */ jsx29(SportSwitch, { sports: sets, selected, onSelect: select, liveLabel: liveLabel3, groupLabel: sportGroupLabel }) : null,
|
|
7290
7361
|
/* @__PURE__ */ jsxs27("div", { className: "ss-w-dash-head", children: [
|
|
7291
|
-
/* @__PURE__ */ jsx29("span", { className: "ss-w-dash-title", children:
|
|
7292
|
-
|
|
7362
|
+
/* @__PURE__ */ jsx29("span", { className: "ss-w-dash-title", children: shown2.title }),
|
|
7363
|
+
shown2.subtitle ? /* @__PURE__ */ jsx29("span", { className: "ss-w-dash-subtitle", children: shown2.subtitle }) : null
|
|
7293
7364
|
] }),
|
|
7294
|
-
personal && ui && slip ? /* @__PURE__ */ jsx29(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx29("div", { className: "ss-w-dash-grid", children:
|
|
7365
|
+
personal && ui && slip ? /* @__PURE__ */ jsx29(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ jsx29("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ jsx29(
|
|
7295
7366
|
DashboardTile,
|
|
7296
7367
|
{
|
|
7297
|
-
tile: t,
|
|
7298
|
-
onTap: () => active ? onTap(t, i, { layout:
|
|
7368
|
+
tile: tileForFormat(t, oddsFormat),
|
|
7369
|
+
onTap: () => active ? onTap(t, i, { layout: shown2.layout, sport: active.sport }) : onTap(t, i),
|
|
7299
7370
|
oddsLabel,
|
|
7300
7371
|
badgePlacement
|
|
7301
7372
|
},
|
|
7302
7373
|
`${t.title}-${i}`
|
|
7303
7374
|
)) }),
|
|
7304
|
-
|
|
7375
|
+
shown2.footerTip ? /* @__PURE__ */ jsx29("span", { className: "ss-w-dash-foot", children: shown2.footerTip }) : null
|
|
7305
7376
|
] });
|
|
7306
7377
|
}
|
|
7307
7378
|
|
|
@@ -7402,11 +7473,11 @@ var WIRE_TO_PUBLIC = {
|
|
|
7402
7473
|
};
|
|
7403
7474
|
|
|
7404
7475
|
// src/popupTelemetry.ts
|
|
7405
|
-
import { useCallback as useCallback20, useEffect as
|
|
7476
|
+
import { useCallback as useCallback20, useEffect as useEffect22, useRef as useRef18 } from "react";
|
|
7406
7477
|
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7407
7478
|
const shownRef = useRef18(/* @__PURE__ */ new Set());
|
|
7408
7479
|
const closedTextRef = useRef18(null);
|
|
7409
|
-
|
|
7480
|
+
useEffect22(() => {
|
|
7410
7481
|
if (isOpen) {
|
|
7411
7482
|
if (closedTextRef.current) log?.log({ name: "popup_opened" });
|
|
7412
7483
|
closedTextRef.current = null;
|
|
@@ -7425,10 +7496,10 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7425
7496
|
}
|
|
7426
7497
|
|
|
7427
7498
|
// src/openTelemetry.ts
|
|
7428
|
-
import { useEffect as
|
|
7499
|
+
import { useEffect as useEffect23, useRef as useRef19 } from "react";
|
|
7429
7500
|
function useOpenTelemetry(log, isOpen) {
|
|
7430
7501
|
const openLoggedRef = useRef19(false);
|
|
7431
|
-
|
|
7502
|
+
useEffect23(() => {
|
|
7432
7503
|
if (!isOpen) {
|
|
7433
7504
|
openLoggedRef.current = false;
|
|
7434
7505
|
return;
|
|
@@ -7440,13 +7511,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7440
7511
|
}
|
|
7441
7512
|
|
|
7442
7513
|
// src/components/ChatFab.tsx
|
|
7443
|
-
import { useEffect as
|
|
7514
|
+
import { useEffect as useEffect24, useRef as useRef20, useState as useState30 } from "react";
|
|
7444
7515
|
|
|
7445
7516
|
// src/components/BrandMark.tsx
|
|
7446
|
-
import { useState as
|
|
7517
|
+
import { useState as useState29 } from "react";
|
|
7447
7518
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
7448
7519
|
function BrandMark({ logoUrl, className }) {
|
|
7449
|
-
const [failed, setFailed] =
|
|
7520
|
+
const [failed, setFailed] = useState29(false);
|
|
7450
7521
|
if (!logoUrl || failed) return /* @__PURE__ */ jsx30(SsMark, { className });
|
|
7451
7522
|
return /* @__PURE__ */ jsx30("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7452
7523
|
}
|
|
@@ -7483,9 +7554,9 @@ import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
|
7483
7554
|
function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup, dismissLabel = "Dismiss", introAllowed = false, onIntroStart, asks }) {
|
|
7484
7555
|
const bubble = popupText ?? greeting;
|
|
7485
7556
|
const track = useTrack();
|
|
7486
|
-
const [intro, setIntro] =
|
|
7557
|
+
const [intro, setIntro] = useState30(false);
|
|
7487
7558
|
const armedRef = useRef20(introAllowed);
|
|
7488
|
-
|
|
7559
|
+
useEffect24(() => {
|
|
7489
7560
|
if (armedRef.current && bubble) {
|
|
7490
7561
|
armedRef.current = false;
|
|
7491
7562
|
setIntro(true);
|
|
@@ -7505,10 +7576,10 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
7505
7576
|
}
|
|
7506
7577
|
|
|
7507
7578
|
// src/components/ChatPanel.tsx
|
|
7508
|
-
import { useCallback as
|
|
7579
|
+
import { useCallback as useCallback24, useEffect as useEffect44, useLayoutEffect as useLayoutEffect3, useMemo as useMemo10, useRef as useRef36, useState as useState72 } from "react";
|
|
7509
7580
|
|
|
7510
7581
|
// src/components/ChatHeader.tsx
|
|
7511
|
-
import { useEffect as
|
|
7582
|
+
import { useEffect as useEffect25, useRef as useRef21, useState as useState31 } from "react";
|
|
7512
7583
|
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7513
7584
|
function ChatHeader({
|
|
7514
7585
|
onClose,
|
|
@@ -7518,17 +7589,21 @@ function ChatHeader({
|
|
|
7518
7589
|
onNewConversation,
|
|
7519
7590
|
canReset,
|
|
7520
7591
|
newConversationLabel = "New conversation",
|
|
7521
|
-
moreOptionsLabel = "More options"
|
|
7592
|
+
moreOptionsLabel = "More options",
|
|
7593
|
+
onOpenSettings,
|
|
7594
|
+
settingsLabel = "Settings"
|
|
7522
7595
|
}) {
|
|
7523
|
-
const [menuOpen, setMenuOpen] =
|
|
7596
|
+
const [menuOpen, setMenuOpen] = useState31(false);
|
|
7524
7597
|
const wrapRef = useRef21(null);
|
|
7525
7598
|
const kebabRef = useRef21(null);
|
|
7526
7599
|
const firstItemRef = useRef21(null);
|
|
7527
|
-
const
|
|
7528
|
-
|
|
7600
|
+
const hasNew = !!(canReset && onNewConversation);
|
|
7601
|
+
const hasSettings = !!onOpenSettings;
|
|
7602
|
+
const hasMenu = hasNew || hasSettings;
|
|
7603
|
+
useEffect25(() => {
|
|
7529
7604
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7530
7605
|
}, [menuOpen]);
|
|
7531
|
-
|
|
7606
|
+
useEffect25(() => {
|
|
7532
7607
|
if (!menuOpen) return;
|
|
7533
7608
|
const onPointer = (e) => {
|
|
7534
7609
|
if (!wrapRef.current?.contains(e.target)) setMenuOpen(false);
|
|
@@ -7550,6 +7625,10 @@ function ChatHeader({
|
|
|
7550
7625
|
setMenuOpen(false);
|
|
7551
7626
|
onNewConversation?.();
|
|
7552
7627
|
};
|
|
7628
|
+
const runSettings = () => {
|
|
7629
|
+
setMenuOpen(false);
|
|
7630
|
+
onOpenSettings?.();
|
|
7631
|
+
};
|
|
7553
7632
|
return /* @__PURE__ */ jsxs30("header", { className: "ss-w-header", children: [
|
|
7554
7633
|
/* @__PURE__ */ jsx33(BrandMark, { logoUrl, className: "ss-w-header-mark" }),
|
|
7555
7634
|
/* @__PURE__ */ jsx33("span", { className: "ss-w-header-title", children: headerTitle ?? "SensibleStats" }),
|
|
@@ -7567,27 +7646,40 @@ function ChatHeader({
|
|
|
7567
7646
|
children: /* @__PURE__ */ jsx33(KebabIcon, {})
|
|
7568
7647
|
}
|
|
7569
7648
|
),
|
|
7570
|
-
menuOpen ? /* @__PURE__ */
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7649
|
+
menuOpen ? /* @__PURE__ */ jsxs30("div", { className: "ss-w-menu", role: "menu", "aria-label": moreOptionsLabel, children: [
|
|
7650
|
+
hasNew ? /* @__PURE__ */ jsx33(
|
|
7651
|
+
"button",
|
|
7652
|
+
{
|
|
7653
|
+
type: "button",
|
|
7654
|
+
className: "ss-w-menu-item",
|
|
7655
|
+
role: "menuitem",
|
|
7656
|
+
ref: firstItemRef,
|
|
7657
|
+
onClick: runNewConversation,
|
|
7658
|
+
children: /* @__PURE__ */ jsx33("span", { children: newConversationLabel })
|
|
7659
|
+
}
|
|
7660
|
+
) : null,
|
|
7661
|
+
hasSettings ? /* @__PURE__ */ jsx33(
|
|
7662
|
+
"button",
|
|
7663
|
+
{
|
|
7664
|
+
type: "button",
|
|
7665
|
+
className: "ss-w-menu-item",
|
|
7666
|
+
role: "menuitem",
|
|
7667
|
+
ref: hasNew ? void 0 : firstItemRef,
|
|
7668
|
+
onClick: runSettings,
|
|
7669
|
+
children: /* @__PURE__ */ jsx33("span", { children: settingsLabel })
|
|
7670
|
+
}
|
|
7671
|
+
) : null
|
|
7672
|
+
] }) : null
|
|
7581
7673
|
] }) : null,
|
|
7582
7674
|
/* @__PURE__ */ jsx33("button", { type: "button", className: "ss-w-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx33(CloseIcon, {}) })
|
|
7583
7675
|
] });
|
|
7584
7676
|
}
|
|
7585
7677
|
|
|
7586
7678
|
// src/components/MessageList.tsx
|
|
7587
|
-
import { useEffect as
|
|
7679
|
+
import { useEffect as useEffect29, useRef as useRef24 } from "react";
|
|
7588
7680
|
|
|
7589
7681
|
// src/components/ChatMessage.tsx
|
|
7590
|
-
import { useState as
|
|
7682
|
+
import { useState as useState40 } from "react";
|
|
7591
7683
|
|
|
7592
7684
|
// src/components/Markdown.tsx
|
|
7593
7685
|
import ReactMarkdown from "react-markdown";
|
|
@@ -7605,7 +7697,7 @@ function Markdown({ text }) {
|
|
|
7605
7697
|
}
|
|
7606
7698
|
|
|
7607
7699
|
// src/components/EntityCardList.tsx
|
|
7608
|
-
import { useState as
|
|
7700
|
+
import { useState as useState32 } from "react";
|
|
7609
7701
|
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7610
7702
|
var MAX_VISIBLE = 3;
|
|
7611
7703
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7689,7 +7781,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7689
7781
|
)) });
|
|
7690
7782
|
}
|
|
7691
7783
|
function EntityCardItem({ c }) {
|
|
7692
|
-
const [active, setActive] =
|
|
7784
|
+
const [active, setActive] = useState32(0);
|
|
7693
7785
|
const hasBody = c.scopes.length > 0;
|
|
7694
7786
|
if (!hasBody) {
|
|
7695
7787
|
return /* @__PURE__ */ jsx35("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ jsx35(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -7703,7 +7795,7 @@ function EntityCardItem({ c }) {
|
|
|
7703
7795
|
] });
|
|
7704
7796
|
}
|
|
7705
7797
|
function EntityCardList({ cards, disabled, showLessLabel = "Show less", showMoreLabel = (n) => `Show ${n} more` }) {
|
|
7706
|
-
const [expanded, setExpanded] =
|
|
7798
|
+
const [expanded, setExpanded] = useState32(false);
|
|
7707
7799
|
if (cards.length === 0) return null;
|
|
7708
7800
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7709
7801
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7742,6 +7834,9 @@ function CardFixture({ it }) {
|
|
|
7742
7834
|
return null;
|
|
7743
7835
|
}
|
|
7744
7836
|
function InsightCard({ it, ui, slip, monitor }) {
|
|
7837
|
+
const { oddsFormat } = useOddsSettings();
|
|
7838
|
+
const odds = it.oddsForms ? formatOdds(it.oddsForms, oddsFormat) : void 0;
|
|
7839
|
+
const previousOdds = it.previousOddsForms ? formatOdds(it.previousOddsForms, oddsFormat) : void 0;
|
|
7745
7840
|
const live = it.isLive || it.phase === "live";
|
|
7746
7841
|
const kickoffFallback = it.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(it.kickoffUtc) : void 0;
|
|
7747
7842
|
const kickoff = it.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -7775,12 +7870,12 @@ function InsightCard({ it, ui, slip, monitor }) {
|
|
|
7775
7870
|
it.market ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-market", children: it.market }) : null,
|
|
7776
7871
|
/* @__PURE__ */ jsxs32("div", { className: "ss-w-bi-pick-row", children: [
|
|
7777
7872
|
it.selection ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-sel", children: it.selection }) : null,
|
|
7778
|
-
|
|
7779
|
-
/* @__PURE__ */ jsx36("b", { children:
|
|
7780
|
-
/* @__PURE__ */ jsx36(OddsMovementBadge, { previous:
|
|
7873
|
+
odds ? /* @__PURE__ */ jsxs32("span", { className: "ss-w-bi-odds", children: [
|
|
7874
|
+
/* @__PURE__ */ jsx36("b", { children: odds }),
|
|
7875
|
+
/* @__PURE__ */ jsx36(OddsMovementBadge, { previous: previousOdds, current: odds, direction: it.movementDirection, ui }),
|
|
7781
7876
|
it.bookmaker ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-book", children: it.bookmaker }) : null
|
|
7782
7877
|
] }) : null,
|
|
7783
|
-
|
|
7878
|
+
odds && showPin && ui && previousOdds ? /* @__PURE__ */ jsx36(
|
|
7784
7879
|
PriceHistoryButton,
|
|
7785
7880
|
{
|
|
7786
7881
|
ui,
|
|
@@ -7802,10 +7897,10 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7802
7897
|
}
|
|
7803
7898
|
|
|
7804
7899
|
// src/nbaLineMove.ts
|
|
7805
|
-
function lineMoveEvents(ev) {
|
|
7900
|
+
function lineMoveEvents(ev, format2) {
|
|
7806
7901
|
const events = [];
|
|
7807
7902
|
for (const lane of [ev.spread, ev.total]) {
|
|
7808
|
-
for (const p of lane?.points ?? []) events.push({ atUtc: p.atUtc, kind: "line", text: p.
|
|
7903
|
+
for (const p of lane?.points ?? []) events.push({ atUtc: p.atUtc, kind: "line", text: formatOdds(p.textFormats, format2) });
|
|
7809
7904
|
}
|
|
7810
7905
|
for (const i of ev.injuries ?? []) events.push({ atUtc: i.atUtc, kind: "injury", text: i.text });
|
|
7811
7906
|
return events.map((e, i) => ({ e, i, t: Date.parse(e.atUtc) })).sort((a, b) => a.t - b.t || (a.e.kind === b.e.kind ? 0 : a.e.kind === "injury" ? -1 : 1) || a.i - b.i).map(({ e }) => e);
|
|
@@ -7852,28 +7947,28 @@ var oneDecimal = (n, ui) => n.toLocaleString(intlTag(ui), { minimumFractionDigit
|
|
|
7852
7947
|
var byDate = (games) => [...games].sort((a, b) => a.date < b.date ? -1 : a.date > b.date ? 1 : 0);
|
|
7853
7948
|
var canAdd = (vm, key, slip) => takesSport(slip, "basketball") && toNbaSlipSelection(vm, key, slip.conversationId) !== null;
|
|
7854
7949
|
function NbaPrice({ vm, selectionKey, label, ui, slip }) {
|
|
7950
|
+
const { oddsFormat } = useOddsSettings();
|
|
7855
7951
|
const s = selectionKey ? vm.selections[selectionKey] : void 0;
|
|
7856
7952
|
if (!s) return null;
|
|
7857
|
-
const
|
|
7953
|
+
const shown2 = formatOdds(s.priceFormats, oddsFormat);
|
|
7858
7954
|
const selection = takesSport(slip, "basketball") ? toNbaSlipSelection(vm, selectionKey, slip.conversationId) : null;
|
|
7859
7955
|
if (selection) {
|
|
7860
7956
|
return /* @__PURE__ */ jsx37(
|
|
7861
7957
|
SlipButton,
|
|
7862
7958
|
{
|
|
7863
7959
|
selection,
|
|
7864
|
-
shownOdds: shown,
|
|
7865
7960
|
marketDeveloperName: s.marketDeveloperName,
|
|
7866
7961
|
selectionLabel: s.selectionLabel,
|
|
7867
7962
|
line: s.line ?? void 0,
|
|
7868
7963
|
slip,
|
|
7869
7964
|
ui,
|
|
7870
|
-
price: { label, ariaLabel: `${s.selectionLabel}, ${
|
|
7965
|
+
price: { label, ariaLabel: `${s.selectionLabel}, ${shown2}` }
|
|
7871
7966
|
}
|
|
7872
7967
|
);
|
|
7873
7968
|
}
|
|
7874
7969
|
return /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-price", children: [
|
|
7875
7970
|
label ? /* @__PURE__ */ jsx37("span", { className: "ss-w-nba-price-lab", children: label }) : null,
|
|
7876
|
-
/* @__PURE__ */ jsx37("span", { children:
|
|
7971
|
+
/* @__PURE__ */ jsx37("span", { children: shown2 })
|
|
7877
7972
|
] });
|
|
7878
7973
|
}
|
|
7879
7974
|
function Head({ vm, chip, ui, monitor }) {
|
|
@@ -7932,11 +8027,12 @@ function PropReason({ vm, pr, ui, slip }) {
|
|
|
7932
8027
|
}
|
|
7933
8028
|
function Ladder({ vm, ld, ui, slip }) {
|
|
7934
8029
|
const nba = ui.nba;
|
|
8030
|
+
const { oddsFormat } = useOddsSettings();
|
|
7935
8031
|
return /* @__PURE__ */ jsx37(Fragment7, { children: ld.stats.map((st, si) => /* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stat", children: [
|
|
7936
8032
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stathd", children: [
|
|
7937
8033
|
/* @__PURE__ */ jsx37("b", { children: nba.stat(st.stat) }),
|
|
7938
8034
|
st.mainLine ? /* @__PURE__ */ jsx37("span", { children: nba.mainLine(nba.lineText(st.mainLine)) }) : null,
|
|
7939
|
-
typeof st.overPrice === "number" && typeof st.underPrice === "number" ? /* @__PURE__ */ jsx37("span", { children: nba.mainPrice(st.
|
|
8035
|
+
typeof st.overPrice === "number" && st.overPriceFormats && typeof st.underPrice === "number" && st.underPriceFormats ? /* @__PURE__ */ jsx37("span", { children: nba.mainPrice(formatOdds(st.overPriceFormats, oddsFormat), formatOdds(st.underPriceFormats, oddsFormat)) }) : null
|
|
7940
8036
|
] }),
|
|
7941
8037
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-ladder", children: [
|
|
7942
8038
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-row", children: [
|
|
@@ -8163,6 +8259,7 @@ var TOTAL_BOX = { x0: 38, x1: 310, y0: 28, y1: 74 };
|
|
|
8163
8259
|
var AXIS_Y = 90;
|
|
8164
8260
|
function LineMove({ vm, lm, ui, slip }) {
|
|
8165
8261
|
const nba = ui.nba;
|
|
8262
|
+
const { oddsFormat } = useOddsSettings();
|
|
8166
8263
|
const lanes = [];
|
|
8167
8264
|
if (lm.spread?.points.length) lanes.push({ lane: lm.spread, box: SPREAD_BOX, label: nba.spread, mod: "spread", side: "l" });
|
|
8168
8265
|
if (lm.total?.points.length) lanes.push({ lane: lm.total, box: TOTAL_BOX, label: nba.total, mod: "total", side: "r" });
|
|
@@ -8181,7 +8278,7 @@ function LineMove({ vm, lm, ui, slip }) {
|
|
|
8181
8278
|
const r = to > from ? (ms - from) / (to - from) : 0;
|
|
8182
8279
|
return SPREAD_BOX.x0 + Math.min(1, Math.max(0, r)) * (SPREAD_BOX.x1 - SPREAD_BOX.x0);
|
|
8183
8280
|
};
|
|
8184
|
-
const events = lineMoveEvents(lm).filter((e) => Number.isFinite(Date.parse(e.atUtc)));
|
|
8281
|
+
const events = lineMoveEvents(lm, oddsFormat).filter((e) => Number.isFinite(Date.parse(e.atUtc)));
|
|
8185
8282
|
const nowLabel = clock2(vm.quotedAtUtc);
|
|
8186
8283
|
return /* @__PURE__ */ jsxs33(Fragment7, { children: [
|
|
8187
8284
|
/* @__PURE__ */ jsx37("div", { className: "ss-w-nba-legend", children: lanes.map((l) => /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-legkey", children: [
|
|
@@ -8310,35 +8407,35 @@ function Badge({ abbr }) {
|
|
|
8310
8407
|
return /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-badge", children: abbr });
|
|
8311
8408
|
}
|
|
8312
8409
|
function Price({ vm, selection, label, ui, slip, nowMs }) {
|
|
8410
|
+
const { oddsFormat } = useOddsSettings();
|
|
8313
8411
|
if (!selection) return null;
|
|
8314
|
-
const
|
|
8412
|
+
const shown2 = formatOdds(selection.priceFormats, oddsFormat);
|
|
8315
8413
|
const slipSelection = takesSport(slip, "americanfootball") ? toNflSlipSelection(vm, selection.key, nowMs, slip.conversationId) : null;
|
|
8316
8414
|
const host = slip.onAddToSlip;
|
|
8317
8415
|
if (slipSelection && host) {
|
|
8318
8416
|
const guarded = {
|
|
8319
8417
|
...slip,
|
|
8320
|
-
onAddToSlip: () => {
|
|
8418
|
+
onAddToSlip: (outgoing) => {
|
|
8321
8419
|
const fresh = toNflSlipSelection(vm, selection.key, Date.now(), slip.conversationId);
|
|
8322
|
-
return fresh ? host(
|
|
8420
|
+
return fresh ? host(outgoing) : { status: "rejected", reason: "closed", message: ui.slipStarted };
|
|
8323
8421
|
}
|
|
8324
8422
|
};
|
|
8325
8423
|
return /* @__PURE__ */ jsx38(
|
|
8326
8424
|
SlipButton,
|
|
8327
8425
|
{
|
|
8328
8426
|
selection: slipSelection,
|
|
8329
|
-
shownOdds: shown,
|
|
8330
8427
|
marketDeveloperName: selection.marketDeveloperName,
|
|
8331
8428
|
selectionLabel: selection.selectionLabel,
|
|
8332
8429
|
line: selection.line ?? void 0,
|
|
8333
8430
|
slip: guarded,
|
|
8334
8431
|
ui,
|
|
8335
|
-
price: { label, ariaLabel: `${selection.selectionLabel}, ${
|
|
8432
|
+
price: { label, ariaLabel: `${selection.selectionLabel}, ${shown2}` }
|
|
8336
8433
|
}
|
|
8337
8434
|
);
|
|
8338
8435
|
}
|
|
8339
8436
|
return /* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-price", children: [
|
|
8340
8437
|
label ? /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-price-lab", children: label }) : null,
|
|
8341
|
-
/* @__PURE__ */ jsx38("span", { children:
|
|
8438
|
+
/* @__PURE__ */ jsx38("span", { children: shown2 })
|
|
8342
8439
|
] });
|
|
8343
8440
|
}
|
|
8344
8441
|
function Head2({ vm, ui, monitor }) {
|
|
@@ -8436,6 +8533,7 @@ function InjuryReport({ ir, ui }) {
|
|
|
8436
8533
|
}
|
|
8437
8534
|
function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
8438
8535
|
const nfl = ui.nfl;
|
|
8536
|
+
const { oddsFormat } = useOddsSettings();
|
|
8439
8537
|
const who = (side) => {
|
|
8440
8538
|
if (side === "home") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.homeAbbr });
|
|
8441
8539
|
if (side === "away") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.awayAbbr });
|
|
@@ -8451,10 +8549,10 @@ function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
|
8451
8549
|
/* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-n ss-w-nfl-n--faint", children: [
|
|
8452
8550
|
l.openLine ?? "",
|
|
8453
8551
|
" \xB7 ",
|
|
8454
|
-
l.
|
|
8552
|
+
formatOdds(l.openPriceFormats, oddsFormat)
|
|
8455
8553
|
] }),
|
|
8456
8554
|
/* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-n", children: l.line ?? "" }),
|
|
8457
|
-
/* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-pcell", children: /* @__PURE__ */ jsx38(Price, { vm, ui, slip, nowMs, selection: vm.selections[`${l.market}:${l.side}`] ?? { key: "", marketDeveloperName: l.market, selectionLabel: "", side: l.side, price: l.price, quotedAtUtc: l.quotedAtUtc } }) })
|
|
8555
|
+
/* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-pcell", children: /* @__PURE__ */ jsx38(Price, { vm, ui, slip, nowMs, selection: vm.selections[`${l.market}:${l.side}`] ?? { key: "", marketDeveloperName: l.market, selectionLabel: "", side: l.side, price: l.price, priceFormats: l.priceFormats, quotedAtUtc: l.quotedAtUtc } }) })
|
|
8458
8556
|
] }, `${l.market}:${l.side}`))
|
|
8459
8557
|
] });
|
|
8460
8558
|
}
|
|
@@ -8601,7 +8699,7 @@ function NflInsightList({ insights, ui, slip = {}, monitor }) {
|
|
|
8601
8699
|
}
|
|
8602
8700
|
|
|
8603
8701
|
// src/components/CompactOddsList.tsx
|
|
8604
|
-
import { useEffect as
|
|
8702
|
+
import { useEffect as useEffect26, useRef as useRef22, useState as useState33 } from "react";
|
|
8605
8703
|
import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
|
|
8606
8704
|
|
|
8607
8705
|
// src/compactList.ts
|
|
@@ -8665,14 +8763,16 @@ function toCompactList(cards) {
|
|
|
8665
8763
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8666
8764
|
function Cell({ row, cell: cell2, ui, slip }) {
|
|
8667
8765
|
const vm = row.card;
|
|
8766
|
+
const { oddsFormat } = useOddsSettings();
|
|
8767
|
+
const odds = formatOdds(cell2.row.priceForms, oddsFormat);
|
|
8768
|
+
const previous = cell2.row.previousPriceForms ? formatOdds(cell2.row.previousPriceForms, oddsFormat) : void 0;
|
|
8668
8769
|
const slippable = vm.addToSlipEnabled && (!isNfl(vm.sport) || slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now()));
|
|
8669
8770
|
const selection = slippable ? marketOddsRowToSlipSelection(vm, cell2.row, slip.conversationId) : null;
|
|
8670
|
-
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${
|
|
8771
|
+
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${odds}`;
|
|
8671
8772
|
const button = /* @__PURE__ */ jsx39(
|
|
8672
8773
|
SlipButton,
|
|
8673
8774
|
{
|
|
8674
8775
|
selection,
|
|
8675
|
-
shownOdds: cell2.row.odds,
|
|
8676
8776
|
marketDeveloperName: vm.marketDeveloperName,
|
|
8677
8777
|
selectionLabel: cell2.row.selectionLabel,
|
|
8678
8778
|
line: cell2.row.line,
|
|
@@ -8684,13 +8784,13 @@ function Cell({ row, cell: cell2, ui, slip }) {
|
|
|
8684
8784
|
return (
|
|
8685
8785
|
// A third of the price column fits four characters at the row's size: 13.00 steps down a size
|
|
8686
8786
|
// and 101.00 two.
|
|
8687
|
-
/* @__PURE__ */ jsxs35("span", { className: ["ss-w-mol-cell",
|
|
8787
|
+
/* @__PURE__ */ jsxs35("span", { className: ["ss-w-mol-cell", odds.length >= 5 && "ss-w-mol-cell--wide", odds.length >= 6 && "ss-w-mol-cell--wider"].filter(Boolean).join(" "), children: [
|
|
8688
8788
|
selection && slip.onAddToSlip && ui ? button : /* @__PURE__ */ jsxs35("span", { className: "ss-w-mol-price", children: [
|
|
8689
8789
|
cell2.label ? /* @__PURE__ */ jsx39("span", { className: "ss-w-mol-lab", "aria-hidden": "true", children: cell2.label }) : null,
|
|
8690
|
-
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children:
|
|
8790
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children: odds }),
|
|
8691
8791
|
/* @__PURE__ */ jsx39("span", { className: "ss-w-vh", children: name })
|
|
8692
8792
|
] }),
|
|
8693
|
-
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous
|
|
8793
|
+
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous, current: odds, direction: cell2.row.movementDirection, ui })
|
|
8694
8794
|
] })
|
|
8695
8795
|
);
|
|
8696
8796
|
}
|
|
@@ -8721,14 +8821,14 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
8721
8821
|
] });
|
|
8722
8822
|
}
|
|
8723
8823
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
8724
|
-
const [
|
|
8725
|
-
const hidden = list.rowCount -
|
|
8726
|
-
const [focusIndex, setFocusIndex] =
|
|
8824
|
+
const [shown2, setShown] = useState33(COMPACT_PAGE);
|
|
8825
|
+
const hidden = list.rowCount - shown2;
|
|
8826
|
+
const [focusIndex, setFocusIndex] = useState33(null);
|
|
8727
8827
|
const focusRef = useRef22(null);
|
|
8728
|
-
|
|
8828
|
+
useEffect26(() => {
|
|
8729
8829
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
8730
8830
|
}, [focusIndex]);
|
|
8731
|
-
let left =
|
|
8831
|
+
let left = shown2;
|
|
8732
8832
|
let index = 0;
|
|
8733
8833
|
return /* @__PURE__ */ jsxs35("div", { className: "ss-w-mol", children: [
|
|
8734
8834
|
/* @__PURE__ */ jsxs35("div", { className: "ss-w-mol-head", children: [
|
|
@@ -8752,7 +8852,7 @@ function CompactOddsList({ list, ui, slip, monitor }) {
|
|
|
8752
8852
|
] }, `${group.competition ?? ""}:${gi}`);
|
|
8753
8853
|
}),
|
|
8754
8854
|
hidden > 0 ? /* @__PURE__ */ jsxs35("button", { type: "button", className: "ss-w-mo-more", onClick: () => {
|
|
8755
|
-
setFocusIndex(
|
|
8855
|
+
setFocusIndex(shown2);
|
|
8756
8856
|
setShown((n) => n + COMPACT_PAGE);
|
|
8757
8857
|
}, children: [
|
|
8758
8858
|
/* @__PURE__ */ jsx39("span", { children: ui?.showMore ? ui.showMore(Math.min(COMPACT_PAGE, hidden)) : `Show ${Math.min(COMPACT_PAGE, hidden)} more` }),
|
|
@@ -8771,9 +8871,13 @@ function directionWord(vm, ui) {
|
|
|
8771
8871
|
return "";
|
|
8772
8872
|
}
|
|
8773
8873
|
function OddsMovementCard({ vm, ui, monitor }) {
|
|
8874
|
+
const { oddsFormat } = useOddsSettings();
|
|
8875
|
+
const text = (forms) => forms ? formatOdds(forms, oddsFormat) : "";
|
|
8876
|
+
const opening = text(vm.openingForms);
|
|
8877
|
+
const current = text(vm.currentForms);
|
|
8774
8878
|
const word = directionWord(vm, ui);
|
|
8775
8879
|
const drift = word ? `, ${word}` : "";
|
|
8776
|
-
const aria = ui?.chartAria ? ui.chartAria(
|
|
8880
|
+
const aria = ui?.chartAria ? ui.chartAria(opening, current, word, vm.windowHours) : `Price movement over the last ${vm.windowHours} hours: opened at ${opening}, currently ${current}${drift}.`;
|
|
8777
8881
|
const showPin = !!monitor && vm.pinEnabled;
|
|
8778
8882
|
return /* @__PURE__ */ jsxs36("div", { className: "ss-w-omcard", children: [
|
|
8779
8883
|
/* @__PURE__ */ jsxs36("div", { className: "ss-w-om-head", children: [
|
|
@@ -8800,7 +8904,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8800
8904
|
vm.competition ? /* @__PURE__ */ jsx40("span", { className: "ss-w-om-comp", children: vm.competition }) : null
|
|
8801
8905
|
] }) : null,
|
|
8802
8906
|
/* @__PURE__ */ jsx40("div", { className: "ss-w-om-sel", children: vm.selection }),
|
|
8803
|
-
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous:
|
|
8907
|
+
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous: opening, current, direction: vm.direction, ui }),
|
|
8804
8908
|
vm.geometry === null ? /* @__PURE__ */ jsx40("div", { className: "ss-w-om-empty", children: vm.observationCount === 1 ? ui?.singlePricePoint ?? "Only one price recorded so far for this selection." : ui?.notEnoughHistory ?? "No price history recorded yet for this selection." }) : /* @__PURE__ */ jsxs36(
|
|
8805
8909
|
"svg",
|
|
8806
8910
|
{
|
|
@@ -8812,7 +8916,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8812
8916
|
children: [
|
|
8813
8917
|
vm.geometry.gridlines.map((g) => /* @__PURE__ */ jsxs36("g", { children: [
|
|
8814
8918
|
/* @__PURE__ */ jsx40("line", { className: "ss-w-om-grid", x1: 40, y1: g.y, x2: CHART_VIEW_W - 8, y2: g.y }),
|
|
8815
|
-
/* @__PURE__ */ jsx40("text", { className: "ss-w-om-ylab", x: 34, y: g.y + 3, textAnchor: "end", children: g.
|
|
8919
|
+
/* @__PURE__ */ jsx40("text", { className: "ss-w-om-ylab", x: 34, y: g.y + 3, textAnchor: "end", children: formatOdds(g.forms, oddsFormat) })
|
|
8816
8920
|
] }, g.price)),
|
|
8817
8921
|
/* @__PURE__ */ jsx40("path", { className: "ss-w-om-line", d: vm.geometry.path, fill: "none" }),
|
|
8818
8922
|
vm.geometry.markers.map((m, i) => /* @__PURE__ */ jsx40("circle", { className: "ss-w-om-dot", cx: m.x, cy: m.y, r: 2.5 }, i)),
|
|
@@ -8827,12 +8931,12 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8827
8931
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8828
8932
|
ui?.openingLabel ?? "Opening",
|
|
8829
8933
|
" ",
|
|
8830
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
8934
|
+
/* @__PURE__ */ jsx40("b", { children: opening })
|
|
8831
8935
|
] }),
|
|
8832
8936
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8833
8937
|
ui?.currentLabel ?? "Current",
|
|
8834
8938
|
" ",
|
|
8835
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
8939
|
+
/* @__PURE__ */ jsx40("b", { children: current })
|
|
8836
8940
|
] })
|
|
8837
8941
|
] }),
|
|
8838
8942
|
vm.bookmaker ? /* @__PURE__ */ jsx40("div", { className: "ss-w-om-foot", children: /* @__PURE__ */ jsx40("span", { children: vm.bookmaker }) }) : null,
|
|
@@ -8950,7 +9054,7 @@ function FixtureCard({ card }) {
|
|
|
8950
9054
|
}
|
|
8951
9055
|
|
|
8952
9056
|
// src/components/dashboard/CountdownCard.tsx
|
|
8953
|
-
import { Fragment as Fragment12, useEffect as
|
|
9057
|
+
import { Fragment as Fragment12, useEffect as useEffect27, useState as useState34 } from "react";
|
|
8954
9058
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8955
9059
|
var DAY_MS = 864e5;
|
|
8956
9060
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -8969,12 +9073,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
8969
9073
|
function CountdownCard({ card }) {
|
|
8970
9074
|
const { data } = card;
|
|
8971
9075
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
8972
|
-
const [nowMs, setNowMs] =
|
|
8973
|
-
const [reduced] =
|
|
9076
|
+
const [nowMs, setNowMs] = useState34(() => Date.now());
|
|
9077
|
+
const [reduced] = useState34(
|
|
8974
9078
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
8975
9079
|
);
|
|
8976
9080
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS;
|
|
8977
|
-
|
|
9081
|
+
useEffect27(() => {
|
|
8978
9082
|
if (reduced) return;
|
|
8979
9083
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
8980
9084
|
return () => window.clearInterval(id);
|
|
@@ -8993,7 +9097,7 @@ function CountdownCard({ card }) {
|
|
|
8993
9097
|
}
|
|
8994
9098
|
|
|
8995
9099
|
// src/components/dashboard/InjuriesCard.tsx
|
|
8996
|
-
import { useState as
|
|
9100
|
+
import { useState as useState35 } from "react";
|
|
8997
9101
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8998
9102
|
var SHOWN = 3;
|
|
8999
9103
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9004,8 +9108,8 @@ function ColHead({ name, crestUrl }) {
|
|
|
9004
9108
|
}
|
|
9005
9109
|
function InjuryList({ rows, emptyLabel, limit }) {
|
|
9006
9110
|
if (rows.length === 0) return /* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injuries-empty", children: emptyLabel });
|
|
9007
|
-
const
|
|
9008
|
-
return /* @__PURE__ */ jsx44("ul", { className: "ss-w-fandash-injury-list", children:
|
|
9111
|
+
const shown2 = limit === void 0 ? rows : rows.slice(0, limit);
|
|
9112
|
+
return /* @__PURE__ */ jsx44("ul", { className: "ss-w-fandash-injury-list", children: shown2.map((r, i) => /* @__PURE__ */ jsxs40("li", { className: "ss-w-fandash-injury-row", children: [
|
|
9009
9113
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-name", children: r.playerName }),
|
|
9010
9114
|
/* @__PURE__ */ jsxs40("span", { className: "ss-w-fandash-injury-meta", children: [
|
|
9011
9115
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-status", children: r.status }),
|
|
@@ -9016,7 +9120,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9016
9120
|
}
|
|
9017
9121
|
function InjuriesCard({ card, ui }) {
|
|
9018
9122
|
const { data } = card;
|
|
9019
|
-
const [expanded, setExpanded] =
|
|
9123
|
+
const [expanded, setExpanded] = useState35(false);
|
|
9020
9124
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9021
9125
|
const limit = expanded ? void 0 : SHOWN;
|
|
9022
9126
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
@@ -9122,7 +9226,7 @@ function LinksCard({ card }) {
|
|
|
9122
9226
|
}
|
|
9123
9227
|
|
|
9124
9228
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9125
|
-
import { useState as
|
|
9229
|
+
import { useState as useState36 } from "react";
|
|
9126
9230
|
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9127
9231
|
function initials3(name) {
|
|
9128
9232
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9132,7 +9236,7 @@ function PostMatchCrest({
|
|
|
9132
9236
|
name,
|
|
9133
9237
|
side
|
|
9134
9238
|
}) {
|
|
9135
|
-
const [failed, setFailed] =
|
|
9239
|
+
const [failed, setFailed] = useState36(false);
|
|
9136
9240
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9137
9241
|
if (url && !failed) {
|
|
9138
9242
|
return /* @__PURE__ */ jsx50("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9331,10 +9435,10 @@ function RestingFormCard({ card }) {
|
|
|
9331
9435
|
}
|
|
9332
9436
|
|
|
9333
9437
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9334
|
-
import { useRef as useRef23, useState as
|
|
9438
|
+
import { useRef as useRef23, useState as useState38 } from "react";
|
|
9335
9439
|
|
|
9336
9440
|
// src/useLiveClock.ts
|
|
9337
|
-
import { useEffect as
|
|
9441
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
9338
9442
|
var TICK_MS = 6e4;
|
|
9339
9443
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9340
9444
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9343,10 +9447,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9343
9447
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9344
9448
|
}
|
|
9345
9449
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9346
|
-
const [displayMinute, setDisplayMinute] =
|
|
9450
|
+
const [displayMinute, setDisplayMinute] = useState37(
|
|
9347
9451
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9348
9452
|
);
|
|
9349
|
-
|
|
9453
|
+
useEffect28(() => {
|
|
9350
9454
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9351
9455
|
if (!clockRunning) return;
|
|
9352
9456
|
const id = window.setInterval(() => {
|
|
@@ -9363,7 +9467,7 @@ function initials5(name) {
|
|
|
9363
9467
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9364
9468
|
}
|
|
9365
9469
|
function LiveCrest({ url, name, side }) {
|
|
9366
|
-
const [failed, setFailed] =
|
|
9470
|
+
const [failed, setFailed] = useState38(false);
|
|
9367
9471
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9368
9472
|
if (url && !failed) {
|
|
9369
9473
|
return /* @__PURE__ */ jsx59("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9431,7 +9535,7 @@ function LiveScoreCard({
|
|
|
9431
9535
|
}
|
|
9432
9536
|
|
|
9433
9537
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
9434
|
-
import { useState as
|
|
9538
|
+
import { useState as useState39 } from "react";
|
|
9435
9539
|
import { jsx as jsx60, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
9436
9540
|
var SHOWN2 = 3;
|
|
9437
9541
|
function EventIcon({ type }) {
|
|
@@ -9473,17 +9577,17 @@ function EventRow({ e }) {
|
|
|
9473
9577
|
] });
|
|
9474
9578
|
}
|
|
9475
9579
|
function LiveTimelineCard({ card, ui }) {
|
|
9476
|
-
const [expanded, setExpanded] =
|
|
9580
|
+
const [expanded, setExpanded] = useState39(false);
|
|
9477
9581
|
const events = card.data.events;
|
|
9478
9582
|
if (!events || events.length === 0) return null;
|
|
9479
9583
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
9480
9584
|
const rest = sorted.length - SHOWN2;
|
|
9481
|
-
const
|
|
9585
|
+
const shown2 = expanded ? sorted : sorted.slice(0, SHOWN2);
|
|
9482
9586
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
9483
9587
|
const showLess = ui?.showLess ?? "Show less";
|
|
9484
9588
|
return /* @__PURE__ */ jsxs56("div", { className: "ss-w-fandash-card ss-w-fandash-live-timeline", children: [
|
|
9485
9589
|
card.title ? /* @__PURE__ */ jsx60("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
|
|
9486
|
-
/* @__PURE__ */ jsx60("div", { className: "ss-w-fandash-live-tl", children:
|
|
9590
|
+
/* @__PURE__ */ jsx60("div", { className: "ss-w-fandash-live-tl", children: shown2.map((e, i) => /* @__PURE__ */ jsx60(EventRow, { e }, `${e.minute}-${e.side}-${e.type}-${i}`)) }),
|
|
9487
9591
|
rest > 0 ? /* @__PURE__ */ jsx60(
|
|
9488
9592
|
"button",
|
|
9489
9593
|
{
|
|
@@ -9672,7 +9776,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
9672
9776
|
// src/components/ChatMessage.tsx
|
|
9673
9777
|
import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
9674
9778
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
9675
|
-
const [sport, setSport] =
|
|
9779
|
+
const [sport, setSport] = useState40(null);
|
|
9676
9780
|
if (message.role === "user") {
|
|
9677
9781
|
return /* @__PURE__ */ jsx64("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ jsx64("div", { className: "ss-w-bubble", children: message.text }) });
|
|
9678
9782
|
}
|
|
@@ -9721,11 +9825,12 @@ function turnAnchor(messages) {
|
|
|
9721
9825
|
}
|
|
9722
9826
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
9723
9827
|
const { state, send } = controller;
|
|
9828
|
+
const { oddsFormat } = useOddsSettings();
|
|
9724
9829
|
const listRef = useRef24(null);
|
|
9725
9830
|
const endRef = useRef24(null);
|
|
9726
9831
|
const pinnedRef = useRef24(true);
|
|
9727
9832
|
const anchoredTurnRef = useRef24(null);
|
|
9728
|
-
|
|
9833
|
+
useEffect29(() => {
|
|
9729
9834
|
const anchor = turnAnchor(state.messages);
|
|
9730
9835
|
const list = listRef.current;
|
|
9731
9836
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -9757,8 +9862,9 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9757
9862
|
disabled: state.isStreaming || isPaused(state.limit),
|
|
9758
9863
|
onAct: (a) => send(a.message, { actionId: a.actionId, actionRef: a.actionRef, displayText: a.label, source: "action" }),
|
|
9759
9864
|
onTap: (tile, index, onScreen) => {
|
|
9760
|
-
const
|
|
9761
|
-
|
|
9865
|
+
const shown2 = tileForFormat(tile, oddsFormat);
|
|
9866
|
+
const displayText2 = tileDisplayText(shown2);
|
|
9867
|
+
send(shown2.actionValue, shown2.actionRef ? { actionRef: shown2.actionRef, displayText: displayText2, source: "tile" } : { displayText: displayText2, source: "tile" });
|
|
9762
9868
|
if (m.role === "assistant" && m.greetingDashboard) onDashboardTap?.(tile, index, onScreen?.layout ?? m.greetingDashboard.layout, onScreen?.sport);
|
|
9763
9869
|
},
|
|
9764
9870
|
ui,
|
|
@@ -9782,10 +9888,10 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9782
9888
|
}
|
|
9783
9889
|
|
|
9784
9890
|
// src/components/ChatInput.tsx
|
|
9785
|
-
import { forwardRef, useEffect as
|
|
9891
|
+
import { forwardRef, useEffect as useEffect30, useImperativeHandle, useRef as useRef25, useState as useState41 } from "react";
|
|
9786
9892
|
import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
9787
|
-
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false
|
|
9788
|
-
const [value, setValue] =
|
|
9893
|
+
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false }, ref) {
|
|
9894
|
+
const [value, setValue] = useState41("");
|
|
9789
9895
|
const textareaRef = useRef25(null);
|
|
9790
9896
|
const stopRef = useRef25(null);
|
|
9791
9897
|
const textBoxWantsFocusRef = useRef25(false);
|
|
@@ -9814,7 +9920,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9814
9920
|
stopRef.current?.focus();
|
|
9815
9921
|
}
|
|
9816
9922
|
}), []);
|
|
9817
|
-
|
|
9923
|
+
useEffect30(() => {
|
|
9818
9924
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
9819
9925
|
textBoxWantsFocusRef.current = false;
|
|
9820
9926
|
const box = textareaRef.current;
|
|
@@ -9836,7 +9942,6 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9836
9942
|
disabled: streaming || disabled,
|
|
9837
9943
|
onChange: (e) => {
|
|
9838
9944
|
setValue(e.target.value);
|
|
9839
|
-
onType?.();
|
|
9840
9945
|
},
|
|
9841
9946
|
onKeyDown
|
|
9842
9947
|
}
|
|
@@ -9846,7 +9951,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9846
9951
|
});
|
|
9847
9952
|
|
|
9848
9953
|
// src/components/TabBar.tsx
|
|
9849
|
-
import { useEffect as
|
|
9954
|
+
import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect2, useRef as useRef26 } from "react";
|
|
9850
9955
|
import { Fragment as Fragment14, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
9851
9956
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true]];
|
|
9852
9957
|
function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -9867,7 +9972,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9867
9972
|
const track = useTrack();
|
|
9868
9973
|
const listRef = useRef26(null);
|
|
9869
9974
|
const activeTab = monitor.activeTab;
|
|
9870
|
-
|
|
9975
|
+
useEffect31(() => {
|
|
9871
9976
|
const el = listRef.current?.querySelector("[data-on]");
|
|
9872
9977
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
9873
9978
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -9928,7 +10033,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9928
10033
|
}
|
|
9929
10034
|
|
|
9930
10035
|
// src/components/MonitorTabs.tsx
|
|
9931
|
-
import { useMemo as
|
|
10036
|
+
import { useMemo as useMemo8 } from "react";
|
|
9932
10037
|
|
|
9933
10038
|
// src/components/MarketAccordion.tsx
|
|
9934
10039
|
import { slipSportOf as slipSportOf7 } from "@sensiblestats/widget-sdk";
|
|
@@ -9990,13 +10095,15 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
9990
10095
|
}
|
|
9991
10096
|
|
|
9992
10097
|
// src/components/LiveFactBlock.tsx
|
|
9993
|
-
import { useState as
|
|
10098
|
+
import { useState as useState42 } from "react";
|
|
9994
10099
|
import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
9995
10100
|
function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
9996
|
-
const [expanded, setExpanded] =
|
|
10101
|
+
const [expanded, setExpanded] = useState42(false);
|
|
10102
|
+
const { oddsFormat } = useOddsSettings();
|
|
9997
10103
|
const [current, ...earlier] = facts;
|
|
9998
10104
|
if (!current) return null;
|
|
9999
10105
|
const m = current.market;
|
|
10106
|
+
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
10000
10107
|
return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10001
10108
|
/* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
|
|
10002
10109
|
/* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
|
|
@@ -10015,12 +10122,11 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10015
10122
|
chipSelectionText(m)
|
|
10016
10123
|
] }),
|
|
10017
10124
|
/* @__PURE__ */ jsxs65("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10018
|
-
|
|
10125
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx70("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10019
10126
|
/* @__PURE__ */ jsx70(
|
|
10020
10127
|
SlipButton,
|
|
10021
10128
|
{
|
|
10022
10129
|
selection: chipSelection(m, matchId, slip.conversationId),
|
|
10023
|
-
shownOdds: typeof m.price === "number" ? m.price.toFixed(2) : "",
|
|
10024
10130
|
marketDeveloperName: m.marketDeveloperName,
|
|
10025
10131
|
selectionLabel: m.selectionLabel,
|
|
10026
10132
|
slip,
|
|
@@ -10061,7 +10167,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10061
10167
|
}
|
|
10062
10168
|
|
|
10063
10169
|
// src/components/MonitorFormH2H.tsx
|
|
10064
|
-
import { useState as
|
|
10170
|
+
import { useState as useState43 } from "react";
|
|
10065
10171
|
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
10066
10172
|
function resultClass2(result) {
|
|
10067
10173
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10077,7 +10183,7 @@ function FormDots({ form, ui }) {
|
|
|
10077
10183
|
return /* @__PURE__ */ jsx71("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ jsx71("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10078
10184
|
}
|
|
10079
10185
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10080
|
-
const [expanded, setExpanded] =
|
|
10186
|
+
const [expanded, setExpanded] = useState43(false);
|
|
10081
10187
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10082
10188
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10083
10189
|
return /* @__PURE__ */ jsx71(Fragment15, {});
|
|
@@ -10182,6 +10288,7 @@ function groupScorers(goals, ownGoalLabel) {
|
|
|
10182
10288
|
});
|
|
10183
10289
|
}
|
|
10184
10290
|
function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
10291
|
+
const { oddsFormat } = useOddsSettings();
|
|
10185
10292
|
const live = match.phase === "live";
|
|
10186
10293
|
const goals = match.events.filter((e) => e.type === "goal");
|
|
10187
10294
|
const homeScorers = groupScorers(goals.filter((e) => e.side === "home"), ui.ownGoalLabel);
|
|
@@ -10240,6 +10347,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10240
10347
|
const { home, away } = splitWidths2(row.homeNum, row.awayNum);
|
|
10241
10348
|
const promoted = isPromoted(row, promotedPins);
|
|
10242
10349
|
const selection = chipSelection(row.market, match.matchId, slip.conversationId);
|
|
10350
|
+
const chipPrice = row.market ? chipPriceText(row.market, oddsFormat) : void 0;
|
|
10243
10351
|
return /* @__PURE__ */ jsxs67("div", { className: promoted ? "ss-w-mon-stat ss-w-mon-pstrip" : "ss-w-mon-stat", children: [
|
|
10244
10352
|
/* @__PURE__ */ jsxs67("div", { className: "ss-w-mon-stat-row", children: [
|
|
10245
10353
|
/* @__PURE__ */ jsx72("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--home", children: row.homeValue }),
|
|
@@ -10257,12 +10365,11 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10257
10365
|
chipSelectionText(row.market)
|
|
10258
10366
|
] }),
|
|
10259
10367
|
/* @__PURE__ */ jsxs67("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10260
|
-
|
|
10368
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx72("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10261
10369
|
/* @__PURE__ */ jsx72(
|
|
10262
10370
|
SlipButton,
|
|
10263
10371
|
{
|
|
10264
10372
|
selection,
|
|
10265
|
-
shownOdds: typeof row.market.price === "number" ? row.market.price.toFixed(2) : "",
|
|
10266
10373
|
marketDeveloperName: row.market.marketDeveloperName,
|
|
10267
10374
|
selectionLabel: row.market.selectionLabel,
|
|
10268
10375
|
slip,
|
|
@@ -10308,10 +10415,10 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
10308
10415
|
import { SPORTS as SPORTS6 } from "@sensiblestats/widget-sdk";
|
|
10309
10416
|
|
|
10310
10417
|
// src/components/NbaPropsSection.tsx
|
|
10311
|
-
import { useState as
|
|
10418
|
+
import { useState as useState45 } from "react";
|
|
10312
10419
|
|
|
10313
10420
|
// src/components/PropsPieces.tsx
|
|
10314
|
-
import { useEffect as
|
|
10421
|
+
import { useEffect as useEffect32, useState as useState44 } from "react";
|
|
10315
10422
|
import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
10316
10423
|
var MAX_TIMER_MS = 2147483647;
|
|
10317
10424
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
@@ -10321,9 +10428,9 @@ function preKickoff(match) {
|
|
|
10321
10428
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
10322
10429
|
}
|
|
10323
10430
|
function usePreKickoff(match) {
|
|
10324
|
-
const [, setTick] =
|
|
10431
|
+
const [, setTick] = useState44(0);
|
|
10325
10432
|
const pre = preKickoff(match);
|
|
10326
|
-
|
|
10433
|
+
useEffect32(() => {
|
|
10327
10434
|
if (!pre || !match.kickoffUtc) return;
|
|
10328
10435
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
10329
10436
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -10336,7 +10443,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10336
10443
|
const pre = usePreKickoff(match);
|
|
10337
10444
|
const live = descriptor.sport === "basketball" && match.phase === "live";
|
|
10338
10445
|
const open = pre || live;
|
|
10339
|
-
|
|
10446
|
+
useEffect32(() => {
|
|
10340
10447
|
if (!open) return;
|
|
10341
10448
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
10342
10449
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -10344,12 +10451,14 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10344
10451
|
return { bundle: monitor.playerProps?.[monitorMatchKey(sport, match.matchId)]?.bundle, live, open };
|
|
10345
10452
|
}
|
|
10346
10453
|
function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip }) {
|
|
10347
|
-
const
|
|
10454
|
+
const { oddsFormat } = useOddsSettings();
|
|
10455
|
+
const shown2 = formatOdds(price.priceFormats, oddsFormat);
|
|
10348
10456
|
if (bundle.addToSlipEnabled && takesSport(slip, descriptor.sport)) {
|
|
10349
10457
|
const selection = {
|
|
10350
10458
|
matchOddsId: price.matchOddsId,
|
|
10351
10459
|
matchId: bundle.matchId,
|
|
10352
10460
|
oddsDecimal: price.price,
|
|
10461
|
+
forms: price.priceFormats,
|
|
10353
10462
|
quotedAtUtc: price.quotedAtUtc,
|
|
10354
10463
|
sport: descriptor.sport
|
|
10355
10464
|
};
|
|
@@ -10358,19 +10467,18 @@ function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip
|
|
|
10358
10467
|
SlipButton,
|
|
10359
10468
|
{
|
|
10360
10469
|
selection,
|
|
10361
|
-
shownOdds: shown,
|
|
10362
10470
|
marketDeveloperName: stat.marketDeveloperName,
|
|
10363
10471
|
selectionLabel: price.label,
|
|
10364
10472
|
line: price.line != null ? String(price.line) : void 0,
|
|
10365
10473
|
slip,
|
|
10366
10474
|
ui,
|
|
10367
|
-
price: { label, ariaLabel: `${ariaName ?? label}, ${
|
|
10475
|
+
price: { label, ariaLabel: `${ariaName ?? label}, ${shown2}` }
|
|
10368
10476
|
}
|
|
10369
10477
|
);
|
|
10370
10478
|
}
|
|
10371
10479
|
return /* @__PURE__ */ jsxs69("span", { className: "ss-w-props-price", children: [
|
|
10372
10480
|
label !== "" && /* @__PURE__ */ jsx74("span", { className: "ss-w-props-price-lab", children: label }),
|
|
10373
|
-
/* @__PURE__ */ jsx74("span", { children:
|
|
10481
|
+
/* @__PURE__ */ jsx74("span", { children: shown2 })
|
|
10374
10482
|
] });
|
|
10375
10483
|
}
|
|
10376
10484
|
function PriceCell({ hitsText, children }) {
|
|
@@ -10406,7 +10514,7 @@ function PropBars({ bars, line, title, wide, ui }) {
|
|
|
10406
10514
|
}
|
|
10407
10515
|
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10408
10516
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10409
|
-
const [picked, setPicked] =
|
|
10517
|
+
const [picked, setPicked] = useState44(null);
|
|
10410
10518
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10411
10519
|
const sample = active?.games?.length ?? 0;
|
|
10412
10520
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
@@ -10445,7 +10553,7 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10445
10553
|
] });
|
|
10446
10554
|
}
|
|
10447
10555
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10448
|
-
const [openId, setOpenId] =
|
|
10556
|
+
const [openId, setOpenId] = useState44(null);
|
|
10449
10557
|
return /* @__PURE__ */ jsx74("div", { className: "ss-w-props-list", children: players.map((p) => {
|
|
10450
10558
|
const isOpen = openId === p.playerId;
|
|
10451
10559
|
const main = descriptor.mainStat(p);
|
|
@@ -10498,21 +10606,21 @@ var nbaDescriptor = (ui) => ({
|
|
|
10498
10606
|
tenGameBars: false
|
|
10499
10607
|
});
|
|
10500
10608
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10501
|
-
const [side, setSide] =
|
|
10609
|
+
const [side, setSide] = useState45("home");
|
|
10502
10610
|
const descriptor = nbaDescriptor(ui);
|
|
10503
10611
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10504
10612
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10505
10613
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
10506
10614
|
const other = side === "home" ? "away" : "home";
|
|
10507
|
-
const
|
|
10615
|
+
const shown2 = bySide(side).length > 0 ? side : other;
|
|
10508
10616
|
const sides = [
|
|
10509
10617
|
{ side: "home", abbreviation: bundle.homeAbbreviation },
|
|
10510
10618
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10511
10619
|
];
|
|
10512
10620
|
return /* @__PURE__ */ jsxs70("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10513
10621
|
/* @__PURE__ */ jsx75("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10514
|
-
/* @__PURE__ */ jsx75("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ jsx75("button", { type: "button", className: "ss-w-props-side", "aria-pressed":
|
|
10515
|
-
/* @__PURE__ */ jsx75(PropRoster, { bundle, players: bySide(
|
|
10622
|
+
/* @__PURE__ */ jsx75("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ jsx75("button", { type: "button", className: "ss-w-props-side", "aria-pressed": shown2 === s.side, onClick: () => setSide(s.side), children: `${s.abbreviation} \xB7 ${bySide(s.side).length}` }, s.side)) }),
|
|
10623
|
+
/* @__PURE__ */ jsx75(PropRoster, { bundle, players: bySide(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10516
10624
|
] });
|
|
10517
10625
|
}
|
|
10518
10626
|
|
|
@@ -10642,7 +10750,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10642
10750
|
}
|
|
10643
10751
|
|
|
10644
10752
|
// src/components/NflFormSection.tsx
|
|
10645
|
-
import { useState as
|
|
10753
|
+
import { useState as useState46 } from "react";
|
|
10646
10754
|
import { Fragment as Fragment18, jsx as jsx77, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
10647
10755
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
10648
10756
|
var signedSpread = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -10694,7 +10802,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
10694
10802
|
] });
|
|
10695
10803
|
}
|
|
10696
10804
|
function NflFormSection({ match, monitor, ui }) {
|
|
10697
|
-
const [segment, setSegment] =
|
|
10805
|
+
const [segment, setSegment] = useState46("away");
|
|
10698
10806
|
const pre = usePreKickoff(match);
|
|
10699
10807
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
10700
10808
|
const form = bundle?.form;
|
|
@@ -10727,7 +10835,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
10727
10835
|
}
|
|
10728
10836
|
|
|
10729
10837
|
// src/components/NflPropsSection.tsx
|
|
10730
|
-
import { useState as
|
|
10838
|
+
import { useState as useState47 } from "react";
|
|
10731
10839
|
import { Fragment as Fragment19, jsx as jsx78, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
10732
10840
|
var TRENDS_SHOWN = 3;
|
|
10733
10841
|
var SCORERS_SHOWN = 8;
|
|
@@ -10795,11 +10903,11 @@ function ShowMore({ label, onClick }) {
|
|
|
10795
10903
|
return /* @__PURE__ */ jsx78("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
10796
10904
|
}
|
|
10797
10905
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
10798
|
-
const [all, setAll] =
|
|
10799
|
-
const
|
|
10906
|
+
const [all, setAll] = useState47(false);
|
|
10907
|
+
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
10800
10908
|
return /* @__PURE__ */ jsxs73("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
10801
10909
|
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
10802
|
-
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children:
|
|
10910
|
+
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children: shown2.map((f, i) => {
|
|
10803
10911
|
const long = LONG_KEYS[f.stat];
|
|
10804
10912
|
const bet = f.stat === "anytime_td" && f.at < 1 ? ui.nfl.statAnytimeTd : `${ui.nba.lineText(String(Math.ceil(f.at)))}+ ${long ? ui.nfl[long] : shortLabel(ui.nfl, f.stat)}`;
|
|
10805
10913
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-fact", children: [
|
|
@@ -10828,8 +10936,8 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
10828
10936
|
] });
|
|
10829
10937
|
}
|
|
10830
10938
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
10831
|
-
const [all, setAll] =
|
|
10832
|
-
const
|
|
10939
|
+
const [all, setAll] = useState47(false);
|
|
10940
|
+
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
10833
10941
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ jsx78(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ jsx78("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
10834
10942
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorers", children: [
|
|
10835
10943
|
/* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer ss-w-props-scorer-head", children: [
|
|
@@ -10838,7 +10946,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10838
10946
|
/* @__PURE__ */ jsx78("span", { children: "2+" }),
|
|
10839
10947
|
/* @__PURE__ */ jsx78("span", { children: ui.nfl.propsFirst })
|
|
10840
10948
|
] }),
|
|
10841
|
-
|
|
10949
|
+
shown2.map((s) => {
|
|
10842
10950
|
const sample = s.anytimeStat.games?.length ?? 0;
|
|
10843
10951
|
const meta = sample > 0 && s.anytime.hits != null ? `${abbreviations[s.player.side]} \xB7 ${fillNfl(ui.nfl.propsScoredIn, { h: s.anytime.hits, n: sample })}` : abbreviations[s.player.side];
|
|
10844
10952
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer", children: [
|
|
@@ -10855,7 +10963,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10855
10963
|
] });
|
|
10856
10964
|
}
|
|
10857
10965
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
10858
|
-
const [tab, setTab] =
|
|
10966
|
+
const [tab, setTab] = useState47(null);
|
|
10859
10967
|
const descriptor = nflDescriptor(ui);
|
|
10860
10968
|
const { bundle, open } = usePropsOpen(match, monitor, descriptor);
|
|
10861
10969
|
if (!open || !bundle || bundle.players.length === 0) return null;
|
|
@@ -10869,13 +10977,13 @@ function NflPropsSection({ match, monitor, ui, slip }) {
|
|
|
10869
10977
|
...scorers.length > 0 ? [{ key: "td", label: ui.nfl.propsScorers }] : []
|
|
10870
10978
|
];
|
|
10871
10979
|
const firstWithContent = roster("away").length > 0 ? "away" : roster("home").length > 0 ? "home" : scorers.length > 0 ? "td" : "away";
|
|
10872
|
-
const
|
|
10980
|
+
const shown2 = tab && tabs.some((t) => t.key === tab) ? tab : firstWithContent;
|
|
10873
10981
|
return /* @__PURE__ */ jsxs73(Fragment19, { children: [
|
|
10874
10982
|
facts.length > 0 && /* @__PURE__ */ jsx78(Trends, { bundle, facts, descriptor, ui, slip }),
|
|
10875
10983
|
/* @__PURE__ */ jsxs73("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10876
10984
|
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10877
|
-
/* @__PURE__ */ jsx78("div", { className: tabs.length === 3 ? "ss-w-props-seg ss-w-props-seg--3" : "ss-w-props-seg", children: tabs.map((t) => /* @__PURE__ */ jsx78("button", { type: "button", className: "ss-w-props-side", "aria-pressed":
|
|
10878
|
-
|
|
10985
|
+
/* @__PURE__ */ jsx78("div", { className: tabs.length === 3 ? "ss-w-props-seg ss-w-props-seg--3" : "ss-w-props-seg", children: tabs.map((t) => /* @__PURE__ */ jsx78("button", { type: "button", className: "ss-w-props-side", "aria-pressed": shown2 === t.key, onClick: () => setTab(t.key), children: t.label }, t.key)) }),
|
|
10986
|
+
shown2 === "td" ? /* @__PURE__ */ jsx78(Scorers, { bundle, scorers, abbreviations, descriptor, ui, slip }) : /* @__PURE__ */ jsx78(PropRoster, { bundle, players: roster(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10879
10987
|
] })
|
|
10880
10988
|
] });
|
|
10881
10989
|
}
|
|
@@ -10960,7 +11068,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10960
11068
|
}
|
|
10961
11069
|
|
|
10962
11070
|
// src/components/ScoreboardStrip.tsx
|
|
10963
|
-
import { useEffect as
|
|
11071
|
+
import { useEffect as useEffect33, useRef as useRef27 } from "react";
|
|
10964
11072
|
import { SPORTS as SPORTS7, sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
10965
11073
|
import { jsx as jsx80, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
10966
11074
|
function nbaStatus(m, ui) {
|
|
@@ -11036,7 +11144,7 @@ function rowsFor(m) {
|
|
|
11036
11144
|
}
|
|
11037
11145
|
function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
11038
11146
|
const stripRef = useRef27(null);
|
|
11039
|
-
|
|
11147
|
+
useEffect33(() => {
|
|
11040
11148
|
const strip = stripRef.current;
|
|
11041
11149
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
11042
11150
|
if (!strip || !pressed) return;
|
|
@@ -11148,7 +11256,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
11148
11256
|
] });
|
|
11149
11257
|
}
|
|
11150
11258
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
11151
|
-
const seedIndex =
|
|
11259
|
+
const seedIndex = useMemo8(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
11152
11260
|
const tiles = orderTiles(
|
|
11153
11261
|
monitor.pins,
|
|
11154
11262
|
monitor.snapshot,
|
|
@@ -11180,11 +11288,11 @@ function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
|
11180
11288
|
}
|
|
11181
11289
|
function withSinceViewMovement(vm, prev) {
|
|
11182
11290
|
const primary = vm.mainRows[0];
|
|
11183
|
-
if (prev === void 0 || !primary || primary.oddsDecimal === void 0 || primary.oddsDecimal === prev) return vm;
|
|
11291
|
+
if (prev === void 0 || !primary || primary.oddsDecimal === void 0 || primary.oddsDecimal === prev.value) return vm;
|
|
11184
11292
|
const updatedPrimary = {
|
|
11185
11293
|
...primary,
|
|
11186
|
-
|
|
11187
|
-
movementDirection: primary.oddsDecimal < prev ? "shortened" : "drifted"
|
|
11294
|
+
previousPriceForms: prev.forms,
|
|
11295
|
+
movementDirection: primary.oddsDecimal < prev.value ? "shortened" : "drifted"
|
|
11188
11296
|
};
|
|
11189
11297
|
return { ...vm, mainRows: [updatedPrimary, ...vm.mainRows.slice(1)] };
|
|
11190
11298
|
}
|
|
@@ -11214,7 +11322,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
11214
11322
|
}
|
|
11215
11323
|
|
|
11216
11324
|
// src/components/TodayPanel.tsx
|
|
11217
|
-
import { useEffect as
|
|
11325
|
+
import { useEffect as useEffect35, useId as useId2, useMemo as useMemo9, useState as useState50 } from "react";
|
|
11218
11326
|
import { matchKey as matchKey7 } from "@sensiblestats/widget-sdk";
|
|
11219
11327
|
|
|
11220
11328
|
// src/placement.ts
|
|
@@ -11279,9 +11387,9 @@ function matchingFixtures(group, query) {
|
|
|
11279
11387
|
}
|
|
11280
11388
|
|
|
11281
11389
|
// src/useStarTap.ts
|
|
11282
|
-
import { useCallback as useCallback21, useRef as useRef28, useState as
|
|
11390
|
+
import { useCallback as useCallback21, useRef as useRef28, useState as useState48 } from "react";
|
|
11283
11391
|
function useStarTap(starLeague) {
|
|
11284
|
-
const [pendingId, setPendingId] =
|
|
11392
|
+
const [pendingId, setPendingId] = useState48(null);
|
|
11285
11393
|
const pendingRef = useRef28(null);
|
|
11286
11394
|
const tap = useCallback21(async (competitionId, next) => {
|
|
11287
11395
|
if (pendingRef.current !== null) return false;
|
|
@@ -11342,7 +11450,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
11342
11450
|
}
|
|
11343
11451
|
|
|
11344
11452
|
// src/components/LeagueDetail.tsx
|
|
11345
|
-
import { useEffect as
|
|
11453
|
+
import { useEffect as useEffect34, useState as useState49 } from "react";
|
|
11346
11454
|
import { matchKey as matchKey5 } from "@sensiblestats/widget-sdk";
|
|
11347
11455
|
|
|
11348
11456
|
// src/components/FixtureRow.tsx
|
|
@@ -11405,11 +11513,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
11405
11513
|
import { jsx as jsx84, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
11406
11514
|
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";
|
|
11407
11515
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
11408
|
-
const [toast, setToast] =
|
|
11409
|
-
|
|
11516
|
+
const [toast, setToast] = useState49(null);
|
|
11517
|
+
useEffect34(() => {
|
|
11410
11518
|
setToast(null);
|
|
11411
11519
|
}, [group.competitionId]);
|
|
11412
|
-
|
|
11520
|
+
useEffect34(() => {
|
|
11413
11521
|
if (toast === null) return;
|
|
11414
11522
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11415
11523
|
return () => clearTimeout(id);
|
|
@@ -11505,8 +11613,8 @@ var STAR_PATH3 = "M12 2.5l2.9 5.9 6.5.95-4.7 4.58 1.1 6.47L12 17.35 6.1 20.4l1.1
|
|
|
11505
11613
|
function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starClickable2, disambiguate, onOpen, starTap, ui, monitor }) {
|
|
11506
11614
|
const sorted = group.matches.filter((m) => !isTreatedLive(states.get(matchKey6(m.sport, m.matchId)), stale)).sort((a, b) => a.kickoffUnix - b.kickoffUnix);
|
|
11507
11615
|
if (sorted.length === 0) return null;
|
|
11508
|
-
const
|
|
11509
|
-
const overflow = sorted.length -
|
|
11616
|
+
const shown2 = sorted.slice(0, cap2);
|
|
11617
|
+
const overflow = sorted.length - shown2.length;
|
|
11510
11618
|
const onStarClick = () => {
|
|
11511
11619
|
void starTap.tap(group.competitionId, !group.isStarred);
|
|
11512
11620
|
};
|
|
@@ -11546,7 +11654,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
|
|
|
11546
11654
|
}
|
|
11547
11655
|
)
|
|
11548
11656
|
] }),
|
|
11549
|
-
/* @__PURE__ */ jsx85("div", { className: "ss-w-today-rowgroup-rows", children:
|
|
11657
|
+
/* @__PURE__ */ jsx85("div", { className: "ss-w-today-rowgroup-rows", children: shown2.map((m) => /* @__PURE__ */ jsx85(
|
|
11550
11658
|
FixtureRow,
|
|
11551
11659
|
{
|
|
11552
11660
|
match: m,
|
|
@@ -11647,22 +11755,22 @@ import { Fragment as Fragment22, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-
|
|
|
11647
11755
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
11648
11756
|
const { groups, states, stale, starLeague } = discovery;
|
|
11649
11757
|
const searchId = useId2();
|
|
11650
|
-
const [query, setQuery] =
|
|
11651
|
-
const [selectedCompetitionId, setSelectedCompetitionId] =
|
|
11652
|
-
const [toast, setToast] =
|
|
11653
|
-
|
|
11758
|
+
const [query, setQuery] = useState50("");
|
|
11759
|
+
const [selectedCompetitionId, setSelectedCompetitionId] = useState50(null);
|
|
11760
|
+
const [toast, setToast] = useState50(null);
|
|
11761
|
+
useEffect35(() => {
|
|
11654
11762
|
if (toast === null) return;
|
|
11655
11763
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11656
11764
|
return () => clearTimeout(id);
|
|
11657
11765
|
}, [toast]);
|
|
11658
11766
|
const visibleGroups = visibleGroupsOf(groups, states);
|
|
11659
|
-
const pinnedMatchIds =
|
|
11767
|
+
const pinnedMatchIds = useMemo9(
|
|
11660
11768
|
() => footballMatchPinIds(monitor.pins),
|
|
11661
11769
|
[monitor.pins]
|
|
11662
11770
|
);
|
|
11663
|
-
const placement =
|
|
11771
|
+
const placement = useMemo9(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
|
|
11664
11772
|
const starTap = useStarTap(starLeague);
|
|
11665
|
-
const gridStarTap =
|
|
11773
|
+
const gridStarTap = useMemo9(() => ({
|
|
11666
11774
|
pendingId: starTap.pendingId,
|
|
11667
11775
|
tap: async (competitionId, next) => {
|
|
11668
11776
|
const ok = await starTap.tap(competitionId, next);
|
|
@@ -11696,7 +11804,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11696
11804
|
}
|
|
11697
11805
|
const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
|
|
11698
11806
|
const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
|
|
11699
|
-
|
|
11807
|
+
useEffect35(() => {
|
|
11700
11808
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
11701
11809
|
}, [selectedCompetitionId, openGroup]);
|
|
11702
11810
|
const liveRows = stale ? [] : visibleGroups.flatMap((group) => group.matches.filter((m) => isTreatedLive(states.get(matchKey7(m.sport, m.matchId)), stale)).map((match) => ({ match, rank: group.rank }))).sort((a, b) => a.rank - b.rank);
|
|
@@ -11852,7 +11960,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11852
11960
|
}
|
|
11853
11961
|
|
|
11854
11962
|
// src/components/GamesPanel.tsx
|
|
11855
|
-
import { useEffect as
|
|
11963
|
+
import { useEffect as useEffect39, useState as useState65 } from "react";
|
|
11856
11964
|
|
|
11857
11965
|
// src/components/GamesLoginWall.tsx
|
|
11858
11966
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
@@ -11861,7 +11969,7 @@ function GamesLoginWall({ ui }) {
|
|
|
11861
11969
|
}
|
|
11862
11970
|
|
|
11863
11971
|
// src/components/GamesHub.tsx
|
|
11864
|
-
import { useEffect as
|
|
11972
|
+
import { useEffect as useEffect36, useState as useState51 } from "react";
|
|
11865
11973
|
|
|
11866
11974
|
// src/components/games/ui/gameMeta.ts
|
|
11867
11975
|
function prettifyGameId(gameId) {
|
|
@@ -12012,8 +12120,8 @@ function pickHeroGame(games) {
|
|
|
12012
12120
|
}
|
|
12013
12121
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
12014
12122
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
12015
|
-
const [, setTick] =
|
|
12016
|
-
|
|
12123
|
+
const [, setTick] = useState51(0);
|
|
12124
|
+
useEffect36(() => {
|
|
12017
12125
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
12018
12126
|
return () => clearInterval(id);
|
|
12019
12127
|
}, []);
|
|
@@ -12073,10 +12181,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
12073
12181
|
}
|
|
12074
12182
|
|
|
12075
12183
|
// src/components/GameScreenHost.tsx
|
|
12076
|
-
import { useEffect as
|
|
12184
|
+
import { useEffect as useEffect38, useRef as useRef32, useState as useState63 } from "react";
|
|
12077
12185
|
|
|
12078
12186
|
// src/useGamePlay.ts
|
|
12079
|
-
import { useCallback as useCallback23, useRef as useRef30, useState as
|
|
12187
|
+
import { useCallback as useCallback23, useRef as useRef30, useState as useState52 } from "react";
|
|
12080
12188
|
function toSubmitResult(payload) {
|
|
12081
12189
|
return {
|
|
12082
12190
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -12088,9 +12196,9 @@ function toSubmitResult(payload) {
|
|
|
12088
12196
|
};
|
|
12089
12197
|
}
|
|
12090
12198
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
12091
|
-
const [result, setResult] =
|
|
12092
|
-
const [submitting, setSubmitting] =
|
|
12093
|
-
const [rawStatus, setRawStatus] =
|
|
12199
|
+
const [result, setResult] = useState52(null);
|
|
12200
|
+
const [submitting, setSubmitting] = useState52(false);
|
|
12201
|
+
const [rawStatus, setRawStatus] = useState52(null);
|
|
12094
12202
|
const inFlightRef = useRef30(false);
|
|
12095
12203
|
const convRef = useRef30(conversation);
|
|
12096
12204
|
convRef.current = conversation;
|
|
@@ -12148,7 +12256,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
12148
12256
|
}
|
|
12149
12257
|
|
|
12150
12258
|
// src/components/games/MysteryTigerGame.tsx
|
|
12151
|
-
import { useState as
|
|
12259
|
+
import { useState as useState54, useId as useId3 } from "react";
|
|
12152
12260
|
|
|
12153
12261
|
// src/components/games/nationFlags.ts
|
|
12154
12262
|
var FLAGS = {
|
|
@@ -12359,7 +12467,7 @@ function isNationCode(flag) {
|
|
|
12359
12467
|
}
|
|
12360
12468
|
|
|
12361
12469
|
// src/components/games/PlayerAvatar.tsx
|
|
12362
|
-
import { useState as
|
|
12470
|
+
import { useState as useState53 } from "react";
|
|
12363
12471
|
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
12364
12472
|
function initialsOf(name) {
|
|
12365
12473
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -12377,7 +12485,7 @@ function PlayerAvatar({
|
|
|
12377
12485
|
imagePath,
|
|
12378
12486
|
className
|
|
12379
12487
|
}) {
|
|
12380
|
-
const [failed, setFailed] =
|
|
12488
|
+
const [failed, setFailed] = useState53(false);
|
|
12381
12489
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
12382
12490
|
return /* @__PURE__ */ jsx94("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ jsx94("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ jsx94("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
12383
12491
|
}
|
|
@@ -12423,7 +12531,7 @@ function SegmentProgress({ segments, ariaLabel, leftLabel, rightLabel, right })
|
|
|
12423
12531
|
import { Fragment as Fragment26, jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
12424
12532
|
function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQuery, onPick, disabled, minQuery = 0 }) {
|
|
12425
12533
|
const needle = query.trim().toLowerCase();
|
|
12426
|
-
const
|
|
12534
|
+
const shown2 = needle.length < minQuery ? [] : needle ? options.filter((o) => o.name.toLowerCase().includes(needle)) : options;
|
|
12427
12535
|
return /* @__PURE__ */ jsxs89(Fragment26, { children: [
|
|
12428
12536
|
/* @__PURE__ */ jsx97(
|
|
12429
12537
|
SearchField,
|
|
@@ -12437,7 +12545,7 @@ function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQu
|
|
|
12437
12545
|
disabled
|
|
12438
12546
|
}
|
|
12439
12547
|
),
|
|
12440
|
-
|
|
12548
|
+
shown2.length > 0 && /* @__PURE__ */ jsx97("div", { className: "ss-g-tray", role: "listbox", "aria-label": optionsLabel, children: shown2.map((o) => {
|
|
12441
12549
|
const { first, last } = splitName(o.name);
|
|
12442
12550
|
return /* @__PURE__ */ jsxs89(
|
|
12443
12551
|
"button",
|
|
@@ -12618,7 +12726,7 @@ function MysteryTigerGame({
|
|
|
12618
12726
|
onBack
|
|
12619
12727
|
}) {
|
|
12620
12728
|
const t = ui.games.mysteryTiger;
|
|
12621
|
-
const [query, setQuery] =
|
|
12729
|
+
const [query, setQuery] = useState54("");
|
|
12622
12730
|
const inputId = useId3();
|
|
12623
12731
|
const clientState = parseClientState(result?.clientStateJson);
|
|
12624
12732
|
const guessResults = clientState?.guessResults ?? [];
|
|
@@ -12880,13 +12988,13 @@ function HigherOrLowerGame({
|
|
|
12880
12988
|
}
|
|
12881
12989
|
|
|
12882
12990
|
// src/components/games/CareerPathGame.tsx
|
|
12883
|
-
import { useState as
|
|
12991
|
+
import { useState as useState56, useId as useId4 } from "react";
|
|
12884
12992
|
|
|
12885
12993
|
// src/components/games/ui/CrestShield.tsx
|
|
12886
|
-
import { useState as
|
|
12994
|
+
import { useState as useState55 } from "react";
|
|
12887
12995
|
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
12888
12996
|
function CrestShield({ src, name, size = 28 }) {
|
|
12889
|
-
const [failed, setFailed] =
|
|
12997
|
+
const [failed, setFailed] = useState55(false);
|
|
12890
12998
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
12891
12999
|
return /* @__PURE__ */ jsx105("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
12892
13000
|
}
|
|
@@ -12918,7 +13026,7 @@ function CareerPathGame({
|
|
|
12918
13026
|
}) {
|
|
12919
13027
|
const s = ui.games.careerPath;
|
|
12920
13028
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
12921
|
-
const [query, setQuery] =
|
|
13029
|
+
const [query, setQuery] = useState56("");
|
|
12922
13030
|
const inputId = useId4();
|
|
12923
13031
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
12924
13032
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
@@ -13025,7 +13133,7 @@ function CareerPathGame({
|
|
|
13025
13133
|
}
|
|
13026
13134
|
|
|
13027
13135
|
// src/components/games/BeatTheGridGame.tsx
|
|
13028
|
-
import React, { useEffect as
|
|
13136
|
+
import React, { useEffect as useEffect37, useId as useId5, useRef as useRef31, useState as useState57 } from "react";
|
|
13029
13137
|
|
|
13030
13138
|
// src/components/games/ui/OptionList.tsx
|
|
13031
13139
|
import { jsx as jsx107 } from "react/jsx-runtime";
|
|
@@ -13114,10 +13222,10 @@ function SearchSheet({
|
|
|
13114
13222
|
ui
|
|
13115
13223
|
}) {
|
|
13116
13224
|
const s = ui.games.beatTheGrid;
|
|
13117
|
-
const [query, setQuery] =
|
|
13225
|
+
const [query, setQuery] = useState57("");
|
|
13118
13226
|
const inputId = useId5();
|
|
13119
13227
|
const inputRef = useRef31(null);
|
|
13120
|
-
|
|
13228
|
+
useEffect37(() => {
|
|
13121
13229
|
inputRef.current?.focus();
|
|
13122
13230
|
}, [row, col]);
|
|
13123
13231
|
const filtered = playerPool.filter(
|
|
@@ -13182,7 +13290,7 @@ function BeatTheGridGame({
|
|
|
13182
13290
|
}) {
|
|
13183
13291
|
const s = ui.games.beatTheGrid;
|
|
13184
13292
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
13185
|
-
const [activeCell, setActiveCell] =
|
|
13293
|
+
const [activeCell, setActiveCell] = useState57(null);
|
|
13186
13294
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
13187
13295
|
const filledCells = clientState?.cells ?? [];
|
|
13188
13296
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -13337,7 +13445,7 @@ function BeatTheGridGame({
|
|
|
13337
13445
|
}
|
|
13338
13446
|
|
|
13339
13447
|
// src/components/games/GuessTheXiGame.tsx
|
|
13340
|
-
import { useState as
|
|
13448
|
+
import { useState as useState58, useId as useId6 } from "react";
|
|
13341
13449
|
|
|
13342
13450
|
// src/components/games/ui/PitchSvg.tsx
|
|
13343
13451
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
@@ -13426,7 +13534,7 @@ function GuessTheXiGame({
|
|
|
13426
13534
|
onBack
|
|
13427
13535
|
}) {
|
|
13428
13536
|
const t = ui.games.guessTheXi;
|
|
13429
|
-
const [query, setQuery] =
|
|
13537
|
+
const [query, setQuery] = useState58("");
|
|
13430
13538
|
const inputId = useId6();
|
|
13431
13539
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
13432
13540
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
@@ -13569,7 +13677,7 @@ function GuessTheXiGame({
|
|
|
13569
13677
|
}
|
|
13570
13678
|
|
|
13571
13679
|
// src/components/games/DailyQuizGame.tsx
|
|
13572
|
-
import { useState as
|
|
13680
|
+
import { useState as useState59 } from "react";
|
|
13573
13681
|
import { Fragment as Fragment33, jsx as jsx111, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13574
13682
|
function parseClientState6(json) {
|
|
13575
13683
|
if (!json) return null;
|
|
@@ -13610,8 +13718,8 @@ function DailyQuizGame({
|
|
|
13610
13718
|
}) {
|
|
13611
13719
|
const s = ui.games.dailyQuiz;
|
|
13612
13720
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
13613
|
-
const [selections, setSelections] =
|
|
13614
|
-
const [page, setPage] =
|
|
13721
|
+
const [selections, setSelections] = useState59(/* @__PURE__ */ new Map());
|
|
13722
|
+
const [page, setPage] = useState59(0);
|
|
13615
13723
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
13616
13724
|
const results2 = clientState?.results ?? [];
|
|
13617
13725
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -13721,7 +13829,7 @@ function DailyQuizGame({
|
|
|
13721
13829
|
}
|
|
13722
13830
|
|
|
13723
13831
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
13724
|
-
import { useId as useId7, useState as
|
|
13832
|
+
import { useId as useId7, useState as useState60 } from "react";
|
|
13725
13833
|
import { jsx as jsx112, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
13726
13834
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
13727
13835
|
function parseClientState7(json) {
|
|
@@ -13817,11 +13925,11 @@ function MatchdayPredictorGame({
|
|
|
13817
13925
|
onBack
|
|
13818
13926
|
}) {
|
|
13819
13927
|
const t = ui.games.predictor;
|
|
13820
|
-
const [homeScore, setHomeScore] =
|
|
13821
|
-
const [awayScore, setAwayScore] =
|
|
13822
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] =
|
|
13823
|
-
const [lastEdited, setLastEdited] =
|
|
13824
|
-
const [query, setQuery] =
|
|
13928
|
+
const [homeScore, setHomeScore] = useState60(0);
|
|
13929
|
+
const [awayScore, setAwayScore] = useState60(0);
|
|
13930
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = useState60(null);
|
|
13931
|
+
const [lastEdited, setLastEdited] = useState60("home");
|
|
13932
|
+
const [query, setQuery] = useState60("");
|
|
13825
13933
|
const searchId = useId7();
|
|
13826
13934
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
13827
13935
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -13989,7 +14097,7 @@ function MatchdayPredictorGame({
|
|
|
13989
14097
|
}
|
|
13990
14098
|
|
|
13991
14099
|
// src/components/games/StartingXiGame.tsx
|
|
13992
|
-
import { useId as useId8, useState as
|
|
14100
|
+
import { useId as useId8, useState as useState61 } from "react";
|
|
13993
14101
|
import { Fragment as Fragment34, jsx as jsx113, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
13994
14102
|
var POINTS_PER_STARTER = 8;
|
|
13995
14103
|
var XI_SIZE = 11;
|
|
@@ -14033,9 +14141,9 @@ function StartingXiGame({
|
|
|
14033
14141
|
lockAtUtc
|
|
14034
14142
|
}) {
|
|
14035
14143
|
const t = ui.games.startingXi;
|
|
14036
|
-
const [slotPlayers, setSlotPlayers] =
|
|
14037
|
-
const [active, setActive] =
|
|
14038
|
-
const [query, setQuery] =
|
|
14144
|
+
const [slotPlayers, setSlotPlayers] = useState61(() => Array(XI_SIZE).fill(null));
|
|
14145
|
+
const [active, setActive] = useState61(0);
|
|
14146
|
+
const [query, setQuery] = useState61("");
|
|
14039
14147
|
const searchId = useId8();
|
|
14040
14148
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
14041
14149
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -14175,7 +14283,7 @@ function StartingXiGame({
|
|
|
14175
14283
|
}
|
|
14176
14284
|
|
|
14177
14285
|
// src/components/games/StatLadderGame.tsx
|
|
14178
|
-
import { useId as useId9, useState as
|
|
14286
|
+
import { useId as useId9, useState as useState62 } from "react";
|
|
14179
14287
|
import { jsx as jsx114, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
14180
14288
|
function ladderClue(ladder) {
|
|
14181
14289
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -14212,8 +14320,8 @@ function StatLadderGame({
|
|
|
14212
14320
|
onBack
|
|
14213
14321
|
}) {
|
|
14214
14322
|
const t = ui.games.statLadder;
|
|
14215
|
-
const [query, setQuery] =
|
|
14216
|
-
const [selectedId, setSelectedId] =
|
|
14323
|
+
const [query, setQuery] = useState62("");
|
|
14324
|
+
const [selectedId, setSelectedId] = useState62(null);
|
|
14217
14325
|
const searchId = useId9();
|
|
14218
14326
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
14219
14327
|
const revealed = clientState != null;
|
|
@@ -14420,8 +14528,8 @@ function GameScreenHost({
|
|
|
14420
14528
|
ui
|
|
14421
14529
|
}) {
|
|
14422
14530
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
14423
|
-
const [configJson, setConfigJson] =
|
|
14424
|
-
|
|
14531
|
+
const [configJson, setConfigJson] = useState63(null);
|
|
14532
|
+
useEffect38(() => {
|
|
14425
14533
|
setConfigJson(null);
|
|
14426
14534
|
if (!conversation) return;
|
|
14427
14535
|
let cancelled = false;
|
|
@@ -14444,12 +14552,12 @@ function GameScreenHost({
|
|
|
14444
14552
|
fixtureId: fixtureId || void 0,
|
|
14445
14553
|
locale: ui.games.lang
|
|
14446
14554
|
});
|
|
14447
|
-
|
|
14555
|
+
useEffect38(() => {
|
|
14448
14556
|
if (conversation) hydrate();
|
|
14449
14557
|
}, [conversation, gameId]);
|
|
14450
14558
|
const hydrateRef = useRef32(hydrate);
|
|
14451
14559
|
hydrateRef.current = hydrate;
|
|
14452
|
-
|
|
14560
|
+
useEffect38(() => {
|
|
14453
14561
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
14454
14562
|
if (rawStatus !== "pending") return;
|
|
14455
14563
|
const timerId = setInterval(() => {
|
|
@@ -14562,7 +14670,7 @@ function GameScreenHost({
|
|
|
14562
14670
|
}
|
|
14563
14671
|
|
|
14564
14672
|
// src/components/Leaderboard.tsx
|
|
14565
|
-
import { useState as
|
|
14673
|
+
import { useState as useState64 } from "react";
|
|
14566
14674
|
|
|
14567
14675
|
// src/components/LeaderboardRow.tsx
|
|
14568
14676
|
import { jsx as jsx117, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
@@ -14647,7 +14755,7 @@ function Leaderboard({
|
|
|
14647
14755
|
ui,
|
|
14648
14756
|
onPlay
|
|
14649
14757
|
}) {
|
|
14650
|
-
const [segment, setSegment] =
|
|
14758
|
+
const [segment, setSegment] = useState64("weekly");
|
|
14651
14759
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
14652
14760
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
14653
14761
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -14750,9 +14858,9 @@ function GamesPanel({
|
|
|
14750
14858
|
leaderboardLoading,
|
|
14751
14859
|
refreshHub
|
|
14752
14860
|
}) {
|
|
14753
|
-
const [selected, setSelected] =
|
|
14754
|
-
const [segment, setSegment] =
|
|
14755
|
-
|
|
14861
|
+
const [selected, setSelected] = useState65(null);
|
|
14862
|
+
const [segment, setSegment] = useState65("play");
|
|
14863
|
+
useEffect39(() => {
|
|
14756
14864
|
ensureGamesFonts();
|
|
14757
14865
|
}, []);
|
|
14758
14866
|
if (!loggedIn) return /* @__PURE__ */ jsx121(GamesLoginWall, { ui });
|
|
@@ -14816,10 +14924,10 @@ function GamesPanel({
|
|
|
14816
14924
|
}
|
|
14817
14925
|
|
|
14818
14926
|
// src/components/FavouritesPanel.tsx
|
|
14819
|
-
import { useEffect as
|
|
14927
|
+
import { useEffect as useEffect42, useRef as useRef34, useState as useState68 } from "react";
|
|
14820
14928
|
|
|
14821
14929
|
// src/components/FavouriteChips.tsx
|
|
14822
|
-
import { useEffect as
|
|
14930
|
+
import { useEffect as useEffect40, useState as useState66 } from "react";
|
|
14823
14931
|
import { Fragment as Fragment36, jsx as jsx122, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
14824
14932
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
14825
14933
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -14865,12 +14973,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
14865
14973
|
] });
|
|
14866
14974
|
}
|
|
14867
14975
|
function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
14868
|
-
const [confirming, setConfirming] =
|
|
14976
|
+
const [confirming, setConfirming] = useState66(false);
|
|
14869
14977
|
const data = controller.data;
|
|
14870
|
-
|
|
14978
|
+
useEffect40(() => {
|
|
14871
14979
|
setConfirming(false);
|
|
14872
14980
|
}, [sport]);
|
|
14873
|
-
|
|
14981
|
+
useEffect40(() => {
|
|
14874
14982
|
if (!confirming) return;
|
|
14875
14983
|
const onPointerDown = (e) => {
|
|
14876
14984
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -14924,21 +15032,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
|
14924
15032
|
}
|
|
14925
15033
|
|
|
14926
15034
|
// src/components/FavouritesSearch.tsx
|
|
14927
|
-
import { useEffect as
|
|
15035
|
+
import { useEffect as useEffect41, useRef as useRef33, useState as useState67 } from "react";
|
|
14928
15036
|
import { jsx as jsx123, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
14929
15037
|
var MIN_LETTERS = 2;
|
|
14930
15038
|
var MAX_LENGTH = 64;
|
|
14931
15039
|
var DEBOUNCE_MS = 250;
|
|
14932
15040
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
14933
|
-
const [query, setQuery] =
|
|
14934
|
-
const [answer, setAnswer] =
|
|
15041
|
+
const [query, setQuery] = useState67("");
|
|
15042
|
+
const [answer, setAnswer] = useState67(null);
|
|
14935
15043
|
const controllerRef = useRef33(controller);
|
|
14936
15044
|
controllerRef.current = controller;
|
|
14937
15045
|
const trimmed = query.trim();
|
|
14938
15046
|
const queryKey = `${sport}|${trimmed}`;
|
|
14939
15047
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
14940
15048
|
const settled = answer?.key === queryKey;
|
|
14941
|
-
|
|
15049
|
+
useEffect41(() => {
|
|
14942
15050
|
setAnswer(null);
|
|
14943
15051
|
if (trimmed.length < MIN_LETTERS) return;
|
|
14944
15052
|
let cancelled = false;
|
|
@@ -15003,13 +15111,13 @@ function capitalised(sport) {
|
|
|
15003
15111
|
return sport.charAt(0).toUpperCase() + sport.slice(1);
|
|
15004
15112
|
}
|
|
15005
15113
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
15006
|
-
const [notice, setNotice] =
|
|
15114
|
+
const [notice, setNotice] = useState68(null);
|
|
15007
15115
|
const refreshRef = useRef34(controller.refresh);
|
|
15008
15116
|
refreshRef.current = controller.refresh;
|
|
15009
|
-
|
|
15117
|
+
useEffect42(() => {
|
|
15010
15118
|
void refreshRef.current();
|
|
15011
15119
|
}, []);
|
|
15012
|
-
|
|
15120
|
+
useEffect42(() => {
|
|
15013
15121
|
setNotice(null);
|
|
15014
15122
|
}, [sport]);
|
|
15015
15123
|
const sportLabel = sports.find((s) => s.sport === sport)?.label ?? capitalised(sport);
|
|
@@ -15273,10 +15381,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
15273
15381
|
}
|
|
15274
15382
|
|
|
15275
15383
|
// src/components/PlayerPhoto.tsx
|
|
15276
|
-
import { useState as
|
|
15384
|
+
import { useState as useState69 } from "react";
|
|
15277
15385
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
15278
15386
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
15279
|
-
const [failed, setFailed] =
|
|
15387
|
+
const [failed, setFailed] = useState69(false);
|
|
15280
15388
|
const box = { width: size, height: size };
|
|
15281
15389
|
if (photoUrl && !failed) {
|
|
15282
15390
|
return /* @__PURE__ */ jsx129("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -15311,7 +15419,7 @@ function MiniPitch({ positionCode }) {
|
|
|
15311
15419
|
}
|
|
15312
15420
|
|
|
15313
15421
|
// src/components/PerformanceBars.tsx
|
|
15314
|
-
import { useState as
|
|
15422
|
+
import { useState as useState70 } from "react";
|
|
15315
15423
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
15316
15424
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
15317
15425
|
function finite3(v) {
|
|
@@ -15357,7 +15465,7 @@ function unrankedLine(ui, reason) {
|
|
|
15357
15465
|
}
|
|
15358
15466
|
}
|
|
15359
15467
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
15360
|
-
const [mode, setMode] =
|
|
15468
|
+
const [mode, setMode] = useState70("total");
|
|
15361
15469
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
15362
15470
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
15363
15471
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -15528,54 +15636,17 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
15528
15636
|
] });
|
|
15529
15637
|
}
|
|
15530
15638
|
|
|
15531
|
-
// src/components/PresetSpeedDial.tsx
|
|
15532
|
-
import { useId as useId10 } from "react";
|
|
15533
|
-
import { jsx as jsx133, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
15534
|
-
function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
|
|
15535
|
-
const pillsId = useId10();
|
|
15536
|
-
const tabIndex = expanded ? 0 : -1;
|
|
15537
|
-
return /* @__PURE__ */ jsxs117("div", { ref: rootRef, className: "ss-w-dial", children: [
|
|
15538
|
-
/* @__PURE__ */ jsxs117(
|
|
15539
|
-
"button",
|
|
15540
|
-
{
|
|
15541
|
-
ref: buttonRef,
|
|
15542
|
-
type: "button",
|
|
15543
|
-
className: "ss-w-dial-btn",
|
|
15544
|
-
"aria-expanded": expanded,
|
|
15545
|
-
"aria-controls": pillsId,
|
|
15546
|
-
"aria-label": strings.dialName,
|
|
15547
|
-
onClick: onToggle,
|
|
15548
|
-
children: [
|
|
15549
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-icon ss-w-dial-icon--open", children: /* @__PURE__ */ jsx133(SlidersIcon, {}) }),
|
|
15550
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-icon ss-w-dial-icon--close", children: /* @__PURE__ */ jsx133(CloseIcon, {}) }),
|
|
15551
|
-
showDot && !expanded ? /* @__PURE__ */ jsx133("span", { className: "ss-w-dial-dot", "aria-hidden": "true" }) : null
|
|
15552
|
-
]
|
|
15553
|
-
}
|
|
15554
|
-
),
|
|
15555
|
-
/* @__PURE__ */ jsxs117("div", { id: pillsId, className: "ss-w-dial-pills", "data-open": expanded ? "" : void 0, children: [
|
|
15556
|
-
/* @__PURE__ */ jsxs117("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("numbers"), children: [
|
|
15557
|
-
/* @__PURE__ */ jsx133(SlidersIcon, {}),
|
|
15558
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-pill-label", children: strings.setNumbers })
|
|
15559
|
-
] }),
|
|
15560
|
-
/* @__PURE__ */ jsxs117("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("combo"), children: [
|
|
15561
|
-
/* @__PURE__ */ jsx133(ComboIcon, {}),
|
|
15562
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-pill-label", children: strings.buildCombo })
|
|
15563
|
-
] })
|
|
15564
|
-
] })
|
|
15565
|
-
] });
|
|
15566
|
-
}
|
|
15567
|
-
|
|
15568
15639
|
// src/components/PresetTools.tsx
|
|
15569
|
-
import {
|
|
15570
|
-
import { Fragment as
|
|
15640
|
+
import { useEffect as useEffect43, useId as useId10, useRef as useRef35, useState as useState71 } from "react";
|
|
15641
|
+
import { Fragment as Fragment39, jsx as jsx133, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
15571
15642
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
15572
|
-
function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
15643
|
+
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
15573
15644
|
const dialogRef = useRef35(null);
|
|
15574
|
-
const titleId =
|
|
15575
|
-
|
|
15576
|
-
dialogRef.current?.focus();
|
|
15645
|
+
const titleId = useId10();
|
|
15646
|
+
useEffect43(() => {
|
|
15647
|
+
dialogRef.current?.focus({ preventScroll: true });
|
|
15577
15648
|
}, []);
|
|
15578
|
-
|
|
15649
|
+
useEffect43(() => {
|
|
15579
15650
|
const onKey = (e) => {
|
|
15580
15651
|
if (e.key !== "Escape") return;
|
|
15581
15652
|
e.stopPropagation();
|
|
@@ -15605,358 +15676,125 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
|
15605
15676
|
first.focus();
|
|
15606
15677
|
}
|
|
15607
15678
|
};
|
|
15608
|
-
return /* @__PURE__ */
|
|
15609
|
-
/* @__PURE__ */
|
|
15610
|
-
/* @__PURE__ */
|
|
15611
|
-
/* @__PURE__ */
|
|
15679
|
+
return /* @__PURE__ */ jsx133("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ jsxs117("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
|
|
15680
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-head", children: [
|
|
15681
|
+
/* @__PURE__ */ jsx133("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
15682
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx133(CloseIcon, {}) })
|
|
15612
15683
|
] }),
|
|
15613
|
-
/* @__PURE__ */
|
|
15614
|
-
footer ? /* @__PURE__ */
|
|
15684
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-body", children }),
|
|
15685
|
+
footer ? /* @__PURE__ */ jsx133("div", { className: "ss-w-tool-foot", children: footer }) : null
|
|
15615
15686
|
] }) });
|
|
15616
15687
|
}
|
|
15617
|
-
function fillTemplate(template, slots) {
|
|
15618
|
-
return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
|
|
15619
|
-
const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
|
|
15620
|
-
return /* @__PURE__ */ jsx134(Fragment39, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
|
|
15621
|
-
});
|
|
15622
|
-
}
|
|
15623
|
-
function NumberSelect({ current, choices: choices2, label, notToday, lockEmpty = true, onChoose }) {
|
|
15624
|
-
const selected = Math.max(0, choices2.findIndex((c) => c.text === current));
|
|
15625
|
-
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15626
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: current }),
|
|
15627
|
-
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(selected), onChange: (e) => {
|
|
15628
|
-
const c = choices2[Number(e.target.value)];
|
|
15629
|
-
if (c) onChoose(c.value);
|
|
15630
|
-
}, children: choices2.map((c, i) => /* @__PURE__ */ jsx134("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, i)) })
|
|
15631
|
-
] });
|
|
15632
|
-
}
|
|
15633
|
-
function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
|
|
15634
|
-
const sizeText = sizeLabels[currentIdx] ?? "";
|
|
15635
|
-
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15636
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
|
|
15637
|
-
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(currentIdx), onChange: (e) => onChoose(Number(e.target.value)), children: optionLabels.map((opt, i) => /* @__PURE__ */ jsx134("option", { value: String(i), children: opt }, i)) })
|
|
15638
|
-
] });
|
|
15639
|
-
}
|
|
15640
15688
|
function SendButton({ label, display, disabled, onClick }) {
|
|
15641
|
-
return /* @__PURE__ */
|
|
15689
|
+
return /* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
|
|
15642
15690
|
}
|
|
15643
15691
|
function PickList({ picks, formatKickoff }) {
|
|
15644
|
-
|
|
15645
|
-
|
|
15692
|
+
const { oddsFormat } = useOddsSettings();
|
|
15693
|
+
return /* @__PURE__ */ jsx133("ul", { className: "ss-w-tool-picks", role: "list", children: picks.map((p) => /* @__PURE__ */ jsxs117("li", { className: "ss-w-tool-pick", children: [
|
|
15694
|
+
/* @__PURE__ */ jsxs117("span", { className: "ss-w-tool-pick-match", children: [
|
|
15646
15695
|
p.homeTeamName,
|
|
15647
15696
|
" \u2013 ",
|
|
15648
15697
|
p.awayTeamName
|
|
15649
15698
|
] }),
|
|
15650
|
-
/* @__PURE__ */
|
|
15699
|
+
/* @__PURE__ */ jsxs117("span", { className: "ss-w-tool-pick-sel", children: [
|
|
15651
15700
|
p.marketLabel,
|
|
15652
15701
|
": ",
|
|
15653
15702
|
p.selectionLabel,
|
|
15654
15703
|
p.line ? ` ${p.line}` : ""
|
|
15655
15704
|
] }),
|
|
15656
|
-
/* @__PURE__ */
|
|
15657
|
-
/* @__PURE__ */
|
|
15705
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
|
|
15706
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-pick-price", children: formatOdds(p.priceFormats, oddsFormat) })
|
|
15658
15707
|
] }, p.matchOddsId)) });
|
|
15659
15708
|
}
|
|
15660
15709
|
function ComboPreview({ cell: cell2, formatKickoff }) {
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
/* @__PURE__ */
|
|
15710
|
+
const { oddsFormat } = useOddsSettings();
|
|
15711
|
+
return /* @__PURE__ */ jsxs117(Fragment39, { children: [
|
|
15712
|
+
/* @__PURE__ */ jsx133(PickList, { picks: cell2.combo.legs, formatKickoff }),
|
|
15713
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-math", children: oddsFormat === "decimal" ? cell2.combo.multiplication : formatOdds(cell2.combo.totalFormats, oddsFormat) })
|
|
15664
15714
|
] });
|
|
15665
15715
|
}
|
|
15666
15716
|
function Unavailable({ text }) {
|
|
15667
|
-
return /* @__PURE__ */
|
|
15668
|
-
}
|
|
15669
|
-
function AskRow({ icon, ask, ready, send }) {
|
|
15670
|
-
return /* @__PURE__ */ jsxs118("section", { className: "ss-w-tool-row ss-w-tool-row--ask", children: [
|
|
15671
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-icon", "aria-hidden": "true", children: icon }),
|
|
15672
|
-
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-main", children: [
|
|
15673
|
-
/* @__PURE__ */ jsx134("p", { className: "ss-w-tool-ask", children: ask }),
|
|
15674
|
-
ready ? /* @__PURE__ */ jsx134("span", { className: "ss-w-tool-ready", children: ready }) : null
|
|
15675
|
-
] }),
|
|
15676
|
-
send
|
|
15677
|
-
] });
|
|
15678
|
-
}
|
|
15679
|
-
function RoundSend({ label, display, disabled, onClick }) {
|
|
15680
|
-
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ jsx134(SendIcon, {}) });
|
|
15681
|
-
}
|
|
15682
|
-
var BIG_COMBO = { total: 50, legs: 6 };
|
|
15683
|
-
function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
15684
|
-
const limits = singlesLimits(grid);
|
|
15685
|
-
const floors = singlesFloors(grid);
|
|
15686
|
-
const totals = comboTotals(grid);
|
|
15687
|
-
const legChoices = comboLegChoices(grid);
|
|
15688
|
-
const count = FIXED_SINGLES_COUNT;
|
|
15689
|
-
const [maxPrice, setMaxPrice] = useState70(() => startSingles(grid.singles, limits, START.maxPrice, count));
|
|
15690
|
-
const [minPrice, setMinPrice] = useState70(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
|
|
15691
|
-
const [start] = useState70(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
|
|
15692
|
-
const [total, setTotal] = useState70(start.total);
|
|
15693
|
-
const [legs, setLegs] = useState70(start.legs);
|
|
15694
|
-
const [bigStart] = useState70(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
|
|
15695
|
-
const [bigTotal, setBigTotal] = useState70(bigStart.total);
|
|
15696
|
-
const [bigLegs, setBigLegs] = useState70(bigStart.legs);
|
|
15697
|
-
const [announcement, setAnnouncement] = useState70("");
|
|
15698
|
-
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
15699
|
-
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
15700
|
-
const comboCell = findCombo(grid, total, legs);
|
|
15701
|
-
const bigCell = findCombo(grid, bigTotal, bigLegs);
|
|
15702
|
-
const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
|
|
15703
|
-
const chooseMarket = (idx) => {
|
|
15704
|
-
setMarketIdx(idx);
|
|
15705
|
-
const cell2 = markets[idx];
|
|
15706
|
-
if (cell2) announce(marketDisplay(cell2, strings), cell2.count > 0);
|
|
15707
|
-
};
|
|
15708
|
-
const chooseMax = (v) => {
|
|
15709
|
-
setMaxPrice(v);
|
|
15710
|
-
announce(strings.maxPriceDisplay(count, v), !!findSingles(grid.singles, v, count));
|
|
15711
|
-
};
|
|
15712
|
-
const chooseMin = (v) => {
|
|
15713
|
-
setMinPrice(v);
|
|
15714
|
-
announce(strings.minPriceDisplay(count, v), !!findSingles(grid.singlesFrom, v, count));
|
|
15715
|
-
};
|
|
15716
|
-
const chooseLegs = (v) => {
|
|
15717
|
-
setLegs(v);
|
|
15718
|
-
announce(strings.comboDisplay(v, total), !!findCombo(grid, total, v));
|
|
15719
|
-
};
|
|
15720
|
-
const chooseTotal = (v) => {
|
|
15721
|
-
const l = legsForTotal(grid, v, legs);
|
|
15722
|
-
setTotal(v);
|
|
15723
|
-
setLegs(l);
|
|
15724
|
-
announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
|
|
15725
|
-
};
|
|
15726
|
-
const chooseBigLegs = (v) => {
|
|
15727
|
-
setBigLegs(v);
|
|
15728
|
-
announce(strings.comboDisplay(v, bigTotal), !!findCombo(grid, bigTotal, v));
|
|
15729
|
-
};
|
|
15730
|
-
const chooseBigTotal = (v) => {
|
|
15731
|
-
const l = legsForTotal(grid, v, bigLegs);
|
|
15732
|
-
setBigTotal(v);
|
|
15733
|
-
setBigLegs(l);
|
|
15734
|
-
announce(strings.comboDisplay(l, v), !!findCombo(grid, v, l));
|
|
15735
|
-
};
|
|
15736
|
-
const maxChoices = limits.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singles, v, count) }));
|
|
15737
|
-
const minChoices = floors.map((v) => ({ value: v, text: v.toFixed(2), available: !!findSingles(grid.singlesFrom, v, count) }));
|
|
15738
|
-
const totalChoices = totals.map((v) => ({ value: v, text: v.toFixed(1), available: legChoices.some((n) => !!findCombo(grid, v, n)) }));
|
|
15739
|
-
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
15740
|
-
const markets = grid.markets ?? [];
|
|
15741
|
-
const [marketIdx, setMarketIdx] = useState70(0);
|
|
15742
|
-
const marketCell = markets[marketIdx] ?? null;
|
|
15743
|
-
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
15744
|
-
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
15745
|
-
const comboReady = (cell2) => cell2 ? strings.readyAt(cell2.combo.total) : strings.unavailable;
|
|
15746
|
-
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
15747
|
-
/* @__PURE__ */ jsx134(
|
|
15748
|
-
AskRow,
|
|
15749
|
-
{
|
|
15750
|
-
icon: "\u{1F3AF}",
|
|
15751
|
-
ask: fillTemplate(strings.maxPriceRow, {
|
|
15752
|
-
count: String(count),
|
|
15753
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice.toFixed(2), choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
|
|
15754
|
-
}),
|
|
15755
|
-
ready: singlesReady(maxCell),
|
|
15756
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, maxPrice), disabled: !maxCell || streaming, onClick: () => {
|
|
15757
|
-
if (maxCell) onSend(maxPriceAsk(maxCell, strings));
|
|
15758
|
-
} })
|
|
15759
|
-
}
|
|
15760
|
-
),
|
|
15761
|
-
/* @__PURE__ */ jsx134(
|
|
15762
|
-
AskRow,
|
|
15763
|
-
{
|
|
15764
|
-
icon: "\u{1F4C8}",
|
|
15765
|
-
ask: fillTemplate(strings.minPriceRow, {
|
|
15766
|
-
count: String(count),
|
|
15767
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice.toFixed(2), choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
|
|
15768
|
-
}),
|
|
15769
|
-
ready: singlesReady(minCell),
|
|
15770
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, minPrice), disabled: !minCell || streaming, onClick: () => {
|
|
15771
|
-
if (minCell) onSend(minPriceAsk(minCell, strings));
|
|
15772
|
-
} })
|
|
15773
|
-
}
|
|
15774
|
-
),
|
|
15775
|
-
/* @__PURE__ */ jsx134(
|
|
15776
|
-
AskRow,
|
|
15777
|
-
{
|
|
15778
|
-
icon: "\u2728",
|
|
15779
|
-
ask: fillTemplate(strings.comboRow, {
|
|
15780
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current: String(legs), choices: legChoicesFor(total), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
|
|
15781
|
-
total: /* @__PURE__ */ jsx134(NumberSelect, { current: total.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
|
|
15782
|
-
}),
|
|
15783
|
-
ready: comboReady(comboCell),
|
|
15784
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, total), disabled: !comboCell || streaming, onClick: () => {
|
|
15785
|
-
if (comboCell) onSend(comboAsk(comboCell, strings));
|
|
15786
|
-
} })
|
|
15787
|
-
}
|
|
15788
|
-
),
|
|
15789
|
-
/* @__PURE__ */ jsx134(
|
|
15790
|
-
AskRow,
|
|
15791
|
-
{
|
|
15792
|
-
icon: "\u{1F3C6}",
|
|
15793
|
-
ask: fillTemplate(strings.bigComboRow, {
|
|
15794
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current: String(bigLegs), choices: legChoicesFor(bigTotal), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseBigLegs }),
|
|
15795
|
-
total: /* @__PURE__ */ jsx134(NumberSelect, { current: bigTotal.toFixed(1), choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseBigTotal })
|
|
15796
|
-
}),
|
|
15797
|
-
ready: comboReady(bigCell),
|
|
15798
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, bigTotal), disabled: !bigCell || streaming, onClick: () => {
|
|
15799
|
-
if (bigCell) onSend(comboAsk(bigCell, strings));
|
|
15800
|
-
} })
|
|
15801
|
-
}
|
|
15802
|
-
),
|
|
15803
|
-
markets.length > 0 && /* @__PURE__ */ jsx134(
|
|
15804
|
-
AskRow,
|
|
15805
|
-
{
|
|
15806
|
-
icon: "\u26BD",
|
|
15807
|
-
ask: fillTemplate(strings.marketRow, {
|
|
15808
|
-
market: /* @__PURE__ */ jsx134(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
|
|
15809
|
-
}),
|
|
15810
|
-
ready: marketCell ? strings.readyCount(marketCell.count) : null,
|
|
15811
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
|
|
15812
|
-
if (marketCell) onSend(marketAsk(marketCell, strings));
|
|
15813
|
-
} })
|
|
15814
|
-
}
|
|
15815
|
-
),
|
|
15816
|
-
/* @__PURE__ */ jsx134("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
15817
|
-
] });
|
|
15717
|
+
return /* @__PURE__ */ jsx133("p", { className: "ss-w-tool-unavailable", children: text });
|
|
15818
15718
|
}
|
|
15719
|
+
var textOf = (options, value, format2) => {
|
|
15720
|
+
const o = options.find((x) => samePrice(x.value, value));
|
|
15721
|
+
return o ? formatOdds(o.formats, format2) : "";
|
|
15722
|
+
};
|
|
15819
15723
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
15820
|
-
const
|
|
15724
|
+
const { oddsFormat } = useOddsSettings();
|
|
15725
|
+
const totalOptions = comboTotals(grid);
|
|
15726
|
+
const totals = totalOptions.map((o) => o.value);
|
|
15821
15727
|
const legChoices = comboLegChoices(grid);
|
|
15822
|
-
const [
|
|
15823
|
-
const [
|
|
15824
|
-
const [
|
|
15825
|
-
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
15826
|
-
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
15827
|
-
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
15828
|
-
});
|
|
15829
|
-
const [announcement, setAnnouncement] = useState70("");
|
|
15728
|
+
const [total, setTotal] = useState71(() => nearest(totals, initialTotal));
|
|
15729
|
+
const [legs, setLegs] = useState71(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
15730
|
+
const [announcement, setAnnouncement] = useState71("");
|
|
15830
15731
|
const cell2 = findCombo(grid, total, legs);
|
|
15831
15732
|
const minLegs = legChoices[0] ?? legs;
|
|
15832
15733
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
15833
|
-
const display = strings.comboDisplay(legs, total);
|
|
15734
|
+
const display = strings.comboDisplay(legs, textOf(totalOptions, total, oddsFormat));
|
|
15834
15735
|
const choose = (nextTotal, nextLegs) => {
|
|
15835
15736
|
setTotal(nextTotal);
|
|
15836
15737
|
setLegs(nextLegs);
|
|
15837
|
-
const d = strings.comboDisplay(nextLegs, nextTotal);
|
|
15738
|
+
const d = strings.comboDisplay(nextLegs, textOf(totalOptions, nextTotal, oddsFormat));
|
|
15838
15739
|
setAnnouncement(findCombo(grid, nextTotal, nextLegs) ? d : `${d}. ${strings.unavailable}`);
|
|
15839
15740
|
};
|
|
15840
|
-
const footer = /* @__PURE__ */
|
|
15841
|
-
if (cell2) onSend(comboAsk(cell2, strings));
|
|
15741
|
+
const footer = /* @__PURE__ */ jsx133(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
|
|
15742
|
+
if (cell2) onSend(comboAsk(cell2, strings, oddsFormat));
|
|
15842
15743
|
} });
|
|
15843
|
-
return /* @__PURE__ */
|
|
15844
|
-
/* @__PURE__ */
|
|
15845
|
-
/* @__PURE__ */
|
|
15846
|
-
/* @__PURE__ */
|
|
15744
|
+
return /* @__PURE__ */ jsxs117(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
|
|
15745
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
|
|
15746
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
|
|
15747
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-chips", children: totalOptions.map((o) => /* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(o.value, total), onClick: () => choose(o.value, samePrice(o.value, total) ? legs : legsForTotal(grid, o.value, legs)), children: formatOdds(o.formats, oddsFormat) }, o.key)) })
|
|
15847
15748
|
] }),
|
|
15848
|
-
/* @__PURE__ */
|
|
15849
|
-
/* @__PURE__ */
|
|
15850
|
-
/* @__PURE__ */
|
|
15851
|
-
/* @__PURE__ */
|
|
15852
|
-
/* @__PURE__ */
|
|
15853
|
-
/* @__PURE__ */
|
|
15749
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
|
|
15750
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
|
|
15751
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-stepper", children: [
|
|
15752
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.fewerMatches, disabled: legs <= minLegs, onClick: () => choose(total, legs - 1), children: "\u2212" }),
|
|
15753
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-count", children: legs }),
|
|
15754
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.moreMatches, disabled: legs >= maxLegs, onClick: () => choose(total, legs + 1), children: "+" })
|
|
15854
15755
|
] })
|
|
15855
15756
|
] }),
|
|
15856
|
-
cell2 ? /* @__PURE__ */
|
|
15857
|
-
/* @__PURE__ */
|
|
15757
|
+
cell2 ? /* @__PURE__ */ jsx133(ComboPreview, { cell: cell2, formatKickoff }) : /* @__PURE__ */ jsx133(Unavailable, { text: strings.unavailable }),
|
|
15758
|
+
/* @__PURE__ */ jsx133("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
15858
15759
|
] });
|
|
15859
15760
|
}
|
|
15860
15761
|
|
|
15861
|
-
// src/
|
|
15862
|
-
import {
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
}
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
expandedRef.current = expanded;
|
|
15894
|
-
useEffect43(() => {
|
|
15895
|
-
const onEscape = (e) => {
|
|
15896
|
-
const dial = dialRef.current;
|
|
15897
|
-
if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
|
|
15898
|
-
e.stopPropagation();
|
|
15899
|
-
e.preventDefault();
|
|
15900
|
-
if (!expandedRef.current) return;
|
|
15901
|
-
setExpanded(false);
|
|
15902
|
-
dialButtonRef.current?.focus();
|
|
15903
|
-
};
|
|
15904
|
-
window.addEventListener("keydown", onEscape, true);
|
|
15905
|
-
return () => window.removeEventListener("keydown", onEscape, true);
|
|
15906
|
-
}, [dialRef, dialButtonRef]);
|
|
15907
|
-
useEffect43(() => {
|
|
15908
|
-
if (!expanded) return;
|
|
15909
|
-
const layer = layerRef.current;
|
|
15910
|
-
const inDial = (e) => {
|
|
15911
|
-
const dial = dialRef.current;
|
|
15912
|
-
return !!dial && e.composedPath().includes(dial);
|
|
15913
|
-
};
|
|
15914
|
-
const inList = (e) => e.composedPath().some((n) => n instanceof Element && n.classList.contains("ss-w-list"));
|
|
15915
|
-
const onPress = (e) => {
|
|
15916
|
-
if (!inDial(e)) setExpanded(false);
|
|
15917
|
-
};
|
|
15918
|
-
const onScrollGesture = (e) => {
|
|
15919
|
-
if (inList(e) && !inDial(e)) setExpanded(false);
|
|
15920
|
-
};
|
|
15921
|
-
const onKey = (e) => {
|
|
15922
|
-
if (SCROLL_KEYS.has(e.key) && inList(e)) setExpanded(false);
|
|
15923
|
-
};
|
|
15924
|
-
const doc = layer?.ownerDocument ?? document;
|
|
15925
|
-
doc.addEventListener("pointerdown", onPress, true);
|
|
15926
|
-
layer?.addEventListener("wheel", onScrollGesture, { passive: true });
|
|
15927
|
-
layer?.addEventListener("touchmove", onScrollGesture, { passive: true });
|
|
15928
|
-
window.addEventListener("keydown", onKey, true);
|
|
15929
|
-
return () => {
|
|
15930
|
-
doc.removeEventListener("pointerdown", onPress, true);
|
|
15931
|
-
layer?.removeEventListener("wheel", onScrollGesture);
|
|
15932
|
-
layer?.removeEventListener("touchmove", onScrollGesture);
|
|
15933
|
-
window.removeEventListener("keydown", onKey, true);
|
|
15934
|
-
};
|
|
15935
|
-
}, [expanded, layerRef, dialRef]);
|
|
15936
|
-
return { expanded, toggle, fold: fold2 };
|
|
15937
|
-
}
|
|
15938
|
-
|
|
15939
|
-
// src/presetSeen.ts
|
|
15940
|
-
var KEY = "ss-w-presets-tool-opened";
|
|
15941
|
-
var openedThisPage = false;
|
|
15942
|
-
function readToolSeen() {
|
|
15943
|
-
if (openedThisPage) return true;
|
|
15944
|
-
try {
|
|
15945
|
-
return window.localStorage.getItem(KEY) === "1";
|
|
15946
|
-
} catch {
|
|
15947
|
-
return false;
|
|
15948
|
-
}
|
|
15949
|
-
}
|
|
15950
|
-
function markToolSeen() {
|
|
15951
|
-
openedThisPage = true;
|
|
15952
|
-
try {
|
|
15953
|
-
window.localStorage.setItem(KEY, "1");
|
|
15954
|
-
} catch {
|
|
15955
|
-
}
|
|
15762
|
+
// src/components/SettingsSheet.tsx
|
|
15763
|
+
import { jsx as jsx134, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
15764
|
+
var SAMPLE = { decimal: "2.50", american: "+150", fractional: "3/2" };
|
|
15765
|
+
var ODDS = ["decimal", "fractional", "american"];
|
|
15766
|
+
var THEMES2 = ["light", "dark", "auto"];
|
|
15767
|
+
function SettingsSheet({ ui, onClose }) {
|
|
15768
|
+
const s = useOddsSettings();
|
|
15769
|
+
const t = ui.settings;
|
|
15770
|
+
return /* @__PURE__ */ jsxs118(
|
|
15771
|
+
PresetToolModal,
|
|
15772
|
+
{
|
|
15773
|
+
title: t.title,
|
|
15774
|
+
closeLabel: t.close,
|
|
15775
|
+
onClose,
|
|
15776
|
+
className: "ss-w-set-backdrop-in",
|
|
15777
|
+
footer: /* @__PURE__ */ jsx134("p", { className: "ss-w-set-foot", children: t.foot }),
|
|
15778
|
+
children: [
|
|
15779
|
+
s.oddsOffered && /* @__PURE__ */ jsxs118("div", { className: "ss-w-set-row", children: [
|
|
15780
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-label", id: "ss-w-set-odds", children: t.oddsLabel }),
|
|
15781
|
+
/* @__PURE__ */ jsxs118("div", { className: "ss-w-set-sample", children: [
|
|
15782
|
+
/* @__PURE__ */ jsx134("span", { children: t.sampleLabel }),
|
|
15783
|
+
/* @__PURE__ */ jsx134("b", { children: formatOdds(SAMPLE, s.oddsFormat) })
|
|
15784
|
+
] }),
|
|
15785
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-odds", children: ODDS.map((f) => /* @__PURE__ */ jsx134("button", { type: "button", "aria-pressed": s.oddsFormat === f, onClick: () => s.setOddsFormat(f), children: t[f] }, f)) })
|
|
15786
|
+
] }),
|
|
15787
|
+
!s.themeLocked && /* @__PURE__ */ jsxs118("div", { className: "ss-w-set-row", children: [
|
|
15788
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-label", id: "ss-w-set-theme", children: t.themeLabel }),
|
|
15789
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-theme", children: THEMES2.map((m) => /* @__PURE__ */ jsx134("button", { type: "button", "aria-pressed": s.theme === m, onClick: () => s.setTheme(m), children: t[m] }, m)) })
|
|
15790
|
+
] })
|
|
15791
|
+
]
|
|
15792
|
+
}
|
|
15793
|
+
);
|
|
15956
15794
|
}
|
|
15957
15795
|
|
|
15958
15796
|
// src/components/ChatPanel.tsx
|
|
15959
|
-
import { Fragment as
|
|
15797
|
+
import { Fragment as Fragment40, jsx as jsx135, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
15960
15798
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
15961
15799
|
function useIsModal() {
|
|
15962
15800
|
const [modal, setModal] = useState72(false);
|
|
@@ -15972,20 +15810,14 @@ function useIsModal() {
|
|
|
15972
15810
|
}
|
|
15973
15811
|
var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
|
|
15974
15812
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
15975
|
-
function hasPersonalBuilder(messages) {
|
|
15976
|
-
return messages.some((m) => m.role === "assistant" && (!!m.greetingDashboard?.personal?.builder || !!m.greetingDashboards?.some((s) => !!s.dashboard.personal?.builder)));
|
|
15977
|
-
}
|
|
15978
|
-
function greetingInFlight(messages) {
|
|
15979
|
-
return messages.some((m) => m.role === "assistant" && m.isGreeting === true && !m.done);
|
|
15980
|
-
}
|
|
15981
15813
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites }) {
|
|
15982
15814
|
const { state, close, stop, send, reset } = controller;
|
|
15983
15815
|
const [squadView, setSquadView] = useState72("roster");
|
|
15984
15816
|
const [selectedPlayerId, setSelectedPlayerId] = useState72(null);
|
|
15985
15817
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
15986
15818
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
15987
|
-
const squadLayerRef =
|
|
15988
|
-
const squadScrollRef =
|
|
15819
|
+
const squadLayerRef = useRef36(null);
|
|
15820
|
+
const squadScrollRef = useRef36(null);
|
|
15989
15821
|
const selectPlayer = (playerId) => {
|
|
15990
15822
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
15991
15823
|
setSelectedPlayerId(playerId);
|
|
@@ -16016,7 +15848,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16016
15848
|
const closeTab = monitor?.activeTab ?? "chat";
|
|
16017
15849
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
16018
15850
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
16019
|
-
const closeWith =
|
|
15851
|
+
const closeWith = useCallback24((method) => {
|
|
16020
15852
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
16021
15853
|
close();
|
|
16022
15854
|
}, [track, closeTab, answering, close]);
|
|
@@ -16040,27 +15872,24 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16040
15872
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
16041
15873
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
16042
15874
|
const onChatTab = !monitor || monitor.activeTab === "chat";
|
|
16043
|
-
const
|
|
16044
|
-
const
|
|
16045
|
-
const
|
|
16046
|
-
const
|
|
16047
|
-
const limitRef = useRef37(null);
|
|
16048
|
-
const typedSendRef = useRef37(false);
|
|
16049
|
-
const focusAfterCloseRef = useRef37(null);
|
|
15875
|
+
const inputRef = useRef36(null);
|
|
15876
|
+
const limitRef = useRef36(null);
|
|
15877
|
+
const typedSendRef = useRef36(false);
|
|
15878
|
+
const focusAfterCloseRef = useRef36(null);
|
|
16050
15879
|
const [tool, setTool] = useState72(null);
|
|
16051
|
-
const
|
|
16052
|
-
const
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
15880
|
+
const panelRef = useRef36(null);
|
|
15881
|
+
const settings = useOddsSettings();
|
|
15882
|
+
const [settingsOpen, setSettingsOpen] = useState72(false);
|
|
15883
|
+
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
15884
|
+
const openSettings = useCallback24(() => {
|
|
15885
|
+
setTool(null);
|
|
15886
|
+
setSettingsOpen(true);
|
|
15887
|
+
}, []);
|
|
15888
|
+
const closeSettings = useCallback24(() => {
|
|
15889
|
+
setSettingsOpen(false);
|
|
15890
|
+
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
15891
|
+
}, []);
|
|
16061
15892
|
const paused = isPaused(state.limit);
|
|
16062
|
-
const dialWanted = !!presetGrid && !greetingInFlight(state.messages) && !hasPersonalBuilder(state.messages);
|
|
16063
|
-
const showDial = dialWanted && onChatTab && !tool && !paused;
|
|
16064
15893
|
useEffect44(() => {
|
|
16065
15894
|
if (paused) setTool(null);
|
|
16066
15895
|
}, [paused]);
|
|
@@ -16069,28 +15898,24 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16069
15898
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
16070
15899
|
typedSendRef.current = false;
|
|
16071
15900
|
}, [paused]);
|
|
16072
|
-
const openTool =
|
|
16073
|
-
fold2();
|
|
16074
|
-
markToolSeen();
|
|
16075
|
-
setToolSeen(true);
|
|
15901
|
+
const openTool = useCallback24((next) => {
|
|
16076
15902
|
setTool(next);
|
|
16077
|
-
}, [
|
|
16078
|
-
const
|
|
16079
|
-
|
|
16080
|
-
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
15903
|
+
}, []);
|
|
15904
|
+
const toolsValue = useMemo10(
|
|
15905
|
+
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
16081
15906
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
16082
15907
|
);
|
|
16083
|
-
const closeTool =
|
|
16084
|
-
focusAfterCloseRef.current = "
|
|
15908
|
+
const closeTool = useCallback24(() => {
|
|
15909
|
+
focusAfterCloseRef.current = "composer";
|
|
16085
15910
|
setTool(null);
|
|
16086
15911
|
}, []);
|
|
16087
|
-
const sendAsk =
|
|
15912
|
+
const sendAsk = useCallback24((ask) => {
|
|
16088
15913
|
focusAfterCloseRef.current = "composer";
|
|
16089
15914
|
setTool(null);
|
|
16090
15915
|
monitor?.setActiveTab("chat");
|
|
16091
15916
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
16092
15917
|
}, [monitor, send]);
|
|
16093
|
-
const formatKickoff =
|
|
15918
|
+
const formatKickoff = useCallback24((kickoffUtc) => {
|
|
16094
15919
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
16095
15920
|
return `${k.dayLabel} ${k.time}`;
|
|
16096
15921
|
}, [ui]);
|
|
@@ -16098,15 +15923,14 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16098
15923
|
if (tool) return;
|
|
16099
15924
|
const target = focusAfterCloseRef.current;
|
|
16100
15925
|
focusAfterCloseRef.current = null;
|
|
16101
|
-
if (target === "
|
|
16102
|
-
else if (target === "composer") inputRef.current?.focus();
|
|
15926
|
+
if (target === "composer") inputRef.current?.focus();
|
|
16103
15927
|
}, [tool]);
|
|
16104
15928
|
useEffect44(() => {
|
|
16105
15929
|
if (!tool || onChatTab && presetGrid) return;
|
|
16106
15930
|
focusAfterCloseRef.current = "composer";
|
|
16107
15931
|
setTool(null);
|
|
16108
15932
|
}, [tool, onChatTab, presetGrid]);
|
|
16109
|
-
return /* @__PURE__ */ jsxs119("div", { className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
15933
|
+
return /* @__PURE__ */ jsxs119("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
16110
15934
|
/* @__PURE__ */ jsx135(
|
|
16111
15935
|
ChatHeader,
|
|
16112
15936
|
{
|
|
@@ -16117,7 +15941,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16117
15941
|
onNewConversation: reset,
|
|
16118
15942
|
canReset: state.messages.length > 0,
|
|
16119
15943
|
newConversationLabel: ui.newConversation,
|
|
16120
|
-
moreOptionsLabel: ui.moreOptions
|
|
15944
|
+
moreOptionsLabel: ui.moreOptions,
|
|
15945
|
+
onOpenSettings: hasSettings ? openSettings : void 0,
|
|
15946
|
+
settingsLabel: ui.settings.title
|
|
16121
15947
|
}
|
|
16122
15948
|
),
|
|
16123
15949
|
monitor && /* @__PURE__ */ jsx135(
|
|
@@ -16134,28 +15960,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16134
15960
|
favouritesEnabled: favouritesEnabled ?? false
|
|
16135
15961
|
}
|
|
16136
15962
|
),
|
|
16137
|
-
/* @__PURE__ */ jsxs119("div", {
|
|
15963
|
+
/* @__PURE__ */ jsxs119("div", { className: "ss-w-chat-layer", style: onChatTab ? void 0 : HIDDEN_LAYER_STYLE, children: [
|
|
16138
15964
|
/* @__PURE__ */ jsx135(PresetToolsContext.Provider, { value: toolsValue, children: /* @__PURE__ */ jsx135(MessageList, { controller, ui, slip, onDashboardTap, monitor }) }),
|
|
16139
|
-
|
|
16140
|
-
PresetSpeedDial,
|
|
16141
|
-
{
|
|
16142
|
-
expanded: dial.expanded,
|
|
16143
|
-
showDot: !toolSeen,
|
|
16144
|
-
strings: ui.presets,
|
|
16145
|
-
onToggle: dial.toggle,
|
|
16146
|
-
onOpen: onPill,
|
|
16147
|
-
rootRef: dialRef,
|
|
16148
|
-
buttonRef: dialButtonRef
|
|
16149
|
-
}
|
|
16150
|
-
) : null,
|
|
16151
|
-
tool && presetGrid && onChatTab && !paused ? tool.kind === "numbers" ? /* @__PURE__ */ jsx135(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ jsx135(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
|
|
15965
|
+
tool && presetGrid && onChatTab && !paused ? /* @__PURE__ */ jsx135(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
|
|
16152
15966
|
] }),
|
|
16153
15967
|
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx135(TodayPanel, { discovery, ui, monitor }),
|
|
16154
15968
|
monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx135(MatchesPanel, { monitor, ui, slip, onAsk: paused ? void 0 : handleAsk, discovery }),
|
|
16155
15969
|
monitor && monitor.activeTab === "trends" && /* @__PURE__ */ jsx135(TrendsPanel, { monitor, ui, slip }),
|
|
16156
15970
|
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */ jsx135(Fixtures, { fixtures: clubFixturesResult?.fixtures ?? [], loading: clubFixturesResult?.loading ?? false, ui }),
|
|
16157
15971
|
monitor && monitor.activeTab === "standings" && /* @__PURE__ */ jsx135(Standings, { standings: clubStandingsResult?.data ?? null, loading: clubStandingsResult?.loading ?? false, ui }),
|
|
16158
|
-
monitor && monitor.activeTab === "squad" && /* @__PURE__ */ jsxs119(
|
|
15972
|
+
monitor && monitor.activeTab === "squad" && /* @__PURE__ */ jsxs119(Fragment40, { children: [
|
|
16159
15973
|
/* @__PURE__ */ jsx135(
|
|
16160
15974
|
"div",
|
|
16161
15975
|
{
|
|
@@ -16198,7 +16012,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16198
16012
|
}
|
|
16199
16013
|
),
|
|
16200
16014
|
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */ jsx135(FavouritesPanel, { controller: favourites.controller, ui, sport: favourites.sport, sports: favourites.sports, onSportChange: favourites.onSportChange }),
|
|
16201
|
-
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ jsxs119(
|
|
16015
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ jsxs119(Fragment40, { children: [
|
|
16202
16016
|
/* @__PURE__ */ jsx135("div", { ref: limitRef, className: "ss-w-limit", role: "status", tabIndex: -1, children: state.limit ? limitText(state.limit, ui) : null }),
|
|
16203
16017
|
paused ? null : /* @__PURE__ */ jsx135(
|
|
16204
16018
|
ChatInput,
|
|
@@ -16210,11 +16024,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16210
16024
|
onStop: stop,
|
|
16211
16025
|
stopLabel: ui.stopResponse,
|
|
16212
16026
|
sendLabel: ui.sendMessage,
|
|
16213
|
-
disabled: !!tool
|
|
16214
|
-
onType: fold2
|
|
16027
|
+
disabled: !!tool
|
|
16215
16028
|
}
|
|
16216
16029
|
)
|
|
16217
|
-
] })
|
|
16030
|
+
] }),
|
|
16031
|
+
settingsOpen && hasSettings ? /* @__PURE__ */ jsx135(SettingsSheet, { ui, onClose: closeSettings }) : null
|
|
16218
16032
|
] });
|
|
16219
16033
|
}
|
|
16220
16034
|
|
|
@@ -16845,7 +16659,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16845
16659
|
.ss-w-combo-addall .ss-w-slip-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; font-weight: 650; border-radius: 22px; white-space: normal; }
|
|
16846
16660
|
.ss-w-combo-addall .ss-w-toast { position: static; width: auto; max-width: none; font-size: 12px; box-shadow: none; }
|
|
16847
16661
|
|
|
16848
|
-
/* onboarding presets
|
|
16662
|
+
/* onboarding presets: the combo builder (spec Stage 2 Behaviour, board 2c). A sheet
|
|
16849
16663
|
over the message list, inside .ss-w-chat-layer; the body scrolls and the builder's Send sits in
|
|
16850
16664
|
the footer, so it stays visible on a phone. Colours come from the theme tokens. */
|
|
16851
16665
|
.ss-w-tool-backdrop { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(0,0,0,.35); }
|
|
@@ -16856,15 +16670,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16856
16670
|
.ss-w-tool-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }
|
|
16857
16671
|
.ss-w-tool-body > * { flex: none; }
|
|
16858
16672
|
.ss-w-tool-foot { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--ss-w-line); }
|
|
16859
|
-
.ss-w-tool-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 11px; border: 1px solid var(--ss-w-line); border-left: 3px solid var(--ss-w-accent); border-radius: 12px; }
|
|
16860
|
-
.ss-w-tool-ask { font-size: 14px; font-weight: 650; line-height: 1.7; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
16861
|
-
.ss-w-tool-num { position: relative; display: inline-block; vertical-align: middle; margin: 0 2px; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); }
|
|
16862
|
-
.ss-w-tool-num-size { display: block; font-size: max(16px, 1em); user-select: none; -webkit-user-select: none; visibility: hidden; box-sizing: border-box; min-width: 44px; min-height: 32px; padding: 6px 26px 6px 10px; line-height: 1.3; white-space: pre; }
|
|
16863
|
-
.ss-w-tool-num-select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0 22px 0 10px; font: inherit; font-size: max(16px, 1em); font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); background-color: color-mix(in srgb, var(--ss-w-accent) 10%, var(--ss-w-panel)); border: 1.5px solid color-mix(in srgb, var(--ss-w-accent) 65%, var(--ss-w-line)); border-radius: 8px; cursor: pointer; appearance: none; -webkit-appearance: none; }
|
|
16864
|
-
.ss-w-tool-num::after { content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
|
|
16865
|
-
.ss-w-tool-num-select:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
16866
|
-
.ss-w-tool-num-select option { font-weight: 600; color: var(--ss-w-ink); background: var(--ss-w-panel); }
|
|
16867
|
-
.ss-w-tool-num-select option:disabled { color: var(--ss-w-faint); }
|
|
16868
16673
|
.ss-w-tool-picks { list-style: none; display: flex; flex-direction: column; gap: 4px; }
|
|
16869
16674
|
.ss-w-tool-pick { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 5px 8px; font-size: 12px; line-height: 1.35; background: var(--ss-w-bubble); border-radius: 8px; }
|
|
16870
16675
|
.ss-w-tool-pick-match { grid-column: 1; font-weight: 650; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
@@ -16873,13 +16678,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16873
16678
|
.ss-w-tool-pick-price { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 800; color: var(--ss-w-accent); }
|
|
16874
16679
|
.ss-w-tool-math { padding: 6px 8px; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; text-align: right; color: var(--ss-w-ink); background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; overflow-wrap: anywhere; }
|
|
16875
16680
|
.ss-w-tool-unavailable { padding: 6px 8px; font-size: 12px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 8px; }
|
|
16876
|
-
.ss-w-tool-row--ask { flex-direction: row; align-items: center; gap: 10px; border-left-width: 1px; }
|
|
16877
|
-
.ss-w-tool-icon { flex: none; font-size: 20px; line-height: 1; }
|
|
16878
|
-
.ss-w-tool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
|
|
16879
|
-
.ss-w-tool-ready { padding: 2px 8px; font-size: 11.5px; font-weight: 650; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 10px; }
|
|
16880
|
-
.ss-w-tool-go { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 17px; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 50%; cursor: pointer; }
|
|
16881
|
-
.ss-w-tool-go:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
16882
|
-
.ss-w-tool-go:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
16883
16681
|
.ss-w-tool-send { align-self: flex-end; min-height: 40px; padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 20px; cursor: pointer; }
|
|
16884
16682
|
.ss-w-tool-send:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
16885
16683
|
.ss-w-tool-foot .ss-w-tool-send { width: 100%; }
|
|
@@ -16892,35 +16690,23 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16892
16690
|
.ss-w-tool-step { width: 40px; height: 40px; display: grid; place-items: center; font: inherit; font-size: 18px; font-weight: 700; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 50%; cursor: pointer; }
|
|
16893
16691
|
.ss-w-tool-step:disabled { opacity: .5; cursor: not-allowed; }
|
|
16894
16692
|
.ss-w-tool-count { min-width: 24px; text-align: center; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
|
|
16693
|
+
.ss-w-set-row { display: flex; flex-direction: column; gap: 6px; }
|
|
16694
|
+
.ss-w-set-sample { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border: 1px solid var(--ss-w-line); border-radius: 10px; font-variant-numeric: tabular-nums; }
|
|
16695
|
+
.ss-w-set-sample b { font-weight: 700; }
|
|
16696
|
+
.ss-w-set-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
|
|
16697
|
+
.ss-w-set-seg button { min-height: 44px; padding: 0 4px; font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--ss-w-ink); background: var(--ss-w-panel); border: 1px solid var(--ss-w-line); border-radius: 10px; cursor: pointer; }
|
|
16698
|
+
.ss-w-set-seg button[aria-pressed="true"] { font-weight: 700; border-color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 14%, var(--ss-w-panel)); }
|
|
16699
|
+
.ss-w-set-seg button:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
16700
|
+
.ss-w-set-foot { margin: 0; font-size: 12px; color: var(--ss-w-faint); }
|
|
16701
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
16702
|
+
.ss-w-set-backdrop-in { animation: ss-w-scrim-in .18s ease-out; }
|
|
16703
|
+
.ss-w-set-backdrop-in > .ss-w-tool { animation: ss-w-sheet-in .18s ease-out; }
|
|
16704
|
+
@keyframes ss-w-scrim-in { from { background-color: rgba(0,0,0,0); } }
|
|
16705
|
+
@keyframes ss-w-sheet-in { from { transform: translateY(12%); } to { transform: none; } }
|
|
16706
|
+
}
|
|
16895
16707
|
|
|
16896
|
-
/*
|
|
16897
|
-
layer is the message list's positioned box (P6), so the dial sits against the list's bottom
|
|
16898
|
-
right and rises with the composer: right 8px puts the 44px button's centre on Send's (12px
|
|
16899
|
-
padding + 18px), bottom 10px is above the composer's top border. While the button shows the list
|
|
16900
|
-
gets 54px more bottom padding so its last message can scroll clear. */
|
|
16708
|
+
/* The chat layer is the message list's positioned box: a preset tool sheet sits over it. */
|
|
16901
16709
|
.ss-w-chat-layer { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
16902
|
-
.ss-w-chat-layer[data-dial] .ss-w-list { padding-bottom: 68px; }
|
|
16903
|
-
.ss-w-dial { position: absolute; left: 12px; right: 8px; bottom: 10px; z-index: 2; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; pointer-events: none; }
|
|
16904
|
-
.ss-w-dial-btn, .ss-w-dial-pill { pointer-events: auto; }
|
|
16905
|
-
.ss-w-dial-btn { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; font-size: 20px; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.18); cursor: pointer; }
|
|
16906
|
-
.ss-w-dial-btn[aria-expanded="true"] { color: var(--ss-w-panel); background: var(--ss-w-accent); border-color: var(--ss-w-accent); }
|
|
16907
|
-
.ss-w-dial-btn:focus-visible, .ss-w-dial-pill:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
16908
|
-
.ss-w-dial-icon { grid-area: 1 / 1; display: grid; place-items: center; transition: transform 200ms ease, opacity 200ms ease; }
|
|
16909
|
-
.ss-w-dial-icon--close { opacity: 0; transform: rotate(-90deg); }
|
|
16910
|
-
.ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { opacity: 0; transform: rotate(90deg); }
|
|
16911
|
-
.ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--close { opacity: 1; transform: none; }
|
|
16912
|
-
.ss-w-dial-dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; background: var(--ss-w-accent); border: 2px solid var(--ss-w-panel); border-radius: 50%; }
|
|
16913
|
-
.ss-w-dial-pills { max-width: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
|
|
16914
|
-
.ss-w-dial-pill { max-width: 100%; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 12px; font: inherit; font-size: 12.5px; font-weight: 650; line-height: 1.25; text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--ss-w-ink); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 35%, var(--ss-w-line)); border-radius: 22px; box-shadow: 0 4px 14px rgba(0,0,0,.16); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.5); transform-origin: bottom right; transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms; }
|
|
16915
|
-
.ss-w-dial-pill svg { flex: none; font-size: 18px; color: var(--ss-w-accent); }
|
|
16916
|
-
.ss-w-dial-pill-label { min-width: 0; }
|
|
16917
|
-
.ss-w-dial-pills[data-open] .ss-w-dial-pill { opacity: 1; visibility: visible; transform: none; transition: opacity 200ms ease, transform 200ms ease, visibility 0s; }
|
|
16918
|
-
@media (prefers-reduced-motion: reduce) {
|
|
16919
|
-
.ss-w-dial-pill { transform: none; transition: opacity 200ms ease, visibility 0s linear 200ms; }
|
|
16920
|
-
.ss-w-dial-pills[data-open] .ss-w-dial-pill { transition: opacity 200ms ease, visibility 0s; }
|
|
16921
|
-
.ss-w-dial-icon { transition: opacity 200ms ease; }
|
|
16922
|
-
.ss-w-dial-icon--close, .ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { transform: none; }
|
|
16923
|
-
}
|
|
16924
16710
|
|
|
16925
16711
|
/* Compact price list (D16): three or more cards of one turn, one row per fixture. Team names wrap
|
|
16926
16712
|
to a second line and are never cut; the time sits above the match pin, with no column of its own. */
|
|
@@ -18751,12 +18537,12 @@ function injectStyles(root) {
|
|
|
18751
18537
|
function StatsWidget(props) {
|
|
18752
18538
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
18753
18539
|
const cfg = props.config;
|
|
18754
|
-
const built =
|
|
18755
|
-
const trackingRef =
|
|
18756
|
-
const track =
|
|
18757
|
-
const eventTextRef =
|
|
18540
|
+
const built = useMemo11(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
18541
|
+
const trackingRef = useRef37({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
18542
|
+
const track = useMemo11(() => createTracker(() => trackingRef.current), []);
|
|
18543
|
+
const eventTextRef = useRef37(false);
|
|
18758
18544
|
eventTextRef.current = cfg?.eventText === true;
|
|
18759
|
-
const logger =
|
|
18545
|
+
const logger = useMemo11(() => {
|
|
18760
18546
|
if (!built) return null;
|
|
18761
18547
|
const raw = built.client.createEventLogger({
|
|
18762
18548
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -18764,23 +18550,24 @@ function StatsWidget(props) {
|
|
|
18764
18550
|
});
|
|
18765
18551
|
return withTracking(raw, track);
|
|
18766
18552
|
}, [built?.client, track]);
|
|
18767
|
-
const ui =
|
|
18768
|
-
const
|
|
18769
|
-
const
|
|
18770
|
-
const
|
|
18553
|
+
const ui = useMemo11(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
18554
|
+
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
18555
|
+
const rootRef = useRef37(null);
|
|
18556
|
+
const introDoneRef = useRef37(false);
|
|
18557
|
+
const markIntroDone = useCallback25(() => {
|
|
18771
18558
|
introDoneRef.current = true;
|
|
18772
18559
|
}, []);
|
|
18773
18560
|
const language = injectedClient ? void 0 : toUserContext(cfg ?? {})?.defaultLanguage;
|
|
18774
18561
|
const threadLanguage = supportedLanguage(language);
|
|
18775
18562
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
18776
|
-
const sportScope =
|
|
18563
|
+
const sportScope = useMemo11(
|
|
18777
18564
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
18778
18565
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
18779
18566
|
);
|
|
18780
|
-
const chatTracking =
|
|
18781
|
-
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking);
|
|
18567
|
+
const chatTracking = useMemo11(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
18568
|
+
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
18782
18569
|
const [hasToday, setHasToday] = useState73(false);
|
|
18783
|
-
const liveCardWatches =
|
|
18570
|
+
const liveCardWatches = useMemo11(() => {
|
|
18784
18571
|
const seen = /* @__PURE__ */ new Set();
|
|
18785
18572
|
const out = [];
|
|
18786
18573
|
for (const msg of controller.state.messages) {
|
|
@@ -18807,11 +18594,11 @@ function StatsWidget(props) {
|
|
|
18807
18594
|
});
|
|
18808
18595
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
18809
18596
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
18810
|
-
const getSchedule =
|
|
18597
|
+
const getSchedule = useCallback25(
|
|
18811
18598
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
18812
18599
|
[built, operatorUserId, anonymousUserId]
|
|
18813
18600
|
);
|
|
18814
|
-
const postLeagueStar =
|
|
18601
|
+
const postLeagueStar = useCallback25(
|
|
18815
18602
|
async (competitionId, starred) => {
|
|
18816
18603
|
if (!built) return null;
|
|
18817
18604
|
const result = await built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId);
|
|
@@ -18820,11 +18607,11 @@ function StatsWidget(props) {
|
|
|
18820
18607
|
},
|
|
18821
18608
|
[built, operatorUserId, anonymousUserId, track]
|
|
18822
18609
|
);
|
|
18823
|
-
const getStates =
|
|
18610
|
+
const getStates = useCallback25(
|
|
18824
18611
|
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
18825
18612
|
[built]
|
|
18826
18613
|
);
|
|
18827
|
-
const pinnedMatchIds =
|
|
18614
|
+
const pinnedMatchIds = useMemo11(
|
|
18828
18615
|
() => footballMatchPinIds(monitor.pins),
|
|
18829
18616
|
[monitor.pins]
|
|
18830
18617
|
);
|
|
@@ -18842,7 +18629,7 @@ function StatsWidget(props) {
|
|
|
18842
18629
|
useEffect45(() => {
|
|
18843
18630
|
setHasToday(todayHasContent);
|
|
18844
18631
|
}, [todayHasContent]);
|
|
18845
|
-
const prevLiveSnapshotRef =
|
|
18632
|
+
const prevLiveSnapshotRef = useRef37(monitor.snapshot);
|
|
18846
18633
|
useEffect45(() => {
|
|
18847
18634
|
const snap = monitor.snapshot;
|
|
18848
18635
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
@@ -18884,13 +18671,13 @@ function StatsWidget(props) {
|
|
|
18884
18671
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
18885
18672
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
18886
18673
|
const [favSportPick, setFavSportPick] = useState73(null);
|
|
18887
|
-
const latestGreeting =
|
|
18674
|
+
const latestGreeting = useMemo11(() => {
|
|
18888
18675
|
for (const m of [...controller.state.messages].reverse()) {
|
|
18889
18676
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
18890
18677
|
}
|
|
18891
18678
|
return null;
|
|
18892
18679
|
}, [controller.state.messages]);
|
|
18893
|
-
const favSportOptions =
|
|
18680
|
+
const favSportOptions = useMemo11(
|
|
18894
18681
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
18895
18682
|
[latestGreeting]
|
|
18896
18683
|
);
|
|
@@ -18910,13 +18697,13 @@ function StatsWidget(props) {
|
|
|
18910
18697
|
track
|
|
18911
18698
|
});
|
|
18912
18699
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
18913
|
-
const getPricePresets =
|
|
18700
|
+
const getPricePresets = useCallback25(
|
|
18914
18701
|
(locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
|
|
18915
18702
|
[built]
|
|
18916
18703
|
);
|
|
18917
18704
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
18918
18705
|
const markTodayActivity = monitor.markTodayActivity;
|
|
18919
|
-
const prevLiveCountRef =
|
|
18706
|
+
const prevLiveCountRef = useRef37(0);
|
|
18920
18707
|
useEffect45(() => {
|
|
18921
18708
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
18922
18709
|
prevLiveCountRef.current = discovery.liveCount;
|
|
@@ -18931,7 +18718,7 @@ function StatsWidget(props) {
|
|
|
18931
18718
|
closePanel: controller.close
|
|
18932
18719
|
});
|
|
18933
18720
|
const markAdded = hostEvents.markAdded;
|
|
18934
|
-
const slip =
|
|
18721
|
+
const slip = useMemo11(
|
|
18935
18722
|
() => {
|
|
18936
18723
|
const handler = props.config?.onAddToSlip;
|
|
18937
18724
|
return {
|
|
@@ -18951,13 +18738,13 @@ function StatsWidget(props) {
|
|
|
18951
18738
|
},
|
|
18952
18739
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
18953
18740
|
);
|
|
18954
|
-
const onDashboardTap =
|
|
18741
|
+
const onDashboardTap = useMemo11(
|
|
18955
18742
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
18956
18743
|
[built, logger]
|
|
18957
18744
|
);
|
|
18958
18745
|
const dismissPopup = usePopupTelemetry(logger, controller.state.isOpen, controller.state.popupText, controller.dismissPopup);
|
|
18959
18746
|
useOpenTelemetry(logger, controller.state.isOpen);
|
|
18960
|
-
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk).map((ask) => ({
|
|
18747
|
+
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
|
|
18961
18748
|
label: ask.label,
|
|
18962
18749
|
onTap: () => runBubbleAsk(ask, {
|
|
18963
18750
|
open: controller.open,
|
|
@@ -18967,7 +18754,7 @@ function StatsWidget(props) {
|
|
|
18967
18754
|
log: logger
|
|
18968
18755
|
})
|
|
18969
18756
|
}));
|
|
18970
|
-
const onControlRef =
|
|
18757
|
+
const onControlRef = useRef37(props.onControl);
|
|
18971
18758
|
onControlRef.current = props.onControl;
|
|
18972
18759
|
const { open: openPanel, close: closePanel } = controller;
|
|
18973
18760
|
useEffect45(() => {
|
|
@@ -19016,8 +18803,8 @@ function StatsWidget(props) {
|
|
|
19016
18803
|
}, [built, ui.injectStyles]);
|
|
19017
18804
|
const holds = useSessionHolds();
|
|
19018
18805
|
const builderConversation = built?.conversation ?? null;
|
|
19019
|
-
const builderMemory =
|
|
19020
|
-
const personalGreeting =
|
|
18806
|
+
const builderMemory = useMemo11(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
18807
|
+
const personalGreeting = useMemo11(() => ({
|
|
19021
18808
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
19022
18809
|
conversation: built?.conversation ?? null,
|
|
19023
18810
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -19029,8 +18816,8 @@ function StatsWidget(props) {
|
|
|
19029
18816
|
memory: builderMemory
|
|
19030
18817
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
19031
18818
|
if (!built) return null;
|
|
19032
|
-
const attrs = themeAttrs(ui);
|
|
19033
|
-
return /* @__PURE__ */ jsx137(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx137(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx137(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx137(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx137("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ jsx137(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx137(
|
|
18819
|
+
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
18820
|
+
return /* @__PURE__ */ jsx137(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx137(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx137(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx137(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ jsx137(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx137("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ jsx137(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx137(
|
|
19034
18821
|
ChatPanel,
|
|
19035
18822
|
{
|
|
19036
18823
|
controller,
|
|
@@ -19066,7 +18853,7 @@ function StatsWidget(props) {
|
|
|
19066
18853
|
onIntroStart: markIntroDone,
|
|
19067
18854
|
asks
|
|
19068
18855
|
}
|
|
19069
|
-
) }) }) }) }) });
|
|
18856
|
+
) }) }) }) }) }) });
|
|
19070
18857
|
}
|
|
19071
18858
|
function emptyConversation() {
|
|
19072
18859
|
return { send: () => {
|