@sensiblestats/widget-react 0.111.0 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/index.cjs +155 -664
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +136 -645
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -44
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/StatsWidget.tsx
|
|
2
|
-
import { useCallback as
|
|
2
|
+
import { useCallback as useCallback25, useEffect as useEffect45, useMemo as useMemo11, useRef as useRef37, useState as useState73 } from "react";
|
|
3
3
|
import { StatsWidgetClient } from "@sensiblestats/widget-sdk";
|
|
4
4
|
|
|
5
5
|
// src/kickoff.ts
|
|
@@ -364,19 +364,7 @@ var STRINGS = {
|
|
|
364
364
|
},
|
|
365
365
|
presets: {
|
|
366
366
|
lang: "en",
|
|
367
|
-
setNumbers: "Set the numbers",
|
|
368
367
|
buildCombo: "Build a combo",
|
|
369
|
-
dialName: "Set the numbers and Build a combo",
|
|
370
|
-
maxPriceRow: "{count} picks, max {price}",
|
|
371
|
-
minPriceRow: "Picks from {price} up",
|
|
372
|
-
comboRow: "Combo of {legs} paying {total}",
|
|
373
|
-
bigComboRow: "Total {total} with {legs} matches",
|
|
374
|
-
readyCount: (n) => `${n} ready`,
|
|
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
368
|
comboDisplay: (legs, total) => `A combo of ${legs} priced at about ${total}`,
|
|
381
369
|
comboMessage: (legs, total) => `Build me a combo of ${legs} priced at about ${total}.`,
|
|
382
370
|
unavailable: "Not available today.",
|
|
@@ -386,14 +374,7 @@ var STRINGS = {
|
|
|
386
374
|
matchesLabel: "Matches",
|
|
387
375
|
fewerMatches: "Fewer matches",
|
|
388
376
|
moreMatches: "More matches",
|
|
389
|
-
maxPriceName: "Max price",
|
|
390
|
-
minPriceName: "Lowest price",
|
|
391
|
-
notToday: " \xB7 not today",
|
|
392
377
|
changeCombo: "Change total or matches",
|
|
393
|
-
marketRow: "{market} picks today",
|
|
394
|
-
marketName: "Market",
|
|
395
|
-
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "BTTS", DOUBLE_CHANCE: "Double chance", FULLTIME_RESULT: "Match winner" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
396
|
-
marketMessage: (market, sel, count) => `Show me ${count} ${sel ? `${market} \u2013 ${sel}` : market} picks.`,
|
|
397
378
|
standoutAsk: "Standout matches today"
|
|
398
379
|
},
|
|
399
380
|
nba: {
|
|
@@ -1062,19 +1043,7 @@ var STRINGS = {
|
|
|
1062
1043
|
},
|
|
1063
1044
|
presets: {
|
|
1064
1045
|
lang: "tr",
|
|
1065
|
-
setNumbers: "Say\u0131lar\u0131 belirle",
|
|
1066
1046
|
buildCombo: "Kombin olu\u015Ftur",
|
|
1067
|
-
dialName: "Say\u0131lar\u0131 belirle ve Kombin olu\u015Ftur",
|
|
1068
|
-
maxPriceRow: "{count} se\xE7im, en fazla {price}",
|
|
1069
|
-
minPriceRow: "{price} ve \xFCzeri se\xE7imler",
|
|
1070
|
-
comboRow: "Yakla\u015F\u0131k {total} oranl\u0131 {legs} ma\xE7l\u0131k kombin",
|
|
1071
|
-
bigComboRow: "{legs} ma\xE7la toplam {total}",
|
|
1072
|
-
readyCount: (n) => `${n} haz\u0131r`,
|
|
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
1047
|
comboDisplay: (legs, total) => `${legs} ma\xE7l\u0131k kombin, yakla\u015F\u0131k ${total}`,
|
|
1079
1048
|
comboMessage: (legs, total) => `Yakla\u015F\u0131k ${total} oranl\u0131 ${legs} ma\xE7l\u0131k bir kombin haz\u0131rla.`,
|
|
1080
1049
|
unavailable: "Bug\xFCn mevcut de\u011Fil.",
|
|
@@ -1084,14 +1053,7 @@ var STRINGS = {
|
|
|
1084
1053
|
matchesLabel: "Ma\xE7 say\u0131s\u0131",
|
|
1085
1054
|
fewerMatches: "Daha az ma\xE7",
|
|
1086
1055
|
moreMatches: "Daha fazla ma\xE7",
|
|
1087
|
-
maxPriceName: "En y\xFCksek oran",
|
|
1088
|
-
minPriceName: "En d\xFC\u015F\xFCk oran",
|
|
1089
|
-
notToday: " \xB7 bug\xFCn yok",
|
|
1090
1056
|
changeCombo: "Toplam\u0131 veya ma\xE7lar\u0131 de\u011Fi\u015Ftir",
|
|
1091
|
-
marketRow: "Bug\xFCnk\xFC {market} se\xE7imleri",
|
|
1092
|
-
marketName: "Bahis t\xFCr\xFC",
|
|
1093
|
-
marketShort: (dev, market, sel) => ({ BOTH_TEAMS_TO_SCORE: "KG Var", DOUBLE_CHANCE: "\xC7ifte \u015Fans", FULLTIME_RESULT: "Ma\xE7 sonucu" })[dev] ?? (dev === "GOALS_OVER_UNDER" && sel ? sel : sel ? `${market} ${sel}` : market),
|
|
1094
|
-
marketMessage: (market, sel, count) => `${count} ${sel ? `${market} \u2013 ${sel}` : market} se\xE7imi g\xF6ster.`,
|
|
1095
1057
|
standoutAsk: "Bug\xFCn\xFCn \xF6ne \xE7\u0131kan ma\xE7lar\u0131"
|
|
1096
1058
|
},
|
|
1097
1059
|
nba: {
|
|
@@ -1468,7 +1430,7 @@ function parseOddsFormat(value) {
|
|
|
1468
1430
|
}
|
|
1469
1431
|
|
|
1470
1432
|
// src/version.generated.ts
|
|
1471
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1433
|
+
var WIDGET_REACT_VERSION = "0.112.0";
|
|
1472
1434
|
|
|
1473
1435
|
// src/config.ts
|
|
1474
1436
|
function normalizeUi(cfg) {
|
|
@@ -4957,10 +4919,8 @@ function useClubPlayerDetail(conversation) {
|
|
|
4957
4919
|
import { useEffect as useEffect13, useRef as useRef13, useState as useState13 } from "react";
|
|
4958
4920
|
|
|
4959
4921
|
// src/presetGrid.ts
|
|
4960
|
-
var FIXED_SINGLES_COUNT = 3;
|
|
4961
4922
|
var MIN_COMBO_LEGS = 2;
|
|
4962
4923
|
var MAX_COMBO_LEGS = 6;
|
|
4963
|
-
var START = { maxPrice: 1.5, minPrice: 2, comboTotal: 5, comboLegs: 3 };
|
|
4964
4924
|
var finite2 = (v) => typeof v === "number" && Number.isFinite(v);
|
|
4965
4925
|
var cents = (n) => Math.round(n * 100);
|
|
4966
4926
|
function samePrice(a, b) {
|
|
@@ -4969,14 +4929,12 @@ function samePrice(a, b) {
|
|
|
4969
4929
|
function isPresetGrid(v) {
|
|
4970
4930
|
if (!v || typeof v !== "object") return false;
|
|
4971
4931
|
const g = v;
|
|
4972
|
-
return Array.isArray(g.
|
|
4932
|
+
return Array.isArray(g.combos) && Array.isArray(g.totalOptions) && finite2(g.maxLegs);
|
|
4973
4933
|
}
|
|
4974
4934
|
function drawable(p) {
|
|
4975
4935
|
return !!p && finite2(p.price) && finite2(p.matchOddsId) && finite2(p.matchId) && typeof p.homeTeamName === "string" && typeof p.awayTeamName === "string";
|
|
4976
4936
|
}
|
|
4977
4937
|
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
4938
|
var comboTotals = (grid) => byValue(grid.totalOptions);
|
|
4981
4939
|
function comboLegChoices(grid) {
|
|
4982
4940
|
const max = Math.min(MAX_COMBO_LEGS, Math.floor(grid.maxLegs));
|
|
@@ -4984,9 +4942,6 @@ function comboLegChoices(grid) {
|
|
|
4984
4942
|
for (let n = MIN_COMBO_LEGS; n <= max; n++) out.push(n);
|
|
4985
4943
|
return out;
|
|
4986
4944
|
}
|
|
4987
|
-
function startValue(values, preferred) {
|
|
4988
|
-
return values.find((v) => samePrice(v, preferred)) ?? values[0] ?? preferred;
|
|
4989
|
-
}
|
|
4990
4945
|
function nearest(values, target) {
|
|
4991
4946
|
const first = values[0];
|
|
4992
4947
|
if (first === void 0) return target;
|
|
@@ -5000,10 +4955,6 @@ function clampLegs(values, legs) {
|
|
|
5000
4955
|
if (lo === void 0 || hi === void 0) return legs;
|
|
5001
4956
|
return Math.min(Math.max(Math.round(legs), lo), hi);
|
|
5002
4957
|
}
|
|
5003
|
-
function findSingles(cells, price, count) {
|
|
5004
|
-
const cell2 = cells.find((c) => !!c && finite2(c.price) && samePrice(c.price, price) && c.count === count);
|
|
5005
|
-
return cell2 && Array.isArray(cell2.picks) && cell2.picks.length === count && cell2.picks.every(drawable) ? cell2 : null;
|
|
5006
|
-
}
|
|
5007
4958
|
function findCombo(grid, total, legs) {
|
|
5008
4959
|
const cell2 = grid.combos.find((c) => !!c && finite2(c.total) && samePrice(c.total, total) && c.legs === legs);
|
|
5009
4960
|
const combo = cell2?.combo;
|
|
@@ -5024,45 +4975,9 @@ function legsForTotal(grid, total, legs) {
|
|
|
5024
4975
|
}
|
|
5025
4976
|
return best;
|
|
5026
4977
|
}
|
|
5027
|
-
function startSingles(cells, values, start, count) {
|
|
5028
|
-
const home = startValue(values, start);
|
|
5029
|
-
if (findSingles(cells, home, count)) return home;
|
|
5030
|
-
let best = null;
|
|
5031
|
-
for (const v of values) {
|
|
5032
|
-
if (!findSingles(cells, v, count)) continue;
|
|
5033
|
-
if (best === null || Math.abs(cents(v) - cents(start)) < Math.abs(cents(best) - cents(start))) best = v;
|
|
5034
|
-
}
|
|
5035
|
-
return best ?? home;
|
|
5036
|
-
}
|
|
5037
|
-
function startCombo(grid, totals, legChoices, startTotal, startLegs) {
|
|
5038
|
-
const home = { total: startValue(totals, startTotal), legs: startValue(legChoices, startLegs) };
|
|
5039
|
-
if (findCombo(grid, home.total, home.legs)) return home;
|
|
5040
|
-
let best = null;
|
|
5041
|
-
for (const t of totals) {
|
|
5042
|
-
if (!legChoices.some((n) => findCombo(grid, t, n))) continue;
|
|
5043
|
-
if (best === null || Math.abs(cents(t) - cents(startTotal)) < Math.abs(cents(best) - cents(startTotal))) best = t;
|
|
5044
|
-
}
|
|
5045
|
-
return best === null ? home : { total: best, legs: legsForTotal(grid, best, home.legs) };
|
|
5046
|
-
}
|
|
5047
4978
|
function idsOf(picks) {
|
|
5048
4979
|
return { matchOddsIds: picks.map((p) => p.matchOddsId), matchIds: picks.map((p) => p.matchId) };
|
|
5049
4980
|
}
|
|
5050
|
-
function maxPriceAsk(cell2, s, format2) {
|
|
5051
|
-
const price = formatOdds(cell2.priceFormats, format2);
|
|
5052
|
-
return {
|
|
5053
|
-
message: s.maxPriceMessage(cell2.count, price),
|
|
5054
|
-
displayText: s.maxPriceDisplay(cell2.count, price),
|
|
5055
|
-
preset: { kind: "max_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
5056
|
-
};
|
|
5057
|
-
}
|
|
5058
|
-
function minPriceAsk(cell2, s, format2) {
|
|
5059
|
-
const price = formatOdds(cell2.priceFormats, format2);
|
|
5060
|
-
return {
|
|
5061
|
-
message: s.minPriceMessage(cell2.count, price),
|
|
5062
|
-
displayText: s.minPriceDisplay(cell2.count, price),
|
|
5063
|
-
preset: { kind: "min_price", price: cell2.price, count: cell2.count, ...idsOf(cell2.picks) }
|
|
5064
|
-
};
|
|
5065
|
-
}
|
|
5066
4981
|
function comboAsk(cell2, s, format2) {
|
|
5067
4982
|
const total = formatOdds(cell2.totalFormats, format2);
|
|
5068
4983
|
return {
|
|
@@ -5071,16 +4986,6 @@ function comboAsk(cell2, s, format2) {
|
|
|
5071
4986
|
preset: { kind: "combo", total: cell2.total, legs: cell2.legs, ...idsOf(cell2.combo.legs) }
|
|
5072
4987
|
};
|
|
5073
4988
|
}
|
|
5074
|
-
function marketAsk(cell2, s) {
|
|
5075
|
-
return {
|
|
5076
|
-
message: s.marketMessage(cell2.marketLabel, cell2.selectionLabel ?? null, cell2.count),
|
|
5077
|
-
displayText: marketDisplay(cell2, s),
|
|
5078
|
-
preset: { kind: "market", marketDeveloperName: cell2.marketDeveloperName, ...idsOf(cell2.picks) }
|
|
5079
|
-
};
|
|
5080
|
-
}
|
|
5081
|
-
function marketDisplay(cell2, s) {
|
|
5082
|
-
return s.marketRow.replace("{market}", s.marketShort(cell2.marketDeveloperName, cell2.marketLabel, cell2.selectionLabel ?? null));
|
|
5083
|
-
}
|
|
5084
4989
|
|
|
5085
4990
|
// src/usePresetGrid.ts
|
|
5086
4991
|
var GRID_MAX_AGE_MS = 6e5;
|
|
@@ -5128,7 +5033,7 @@ function usePresetGrid({ getPricePresets, isOpen, locale, now = Date.now }) {
|
|
|
5128
5033
|
return grid;
|
|
5129
5034
|
}
|
|
5130
5035
|
function hasAnyCell(grid) {
|
|
5131
|
-
return grid.
|
|
5036
|
+
return grid.combos.length > 0;
|
|
5132
5037
|
}
|
|
5133
5038
|
|
|
5134
5039
|
// src/useFavourites.ts
|
|
@@ -5385,20 +5290,6 @@ function KebabIcon() {
|
|
|
5385
5290
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "1.6" })
|
|
5386
5291
|
] }) });
|
|
5387
5292
|
}
|
|
5388
|
-
function SlidersIcon() {
|
|
5389
|
-
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
5390
|
-
/* @__PURE__ */ jsx("path", { d: "M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1" }),
|
|
5391
|
-
/* @__PURE__ */ jsx("circle", { cx: "15", cy: "6", r: "2" }),
|
|
5392
|
-
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "2" }),
|
|
5393
|
-
/* @__PURE__ */ jsx("circle", { cx: "17", cy: "18", r: "2" })
|
|
5394
|
-
] }) });
|
|
5395
|
-
}
|
|
5396
|
-
function ComboIcon() {
|
|
5397
|
-
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinejoin: "round", children: [
|
|
5398
|
-
/* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "11", height: "11", rx: "2" }),
|
|
5399
|
-
/* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "11", height: "11", rx: "2" })
|
|
5400
|
-
] }) });
|
|
5401
|
-
}
|
|
5402
5293
|
var DASHBOARD_EMOJI = {
|
|
5403
5294
|
football: "\u26BD",
|
|
5404
5295
|
"goal-net": "\u{1F945}",
|
|
@@ -7685,7 +7576,7 @@ function ChatFab({ label, greeting, popupText, logoUrl, onOpen, onDismissPopup,
|
|
|
7685
7576
|
}
|
|
7686
7577
|
|
|
7687
7578
|
// src/components/ChatPanel.tsx
|
|
7688
|
-
import { useCallback as
|
|
7579
|
+
import { useCallback as useCallback24, useEffect as useEffect44, useLayoutEffect as useLayoutEffect3, useMemo as useMemo10, useRef as useRef36, useState as useState72 } from "react";
|
|
7689
7580
|
|
|
7690
7581
|
// src/components/ChatHeader.tsx
|
|
7691
7582
|
import { useEffect as useEffect25, useRef as useRef21, useState as useState31 } from "react";
|
|
@@ -9999,7 +9890,7 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor }) {
|
|
|
9999
9890
|
// src/components/ChatInput.tsx
|
|
10000
9891
|
import { forwardRef, useEffect as useEffect30, useImperativeHandle, useRef as useRef25, useState as useState41 } from "react";
|
|
10001
9892
|
import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
10002
|
-
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false
|
|
9893
|
+
var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel = "Stop response", sendLabel = "Send message", disabled = false }, ref) {
|
|
10003
9894
|
const [value, setValue] = useState41("");
|
|
10004
9895
|
const textareaRef = useRef25(null);
|
|
10005
9896
|
const stopRef = useRef25(null);
|
|
@@ -10051,7 +9942,6 @@ var ChatInput = forwardRef(function ChatInput2({ placeholder, streaming, onSend,
|
|
|
10051
9942
|
disabled: streaming || disabled,
|
|
10052
9943
|
onChange: (e) => {
|
|
10053
9944
|
setValue(e.target.value);
|
|
10054
|
-
onType?.();
|
|
10055
9945
|
},
|
|
10056
9946
|
onKeyDown
|
|
10057
9947
|
}
|
|
@@ -15746,50 +15636,13 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
15746
15636
|
] });
|
|
15747
15637
|
}
|
|
15748
15638
|
|
|
15749
|
-
// src/components/PresetSpeedDial.tsx
|
|
15750
|
-
import { useId as useId10 } from "react";
|
|
15751
|
-
import { jsx as jsx133, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
15752
|
-
function PresetSpeedDial({ expanded, showDot, strings, onToggle, onOpen, rootRef, buttonRef }) {
|
|
15753
|
-
const pillsId = useId10();
|
|
15754
|
-
const tabIndex = expanded ? 0 : -1;
|
|
15755
|
-
return /* @__PURE__ */ jsxs117("div", { ref: rootRef, className: "ss-w-dial", children: [
|
|
15756
|
-
/* @__PURE__ */ jsxs117(
|
|
15757
|
-
"button",
|
|
15758
|
-
{
|
|
15759
|
-
ref: buttonRef,
|
|
15760
|
-
type: "button",
|
|
15761
|
-
className: "ss-w-dial-btn",
|
|
15762
|
-
"aria-expanded": expanded,
|
|
15763
|
-
"aria-controls": pillsId,
|
|
15764
|
-
"aria-label": strings.dialName,
|
|
15765
|
-
onClick: onToggle,
|
|
15766
|
-
children: [
|
|
15767
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-icon ss-w-dial-icon--open", children: /* @__PURE__ */ jsx133(SlidersIcon, {}) }),
|
|
15768
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-icon ss-w-dial-icon--close", children: /* @__PURE__ */ jsx133(CloseIcon, {}) }),
|
|
15769
|
-
showDot && !expanded ? /* @__PURE__ */ jsx133("span", { className: "ss-w-dial-dot", "aria-hidden": "true" }) : null
|
|
15770
|
-
]
|
|
15771
|
-
}
|
|
15772
|
-
),
|
|
15773
|
-
/* @__PURE__ */ jsxs117("div", { id: pillsId, className: "ss-w-dial-pills", "data-open": expanded ? "" : void 0, children: [
|
|
15774
|
-
/* @__PURE__ */ jsxs117("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("numbers"), children: [
|
|
15775
|
-
/* @__PURE__ */ jsx133(SlidersIcon, {}),
|
|
15776
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-pill-label", children: strings.setNumbers })
|
|
15777
|
-
] }),
|
|
15778
|
-
/* @__PURE__ */ jsxs117("button", { type: "button", className: "ss-w-dial-pill", tabIndex, onClick: () => onOpen("combo"), children: [
|
|
15779
|
-
/* @__PURE__ */ jsx133(ComboIcon, {}),
|
|
15780
|
-
/* @__PURE__ */ jsx133("span", { className: "ss-w-dial-pill-label", children: strings.buildCombo })
|
|
15781
|
-
] })
|
|
15782
|
-
] })
|
|
15783
|
-
] });
|
|
15784
|
-
}
|
|
15785
|
-
|
|
15786
15639
|
// src/components/PresetTools.tsx
|
|
15787
|
-
import {
|
|
15788
|
-
import { Fragment as
|
|
15640
|
+
import { useEffect as useEffect43, useId as useId10, useRef as useRef35, useState as useState71 } from "react";
|
|
15641
|
+
import { Fragment as Fragment39, jsx as jsx133, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
15789
15642
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
15790
15643
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
15791
15644
|
const dialogRef = useRef35(null);
|
|
15792
|
-
const titleId =
|
|
15645
|
+
const titleId = useId10();
|
|
15793
15646
|
useEffect43(() => {
|
|
15794
15647
|
dialogRef.current?.focus({ preventScroll: true });
|
|
15795
15648
|
}, []);
|
|
@@ -15823,241 +15676,57 @@ function PresetToolModal({ title, closeLabel, onClose, children, footer, classNa
|
|
|
15823
15676
|
first.focus();
|
|
15824
15677
|
}
|
|
15825
15678
|
};
|
|
15826
|
-
return /* @__PURE__ */
|
|
15827
|
-
/* @__PURE__ */
|
|
15828
|
-
/* @__PURE__ */
|
|
15829
|
-
/* @__PURE__ */
|
|
15679
|
+
return /* @__PURE__ */ jsx133("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ jsxs117("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapTab, children: [
|
|
15680
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-head", children: [
|
|
15681
|
+
/* @__PURE__ */ jsx133("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
15682
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx133(CloseIcon, {}) })
|
|
15830
15683
|
] }),
|
|
15831
|
-
/* @__PURE__ */
|
|
15832
|
-
footer ? /* @__PURE__ */
|
|
15684
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-body", children }),
|
|
15685
|
+
footer ? /* @__PURE__ */ jsx133("div", { className: "ss-w-tool-foot", children: footer }) : null
|
|
15833
15686
|
] }) });
|
|
15834
15687
|
}
|
|
15835
|
-
function fillTemplate(template, slots) {
|
|
15836
|
-
return template.split(/(\{[a-z]+\})/).filter((part) => part !== "").map((part, i) => {
|
|
15837
|
-
const key = /^\{([a-z]+)\}$/.exec(part)?.[1];
|
|
15838
|
-
return /* @__PURE__ */ jsx134(Fragment39, { children: key !== void 0 && key in slots ? slots[key] : part }, i);
|
|
15839
|
-
});
|
|
15840
|
-
}
|
|
15841
|
-
function NumberSelect({ current, choices, label, notToday, lockEmpty = true, onChoose }) {
|
|
15842
|
-
const selected = Math.max(0, choices.findIndex((c) => samePrice(c.value, current)));
|
|
15843
|
-
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15844
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: choices[selected]?.text ?? "" }),
|
|
15845
|
-
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(selected), onChange: (e) => {
|
|
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)) })
|
|
15849
|
-
] });
|
|
15850
|
-
}
|
|
15851
|
-
function ChoiceSelect({ currentIdx, sizeLabels, optionLabels, label, onChoose }) {
|
|
15852
|
-
const sizeText = sizeLabels[currentIdx] ?? "";
|
|
15853
|
-
return /* @__PURE__ */ jsxs118("span", { className: "ss-w-tool-num", children: [
|
|
15854
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-num-size", "aria-hidden": "true", children: sizeText }),
|
|
15855
|
-
/* @__PURE__ */ jsx134("select", { className: "ss-w-tool-num-select", "aria-label": label, value: String(currentIdx), onChange: (e) => onChoose(Number(e.target.value)), children: optionLabels.map((opt, i) => /* @__PURE__ */ jsx134("option", { value: String(i), children: opt }, i)) })
|
|
15856
|
-
] });
|
|
15857
|
-
}
|
|
15858
15688
|
function SendButton({ label, display, disabled, onClick }) {
|
|
15859
|
-
return /* @__PURE__ */
|
|
15689
|
+
return /* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-send", "aria-label": `${label}: ${display}`, disabled, onClick, children: label });
|
|
15860
15690
|
}
|
|
15861
15691
|
function PickList({ picks, formatKickoff }) {
|
|
15862
15692
|
const { oddsFormat } = useOddsSettings();
|
|
15863
|
-
return /* @__PURE__ */
|
|
15864
|
-
/* @__PURE__ */
|
|
15693
|
+
return /* @__PURE__ */ jsx133("ul", { className: "ss-w-tool-picks", role: "list", children: picks.map((p) => /* @__PURE__ */ jsxs117("li", { className: "ss-w-tool-pick", children: [
|
|
15694
|
+
/* @__PURE__ */ jsxs117("span", { className: "ss-w-tool-pick-match", children: [
|
|
15865
15695
|
p.homeTeamName,
|
|
15866
15696
|
" \u2013 ",
|
|
15867
15697
|
p.awayTeamName
|
|
15868
15698
|
] }),
|
|
15869
|
-
/* @__PURE__ */
|
|
15699
|
+
/* @__PURE__ */ jsxs117("span", { className: "ss-w-tool-pick-sel", children: [
|
|
15870
15700
|
p.marketLabel,
|
|
15871
15701
|
": ",
|
|
15872
15702
|
p.selectionLabel,
|
|
15873
15703
|
p.line ? ` ${p.line}` : ""
|
|
15874
15704
|
] }),
|
|
15875
|
-
/* @__PURE__ */
|
|
15876
|
-
/* @__PURE__ */
|
|
15705
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-pick-kick", children: formatKickoff(p.kickoffUtc) }),
|
|
15706
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-pick-price", children: formatOdds(p.priceFormats, oddsFormat) })
|
|
15877
15707
|
] }, p.matchOddsId)) });
|
|
15878
15708
|
}
|
|
15879
15709
|
function ComboPreview({ cell: cell2, formatKickoff }) {
|
|
15880
15710
|
const { oddsFormat } = useOddsSettings();
|
|
15881
|
-
return /* @__PURE__ */
|
|
15882
|
-
/* @__PURE__ */
|
|
15883
|
-
/* @__PURE__ */
|
|
15711
|
+
return /* @__PURE__ */ jsxs117(Fragment39, { children: [
|
|
15712
|
+
/* @__PURE__ */ jsx133(PickList, { picks: cell2.combo.legs, formatKickoff }),
|
|
15713
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-math", children: oddsFormat === "decimal" ? cell2.combo.multiplication : formatOdds(cell2.combo.totalFormats, oddsFormat) })
|
|
15884
15714
|
] });
|
|
15885
15715
|
}
|
|
15886
15716
|
function Unavailable({ text }) {
|
|
15887
|
-
return /* @__PURE__ */
|
|
15888
|
-
}
|
|
15889
|
-
function AskRow({ icon, ask, ready, send }) {
|
|
15890
|
-
return /* @__PURE__ */ jsxs118("section", { className: "ss-w-tool-row ss-w-tool-row--ask", children: [
|
|
15891
|
-
/* @__PURE__ */ jsx134("span", { className: "ss-w-tool-icon", "aria-hidden": "true", children: icon }),
|
|
15892
|
-
/* @__PURE__ */ jsxs118("div", { className: "ss-w-tool-main", children: [
|
|
15893
|
-
/* @__PURE__ */ jsx134("p", { className: "ss-w-tool-ask", children: ask }),
|
|
15894
|
-
ready ? /* @__PURE__ */ jsx134("span", { className: "ss-w-tool-ready", children: ready }) : null
|
|
15895
|
-
] }),
|
|
15896
|
-
send
|
|
15897
|
-
] });
|
|
15898
|
-
}
|
|
15899
|
-
function RoundSend({ label, display, disabled, onClick }) {
|
|
15900
|
-
return /* @__PURE__ */ jsx134("button", { type: "button", className: "ss-w-tool-go", "aria-label": `${label}: ${display}`, disabled, onClick, children: /* @__PURE__ */ jsx134(SendIcon, {}) });
|
|
15717
|
+
return /* @__PURE__ */ jsx133("p", { className: "ss-w-tool-unavailable", children: text });
|
|
15901
15718
|
}
|
|
15902
|
-
var optionChoice = (o, format2, available) => ({ key: o.key, value: o.value, text: formatOdds(o.formats, format2), available });
|
|
15903
15719
|
var textOf = (options, value, format2) => {
|
|
15904
15720
|
const o = options.find((x) => samePrice(x.value, value));
|
|
15905
15721
|
return o ? formatOdds(o.formats, format2) : "";
|
|
15906
15722
|
};
|
|
15907
|
-
var BIG_COMBO = { total: 50, legs: 6 };
|
|
15908
|
-
function SetNumbersTool({ grid, strings, streaming, onSend, onClose }) {
|
|
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);
|
|
15916
|
-
const legChoices = comboLegChoices(grid);
|
|
15917
|
-
const count = FIXED_SINGLES_COUNT;
|
|
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("");
|
|
15927
|
-
const maxCell = findSingles(grid.singles, maxPrice, count);
|
|
15928
|
-
const minCell = findSingles(grid.singlesFrom, minPrice, count);
|
|
15929
|
-
const comboCell = findCombo(grid, total, legs);
|
|
15930
|
-
const bigCell = findCombo(grid, bigTotal, bigLegs);
|
|
15931
|
-
const announce = (display, available) => setAnnouncement(available ? display : `${display}. ${strings.unavailable}`);
|
|
15932
|
-
const chooseMarket = (idx) => {
|
|
15933
|
-
setMarketIdx(idx);
|
|
15934
|
-
const cell2 = markets[idx];
|
|
15935
|
-
if (cell2) announce(marketDisplay(cell2, strings), cell2.count > 0);
|
|
15936
|
-
};
|
|
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));
|
|
15941
|
-
};
|
|
15942
|
-
const chooseMin = (c) => {
|
|
15943
|
-
setMinPrice(c.value);
|
|
15944
|
-
announce(strings.minPriceDisplay(count, c.text), !!findSingles(grid.singlesFrom, c.value, count));
|
|
15945
|
-
};
|
|
15946
|
-
const chooseLegs = (c) => {
|
|
15947
|
-
setLegs(c.value);
|
|
15948
|
-
announce(strings.comboDisplay(c.value, totalText(total)), !!findCombo(grid, total, c.value));
|
|
15949
|
-
};
|
|
15950
|
-
const chooseTotal = (c) => {
|
|
15951
|
-
const l = legsForTotal(grid, c.value, legs);
|
|
15952
|
-
setTotal(c.value);
|
|
15953
|
-
setLegs(l);
|
|
15954
|
-
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15955
|
-
};
|
|
15956
|
-
const chooseBigLegs = (c) => {
|
|
15957
|
-
setBigLegs(c.value);
|
|
15958
|
-
announce(strings.comboDisplay(c.value, totalText(bigTotal)), !!findCombo(grid, bigTotal, c.value));
|
|
15959
|
-
};
|
|
15960
|
-
const chooseBigTotal = (c) => {
|
|
15961
|
-
const l = legsForTotal(grid, c.value, bigLegs);
|
|
15962
|
-
setBigTotal(c.value);
|
|
15963
|
-
setBigLegs(l);
|
|
15964
|
-
announce(strings.comboDisplay(l, c.text), !!findCombo(grid, c.value, l));
|
|
15965
|
-
};
|
|
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) }));
|
|
15970
|
-
const markets = grid.markets ?? [];
|
|
15971
|
-
const [marketIdx, setMarketIdx] = useState71(0);
|
|
15972
|
-
const marketCell = markets[marketIdx] ?? null;
|
|
15973
|
-
const marketLabels = markets.map((c) => strings.marketShort(c.marketDeveloperName, c.marketLabel, c.selectionLabel ?? null));
|
|
15974
|
-
const singlesReady = (cell2) => cell2 ? strings.readyCount(cell2.picks.length) : strings.unavailable;
|
|
15975
|
-
const comboReady = (cell2) => cell2 ? strings.readyAt(formatOdds(cell2.combo.totalFormats, oddsFormat)) : strings.unavailable;
|
|
15976
|
-
return /* @__PURE__ */ jsxs118(PresetToolModal, { title: strings.setNumbers, closeLabel: strings.close, onClose, children: [
|
|
15977
|
-
/* @__PURE__ */ jsx134(
|
|
15978
|
-
AskRow,
|
|
15979
|
-
{
|
|
15980
|
-
icon: "\u{1F3AF}",
|
|
15981
|
-
ask: fillTemplate(strings.maxPriceRow, {
|
|
15982
|
-
count: String(count),
|
|
15983
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: maxPrice, choices: maxChoices, label: strings.maxPriceName, notToday: strings.notToday, onChoose: chooseMax })
|
|
15984
|
-
}),
|
|
15985
|
-
ready: singlesReady(maxCell),
|
|
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));
|
|
15988
|
-
} })
|
|
15989
|
-
}
|
|
15990
|
-
),
|
|
15991
|
-
/* @__PURE__ */ jsx134(
|
|
15992
|
-
AskRow,
|
|
15993
|
-
{
|
|
15994
|
-
icon: "\u{1F4C8}",
|
|
15995
|
-
ask: fillTemplate(strings.minPriceRow, {
|
|
15996
|
-
count: String(count),
|
|
15997
|
-
price: /* @__PURE__ */ jsx134(NumberSelect, { current: minPrice, choices: minChoices, label: strings.minPriceName, notToday: strings.notToday, onChoose: chooseMin })
|
|
15998
|
-
}),
|
|
15999
|
-
ready: singlesReady(minCell),
|
|
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));
|
|
16002
|
-
} })
|
|
16003
|
-
}
|
|
16004
|
-
),
|
|
16005
|
-
/* @__PURE__ */ jsx134(
|
|
16006
|
-
AskRow,
|
|
16007
|
-
{
|
|
16008
|
-
icon: "\u2728",
|
|
16009
|
-
ask: fillTemplate(strings.comboRow, {
|
|
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 })
|
|
16012
|
-
}),
|
|
16013
|
-
ready: comboReady(comboCell),
|
|
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));
|
|
16016
|
-
} })
|
|
16017
|
-
}
|
|
16018
|
-
),
|
|
16019
|
-
/* @__PURE__ */ jsx134(
|
|
16020
|
-
AskRow,
|
|
16021
|
-
{
|
|
16022
|
-
icon: "\u{1F3C6}",
|
|
16023
|
-
ask: fillTemplate(strings.bigComboRow, {
|
|
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 })
|
|
16026
|
-
}),
|
|
16027
|
-
ready: comboReady(bigCell),
|
|
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));
|
|
16030
|
-
} })
|
|
16031
|
-
}
|
|
16032
|
-
),
|
|
16033
|
-
markets.length > 0 && /* @__PURE__ */ jsx134(
|
|
16034
|
-
AskRow,
|
|
16035
|
-
{
|
|
16036
|
-
icon: "\u26BD",
|
|
16037
|
-
ask: fillTemplate(strings.marketRow, {
|
|
16038
|
-
market: /* @__PURE__ */ jsx134(ChoiceSelect, { currentIdx: marketIdx, sizeLabels: marketLabels, optionLabels: marketLabels, label: strings.marketName, onChoose: chooseMarket })
|
|
16039
|
-
}),
|
|
16040
|
-
ready: marketCell ? strings.readyCount(marketCell.count) : null,
|
|
16041
|
-
send: /* @__PURE__ */ jsx134(RoundSend, { label: strings.send, display: marketCell ? marketDisplay(marketCell, strings) : "", disabled: !marketCell || streaming, onClick: () => {
|
|
16042
|
-
if (marketCell) onSend(marketAsk(marketCell, strings));
|
|
16043
|
-
} })
|
|
16044
|
-
}
|
|
16045
|
-
),
|
|
16046
|
-
/* @__PURE__ */ jsx134("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
16047
|
-
] });
|
|
16048
|
-
}
|
|
16049
15723
|
function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal, initialLegs, onSend, onClose }) {
|
|
16050
15724
|
const { oddsFormat } = useOddsSettings();
|
|
16051
15725
|
const totalOptions = comboTotals(grid);
|
|
16052
15726
|
const totals = totalOptions.map((o) => o.value);
|
|
16053
15727
|
const legChoices = comboLegChoices(grid);
|
|
16054
|
-
const [
|
|
16055
|
-
const [
|
|
16056
|
-
const [legs, setLegs] = useState71(() => {
|
|
16057
|
-
if (initialTotal === void 0) return initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : start.legs;
|
|
16058
|
-
const from = initialLegs !== void 0 ? clampLegs(legChoices, initialLegs) : startValue(legChoices, START.comboLegs);
|
|
16059
|
-
return legsForTotal(grid, nearest(totals, initialTotal), from);
|
|
16060
|
-
});
|
|
15728
|
+
const [total, setTotal] = useState71(() => nearest(totals, initialTotal));
|
|
15729
|
+
const [legs, setLegs] = useState71(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
16061
15730
|
const [announcement, setAnnouncement] = useState71("");
|
|
16062
15731
|
const cell2 = findCombo(grid, total, legs);
|
|
16063
15732
|
const minLegs = legChoices[0] ?? legs;
|
|
@@ -16069,164 +15738,67 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
16069
15738
|
const d = strings.comboDisplay(nextLegs, textOf(totalOptions, nextTotal, oddsFormat));
|
|
16070
15739
|
setAnnouncement(findCombo(grid, nextTotal, nextLegs) ? d : `${d}. ${strings.unavailable}`);
|
|
16071
15740
|
};
|
|
16072
|
-
const footer = /* @__PURE__ */
|
|
15741
|
+
const footer = /* @__PURE__ */ jsx133(SendButton, { label: strings.send, display, disabled: !cell2 || streaming, onClick: () => {
|
|
16073
15742
|
if (cell2) onSend(comboAsk(cell2, strings, oddsFormat));
|
|
16074
15743
|
} });
|
|
16075
|
-
return /* @__PURE__ */
|
|
16076
|
-
/* @__PURE__ */
|
|
16077
|
-
/* @__PURE__ */
|
|
16078
|
-
/* @__PURE__ */
|
|
15744
|
+
return /* @__PURE__ */ jsxs117(PresetToolModal, { title: strings.buildCombo, closeLabel: strings.close, onClose, footer, children: [
|
|
15745
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.totalLabel, children: [
|
|
15746
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.totalLabel }),
|
|
15747
|
+
/* @__PURE__ */ jsx133("div", { className: "ss-w-tool-chips", children: totalOptions.map((o) => /* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-chip", "aria-pressed": samePrice(o.value, total), onClick: () => choose(o.value, samePrice(o.value, total) ? legs : legsForTotal(grid, o.value, legs)), children: formatOdds(o.formats, oddsFormat) }, o.key)) })
|
|
16079
15748
|
] }),
|
|
16080
|
-
/* @__PURE__ */
|
|
16081
|
-
/* @__PURE__ */
|
|
16082
|
-
/* @__PURE__ */
|
|
16083
|
-
/* @__PURE__ */
|
|
16084
|
-
/* @__PURE__ */
|
|
16085
|
-
/* @__PURE__ */
|
|
15749
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-section", role: "group", "aria-label": strings.matchesLabel, children: [
|
|
15750
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-label", "aria-hidden": "true", children: strings.matchesLabel }),
|
|
15751
|
+
/* @__PURE__ */ jsxs117("div", { className: "ss-w-tool-stepper", children: [
|
|
15752
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.fewerMatches, disabled: legs <= minLegs, onClick: () => choose(total, legs - 1), children: "\u2212" }),
|
|
15753
|
+
/* @__PURE__ */ jsx133("span", { className: "ss-w-tool-count", children: legs }),
|
|
15754
|
+
/* @__PURE__ */ jsx133("button", { type: "button", className: "ss-w-tool-step", "aria-label": strings.moreMatches, disabled: legs >= maxLegs, onClick: () => choose(total, legs + 1), children: "+" })
|
|
16086
15755
|
] })
|
|
16087
15756
|
] }),
|
|
16088
|
-
cell2 ? /* @__PURE__ */
|
|
16089
|
-
/* @__PURE__ */
|
|
15757
|
+
cell2 ? /* @__PURE__ */ jsx133(ComboPreview, { cell: cell2, formatKickoff }) : /* @__PURE__ */ jsx133(Unavailable, { text: strings.unavailable }),
|
|
15758
|
+
/* @__PURE__ */ jsx133("p", { className: "ss-w-vh", "aria-live": "polite", children: announcement })
|
|
16090
15759
|
] });
|
|
16091
15760
|
}
|
|
16092
15761
|
|
|
16093
15762
|
// src/components/SettingsSheet.tsx
|
|
16094
|
-
import { jsx as
|
|
15763
|
+
import { jsx as jsx134, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
16095
15764
|
var SAMPLE = { decimal: "2.50", american: "+150", fractional: "3/2" };
|
|
16096
15765
|
var ODDS = ["decimal", "fractional", "american"];
|
|
16097
15766
|
var THEMES2 = ["light", "dark", "auto"];
|
|
16098
15767
|
function SettingsSheet({ ui, onClose }) {
|
|
16099
15768
|
const s = useOddsSettings();
|
|
16100
15769
|
const t = ui.settings;
|
|
16101
|
-
return /* @__PURE__ */
|
|
15770
|
+
return /* @__PURE__ */ jsxs118(
|
|
16102
15771
|
PresetToolModal,
|
|
16103
15772
|
{
|
|
16104
15773
|
title: t.title,
|
|
16105
15774
|
closeLabel: t.close,
|
|
16106
15775
|
onClose,
|
|
16107
15776
|
className: "ss-w-set-backdrop-in",
|
|
16108
|
-
footer: /* @__PURE__ */
|
|
15777
|
+
footer: /* @__PURE__ */ jsx134("p", { className: "ss-w-set-foot", children: t.foot }),
|
|
16109
15778
|
children: [
|
|
16110
|
-
s.oddsOffered && /* @__PURE__ */
|
|
16111
|
-
/* @__PURE__ */
|
|
16112
|
-
/* @__PURE__ */
|
|
16113
|
-
/* @__PURE__ */
|
|
16114
|
-
/* @__PURE__ */
|
|
15779
|
+
s.oddsOffered && /* @__PURE__ */ jsxs118("div", { className: "ss-w-set-row", children: [
|
|
15780
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-label", id: "ss-w-set-odds", children: t.oddsLabel }),
|
|
15781
|
+
/* @__PURE__ */ jsxs118("div", { className: "ss-w-set-sample", children: [
|
|
15782
|
+
/* @__PURE__ */ jsx134("span", { children: t.sampleLabel }),
|
|
15783
|
+
/* @__PURE__ */ jsx134("b", { children: formatOdds(SAMPLE, s.oddsFormat) })
|
|
16115
15784
|
] }),
|
|
16116
|
-
/* @__PURE__ */
|
|
15785
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-odds", children: ODDS.map((f) => /* @__PURE__ */ jsx134("button", { type: "button", "aria-pressed": s.oddsFormat === f, onClick: () => s.setOddsFormat(f), children: t[f] }, f)) })
|
|
16117
15786
|
] }),
|
|
16118
|
-
!s.themeLocked && /* @__PURE__ */
|
|
16119
|
-
/* @__PURE__ */
|
|
16120
|
-
/* @__PURE__ */
|
|
15787
|
+
!s.themeLocked && /* @__PURE__ */ jsxs118("div", { className: "ss-w-set-row", children: [
|
|
15788
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-tool-label", id: "ss-w-set-theme", children: t.themeLabel }),
|
|
15789
|
+
/* @__PURE__ */ jsx134("div", { className: "ss-w-set-seg", role: "group", "aria-labelledby": "ss-w-set-theme", children: THEMES2.map((m) => /* @__PURE__ */ jsx134("button", { type: "button", "aria-pressed": s.theme === m, onClick: () => s.setTheme(m), children: t[m] }, m)) })
|
|
16121
15790
|
] })
|
|
16122
15791
|
]
|
|
16123
15792
|
}
|
|
16124
15793
|
);
|
|
16125
15794
|
}
|
|
16126
15795
|
|
|
16127
|
-
// src/usePresetDial.ts
|
|
16128
|
-
import { useCallback as useCallback24, useEffect as useEffect44, useRef as useRef36, useState as useState72 } from "react";
|
|
16129
|
-
function sendInFlight(messages, isStreaming) {
|
|
16130
|
-
const last = messages[messages.length - 1];
|
|
16131
|
-
return isStreaming && !!last && last.role === "assistant" && !last.done && !last.isGreeting;
|
|
16132
|
-
}
|
|
16133
|
-
function lastUserId(messages) {
|
|
16134
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
16135
|
-
const m = messages[i];
|
|
16136
|
-
if (m && m.role === "user") return m.id;
|
|
16137
|
-
}
|
|
16138
|
-
return null;
|
|
16139
|
-
}
|
|
16140
|
-
var SCROLL_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End", " "]);
|
|
16141
|
-
function usePresetDial({ layerRef, dialRef, dialButtonRef, messages, isStreaming, activeTab }) {
|
|
16142
|
-
const [expanded, setExpanded] = useState72(() => !sendInFlight(messages, isStreaming));
|
|
16143
|
-
const fold2 = useCallback24(() => setExpanded(false), []);
|
|
16144
|
-
const toggle = useCallback24(() => setExpanded((e) => !e), []);
|
|
16145
|
-
const currentUserId = lastUserId(messages);
|
|
16146
|
-
const userIdRef = useRef36(currentUserId);
|
|
16147
|
-
useEffect44(() => {
|
|
16148
|
-
if (currentUserId === userIdRef.current) return;
|
|
16149
|
-
userIdRef.current = currentUserId;
|
|
16150
|
-
setExpanded(false);
|
|
16151
|
-
}, [currentUserId]);
|
|
16152
|
-
const tabRef = useRef36(activeTab);
|
|
16153
|
-
useEffect44(() => {
|
|
16154
|
-
if (activeTab === tabRef.current) return;
|
|
16155
|
-
tabRef.current = activeTab;
|
|
16156
|
-
setExpanded(false);
|
|
16157
|
-
}, [activeTab]);
|
|
16158
|
-
const expandedRef = useRef36(expanded);
|
|
16159
|
-
expandedRef.current = expanded;
|
|
16160
|
-
useEffect44(() => {
|
|
16161
|
-
const onEscape = (e) => {
|
|
16162
|
-
const dial = dialRef.current;
|
|
16163
|
-
if (e.key !== "Escape" || !dial || !e.composedPath().includes(dial)) return;
|
|
16164
|
-
e.stopPropagation();
|
|
16165
|
-
e.preventDefault();
|
|
16166
|
-
if (!expandedRef.current) return;
|
|
16167
|
-
setExpanded(false);
|
|
16168
|
-
dialButtonRef.current?.focus();
|
|
16169
|
-
};
|
|
16170
|
-
window.addEventListener("keydown", onEscape, true);
|
|
16171
|
-
return () => window.removeEventListener("keydown", onEscape, true);
|
|
16172
|
-
}, [dialRef, dialButtonRef]);
|
|
16173
|
-
useEffect44(() => {
|
|
16174
|
-
if (!expanded) return;
|
|
16175
|
-
const layer = layerRef.current;
|
|
16176
|
-
const inDial = (e) => {
|
|
16177
|
-
const dial = dialRef.current;
|
|
16178
|
-
return !!dial && e.composedPath().includes(dial);
|
|
16179
|
-
};
|
|
16180
|
-
const inList = (e) => e.composedPath().some((n) => n instanceof Element && n.classList.contains("ss-w-list"));
|
|
16181
|
-
const onPress = (e) => {
|
|
16182
|
-
if (!inDial(e)) setExpanded(false);
|
|
16183
|
-
};
|
|
16184
|
-
const onScrollGesture = (e) => {
|
|
16185
|
-
if (inList(e) && !inDial(e)) setExpanded(false);
|
|
16186
|
-
};
|
|
16187
|
-
const onKey = (e) => {
|
|
16188
|
-
if (SCROLL_KEYS.has(e.key) && inList(e)) setExpanded(false);
|
|
16189
|
-
};
|
|
16190
|
-
const doc = layer?.ownerDocument ?? document;
|
|
16191
|
-
doc.addEventListener("pointerdown", onPress, true);
|
|
16192
|
-
layer?.addEventListener("wheel", onScrollGesture, { passive: true });
|
|
16193
|
-
layer?.addEventListener("touchmove", onScrollGesture, { passive: true });
|
|
16194
|
-
window.addEventListener("keydown", onKey, true);
|
|
16195
|
-
return () => {
|
|
16196
|
-
doc.removeEventListener("pointerdown", onPress, true);
|
|
16197
|
-
layer?.removeEventListener("wheel", onScrollGesture);
|
|
16198
|
-
layer?.removeEventListener("touchmove", onScrollGesture);
|
|
16199
|
-
window.removeEventListener("keydown", onKey, true);
|
|
16200
|
-
};
|
|
16201
|
-
}, [expanded, layerRef, dialRef]);
|
|
16202
|
-
return { expanded, toggle, fold: fold2 };
|
|
16203
|
-
}
|
|
16204
|
-
|
|
16205
|
-
// src/presetSeen.ts
|
|
16206
|
-
var KEY2 = "ss-w-presets-tool-opened";
|
|
16207
|
-
var openedThisPage = false;
|
|
16208
|
-
function readToolSeen() {
|
|
16209
|
-
if (openedThisPage) return true;
|
|
16210
|
-
try {
|
|
16211
|
-
return window.localStorage.getItem(KEY2) === "1";
|
|
16212
|
-
} catch {
|
|
16213
|
-
return false;
|
|
16214
|
-
}
|
|
16215
|
-
}
|
|
16216
|
-
function markToolSeen() {
|
|
16217
|
-
openedThisPage = true;
|
|
16218
|
-
try {
|
|
16219
|
-
window.localStorage.setItem(KEY2, "1");
|
|
16220
|
-
} catch {
|
|
16221
|
-
}
|
|
16222
|
-
}
|
|
16223
|
-
|
|
16224
15796
|
// src/components/ChatPanel.tsx
|
|
16225
|
-
import { Fragment as
|
|
15797
|
+
import { Fragment as Fragment40, jsx as jsx135, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
16226
15798
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
16227
15799
|
function useIsModal() {
|
|
16228
|
-
const [modal, setModal] =
|
|
16229
|
-
|
|
15800
|
+
const [modal, setModal] = useState72(false);
|
|
15801
|
+
useEffect44(() => {
|
|
16230
15802
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
16231
15803
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
16232
15804
|
const sync = () => setModal(mql.matches);
|
|
@@ -16238,20 +15810,14 @@ function useIsModal() {
|
|
|
16238
15810
|
}
|
|
16239
15811
|
var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
|
|
16240
15812
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
16241
|
-
function hasPersonalBuilder(messages) {
|
|
16242
|
-
return messages.some((m) => m.role === "assistant" && (!!m.greetingDashboard?.personal?.builder || !!m.greetingDashboards?.some((s) => !!s.dashboard.personal?.builder)));
|
|
16243
|
-
}
|
|
16244
|
-
function greetingInFlight(messages) {
|
|
16245
|
-
return messages.some((m) => m.role === "assistant" && m.isGreeting === true && !m.done);
|
|
16246
|
-
}
|
|
16247
15813
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites }) {
|
|
16248
15814
|
const { state, close, stop, send, reset } = controller;
|
|
16249
|
-
const [squadView, setSquadView] =
|
|
16250
|
-
const [selectedPlayerId, setSelectedPlayerId] =
|
|
15815
|
+
const [squadView, setSquadView] = useState72("roster");
|
|
15816
|
+
const [selectedPlayerId, setSelectedPlayerId] = useState72(null);
|
|
16251
15817
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
16252
15818
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
16253
|
-
const squadLayerRef =
|
|
16254
|
-
const squadScrollRef =
|
|
15819
|
+
const squadLayerRef = useRef36(null);
|
|
15820
|
+
const squadScrollRef = useRef36(null);
|
|
16255
15821
|
const selectPlayer = (playerId) => {
|
|
16256
15822
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
16257
15823
|
setSelectedPlayerId(playerId);
|
|
@@ -16268,13 +15834,13 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16268
15834
|
squadScrollRef.current = null;
|
|
16269
15835
|
}, [selectedPlayerId]);
|
|
16270
15836
|
const activeTab = monitor?.activeTab;
|
|
16271
|
-
|
|
15837
|
+
useEffect44(() => {
|
|
16272
15838
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
16273
15839
|
setSelectedPlayerId(null);
|
|
16274
15840
|
clearPlayerDetail?.();
|
|
16275
15841
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
16276
15842
|
const setMonitorTab = monitor?.setActiveTab;
|
|
16277
|
-
|
|
15843
|
+
useEffect44(() => {
|
|
16278
15844
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
16279
15845
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
16280
15846
|
const isModal = useIsModal();
|
|
@@ -16282,11 +15848,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16282
15848
|
const closeTab = monitor?.activeTab ?? "chat";
|
|
16283
15849
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
16284
15850
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
16285
|
-
const closeWith =
|
|
15851
|
+
const closeWith = useCallback24((method) => {
|
|
16286
15852
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
16287
15853
|
close();
|
|
16288
15854
|
}, [track, closeTab, answering, close]);
|
|
16289
|
-
|
|
15855
|
+
useEffect44(() => {
|
|
16290
15856
|
const onKey = (e) => {
|
|
16291
15857
|
if (e.key === "Escape") closeWith("escape");
|
|
16292
15858
|
};
|
|
@@ -16302,90 +15868,70 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16302
15868
|
monitor?.setActiveTab("chat");
|
|
16303
15869
|
send(text, { grounding, source: "live_fact" });
|
|
16304
15870
|
};
|
|
16305
|
-
|
|
15871
|
+
useEffect44(() => {
|
|
16306
15872
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
16307
15873
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
16308
15874
|
const onChatTab = !monitor || monitor.activeTab === "chat";
|
|
16309
|
-
const
|
|
16310
|
-
const
|
|
16311
|
-
const
|
|
16312
|
-
const
|
|
16313
|
-
const
|
|
16314
|
-
const
|
|
16315
|
-
const focusAfterCloseRef = useRef37(null);
|
|
16316
|
-
const [tool, setTool] = useState73(null);
|
|
16317
|
-
const panelRef = useRef37(null);
|
|
15875
|
+
const inputRef = useRef36(null);
|
|
15876
|
+
const limitRef = useRef36(null);
|
|
15877
|
+
const typedSendRef = useRef36(false);
|
|
15878
|
+
const focusAfterCloseRef = useRef36(null);
|
|
15879
|
+
const [tool, setTool] = useState72(null);
|
|
15880
|
+
const panelRef = useRef36(null);
|
|
16318
15881
|
const settings = useOddsSettings();
|
|
16319
|
-
const [settingsOpen, setSettingsOpen] =
|
|
15882
|
+
const [settingsOpen, setSettingsOpen] = useState72(false);
|
|
16320
15883
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
16321
|
-
const openSettings =
|
|
15884
|
+
const openSettings = useCallback24(() => {
|
|
16322
15885
|
setTool(null);
|
|
16323
15886
|
setSettingsOpen(true);
|
|
16324
15887
|
}, []);
|
|
16325
|
-
const closeSettings =
|
|
15888
|
+
const closeSettings = useCallback24(() => {
|
|
16326
15889
|
setSettingsOpen(false);
|
|
16327
15890
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
16328
15891
|
}, []);
|
|
16329
|
-
const [toolSeen, setToolSeen] = useState73(readToolSeen);
|
|
16330
|
-
const dial = usePresetDial({
|
|
16331
|
-
layerRef,
|
|
16332
|
-
dialRef,
|
|
16333
|
-
dialButtonRef,
|
|
16334
|
-
messages: state.messages,
|
|
16335
|
-
isStreaming: state.isStreaming,
|
|
16336
|
-
activeTab: monitor?.activeTab ?? "chat"
|
|
16337
|
-
});
|
|
16338
|
-
const { fold: fold2 } = dial;
|
|
16339
15892
|
const paused = isPaused(state.limit);
|
|
16340
|
-
|
|
16341
|
-
const showDial = dialWanted && onChatTab && !tool && !paused;
|
|
16342
|
-
useEffect45(() => {
|
|
15893
|
+
useEffect44(() => {
|
|
16343
15894
|
if (paused) setTool(null);
|
|
16344
15895
|
}, [paused]);
|
|
16345
|
-
|
|
15896
|
+
useEffect44(() => {
|
|
16346
15897
|
if (!paused) return;
|
|
16347
15898
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
16348
15899
|
typedSendRef.current = false;
|
|
16349
15900
|
}, [paused]);
|
|
16350
|
-
const openTool =
|
|
16351
|
-
fold2();
|
|
16352
|
-
markToolSeen();
|
|
16353
|
-
setToolSeen(true);
|
|
15901
|
+
const openTool = useCallback24((next) => {
|
|
16354
15902
|
setTool(next);
|
|
16355
|
-
}, [
|
|
16356
|
-
const onPill = useCallback25((kind) => openTool(kind === "numbers" ? { kind: "numbers" } : { kind: "combo" }), [openTool]);
|
|
15903
|
+
}, []);
|
|
16357
15904
|
const toolsValue = useMemo10(
|
|
16358
|
-
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({
|
|
15905
|
+
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
16359
15906
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
16360
15907
|
);
|
|
16361
|
-
const closeTool =
|
|
16362
|
-
focusAfterCloseRef.current = "
|
|
15908
|
+
const closeTool = useCallback24(() => {
|
|
15909
|
+
focusAfterCloseRef.current = "composer";
|
|
16363
15910
|
setTool(null);
|
|
16364
15911
|
}, []);
|
|
16365
|
-
const sendAsk =
|
|
15912
|
+
const sendAsk = useCallback24((ask) => {
|
|
16366
15913
|
focusAfterCloseRef.current = "composer";
|
|
16367
15914
|
setTool(null);
|
|
16368
15915
|
monitor?.setActiveTab("chat");
|
|
16369
15916
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
16370
15917
|
}, [monitor, send]);
|
|
16371
|
-
const formatKickoff =
|
|
15918
|
+
const formatKickoff = useCallback24((kickoffUtc) => {
|
|
16372
15919
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
16373
15920
|
return `${k.dayLabel} ${k.time}`;
|
|
16374
15921
|
}, [ui]);
|
|
16375
|
-
|
|
15922
|
+
useEffect44(() => {
|
|
16376
15923
|
if (tool) return;
|
|
16377
15924
|
const target = focusAfterCloseRef.current;
|
|
16378
15925
|
focusAfterCloseRef.current = null;
|
|
16379
|
-
if (target === "
|
|
16380
|
-
else if (target === "composer") inputRef.current?.focus();
|
|
15926
|
+
if (target === "composer") inputRef.current?.focus();
|
|
16381
15927
|
}, [tool]);
|
|
16382
|
-
|
|
15928
|
+
useEffect44(() => {
|
|
16383
15929
|
if (!tool || onChatTab && presetGrid) return;
|
|
16384
15930
|
focusAfterCloseRef.current = "composer";
|
|
16385
15931
|
setTool(null);
|
|
16386
15932
|
}, [tool, onChatTab, presetGrid]);
|
|
16387
|
-
return /* @__PURE__ */
|
|
16388
|
-
/* @__PURE__ */
|
|
15933
|
+
return /* @__PURE__ */ jsxs119("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
15934
|
+
/* @__PURE__ */ jsx135(
|
|
16389
15935
|
ChatHeader,
|
|
16390
15936
|
{
|
|
16391
15937
|
onClose: () => closeWith("button"),
|
|
@@ -16400,7 +15946,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16400
15946
|
settingsLabel: ui.settings.title
|
|
16401
15947
|
}
|
|
16402
15948
|
),
|
|
16403
|
-
monitor && /* @__PURE__ */
|
|
15949
|
+
monitor && /* @__PURE__ */ jsx135(
|
|
16404
15950
|
TabBar,
|
|
16405
15951
|
{
|
|
16406
15952
|
monitor,
|
|
@@ -16414,35 +15960,23 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16414
15960
|
favouritesEnabled: favouritesEnabled ?? false
|
|
16415
15961
|
}
|
|
16416
15962
|
),
|
|
16417
|
-
/* @__PURE__ */
|
|
16418
|
-
/* @__PURE__ */
|
|
16419
|
-
|
|
16420
|
-
PresetSpeedDial,
|
|
16421
|
-
{
|
|
16422
|
-
expanded: dial.expanded,
|
|
16423
|
-
showDot: !toolSeen,
|
|
16424
|
-
strings: ui.presets,
|
|
16425
|
-
onToggle: dial.toggle,
|
|
16426
|
-
onOpen: onPill,
|
|
16427
|
-
rootRef: dialRef,
|
|
16428
|
-
buttonRef: dialButtonRef
|
|
16429
|
-
}
|
|
16430
|
-
) : null,
|
|
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
|
|
15963
|
+
/* @__PURE__ */ jsxs119("div", { className: "ss-w-chat-layer", style: onChatTab ? void 0 : HIDDEN_LAYER_STYLE, children: [
|
|
15964
|
+
/* @__PURE__ */ jsx135(PresetToolsContext.Provider, { value: toolsValue, children: /* @__PURE__ */ jsx135(MessageList, { controller, ui, slip, onDashboardTap, monitor }) }),
|
|
15965
|
+
tool && presetGrid && onChatTab && !paused ? /* @__PURE__ */ jsx135(BuildComboTool, { grid: presetGrid, strings: ui.presets, streaming: state.isStreaming, formatKickoff, initialTotal: tool.total, initialLegs: tool.legs, onSend: sendAsk, onClose: closeTool }) : null
|
|
16432
15966
|
] }),
|
|
16433
|
-
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */
|
|
16434
|
-
monitor && monitor.activeTab === "following" && /* @__PURE__ */
|
|
16435
|
-
monitor && monitor.activeTab === "trends" && /* @__PURE__ */
|
|
16436
|
-
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */
|
|
16437
|
-
monitor && monitor.activeTab === "standings" && /* @__PURE__ */
|
|
16438
|
-
monitor && monitor.activeTab === "squad" && /* @__PURE__ */
|
|
16439
|
-
/* @__PURE__ */
|
|
15967
|
+
monitor && discovery && monitor.activeTab === "today" && /* @__PURE__ */ jsx135(TodayPanel, { discovery, ui, monitor }),
|
|
15968
|
+
monitor && monitor.activeTab === "following" && /* @__PURE__ */ jsx135(MatchesPanel, { monitor, ui, slip, onAsk: paused ? void 0 : handleAsk, discovery }),
|
|
15969
|
+
monitor && monitor.activeTab === "trends" && /* @__PURE__ */ jsx135(TrendsPanel, { monitor, ui, slip }),
|
|
15970
|
+
monitor && monitor.activeTab === "fixtures" && /* @__PURE__ */ jsx135(Fixtures, { fixtures: clubFixturesResult?.fixtures ?? [], loading: clubFixturesResult?.loading ?? false, ui }),
|
|
15971
|
+
monitor && monitor.activeTab === "standings" && /* @__PURE__ */ jsx135(Standings, { standings: clubStandingsResult?.data ?? null, loading: clubStandingsResult?.loading ?? false, ui }),
|
|
15972
|
+
monitor && monitor.activeTab === "squad" && /* @__PURE__ */ jsxs119(Fragment40, { children: [
|
|
15973
|
+
/* @__PURE__ */ jsx135(
|
|
16440
15974
|
"div",
|
|
16441
15975
|
{
|
|
16442
15976
|
ref: squadLayerRef,
|
|
16443
15977
|
style: selectedPlayerId === null ? SQUAD_LAYER_STYLE : HIDDEN_LAYER_STYLE,
|
|
16444
15978
|
"aria-hidden": selectedPlayerId !== null ? true : void 0,
|
|
16445
|
-
children: /* @__PURE__ */
|
|
15979
|
+
children: /* @__PURE__ */ jsx135(
|
|
16446
15980
|
Squad,
|
|
16447
15981
|
{
|
|
16448
15982
|
squad: clubSquadResult?.data ?? null,
|
|
@@ -16460,9 +15994,9 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16460
15994
|
)
|
|
16461
15995
|
}
|
|
16462
15996
|
),
|
|
16463
|
-
selectedPlayerId !== null && /* @__PURE__ */
|
|
15997
|
+
selectedPlayerId !== null && /* @__PURE__ */ jsx135(PlayerDetail, { detail: clubPlayerDetailResult?.data ?? null, loading: clubPlayerDetailResult?.loading ?? false, ui, seasonName: clubSquadStatsResult?.seasonName ?? null, onClose: closePlayer })
|
|
16464
15998
|
] }),
|
|
16465
|
-
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */
|
|
15999
|
+
monitor && monitor.activeTab === "games" && gamesResult && /* @__PURE__ */ jsx135(
|
|
16466
16000
|
GamesPanel,
|
|
16467
16001
|
{
|
|
16468
16002
|
loggedIn: !!loggedIn,
|
|
@@ -16477,10 +16011,10 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16477
16011
|
}
|
|
16478
16012
|
}
|
|
16479
16013
|
),
|
|
16480
|
-
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */
|
|
16481
|
-
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */
|
|
16482
|
-
/* @__PURE__ */
|
|
16483
|
-
paused ? null : /* @__PURE__ */
|
|
16014
|
+
monitor && monitor.activeTab === "favourites" && favouritesEnabled && favourites && /* @__PURE__ */ jsx135(FavouritesPanel, { controller: favourites.controller, ui, sport: favourites.sport, sports: favourites.sports, onSportChange: favourites.onSportChange }),
|
|
16015
|
+
(!monitor || monitor.activeTab !== "games" && monitor.activeTab !== "favourites") && /* @__PURE__ */ jsxs119(Fragment40, { children: [
|
|
16016
|
+
/* @__PURE__ */ jsx135("div", { ref: limitRef, className: "ss-w-limit", role: "status", tabIndex: -1, children: state.limit ? limitText(state.limit, ui) : null }),
|
|
16017
|
+
paused ? null : /* @__PURE__ */ jsx135(
|
|
16484
16018
|
ChatInput,
|
|
16485
16019
|
{
|
|
16486
16020
|
ref: inputRef,
|
|
@@ -16490,19 +16024,18 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, g
|
|
|
16490
16024
|
onStop: stop,
|
|
16491
16025
|
stopLabel: ui.stopResponse,
|
|
16492
16026
|
sendLabel: ui.sendMessage,
|
|
16493
|
-
disabled: !!tool
|
|
16494
|
-
onType: fold2
|
|
16027
|
+
disabled: !!tool
|
|
16495
16028
|
}
|
|
16496
16029
|
)
|
|
16497
16030
|
] }),
|
|
16498
|
-
settingsOpen && hasSettings ? /* @__PURE__ */
|
|
16031
|
+
settingsOpen && hasSettings ? /* @__PURE__ */ jsx135(SettingsSheet, { ui, onClose: closeSettings }) : null
|
|
16499
16032
|
] });
|
|
16500
16033
|
}
|
|
16501
16034
|
|
|
16502
16035
|
// src/components/HostEventsProvider.tsx
|
|
16503
|
-
import { jsx as
|
|
16036
|
+
import { jsx as jsx136 } from "react/jsx-runtime";
|
|
16504
16037
|
function HostEventsProvider({ value, children }) {
|
|
16505
|
-
return /* @__PURE__ */
|
|
16038
|
+
return /* @__PURE__ */ jsx136(SlipStateContext.Provider, { value: value.slipState, children });
|
|
16506
16039
|
}
|
|
16507
16040
|
|
|
16508
16041
|
// src/styles/css.generated.ts
|
|
@@ -17126,7 +16659,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17126
16659
|
.ss-w-combo-addall .ss-w-slip-btn { min-height: 44px; padding: 10px 16px; font-size: 14px; font-weight: 650; border-radius: 22px; white-space: normal; }
|
|
17127
16660
|
.ss-w-combo-addall .ss-w-toast { position: static; width: auto; max-width: none; font-size: 12px; box-shadow: none; }
|
|
17128
16661
|
|
|
17129
|
-
/* onboarding presets
|
|
16662
|
+
/* onboarding presets: the combo builder (spec Stage 2 Behaviour, board 2c). A sheet
|
|
17130
16663
|
over the message list, inside .ss-w-chat-layer; the body scrolls and the builder's Send sits in
|
|
17131
16664
|
the footer, so it stays visible on a phone. Colours come from the theme tokens. */
|
|
17132
16665
|
.ss-w-tool-backdrop { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(0,0,0,.35); }
|
|
@@ -17137,15 +16670,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17137
16670
|
.ss-w-tool-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 14px; }
|
|
17138
16671
|
.ss-w-tool-body > * { flex: none; }
|
|
17139
16672
|
.ss-w-tool-foot { flex: none; padding: 10px 14px 12px; border-top: 1px solid var(--ss-w-line); }
|
|
17140
|
-
.ss-w-tool-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 11px; border: 1px solid var(--ss-w-line); border-left: 3px solid var(--ss-w-accent); border-radius: 12px; }
|
|
17141
|
-
.ss-w-tool-ask { font-size: 14px; font-weight: 650; line-height: 1.7; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
17142
|
-
.ss-w-tool-num { position: relative; display: inline-block; vertical-align: middle; margin: 0 2px; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); }
|
|
17143
|
-
.ss-w-tool-num-size { display: block; font-size: max(16px, 1em); user-select: none; -webkit-user-select: none; visibility: hidden; box-sizing: border-box; min-width: 44px; min-height: 32px; padding: 6px 26px 6px 10px; line-height: 1.3; white-space: pre; }
|
|
17144
|
-
.ss-w-tool-num-select { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0 22px 0 10px; font: inherit; font-size: max(16px, 1em); font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ss-w-accent); background-color: color-mix(in srgb, var(--ss-w-accent) 10%, var(--ss-w-panel)); border: 1.5px solid color-mix(in srgb, var(--ss-w-accent) 65%, var(--ss-w-line)); border-radius: 8px; cursor: pointer; appearance: none; -webkit-appearance: none; }
|
|
17145
|
-
.ss-w-tool-num::after { content: ""; position: absolute; right: 9px; top: 50%; width: 5px; height: 5px; margin-top: -4px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
|
|
17146
|
-
.ss-w-tool-num-select:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
17147
|
-
.ss-w-tool-num-select option { font-weight: 600; color: var(--ss-w-ink); background: var(--ss-w-panel); }
|
|
17148
|
-
.ss-w-tool-num-select option:disabled { color: var(--ss-w-faint); }
|
|
17149
16673
|
.ss-w-tool-picks { list-style: none; display: flex; flex-direction: column; gap: 4px; }
|
|
17150
16674
|
.ss-w-tool-pick { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 5px 8px; font-size: 12px; line-height: 1.35; background: var(--ss-w-bubble); border-radius: 8px; }
|
|
17151
16675
|
.ss-w-tool-pick-match { grid-column: 1; font-weight: 650; color: var(--ss-w-ink); overflow-wrap: anywhere; }
|
|
@@ -17154,13 +16678,6 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17154
16678
|
.ss-w-tool-pick-price { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 800; color: var(--ss-w-accent); }
|
|
17155
16679
|
.ss-w-tool-math { padding: 6px 8px; font-family: ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; text-align: right; color: var(--ss-w-ink); background: color-mix(in srgb, var(--ss-w-accent) 9%, var(--ss-w-panel)); border-radius: 8px; overflow-wrap: anywhere; }
|
|
17156
16680
|
.ss-w-tool-unavailable { padding: 6px 8px; font-size: 12px; color: var(--ss-w-faint); border: 1px dashed var(--ss-w-line); border-radius: 8px; }
|
|
17157
|
-
.ss-w-tool-row--ask { flex-direction: row; align-items: center; gap: 10px; border-left-width: 1px; }
|
|
17158
|
-
.ss-w-tool-icon { flex: none; font-size: 20px; line-height: 1; }
|
|
17159
|
-
.ss-w-tool-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
|
|
17160
|
-
.ss-w-tool-ready { padding: 2px 8px; font-size: 11.5px; font-weight: 650; color: var(--ss-w-accent); background: color-mix(in srgb, var(--ss-w-accent) 12%, transparent); border-radius: 10px; }
|
|
17161
|
-
.ss-w-tool-go { flex: none; width: 44px; height: 44px; display: grid; place-items: center; font-size: 17px; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 50%; cursor: pointer; }
|
|
17162
|
-
.ss-w-tool-go:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
17163
|
-
.ss-w-tool-go:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
17164
16681
|
.ss-w-tool-send { align-self: flex-end; min-height: 40px; padding: 8px 18px; font: inherit; font-size: 13px; font-weight: 700; color: #fff; background: var(--ss-w-accent); border: none; border-radius: 20px; cursor: pointer; }
|
|
17165
16682
|
.ss-w-tool-send:disabled { color: var(--ss-w-faint); background: var(--ss-w-bubble); cursor: not-allowed; }
|
|
17166
16683
|
.ss-w-tool-foot .ss-w-tool-send { width: 100%; }
|
|
@@ -17188,34 +16705,8 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
17188
16705
|
@keyframes ss-w-sheet-in { from { transform: translateY(12%); } to { transform: none; } }
|
|
17189
16706
|
}
|
|
17190
16707
|
|
|
17191
|
-
/*
|
|
17192
|
-
layer is the message list's positioned box (P6), so the dial sits against the list's bottom
|
|
17193
|
-
right and rises with the composer: right 8px puts the 44px button's centre on Send's (12px
|
|
17194
|
-
padding + 18px), bottom 10px is above the composer's top border. While the button shows the list
|
|
17195
|
-
gets 54px more bottom padding so its last message can scroll clear. */
|
|
16708
|
+
/* The chat layer is the message list's positioned box: a preset tool sheet sits over it. */
|
|
17196
16709
|
.ss-w-chat-layer { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
17197
|
-
.ss-w-chat-layer[data-dial] .ss-w-list { padding-bottom: 68px; }
|
|
17198
|
-
.ss-w-dial { position: absolute; left: 12px; right: 8px; bottom: 10px; z-index: 2; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; pointer-events: none; }
|
|
17199
|
-
.ss-w-dial-btn, .ss-w-dial-pill { pointer-events: auto; }
|
|
17200
|
-
.ss-w-dial-btn { position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; font-size: 20px; color: var(--ss-w-accent); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 40%, var(--ss-w-line)); border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.18); cursor: pointer; }
|
|
17201
|
-
.ss-w-dial-btn[aria-expanded="true"] { color: var(--ss-w-panel); background: var(--ss-w-accent); border-color: var(--ss-w-accent); }
|
|
17202
|
-
.ss-w-dial-btn:focus-visible, .ss-w-dial-pill:focus-visible { outline: 2px solid var(--ss-w-accent); outline-offset: 2px; }
|
|
17203
|
-
.ss-w-dial-icon { grid-area: 1 / 1; display: grid; place-items: center; transition: transform 200ms ease, opacity 200ms ease; }
|
|
17204
|
-
.ss-w-dial-icon--close { opacity: 0; transform: rotate(-90deg); }
|
|
17205
|
-
.ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { opacity: 0; transform: rotate(90deg); }
|
|
17206
|
-
.ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--close { opacity: 1; transform: none; }
|
|
17207
|
-
.ss-w-dial-dot { position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; background: var(--ss-w-accent); border: 2px solid var(--ss-w-panel); border-radius: 50%; }
|
|
17208
|
-
.ss-w-dial-pills { max-width: 100%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
|
|
17209
|
-
.ss-w-dial-pill { max-width: 100%; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 12px; font: inherit; font-size: 12.5px; font-weight: 650; line-height: 1.25; text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--ss-w-ink); background: var(--ss-w-panel); border: 1px solid color-mix(in srgb, var(--ss-w-accent) 35%, var(--ss-w-line)); border-radius: 22px; box-shadow: 0 4px 14px rgba(0,0,0,.16); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.5); transform-origin: bottom right; transition: opacity 200ms ease, transform 200ms ease, visibility 0s linear 200ms; }
|
|
17210
|
-
.ss-w-dial-pill svg { flex: none; font-size: 18px; color: var(--ss-w-accent); }
|
|
17211
|
-
.ss-w-dial-pill-label { min-width: 0; }
|
|
17212
|
-
.ss-w-dial-pills[data-open] .ss-w-dial-pill { opacity: 1; visibility: visible; transform: none; transition: opacity 200ms ease, transform 200ms ease, visibility 0s; }
|
|
17213
|
-
@media (prefers-reduced-motion: reduce) {
|
|
17214
|
-
.ss-w-dial-pill { transform: none; transition: opacity 200ms ease, visibility 0s linear 200ms; }
|
|
17215
|
-
.ss-w-dial-pills[data-open] .ss-w-dial-pill { transition: opacity 200ms ease, visibility 0s; }
|
|
17216
|
-
.ss-w-dial-icon { transition: opacity 200ms ease; }
|
|
17217
|
-
.ss-w-dial-icon--close, .ss-w-dial-btn[aria-expanded="true"] .ss-w-dial-icon--open { transform: none; }
|
|
17218
|
-
}
|
|
17219
16710
|
|
|
17220
16711
|
/* Compact price list (D16): three or more cards of one turn, one row per fixture. Team names wrap
|
|
17221
16712
|
to a second line and are never cut; the time sits above the match pin, with no column of its own. */
|
|
@@ -19021,7 +18512,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
19021
18512
|
`;
|
|
19022
18513
|
|
|
19023
18514
|
// src/StatsWidget.tsx
|
|
19024
|
-
import { jsx as
|
|
18515
|
+
import { jsx as jsx137 } from "react/jsx-runtime";
|
|
19025
18516
|
function buildClient(props) {
|
|
19026
18517
|
try {
|
|
19027
18518
|
if ("client" in props && props.client) {
|
|
@@ -19047,9 +18538,9 @@ function StatsWidget(props) {
|
|
|
19047
18538
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
19048
18539
|
const cfg = props.config;
|
|
19049
18540
|
const built = useMemo11(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
19050
|
-
const trackingRef =
|
|
18541
|
+
const trackingRef = useRef37({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
19051
18542
|
const track = useMemo11(() => createTracker(() => trackingRef.current), []);
|
|
19052
|
-
const eventTextRef =
|
|
18543
|
+
const eventTextRef = useRef37(false);
|
|
19053
18544
|
eventTextRef.current = cfg?.eventText === true;
|
|
19054
18545
|
const logger = useMemo11(() => {
|
|
19055
18546
|
if (!built) return null;
|
|
@@ -19061,9 +18552,9 @@ function StatsWidget(props) {
|
|
|
19061
18552
|
}, [built?.client, track]);
|
|
19062
18553
|
const ui = useMemo11(() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }), [props.config]);
|
|
19063
18554
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
19064
|
-
const rootRef =
|
|
19065
|
-
const introDoneRef =
|
|
19066
|
-
const markIntroDone =
|
|
18555
|
+
const rootRef = useRef37(null);
|
|
18556
|
+
const introDoneRef = useRef37(false);
|
|
18557
|
+
const markIntroDone = useCallback25(() => {
|
|
19067
18558
|
introDoneRef.current = true;
|
|
19068
18559
|
}, []);
|
|
19069
18560
|
const language = injectedClient ? void 0 : toUserContext(cfg ?? {})?.defaultLanguage;
|
|
@@ -19075,7 +18566,7 @@ function StatsWidget(props) {
|
|
|
19075
18566
|
);
|
|
19076
18567
|
const chatTracking = useMemo11(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
19077
18568
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
19078
|
-
const [hasToday, setHasToday] =
|
|
18569
|
+
const [hasToday, setHasToday] = useState73(false);
|
|
19079
18570
|
const liveCardWatches = useMemo11(() => {
|
|
19080
18571
|
const seen = /* @__PURE__ */ new Set();
|
|
19081
18572
|
const out = [];
|
|
@@ -19103,11 +18594,11 @@ function StatsWidget(props) {
|
|
|
19103
18594
|
});
|
|
19104
18595
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
19105
18596
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
19106
|
-
const getSchedule =
|
|
18597
|
+
const getSchedule = useCallback25(
|
|
19107
18598
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
19108
18599
|
[built, operatorUserId, anonymousUserId]
|
|
19109
18600
|
);
|
|
19110
|
-
const postLeagueStar =
|
|
18601
|
+
const postLeagueStar = useCallback25(
|
|
19111
18602
|
async (competitionId, starred) => {
|
|
19112
18603
|
if (!built) return null;
|
|
19113
18604
|
const result = await built.conversation.starLeague(competitionId, starred, operatorUserId, anonymousUserId);
|
|
@@ -19116,7 +18607,7 @@ function StatsWidget(props) {
|
|
|
19116
18607
|
},
|
|
19117
18608
|
[built, operatorUserId, anonymousUserId, track]
|
|
19118
18609
|
);
|
|
19119
|
-
const getStates =
|
|
18610
|
+
const getStates = useCallback25(
|
|
19120
18611
|
(matchIds, nbaGameIds, nflGameIds) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds) : Promise.resolve(null),
|
|
19121
18612
|
[built]
|
|
19122
18613
|
);
|
|
@@ -19135,11 +18626,11 @@ function StatsWidget(props) {
|
|
|
19135
18626
|
pinnedMatchIds
|
|
19136
18627
|
});
|
|
19137
18628
|
const todayHasContent = visibleGroupsOf(discovery.groups, discovery.states).length > 0;
|
|
19138
|
-
|
|
18629
|
+
useEffect45(() => {
|
|
19139
18630
|
setHasToday(todayHasContent);
|
|
19140
18631
|
}, [todayHasContent]);
|
|
19141
|
-
const prevLiveSnapshotRef =
|
|
19142
|
-
|
|
18632
|
+
const prevLiveSnapshotRef = useRef37(monitor.snapshot);
|
|
18633
|
+
useEffect45(() => {
|
|
19143
18634
|
const snap = monitor.snapshot;
|
|
19144
18635
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
19145
18636
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -19179,7 +18670,7 @@ function StatsWidget(props) {
|
|
|
19179
18670
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
19180
18671
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
19181
18672
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
19182
|
-
const [favSportPick, setFavSportPick] =
|
|
18673
|
+
const [favSportPick, setFavSportPick] = useState73(null);
|
|
19183
18674
|
const latestGreeting = useMemo11(() => {
|
|
19184
18675
|
for (const m of [...controller.state.messages].reverse()) {
|
|
19185
18676
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
@@ -19195,7 +18686,7 @@ function StatsWidget(props) {
|
|
|
19195
18686
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
19196
18687
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: favSport.charAt(0).toUpperCase() + favSport.slice(1) }];
|
|
19197
18688
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
19198
|
-
const [panelEverOpened, setPanelEverOpened] =
|
|
18689
|
+
const [panelEverOpened, setPanelEverOpened] = useState73(controller.state.isOpen);
|
|
19199
18690
|
if (controller.state.isOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
19200
18691
|
const favourites = useFavourites({
|
|
19201
18692
|
conversation: built?.conversation ?? null,
|
|
@@ -19206,14 +18697,14 @@ function StatsWidget(props) {
|
|
|
19206
18697
|
track
|
|
19207
18698
|
});
|
|
19208
18699
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
19209
|
-
const getPricePresets =
|
|
18700
|
+
const getPricePresets = useCallback25(
|
|
19210
18701
|
(locale2) => built ? built.conversation.getPricePresets(locale2, { pool: "open" }) : Promise.resolve(null),
|
|
19211
18702
|
[built]
|
|
19212
18703
|
);
|
|
19213
18704
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: controller.state.isOpen, locale: ui.presets.lang });
|
|
19214
18705
|
const markTodayActivity = monitor.markTodayActivity;
|
|
19215
|
-
const prevLiveCountRef =
|
|
19216
|
-
|
|
18706
|
+
const prevLiveCountRef = useRef37(0);
|
|
18707
|
+
useEffect45(() => {
|
|
19217
18708
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
19218
18709
|
prevLiveCountRef.current = discovery.liveCount;
|
|
19219
18710
|
if (rose) markTodayActivity();
|
|
@@ -19263,10 +18754,10 @@ function StatsWidget(props) {
|
|
|
19263
18754
|
log: logger
|
|
19264
18755
|
})
|
|
19265
18756
|
}));
|
|
19266
|
-
const onControlRef =
|
|
18757
|
+
const onControlRef = useRef37(props.onControl);
|
|
19267
18758
|
onControlRef.current = props.onControl;
|
|
19268
18759
|
const { open: openPanel, close: closePanel } = controller;
|
|
19269
|
-
|
|
18760
|
+
useEffect45(() => {
|
|
19270
18761
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
19271
18762
|
return () => onControlRef.current?.(null);
|
|
19272
18763
|
}, [openPanel, closePanel]);
|
|
@@ -19283,11 +18774,11 @@ function StatsWidget(props) {
|
|
|
19283
18774
|
page: cfg?.page
|
|
19284
18775
|
}
|
|
19285
18776
|
};
|
|
19286
|
-
|
|
18777
|
+
useEffect45(() => {
|
|
19287
18778
|
if (!logger) return;
|
|
19288
18779
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
19289
18780
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
19290
|
-
|
|
18781
|
+
useEffect45(() => {
|
|
19291
18782
|
if (!logger) return;
|
|
19292
18783
|
logger.resume();
|
|
19293
18784
|
const onHide = () => {
|
|
@@ -19305,7 +18796,7 @@ function StatsWidget(props) {
|
|
|
19305
18796
|
logger.dispose();
|
|
19306
18797
|
};
|
|
19307
18798
|
}, [logger]);
|
|
19308
|
-
|
|
18799
|
+
useEffect45(() => {
|
|
19309
18800
|
if (!built || !ui.injectStyles) return;
|
|
19310
18801
|
const node = rootRef.current?.getRootNode();
|
|
19311
18802
|
if (node) injectStyles(node);
|
|
@@ -19326,7 +18817,7 @@ function StatsWidget(props) {
|
|
|
19326
18817
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
19327
18818
|
if (!built) return null;
|
|
19328
18819
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
19329
|
-
return /* @__PURE__ */
|
|
18820
|
+
return /* @__PURE__ */ jsx137(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ jsx137(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ jsx137(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ jsx137(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ jsx137(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ jsx137("div", { ref: rootRef, className: "ss-w-root", "data-ss-w-theme": attrs["data-ss-w-theme"], "data-ss-w-pos": attrs["data-ss-w-pos"], style: attrs.style, children: controller.state.isOpen ? /* @__PURE__ */ jsx137(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ jsx137(
|
|
19330
18821
|
ChatPanel,
|
|
19331
18822
|
{
|
|
19332
18823
|
controller,
|
|
@@ -19348,7 +18839,7 @@ function StatsWidget(props) {
|
|
|
19348
18839
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
19349
18840
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick }
|
|
19350
18841
|
}
|
|
19351
|
-
) }) : /* @__PURE__ */
|
|
18842
|
+
) }) : /* @__PURE__ */ jsx137(
|
|
19352
18843
|
ChatFab,
|
|
19353
18844
|
{
|
|
19354
18845
|
label: ui.launcherLabel,
|