@sensiblestats/widget-react 0.109.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 +24 -0
- package/README.md +12 -3
- package/dist/index.cjs +1265 -963
- 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 +1036 -734
- 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);
|
|
@@ -3654,7 +3831,8 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3654
3831
|
try {
|
|
3655
3832
|
for await (const event of handle) {
|
|
3656
3833
|
dispatch({ kind: "EVENT", event });
|
|
3657
|
-
|
|
3834
|
+
const cardType = event.type === "entity_card" ? "team_player" : event.type;
|
|
3835
|
+
if (CARD_EVENT_TYPES.has(event.type) && !cardTypes.includes(cardType)) cardTypes.push(cardType);
|
|
3658
3836
|
if (event.type === "turn_complete") {
|
|
3659
3837
|
turn?.settle({ name: "answer_received", turnId: turn.id, conversationId: event.data.conversationId, latencyMs: Date.now() - turn.startedAt, cardTypes });
|
|
3660
3838
|
} else if (event.type === "error" && !isLimitNotice(event.data)) {
|
|
@@ -3675,7 +3853,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3675
3853
|
const run = useCallback3((input, source, displayText2) => {
|
|
3676
3854
|
if (isPaused(stateRef.current.limit)) return;
|
|
3677
3855
|
const track = optionsRef.current?.track;
|
|
3678
|
-
const
|
|
3856
|
+
const shown2 = displayText2 ?? input.message;
|
|
3679
3857
|
const userId = nextId();
|
|
3680
3858
|
const assistantId = nextId();
|
|
3681
3859
|
activeTurnRef.current?.abandon();
|
|
@@ -3696,7 +3874,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3696
3874
|
};
|
|
3697
3875
|
activeTurnRef.current = turn;
|
|
3698
3876
|
dispatch({ kind: "USER_SENT", input, userId, assistantId, displayText: displayText2 });
|
|
3699
|
-
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 } : {} });
|
|
3700
3878
|
const handle = conversation.send(withLanguage(input));
|
|
3701
3879
|
handleRef.current = handle;
|
|
3702
3880
|
armFallbackTimer(() => {
|
|
@@ -3750,13 +3928,13 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3750
3928
|
dispatch({ kind: "STOP" });
|
|
3751
3929
|
}
|
|
3752
3930
|
}, [greetingMessage, conversation, consume, clearFallbackTimer, armFallbackTimer]);
|
|
3753
|
-
|
|
3931
|
+
useEffect5(() => {
|
|
3754
3932
|
if (greetedRef.current) return;
|
|
3755
3933
|
greetedRef.current = true;
|
|
3756
3934
|
fireGreeting();
|
|
3757
3935
|
}, [fireGreeting]);
|
|
3758
3936
|
const key = pageKey(page);
|
|
3759
|
-
|
|
3937
|
+
useEffect5(() => {
|
|
3760
3938
|
if (greetedKeyRef.current === null) return;
|
|
3761
3939
|
if (key === greetedKeyRef.current && !greetingCancelledRef.current) return;
|
|
3762
3940
|
if (stateRef.current.messages.some((m) => m.role === "user")) return;
|
|
@@ -3774,7 +3952,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3774
3952
|
return () => clearTimeout(timer);
|
|
3775
3953
|
}, [key, conversation, fireGreeting]);
|
|
3776
3954
|
const keyRef = useRef4(storageKey);
|
|
3777
|
-
|
|
3955
|
+
useEffect5(() => {
|
|
3778
3956
|
if (keyRef.current === storageKey) return;
|
|
3779
3957
|
keyRef.current = storageKey;
|
|
3780
3958
|
activeTurnRef.current?.abandon();
|
|
@@ -3795,17 +3973,17 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3795
3973
|
dispatch({ kind: "RESET" });
|
|
3796
3974
|
fireGreeting();
|
|
3797
3975
|
}, [storageKey, conversation, clearFallbackTimer, fireGreeting]);
|
|
3798
|
-
|
|
3976
|
+
useEffect5(() => {
|
|
3799
3977
|
if (!state.limit) return;
|
|
3800
3978
|
const delay = limitDelayMs(state.limit, Date.now());
|
|
3801
3979
|
if (delay === null) return;
|
|
3802
3980
|
const timer = setTimeout(() => dispatch({ kind: "LIMIT_EXPIRED" }), delay);
|
|
3803
3981
|
return () => clearTimeout(timer);
|
|
3804
3982
|
}, [state.limit]);
|
|
3805
|
-
|
|
3983
|
+
useEffect5(() => {
|
|
3806
3984
|
if (boot.stale && storageKey) clearConversation(storageKey);
|
|
3807
3985
|
}, []);
|
|
3808
|
-
|
|
3986
|
+
useEffect5(() => {
|
|
3809
3987
|
if (!storageKey || state.isStreaming) return;
|
|
3810
3988
|
if (hydratedRef.current) {
|
|
3811
3989
|
hydratedRef.current = false;
|
|
@@ -3822,7 +4000,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3822
4000
|
if (persistable.length === 0) return;
|
|
3823
4001
|
writeConversation(storageKey, state.conversationId, persistable, Date.now());
|
|
3824
4002
|
}, [storageKey, state.isStreaming, state.messages, state.conversationId]);
|
|
3825
|
-
|
|
4003
|
+
useEffect5(() => {
|
|
3826
4004
|
if (!storageKey) return;
|
|
3827
4005
|
const onStorage = (e) => {
|
|
3828
4006
|
if (e.key !== storageKey || e.storageArea !== window.localStorage) return;
|
|
@@ -3886,7 +4064,7 @@ function useChatStream(conversation, starterTexts, greetingMessage, storageKey,
|
|
|
3886
4064
|
}
|
|
3887
4065
|
|
|
3888
4066
|
// src/useLiveMonitor.ts
|
|
3889
|
-
import { useCallback as useCallback4, useEffect as
|
|
4067
|
+
import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef5, useState as useState5 } from "react";
|
|
3890
4068
|
|
|
3891
4069
|
// src/pinStore.ts
|
|
3892
4070
|
import { SPORTS as SPORTS4, sportOf as sportOf5 } from "@sensiblestats/widget-sdk";
|
|
@@ -4013,9 +4191,9 @@ function orderTiles(pins, snapshot, seedOf) {
|
|
|
4013
4191
|
}
|
|
4014
4192
|
|
|
4015
4193
|
// src/useTabs.ts
|
|
4016
|
-
import { useState as
|
|
4194
|
+
import { useState as useState4 } from "react";
|
|
4017
4195
|
function useTabs(initial = "chat") {
|
|
4018
|
-
const [activeTab, setActiveTab] =
|
|
4196
|
+
const [activeTab, setActiveTab] = useState4(initial);
|
|
4019
4197
|
return { activeTab, setActiveTab };
|
|
4020
4198
|
}
|
|
4021
4199
|
|
|
@@ -4038,7 +4216,7 @@ function priceForPin(snapshot, pin) {
|
|
|
4038
4216
|
const rows = market?.card?.rows;
|
|
4039
4217
|
if (!rows || rows.length === 0) return void 0;
|
|
4040
4218
|
const row = pin.matchOddsId != null ? rows.find((r) => r.matchOddsId === pin.matchOddsId) : rows[0];
|
|
4041
|
-
return row
|
|
4219
|
+
return row ? { value: row.price, forms: row.priceFormats } : void 0;
|
|
4042
4220
|
}
|
|
4043
4221
|
function phaseForPin(snapshot, pin) {
|
|
4044
4222
|
if (pin.kind === "match") return matchFor(snapshot, pin)?.phase;
|
|
@@ -4046,19 +4224,19 @@ function phaseForPin(snapshot, pin) {
|
|
|
4046
4224
|
}
|
|
4047
4225
|
function useLiveMonitor(opts) {
|
|
4048
4226
|
const sessionIdRef = useRef5(crypto.randomUUID());
|
|
4049
|
-
const [pins, setPins] =
|
|
4050
|
-
const [store] =
|
|
4051
|
-
const [enabled, setEnabled] =
|
|
4052
|
-
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);
|
|
4053
4231
|
const { activeTab, setActiveTab: setActiveTabState } = useTabs("chat");
|
|
4054
|
-
const [chatDot, setChatDot] =
|
|
4055
|
-
const [matchesDot, setMatchesDot] =
|
|
4056
|
-
const [trendsDot, setTrendsDot] =
|
|
4057
|
-
const [todayDot, setTodayDot] =
|
|
4058
|
-
const [lastViewedPrices, setLastViewedPrices] =
|
|
4059
|
-
const [openMarket, setOpenMarket] =
|
|
4060
|
-
const [selectedMatchKey, setSelectedMatchKey] =
|
|
4061
|
-
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({});
|
|
4062
4240
|
const pinsRef = useRef5(pins);
|
|
4063
4241
|
pinsRef.current = pins;
|
|
4064
4242
|
const watchesRef = useRef5(opts.watches ?? []);
|
|
@@ -4124,7 +4302,7 @@ function useLiveMonitor(opts) {
|
|
|
4124
4302
|
const getPlayerPropsRef = useRef5(opts.getPlayerProps);
|
|
4125
4303
|
getPlayerPropsRef.current = opts.getPlayerProps;
|
|
4126
4304
|
const playerPropsRef = useRef5({});
|
|
4127
|
-
const [playerProps, setPlayerProps] =
|
|
4305
|
+
const [playerProps, setPlayerProps] = useState5({});
|
|
4128
4306
|
const loadPlayerProps = useCallback4((matchId, sport) => {
|
|
4129
4307
|
const fn = getPlayerPropsRef.current;
|
|
4130
4308
|
if (!fn) return;
|
|
@@ -4200,7 +4378,7 @@ function useLiveMonitor(opts) {
|
|
|
4200
4378
|
const out = { ...prevMap };
|
|
4201
4379
|
for (const pin of marketPins) {
|
|
4202
4380
|
const price = priceForPin(next, pin);
|
|
4203
|
-
if (price !== void 0 && out[pin.key] !== price) {
|
|
4381
|
+
if (price !== void 0 && out[pin.key]?.value !== price.value) {
|
|
4204
4382
|
out[pin.key] = price;
|
|
4205
4383
|
changed = true;
|
|
4206
4384
|
}
|
|
@@ -4212,7 +4390,7 @@ function useLiveMonitor(opts) {
|
|
|
4212
4390
|
for (const pin of marketPins) {
|
|
4213
4391
|
const price = priceForPin(next, pin);
|
|
4214
4392
|
const last = lastViewedPricesRef.current[pin.key];
|
|
4215
|
-
if (price !== void 0 && last !== void 0 && price !== last) {
|
|
4393
|
+
if (price !== void 0 && last !== void 0 && price.value !== last.value) {
|
|
4216
4394
|
sawPriceMove = true;
|
|
4217
4395
|
break;
|
|
4218
4396
|
}
|
|
@@ -4285,14 +4463,14 @@ function useLiveMonitor(opts) {
|
|
|
4285
4463
|
const hinted = snapshotRef.current ? snapshotRef.current.nextPollSeconds * 1e3 : fallbackMs;
|
|
4286
4464
|
timerRef.current = window.setTimeout(() => void tick(), Math.max(MIN_POLL_MS, hinted));
|
|
4287
4465
|
};
|
|
4288
|
-
|
|
4466
|
+
useEffect6(() => {
|
|
4289
4467
|
mountedRef.current = true;
|
|
4290
4468
|
return () => {
|
|
4291
4469
|
mountedRef.current = false;
|
|
4292
4470
|
};
|
|
4293
4471
|
}, []);
|
|
4294
4472
|
const prevPinsLengthRef = useRef5(0);
|
|
4295
|
-
|
|
4473
|
+
useEffect6(() => {
|
|
4296
4474
|
const wasEmpty = prevPinsLengthRef.current === 0 && watchesRef.current.length === 0;
|
|
4297
4475
|
prevPinsLengthRef.current = pins.length;
|
|
4298
4476
|
if (pins.length === 0 && watchesRef.current.length === 0) {
|
|
@@ -4303,17 +4481,17 @@ function useLiveMonitor(opts) {
|
|
|
4303
4481
|
}, [pins.length, tick]);
|
|
4304
4482
|
const prevWatchesLengthRef = useRef5(0);
|
|
4305
4483
|
const watchesLength = opts.watches?.length ?? 0;
|
|
4306
|
-
|
|
4484
|
+
useEffect6(() => {
|
|
4307
4485
|
const wasEmpty = prevWatchesLengthRef.current === 0 && pinsRef.current.length === 0;
|
|
4308
4486
|
prevWatchesLengthRef.current = watchesLength;
|
|
4309
4487
|
if (wasEmpty && watchesLength > 0) void tick();
|
|
4310
4488
|
}, [watchesLength, tick]);
|
|
4311
|
-
|
|
4489
|
+
useEffect6(() => {
|
|
4312
4490
|
const matchPins = pins.filter((p) => p.kind === "match");
|
|
4313
4491
|
if (selectedRef.current !== null && matchPins.some((p) => p.key === selectedRef.current)) return;
|
|
4314
4492
|
chooseSelection(orderTiles(matchPins, snapshotRef.current)[0]?.pin.key ?? null);
|
|
4315
4493
|
}, [pins, chooseSelection]);
|
|
4316
|
-
|
|
4494
|
+
useEffect6(() => {
|
|
4317
4495
|
if (clubEnabled && (activeTab === "today" || activeTab === "following" || activeTab === "trends")) {
|
|
4318
4496
|
setActiveTabState("chat");
|
|
4319
4497
|
return;
|
|
@@ -4325,12 +4503,12 @@ function useLiveMonitor(opts) {
|
|
|
4325
4503
|
if (activeTab === "today" && !hasToday) setActiveTabState("chat");
|
|
4326
4504
|
}, [pins, activeTab, hasToday, clubEnabled]);
|
|
4327
4505
|
const prevIsOpenRef = useRef5(false);
|
|
4328
|
-
|
|
4506
|
+
useEffect6(() => {
|
|
4329
4507
|
const wasClosed = !prevIsOpenRef.current;
|
|
4330
4508
|
prevIsOpenRef.current = opts.isOpen;
|
|
4331
4509
|
if (wasClosed && opts.isOpen) void tick();
|
|
4332
4510
|
}, [opts.isOpen, tick]);
|
|
4333
|
-
|
|
4511
|
+
useEffect6(() => {
|
|
4334
4512
|
const onVisibility = () => {
|
|
4335
4513
|
if (document.visibilityState === "hidden") window.clearTimeout(timerRef.current);
|
|
4336
4514
|
else void tick();
|
|
@@ -4439,17 +4617,17 @@ function useLiveMonitor(opts) {
|
|
|
4439
4617
|
}
|
|
4440
4618
|
|
|
4441
4619
|
// src/useGames.ts
|
|
4442
|
-
import { useCallback as useCallback5, useEffect as
|
|
4620
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef6, useState as useState6 } from "react";
|
|
4443
4621
|
var GAMES_POLL_MS = 6e4;
|
|
4444
4622
|
var DEFAULT_TZ = "Europe/London";
|
|
4445
4623
|
function computeGameDay(timezone) {
|
|
4446
4624
|
return new Intl.DateTimeFormat("en-CA", { timeZone: timezone }).format(/* @__PURE__ */ new Date());
|
|
4447
4625
|
}
|
|
4448
4626
|
function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
4449
|
-
const [enabled, setEnabled] =
|
|
4450
|
-
const [games, setGames] =
|
|
4451
|
-
const [loading, setLoading] =
|
|
4452
|
-
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);
|
|
4453
4631
|
const inFlightRef = useRef6(false);
|
|
4454
4632
|
const hardOffRef = useRef6(false);
|
|
4455
4633
|
const conversationRef = useRef6(conversation);
|
|
@@ -4457,7 +4635,7 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4457
4635
|
const tzRef = useRef6(operatorTimezone ?? DEFAULT_TZ);
|
|
4458
4636
|
tzRef.current = operatorTimezone ?? DEFAULT_TZ;
|
|
4459
4637
|
const ready = conversation != null;
|
|
4460
|
-
|
|
4638
|
+
useEffect7(() => {
|
|
4461
4639
|
if (hardOffRef.current) return;
|
|
4462
4640
|
let active = true;
|
|
4463
4641
|
const doFetch = async () => {
|
|
@@ -4507,15 +4685,15 @@ function useGames(conversation, { activeTab, operatorTimezone }) {
|
|
|
4507
4685
|
}
|
|
4508
4686
|
|
|
4509
4687
|
// src/useLeaderboard.ts
|
|
4510
|
-
import { useCallback as useCallback6, useEffect as
|
|
4688
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef7, useState as useState7 } from "react";
|
|
4511
4689
|
function useLeaderboard(conversation, { activeTab }) {
|
|
4512
|
-
const [data, setData] =
|
|
4513
|
-
const [loading, setLoading] =
|
|
4514
|
-
const [refreshCount, setRefreshCount] =
|
|
4690
|
+
const [data, setData] = useState7(null);
|
|
4691
|
+
const [loading, setLoading] = useState7(false);
|
|
4692
|
+
const [refreshCount, setRefreshCount] = useState7(0);
|
|
4515
4693
|
const inFlightRef = useRef7(false);
|
|
4516
4694
|
const conversationRef = useRef7(conversation);
|
|
4517
4695
|
conversationRef.current = conversation;
|
|
4518
|
-
|
|
4696
|
+
useEffect8(() => {
|
|
4519
4697
|
if (activeTab !== "games") return;
|
|
4520
4698
|
let active = true;
|
|
4521
4699
|
const doFetch = async () => {
|
|
@@ -4545,29 +4723,29 @@ function useLeaderboard(conversation, { activeTab }) {
|
|
|
4545
4723
|
}
|
|
4546
4724
|
|
|
4547
4725
|
// src/useClubFixtures.ts
|
|
4548
|
-
import { useCallback as useCallback7, useEffect as
|
|
4726
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useRef as useRef8, useState as useState8 } from "react";
|
|
4549
4727
|
var CLUB_PROBE_RETRY_MS = 15e3;
|
|
4550
4728
|
var CLUB_PROBE_MAX_ATTEMPTS = 3;
|
|
4551
4729
|
var CLUB_TAB_WAIT_MS = 2e3;
|
|
4552
4730
|
function useClubFixtures(conversation) {
|
|
4553
|
-
const [enabled, setEnabled] =
|
|
4554
|
-
const [settled, setSettled] =
|
|
4555
|
-
const [failed, setFailed] =
|
|
4556
|
-
const [waited, setWaited] =
|
|
4557
|
-
const [fixtures, setFixtures] =
|
|
4558
|
-
const [loading, setLoading] =
|
|
4559
|
-
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);
|
|
4560
4738
|
const inFlightRef = useRef8(false);
|
|
4561
4739
|
const hardOffRef = useRef8(false);
|
|
4562
4740
|
const conversationRef = useRef8(conversation);
|
|
4563
4741
|
conversationRef.current = conversation;
|
|
4564
4742
|
const ready = conversation != null;
|
|
4565
|
-
|
|
4743
|
+
useEffect9(() => {
|
|
4566
4744
|
if (!ready) return;
|
|
4567
4745
|
const id = window.setTimeout(() => setWaited(true), CLUB_TAB_WAIT_MS);
|
|
4568
4746
|
return () => window.clearTimeout(id);
|
|
4569
4747
|
}, [ready]);
|
|
4570
|
-
|
|
4748
|
+
useEffect9(() => {
|
|
4571
4749
|
if (hardOffRef.current) return;
|
|
4572
4750
|
let active = true;
|
|
4573
4751
|
let retryTimeoutId;
|
|
@@ -4619,15 +4797,15 @@ function useClubFixtures(conversation) {
|
|
|
4619
4797
|
}
|
|
4620
4798
|
|
|
4621
4799
|
// src/useClubStandings.ts
|
|
4622
|
-
import { useCallback as useCallback8, useEffect as
|
|
4800
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useRef as useRef9, useState as useState9 } from "react";
|
|
4623
4801
|
function useClubStandings(conversation, { activeTab, enabled }) {
|
|
4624
|
-
const [data, setData] =
|
|
4625
|
-
const [loading, setLoading] =
|
|
4626
|
-
const [refreshCount, setRefreshCount] =
|
|
4802
|
+
const [data, setData] = useState9(null);
|
|
4803
|
+
const [loading, setLoading] = useState9(false);
|
|
4804
|
+
const [refreshCount, setRefreshCount] = useState9(0);
|
|
4627
4805
|
const inFlightRef = useRef9(false);
|
|
4628
4806
|
const conversationRef = useRef9(conversation);
|
|
4629
4807
|
conversationRef.current = conversation;
|
|
4630
|
-
|
|
4808
|
+
useEffect10(() => {
|
|
4631
4809
|
if (activeTab !== "standings" || !enabled) return;
|
|
4632
4810
|
let active = true;
|
|
4633
4811
|
const doFetch = async () => {
|
|
@@ -4658,15 +4836,15 @@ function useClubStandings(conversation, { activeTab, enabled }) {
|
|
|
4658
4836
|
}
|
|
4659
4837
|
|
|
4660
4838
|
// src/useClubSquad.ts
|
|
4661
|
-
import { useCallback as useCallback9, useEffect as
|
|
4839
|
+
import { useCallback as useCallback9, useEffect as useEffect11, useRef as useRef10, useState as useState10 } from "react";
|
|
4662
4840
|
function useClubSquad(conversation, { activeTab, enabled }) {
|
|
4663
|
-
const [data, setData] =
|
|
4664
|
-
const [loading, setLoading] =
|
|
4665
|
-
const [refreshCount, setRefreshCount] =
|
|
4841
|
+
const [data, setData] = useState10(null);
|
|
4842
|
+
const [loading, setLoading] = useState10(false);
|
|
4843
|
+
const [refreshCount, setRefreshCount] = useState10(0);
|
|
4666
4844
|
const inFlightRef = useRef10(false);
|
|
4667
4845
|
const conversationRef = useRef10(conversation);
|
|
4668
4846
|
conversationRef.current = conversation;
|
|
4669
|
-
|
|
4847
|
+
useEffect11(() => {
|
|
4670
4848
|
if (activeTab !== "squad" || !enabled) return;
|
|
4671
4849
|
let active = true;
|
|
4672
4850
|
const doFetch = async () => {
|
|
@@ -4697,18 +4875,18 @@ function useClubSquad(conversation, { activeTab, enabled }) {
|
|
|
4697
4875
|
}
|
|
4698
4876
|
|
|
4699
4877
|
// src/useClubSquadStats.ts
|
|
4700
|
-
import { useCallback as useCallback10, useEffect as
|
|
4878
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef11, useState as useState11 } from "react";
|
|
4701
4879
|
function useClubSquadStats(conversation, { activeTab, enabled }) {
|
|
4702
|
-
const [data, setData] =
|
|
4703
|
-
const [seasonName, setSeasonName] =
|
|
4704
|
-
const [competitionName, setCompetitionName] =
|
|
4705
|
-
const [matchesPlayed, setMatchesPlayed] =
|
|
4706
|
-
const [loading, setLoading] =
|
|
4707
|
-
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);
|
|
4708
4886
|
const inFlightRef = useRef11(false);
|
|
4709
4887
|
const conversationRef = useRef11(conversation);
|
|
4710
4888
|
conversationRef.current = conversation;
|
|
4711
|
-
|
|
4889
|
+
useEffect12(() => {
|
|
4712
4890
|
if (activeTab !== "squad" || !enabled) return;
|
|
4713
4891
|
let active = true;
|
|
4714
4892
|
const doFetch = async () => {
|
|
@@ -4744,10 +4922,10 @@ function useClubSquadStats(conversation, { activeTab, enabled }) {
|
|
|
4744
4922
|
}
|
|
4745
4923
|
|
|
4746
4924
|
// src/useClubPlayerDetail.ts
|
|
4747
|
-
import { useCallback as useCallback11, useRef as useRef12, useState as
|
|
4925
|
+
import { useCallback as useCallback11, useRef as useRef12, useState as useState12 } from "react";
|
|
4748
4926
|
function useClubPlayerDetail(conversation) {
|
|
4749
|
-
const [data, setData] =
|
|
4750
|
-
const [loading, setLoading] =
|
|
4927
|
+
const [data, setData] = useState12(null);
|
|
4928
|
+
const [loading, setLoading] = useState12(false);
|
|
4751
4929
|
const requestSeqRef = useRef12(0);
|
|
4752
4930
|
const conversationRef = useRef12(conversation);
|
|
4753
4931
|
conversationRef.current = conversation;
|
|
@@ -4776,12 +4954,9 @@ function useClubPlayerDetail(conversation) {
|
|
|
4776
4954
|
}
|
|
4777
4955
|
|
|
4778
4956
|
// src/usePresetGrid.ts
|
|
4779
|
-
import { useEffect as
|
|
4957
|
+
import { useEffect as useEffect13, useRef as useRef13, useState as useState13 } from "react";
|
|
4780
4958
|
|
|
4781
4959
|
// src/presetGrid.ts
|
|
4782
|
-
var DEFAULT_SINGLES_LIMITS = [1.3, 1.5, 1.7, 2];
|
|
4783
|
-
var DEFAULT_SINGLES_FLOORS = [1.5, 2, 2.5, 3];
|
|
4784
|
-
var DEFAULT_COMBO_TOTALS = [3, 5, 10, 20, 50];
|
|
4785
4960
|
var FIXED_SINGLES_COUNT = 3;
|
|
4786
4961
|
var MIN_COMBO_LEGS = 2;
|
|
4787
4962
|
var MAX_COMBO_LEGS = 6;
|
|
@@ -4794,27 +4969,15 @@ function samePrice(a, b) {
|
|
|
4794
4969
|
function isPresetGrid(v) {
|
|
4795
4970
|
if (!v || typeof v !== "object") return false;
|
|
4796
4971
|
const g = v;
|
|
4797
|
-
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);
|
|
4798
4973
|
}
|
|
4799
4974
|
function drawable(p) {
|
|
4800
4975
|
return !!p && finite2(p.price) && finite2(p.matchOddsId) && finite2(p.matchId) && typeof p.homeTeamName === "string" && typeof p.awayTeamName === "string";
|
|
4801
4976
|
}
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
}
|
|
4807
|
-
return out.sort((a, b) => a - b);
|
|
4808
|
-
}
|
|
4809
|
-
function singlesLimits(grid) {
|
|
4810
|
-
return choices(DEFAULT_SINGLES_LIMITS, grid.singles.map((c) => c?.price));
|
|
4811
|
-
}
|
|
4812
|
-
function singlesFloors(grid) {
|
|
4813
|
-
return choices(DEFAULT_SINGLES_FLOORS, grid.singlesFrom.map((c) => c?.price));
|
|
4814
|
-
}
|
|
4815
|
-
function comboTotals(grid) {
|
|
4816
|
-
return choices(DEFAULT_COMBO_TOTALS, grid.combos.map((c) => c?.total));
|
|
4817
|
-
}
|
|
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);
|
|
4818
4981
|
function comboLegChoices(grid) {
|
|
4819
4982
|
const max = Math.min(MAX_COMBO_LEGS, Math.floor(grid.maxLegs));
|
|
4820
4983
|
const out = [];
|
|
@@ -4884,24 +5047,27 @@ function startCombo(grid, totals, legChoices, startTotal, startLegs) {
|
|
|
4884
5047
|
function idsOf(picks) {
|
|
4885
5048
|
return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
|
|
4886
5049
|
}
|
|
4887
|
-
function maxPriceAsk(cell2, s) {
|
|
5050
|
+
function maxPriceAsk(cell2, s, format2) {
|
|
5051
|
+
const price = formatOdds(cell2.priceFormats, format2);
|
|
4888
5052
|
return {
|
|
4889
|
-
message: s.maxPriceMessage(cell2.count,
|
|
4890
|
-
displayText: s.maxPriceDisplay(cell2.count,
|
|
5053
|
+
message: s.maxPriceMessage(cell2.count, price),
|
|
5054
|
+
displayText: s.maxPriceDisplay(cell2.count, price),
|
|
4891
5055
|
preset: { kind: "max_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4892
5056
|
};
|
|
4893
5057
|
}
|
|
4894
|
-
function minPriceAsk(cell2, s) {
|
|
5058
|
+
function minPriceAsk(cell2, s, format2) {
|
|
5059
|
+
const price = formatOdds(cell2.priceFormats, format2);
|
|
4895
5060
|
return {
|
|
4896
|
-
message: s.minPriceMessage(cell2.count,
|
|
4897
|
-
displayText: s.minPriceDisplay(cell2.count,
|
|
5061
|
+
message: s.minPriceMessage(cell2.count, price),
|
|
5062
|
+
displayText: s.minPriceDisplay(cell2.count, price),
|
|
4898
5063
|
preset: { kind: "min_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
4899
5064
|
};
|
|
4900
5065
|
}
|
|
4901
|
-
function comboAsk(cell2, s) {
|
|
5066
|
+
function comboAsk(cell2, s, format2) {
|
|
5067
|
+
const total = formatOdds(cell2.totalFormats, format2);
|
|
4902
5068
|
return {
|
|
4903
|
-
message: s.comboMessage(cell2.legs,
|
|
4904
|
-
displayText: s.comboDisplay(cell2.legs,
|
|
5069
|
+
message: s.comboMessage(cell2.legs, total),
|
|
5070
|
+
displayText: s.comboDisplay(cell2.legs, total),
|
|
4905
5071
|
preset: { kind: "combo", total: cell2.total, legs: cell2.legs, ...idsOf(cell2.combo.legs) }
|
|
4906
5072
|
};
|
|
4907
5073
|
}
|
|
@@ -4919,7 +5085,7 @@ function marketDisplay(cell2, s) {
|
|
|
4919
5085
|
// src/usePresetGrid.ts
|
|
4920
5086
|
var GRID_MAX_AGE_MS = 6e5;
|
|
4921
5087
|
function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
4922
|
-
const [grid, setGrid] =
|
|
5088
|
+
const [grid, setGrid] = useState13(null);
|
|
4923
5089
|
const keptRef = useRef13(null);
|
|
4924
5090
|
const localeRef = useRef13(locale);
|
|
4925
5091
|
const inFlightRef = useRef13(false);
|
|
@@ -4928,13 +5094,13 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
4928
5094
|
getRef.current = getPricePresets;
|
|
4929
5095
|
const nowRef = useRef13(now);
|
|
4930
5096
|
nowRef.current = now;
|
|
4931
|
-
|
|
5097
|
+
useEffect13(() => {
|
|
4932
5098
|
mountedRef.current = true;
|
|
4933
5099
|
return () => {
|
|
4934
5100
|
mountedRef.current = false;
|
|
4935
5101
|
};
|
|
4936
5102
|
}, []);
|
|
4937
|
-
|
|
5103
|
+
useEffect13(() => {
|
|
4938
5104
|
if (localeRef.current !== locale) {
|
|
4939
5105
|
localeRef.current = locale;
|
|
4940
5106
|
keptRef.current = null;
|
|
@@ -4966,7 +5132,7 @@ function hasAnyCell(grid) {
|
|
|
4966
5132
|
}
|
|
4967
5133
|
|
|
4968
5134
|
// src/useFavourites.ts
|
|
4969
|
-
import { useCallback as useCallback12, useEffect as
|
|
5135
|
+
import { useCallback as useCallback12, useEffect as useEffect14, useRef as useRef14, useState as useState14 } from "react";
|
|
4970
5136
|
var LIST_OF = { competition: "competitions", team: "teams", player: "players" };
|
|
4971
5137
|
var keyOf = (kind, id) => `${kind}:${id}`;
|
|
4972
5138
|
function idle(enabled) {
|
|
@@ -5021,8 +5187,8 @@ function revertStar(prev, before, kind, id, next) {
|
|
|
5021
5187
|
}
|
|
5022
5188
|
function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, enabled, track }) {
|
|
5023
5189
|
const live = enabled && conversation !== null;
|
|
5024
|
-
const [state, setState] =
|
|
5025
|
-
const [pendingKey, setPendingKey] =
|
|
5190
|
+
const [state, setState] = useState14(() => idle(live));
|
|
5191
|
+
const [pendingKey, setPendingKey] = useState14(null);
|
|
5026
5192
|
const stateRef = useRef14(state);
|
|
5027
5193
|
stateRef.current = state;
|
|
5028
5194
|
const scopeRef = useRef14(0);
|
|
@@ -5068,7 +5234,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5068
5234
|
inFlightRef.current = run;
|
|
5069
5235
|
return run;
|
|
5070
5236
|
}, [live, conversation, sport, operatorUserId, anonymousUserId, identityKey]);
|
|
5071
|
-
|
|
5237
|
+
useEffect14(() => {
|
|
5072
5238
|
scopeRef.current += 1;
|
|
5073
5239
|
inFlightRef.current = null;
|
|
5074
5240
|
pendingRef.current = null;
|
|
@@ -5078,7 +5244,7 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5078
5244
|
setState(refusedRef.current === identityKey ? { status: "refused", data: null, starred: /* @__PURE__ */ new Set() } : idle(live));
|
|
5079
5245
|
void load2();
|
|
5080
5246
|
}, [load2, live, identityKey]);
|
|
5081
|
-
|
|
5247
|
+
useEffect14(() => {
|
|
5082
5248
|
if (!live) return;
|
|
5083
5249
|
const onFocus = () => {
|
|
5084
5250
|
void load2();
|
|
@@ -5179,20 +5345,20 @@ function useFavourites({ conversation, sport, operatorUserId, anonymousUserId, e
|
|
|
5179
5345
|
}
|
|
5180
5346
|
|
|
5181
5347
|
// src/components/dashboard/GreetingDashboard.tsx
|
|
5182
|
-
import { useState as
|
|
5348
|
+
import { useState as useState28 } from "react";
|
|
5183
5349
|
|
|
5184
5350
|
// src/eventLogContext.ts
|
|
5185
|
-
import { createContext, useContext } from "react";
|
|
5186
|
-
var EventLogContext =
|
|
5351
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
5352
|
+
var EventLogContext = createContext2(null);
|
|
5187
5353
|
function useEventLog() {
|
|
5188
|
-
return
|
|
5354
|
+
return useContext2(EventLogContext);
|
|
5189
5355
|
}
|
|
5190
5356
|
|
|
5191
5357
|
// src/sportScopeContext.ts
|
|
5192
|
-
import { createContext as
|
|
5193
|
-
var SportScopeContext =
|
|
5358
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
5359
|
+
var SportScopeContext = createContext3(null);
|
|
5194
5360
|
function useSportScope() {
|
|
5195
|
-
return
|
|
5361
|
+
return useContext3(SportScopeContext);
|
|
5196
5362
|
}
|
|
5197
5363
|
|
|
5198
5364
|
// src/assets/logo.ts
|
|
@@ -5268,11 +5434,6 @@ function DashboardIcon({ name }) {
|
|
|
5268
5434
|
// src/components/dashboard/DashboardTile.tsx
|
|
5269
5435
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
5270
5436
|
var MAX_CRESTS = 3;
|
|
5271
|
-
var ODDS_TAIL = /\s*·\s*@(\d+(?:\.\d+)?)\s*$/;
|
|
5272
|
-
function splitOdds(subtitle) {
|
|
5273
|
-
const m = ODDS_TAIL.exec(subtitle);
|
|
5274
|
-
return m ? { text: subtitle.slice(0, m.index), odds: m[1] } : { text: subtitle };
|
|
5275
|
-
}
|
|
5276
5437
|
function codesOf(tile) {
|
|
5277
5438
|
return (tile.imageCodes ?? []).filter(Boolean);
|
|
5278
5439
|
}
|
|
@@ -5294,35 +5455,35 @@ var keepDashWithHome = (title) => title.replace(/ - /g, "\xA0- ");
|
|
|
5294
5455
|
function HeroTile({ tile, onTap, oddsLabel }) {
|
|
5295
5456
|
const crests = (tile.imageUrls ?? []).filter(Boolean).slice(0, 2);
|
|
5296
5457
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, 2) : [];
|
|
5297
|
-
const
|
|
5458
|
+
const { oddsFormat } = useOddsSettings();
|
|
5459
|
+
const price = tile.priceFormats ? formatOdds(tile.priceFormats, oddsFormat) : null;
|
|
5298
5460
|
return /* @__PURE__ */ jsxs2("button", { type: "button", className: "ss-w-dash-tile ss-w-dash-tile--full ss-w-dash-hero", onClick: onTap, children: [
|
|
5299
5461
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-top", children: [
|
|
5300
5462
|
tile.badgeText ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-badge", children: tile.badgeText }) : null,
|
|
5301
|
-
|
|
5463
|
+
price ? /* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-price", children: [
|
|
5302
5464
|
/* @__PURE__ */ jsxs2("span", { className: "ss-g-sr", children: [
|
|
5303
5465
|
oddsLabel,
|
|
5304
5466
|
" "
|
|
5305
5467
|
] }),
|
|
5306
|
-
|
|
5468
|
+
price
|
|
5307
5469
|
] }) : null,
|
|
5308
|
-
!
|
|
5470
|
+
!price && tile.meta ? /* @__PURE__ */ jsx2("span", { className: "ss-w-dash__meta", children: /* @__PURE__ */ jsx2(DotSeparated, { text: tile.meta }) }) : null,
|
|
5309
5471
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-chevron", children: /* @__PURE__ */ jsx2(ChevronIcon, {}) })
|
|
5310
5472
|
] }),
|
|
5311
5473
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-main", children: [
|
|
5312
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 }) }) }),
|
|
5313
5475
|
/* @__PURE__ */ jsxs2("span", { className: "ss-w-dash-hero-body", children: [
|
|
5314
5476
|
/* @__PURE__ */ jsx2("span", { className: "ss-w-dash-hero-title", children: keepDashWithHome(tile.title) }),
|
|
5315
|
-
|
|
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
|
|
5316
5478
|
] })
|
|
5317
5479
|
] })
|
|
5318
5480
|
] });
|
|
5319
5481
|
}
|
|
5320
|
-
var PRICE_BADGE = /^\d+(?:[.,]\d+)?$/;
|
|
5321
5482
|
function DashboardTile({ tile, onTap, oddsLabel = "Odds", badgePlacement = "meta" }) {
|
|
5322
5483
|
if (tile.emphasis === "hero") return /* @__PURE__ */ jsx2(HeroTile, { tile, onTap, oddsLabel });
|
|
5323
5484
|
const spanClass = tile.span === "full" ? "ss-w-dash-tile--full" : "ss-w-dash-tile--half";
|
|
5324
5485
|
const crests = (tile.imageUrls ?? []).slice(0, MAX_CRESTS);
|
|
5325
|
-
const endBadge = badgePlacement === "end" && tile.badgeText &&
|
|
5486
|
+
const endBadge = badgePlacement === "end" && tile.badgeText && tile.badgeFormats ? tile.badgeText : null;
|
|
5326
5487
|
const metaBadge = endBadge ? null : tile.badgeText;
|
|
5327
5488
|
const codes = crests.length === 0 ? codesOf(tile).slice(0, MAX_CRESTS) : [];
|
|
5328
5489
|
const hasMeta = Boolean(metaBadge) || crests.length > 0 || codes.length > 0;
|
|
@@ -5399,23 +5560,23 @@ function SportSwitch({ sports, selected, onSelect, liveLabel: liveLabel3 = "Live
|
|
|
5399
5560
|
}
|
|
5400
5561
|
|
|
5401
5562
|
// src/components/dashboard/v8/PersonalGreeting.tsx
|
|
5402
|
-
import { useState as
|
|
5563
|
+
import { useState as useState27 } from "react";
|
|
5403
5564
|
|
|
5404
5565
|
// src/personalGreetingContext.ts
|
|
5405
|
-
import { createContext as
|
|
5566
|
+
import { createContext as createContext4, useContext as useContext4, useMemo as useMemo5, useState as useState15 } from "react";
|
|
5406
5567
|
function useSessionHolds() {
|
|
5407
|
-
const [dismissed, setDismissed] =
|
|
5408
|
-
const [followed, setFollowed] =
|
|
5409
|
-
return
|
|
5568
|
+
const [dismissed, setDismissed] = useState15(/* @__PURE__ */ new Set());
|
|
5569
|
+
const [followed, setFollowed] = useState15(/* @__PURE__ */ new Set());
|
|
5570
|
+
return useMemo5(() => ({
|
|
5410
5571
|
dismissed,
|
|
5411
5572
|
followed,
|
|
5412
5573
|
dismiss: (key) => setDismissed((prev) => prev.has(key) ? prev : new Set(prev).add(key)),
|
|
5413
5574
|
follow: (key) => setFollowed((prev) => prev.has(key) ? prev : new Set(prev).add(key))
|
|
5414
5575
|
}), [dismissed, followed]);
|
|
5415
5576
|
}
|
|
5416
|
-
var PersonalGreetingContext =
|
|
5577
|
+
var PersonalGreetingContext = createContext4(null);
|
|
5417
5578
|
function usePersonalGreeting() {
|
|
5418
|
-
return
|
|
5579
|
+
return useContext4(PersonalGreetingContext);
|
|
5419
5580
|
}
|
|
5420
5581
|
|
|
5421
5582
|
// src/components/dashboard/v8/AskCards.tsx
|
|
@@ -5428,10 +5589,10 @@ function AskCards({ asks, ui, ofYours, onAct }) {
|
|
|
5428
5589
|
}
|
|
5429
5590
|
|
|
5430
5591
|
// src/components/dashboard/v8/CardLine.tsx
|
|
5431
|
-
import { useEffect as
|
|
5592
|
+
import { useEffect as useEffect19, useMemo as useMemo6 } from "react";
|
|
5432
5593
|
|
|
5433
5594
|
// src/useBuilderGrid.ts
|
|
5434
|
-
import { useCallback as useCallback13, useEffect as
|
|
5595
|
+
import { useCallback as useCallback13, useEffect as useEffect15, useRef as useRef16, useState as useState16 } from "react";
|
|
5435
5596
|
|
|
5436
5597
|
// src/builderMemory.ts
|
|
5437
5598
|
var GRID_TTL_MS = 5 * 6e4;
|
|
@@ -5474,23 +5635,23 @@ function createBuilderMemory(now = Date.now) {
|
|
|
5474
5635
|
var PENDING_MAX_MS = 3e3;
|
|
5475
5636
|
var inFlight = /* @__PURE__ */ new WeakMap();
|
|
5476
5637
|
var newest = /* @__PURE__ */ new WeakMap();
|
|
5477
|
-
function shared(
|
|
5478
|
-
let flights = inFlight.get(
|
|
5479
|
-
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());
|
|
5480
5641
|
let flight = flights.get(key);
|
|
5481
5642
|
if (!flight) {
|
|
5482
5643
|
const own = flights;
|
|
5483
|
-
let order = newest.get(
|
|
5484
|
-
if (!order) newest.set(
|
|
5644
|
+
let order = newest.get(memory3);
|
|
5645
|
+
if (!order) newest.set(memory3, order = /* @__PURE__ */ new Map());
|
|
5485
5646
|
const previous = order.get(key);
|
|
5486
5647
|
const latest = () => order.get(key) === made;
|
|
5487
5648
|
const promise = start().then(
|
|
5488
5649
|
(g) => {
|
|
5489
|
-
if (latest())
|
|
5650
|
+
if (latest()) memory3.cacheGrid(key, g);
|
|
5490
5651
|
return g;
|
|
5491
5652
|
},
|
|
5492
5653
|
(e) => {
|
|
5493
|
-
if (latest())
|
|
5654
|
+
if (latest()) memory3.cacheGrid(key, null);
|
|
5494
5655
|
throw e;
|
|
5495
5656
|
}
|
|
5496
5657
|
).finally(() => {
|
|
@@ -5516,22 +5677,22 @@ async function settle(flight) {
|
|
|
5516
5677
|
if (heir) return { heir };
|
|
5517
5678
|
return { grid: await flight.promise };
|
|
5518
5679
|
}
|
|
5519
|
-
function forget(
|
|
5520
|
-
const flights = inFlight.get(
|
|
5680
|
+
function forget(memory3, key, flight) {
|
|
5681
|
+
const flights = inFlight.get(memory3);
|
|
5521
5682
|
if (flights?.get(key) === flight) flights.delete(key);
|
|
5522
5683
|
}
|
|
5523
|
-
function useBuilderGrid({ conversation, locale, memory:
|
|
5524
|
-
const [seed] =
|
|
5525
|
-
const [grid, setGrid] =
|
|
5526
|
-
const [status, setStatus] =
|
|
5527
|
-
const [confirmed, setConfirmed] =
|
|
5528
|
-
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);
|
|
5529
5690
|
const seq = useRef16(0);
|
|
5530
5691
|
const mounted = useRef16(true);
|
|
5531
5692
|
const hung = useRef16(void 0);
|
|
5532
5693
|
const waiting = useRef16(null);
|
|
5533
|
-
const memoryRef = useRef16(
|
|
5534
|
-
memoryRef.current =
|
|
5694
|
+
const memoryRef = useRef16(memory3);
|
|
5695
|
+
memoryRef.current = memory3;
|
|
5535
5696
|
const stopWaiting = useCallback13((release, keep) => {
|
|
5536
5697
|
window.clearTimeout(hung.current);
|
|
5537
5698
|
const w = waiting.current;
|
|
@@ -5540,7 +5701,7 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5540
5701
|
w.flight.waiters -= 1;
|
|
5541
5702
|
if (release && w.key !== keep && w.flight.waiters <= 0 && memoryRef.current) forget(memoryRef.current, w.key, w.flight);
|
|
5542
5703
|
}, []);
|
|
5543
|
-
|
|
5704
|
+
useEffect15(() => {
|
|
5544
5705
|
mounted.current = true;
|
|
5545
5706
|
return () => {
|
|
5546
5707
|
mounted.current = false;
|
|
@@ -5550,8 +5711,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5550
5711
|
const request = useCallback13(async (req) => {
|
|
5551
5712
|
if (!conversation) return;
|
|
5552
5713
|
const mine = ++seq.current;
|
|
5553
|
-
const key =
|
|
5554
|
-
const fresh = key &&
|
|
5714
|
+
const key = memory3 ? gridKey(locale, req) : null;
|
|
5715
|
+
const fresh = key && memory3 ? memory3.cachedGrid(key) : void 0;
|
|
5555
5716
|
stopWaiting(true, key);
|
|
5556
5717
|
if (fresh) {
|
|
5557
5718
|
setGrid(fresh);
|
|
@@ -5567,9 +5728,9 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5567
5728
|
hung.current = window.setTimeout(() => {
|
|
5568
5729
|
if (mine !== seq.current || !mounted.current) return;
|
|
5569
5730
|
waiting.current = null;
|
|
5570
|
-
if (key &&
|
|
5571
|
-
forget(
|
|
5572
|
-
|
|
5731
|
+
if (key && memory3 && own?.flight) {
|
|
5732
|
+
forget(memory3, key, own.flight);
|
|
5733
|
+
memory3.cacheGrid(key, null);
|
|
5573
5734
|
}
|
|
5574
5735
|
setGrid(null);
|
|
5575
5736
|
setAnswered({ req, locale });
|
|
@@ -5579,8 +5740,8 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5579
5740
|
let flight;
|
|
5580
5741
|
try {
|
|
5581
5742
|
let g;
|
|
5582
|
-
if (key &&
|
|
5583
|
-
flight = shared(
|
|
5743
|
+
if (key && memory3) {
|
|
5744
|
+
flight = shared(memory3, key, () => conversation.getBuilderGrid(locale, req));
|
|
5584
5745
|
flight.waiters += 1;
|
|
5585
5746
|
if (own) own.flight = flight;
|
|
5586
5747
|
for (; ; ) {
|
|
@@ -5617,35 +5778,40 @@ function useBuilderGrid({ conversation, locale, memory: memory2, initial }) {
|
|
|
5617
5778
|
setStatus("error");
|
|
5618
5779
|
}
|
|
5619
5780
|
}
|
|
5620
|
-
}, [conversation, locale,
|
|
5781
|
+
}, [conversation, locale, memory3, stopWaiting]);
|
|
5621
5782
|
const answeredFor = answered && answered.locale === locale ? answered.req : null;
|
|
5622
5783
|
return { grid, answeredFor, status, confirmed, request };
|
|
5623
5784
|
}
|
|
5624
5785
|
|
|
5625
5786
|
// src/components/AddToSlipButton.tsx
|
|
5626
|
-
import { useCallback as useCallback15, useState as
|
|
5787
|
+
import { useCallback as useCallback15, useState as useState17 } from "react";
|
|
5627
5788
|
|
|
5628
5789
|
// src/slipAdd.ts
|
|
5629
5790
|
import { useCallback as useCallback14 } from "react";
|
|
5630
5791
|
import { isAddToSlipResult, toWireSport as toWireSport3 } from "@sensiblestats/widget-sdk";
|
|
5631
5792
|
|
|
5632
5793
|
// src/trackingContext.ts
|
|
5633
|
-
import { createContext as
|
|
5794
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
5634
5795
|
var noop = () => {
|
|
5635
5796
|
};
|
|
5636
|
-
var TrackingContext =
|
|
5797
|
+
var TrackingContext = createContext5(noop);
|
|
5637
5798
|
function useTrack() {
|
|
5638
|
-
return
|
|
5799
|
+
return useContext5(TrackingContext);
|
|
5639
5800
|
}
|
|
5640
5801
|
|
|
5641
5802
|
// src/slipStateContext.ts
|
|
5642
|
-
import { createContext as
|
|
5643
|
-
var SlipStateContext =
|
|
5803
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
5804
|
+
var SlipStateContext = createContext6(null);
|
|
5644
5805
|
function useSlipState() {
|
|
5645
|
-
return
|
|
5806
|
+
return useContext6(SlipStateContext);
|
|
5646
5807
|
}
|
|
5647
5808
|
|
|
5648
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
|
+
}
|
|
5649
5815
|
function withTimeout(value) {
|
|
5650
5816
|
return Promise.race([
|
|
5651
5817
|
value,
|
|
@@ -5668,24 +5834,26 @@ function useSlipAdd(slip, ui) {
|
|
|
5668
5834
|
const slipState = useSlipState();
|
|
5669
5835
|
const handler = slip.onAddToSlip;
|
|
5670
5836
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
5837
|
+
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
5671
5838
|
return useCallback14(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
5672
5839
|
if (!handler) return { kind: "failed" };
|
|
5673
|
-
const
|
|
5674
|
-
const
|
|
5840
|
+
const out = toHostSelection(selection, operatorFormat);
|
|
5841
|
+
const pick = slipPickFields(out, rawLabels ? selectionLabel : void 0, line);
|
|
5842
|
+
const wireSport = toWireSport3(out.sport);
|
|
5675
5843
|
const sportField = wireSport ? { sport: wireSport } : {};
|
|
5676
5844
|
const clickFields = {
|
|
5677
|
-
matchOddsId:
|
|
5678
|
-
matchId:
|
|
5679
|
-
odds:
|
|
5845
|
+
matchOddsId: out.matchOddsId,
|
|
5846
|
+
matchId: out.matchId,
|
|
5847
|
+
odds: out.oddsDecimal,
|
|
5680
5848
|
...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
|
|
5681
|
-
...
|
|
5849
|
+
...out.sport !== void 0 ? { sport: out.sport } : {}
|
|
5682
5850
|
};
|
|
5683
5851
|
track({ name: "add_to_slip_click", ...clickFields });
|
|
5684
5852
|
if (marketDeveloperName !== void 0) {
|
|
5685
5853
|
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
5686
5854
|
}
|
|
5687
5855
|
try {
|
|
5688
|
-
const raw = await withTimeout(Promise.resolve(handler(
|
|
5856
|
+
const raw = await withTimeout(Promise.resolve(handler(out)));
|
|
5689
5857
|
if (raw != null && !isAddToSlipResult(raw)) throw new Error("malformed add-to-slip result");
|
|
5690
5858
|
const result = withSafeMessage(raw ?? void 0);
|
|
5691
5859
|
track({ name: "add_to_slip_result", outcome: slipOutcome(result), ...clickFields });
|
|
@@ -5701,12 +5869,12 @@ function useSlipAdd(slip, ui) {
|
|
|
5701
5869
|
});
|
|
5702
5870
|
}
|
|
5703
5871
|
if (slipState) {
|
|
5704
|
-
if (isTerminal(result)) slipState.settle(slipKey(
|
|
5872
|
+
if (isTerminal(result)) slipState.settle(slipKey(out));
|
|
5705
5873
|
if (wasAdded(result) && marketDeveloperName !== void 0) {
|
|
5706
|
-
slipState.recordAdd({ selection, market: marketDeveloperName, pick });
|
|
5874
|
+
slipState.recordAdd({ selection: out, market: marketDeveloperName, pick });
|
|
5707
5875
|
}
|
|
5708
5876
|
}
|
|
5709
|
-
return { kind: "answered", result };
|
|
5877
|
+
return { kind: "answered", result, oldOdds: out.odds?.text ?? selection.forms.decimal };
|
|
5710
5878
|
} catch {
|
|
5711
5879
|
track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
|
|
5712
5880
|
if (marketDeveloperName !== void 0) {
|
|
@@ -5714,15 +5882,15 @@ function useSlipAdd(slip, ui) {
|
|
|
5714
5882
|
}
|
|
5715
5883
|
return { kind: "failed" };
|
|
5716
5884
|
}
|
|
5717
|
-
}, [handler, log, track, slipState, rawLabels]);
|
|
5885
|
+
}, [handler, log, track, slipState, rawLabels, operatorFormat]);
|
|
5718
5886
|
}
|
|
5719
5887
|
|
|
5720
5888
|
// src/components/Toast.tsx
|
|
5721
|
-
import { useEffect as
|
|
5889
|
+
import { useEffect as useEffect16 } from "react";
|
|
5722
5890
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
5723
5891
|
var DISMISS_MS = 4e3;
|
|
5724
5892
|
function Toast({ toast, onDismiss }) {
|
|
5725
|
-
|
|
5893
|
+
useEffect16(() => {
|
|
5726
5894
|
if (!toast) return;
|
|
5727
5895
|
const timer = setTimeout(onDismiss, DISMISS_MS);
|
|
5728
5896
|
return () => clearTimeout(timer);
|
|
@@ -5733,13 +5901,14 @@ function Toast({ toast, onDismiss }) {
|
|
|
5733
5901
|
|
|
5734
5902
|
// src/components/AddToSlipButton.tsx
|
|
5735
5903
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5736
|
-
function SlipButton({ selection,
|
|
5737
|
-
const [pending, setPending] =
|
|
5738
|
-
const [settledLocal, setSettledLocal] =
|
|
5739
|
-
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);
|
|
5740
5908
|
const dismiss = useCallback15(() => setToast(null), []);
|
|
5741
5909
|
const add = useSlipAdd(slip, ui);
|
|
5742
5910
|
const slipState = useSlipState();
|
|
5911
|
+
const { oddsFormat } = useOddsSettings();
|
|
5743
5912
|
const handler = slip.onAddToSlip;
|
|
5744
5913
|
if (!ui || !handler || !selection) return null;
|
|
5745
5914
|
const settled = slipState ? !!slipState.settled[slipKey(selection)] : settledLocal;
|
|
@@ -5751,7 +5920,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5751
5920
|
setToast({ kind: "error", text: ui.slipFailed });
|
|
5752
5921
|
return;
|
|
5753
5922
|
}
|
|
5754
|
-
setToast(resultToToast(outcome.result,
|
|
5923
|
+
setToast(resultToToast(outcome.result, outcome.oldOdds, ui));
|
|
5755
5924
|
if (!slipState) setSettledLocal(isTerminal(outcome.result));
|
|
5756
5925
|
} finally {
|
|
5757
5926
|
setPending(false);
|
|
@@ -5770,7 +5939,7 @@ function SlipButton({ selection, shownOdds, marketDeveloperName, selectionLabel,
|
|
|
5770
5939
|
children: [
|
|
5771
5940
|
settled ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-tick", "aria-hidden": "true", children: "\u2713" }) : null,
|
|
5772
5941
|
price.label ? /* @__PURE__ */ jsx6("span", { className: "ss-w-mol-lab", children: price.label }) : null,
|
|
5773
|
-
/* @__PURE__ */ jsx6("span", { children:
|
|
5942
|
+
/* @__PURE__ */ jsx6("span", { children: formatOdds(selection.forms, oddsFormat) })
|
|
5774
5943
|
]
|
|
5775
5944
|
}
|
|
5776
5945
|
) : /* @__PURE__ */ jsx6(
|
|
@@ -5793,7 +5962,6 @@ function AddToSlipButton({ it, slip, ui }) {
|
|
|
5793
5962
|
SlipButton,
|
|
5794
5963
|
{
|
|
5795
5964
|
selection,
|
|
5796
|
-
shownOdds: it.odds ?? "",
|
|
5797
5965
|
marketDeveloperName: it.marketDeveloperName,
|
|
5798
5966
|
selectionLabel: it.selectionLabel,
|
|
5799
5967
|
line: it.line,
|
|
@@ -5840,11 +6008,11 @@ function oldestQuote(legs) {
|
|
|
5840
6008
|
}
|
|
5841
6009
|
|
|
5842
6010
|
// src/components/MarketOddsCardList.tsx
|
|
5843
|
-
import { useEffect as
|
|
6011
|
+
import { useEffect as useEffect18, useState as useState23 } from "react";
|
|
5844
6012
|
import { mayPinOrSlip as mayPinOrSlip4, slipSportOf as slipSportOf5, sportOf as sportOf8 } from "@sensiblestats/widget-sdk";
|
|
5845
6013
|
|
|
5846
6014
|
// src/nflKickoff.ts
|
|
5847
|
-
import { useEffect as
|
|
6015
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
5848
6016
|
import { sportOf as sportOf6 } from "@sensiblestats/widget-sdk";
|
|
5849
6017
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
5850
6018
|
var isNfl = (sport) => sportOf6(sport) === "americanfootball";
|
|
@@ -5872,9 +6040,9 @@ function guardLegsPreMatch(slip, legs, ui) {
|
|
|
5872
6040
|
};
|
|
5873
6041
|
}
|
|
5874
6042
|
function useNextKickoffRender(kickoffs) {
|
|
5875
|
-
const [tick, setTick] =
|
|
6043
|
+
const [tick, setTick] = useState18(0);
|
|
5876
6044
|
const key = kickoffs.map((k) => k ?? "").join("|");
|
|
5877
|
-
|
|
6045
|
+
useEffect17(() => {
|
|
5878
6046
|
const now = Date.now();
|
|
5879
6047
|
const upcoming = key.split("|").map((k) => k ? Date.parse(k) : NaN).filter((ms) => ms > now);
|
|
5880
6048
|
if (upcoming.length === 0) return;
|
|
@@ -5907,14 +6075,14 @@ function OddsMovementBadge({
|
|
|
5907
6075
|
}
|
|
5908
6076
|
|
|
5909
6077
|
// src/components/Crest.tsx
|
|
5910
|
-
import { useState as
|
|
6078
|
+
import { useState as useState19 } from "react";
|
|
5911
6079
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
5912
6080
|
function initials(name) {
|
|
5913
6081
|
return (name ?? "").trim().slice(0, 1).toUpperCase() || "?";
|
|
5914
6082
|
}
|
|
5915
6083
|
function Crest({ url, name, kind, abbr }) {
|
|
5916
6084
|
const cls = kind === "comp" ? "ss-w-bi-comp-logo" : "ss-w-bi-crest";
|
|
5917
|
-
const [failed, setFailed] =
|
|
6085
|
+
const [failed, setFailed] = useState19(false);
|
|
5918
6086
|
if (url && !failed) {
|
|
5919
6087
|
return /* @__PURE__ */ jsx8("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
5920
6088
|
}
|
|
@@ -5923,7 +6091,7 @@ function Crest({ url, name, kind, abbr }) {
|
|
|
5923
6091
|
}
|
|
5924
6092
|
|
|
5925
6093
|
// src/components/PinToggle.tsx
|
|
5926
|
-
import { useCallback as useCallback16, useState as
|
|
6094
|
+
import { useCallback as useCallback16, useState as useState20 } from "react";
|
|
5927
6095
|
import { qualifiedId, toWireSport as toWireSport4 } from "@sensiblestats/widget-sdk";
|
|
5928
6096
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5929
6097
|
var PIN_GLYPHS = {
|
|
@@ -5932,7 +6100,7 @@ var PIN_GLYPHS = {
|
|
|
5932
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" }
|
|
5933
6101
|
};
|
|
5934
6102
|
function PinToggle({ pin, monitor, ui, market }) {
|
|
5935
|
-
const [toast, setToast] =
|
|
6103
|
+
const [toast, setToast] = useState20(null);
|
|
5936
6104
|
const dismiss = useCallback16(() => setToast(null), []);
|
|
5937
6105
|
const log = useEventLog();
|
|
5938
6106
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6002,10 +6170,10 @@ function PinToggle({ pin, monitor, ui, market }) {
|
|
|
6002
6170
|
}
|
|
6003
6171
|
|
|
6004
6172
|
// src/components/PriceHistoryButton.tsx
|
|
6005
|
-
import { useCallback as useCallback17, useState as
|
|
6173
|
+
import { useCallback as useCallback17, useState as useState21 } from "react";
|
|
6006
6174
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6007
6175
|
function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
6008
|
-
const [toast, setToast] =
|
|
6176
|
+
const [toast, setToast] = useState21(null);
|
|
6009
6177
|
const dismiss = useCallback17(() => setToast(null), []);
|
|
6010
6178
|
const log = useEventLog();
|
|
6011
6179
|
if (!monitor || !monitor.enabled) return null;
|
|
@@ -6033,7 +6201,7 @@ function PriceHistoryButton({ selection, monitor, ui, displayLabel }) {
|
|
|
6033
6201
|
}
|
|
6034
6202
|
|
|
6035
6203
|
// src/components/AllMarketsButton.tsx
|
|
6036
|
-
import { useCallback as useCallback18, useState as
|
|
6204
|
+
import { useCallback as useCallback18, useState as useState22 } from "react";
|
|
6037
6205
|
import { sportOf as sportOf7 } from "@sensiblestats/widget-sdk";
|
|
6038
6206
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6039
6207
|
function allMarketsCount(vm, monitor) {
|
|
@@ -6042,7 +6210,7 @@ function allMarketsCount(vm, monitor) {
|
|
|
6042
6210
|
}
|
|
6043
6211
|
function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
6044
6212
|
const log = useEventLog();
|
|
6045
|
-
const [toast, setToast] =
|
|
6213
|
+
const [toast, setToast] = useState22(null);
|
|
6046
6214
|
const dismiss = useCallback18(() => setToast(null), []);
|
|
6047
6215
|
const onClick = () => {
|
|
6048
6216
|
if (monitor.pinMatch({ matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName }) === "match_limit") {
|
|
@@ -6077,14 +6245,17 @@ function AllMarketsButton({ vm, count, monitor, ui, surface }) {
|
|
|
6077
6245
|
// src/components/MarketOddsCardList.tsx
|
|
6078
6246
|
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6079
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;
|
|
6080
6251
|
const slipAllowed = vm.addToSlipEnabled && !suppressSlip && slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now());
|
|
6081
6252
|
const selection = slipAllowed ? marketOddsRowToSlipSelection(vm, row, slip.conversationId) : null;
|
|
6082
6253
|
const inSlip = !!inSlipIds && row.matchOddsId != null && !!inSlipIds[slipKey({ matchOddsId: row.matchOddsId, sport: slipSportOf5(vm.sport) })];
|
|
6083
6254
|
return /* @__PURE__ */ jsxs10("div", { className: "ss-w-mo-row", children: [
|
|
6084
6255
|
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-sel", children: row.selection }),
|
|
6085
|
-
/* @__PURE__ */ jsx12(OddsMovementBadge, { previous:
|
|
6086
|
-
/* @__PURE__ */ jsx12("span", { className: "ss-w-mo-price", children:
|
|
6087
|
-
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(
|
|
6088
6259
|
PriceHistoryButton,
|
|
6089
6260
|
{
|
|
6090
6261
|
ui,
|
|
@@ -6097,7 +6268,7 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
6097
6268
|
"\u2713 ",
|
|
6098
6269
|
ui.inSlipLabel
|
|
6099
6270
|
] }) : null,
|
|
6100
|
-
!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
|
|
6101
6272
|
] });
|
|
6102
6273
|
}
|
|
6103
6274
|
var STALE_AFTER_MS = 12e4;
|
|
@@ -6105,7 +6276,7 @@ function fmtHhMm(iso, locale) {
|
|
|
6105
6276
|
return new Date(iso).toLocaleTimeString(intlLocale(locale), { hour: "2-digit", minute: "2-digit", hour12: false });
|
|
6106
6277
|
}
|
|
6107
6278
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
6108
|
-
const [open, setOpen] =
|
|
6279
|
+
const [open, setOpen] = useState23(false);
|
|
6109
6280
|
useNextKickoffRender(isNfl(vm.sport) ? [vm.kickoffUtc] : []);
|
|
6110
6281
|
const kickoffFallback = vm.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(vm.kickoffUtc) : void 0;
|
|
6111
6282
|
const kickoff = vm.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -6116,9 +6287,9 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6116
6287
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
6117
6288
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
6118
6289
|
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui?.locale ?? "en") : null;
|
|
6119
|
-
const [, setStaleTick] =
|
|
6290
|
+
const [, setStaleTick] = useState23(0);
|
|
6120
6291
|
const watchStale = live != null && !isClosed && !isStale;
|
|
6121
|
-
|
|
6292
|
+
useEffect18(() => {
|
|
6122
6293
|
if (!watchStale) return;
|
|
6123
6294
|
const id = window.setTimeout(() => setStaleTick((n) => n + 1), Math.max(0, asOfMs + STALE_AFTER_MS - Date.now()) + 1);
|
|
6124
6295
|
return () => window.clearTimeout(id);
|
|
@@ -6248,7 +6419,7 @@ var asOf = (iso, ui) => {
|
|
|
6248
6419
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId, coolOff }) {
|
|
6249
6420
|
const matchId = card.matchId;
|
|
6250
6421
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6251
|
-
const ask =
|
|
6422
|
+
const ask = useMemo6(() => canAdd2 && !coolOff && marketKey && matchId ? {
|
|
6252
6423
|
sport,
|
|
6253
6424
|
marketKey,
|
|
6254
6425
|
matchIds: [matchId],
|
|
@@ -6259,10 +6430,11 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6259
6430
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6260
6431
|
} : null, [canAdd2, coolOff, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6261
6432
|
const { grid, answeredFor, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, initial: ask });
|
|
6262
|
-
|
|
6433
|
+
useEffect19(() => {
|
|
6263
6434
|
if (ask) void request(ask);
|
|
6264
6435
|
}, [request, ask]);
|
|
6265
6436
|
useNextKickoffRender([card.startsAtUtc]);
|
|
6437
|
+
const { oddsFormat } = useOddsSettings();
|
|
6266
6438
|
const settled = answeredFor === ask;
|
|
6267
6439
|
const pending = ask !== null && conversation !== null && !settled;
|
|
6268
6440
|
if (!ask || !preMatchOpen(card.startsAtUtc, Date.now())) return null;
|
|
@@ -6285,20 +6457,19 @@ function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUser
|
|
|
6285
6457
|
SlipButton,
|
|
6286
6458
|
{
|
|
6287
6459
|
selection,
|
|
6288
|
-
shownOdds: leg.odds,
|
|
6289
6460
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6290
6461
|
selectionLabel: leg.selectionLabel,
|
|
6291
6462
|
line: leg.line,
|
|
6292
6463
|
slip: guardPreMatch(slip, card.startsAtUtc, ui),
|
|
6293
6464
|
ui,
|
|
6294
|
-
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)}` }
|
|
6295
6466
|
}
|
|
6296
6467
|
)
|
|
6297
6468
|
] }) });
|
|
6298
6469
|
}
|
|
6299
6470
|
|
|
6300
6471
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6301
|
-
import { useEffect as
|
|
6472
|
+
import { useEffect as useEffect20, useMemo as useMemo7 } from "react";
|
|
6302
6473
|
|
|
6303
6474
|
// src/components/dashboard/v8/factLeg.ts
|
|
6304
6475
|
var isProp = (key) => key.toLowerCase().startsWith("prop_");
|
|
@@ -6326,10 +6497,10 @@ function legForFact(ref, grid, stars = []) {
|
|
|
6326
6497
|
|
|
6327
6498
|
// src/components/dashboard/v8/FactPrice.tsx
|
|
6328
6499
|
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6329
|
-
function FactPrice({ reference, ui, slip, conversation, memory:
|
|
6500
|
+
function FactPrice({ reference, ui, slip, conversation, memory: memory3, stars, enabled, operatorUserId, anonymousUserId }) {
|
|
6330
6501
|
const { sport, marketKey, matchId } = reference;
|
|
6331
6502
|
const canAdd2 = !!slip.onAddToSlip;
|
|
6332
|
-
const ask =
|
|
6503
|
+
const ask = useMemo7(() => enabled && canAdd2 && marketKey && matchId ? {
|
|
6333
6504
|
sport,
|
|
6334
6505
|
marketKey,
|
|
6335
6506
|
matchIds: [matchId],
|
|
@@ -6340,8 +6511,8 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6340
6511
|
...operatorUserId ? { operatorUserId } : {},
|
|
6341
6512
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6342
6513
|
} : null, [enabled, canAdd2, sport, marketKey, matchId, operatorUserId, anonymousUserId]);
|
|
6343
|
-
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory:
|
|
6344
|
-
|
|
6514
|
+
const { grid, answeredFor, confirmed, request } = useBuilderGrid({ conversation, locale: ui.presets.lang, memory: memory3, initial: ask });
|
|
6515
|
+
useEffect20(() => {
|
|
6345
6516
|
if (ask) void request(ask);
|
|
6346
6517
|
}, [request, ask]);
|
|
6347
6518
|
const settled = answeredFor === ask;
|
|
@@ -6350,6 +6521,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6350
6521
|
const index = answer ? legForFact(reference, answer, stars) : -1;
|
|
6351
6522
|
const leg = answer && index >= 0 ? legAt(answer, index, sport) ?? void 0 : void 0;
|
|
6352
6523
|
useNextKickoffRender([leg?.kickoffUtc]);
|
|
6524
|
+
const { oddsFormat } = useOddsSettings();
|
|
6353
6525
|
if (!ask) return null;
|
|
6354
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" });
|
|
6355
6527
|
if (!leg || !leg.quotedAtUtc || Number.isNaN(Date.parse(leg.quotedAtUtc))) return null;
|
|
@@ -6364,14 +6536,13 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6364
6536
|
SlipButton,
|
|
6365
6537
|
{
|
|
6366
6538
|
selection,
|
|
6367
|
-
shownOdds: leg.odds,
|
|
6368
6539
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6369
6540
|
selectionLabel: leg.selectionLabel,
|
|
6370
6541
|
line: leg.line,
|
|
6371
6542
|
slip: guardPreMatch(slip, leg.kickoffUtc, ui),
|
|
6372
6543
|
ui,
|
|
6373
6544
|
hold: !confirmed,
|
|
6374
|
-
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)}` }
|
|
6375
6546
|
}
|
|
6376
6547
|
)
|
|
6377
6548
|
] }) });
|
|
@@ -6379,7 +6550,7 @@ function FactPrice({ reference, ui, slip, conversation, memory: memory2, stars,
|
|
|
6379
6550
|
|
|
6380
6551
|
// src/components/dashboard/v8/FactsBlock.tsx
|
|
6381
6552
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6382
|
-
function FactsBlock({ facts, injury, ui, slip, conversation, memory:
|
|
6553
|
+
function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory3, stars, priced, operatorUserId, anonymousUserId }) {
|
|
6383
6554
|
const injuryText = injury?.text?.trim();
|
|
6384
6555
|
const injuryAt = injury && !Number.isNaN(Date.parse(injury.asOfUtc)) ? injury.asOfUtc : null;
|
|
6385
6556
|
if (facts.length === 0 && !(injuryText && injuryAt)) return null;
|
|
@@ -6387,7 +6558,7 @@ function FactsBlock({ facts, injury, ui, slip, conversation, memory: memory2, st
|
|
|
6387
6558
|
/* @__PURE__ */ jsx15("h3", { className: "ss-w-v8-sec-title", children: ui.v8BeforeKickoff }),
|
|
6388
6559
|
facts.map((f, i) => /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", children: [
|
|
6389
6560
|
/* @__PURE__ */ jsx15("p", { className: "ss-w-v8-fact-text", children: f.text }),
|
|
6390
|
-
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
|
|
6391
6562
|
] }, `${f.matchId ?? ""}:${f.marketKey}:${i}`)),
|
|
6392
6563
|
injuryText && injuryAt ? /* @__PURE__ */ jsxs13("div", { className: "ss-w-v8-fact", "data-testid": "v8-injury", children: [
|
|
6393
6564
|
/* @__PURE__ */ jsx15("p", { className: "ss-w-v8-fact-text", children: injuryText }),
|
|
@@ -6407,14 +6578,14 @@ function FavouritesInvite({ ui, onOpen }) {
|
|
|
6407
6578
|
}
|
|
6408
6579
|
|
|
6409
6580
|
// src/components/dashboard/v8/useFollow.ts
|
|
6410
|
-
import { useState as
|
|
6581
|
+
import { useState as useState24 } from "react";
|
|
6411
6582
|
var isFavouriteKind = (kind) => kind === "team" || kind === "player" || kind === "competition";
|
|
6412
6583
|
var keyOf2 = (sport, t) => `${sport}:${t.kind}:${t.id}`;
|
|
6413
6584
|
function kindLabel(kind, ui) {
|
|
6414
6585
|
return kind === "competition" ? ui.favKindLeague : kind === "player" ? ui.favKindPlayer : ui.favKindTeam;
|
|
6415
6586
|
}
|
|
6416
6587
|
function useFollow(controller, ui, holds, sport) {
|
|
6417
|
-
const [notice, setNotice] =
|
|
6588
|
+
const [notice, setNotice] = useState24(null);
|
|
6418
6589
|
const isOpen = (t) => isFavouriteKind(t.kind) && !holds.followed.has(keyOf2(sport, t)) && !controller.isStarred(t.kind, t.id);
|
|
6419
6590
|
const follow = async (t) => {
|
|
6420
6591
|
if (!isFavouriteKind(t.kind)) return;
|
|
@@ -6682,18 +6853,19 @@ function shownFacts(personal, picked) {
|
|
|
6682
6853
|
}
|
|
6683
6854
|
|
|
6684
6855
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
6685
|
-
import { useEffect as
|
|
6856
|
+
import { useEffect as useEffect21, useLayoutEffect, useRef as useRef17, useState as useState26 } from "react";
|
|
6686
6857
|
|
|
6687
6858
|
// src/components/AddAllToSlipButton.tsx
|
|
6688
|
-
import { useCallback as useCallback19, useState as
|
|
6859
|
+
import { useCallback as useCallback19, useState as useState25 } from "react";
|
|
6689
6860
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6690
|
-
function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onStartedGame }) {
|
|
6861
|
+
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
6691
6862
|
const add = useSlipAdd(slip, ui);
|
|
6692
6863
|
const slipState = useSlipState();
|
|
6693
6864
|
const log = useEventLog();
|
|
6694
|
-
const
|
|
6695
|
-
const [
|
|
6696
|
-
const [
|
|
6865
|
+
const track = useTrack();
|
|
6866
|
+
const [pending, setPending] = useState25(false);
|
|
6867
|
+
const [settledLocal, setSettledLocal] = useState25({});
|
|
6868
|
+
const [toast, setToast] = useState25(null);
|
|
6697
6869
|
const dismiss = useCallback19(() => setToast(null), []);
|
|
6698
6870
|
if (!ui || !slip.onAddToSlip || legs.length < 2) return null;
|
|
6699
6871
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
@@ -6751,6 +6923,9 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onS
|
|
|
6751
6923
|
}
|
|
6752
6924
|
});
|
|
6753
6925
|
}
|
|
6926
|
+
if (chatCombo && tally.added === legs.length) {
|
|
6927
|
+
track({ name: "combo_add_click", surface: "chat", sport: legs[0].sport ?? "football", legs: legs.length, total: chatCombo.total });
|
|
6928
|
+
}
|
|
6754
6929
|
if (!slipState) setSettledLocal((s) => ({ ...s, ...added }));
|
|
6755
6930
|
setToast(addAllToast(tally, ui, sizeless));
|
|
6756
6931
|
setPending(false);
|
|
@@ -6764,15 +6939,17 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, sizeless, hold, onS
|
|
|
6764
6939
|
}
|
|
6765
6940
|
|
|
6766
6941
|
// src/presetToolsContext.ts
|
|
6767
|
-
import { createContext as
|
|
6768
|
-
var PresetToolsContext =
|
|
6942
|
+
import { createContext as createContext7, useContext as useContext7 } from "react";
|
|
6943
|
+
var PresetToolsContext = createContext7(null);
|
|
6769
6944
|
function usePresetTools() {
|
|
6770
|
-
return
|
|
6945
|
+
return useContext7(PresetToolsContext);
|
|
6771
6946
|
}
|
|
6772
6947
|
|
|
6773
6948
|
// src/components/ComboCardList.tsx
|
|
6774
6949
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6775
6950
|
function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed }) {
|
|
6951
|
+
const { oddsFormat } = useOddsSettings();
|
|
6952
|
+
const odds = formatOdds(leg.priceForms, oddsFormat);
|
|
6776
6953
|
const kickoffFallback = !leg.kickoffLabel && leg.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(leg.kickoffUtc) : void 0;
|
|
6777
6954
|
const kickoff = leg.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
6778
6955
|
const selection = addToSlipEnabled ? comboLegToSlipSelection(leg, slip.conversationId) : null;
|
|
@@ -6797,18 +6974,17 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6797
6974
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-market", children: leg.market }),
|
|
6798
6975
|
/* @__PURE__ */ jsx24("span", { className: "ss-w-combo-leg-sel", children: leg.selection })
|
|
6799
6976
|
] }),
|
|
6800
|
-
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 }),
|
|
6801
6978
|
closed ? null : /* @__PURE__ */ jsx24(
|
|
6802
6979
|
SlipButton,
|
|
6803
6980
|
{
|
|
6804
6981
|
selection,
|
|
6805
|
-
shownOdds: leg.odds,
|
|
6806
6982
|
marketDeveloperName: leg.marketDeveloperName || void 0,
|
|
6807
6983
|
selectionLabel: leg.selectionLabel,
|
|
6808
6984
|
line: leg.line,
|
|
6809
6985
|
slip,
|
|
6810
6986
|
ui,
|
|
6811
|
-
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${
|
|
6987
|
+
ariaLabel: `${leg.homeTeamName} ${leg.awayTeamName}, ${leg.selection} ${odds}`,
|
|
6812
6988
|
hold
|
|
6813
6989
|
}
|
|
6814
6990
|
)
|
|
@@ -6818,12 +6994,13 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed })
|
|
|
6818
6994
|
}
|
|
6819
6995
|
function ComboCardView({ vm, ui, slip, monitor }) {
|
|
6820
6996
|
const tools = usePresetTools();
|
|
6997
|
+
const { oddsFormat } = useOddsSettings();
|
|
6821
6998
|
const { target, legCount } = vm;
|
|
6822
6999
|
return /* @__PURE__ */ jsxs22("div", { className: "ss-w-combo", children: [
|
|
6823
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)) }),
|
|
6824
|
-
/* @__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) }),
|
|
6825
7002
|
vm.replacedNote ? /* @__PURE__ */ jsx24("p", { className: "ss-w-combo-note", children: vm.replacedNote }) : null,
|
|
6826
|
-
vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui }) : null,
|
|
7003
|
+
vm.addToSlipEnabled ? /* @__PURE__ */ jsx24(AddAllToSlipButton, { legs: vm.legs, slip, ui, chatCombo: { total: vm.target !== void 0 ? String(vm.target) : "" } }) : null,
|
|
6827
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
|
|
6828
7005
|
] });
|
|
6829
7006
|
}
|
|
@@ -6836,8 +7013,13 @@ function ComboCardList({ cards, ui, slip, monitor }) {
|
|
|
6836
7013
|
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6837
7014
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
6838
7015
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
6839
|
-
var
|
|
6840
|
-
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
|
+
};
|
|
6841
7023
|
var sameIds = (a, b) => a.length === b.length && a.every((id) => b.includes(id));
|
|
6842
7024
|
function openingGames(preset) {
|
|
6843
7025
|
const options = preset.gamesOptions && preset.gamesOptions.length > 0 ? preset.gamesOptions : null;
|
|
@@ -6846,31 +7028,33 @@ function openingGames(preset) {
|
|
|
6846
7028
|
return option ? { options, option } : { options: null, option: null };
|
|
6847
7029
|
}
|
|
6848
7030
|
var usableMarkets = (preset) => preset.marketOptions && preset.marketOptions.some((m) => m.key === preset.marketKey) ? preset.marketOptions : null;
|
|
6849
|
-
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);
|
|
6850
7034
|
const opening = openingGames(preset);
|
|
6851
7035
|
const gamesOptions = opening.options;
|
|
6852
7036
|
const marketOptions = usableMarkets(preset);
|
|
6853
|
-
const [fingerprint] =
|
|
6854
|
-
const [saved] =
|
|
6855
|
-
const kept =
|
|
7037
|
+
const [fingerprint] = useState26(() => JSON.stringify(preset));
|
|
7038
|
+
const [saved] = useState26(() => {
|
|
7039
|
+
const kept = memory3?.savedView(sport);
|
|
6856
7040
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
6857
7041
|
});
|
|
6858
7042
|
const openingView = {
|
|
6859
7043
|
legs: preset.legs,
|
|
6860
|
-
total: asTotal(preset.totalTarget),
|
|
7044
|
+
total: asTotal(preset.totalTarget, totals),
|
|
6861
7045
|
marketKey: preset.marketKey,
|
|
6862
7046
|
gamesId: opening.option?.id ?? null,
|
|
6863
7047
|
matchIds: opening.option ? opening.option.matchIds : preset.matchIds,
|
|
6864
7048
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
6865
7049
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
6866
7050
|
};
|
|
6867
|
-
const [view, setView] =
|
|
6868
|
-
const [chosen, setChosen] =
|
|
7051
|
+
const [view, setView] = useState26(() => saved?.view ?? openingView);
|
|
7052
|
+
const [chosen, setChosen] = useState26(() => saved?.chosen ?? (saved && !saved.widenedNote ? saved.view : openingView));
|
|
6869
7053
|
const pickedMatchId = chosen.widen ? gamesOptions?.find((o) => o.group === "game")?.matchIds[0] ?? null : chosen.matchIds[0] ?? null;
|
|
6870
7054
|
const pickedMatchIds = chosen.widen ? (gamesOptions ?? []).filter((o) => o.group === "game").flatMap((o) => o.matchIds) : chosen.matchIds;
|
|
6871
7055
|
const pickedOpening = chosen.widen === openingView.widen && chosen.gamesId === openingView.gamesId && sameIds(chosen.matchIds, openingView.matchIds);
|
|
6872
7056
|
const autoWidened = useRef17(false);
|
|
6873
|
-
const [widenedNote, setWidenedNote] =
|
|
7057
|
+
const [widenedNote, setWidenedNote] = useState26(saved?.widenedNote ?? false);
|
|
6874
7058
|
const requestFor = (v) => ({
|
|
6875
7059
|
sport,
|
|
6876
7060
|
marketKey: v.marketKey,
|
|
@@ -6882,10 +7066,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6882
7066
|
...operatorUserId ? { operatorUserId } : {},
|
|
6883
7067
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6884
7068
|
});
|
|
6885
|
-
const [first] =
|
|
6886
|
-
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 });
|
|
6887
7071
|
const lastRequest = useRef17(first);
|
|
6888
|
-
|
|
7072
|
+
useEffect21(() => {
|
|
6889
7073
|
void request(lastRequest.current);
|
|
6890
7074
|
}, [request]);
|
|
6891
7075
|
const send = (req) => {
|
|
@@ -6895,7 +7079,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6895
7079
|
const commit = (next, note, picked) => {
|
|
6896
7080
|
setView(next);
|
|
6897
7081
|
setWidenedNote(note);
|
|
6898
|
-
|
|
7082
|
+
memory3?.saveView(sport, { fingerprint, view: next, widenedNote: note, chosen: picked });
|
|
6899
7083
|
};
|
|
6900
7084
|
const ask = (next, pick) => {
|
|
6901
7085
|
setStartedNote(false);
|
|
@@ -6919,14 +7103,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6919
7103
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
6920
7104
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
6921
7105
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
6922
|
-
const [startedNote, setStartedNote] =
|
|
7106
|
+
const [startedNote, setStartedNote] = useState26(false);
|
|
6923
7107
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
6924
|
-
|
|
7108
|
+
useEffect21(() => {
|
|
6925
7109
|
if (startedNote && status === "ready" && !anyStarted) setStartedNote(false);
|
|
6926
7110
|
}, [startedNote, status, anyStarted]);
|
|
6927
7111
|
const market = rows?.[0]?.market;
|
|
6928
|
-
const [seen, setSeen] =
|
|
6929
|
-
|
|
7112
|
+
const [seen, setSeen] = useState26(null);
|
|
7113
|
+
useEffect21(() => {
|
|
6930
7114
|
if (market) setSeen(market);
|
|
6931
7115
|
}, [market]);
|
|
6932
7116
|
const marketName = marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen;
|
|
@@ -6939,7 +7123,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
6939
7123
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
6940
7124
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
6941
7125
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
6942
|
-
|
|
7126
|
+
useEffect21(() => {
|
|
6943
7127
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
6944
7128
|
autoWidened.current = true;
|
|
6945
7129
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
@@ -7006,7 +7190,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7006
7190
|
] }),
|
|
7007
7191
|
view.legs > 1 ? /* @__PURE__ */ jsxs23("div", { className: "ss-w-v8-builder-ln ss-w-v8-builder-ln--total", children: [
|
|
7008
7192
|
/* @__PURE__ */ jsx25("span", { className: "ss-w-v8-builder-w", children: ui.v8BuilderTotal }),
|
|
7009
|
-
/* @__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(
|
|
7010
7194
|
"button",
|
|
7011
7195
|
{
|
|
7012
7196
|
type: "button",
|
|
@@ -7015,7 +7199,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory2, slip, spor
|
|
|
7015
7199
|
onClick: () => {
|
|
7016
7200
|
if (view.total !== t) ask({ ...view, total: t });
|
|
7017
7201
|
},
|
|
7018
|
-
children: totalLabel(t, ui)
|
|
7202
|
+
children: totalLabel(t, preset.totalOptions, oddsFormat, ui)
|
|
7019
7203
|
},
|
|
7020
7204
|
t
|
|
7021
7205
|
)) })
|
|
@@ -7135,7 +7319,7 @@ function oneCardPerGame(cards) {
|
|
|
7135
7319
|
var MAX_IDLE_TEAMS = 2;
|
|
7136
7320
|
function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, onAct }) {
|
|
7137
7321
|
const ctx = usePersonalGreeting();
|
|
7138
|
-
const [pickedGames, setPickedGames] =
|
|
7322
|
+
const [pickedGames, setPickedGames] = useState27(null);
|
|
7139
7323
|
const scope = useSportScope();
|
|
7140
7324
|
const controller = ctx?.favourites && ctx.favourites.status !== "idle" && (scope?.operatorUserId || scope?.anonymousUserId) ? ctx.favourites : null;
|
|
7141
7325
|
const teamCards = oneCardPerGame((personal.teamCards ?? []).filter(teamCardHasContent)).slice(0, MAX_TEAM_CARDS);
|
|
@@ -7174,12 +7358,12 @@ function PersonalGreeting({ personal, ui, slip, sport, starsElsewhere = false, o
|
|
|
7174
7358
|
...(personal.idleTeams ?? []).map((t) => t.label),
|
|
7175
7359
|
...(controller?.data?.teams ?? []).map((t) => t.name)
|
|
7176
7360
|
];
|
|
7177
|
-
const
|
|
7178
|
-
const factsBlock =
|
|
7361
|
+
const shown2 = shownFacts(personal, pickedGames);
|
|
7362
|
+
const factsBlock = shown2 && (shown2.facts.length > 0 || shown2.injury) ? /* @__PURE__ */ jsx28(
|
|
7179
7363
|
FactsBlock,
|
|
7180
7364
|
{
|
|
7181
|
-
facts:
|
|
7182
|
-
injury:
|
|
7365
|
+
facts: shown2.facts,
|
|
7366
|
+
injury: shown2.injury,
|
|
7183
7367
|
ui,
|
|
7184
7368
|
slip,
|
|
7185
7369
|
conversation: ctx?.conversation ?? null,
|
|
@@ -7264,12 +7448,13 @@ function initialSport(sets, defaultSport) {
|
|
|
7264
7448
|
}
|
|
7265
7449
|
function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSportChange, oddsLabel, liveLabel: liveLabel3, sportGroupLabel, ui, slip, onAct }) {
|
|
7266
7450
|
const log = useEventLog();
|
|
7451
|
+
const { oddsFormat } = useOddsSettings();
|
|
7267
7452
|
const scope = useSportScope();
|
|
7268
7453
|
const sets = switchSets(dashboards);
|
|
7269
|
-
const [selected, setSelected] =
|
|
7454
|
+
const [selected, setSelected] = useState28(() => initialSport(sets, defaultSport));
|
|
7270
7455
|
const active = sets?.find((s) => s.sport === selected) ?? null;
|
|
7271
|
-
const
|
|
7272
|
-
const personal =
|
|
7456
|
+
const shown2 = active ? active.dashboard : dashboard;
|
|
7457
|
+
const personal = shown2.personal;
|
|
7273
7458
|
const starsElsewhere = (sets ?? []).some((s) => (s.dashboard.personal?.ribbon?.stars.length ?? 0) > 0);
|
|
7274
7459
|
const select = (sport) => {
|
|
7275
7460
|
if (sport === selected) return;
|
|
@@ -7278,25 +7463,25 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, onTap, onSport
|
|
|
7278
7463
|
if (scope) writeSportChoice(scope.operatorId, encodedUserKey(scope.operatorUserId, scope.anonymousUserId), sport, Date.now());
|
|
7279
7464
|
log?.log({ name: "dashboard_sport_switch", outcome: sport });
|
|
7280
7465
|
};
|
|
7281
|
-
const layout = layoutClass(
|
|
7466
|
+
const layout = layoutClass(shown2.layout);
|
|
7282
7467
|
const badgePlacement = layout === LAYOUT_CLASSES.goal ? "end" : "meta";
|
|
7283
7468
|
return /* @__PURE__ */ jsxs27("div", { className: `ss-w-dash ${layout}`, children: [
|
|
7284
7469
|
sets ? /* @__PURE__ */ jsx29(SportSwitch, { sports: sets, selected, onSelect: select, liveLabel: liveLabel3, groupLabel: sportGroupLabel }) : null,
|
|
7285
7470
|
/* @__PURE__ */ jsxs27("div", { className: "ss-w-dash-head", children: [
|
|
7286
|
-
/* @__PURE__ */ jsx29("span", { className: "ss-w-dash-title", children:
|
|
7287
|
-
|
|
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
|
|
7288
7473
|
] }),
|
|
7289
|
-
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(
|
|
7290
7475
|
DashboardTile,
|
|
7291
7476
|
{
|
|
7292
|
-
tile: t,
|
|
7293
|
-
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),
|
|
7294
7479
|
oddsLabel,
|
|
7295
7480
|
badgePlacement
|
|
7296
7481
|
},
|
|
7297
7482
|
`${t.title}-${i}`
|
|
7298
7483
|
)) }),
|
|
7299
|
-
|
|
7484
|
+
shown2.footerTip ? /* @__PURE__ */ jsx29("span", { className: "ss-w-dash-foot", children: shown2.footerTip }) : null
|
|
7300
7485
|
] });
|
|
7301
7486
|
}
|
|
7302
7487
|
|
|
@@ -7377,6 +7562,7 @@ var WIRE_TO_PUBLIC = {
|
|
|
7377
7562
|
const e = entity(input);
|
|
7378
7563
|
return {
|
|
7379
7564
|
name: "combo_add_click",
|
|
7565
|
+
surface: "builder",
|
|
7380
7566
|
sport: e.metadata?.sport ?? e.sport ?? "",
|
|
7381
7567
|
legs: e.metadata?.legs ?? 0,
|
|
7382
7568
|
total: e.metadata?.totalChosen ?? String(e.metadata?.totalActual ?? "")
|
|
@@ -7396,11 +7582,11 @@ var WIRE_TO_PUBLIC = {
|
|
|
7396
7582
|
};
|
|
7397
7583
|
|
|
7398
7584
|
// src/popupTelemetry.ts
|
|
7399
|
-
import { useCallback as useCallback20, useEffect as
|
|
7585
|
+
import { useCallback as useCallback20, useEffect as useEffect22, useRef as useRef18 } from "react";
|
|
7400
7586
|
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7401
7587
|
const shownRef = useRef18(/* @__PURE__ */ new Set());
|
|
7402
7588
|
const closedTextRef = useRef18(null);
|
|
7403
|
-
|
|
7589
|
+
useEffect22(() => {
|
|
7404
7590
|
if (isOpen) {
|
|
7405
7591
|
if (closedTextRef.current) log?.log({ name: "popup_opened" });
|
|
7406
7592
|
closedTextRef.current = null;
|
|
@@ -7419,10 +7605,10 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7419
7605
|
}
|
|
7420
7606
|
|
|
7421
7607
|
// src/openTelemetry.ts
|
|
7422
|
-
import { useEffect as
|
|
7608
|
+
import { useEffect as useEffect23, useRef as useRef19 } from "react";
|
|
7423
7609
|
function useOpenTelemetry(log, isOpen) {
|
|
7424
7610
|
const openLoggedRef = useRef19(false);
|
|
7425
|
-
|
|
7611
|
+
useEffect23(() => {
|
|
7426
7612
|
if (!isOpen) {
|
|
7427
7613
|
openLoggedRef.current = false;
|
|
7428
7614
|
return;
|
|
@@ -7434,13 +7620,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7434
7620
|
}
|
|
7435
7621
|
|
|
7436
7622
|
// src/components/ChatFab.tsx
|
|
7437
|
-
import { useEffect as
|
|
7623
|
+
import { useEffect as useEffect24, useRef as useRef20, useState as useState30 } from "react";
|
|
7438
7624
|
|
|
7439
7625
|
// src/components/BrandMark.tsx
|
|
7440
|
-
import { useState as
|
|
7626
|
+
import { useState as useState29 } from "react";
|
|
7441
7627
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
7442
7628
|
function BrandMark({ logoUrl, className }) {
|
|
7443
|
-
const [failed, setFailed] =
|
|
7629
|
+
const [failed, setFailed] = useState29(false);
|
|
7444
7630
|
if (!logoUrl || failed) return /* @__PURE__ */ jsx30(SsMark, { className });
|
|
7445
7631
|
return /* @__PURE__ */ jsx30("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7446
7632
|
}
|
|
@@ -7477,9 +7663,9 @@ import { jsx as jsx32, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
|
7477
7663
|
function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup, dismissLabel = "Dismiss", introAllowed = false, onIntroStart, asks }) {
|
|
7478
7664
|
const bubble = popupText ?? greeting;
|
|
7479
7665
|
const track = useTrack();
|
|
7480
|
-
const [intro, setIntro] =
|
|
7666
|
+
const [intro, setIntro] = useState30(false);
|
|
7481
7667
|
const armedRef = useRef20(introAllowed);
|
|
7482
|
-
|
|
7668
|
+
useEffect24(() => {
|
|
7483
7669
|
if (armedRef.current && bubble) {
|
|
7484
7670
|
armedRef.current = false;
|
|
7485
7671
|
setIntro(true);
|
|
@@ -7499,10 +7685,10 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
7499
7685
|
}
|
|
7500
7686
|
|
|
7501
7687
|
// src/components/ChatPanel.tsx
|
|
7502
|
-
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";
|
|
7503
7689
|
|
|
7504
7690
|
// src/components/ChatHeader.tsx
|
|
7505
|
-
import { useEffect as
|
|
7691
|
+
import { useEffect as useEffect25, useRef as useRef21, useState as useState31 } from "react";
|
|
7506
7692
|
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7507
7693
|
function ChatHeader({
|
|
7508
7694
|
onClose,
|
|
@@ -7512,17 +7698,21 @@ function ChatHeader({
|
|
|
7512
7698
|
onNewConversation,
|
|
7513
7699
|
canReset,
|
|
7514
7700
|
newConversationLabel = "New conversation",
|
|
7515
|
-
moreOptionsLabel = "More options"
|
|
7701
|
+
moreOptionsLabel = "More options",
|
|
7702
|
+
onOpenSettings,
|
|
7703
|
+
settingsLabel = "Settings"
|
|
7516
7704
|
}) {
|
|
7517
|
-
const [menuOpen, setMenuOpen] =
|
|
7705
|
+
const [menuOpen, setMenuOpen] = useState31(false);
|
|
7518
7706
|
const wrapRef = useRef21(null);
|
|
7519
7707
|
const kebabRef = useRef21(null);
|
|
7520
7708
|
const firstItemRef = useRef21(null);
|
|
7521
|
-
const
|
|
7522
|
-
|
|
7709
|
+
const hasNew = !!(canReset && onNewConversation);
|
|
7710
|
+
const hasSettings = !!onOpenSettings;
|
|
7711
|
+
const hasMenu = hasNew || hasSettings;
|
|
7712
|
+
useEffect25(() => {
|
|
7523
7713
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7524
7714
|
}, [menuOpen]);
|
|
7525
|
-
|
|
7715
|
+
useEffect25(() => {
|
|
7526
7716
|
if (!menuOpen) return;
|
|
7527
7717
|
const onPointer = (e) => {
|
|
7528
7718
|
if (!wrapRef.current?.contains(e.target)) setMenuOpen(false);
|
|
@@ -7544,6 +7734,10 @@ function ChatHeader({
|
|
|
7544
7734
|
setMenuOpen(false);
|
|
7545
7735
|
onNewConversation?.();
|
|
7546
7736
|
};
|
|
7737
|
+
const runSettings = () => {
|
|
7738
|
+
setMenuOpen(false);
|
|
7739
|
+
onOpenSettings?.();
|
|
7740
|
+
};
|
|
7547
7741
|
return /* @__PURE__ */ jsxs30("header", { className: "ss-w-header", children: [
|
|
7548
7742
|
/* @__PURE__ */ jsx33(BrandMark, { logoUrl, className: "ss-w-header-mark" }),
|
|
7549
7743
|
/* @__PURE__ */ jsx33("span", { className: "ss-w-header-title", children: headerTitle ?? "SensibleStats" }),
|
|
@@ -7561,27 +7755,40 @@ function ChatHeader({
|
|
|
7561
7755
|
children: /* @__PURE__ */ jsx33(KebabIcon, {})
|
|
7562
7756
|
}
|
|
7563
7757
|
),
|
|
7564
|
-
menuOpen ? /* @__PURE__ */
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
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
|
|
7575
7782
|
] }) : null,
|
|
7576
7783
|
/* @__PURE__ */ jsx33("button", { type: "button", className: "ss-w-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx33(CloseIcon, {}) })
|
|
7577
7784
|
] });
|
|
7578
7785
|
}
|
|
7579
7786
|
|
|
7580
7787
|
// src/components/MessageList.tsx
|
|
7581
|
-
import { useEffect as
|
|
7788
|
+
import { useEffect as useEffect29, useRef as useRef24 } from "react";
|
|
7582
7789
|
|
|
7583
7790
|
// src/components/ChatMessage.tsx
|
|
7584
|
-
import { useState as
|
|
7791
|
+
import { useState as useState40 } from "react";
|
|
7585
7792
|
|
|
7586
7793
|
// src/components/Markdown.tsx
|
|
7587
7794
|
import ReactMarkdown from "react-markdown";
|
|
@@ -7599,7 +7806,7 @@ function Markdown({ text }) {
|
|
|
7599
7806
|
}
|
|
7600
7807
|
|
|
7601
7808
|
// src/components/EntityCardList.tsx
|
|
7602
|
-
import { useState as
|
|
7809
|
+
import { useState as useState32 } from "react";
|
|
7603
7810
|
import { jsx as jsx35, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7604
7811
|
var MAX_VISIBLE = 3;
|
|
7605
7812
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7683,7 +7890,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7683
7890
|
)) });
|
|
7684
7891
|
}
|
|
7685
7892
|
function EntityCardItem({ c }) {
|
|
7686
|
-
const [active, setActive] =
|
|
7893
|
+
const [active, setActive] = useState32(0);
|
|
7687
7894
|
const hasBody = c.scopes.length > 0;
|
|
7688
7895
|
if (!hasBody) {
|
|
7689
7896
|
return /* @__PURE__ */ jsx35("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ jsx35(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -7697,7 +7904,7 @@ function EntityCardItem({ c }) {
|
|
|
7697
7904
|
] });
|
|
7698
7905
|
}
|
|
7699
7906
|
function EntityCardList({ cards, disabled, showLessLabel = "Show less", showMoreLabel = (n) => `Show ${n} more` }) {
|
|
7700
|
-
const [expanded, setExpanded] =
|
|
7907
|
+
const [expanded, setExpanded] = useState32(false);
|
|
7701
7908
|
if (cards.length === 0) return null;
|
|
7702
7909
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7703
7910
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7736,6 +7943,9 @@ function CardFixture({ it }) {
|
|
|
7736
7943
|
return null;
|
|
7737
7944
|
}
|
|
7738
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;
|
|
7739
7949
|
const live = it.isLive || it.phase === "live";
|
|
7740
7950
|
const kickoffFallback = it.kickoffUtc && ui?.bettingKickoff ? ui.bettingKickoff(it.kickoffUtc) : void 0;
|
|
7741
7951
|
const kickoff = it.kickoffLabel ?? (kickoffFallback ? `${kickoffFallback.dayLabel} ${kickoffFallback.time}` : void 0);
|
|
@@ -7769,12 +7979,12 @@ function InsightCard({ it, ui, slip, monitor }) {
|
|
|
7769
7979
|
it.market ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-market", children: it.market }) : null,
|
|
7770
7980
|
/* @__PURE__ */ jsxs32("div", { className: "ss-w-bi-pick-row", children: [
|
|
7771
7981
|
it.selection ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-sel", children: it.selection }) : null,
|
|
7772
|
-
|
|
7773
|
-
/* @__PURE__ */ jsx36("b", { children:
|
|
7774
|
-
/* @__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 }),
|
|
7775
7985
|
it.bookmaker ? /* @__PURE__ */ jsx36("span", { className: "ss-w-bi-book", children: it.bookmaker }) : null
|
|
7776
7986
|
] }) : null,
|
|
7777
|
-
|
|
7987
|
+
odds && showPin && ui && previousOdds ? /* @__PURE__ */ jsx36(
|
|
7778
7988
|
PriceHistoryButton,
|
|
7779
7989
|
{
|
|
7780
7990
|
ui,
|
|
@@ -7796,10 +8006,10 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7796
8006
|
}
|
|
7797
8007
|
|
|
7798
8008
|
// src/nbaLineMove.ts
|
|
7799
|
-
function lineMoveEvents(ev) {
|
|
8009
|
+
function lineMoveEvents(ev, format2) {
|
|
7800
8010
|
const events = [];
|
|
7801
8011
|
for (const lane of [ev.spread, ev.total]) {
|
|
7802
|
-
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) });
|
|
7803
8013
|
}
|
|
7804
8014
|
for (const i of ev.injuries ?? []) events.push({ atUtc: i.atUtc, kind: "injury", text: i.text });
|
|
7805
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);
|
|
@@ -7846,28 +8056,28 @@ var oneDecimal = (n, ui) => n.toLocaleString(intlTag(ui), { minimumFractionDigit
|
|
|
7846
8056
|
var byDate = (games) => [...games].sort((a, b) => a.date < b.date ? -1 : a.date > b.date ? 1 : 0);
|
|
7847
8057
|
var canAdd = (vm, key, slip) => takesSport(slip, "basketball") && toNbaSlipSelection(vm, key, slip.conversationId) !== null;
|
|
7848
8058
|
function NbaPrice({ vm, selectionKey, label, ui, slip }) {
|
|
8059
|
+
const { oddsFormat } = useOddsSettings();
|
|
7849
8060
|
const s = selectionKey ? vm.selections[selectionKey] : void 0;
|
|
7850
8061
|
if (!s) return null;
|
|
7851
|
-
const
|
|
8062
|
+
const shown2 = formatOdds(s.priceFormats, oddsFormat);
|
|
7852
8063
|
const selection = takesSport(slip, "basketball") ? toNbaSlipSelection(vm, selectionKey, slip.conversationId) : null;
|
|
7853
8064
|
if (selection) {
|
|
7854
8065
|
return /* @__PURE__ */ jsx37(
|
|
7855
8066
|
SlipButton,
|
|
7856
8067
|
{
|
|
7857
8068
|
selection,
|
|
7858
|
-
shownOdds: shown,
|
|
7859
8069
|
marketDeveloperName: s.marketDeveloperName,
|
|
7860
8070
|
selectionLabel: s.selectionLabel,
|
|
7861
8071
|
line: s.line ?? void 0,
|
|
7862
8072
|
slip,
|
|
7863
8073
|
ui,
|
|
7864
|
-
price: { label, ariaLabel: `${s.selectionLabel}, ${
|
|
8074
|
+
price: { label, ariaLabel: `${s.selectionLabel}, ${shown2}` }
|
|
7865
8075
|
}
|
|
7866
8076
|
);
|
|
7867
8077
|
}
|
|
7868
8078
|
return /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-price", children: [
|
|
7869
8079
|
label ? /* @__PURE__ */ jsx37("span", { className: "ss-w-nba-price-lab", children: label }) : null,
|
|
7870
|
-
/* @__PURE__ */ jsx37("span", { children:
|
|
8080
|
+
/* @__PURE__ */ jsx37("span", { children: shown2 })
|
|
7871
8081
|
] });
|
|
7872
8082
|
}
|
|
7873
8083
|
function Head({ vm, chip, ui, monitor }) {
|
|
@@ -7926,11 +8136,12 @@ function PropReason({ vm, pr, ui, slip }) {
|
|
|
7926
8136
|
}
|
|
7927
8137
|
function Ladder({ vm, ld, ui, slip }) {
|
|
7928
8138
|
const nba = ui.nba;
|
|
8139
|
+
const { oddsFormat } = useOddsSettings();
|
|
7929
8140
|
return /* @__PURE__ */ jsx37(Fragment7, { children: ld.stats.map((st, si) => /* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stat", children: [
|
|
7930
8141
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-stathd", children: [
|
|
7931
8142
|
/* @__PURE__ */ jsx37("b", { children: nba.stat(st.stat) }),
|
|
7932
8143
|
st.mainLine ? /* @__PURE__ */ jsx37("span", { children: nba.mainLine(nba.lineText(st.mainLine)) }) : null,
|
|
7933
|
-
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
|
|
7934
8145
|
] }),
|
|
7935
8146
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-ladder", children: [
|
|
7936
8147
|
/* @__PURE__ */ jsxs33("div", { className: "ss-w-nba-row", children: [
|
|
@@ -8157,6 +8368,7 @@ var TOTAL_BOX = { x0: 38, x1: 310, y0: 28, y1: 74 };
|
|
|
8157
8368
|
var AXIS_Y = 90;
|
|
8158
8369
|
function LineMove({ vm, lm, ui, slip }) {
|
|
8159
8370
|
const nba = ui.nba;
|
|
8371
|
+
const { oddsFormat } = useOddsSettings();
|
|
8160
8372
|
const lanes = [];
|
|
8161
8373
|
if (lm.spread?.points.length) lanes.push({ lane: lm.spread, box: SPREAD_BOX, label: nba.spread, mod: "spread", side: "l" });
|
|
8162
8374
|
if (lm.total?.points.length) lanes.push({ lane: lm.total, box: TOTAL_BOX, label: nba.total, mod: "total", side: "r" });
|
|
@@ -8175,7 +8387,7 @@ function LineMove({ vm, lm, ui, slip }) {
|
|
|
8175
8387
|
const r = to > from ? (ms - from) / (to - from) : 0;
|
|
8176
8388
|
return SPREAD_BOX.x0 + Math.min(1, Math.max(0, r)) * (SPREAD_BOX.x1 - SPREAD_BOX.x0);
|
|
8177
8389
|
};
|
|
8178
|
-
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)));
|
|
8179
8391
|
const nowLabel = clock2(vm.quotedAtUtc);
|
|
8180
8392
|
return /* @__PURE__ */ jsxs33(Fragment7, { children: [
|
|
8181
8393
|
/* @__PURE__ */ jsx37("div", { className: "ss-w-nba-legend", children: lanes.map((l) => /* @__PURE__ */ jsxs33("span", { className: "ss-w-nba-legkey", children: [
|
|
@@ -8304,35 +8516,35 @@ function Badge({ abbr }) {
|
|
|
8304
8516
|
return /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-badge", children: abbr });
|
|
8305
8517
|
}
|
|
8306
8518
|
function Price({ vm, selection, label, ui, slip, nowMs }) {
|
|
8519
|
+
const { oddsFormat } = useOddsSettings();
|
|
8307
8520
|
if (!selection) return null;
|
|
8308
|
-
const
|
|
8521
|
+
const shown2 = formatOdds(selection.priceFormats, oddsFormat);
|
|
8309
8522
|
const slipSelection = takesSport(slip, "americanfootball") ? toNflSlipSelection(vm, selection.key, nowMs, slip.conversationId) : null;
|
|
8310
8523
|
const host = slip.onAddToSlip;
|
|
8311
8524
|
if (slipSelection && host) {
|
|
8312
8525
|
const guarded = {
|
|
8313
8526
|
...slip,
|
|
8314
|
-
onAddToSlip: () => {
|
|
8527
|
+
onAddToSlip: (outgoing) => {
|
|
8315
8528
|
const fresh = toNflSlipSelection(vm, selection.key, Date.now(), slip.conversationId);
|
|
8316
|
-
return fresh ? host(
|
|
8529
|
+
return fresh ? host(outgoing) : { status: "rejected", reason: "closed", message: ui.slipStarted };
|
|
8317
8530
|
}
|
|
8318
8531
|
};
|
|
8319
8532
|
return /* @__PURE__ */ jsx38(
|
|
8320
8533
|
SlipButton,
|
|
8321
8534
|
{
|
|
8322
8535
|
selection: slipSelection,
|
|
8323
|
-
shownOdds: shown,
|
|
8324
8536
|
marketDeveloperName: selection.marketDeveloperName,
|
|
8325
8537
|
selectionLabel: selection.selectionLabel,
|
|
8326
8538
|
line: selection.line ?? void 0,
|
|
8327
8539
|
slip: guarded,
|
|
8328
8540
|
ui,
|
|
8329
|
-
price: { label, ariaLabel: `${selection.selectionLabel}, ${
|
|
8541
|
+
price: { label, ariaLabel: `${selection.selectionLabel}, ${shown2}` }
|
|
8330
8542
|
}
|
|
8331
8543
|
);
|
|
8332
8544
|
}
|
|
8333
8545
|
return /* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-price", children: [
|
|
8334
8546
|
label ? /* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-price-lab", children: label }) : null,
|
|
8335
|
-
/* @__PURE__ */ jsx38("span", { children:
|
|
8547
|
+
/* @__PURE__ */ jsx38("span", { children: shown2 })
|
|
8336
8548
|
] });
|
|
8337
8549
|
}
|
|
8338
8550
|
function Head2({ vm, ui, monitor }) {
|
|
@@ -8430,6 +8642,7 @@ function InjuryReport({ ir, ui }) {
|
|
|
8430
8642
|
}
|
|
8431
8643
|
function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
8432
8644
|
const nfl = ui.nfl;
|
|
8645
|
+
const { oddsFormat } = useOddsSettings();
|
|
8433
8646
|
const who = (side) => {
|
|
8434
8647
|
if (side === "home") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.homeAbbr });
|
|
8435
8648
|
if (side === "away") return /* @__PURE__ */ jsx38(Badge, { abbr: vm.awayAbbr });
|
|
@@ -8445,10 +8658,10 @@ function LineMove2({ vm, lm, ui, slip, nowMs }) {
|
|
|
8445
8658
|
/* @__PURE__ */ jsxs34("span", { className: "ss-w-nfl-n ss-w-nfl-n--faint", children: [
|
|
8446
8659
|
l.openLine ?? "",
|
|
8447
8660
|
" \xB7 ",
|
|
8448
|
-
l.
|
|
8661
|
+
formatOdds(l.openPriceFormats, oddsFormat)
|
|
8449
8662
|
] }),
|
|
8450
8663
|
/* @__PURE__ */ jsx38("span", { className: "ss-w-nfl-n", children: l.line ?? "" }),
|
|
8451
|
-
/* @__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 } }) })
|
|
8452
8665
|
] }, `${l.market}:${l.side}`))
|
|
8453
8666
|
] });
|
|
8454
8667
|
}
|
|
@@ -8595,7 +8808,7 @@ function NflInsightList({ insights, ui, slip = {}, monitor }) {
|
|
|
8595
8808
|
}
|
|
8596
8809
|
|
|
8597
8810
|
// src/components/CompactOddsList.tsx
|
|
8598
|
-
import { useEffect as
|
|
8811
|
+
import { useEffect as useEffect26, useRef as useRef22, useState as useState33 } from "react";
|
|
8599
8812
|
import { mayPinOrSlip as mayPinOrSlip5, slipSportOf as slipSportOf6, sportOf as sportOf10 } from "@sensiblestats/widget-sdk";
|
|
8600
8813
|
|
|
8601
8814
|
// src/compactList.ts
|
|
@@ -8659,14 +8872,16 @@ function toCompactList(cards) {
|
|
|
8659
8872
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8660
8873
|
function Cell({ row, cell: cell2, ui, slip }) {
|
|
8661
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;
|
|
8662
8878
|
const slippable = vm.addToSlipEnabled && (!isNfl(vm.sport) || slipOpenFor(slip, vm.sport) && !nflStarted(vm, Date.now()));
|
|
8663
8879
|
const selection = slippable ? marketOddsRowToSlipSelection(vm, cell2.row, slip.conversationId) : null;
|
|
8664
|
-
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${
|
|
8880
|
+
const name = `${vm.homeTeamName ?? ""} ${vm.awayTeamName ?? ""}, ${cell2.row.selection} ${odds}`;
|
|
8665
8881
|
const button = /* @__PURE__ */ jsx39(
|
|
8666
8882
|
SlipButton,
|
|
8667
8883
|
{
|
|
8668
8884
|
selection,
|
|
8669
|
-
shownOdds: cell2.row.odds,
|
|
8670
8885
|
marketDeveloperName: vm.marketDeveloperName,
|
|
8671
8886
|
selectionLabel: cell2.row.selectionLabel,
|
|
8672
8887
|
line: cell2.row.line,
|
|
@@ -8678,13 +8893,13 @@ function Cell({ row, cell: cell2, ui, slip }) {
|
|
|
8678
8893
|
return (
|
|
8679
8894
|
// A third of the price column fits four characters at the row's size: 13.00 steps down a size
|
|
8680
8895
|
// and 101.00 two.
|
|
8681
|
-
/* @__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: [
|
|
8682
8897
|
selection && slip.onAddToSlip && ui ? button : /* @__PURE__ */ jsxs35("span", { className: "ss-w-mol-price", children: [
|
|
8683
8898
|
cell2.label ? /* @__PURE__ */ jsx39("span", { className: "ss-w-mol-lab", "aria-hidden": "true", children: cell2.label }) : null,
|
|
8684
|
-
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children:
|
|
8899
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", children: odds }),
|
|
8685
8900
|
/* @__PURE__ */ jsx39("span", { className: "ss-w-vh", children: name })
|
|
8686
8901
|
] }),
|
|
8687
|
-
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous
|
|
8902
|
+
/* @__PURE__ */ jsx39(OddsMovementBadge, { previous, current: odds, direction: cell2.row.movementDirection, ui })
|
|
8688
8903
|
] })
|
|
8689
8904
|
);
|
|
8690
8905
|
}
|
|
@@ -8715,14 +8930,14 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
8715
8930
|
] });
|
|
8716
8931
|
}
|
|
8717
8932
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
8718
|
-
const [
|
|
8719
|
-
const hidden = list.rowCount -
|
|
8720
|
-
const [focusIndex, setFocusIndex] =
|
|
8933
|
+
const [shown2, setShown] = useState33(COMPACT_PAGE);
|
|
8934
|
+
const hidden = list.rowCount - shown2;
|
|
8935
|
+
const [focusIndex, setFocusIndex] = useState33(null);
|
|
8721
8936
|
const focusRef = useRef22(null);
|
|
8722
|
-
|
|
8937
|
+
useEffect26(() => {
|
|
8723
8938
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
8724
8939
|
}, [focusIndex]);
|
|
8725
|
-
let left =
|
|
8940
|
+
let left = shown2;
|
|
8726
8941
|
let index = 0;
|
|
8727
8942
|
return /* @__PURE__ */ jsxs35("div", { className: "ss-w-mol", children: [
|
|
8728
8943
|
/* @__PURE__ */ jsxs35("div", { className: "ss-w-mol-head", children: [
|
|
@@ -8746,7 +8961,7 @@ function CompactOddsList({ list, ui, slip, monitor }) {
|
|
|
8746
8961
|
] }, `${group.competition ?? ""}:${gi}`);
|
|
8747
8962
|
}),
|
|
8748
8963
|
hidden > 0 ? /* @__PURE__ */ jsxs35("button", { type: "button", className: "ss-w-mo-more", onClick: () => {
|
|
8749
|
-
setFocusIndex(
|
|
8964
|
+
setFocusIndex(shown2);
|
|
8750
8965
|
setShown((n) => n + COMPACT_PAGE);
|
|
8751
8966
|
}, children: [
|
|
8752
8967
|
/* @__PURE__ */ jsx39("span", { children: ui?.showMore ? ui.showMore(Math.min(COMPACT_PAGE, hidden)) : `Show ${Math.min(COMPACT_PAGE, hidden)} more` }),
|
|
@@ -8765,9 +8980,13 @@ function directionWord(vm, ui) {
|
|
|
8765
8980
|
return "";
|
|
8766
8981
|
}
|
|
8767
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);
|
|
8768
8987
|
const word = directionWord(vm, ui);
|
|
8769
8988
|
const drift = word ? `, ${word}` : "";
|
|
8770
|
-
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}.`;
|
|
8771
8990
|
const showPin = !!monitor && vm.pinEnabled;
|
|
8772
8991
|
return /* @__PURE__ */ jsxs36("div", { className: "ss-w-omcard", children: [
|
|
8773
8992
|
/* @__PURE__ */ jsxs36("div", { className: "ss-w-om-head", children: [
|
|
@@ -8794,7 +9013,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8794
9013
|
vm.competition ? /* @__PURE__ */ jsx40("span", { className: "ss-w-om-comp", children: vm.competition }) : null
|
|
8795
9014
|
] }) : null,
|
|
8796
9015
|
/* @__PURE__ */ jsx40("div", { className: "ss-w-om-sel", children: vm.selection }),
|
|
8797
|
-
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous:
|
|
9016
|
+
/* @__PURE__ */ jsx40(OddsMovementBadge, { previous: opening, current, direction: vm.direction, ui }),
|
|
8798
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(
|
|
8799
9018
|
"svg",
|
|
8800
9019
|
{
|
|
@@ -8806,7 +9025,7 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8806
9025
|
children: [
|
|
8807
9026
|
vm.geometry.gridlines.map((g) => /* @__PURE__ */ jsxs36("g", { children: [
|
|
8808
9027
|
/* @__PURE__ */ jsx40("line", { className: "ss-w-om-grid", x1: 40, y1: g.y, x2: CHART_VIEW_W - 8, y2: g.y }),
|
|
8809
|
-
/* @__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) })
|
|
8810
9029
|
] }, g.price)),
|
|
8811
9030
|
/* @__PURE__ */ jsx40("path", { className: "ss-w-om-line", d: vm.geometry.path, fill: "none" }),
|
|
8812
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)),
|
|
@@ -8821,12 +9040,12 @@ function OddsMovementCard({ vm, ui, monitor }) {
|
|
|
8821
9040
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8822
9041
|
ui?.openingLabel ?? "Opening",
|
|
8823
9042
|
" ",
|
|
8824
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
9043
|
+
/* @__PURE__ */ jsx40("b", { children: opening })
|
|
8825
9044
|
] }),
|
|
8826
9045
|
/* @__PURE__ */ jsxs36("span", { children: [
|
|
8827
9046
|
ui?.currentLabel ?? "Current",
|
|
8828
9047
|
" ",
|
|
8829
|
-
/* @__PURE__ */ jsx40("b", { children:
|
|
9048
|
+
/* @__PURE__ */ jsx40("b", { children: current })
|
|
8830
9049
|
] })
|
|
8831
9050
|
] }),
|
|
8832
9051
|
vm.bookmaker ? /* @__PURE__ */ jsx40("div", { className: "ss-w-om-foot", children: /* @__PURE__ */ jsx40("span", { children: vm.bookmaker }) }) : null,
|
|
@@ -8944,7 +9163,7 @@ function FixtureCard({ card }) {
|
|
|
8944
9163
|
}
|
|
8945
9164
|
|
|
8946
9165
|
// src/components/dashboard/CountdownCard.tsx
|
|
8947
|
-
import { Fragment as Fragment12, useEffect as
|
|
9166
|
+
import { Fragment as Fragment12, useEffect as useEffect27, useState as useState34 } from "react";
|
|
8948
9167
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8949
9168
|
var DAY_MS = 864e5;
|
|
8950
9169
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -8963,12 +9182,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
8963
9182
|
function CountdownCard({ card }) {
|
|
8964
9183
|
const { data } = card;
|
|
8965
9184
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
8966
|
-
const [nowMs, setNowMs] =
|
|
8967
|
-
const [reduced] =
|
|
9185
|
+
const [nowMs, setNowMs] = useState34(() => Date.now());
|
|
9186
|
+
const [reduced] = useState34(
|
|
8968
9187
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
8969
9188
|
);
|
|
8970
9189
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS;
|
|
8971
|
-
|
|
9190
|
+
useEffect27(() => {
|
|
8972
9191
|
if (reduced) return;
|
|
8973
9192
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
8974
9193
|
return () => window.clearInterval(id);
|
|
@@ -8987,7 +9206,7 @@ function CountdownCard({ card }) {
|
|
|
8987
9206
|
}
|
|
8988
9207
|
|
|
8989
9208
|
// src/components/dashboard/InjuriesCard.tsx
|
|
8990
|
-
import { useState as
|
|
9209
|
+
import { useState as useState35 } from "react";
|
|
8991
9210
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8992
9211
|
var SHOWN = 3;
|
|
8993
9212
|
function ColHead({ name, crestUrl }) {
|
|
@@ -8998,8 +9217,8 @@ function ColHead({ name, crestUrl }) {
|
|
|
8998
9217
|
}
|
|
8999
9218
|
function InjuryList({ rows, emptyLabel, limit }) {
|
|
9000
9219
|
if (rows.length === 0) return /* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injuries-empty", children: emptyLabel });
|
|
9001
|
-
const
|
|
9002
|
-
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: [
|
|
9003
9222
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-name", children: r.playerName }),
|
|
9004
9223
|
/* @__PURE__ */ jsxs40("span", { className: "ss-w-fandash-injury-meta", children: [
|
|
9005
9224
|
/* @__PURE__ */ jsx44("span", { className: "ss-w-fandash-injury-status", children: r.status }),
|
|
@@ -9010,7 +9229,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9010
9229
|
}
|
|
9011
9230
|
function InjuriesCard({ card, ui }) {
|
|
9012
9231
|
const { data } = card;
|
|
9013
|
-
const [expanded, setExpanded] =
|
|
9232
|
+
const [expanded, setExpanded] = useState35(false);
|
|
9014
9233
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9015
9234
|
const limit = expanded ? void 0 : SHOWN;
|
|
9016
9235
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
@@ -9116,7 +9335,7 @@ function LinksCard({ card }) {
|
|
|
9116
9335
|
}
|
|
9117
9336
|
|
|
9118
9337
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9119
|
-
import { useState as
|
|
9338
|
+
import { useState as useState36 } from "react";
|
|
9120
9339
|
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9121
9340
|
function initials3(name) {
|
|
9122
9341
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9126,7 +9345,7 @@ function PostMatchCrest({
|
|
|
9126
9345
|
name,
|
|
9127
9346
|
side
|
|
9128
9347
|
}) {
|
|
9129
|
-
const [failed, setFailed] =
|
|
9348
|
+
const [failed, setFailed] = useState36(false);
|
|
9130
9349
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9131
9350
|
if (url && !failed) {
|
|
9132
9351
|
return /* @__PURE__ */ jsx50("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9325,10 +9544,10 @@ function RestingFormCard({ card }) {
|
|
|
9325
9544
|
}
|
|
9326
9545
|
|
|
9327
9546
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9328
|
-
import { useRef as useRef23, useState as
|
|
9547
|
+
import { useRef as useRef23, useState as useState38 } from "react";
|
|
9329
9548
|
|
|
9330
9549
|
// src/useLiveClock.ts
|
|
9331
|
-
import { useEffect as
|
|
9550
|
+
import { useEffect as useEffect28, useState as useState37 } from "react";
|
|
9332
9551
|
var TICK_MS = 6e4;
|
|
9333
9552
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9334
9553
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9337,10 +9556,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9337
9556
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9338
9557
|
}
|
|
9339
9558
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9340
|
-
const [displayMinute, setDisplayMinute] =
|
|
9559
|
+
const [displayMinute, setDisplayMinute] = useState37(
|
|
9341
9560
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9342
9561
|
);
|
|
9343
|
-
|
|
9562
|
+
useEffect28(() => {
|
|
9344
9563
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9345
9564
|
if (!clockRunning) return;
|
|
9346
9565
|
const id = window.setInterval(() => {
|
|
@@ -9357,7 +9576,7 @@ function initials5(name) {
|
|
|
9357
9576
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9358
9577
|
}
|
|
9359
9578
|
function LiveCrest({ url, name, side }) {
|
|
9360
|
-
const [failed, setFailed] =
|
|
9579
|
+
const [failed, setFailed] = useState38(false);
|
|
9361
9580
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9362
9581
|
if (url && !failed) {
|
|
9363
9582
|
return /* @__PURE__ */ jsx59("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9425,7 +9644,7 @@ function LiveScoreCard({
|
|
|
9425
9644
|
}
|
|
9426
9645
|
|
|
9427
9646
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
9428
|
-
import { useState as
|
|
9647
|
+
import { useState as useState39 } from "react";
|
|
9429
9648
|
import { jsx as jsx60, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
9430
9649
|
var SHOWN2 = 3;
|
|
9431
9650
|
function EventIcon({ type }) {
|
|
@@ -9467,17 +9686,17 @@ function EventRow({ e }) {
|
|
|
9467
9686
|
] });
|
|
9468
9687
|
}
|
|
9469
9688
|
function LiveTimelineCard({ card, ui }) {
|
|
9470
|
-
const [expanded, setExpanded] =
|
|
9689
|
+
const [expanded, setExpanded] = useState39(false);
|
|
9471
9690
|
const events = card.data.events;
|
|
9472
9691
|
if (!events || events.length === 0) return null;
|
|
9473
9692
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
9474
9693
|
const rest = sorted.length - SHOWN2;
|
|
9475
|
-
const
|
|
9694
|
+
const shown2 = expanded ? sorted : sorted.slice(0, SHOWN2);
|
|
9476
9695
|
const showMore = ui?.showMore ?? ((n) => `Show ${n} more`);
|
|
9477
9696
|
const showLess = ui?.showLess ?? "Show less";
|
|
9478
9697
|
return /* @__PURE__ */ jsxs56("div", { className: "ss-w-fandash-card ss-w-fandash-live-timeline", children: [
|
|
9479
9698
|
card.title ? /* @__PURE__ */ jsx60("span", { className: "ss-w-fandash-eyebrow", children: card.title }) : null,
|
|
9480
|
-
/* @__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}`)) }),
|
|
9481
9700
|
rest > 0 ? /* @__PURE__ */ jsx60(
|
|
9482
9701
|
"button",
|
|
9483
9702
|
{
|
|
@@ -9666,7 +9885,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
9666
9885
|
// src/components/ChatMessage.tsx
|
|
9667
9886
|
import { jsx as jsx64, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
9668
9887
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor }) {
|
|
9669
|
-
const [sport, setSport] =
|
|
9888
|
+
const [sport, setSport] = useState40(null);
|
|
9670
9889
|
if (message.role === "user") {
|
|
9671
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 }) });
|
|
9672
9891
|
}
|
|
@@ -9715,11 +9934,12 @@ function turnAnchor(messages) {
|
|
|
9715
9934
|
}
|
|
9716
9935
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
9717
9936
|
const { state, send } = controller;
|
|
9937
|
+
const { oddsFormat } = useOddsSettings();
|
|
9718
9938
|
const listRef = useRef24(null);
|
|
9719
9939
|
const endRef = useRef24(null);
|
|
9720
9940
|
const pinnedRef = useRef24(true);
|
|
9721
9941
|
const anchoredTurnRef = useRef24(null);
|
|
9722
|
-
|
|
9942
|
+
useEffect29(() => {
|
|
9723
9943
|
const anchor = turnAnchor(state.messages);
|
|
9724
9944
|
const list = listRef.current;
|
|
9725
9945
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -9751,8 +9971,9 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9751
9971
|
disabled: state.isStreaming || isPaused(state.limit),
|
|
9752
9972
|
onAct: (a) => send(a.message, { actionId: a.actionId, actionRef: a.actionRef, displayText: a.label, source: "action" }),
|
|
9753
9973
|
onTap: (tile, index, onScreen) => {
|
|
9754
|
-
const
|
|
9755
|
-
|
|
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" });
|
|
9756
9977
|
if (m.role === "assistant" && m.greetingDashboard) onDashboardTap?.(tile, index, onScreen?.layout ?? m.greetingDashboard.layout, onScreen?.sport);
|
|
9757
9978
|
},
|
|
9758
9979
|
ui,
|
|
@@ -9776,10 +9997,10 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9776
9997
|
}
|
|
9777
9998
|
|
|
9778
9999
|
// src/components/ChatInput.tsx
|
|
9779
|
-
import { forwardRef, useEffect as
|
|
10000
|
+
import { forwardRef, useEffect as useEffect30, useImperativeHandle, useRef as useRef25, useState as useState41 } from "react";
|
|
9780
10001
|
import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
9781
10002
|
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false, onType }, ref) {
|
|
9782
|
-
const [value, setValue] =
|
|
10003
|
+
const [value, setValue] = useState41("");
|
|
9783
10004
|
const textareaRef = useRef25(null);
|
|
9784
10005
|
const stopRef = useRef25(null);
|
|
9785
10006
|
const textBoxWantsFocusRef = useRef25(false);
|
|
@@ -9808,7 +10029,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9808
10029
|
stopRef.current?.focus();
|
|
9809
10030
|
}
|
|
9810
10031
|
}), []);
|
|
9811
|
-
|
|
10032
|
+
useEffect30(() => {
|
|
9812
10033
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
9813
10034
|
textBoxWantsFocusRef.current = false;
|
|
9814
10035
|
const box = textareaRef.current;
|
|
@@ -9840,7 +10061,7 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
9840
10061
|
});
|
|
9841
10062
|
|
|
9842
10063
|
// src/components/TabBar.tsx
|
|
9843
|
-
import { useEffect as
|
|
10064
|
+
import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect2, useRef as useRef26 } from "react";
|
|
9844
10065
|
import { Fragment as Fragment14, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
9845
10066
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true]];
|
|
9846
10067
|
function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -9861,7 +10082,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9861
10082
|
const track = useTrack();
|
|
9862
10083
|
const listRef = useRef26(null);
|
|
9863
10084
|
const activeTab = monitor.activeTab;
|
|
9864
|
-
|
|
10085
|
+
useEffect31(() => {
|
|
9865
10086
|
const el = listRef.current?.querySelector("[data-on]");
|
|
9866
10087
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
9867
10088
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -9922,7 +10143,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, todayCount, hasToday, ga
|
|
|
9922
10143
|
}
|
|
9923
10144
|
|
|
9924
10145
|
// src/components/MonitorTabs.tsx
|
|
9925
|
-
import { useMemo as
|
|
10146
|
+
import { useMemo as useMemo8 } from "react";
|
|
9926
10147
|
|
|
9927
10148
|
// src/components/MarketAccordion.tsx
|
|
9928
10149
|
import { slipSportOf as slipSportOf7 } from "@sensiblestats/widget-sdk";
|
|
@@ -9984,13 +10205,15 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
9984
10205
|
}
|
|
9985
10206
|
|
|
9986
10207
|
// src/components/LiveFactBlock.tsx
|
|
9987
|
-
import { useState as
|
|
10208
|
+
import { useState as useState42 } from "react";
|
|
9988
10209
|
import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
9989
10210
|
function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
9990
|
-
const [expanded, setExpanded] =
|
|
10211
|
+
const [expanded, setExpanded] = useState42(false);
|
|
10212
|
+
const { oddsFormat } = useOddsSettings();
|
|
9991
10213
|
const [current, ...earlier] = facts;
|
|
9992
10214
|
if (!current) return null;
|
|
9993
10215
|
const m = current.market;
|
|
10216
|
+
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
9994
10217
|
return /* @__PURE__ */ jsxs65("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
9995
10218
|
/* @__PURE__ */ jsxs65("div", { className: "ss-w-fact-k", children: [
|
|
9996
10219
|
/* @__PURE__ */ jsx70("span", { children: ui.liveFactLabel }),
|
|
@@ -10009,12 +10232,11 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10009
10232
|
chipSelectionText(m)
|
|
10010
10233
|
] }),
|
|
10011
10234
|
/* @__PURE__ */ jsxs65("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10012
|
-
|
|
10235
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx70("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10013
10236
|
/* @__PURE__ */ jsx70(
|
|
10014
10237
|
SlipButton,
|
|
10015
10238
|
{
|
|
10016
10239
|
selection: chipSelection(m, matchId, slip.conversationId),
|
|
10017
|
-
shownOdds: typeof m.price === "number" ? m.price.toFixed(2) : "",
|
|
10018
10240
|
marketDeveloperName: m.marketDeveloperName,
|
|
10019
10241
|
selectionLabel: m.selectionLabel,
|
|
10020
10242
|
slip,
|
|
@@ -10055,7 +10277,7 @@ function LiveFactBlock({ facts, matchId, ui, slip, onAsk }) {
|
|
|
10055
10277
|
}
|
|
10056
10278
|
|
|
10057
10279
|
// src/components/MonitorFormH2H.tsx
|
|
10058
|
-
import { useState as
|
|
10280
|
+
import { useState as useState43 } from "react";
|
|
10059
10281
|
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
10060
10282
|
function resultClass2(result) {
|
|
10061
10283
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10071,7 +10293,7 @@ function FormDots({ form, ui }) {
|
|
|
10071
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)) });
|
|
10072
10294
|
}
|
|
10073
10295
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10074
|
-
const [expanded, setExpanded] =
|
|
10296
|
+
const [expanded, setExpanded] = useState43(false);
|
|
10075
10297
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10076
10298
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10077
10299
|
return /* @__PURE__ */ jsx71(Fragment15, {});
|
|
@@ -10176,6 +10398,7 @@ function groupScorers(goals, ownGoalLabel) {
|
|
|
10176
10398
|
});
|
|
10177
10399
|
}
|
|
10178
10400
|
function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
10401
|
+
const { oddsFormat } = useOddsSettings();
|
|
10179
10402
|
const live = match.phase === "live";
|
|
10180
10403
|
const goals = match.events.filter((e) => e.type === "goal");
|
|
10181
10404
|
const homeScorers = groupScorers(goals.filter((e) => e.side === "home"), ui.ownGoalLabel);
|
|
@@ -10234,6 +10457,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10234
10457
|
const { home, away } = splitWidths2(row.homeNum, row.awayNum);
|
|
10235
10458
|
const promoted = isPromoted(row, promotedPins);
|
|
10236
10459
|
const selection = chipSelection(row.market, match.matchId, slip.conversationId);
|
|
10460
|
+
const chipPrice = row.market ? chipPriceText(row.market, oddsFormat) : void 0;
|
|
10237
10461
|
return /* @__PURE__ */ jsxs67("div", { className: promoted ? "ss-w-mon-stat ss-w-mon-pstrip" : "ss-w-mon-stat", children: [
|
|
10238
10462
|
/* @__PURE__ */ jsxs67("div", { className: "ss-w-mon-stat-row", children: [
|
|
10239
10463
|
/* @__PURE__ */ jsx72("span", { className: "ss-w-mon-stat-v ss-w-mon-stat-v--home", children: row.homeValue }),
|
|
@@ -10251,12 +10475,11 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10251
10475
|
chipSelectionText(row.market)
|
|
10252
10476
|
] }),
|
|
10253
10477
|
/* @__PURE__ */ jsxs67("span", { className: "ss-w-mon-stat-mkt-right", children: [
|
|
10254
|
-
|
|
10478
|
+
chipPrice !== void 0 && /* @__PURE__ */ jsx72("span", { className: "ss-w-mon-price", children: chipPrice }),
|
|
10255
10479
|
/* @__PURE__ */ jsx72(
|
|
10256
10480
|
SlipButton,
|
|
10257
10481
|
{
|
|
10258
10482
|
selection,
|
|
10259
|
-
shownOdds: typeof row.market.price === "number" ? row.market.price.toFixed(2) : "",
|
|
10260
10483
|
marketDeveloperName: row.market.marketDeveloperName,
|
|
10261
10484
|
selectionLabel: row.market.selectionLabel,
|
|
10262
10485
|
slip,
|
|
@@ -10302,10 +10525,10 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
10302
10525
|
import { SPORTS as SPORTS6 } from "@sensiblestats/widget-sdk";
|
|
10303
10526
|
|
|
10304
10527
|
// src/components/NbaPropsSection.tsx
|
|
10305
|
-
import { useState as
|
|
10528
|
+
import { useState as useState45 } from "react";
|
|
10306
10529
|
|
|
10307
10530
|
// src/components/PropsPieces.tsx
|
|
10308
|
-
import { useEffect as
|
|
10531
|
+
import { useEffect as useEffect32, useState as useState44 } from "react";
|
|
10309
10532
|
import { Fragment as Fragment16, jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
10310
10533
|
var MAX_TIMER_MS = 2147483647;
|
|
10311
10534
|
var hasMainLine = (s) => s.over != null || s.under != null;
|
|
@@ -10315,9 +10538,9 @@ function preKickoff(match) {
|
|
|
10315
10538
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
10316
10539
|
}
|
|
10317
10540
|
function usePreKickoff(match) {
|
|
10318
|
-
const [, setTick] =
|
|
10541
|
+
const [, setTick] = useState44(0);
|
|
10319
10542
|
const pre = preKickoff(match);
|
|
10320
|
-
|
|
10543
|
+
useEffect32(() => {
|
|
10321
10544
|
if (!pre || !match.kickoffUtc) return;
|
|
10322
10545
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
10323
10546
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -10330,7 +10553,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10330
10553
|
const pre = usePreKickoff(match);
|
|
10331
10554
|
const live = descriptor.sport === "basketball" && match.phase === "live";
|
|
10332
10555
|
const open = pre || live;
|
|
10333
|
-
|
|
10556
|
+
useEffect32(() => {
|
|
10334
10557
|
if (!open) return;
|
|
10335
10558
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
10336
10559
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -10338,12 +10561,14 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
10338
10561
|
return { bundle: monitor.playerProps?.[monitorMatchKey(sport, match.matchId)]?.bundle, live, open };
|
|
10339
10562
|
}
|
|
10340
10563
|
function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip }) {
|
|
10341
|
-
const
|
|
10564
|
+
const { oddsFormat } = useOddsSettings();
|
|
10565
|
+
const shown2 = formatOdds(price.priceFormats, oddsFormat);
|
|
10342
10566
|
if (bundle.addToSlipEnabled && takesSport(slip, descriptor.sport)) {
|
|
10343
10567
|
const selection = {
|
|
10344
10568
|
matchOddsId: price.matchOddsId,
|
|
10345
10569
|
matchId: bundle.matchId,
|
|
10346
10570
|
oddsDecimal: price.price,
|
|
10571
|
+
forms: price.priceFormats,
|
|
10347
10572
|
quotedAtUtc: price.quotedAtUtc,
|
|
10348
10573
|
sport: descriptor.sport
|
|
10349
10574
|
};
|
|
@@ -10352,19 +10577,18 @@ function PropPrice({ price, label, ariaName, stat, bundle, descriptor, ui, slip
|
|
|
10352
10577
|
SlipButton,
|
|
10353
10578
|
{
|
|
10354
10579
|
selection,
|
|
10355
|
-
shownOdds: shown,
|
|
10356
10580
|
marketDeveloperName: stat.marketDeveloperName,
|
|
10357
10581
|
selectionLabel: price.label,
|
|
10358
10582
|
line: price.line != null ? String(price.line) : void 0,
|
|
10359
10583
|
slip,
|
|
10360
10584
|
ui,
|
|
10361
|
-
price: { label, ariaLabel: `${ariaName ?? label}, ${
|
|
10585
|
+
price: { label, ariaLabel: `${ariaName ?? label}, ${shown2}` }
|
|
10362
10586
|
}
|
|
10363
10587
|
);
|
|
10364
10588
|
}
|
|
10365
10589
|
return /* @__PURE__ */ jsxs69("span", { className: "ss-w-props-price", children: [
|
|
10366
10590
|
label !== "" && /* @__PURE__ */ jsx74("span", { className: "ss-w-props-price-lab", children: label }),
|
|
10367
|
-
/* @__PURE__ */ jsx74("span", { children:
|
|
10591
|
+
/* @__PURE__ */ jsx74("span", { children: shown2 })
|
|
10368
10592
|
] });
|
|
10369
10593
|
}
|
|
10370
10594
|
function PriceCell({ hitsText, children }) {
|
|
@@ -10400,7 +10624,7 @@ function PropBars({ bars, line, title, wide, ui }) {
|
|
|
10400
10624
|
}
|
|
10401
10625
|
function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
10402
10626
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
10403
|
-
const [picked, setPicked] =
|
|
10627
|
+
const [picked, setPicked] = useState44(null);
|
|
10404
10628
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
10405
10629
|
const sample = active?.games?.length ?? 0;
|
|
10406
10630
|
const hitsOf = (price, text) => descriptor.showHits && sample > 0 && price.hits != null ? text(price.hits) : null;
|
|
@@ -10439,7 +10663,7 @@ function PropPlayerPanel({ player, bundle, descriptor, ui, slip }) {
|
|
|
10439
10663
|
] });
|
|
10440
10664
|
}
|
|
10441
10665
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
10442
|
-
const [openId, setOpenId] =
|
|
10666
|
+
const [openId, setOpenId] = useState44(null);
|
|
10443
10667
|
return /* @__PURE__ */ jsx74("div", { className: "ss-w-props-list", children: players.map((p) => {
|
|
10444
10668
|
const isOpen = openId === p.playerId;
|
|
10445
10669
|
const main = descriptor.mainStat(p);
|
|
@@ -10492,21 +10716,21 @@ var nbaDescriptor = (ui) => ({
|
|
|
10492
10716
|
tenGameBars: false
|
|
10493
10717
|
});
|
|
10494
10718
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
10495
|
-
const [side, setSide] =
|
|
10719
|
+
const [side, setSide] = useState45("home");
|
|
10496
10720
|
const descriptor = nbaDescriptor(ui);
|
|
10497
10721
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
10498
10722
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
10499
10723
|
const bySide = (s) => bundle.players.filter((p) => p.side === s);
|
|
10500
10724
|
const other = side === "home" ? "away" : "home";
|
|
10501
|
-
const
|
|
10725
|
+
const shown2 = bySide(side).length > 0 ? side : other;
|
|
10502
10726
|
const sides = [
|
|
10503
10727
|
{ side: "home", abbreviation: bundle.homeAbbreviation },
|
|
10504
10728
|
{ side: "away", abbreviation: bundle.awayAbbreviation }
|
|
10505
10729
|
];
|
|
10506
10730
|
return /* @__PURE__ */ jsxs70("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10507
10731
|
/* @__PURE__ */ jsx75("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10508
|
-
/* @__PURE__ */ jsx75("div", { className: "ss-w-props-seg", children: sides.map((s) => /* @__PURE__ */ jsx75("button", { type: "button", className: "ss-w-props-side", "aria-pressed":
|
|
10509
|
-
/* @__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)
|
|
10510
10734
|
] });
|
|
10511
10735
|
}
|
|
10512
10736
|
|
|
@@ -10636,7 +10860,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10636
10860
|
}
|
|
10637
10861
|
|
|
10638
10862
|
// src/components/NflFormSection.tsx
|
|
10639
|
-
import { useState as
|
|
10863
|
+
import { useState as useState46 } from "react";
|
|
10640
10864
|
import { Fragment as Fragment18, jsx as jsx77, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
10641
10865
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
10642
10866
|
var signedSpread = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -10688,7 +10912,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
10688
10912
|
] });
|
|
10689
10913
|
}
|
|
10690
10914
|
function NflFormSection({ match, monitor, ui }) {
|
|
10691
|
-
const [segment, setSegment] =
|
|
10915
|
+
const [segment, setSegment] = useState46("away");
|
|
10692
10916
|
const pre = usePreKickoff(match);
|
|
10693
10917
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
10694
10918
|
const form = bundle?.form;
|
|
@@ -10721,7 +10945,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
10721
10945
|
}
|
|
10722
10946
|
|
|
10723
10947
|
// src/components/NflPropsSection.tsx
|
|
10724
|
-
import { useState as
|
|
10948
|
+
import { useState as useState47 } from "react";
|
|
10725
10949
|
import { Fragment as Fragment19, jsx as jsx78, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
10726
10950
|
var TRENDS_SHOWN = 3;
|
|
10727
10951
|
var SCORERS_SHOWN = 8;
|
|
@@ -10789,11 +11013,11 @@ function ShowMore({ label, onClick }) {
|
|
|
10789
11013
|
return /* @__PURE__ */ jsx78("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
10790
11014
|
}
|
|
10791
11015
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
10792
|
-
const [all, setAll] =
|
|
10793
|
-
const
|
|
11016
|
+
const [all, setAll] = useState47(false);
|
|
11017
|
+
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
10794
11018
|
return /* @__PURE__ */ jsxs73("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
10795
11019
|
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
10796
|
-
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children:
|
|
11020
|
+
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-list", children: shown2.map((f, i) => {
|
|
10797
11021
|
const long = LONG_KEYS[f.stat];
|
|
10798
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)}`;
|
|
10799
11023
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-fact", children: [
|
|
@@ -10822,8 +11046,8 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
10822
11046
|
] });
|
|
10823
11047
|
}
|
|
10824
11048
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
10825
|
-
const [all, setAll] =
|
|
10826
|
-
const
|
|
11049
|
+
const [all, setAll] = useState47(false);
|
|
11050
|
+
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
10827
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" });
|
|
10828
11052
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorers", children: [
|
|
10829
11053
|
/* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer ss-w-props-scorer-head", children: [
|
|
@@ -10832,7 +11056,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10832
11056
|
/* @__PURE__ */ jsx78("span", { children: "2+" }),
|
|
10833
11057
|
/* @__PURE__ */ jsx78("span", { children: ui.nfl.propsFirst })
|
|
10834
11058
|
] }),
|
|
10835
|
-
|
|
11059
|
+
shown2.map((s) => {
|
|
10836
11060
|
const sample = s.anytimeStat.games?.length ?? 0;
|
|
10837
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];
|
|
10838
11062
|
return /* @__PURE__ */ jsxs73("div", { className: "ss-w-props-scorer", children: [
|
|
@@ -10849,7 +11073,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
10849
11073
|
] });
|
|
10850
11074
|
}
|
|
10851
11075
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
10852
|
-
const [tab, setTab] =
|
|
11076
|
+
const [tab, setTab] = useState47(null);
|
|
10853
11077
|
const descriptor = nflDescriptor(ui);
|
|
10854
11078
|
const { bundle, open } = usePropsOpen(match, monitor, descriptor);
|
|
10855
11079
|
if (!open || !bundle || bundle.players.length === 0) return null;
|
|
@@ -10863,13 +11087,13 @@ function NflPropsSection({ match, monitor, ui, slip }) {
|
|
|
10863
11087
|
...scorers.length > 0 ? [{ key: "td", label: ui.nfl.propsScorers }] : []
|
|
10864
11088
|
];
|
|
10865
11089
|
const firstWithContent = roster("away").length > 0 ? "away" : roster("home").length > 0 ? "home" : scorers.length > 0 ? "td" : "away";
|
|
10866
|
-
const
|
|
11090
|
+
const shown2 = tab && tabs.some((t) => t.key === tab) ? tab : firstWithContent;
|
|
10867
11091
|
return /* @__PURE__ */ jsxs73(Fragment19, { children: [
|
|
10868
11092
|
facts.length > 0 && /* @__PURE__ */ jsx78(Trends, { bundle, facts, descriptor, ui, slip }),
|
|
10869
11093
|
/* @__PURE__ */ jsxs73("section", { className: "ss-w-props", lang: ui.locale, children: [
|
|
10870
11094
|
/* @__PURE__ */ jsx78("div", { className: "ss-w-props-head", children: ui.nba.propsTitle }),
|
|
10871
|
-
/* @__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":
|
|
10872
|
-
|
|
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)
|
|
10873
11097
|
] })
|
|
10874
11098
|
] });
|
|
10875
11099
|
}
|
|
@@ -10954,7 +11178,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
10954
11178
|
}
|
|
10955
11179
|
|
|
10956
11180
|
// src/components/ScoreboardStrip.tsx
|
|
10957
|
-
import { useEffect as
|
|
11181
|
+
import { useEffect as useEffect33, useRef as useRef27 } from "react";
|
|
10958
11182
|
import { SPORTS as SPORTS7, sportOf as sportOf11 } from "@sensiblestats/widget-sdk";
|
|
10959
11183
|
import { jsx as jsx80, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
10960
11184
|
function nbaStatus(m, ui) {
|
|
@@ -11030,7 +11254,7 @@ function rowsFor(m) {
|
|
|
11030
11254
|
}
|
|
11031
11255
|
function ScoreboardStrip({ tiles, selectedKey, onSelect, ui }) {
|
|
11032
11256
|
const stripRef = useRef27(null);
|
|
11033
|
-
|
|
11257
|
+
useEffect33(() => {
|
|
11034
11258
|
const strip = stripRef.current;
|
|
11035
11259
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
11036
11260
|
if (!strip || !pressed) return;
|
|
@@ -11142,7 +11366,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
11142
11366
|
] });
|
|
11143
11367
|
}
|
|
11144
11368
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
11145
|
-
const seedIndex =
|
|
11369
|
+
const seedIndex = useMemo8(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
11146
11370
|
const tiles = orderTiles(
|
|
11147
11371
|
monitor.pins,
|
|
11148
11372
|
monitor.snapshot,
|
|
@@ -11174,11 +11398,11 @@ function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
|
11174
11398
|
}
|
|
11175
11399
|
function withSinceViewMovement(vm, prev) {
|
|
11176
11400
|
const primary = vm.mainRows[0];
|
|
11177
|
-
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;
|
|
11178
11402
|
const updatedPrimary = {
|
|
11179
11403
|
...primary,
|
|
11180
|
-
|
|
11181
|
-
movementDirection: primary.oddsDecimal < prev ? "shortened" : "drifted"
|
|
11404
|
+
previousPriceForms: prev.forms,
|
|
11405
|
+
movementDirection: primary.oddsDecimal < prev.value ? "shortened" : "drifted"
|
|
11182
11406
|
};
|
|
11183
11407
|
return { ...vm, mainRows: [updatedPrimary, ...vm.mainRows.slice(1)] };
|
|
11184
11408
|
}
|
|
@@ -11208,7 +11432,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
11208
11432
|
}
|
|
11209
11433
|
|
|
11210
11434
|
// src/components/TodayPanel.tsx
|
|
11211
|
-
import { useEffect as
|
|
11435
|
+
import { useEffect as useEffect35, useId as useId2, useMemo as useMemo9, useState as useState50 } from "react";
|
|
11212
11436
|
import { matchKey as matchKey7 } from "@sensiblestats/widget-sdk";
|
|
11213
11437
|
|
|
11214
11438
|
// src/placement.ts
|
|
@@ -11273,9 +11497,9 @@ function matchingFixtures(group, query) {
|
|
|
11273
11497
|
}
|
|
11274
11498
|
|
|
11275
11499
|
// src/useStarTap.ts
|
|
11276
|
-
import { useCallback as useCallback21, useRef as useRef28, useState as
|
|
11500
|
+
import { useCallback as useCallback21, useRef as useRef28, useState as useState48 } from "react";
|
|
11277
11501
|
function useStarTap(starLeague) {
|
|
11278
|
-
const [pendingId, setPendingId] =
|
|
11502
|
+
const [pendingId, setPendingId] = useState48(null);
|
|
11279
11503
|
const pendingRef = useRef28(null);
|
|
11280
11504
|
const tap = useCallback21(async (competitionId, next) => {
|
|
11281
11505
|
if (pendingRef.current !== null) return false;
|
|
@@ -11336,7 +11560,7 @@ function LeagueTile({ group, starClickable: starClickable2, disambiguate, onOpen
|
|
|
11336
11560
|
}
|
|
11337
11561
|
|
|
11338
11562
|
// src/components/LeagueDetail.tsx
|
|
11339
|
-
import { useEffect as
|
|
11563
|
+
import { useEffect as useEffect34, useState as useState49 } from "react";
|
|
11340
11564
|
import { matchKey as matchKey5 } from "@sensiblestats/widget-sdk";
|
|
11341
11565
|
|
|
11342
11566
|
// src/components/FixtureRow.tsx
|
|
@@ -11399,11 +11623,11 @@ function FixtureRow({ match, state, stale, ui, monitor }) {
|
|
|
11399
11623
|
import { jsx as jsx84, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
11400
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";
|
|
11401
11625
|
function LeagueDetail({ group, position, states, stale, ui, monitor, starTap, onBack, onPrev, onNext }) {
|
|
11402
|
-
const [toast, setToast] =
|
|
11403
|
-
|
|
11626
|
+
const [toast, setToast] = useState49(null);
|
|
11627
|
+
useEffect34(() => {
|
|
11404
11628
|
setToast(null);
|
|
11405
11629
|
}, [group.competitionId]);
|
|
11406
|
-
|
|
11630
|
+
useEffect34(() => {
|
|
11407
11631
|
if (toast === null) return;
|
|
11408
11632
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11409
11633
|
return () => clearTimeout(id);
|
|
@@ -11499,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
|
|
|
11499
11723
|
function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starClickable2, disambiguate, onOpen, starTap, ui, monitor }) {
|
|
11500
11724
|
const sorted = group.matches.filter((m) => !isTreatedLive(states.get(matchKey6(m.sport, m.matchId)), stale)).sort((a, b) => a.kickoffUnix - b.kickoffUnix);
|
|
11501
11725
|
if (sorted.length === 0) return null;
|
|
11502
|
-
const
|
|
11503
|
-
const overflow = sorted.length -
|
|
11726
|
+
const shown2 = sorted.slice(0, cap2);
|
|
11727
|
+
const overflow = sorted.length - shown2.length;
|
|
11504
11728
|
const onStarClick = () => {
|
|
11505
11729
|
void starTap.tap(group.competitionId, !group.isStarred);
|
|
11506
11730
|
};
|
|
@@ -11540,7 +11764,7 @@ function LeagueRowGroup({ group, states, stale, cap: cap2, starClickable: starCl
|
|
|
11540
11764
|
}
|
|
11541
11765
|
)
|
|
11542
11766
|
] }),
|
|
11543
|
-
/* @__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(
|
|
11544
11768
|
FixtureRow,
|
|
11545
11769
|
{
|
|
11546
11770
|
match: m,
|
|
@@ -11641,22 +11865,22 @@ import { Fragment as Fragment22, jsx as jsx88, jsxs as jsxs82 } from "react/jsx-
|
|
|
11641
11865
|
function TodayPanel({ discovery, ui, monitor }) {
|
|
11642
11866
|
const { groups, states, stale, starLeague } = discovery;
|
|
11643
11867
|
const searchId = useId2();
|
|
11644
|
-
const [query, setQuery] =
|
|
11645
|
-
const [selectedCompetitionId, setSelectedCompetitionId] =
|
|
11646
|
-
const [toast, setToast] =
|
|
11647
|
-
|
|
11868
|
+
const [query, setQuery] = useState50("");
|
|
11869
|
+
const [selectedCompetitionId, setSelectedCompetitionId] = useState50(null);
|
|
11870
|
+
const [toast, setToast] = useState50(null);
|
|
11871
|
+
useEffect35(() => {
|
|
11648
11872
|
if (toast === null) return;
|
|
11649
11873
|
const id = setTimeout(() => setToast(null), 4e3);
|
|
11650
11874
|
return () => clearTimeout(id);
|
|
11651
11875
|
}, [toast]);
|
|
11652
11876
|
const visibleGroups = visibleGroupsOf(groups, states);
|
|
11653
|
-
const pinnedMatchIds =
|
|
11877
|
+
const pinnedMatchIds = useMemo9(
|
|
11654
11878
|
() => footballMatchPinIds(monitor.pins),
|
|
11655
11879
|
[monitor.pins]
|
|
11656
11880
|
);
|
|
11657
|
-
const placement =
|
|
11881
|
+
const placement = useMemo9(() => placeLeagues(visibleGroups, pinnedMatchIds), [visibleGroups, pinnedMatchIds]);
|
|
11658
11882
|
const starTap = useStarTap(starLeague);
|
|
11659
|
-
const gridStarTap =
|
|
11883
|
+
const gridStarTap = useMemo9(() => ({
|
|
11660
11884
|
pendingId: starTap.pendingId,
|
|
11661
11885
|
tap: async (competitionId, next) => {
|
|
11662
11886
|
const ok = await starTap.tap(competitionId, next);
|
|
@@ -11690,7 +11914,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11690
11914
|
}
|
|
11691
11915
|
const openIndex = selectedCompetitionId === null ? -1 : placement.order.findIndex((g) => g.competitionId === selectedCompetitionId);
|
|
11692
11916
|
const openGroup = openIndex === -1 ? void 0 : placement.order[openIndex];
|
|
11693
|
-
|
|
11917
|
+
useEffect35(() => {
|
|
11694
11918
|
if (selectedCompetitionId !== null && openGroup === void 0) setSelectedCompetitionId(null);
|
|
11695
11919
|
}, [selectedCompetitionId, openGroup]);
|
|
11696
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);
|
|
@@ -11846,7 +12070,7 @@ function TodayPanel({ discovery, ui, monitor }) {
|
|
|
11846
12070
|
}
|
|
11847
12071
|
|
|
11848
12072
|
// src/components/GamesPanel.tsx
|
|
11849
|
-
import { useEffect as
|
|
12073
|
+
import { useEffect as useEffect39, useState as useState65 } from "react";
|
|
11850
12074
|
|
|
11851
12075
|
// src/components/GamesLoginWall.tsx
|
|
11852
12076
|
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
@@ -11855,7 +12079,7 @@ function GamesLoginWall({ ui }) {
|
|
|
11855
12079
|
}
|
|
11856
12080
|
|
|
11857
12081
|
// src/components/GamesHub.tsx
|
|
11858
|
-
import { useEffect as
|
|
12082
|
+
import { useEffect as useEffect36, useState as useState51 } from "react";
|
|
11859
12083
|
|
|
11860
12084
|
// src/components/games/ui/gameMeta.ts
|
|
11861
12085
|
function prettifyGameId(gameId) {
|
|
@@ -12006,8 +12230,8 @@ function pickHeroGame(games) {
|
|
|
12006
12230
|
}
|
|
12007
12231
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
12008
12232
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
12009
|
-
const [, setTick] =
|
|
12010
|
-
|
|
12233
|
+
const [, setTick] = useState51(0);
|
|
12234
|
+
useEffect36(() => {
|
|
12011
12235
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
12012
12236
|
return () => clearInterval(id);
|
|
12013
12237
|
}, []);
|
|
@@ -12067,10 +12291,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
12067
12291
|
}
|
|
12068
12292
|
|
|
12069
12293
|
// src/components/GameScreenHost.tsx
|
|
12070
|
-
import { useEffect as
|
|
12294
|
+
import { useEffect as useEffect38, useRef as useRef32, useState as useState63 } from "react";
|
|
12071
12295
|
|
|
12072
12296
|
// src/useGamePlay.ts
|
|
12073
|
-
import { useCallback as useCallback23, useRef as useRef30, useState as
|
|
12297
|
+
import { useCallback as useCallback23, useRef as useRef30, useState as useState52 } from "react";
|
|
12074
12298
|
function toSubmitResult(payload) {
|
|
12075
12299
|
return {
|
|
12076
12300
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -12082,9 +12306,9 @@ function toSubmitResult(payload) {
|
|
|
12082
12306
|
};
|
|
12083
12307
|
}
|
|
12084
12308
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
12085
|
-
const [result, setResult] =
|
|
12086
|
-
const [submitting, setSubmitting] =
|
|
12087
|
-
const [rawStatus, setRawStatus] =
|
|
12309
|
+
const [result, setResult] = useState52(null);
|
|
12310
|
+
const [submitting, setSubmitting] = useState52(false);
|
|
12311
|
+
const [rawStatus, setRawStatus] = useState52(null);
|
|
12088
12312
|
const inFlightRef = useRef30(false);
|
|
12089
12313
|
const convRef = useRef30(conversation);
|
|
12090
12314
|
convRef.current = conversation;
|
|
@@ -12142,7 +12366,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
12142
12366
|
}
|
|
12143
12367
|
|
|
12144
12368
|
// src/components/games/MysteryTigerGame.tsx
|
|
12145
|
-
import { useState as
|
|
12369
|
+
import { useState as useState54, useId as useId3 } from "react";
|
|
12146
12370
|
|
|
12147
12371
|
// src/components/games/nationFlags.ts
|
|
12148
12372
|
var FLAGS = {
|
|
@@ -12353,7 +12577,7 @@ function isNationCode(flag) {
|
|
|
12353
12577
|
}
|
|
12354
12578
|
|
|
12355
12579
|
// src/components/games/PlayerAvatar.tsx
|
|
12356
|
-
import { useState as
|
|
12580
|
+
import { useState as useState53 } from "react";
|
|
12357
12581
|
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
12358
12582
|
function initialsOf(name) {
|
|
12359
12583
|
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -12371,7 +12595,7 @@ function PlayerAvatar({
|
|
|
12371
12595
|
imagePath,
|
|
12372
12596
|
className
|
|
12373
12597
|
}) {
|
|
12374
|
-
const [failed, setFailed] =
|
|
12598
|
+
const [failed, setFailed] = useState53(false);
|
|
12375
12599
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
12376
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) }) });
|
|
12377
12601
|
}
|
|
@@ -12417,7 +12641,7 @@ function SegmentProgress({ segments, ariaLabel, leftLabel, rightLabel, right })
|
|
|
12417
12641
|
import { Fragment as Fragment26, jsx as jsx97, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
12418
12642
|
function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQuery, onPick, disabled, minQuery = 0 }) {
|
|
12419
12643
|
const needle = query.trim().toLowerCase();
|
|
12420
|
-
const
|
|
12644
|
+
const shown2 = needle.length < minQuery ? [] : needle ? options.filter((o) => o.name.toLowerCase().includes(needle)) : options;
|
|
12421
12645
|
return /* @__PURE__ */ jsxs89(Fragment26, { children: [
|
|
12422
12646
|
/* @__PURE__ */ jsx97(
|
|
12423
12647
|
SearchField,
|
|
@@ -12431,7 +12655,7 @@ function AnswerTray({ id, label, placeholder, optionsLabel, options, query, onQu
|
|
|
12431
12655
|
disabled
|
|
12432
12656
|
}
|
|
12433
12657
|
),
|
|
12434
|
-
|
|
12658
|
+
shown2.length > 0 && /* @__PURE__ */ jsx97("div", { className: "ss-g-tray", role: "listbox", "aria-label": optionsLabel, children: shown2.map((o) => {
|
|
12435
12659
|
const { first, last } = splitName(o.name);
|
|
12436
12660
|
return /* @__PURE__ */ jsxs89(
|
|
12437
12661
|
"button",
|
|
@@ -12612,7 +12836,7 @@ function MysteryTigerGame({
|
|
|
12612
12836
|
onBack
|
|
12613
12837
|
}) {
|
|
12614
12838
|
const t = ui.games.mysteryTiger;
|
|
12615
|
-
const [query, setQuery] =
|
|
12839
|
+
const [query, setQuery] = useState54("");
|
|
12616
12840
|
const inputId = useId3();
|
|
12617
12841
|
const clientState = parseClientState(result?.clientStateJson);
|
|
12618
12842
|
const guessResults = clientState?.guessResults ?? [];
|
|
@@ -12874,13 +13098,13 @@ function HigherOrLowerGame({
|
|
|
12874
13098
|
}
|
|
12875
13099
|
|
|
12876
13100
|
// src/components/games/CareerPathGame.tsx
|
|
12877
|
-
import { useState as
|
|
13101
|
+
import { useState as useState56, useId as useId4 } from "react";
|
|
12878
13102
|
|
|
12879
13103
|
// src/components/games/ui/CrestShield.tsx
|
|
12880
|
-
import { useState as
|
|
13104
|
+
import { useState as useState55 } from "react";
|
|
12881
13105
|
import { jsx as jsx105 } from "react/jsx-runtime";
|
|
12882
13106
|
function CrestShield({ src, name, size = 28 }) {
|
|
12883
|
-
const [failed, setFailed] =
|
|
13107
|
+
const [failed, setFailed] = useState55(false);
|
|
12884
13108
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
12885
13109
|
return /* @__PURE__ */ jsx105("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
12886
13110
|
}
|
|
@@ -12912,7 +13136,7 @@ function CareerPathGame({
|
|
|
12912
13136
|
}) {
|
|
12913
13137
|
const s = ui.games.careerPath;
|
|
12914
13138
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
12915
|
-
const [query, setQuery] =
|
|
13139
|
+
const [query, setQuery] = useState56("");
|
|
12916
13140
|
const inputId = useId4();
|
|
12917
13141
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
12918
13142
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
@@ -13019,7 +13243,7 @@ function CareerPathGame({
|
|
|
13019
13243
|
}
|
|
13020
13244
|
|
|
13021
13245
|
// src/components/games/BeatTheGridGame.tsx
|
|
13022
|
-
import React, { useEffect as
|
|
13246
|
+
import React, { useEffect as useEffect37, useId as useId5, useRef as useRef31, useState as useState57 } from "react";
|
|
13023
13247
|
|
|
13024
13248
|
// src/components/games/ui/OptionList.tsx
|
|
13025
13249
|
import { jsx as jsx107 } from "react/jsx-runtime";
|
|
@@ -13108,10 +13332,10 @@ function SearchSheet({
|
|
|
13108
13332
|
ui
|
|
13109
13333
|
}) {
|
|
13110
13334
|
const s = ui.games.beatTheGrid;
|
|
13111
|
-
const [query, setQuery] =
|
|
13335
|
+
const [query, setQuery] = useState57("");
|
|
13112
13336
|
const inputId = useId5();
|
|
13113
13337
|
const inputRef = useRef31(null);
|
|
13114
|
-
|
|
13338
|
+
useEffect37(() => {
|
|
13115
13339
|
inputRef.current?.focus();
|
|
13116
13340
|
}, [row, col]);
|
|
13117
13341
|
const filtered = playerPool.filter(
|
|
@@ -13176,7 +13400,7 @@ function BeatTheGridGame({
|
|
|
13176
13400
|
}) {
|
|
13177
13401
|
const s = ui.games.beatTheGrid;
|
|
13178
13402
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
13179
|
-
const [activeCell, setActiveCell] =
|
|
13403
|
+
const [activeCell, setActiveCell] = useState57(null);
|
|
13180
13404
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
13181
13405
|
const filledCells = clientState?.cells ?? [];
|
|
13182
13406
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -13331,7 +13555,7 @@ function BeatTheGridGame({
|
|
|
13331
13555
|
}
|
|
13332
13556
|
|
|
13333
13557
|
// src/components/games/GuessTheXiGame.tsx
|
|
13334
|
-
import { useState as
|
|
13558
|
+
import { useState as useState58, useId as useId6 } from "react";
|
|
13335
13559
|
|
|
13336
13560
|
// src/components/games/ui/PitchSvg.tsx
|
|
13337
13561
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs97 } from "react/jsx-runtime";
|
|
@@ -13420,7 +13644,7 @@ function GuessTheXiGame({
|
|
|
13420
13644
|
onBack
|
|
13421
13645
|
}) {
|
|
13422
13646
|
const t = ui.games.guessTheXi;
|
|
13423
|
-
const [query, setQuery] =
|
|
13647
|
+
const [query, setQuery] = useState58("");
|
|
13424
13648
|
const inputId = useId6();
|
|
13425
13649
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
13426
13650
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
@@ -13563,7 +13787,7 @@ function GuessTheXiGame({
|
|
|
13563
13787
|
}
|
|
13564
13788
|
|
|
13565
13789
|
// src/components/games/DailyQuizGame.tsx
|
|
13566
|
-
import { useState as
|
|
13790
|
+
import { useState as useState59 } from "react";
|
|
13567
13791
|
import { Fragment as Fragment33, jsx as jsx111, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
13568
13792
|
function parseClientState6(json) {
|
|
13569
13793
|
if (!json) return null;
|
|
@@ -13604,8 +13828,8 @@ function DailyQuizGame({
|
|
|
13604
13828
|
}) {
|
|
13605
13829
|
const s = ui.games.dailyQuiz;
|
|
13606
13830
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
13607
|
-
const [selections, setSelections] =
|
|
13608
|
-
const [page, setPage] =
|
|
13831
|
+
const [selections, setSelections] = useState59(/* @__PURE__ */ new Map());
|
|
13832
|
+
const [page, setPage] = useState59(0);
|
|
13609
13833
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
13610
13834
|
const results2 = clientState?.results ?? [];
|
|
13611
13835
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -13715,7 +13939,7 @@ function DailyQuizGame({
|
|
|
13715
13939
|
}
|
|
13716
13940
|
|
|
13717
13941
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
13718
|
-
import { useId as useId7, useState as
|
|
13942
|
+
import { useId as useId7, useState as useState60 } from "react";
|
|
13719
13943
|
import { jsx as jsx112, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
13720
13944
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
13721
13945
|
function parseClientState7(json) {
|
|
@@ -13811,11 +14035,11 @@ function MatchdayPredictorGame({
|
|
|
13811
14035
|
onBack
|
|
13812
14036
|
}) {
|
|
13813
14037
|
const t = ui.games.predictor;
|
|
13814
|
-
const [homeScore, setHomeScore] =
|
|
13815
|
-
const [awayScore, setAwayScore] =
|
|
13816
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] =
|
|
13817
|
-
const [lastEdited, setLastEdited] =
|
|
13818
|
-
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("");
|
|
13819
14043
|
const searchId = useId7();
|
|
13820
14044
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
13821
14045
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -13983,7 +14207,7 @@ function MatchdayPredictorGame({
|
|
|
13983
14207
|
}
|
|
13984
14208
|
|
|
13985
14209
|
// src/components/games/StartingXiGame.tsx
|
|
13986
|
-
import { useId as useId8, useState as
|
|
14210
|
+
import { useId as useId8, useState as useState61 } from "react";
|
|
13987
14211
|
import { Fragment as Fragment34, jsx as jsx113, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
13988
14212
|
var POINTS_PER_STARTER = 8;
|
|
13989
14213
|
var XI_SIZE = 11;
|
|
@@ -14027,9 +14251,9 @@ function StartingXiGame({
|
|
|
14027
14251
|
lockAtUtc
|
|
14028
14252
|
}) {
|
|
14029
14253
|
const t = ui.games.startingXi;
|
|
14030
|
-
const [slotPlayers, setSlotPlayers] =
|
|
14031
|
-
const [active, setActive] =
|
|
14032
|
-
const [query, setQuery] =
|
|
14254
|
+
const [slotPlayers, setSlotPlayers] = useState61(() => Array(XI_SIZE).fill(null));
|
|
14255
|
+
const [active, setActive] = useState61(0);
|
|
14256
|
+
const [query, setQuery] = useState61("");
|
|
14033
14257
|
const searchId = useId8();
|
|
14034
14258
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
14035
14259
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
@@ -14169,7 +14393,7 @@ function StartingXiGame({
|
|
|
14169
14393
|
}
|
|
14170
14394
|
|
|
14171
14395
|
// src/components/games/StatLadderGame.tsx
|
|
14172
|
-
import { useId as useId9, useState as
|
|
14396
|
+
import { useId as useId9, useState as useState62 } from "react";
|
|
14173
14397
|
import { jsx as jsx114, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
14174
14398
|
function ladderClue(ladder) {
|
|
14175
14399
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -14206,8 +14430,8 @@ function StatLadderGame({
|
|
|
14206
14430
|
onBack
|
|
14207
14431
|
}) {
|
|
14208
14432
|
const t = ui.games.statLadder;
|
|
14209
|
-
const [query, setQuery] =
|
|
14210
|
-
const [selectedId, setSelectedId] =
|
|
14433
|
+
const [query, setQuery] = useState62("");
|
|
14434
|
+
const [selectedId, setSelectedId] = useState62(null);
|
|
14211
14435
|
const searchId = useId9();
|
|
14212
14436
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
14213
14437
|
const revealed = clientState != null;
|
|
@@ -14414,8 +14638,8 @@ function GameScreenHost({
|
|
|
14414
14638
|
ui
|
|
14415
14639
|
}) {
|
|
14416
14640
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
14417
|
-
const [configJson, setConfigJson] =
|
|
14418
|
-
|
|
14641
|
+
const [configJson, setConfigJson] = useState63(null);
|
|
14642
|
+
useEffect38(() => {
|
|
14419
14643
|
setConfigJson(null);
|
|
14420
14644
|
if (!conversation) return;
|
|
14421
14645
|
let cancelled = false;
|
|
@@ -14438,12 +14662,12 @@ function GameScreenHost({
|
|
|
14438
14662
|
fixtureId: fixtureId || void 0,
|
|
14439
14663
|
locale: ui.games.lang
|
|
14440
14664
|
});
|
|
14441
|
-
|
|
14665
|
+
useEffect38(() => {
|
|
14442
14666
|
if (conversation) hydrate();
|
|
14443
14667
|
}, [conversation, gameId]);
|
|
14444
14668
|
const hydrateRef = useRef32(hydrate);
|
|
14445
14669
|
hydrateRef.current = hydrate;
|
|
14446
|
-
|
|
14670
|
+
useEffect38(() => {
|
|
14447
14671
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
14448
14672
|
if (rawStatus !== "pending") return;
|
|
14449
14673
|
const timerId = setInterval(() => {
|
|
@@ -14556,7 +14780,7 @@ function GameScreenHost({
|
|
|
14556
14780
|
}
|
|
14557
14781
|
|
|
14558
14782
|
// src/components/Leaderboard.tsx
|
|
14559
|
-
import { useState as
|
|
14783
|
+
import { useState as useState64 } from "react";
|
|
14560
14784
|
|
|
14561
14785
|
// src/components/LeaderboardRow.tsx
|
|
14562
14786
|
import { jsx as jsx117, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
@@ -14641,7 +14865,7 @@ function Leaderboard({
|
|
|
14641
14865
|
ui,
|
|
14642
14866
|
onPlay
|
|
14643
14867
|
}) {
|
|
14644
|
-
const [segment, setSegment] =
|
|
14868
|
+
const [segment, setSegment] = useState64("weekly");
|
|
14645
14869
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
14646
14870
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
14647
14871
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -14744,9 +14968,9 @@ function GamesPanel({
|
|
|
14744
14968
|
leaderboardLoading,
|
|
14745
14969
|
refreshHub
|
|
14746
14970
|
}) {
|
|
14747
|
-
const [selected, setSelected] =
|
|
14748
|
-
const [segment, setSegment] =
|
|
14749
|
-
|
|
14971
|
+
const [selected, setSelected] = useState65(null);
|
|
14972
|
+
const [segment, setSegment] = useState65("play");
|
|
14973
|
+
useEffect39(() => {
|
|
14750
14974
|
ensureGamesFonts();
|
|
14751
14975
|
}, []);
|
|
14752
14976
|
if (!loggedIn) return /* @__PURE__ */ jsx121(GamesLoginWall, { ui });
|
|
@@ -14810,10 +15034,10 @@ function GamesPanel({
|
|
|
14810
15034
|
}
|
|
14811
15035
|
|
|
14812
15036
|
// src/components/FavouritesPanel.tsx
|
|
14813
|
-
import { useEffect as
|
|
15037
|
+
import { useEffect as useEffect42, useRef as useRef34, useState as useState68 } from "react";
|
|
14814
15038
|
|
|
14815
15039
|
// src/components/FavouriteChips.tsx
|
|
14816
|
-
import { useEffect as
|
|
15040
|
+
import { useEffect as useEffect40, useState as useState66 } from "react";
|
|
14817
15041
|
import { Fragment as Fragment36, jsx as jsx122, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
14818
15042
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
14819
15043
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -14859,12 +15083,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
14859
15083
|
] });
|
|
14860
15084
|
}
|
|
14861
15085
|
function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
14862
|
-
const [confirming, setConfirming] =
|
|
15086
|
+
const [confirming, setConfirming] = useState66(false);
|
|
14863
15087
|
const data = controller.data;
|
|
14864
|
-
|
|
15088
|
+
useEffect40(() => {
|
|
14865
15089
|
setConfirming(false);
|
|
14866
15090
|
}, [sport]);
|
|
14867
|
-
|
|
15091
|
+
useEffect40(() => {
|
|
14868
15092
|
if (!confirming) return;
|
|
14869
15093
|
const onPointerDown = (e) => {
|
|
14870
15094
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -14918,21 +15142,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel, onNotice }) {
|
|
|
14918
15142
|
}
|
|
14919
15143
|
|
|
14920
15144
|
// src/components/FavouritesSearch.tsx
|
|
14921
|
-
import { useEffect as
|
|
15145
|
+
import { useEffect as useEffect41, useRef as useRef33, useState as useState67 } from "react";
|
|
14922
15146
|
import { jsx as jsx123, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
14923
15147
|
var MIN_LETTERS = 2;
|
|
14924
15148
|
var MAX_LENGTH = 64;
|
|
14925
15149
|
var DEBOUNCE_MS = 250;
|
|
14926
15150
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
14927
|
-
const [query, setQuery] =
|
|
14928
|
-
const [answer, setAnswer] =
|
|
15151
|
+
const [query, setQuery] = useState67("");
|
|
15152
|
+
const [answer, setAnswer] = useState67(null);
|
|
14929
15153
|
const controllerRef = useRef33(controller);
|
|
14930
15154
|
controllerRef.current = controller;
|
|
14931
15155
|
const trimmed = query.trim();
|
|
14932
15156
|
const queryKey = `${sport}|${trimmed}`;
|
|
14933
15157
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
14934
15158
|
const settled = answer?.key === queryKey;
|
|
14935
|
-
|
|
15159
|
+
useEffect41(() => {
|
|
14936
15160
|
setAnswer(null);
|
|
14937
15161
|
if (trimmed.length < MIN_LETTERS) return;
|
|
14938
15162
|
let cancelled = false;
|
|
@@ -14997,13 +15221,13 @@ function capitalised(sport) {
|
|
|
14997
15221
|
return sport.charAt(0).toUpperCase() + sport.slice(1);
|
|
14998
15222
|
}
|
|
14999
15223
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
15000
|
-
const [notice, setNotice] =
|
|
15224
|
+
const [notice, setNotice] = useState68(null);
|
|
15001
15225
|
const refreshRef = useRef34(controller.refresh);
|
|
15002
15226
|
refreshRef.current = controller.refresh;
|
|
15003
|
-
|
|
15227
|
+
useEffect42(() => {
|
|
15004
15228
|
void refreshRef.current();
|
|
15005
15229
|
}, []);
|
|
15006
|
-
|
|
15230
|
+
useEffect42(() => {
|
|
15007
15231
|
setNotice(null);
|
|
15008
15232
|
}, [sport]);
|
|
15009
15233
|
const sportLabel = sports.find((s) => s.sport === sport)?.label ?? capitalised(sport);
|
|
@@ -15267,10 +15491,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
15267
15491
|
}
|
|
15268
15492
|
|
|
15269
15493
|
// src/components/PlayerPhoto.tsx
|
|
15270
|
-
import { useState as
|
|
15494
|
+
import { useState as useState69 } from "react";
|
|
15271
15495
|
import { jsx as jsx129 } from "react/jsx-runtime";
|
|
15272
15496
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
15273
|
-
const [failed, setFailed] =
|
|
15497
|
+
const [failed, setFailed] = useState69(false);
|
|
15274
15498
|
const box = { width: size, height: size };
|
|
15275
15499
|
if (photoUrl && !failed) {
|
|
15276
15500
|
return /* @__PURE__ */ jsx129("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -15305,7 +15529,7 @@ function MiniPitch({ positionCode }) {
|
|
|
15305
15529
|
}
|
|
15306
15530
|
|
|
15307
15531
|
// src/components/PerformanceBars.tsx
|
|
15308
|
-
import { useState as
|
|
15532
|
+
import { useState as useState70 } from "react";
|
|
15309
15533
|
import { jsx as jsx131, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
15310
15534
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
15311
15535
|
function finite3(v) {
|
|
@@ -15351,7 +15575,7 @@ function unrankedLine(ui, reason) {
|
|
|
15351
15575
|
}
|
|
15352
15576
|
}
|
|
15353
15577
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
15354
|
-
const [mode, setMode] =
|
|
15578
|
+
const [mode, setMode] = useState70("total");
|
|
15355
15579
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
15356
15580
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
15357
15581
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -15560,16 +15784,16 @@ function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef
|
|
|
15560
15784
|
}
|
|
15561
15785
|
|
|
15562
15786
|
// src/components/PresetTools.tsx
|
|
15563
|
-
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";
|
|
15564
15788
|
import { Fragment as Fragment40, jsx as jsx134, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
15565
15789
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
15566
|
-
function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
15790
|
+
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
15567
15791
|
const dialogRef = useRef35(null);
|
|
15568
15792
|
const titleId = useId11();
|
|
15569
|
-
|
|
15570
|
-
dialogRef.current?.focus();
|
|
15793
|
+
useEffect43(() => {
|
|
15794
|
+
dialogRef.current?.focus({ preventScroll: true });
|
|
15571
15795
|
}, []);
|
|
15572
|
-
|
|
15796
|
+
useEffect43(() => {
|
|
15573
15797
|
const onKey = (e) => {
|
|
15574
15798
|
if (e.key !== "Escape") return;
|
|
15575
15799
|
e.stopPropagation();
|
|
@@ -15599,7 +15823,7 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer }) {
|
|
|
15599
15823
|
first.focus();
|
|
15600
15824
|
}
|
|
15601
15825
|
};
|
|
15602
|
-
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: [
|
|
15603
15827
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-head", children: [
|
|
15604
15828
|
/* @__PURE__ */ jsx134("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
15605
15829
|
/* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx134(CloseIcon, {}) })
|
|
@@ -15614,14 +15838,14 @@ function fillTemplate(template, slots) {
|
|
|
15614
15838
|
return /* @__PURE__ */ jsx134(Fragment39, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
|
|
15615
15839
|
});
|
|
15616
15840
|
}
|
|
15617
|
-
function NumberSelect({ current, choices
|
|
15618
|
-
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)));
|
|
15619
15843
|
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15620
|
-
/* @__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 ?? "" }),
|
|
15621
15845
|
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(selected), onChange: (e) => {
|
|
15622
|
-
const c =
|
|
15623
|
-
if (c) onChoose(c
|
|
15624
|
-
}, 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)) })
|
|
15625
15849
|
] });
|
|
15626
15850
|
}
|
|
15627
15851
|
function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
|
|
@@ -15635,6 +15859,7 @@ function SendButton({ label, display, disabled, onClick }) {
|
|
|
15635
15859
|
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
|
|
15636
15860
|
}
|
|
15637
15861
|
function PickList({ picks, formatKickoff }) {
|
|
15862
|
+
const { oddsFormat } = useOddsSettings();
|
|
15638
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: [
|
|
15639
15864
|
/* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-pick-match", children: [
|
|
15640
15865
|
p.homeTeamName,
|
|
@@ -15648,13 +15873,14 @@ function PickList({ picks, formatKickoff }) {
|
|
|
15648
15873
|
p.line ? ` ${p.line}` : ""
|
|
15649
15874
|
] }),
|
|
15650
15875
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
|
|
15651
|
-
/* @__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) })
|
|
15652
15877
|
] }, p.matchOddsId)) });
|
|
15653
15878
|
}
|
|
15654
15879
|
function ComboPreview({ cell: cell2, formatKickoff }) {
|
|
15880
|
+
const { oddsFormat } = useOddsSettings();
|
|
15655
15881
|
return /* @__PURE__ */ jsxs118(Fragment40, { children: [
|
|
15656
15882
|
/* @__PURE__ */ jsx134(PickList, { picks: cell2.combo.legs, formatKickoff }),
|
|
15657
|
-
/* @__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) })
|
|
15658
15884
|
] });
|
|
15659
15885
|
}
|
|
15660
15886
|
function Unavailable({ text }) {
|
|
@@ -15673,22 +15899,31 @@ function AskRow({ icon, ask, ready, send }) {
|
|
|
15673
15899
|
function RoundSend({ label, display, disabled, onClick }) {
|
|
15674
15900
|
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ jsx134(SendIcon, {}) });
|
|
15675
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
|
+
};
|
|
15676
15907
|
var BIG_COMBO = { total: 50, legs: 6 };
|
|
15677
15908
|
function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
15678
|
-
const
|
|
15679
|
-
const
|
|
15680
|
-
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);
|
|
15681
15916
|
const legChoices = comboLegChoices(grid);
|
|
15682
15917
|
const count = FIXED_SINGLES_COUNT;
|
|
15683
|
-
const [maxPrice, setMaxPrice] =
|
|
15684
|
-
const [minPrice, setMinPrice] =
|
|
15685
|
-
const [start] =
|
|
15686
|
-
const [total, setTotal] =
|
|
15687
|
-
const [legs, setLegs] =
|
|
15688
|
-
const [bigStart] =
|
|
15689
|
-
const [bigTotal, setBigTotal] =
|
|
15690
|
-
const [bigLegs, setBigLegs] =
|
|
15691
|
-
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("");
|
|
15692
15927
|
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
15693
15928
|
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
15694
15929
|
const comboCell = findCombo(grid, total, legs);
|
|
@@ -15699,44 +15934,45 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15699
15934
|
const cell2 = markets[idx];
|
|
15700
15935
|
if (cell2) announce(marketDisplay(cell2, strings), cell2.count > 0);
|
|
15701
15936
|
};
|
|
15702
|
-
const
|
|
15703
|
-
|
|
15704
|
-
|
|
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));
|
|
15705
15941
|
};
|
|
15706
|
-
const chooseMin = (
|
|
15707
|
-
setMinPrice(
|
|
15708
|
-
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));
|
|
15709
15945
|
};
|
|
15710
|
-
const chooseLegs = (
|
|
15711
|
-
setLegs(
|
|
15712
|
-
announce(strings.comboDisplay(
|
|
15946
|
+
const chooseLegs = (c) => {
|
|
15947
|
+
setLegs(c.value);
|
|
15948
|
+
announce(strings.comboDisplay(c.value, totalText(total)), !!findCombo(grid, total, c.value));
|
|
15713
15949
|
};
|
|
15714
|
-
const chooseTotal = (
|
|
15715
|
-
const l = legsForTotal(grid,
|
|
15716
|
-
setTotal(
|
|
15950
|
+
const chooseTotal = (c) => {
|
|
15951
|
+
const l = legsForTotal(grid, c.value, legs);
|
|
15952
|
+
setTotal(c.value);
|
|
15717
15953
|
setLegs(l);
|
|
15718
|
-
announce(strings.comboDisplay(l,
|
|
15954
|
+
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15719
15955
|
};
|
|
15720
|
-
const chooseBigLegs = (
|
|
15721
|
-
setBigLegs(
|
|
15722
|
-
announce(strings.comboDisplay(
|
|
15956
|
+
const chooseBigLegs = (c) => {
|
|
15957
|
+
setBigLegs(c.value);
|
|
15958
|
+
announce(strings.comboDisplay(c.value, totalText(bigTotal)), !!findCombo(grid, bigTotal, c.value));
|
|
15723
15959
|
};
|
|
15724
|
-
const chooseBigTotal = (
|
|
15725
|
-
const l = legsForTotal(grid,
|
|
15726
|
-
setBigTotal(
|
|
15960
|
+
const chooseBigTotal = (c) => {
|
|
15961
|
+
const l = legsForTotal(grid, c.value, bigLegs);
|
|
15962
|
+
setBigTotal(c.value);
|
|
15727
15963
|
setBigLegs(l);
|
|
15728
|
-
announce(strings.comboDisplay(l,
|
|
15964
|
+
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15729
15965
|
};
|
|
15730
|
-
const maxChoices =
|
|
15731
|
-
const minChoices =
|
|
15732
|
-
const totalChoices =
|
|
15733
|
-
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) }));
|
|
15734
15970
|
const markets = grid.markets ?? [];
|
|
15735
|
-
const [marketIdx, setMarketIdx] =
|
|
15971
|
+
const [marketIdx, setMarketIdx] = useState71(0);
|
|
15736
15972
|
const marketCell = markets[marketIdx] ?? null;
|
|
15737
15973
|
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
15738
15974
|
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
15739
|
-
const comboReady = (cell2) => cell2 ? strings.readyAt(cell2.combo.
|
|
15975
|
+
const comboReady = (cell2) => cell2 ? strings.readyAt(formatOdds(cell2.combo.totalFormats, oddsFormat)) : strings.unavailable;
|
|
15740
15976
|
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
15741
15977
|
/* @__PURE__ */ jsx134(
|
|
15742
15978
|
AskRow,
|
|
@@ -15744,11 +15980,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15744
15980
|
icon: "\u{1F3AF}",
|
|
15745
15981
|
ask: fillTemplate(strings.maxPriceRow, {
|
|
15746
15982
|
count: String(count),
|
|
15747
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice
|
|
15983
|
+
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice, choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
|
|
15748
15984
|
}),
|
|
15749
15985
|
ready: singlesReady(maxCell),
|
|
15750
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.maxPriceDisplay(count, maxPrice), disabled: !maxCell || streaming, onClick: () => {
|
|
15751
|
-
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));
|
|
15752
15988
|
} })
|
|
15753
15989
|
}
|
|
15754
15990
|
),
|
|
@@ -15758,11 +15994,11 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15758
15994
|
icon: "\u{1F4C8}",
|
|
15759
15995
|
ask: fillTemplate(strings.minPriceRow, {
|
|
15760
15996
|
count: String(count),
|
|
15761
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice
|
|
15997
|
+
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice, choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
|
|
15762
15998
|
}),
|
|
15763
15999
|
ready: singlesReady(minCell),
|
|
15764
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.minPriceDisplay(count, minPrice), disabled: !minCell || streaming, onClick: () => {
|
|
15765
|
-
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));
|
|
15766
16002
|
} })
|
|
15767
16003
|
}
|
|
15768
16004
|
),
|
|
@@ -15771,12 +16007,12 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15771
16007
|
{
|
|
15772
16008
|
icon: "\u2728",
|
|
15773
16009
|
ask: fillTemplate(strings.comboRow, {
|
|
15774
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current:
|
|
15775
|
-
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 })
|
|
15776
16012
|
}),
|
|
15777
16013
|
ready: comboReady(comboCell),
|
|
15778
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(legs, total), disabled: !comboCell || streaming, onClick: () => {
|
|
15779
|
-
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));
|
|
15780
16016
|
} })
|
|
15781
16017
|
}
|
|
15782
16018
|
),
|
|
@@ -15785,12 +16021,12 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15785
16021
|
{
|
|
15786
16022
|
icon: "\u{1F3C6}",
|
|
15787
16023
|
ask: fillTemplate(strings.bigComboRow, {
|
|
15788
|
-
legs: /* @__PURE__ */ jsx134(NumberSelect, { current:
|
|
15789
|
-
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 })
|
|
15790
16026
|
}),
|
|
15791
16027
|
ready: comboReady(bigCell),
|
|
15792
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: strings.comboDisplay(bigLegs, bigTotal), disabled: !bigCell || streaming, onClick: () => {
|
|
15793
|
-
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));
|
|
15794
16030
|
} })
|
|
15795
16031
|
}
|
|
15796
16032
|
),
|
|
@@ -15811,33 +16047,35 @@ function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
|
15811
16047
|
] });
|
|
15812
16048
|
}
|
|
15813
16049
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
15814
|
-
const
|
|
16050
|
+
const { oddsFormat } = useOddsSettings();
|
|
16051
|
+
const totalOptions = comboTotals(grid);
|
|
16052
|
+
const totals = totalOptions.map((o) => o.value);
|
|
15815
16053
|
const legChoices = comboLegChoices(grid);
|
|
15816
|
-
const [start] =
|
|
15817
|
-
const [total, setTotal] =
|
|
15818
|
-
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(() => {
|
|
15819
16057
|
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
15820
16058
|
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
15821
16059
|
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
15822
16060
|
});
|
|
15823
|
-
const [announcement, setAnnouncement] =
|
|
16061
|
+
const [announcement, setAnnouncement] = useState71("");
|
|
15824
16062
|
const cell2 = findCombo(grid, total, legs);
|
|
15825
16063
|
const minLegs = legChoices[0] ?? legs;
|
|
15826
16064
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
15827
|
-
const display = strings.comboDisplay(legs, total);
|
|
16065
|
+
const display = strings.comboDisplay(legs, textOf(totalOptions, total, oddsFormat));
|
|
15828
16066
|
const choose = (nextTotal, nextLegs) => {
|
|
15829
16067
|
setTotal(nextTotal);
|
|
15830
16068
|
setLegs(nextLegs);
|
|
15831
|
-
const d = strings.comboDisplay(nextLegs, nextTotal);
|
|
16069
|
+
const d = strings.comboDisplay(nextLegs, textOf(totalOptions, nextTotal, oddsFormat));
|
|
15832
16070
|
setAnnouncement(findCombo(grid, nextTotal, nextLegs) ? d : `${d}. ${strings.unavailable}`);
|
|
15833
16071
|
};
|
|
15834
16072
|
const footer = /* @__PURE__ */ jsx134(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
|
|
15835
|
-
if (cell2) onSend(comboAsk(cell2, strings));
|
|
16073
|
+
if (cell2) onSend(comboAsk(cell2, strings, oddsFormat));
|
|
15836
16074
|
} });
|
|
15837
16075
|
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
|
|
15838
16076
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
|
|
15839
16077
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
|
|
15840
|
-
/* @__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)) })
|
|
15841
16079
|
] }),
|
|
15842
16080
|
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
|
|
15843
16081
|
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
|
|
@@ -15852,8 +16090,42 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
15852
16090
|
] });
|
|
15853
16091
|
}
|
|
15854
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
|
+
|
|
15855
16127
|
// src/usePresetDial.ts
|
|
15856
|
-
import { useCallback as useCallback24, useEffect as
|
|
16128
|
+
import { useCallback as useCallback24, useEffect as useEffect44, useRef as useRef36, useState as useState72 } from "react";
|
|
15857
16129
|
function sendInFlight(messages, isStreaming) {
|
|
15858
16130
|
const last = messages[messages.length - 1];
|
|
15859
16131
|
return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
|
|
@@ -15867,25 +16139,25 @@ function lastUserId(messages) {
|
|
|
15867
16139
|
}
|
|
15868
16140
|
var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
|
|
15869
16141
|
function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
|
|
15870
|
-
const [expanded, setExpanded] =
|
|
16142
|
+
const [expanded, setExpanded] = useState72(() => !sendInFlight(messages, isStreaming));
|
|
15871
16143
|
const fold2 = useCallback24(() => setExpanded(false), []);
|
|
15872
16144
|
const toggle = useCallback24(() => setExpanded((e) => !e), []);
|
|
15873
16145
|
const currentUserId = lastUserId(messages);
|
|
15874
16146
|
const userIdRef = useRef36(currentUserId);
|
|
15875
|
-
|
|
16147
|
+
useEffect44(() => {
|
|
15876
16148
|
if (currentUserId === userIdRef.current) return;
|
|
15877
16149
|
userIdRef.current = currentUserId;
|
|
15878
16150
|
setExpanded(false);
|
|
15879
16151
|
}, [currentUserId]);
|
|
15880
16152
|
const tabRef = useRef36(activeTab);
|
|
15881
|
-
|
|
16153
|
+
useEffect44(() => {
|
|
15882
16154
|
if (activeTab === tabRef.current) return;
|
|
15883
16155
|
tabRef.current = activeTab;
|
|
15884
16156
|
setExpanded(false);
|
|
15885
16157
|
}, [activeTab]);
|
|
15886
16158
|
const expandedRef = useRef36(expanded);
|
|
15887
16159
|
expandedRef.current = expanded;
|
|
15888
|
-
|
|
16160
|
+
useEffect44(() => {
|
|
15889
16161
|
const onEscape = (e) => {
|
|
15890
16162
|
const dial = dialRef.current;
|
|
15891
16163
|
if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
|
|
@@ -15898,7 +16170,7 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
|
|
|
15898
16170
|
window.addEventListener("keydown", onEscape, true);
|
|
15899
16171
|
return () => window.removeEventListener("keydown", onEscape, true);
|
|
15900
16172
|
}, [dialRef, dialButtonRef]);
|
|
15901
|
-
|
|
16173
|
+
useEffect44(() => {
|
|
15902
16174
|
if (!expanded) return;
|
|
15903
16175
|
const layer = layerRef.current;
|
|
15904
16176
|
const inDial = (e) => {
|
|
@@ -15931,12 +16203,12 @@ function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming
|
|
|
15931
16203
|
}
|
|
15932
16204
|
|
|
15933
16205
|
// src/presetSeen.ts
|
|
15934
|
-
var
|
|
16206
|
+
var KEY2 = "ss-w-presets-tool-opened";
|
|
15935
16207
|
var openedThisPage = false;
|
|
15936
16208
|
function readToolSeen() {
|
|
15937
16209
|
if (openedThisPage) return true;
|
|
15938
16210
|
try {
|
|
15939
|
-
return window.localStorage.getItem(
|
|
16211
|
+
return window.localStorage.getItem(KEY2) === "1";
|
|
15940
16212
|
} catch {
|
|
15941
16213
|
return false;
|
|
15942
16214
|
}
|
|
@@ -15944,17 +16216,17 @@ function readToolSeen() {
|
|
|
15944
16216
|
function markToolSeen() {
|
|
15945
16217
|
openedThisPage = true;
|
|
15946
16218
|
try {
|
|
15947
|
-
window.localStorage.setItem(
|
|
16219
|
+
window.localStorage.setItem(KEY2, "1");
|
|
15948
16220
|
} catch {
|
|
15949
16221
|
}
|
|
15950
16222
|
}
|
|
15951
16223
|
|
|
15952
16224
|
// src/components/ChatPanel.tsx
|
|
15953
|
-
import { Fragment as Fragment41, jsx as
|
|
16225
|
+
import { Fragment as Fragment41, jsx as jsx136, jsxs as jsxs120 } from "react/jsx-runtime";
|
|
15954
16226
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
15955
16227
|
function useIsModal() {
|
|
15956
|
-
const [modal, setModal] =
|
|
15957
|
-
|
|
16228
|
+
const [modal, setModal] = useState73(false);
|
|
16229
|
+
useEffect45(() => {
|
|
15958
16230
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
15959
16231
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
15960
16232
|
const sync = () => setModal(mql.matches);
|
|
@@ -15974,8 +16246,8 @@ function greetingInFlight(messages) {
|
|
|
15974
16246
|
}
|
|
15975
16247
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites }) {
|
|
15976
16248
|
const { state, close, stop, send, reset } = controller;
|
|
15977
|
-
const [squadView, setSquadView] =
|
|
15978
|
-
const [selectedPlayerId, setSelectedPlayerId] =
|
|
16249
|
+
const [squadView, setSquadView] = useState73("roster");
|
|
16250
|
+
const [selectedPlayerId, setSelectedPlayerId] = useState73(null);
|
|
15979
16251
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
15980
16252
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
15981
16253
|
const squadLayerRef = useRef37(null);
|
|
@@ -15996,13 +16268,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
15996
16268
|
squadScrollRef.current = null;
|
|
15997
16269
|
}, [selectedPlayerId]);
|
|
15998
16270
|
const activeTab = monitor?.activeTab;
|
|
15999
|
-
|
|
16271
|
+
useEffect45(() => {
|
|
16000
16272
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
16001
16273
|
setSelectedPlayerId(null);
|
|
16002
16274
|
clearPlayerDetail?.();
|
|
16003
16275
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
16004
16276
|
const setMonitorTab = monitor?.setActiveTab;
|
|
16005
|
-
|
|
16277
|
+
useEffect45(() => {
|
|
16006
16278
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
16007
16279
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
16008
16280
|
const isModal = useIsModal();
|
|
@@ -16014,7 +16286,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16014
16286
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
16015
16287
|
close();
|
|
16016
16288
|
}, [track, closeTab, answering, close]);
|
|
16017
|
-
|
|
16289
|
+
useEffect45(() => {
|
|
16018
16290
|
const onKey = (e) => {
|
|
16019
16291
|
if (e.key === "Escape") closeWith("escape");
|
|
16020
16292
|
};
|
|
@@ -16030,7 +16302,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16030
16302
|
monitor?.setActiveTab("chat");
|
|
16031
16303
|
send(text, { grounding, source: "live_fact" });
|
|
16032
16304
|
};
|
|
16033
|
-
|
|
16305
|
+
useEffect45(() => {
|
|
16034
16306
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
16035
16307
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
16036
16308
|
const onChatTab = !monitor || monitor.activeTab === "chat";
|
|
@@ -16041,8 +16313,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16041
16313
|
const limitRef = useRef37(null);
|
|
16042
16314
|
const typedSendRef = useRef37(false);
|
|
16043
16315
|
const focusAfterCloseRef = useRef37(null);
|
|
16044
|
-
const [tool, setTool] =
|
|
16045
|
-
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);
|
|
16046
16330
|
const dial = usePresetDial({
|
|
16047
16331
|
layerRef,
|
|
16048
16332
|
dialRef,
|
|
@@ -16055,10 +16339,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16055
16339
|
const paused = isPaused(state.limit);
|
|
16056
16340
|
const dialWanted = !!presetGrid && !greetingInFlight(state.messages) && !hasPersonalBuilder(state.messages);
|
|
16057
16341
|
const showDial = dialWanted && onChatTab && !tool && !paused;
|
|
16058
|
-
|
|
16342
|
+
useEffect45(() => {
|
|
16059
16343
|
if (paused) setTool(null);
|
|
16060
16344
|
}, [paused]);
|
|
16061
|
-
|
|
16345
|
+
useEffect45(() => {
|
|
16062
16346
|
if (!paused) return;
|
|
16063
16347
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
16064
16348
|
typedSendRef.current = false;
|
|
@@ -16070,7 +16354,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16070
16354
|
setTool(next);
|
|
16071
16355
|
}, [fold2]);
|
|
16072
16356
|
const onPill = useCallback25((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
|
|
16073
|
-
const toolsValue =
|
|
16357
|
+
const toolsValue = useMemo10(
|
|
16074
16358
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ kind: "combo", total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
16075
16359
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
16076
16360
|
);
|
|
@@ -16088,20 +16372,20 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16088
16372
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
16089
16373
|
return `${k.dayLabel} ${k.time}`;
|
|
16090
16374
|
}, [ui]);
|
|
16091
|
-
|
|
16375
|
+
useEffect45(() => {
|
|
16092
16376
|
if (tool) return;
|
|
16093
16377
|
const target = focusAfterCloseRef.current;
|
|
16094
16378
|
focusAfterCloseRef.current = null;
|
|
16095
16379
|
if (target === "dial") dialButtonRef.current?.focus();
|
|
16096
16380
|
else if (target === "composer") inputRef.current?.focus();
|
|
16097
16381
|
}, [tool]);
|
|
16098
|
-
|
|
16382
|
+
useEffect45(() => {
|
|
16099
16383
|
if (!tool || onChatTab && presetGrid) return;
|
|
16100
16384
|
focusAfterCloseRef.current = "composer";
|
|
16101
16385
|
setTool(null);
|
|
16102
16386
|
}, [tool, onChatTab, presetGrid]);
|
|
16103
|
-
return /* @__PURE__ */
|
|
16104
|
-
/* @__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(
|
|
16105
16389
|
ChatHeader,
|
|
16106
16390
|
{
|
|
16107
16391
|
onClose: () => closeWith("button"),
|
|
@@ -16111,10 +16395,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16111
16395
|
onNewConversation: reset,
|
|
16112
16396
|
canReset: state.messages.length > 0,
|
|
16113
16397
|
newConversationLabel: ui.newConversation,
|
|
16114
|
-
moreOptionsLabel: ui.moreOptions
|
|
16398
|
+
moreOptionsLabel: ui.moreOptions,
|
|
16399
|
+
onOpenSettings: hasSettings ? openSettings : void 0,
|
|
16400
|
+
settingsLabel: ui.settings.title
|
|
16115
16401
|
}
|
|
16116
16402
|
),
|
|
16117
|
-
monitor && /* @__PURE__ */
|
|
16403
|
+
monitor && /* @__PURE__ */ jsx136(
|
|
16118
16404
|
TabBar,
|
|
16119
16405
|
{
|
|
16120
16406
|
monitor,
|
|
@@ -16128,9 +16414,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16128
16414
|
favouritesEnabled: favouritesEnabled ?? false
|
|
16129
16415
|
}
|
|
16130
16416
|
),
|
|
16131
|
-
/* @__PURE__ */
|
|
16132
|
-
/* @__PURE__ */
|
|
16133
|
-
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(
|
|
16134
16420
|
PresetSpeedDial,
|
|
16135
16421
|
{
|
|
16136
16422
|
expanded: dial.expanded,
|
|
@@ -16142,21 +16428,21 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16142
16428
|
buttonRef: dialButtonRef
|
|
16143
16429
|
}
|
|
16144
16430
|
) : null,
|
|
16145
|
-
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
|
|
16146
16432
|
] }),
|
|
16147
|
-
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */
|
|
16148
|
-
monitor && monitor.activeTab === "following" && /* @__PURE__ */
|
|
16149
|
-
monitor && monitor.activeTab === "trends" && /* @__PURE__ */
|
|
16150
|
-
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */
|
|
16151
|
-
monitor && monitor.activeTab === "standings" && /* @__PURE__ */
|
|
16152
|
-
monitor && monitor.activeTab === "squad" && /* @__PURE__ */
|
|
16153
|
-
/* @__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(
|
|
16154
16440
|
"div",
|
|
16155
16441
|
{
|
|
16156
16442
|
ref: squadLayerRef,
|
|
16157
16443
|
style: selectedPlayerId === null ? SQUAD_LAYER_STYLE : HIDDEN_LAYER_STYLE,
|
|
16158
16444
|
"aria-hidden": selectedPlayerId !== null ? true : void 0,
|
|
16159
|
-
children: /* @__PURE__ */
|
|
16445
|
+
children: /* @__PURE__ */ jsx136(
|
|
16160
16446
|
Squad,
|
|
16161
16447
|
{
|
|
16162
16448
|
squad: clubSquadResult?.data ?? null,
|
|
@@ -16174,9 +16460,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16174
16460
|
)
|
|
16175
16461
|
}
|
|
16176
16462
|
),
|
|
16177
|
-
selectedPlayerId !== null && /* @__PURE__ */
|
|
16463
|
+
selectedPlayerId !== null && /* @__PURE__ */ jsx136(PlayerDetail, { detail: clubPlayerDetailResult?.data ?? null, loading: clubPlayerDetailResult?.loading ?? false, ui, seasonName: clubSquadStatsResult?.seasonName ?? null, onClose: closePlayer })
|
|
16178
16464
|
] }),
|
|
16179
|
-
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */
|
|
16465
|
+
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx136(
|
|
16180
16466
|
GamesPanel,
|
|
16181
16467
|
{
|
|
16182
16468
|
loggedIn: !!loggedIn,
|
|
@@ -16191,10 +16477,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16191
16477
|
}
|
|
16192
16478
|
}
|
|
16193
16479
|
),
|
|
16194
|
-
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */
|
|
16195
|
-
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */
|
|
16196
|
-
/* @__PURE__ */
|
|
16197
|
-
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(
|
|
16198
16484
|
ChatInput,
|
|
16199
16485
|
{
|
|
16200
16486
|
ref: inputRef,
|
|
@@ -16208,14 +16494,15 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16208
16494
|
onType: fold2
|
|
16209
16495
|
}
|
|
16210
16496
|
)
|
|
16211
|
-
] })
|
|
16497
|
+
] }),
|
|
16498
|
+
settingsOpen && hasSettings ? /* @__PURE__ */ jsx136(SettingsSheet, { ui, onClose: closeSettings }) : null
|
|
16212
16499
|
] });
|
|
16213
16500
|
}
|
|
16214
16501
|
|
|
16215
16502
|
// src/components/HostEventsProvider.tsx
|
|
16216
|
-
import { jsx as
|
|
16503
|
+
import { jsx as jsx137 } from "react/jsx-runtime";
|
|
16217
16504
|
function HostEventsProvider({ value, children }) {
|
|
16218
|
-
return /* @__PURE__ */
|
|
16505
|
+
return /* @__PURE__ */ jsx137(SlipStateContext.Provider, { value: value.slipState, children });
|
|
16219
16506
|
}
|
|
16220
16507
|
|
|
16221
16508
|
// src/styles/css.generated.ts
|
|
@@ -16886,6 +17173,20 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
16886
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; }
|
|
16887
17174
|
.ss-w-tool-step:disabled { opacity: .5; cursor: not-allowed; }
|
|
16888
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
|
+
}
|
|
16889
17190
|
|
|
16890
17191
|
/* onboarding presets stage 2: the chat layer and the speed dial (spec Stage 2 Behaviour). The
|
|
16891
17192
|
layer is the message list's positioned box (P6), so the dial sits against the list's bottom
|
|
@@ -18720,7 +19021,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18720
19021
|
`;
|
|
18721
19022
|
|
|
18722
19023
|
// src/StatsWidget.tsx
|
|
18723
|
-
import { jsx as
|
|
19024
|
+
import { jsx as jsx138 } from "react/jsx-runtime";
|
|
18724
19025
|
function buildClient(props) {
|
|
18725
19026
|
try {
|
|
18726
19027
|
if ("client" in props && props.client) {
|
|
@@ -18745,12 +19046,12 @@ function injectStyles(root) {
|
|
|
18745
19046
|
function StatsWidget(props) {
|
|
18746
19047
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
18747
19048
|
const cfg = props.config;
|
|
18748
|
-
const built =
|
|
19049
|
+
const built = useMemo11(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
18749
19050
|
const trackingRef = useRef38({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
18750
|
-
const track =
|
|
19051
|
+
const track = useMemo11(() => createTracker(() => trackingRef.current), []);
|
|
18751
19052
|
const eventTextRef = useRef38(false);
|
|
18752
19053
|
eventTextRef.current = cfg?.eventText === true;
|
|
18753
|
-
const logger =
|
|
19054
|
+
const logger = useMemo11(() => {
|
|
18754
19055
|
if (!built) return null;
|
|
18755
19056
|
const raw = built.client.createEventLogger({
|
|
18756
19057
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -18758,7 +19059,8 @@ function StatsWidget(props) {
|
|
|
18758
19059
|
});
|
|
18759
19060
|
return withTracking(raw, track);
|
|
18760
19061
|
}, [built?.client, track]);
|
|
18761
|
-
const ui =
|
|
19062
|
+
const ui = useMemo11(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
19063
|
+
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
18762
19064
|
const rootRef = useRef38(null);
|
|
18763
19065
|
const introDoneRef = useRef38(false);
|
|
18764
19066
|
const markIntroDone = useCallback26(() => {
|
|
@@ -18767,14 +19069,14 @@ function StatsWidget(props) {
|
|
|
18767
19069
|
const language = injectedClient ? void 0 : toUserContext(cfg ?? {})?.defaultLanguage;
|
|
18768
19070
|
const threadLanguage = supportedLanguage(language);
|
|
18769
19071
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
18770
|
-
const sportScope =
|
|
19072
|
+
const sportScope = useMemo11(
|
|
18771
19073
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
18772
19074
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
18773
19075
|
);
|
|
18774
|
-
const chatTracking =
|
|
18775
|
-
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking);
|
|
18776
|
-
const [hasToday, setHasToday] =
|
|
18777
|
-
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(() => {
|
|
18778
19080
|
const seen = /* @__PURE__ */ new Set();
|
|
18779
19081
|
const out = [];
|
|
18780
19082
|
for (const msg of controller.state.messages) {
|
|
@@ -18818,7 +19120,7 @@ function StatsWidget(props) {
|
|
|
18818
19120
|
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
18819
19121
|
[built]
|
|
18820
19122
|
);
|
|
18821
|
-
const pinnedMatchIds =
|
|
19123
|
+
const pinnedMatchIds = useMemo11(
|
|
18822
19124
|
() => footballMatchPinIds(monitor.pins),
|
|
18823
19125
|
[monitor.pins]
|
|
18824
19126
|
);
|
|
@@ -18833,11 +19135,11 @@ function StatsWidget(props) {
|
|
|
18833
19135
|
pinnedMatchIds
|
|
18834
19136
|
});
|
|
18835
19137
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
18836
|
-
|
|
19138
|
+
useEffect46(() => {
|
|
18837
19139
|
setHasToday(todayHasContent);
|
|
18838
19140
|
}, [todayHasContent]);
|
|
18839
19141
|
const prevLiveSnapshotRef = useRef38(monitor.snapshot);
|
|
18840
|
-
|
|
19142
|
+
useEffect46(() => {
|
|
18841
19143
|
const snap = monitor.snapshot;
|
|
18842
19144
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
18843
19145
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -18877,14 +19179,14 @@ function StatsWidget(props) {
|
|
|
18877
19179
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
18878
19180
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
18879
19181
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
18880
|
-
const [favSportPick, setFavSportPick] =
|
|
18881
|
-
const latestGreeting =
|
|
19182
|
+
const [favSportPick, setFavSportPick] = useState74(null);
|
|
19183
|
+
const latestGreeting = useMemo11(() => {
|
|
18882
19184
|
for (const m of [...controller.state.messages].reverse()) {
|
|
18883
19185
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
18884
19186
|
}
|
|
18885
19187
|
return null;
|
|
18886
19188
|
}, [controller.state.messages]);
|
|
18887
|
-
const favSportOptions =
|
|
19189
|
+
const favSportOptions = useMemo11(
|
|
18888
19190
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
18889
19191
|
[latestGreeting]
|
|
18890
19192
|
);
|
|
@@ -18893,7 +19195,7 @@ function StatsWidget(props) {
|
|
|
18893
19195
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
18894
19196
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: favSport.charAt(0).toUpperCase() + favSport.slice(1) }];
|
|
18895
19197
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
18896
|
-
const [panelEverOpened, setPanelEverOpened] =
|
|
19198
|
+
const [panelEverOpened, setPanelEverOpened] = useState74(controller.state.isOpen);
|
|
18897
19199
|
if (controller.state.isOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
18898
19200
|
const favourites = useFavourites({
|
|
18899
19201
|
conversation: built?.conversation ?? null,
|
|
@@ -18911,7 +19213,7 @@ function StatsWidget(props) {
|
|
|
18911
19213
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
18912
19214
|
const markTodayActivity = monitor.markTodayActivity;
|
|
18913
19215
|
const prevLiveCountRef = useRef38(0);
|
|
18914
|
-
|
|
19216
|
+
useEffect46(() => {
|
|
18915
19217
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
18916
19218
|
prevLiveCountRef.current = discovery.liveCount;
|
|
18917
19219
|
if (rose) markTodayActivity();
|
|
@@ -18925,7 +19227,7 @@ function StatsWidget(props) {
|
|
|
18925
19227
|
closePanel: controller.close
|
|
18926
19228
|
});
|
|
18927
19229
|
const markAdded = hostEvents.markAdded;
|
|
18928
|
-
const slip =
|
|
19230
|
+
const slip = useMemo11(
|
|
18929
19231
|
() => {
|
|
18930
19232
|
const handler = props.config?.onAddToSlip;
|
|
18931
19233
|
return {
|
|
@@ -18945,13 +19247,13 @@ function StatsWidget(props) {
|
|
|
18945
19247
|
},
|
|
18946
19248
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
18947
19249
|
);
|
|
18948
|
-
const onDashboardTap =
|
|
19250
|
+
const onDashboardTap = useMemo11(
|
|
18949
19251
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
18950
19252
|
[built, logger]
|
|
18951
19253
|
);
|
|
18952
19254
|
const dismissPopup = usePopupTelemetry(logger, controller.state.isOpen, controller.state.popupText, controller.dismissPopup);
|
|
18953
19255
|
useOpenTelemetry(logger, controller.state.isOpen);
|
|
18954
|
-
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) => ({
|
|
18955
19257
|
label: ask.label,
|
|
18956
19258
|
onTap: () => runBubbleAsk(ask, {
|
|
18957
19259
|
open: controller.open,
|
|
@@ -18964,7 +19266,7 @@ function StatsWidget(props) {
|
|
|
18964
19266
|
const onControlRef = useRef38(props.onControl);
|
|
18965
19267
|
onControlRef.current = props.onControl;
|
|
18966
19268
|
const { open: openPanel, close: closePanel } = controller;
|
|
18967
|
-
|
|
19269
|
+
useEffect46(() => {
|
|
18968
19270
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
18969
19271
|
return () => onControlRef.current?.(null);
|
|
18970
19272
|
}, [openPanel, closePanel]);
|
|
@@ -18981,11 +19283,11 @@ function StatsWidget(props) {
|
|
|
18981
19283
|
page: cfg?.page
|
|
18982
19284
|
}
|
|
18983
19285
|
};
|
|
18984
|
-
|
|
19286
|
+
useEffect46(() => {
|
|
18985
19287
|
if (!logger) return;
|
|
18986
19288
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
18987
19289
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
18988
|
-
|
|
19290
|
+
useEffect46(() => {
|
|
18989
19291
|
if (!logger) return;
|
|
18990
19292
|
logger.resume();
|
|
18991
19293
|
const onHide = () => {
|
|
@@ -19003,15 +19305,15 @@ function StatsWidget(props) {
|
|
|
19003
19305
|
logger.dispose();
|
|
19004
19306
|
};
|
|
19005
19307
|
}, [logger]);
|
|
19006
|
-
|
|
19308
|
+
useEffect46(() => {
|
|
19007
19309
|
if (!built || !ui.injectStyles) return;
|
|
19008
19310
|
const node = rootRef.current?.getRootNode();
|
|
19009
19311
|
if (node) injectStyles(node);
|
|
19010
19312
|
}, [built, ui.injectStyles]);
|
|
19011
19313
|
const holds = useSessionHolds();
|
|
19012
19314
|
const builderConversation = built?.conversation ?? null;
|
|
19013
|
-
const builderMemory =
|
|
19014
|
-
const personalGreeting =
|
|
19315
|
+
const builderMemory = useMemo11(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
19316
|
+
const personalGreeting = useMemo11(() => ({
|
|
19015
19317
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
19016
19318
|
conversation: built?.conversation ?? null,
|
|
19017
19319
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -19023,8 +19325,8 @@ function StatsWidget(props) {
|
|
|
19023
19325
|
memory: builderMemory
|
|
19024
19326
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
19025
19327
|
if (!built) return null;
|
|
19026
|
-
const attrs = themeAttrs(ui);
|
|
19027
|
-
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(
|
|
19028
19330
|
ChatPanel,
|
|
19029
19331
|
{
|
|
19030
19332
|
controller,
|
|
@@ -19046,7 +19348,7 @@ function StatsWidget(props) {
|
|
|
19046
19348
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
19047
19349
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick }
|
|
19048
19350
|
}
|
|
19049
|
-
) }) : /* @__PURE__ */
|
|
19351
|
+
) }) : /* @__PURE__ */ jsx138(
|
|
19050
19352
|
ChatFab,
|
|
19051
19353
|
{
|
|
19052
19354
|
label: ui.launcherLabel,
|
|
@@ -19060,7 +19362,7 @@ function StatsWidget(props) {
|
|
|
19060
19362
|
onIntroStart: markIntroDone,
|
|
19061
19363
|
asks
|
|
19062
19364
|
}
|
|
19063
|
-
) }) }) }) }) });
|
|
19365
|
+
) }) }) }) }) }) });
|
|
19064
19366
|
}
|
|
19065
19367
|
function emptyConversation() {
|
|
19066
19368
|
return { send: () => {
|