@sensiblestats/widget-react 0.110.0 → 0.111.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 +13 -0
- package/README.md +10 -1
- package/dist/index.cjs +1256 -960
- 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 +1027 -731
- package/dist/index.js.map +1 -1
- package/dist/styles.css +14 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as useCallback26, useEffect as
|
|
2
|
+
import { useCallback as useCallback26, useEffect as useEffect46, useMemo as useMemo11, useRef as useRef38, useState as useState74 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/kickoff.ts
|
|
@@ -348,6 +348,20 @@ 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
367
|
setNumbers: "Set the numbers",
|
|
@@ -358,13 +372,13 @@ var STRINGS = {
|
|
|
358
372
|
comboRow: "Combo of {legs} paying {total}",
|
|
359
373
|
bigComboRow: "Total {total} with {legs} matches",
|
|
360
374
|
readyCount: (n) => `${n} ready`,
|
|
361
|
-
readyAt: (total) => `ready at ${total
|
|
362
|
-
maxPriceDisplay: (count, price) => `${count} picks, max ${price
|
|
363
|
-
maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price
|
|
364
|
-
minPriceDisplay: (count, price) => `${count} picks from ${price
|
|
365
|
-
minPriceMessage: (count, price) => `Show me ${count} picks priced at ${price
|
|
366
|
-
comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total
|
|
367
|
-
comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total
|
|
375
|
+
readyAt: (total) => `ready at ${total}`,
|
|
376
|
+
maxPriceDisplay: (count, price) => `${count} picks, max ${price}`,
|
|
377
|
+
maxPriceMessage: (count, price) => `Show me ${count} picks priced at ${price} or less.`,
|
|
378
|
+
minPriceDisplay: (count, price) => `${count} picks from ${price} up`,
|
|
379
|
+
minPriceMessage: (count, price) => `Show me ${count} picks priced at ${price} or more.`,
|
|
380
|
+
comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total}`,
|
|
381
|
+
comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total}.`,
|
|
368
382
|
unavailable: "Not available today.",
|
|
369
383
|
send: "Send",
|
|
370
384
|
close: "Close",
|
|
@@ -1032,6 +1046,20 @@ var STRINGS = {
|
|
|
1032
1046
|
gamePlay: "Oyna",
|
|
1033
1047
|
gameLocked: "Kilitli",
|
|
1034
1048
|
gameVoided: "\u0130ptal edildi",
|
|
1049
|
+
settings: {
|
|
1050
|
+
title: "Ayarlar",
|
|
1051
|
+
close: "Ayarlar\u0131 kapat",
|
|
1052
|
+
oddsLabel: "Oran bi\xE7imi",
|
|
1053
|
+
decimal: "Ondal\u0131k",
|
|
1054
|
+
fractional: "Kesirli",
|
|
1055
|
+
american: "Amerikan",
|
|
1056
|
+
themeLabel: "Tema",
|
|
1057
|
+
light: "A\xE7\u0131k",
|
|
1058
|
+
dark: "Koyu",
|
|
1059
|
+
auto: "Otomatik",
|
|
1060
|
+
sampleLabel: "Arsenal kazan\u0131r",
|
|
1061
|
+
foot: "Bu sohbetteki oranlara uygulan\u0131r. Bu cihazda saklan\u0131r."
|
|
1062
|
+
},
|
|
1035
1063
|
presets: {
|
|
1036
1064
|
lang: "tr",
|
|
1037
1065
|
setNumbers: "Say\u0131lar\u0131 belirle",
|
|
@@ -1042,13 +1070,13 @@ var STRINGS = {
|
|
|
1042
1070
|
comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
|
|
1043
1071
|
bigComboRow: "{legs} ma\xE7la toplam {total}",
|
|
1044
1072
|
readyCount: (n) => `${n} haz\u0131r`,
|
|
1045
|
-
readyAt: (total) => `${total
|
|
1046
|
-
maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price
|
|
1047
|
-
maxPriceMessage: (count, price) => `${price
|
|
1048
|
-
minPriceDisplay: (count, price) => `${count} se\xE7im, ${price
|
|
1049
|
-
minPriceMessage: (count, price) => `${price
|
|
1050
|
-
comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total
|
|
1051
|
-
comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total
|
|
1073
|
+
readyAt: (total) => `${total} ile haz\u0131r`,
|
|
1074
|
+
maxPriceDisplay: (count, price) => `${count} se\xE7im, en fazla ${price}`,
|
|
1075
|
+
maxPriceMessage: (count, price) => `${price} veya alt\u0131 oranl\u0131 ${count} se\xE7im g\xF6ster.`,
|
|
1076
|
+
minPriceDisplay: (count, price) => `${count} se\xE7im, ${price} ve \xFCzeri`,
|
|
1077
|
+
minPriceMessage: (count, price) => `${price} veya \xFCzeri oranl\u0131 ${count} se\xE7im g\xF6ster.`,
|
|
1078
|
+
comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total}`,
|
|
1079
|
+
comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total} oranl\u0131 ${legs} ma\xE7l\u0131k bir kombin haz\u0131rla.`,
|
|
1052
1080
|
unavailable: "Bug\xFCn mevcut de\u011Fil.",
|
|
1053
1081
|
send: "G\xF6nder",
|
|
1054
1082
|
close: "Kapat",
|
|
@@ -1426,14 +1454,28 @@ function isEnglishLocale(locale) {
|
|
|
1426
1454
|
return lang === null || lang === "en";
|
|
1427
1455
|
}
|
|
1428
1456
|
|
|
1457
|
+
// src/odds.ts
|
|
1458
|
+
function formatOdds(forms, format2) {
|
|
1459
|
+
return (format2 === "american" ? forms.american : format2 === "fractional" ? forms.fractional : forms.decimal) ?? forms.decimal;
|
|
1460
|
+
}
|
|
1461
|
+
function operatorOdds(forms, format2) {
|
|
1462
|
+
const text = format2 === "american" ? forms.american : format2 === "fractional" ? forms.fractional : forms.decimal;
|
|
1463
|
+
return text ? { format: format2, text } : void 0;
|
|
1464
|
+
}
|
|
1465
|
+
function parseOddsFormat(value) {
|
|
1466
|
+
const v = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
1467
|
+
return v === "decimal" || v === "american" || v === "fractional" ? v : void 0;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1429
1470
|
// src/version.generated.ts
|
|
1430
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1471
|
+
var WIDGET_REACT_VERSION = "0.111.0";
|
|
1431
1472
|
|
|
1432
1473
|
// src/config.ts
|
|
1433
1474
|
function normalizeUi(cfg) {
|
|
1434
1475
|
const strings = resolveLocaleStrings(cfg.locale);
|
|
1435
1476
|
return {
|
|
1436
1477
|
theme: cfg.theme ?? "auto",
|
|
1478
|
+
oddsFormat: parseOddsFormat(cfg.oddsFormat) ?? "decimal",
|
|
1437
1479
|
accent: cfg.accent,
|
|
1438
1480
|
logoUrl: cfg.logoUrl,
|
|
1439
1481
|
headerTitle: cfg.headerTitle,
|
|
@@ -1741,6 +1783,7 @@ function normalizeUi(cfg) {
|
|
|
1741
1783
|
gameVoided: strings.gameVoided,
|
|
1742
1784
|
games: strings.games,
|
|
1743
1785
|
presets: strings.presets,
|
|
1786
|
+
settings: strings.settings,
|
|
1744
1787
|
nba: strings.nba,
|
|
1745
1788
|
nfl: strings.nfl,
|
|
1746
1789
|
liveCard: strings.liveCard
|
|
@@ -1780,6 +1823,8 @@ function projectSeries(samples) {
|
|
|
1780
1823
|
const prices = samples.map((s) => s.price);
|
|
1781
1824
|
const pMin = Math.min(...prices);
|
|
1782
1825
|
const pMax = Math.max(...prices);
|
|
1826
|
+
const maxSample = samples.find((s) => s.price === pMax);
|
|
1827
|
+
const minSample = samples.find((s) => s.price === pMin);
|
|
1783
1828
|
let yMin;
|
|
1784
1829
|
let yMax;
|
|
1785
1830
|
if (pMax === pMin) {
|
|
@@ -1800,9 +1845,9 @@ function projectSeries(samples) {
|
|
|
1800
1845
|
// The real extremes, never the padded bounds: a gridline label is a price, and the padded
|
|
1801
1846
|
// bounds are prices nobody was ever offered. A flat series has one real extreme, not two —
|
|
1802
1847
|
// 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 }
|
|
1848
|
+
gridlines: pMax === pMin ? [{ y: y(pMax), price: pMax, forms: maxSample.forms }] : [
|
|
1849
|
+
{ y: y(pMax), price: pMax, forms: maxSample.forms },
|
|
1850
|
+
{ y: y(pMin), price: pMin, forms: minSample.forms }
|
|
1806
1851
|
],
|
|
1807
1852
|
viewBox: `0 0 ${CHART_VIEW_W} ${CHART_VIEW_H}`,
|
|
1808
1853
|
startMs: tMin,
|
|
@@ -1887,8 +1932,6 @@ function toInsightVM(insight) {
|
|
|
1887
1932
|
const selectionLabel = str(insight.selectionLabel);
|
|
1888
1933
|
const selectionLine = str(insight.line);
|
|
1889
1934
|
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
1935
|
const oddsValue = insight.odds?.value;
|
|
1893
1936
|
const matchOddsId = typeof insight.odds?.matchOddsId === "number" ? insight.odds.matchOddsId : void 0;
|
|
1894
1937
|
const home = str(insight.homeTeamName);
|
|
@@ -1902,7 +1945,8 @@ function toInsightVM(insight) {
|
|
|
1902
1945
|
id: str(insight.insightId) ?? `${str(insight.ruleId) ?? "insight"}:${num(insight.matchId) ?? ""}`,
|
|
1903
1946
|
market,
|
|
1904
1947
|
selection,
|
|
1905
|
-
odds,
|
|
1948
|
+
oddsForms: oddsValue !== void 0 && Number.isFinite(oddsValue) ? insight.odds?.valueFormats : void 0,
|
|
1949
|
+
previousOddsForms: previous !== void 0 && direction !== void 0 ? insight.odds?.previousValueFormats ?? void 0 : void 0,
|
|
1906
1950
|
// The wire payload carries bookmakerId (not a name); render a name only if one is present.
|
|
1907
1951
|
bookmaker: str(insight.odds?.bookmakerName),
|
|
1908
1952
|
isLive: insight.odds?.isLive === true,
|
|
@@ -1921,7 +1965,6 @@ function toInsightVM(insight) {
|
|
|
1921
1965
|
isMarketFloor: insight.isMarketFloor === true,
|
|
1922
1966
|
oddsDecimal: typeof oddsValue === "number" && Number.isFinite(oddsValue) ? oddsValue : void 0,
|
|
1923
1967
|
quotedAtUtc: str(insight.odds?.quotedAtUtc),
|
|
1924
|
-
previousOdds: previous !== void 0 && direction !== void 0 ? previous.toFixed(2) : void 0,
|
|
1925
1968
|
movementDirection: previous !== void 0 && direction !== void 0 ? direction : void 0,
|
|
1926
1969
|
homeTeamName: home,
|
|
1927
1970
|
awayTeamName: away,
|
|
@@ -1933,11 +1976,12 @@ function toInsightVM(insight) {
|
|
|
1933
1976
|
};
|
|
1934
1977
|
}
|
|
1935
1978
|
function toSlipSelection(vm, conversationId) {
|
|
1936
|
-
if (vm.matchOddsId === void 0 || vm.oddsDecimal === void 0) return null;
|
|
1979
|
+
if (vm.matchOddsId === void 0 || vm.oddsDecimal === void 0 || vm.oddsForms === void 0) return null;
|
|
1937
1980
|
const selection = {
|
|
1938
1981
|
matchOddsId: vm.matchOddsId,
|
|
1939
1982
|
matchId: vm.matchId,
|
|
1940
|
-
oddsDecimal: vm.oddsDecimal
|
|
1983
|
+
oddsDecimal: vm.oddsDecimal,
|
|
1984
|
+
forms: vm.oddsForms
|
|
1941
1985
|
};
|
|
1942
1986
|
if (vm.quotedAtUtc !== void 0) selection.quotedAtUtc = vm.quotedAtUtc;
|
|
1943
1987
|
if (vm.id !== void 0) selection.insightId = vm.id;
|
|
@@ -1958,19 +2002,19 @@ function toMarketOddsVM(card) {
|
|
|
1958
2002
|
displayLabel,
|
|
1959
2003
|
selectionLabel: str(r.selectionLabel),
|
|
1960
2004
|
line: str(r.line),
|
|
1961
|
-
odds: price !== void 0 ? price.toFixed(2) : "",
|
|
1962
2005
|
oddsDecimal: price,
|
|
2006
|
+
priceForms: r.priceFormats,
|
|
2007
|
+
previousPriceForms: previous !== void 0 && direction !== void 0 ? r.previousPriceFormats ?? void 0 : void 0,
|
|
1963
2008
|
matchOddsId: typeof r.matchOddsId === "number" ? r.matchOddsId : void 0,
|
|
1964
2009
|
quotedAtUtc: str(r.quotedAtUtc),
|
|
1965
2010
|
isMain: r.isMainLine !== false,
|
|
1966
2011
|
// === true, not !== false: a server that has not shipped the field yet leaves it undefined,
|
|
1967
2012
|
// and undefined must read as open rather than hiding every price on the card.
|
|
1968
2013
|
isSuspended: r.isSuspended === true,
|
|
1969
|
-
previousOdds: previous !== void 0 && direction !== void 0 ? previous.toFixed(2) : void 0,
|
|
1970
2014
|
movementDirection: previous !== void 0 && direction !== void 0 ? direction : void 0
|
|
1971
2015
|
};
|
|
1972
2016
|
};
|
|
1973
|
-
const vms = rows.map(toRow).filter((r) => (r.selectionLabel || r.line) && r.
|
|
2017
|
+
const vms = rows.map(toRow).filter((r) => (r.selectionLabel || r.line) && r.oddsDecimal !== void 0 && !r.isSuspended);
|
|
1974
2018
|
const home = str(card.homeTeamName);
|
|
1975
2019
|
const away = str(card.awayTeamName);
|
|
1976
2020
|
const sport = sportOf(card.sport);
|
|
@@ -2015,7 +2059,7 @@ function toOddsMovementVM(card) {
|
|
|
2015
2059
|
const price = typeof p.price === "number" && Number.isFinite(p.price) ? p.price : void 0;
|
|
2016
2060
|
const atMs = typeof p.atUtc === "string" ? Date.parse(p.atUtc) : NaN;
|
|
2017
2061
|
if (price === void 0 || Number.isNaN(atMs)) continue;
|
|
2018
|
-
samples.push({ atMs, price });
|
|
2062
|
+
samples.push({ atMs, price, forms: p.priceFormats });
|
|
2019
2063
|
}
|
|
2020
2064
|
samples.sort((a, b) => a.atMs - b.atMs);
|
|
2021
2065
|
const asNumber = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
@@ -2038,8 +2082,8 @@ function toOddsMovementVM(card) {
|
|
|
2038
2082
|
fixture: home && away ? `${home} vs ${away}` : void 0,
|
|
2039
2083
|
competition: str(card.competitionName),
|
|
2040
2084
|
bookmaker: str(card.bookmakerName),
|
|
2041
|
-
|
|
2042
|
-
|
|
2085
|
+
openingForms: opening !== void 0 ? card.openingPriceFormats : void 0,
|
|
2086
|
+
currentForms: current !== void 0 ? card.currentPriceFormats : void 0,
|
|
2043
2087
|
direction: card.movementDirection === "shortened" || card.movementDirection === "drifted" ? card.movementDirection : void 0,
|
|
2044
2088
|
windowHours: asNumber(card.windowHours) ?? 0,
|
|
2045
2089
|
excludedCount: asNumber(card.excludedSuspendedCount) ?? 0,
|
|
@@ -2054,7 +2098,7 @@ function toOddsMovementVM(card) {
|
|
|
2054
2098
|
function marketOddsRowToSlipSelection(vm, row, conversationId) {
|
|
2055
2099
|
if (row.matchOddsId === void 0 || row.oddsDecimal === void 0) return null;
|
|
2056
2100
|
if (!mayPinOrSlip(vm.sport)) return null;
|
|
2057
|
-
const selection = { matchOddsId: row.matchOddsId, matchId: vm.matchId, oddsDecimal: row.oddsDecimal };
|
|
2101
|
+
const selection = { matchOddsId: row.matchOddsId, matchId: vm.matchId, oddsDecimal: row.oddsDecimal, forms: row.priceForms };
|
|
2058
2102
|
if (row.quotedAtUtc !== void 0) selection.quotedAtUtc = row.quotedAtUtc;
|
|
2059
2103
|
const slipSport = slipSportOf(vm.sport);
|
|
2060
2104
|
if (slipSport) selection.sport = slipSport;
|
|
@@ -2093,8 +2137,8 @@ function toComboLegVM(leg) {
|
|
|
2093
2137
|
selection: joinSelection(selectionLabel, line) ?? selectionLabel,
|
|
2094
2138
|
selectionLabel,
|
|
2095
2139
|
line,
|
|
2096
|
-
odds: price.toFixed(2),
|
|
2097
2140
|
oddsDecimal: price,
|
|
2141
|
+
priceForms: leg.priceFormats,
|
|
2098
2142
|
matchOddsId,
|
|
2099
2143
|
quotedAtUtc: str(leg.quotedAtUtc),
|
|
2100
2144
|
...hasStat ? { insightId, statText } : {},
|
|
@@ -2115,6 +2159,7 @@ function toComboCardVM(card) {
|
|
|
2115
2159
|
id: str(card.comboId) ?? legs.map((l) => l.matchOddsId).join("-"),
|
|
2116
2160
|
legs,
|
|
2117
2161
|
multiplication,
|
|
2162
|
+
totalForms: card.totalFormats,
|
|
2118
2163
|
replacedNote: str(card.replacedNote),
|
|
2119
2164
|
addToSlipEnabled: card.addToSlipEnabled === true,
|
|
2120
2165
|
target: finite(card.target),
|
|
@@ -2125,7 +2170,8 @@ function comboLegToSlipSelection(leg, conversationId) {
|
|
|
2125
2170
|
const selection = {
|
|
2126
2171
|
matchOddsId: leg.matchOddsId,
|
|
2127
2172
|
matchId: leg.matchId,
|
|
2128
|
-
oddsDecimal: leg.oddsDecimal
|
|
2173
|
+
oddsDecimal: leg.oddsDecimal,
|
|
2174
|
+
forms: leg.priceForms
|
|
2129
2175
|
};
|
|
2130
2176
|
if (leg.insightId !== void 0) selection.insightId = leg.insightId;
|
|
2131
2177
|
if (leg.quotedAtUtc !== void 0) selection.quotedAtUtc = leg.quotedAtUtc;
|
|
@@ -2208,6 +2254,7 @@ function toNbaSlipSelection(vm, key, conversationId) {
|
|
|
2208
2254
|
matchOddsId: s.matchOddsId,
|
|
2209
2255
|
matchId: vm.matchId,
|
|
2210
2256
|
oddsDecimal: s.price,
|
|
2257
|
+
forms: s.priceFormats,
|
|
2211
2258
|
quotedAtUtc: s.quotedAtUtc,
|
|
2212
2259
|
insightId: vm.id,
|
|
2213
2260
|
sport: "basketball"
|
|
@@ -2231,8 +2278,8 @@ function nbaCoHitLegs(vm, conversationId) {
|
|
|
2231
2278
|
selection: s.selectionLabel,
|
|
2232
2279
|
selectionLabel: s.selectionLabel,
|
|
2233
2280
|
line: s.line ?? void 0,
|
|
2234
|
-
odds: s.price.toFixed(2),
|
|
2235
2281
|
oddsDecimal: s.price,
|
|
2282
|
+
priceForms: s.priceFormats,
|
|
2236
2283
|
matchOddsId: s.matchOddsId,
|
|
2237
2284
|
quotedAtUtc: s.quotedAtUtc,
|
|
2238
2285
|
insightId: vm.id,
|
|
@@ -2319,6 +2366,7 @@ function toNflSlipSelection(vm, key, nowMs, conversationId) {
|
|
|
2319
2366
|
matchOddsId: s.matchOddsId,
|
|
2320
2367
|
matchId: vm.matchId,
|
|
2321
2368
|
oddsDecimal: s.price,
|
|
2369
|
+
forms: s.priceFormats,
|
|
2322
2370
|
quotedAtUtc: s.quotedAtUtc,
|
|
2323
2371
|
insightId: vm.id,
|
|
2324
2372
|
sport: "americanfootball"
|
|
@@ -2381,11 +2429,14 @@ function slipPickFields(selection, label, line) {
|
|
|
2381
2429
|
return fields;
|
|
2382
2430
|
}
|
|
2383
2431
|
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 };
|
|
2432
|
+
if (!market || !market.addToSlipEnabled || typeof market.matchOddsId !== "number" || typeof market.price !== "number" || !market.priceFormats) return null;
|
|
2433
|
+
const selection = { matchOddsId: market.matchOddsId, matchId, oddsDecimal: market.price, forms: market.priceFormats };
|
|
2386
2434
|
if (conversationId !== void 0) selection.conversationId = conversationId;
|
|
2387
2435
|
return selection;
|
|
2388
2436
|
}
|
|
2437
|
+
function chipPriceText(market, format2) {
|
|
2438
|
+
return typeof market.price === "number" && market.priceFormats ? formatOdds(market.priceFormats, format2) : void 0;
|
|
2439
|
+
}
|
|
2389
2440
|
function chipSelectionText(market) {
|
|
2390
2441
|
return displayText(market.displayLabel) ?? market.selectionLabel;
|
|
2391
2442
|
}
|
|
@@ -2422,7 +2473,7 @@ function resultToToast(result, shownOdds, ui) {
|
|
|
2422
2473
|
case "duplicate":
|
|
2423
2474
|
return { kind: "success", text: ui.slipDuplicate };
|
|
2424
2475
|
case "price_changed":
|
|
2425
|
-
return result.accepted ? { kind: "success", text: ui.slipPriceChanged(shownOdds, result.
|
|
2476
|
+
return result.accepted ? { kind: "success", text: ui.slipPriceChanged(shownOdds, result.newOdds) } : { kind: "error", text: ui.slipPriceNotAccepted(shownOdds, result.newOdds) };
|
|
2426
2477
|
case "rejected":
|
|
2427
2478
|
if (result.reason === "login_required") return { kind: "error", text: ui.slipLoginRequired };
|
|
2428
2479
|
if (result.reason === "suspended") return { kind: "error", text: ui.slipSuspended };
|
|
@@ -2585,20 +2636,20 @@ function createMatchViews(storageKey, options = {}) {
|
|
|
2585
2636
|
const now = options.now ?? (() => Date.now());
|
|
2586
2637
|
const user = options.user;
|
|
2587
2638
|
let storage = options.storage;
|
|
2588
|
-
let
|
|
2639
|
+
let memory3 = empty();
|
|
2589
2640
|
const read2 = () => {
|
|
2590
2641
|
if (storage === void 0) storage = browserStorage();
|
|
2591
2642
|
if (storage) {
|
|
2592
2643
|
try {
|
|
2593
|
-
|
|
2644
|
+
memory3 = parse(storage.getItem(storageKey), user);
|
|
2594
2645
|
} catch {
|
|
2595
2646
|
storage = null;
|
|
2596
2647
|
}
|
|
2597
2648
|
}
|
|
2598
|
-
return
|
|
2649
|
+
return memory3;
|
|
2599
2650
|
};
|
|
2600
2651
|
const write = (state) => {
|
|
2601
|
-
|
|
2652
|
+
memory3 = state;
|
|
2602
2653
|
if (!storage) return;
|
|
2603
2654
|
try {
|
|
2604
2655
|
storage.setItem(storageKey, JSON.stringify({ v: 1, user, ...state }));
|
|
@@ -2695,20 +2746,20 @@ function browserStorage2() {
|
|
|
2695
2746
|
function createSlipLedger(storageKey, options = {}) {
|
|
2696
2747
|
const now = options.now ?? (() => Date.now());
|
|
2697
2748
|
let storage = options.storage;
|
|
2698
|
-
let
|
|
2749
|
+
let memory3 = [];
|
|
2699
2750
|
const read2 = () => {
|
|
2700
2751
|
if (storage === void 0) storage = browserStorage2();
|
|
2701
2752
|
if (storage) {
|
|
2702
2753
|
try {
|
|
2703
|
-
|
|
2754
|
+
memory3 = parse2(storage.getItem(storageKey));
|
|
2704
2755
|
} catch {
|
|
2705
2756
|
storage = null;
|
|
2706
2757
|
}
|
|
2707
2758
|
}
|
|
2708
|
-
return
|
|
2759
|
+
return memory3;
|
|
2709
2760
|
};
|
|
2710
2761
|
const write = (entries) => {
|
|
2711
|
-
|
|
2762
|
+
memory3 = entries;
|
|
2712
2763
|
if (!storage) return;
|
|
2713
2764
|
try {
|
|
2714
2765
|
storage.setItem(storageKey, JSON.stringify({ v: 1, entries }));
|
|
@@ -2884,7 +2935,7 @@ function createDashboardTapSignal(sendSignal, log) {
|
|
|
2884
2935
|
}
|
|
2885
2936
|
|
|
2886
2937
|
// src/theme.ts
|
|
2887
|
-
function themeAttrs(ui) {
|
|
2938
|
+
function themeAttrs(ui, userTheme) {
|
|
2888
2939
|
const style = {
|
|
2889
2940
|
"--ss-w-offset-x": `${ui.offset.x}px`,
|
|
2890
2941
|
"--ss-w-offset-y": `${ui.offset.y}px`,
|
|
@@ -2899,11 +2950,112 @@ function themeAttrs(ui) {
|
|
|
2899
2950
|
style["--ss-w-line"] = "color-mix(in srgb, var(--ss-w-ink) 12%, var(--ss-w-panel))";
|
|
2900
2951
|
style["--ss-w-faint"] = "color-mix(in srgb, var(--ss-w-ink) 55%, var(--ss-w-panel))";
|
|
2901
2952
|
}
|
|
2902
|
-
|
|
2953
|
+
const theme = ui.surface || ui.ink ? ui.theme : userTheme ?? ui.theme;
|
|
2954
|
+
return { "data-ss-w-theme": theme, "data-ss-w-pos": ui.position, style };
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
// src/oddsSettingsContext.ts
|
|
2958
|
+
import { createContext, useContext, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
2959
|
+
|
|
2960
|
+
// src/oddsSettings.ts
|
|
2961
|
+
var KEY = "ss-w-settings";
|
|
2962
|
+
var THEMES = ["light", "dark", "auto"];
|
|
2963
|
+
var memory = {};
|
|
2964
|
+
function readSettings() {
|
|
2965
|
+
let raw;
|
|
2966
|
+
try {
|
|
2967
|
+
raw = window.localStorage.getItem(KEY);
|
|
2968
|
+
} catch {
|
|
2969
|
+
return { ...memory };
|
|
2970
|
+
}
|
|
2971
|
+
if (raw === null) return { ...memory };
|
|
2972
|
+
try {
|
|
2973
|
+
const parsed = JSON.parse(raw);
|
|
2974
|
+
if (typeof parsed !== "object" || parsed === null || parsed.v !== 1) return {};
|
|
2975
|
+
const p = parsed;
|
|
2976
|
+
const out = {};
|
|
2977
|
+
const f = parseOddsFormat(p.oddsFormat);
|
|
2978
|
+
if (f) out.oddsFormat = f;
|
|
2979
|
+
if (typeof p.theme === "string" && THEMES.includes(p.theme)) out.theme = p.theme;
|
|
2980
|
+
return out;
|
|
2981
|
+
} catch {
|
|
2982
|
+
return {};
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
function writeSettings(patch) {
|
|
2986
|
+
const next = { ...readSettings() };
|
|
2987
|
+
if (patch.oddsFormat === null) delete next.oddsFormat;
|
|
2988
|
+
else if (patch.oddsFormat) next.oddsFormat = patch.oddsFormat;
|
|
2989
|
+
if (patch.theme === null) delete next.theme;
|
|
2990
|
+
else if (patch.theme) next.theme = patch.theme;
|
|
2991
|
+
memory = next;
|
|
2992
|
+
try {
|
|
2993
|
+
window.localStorage.setItem(KEY, JSON.stringify({ v: 1, ...next }));
|
|
2994
|
+
} catch {
|
|
2995
|
+
}
|
|
2996
|
+
return next;
|
|
2997
|
+
}
|
|
2998
|
+
var offeredKey = (operatorKey) => `ss-w-odds-offered:${operatorKey}`;
|
|
2999
|
+
function readOddsOffered(operatorKey) {
|
|
3000
|
+
try {
|
|
3001
|
+
const raw = window.localStorage.getItem(offeredKey(operatorKey));
|
|
3002
|
+
return raw === "true" ? true : raw === "false" ? false : void 0;
|
|
3003
|
+
} catch {
|
|
3004
|
+
return void 0;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
function writeOddsOffered(operatorKey, value) {
|
|
3008
|
+
try {
|
|
3009
|
+
window.localStorage.setItem(offeredKey(operatorKey), String(value));
|
|
3010
|
+
} catch {
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
// src/oddsSettingsContext.ts
|
|
3015
|
+
var OddsSettingsContext = createContext({
|
|
3016
|
+
oddsFormat: "decimal",
|
|
3017
|
+
theme: "auto",
|
|
3018
|
+
themeLocked: false,
|
|
3019
|
+
oddsOffered: true,
|
|
3020
|
+
setOddsFormat: () => {
|
|
3021
|
+
},
|
|
3022
|
+
setTheme: () => {
|
|
3023
|
+
}
|
|
3024
|
+
});
|
|
3025
|
+
var useOddsSettings = () => useContext(OddsSettingsContext);
|
|
3026
|
+
function useOddsSettingsState(ui, conversation, operatorKey) {
|
|
3027
|
+
const [stored, setStored] = useState2(readSettings);
|
|
3028
|
+
const [oddsOffered, setOddsOffered] = useState2(() => readOddsOffered(operatorKey) ?? true);
|
|
3029
|
+
useEffect2(() => {
|
|
3030
|
+
let live = true;
|
|
3031
|
+
conversation?.getWidgetSettings?.().then(
|
|
3032
|
+
(s) => {
|
|
3033
|
+
if (live && typeof s?.oddsOffered === "boolean") {
|
|
3034
|
+
writeOddsOffered(operatorKey, s.oddsOffered);
|
|
3035
|
+
setOddsOffered(s.oddsOffered);
|
|
3036
|
+
}
|
|
3037
|
+
},
|
|
3038
|
+
() => {
|
|
3039
|
+
}
|
|
3040
|
+
);
|
|
3041
|
+
return () => {
|
|
3042
|
+
live = false;
|
|
3043
|
+
};
|
|
3044
|
+
}, [conversation, operatorKey]);
|
|
3045
|
+
return useMemo2(() => ({
|
|
3046
|
+
oddsFormat: stored.oddsFormat ?? ui.oddsFormat,
|
|
3047
|
+
userOddsFormat: stored.oddsFormat,
|
|
3048
|
+
theme: stored.theme ?? ui.theme,
|
|
3049
|
+
userTheme: stored.theme,
|
|
3050
|
+
themeLocked: !!(ui.surface || ui.ink),
|
|
3051
|
+
oddsOffered,
|
|
3052
|
+
setOddsFormat: (f) => setStored(writeSettings({ oddsFormat: f })),
|
|
3053
|
+
setTheme: (t) => setStored(writeSettings({ theme: t }))
|
|
3054
|
+
}), [stored, ui.oddsFormat, ui.theme, ui.surface, ui.ink, oddsOffered]);
|
|
2903
3055
|
}
|
|
2904
3056
|
|
|
2905
3057
|
// src/useChatStream.ts
|
|
2906
|
-
import { useCallback as useCallback3, useEffect as
|
|
3058
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo4, useReducer as useReducer2, useRef as useRef4 } from "react";
|
|
2907
3059
|
import { LimitError as LimitError2, WidgetSdkError as WidgetSdkError2 } from "@sensiblestats/widget-sdk";
|
|
2908
3060
|
|
|
2909
3061
|
// src/reducer.ts
|
|
@@ -3140,7 +3292,7 @@ function reducer(state, action) {
|
|
|
3140
3292
|
}
|
|
3141
3293
|
|
|
3142
3294
|
// src/useLiveDashboardPoll.ts
|
|
3143
|
-
import { useEffect as
|
|
3295
|
+
import { useEffect as useEffect3, useReducer, useRef as useRef2 } from "react";
|
|
3144
3296
|
var POLL_INTERVAL_MS = 6e4;
|
|
3145
3297
|
var LEAD_MS = 12e4;
|
|
3146
3298
|
var GIVE_UP_MS = 30 * 6e4;
|
|
@@ -3188,7 +3340,7 @@ function useLiveDashboardPoll({ messages, dispatch, getLiveDashboard }) {
|
|
|
3188
3340
|
anchorRef.current = anchor;
|
|
3189
3341
|
const inFlightRef = useRef2(false);
|
|
3190
3342
|
const anchorKey = anchor ? `${anchor.messageId}:${anchor.kind}` : null;
|
|
3191
|
-
|
|
3343
|
+
useEffect3(() => {
|
|
3192
3344
|
if (!anchorKey || !anchorRef.current) return;
|
|
3193
3345
|
const tick = async () => {
|
|
3194
3346
|
if (inFlightRef.current) return;
|
|
@@ -3224,7 +3376,7 @@ function useLiveDashboardPoll({ messages, dispatch, getLiveDashboard }) {
|
|
|
3224
3376
|
}, POLL_INTERVAL_MS);
|
|
3225
3377
|
return () => window.clearInterval(id);
|
|
3226
3378
|
}, [anchorKey, dispatch, getLiveDashboard]);
|
|
3227
|
-
|
|
3379
|
+
useEffect3(() => {
|
|
3228
3380
|
if (anchorKey !== null) return;
|
|
3229
3381
|
const wakeAt = findEarliestWakeupMs(messages);
|
|
3230
3382
|
if (wakeAt === null) return;
|
|
@@ -3252,7 +3404,7 @@ function readConversation(storageKey, now) {
|
|
|
3252
3404
|
} catch {
|
|
3253
3405
|
return "corrupt";
|
|
3254
3406
|
}
|
|
3255
|
-
if (parsed?.v !==
|
|
3407
|
+
if (parsed?.v !== 2 || !Array.isArray(parsed.messages) || typeof parsed.updatedAt !== "number") return "corrupt";
|
|
3256
3408
|
if (now - parsed.updatedAt > TTL_MS) return "expired";
|
|
3257
3409
|
return { conversationId: parsed.conversationId ?? null, messages: parsed.messages };
|
|
3258
3410
|
}
|
|
@@ -3260,7 +3412,7 @@ function writeConversation(storageKey, conversationId, messages, now) {
|
|
|
3260
3412
|
let capped = messages.slice(-MAX_MESSAGES);
|
|
3261
3413
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
3262
3414
|
try {
|
|
3263
|
-
window.localStorage.setItem(storageKey, JSON.stringify({ v:
|
|
3415
|
+
window.localStorage.setItem(storageKey, JSON.stringify({ v: 2, updatedAt: now, conversationId, messages: capped }));
|
|
3264
3416
|
return;
|
|
3265
3417
|
} catch {
|
|
3266
3418
|
if (capped.length <= 1) return;
|
|
@@ -3286,18 +3438,29 @@ function tileDisplayText(tile) {
|
|
|
3286
3438
|
const subtitle = tile.subtitle?.trim();
|
|
3287
3439
|
return isPriceTile(tile) && subtitle ? subtitle : tile.title;
|
|
3288
3440
|
}
|
|
3441
|
+
var shown = (forms, format2) => forms ? formatOdds(forms, format2) : void 0;
|
|
3442
|
+
function tileForFormat(tile, format2) {
|
|
3443
|
+
return {
|
|
3444
|
+
...tile,
|
|
3445
|
+
title: shown(tile.titleFormats, format2) ?? tile.title,
|
|
3446
|
+
subtitle: shown(tile.subtitleFormats, format2) ?? tile.subtitle,
|
|
3447
|
+
badgeText: shown(tile.badgeFormats, format2) ?? tile.badgeText,
|
|
3448
|
+
actionValue: shown(tile.actionValueFormats, format2) ?? tile.actionValue
|
|
3449
|
+
};
|
|
3450
|
+
}
|
|
3289
3451
|
var MAX_PRICE_TILE_ID = "goal-preset-max-price";
|
|
3290
3452
|
var STANDOUT_TILE_ID = "goal-standout-matches";
|
|
3291
|
-
function bubbleAsks(messages, standoutLabel) {
|
|
3453
|
+
function bubbleAsks(messages, standoutLabel, format2) {
|
|
3292
3454
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
3293
3455
|
const m = messages[i];
|
|
3294
3456
|
if (!m || m.role !== "assistant" || !m.isGreeting) continue;
|
|
3295
3457
|
const dashboard = m.greetingDashboard;
|
|
3296
3458
|
if (!dashboard || !dashboard.tiles.some(isPriceTile)) return [];
|
|
3297
3459
|
const asks = [];
|
|
3460
|
+
const tiles = dashboard.tiles.map((tile) => tileForFormat(tile, format2));
|
|
3298
3461
|
const add = (entityId, labelOf) => {
|
|
3299
|
-
const index =
|
|
3300
|
-
const tile =
|
|
3462
|
+
const index = tiles.findIndex((tile2) => tile2.signal?.entityId === entityId);
|
|
3463
|
+
const tile = tiles[index];
|
|
3301
3464
|
const label = tile ? labelOf(tile)?.trim() : void 0;
|
|
3302
3465
|
if (tile && label) asks.push({ tile, index, position: asks.length, layout: dashboard.layout, label });
|
|
3303
3466
|
};
|
|
@@ -3321,7 +3484,7 @@ import { SPORTS as SPORTS3 } from "@sensiblestats/widget-sdk";
|
|
|
3321
3484
|
var PREFIX = "ss-w-sport:";
|
|
3322
3485
|
var VERSION = 1;
|
|
3323
3486
|
var TTL_MS2 = 30 * 24 * 36e5;
|
|
3324
|
-
var
|
|
3487
|
+
var memory2 = /* @__PURE__ */ new Map();
|
|
3325
3488
|
function sportChoiceKey(operatorId, encodedUserKey2) {
|
|
3326
3489
|
return `${PREFIX}${operatorId}:${encodedUserKey2}`;
|
|
3327
3490
|
}
|
|
@@ -3334,7 +3497,7 @@ function load(key) {
|
|
|
3334
3497
|
if (raw) return raw;
|
|
3335
3498
|
} catch {
|
|
3336
3499
|
}
|
|
3337
|
-
return
|
|
3500
|
+
return memory2.get(key) ?? null;
|
|
3338
3501
|
}
|
|
3339
3502
|
function readSportChoice(operatorId, encodedUserKey2, now) {
|
|
3340
3503
|
const raw = load(sportChoiceKey(operatorId, encodedUserKey2));
|
|
@@ -3353,14 +3516,14 @@ function writeSportChoice(operatorId, encodedUserKey2, sport, now) {
|
|
|
3353
3516
|
const raw = JSON.stringify({ v: VERSION, sport, at: now });
|
|
3354
3517
|
try {
|
|
3355
3518
|
window.localStorage.setItem(key, raw);
|
|
3356
|
-
|
|
3519
|
+
memory2.delete(key);
|
|
3357
3520
|
} catch {
|
|
3358
|
-
|
|
3521
|
+
memory2.set(key, raw);
|
|
3359
3522
|
}
|
|
3360
3523
|
}
|
|
3361
3524
|
|
|
3362
3525
|
// src/useMatchDiscovery.ts
|
|
3363
|
-
import { useCallback as useCallback2, useEffect as
|
|
3526
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
|
|
3364
3527
|
import { matchKey as matchKey2 } from "@sensiblestats/widget-sdk";
|
|
3365
3528
|
|
|
3366
3529
|
// src/scheduleCache.ts
|
|
@@ -3472,24 +3635,24 @@ function localDateOf(now) {
|
|
|
3472
3635
|
return `${y}-${m}-${d}`;
|
|
3473
3636
|
}
|
|
3474
3637
|
function useMatchDiscovery(opts) {
|
|
3475
|
-
const [groups, setGroups] =
|
|
3476
|
-
const [states, setStates] =
|
|
3477
|
-
const [failures, setFailures] =
|
|
3638
|
+
const [groups, setGroups] = useState3([]);
|
|
3639
|
+
const [states, setStates] = useState3(() => /* @__PURE__ */ new Map());
|
|
3640
|
+
const [failures, setFailures] = useState3(0);
|
|
3478
3641
|
const groupsRef = useRef3(groups);
|
|
3479
3642
|
groupsRef.current = groups;
|
|
3480
3643
|
const statesRef = useRef3(states);
|
|
3481
3644
|
statesRef.current = states;
|
|
3482
3645
|
const getStatesRef = useRef3(opts.getStates);
|
|
3483
3646
|
getStatesRef.current = opts.getStates;
|
|
3484
|
-
const [localDate, setLocalDate] =
|
|
3485
|
-
|
|
3647
|
+
const [localDate, setLocalDate] = useState3(() => localDateOf(/* @__PURE__ */ new Date()));
|
|
3648
|
+
useEffect4(() => {
|
|
3486
3649
|
const id = setInterval(() => {
|
|
3487
3650
|
const next = localDateOf(/* @__PURE__ */ new Date());
|
|
3488
3651
|
setLocalDate((prev) => prev === next ? prev : next);
|
|
3489
3652
|
}, ROLLOVER_CHECK_MS);
|
|
3490
3653
|
return () => clearInterval(id);
|
|
3491
3654
|
}, []);
|
|
3492
|
-
|
|
3655
|
+
useEffect4(() => {
|
|
3493
3656
|
let cancelled = false;
|
|
3494
3657
|
const utcOffsetMinutes = -(/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
3495
3658
|
const key = encodedUserKey(opts.operatorUserId, opts.anonymousUserId);
|
|
@@ -3531,7 +3694,7 @@ function useMatchDiscovery(opts) {
|
|
|
3531
3694
|
setFailures((n) => n + 1);
|
|
3532
3695
|
}
|
|
3533
3696
|
}, []);
|
|
3534
|
-
|
|
3697
|
+
useEffect4(() => {
|
|
3535
3698
|
if (!opts.isOpen) return;
|
|
3536
3699
|
void tick();
|
|
3537
3700
|
const id = setInterval(() => {
|
|
@@ -3540,7 +3703,7 @@ function useMatchDiscovery(opts) {
|
|
|
3540
3703
|
return () => clearInterval(id);
|
|
3541
3704
|
}, [opts.isOpen, tick, groups]);
|
|
3542
3705
|
const stale = failures >= STALE_AFTER_FAILURES;
|
|
3543
|
-
const liveCount =
|
|
3706
|
+
const liveCount = useMemo3(
|
|
3544
3707
|
() => stale ? 0 : [...states.values()].filter((s) => s.phase === "live").length,
|
|
3545
3708
|
[states, stale]
|
|
3546
3709
|
);
|
|
@@ -3589,8 +3752,8 @@ var CARD_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
3589
3752
|
"combo_card",
|
|
3590
3753
|
"odds_movement"
|
|
3591
3754
|
]);
|
|
3592
|
-
function useChatStream(conversation, starterTexts, greetingMessage, storageKey, page, sportScope, language, options) {
|
|
3593
|
-
const boot =
|
|
3755
|
+
function useChatStream(conversation, starterTexts, greetingMessage, storageKey, page, sportScope, language, options, oddsFormat) {
|
|
3756
|
+
const boot = useMemo4(() => {
|
|
3594
3757
|
const payload = storageKey ? readConversation(storageKey, Date.now()) : null;
|
|
3595
3758
|
const restored = payload != null && payload !== "expired" && payload !== "corrupt";
|
|
3596
3759
|
const base = initialState(starterTexts.map(chipFromText));
|
|
@@ -3618,7 +3781,21 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3618
3781
|
languageRef.current = language;
|
|
3619
3782
|
const builtWithRef = useRef4({ conversation, language });
|
|
3620
3783
|
if (builtWithRef.current.conversation !== conversation) builtWithRef.current = { conversation, language };
|
|
3621
|
-
const
|
|
3784
|
+
const oddsFormatRef = useRef4(oddsFormat);
|
|
3785
|
+
oddsFormatRef.current = oddsFormat;
|
|
3786
|
+
const withLanguage = (input) => {
|
|
3787
|
+
const languageChanged = languageRef.current !== builtWithRef.current.language;
|
|
3788
|
+
const format2 = oddsFormatRef.current;
|
|
3789
|
+
if (!languageChanged && format2 === void 0) return input;
|
|
3790
|
+
return {
|
|
3791
|
+
...input,
|
|
3792
|
+
userContext: {
|
|
3793
|
+
...input.userContext,
|
|
3794
|
+
...languageChanged ? { defaultLanguage: languageRef.current } : {},
|
|
3795
|
+
...format2 !== void 0 ? { oddsFormat: format2 } : {}
|
|
3796
|
+
}
|
|
3797
|
+
};
|
|
3798
|
+
};
|
|
3622
3799
|
const greetedKeyRef = useRef4(null);
|
|
3623
3800
|
const greetingCancelledRef = useRef4(false);
|
|
3624
3801
|
const restoreSeededRef = useRef4(false);
|
|
@@ -3676,7 +3853,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3676
3853
|
const run = useCallback3((input, source, displayText2) => {
|
|
3677
3854
|
if (isPaused(stateRef.current.limit)) return;
|
|
3678
3855
|
const track = optionsRef.current?.track;
|
|
3679
|
-
const
|
|
3856
|
+
const shown2 = displayText2 ?? input.message;
|
|
3680
3857
|
const userId = nextId();
|
|
3681
3858
|
const assistantId = nextId();
|
|
3682
3859
|
activeTurnRef.current?.abandon();
|
|
@@ -3697,7 +3874,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3697
3874
|
};
|
|
3698
3875
|
activeTurnRef.current = turn;
|
|
3699
3876
|
dispatch({ kind: "USER_SENT", input, userId, assistantId, displayText: displayText2 });
|
|
3700
|
-
track?.({ name: "question_asked", turnId: turn.id, source, length:
|
|
3877
|
+
track?.({ name: "question_asked", turnId: turn.id, source, length: shown2.length, ...optionsRef.current?.eventText?.() ? { text: shown2 } : {} });
|
|
3701
3878
|
const handle = conversation.send(withLanguage(input));
|
|
3702
3879
|
handleRef.current = handle;
|
|
3703
3880
|
armFallbackTimer(() => {
|
|
@@ -3751,13 +3928,13 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3751
3928
|
dispatch({ kind: "STOP" });
|
|
3752
3929
|
}
|
|
3753
3930
|
}, [greetingMessage, conversation, consume, clearFallbackTimer, armFallbackTimer]);
|
|
3754
|
-
|
|
3931
|
+
useEffect5(() => {
|
|
3755
3932
|
if (greetedRef.current) return;
|
|
3756
3933
|
greetedRef.current = true;
|
|
3757
3934
|
fireGreeting();
|
|
3758
3935
|
}, [fireGreeting]);
|
|
3759
3936
|
const key = pageKey(page);
|
|
3760
|
-
|
|
3937
|
+
useEffect5(() => {
|
|
3761
3938
|
if (greetedKeyRef.current === null) return;
|
|
3762
3939
|
if (key === greetedKeyRef.current && !greetingCancelledRef.current) return;
|
|
3763
3940
|
if (stateRef.current.messages.some((m) => m.role === "user")) return;
|
|
@@ -3775,7 +3952,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3775
3952
|
return () => clearTimeout(timer);
|
|
3776
3953
|
}, [key, conversation, fireGreeting]);
|
|
3777
3954
|
const keyRef = useRef4(storageKey);
|
|
3778
|
-
|
|
3955
|
+
useEffect5(() => {
|
|
3779
3956
|
if (keyRef.current === storageKey) return;
|
|
3780
3957
|
keyRef.current = storageKey;
|
|
3781
3958
|
activeTurnRef.current?.abandon();
|
|
@@ -3796,17 +3973,17 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3796
3973
|
dispatch({ kind: "RESET" });
|
|
3797
3974
|
fireGreeting();
|
|
3798
3975
|
}, [storageKey, conversation, clearFallbackTimer, fireGreeting]);
|
|
3799
|
-
|
|
3976
|
+
useEffect5(() => {
|
|
3800
3977
|
if (!state.limit) return;
|
|
3801
3978
|
const delay = limitDelayMs(state.limit, Date.now());
|
|
3802
3979
|
if (delay === null) return;
|
|
3803
3980
|
const timer = setTimeout(() => dispatch({ kind: "LIMIT_EXPIRED" }), delay);
|
|
3804
3981
|
return () => clearTimeout(timer);
|
|
3805
3982
|
}, [state.limit]);
|
|
3806
|
-
|
|
3983
|
+
useEffect5(() => {
|
|
3807
3984
|
if (boot.stale && storageKey) clearConversation(storageKey);
|
|
3808
3985
|
}, []);
|
|
3809
|
-
|
|
3986
|
+
useEffect5(() => {
|
|
3810
3987
|
if (!storageKey || state.isStreaming) return;
|
|
3811
3988
|
if (hydratedRef.current) {
|
|
3812
3989
|
hydratedRef.current = false;
|
|
@@ -3823,7 +4000,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3823
4000
|
if (persistable.length === 0) return;
|
|
3824
4001
|
writeConversation(storageKey, state.conversationId, persistable, Date.now());
|
|
3825
4002
|
}, [storageKey, state.isStreaming, state.messages, state.conversationId]);
|
|
3826
|
-
|
|
4003
|
+
useEffect5(() => {
|
|
3827
4004
|
if (!storageKey) return;
|
|
3828
4005
|
const onStorage = (e) => {
|
|
3829
4006
|
if (e.key !== storageKey || e.storageArea !== window.localStorage) return;
|
|
@@ -3887,7 +4064,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3887
4064
|
}
|
|
3888
4065
|
|
|
3889
4066
|
// src/useLiveMonitor.ts
|
|
3890
|
-
import { useCallback as useCallback4, useEffect as
|
|
4067
|
+
import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef5, useState as useState5 } from "react";
|
|
3891
4068
|
|
|
3892
4069
|
// src/pinStore.ts
|
|
3893
4070
|
import { SPORTS as SPORTS4, sportOf as sportOf5 } from "@sensiblestats/widget-sdk";
|
|
@@ -4014,9 +4191,9 @@ function orderTiles(pins, snapshot, seedOf) {
|
|
|
4014
4191
|
}
|
|
4015
4192
|
|
|
4016
4193
|
// src/useTabs.ts
|
|
4017
|
-
import { useState as
|
|
4194
|
+
import { useState as useState4 } from "react";
|
|
4018
4195
|
function useTabs(initial = "chat") {
|
|
4019
|
-
const [activeTab, setActiveTab] =
|
|
4196
|
+
const [activeTab, setActiveTab] = useState4(initial);
|
|
4020
4197
|
return { activeTab, setActiveTab };
|
|
4021
4198
|
}
|
|
4022
4199
|
|
|
@@ -4039,7 +4216,7 @@ function priceForPin(snapshot, pin) {
|
|
|
4039
4216
|
const rows = market?.card?.rows;
|
|
4040
4217
|
if (!rows || rows.length === 0) return void 0;
|
|
4041
4218
|
const row = pin.matchOddsId != null ? rows.find((r) => r.matchOddsId === pin.matchOddsId) : rows[0];
|
|
4042
|
-
return row
|
|
4219
|
+
return row ? { value: row.price, forms: row.priceFormats } : void 0;
|
|
4043
4220
|
}
|
|
4044
4221
|
function phaseForPin(snapshot, pin) {
|
|
4045
4222
|
if (pin.kind === "match") return matchFor(snapshot, pin)?.phase;
|
|
@@ -4047,19 +4224,19 @@ function phaseForPin(snapshot, pin) {
|
|
|
4047
4224
|
}
|
|
4048
4225
|
function useLiveMonitor(opts) {
|
|
4049
4226
|
const sessionIdRef = useRef5(crypto.randomUUID());
|
|
4050
|
-
const [pins, setPins] =
|
|
4051
|
-
const [store] =
|
|
4052
|
-
const [enabled, setEnabled] =
|
|
4053
|
-
const [snapshot, setSnapshotState] =
|
|
4227
|
+
const [pins, setPins] = useState5([]);
|
|
4228
|
+
const [store] = useState5(() => createPinStore(opts.storageKey, sessionIdRef.current, setPins));
|
|
4229
|
+
const [enabled, setEnabled] = useState5(true);
|
|
4230
|
+
const [snapshot, setSnapshotState] = useState5(null);
|
|
4054
4231
|
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] =
|
|
4232
|
+
const [chatDot, setChatDot] = useState5(false);
|
|
4233
|
+
const [matchesDot, setMatchesDot] = useState5(false);
|
|
4234
|
+
const [trendsDot, setTrendsDot] = useState5(false);
|
|
4235
|
+
const [todayDot, setTodayDot] = useState5(false);
|
|
4236
|
+
const [lastViewedPrices, setLastViewedPrices] = useState5({});
|
|
4237
|
+
const [openMarket, setOpenMarket] = useState5({});
|
|
4238
|
+
const [selectedMatchKey, setSelectedMatchKey] = useState5(null);
|
|
4239
|
+
const [marketOdds, setMarketOdds] = useState5({});
|
|
4063
4240
|
const pinsRef = useRef5(pins);
|
|
4064
4241
|
pinsRef.current = pins;
|
|
4065
4242
|
const watchesRef = useRef5(opts.watches ?? []);
|
|
@@ -4125,7 +4302,7 @@ function useLiveMonitor(opts) {
|
|
|
4125
4302
|
const getPlayerPropsRef = useRef5(opts.getPlayerProps);
|
|
4126
4303
|
getPlayerPropsRef.current = opts.getPlayerProps;
|
|
4127
4304
|
const playerPropsRef = useRef5({});
|
|
4128
|
-
const [playerProps, setPlayerProps] =
|
|
4305
|
+
const [playerProps, setPlayerProps] = useState5({});
|
|
4129
4306
|
const loadPlayerProps = useCallback4((matchId, sport) => {
|
|
4130
4307
|
const fn = getPlayerPropsRef.current;
|
|
4131
4308
|
if (!fn) return;
|
|
@@ -4201,7 +4378,7 @@ function useLiveMonitor(opts) {
|
|
|
4201
4378
|
const out = { ...prevMap };
|
|
4202
4379
|
for (const pin of marketPins) {
|
|
4203
4380
|
const price = priceForPin(next, pin);
|
|
4204
|
-
if (price !== void 0 && out[pin.key] !== price) {
|
|
4381
|
+
if (price !== void 0 && out[pin.key]?.value !== price.value) {
|
|
4205
4382
|
out[pin.key] = price;
|
|
4206
4383
|
changed = true;
|
|
4207
4384
|
}
|
|
@@ -4213,7 +4390,7 @@ function useLiveMonitor(opts) {
|
|
|
4213
4390
|
for (const pin of marketPins) {
|
|
4214
4391
|
const price = priceForPin(next, pin);
|
|
4215
4392
|
const last = lastViewedPricesRef.current[pin.key];
|
|
4216
|
-
if (price !== void 0 && last !== void 0 && price !== last) {
|
|
4393
|
+
if (price !== void 0 && last !== void 0 && price.value !== last.value) {
|
|
4217
4394
|
sawPriceMove = true;
|
|
4218
4395
|
break;
|
|
4219
4396
|
}
|
|
@@ -4286,14 +4463,14 @@ function useLiveMonitor(opts) {
|
|
|
4286
4463
|
const hinted = snapshotRef.current ? snapshotRef.current.nextPollSeconds * 1e3 : fallbackMs;
|
|
4287
4464
|
timerRef.current = window.setTimeout(() => void tick(), Math.max(MIN_POLL_MS, hinted));
|
|
4288
4465
|
};
|
|
4289
|
-
|
|
4466
|
+
useEffect6(() => {
|
|
4290
4467
|
mountedRef.current = true;
|
|
4291
4468
|
return () => {
|
|
4292
4469
|
mountedRef.current = false;
|
|
4293
4470
|
};
|
|
4294
4471
|
}, []);
|
|
4295
4472
|
const prevPinsLengthRef = useRef5(0);
|
|
4296
|
-
|
|
4473
|
+
useEffect6(() => {
|
|
4297
4474
|
const wasEmpty = prevPinsLengthRef.current === 0 && watchesRef.current.length === 0;
|
|
4298
4475
|
prevPinsLengthRef.current = pins.length;
|
|
4299
4476
|
if (pins.length === 0 && watchesRef.current.length === 0) {
|
|
@@ -4304,17 +4481,17 @@ function useLiveMonitor(opts) {
|
|
|
4304
4481
|
}, [pins.length, tick]);
|
|
4305
4482
|
const prevWatchesLengthRef = useRef5(0);
|
|
4306
4483
|
const watchesLength = opts.watches?.length ?? 0;
|
|
4307
|
-
|
|
4484
|
+
useEffect6(() => {
|
|
4308
4485
|
const wasEmpty = prevWatchesLengthRef.current === 0 && pinsRef.current.length === 0;
|
|
4309
4486
|
prevWatchesLengthRef.current = watchesLength;
|
|
4310
4487
|
if (wasEmpty && watchesLength > 0) void tick();
|
|
4311
4488
|
}, [watchesLength, tick]);
|
|
4312
|
-
|
|
4489
|
+
useEffect6(() => {
|
|
4313
4490
|
const matchPins = pins.filter((p) => p.kind === "match");
|
|
4314
4491
|
if (selectedRef.current !== null && matchPins.some((p) => p.key === selectedRef.current)) return;
|
|
4315
4492
|
chooseSelection(orderTiles(matchPins, snapshotRef.current)[0]?.pin.key ?? null);
|
|
4316
4493
|
}, [pins, chooseSelection]);
|
|
4317
|
-
|
|
4494
|
+
useEffect6(() => {
|
|
4318
4495
|
if (clubEnabled && (activeTab === "today" || activeTab === "following" || activeTab === "trends")) {
|
|
4319
4496
|
setActiveTabState("chat");
|
|
4320
4497
|
return;
|
|
@@ -4326,12 +4503,12 @@ function useLiveMonitor(opts) {
|
|
|
4326
4503
|
if (activeTab === "today" && !hasToday) setActiveTabState("chat");
|
|
4327
4504
|
}, [pins, activeTab, hasToday, clubEnabled]);
|
|
4328
4505
|
const prevIsOpenRef = useRef5(false);
|
|
4329
|
-
|
|
4506
|
+
useEffect6(() => {
|
|
4330
4507
|
const wasClosed = !prevIsOpenRef.current;
|
|
4331
4508
|
prevIsOpenRef.current = opts.isOpen;
|
|
4332
4509
|
if (wasClosed && opts.isOpen) void tick();
|
|
4333
4510
|
}, [opts.isOpen, tick]);
|
|
4334
|
-
|
|
4511
|
+
useEffect6(() => {
|
|
4335
4512
|
const onVisibility = () => {
|
|
4336
4513
|
if (document.visibilityState === "hidden") window.clearTimeout(timerRef.current);
|
|
4337
4514
|
else void tick();
|
|
@@ -4440,17 +4617,17 @@ function useLiveMonitor(opts) {
|
|
|
4440
4617
|
}
|
|
4441
4618
|
|
|
4442
4619
|
// src/useGames.ts
|
|
4443
|
-
import { useCallback as useCallback5, useEffect as
|
|
4620
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef6, useState as useState6 } from "react";
|
|
4444
4621
|
var GAMES_POLL_MS = 6e4;
|
|
4445
4622
|
var DEFAULT_TZ = "Europe/London";
|
|
4446
4623
|
function computeGameDay(timezone) {
|
|
4447
4624
|
return new Intl.DateTimeFormat("en-CA", { timeZone: timezone }).format(/* @__PURE__ */ new Date());
|
|
4448
4625
|
}
|
|
4449
4626
|
function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
4450
|
-
const [enabled, setEnabled] =
|
|
4451
|
-
const [games, setGames] =
|
|
4452
|
-
const [loading, setLoading] =
|
|
4453
|
-
const [refreshCount, setRefreshCount] =
|
|
4627
|
+
const [enabled, setEnabled] = useState6(false);
|
|
4628
|
+
const [games, setGames] = useState6([]);
|
|
4629
|
+
const [loading, setLoading] = useState6(false);
|
|
4630
|
+
const [refreshCount, setRefreshCount] = useState6(0);
|
|
4454
4631
|
const inFlightRef = useRef6(false);
|
|
4455
4632
|
const hardOffRef = useRef6(false);
|
|
4456
4633
|
const conversationRef = useRef6(conversation);
|
|
@@ -4458,7 +4635,7 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4458
4635
|
const tzRef = useRef6(operatorTimezone ?? DEFAULT_TZ);
|
|
4459
4636
|
tzRef.current = operatorTimezone ?? DEFAULT_TZ;
|
|
4460
4637
|
const ready = conversation != null;
|
|
4461
|
-
|
|
4638
|
+
useEffect7(() => {
|
|
4462
4639
|
if (hardOffRef.current) return;
|
|
4463
4640
|
let active = true;
|
|
4464
4641
|
const doFetch = async () => {
|
|
@@ -4508,15 +4685,15 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4508
4685
|
}
|
|
4509
4686
|
|
|
4510
4687
|
// src/useLeaderboard.ts
|
|
4511
|
-
import { useCallback as useCallback6, useEffect as
|
|
4688
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef7, useState as useState7 } from "react";
|
|
4512
4689
|
function useLeaderboard(conversation, { activeTab }) {
|
|
4513
|
-
const [data, setData] =
|
|
4514
|
-
const [loading, setLoading] =
|
|
4515
|
-
const [refreshCount, setRefreshCount] =
|
|
4690
|
+
const [data, setData] = useState7(null);
|
|
4691
|
+
const [loading, setLoading] = useState7(false);
|
|
4692
|
+
const [refreshCount, setRefreshCount] = useState7(0);
|
|
4516
4693
|
const inFlightRef = useRef7(false);
|
|
4517
4694
|
const conversationRef = useRef7(conversation);
|
|
4518
4695
|
conversationRef.current = conversation;
|
|
4519
|
-
|
|
4696
|
+
useEffect8(() => {
|
|
4520
4697
|
if (activeTab !== "games") return;
|
|
4521
4698
|
let active = true;
|
|
4522
4699
|
const doFetch = async () => {
|
|
@@ -4546,29 +4723,29 @@ function useLeaderboard(conversation, { activeTab }) {
|
|
|
4546
4723
|
}
|
|
4547
4724
|
|
|
4548
4725
|
// src/useClubFixtures.ts
|
|
4549
|
-
import { useCallback as useCallback7, useEffect as
|
|
4726
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useRef as useRef8, useState as useState8 } from "react";
|
|
4550
4727
|
var CLUB_PROBE_RETRY_MS = 15e3;
|
|
4551
4728
|
var CLUB_PROBE_MAX_ATTEMPTS = 3;
|
|
4552
4729
|
var CLUB_TAB_WAIT_MS = 2e3;
|
|
4553
4730
|
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] =
|
|
4731
|
+
const [enabled, setEnabled] = useState8(false);
|
|
4732
|
+
const [settled, setSettled] = useState8(false);
|
|
4733
|
+
const [failed, setFailed] = useState8(false);
|
|
4734
|
+
const [waited, setWaited] = useState8(false);
|
|
4735
|
+
const [fixtures, setFixtures] = useState8([]);
|
|
4736
|
+
const [loading, setLoading] = useState8(false);
|
|
4737
|
+
const [refreshCount, setRefreshCount] = useState8(0);
|
|
4561
4738
|
const inFlightRef = useRef8(false);
|
|
4562
4739
|
const hardOffRef = useRef8(false);
|
|
4563
4740
|
const conversationRef = useRef8(conversation);
|
|
4564
4741
|
conversationRef.current = conversation;
|
|
4565
4742
|
const ready = conversation != null;
|
|
4566
|
-
|
|
4743
|
+
useEffect9(() => {
|
|
4567
4744
|
if (!ready) return;
|
|
4568
4745
|
const id = window.setTimeout(() => setWaited(true), CLUB_TAB_WAIT_MS);
|
|
4569
4746
|
return () => window.clearTimeout(id);
|
|
4570
4747
|
}, [ready]);
|
|
4571
|
-
|
|
4748
|
+
useEffect9(() => {
|
|
4572
4749
|
if (hardOffRef.current) return;
|
|
4573
4750
|
let active = true;
|
|
4574
4751
|
let retryTimeoutId;
|
|
@@ -4620,15 +4797,15 @@ function useClubFixtures(conversation) {
|
|
|
4620
4797
|
}
|
|
4621
4798
|
|
|
4622
4799
|
// src/useClubStandings.ts
|
|
4623
|
-
import { useCallback as useCallback8, useEffect as
|
|
4800
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useRef as useRef9, useState as useState9 } from "react";
|
|
4624
4801
|
function useClubStandings(conversation, { activeTab, enabled }) {
|
|
4625
|
-
const [data, setData] =
|
|
4626
|
-
const [loading, setLoading] =
|
|
4627
|
-
const [refreshCount, setRefreshCount] =
|
|
4802
|
+
const [data, setData] = useState9(null);
|
|
4803
|
+
const [loading, setLoading] = useState9(false);
|
|
4804
|
+
const [refreshCount, setRefreshCount] = useState9(0);
|
|
4628
4805
|
const inFlightRef = useRef9(false);
|
|
4629
4806
|
const conversationRef = useRef9(conversation);
|
|
4630
4807
|
conversationRef.current = conversation;
|
|
4631
|
-
|
|
4808
|
+
useEffect10(() => {
|
|
4632
4809
|
if (activeTab !== "standings" || !enabled) return;
|
|
4633
4810
|
let active = true;
|
|
4634
4811
|
const doFetch = async () => {
|
|
@@ -4659,15 +4836,15 @@ function useClubStandings(conversation, { activeTab, enabled }) {
|
|
|
4659
4836
|
}
|
|
4660
4837
|
|
|
4661
4838
|
// src/useClubSquad.ts
|
|
4662
|
-
import { useCallback as useCallback9, useEffect as
|
|
4839
|
+
import { useCallback as useCallback9, useEffect as useEffect11, useRef as useRef10, useState as useState10 } from "react";
|
|
4663
4840
|
function useClubSquad(conversation, { activeTab, enabled }) {
|
|
4664
|
-
const [data, setData] =
|
|
4665
|
-
const [loading, setLoading] =
|
|
4666
|
-
const [refreshCount, setRefreshCount] =
|
|
4841
|
+
const [data, setData] = useState10(null);
|
|
4842
|
+
const [loading, setLoading] = useState10(false);
|
|
4843
|
+
const [refreshCount, setRefreshCount] = useState10(0);
|
|
4667
4844
|
const inFlightRef = useRef10(false);
|
|
4668
4845
|
const conversationRef = useRef10(conversation);
|
|
4669
4846
|
conversationRef.current = conversation;
|
|
4670
|
-
|
|
4847
|
+
useEffect11(() => {
|
|
4671
4848
|
if (activeTab !== "squad" || !enabled) return;
|
|
4672
4849
|
let active = true;
|
|
4673
4850
|
const doFetch = async () => {
|
|
@@ -4698,18 +4875,18 @@ function useClubSquad(conversation, { activeTab, enabled }) {
|
|
|
4698
4875
|
}
|
|
4699
4876
|
|
|
4700
4877
|
// src/useClubSquadStats.ts
|
|
4701
|
-
import { useCallback as useCallback10, useEffect as
|
|
4878
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef11, useState as useState11 } from "react";
|
|
4702
4879
|
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] =
|
|
4880
|
+
const [data, setData] = useState11(null);
|
|
4881
|
+
const [seasonName, setSeasonName] = useState11(null);
|
|
4882
|
+
const [competitionName, setCompetitionName] = useState11(null);
|
|
4883
|
+
const [matchesPlayed, setMatchesPlayed] = useState11(null);
|
|
4884
|
+
const [loading, setLoading] = useState11(false);
|
|
4885
|
+
const [refreshCount, setRefreshCount] = useState11(0);
|
|
4709
4886
|
const inFlightRef = useRef11(false);
|
|
4710
4887
|
const conversationRef = useRef11(conversation);
|
|
4711
4888
|
conversationRef.current = conversation;
|
|
4712
|
-
|
|
4889
|
+
useEffect12(() => {
|
|
4713
4890
|
if (activeTab !== "squad" || !enabled) return;
|
|
4714
4891
|
let active = true;
|
|
4715
4892
|
const doFetch = async () => {
|
|
@@ -4745,10 +4922,10 @@ function useClubSquadStats(conversation, { activeTab, enabled }) {
|
|
|
4745
4922
|
}
|
|
4746
4923
|
|
|
4747
4924
|
// src/useClubPlayerDetail.ts
|
|
4748
|
-
import { useCallback as useCallback11, useRef as useRef12, useState as
|
|
4925
|
+
import { useCallback as useCallback11, useRef as useRef12, useState as useState12 } from "react";
|
|
4749
4926
|
function useClubPlayerDetail(conversation) {
|
|
4750
|
-
const [data, setData] =
|
|
4751
|
-
const [loading, setLoading] =
|
|
4927
|
+
const [data, setData] = useState12(null);
|
|
4928
|
+
const [loading, setLoading] = useState12(false);
|
|
4752
4929
|
const requestSeqRef = useRef12(0);
|
|
4753
4930
|
const conversationRef = useRef12(conversation);
|
|
4754
4931
|
conversationRef.current = conversation;
|
|
@@ -4777,12 +4954,9 @@ function useClubPlayerDetail(conversation) {
|
|
|
4777
4954
|
}
|
|
4778
4955
|
|
|
4779
4956
|
// src/usePresetGrid.ts
|
|
4780
|
-
import { useEffect as
|
|
4957
|
+
import { useEffect as useEffect13, useRef as useRef13, useState as useState13 } from "react";
|
|
4781
4958
|
|
|
4782
4959
|
// 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
4960
|
var FIXED_SINGLES_COUNT = 3;
|
|
4787
4961
|
var MIN_COMBO_LEGS = 2;
|
|
4788
4962
|
var MAX_COMBO_LEGS = 6;
|
|
@@ -4795,27 +4969,15 @@ function samePrice(a, b) {
|
|
|
4795
4969
|
function isPresetGrid(v) {
|
|
4796
4970
|
if (!v || typeof v !== "object") return false;
|
|
4797
4971
|
const g = v;
|
|
4798
|
-
return Array.isArray(g.singles) && Array.isArray(g.singlesFrom) && Array.isArray(g.combos) && finite2(g.maxLegs);
|
|
4972
|
+
return Array.isArray(g.singles) && Array.isArray(g.singlesFrom) && Array.isArray(g.combos) && Array.isArray(g.limitOptions) && Array.isArray(g.floorOptions) && Array.isArray(g.totalOptions) && finite2(g.maxLegs);
|
|
4799
4973
|
}
|
|
4800
4974
|
function drawable(p) {
|
|
4801
4975
|
return !!p && finite2(p.price) && finite2(p.matchOddsId) && finite2(p.matchId) && typeof p.homeTeamName === "string" && typeof p.awayTeamName === "string";
|
|
4802
4976
|
}
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
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
|
-
}
|
|
4977
|
+
var byValue = (options) => [...options].sort((a, b) => a.value - b.value);
|
|
4978
|
+
var singlesLimits = (grid) => byValue(grid.limitOptions);
|
|
4979
|
+
var singlesFloors = (grid) => byValue(grid.floorOptions);
|
|
4980
|
+
var comboTotals = (grid) => byValue(grid.totalOptions);
|
|
4819
4981
|
function comboLegChoices(grid) {
|
|
4820
4982
|
const max = Math.min(MAX_COMBO_LEGS, Math.floor(grid.maxLegs));
|
|
4821
4983
|
const out = [];
|
|
@@ -4885,24 +5047,27 @@ function startCombo(grid, totals, legChoices, startTotal, startLegs) {
|
|
|
4885
5047
|
function idsOf(picks) {
|
|
4886
5048
|
return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
|
|
4887
5049
|
}
|
|
4888
|
-
function maxPriceAsk(cell2, s) {
|
|
5050
|
+
function maxPriceAsk(cell2, s, format2) {
|
|
5051
|
+
const price = formatOdds(cell2.priceFormats, format2);
|
|
4889
5052
|
return {
|
|
4890
|
-
message: s.maxPriceMessage(cell2.count,
|
|
4891
|
-
displayText: s.maxPriceDisplay(cell2.count,
|
|
5053
|
+
message: s.maxPriceMessage(cell2.count, price),
|
|
5054
|
+
displayText: s.maxPriceDisplay(cell2.count, price),
|
|
4892
5055
|
preset: { kind: "max_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4893
5056
|
};
|
|
4894
5057
|
}
|
|
4895
|
-
function minPriceAsk(cell2, s) {
|
|
5058
|
+
function minPriceAsk(cell2, s, format2) {
|
|
5059
|
+
const price = formatOdds(cell2.priceFormats, format2);
|
|
4896
5060
|
return {
|
|
4897
|
-
message: s.minPriceMessage(cell2.count,
|
|
4898
|
-
displayText: s.minPriceDisplay(cell2.count,
|
|
5061
|
+
message: s.minPriceMessage(cell2.count, price),
|
|
5062
|
+
displayText: s.minPriceDisplay(cell2.count, price),
|
|
4899
5063
|
preset: { kind: "min_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4900
5064
|
};
|
|
4901
5065
|
}
|
|
4902
|
-
function comboAsk(cell2, s) {
|
|
5066
|
+
function comboAsk(cell2, s, format2) {
|
|
5067
|
+
const total = formatOdds(cell2.totalFormats, format2);
|
|
4903
5068
|
return {
|
|
4904
|
-
message: s.comboMessage(cell2.legs,
|
|
4905
|
-
displayText: s.comboDisplay(cell2.legs,
|
|
5069
|
+
message: s.comboMessage(cell2.legs, total),
|
|
5070
|
+
displayText: s.comboDisplay(cell2.legs, total),
|
|
4906
5071
|
preset: { kind: "combo", total: cell2.total, legs: cell2.legs, ...idsOf(cell2.combo.legs) }
|
|
4907
5072
|
};
|
|
4908
5073
|
}
|
|
@@ -4920,7 +5085,7 @@ function marketDisplay(cell2, s) {
|
|
|
4920
5085
|
// src/usePresetGrid.ts
|
|
4921
5086
|
var GRID_MAX_AGE_MS = 6e5;
|
|
4922
5087
|
function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
4923
|
-
const [grid, setGrid] =
|
|
5088
|
+
const [grid, setGrid] = useState13(null);
|
|
4924
5089
|
const keptRef = useRef13(null);
|
|
4925
5090
|
const localeRef = useRef13(locale);
|
|
4926
5091
|
const inFlightRef = useRef13(false);
|
|
@@ -4929,13 +5094,13 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
4929
5094
|
getRef.current = getPricePresets;
|
|
4930
5095
|
const nowRef = useRef13(now);
|
|
4931
5096
|
nowRef.current = now;
|
|
4932
|
-
|
|
5097
|
+
useEffect13(() => {
|
|
4933
5098
|
mountedRef.current = true;
|
|
4934
5099
|
return () => {
|
|
4935
5100
|
mountedRef.current = false;
|
|
4936
5101
|
};
|
|
4937
5102
|
}, []);
|
|
4938
|
-
|
|
5103
|
+
useEffect13(() => {
|
|
4939
5104
|
if (localeRef.current !== locale) {
|
|
4940
5105
|
localeRef.current = locale;
|
|
4941
5106
|
keptRef.current = null;
|
|
@@ -4967,7 +5132,7 @@ function hasAnyCell(grid) {
|
|
|
4967
5132
|
}
|
|
4968
5133
|
|
|
4969
5134
|
// src/useFavourites.ts
|
|
4970
|
-
import { useCallback as useCallback12, useEffect as
|
|
5135
|
+
import { useCallback as useCallback12, useEffect as useEffect14, useRef as useRef14, useState as useState14 } from "react";
|
|
4971
5136
|
var LIST_OF = { competition: "competitions", team: "teams", player: "players" };
|
|
4972
5137
|
var keyOf = (kind, id) => `${kind}:${id}`;
|
|
4973
5138
|
function idle(enabled) {
|
|
@@ -5022,8 +5187,8 @@ function revertStar(prev, before, kind, id, next) {
|
|
|
5022
5187
|
}
|
|
5023
5188
|
function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, enabled, track }) {
|
|
5024
5189
|
const live = enabled && conversation !== null;
|
|
5025
|
-
const [state, setState] =
|
|
5026
|
-
const [pendingKey, setPendingKey] =
|
|
5190
|
+
const [state, setState] = useState14(() => idle(live));
|
|
5191
|
+
const [pendingKey, setPendingKey] = useState14(null);
|
|
5027
5192
|
const stateRef = useRef14(state);
|
|
5028
5193
|
stateRef.current = state;
|
|
5029
5194
|
const scopeRef = useRef14(0);
|
|
@@ -5069,7 +5234,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5069
5234
|
inFlightRef.current = run;
|
|
5070
5235
|
return run;
|
|
5071
5236
|
}, [live, conversation, sport, operatorUserId, anonymousUserId, identityKey]);
|
|
5072
|
-
|
|
5237
|
+
useEffect14(() => {
|
|
5073
5238
|
scopeRef.current += 1;
|
|
5074
5239
|
inFlightRef.current = null;
|
|
5075
5240
|
pendingRef.current = null;
|
|
@@ -5079,7 +5244,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5079
5244
|
setState(refusedRef.current === identityKey ? { status: "refused", data: null, starred: /* @__PURE__ */ new Set() } : idle(live));
|
|
5080
5245
|
void load2();
|
|
5081
5246
|
}, [load2, live, identityKey]);
|
|
5082
|
-
|
|
5247
|
+
useEffect14(() => {
|
|
5083
5248
|
if (!live) return;
|
|
5084
5249
|
const onFocus = () => {
|
|
5085
5250
|
void load2();
|
|
@@ -5180,20 +5345,20 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5180
5345
|
}
|
|
5181
5346
|
|
|
5182
5347
|
// src/components/dashboard/GreetingDashboard.tsx
|
|
5183
|
-
import { useState as
|
|
5348
|
+
import { useState as useState28 } from "react";
|
|
5184
5349
|
|
|
5185
5350
|
// src/eventLogContext.ts
|
|
5186
|
-
import { createContext, useContext } from "react";
|
|
5187
|
-
var EventLogContext =
|
|
5351
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
5352
|
+
var EventLogContext = createContext2(null);
|
|
5188
5353
|
function useEventLog() {
|
|
5189
|
-
return
|
|
5354
|
+
return useContext2(EventLogContext);
|
|
5190
5355
|
}
|
|
5191
5356
|
|
|
5192
5357
|
// src/sportScopeContext.ts
|
|
5193
|
-
import { createContext as
|
|
5194
|
-
var SportScopeContext =
|
|
5358
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
5359
|
+
var SportScopeContext = createContext3(null);
|
|
5195
5360
|
function useSportScope() {
|
|
5196
|
-
return
|
|
5361
|
+
return useContext3(SportScopeContext);
|
|
5197
5362
|
}
|
|
5198
5363
|
|
|
5199
5364
|
// src/assets/logo.ts
|
|
@@ -5269,11 +5434,6 @@ function DashboardIcon({ name }) {
|
|
|
5269
5434
|
// src/components/dashboard/DashboardTile.tsx
|
|
5270
5435
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5271
5436
|
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
5437
|
function codesOf(tile) {
|
|
5278
5438
|
return (tile.imageCodes ?? []).filter(Boolean);
|
|
5279
5439
|
}
|
|
@@ -5295,35 +5455,35 @@ var keepDashWithHome = (title) => title.replace(/ - /g, "\xA0- ");
|
|
|
5295
5455
|
function HeroTile({ tile, onTap, oddsLabel }) {
|
|
5296
5456
|
const crests = (tile.imageUrls ?? []).filter(Boolean).slice(0, 2);
|
|
5297
5457
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, 2) : [];
|
|
5298
|
-
const
|
|
5458
|
+
const { oddsFormat } = useOddsSettings();
|
|
5459
|
+
const price = tile.priceFormats ? formatOdds(tile.priceFormats, oddsFormat) : null;
|
|
5299
5460
|
return /* @__PURE__ */ jsxs2("button", { type: "button", className: "ss-w-dash-tile ss-w-dash-tile--full ss-w-dash-hero", onClick: onTap, children: [
|
|
5300
5461
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-top", children: [
|
|
5301
5462
|
tile.badgeText ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-badge", children: tile.badgeText }) : null,
|
|
5302
|
-
|
|
5463
|
+
price ? /* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-price", children: [
|
|
5303
5464
|
/* @__PURE__ */ jsxs2("span", { className: "ss-g-sr", children: [
|
|
5304
5465
|
oddsLabel,
|
|
5305
5466
|
" "
|
|
5306
5467
|
] }),
|
|
5307
|
-
|
|
5468
|
+
price
|
|
5308
5469
|
] }) : null,
|
|
5309
|
-
!
|
|
5470
|
+
!price && tile.meta ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash__meta", children: /* @__PURE__ */ jsx2(DotSeparated, { text: tile.meta }) }) : null,
|
|
5310
5471
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-chevron", children: /* @__PURE__ */ jsx2(ChevronIcon, {}) })
|
|
5311
5472
|
] }),
|
|
5312
5473
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-main", children: [
|
|
5313
5474
|
/* @__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
5475
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-body", children: [
|
|
5315
5476
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-title", children: keepDashWithHome(tile.title) }),
|
|
5316
|
-
|
|
5477
|
+
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
5478
|
] })
|
|
5318
5479
|
] })
|
|
5319
5480
|
] });
|
|
5320
5481
|
}
|
|
5321
|
-
var PRICE_BADGE = /^\d+(?:[.,]\d+)?$/;
|
|
5322
5482
|
function DashboardTile({ tile, onTap, oddsLabel = "Odds", badgePlacement = "meta" }) {
|
|
5323
5483
|
if (tile.emphasis === "hero") return /* @__PURE__ */ jsx2(HeroTile, { tile, onTap, oddsLabel });
|
|
5324
5484
|
const spanClass = tile.span === "full" ? "ss-w-dash-tile--full" : "ss-w-dash-tile--half";
|
|
5325
5485
|
const crests = (tile.imageUrls ?? []).slice(0, MAX_CRESTS);
|
|
5326
|
-
const endBadge = badgePlacement === "end" && tile.badgeText &&
|
|
5486
|
+
const endBadge = badgePlacement === "end" && tile.badgeText && tile.badgeFormats ? tile.badgeText : null;
|
|
5327
5487
|
const metaBadge = endBadge ? null : tile.badgeText;
|
|
5328
5488
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, MAX_CRESTS) : [];
|
|
5329
5489
|
const hasMeta = Boolean(metaBadge) || crests.length > 0 || codes.length > 0;
|
|
@@ -5400,23 +5560,23 @@ function SportSwitch({ sports, selected, onSelect, liveLabel: liveLabel3 = "Live
|
|
|
5400
5560
|
}
|
|
5401
5561
|
|
|
5402
5562
|
// src/components/dashboard/v8/PersonalGreeting.tsx
|
|
5403
|
-
import { useState as
|
|
5563
|
+
import { useState as useState27 } from "react";
|
|
5404
5564
|
|
|
5405
5565
|
// src/personalGreetingContext.ts
|
|
5406
|
-
import { createContext as
|
|
5566
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo5, useState as useState15 } from "react";
|
|
5407
5567
|
function useSessionHolds() {
|
|
5408
|
-
const [dismissed, setDismissed] =
|
|
5409
|
-
const [followed, setFollowed] =
|
|
5410
|
-
return
|
|
5568
|
+
const [dismissed, setDismissed] = useState15(/* @__PURE__ */ new Set());
|
|
5569
|
+
const [followed, setFollowed] = useState15(/* @__PURE__ */ new Set());
|
|
5570
|
+
return useMemo5(() => ({
|
|
5411
5571
|
dismissed,
|
|
5412
5572
|
followed,
|
|
5413
5573
|
dismiss: (key) => setDismissed((prev) => prev.has(key) ? prev : new Set(prev).add(key)),
|
|
5414
5574
|
follow: (key) => setFollowed((prev) => prev.has(key) ? prev : new Set(prev).add(key))
|
|
5415
5575
|
}), [dismissed, followed]);
|
|
5416
5576
|
}
|
|
5417
|
-
var PersonalGreetingContext =
|
|
5577
|
+
var PersonalGreetingContext = createContext4(null);
|
|
5418
5578
|
function usePersonalGreeting() {
|
|
5419
|
-
return
|
|
5579
|
+
return useContext4(PersonalGreetingContext);
|
|
5420
5580
|
}
|
|
5421
5581
|
|
|
5422
5582
|
// src/components/dashboard/v8/AskCards.tsx
|
|
@@ -5429,10 +5589,10 @@ function AskCards({ asks, ui, ofYours, onAct }) {
|
|
|
5429
5589
|
}
|
|
5430
5590
|
|
|
5431
5591
|
// src/components/dashboard/v8/CardLine.tsx
|
|
5432
|
-
import { useEffect as
|
|
5592
|
+
import { useEffect as useEffect19, useMemo as useMemo6 } from "react";
|
|
5433
5593
|
|
|
5434
5594
|
// src/useBuilderGrid.ts
|
|
5435
|
-
import { useCallback as useCallback13, useEffect as
|
|
5595
|
+
import { useCallback as useCallback13, useEffect as useEffect15, useRef as useRef16, useState as useState16 } from "react";
|
|
5436
5596
|
|
|
5437
5597
|
// src/builderMemory.ts
|
|
5438
5598
|
var GRID_TTL_MS = 5 * 6e4;
|
|
@@ -5475,23 +5635,23 @@ function createBuilderMemory(now = Date.now) {
|
|
|
5475
5635
|
var PENDING_MAX_MS = 3e3;
|
|
5476
5636
|
var inFlight = /* @__PURE__ */ new WeakMap();
|
|
5477
5637
|
var newest = /* @__PURE__ */ new WeakMap();
|
|
5478
|
-
function shared(
|
|
5479
|
-
let flights = inFlight.get(
|
|
5480
|
-
if (!flights) inFlight.set(
|
|
5638
|
+
function shared(memory3, key, start) {
|
|
5639
|
+
let flights = inFlight.get(memory3);
|
|
5640
|
+
if (!flights) inFlight.set(memory3, flights = /* @__PURE__ */ new Map());
|
|
5481
5641
|
let flight = flights.get(key);
|
|
5482
5642
|
if (!flight) {
|
|
5483
5643
|
const own = flights;
|
|
5484
|
-
let order = newest.get(
|
|
5485
|
-
if (!order) newest.set(
|
|
5644
|
+
let order = newest.get(memory3);
|
|
5645
|
+
if (!order) newest.set(memory3, order = /* @__PURE__ */ new Map());
|
|
5486
5646
|
const previous = order.get(key);
|
|
5487
5647
|
const latest = () => order.get(key) === made;
|
|
5488
5648
|
const promise = start().then(
|
|
5489
5649
|
(g) => {
|
|
5490
|
-
if (latest())
|
|
5650
|
+
if (latest()) memory3.cacheGrid(key, g);
|
|
5491
5651
|
return g;
|
|
5492
5652
|
},
|
|
5493
5653
|
(e) => {
|
|
5494
|
-
if (latest())
|
|
5654
|
+
if (latest()) memory3.cacheGrid(key, null);
|
|
5495
5655
|
throw e;
|
|
5496
5656
|
}
|
|
5497
5657
|
).finally(() => {
|
|
@@ -5517,22 +5677,22 @@ async function settle(flight) {
|
|
|
5517
5677
|
if (heir) return { heir };
|
|
5518
5678
|
return { grid: await flight.promise };
|
|
5519
5679
|
}
|
|
5520
|
-
function forget(
|
|
5521
|
-
const flights = inFlight.get(
|
|
5680
|
+
function forget(memory3, key, flight) {
|
|
5681
|
+
const flights = inFlight.get(memory3);
|
|
5522
5682
|
if (flights?.get(key) === flight) flights.delete(key);
|
|
5523
5683
|
}
|
|
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] =
|
|
5684
|
+
function useBuilderGrid({ conversation, locale, memory: memory3, initial }) {
|
|
5685
|
+
const [seed] = useState16(() => memory3 && conversation && initial ? memory3.cachedGrid(gridKey(locale, initial)) : void 0);
|
|
5686
|
+
const [grid, setGrid] = useState16(seed ?? null);
|
|
5687
|
+
const [status, setStatus] = useState16(seed ? "ready" : "idle");
|
|
5688
|
+
const [confirmed, setConfirmed] = useState16(false);
|
|
5689
|
+
const [answered, setAnswered] = useState16(seed && initial ? { req: initial, locale } : null);
|
|
5530
5690
|
const seq = useRef16(0);
|
|
5531
5691
|
const mounted = useRef16(true);
|
|
5532
5692
|
const hung = useRef16(void 0);
|
|
5533
5693
|
const waiting = useRef16(null);
|
|
5534
|
-
const memoryRef = useRef16(
|
|
5535
|
-
memoryRef.current =
|
|
5694
|
+
const memoryRef = useRef16(memory3);
|
|
5695
|
+
memoryRef.current = memory3;
|
|
5536
5696
|
const stopWaiting = useCallback13((release, keep) => {
|
|
5537
5697
|
window.clearTimeout(hung.current);
|
|
5538
5698
|
const w = waiting.current;
|
|
@@ -5541,7 +5701,7 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5541
5701
|
w.flight.waiters -= 1;
|
|
5542
5702
|
if (release && w.key !== keep && w.flight.waiters <= 0 && memoryRef.current) forget(memoryRef.current, w.key, w.flight);
|
|
5543
5703
|
}, []);
|
|
5544
|
-
|
|
5704
|
+
useEffect15(() => {
|
|
5545
5705
|
mounted.current = true;
|
|
5546
5706
|
return () => {
|
|
5547
5707
|
mounted.current = false;
|
|
@@ -5551,8 +5711,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5551
5711
|
const request = useCallback13(async (req) => {
|
|
5552
5712
|
if (!conversation) return;
|
|
5553
5713
|
const mine = ++seq.current;
|
|
5554
|
-
const key =
|
|
5555
|
-
const fresh = key &&
|
|
5714
|
+
const key = memory3 ? gridKey(locale, req) : null;
|
|
5715
|
+
const fresh = key && memory3 ? memory3.cachedGrid(key) : void 0;
|
|
5556
5716
|
stopWaiting(true, key);
|
|
5557
5717
|
if (fresh) {
|
|
5558
5718
|
setGrid(fresh);
|
|
@@ -5568,9 +5728,9 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5568
5728
|
hung.current = window.setTimeout(() => {
|
|
5569
5729
|
if (mine !== seq.current || !mounted.current) return;
|
|
5570
5730
|
waiting.current = null;
|
|
5571
|
-
if (key &&
|
|
5572
|
-
forget(
|
|
5573
|
-
|
|
5731
|
+
if (key && memory3 && own?.flight) {
|
|
5732
|
+
forget(memory3, key, own.flight);
|
|
5733
|
+
memory3.cacheGrid(key, null);
|
|
5574
5734
|
}
|
|
5575
5735
|
setGrid(null);
|
|
5576
5736
|
setAnswered({ req, locale });
|
|
@@ -5580,8 +5740,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5580
5740
|
let flight;
|
|
5581
5741
|
try {
|
|
5582
5742
|
let g;
|
|
5583
|
-
if (key &&
|
|
5584
|
-
flight = shared(
|
|
5743
|
+
if (key && memory3) {
|
|
5744
|
+
flight = shared(memory3, key, () => conversation.getBuilderGrid(locale, req));
|
|
5585
5745
|
flight.waiters += 1;
|
|
5586
5746
|
if (own) own.flight = flight;
|
|
5587
5747
|
for (; ; ) {
|
|
@@ -5618,35 +5778,40 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5618
5778
|
setStatus("error");
|
|
5619
5779
|
}
|
|
5620
5780
|
}
|
|
5621
|
-
}, [conversation, locale,
|
|
5781
|
+
}, [conversation, locale, memory3, stopWaiting]);
|
|
5622
5782
|
const answeredFor = answered && answered.locale === locale ? answered.req : null;
|
|
5623
5783
|
return { grid, answeredFor, status, confirmed, request };
|
|
5624
5784
|
}
|
|
5625
5785
|
|
|
5626
5786
|
// src/components/AddToSlipButton.tsx
|
|
5627
|
-
import { useCallback as useCallback15, useState as
|
|
5787
|
+
import { useCallback as useCallback15, useState as useState17 } from "react";
|
|
5628
5788
|
|
|
5629
5789
|
// src/slipAdd.ts
|
|
5630
5790
|
import { useCallback as useCallback14 } from "react";
|
|
5631
5791
|
import { isAddToSlipResult, toWireSport as toWireSport3 } from "@sensiblestats/widget-sdk";
|
|
5632
5792
|
|
|
5633
5793
|
// src/trackingContext.ts
|
|
5634
|
-
import { createContext as
|
|
5794
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
5635
5795
|
var noop = () => {
|
|
5636
5796
|
};
|
|
5637
|
-
var TrackingContext =
|
|
5797
|
+
var TrackingContext = createContext5(noop);
|
|
5638
5798
|
function useTrack() {
|
|
5639
|
-
return
|
|
5799
|
+
return useContext5(TrackingContext);
|
|
5640
5800
|
}
|
|
5641
5801
|
|
|
5642
5802
|
// src/slipStateContext.ts
|
|
5643
|
-
import { createContext as
|
|
5644
|
-
var SlipStateContext =
|
|
5803
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
5804
|
+
var SlipStateContext = createContext6(null);
|
|
5645
5805
|
function useSlipState() {
|
|
5646
|
-
return
|
|
5806
|
+
return useContext6(SlipStateContext);
|
|
5647
5807
|
}
|
|
5648
5808
|
|
|
5649
5809
|
// src/slipAdd.ts
|
|
5810
|
+
function toHostSelection(selection, operatorFormat) {
|
|
5811
|
+
const { forms, ...rest } = selection;
|
|
5812
|
+
const odds = operatorOdds(forms, operatorFormat);
|
|
5813
|
+
return odds ? { ...rest, odds } : rest;
|
|
5814
|
+
}
|
|
5650
5815
|
function withTimeout(value) {
|
|
5651
5816
|
return Promise.race([
|
|
5652
5817
|
value,
|
|
@@ -5669,24 +5834,26 @@ function useSlipAdd(slip, ui) {
|
|
|
5669
5834
|
const slipState = useSlipState();
|
|
5670
5835
|
const handler = slip.onAddToSlip;
|
|
5671
5836
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
5837
|
+
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
5672
5838
|
return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
5673
5839
|
if (!handler) return { kind: "failed" };
|
|
5674
|
-
const
|
|
5675
|
-
const
|
|
5840
|
+
const out = toHostSelection(selection, operatorFormat);
|
|
5841
|
+
const pick = slipPickFields(out, rawLabels ? selectionLabel : void 0, line);
|
|
5842
|
+
const wireSport = toWireSport3(out.sport);
|
|
5676
5843
|
const sportField = wireSport ? { sport: wireSport } : {};
|
|
5677
5844
|
const clickFields = {
|
|
5678
|
-
matchOddsId:
|
|
5679
|
-
matchId:
|
|
5680
|
-
odds:
|
|
5845
|
+
matchOddsId: out.matchOddsId,
|
|
5846
|
+
matchId: out.matchId,
|
|
5847
|
+
odds: out.oddsDecimal,
|
|
5681
5848
|
...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
|
|
5682
|
-
...
|
|
5849
|
+
...out.sport !== void 0 ? { sport: out.sport } : {}
|
|
5683
5850
|
};
|
|
5684
5851
|
track({ name: "add_to_slip_click", ...clickFields });
|
|
5685
5852
|
if (marketDeveloperName !== void 0) {
|
|
5686
5853
|
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
5687
5854
|
}
|
|
5688
5855
|
try {
|
|
5689
|
-
const raw = await withTimeout(Promise.resolve(handler(
|
|
5856
|
+
const raw = await withTimeout(Promise.resolve(handler(out)));
|
|
5690
5857
|
if (raw != null && !isAddToSlipResult(raw)) throw new Error("malformed add-to-slip result");
|
|
5691
5858
|
const result = withSafeMessage(raw ?? void 0);
|
|
5692
5859
|
track({ name: "add_to_slip_result", outcome: slipOutcome(result), ...clickFields });
|
|
@@ -5702,12 +5869,12 @@ function useSlipAdd(slip, ui) {
|
|
|
5702
5869
|
});
|
|
5703
5870
|
}
|
|
5704
5871
|
if (slipState) {
|
|
5705
|
-
if (isTerminal(result)) slipState.settle(slipKey(
|
|
5872
|
+
if (isTerminal(result)) slipState.settle(slipKey(out));
|
|
5706
5873
|
if (wasAdded(result) && marketDeveloperName !== void 0) {
|
|
5707
|
-
slipState.recordAdd({ selection, market: marketDeveloperName, pick });
|
|
5874
|
+
slipState.recordAdd({ selection: out, market: marketDeveloperName, pick });
|
|
5708
5875
|
}
|
|
5709
5876
|
}
|
|
5710
|
-
return { kind: "answered", result };
|
|
5877
|
+
return { kind: "answered", result, oldOdds: out.odds?.text ?? selection.forms.decimal };
|
|
5711
5878
|
} catch {
|
|
5712
5879
|
track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
|
|
5713
5880
|
if (marketDeveloperName !== void 0) {
|
|
@@ -5715,15 +5882,15 @@ function useSlipAdd(slip, ui) {
|
|
|
5715
5882
|
}
|
|
5716
5883
|
return { kind: "failed" };
|
|
5717
5884
|
}
|
|
5718
|
-
}, [handler, log, track, slipState, rawLabels]);
|
|
5885
|
+
}, [handler, log, track, slipState, rawLabels, operatorFormat]);
|
|
5719
5886
|
}
|
|
5720
5887
|
|
|
5721
5888
|
// src/components/Toast.tsx
|
|
5722
|
-
import { useEffect as
|
|
5889
|
+
import { useEffect as useEffect16 } from "react";
|
|
5723
5890
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
5724
5891
|
var DISMISS_MS = 4e3;
|
|
5725
5892
|
function Toast({ toast, onDismiss }) {
|
|
5726
|
-
|
|
5893
|
+
useEffect16(() => {
|
|
5727
5894
|
if (!toast) return;
|
|
5728
5895
|
const timer = setTimeout(onDismiss, DISMISS_MS);
|
|
5729
5896
|
return () => clearTimeout(timer);
|
|
@@ -5734,13 +5901,14 @@ function Toast({ toast, onDismiss }) {
|
|
|
5734
5901
|
|
|
5735
5902
|
// src/components/AddToSlipButton.tsx
|
|
5736
5903
|
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] =
|
|
5904
|
+
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
|
|
5905
|
+
const [pending, setPending] = useState17(false);
|
|
5906
|
+
const [settledLocal, setSettledLocal] = useState17(false);
|
|
5907
|
+
const [toast, setToast] = useState17(null);
|
|
5741
5908
|
const dismiss = useCallback15(() => setToast(null), []);
|
|
5742
5909
|
const add = useSlipAdd(slip, ui);
|
|
5743
5910
|
const slipState = useSlipState();
|
|
5911
|
+
const { oddsFormat } = useOddsSettings();
|
|
5744
5912
|
const handler = slip.onAddToSlip;
|
|
5745
5913
|
if (!ui || !handler || !selection) return null;
|
|
5746
5914
|
const settled = slipState ? !!slipState.settled[slipKey(selection)] : settledLocal;
|
|
@@ -5752,7 +5920,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5752
5920
|
setToast({ kind: "error", text: ui.slipFailed });
|
|
5753
5921
|
return;
|
|
5754
5922
|
}
|
|
5755
|
-
setToast(resultToToast(outcome.result,
|
|
5923
|
+
setToast(resultToToast(outcome.result, outcome.oldOdds, ui));
|
|
5756
5924
|
if (!slipState) setSettledLocal(isTerminal(outcome.result));
|
|
5757
5925
|
} finally {
|
|
5758
5926
|
setPending(false);
|
|
@@ -5771,7 +5939,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5771
5939
|
children: [
|
|
5772
5940
|
settled ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
|
|
5773
5941
|
price.label ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-lab", children: price.label }) : null,
|
|
5774
|
-
/* @__PURE__ */ jsx6("span", { children:
|
|
5942
|
+
/* @__PURE__ */ jsx6("span", { children: formatOdds(selection.forms, oddsFormat) })
|
|
5775
5943
|
]
|
|
5776
5944
|
}
|
|
5777
5945
|
) : /* @__PURE__ */ jsx6(
|
|
@@ -5794,7 +5962,6 @@ function AddToSlipButton({ it, slip, ui }) {
|
|
|
5794
5962
|
SlipButton,
|
|
5795
5963
|
{
|
|
5796
5964
|
selection,
|
|
5797
|
-
shownOdds: it.odds ?? "",
|
|
5798
5965
|
marketDeveloperName: it.marketDeveloperName,
|
|
5799
5966
|
selectionLabel: it.selectionLabel,
|
|
5800
5967
|
line: it.line,
|
|
@@ -5841,11 +6008,11 @@ function oldestQuote(legs) {
|
|
|
5841
6008
|
}
|
|
5842
6009
|
|
|
5843
6010
|
// src/components/MarketOddsCardList.tsx
|
|
5844
|
-
import { useEffect as
|
|
6011
|
+
import { useEffect as useEffect18, useState as useState23 } from "react";
|
|
5845
6012
|
import { mayPinOrSlip as mayPinOrSlip4, slipSportOf as slipSportOf5, sportOf as sportOf8 } from "@sensiblestats/widget-sdk";
|
|
5846
6013
|
|
|
5847
6014
|
// src/nflKickoff.ts
|
|
5848
|
-
import { useEffect as
|
|
6015
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
5849
6016
|
import { sportOf as sportOf6 } from "@sensiblestats/widget-sdk";
|
|
5850
6017
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5851
6018
|
var isNfl = (sport) => sportOf6(sport) === "americanfootball";
|
|
@@ -5873,9 +6040,9 @@ function guardLegsPreMatch(slip, legs, ui) {
|
|
|
5873
6040
|
};
|
|
5874
6041
|
}
|
|
5875
6042
|
function useNextKickoffRender(kickoffs) {
|
|
5876
|
-
const [tick, setTick] =
|
|
6043
|
+
const [tick, setTick] = useState18(0);
|
|
5877
6044
|
const key = kickoffs.map((k) => k ?? "").join("|");
|
|
5878
|
-
|
|
6045
|
+
useEffect17(() => {
|
|
5879
6046
|
const now = Date.now();
|
|
5880
6047
|
const upcoming = key.split("|").map((k) => k ? Date.parse(k) : NaN).filter((ms) => ms > now);
|
|
5881
6048
|
if (upcoming.length === 0) return;
|
|
@@ -5908,14 +6075,14 @@ function OddsMovementBadge({
|
|
|
5908
6075
|
}
|
|
5909
6076
|
|
|
5910
6077
|
// src/components/Crest.tsx
|
|
5911
|
-
import { useState as
|
|
6078
|
+
import { useState as useState19 } from "react";
|
|
5912
6079
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
5913
6080
|
function initials(name) {
|
|
5914
6081
|
return (name ?? "").trim().slice(0, 1).toUpperCase() || "?";
|
|
5915
6082
|
}
|
|
5916
6083
|
function Crest({ url, name, kind, abbr }) {
|
|
5917
6084
|
const cls = kind === "comp" ? "ss-w-bi-comp-logo" : "ss-w-bi-crest";
|
|
5918
|
-
const [failed, setFailed] =
|
|
6085
|
+
const [failed, setFailed] = useState19(false);
|
|
5919
6086
|
if (url && !failed) {
|
|
5920
6087
|
return /* @__PURE__ */ jsx8("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
5921
6088
|
}
|
|
@@ -5924,7 +6091,7 @@ function Crest({ url, name, kind, abbr }) {
|
|
|
5924
6091
|
}
|
|
5925
6092
|
|
|
5926
6093
|
// src/components/PinToggle.tsx
|
|
5927
|
-
import { useCallback as useCallback16, useState as
|
|
6094
|
+
import { useCallback as useCallback16, useState as useState20 } from "react";
|
|
5928
6095
|
import { qualifiedId, toWireSport as toWireSport4 } from "@sensiblestats/widget-sdk";
|
|
5929
6096
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5930
6097
|
var PIN_GLYPHS = {
|
|
@@ -5933,7 +6100,7 @@ var PIN_GLYPHS = {
|
|
|
5933
6100
|
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
6101
|
};
|
|
5935
6102
|
function PinToggle({ pin, monitor, ui, market }) {
|
|
5936
|
-
const [toast, setToast] =
|
|
6103
|
+
const [toast, setToast] = useState20(null);
|
|
5937
6104
|
const dismiss = useCallback16(() => setToast(null), []);
|
|
5938
6105
|
const log = useEventLog();
|
|
5939
6106
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6003,10 +6170,10 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
6003
6170
|
}
|
|
6004
6171
|
|
|
6005
6172
|
// src/components/PriceHistoryButton.tsx
|
|
6006
|
-
import { useCallback as useCallback17, useState as
|
|
6173
|
+
import { useCallback as useCallback17, useState as useState21 } from "react";
|
|
6007
6174
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6008
6175
|
function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
6009
|
-
const [toast, setToast] =
|
|
6176
|
+
const [toast, setToast] = useState21(null);
|
|
6010
6177
|
const dismiss = useCallback17(() => setToast(null), []);
|
|
6011
6178
|
const log = useEventLog();
|
|
6012
6179
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6034,7 +6201,7 @@ function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
|
6034
6201
|
}
|
|
6035
6202
|
|
|
6036
6203
|
// src/components/AllMarketsButton.tsx
|
|
6037
|
-
import { useCallback as useCallback18, useState as
|
|
6204
|
+
import { useCallback as useCallback18, useState as useState22 } from "react";
|
|
6038
6205
|
import { sportOf as sportOf7 } from "@sensiblestats/widget-sdk";
|
|
6039
6206
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6040
6207
|
function allMarketsCount(vm, monitor) {
|
|
@@ -6043,7 +6210,7 @@ function allMarketsCount(vm, monitor) {
|
|
|
6043
6210
|
}
|
|
6044
6211
|
function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
6045
6212
|
const log = useEventLog();
|
|
6046
|
-
const [toast, setToast] =
|
|
6213
|
+
const [toast, setToast] = useState22(null);
|
|
6047
6214
|
const dismiss = useCallback18(() => setToast(null), []);
|
|
6048
6215
|
const onClick = () => {
|
|
6049
6216
|
if (monitor.pinMatch({ matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName }) === "match_limit") {
|
|
@@ -6078,14 +6245,17 @@ function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
|
6078
6245
|
// src/components/MarketOddsCardList.tsx
|
|
6079
6246
|
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6080
6247
|
function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
6248
|
+
const { oddsFormat } = useOddsSettings();
|
|
6249
|
+
const odds = formatOdds(row.priceForms, oddsFormat);
|
|
6250
|
+
const previousOdds = row.previousPriceForms ? formatOdds(row.previousPriceForms, oddsFormat) : void 0;
|
|
6081
6251
|
const slipAllowed = vm.addToSlipEnabled && !suppressSlip && slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now());
|
|
6082
6252
|
const selection = slipAllowed ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
6083
6253
|
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: slipSportOf5(vm.sport) })];
|
|
6084
6254
|
return /* @__PURE__ */ jsxs10("div", { className: "ss-w-mo-row", children: [
|
|
6085
6255
|
/* @__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 &&
|
|
6256
|
+
/* @__PURE__ */ jsx12(OddsMovementBadge, { previous: previousOdds, current: odds, direction: row.movementDirection, ui }),
|
|
6257
|
+
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-price", children: odds }),
|
|
6258
|
+
history && ui && previousOdds ? /* @__PURE__ */ jsx12(
|
|
6089
6259
|
PriceHistoryButton,
|
|
6090
6260
|
{
|
|
6091
6261
|
ui,
|
|
@@ -6098,7 +6268,7 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
6098
6268
|
"\u2713 ",
|
|
6099
6269
|
ui.inSlipLabel
|
|
6100
6270
|
] }) : null,
|
|
6101
|
-
!suppressSlip ? /* @__PURE__ */ jsx12(SlipButton, { selection,
|
|
6271
|
+
!suppressSlip ? /* @__PURE__ */ jsx12(SlipButton, { selection, marketDeveloperName: vm.marketDeveloperName, selectionLabel: row.selectionLabel, line: row.line, slip: guardNflKickoff(slip, vm, ui), ui }) : null
|
|
6102
6272
|
] });
|
|
6103
6273
|
}
|
|
6104
6274
|
var STALE_AFTER_MS = 12e4;
|
|
@@ -6106,7 +6276,7 @@ function fmtHhMm(iso, locale) {
|
|
|
6106
6276
|
return new Date(iso).toLocaleTimeString(intlLocale(locale), { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
6107
6277
|
}
|
|
6108
6278
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
6109
|
-
const [open, setOpen] =
|
|
6279
|
+
const [open, setOpen] = useState23(false);
|
|
6110
6280
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
6111
6281
|
const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
6112
6282
|
const kickoff = vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -6117,9 +6287,9 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6117
6287
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
6118
6288
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
6119
6289
|
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui?.locale ?? "en") : null;
|
|
6120
|
-
const [, setStaleTick] =
|
|
6290
|
+
const [, setStaleTick] = useState23(0);
|
|
6121
6291
|
const watchStale = live != null && !isClosed && !isStale;
|
|
6122
|
-
|
|
6292
|
+
useEffect18(() => {
|
|
6123
6293
|
if (!watchStale) return;
|
|
6124
6294
|
const id = window.setTimeout(() => setStaleTick((n) => n + 1), Math.max(0, asOfMs + STALE_AFTER_MS - Date.now()) + 1);
|
|
6125
6295
|
return () => window.clearTimeout(id);
|
|
@@ -6249,7 +6419,7 @@ var asOf = (iso, ui) => {
|
|
|
6249
6419
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId, coolOff }) {
|
|
6250
6420
|
const matchId = card.matchId;
|
|
6251
6421
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6252
|
-
const ask =
|
|
6422
|
+
const ask = useMemo6(() => canAdd2 && !coolOff && marketKey && matchId ? {
|
|
6253
6423
|
sport,
|
|
6254
6424
|
marketKey,
|
|
6255
6425
|
matchIds: [matchId],
|
|
@@ -6260,10 +6430,11 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6260
6430
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6261
6431
|
} : null, [canAdd2, coolOff, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6262
6432
|
const { grid, answeredFor, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, initial: ask });
|
|
6263
|
-
|
|
6433
|
+
useEffect19(() => {
|
|
6264
6434
|
if (ask) void request(ask);
|
|
6265
6435
|
}, [request, ask]);
|
|
6266
6436
|
useNextKickoffRender([card.startsAtUtc]);
|
|
6437
|
+
const { oddsFormat } = useOddsSettings();
|
|
6267
6438
|
const settled = answeredFor === ask;
|
|
6268
6439
|
const pending = ask !== null && conversation !== null && !settled;
|
|
6269
6440
|
if (!ask || !preMatchOpen(card.startsAtUtc, Date.now())) return null;
|
|
@@ -6286,20 +6457,19 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6286
6457
|
SlipButton,
|
|
6287
6458
|
{
|
|
6288
6459
|
selection,
|
|
6289
|
-
shownOdds: leg.odds,
|
|
6290
6460
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6291
6461
|
selectionLabel: leg.selectionLabel,
|
|
6292
6462
|
line: leg.line,
|
|
6293
6463
|
slip: guardPreMatch(slip, card.startsAtUtc, ui),
|
|
6294
6464
|
ui,
|
|
6295
|
-
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${leg.
|
|
6465
|
+
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${formatOdds(leg.priceForms, oddsFormat)}` }
|
|
6296
6466
|
}
|
|
6297
6467
|
)
|
|
6298
6468
|
] }) });
|
|
6299
6469
|
}
|
|
6300
6470
|
|
|
6301
6471
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6302
|
-
import { useEffect as
|
|
6472
|
+
import { useEffect as useEffect20, useMemo as useMemo7 } from "react";
|
|
6303
6473
|
|
|
6304
6474
|
// src/components/dashboard/v8/factLeg.ts
|
|
6305
6475
|
var isProp = (key) => key.toLowerCase().startsWith("prop_");
|
|
@@ -6327,10 +6497,10 @@ function legForFact(ref, grid, stars = []) {
|
|
|
6327
6497
|
|
|
6328
6498
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6329
6499
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6330
|
-
function FactPrice({ reference, ui, slip, conversation, memory:
|
|
6500
|
+
function FactPrice({ reference, ui, slip, conversation, memory: memory3, stars, enabled, operatorUserId, anonymousUserId }) {
|
|
6331
6501
|
const { sport, marketKey, matchId } = reference;
|
|
6332
6502
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6333
|
-
const ask =
|
|
6503
|
+
const ask = useMemo7(() => enabled && canAdd2 && marketKey && matchId ? {
|
|
6334
6504
|
sport,
|
|
6335
6505
|
marketKey,
|
|
6336
6506
|
matchIds: [matchId],
|
|
@@ -6341,8 +6511,8 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6341
6511
|
...operatorUserId ? { operatorUserId } : {},
|
|
6342
6512
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6343
6513
|
} : null, [enabled, canAdd2, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6344
|
-
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory:
|
|
6345
|
-
|
|
6514
|
+
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: ask });
|
|
6515
|
+
useEffect20(() => {
|
|
6346
6516
|
if (ask) void request(ask);
|
|
6347
6517
|
}, [request, ask]);
|
|
6348
6518
|
const settled = answeredFor === ask;
|
|
@@ -6351,6 +6521,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6351
6521
|
const index = answer ? legForFact(reference, answer, stars) : -1;
|
|
6352
6522
|
const leg = answer && index >= 0 ? legAt(answer, index, sport) ?? void 0 : void 0;
|
|
6353
6523
|
useNextKickoffRender([leg?.kickoffUtc]);
|
|
6524
|
+
const { oddsFormat } = useOddsSettings();
|
|
6354
6525
|
if (!ask) return null;
|
|
6355
6526
|
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
6527
|
if (!leg || !leg.quotedAtUtc || Number.isNaN(Date.parse(leg.quotedAtUtc))) return null;
|
|
@@ -6365,14 +6536,13 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6365
6536
|
SlipButton,
|
|
6366
6537
|
{
|
|
6367
6538
|
selection,
|
|
6368
|
-
shownOdds: leg.odds,
|
|
6369
6539
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6370
6540
|
selectionLabel: leg.selectionLabel,
|
|
6371
6541
|
line: leg.line,
|
|
6372
6542
|
slip: guardPreMatch(slip, leg.kickoffUtc, ui),
|
|
6373
6543
|
ui,
|
|
6374
6544
|
hold: !confirmed,
|
|
6375
|
-
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${leg.
|
|
6545
|
+
price: { label: leg.selection, ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${formatOdds(leg.priceForms, oddsFormat)}` }
|
|
6376
6546
|
}
|
|
6377
6547
|
)
|
|
6378
6548
|
] }) });
|
|
@@ -6380,7 +6550,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6380
6550
|
|
|
6381
6551
|
// src/components/dashboard/v8/FactsBlock.tsx
|
|
6382
6552
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6383
|
-
function FactsBlock({ facts, injury, ui, slip, conversation, memory:
|
|
6553
|
+
function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory3, stars, priced, operatorUserId, anonymousUserId }) {
|
|
6384
6554
|
const injuryText = injury?.text?.trim();
|
|
6385
6555
|
const injuryAt = injury && !Number.isNaN(Date.parse(injury.asOfUtc)) ? injury.asOfUtc : null;
|
|
6386
6556
|
if (facts.length === 0 && !(injuryText && injuryAt)) return null;
|
|
@@ -6388,7 +6558,7 @@ function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory2, st
|
|
|
6388
6558
|
/* @__PURE__ */ jsx15("h3", { className: "ss-w-v8-sec-title", children: ui.v8BeforeKickoff }),
|
|
6389
6559
|
facts.map((f, i) => /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", children: [
|
|
6390
6560
|
/* @__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:
|
|
6561
|
+
f.reference ? /* @__PURE__ */ jsx15(FactPrice, { reference: f.reference, ui, slip, conversation, memory: memory3, stars, enabled: priced, operatorUserId, anonymousUserId }) : null
|
|
6392
6562
|
] }, `${f.matchId ?? ""}:${f.marketKey}:${i}`)),
|
|
6393
6563
|
injuryText && injuryAt ? /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", "data-testid": "v8-injury", children: [
|
|
6394
6564
|
/* @__PURE__ */ jsx15("p", { className: "ss-w-v8-fact-text", children: injuryText }),
|
|
@@ -6408,14 +6578,14 @@ function FavouritesInvite({ ui, onOpen }) {
|
|
|
6408
6578
|
}
|
|
6409
6579
|
|
|
6410
6580
|
// src/components/dashboard/v8/useFollow.ts
|
|
6411
|
-
import { useState as
|
|
6581
|
+
import { useState as useState24 } from "react";
|
|
6412
6582
|
var isFavouriteKind = (kind) => kind === "team" || kind === "player" || kind === "competition";
|
|
6413
6583
|
var keyOf2 = (sport, t) => `${sport}:${t.kind}:${t.id}`;
|
|
6414
6584
|
function kindLabel(kind, ui) {
|
|
6415
6585
|
return kind === "competition" ? ui.favKindLeague : kind === "player" ? ui.favKindPlayer : ui.favKindTeam;
|
|
6416
6586
|
}
|
|
6417
6587
|
function useFollow(controller, ui, holds, sport) {
|
|
6418
|
-
const [notice, setNotice] =
|
|
6588
|
+
const [notice, setNotice] = useState24(null);
|
|
6419
6589
|
const isOpen = (t) => isFavouriteKind(t.kind) && !holds.followed.has(keyOf2(sport, t)) && !controller.isStarred(t.kind, t.id);
|
|
6420
6590
|
const follow = async (t) => {
|
|
6421
6591
|
if (!isFavouriteKind(t.kind)) return;
|
|
@@ -6683,19 +6853,19 @@ function shownFacts(personal, picked) {
|
|
|
6683
6853
|
}
|
|
6684
6854
|
|
|
6685
6855
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
6686
|
-
import { useEffect as
|
|
6856
|
+
import { useEffect as useEffect21, useLayoutEffect, useRef as useRef17, useState as useState26 } from "react";
|
|
6687
6857
|
|
|
6688
6858
|
// src/components/AddAllToSlipButton.tsx
|
|
6689
|
-
import { useCallback as useCallback19, useState as
|
|
6859
|
+
import { useCallback as useCallback19, useState as useState25 } from "react";
|
|
6690
6860
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6691
6861
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
6692
6862
|
const add = useSlipAdd(slip, ui);
|
|
6693
6863
|
const slipState = useSlipState();
|
|
6694
6864
|
const log = useEventLog();
|
|
6695
6865
|
const track = useTrack();
|
|
6696
|
-
const [pending, setPending] =
|
|
6697
|
-
const [settledLocal, setSettledLocal] =
|
|
6698
|
-
const [toast, setToast] =
|
|
6866
|
+
const [pending, setPending] = useState25(false);
|
|
6867
|
+
const [settledLocal, setSettledLocal] = useState25({});
|
|
6868
|
+
const [toast, setToast] = useState25(null);
|
|
6699
6869
|
const dismiss = useCallback19(() => setToast(null), []);
|
|
6700
6870
|
if (!ui || !slip.onAddToSlip || legs.length < 2) return null;
|
|
6701
6871
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
@@ -6769,15 +6939,17 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
6769
6939
|
}
|
|
6770
6940
|
|
|
6771
6941
|
// src/presetToolsContext.ts
|
|
6772
|
-
import { createContext as
|
|
6773
|
-
var PresetToolsContext =
|
|
6942
|
+
import { createContext as createContext7, useContext as useContext7 } from "react";
|
|
6943
|
+
var PresetToolsContext = createContext7(null);
|
|
6774
6944
|
function usePresetTools() {
|
|
6775
|
-
return
|
|
6945
|
+
return useContext7(PresetToolsContext);
|
|
6776
6946
|
}
|
|
6777
6947
|
|
|
6778
6948
|
// src/components/ComboCardList.tsx
|
|
6779
6949
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6780
6950
|
function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed }) {
|
|
6951
|
+
const { oddsFormat } = useOddsSettings();
|
|
6952
|
+
const odds = formatOdds(leg.priceForms, oddsFormat);
|
|
6781
6953
|
const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
|
|
6782
6954
|
const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
6783
6955
|
const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
|
|
@@ -6802,18 +6974,17 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6802
6974
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-market", children: leg.market }),
|
|
6803
6975
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-sel", children: leg.selection })
|
|
6804
6976
|
] }),
|
|
6805
|
-
closed ? null : /* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-price", children:
|
|
6977
|
+
closed ? null : /* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-price", children: odds }),
|
|
6806
6978
|
closed ? null : /* @__PURE__ */ jsx24(
|
|
6807
6979
|
SlipButton,
|
|
6808
6980
|
{
|
|
6809
6981
|
selection,
|
|
6810
|
-
shownOdds: leg.odds,
|
|
6811
6982
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6812
6983
|
selectionLabel: leg.selectionLabel,
|
|
6813
6984
|
line: leg.line,
|
|
6814
6985
|
slip,
|
|
6815
6986
|
ui,
|
|
6816
|
-
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${
|
|
6987
|
+
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${odds}`,
|
|
6817
6988
|
hold
|
|
6818
6989
|
}
|
|
6819
6990
|
)
|
|
@@ -6823,10 +6994,11 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6823
6994
|
}
|
|
6824
6995
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
6825
6996
|
const tools = usePresetTools();
|
|
6997
|
+
const { oddsFormat } = useOddsSettings();
|
|
6826
6998
|
const { target, legCount } = vm;
|
|
6827
6999
|
return /* @__PURE__ */ jsxs22("div", { className: "ss-w-combo", children: [
|
|
6828
7000
|
/* @__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 }),
|
|
7001
|
+
/* @__PURE__ */ jsx24("div", { className: "ss-w-combo-math", children: oddsFormat === "decimal" ? vm.multiplication : formatOdds(vm.totalForms, oddsFormat) }),
|
|
6830
7002
|
vm.replacedNote ? /* @__PURE__ */ jsx24("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
|
|
6831
7003
|
vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui, chatCombo: { total: vm.target !== void 0 ? String(vm.target) : "" } }) : null,
|
|
6832
7004
|
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 +7013,13 @@ function ComboCardList({ cards, ui, slip, monitor }) {
|
|
|
6841
7013
|
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6842
7014
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
6843
7015
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
6844
|
-
var
|
|
6845
|
-
var
|
|
7016
|
+
var isTotal = (v) => TOTALS.includes(v);
|
|
7017
|
+
var totalKeys = (preset) => ["any", ...preset.totalOptions.map((o) => o.key)].filter(isTotal);
|
|
7018
|
+
var asTotal = (v, keys) => isTotal(v) && keys.includes(v) ? v : "any";
|
|
7019
|
+
var totalLabel = (t, options, format2, ui) => {
|
|
7020
|
+
const option = options.find((o) => o.key === t);
|
|
7021
|
+
return t === "any" || !option ? ui.v8BuilderAny : formatOdds(option.formats, format2);
|
|
7022
|
+
};
|
|
6846
7023
|
var sameIds = (a, b) => a.length === b.length && a.every((id) => b.includes(id));
|
|
6847
7024
|
function openingGames(preset) {
|
|
6848
7025
|
const options = preset.gamesOptions && preset.gamesOptions.length > 0 ? preset.gamesOptions : null;
|
|
@@ -6851,31 +7028,33 @@ function openingGames(preset) {
|
|
|
6851
7028
|
return option ? { options, option } : { options: null, option: null };
|
|
6852
7029
|
}
|
|
6853
7030
|
var usableMarkets = (preset) => preset.marketOptions && preset.marketOptions.some((m) => m.key === preset.marketKey) ? preset.marketOptions : null;
|
|
6854
|
-
function SentenceBuilder({ preset, ui, conversation, memory:
|
|
7031
|
+
function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, sport, operatorUserId, anonymousUserId, onGames }) {
|
|
7032
|
+
const { oddsFormat } = useOddsSettings();
|
|
7033
|
+
const totals = totalKeys(preset);
|
|
6855
7034
|
const opening = openingGames(preset);
|
|
6856
7035
|
const gamesOptions = opening.options;
|
|
6857
7036
|
const marketOptions = usableMarkets(preset);
|
|
6858
|
-
const [fingerprint] =
|
|
6859
|
-
const [saved] =
|
|
6860
|
-
const kept =
|
|
7037
|
+
const [fingerprint] = useState26(() => JSON.stringify(preset));
|
|
7038
|
+
const [saved] = useState26(() => {
|
|
7039
|
+
const kept = memory3?.savedView(sport);
|
|
6861
7040
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
6862
7041
|
});
|
|
6863
7042
|
const openingView = {
|
|
6864
7043
|
legs: preset.legs,
|
|
6865
|
-
total: asTotal(preset.totalTarget),
|
|
7044
|
+
total: asTotal(preset.totalTarget, totals),
|
|
6866
7045
|
marketKey: preset.marketKey,
|
|
6867
7046
|
gamesId: opening.option?.id ?? null,
|
|
6868
7047
|
matchIds: opening.option ? opening.option.matchIds : preset.matchIds,
|
|
6869
7048
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
6870
7049
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
6871
7050
|
};
|
|
6872
|
-
const [view, setView] =
|
|
6873
|
-
const [chosen, setChosen] =
|
|
7051
|
+
const [view, setView] = useState26(() => saved?.view ?? openingView);
|
|
7052
|
+
const [chosen, setChosen] = useState26(() => saved?.chosen ?? (saved && !saved.widenedNote ? saved.view : openingView));
|
|
6874
7053
|
const pickedMatchId = chosen.widen ? gamesOptions?.find((o) => o.group === "game")?.matchIds[0] ?? null : chosen.matchIds[0] ?? null;
|
|
6875
7054
|
const pickedMatchIds = chosen.widen ? (gamesOptions ?? []).filter((o) => o.group === "game").flatMap((o) => o.matchIds) : chosen.matchIds;
|
|
6876
7055
|
const pickedOpening = chosen.widen === openingView.widen && chosen.gamesId === openingView.gamesId && sameIds(chosen.matchIds, openingView.matchIds);
|
|
6877
7056
|
const autoWidened = useRef17(false);
|
|
6878
|
-
const [widenedNote, setWidenedNote] =
|
|
7057
|
+
const [widenedNote, setWidenedNote] = useState26(saved?.widenedNote ?? false);
|
|
6879
7058
|
const requestFor = (v) => ({
|
|
6880
7059
|
sport,
|
|
6881
7060
|
marketKey: v.marketKey,
|
|
@@ -6887,10 +7066,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6887
7066
|
...operatorUserId ? { operatorUserId } : {},
|
|
6888
7067
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6889
7068
|
});
|
|
6890
|
-
const [first] =
|
|
6891
|
-
const { grid, status, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory:
|
|
7069
|
+
const [first] = useState26(() => requestFor(view));
|
|
7070
|
+
const { grid, status, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: first });
|
|
6892
7071
|
const lastRequest = useRef17(first);
|
|
6893
|
-
|
|
7072
|
+
useEffect21(() => {
|
|
6894
7073
|
void request(lastRequest.current);
|
|
6895
7074
|
}, [request]);
|
|
6896
7075
|
const send = (req) => {
|
|
@@ -6900,7 +7079,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6900
7079
|
const commit = (next, note, picked) => {
|
|
6901
7080
|
setView(next);
|
|
6902
7081
|
setWidenedNote(note);
|
|
6903
|
-
|
|
7082
|
+
memory3?.saveView(sport, { fingerprint, view: next, widenedNote: note, chosen: picked });
|
|
6904
7083
|
};
|
|
6905
7084
|
const ask = (next, pick) => {
|
|
6906
7085
|
setStartedNote(false);
|
|
@@ -6924,14 +7103,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6924
7103
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
6925
7104
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
6926
7105
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
6927
|
-
const [startedNote, setStartedNote] =
|
|
7106
|
+
const [startedNote, setStartedNote] = useState26(false);
|
|
6928
7107
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
6929
|
-
|
|
7108
|
+
useEffect21(() => {
|
|
6930
7109
|
if (startedNote && status === "ready" && !anyStarted) setStartedNote(false);
|
|
6931
7110
|
}, [startedNote, status, anyStarted]);
|
|
6932
7111
|
const market = rows?.[0]?.market;
|
|
6933
|
-
const [seen, setSeen] =
|
|
6934
|
-
|
|
7112
|
+
const [seen, setSeen] = useState26(null);
|
|
7113
|
+
useEffect21(() => {
|
|
6935
7114
|
if (market) setSeen(market);
|
|
6936
7115
|
}, [market]);
|
|
6937
7116
|
const marketName = marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
|
|
@@ -6944,7 +7123,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6944
7123
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
6945
7124
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
6946
7125
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
6947
|
-
|
|
7126
|
+
useEffect21(() => {
|
|
6948
7127
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
6949
7128
|
autoWidened.current = true;
|
|
6950
7129
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
@@ -7011,7 +7190,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7011
7190
|
] }),
|
|
7012
7191
|
view.legs > 1 ? /* @__PURE__ */ jsxs23("div", { className: "ss-w-v8-builder-ln ss-w-v8-builder-ln--total", children: [
|
|
7013
7192
|
/* @__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:
|
|
7193
|
+
/* @__PURE__ */ jsx25("div", { className: "ss-w-v8-builder-btns", role: "group", "aria-label": ui.v8BuilderTotal, children: totals.map((t) => /* @__PURE__ */ jsx25(
|
|
7015
7194
|
"button",
|
|
7016
7195
|
{
|
|
7017
7196
|
type: "button",
|
|
@@ -7020,7 +7199,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7020
7199
|
onClick: () => {
|
|
7021
7200
|
if (view.total !== t) ask({ ...view, total: t });
|
|
7022
7201
|
},
|
|
7023
|
-
children: totalLabel(t, ui)
|
|
7202
|
+
children: totalLabel(t, preset.totalOptions, oddsFormat, ui)
|
|
7024
7203
|
},
|
|
7025
7204
|
t
|
|
7026
7205
|
)) })
|
|
@@ -7140,7 +7319,7 @@ function oneCardPerGame(cards) {
|
|
|
7140
7319
|
var MAX_IDLE_TEAMS = 2;
|
|
7141
7320
|
function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, onAct }) {
|
|
7142
7321
|
const ctx = usePersonalGreeting();
|
|
7143
|
-
const [pickedGames, setPickedGames] =
|
|
7322
|
+
const [pickedGames, setPickedGames] = useState27(null);
|
|
7144
7323
|
const scope = useSportScope();
|
|
7145
7324
|
const controller = ctx?.favourites && ctx.favourites.status !== "idle" && (scope?.operatorUserId || scope?.anonymousUserId) ? ctx.favourites : null;
|
|
7146
7325
|
const teamCards = oneCardPerGame((personal.teamCards ?? []).filter(teamCardHasContent)).slice(0, MAX_TEAM_CARDS);
|
|
@@ -7179,12 +7358,12 @@ function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, o
|
|
|
7179
7358
|
...(personal.idleTeams ?? []).map((t) => t.label),
|
|
7180
7359
|
...(controller?.data?.teams ?? []).map((t) => t.name)
|
|
7181
7360
|
];
|
|
7182
|
-
const
|
|
7183
|
-
const factsBlock =
|
|
7361
|
+
const shown2 = shownFacts(personal, pickedGames);
|
|
7362
|
+
const factsBlock = shown2 && (shown2.facts.length > 0 || shown2.injury) ? /* @__PURE__ */ jsx28(
|
|
7184
7363
|
FactsBlock,
|
|
7185
7364
|
{
|
|
7186
|
-
facts:
|
|
7187
|
-
injury:
|
|
7365
|
+
facts: shown2.facts,
|
|
7366
|
+
injury: shown2.injury,
|
|
7188
7367
|
ui,
|
|
7189
7368
|
slip,
|
|
7190
7369
|
conversation: ctx?.conversation ?? null,
|
|
@@ -7269,12 +7448,13 @@ function initialSport(sets, defaultSport) {
|
|
|
7269
7448
|
}
|
|
7270
7449
|
function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel, ui, slip, onAct }) {
|
|
7271
7450
|
const log = useEventLog();
|
|
7451
|
+
const { oddsFormat } = useOddsSettings();
|
|
7272
7452
|
const scope = useSportScope();
|
|
7273
7453
|
const sets = switchSets(dashboards);
|
|
7274
|
-
const [selected, setSelected] =
|
|
7454
|
+
const [selected, setSelected] = useState28(() => initialSport(sets, defaultSport));
|
|
7275
7455
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
7276
|
-
const
|
|
7277
|
-
const personal =
|
|
7456
|
+
const shown2 = active ? active.dashboard : dashboard;
|
|
7457
|
+
const personal = shown2.personal;
|
|
7278
7458
|
const starsElsewhere = (sets ?? []).some((s) => (s.dashboard.personal?.ribbon?.stars.length ?? 0) > 0);
|
|
7279
7459
|
const select = (sport) => {
|
|
7280
7460
|
if (sport === selected) return;
|
|
@@ -7283,25 +7463,25 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSport
|
|
|
7283
7463
|
if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
|
|
7284
7464
|
log?.log({ name: "dashboard_sport_switch", outcome: sport });
|
|
7285
7465
|
};
|
|
7286
|
-
const layout = layoutClass(
|
|
7466
|
+
const layout = layoutClass(shown2.layout);
|
|
7287
7467
|
const badgePlacement = layout === LAYOUT_CLASSES.goal ? "end" : "meta";
|
|
7288
7468
|
return /* @__PURE__ */ jsxs27("div", { className: `ss-w-dash ${layout}`, children: [
|
|
7289
7469
|
sets ? /* @__PURE__ */ jsx29(SportSwitch, { sports: sets, selected, onSelect: select, liveLabel: liveLabel3, groupLabel: sportGroupLabel }) : null,
|
|
7290
7470
|
/* @__PURE__ */ jsxs27("div", { className: "ss-w-dash-head", children: [
|
|
7291
|
-
/* @__PURE__ */ jsx29("span", { className: "ss-w-dash-title", children:
|
|
7292
|
-
|
|
7471
|
+
/* @__PURE__ */ jsx29("span", { className: "ss-w-dash-title", children: shown2.title }),
|
|
7472
|
+
shown2.subtitle ? /* @__PURE__ */ jsx29("span", { className: "ss-w-dash-subtitle", children: shown2.subtitle }) : null
|
|
7293
7473
|
] }),
|
|
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:
|
|
7474
|
+
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
7475
|
DashboardTile,
|
|
7296
7476
|
{
|
|
7297
|
-
tile: t,
|
|
7298
|
-
onTap: () => active ? onTap(t, i, { layout:
|
|
7477
|
+
tile: tileForFormat(t, oddsFormat),
|
|
7478
|
+
onTap: () => active ? onTap(t, i, { layout: shown2.layout, sport: active.sport }) : onTap(t, i),
|
|
7299
7479
|
oddsLabel,
|
|
7300
7480
|
badgePlacement
|
|
7301
7481
|
},
|
|
7302
7482
|
`${t.title}-${i}`
|
|
7303
7483
|
)) }),
|
|
7304
|
-
|
|
7484
|
+
shown2.footerTip ? /* @__PURE__ */ jsx29("span", { className: "ss-w-dash-foot", children: shown2.footerTip }) : null
|
|
7305
7485
|
] });
|
|
7306
7486
|
}
|
|
7307
7487
|
|
|
@@ -7402,11 +7582,11 @@ var WIRE_TO_PUBLIC = {
|
|
|
7402
7582
|
};
|
|
7403
7583
|
|
|
7404
7584
|
// src/popupTelemetry.ts
|
|
7405
|
-
import { useCallback as useCallback20, useEffect as
|
|
7585
|
+
import { useCallback as useCallback20, useEffect as useEffect22, useRef as useRef18 } from "react";
|
|
7406
7586
|
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7407
7587
|
const shownRef = useRef18(/* @__PURE__ */ new Set());
|
|
7408
7588
|
const closedTextRef = useRef18(null);
|
|
7409
|
-
|
|
7589
|
+
useEffect22(() => {
|
|
7410
7590
|
if (isOpen) {
|
|
7411
7591
|
if (closedTextRef.current) log?.log({ name: "popup_opened" });
|
|
7412
7592
|
closedTextRef.current = null;
|
|
@@ -7425,10 +7605,10 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7425
7605
|
}
|
|
7426
7606
|
|
|
7427
7607
|
// src/openTelemetry.ts
|
|
7428
|
-
import { useEffect as
|
|
7608
|
+
import { useEffect as useEffect23, useRef as useRef19 } from "react";
|
|
7429
7609
|
function useOpenTelemetry(log, isOpen) {
|
|
7430
7610
|
const openLoggedRef = useRef19(false);
|
|
7431
|
-
|
|
7611
|
+
useEffect23(() => {
|
|
7432
7612
|
if (!isOpen) {
|
|
7433
7613
|
openLoggedRef.current = false;
|
|
7434
7614
|
return;
|
|
@@ -7440,13 +7620,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7440
7620
|
}
|
|
7441
7621
|
|
|
7442
7622
|
// src/components/ChatFab.tsx
|
|
7443
|
-
import { useEffect as
|
|
7623
|
+
import { useEffect as useEffect24, useRef as useRef20, useState as useState30 } from "react";
|
|
7444
7624
|
|
|
7445
7625
|
// src/components/BrandMark.tsx
|
|
7446
|
-
import { useState as
|
|
7626
|
+
import { useState as useState29 } from "react";
|
|
7447
7627
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
7448
7628
|
function BrandMark({ logoUrl, className }) {
|
|
7449
|
-
const [failed, setFailed] =
|
|
7629
|
+
const [failed, setFailed] = useState29(false);
|
|
7450
7630
|
if (!logoUrl || failed) return /* @__PURE__ */ jsx30(SsMark, { className });
|
|
7451
7631
|
return /* @__PURE__ */ jsx30("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7452
7632
|
}
|
|
@@ -7483,9 +7663,9 @@ import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
|
7483
7663
|
function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup, dismissLabel = "Dismiss", introAllowed = false, onIntroStart, asks }) {
|
|
7484
7664
|
const bubble = popupText ?? greeting;
|
|
7485
7665
|
const track = useTrack();
|
|
7486
|
-
const [intro, setIntro] =
|
|
7666
|
+
const [intro, setIntro] = useState30(false);
|
|
7487
7667
|
const armedRef = useRef20(introAllowed);
|
|
7488
|
-
|
|
7668
|
+
useEffect24(() => {
|
|
7489
7669
|
if (armedRef.current && bubble) {
|
|
7490
7670
|
armedRef.current = false;
|
|
7491
7671
|
setIntro(true);
|
|
@@ -7505,10 +7685,10 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
7505
7685
|
}
|
|
7506
7686
|
|
|
7507
7687
|
// src/components/ChatPanel.tsx
|
|
7508
|
-
import { useCallback as useCallback25, useEffect as
|
|
7688
|
+
import { useCallback as useCallback25, useEffect as useEffect45, useLayoutEffect as useLayoutEffect3, useMemo as useMemo10, useRef as useRef37, useState as useState73 } from "react";
|
|
7509
7689
|
|
|
7510
7690
|
// src/components/ChatHeader.tsx
|
|
7511
|
-
import { useEffect as
|
|
7691
|
+
import { useEffect as useEffect25, useRef as useRef21, useState as useState31 } from "react";
|
|
7512
7692
|
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7513
7693
|
function ChatHeader({
|
|
7514
7694
|
onClose,
|
|
@@ -7518,17 +7698,21 @@ function ChatHeader({
|
|
|
7518
7698
|
onNewConversation,
|
|
7519
7699
|
canReset,
|
|
7520
7700
|
newConversationLabel = "New conversation",
|
|
7521
|
-
moreOptionsLabel = "More options"
|
|
7701
|
+
moreOptionsLabel = "More options",
|
|
7702
|
+
onOpenSettings,
|
|
7703
|
+
settingsLabel = "Settings"
|
|
7522
7704
|
}) {
|
|
7523
|
-
const [menuOpen, setMenuOpen] =
|
|
7705
|
+
const [menuOpen, setMenuOpen] = useState31(false);
|
|
7524
7706
|
const wrapRef = useRef21(null);
|
|
7525
7707
|
const kebabRef = useRef21(null);
|
|
7526
7708
|
const firstItemRef = useRef21(null);
|
|
7527
|
-
const
|
|
7528
|
-
|
|
7709
|
+
const hasNew = !!(canReset && onNewConversation);
|
|
7710
|
+
const hasSettings = !!onOpenSettings;
|
|
7711
|
+
const hasMenu = hasNew || hasSettings;
|
|
7712
|
+
useEffect25(() => {
|
|
7529
7713
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7530
7714
|
}, [menuOpen]);
|
|
7531
|
-
|
|
7715
|
+
useEffect25(() => {
|
|
7532
7716
|
if (!menuOpen) return;
|
|
7533
7717
|
const onPointer = (e) => {
|
|
7534
7718
|
if (!wrapRef.current?.contains(e.target)) setMenuOpen(false);
|
|
@@ -7550,6 +7734,10 @@ function ChatHeader({
|
|
|
7550
7734
|
setMenuOpen(false);
|
|
7551
7735
|
onNewConversation?.();
|
|
7552
7736
|
};
|
|
7737
|
+
const runSettings = () => {
|
|
7738
|
+
setMenuOpen(false);
|
|
7739
|
+
onOpenSettings?.();
|
|
7740
|
+
};
|
|
7553
7741
|
return /* @__PURE__ */ jsxs30("header", { className: "ss-w-header", children: [
|
|
7554
7742
|
/* @__PURE__ */ jsx33(BrandMark, { logoUrl, className: "ss-w-header-mark" }),
|
|
7555
7743
|
/* @__PURE__ */ jsx33("span", { className: "ss-w-header-title", children: headerTitle ?? "SensibleStats" }),
|
|
@@ -7567,27 +7755,40 @@ function ChatHeader({
|
|
|
7567
7755
|
children: /* @__PURE__ */ jsx33(KebabIcon, {})
|
|
7568
7756
|
}
|
|
7569
7757
|
),
|
|
7570
|
-
menuOpen ? /* @__PURE__ */
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7758
|
+
menuOpen ? /* @__PURE__ */ jsxs30("div", { className: "ss-w-menu", role: "menu", "aria-label": moreOptionsLabel, children: [
|
|
7759
|
+
hasNew ? /* @__PURE__ */ jsx33(
|
|
7760
|
+
"button",
|
|
7761
|
+
{
|
|
7762
|
+
type: "button",
|
|
7763
|
+
className: "ss-w-menu-item",
|
|
7764
|
+
role: "menuitem",
|
|
7765
|
+
ref: firstItemRef,
|
|
7766
|
+
onClick: runNewConversation,
|
|
7767
|
+
children: /* @__PURE__ */ jsx33("span", { children: newConversationLabel })
|
|
7768
|
+
}
|
|
7769
|
+
) : null,
|
|
7770
|
+
hasSettings ? /* @__PURE__ */ jsx33(
|
|
7771
|
+
"button",
|
|
7772
|
+
{
|
|
7773
|
+
type: "button",
|
|
7774
|
+
className: "ss-w-menu-item",
|
|
7775
|
+
role: "menuitem",
|
|
7776
|
+
ref: hasNew ? void 0 : firstItemRef,
|
|
7777
|
+
onClick: runSettings,
|
|
7778
|
+
children: /* @__PURE__ */ jsx33("span", { children: settingsLabel })
|
|
7779
|
+
}
|
|
7780
|
+
) : null
|
|
7781
|
+
] }) : null
|
|
7581
7782
|
] }) : null,
|
|
7582
7783
|
/* @__PURE__ */ jsx33("button", { type: "button", className: "ss-w-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx33(CloseIcon, {}) })
|
|
7583
7784
|
] });
|
|
7584
7785
|
}
|
|
7585
7786
|
|
|
7586
7787
|
// src/components/MessageList.tsx
|
|
7587
|
-
import { useEffect as
|
|
7788
|
+
import { useEffect as useEffect29, useRef as useRef24 } from "react";
|
|
7588
7789
|
|
|
7589
7790
|
// src/components/ChatMessage.tsx
|
|
7590
|
-
import { useState as
|
|
7791
|
+
import { useState as useState40 } from "react";
|
|
7591
7792
|
|
|
7592
7793
|
// src/components/Markdown.tsx
|
|
7593
7794
|
import ReactMarkdown from "react-markdown";
|
|
@@ -7605,7 +7806,7 @@ function Markdown({ text }) {
|
|
|
7605
7806
|
}
|
|
7606
7807
|
|
|
7607
7808
|
// src/components/EntityCardList.tsx
|
|
7608
|
-
import { useState as
|
|
7809
|
+
import { useState as useState32 } from "react";
|
|
7609
7810
|
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7610
7811
|
var MAX_VISIBLE = 3;
|
|
7611
7812
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7689,7 +7890,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7689
7890
|
)) });
|
|
7690
7891
|
}
|
|
7691
7892
|
function EntityCardItem({ c }) {
|
|
7692
|
-
const [active, setActive] =
|
|
7893
|
+
const [active, setActive] = useState32(0);
|
|
7693
7894
|
const hasBody = c.scopes.length > 0;
|
|
7694
7895
|
if (!hasBody) {
|
|
7695
7896
|
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 +7904,7 @@ function EntityCardItem({ c }) {
|
|
|
7703
7904
|
] });
|
|
7704
7905
|
}
|
|
7705
7906
|
function EntityCardList({ cards, disabled, showLessLabel = "Show less", showMoreLabel = (n) => `Show ${n} more` }) {
|
|
7706
|
-
const [expanded, setExpanded] =
|
|
7907
|
+
const [expanded, setExpanded] = useState32(false);
|
|
7707
7908
|
if (cards.length === 0) return null;
|
|
7708
7909
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7709
7910
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7742,6 +7943,9 @@ function CardFixture({ it }) {
|
|
|
7742
7943
|
return null;
|
|
7743
7944
|
}
|
|
7744
7945
|
function InsightCard({ it, ui, slip, monitor }) {
|
|
7946
|
+
const { oddsFormat } = useOddsSettings();
|
|
7947
|
+
const odds = it.oddsForms ? formatOdds(it.oddsForms, oddsFormat) : void 0;
|
|
7948
|
+
const previousOdds = it.previousOddsForms ? formatOdds(it.previousOddsForms, oddsFormat) : void 0;
|
|
7745
7949
|
const live = it.isLive || it.phase === "live";
|
|
7746
7950
|
const kickoffFallback = it.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(it.kickoffUtc) : void 0;
|
|
7747
7951
|
const kickoff = it.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -7775,12 +7979,12 @@ function InsightCard({ it, ui, slip, monitor }) {
|
|
|
7775
7979
|
it.market ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-market", children: it.market }) : null,
|
|
7776
7980
|
/* @__PURE__ */ jsxs32("div", { className: "ss-w-bi-pick-row", children: [
|
|
7777
7981
|
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:
|
|
7982
|
+
odds ? /* @__PURE__ */ jsxs32("span", { className: "ss-w-bi-odds", children: [
|
|
7983
|
+
/* @__PURE__ */ jsx36("b", { children: odds }),
|
|
7984
|
+
/* @__PURE__ */ jsx36(OddsMovementBadge, { previous: previousOdds, current: odds, direction: it.movementDirection, ui }),
|
|
7781
7985
|
it.bookmaker ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-book", children: it.bookmaker }) : null
|
|
7782
7986
|
] }) : null,
|
|
7783
|
-
|
|
7987
|
+
odds && showPin && ui && previousOdds ? /* @__PURE__ */ jsx36(
|
|
7784
7988
|
PriceHistoryButton,
|
|
7785
7989
|
{
|
|
7786
7990
|
ui,
|
|
@@ -7802,10 +8006,10 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7802
8006
|
}
|
|
7803
8007
|
|
|
7804
8008
|
// src/nbaLineMove.ts
|
|
7805
|
-
function lineMoveEvents(ev) {
|
|
8009
|
+
function lineMoveEvents(ev, format2) {
|
|
7806
8010
|
const events = [];
|
|
7807
8011
|
for (const lane of [ev.spread, ev.total]) {
|
|
7808
|
-
for (const p of lane?.points ?? []) events.push({ atUtc: p.atUtc, kind: "line", text: p.
|
|
8012
|
+
for (const p of lane?.points ?? []) events.push({ atUtc: p.atUtc, kind: "line", text: formatOdds(p.textFormats, format2) });
|
|
7809
8013
|
}
|
|
7810
8014
|
for (const i of ev.injuries ?? []) events.push({ atUtc: i.atUtc, kind: "injury", text: i.text });
|
|
7811
8015
|
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 +8056,28 @@ var oneDecimal = (n, ui) => n.toLocaleString(intlTag(ui), { minimumFractionDigit
|
|
|
7852
8056
|
var byDate = (games) => [...games].sort((a, b) => a.date < b.date ? -1 : a.date > b.date ? 1 : 0);
|
|
7853
8057
|
var canAdd = (vm, key, slip) => takesSport(slip, "basketball") && toNbaSlipSelection(vm, key, slip.conversationId) !== null;
|
|
7854
8058
|
function NbaPrice({ vm, selectionKey, label, ui, slip }) {
|
|
8059
|
+
const { oddsFormat } = useOddsSettings();
|
|
7855
8060
|
const s = selectionKey ? vm.selections[selectionKey] : void 0;
|
|
7856
8061
|
if (!s) return null;
|
|
7857
|
-
const
|
|
8062
|
+
const shown2 = formatOdds(s.priceFormats, oddsFormat);
|
|
7858
8063
|
const selection = takesSport(slip, "basketball") ? toNbaSlipSelection(vm, selectionKey, slip.conversationId) : null;
|
|
7859
8064
|
if (selection) {
|
|
7860
8065
|
return /* @__PURE__ */ jsx37(
|
|
7861
8066
|
SlipButton,
|
|
7862
8067
|
{
|
|
7863
8068
|
selection,
|
|
7864
|
-
shownOdds: shown,
|
|
7865
8069
|
marketDeveloperName: s.marketDeveloperName,
|
|
7866
8070
|
selectionLabel: s.selectionLabel,
|
|
7867
8071
|
line: s.line ?? void 0,
|
|
7868
8072
|
slip,
|
|
7869
8073
|
ui,
|
|
7870
|
-
price: { label, ariaLabel: `${s.selectionLabel}, ${
|
|
8074
|
+
price: { label, ariaLabel: `${s.selectionLabel}, ${shown2}` }
|
|
7871
8075
|
}
|
|
7872
8076
|
);
|
|
7873
8077
|
}
|
|
7874
8078
|
return /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-price", children: [
|
|
7875
8079
|
label ? /* @__PURE__ */ jsx37("span", { className: "ss-w-nba-price-lab", children: label }) : null,
|
|
7876
|
-
/* @__PURE__ */ jsx37("span", { children:
|
|
8080
|
+
/* @__PURE__ */ jsx37("span", { children: shown2 })
|
|
7877
8081
|
] });
|
|
7878
8082
|
}
|
|
7879
8083
|
function Head({ vm, chip, ui, monitor }) {
|
|
@@ -7932,11 +8136,12 @@ function PropReason({ vm, pr, ui, slip }) {
|
|
|
7932
8136
|
}
|
|
7933
8137
|
function Ladder({ vm, ld, ui, slip }) {
|
|
7934
8138
|
const nba = ui.nba;
|
|
8139
|
+
const { oddsFormat } = useOddsSettings();
|
|
7935
8140
|
return /* @__PURE__ */ jsx37(Fragment7, { children: ld.stats.map((st, si) => /* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stat", children: [
|
|
7936
8141
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stathd", children: [
|
|
7937
8142
|
/* @__PURE__ */ jsx37("b", { children: nba.stat(st.stat) }),
|
|
7938
8143
|
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.
|
|
8144
|
+
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
8145
|
] }),
|
|
7941
8146
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-ladder", children: [
|
|
7942
8147
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-row", children: [
|
|
@@ -8163,6 +8368,7 @@ var TOTAL_BOX = { x0: 38, x1: 310, y0: 28, y1: 74 };
|
|
|
8163
8368
|
var AXIS_Y = 90;
|
|
8164
8369
|
function LineMove({ vm, lm, ui, slip }) {
|
|
8165
8370
|
const nba = ui.nba;
|
|
8371
|
+
const { oddsFormat } = useOddsSettings();
|
|
8166
8372
|
const lanes = [];
|
|
8167
8373
|
if (lm.spread?.points.length) lanes.push({ lane: lm.spread, box: SPREAD_BOX, label: nba.spread, mod: "spread", side: "l" });
|
|
8168
8374
|
if (lm.total?.points.length) lanes.push({ lane: lm.total, box: TOTAL_BOX, label: nba.total, mod: "total", side: "r" });
|
|
@@ -8181,7 +8387,7 @@ function LineMove({ vm, lm, ui, slip }) {
|
|
|
8181
8387
|
const r = to > from ? (ms - from) / (to - from) : 0;
|
|
8182
8388
|
return SPREAD_BOX.x0 + Math.min(1, Math.max(0, r)) * (SPREAD_BOX.x1 - SPREAD_BOX.x0);
|
|
8183
8389
|
};
|
|
8184
|
-
const events = lineMoveEvents(lm).filter((e) => Number.isFinite(Date.parse(e.atUtc)));
|
|
8390
|
+
const events = lineMoveEvents(lm, oddsFormat).filter((e) => Number.isFinite(Date.parse(e.atUtc)));
|
|
8185
8391
|
const nowLabel = clock2(vm.quotedAtUtc);
|
|
8186
8392
|
return /* @__PURE__ */ jsxs33(Fragment7, { children: [
|
|
8187
8393
|
/* @__PURE__ */ jsx37("div", { className: "ss-w-nba-legend", children: lanes.map((l) => /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-legkey", children: [
|
|
@@ -8310,35 +8516,35 @@ function Badge({ abbr }) {
|
|
|
8310
8516
|
return /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-badge", children: abbr });
|
|
8311
8517
|
}
|
|
8312
8518
|
function Price({ vm, selection, label, ui, slip, nowMs }) {
|
|
8519
|
+
const { oddsFormat } = useOddsSettings();
|
|
8313
8520
|
if (!selection) return null;
|
|
8314
|
-
const
|
|
8521
|
+
const shown2 = formatOdds(selection.priceFormats, oddsFormat);
|
|
8315
8522
|
const slipSelection = takesSport(slip, "americanfootball") ? toNflSlipSelection(vm, selection.key, nowMs, slip.conversationId) : null;
|
|
8316
8523
|
const host = slip.onAddToSlip;
|
|
8317
8524
|
if (slipSelection && host) {
|
|
8318
8525
|
const guarded = {
|
|
8319
8526
|
...slip,
|
|
8320
|
-
onAddToSlip: () => {
|
|
8527
|
+
onAddToSlip: (outgoing) => {
|
|
8321
8528
|
const fresh = toNflSlipSelection(vm, selection.key, Date.now(), slip.conversationId);
|
|
8322
|
-
return fresh ? host(
|
|
8529
|
+
return fresh ? host(outgoing) : { status: "rejected", reason: "closed", message: ui.slipStarted };
|
|
8323
8530
|
}
|
|
8324
8531
|
};
|
|
8325
8532
|
return /* @__PURE__ */ jsx38(
|
|
8326
8533
|
SlipButton,
|
|
8327
8534
|
{
|
|
8328
8535
|
selection: slipSelection,
|
|
8329
|
-
shownOdds: shown,
|
|
8330
8536
|
marketDeveloperName: selection.marketDeveloperName,
|
|
8331
8537
|
selectionLabel: selection.selectionLabel,
|
|
8332
8538
|
line: selection.line ?? void 0,
|
|
8333
8539
|
slip: guarded,
|
|
8334
8540
|
ui,
|
|
8335
|
-
price: { label, ariaLabel: `${selection.selectionLabel}, ${
|
|
8541
|
+
price: { label, ariaLabel: `${selection.selectionLabel}, ${shown2}` }
|
|
8336
8542
|
}
|
|
8337
8543
|
);
|
|
8338
8544
|
}
|
|
8339
8545
|
return /* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-price", children: [
|
|
8340
8546
|
label ? /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-price-lab", children: label }) : null,
|
|
8341
|
-
/* @__PURE__ */ jsx38("span", { children:
|
|
8547
|
+
/* @__PURE__ */ jsx38("span", { children: shown2 })
|
|
8342
8548
|
] });
|
|
8343
8549
|
}
|
|
8344
8550
|
function Head2({ vm, ui, monitor }) {
|
|
@@ -8436,6 +8642,7 @@ function InjuryReport({ ir, ui }) {
|
|
|
8436
8642
|
}
|
|
8437
8643
|
function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
8438
8644
|
const nfl = ui.nfl;
|
|
8645
|
+
const { oddsFormat } = useOddsSettings();
|
|
8439
8646
|
const who = (side) => {
|
|
8440
8647
|
if (side === "home") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.homeAbbr });
|
|
8441
8648
|
if (side === "away") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.awayAbbr });
|
|
@@ -8451,10 +8658,10 @@ function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
|
8451
8658
|
/* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-n ss-w-nfl-n--faint", children: [
|
|
8452
8659
|
l.openLine ?? "",
|
|
8453
8660
|
" \xB7 ",
|
|
8454
|
-
l.
|
|
8661
|
+
formatOdds(l.openPriceFormats, oddsFormat)
|
|
8455
8662
|
] }),
|
|
8456
8663
|
/* @__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 } }) })
|
|
8664
|
+
/* @__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
8665
|
] }, `${l.market}:${l.side}`))
|
|
8459
8666
|
] });
|
|
8460
8667
|
}
|
|
@@ -8601,7 +8808,7 @@ function NflInsightList({ insights, ui, slip = {}, monitor }) {
|
|
|
8601
8808
|
}
|
|
8602
8809
|
|
|
8603
8810
|
// src/components/CompactOddsList.tsx
|
|
8604
|
-
import { useEffect as
|
|
8811
|
+
import { useEffect as useEffect26, useRef as useRef22, useState as useState33 } from "react";
|
|
8605
8812
|
import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
|
|
8606
8813
|
|
|
8607
8814
|
// src/compactList.ts
|
|
@@ -8665,14 +8872,16 @@ function toCompactList(cards) {
|
|
|
8665
8872
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8666
8873
|
function Cell({ row, cell: cell2, ui, slip }) {
|
|
8667
8874
|
const vm = row.card;
|
|
8875
|
+
const { oddsFormat } = useOddsSettings();
|
|
8876
|
+
const odds = formatOdds(cell2.row.priceForms, oddsFormat);
|
|
8877
|
+
const previous = cell2.row.previousPriceForms ? formatOdds(cell2.row.previousPriceForms, oddsFormat) : void 0;
|
|
8668
8878
|
const slippable = vm.addToSlipEnabled && (!isNfl(vm.sport) || slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now()));
|
|
8669
8879
|
const selection = slippable ? marketOddsRowToSlipSelection(vm, cell2.row, slip.conversationId) : null;
|
|
8670
|
-
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${
|
|
8880
|
+
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${odds}`;
|
|
8671
8881
|
const button = /* @__PURE__ */ jsx39(
|
|
8672
8882
|
SlipButton,
|
|
8673
8883
|
{
|
|
8674
8884
|
selection,
|
|
8675
|
-
shownOdds: cell2.row.odds,
|
|
8676
8885
|
marketDeveloperName: vm.marketDeveloperName,
|
|
8677
8886
|
selectionLabel: cell2.row.selectionLabel,
|
|
8678
8887
|
line: cell2.row.line,
|
|
@@ -8684,13 +8893,13 @@ function Cell({ row, cell: cell2, ui, slip }) {
|
|
|
8684
8893
|
return (
|
|
8685
8894
|
// A third of the price column fits four characters at the row's size: 13.00 steps down a size
|
|
8686
8895
|
// and 101.00 two.
|
|
8687
|
-
/* @__PURE__ */ jsxs35("span", { className: ["ss-w-mol-cell",
|
|
8896
|
+
/* @__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
8897
|
selection && slip.onAddToSlip && ui ? button : /* @__PURE__ */ jsxs35("span", { className: "ss-w-mol-price", children: [
|
|
8689
8898
|
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:
|
|
8899
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children: odds }),
|
|
8691
8900
|
/* @__PURE__ */ jsx39("span", { className: "ss-w-vh", children: name })
|
|
8692
8901
|
] }),
|
|
8693
|
-
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous
|
|
8902
|
+
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous, current: odds, direction: cell2.row.movementDirection, ui })
|
|
8694
8903
|
] })
|
|
8695
8904
|
);
|
|
8696
8905
|
}
|
|
@@ -8721,14 +8930,14 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
8721
8930
|
] });
|
|
8722
8931
|
}
|
|
8723
8932
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
8724
|
-
const [
|
|
8725
|
-
const hidden = list.rowCount -
|
|
8726
|
-
const [focusIndex, setFocusIndex] =
|
|
8933
|
+
const [shown2, setShown] = useState33(COMPACT_PAGE);
|
|
8934
|
+
const hidden = list.rowCount - shown2;
|
|
8935
|
+
const [focusIndex, setFocusIndex] = useState33(null);
|
|
8727
8936
|
const focusRef = useRef22(null);
|
|
8728
|
-
|
|
8937
|
+
useEffect26(() => {
|
|
8729
8938
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
8730
8939
|
}, [focusIndex]);
|
|
8731
|
-
let left =
|
|
8940
|
+
let left = shown2;
|
|
8732
8941
|
let index = 0;
|
|
8733
8942
|
return /* @__PURE__ */ jsxs35("div", { className: "ss-w-mol", children: [
|
|
8734
8943
|
/* @__PURE__ */ jsxs35("div", { className: "ss-w-mol-head", children: [
|
|
@@ -8752,7 +8961,7 @@ function CompactOddsList({ list, ui, slip, monitor }) {
|
|
|
8752
8961
|
] }, `${group.competition ?? ""}:${gi}`);
|
|
8753
8962
|
}),
|
|
8754
8963
|
hidden > 0 ? /* @__PURE__ */ jsxs35("button", { type: "button", className: "ss-w-mo-more", onClick: () => {
|
|
8755
|
-
setFocusIndex(
|
|
8964
|
+
setFocusIndex(shown2);
|
|
8756
8965
|
setShown((n) => n + COMPACT_PAGE);
|
|
8757
8966
|
}, children: [
|
|
8758
8967
|
/* @__PURE__ */ jsx39("span", { children: ui?.showMore ? ui.showMore(Math.min(COMPACT_PAGE, hidden)) : `Show ${Math.min(COMPACT_PAGE, hidden)} more` }),
|
|
@@ -8771,9 +8980,13 @@ function directionWord(vm, ui) {
|
|
|
8771
8980
|
return "";
|
|
8772
8981
|
}
|
|
8773
8982
|
function OddsMovementCard({ vm, ui, monitor }) {
|
|
8983
|
+
const { oddsFormat } = useOddsSettings();
|
|
8984
|
+
const text = (forms) => forms ? formatOdds(forms, oddsFormat) : "";
|
|
8985
|
+
const opening = text(vm.openingForms);
|
|
8986
|
+
const current = text(vm.currentForms);
|
|
8774
8987
|
const word = directionWord(vm, ui);
|
|
8775
8988
|
const drift = word ? `, ${word}` : "";
|
|
8776
|
-
const aria = ui?.chartAria ? ui.chartAria(
|
|
8989
|
+
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
8990
|
const showPin = !!monitor && vm.pinEnabled;
|
|
8778
8991
|
return /* @__PURE__ */ jsxs36("div", { className: "ss-w-omcard", children: [
|
|
8779
8992
|
/* @__PURE__ */ jsxs36("div", { className: "ss-w-om-head", children: [
|
|
@@ -8800,7 +9013,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8800
9013
|
vm.competition ? /* @__PURE__ */ jsx40("span", { className: "ss-w-om-comp", children: vm.competition }) : null
|
|
8801
9014
|
] }) : null,
|
|
8802
9015
|
/* @__PURE__ */ jsx40("div", { className: "ss-w-om-sel", children: vm.selection }),
|
|
8803
|
-
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous:
|
|
9016
|
+
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous: opening, current, direction: vm.direction, ui }),
|
|
8804
9017
|
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
9018
|
"svg",
|
|
8806
9019
|
{
|
|
@@ -8812,7 +9025,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8812
9025
|
children: [
|
|
8813
9026
|
vm.geometry.gridlines.map((g) => /* @__PURE__ */ jsxs36("g", { children: [
|
|
8814
9027
|
/* @__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.
|
|
9028
|
+
/* @__PURE__ */ jsx40("text", { className: "ss-w-om-ylab", x: 34, y: g.y + 3, textAnchor: "end", children: formatOdds(g.forms, oddsFormat) })
|
|
8816
9029
|
] }, g.price)),
|
|
8817
9030
|
/* @__PURE__ */ jsx40("path", { className: "ss-w-om-line", d: vm.geometry.path, fill: "none" }),
|
|
8818
9031
|
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 +9040,12 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8827
9040
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8828
9041
|
ui?.openingLabel ?? "Opening",
|
|
8829
9042
|
" ",
|
|
8830
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
9043
|
+
/* @__PURE__ */ jsx40("b", { children: opening })
|
|
8831
9044
|
] }),
|
|
8832
9045
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8833
9046
|
ui?.currentLabel ?? "Current",
|
|
8834
9047
|
" ",
|
|
8835
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
9048
|
+
/* @__PURE__ */ jsx40("b", { children: current })
|
|
8836
9049
|
] })
|
|
8837
9050
|
] }),
|
|
8838
9051
|
vm.bookmaker ? /* @__PURE__ */ jsx40("div", { className: "ss-w-om-foot", children: /* @__PURE__ */ jsx40("span", { children: vm.bookmaker }) }) : null,
|
|
@@ -8950,7 +9163,7 @@ function FixtureCard({ card }) {
|
|
|
8950
9163
|
}
|
|
8951
9164
|
|
|
8952
9165
|
// src/components/dashboard/CountdownCard.tsx
|
|
8953
|
-
import { Fragment as Fragment12, useEffect as
|
|
9166
|
+
import { Fragment as Fragment12, useEffect as useEffect27, useState as useState34 } from "react";
|
|
8954
9167
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8955
9168
|
var DAY_MS = 864e5;
|
|
8956
9169
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -8969,12 +9182,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
8969
9182
|
function CountdownCard({ card }) {
|
|
8970
9183
|
const { data } = card;
|
|
8971
9184
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
8972
|
-
const [nowMs, setNowMs] =
|
|
8973
|
-
const [reduced] =
|
|
9185
|
+
const [nowMs, setNowMs] = useState34(() => Date.now());
|
|
9186
|
+
const [reduced] = useState34(
|
|
8974
9187
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
8975
9188
|
);
|
|
8976
9189
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS;
|
|
8977
|
-
|
|
9190
|
+
useEffect27(() => {
|
|
8978
9191
|
if (reduced) return;
|
|
8979
9192
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
8980
9193
|
return () => window.clearInterval(id);
|
|
@@ -8993,7 +9206,7 @@ function CountdownCard({ card }) {
|
|
|
8993
9206
|
}
|
|
8994
9207
|
|
|
8995
9208
|
// src/components/dashboard/InjuriesCard.tsx
|
|
8996
|
-
import { useState as
|
|
9209
|
+
import { useState as useState35 } from "react";
|
|
8997
9210
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8998
9211
|
var SHOWN = 3;
|
|
8999
9212
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9004,8 +9217,8 @@ function ColHead({ name, crestUrl }) {
|
|
|
9004
9217
|
}
|
|
9005
9218
|
function InjuryList({ rows, emptyLabel, limit }) {
|
|
9006
9219
|
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:
|
|
9220
|
+
const shown2 = limit === void 0 ? rows : rows.slice(0, limit);
|
|
9221
|
+
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
9222
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-name", children: r.playerName }),
|
|
9010
9223
|
/* @__PURE__ */ jsxs40("span", { className: "ss-w-fandash-injury-meta", children: [
|
|
9011
9224
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-status", children: r.status }),
|
|
@@ -9016,7 +9229,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9016
9229
|
}
|
|
9017
9230
|
function InjuriesCard({ card, ui }) {
|
|
9018
9231
|
const { data } = card;
|
|
9019
|
-
const [expanded, setExpanded] =
|
|
9232
|
+
const [expanded, setExpanded] = useState35(false);
|
|
9020
9233
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9021
9234
|
const limit = expanded ? void 0 : SHOWN;
|
|
9022
9235
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
@@ -9122,7 +9335,7 @@ function LinksCard({ card }) {
|
|
|
9122
9335
|
}
|
|
9123
9336
|
|
|
9124
9337
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9125
|
-
import { useState as
|
|
9338
|
+
import { useState as useState36 } from "react";
|
|
9126
9339
|
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9127
9340
|
function initials3(name) {
|
|
9128
9341
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9132,7 +9345,7 @@ function PostMatchCrest({
|
|
|
9132
9345
|
name,
|
|
9133
9346
|
side
|
|
9134
9347
|
}) {
|
|
9135
|
-
const [failed, setFailed] =
|
|
9348
|
+
const [failed, setFailed] = useState36(false);
|
|
9136
9349
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9137
9350
|
if (url && !failed) {
|
|
9138
9351
|
return /* @__PURE__ */ jsx50("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9331,10 +9544,10 @@ function RestingFormCard({ card }) {
|
|
|
9331
9544
|
}
|
|
9332
9545
|
|
|
9333
9546
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9334
|
-
import { useRef as useRef23, useState as
|
|
9547
|
+
import { useRef as useRef23, useState as useState38 } from "react";
|
|
9335
9548
|
|
|
9336
9549
|
// src/useLiveClock.ts
|
|
9337
|
-
import { useEffect as
|
|
9550
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
9338
9551
|
var TICK_MS = 6e4;
|
|
9339
9552
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9340
9553
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9343,10 +9556,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9343
9556
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9344
9557
|
}
|
|
9345
9558
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9346
|
-
const [displayMinute, setDisplayMinute] =
|
|
9559
|
+
const [displayMinute, setDisplayMinute] = useState37(
|
|
9347
9560
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9348
9561
|
);
|
|
9349
|
-
|
|
9562
|
+
useEffect28(() => {
|
|
9350
9563
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9351
9564
|
if (!clockRunning) return;
|
|
9352
9565
|
const id = window.setInterval(() => {
|
|
@@ -9363,7 +9576,7 @@ function initials5(name) {
|
|
|
9363
9576
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9364
9577
|
}
|
|
9365
9578
|
function LiveCrest({ url, name, side }) {
|
|
9366
|
-
const [failed, setFailed] =
|
|
9579
|
+
const [failed, setFailed] = useState38(false);
|
|
9367
9580
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9368
9581
|
if (url && !failed) {
|
|
9369
9582
|
return /* @__PURE__ */ jsx59("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9431,7 +9644,7 @@ function LiveScoreCard({
|
|
|
9431
9644
|
}
|
|
9432
9645
|
|
|
9433
9646
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
9434
|
-
import { useState as
|
|
9647
|
+
import { useState as useState39 } from "react";
|
|
9435
9648
|
import { jsx as jsx60, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
9436
9649
|
var SHOWN2 = 3;
|
|
9437
9650
|
function EventIcon({ type }) {
|
|
@@ -9473,17 +9686,17 @@ function EventRow({ e }) {
|
|
|
9473
9686
|
] });
|
|
9474
9687
|
}
|
|
9475
9688
|
function LiveTimelineCard({ card, ui }) {
|
|
9476
|
-
const [expanded, setExpanded] =
|
|
9689
|
+
const [expanded, setExpanded] = useState39(false);
|
|
9477
9690
|
const events = card.data.events;
|
|
9478
9691
|
if (!events || events.length === 0) return null;
|
|
9479
9692
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
9480
9693
|
const rest = sorted.length - SHOWN2;
|
|
9481
|
-
const
|
|
9694
|
+
const shown2 = expanded ? sorted : sorted.slice(0, SHOWN2);
|
|
9482
9695
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
9483
9696
|
const showLess = ui?.showLess ?? "Show less";
|
|
9484
9697
|
return /* @__PURE__ */ jsxs56("div", { className: "ss-w-fandash-card ss-w-fandash-live-timeline", children: [
|
|
9485
9698
|
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:
|
|
9699
|
+
/* @__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
9700
|
rest > 0 ? /* @__PURE__ */ jsx60(
|
|
9488
9701
|
"button",
|
|
9489
9702
|
{
|
|
@@ -9672,7 +9885,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
9672
9885
|
// src/components/ChatMessage.tsx
|
|
9673
9886
|
import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
9674
9887
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
9675
|
-
const [sport, setSport] =
|
|
9888
|
+
const [sport, setSport] = useState40(null);
|
|
9676
9889
|
if (message.role === "user") {
|
|
9677
9890
|
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
9891
|
}
|
|
@@ -9721,11 +9934,12 @@ function turnAnchor(messages) {
|
|
|
9721
9934
|
}
|
|
9722
9935
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
9723
9936
|
const { state, send } = controller;
|
|
9937
|
+
const { oddsFormat } = useOddsSettings();
|
|
9724
9938
|
const listRef = useRef24(null);
|
|
9725
9939
|
const endRef = useRef24(null);
|
|
9726
9940
|
const pinnedRef = useRef24(true);
|
|
9727
9941
|
const anchoredTurnRef = useRef24(null);
|
|
9728
|
-
|
|
9942
|
+
useEffect29(() => {
|
|
9729
9943
|
const anchor = turnAnchor(state.messages);
|
|
9730
9944
|
const list = listRef.current;
|
|
9731
9945
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -9757,8 +9971,9 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9757
9971
|
disabled: state.isStreaming || isPaused(state.limit),
|
|
9758
9972
|
onAct: (a) => send(a.message, { actionId: a.actionId, actionRef: a.actionRef, displayText: a.label, source: "action" }),
|
|
9759
9973
|
onTap: (tile, index, onScreen) => {
|
|
9760
|
-
const
|
|
9761
|
-
|
|
9974
|
+
const shown2 = tileForFormat(tile, oddsFormat);
|
|
9975
|
+
const displayText2 = tileDisplayText(shown2);
|
|
9976
|
+
send(shown2.actionValue, shown2.actionRef ? { actionRef: shown2.actionRef, displayText: displayText2, source: "tile" } : { displayText: displayText2, source: "tile" });
|
|
9762
9977
|
if (m.role === "assistant" && m.greetingDashboard) onDashboardTap?.(tile, index, onScreen?.layout ?? m.greetingDashboard.layout, onScreen?.sport);
|
|
9763
9978
|
},
|
|
9764
9979
|
ui,
|
|
@@ -9782,10 +9997,10 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9782
9997
|
}
|
|
9783
9998
|
|
|
9784
9999
|
// src/components/ChatInput.tsx
|
|
9785
|
-
import { forwardRef, useEffect as
|
|
10000
|
+
import { forwardRef, useEffect as useEffect30, useImperativeHandle, useRef as useRef25, useState as useState41 } from "react";
|
|
9786
10001
|
import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
9787
10002
|
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
|
|
9788
|
-
const [value, setValue] =
|
|
10003
|
+
const [value, setValue] = useState41("");
|
|
9789
10004
|
const textareaRef = useRef25(null);
|
|
9790
10005
|
const stopRef = useRef25(null);
|
|
9791
10006
|
const textBoxWantsFocusRef = useRef25(false);
|
|
@@ -9814,7 +10029,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9814
10029
|
stopRef.current?.focus();
|
|
9815
10030
|
}
|
|
9816
10031
|
}), []);
|
|
9817
|
-
|
|
10032
|
+
useEffect30(() => {
|
|
9818
10033
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
9819
10034
|
textBoxWantsFocusRef.current = false;
|
|
9820
10035
|
const box = textareaRef.current;
|
|
@@ -9846,7 +10061,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9846
10061
|
});
|
|
9847
10062
|
|
|
9848
10063
|
// src/components/TabBar.tsx
|
|
9849
|
-
import { useEffect as
|
|
10064
|
+
import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect2, useRef as useRef26 } from "react";
|
|
9850
10065
|
import { Fragment as Fragment14, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
9851
10066
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true]];
|
|
9852
10067
|
function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -9867,7 +10082,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9867
10082
|
const track = useTrack();
|
|
9868
10083
|
const listRef = useRef26(null);
|
|
9869
10084
|
const activeTab = monitor.activeTab;
|
|
9870
|
-
|
|
10085
|
+
useEffect31(() => {
|
|
9871
10086
|
const el = listRef.current?.querySelector("[data-on]");
|
|
9872
10087
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
9873
10088
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -9928,7 +10143,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9928
10143
|
}
|
|
9929
10144
|
|
|
9930
10145
|
// src/components/MonitorTabs.tsx
|
|
9931
|
-
import { useMemo as
|
|
10146
|
+
import { useMemo as useMemo8 } from "react";
|
|
9932
10147
|
|
|
9933
10148
|
// src/components/MarketAccordion.tsx
|
|
9934
10149
|
import { slipSportOf as slipSportOf7 } from "@sensiblestats/widget-sdk";
|
|
@@ -9990,13 +10205,15 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
9990
10205
|
}
|
|
9991
10206
|
|
|
9992
10207
|
// src/components/LiveFactBlock.tsx
|
|
9993
|
-
import { useState as
|
|
10208
|
+
import { useState as useState42 } from "react";
|
|
9994
10209
|
import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
9995
10210
|
function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
9996
|
-
const [expanded, setExpanded] =
|
|
10211
|
+
const [expanded, setExpanded] = useState42(false);
|
|
10212
|
+
const { oddsFormat } = useOddsSettings();
|
|
9997
10213
|
const [current, ...earlier] = facts;
|
|
9998
10214
|
if (!current) return null;
|
|
9999
10215
|
const m = current.market;
|
|
10216
|
+
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
10000
10217
|
return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10001
10218
|
/* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
|
|
10002
10219
|
/* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
|
|
@@ -10015,12 +10232,11 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10015
10232
|
chipSelectionText(m)
|
|
10016
10233
|
] }),
|
|
10017
10234
|
/* @__PURE__ */ jsxs65("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10018
|
-
|
|
10235
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx70("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10019
10236
|
/* @__PURE__ */ jsx70(
|
|
10020
10237
|
SlipButton,
|
|
10021
10238
|
{
|
|
10022
10239
|
selection: chipSelection(m, matchId, slip.conversationId),
|
|
10023
|
-
shownOdds: typeof m.price === "number" ? m.price.toFixed(2) : "",
|
|
10024
10240
|
marketDeveloperName: m.marketDeveloperName,
|
|
10025
10241
|
selectionLabel: m.selectionLabel,
|
|
10026
10242
|
slip,
|
|
@@ -10061,7 +10277,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10061
10277
|
}
|
|
10062
10278
|
|
|
10063
10279
|
// src/components/MonitorFormH2H.tsx
|
|
10064
|
-
import { useState as
|
|
10280
|
+
import { useState as useState43 } from "react";
|
|
10065
10281
|
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
10066
10282
|
function resultClass2(result) {
|
|
10067
10283
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10077,7 +10293,7 @@ function FormDots({ form, ui }) {
|
|
|
10077
10293
|
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
10294
|
}
|
|
10079
10295
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10080
|
-
const [expanded, setExpanded] =
|
|
10296
|
+
const [expanded, setExpanded] = useState43(false);
|
|
10081
10297
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10082
10298
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10083
10299
|
return /* @__PURE__ */ jsx71(Fragment15, {});
|
|
@@ -10182,6 +10398,7 @@ function groupScorers(goals, ownGoalLabel) {
|
|
|
10182
10398
|
});
|
|
10183
10399
|
}
|
|
10184
10400
|
function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
10401
|
+
const { oddsFormat } = useOddsSettings();
|
|
10185
10402
|
const live = match.phase === "live";
|
|
10186
10403
|
const goals = match.events.filter((e) => e.type === "goal");
|
|
10187
10404
|
const homeScorers = groupScorers(goals.filter((e) => e.side === "home"), ui.ownGoalLabel);
|
|
@@ -10240,6 +10457,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10240
10457
|
const { home, away } = splitWidths2(row.homeNum, row.awayNum);
|
|
10241
10458
|
const promoted = isPromoted(row, promotedPins);
|
|
10242
10459
|
const selection = chipSelection(row.market, match.matchId, slip.conversationId);
|
|
10460
|
+
const chipPrice = row.market ? chipPriceText(row.market, oddsFormat) : void 0;
|
|
10243
10461
|
return /* @__PURE__ */ jsxs67("div", { className: promoted ? "ss-w-mon-stat ss-w-mon-pstrip" : "ss-w-mon-stat", children: [
|
|
10244
10462
|
/* @__PURE__ */ jsxs67("div", { className: "ss-w-mon-stat-row", children: [
|
|
10245
10463
|
/* @__PURE__ */ jsx72("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--home", children: row.homeValue }),
|
|
@@ -10257,12 +10475,11 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10257
10475
|
chipSelectionText(row.market)
|
|
10258
10476
|
] }),
|
|
10259
10477
|
/* @__PURE__ */ jsxs67("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10260
|
-
|
|
10478
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx72("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10261
10479
|
/* @__PURE__ */ jsx72(
|
|
10262
10480
|
SlipButton,
|
|
10263
10481
|
{
|
|
10264
10482
|
selection,
|
|
10265
|
-
shownOdds: typeof row.market.price === "number" ? row.market.price.toFixed(2) : "",
|
|
10266
10483
|
marketDeveloperName: row.market.marketDeveloperName,
|
|
10267
10484
|
selectionLabel: row.market.selectionLabel,
|
|
10268
10485
|
slip,
|
|
@@ -10308,10 +10525,10 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
10308
10525
|
import { SPORTS as SPORTS6 } from "@sensiblestats/widget-sdk";
|
|
10309
10526
|
|
|
10310
10527
|
// src/components/NbaPropsSection.tsx
|
|
10311
|
-
import { useState as
|
|
10528
|
+
import { useState as useState45 } from "react";
|
|
10312
10529
|
|
|
10313
10530
|
// src/components/PropsPieces.tsx
|
|
10314
|
-
import { useEffect as
|
|
10531
|
+
import { useEffect as useEffect32, useState as useState44 } from "react";
|
|
10315
10532
|
import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
10316
10533
|
var MAX_TIMER_MS = 2147483647;
|
|
10317
10534
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
@@ -10321,9 +10538,9 @@ function preKickoff(match) {
|
|
|
10321
10538
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
10322
10539
|
}
|
|
10323
10540
|
function usePreKickoff(match) {
|
|
10324
|
-
const [, setTick] =
|
|
10541
|
+
const [, setTick] = useState44(0);
|
|
10325
10542
|
const pre = preKickoff(match);
|
|
10326
|
-
|
|
10543
|
+
useEffect32(() => {
|
|
10327
10544
|
if (!pre || !match.kickoffUtc) return;
|
|
10328
10545
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
10329
10546
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -10336,7 +10553,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10336
10553
|
const pre = usePreKickoff(match);
|
|
10337
10554
|
const live = descriptor.sport === "basketball" && match.phase === "live";
|
|
10338
10555
|
const open = pre || live;
|
|
10339
|
-
|
|
10556
|
+
useEffect32(() => {
|
|
10340
10557
|
if (!open) return;
|
|
10341
10558
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
10342
10559
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -10344,12 +10561,14 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10344
10561
|
return { bundle: monitor.playerProps?.[monitorMatchKey(sport, match.matchId)]?.bundle, live, open };
|
|
10345
10562
|
}
|
|
10346
10563
|
function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip }) {
|
|
10347
|
-
const
|
|
10564
|
+
const { oddsFormat } = useOddsSettings();
|
|
10565
|
+
const shown2 = formatOdds(price.priceFormats, oddsFormat);
|
|
10348
10566
|
if (bundle.addToSlipEnabled && takesSport(slip, descriptor.sport)) {
|
|
10349
10567
|
const selection = {
|
|
10350
10568
|
matchOddsId: price.matchOddsId,
|
|
10351
10569
|
matchId: bundle.matchId,
|
|
10352
10570
|
oddsDecimal: price.price,
|
|
10571
|
+
forms: price.priceFormats,
|
|
10353
10572
|
quotedAtUtc: price.quotedAtUtc,
|
|
10354
10573
|
sport: descriptor.sport
|
|
10355
10574
|
};
|
|
@@ -10358,19 +10577,18 @@ function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip
|
|
|
10358
10577
|
SlipButton,
|
|
10359
10578
|
{
|
|
10360
10579
|
selection,
|
|
10361
|
-
shownOdds: shown,
|
|
10362
10580
|
marketDeveloperName: stat.marketDeveloperName,
|
|
10363
10581
|
selectionLabel: price.label,
|
|
10364
10582
|
line: price.line != null ? String(price.line) : void 0,
|
|
10365
10583
|
slip,
|
|
10366
10584
|
ui,
|
|
10367
|
-
price: { label, ariaLabel: `${ariaName ?? label}, ${
|
|
10585
|
+
price: { label, ariaLabel: `${ariaName ?? label}, ${shown2}` }
|
|
10368
10586
|
}
|
|
10369
10587
|
);
|
|
10370
10588
|
}
|
|
10371
10589
|
return /* @__PURE__ */ jsxs69("span", { className: "ss-w-props-price", children: [
|
|
10372
10590
|
label !== "" && /* @__PURE__ */ jsx74("span", { className: "ss-w-props-price-lab", children: label }),
|
|
10373
|
-
/* @__PURE__ */ jsx74("span", { children:
|
|
10591
|
+
/* @__PURE__ */ jsx74("span", { children: shown2 })
|
|
10374
10592
|
] });
|
|
10375
10593
|
}
|
|
10376
10594
|
function PriceCell({ hitsText, children }) {
|
|
@@ -10406,7 +10624,7 @@ function PropBars({ bars, line, title, wide, ui }) {
|
|
|
10406
10624
|
}
|
|
10407
10625
|
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10408
10626
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10409
|
-
const [picked, setPicked] =
|
|
10627
|
+
const [picked, setPicked] = useState44(null);
|
|
10410
10628
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10411
10629
|
const sample = active?.games?.length ?? 0;
|
|
10412
10630
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
@@ -10445,7 +10663,7 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10445
10663
|
] });
|
|
10446
10664
|
}
|
|
10447
10665
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10448
|
-
const [openId, setOpenId] =
|
|
10666
|
+
const [openId, setOpenId] = useState44(null);
|
|
10449
10667
|
return /* @__PURE__ */ jsx74("div", { className: "ss-w-props-list", children: players.map((p) => {
|
|
10450
10668
|
const isOpen = openId === p.playerId;
|
|
10451
10669
|
const main = descriptor.mainStat(p);
|
|
@@ -10498,21 +10716,21 @@ var nbaDescriptor = (ui) => ({
|
|
|
10498
10716
|
tenGameBars: false
|
|
10499
10717
|
});
|
|
10500
10718
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10501
|
-
const [side, setSide] =
|
|
10719
|
+
const [side, setSide] = useState45("home");
|
|
10502
10720
|
const descriptor = nbaDescriptor(ui);
|
|
10503
10721
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10504
10722
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10505
10723
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
10506
10724
|
const other = side === "home" ? "away" : "home";
|
|
10507
|
-
const
|
|
10725
|
+
const shown2 = bySide(side).length > 0 ? side : other;
|
|
10508
10726
|
const sides = [
|
|
10509
10727
|
{ side: "home", abbreviation: bundle.homeAbbreviation },
|
|
10510
10728
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10511
10729
|
];
|
|
10512
10730
|
return /* @__PURE__ */ jsxs70("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10513
10731
|
/* @__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(
|
|
10732
|
+
/* @__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)) }),
|
|
10733
|
+
/* @__PURE__ */ jsx75(PropRoster, { bundle, players: bySide(shown2), side: shown2, descriptor, ui, slip }, shown2)
|
|
10516
10734
|
] });
|
|
10517
10735
|
}
|
|
10518
10736
|
|
|
@@ -10642,7 +10860,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10642
10860
|
}
|
|
10643
10861
|
|
|
10644
10862
|
// src/components/NflFormSection.tsx
|
|
10645
|
-
import { useState as
|
|
10863
|
+
import { useState as useState46 } from "react";
|
|
10646
10864
|
import { Fragment as Fragment18, jsx as jsx77, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
10647
10865
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
10648
10866
|
var signedSpread = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -10694,7 +10912,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
10694
10912
|
] });
|
|
10695
10913
|
}
|
|
10696
10914
|
function NflFormSection({ match, monitor, ui }) {
|
|
10697
|
-
const [segment, setSegment] =
|
|
10915
|
+
const [segment, setSegment] = useState46("away");
|
|
10698
10916
|
const pre = usePreKickoff(match);
|
|
10699
10917
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
10700
10918
|
const form = bundle?.form;
|
|
@@ -10727,7 +10945,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
10727
10945
|
}
|
|
10728
10946
|
|
|
10729
10947
|
// src/components/NflPropsSection.tsx
|
|
10730
|
-
import { useState as
|
|
10948
|
+
import { useState as useState47 } from "react";
|
|
10731
10949
|
import { Fragment as Fragment19, jsx as jsx78, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
10732
10950
|
var TRENDS_SHOWN = 3;
|
|
10733
10951
|
var SCORERS_SHOWN = 8;
|
|
@@ -10795,11 +11013,11 @@ function ShowMore({ label, onClick }) {
|
|
|
10795
11013
|
return /* @__PURE__ */ jsx78("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
10796
11014
|
}
|
|
10797
11015
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
10798
|
-
const [all, setAll] =
|
|
10799
|
-
const
|
|
11016
|
+
const [all, setAll] = useState47(false);
|
|
11017
|
+
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
10800
11018
|
return /* @__PURE__ */ jsxs73("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
10801
11019
|
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
10802
|
-
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children:
|
|
11020
|
+
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children: shown2.map((f, i) => {
|
|
10803
11021
|
const long = LONG_KEYS[f.stat];
|
|
10804
11022
|
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
11023
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-fact", children: [
|
|
@@ -10828,8 +11046,8 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
10828
11046
|
] });
|
|
10829
11047
|
}
|
|
10830
11048
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
10831
|
-
const [all, setAll] =
|
|
10832
|
-
const
|
|
11049
|
+
const [all, setAll] = useState47(false);
|
|
11050
|
+
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
10833
11051
|
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
11052
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorers", children: [
|
|
10835
11053
|
/* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer ss-w-props-scorer-head", children: [
|
|
@@ -10838,7 +11056,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10838
11056
|
/* @__PURE__ */ jsx78("span", { children: "2+" }),
|
|
10839
11057
|
/* @__PURE__ */ jsx78("span", { children: ui.nfl.propsFirst })
|
|
10840
11058
|
] }),
|
|
10841
|
-
|
|
11059
|
+
shown2.map((s) => {
|
|
10842
11060
|
const sample = s.anytimeStat.games?.length ?? 0;
|
|
10843
11061
|
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
11062
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer", children: [
|
|
@@ -10855,7 +11073,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10855
11073
|
] });
|
|
10856
11074
|
}
|
|
10857
11075
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
10858
|
-
const [tab, setTab] =
|
|
11076
|
+
const [tab, setTab] = useState47(null);
|
|
10859
11077
|
const descriptor = nflDescriptor(ui);
|
|
10860
11078
|
const { bundle, open } = usePropsOpen(match, monitor, descriptor);
|
|
10861
11079
|
if (!open || !bundle || bundle.players.length === 0) return null;
|
|
@@ -10869,13 +11087,13 @@ function NflPropsSection({ match, monitor, ui, slip }) {
|
|
|
10869
11087
|
...scorers.length > 0 ? [{ key: "td", label: ui.nfl.propsScorers }] : []
|
|
10870
11088
|
];
|
|
10871
11089
|
const firstWithContent = roster("away").length > 0 ? "away" : roster("home").length > 0 ? "home" : scorers.length > 0 ? "td" : "away";
|
|
10872
|
-
const
|
|
11090
|
+
const shown2 = tab && tabs.some((t) => t.key === tab) ? tab : firstWithContent;
|
|
10873
11091
|
return /* @__PURE__ */ jsxs73(Fragment19, { children: [
|
|
10874
11092
|
facts.length > 0 && /* @__PURE__ */ jsx78(Trends, { bundle, facts, descriptor, ui, slip }),
|
|
10875
11093
|
/* @__PURE__ */ jsxs73("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10876
11094
|
/* @__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
|
-
|
|
11095
|
+
/* @__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)) }),
|
|
11096
|
+
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
11097
|
] })
|
|
10880
11098
|
] });
|
|
10881
11099
|
}
|
|
@@ -10960,7 +11178,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10960
11178
|
}
|
|
10961
11179
|
|
|
10962
11180
|
// src/components/ScoreboardStrip.tsx
|
|
10963
|
-
import { useEffect as
|
|
11181
|
+
import { useEffect as useEffect33, useRef as useRef27 } from "react";
|
|
10964
11182
|
import { SPORTS as SPORTS7, sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
10965
11183
|
import { jsx as jsx80, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
10966
11184
|
function nbaStatus(m, ui) {
|
|
@@ -11036,7 +11254,7 @@ function rowsFor(m) {
|
|
|
11036
11254
|
}
|
|
11037
11255
|
function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
11038
11256
|
const stripRef = useRef27(null);
|
|
11039
|
-
|
|
11257
|
+
useEffect33(() => {
|
|
11040
11258
|
const strip = stripRef.current;
|
|
11041
11259
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
11042
11260
|
if (!strip || !pressed) return;
|
|
@@ -11148,7 +11366,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
11148
11366
|
] });
|
|
11149
11367
|
}
|
|
11150
11368
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
11151
|
-
const seedIndex =
|
|
11369
|
+
const seedIndex = useMemo8(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
11152
11370
|
const tiles = orderTiles(
|
|
11153
11371
|
monitor.pins,
|
|
11154
11372
|
monitor.snapshot,
|
|
@@ -11180,11 +11398,11 @@ function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
|
11180
11398
|
}
|
|
11181
11399
|
function withSinceViewMovement(vm, prev) {
|
|
11182
11400
|
const primary = vm.mainRows[0];
|
|
11183
|
-
if (prev === void 0 || !primary || primary.oddsDecimal === void 0 || primary.oddsDecimal === prev) return vm;
|
|
11401
|
+
if (prev === void 0 || !primary || primary.oddsDecimal === void 0 || primary.oddsDecimal === prev.value) return vm;
|
|
11184
11402
|
const updatedPrimary = {
|
|
11185
11403
|
...primary,
|
|
11186
|
-
|
|
11187
|
-
movementDirection: primary.oddsDecimal < prev ? "shortened" : "drifted"
|
|
11404
|
+
previousPriceForms: prev.forms,
|
|
11405
|
+
movementDirection: primary.oddsDecimal < prev.value ? "shortened" : "drifted"
|
|
11188
11406
|
};
|
|
11189
11407
|
return { ...vm, mainRows: [updatedPrimary, ...vm.mainRows.slice(1)] };
|
|
11190
11408
|
}
|
|
@@ -11214,7 +11432,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
11214
11432
|
}
|
|
11215
11433
|
|
|
11216
11434
|
// src/components/TodayPanel.tsx
|
|
11217
|
-
import { useEffect as
|
|
11435
|
+
import { useEffect as useEffect35, useId as useId2, useMemo as useMemo9, useState as useState50 } from "react";
|
|
11218
11436
|
import { matchKey as matchKey7 } from "@sensiblestats/widget-sdk";
|
|
11219
11437
|
|
|
11220
11438
|
// src/placement.ts
|
|
@@ -11279,9 +11497,9 @@ function matchingFixtures(group, query) {
|
|
|
11279
11497
|
}
|
|
11280
11498
|
|
|
11281
11499
|
// src/useStarTap.ts
|
|
11282
|
-
import { useCallback as useCallback21, useRef as useRef28, useState as
|
|
11500
|
+
import { useCallback as useCallback21, useRef as useRef28, useState as useState48 } from "react";
|
|
11283
11501
|
function useStarTap(starLeague) {
|
|
11284
|
-
const [pendingId, setPendingId] =
|
|
11502
|
+
const [pendingId, setPendingId] = useState48(null);
|
|
11285
11503
|
const pendingRef = useRef28(null);
|
|
11286
11504
|
const tap = useCallback21(async (competitionId, next) => {
|
|
11287
11505
|
if (pendingRef.current !== null) return false;
|
|
@@ -11342,7 +11560,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
11342
11560
|
}
|
|
11343
11561
|
|
|
11344
11562
|
// src/components/LeagueDetail.tsx
|
|
11345
|
-
import { useEffect as
|
|
11563
|
+
import { useEffect as useEffect34, useState as useState49 } from "react";
|
|
11346
11564
|
import { matchKey as matchKey5 } from "@sensiblestats/widget-sdk";
|
|
11347
11565
|
|
|
11348
11566
|
// src/components/FixtureRow.tsx
|
|
@@ -11405,11 +11623,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
11405
11623
|
import { jsx as jsx84, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
11406
11624
|
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
11625
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
11408
|
-
const [toast, setToast] =
|
|
11409
|
-
|
|
11626
|
+
const [toast, setToast] = useState49(null);
|
|
11627
|
+
useEffect34(() => {
|
|
11410
11628
|
setToast(null);
|
|
11411
11629
|
}, [group.competitionId]);
|
|
11412
|
-
|
|
11630
|
+
useEffect34(() => {
|
|
11413
11631
|
if (toast === null) return;
|
|
11414
11632
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11415
11633
|
return () => clearTimeout(id);
|
|
@@ -11505,8 +11723,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
11723
|
function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starClickable2, disambiguate, onOpen, starTap, ui, monitor }) {
|
|
11506
11724
|
const sorted = group.matches.filter((m) => !isTreatedLive(states.get(matchKey6(m.sport, m.matchId)), stale)).sort((a, b) => a.kickoffUnix - b.kickoffUnix);
|
|
11507
11725
|
if (sorted.length === 0) return null;
|
|
11508
|
-
const
|
|
11509
|
-
const overflow = sorted.length -
|
|
11726
|
+
const shown2 = sorted.slice(0, cap2);
|
|
11727
|
+
const overflow = sorted.length - shown2.length;
|
|
11510
11728
|
const onStarClick = () => {
|
|
11511
11729
|
void starTap.tap(group.competitionId, !group.isStarred);
|
|
11512
11730
|
};
|
|
@@ -11546,7 +11764,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
|
|
|
11546
11764
|
}
|
|
11547
11765
|
)
|
|
11548
11766
|
] }),
|
|
11549
|
-
/* @__PURE__ */ jsx85("div", { className: "ss-w-today-rowgroup-rows", children:
|
|
11767
|
+
/* @__PURE__ */ jsx85("div", { className: "ss-w-today-rowgroup-rows", children: shown2.map((m) => /* @__PURE__ */ jsx85(
|
|
11550
11768
|
FixtureRow,
|
|
11551
11769
|
{
|
|
11552
11770
|
match: m,
|
|
@@ -11647,22 +11865,22 @@ import { Fragment as Fragment22, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-
|
|
|
11647
11865
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
11648
11866
|
const { groups, states, stale, starLeague } = discovery;
|
|
11649
11867
|
const searchId = useId2();
|
|
11650
|
-
const [query, setQuery] =
|
|
11651
|
-
const [selectedCompetitionId, setSelectedCompetitionId] =
|
|
11652
|
-
const [toast, setToast] =
|
|
11653
|
-
|
|
11868
|
+
const [query, setQuery] = useState50("");
|
|
11869
|
+
const [selectedCompetitionId, setSelectedCompetitionId] = useState50(null);
|
|
11870
|
+
const [toast, setToast] = useState50(null);
|
|
11871
|
+
useEffect35(() => {
|
|
11654
11872
|
if (toast === null) return;
|
|
11655
11873
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11656
11874
|
return () => clearTimeout(id);
|
|
11657
11875
|
}, [toast]);
|
|
11658
11876
|
const visibleGroups = visibleGroupsOf(groups, states);
|
|
11659
|
-
const pinnedMatchIds =
|
|
11877
|
+
const pinnedMatchIds = useMemo9(
|
|
11660
11878
|
() => footballMatchPinIds(monitor.pins),
|
|
11661
11879
|
[monitor.pins]
|
|
11662
11880
|
);
|
|
11663
|
-
const placement =
|
|
11881
|
+
const placement = useMemo9(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
|
|
11664
11882
|
const starTap = useStarTap(starLeague);
|
|
11665
|
-
const gridStarTap =
|
|
11883
|
+
const gridStarTap = useMemo9(() => ({
|
|
11666
11884
|
pendingId: starTap.pendingId,
|
|
11667
11885
|
tap: async (competitionId, next) => {
|
|
11668
11886
|
const ok = await starTap.tap(competitionId, next);
|
|
@@ -11696,7 +11914,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11696
11914
|
}
|
|
11697
11915
|
const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
|
|
11698
11916
|
const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
|
|
11699
|
-
|
|
11917
|
+
useEffect35(() => {
|
|
11700
11918
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
11701
11919
|
}, [selectedCompetitionId, openGroup]);
|
|
11702
11920
|
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 +12070,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11852
12070
|
}
|
|
11853
12071
|
|
|
11854
12072
|
// src/components/GamesPanel.tsx
|
|
11855
|
-
import { useEffect as
|
|
12073
|
+
import { useEffect as useEffect39, useState as useState65 } from "react";
|
|
11856
12074
|
|
|
11857
12075
|
// src/components/GamesLoginWall.tsx
|
|
11858
12076
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
@@ -11861,7 +12079,7 @@ function GamesLoginWall({ ui }) {
|
|
|
11861
12079
|
}
|
|
11862
12080
|
|
|
11863
12081
|
// src/components/GamesHub.tsx
|
|
11864
|
-
import { useEffect as
|
|
12082
|
+
import { useEffect as useEffect36, useState as useState51 } from "react";
|
|
11865
12083
|
|
|
11866
12084
|
// src/components/games/ui/gameMeta.ts
|
|
11867
12085
|
function prettifyGameId(gameId) {
|
|
@@ -12012,8 +12230,8 @@ function pickHeroGame(games) {
|
|
|
12012
12230
|
}
|
|
12013
12231
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
12014
12232
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
12015
|
-
const [, setTick] =
|
|
12016
|
-
|
|
12233
|
+
const [, setTick] = useState51(0);
|
|
12234
|
+
useEffect36(() => {
|
|
12017
12235
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
12018
12236
|
return () => clearInterval(id);
|
|
12019
12237
|
}, []);
|
|
@@ -12073,10 +12291,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
12073
12291
|
}
|
|
12074
12292
|
|
|
12075
12293
|
// src/components/GameScreenHost.tsx
|
|
12076
|
-
import { useEffect as
|
|
12294
|
+
import { useEffect as useEffect38, useRef as useRef32, useState as useState63 } from "react";
|
|
12077
12295
|
|
|
12078
12296
|
// src/useGamePlay.ts
|
|
12079
|
-
import { useCallback as useCallback23, useRef as useRef30, useState as
|
|
12297
|
+
import { useCallback as useCallback23, useRef as useRef30, useState as useState52 } from "react";
|
|
12080
12298
|
function toSubmitResult(payload) {
|
|
12081
12299
|
return {
|
|
12082
12300
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -12088,9 +12306,9 @@ function toSubmitResult(payload) {
|
|
|
12088
12306
|
};
|
|
12089
12307
|
}
|
|
12090
12308
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
12091
|
-
const [result, setResult] =
|
|
12092
|
-
const [submitting, setSubmitting] =
|
|
12093
|
-
const [rawStatus, setRawStatus] =
|
|
12309
|
+
const [result, setResult] = useState52(null);
|
|
12310
|
+
const [submitting, setSubmitting] = useState52(false);
|
|
12311
|
+
const [rawStatus, setRawStatus] = useState52(null);
|
|
12094
12312
|
const inFlightRef = useRef30(false);
|
|
12095
12313
|
const convRef = useRef30(conversation);
|
|
12096
12314
|
convRef.current = conversation;
|
|
@@ -12148,7 +12366,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
12148
12366
|
}
|
|
12149
12367
|
|
|
12150
12368
|
// src/components/games/MysteryTigerGame.tsx
|
|
12151
|
-
import { useState as
|
|
12369
|
+
import { useState as useState54, useId as useId3 } from "react";
|
|
12152
12370
|
|
|
12153
12371
|
// src/components/games/nationFlags.ts
|
|
12154
12372
|
var FLAGS = {
|
|
@@ -12359,7 +12577,7 @@ function isNationCode(flag) {
|
|
|
12359
12577
|
}
|
|
12360
12578
|
|
|
12361
12579
|
// src/components/games/PlayerAvatar.tsx
|
|
12362
|
-
import { useState as
|
|
12580
|
+
import { useState as useState53 } from "react";
|
|
12363
12581
|
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
12364
12582
|
function initialsOf(name) {
|
|
12365
12583
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -12377,7 +12595,7 @@ function PlayerAvatar({
|
|
|
12377
12595
|
imagePath,
|
|
12378
12596
|
className
|
|
12379
12597
|
}) {
|
|
12380
|
-
const [failed, setFailed] =
|
|
12598
|
+
const [failed, setFailed] = useState53(false);
|
|
12381
12599
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
12382
12600
|
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
12601
|
}
|
|
@@ -12423,7 +12641,7 @@ function SegmentProgress({ segments, ariaLabel, leftLabel, rightLabel, right })
|
|
|
12423
12641
|
import { Fragment as Fragment26, jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
12424
12642
|
function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQuery, onPick, disabled, minQuery = 0 }) {
|
|
12425
12643
|
const needle = query.trim().toLowerCase();
|
|
12426
|
-
const
|
|
12644
|
+
const shown2 = needle.length < minQuery ? [] : needle ? options.filter((o) => o.name.toLowerCase().includes(needle)) : options;
|
|
12427
12645
|
return /* @__PURE__ */ jsxs89(Fragment26, { children: [
|
|
12428
12646
|
/* @__PURE__ */ jsx97(
|
|
12429
12647
|
SearchField,
|
|
@@ -12437,7 +12655,7 @@ function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQu
|
|
|
12437
12655
|
disabled
|
|
12438
12656
|
}
|
|
12439
12657
|
),
|
|
12440
|
-
|
|
12658
|
+
shown2.length > 0 && /* @__PURE__ */ jsx97("div", { className: "ss-g-tray", role: "listbox", "aria-label": optionsLabel, children: shown2.map((o) => {
|
|
12441
12659
|
const { first, last } = splitName(o.name);
|
|
12442
12660
|
return /* @__PURE__ */ jsxs89(
|
|
12443
12661
|
"button",
|
|
@@ -12618,7 +12836,7 @@ function MysteryTigerGame({
|
|
|
12618
12836
|
onBack
|
|
12619
12837
|
}) {
|
|
12620
12838
|
const t = ui.games.mysteryTiger;
|
|
12621
|
-
const [query, setQuery] =
|
|
12839
|
+
const [query, setQuery] = useState54("");
|
|
12622
12840
|
const inputId = useId3();
|
|
12623
12841
|
const clientState = parseClientState(result?.clientStateJson);
|
|
12624
12842
|
const guessResults = clientState?.guessResults ?? [];
|
|
@@ -12880,13 +13098,13 @@ function HigherOrLowerGame({
|
|
|
12880
13098
|
}
|
|
12881
13099
|
|
|
12882
13100
|
// src/components/games/CareerPathGame.tsx
|
|
12883
|
-
import { useState as
|
|
13101
|
+
import { useState as useState56, useId as useId4 } from "react";
|
|
12884
13102
|
|
|
12885
13103
|
// src/components/games/ui/CrestShield.tsx
|
|
12886
|
-
import { useState as
|
|
13104
|
+
import { useState as useState55 } from "react";
|
|
12887
13105
|
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
12888
13106
|
function CrestShield({ src, name, size = 28 }) {
|
|
12889
|
-
const [failed, setFailed] =
|
|
13107
|
+
const [failed, setFailed] = useState55(false);
|
|
12890
13108
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
12891
13109
|
return /* @__PURE__ */ jsx105("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
12892
13110
|
}
|
|
@@ -12918,7 +13136,7 @@ function CareerPathGame({
|
|
|
12918
13136
|
}) {
|
|
12919
13137
|
const s = ui.games.careerPath;
|
|
12920
13138
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
12921
|
-
const [query, setQuery] =
|
|
13139
|
+
const [query, setQuery] = useState56("");
|
|
12922
13140
|
const inputId = useId4();
|
|
12923
13141
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
12924
13142
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
@@ -13025,7 +13243,7 @@ function CareerPathGame({
|
|
|
13025
13243
|
}
|
|
13026
13244
|
|
|
13027
13245
|
// src/components/games/BeatTheGridGame.tsx
|
|
13028
|
-
import React, { useEffect as
|
|
13246
|
+
import React, { useEffect as useEffect37, useId as useId5, useRef as useRef31, useState as useState57 } from "react";
|
|
13029
13247
|
|
|
13030
13248
|
// src/components/games/ui/OptionList.tsx
|
|
13031
13249
|
import { jsx as jsx107 } from "react/jsx-runtime";
|
|
@@ -13114,10 +13332,10 @@ function SearchSheet({
|
|
|
13114
13332
|
ui
|
|
13115
13333
|
}) {
|
|
13116
13334
|
const s = ui.games.beatTheGrid;
|
|
13117
|
-
const [query, setQuery] =
|
|
13335
|
+
const [query, setQuery] = useState57("");
|
|
13118
13336
|
const inputId = useId5();
|
|
13119
13337
|
const inputRef = useRef31(null);
|
|
13120
|
-
|
|
13338
|
+
useEffect37(() => {
|
|
13121
13339
|
inputRef.current?.focus();
|
|
13122
13340
|
}, [row, col]);
|
|
13123
13341
|
const filtered = playerPool.filter(
|
|
@@ -13182,7 +13400,7 @@ function BeatTheGridGame({
|
|
|
13182
13400
|
}) {
|
|
13183
13401
|
const s = ui.games.beatTheGrid;
|
|
13184
13402
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
13185
|
-
const [activeCell, setActiveCell] =
|
|
13403
|
+
const [activeCell, setActiveCell] = useState57(null);
|
|
13186
13404
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
13187
13405
|
const filledCells = clientState?.cells ?? [];
|
|
13188
13406
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -13337,7 +13555,7 @@ function BeatTheGridGame({
|
|
|
13337
13555
|
}
|
|
13338
13556
|
|
|
13339
13557
|
// src/components/games/GuessTheXiGame.tsx
|
|
13340
|
-
import { useState as
|
|
13558
|
+
import { useState as useState58, useId as useId6 } from "react";
|
|
13341
13559
|
|
|
13342
13560
|
// src/components/games/ui/PitchSvg.tsx
|
|
13343
13561
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
@@ -13426,7 +13644,7 @@ function GuessTheXiGame({
|
|
|
13426
13644
|
onBack
|
|
13427
13645
|
}) {
|
|
13428
13646
|
const t = ui.games.guessTheXi;
|
|
13429
|
-
const [query, setQuery] =
|
|
13647
|
+
const [query, setQuery] = useState58("");
|
|
13430
13648
|
const inputId = useId6();
|
|
13431
13649
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
13432
13650
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
@@ -13569,7 +13787,7 @@ function GuessTheXiGame({
|
|
|
13569
13787
|
}
|
|
13570
13788
|
|
|
13571
13789
|
// src/components/games/DailyQuizGame.tsx
|
|
13572
|
-
import { useState as
|
|
13790
|
+
import { useState as useState59 } from "react";
|
|
13573
13791
|
import { Fragment as Fragment33, jsx as jsx111, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13574
13792
|
function parseClientState6(json) {
|
|
13575
13793
|
if (!json) return null;
|
|
@@ -13610,8 +13828,8 @@ function DailyQuizGame({
|
|
|
13610
13828
|
}) {
|
|
13611
13829
|
const s = ui.games.dailyQuiz;
|
|
13612
13830
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
13613
|
-
const [selections, setSelections] =
|
|
13614
|
-
const [page, setPage] =
|
|
13831
|
+
const [selections, setSelections] = useState59(/* @__PURE__ */ new Map());
|
|
13832
|
+
const [page, setPage] = useState59(0);
|
|
13615
13833
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
13616
13834
|
const results2 = clientState?.results ?? [];
|
|
13617
13835
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -13721,7 +13939,7 @@ function DailyQuizGame({
|
|
|
13721
13939
|
}
|
|
13722
13940
|
|
|
13723
13941
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
13724
|
-
import { useId as useId7, useState as
|
|
13942
|
+
import { useId as useId7, useState as useState60 } from "react";
|
|
13725
13943
|
import { jsx as jsx112, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
13726
13944
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
13727
13945
|
function parseClientState7(json) {
|
|
@@ -13817,11 +14035,11 @@ function MatchdayPredictorGame({
|
|
|
13817
14035
|
onBack
|
|
13818
14036
|
}) {
|
|
13819
14037
|
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] =
|
|
14038
|
+
const [homeScore, setHomeScore] = useState60(0);
|
|
14039
|
+
const [awayScore, setAwayScore] = useState60(0);
|
|
14040
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = useState60(null);
|
|
14041
|
+
const [lastEdited, setLastEdited] = useState60("home");
|
|
14042
|
+
const [query, setQuery] = useState60("");
|
|
13825
14043
|
const searchId = useId7();
|
|
13826
14044
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
13827
14045
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -13989,7 +14207,7 @@ function MatchdayPredictorGame({
|
|
|
13989
14207
|
}
|
|
13990
14208
|
|
|
13991
14209
|
// src/components/games/StartingXiGame.tsx
|
|
13992
|
-
import { useId as useId8, useState as
|
|
14210
|
+
import { useId as useId8, useState as useState61 } from "react";
|
|
13993
14211
|
import { Fragment as Fragment34, jsx as jsx113, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
13994
14212
|
var POINTS_PER_STARTER = 8;
|
|
13995
14213
|
var XI_SIZE = 11;
|
|
@@ -14033,9 +14251,9 @@ function StartingXiGame({
|
|
|
14033
14251
|
lockAtUtc
|
|
14034
14252
|
}) {
|
|
14035
14253
|
const t = ui.games.startingXi;
|
|
14036
|
-
const [slotPlayers, setSlotPlayers] =
|
|
14037
|
-
const [active, setActive] =
|
|
14038
|
-
const [query, setQuery] =
|
|
14254
|
+
const [slotPlayers, setSlotPlayers] = useState61(() => Array(XI_SIZE).fill(null));
|
|
14255
|
+
const [active, setActive] = useState61(0);
|
|
14256
|
+
const [query, setQuery] = useState61("");
|
|
14039
14257
|
const searchId = useId8();
|
|
14040
14258
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
14041
14259
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -14175,7 +14393,7 @@ function StartingXiGame({
|
|
|
14175
14393
|
}
|
|
14176
14394
|
|
|
14177
14395
|
// src/components/games/StatLadderGame.tsx
|
|
14178
|
-
import { useId as useId9, useState as
|
|
14396
|
+
import { useId as useId9, useState as useState62 } from "react";
|
|
14179
14397
|
import { jsx as jsx114, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
14180
14398
|
function ladderClue(ladder) {
|
|
14181
14399
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -14212,8 +14430,8 @@ function StatLadderGame({
|
|
|
14212
14430
|
onBack
|
|
14213
14431
|
}) {
|
|
14214
14432
|
const t = ui.games.statLadder;
|
|
14215
|
-
const [query, setQuery] =
|
|
14216
|
-
const [selectedId, setSelectedId] =
|
|
14433
|
+
const [query, setQuery] = useState62("");
|
|
14434
|
+
const [selectedId, setSelectedId] = useState62(null);
|
|
14217
14435
|
const searchId = useId9();
|
|
14218
14436
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
14219
14437
|
const revealed = clientState != null;
|
|
@@ -14420,8 +14638,8 @@ function GameScreenHost({
|
|
|
14420
14638
|
ui
|
|
14421
14639
|
}) {
|
|
14422
14640
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
14423
|
-
const [configJson, setConfigJson] =
|
|
14424
|
-
|
|
14641
|
+
const [configJson, setConfigJson] = useState63(null);
|
|
14642
|
+
useEffect38(() => {
|
|
14425
14643
|
setConfigJson(null);
|
|
14426
14644
|
if (!conversation) return;
|
|
14427
14645
|
let cancelled = false;
|
|
@@ -14444,12 +14662,12 @@ function GameScreenHost({
|
|
|
14444
14662
|
fixtureId: fixtureId || void 0,
|
|
14445
14663
|
locale: ui.games.lang
|
|
14446
14664
|
});
|
|
14447
|
-
|
|
14665
|
+
useEffect38(() => {
|
|
14448
14666
|
if (conversation) hydrate();
|
|
14449
14667
|
}, [conversation, gameId]);
|
|
14450
14668
|
const hydrateRef = useRef32(hydrate);
|
|
14451
14669
|
hydrateRef.current = hydrate;
|
|
14452
|
-
|
|
14670
|
+
useEffect38(() => {
|
|
14453
14671
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
14454
14672
|
if (rawStatus !== "pending") return;
|
|
14455
14673
|
const timerId = setInterval(() => {
|
|
@@ -14562,7 +14780,7 @@ function GameScreenHost({
|
|
|
14562
14780
|
}
|
|
14563
14781
|
|
|
14564
14782
|
// src/components/Leaderboard.tsx
|
|
14565
|
-
import { useState as
|
|
14783
|
+
import { useState as useState64 } from "react";
|
|
14566
14784
|
|
|
14567
14785
|
// src/components/LeaderboardRow.tsx
|
|
14568
14786
|
import { jsx as jsx117, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
@@ -14647,7 +14865,7 @@ function Leaderboard({
|
|
|
14647
14865
|
ui,
|
|
14648
14866
|
onPlay
|
|
14649
14867
|
}) {
|
|
14650
|
-
const [segment, setSegment] =
|
|
14868
|
+
const [segment, setSegment] = useState64("weekly");
|
|
14651
14869
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
14652
14870
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
14653
14871
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -14750,9 +14968,9 @@ function GamesPanel({
|
|
|
14750
14968
|
leaderboardLoading,
|
|
14751
14969
|
refreshHub
|
|
14752
14970
|
}) {
|
|
14753
|
-
const [selected, setSelected] =
|
|
14754
|
-
const [segment, setSegment] =
|
|
14755
|
-
|
|
14971
|
+
const [selected, setSelected] = useState65(null);
|
|
14972
|
+
const [segment, setSegment] = useState65("play");
|
|
14973
|
+
useEffect39(() => {
|
|
14756
14974
|
ensureGamesFonts();
|
|
14757
14975
|
}, []);
|
|
14758
14976
|
if (!loggedIn) return /* @__PURE__ */ jsx121(GamesLoginWall, { ui });
|
|
@@ -14816,10 +15034,10 @@ function GamesPanel({
|
|
|
14816
15034
|
}
|
|
14817
15035
|
|
|
14818
15036
|
// src/components/FavouritesPanel.tsx
|
|
14819
|
-
import { useEffect as
|
|
15037
|
+
import { useEffect as useEffect42, useRef as useRef34, useState as useState68 } from "react";
|
|
14820
15038
|
|
|
14821
15039
|
// src/components/FavouriteChips.tsx
|
|
14822
|
-
import { useEffect as
|
|
15040
|
+
import { useEffect as useEffect40, useState as useState66 } from "react";
|
|
14823
15041
|
import { Fragment as Fragment36, jsx as jsx122, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
14824
15042
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
14825
15043
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -14865,12 +15083,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
14865
15083
|
] });
|
|
14866
15084
|
}
|
|
14867
15085
|
function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
14868
|
-
const [confirming, setConfirming] =
|
|
15086
|
+
const [confirming, setConfirming] = useState66(false);
|
|
14869
15087
|
const data = controller.data;
|
|
14870
|
-
|
|
15088
|
+
useEffect40(() => {
|
|
14871
15089
|
setConfirming(false);
|
|
14872
15090
|
}, [sport]);
|
|
14873
|
-
|
|
15091
|
+
useEffect40(() => {
|
|
14874
15092
|
if (!confirming) return;
|
|
14875
15093
|
const onPointerDown = (e) => {
|
|
14876
15094
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -14924,21 +15142,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
|
14924
15142
|
}
|
|
14925
15143
|
|
|
14926
15144
|
// src/components/FavouritesSearch.tsx
|
|
14927
|
-
import { useEffect as
|
|
15145
|
+
import { useEffect as useEffect41, useRef as useRef33, useState as useState67 } from "react";
|
|
14928
15146
|
import { jsx as jsx123, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
14929
15147
|
var MIN_LETTERS = 2;
|
|
14930
15148
|
var MAX_LENGTH = 64;
|
|
14931
15149
|
var DEBOUNCE_MS = 250;
|
|
14932
15150
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
14933
|
-
const [query, setQuery] =
|
|
14934
|
-
const [answer, setAnswer] =
|
|
15151
|
+
const [query, setQuery] = useState67("");
|
|
15152
|
+
const [answer, setAnswer] = useState67(null);
|
|
14935
15153
|
const controllerRef = useRef33(controller);
|
|
14936
15154
|
controllerRef.current = controller;
|
|
14937
15155
|
const trimmed = query.trim();
|
|
14938
15156
|
const queryKey = `${sport}|${trimmed}`;
|
|
14939
15157
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
14940
15158
|
const settled = answer?.key === queryKey;
|
|
14941
|
-
|
|
15159
|
+
useEffect41(() => {
|
|
14942
15160
|
setAnswer(null);
|
|
14943
15161
|
if (trimmed.length < MIN_LETTERS) return;
|
|
14944
15162
|
let cancelled = false;
|
|
@@ -15003,13 +15221,13 @@ function capitalised(sport) {
|
|
|
15003
15221
|
return sport.charAt(0).toUpperCase() + sport.slice(1);
|
|
15004
15222
|
}
|
|
15005
15223
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
15006
|
-
const [notice, setNotice] =
|
|
15224
|
+
const [notice, setNotice] = useState68(null);
|
|
15007
15225
|
const refreshRef = useRef34(controller.refresh);
|
|
15008
15226
|
refreshRef.current = controller.refresh;
|
|
15009
|
-
|
|
15227
|
+
useEffect42(() => {
|
|
15010
15228
|
void refreshRef.current();
|
|
15011
15229
|
}, []);
|
|
15012
|
-
|
|
15230
|
+
useEffect42(() => {
|
|
15013
15231
|
setNotice(null);
|
|
15014
15232
|
}, [sport]);
|
|
15015
15233
|
const sportLabel = sports.find((s) => s.sport === sport)?.label ?? capitalised(sport);
|
|
@@ -15273,10 +15491,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
15273
15491
|
}
|
|
15274
15492
|
|
|
15275
15493
|
// src/components/PlayerPhoto.tsx
|
|
15276
|
-
import { useState as
|
|
15494
|
+
import { useState as useState69 } from "react";
|
|
15277
15495
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
15278
15496
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
15279
|
-
const [failed, setFailed] =
|
|
15497
|
+
const [failed, setFailed] = useState69(false);
|
|
15280
15498
|
const box = { width: size, height: size };
|
|
15281
15499
|
if (photoUrl && !failed) {
|
|
15282
15500
|
return /* @__PURE__ */ jsx129("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -15311,7 +15529,7 @@ function MiniPitch({ positionCode }) {
|
|
|
15311
15529
|
}
|
|
15312
15530
|
|
|
15313
15531
|
// src/components/PerformanceBars.tsx
|
|
15314
|
-
import { useState as
|
|
15532
|
+
import { useState as useState70 } from "react";
|
|
15315
15533
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
15316
15534
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
15317
15535
|
function finite3(v) {
|
|
@@ -15357,7 +15575,7 @@ function unrankedLine(ui, reason) {
|
|
|
15357
15575
|
}
|
|
15358
15576
|
}
|
|
15359
15577
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
15360
|
-
const [mode, setMode] =
|
|
15578
|
+
const [mode, setMode] = useState70("total");
|
|
15361
15579
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
15362
15580
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
15363
15581
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -15566,16 +15784,16 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
|
|
|
15566
15784
|
}
|
|
15567
15785
|
|
|
15568
15786
|
// src/components/PresetTools.tsx
|
|
15569
|
-
import { Fragment as Fragment39, useEffect as
|
|
15787
|
+
import { Fragment as Fragment39, useEffect as useEffect43, useId as useId11, useRef as useRef35, useState as useState71 } from "react";
|
|
15570
15788
|
import { Fragment as Fragment40, jsx as jsx134, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
15571
15789
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
15572
|
-
function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
15790
|
+
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
15573
15791
|
const dialogRef = useRef35(null);
|
|
15574
15792
|
const titleId = useId11();
|
|
15575
|
-
|
|
15576
|
-
dialogRef.current?.focus();
|
|
15793
|
+
useEffect43(() => {
|
|
15794
|
+
dialogRef.current?.focus({ preventScroll: true });
|
|
15577
15795
|
}, []);
|
|
15578
|
-
|
|
15796
|
+
useEffect43(() => {
|
|
15579
15797
|
const onKey = (e) => {
|
|
15580
15798
|
if (e.key !== "Escape") return;
|
|
15581
15799
|
e.stopPropagation();
|
|
@@ -15605,7 +15823,7 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
|
15605
15823
|
first.focus();
|
|
15606
15824
|
}
|
|
15607
15825
|
};
|
|
15608
|
-
return /* @__PURE__ */ jsx134("div", { className: "ss-w-tool-backdrop", children: /* @__PURE__ */ jsxs118("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
|
|
15826
|
+
return /* @__PURE__ */ jsx134("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ jsxs118("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
|
|
15609
15827
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-head", children: [
|
|
15610
15828
|
/* @__PURE__ */ jsx134("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
15611
15829
|
/* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx134(CloseIcon, {}) })
|
|
@@ -15620,14 +15838,14 @@ function fillTemplate(template, slots) {
|
|
|
15620
15838
|
return /* @__PURE__ */ jsx134(Fragment39, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
|
|
15621
15839
|
});
|
|
15622
15840
|
}
|
|
15623
|
-
function NumberSelect({ current, choices
|
|
15624
|
-
const selected = Math.max(0,
|
|
15841
|
+
function NumberSelect({ current, choices, label, notToday, lockEmpty = true, onChoose }) {
|
|
15842
|
+
const selected = Math.max(0, choices.findIndex((c) => samePrice(c.value, current)));
|
|
15625
15843
|
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15626
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children:
|
|
15844
|
+
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: choices[selected]?.text ?? "" }),
|
|
15627
15845
|
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(selected), onChange: (e) => {
|
|
15628
|
-
const c =
|
|
15629
|
-
if (c) onChoose(c
|
|
15630
|
-
}, children:
|
|
15846
|
+
const c = choices[Number(e.target.value)];
|
|
15847
|
+
if (c) onChoose(c);
|
|
15848
|
+
}, children: choices.map((c, i) => /* @__PURE__ */ jsx134("option", { value: String(i), disabled: lockEmpty && !c.available && i !== selected, children: c.available ? c.text : `${c.text}${notToday}` }, c.key)) })
|
|
15631
15849
|
] });
|
|
15632
15850
|
}
|
|
15633
15851
|
function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
|
|
@@ -15641,6 +15859,7 @@ function SendButton({ label, display, disabled, onClick }) {
|
|
|
15641
15859
|
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
|
|
15642
15860
|
}
|
|
15643
15861
|
function PickList({ picks, formatKickoff }) {
|
|
15862
|
+
const { oddsFormat } = useOddsSettings();
|
|
15644
15863
|
return /* @__PURE__ */ jsx134("ul", { className: "ss-w-tool-picks", role: "list", children: picks.map((p) => /* @__PURE__ */ jsxs118("li", { className: "ss-w-tool-pick", children: [
|
|
15645
15864
|
/* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-pick-match", children: [
|
|
15646
15865
|
p.homeTeamName,
|
|
@@ -15654,13 +15873,14 @@ function PickList({ picks, formatKickoff }) {
|
|
|
15654
15873
|
p.line ? ` ${p.line}` : ""
|
|
15655
15874
|
] }),
|
|
15656
15875
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
|
|
15657
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-pick-price", children: p.
|
|
15876
|
+
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-pick-price", children: formatOdds(p.priceFormats, oddsFormat) })
|
|
15658
15877
|
] }, p.matchOddsId)) });
|
|
15659
15878
|
}
|
|
15660
15879
|
function ComboPreview({ cell: cell2, formatKickoff }) {
|
|
15880
|
+
const { oddsFormat } = useOddsSettings();
|
|
15661
15881
|
return /* @__PURE__ */ jsxs118(Fragment40, { children: [
|
|
15662
15882
|
/* @__PURE__ */ jsx134(PickList, { picks: cell2.combo.legs, formatKickoff }),
|
|
15663
|
-
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-math", children: cell2.combo.multiplication })
|
|
15883
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-math", children: oddsFormat === "decimal" ? cell2.combo.multiplication : formatOdds(cell2.combo.totalFormats, oddsFormat) })
|
|
15664
15884
|
] });
|
|
15665
15885
|
}
|
|
15666
15886
|
function Unavailable({ text }) {
|
|
@@ -15679,22 +15899,31 @@ function AskRow({ icon, ask, ready, send }) {
|
|
|
15679
15899
|
function RoundSend({ label, display, disabled, onClick }) {
|
|
15680
15900
|
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ jsx134(SendIcon, {}) });
|
|
15681
15901
|
}
|
|
15902
|
+
var optionChoice = (o, format2, available) => ({ key: o.key, value: o.value, text: formatOdds(o.formats, format2), available });
|
|
15903
|
+
var textOf = (options, value, format2) => {
|
|
15904
|
+
const o = options.find((x) => samePrice(x.value, value));
|
|
15905
|
+
return o ? formatOdds(o.formats, format2) : "";
|
|
15906
|
+
};
|
|
15682
15907
|
var BIG_COMBO = { total: 50, legs: 6 };
|
|
15683
15908
|
function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
15684
|
-
const
|
|
15685
|
-
const
|
|
15686
|
-
const
|
|
15909
|
+
const { oddsFormat } = useOddsSettings();
|
|
15910
|
+
const limitOptions = singlesLimits(grid);
|
|
15911
|
+
const floorOptions = singlesFloors(grid);
|
|
15912
|
+
const totalOptions = comboTotals(grid);
|
|
15913
|
+
const limits = limitOptions.map((o) => o.value);
|
|
15914
|
+
const floors = floorOptions.map((o) => o.value);
|
|
15915
|
+
const totals = totalOptions.map((o) => o.value);
|
|
15687
15916
|
const legChoices = comboLegChoices(grid);
|
|
15688
15917
|
const count = FIXED_SINGLES_COUNT;
|
|
15689
|
-
const [maxPrice, setMaxPrice] =
|
|
15690
|
-
const [minPrice, setMinPrice] =
|
|
15691
|
-
const [start] =
|
|
15692
|
-
const [total, setTotal] =
|
|
15693
|
-
const [legs, setLegs] =
|
|
15694
|
-
const [bigStart] =
|
|
15695
|
-
const [bigTotal, setBigTotal] =
|
|
15696
|
-
const [bigLegs, setBigLegs] =
|
|
15697
|
-
const [announcement, setAnnouncement] =
|
|
15918
|
+
const [maxPrice, setMaxPrice] = useState71(() => startSingles(grid.singles, limits, START.maxPrice, count));
|
|
15919
|
+
const [minPrice, setMinPrice] = useState71(() => startSingles(grid.singlesFrom, floors, START.minPrice, count));
|
|
15920
|
+
const [start] = useState71(() => startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs));
|
|
15921
|
+
const [total, setTotal] = useState71(start.total);
|
|
15922
|
+
const [legs, setLegs] = useState71(start.legs);
|
|
15923
|
+
const [bigStart] = useState71(() => startCombo(grid, totals, legChoices, BIG_COMBO.total, BIG_COMBO.legs));
|
|
15924
|
+
const [bigTotal, setBigTotal] = useState71(bigStart.total);
|
|
15925
|
+
const [bigLegs, setBigLegs] = useState71(bigStart.legs);
|
|
15926
|
+
const [announcement, setAnnouncement] = useState71("");
|
|
15698
15927
|
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
15699
15928
|
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
15700
15929
|
const comboCell = findCombo(grid, total, legs);
|
|
@@ -15705,44 +15934,45 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15705
15934
|
const cell2 = markets[idx];
|
|
15706
15935
|
if (cell2) announce(marketDisplay(cell2, strings), cell2.count > 0);
|
|
15707
15936
|
};
|
|
15708
|
-
const
|
|
15709
|
-
|
|
15710
|
-
|
|
15937
|
+
const totalText = (v) => textOf(totalOptions, v, oddsFormat);
|
|
15938
|
+
const chooseMax = (c) => {
|
|
15939
|
+
setMaxPrice(c.value);
|
|
15940
|
+
announce(strings.maxPriceDisplay(count, c.text), !!findSingles(grid.singles, c.value, count));
|
|
15711
15941
|
};
|
|
15712
|
-
const chooseMin = (
|
|
15713
|
-
setMinPrice(
|
|
15714
|
-
announce(strings.minPriceDisplay(count,
|
|
15942
|
+
const chooseMin = (c) => {
|
|
15943
|
+
setMinPrice(c.value);
|
|
15944
|
+
announce(strings.minPriceDisplay(count, c.text), !!findSingles(grid.singlesFrom, c.value, count));
|
|
15715
15945
|
};
|
|
15716
|
-
const chooseLegs = (
|
|
15717
|
-
setLegs(
|
|
15718
|
-
announce(strings.comboDisplay(
|
|
15946
|
+
const chooseLegs = (c) => {
|
|
15947
|
+
setLegs(c.value);
|
|
15948
|
+
announce(strings.comboDisplay(c.value, totalText(total)), !!findCombo(grid, total, c.value));
|
|
15719
15949
|
};
|
|
15720
|
-
const chooseTotal = (
|
|
15721
|
-
const l = legsForTotal(grid,
|
|
15722
|
-
setTotal(
|
|
15950
|
+
const chooseTotal = (c) => {
|
|
15951
|
+
const l = legsForTotal(grid, c.value, legs);
|
|
15952
|
+
setTotal(c.value);
|
|
15723
15953
|
setLegs(l);
|
|
15724
|
-
announce(strings.comboDisplay(l,
|
|
15954
|
+
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15725
15955
|
};
|
|
15726
|
-
const chooseBigLegs = (
|
|
15727
|
-
setBigLegs(
|
|
15728
|
-
announce(strings.comboDisplay(
|
|
15956
|
+
const chooseBigLegs = (c) => {
|
|
15957
|
+
setBigLegs(c.value);
|
|
15958
|
+
announce(strings.comboDisplay(c.value, totalText(bigTotal)), !!findCombo(grid, bigTotal, c.value));
|
|
15729
15959
|
};
|
|
15730
|
-
const chooseBigTotal = (
|
|
15731
|
-
const l = legsForTotal(grid,
|
|
15732
|
-
setBigTotal(
|
|
15960
|
+
const chooseBigTotal = (c) => {
|
|
15961
|
+
const l = legsForTotal(grid, c.value, bigLegs);
|
|
15962
|
+
setBigTotal(c.value);
|
|
15733
15963
|
setBigLegs(l);
|
|
15734
|
-
announce(strings.comboDisplay(l,
|
|
15964
|
+
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15735
15965
|
};
|
|
15736
|
-
const maxChoices =
|
|
15737
|
-
const minChoices =
|
|
15738
|
-
const totalChoices =
|
|
15739
|
-
const legChoicesFor = (t) => legChoices.map((n) => ({ value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
15966
|
+
const maxChoices = limitOptions.map((o) => optionChoice(o, oddsFormat, !!findSingles(grid.singles, o.value, count)));
|
|
15967
|
+
const minChoices = floorOptions.map((o) => optionChoice(o, oddsFormat, !!findSingles(grid.singlesFrom, o.value, count)));
|
|
15968
|
+
const totalChoices = totalOptions.map((o) => optionChoice(o, oddsFormat, legChoices.some((n) => !!findCombo(grid, o.value, n))));
|
|
15969
|
+
const legChoicesFor = (t) => legChoices.map((n) => ({ key: String(n), value: n, text: String(n), available: !!findCombo(grid, t, n) }));
|
|
15740
15970
|
const markets = grid.markets ?? [];
|
|
15741
|
-
const [marketIdx, setMarketIdx] =
|
|
15971
|
+
const [marketIdx, setMarketIdx] = useState71(0);
|
|
15742
15972
|
const marketCell = markets[marketIdx] ?? null;
|
|
15743
15973
|
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
15744
15974
|
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
15745
|
-
const comboReady = (cell2) => cell2 ? strings.readyAt(cell2.combo.
|
|
15975
|
+
const comboReady = (cell2) => cell2 ? strings.readyAt(formatOdds(cell2.combo.totalFormats, oddsFormat)) : strings.unavailable;
|
|
15746
15976
|
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
15747
15977
|
/* @__PURE__ */ jsx134(
|
|
15748
15978
|
AskRow,
|
|
@@ -15750,11 +15980,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15750
15980
|
icon: "\u{1F3AF}",
|
|
15751
15981
|
ask: fillTemplate(strings.maxPriceRow, {
|
|
15752
15982
|
count: String(count),
|
|
15753
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice
|
|
15983
|
+
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice, choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
|
|
15754
15984
|
}),
|
|
15755
15985
|
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));
|
|
15986
|
+
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, textOf(limitOptions, maxPrice, oddsFormat)), disabled: !maxCell || streaming, onClick: () => {
|
|
15987
|
+
if (maxCell) onSend(maxPriceAsk(maxCell, strings, oddsFormat));
|
|
15758
15988
|
} })
|
|
15759
15989
|
}
|
|
15760
15990
|
),
|
|
@@ -15764,11 +15994,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15764
15994
|
icon: "\u{1F4C8}",
|
|
15765
15995
|
ask: fillTemplate(strings.minPriceRow, {
|
|
15766
15996
|
count: String(count),
|
|
15767
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice
|
|
15997
|
+
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice, choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
|
|
15768
15998
|
}),
|
|
15769
15999
|
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));
|
|
16000
|
+
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, textOf(floorOptions, minPrice, oddsFormat)), disabled: !minCell || streaming, onClick: () => {
|
|
16001
|
+
if (minCell) onSend(minPriceAsk(minCell, strings, oddsFormat));
|
|
15772
16002
|
} })
|
|
15773
16003
|
}
|
|
15774
16004
|
),
|
|
@@ -15777,12 +16007,12 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15777
16007
|
{
|
|
15778
16008
|
icon: "\u2728",
|
|
15779
16009
|
ask: fillTemplate(strings.comboRow, {
|
|
15780
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current:
|
|
15781
|
-
total: /* @__PURE__ */ jsx134(NumberSelect, { current: total
|
|
16010
|
+
legs: /* @__PURE__ */ jsx134(NumberSelect, { current: legs, choices: legChoicesFor(total), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseLegs }),
|
|
16011
|
+
total: /* @__PURE__ */ jsx134(NumberSelect, { current: total, choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseTotal })
|
|
15782
16012
|
}),
|
|
15783
16013
|
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));
|
|
16014
|
+
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, totalText(total)), disabled: !comboCell || streaming, onClick: () => {
|
|
16015
|
+
if (comboCell) onSend(comboAsk(comboCell, strings, oddsFormat));
|
|
15786
16016
|
} })
|
|
15787
16017
|
}
|
|
15788
16018
|
),
|
|
@@ -15791,12 +16021,12 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15791
16021
|
{
|
|
15792
16022
|
icon: "\u{1F3C6}",
|
|
15793
16023
|
ask: fillTemplate(strings.bigComboRow, {
|
|
15794
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current:
|
|
15795
|
-
total: /* @__PURE__ */ jsx134(NumberSelect, { current: bigTotal
|
|
16024
|
+
legs: /* @__PURE__ */ jsx134(NumberSelect, { current: bigLegs, choices: legChoicesFor(bigTotal), label: strings.matchesLabel, notToday: strings.notToday, lockEmpty: false, onChoose: chooseBigLegs }),
|
|
16025
|
+
total: /* @__PURE__ */ jsx134(NumberSelect, { current: bigTotal, choices: totalChoices, label: strings.totalLabel, notToday: strings.notToday, onChoose: chooseBigTotal })
|
|
15796
16026
|
}),
|
|
15797
16027
|
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));
|
|
16028
|
+
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, totalText(bigTotal)), disabled: !bigCell || streaming, onClick: () => {
|
|
16029
|
+
if (bigCell) onSend(comboAsk(bigCell, strings, oddsFormat));
|
|
15800
16030
|
} })
|
|
15801
16031
|
}
|
|
15802
16032
|
),
|
|
@@ -15817,33 +16047,35 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15817
16047
|
] });
|
|
15818
16048
|
}
|
|
15819
16049
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
15820
|
-
const
|
|
16050
|
+
const { oddsFormat } = useOddsSettings();
|
|
16051
|
+
const totalOptions = comboTotals(grid);
|
|
16052
|
+
const totals = totalOptions.map((o) => o.value);
|
|
15821
16053
|
const legChoices = comboLegChoices(grid);
|
|
15822
|
-
const [start] =
|
|
15823
|
-
const [total, setTotal] =
|
|
15824
|
-
const [legs, setLegs] =
|
|
16054
|
+
const [start] = useState71(() => initialTotal === void 0 ? startCombo(grid, totals, legChoices, START.comboTotal, START.comboLegs) : null);
|
|
16055
|
+
const [total, setTotal] = useState71(() => initialTotal !== void 0 ? nearest(totals, initialTotal) : start.total);
|
|
16056
|
+
const [legs, setLegs] = useState71(() => {
|
|
15825
16057
|
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
15826
16058
|
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
15827
16059
|
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
15828
16060
|
});
|
|
15829
|
-
const [announcement, setAnnouncement] =
|
|
16061
|
+
const [announcement, setAnnouncement] = useState71("");
|
|
15830
16062
|
const cell2 = findCombo(grid, total, legs);
|
|
15831
16063
|
const minLegs = legChoices[0] ?? legs;
|
|
15832
16064
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
15833
|
-
const display = strings.comboDisplay(legs, total);
|
|
16065
|
+
const display = strings.comboDisplay(legs, textOf(totalOptions, total, oddsFormat));
|
|
15834
16066
|
const choose = (nextTotal, nextLegs) => {
|
|
15835
16067
|
setTotal(nextTotal);
|
|
15836
16068
|
setLegs(nextLegs);
|
|
15837
|
-
const d = strings.comboDisplay(nextLegs, nextTotal);
|
|
16069
|
+
const d = strings.comboDisplay(nextLegs, textOf(totalOptions, nextTotal, oddsFormat));
|
|
15838
16070
|
setAnnouncement(findCombo(grid, nextTotal, nextLegs) ? d : `${d}. ${strings.unavailable}`);
|
|
15839
16071
|
};
|
|
15840
16072
|
const footer = /* @__PURE__ */ jsx134(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
|
|
15841
|
-
if (cell2) onSend(comboAsk(cell2, strings));
|
|
16073
|
+
if (cell2) onSend(comboAsk(cell2, strings, oddsFormat));
|
|
15842
16074
|
} });
|
|
15843
16075
|
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
|
|
15844
16076
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
|
|
15845
16077
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
|
|
15846
|
-
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-chips", children:
|
|
16078
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-chips", children: totalOptions.map((o) => /* @__PURE__ */ jsx134("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
16079
|
] }),
|
|
15848
16080
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
|
|
15849
16081
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
|
|
@@ -15858,8 +16090,42 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
15858
16090
|
] });
|
|
15859
16091
|
}
|
|
15860
16092
|
|
|
16093
|
+
// src/components/SettingsSheet.tsx
|
|
16094
|
+
import { jsx as jsx135, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
16095
|
+
var SAMPLE = { decimal: "2.50", american: "+150", fractional: "3/2" };
|
|
16096
|
+
var ODDS = ["decimal", "fractional", "american"];
|
|
16097
|
+
var THEMES2 = ["light", "dark", "auto"];
|
|
16098
|
+
function SettingsSheet({ ui, onClose }) {
|
|
16099
|
+
const s = useOddsSettings();
|
|
16100
|
+
const t = ui.settings;
|
|
16101
|
+
return /* @__PURE__ */ jsxs119(
|
|
16102
|
+
PresetToolModal,
|
|
16103
|
+
{
|
|
16104
|
+
title: t.title,
|
|
16105
|
+
closeLabel: t.close,
|
|
16106
|
+
onClose,
|
|
16107
|
+
className: "ss-w-set-backdrop-in",
|
|
16108
|
+
footer: /* @__PURE__ */ jsx135("p", { className: "ss-w-set-foot", children: t.foot }),
|
|
16109
|
+
children: [
|
|
16110
|
+
s.oddsOffered && /* @__PURE__ */ jsxs119("div", { className: "ss-w-set-row", children: [
|
|
16111
|
+
/* @__PURE__ */ jsx135("div", { className: "ss-w-tool-label", id: "ss-w-set-odds", children: t.oddsLabel }),
|
|
16112
|
+
/* @__PURE__ */ jsxs119("div", { className: "ss-w-set-sample", children: [
|
|
16113
|
+
/* @__PURE__ */ jsx135("span", { children: t.sampleLabel }),
|
|
16114
|
+
/* @__PURE__ */ jsx135("b", { children: formatOdds(SAMPLE, s.oddsFormat) })
|
|
16115
|
+
] }),
|
|
16116
|
+
/* @__PURE__ */ jsx135("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-odds", children: ODDS.map((f) => /* @__PURE__ */ jsx135("button", { type: "button", "aria-pressed": s.oddsFormat === f, onClick: () => s.setOddsFormat(f), children: t[f] }, f)) })
|
|
16117
|
+
] }),
|
|
16118
|
+
!s.themeLocked && /* @__PURE__ */ jsxs119("div", { className: "ss-w-set-row", children: [
|
|
16119
|
+
/* @__PURE__ */ jsx135("div", { className: "ss-w-tool-label", id: "ss-w-set-theme", children: t.themeLabel }),
|
|
16120
|
+
/* @__PURE__ */ jsx135("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-theme", children: THEMES2.map((m) => /* @__PURE__ */ jsx135("button", { type: "button", "aria-pressed": s.theme === m, onClick: () => s.setTheme(m), children: t[m] }, m)) })
|
|
16121
|
+
] })
|
|
16122
|
+
]
|
|
16123
|
+
}
|
|
16124
|
+
);
|
|
16125
|
+
}
|
|
16126
|
+
|
|
15861
16127
|
// src/usePresetDial.ts
|
|
15862
|
-
import { useCallback as useCallback24, useEffect as
|
|
16128
|
+
import { useCallback as useCallback24, useEffect as useEffect44, useRef as useRef36, useState as useState72 } from "react";
|
|
15863
16129
|
function sendInFlight(messages, isStreaming) {
|
|
15864
16130
|
const last = messages[messages.length - 1];
|
|
15865
16131
|
return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
|
|
@@ -15873,25 +16139,25 @@ function lastUserId(messages) {
|
|
|
15873
16139
|
}
|
|
15874
16140
|
var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
|
|
15875
16141
|
function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
|
|
15876
|
-
const [expanded, setExpanded] =
|
|
16142
|
+
const [expanded, setExpanded] = useState72(() => !sendInFlight(messages, isStreaming));
|
|
15877
16143
|
const fold2 = useCallback24(() => setExpanded(false), []);
|
|
15878
16144
|
const toggle = useCallback24(() => setExpanded((e) => !e), []);
|
|
15879
16145
|
const currentUserId = lastUserId(messages);
|
|
15880
16146
|
const userIdRef = useRef36(currentUserId);
|
|
15881
|
-
|
|
16147
|
+
useEffect44(() => {
|
|
15882
16148
|
if (currentUserId === userIdRef.current) return;
|
|
15883
16149
|
userIdRef.current = currentUserId;
|
|
15884
16150
|
setExpanded(false);
|
|
15885
16151
|
}, [currentUserId]);
|
|
15886
16152
|
const tabRef = useRef36(activeTab);
|
|
15887
|
-
|
|
16153
|
+
useEffect44(() => {
|
|
15888
16154
|
if (activeTab === tabRef.current) return;
|
|
15889
16155
|
tabRef.current = activeTab;
|
|
15890
16156
|
setExpanded(false);
|
|
15891
16157
|
}, [activeTab]);
|
|
15892
16158
|
const expandedRef = useRef36(expanded);
|
|
15893
16159
|
expandedRef.current = expanded;
|
|
15894
|
-
|
|
16160
|
+
useEffect44(() => {
|
|
15895
16161
|
const onEscape = (e) => {
|
|
15896
16162
|
const dial = dialRef.current;
|
|
15897
16163
|
if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
|
|
@@ -15904,7 +16170,7 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
|
|
|
15904
16170
|
window.addEventListener("keydown", onEscape, true);
|
|
15905
16171
|
return () => window.removeEventListener("keydown", onEscape, true);
|
|
15906
16172
|
}, [dialRef, dialButtonRef]);
|
|
15907
|
-
|
|
16173
|
+
useEffect44(() => {
|
|
15908
16174
|
if (!expanded) return;
|
|
15909
16175
|
const layer = layerRef.current;
|
|
15910
16176
|
const inDial = (e) => {
|
|
@@ -15937,12 +16203,12 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
|
|
|
15937
16203
|
}
|
|
15938
16204
|
|
|
15939
16205
|
// src/presetSeen.ts
|
|
15940
|
-
var
|
|
16206
|
+
var KEY2 = "ss-w-presets-tool-opened";
|
|
15941
16207
|
var openedThisPage = false;
|
|
15942
16208
|
function readToolSeen() {
|
|
15943
16209
|
if (openedThisPage) return true;
|
|
15944
16210
|
try {
|
|
15945
|
-
return window.localStorage.getItem(
|
|
16211
|
+
return window.localStorage.getItem(KEY2) === "1";
|
|
15946
16212
|
} catch {
|
|
15947
16213
|
return false;
|
|
15948
16214
|
}
|
|
@@ -15950,17 +16216,17 @@ function readToolSeen() {
|
|
|
15950
16216
|
function markToolSeen() {
|
|
15951
16217
|
openedThisPage = true;
|
|
15952
16218
|
try {
|
|
15953
|
-
window.localStorage.setItem(
|
|
16219
|
+
window.localStorage.setItem(KEY2, "1");
|
|
15954
16220
|
} catch {
|
|
15955
16221
|
}
|
|
15956
16222
|
}
|
|
15957
16223
|
|
|
15958
16224
|
// src/components/ChatPanel.tsx
|
|
15959
|
-
import { Fragment as Fragment41, jsx as
|
|
16225
|
+
import { Fragment as Fragment41, jsx as jsx136, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
15960
16226
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
15961
16227
|
function useIsModal() {
|
|
15962
|
-
const [modal, setModal] =
|
|
15963
|
-
|
|
16228
|
+
const [modal, setModal] = useState73(false);
|
|
16229
|
+
useEffect45(() => {
|
|
15964
16230
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
15965
16231
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
15966
16232
|
const sync = () => setModal(mql.matches);
|
|
@@ -15980,8 +16246,8 @@ function greetingInFlight(messages) {
|
|
|
15980
16246
|
}
|
|
15981
16247
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites }) {
|
|
15982
16248
|
const { state, close, stop, send, reset } = controller;
|
|
15983
|
-
const [squadView, setSquadView] =
|
|
15984
|
-
const [selectedPlayerId, setSelectedPlayerId] =
|
|
16249
|
+
const [squadView, setSquadView] = useState73("roster");
|
|
16250
|
+
const [selectedPlayerId, setSelectedPlayerId] = useState73(null);
|
|
15985
16251
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
15986
16252
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
15987
16253
|
const squadLayerRef = useRef37(null);
|
|
@@ -16002,13 +16268,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16002
16268
|
squadScrollRef.current = null;
|
|
16003
16269
|
}, [selectedPlayerId]);
|
|
16004
16270
|
const activeTab = monitor?.activeTab;
|
|
16005
|
-
|
|
16271
|
+
useEffect45(() => {
|
|
16006
16272
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
16007
16273
|
setSelectedPlayerId(null);
|
|
16008
16274
|
clearPlayerDetail?.();
|
|
16009
16275
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
16010
16276
|
const setMonitorTab = monitor?.setActiveTab;
|
|
16011
|
-
|
|
16277
|
+
useEffect45(() => {
|
|
16012
16278
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
16013
16279
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
16014
16280
|
const isModal = useIsModal();
|
|
@@ -16020,7 +16286,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16020
16286
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
16021
16287
|
close();
|
|
16022
16288
|
}, [track, closeTab, answering, close]);
|
|
16023
|
-
|
|
16289
|
+
useEffect45(() => {
|
|
16024
16290
|
const onKey = (e) => {
|
|
16025
16291
|
if (e.key === "Escape") closeWith("escape");
|
|
16026
16292
|
};
|
|
@@ -16036,7 +16302,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16036
16302
|
monitor?.setActiveTab("chat");
|
|
16037
16303
|
send(text, { grounding, source: "live_fact" });
|
|
16038
16304
|
};
|
|
16039
|
-
|
|
16305
|
+
useEffect45(() => {
|
|
16040
16306
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
16041
16307
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
16042
16308
|
const onChatTab = !monitor || monitor.activeTab === "chat";
|
|
@@ -16047,8 +16313,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16047
16313
|
const limitRef = useRef37(null);
|
|
16048
16314
|
const typedSendRef = useRef37(false);
|
|
16049
16315
|
const focusAfterCloseRef = useRef37(null);
|
|
16050
|
-
const [tool, setTool] =
|
|
16051
|
-
const
|
|
16316
|
+
const [tool, setTool] = useState73(null);
|
|
16317
|
+
const panelRef = useRef37(null);
|
|
16318
|
+
const settings = useOddsSettings();
|
|
16319
|
+
const [settingsOpen, setSettingsOpen] = useState73(false);
|
|
16320
|
+
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
16321
|
+
const openSettings = useCallback25(() => {
|
|
16322
|
+
setTool(null);
|
|
16323
|
+
setSettingsOpen(true);
|
|
16324
|
+
}, []);
|
|
16325
|
+
const closeSettings = useCallback25(() => {
|
|
16326
|
+
setSettingsOpen(false);
|
|
16327
|
+
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
16328
|
+
}, []);
|
|
16329
|
+
const [toolSeen, setToolSeen] = useState73(readToolSeen);
|
|
16052
16330
|
const dial = usePresetDial({
|
|
16053
16331
|
layerRef,
|
|
16054
16332
|
dialRef,
|
|
@@ -16061,10 +16339,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16061
16339
|
const paused = isPaused(state.limit);
|
|
16062
16340
|
const dialWanted = !!presetGrid && !greetingInFlight(state.messages) && !hasPersonalBuilder(state.messages);
|
|
16063
16341
|
const showDial = dialWanted && onChatTab && !tool && !paused;
|
|
16064
|
-
|
|
16342
|
+
useEffect45(() => {
|
|
16065
16343
|
if (paused) setTool(null);
|
|
16066
16344
|
}, [paused]);
|
|
16067
|
-
|
|
16345
|
+
useEffect45(() => {
|
|
16068
16346
|
if (!paused) return;
|
|
16069
16347
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
16070
16348
|
typedSendRef.current = false;
|
|
@@ -16076,7 +16354,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16076
16354
|
setTool(next);
|
|
16077
16355
|
}, [fold2]);
|
|
16078
16356
|
const onPill = useCallback25((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
|
|
16079
|
-
const toolsValue =
|
|
16357
|
+
const toolsValue = useMemo10(
|
|
16080
16358
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
16081
16359
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
16082
16360
|
);
|
|
@@ -16094,20 +16372,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16094
16372
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
16095
16373
|
return `${k.dayLabel} ${k.time}`;
|
|
16096
16374
|
}, [ui]);
|
|
16097
|
-
|
|
16375
|
+
useEffect45(() => {
|
|
16098
16376
|
if (tool) return;
|
|
16099
16377
|
const target = focusAfterCloseRef.current;
|
|
16100
16378
|
focusAfterCloseRef.current = null;
|
|
16101
16379
|
if (target === "dial") dialButtonRef.current?.focus();
|
|
16102
16380
|
else if (target === "composer") inputRef.current?.focus();
|
|
16103
16381
|
}, [tool]);
|
|
16104
|
-
|
|
16382
|
+
useEffect45(() => {
|
|
16105
16383
|
if (!tool || onChatTab && presetGrid) return;
|
|
16106
16384
|
focusAfterCloseRef.current = "composer";
|
|
16107
16385
|
setTool(null);
|
|
16108
16386
|
}, [tool, onChatTab, presetGrid]);
|
|
16109
|
-
return /* @__PURE__ */
|
|
16110
|
-
/* @__PURE__ */
|
|
16387
|
+
return /* @__PURE__ */ jsxs120("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
16388
|
+
/* @__PURE__ */ jsx136(
|
|
16111
16389
|
ChatHeader,
|
|
16112
16390
|
{
|
|
16113
16391
|
onClose: () => closeWith("button"),
|
|
@@ -16117,10 +16395,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16117
16395
|
onNewConversation: reset,
|
|
16118
16396
|
canReset: state.messages.length > 0,
|
|
16119
16397
|
newConversationLabel: ui.newConversation,
|
|
16120
|
-
moreOptionsLabel: ui.moreOptions
|
|
16398
|
+
moreOptionsLabel: ui.moreOptions,
|
|
16399
|
+
onOpenSettings: hasSettings ? openSettings : void 0,
|
|
16400
|
+
settingsLabel: ui.settings.title
|
|
16121
16401
|
}
|
|
16122
16402
|
),
|
|
16123
|
-
monitor && /* @__PURE__ */
|
|
16403
|
+
monitor && /* @__PURE__ */ jsx136(
|
|
16124
16404
|
TabBar,
|
|
16125
16405
|
{
|
|
16126
16406
|
monitor,
|
|
@@ -16134,9 +16414,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16134
16414
|
favouritesEnabled: favouritesEnabled ?? false
|
|
16135
16415
|
}
|
|
16136
16416
|
),
|
|
16137
|
-
/* @__PURE__ */
|
|
16138
|
-
/* @__PURE__ */
|
|
16139
|
-
showDial ? /* @__PURE__ */
|
|
16417
|
+
/* @__PURE__ */ jsxs120("div", { ref: layerRef, className: "ss-w-chat-layer", "data-dial": dialWanted ? "" : void 0, style: onChatTab ? void 0 : HIDDEN_LAYER_STYLE, children: [
|
|
16418
|
+
/* @__PURE__ */ jsx136(PresetToolsContext.Provider, { value: toolsValue, children: /* @__PURE__ */ jsx136(MessageList, { controller, ui, slip, onDashboardTap, monitor }) }),
|
|
16419
|
+
showDial ? /* @__PURE__ */ jsx136(
|
|
16140
16420
|
PresetSpeedDial,
|
|
16141
16421
|
{
|
|
16142
16422
|
expanded: dial.expanded,
|
|
@@ -16148,21 +16428,21 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16148
16428
|
buttonRef: dialButtonRef
|
|
16149
16429
|
}
|
|
16150
16430
|
) : null,
|
|
16151
|
-
tool && presetGrid && onChatTab && !paused ? tool.kind === "numbers" ? /* @__PURE__ */
|
|
16431
|
+
tool && presetGrid && onChatTab && !paused ? tool.kind === "numbers" ? /* @__PURE__ */ jsx136(SetNumbersTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, onSend: sendAsk, onClose: closeTool }) : /* @__PURE__ */ jsx136(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
|
|
16152
16432
|
] }),
|
|
16153
|
-
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */
|
|
16154
|
-
monitor && monitor.activeTab === "following" && /* @__PURE__ */
|
|
16155
|
-
monitor && monitor.activeTab === "trends" && /* @__PURE__ */
|
|
16156
|
-
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */
|
|
16157
|
-
monitor && monitor.activeTab === "standings" && /* @__PURE__ */
|
|
16158
|
-
monitor && monitor.activeTab === "squad" && /* @__PURE__ */
|
|
16159
|
-
/* @__PURE__ */
|
|
16433
|
+
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx136(TodayPanel, { discovery, ui, monitor }),
|
|
16434
|
+
monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx136(MatchesPanel, { monitor, ui, slip, onAsk: paused ? void 0 : handleAsk, discovery }),
|
|
16435
|
+
monitor && monitor.activeTab === "trends" && /* @__PURE__ */ jsx136(TrendsPanel, { monitor, ui, slip }),
|
|
16436
|
+
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */ jsx136(Fixtures, { fixtures: clubFixturesResult?.fixtures ?? [], loading: clubFixturesResult?.loading ?? false, ui }),
|
|
16437
|
+
monitor && monitor.activeTab === "standings" && /* @__PURE__ */ jsx136(Standings, { standings: clubStandingsResult?.data ?? null, loading: clubStandingsResult?.loading ?? false, ui }),
|
|
16438
|
+
monitor && monitor.activeTab === "squad" && /* @__PURE__ */ jsxs120(Fragment41, { children: [
|
|
16439
|
+
/* @__PURE__ */ jsx136(
|
|
16160
16440
|
"div",
|
|
16161
16441
|
{
|
|
16162
16442
|
ref: squadLayerRef,
|
|
16163
16443
|
style: selectedPlayerId === null ? SQUAD_LAYER_STYLE : HIDDEN_LAYER_STYLE,
|
|
16164
16444
|
"aria-hidden": selectedPlayerId !== null ? true : void 0,
|
|
16165
|
-
children: /* @__PURE__ */
|
|
16445
|
+
children: /* @__PURE__ */ jsx136(
|
|
16166
16446
|
Squad,
|
|
16167
16447
|
{
|
|
16168
16448
|
squad: clubSquadResult?.data ?? null,
|
|
@@ -16180,9 +16460,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16180
16460
|
)
|
|
16181
16461
|
}
|
|
16182
16462
|
),
|
|
16183
|
-
selectedPlayerId !== null && /* @__PURE__ */
|
|
16463
|
+
selectedPlayerId !== null && /* @__PURE__ */ jsx136(PlayerDetail, { detail: clubPlayerDetailResult?.data ?? null, loading: clubPlayerDetailResult?.loading ?? false, ui, seasonName: clubSquadStatsResult?.seasonName ?? null, onClose: closePlayer })
|
|
16184
16464
|
] }),
|
|
16185
|
-
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */
|
|
16465
|
+
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx136(
|
|
16186
16466
|
GamesPanel,
|
|
16187
16467
|
{
|
|
16188
16468
|
loggedIn: !!loggedIn,
|
|
@@ -16197,10 +16477,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16197
16477
|
}
|
|
16198
16478
|
}
|
|
16199
16479
|
),
|
|
16200
|
-
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */
|
|
16201
|
-
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */
|
|
16202
|
-
/* @__PURE__ */
|
|
16203
|
-
paused ? null : /* @__PURE__ */
|
|
16480
|
+
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */ jsx136(FavouritesPanel, { controller: favourites.controller, ui, sport: favourites.sport, sports: favourites.sports, onSportChange: favourites.onSportChange }),
|
|
16481
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ jsxs120(Fragment41, { children: [
|
|
16482
|
+
/* @__PURE__ */ jsx136("div", { ref: limitRef, className: "ss-w-limit", role: "status", tabIndex: -1, children: state.limit ? limitText(state.limit, ui) : null }),
|
|
16483
|
+
paused ? null : /* @__PURE__ */ jsx136(
|
|
16204
16484
|
ChatInput,
|
|
16205
16485
|
{
|
|
16206
16486
|
ref: inputRef,
|
|
@@ -16214,14 +16494,15 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16214
16494
|
onType: fold2
|
|
16215
16495
|
}
|
|
16216
16496
|
)
|
|
16217
|
-
] })
|
|
16497
|
+
] }),
|
|
16498
|
+
settingsOpen && hasSettings ? /* @__PURE__ */ jsx136(SettingsSheet, { ui, onClose: closeSettings }) : null
|
|
16218
16499
|
] });
|
|
16219
16500
|
}
|
|
16220
16501
|
|
|
16221
16502
|
// src/components/HostEventsProvider.tsx
|
|
16222
|
-
import { jsx as
|
|
16503
|
+
import { jsx as jsx137 } from "react/jsx-runtime";
|
|
16223
16504
|
function HostEventsProvider({ value, children }) {
|
|
16224
|
-
return /* @__PURE__ */
|
|
16505
|
+
return /* @__PURE__ */ jsx137(SlipStateContext.Provider, { value: value.slipState, children });
|
|
16225
16506
|
}
|
|
16226
16507
|
|
|
16227
16508
|
// src/styles/css.generated.ts
|
|
@@ -16892,6 +17173,20 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16892
17173
|
.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
17174
|
.ss-w-tool-step:disabled { opacity: .5; cursor: not-allowed; }
|
|
16894
17175
|
.ss-w-tool-count { min-width: 24px; text-align: center; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
|
|
17176
|
+
.ss-w-set-row { display: flex; flex-direction: column; gap: 6px; }
|
|
17177
|
+
.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; }
|
|
17178
|
+
.ss-w-set-sample b { font-weight: 700; }
|
|
17179
|
+
.ss-w-set-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
|
|
17180
|
+
.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; }
|
|
17181
|
+
.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)); }
|
|
17182
|
+
.ss-w-set-seg button:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
17183
|
+
.ss-w-set-foot { margin: 0; font-size: 12px; color: var(--ss-w-faint); }
|
|
17184
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
17185
|
+
.ss-w-set-backdrop-in { animation: ss-w-scrim-in .18s ease-out; }
|
|
17186
|
+
.ss-w-set-backdrop-in > .ss-w-tool { animation: ss-w-sheet-in .18s ease-out; }
|
|
17187
|
+
@keyframes ss-w-scrim-in { from { background-color: rgba(0,0,0,0); } }
|
|
17188
|
+
@keyframes ss-w-sheet-in { from { transform: translateY(12%); } to { transform: none; } }
|
|
17189
|
+
}
|
|
16895
17190
|
|
|
16896
17191
|
/* onboarding presets stage 2: the chat layer and the speed dial (spec Stage 2 Behaviour). The
|
|
16897
17192
|
layer is the message list's positioned box (P6), so the dial sits against the list's bottom
|
|
@@ -18726,7 +19021,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18726
19021
|
`;
|
|
18727
19022
|
|
|
18728
19023
|
// src/StatsWidget.tsx
|
|
18729
|
-
import { jsx as
|
|
19024
|
+
import { jsx as jsx138 } from "react/jsx-runtime";
|
|
18730
19025
|
function buildClient(props) {
|
|
18731
19026
|
try {
|
|
18732
19027
|
if ("client" in props && props.client) {
|
|
@@ -18751,12 +19046,12 @@ function injectStyles(root) {
|
|
|
18751
19046
|
function StatsWidget(props) {
|
|
18752
19047
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
18753
19048
|
const cfg = props.config;
|
|
18754
|
-
const built =
|
|
19049
|
+
const built = useMemo11(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
18755
19050
|
const trackingRef = useRef38({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
18756
|
-
const track =
|
|
19051
|
+
const track = useMemo11(() => createTracker(() => trackingRef.current), []);
|
|
18757
19052
|
const eventTextRef = useRef38(false);
|
|
18758
19053
|
eventTextRef.current = cfg?.eventText === true;
|
|
18759
|
-
const logger =
|
|
19054
|
+
const logger = useMemo11(() => {
|
|
18760
19055
|
if (!built) return null;
|
|
18761
19056
|
const raw = built.client.createEventLogger({
|
|
18762
19057
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -18764,7 +19059,8 @@ function StatsWidget(props) {
|
|
|
18764
19059
|
});
|
|
18765
19060
|
return withTracking(raw, track);
|
|
18766
19061
|
}, [built?.client, track]);
|
|
18767
|
-
const ui =
|
|
19062
|
+
const ui = useMemo11(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
19063
|
+
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
18768
19064
|
const rootRef = useRef38(null);
|
|
18769
19065
|
const introDoneRef = useRef38(false);
|
|
18770
19066
|
const markIntroDone = useCallback26(() => {
|
|
@@ -18773,14 +19069,14 @@ function StatsWidget(props) {
|
|
|
18773
19069
|
const language = injectedClient ? void 0 : toUserContext(cfg ?? {})?.defaultLanguage;
|
|
18774
19070
|
const threadLanguage = supportedLanguage(language);
|
|
18775
19071
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
18776
|
-
const sportScope =
|
|
19072
|
+
const sportScope = useMemo11(
|
|
18777
19073
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
18778
19074
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
18779
19075
|
);
|
|
18780
|
-
const chatTracking =
|
|
18781
|
-
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking);
|
|
18782
|
-
const [hasToday, setHasToday] =
|
|
18783
|
-
const liveCardWatches =
|
|
19076
|
+
const chatTracking = useMemo11(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
19077
|
+
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
19078
|
+
const [hasToday, setHasToday] = useState74(false);
|
|
19079
|
+
const liveCardWatches = useMemo11(() => {
|
|
18784
19080
|
const seen = /* @__PURE__ */ new Set();
|
|
18785
19081
|
const out = [];
|
|
18786
19082
|
for (const msg of controller.state.messages) {
|
|
@@ -18824,7 +19120,7 @@ function StatsWidget(props) {
|
|
|
18824
19120
|
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
18825
19121
|
[built]
|
|
18826
19122
|
);
|
|
18827
|
-
const pinnedMatchIds =
|
|
19123
|
+
const pinnedMatchIds = useMemo11(
|
|
18828
19124
|
() => footballMatchPinIds(monitor.pins),
|
|
18829
19125
|
[monitor.pins]
|
|
18830
19126
|
);
|
|
@@ -18839,11 +19135,11 @@ function StatsWidget(props) {
|
|
|
18839
19135
|
pinnedMatchIds
|
|
18840
19136
|
});
|
|
18841
19137
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
18842
|
-
|
|
19138
|
+
useEffect46(() => {
|
|
18843
19139
|
setHasToday(todayHasContent);
|
|
18844
19140
|
}, [todayHasContent]);
|
|
18845
19141
|
const prevLiveSnapshotRef = useRef38(monitor.snapshot);
|
|
18846
|
-
|
|
19142
|
+
useEffect46(() => {
|
|
18847
19143
|
const snap = monitor.snapshot;
|
|
18848
19144
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
18849
19145
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -18883,14 +19179,14 @@ function StatsWidget(props) {
|
|
|
18883
19179
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
18884
19180
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
18885
19181
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
18886
|
-
const [favSportPick, setFavSportPick] =
|
|
18887
|
-
const latestGreeting =
|
|
19182
|
+
const [favSportPick, setFavSportPick] = useState74(null);
|
|
19183
|
+
const latestGreeting = useMemo11(() => {
|
|
18888
19184
|
for (const m of [...controller.state.messages].reverse()) {
|
|
18889
19185
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
18890
19186
|
}
|
|
18891
19187
|
return null;
|
|
18892
19188
|
}, [controller.state.messages]);
|
|
18893
|
-
const favSportOptions =
|
|
19189
|
+
const favSportOptions = useMemo11(
|
|
18894
19190
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
18895
19191
|
[latestGreeting]
|
|
18896
19192
|
);
|
|
@@ -18899,7 +19195,7 @@ function StatsWidget(props) {
|
|
|
18899
19195
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
18900
19196
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: favSport.charAt(0).toUpperCase() + favSport.slice(1) }];
|
|
18901
19197
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
18902
|
-
const [panelEverOpened, setPanelEverOpened] =
|
|
19198
|
+
const [panelEverOpened, setPanelEverOpened] = useState74(controller.state.isOpen);
|
|
18903
19199
|
if (controller.state.isOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
18904
19200
|
const favourites = useFavourites({
|
|
18905
19201
|
conversation: built?.conversation ?? null,
|
|
@@ -18917,7 +19213,7 @@ function StatsWidget(props) {
|
|
|
18917
19213
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
18918
19214
|
const markTodayActivity = monitor.markTodayActivity;
|
|
18919
19215
|
const prevLiveCountRef = useRef38(0);
|
|
18920
|
-
|
|
19216
|
+
useEffect46(() => {
|
|
18921
19217
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
18922
19218
|
prevLiveCountRef.current = discovery.liveCount;
|
|
18923
19219
|
if (rose) markTodayActivity();
|
|
@@ -18931,7 +19227,7 @@ function StatsWidget(props) {
|
|
|
18931
19227
|
closePanel: controller.close
|
|
18932
19228
|
});
|
|
18933
19229
|
const markAdded = hostEvents.markAdded;
|
|
18934
|
-
const slip =
|
|
19230
|
+
const slip = useMemo11(
|
|
18935
19231
|
() => {
|
|
18936
19232
|
const handler = props.config?.onAddToSlip;
|
|
18937
19233
|
return {
|
|
@@ -18951,13 +19247,13 @@ function StatsWidget(props) {
|
|
|
18951
19247
|
},
|
|
18952
19248
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
18953
19249
|
);
|
|
18954
|
-
const onDashboardTap =
|
|
19250
|
+
const onDashboardTap = useMemo11(
|
|
18955
19251
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
18956
19252
|
[built, logger]
|
|
18957
19253
|
);
|
|
18958
19254
|
const dismissPopup = usePopupTelemetry(logger, controller.state.isOpen, controller.state.popupText, controller.dismissPopup);
|
|
18959
19255
|
useOpenTelemetry(logger, controller.state.isOpen);
|
|
18960
|
-
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk).map((ask) => ({
|
|
19256
|
+
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
|
|
18961
19257
|
label: ask.label,
|
|
18962
19258
|
onTap: () => runBubbleAsk(ask, {
|
|
18963
19259
|
open: controller.open,
|
|
@@ -18970,7 +19266,7 @@ function StatsWidget(props) {
|
|
|
18970
19266
|
const onControlRef = useRef38(props.onControl);
|
|
18971
19267
|
onControlRef.current = props.onControl;
|
|
18972
19268
|
const { open: openPanel, close: closePanel } = controller;
|
|
18973
|
-
|
|
19269
|
+
useEffect46(() => {
|
|
18974
19270
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
18975
19271
|
return () => onControlRef.current?.(null);
|
|
18976
19272
|
}, [openPanel, closePanel]);
|
|
@@ -18987,11 +19283,11 @@ function StatsWidget(props) {
|
|
|
18987
19283
|
page: cfg?.page
|
|
18988
19284
|
}
|
|
18989
19285
|
};
|
|
18990
|
-
|
|
19286
|
+
useEffect46(() => {
|
|
18991
19287
|
if (!logger) return;
|
|
18992
19288
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
18993
19289
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
18994
|
-
|
|
19290
|
+
useEffect46(() => {
|
|
18995
19291
|
if (!logger) return;
|
|
18996
19292
|
logger.resume();
|
|
18997
19293
|
const onHide = () => {
|
|
@@ -19009,15 +19305,15 @@ function StatsWidget(props) {
|
|
|
19009
19305
|
logger.dispose();
|
|
19010
19306
|
};
|
|
19011
19307
|
}, [logger]);
|
|
19012
|
-
|
|
19308
|
+
useEffect46(() => {
|
|
19013
19309
|
if (!built || !ui.injectStyles) return;
|
|
19014
19310
|
const node = rootRef.current?.getRootNode();
|
|
19015
19311
|
if (node) injectStyles(node);
|
|
19016
19312
|
}, [built, ui.injectStyles]);
|
|
19017
19313
|
const holds = useSessionHolds();
|
|
19018
19314
|
const builderConversation = built?.conversation ?? null;
|
|
19019
|
-
const builderMemory =
|
|
19020
|
-
const personalGreeting =
|
|
19315
|
+
const builderMemory = useMemo11(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
19316
|
+
const personalGreeting = useMemo11(() => ({
|
|
19021
19317
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
19022
19318
|
conversation: built?.conversation ?? null,
|
|
19023
19319
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -19029,8 +19325,8 @@ function StatsWidget(props) {
|
|
|
19029
19325
|
memory: builderMemory
|
|
19030
19326
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
19031
19327
|
if (!built) return null;
|
|
19032
|
-
const attrs = themeAttrs(ui);
|
|
19033
|
-
return /* @__PURE__ */
|
|
19328
|
+
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
19329
|
+
return /* @__PURE__ */ jsx138(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx138(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx138(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx138(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ jsx138(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx138("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__ */ jsx138(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx138(
|
|
19034
19330
|
ChatPanel,
|
|
19035
19331
|
{
|
|
19036
19332
|
controller,
|
|
@@ -19052,7 +19348,7 @@ function StatsWidget(props) {
|
|
|
19052
19348
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
19053
19349
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick }
|
|
19054
19350
|
}
|
|
19055
|
-
) }) : /* @__PURE__ */
|
|
19351
|
+
) }) : /* @__PURE__ */ jsx138(
|
|
19056
19352
|
ChatFab,
|
|
19057
19353
|
{
|
|
19058
19354
|
label: ui.launcherLabel,
|
|
@@ -19066,7 +19362,7 @@ function StatsWidget(props) {
|
|
|
19066
19362
|
onIntroStart: markIntroDone,
|
|
19067
19363
|
asks
|
|
19068
19364
|
}
|
|
19069
|
-
) }) }) }) }) });
|
|
19365
|
+
) }) }) }) }) }) });
|
|
19070
19366
|
}
|
|
19071
19367
|
function emptyConversation() {
|
|
19072
19368
|
return { send: () => {
|