@sensiblestats/widget-react 0.130.1 → 0.132.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 +17 -0
- package/README.md +1 -1
- package/dist/index.cjs +508 -358
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +463 -314
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,13 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
StatsWidget: () => StatsWidget,
|
|
34
34
|
WIDGET_CSS: () => WIDGET_CSS,
|
|
35
|
+
WIDGET_REACT_VERSION: () => WIDGET_REACT_VERSION,
|
|
35
36
|
createWidgetHost: () => createWidgetHost
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
39
|
|
|
39
40
|
// src/StatsWidget.tsx
|
|
40
|
-
var
|
|
41
|
+
var import_react104 = require("react");
|
|
41
42
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
42
43
|
|
|
43
44
|
// src/strings/tag.ts
|
|
@@ -1323,7 +1324,7 @@ function parseOddsFormat(value) {
|
|
|
1323
1324
|
}
|
|
1324
1325
|
|
|
1325
1326
|
// src/version.generated.ts
|
|
1326
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1327
|
+
var WIDGET_REACT_VERSION = "0.132.0";
|
|
1327
1328
|
|
|
1328
1329
|
// src/config.ts
|
|
1329
1330
|
function hostTag(cfg) {
|
|
@@ -1688,8 +1689,9 @@ function normalizeUi(cfg, loaded) {
|
|
|
1688
1689
|
};
|
|
1689
1690
|
}
|
|
1690
1691
|
function toClientOptions(cfg) {
|
|
1691
|
-
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client:
|
|
1692
|
+
const opts = { operatorId: cfg.operatorId, publicKey: cfg.publicKey, client: `${cfg.transport?.client ?? "widget-react"}/${WIDGET_REACT_VERSION}` };
|
|
1692
1693
|
if (cfg.baseUrl !== void 0) opts.baseUrl = cfg.baseUrl;
|
|
1694
|
+
if (cfg.transport?.fetch !== void 0) opts.fetch = cfg.transport.fetch;
|
|
1693
1695
|
return opts;
|
|
1694
1696
|
}
|
|
1695
1697
|
function toUserContext(cfg) {
|
|
@@ -6040,7 +6042,7 @@ function useSlipAdd(slip, ui) {
|
|
|
6040
6042
|
const handler = slip.onAddToSlip;
|
|
6041
6043
|
const rawLabels = !!ui?.rawBettingLabels;
|
|
6042
6044
|
const operatorFormat = ui?.oddsFormat ?? "decimal";
|
|
6043
|
-
return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line }) => {
|
|
6045
|
+
return (0, import_react25.useCallback)(async (selection, { marketDeveloperName, selectionLabel, line, fact }) => {
|
|
6044
6046
|
if (!handler) return { kind: "failed" };
|
|
6045
6047
|
const display = slipDisplay({ ...selection.display, market: marketDeveloperName, selection: selectionLabel, line });
|
|
6046
6048
|
const out = toHostSelection(display ? { ...selection, display } : selection, operatorFormat);
|
|
@@ -6055,11 +6057,13 @@ function useSlipAdd(slip, ui) {
|
|
|
6055
6057
|
matchId: out.matchId,
|
|
6056
6058
|
odds: out.oddsDecimal,
|
|
6057
6059
|
...marketDeveloperName !== void 0 ? { market: marketDeveloperName } : {},
|
|
6058
|
-
...out.sport !== void 0 ? { sport: out.sport } : {}
|
|
6060
|
+
...out.sport !== void 0 ? { sport: out.sport } : {},
|
|
6061
|
+
...fact ? { factKey: fact.factKey } : {}
|
|
6059
6062
|
};
|
|
6063
|
+
const factTag = fact ? { factId: String(fact.id), factKey: fact.factKey } : {};
|
|
6060
6064
|
track({ name: "add_to_slip_click", ...clickFields });
|
|
6061
6065
|
if (marketDeveloperName !== void 0) {
|
|
6062
|
-
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField });
|
|
6066
|
+
log?.log({ name: "slip_click", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, ...pick, ...sportField, ...factTag });
|
|
6063
6067
|
}
|
|
6064
6068
|
try {
|
|
6065
6069
|
const raw = await withTimeout(Promise.resolve(handler(out)));
|
|
@@ -6074,7 +6078,8 @@ function useSlipAdd(slip, ui) {
|
|
|
6074
6078
|
entityId: marketDeveloperName,
|
|
6075
6079
|
outcome: slipOutcome(result),
|
|
6076
6080
|
...pick,
|
|
6077
|
-
...sportField
|
|
6081
|
+
...sportField,
|
|
6082
|
+
...factTag
|
|
6078
6083
|
});
|
|
6079
6084
|
}
|
|
6080
6085
|
if (slipState) {
|
|
@@ -6087,7 +6092,7 @@ function useSlipAdd(slip, ui) {
|
|
|
6087
6092
|
} catch {
|
|
6088
6093
|
track({ name: "add_to_slip_result", outcome: "timeout", ...clickFields });
|
|
6089
6094
|
if (marketDeveloperName !== void 0) {
|
|
6090
|
-
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField });
|
|
6095
|
+
log?.log({ name: "slip_result", entityType: "market", marketDeveloperName, entityId: marketDeveloperName, outcome: "timeout", ...pick, ...sportField, ...factTag });
|
|
6091
6096
|
}
|
|
6092
6097
|
return { kind: "failed" };
|
|
6093
6098
|
}
|
|
@@ -6110,7 +6115,7 @@ function Toast({ toast, onDismiss }) {
|
|
|
6110
6115
|
|
|
6111
6116
|
// src/components/AddToSlipButton.tsx
|
|
6112
6117
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
6113
|
-
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold }) {
|
|
6118
|
+
function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip, ui, price, ariaLabel, hold, fact }) {
|
|
6114
6119
|
const [pending, setPending] = (0, import_react27.useState)(false);
|
|
6115
6120
|
const [settledLocal, setSettledLocal] = (0, import_react27.useState)(false);
|
|
6116
6121
|
const [toast, setToast] = (0, import_react27.useState)(null);
|
|
@@ -6124,7 +6129,7 @@ function SlipButton({ selection, marketDeveloperName, selectionLabel, line, slip
|
|
|
6124
6129
|
const onClick = async () => {
|
|
6125
6130
|
setPending(true);
|
|
6126
6131
|
try {
|
|
6127
|
-
const outcome = await add(selection, { marketDeveloperName, selectionLabel, line });
|
|
6132
|
+
const outcome = await add(selection, { marketDeveloperName, selectionLabel, line, fact });
|
|
6128
6133
|
if (outcome.kind === "failed") {
|
|
6129
6134
|
setToast({ kind: "error", text: ui.slipFailed });
|
|
6130
6135
|
return;
|
|
@@ -7123,11 +7128,11 @@ var ANY_TIER = ["guess", "ribbon", "since", "cards", "facts", "follow", "invite"
|
|
|
7123
7128
|
var orderFor = (tier) => Object.prototype.hasOwnProperty.call(ORDER, tier) ? ORDER[tier] : ANY_TIER;
|
|
7124
7129
|
var MAX_TEAM_CARDS = 3;
|
|
7125
7130
|
function oneCardPerGame(cards) {
|
|
7126
|
-
const
|
|
7131
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
7127
7132
|
return cards.filter((c) => {
|
|
7128
7133
|
if (!c.matchId) return true;
|
|
7129
|
-
if (
|
|
7130
|
-
|
|
7134
|
+
if (seen2.has(c.matchId)) return false;
|
|
7135
|
+
seen2.add(c.matchId);
|
|
7131
7136
|
return true;
|
|
7132
7137
|
});
|
|
7133
7138
|
}
|
|
@@ -7456,12 +7461,14 @@ var WIRE_TO_PUBLIC = {
|
|
|
7456
7461
|
slip_remove: null,
|
|
7457
7462
|
bet_placed: null,
|
|
7458
7463
|
match_view: null,
|
|
7459
|
-
popup_opened: null
|
|
7464
|
+
popup_opened: null,
|
|
7465
|
+
fact_view: null,
|
|
7466
|
+
fact_ask: null
|
|
7460
7467
|
};
|
|
7461
7468
|
|
|
7462
7469
|
// src/popupTelemetry.ts
|
|
7463
7470
|
var import_react41 = require("react");
|
|
7464
|
-
function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
7471
|
+
function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown) {
|
|
7465
7472
|
const shownRef = (0, import_react41.useRef)(/* @__PURE__ */ new Set());
|
|
7466
7473
|
const closedTextRef = (0, import_react41.useRef)(null);
|
|
7467
7474
|
(0, import_react41.useEffect)(() => {
|
|
@@ -7470,23 +7477,70 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup) {
|
|
|
7470
7477
|
closedTextRef.current = null;
|
|
7471
7478
|
return;
|
|
7472
7479
|
}
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7480
|
+
const text2 = confirmedShown === void 0 || confirmedShown === popupText ? popupText : null;
|
|
7481
|
+
closedTextRef.current = text2;
|
|
7482
|
+
if (text2 && !shownRef.current.has(text2)) {
|
|
7483
|
+
shownRef.current.add(text2);
|
|
7476
7484
|
log?.log({ name: "popup_shown" });
|
|
7477
7485
|
}
|
|
7478
|
-
}, [log, isOpen, popupText]);
|
|
7486
|
+
}, [log, isOpen, popupText, confirmedShown]);
|
|
7479
7487
|
return (0, import_react41.useCallback)(() => {
|
|
7480
7488
|
log?.log({ name: "popup_dismissed" });
|
|
7481
7489
|
dismissPopup();
|
|
7482
7490
|
}, [log, dismissPopup]);
|
|
7483
7491
|
}
|
|
7484
7492
|
|
|
7485
|
-
// src/
|
|
7493
|
+
// src/mobileBinding.ts
|
|
7486
7494
|
var import_react42 = require("react");
|
|
7487
|
-
|
|
7488
|
-
|
|
7495
|
+
var CLEARED = { text: null, asks: [] };
|
|
7496
|
+
function useMobileBinding(args) {
|
|
7497
|
+
const { binding, panelOpen, popupText, asks } = args;
|
|
7498
|
+
const latest = (0, import_react42.useRef)(args);
|
|
7499
|
+
latest.current = args;
|
|
7500
|
+
const bindingRef = (0, import_react42.useRef)(binding);
|
|
7501
|
+
bindingRef.current = binding;
|
|
7502
|
+
const backRef = (0, import_react42.useRef)(null);
|
|
7503
|
+
const [confirmedShown, setConfirmedShown] = (0, import_react42.useState)(null);
|
|
7504
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label)]);
|
|
7505
|
+
const reported = (0, import_react42.useRef)({ binding: void 0, key: "" });
|
|
7489
7506
|
(0, import_react42.useEffect)(() => {
|
|
7507
|
+
if (!binding) return;
|
|
7508
|
+
const prev = reported.current;
|
|
7509
|
+
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
7510
|
+
reported.current = { binding, key: teaserKey };
|
|
7511
|
+
if (teaserKey === "" && prev.binding !== binding) return;
|
|
7512
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })) });
|
|
7513
|
+
}, [binding, teaserKey]);
|
|
7514
|
+
(0, import_react42.useEffect)(() => {
|
|
7515
|
+
if (!binding) return;
|
|
7516
|
+
binding.onHandle({
|
|
7517
|
+
open: () => latest.current.open(),
|
|
7518
|
+
close: () => latest.current.close(),
|
|
7519
|
+
tapAsk: (index) => {
|
|
7520
|
+
const { asks: current, open } = latest.current;
|
|
7521
|
+
if (!Number.isInteger(index) || index < 0 || index >= current.length) return;
|
|
7522
|
+
open();
|
|
7523
|
+
current[index].onTap();
|
|
7524
|
+
},
|
|
7525
|
+
dismissTeaser: () => latest.current.dismissPopup(),
|
|
7526
|
+
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
7527
|
+
back: () => backRef.current?.() ?? false
|
|
7528
|
+
});
|
|
7529
|
+
return () => binding.onHandle(null);
|
|
7530
|
+
}, [binding]);
|
|
7531
|
+
const onCloseRequested = (0, import_react42.useCallback)(() => bindingRef.current?.onCloseRequested(), []);
|
|
7532
|
+
const onRegisterBack = (0, import_react42.useCallback)((fn) => {
|
|
7533
|
+
backRef.current = fn;
|
|
7534
|
+
}, []);
|
|
7535
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0 };
|
|
7536
|
+
return { confirmedShown, onCloseRequested, onRegisterBack };
|
|
7537
|
+
}
|
|
7538
|
+
|
|
7539
|
+
// src/openTelemetry.ts
|
|
7540
|
+
var import_react43 = require("react");
|
|
7541
|
+
function useOpenTelemetry(log, isOpen) {
|
|
7542
|
+
const openLoggedRef = (0, import_react43.useRef)(false);
|
|
7543
|
+
(0, import_react43.useEffect)(() => {
|
|
7490
7544
|
if (!isOpen) {
|
|
7491
7545
|
openLoggedRef.current = false;
|
|
7492
7546
|
return;
|
|
@@ -7498,13 +7552,13 @@ function useOpenTelemetry(log, isOpen) {
|
|
|
7498
7552
|
}
|
|
7499
7553
|
|
|
7500
7554
|
// src/components/ChatFab.tsx
|
|
7501
|
-
var
|
|
7555
|
+
var import_react45 = require("react");
|
|
7502
7556
|
|
|
7503
7557
|
// src/components/BrandMark.tsx
|
|
7504
|
-
var
|
|
7558
|
+
var import_react44 = require("react");
|
|
7505
7559
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
7506
7560
|
function BrandMark({ logoUrl, className }) {
|
|
7507
|
-
const [failed, setFailed] = (0,
|
|
7561
|
+
const [failed, setFailed] = (0, import_react44.useState)(false);
|
|
7508
7562
|
if (!logoUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SsMark, { className });
|
|
7509
7563
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { className, src: logoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
7510
7564
|
}
|
|
@@ -7542,9 +7596,9 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7542
7596
|
const bubble = popupText ?? greeting;
|
|
7543
7597
|
const hidden = busy && !label;
|
|
7544
7598
|
const track = useTrack();
|
|
7545
|
-
const [intro, setIntro] = (0,
|
|
7546
|
-
const armedRef = (0,
|
|
7547
|
-
(0,
|
|
7599
|
+
const [intro, setIntro] = (0, import_react45.useState)(false);
|
|
7600
|
+
const armedRef = (0, import_react45.useRef)(introAllowed);
|
|
7601
|
+
(0, import_react45.useEffect)(() => {
|
|
7548
7602
|
if (armedRef.current && bubble) {
|
|
7549
7603
|
armedRef.current = false;
|
|
7550
7604
|
setIntro(true);
|
|
@@ -7564,10 +7618,10 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
7564
7618
|
}
|
|
7565
7619
|
|
|
7566
7620
|
// src/components/ChatPanel.tsx
|
|
7567
|
-
var
|
|
7621
|
+
var import_react103 = require("react");
|
|
7568
7622
|
|
|
7569
7623
|
// src/components/ChatHeader.tsx
|
|
7570
|
-
var
|
|
7624
|
+
var import_react46 = require("react");
|
|
7571
7625
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7572
7626
|
function ChatHeader({
|
|
7573
7627
|
onClose,
|
|
@@ -7581,20 +7635,20 @@ function ChatHeader({
|
|
|
7581
7635
|
onOpenSettings,
|
|
7582
7636
|
settingsLabel
|
|
7583
7637
|
}) {
|
|
7584
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
7585
|
-
const wrapRef = (0,
|
|
7586
|
-
const kebabRef = (0,
|
|
7587
|
-
const firstItemRef = (0,
|
|
7638
|
+
const [menuOpen, setMenuOpen] = (0, import_react46.useState)(false);
|
|
7639
|
+
const wrapRef = (0, import_react46.useRef)(null);
|
|
7640
|
+
const kebabRef = (0, import_react46.useRef)(null);
|
|
7641
|
+
const firstItemRef = (0, import_react46.useRef)(null);
|
|
7588
7642
|
const hasNew = !!(canReset && onNewConversation);
|
|
7589
7643
|
const hasSettings = !!onOpenSettings;
|
|
7590
7644
|
const hasMenu = hasNew || hasSettings;
|
|
7591
|
-
(0,
|
|
7645
|
+
(0, import_react46.useEffect)(() => {
|
|
7592
7646
|
if (menuOpen) firstItemRef.current?.focus();
|
|
7593
7647
|
}, [menuOpen]);
|
|
7594
|
-
(0,
|
|
7648
|
+
(0, import_react46.useEffect)(() => {
|
|
7595
7649
|
if (!menuOpen) return;
|
|
7596
7650
|
const onPointer = (e) => {
|
|
7597
|
-
if (!wrapRef.current
|
|
7651
|
+
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
7598
7652
|
};
|
|
7599
7653
|
const onKey = (e) => {
|
|
7600
7654
|
if (e.key === "Escape") {
|
|
@@ -7664,10 +7718,10 @@ function ChatHeader({
|
|
|
7664
7718
|
}
|
|
7665
7719
|
|
|
7666
7720
|
// src/components/MessageList.tsx
|
|
7667
|
-
var
|
|
7721
|
+
var import_react59 = require("react");
|
|
7668
7722
|
|
|
7669
7723
|
// src/components/ChatMessage.tsx
|
|
7670
|
-
var
|
|
7724
|
+
var import_react58 = require("react");
|
|
7671
7725
|
|
|
7672
7726
|
// src/components/Markdown.tsx
|
|
7673
7727
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -7685,7 +7739,7 @@ function Markdown({ text: text2 }) {
|
|
|
7685
7739
|
}
|
|
7686
7740
|
|
|
7687
7741
|
// src/components/EntityCardList.tsx
|
|
7688
|
-
var
|
|
7742
|
+
var import_react47 = require("react");
|
|
7689
7743
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7690
7744
|
var MAX_VISIBLE = 3;
|
|
7691
7745
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -7769,7 +7823,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
7769
7823
|
)) });
|
|
7770
7824
|
}
|
|
7771
7825
|
function EntityCardItem({ c }) {
|
|
7772
|
-
const [active, setActive] = (0,
|
|
7826
|
+
const [active, setActive] = (0, import_react47.useState)(0);
|
|
7773
7827
|
const hasBody = c.scopes.length > 0;
|
|
7774
7828
|
if (!hasBody) {
|
|
7775
7829
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -7783,7 +7837,7 @@ function EntityCardItem({ c }) {
|
|
|
7783
7837
|
] });
|
|
7784
7838
|
}
|
|
7785
7839
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
7786
|
-
const [expanded, setExpanded] = (0,
|
|
7840
|
+
const [expanded, setExpanded] = (0, import_react47.useState)(false);
|
|
7787
7841
|
if (cards.length === 0) return null;
|
|
7788
7842
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
7789
7843
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -7884,17 +7938,17 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
7884
7938
|
}
|
|
7885
7939
|
|
|
7886
7940
|
// src/components/AddAllToSlipButton.tsx
|
|
7887
|
-
var
|
|
7941
|
+
var import_react48 = require("react");
|
|
7888
7942
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7889
7943
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
7890
7944
|
const add = useSlipAdd(slip, ui);
|
|
7891
7945
|
const slipState = useSlipState();
|
|
7892
7946
|
const log = useEventLog();
|
|
7893
7947
|
const track = useTrack();
|
|
7894
|
-
const [pending, setPending] = (0,
|
|
7895
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
7896
|
-
const [toast, setToast] = (0,
|
|
7897
|
-
const dismiss = (0,
|
|
7948
|
+
const [pending, setPending] = (0, import_react48.useState)(false);
|
|
7949
|
+
const [settledLocal, setSettledLocal] = (0, import_react48.useState)({});
|
|
7950
|
+
const [toast, setToast] = (0, import_react48.useState)(null);
|
|
7951
|
+
const dismiss = (0, import_react48.useCallback)(() => setToast(null), []);
|
|
7898
7952
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
7899
7953
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
7900
7954
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -7967,10 +8021,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
7967
8021
|
}
|
|
7968
8022
|
|
|
7969
8023
|
// src/presetToolsContext.ts
|
|
7970
|
-
var
|
|
7971
|
-
var PresetToolsContext = (0,
|
|
8024
|
+
var import_react49 = require("react");
|
|
8025
|
+
var PresetToolsContext = (0, import_react49.createContext)(null);
|
|
7972
8026
|
function usePresetTools() {
|
|
7973
|
-
return (0,
|
|
8027
|
+
return (0, import_react49.useContext)(PresetToolsContext);
|
|
7974
8028
|
}
|
|
7975
8029
|
|
|
7976
8030
|
// src/components/ComboCardList.tsx
|
|
@@ -8953,15 +9007,15 @@ function pathRounds(e) {
|
|
|
8953
9007
|
const base = h - pad.b;
|
|
8954
9008
|
const plotH = h - pad.t - pad.b;
|
|
8955
9009
|
const { lo, span } = roundSpan(e);
|
|
8956
|
-
const
|
|
9010
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
8957
9011
|
for (const ev of e.events) {
|
|
8958
9012
|
if (ev.roundIndex < 0) continue;
|
|
8959
9013
|
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8960
9014
|
const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
|
|
8961
|
-
if (short !== "" && !
|
|
9015
|
+
if (short !== "" && !seen2.has(idx)) seen2.set(idx, short);
|
|
8962
9016
|
}
|
|
8963
9017
|
const kept = [];
|
|
8964
|
-
for (const [roundIndex, label] of [...
|
|
9018
|
+
for (const [roundIndex, label] of [...seen2.entries()].sort((a, b) => b[0] - a[0])) {
|
|
8965
9019
|
const y = round22(base - (roundIndex - lo + 1) / span * plotH);
|
|
8966
9020
|
const last = kept[kept.length - 1];
|
|
8967
9021
|
if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
|
|
@@ -9204,7 +9258,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
9204
9258
|
}
|
|
9205
9259
|
|
|
9206
9260
|
// src/components/CompactOddsList.tsx
|
|
9207
|
-
var
|
|
9261
|
+
var import_react50 = require("react");
|
|
9208
9262
|
var import_widget_sdk23 = require("@sensiblestats/widget-sdk");
|
|
9209
9263
|
|
|
9210
9264
|
// src/compactList.ts
|
|
@@ -9326,11 +9380,11 @@ function Row({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
9326
9380
|
] });
|
|
9327
9381
|
}
|
|
9328
9382
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
9329
|
-
const [shown2, setShown] = (0,
|
|
9383
|
+
const [shown2, setShown] = (0, import_react50.useState)(COMPACT_PAGE);
|
|
9330
9384
|
const hidden = list.rowCount - shown2;
|
|
9331
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
9332
|
-
const focusRef = (0,
|
|
9333
|
-
(0,
|
|
9385
|
+
const [focusIndex, setFocusIndex] = (0, import_react50.useState)(null);
|
|
9386
|
+
const focusRef = (0, import_react50.useRef)(null);
|
|
9387
|
+
(0, import_react50.useEffect)(() => {
|
|
9334
9388
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
9335
9389
|
}, [focusIndex]);
|
|
9336
9390
|
let left = shown2;
|
|
@@ -9565,7 +9619,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9565
9619
|
}
|
|
9566
9620
|
|
|
9567
9621
|
// src/components/dashboard/CountdownCard.tsx
|
|
9568
|
-
var
|
|
9622
|
+
var import_react51 = require("react");
|
|
9569
9623
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9570
9624
|
var DAY_MS3 = 864e5;
|
|
9571
9625
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -9584,12 +9638,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9584
9638
|
function CountdownCard({ card, ui }) {
|
|
9585
9639
|
const { data } = card;
|
|
9586
9640
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
9587
|
-
const [nowMs, setNowMs] = (0,
|
|
9588
|
-
const [reduced] = (0,
|
|
9641
|
+
const [nowMs, setNowMs] = (0, import_react51.useState)(() => Date.now());
|
|
9642
|
+
const [reduced] = (0, import_react51.useState)(
|
|
9589
9643
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9590
9644
|
);
|
|
9591
9645
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9592
|
-
(0,
|
|
9646
|
+
(0, import_react51.useEffect)(() => {
|
|
9593
9647
|
if (reduced) return;
|
|
9594
9648
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
9595
9649
|
return () => window.clearInterval(id);
|
|
@@ -9597,7 +9651,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9597
9651
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
9598
9652
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
9599
9653
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
9600
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
9654
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react51.Fragment, { children: [
|
|
9601
9655
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
9602
9656
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
9603
9657
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -9608,7 +9662,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9608
9662
|
}
|
|
9609
9663
|
|
|
9610
9664
|
// src/components/dashboard/InjuriesCard.tsx
|
|
9611
|
-
var
|
|
9665
|
+
var import_react52 = require("react");
|
|
9612
9666
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9613
9667
|
var SHOWN = 3;
|
|
9614
9668
|
function ColHead({ name, crestUrl }) {
|
|
@@ -9631,7 +9685,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
9631
9685
|
}
|
|
9632
9686
|
function InjuriesCard({ card, ui }) {
|
|
9633
9687
|
const { data } = card;
|
|
9634
|
-
const [expanded, setExpanded] = (0,
|
|
9688
|
+
const [expanded, setExpanded] = (0, import_react52.useState)(false);
|
|
9635
9689
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
9636
9690
|
const limit = expanded ? void 0 : SHOWN;
|
|
9637
9691
|
const { showMore, showLess } = ui;
|
|
@@ -9736,7 +9790,7 @@ function LinksCard({ card }) {
|
|
|
9736
9790
|
}
|
|
9737
9791
|
|
|
9738
9792
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
9739
|
-
var
|
|
9793
|
+
var import_react53 = require("react");
|
|
9740
9794
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9741
9795
|
function initials3(name) {
|
|
9742
9796
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -9746,7 +9800,7 @@ function PostMatchCrest({
|
|
|
9746
9800
|
name,
|
|
9747
9801
|
side
|
|
9748
9802
|
}) {
|
|
9749
|
-
const [failed, setFailed] = (0,
|
|
9803
|
+
const [failed, setFailed] = (0, import_react53.useState)(false);
|
|
9750
9804
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
9751
9805
|
if (url && !failed) {
|
|
9752
9806
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9945,10 +9999,10 @@ function RestingFormCard({ card }) {
|
|
|
9945
9999
|
}
|
|
9946
10000
|
|
|
9947
10001
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
9948
|
-
var
|
|
10002
|
+
var import_react55 = require("react");
|
|
9949
10003
|
|
|
9950
10004
|
// src/useLiveClock.ts
|
|
9951
|
-
var
|
|
10005
|
+
var import_react54 = require("react");
|
|
9952
10006
|
var TICK_MS = 6e4;
|
|
9953
10007
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
9954
10008
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -9957,10 +10011,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
9957
10011
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
9958
10012
|
}
|
|
9959
10013
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
9960
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10014
|
+
const [displayMinute, setDisplayMinute] = (0, import_react54.useState)(
|
|
9961
10015
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
9962
10016
|
);
|
|
9963
|
-
(0,
|
|
10017
|
+
(0, import_react54.useEffect)(() => {
|
|
9964
10018
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
9965
10019
|
if (!clockRunning) return;
|
|
9966
10020
|
const id = window.setInterval(() => {
|
|
@@ -9977,7 +10031,7 @@ function initials5(name) {
|
|
|
9977
10031
|
return name.trim().slice(0, 3).toUpperCase();
|
|
9978
10032
|
}
|
|
9979
10033
|
function LiveCrest({ url, name, side }) {
|
|
9980
|
-
const [failed, setFailed] = (0,
|
|
10034
|
+
const [failed, setFailed] = (0, import_react55.useState)(false);
|
|
9981
10035
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
9982
10036
|
if (url && !failed) {
|
|
9983
10037
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -9999,7 +10053,7 @@ function LiveScoreCard({
|
|
|
9999
10053
|
}) {
|
|
10000
10054
|
const { data } = card;
|
|
10001
10055
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10002
|
-
const seedRef = (0,
|
|
10056
|
+
const seedRef = (0, import_react55.useRef)(null);
|
|
10003
10057
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10004
10058
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10005
10059
|
}
|
|
@@ -10045,7 +10099,7 @@ function LiveScoreCard({
|
|
|
10045
10099
|
}
|
|
10046
10100
|
|
|
10047
10101
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10048
|
-
var
|
|
10102
|
+
var import_react56 = require("react");
|
|
10049
10103
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10050
10104
|
var SHOWN2 = 3;
|
|
10051
10105
|
function EventIcon({ type }) {
|
|
@@ -10087,7 +10141,7 @@ function EventRow({ e }) {
|
|
|
10087
10141
|
] });
|
|
10088
10142
|
}
|
|
10089
10143
|
function LiveTimelineCard({ card, ui }) {
|
|
10090
|
-
const [expanded, setExpanded] = (0,
|
|
10144
|
+
const [expanded, setExpanded] = (0, import_react56.useState)(false);
|
|
10091
10145
|
const events = card.data.events;
|
|
10092
10146
|
if (!events || events.length === 0) return null;
|
|
10093
10147
|
const sorted = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -10111,7 +10165,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
10111
10165
|
}
|
|
10112
10166
|
|
|
10113
10167
|
// src/components/dashboard/MomentumWave.tsx
|
|
10114
|
-
var
|
|
10168
|
+
var import_react57 = require("react");
|
|
10115
10169
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10116
10170
|
var WIDTH = 270;
|
|
10117
10171
|
var HEIGHT = 56;
|
|
@@ -10136,7 +10190,7 @@ function MomentumWave({
|
|
|
10136
10190
|
}) {
|
|
10137
10191
|
if (points.length === 0) return null;
|
|
10138
10192
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
10139
|
-
const clipId = (0,
|
|
10193
|
+
const clipId = (0, import_react57.useId)();
|
|
10140
10194
|
const topClipId = `${clipId}-top`;
|
|
10141
10195
|
const bottomClipId = `${clipId}-bottom`;
|
|
10142
10196
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -10286,7 +10340,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
10286
10340
|
// src/components/ChatMessage.tsx
|
|
10287
10341
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
10288
10342
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
10289
|
-
const [sport, setSport] = (0,
|
|
10343
|
+
const [sport, setSport] = (0, import_react58.useState)(null);
|
|
10290
10344
|
if (message.role === "user") {
|
|
10291
10345
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
10292
10346
|
}
|
|
@@ -10340,11 +10394,11 @@ function turnAnchor(messages) {
|
|
|
10340
10394
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
10341
10395
|
const { state, send } = controller;
|
|
10342
10396
|
const { oddsFormat } = useOddsSettings();
|
|
10343
|
-
const listRef = (0,
|
|
10344
|
-
const endRef = (0,
|
|
10345
|
-
const pinnedRef = (0,
|
|
10346
|
-
const anchoredTurnRef = (0,
|
|
10347
|
-
(0,
|
|
10397
|
+
const listRef = (0, import_react59.useRef)(null);
|
|
10398
|
+
const endRef = (0, import_react59.useRef)(null);
|
|
10399
|
+
const pinnedRef = (0, import_react59.useRef)(true);
|
|
10400
|
+
const anchoredTurnRef = (0, import_react59.useRef)(null);
|
|
10401
|
+
(0, import_react59.useEffect)(() => {
|
|
10348
10402
|
const anchor = turnAnchor(state.messages);
|
|
10349
10403
|
const list = listRef.current;
|
|
10350
10404
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -10403,13 +10457,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
10403
10457
|
}
|
|
10404
10458
|
|
|
10405
10459
|
// src/components/ChatInput.tsx
|
|
10406
|
-
var
|
|
10460
|
+
var import_react60 = require("react");
|
|
10407
10461
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
10408
|
-
var ChatInput = (0,
|
|
10409
|
-
const [value, setValue] = (0,
|
|
10410
|
-
const textareaRef = (0,
|
|
10411
|
-
const stopRef = (0,
|
|
10412
|
-
const textBoxWantsFocusRef = (0,
|
|
10462
|
+
var ChatInput = (0, import_react60.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
10463
|
+
const [value, setValue] = (0, import_react60.useState)("");
|
|
10464
|
+
const textareaRef = (0, import_react60.useRef)(null);
|
|
10465
|
+
const stopRef = (0, import_react60.useRef)(null);
|
|
10466
|
+
const textBoxWantsFocusRef = (0, import_react60.useRef)(false);
|
|
10413
10467
|
const submit = () => {
|
|
10414
10468
|
if (disabled) return;
|
|
10415
10469
|
const t = value.trim();
|
|
@@ -10423,7 +10477,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10423
10477
|
submit();
|
|
10424
10478
|
}
|
|
10425
10479
|
};
|
|
10426
|
-
(0,
|
|
10480
|
+
(0, import_react60.useImperativeHandle)(ref, () => ({
|
|
10427
10481
|
focus() {
|
|
10428
10482
|
const box = textareaRef.current;
|
|
10429
10483
|
if (box && !box.disabled) {
|
|
@@ -10435,7 +10489,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10435
10489
|
stopRef.current?.focus();
|
|
10436
10490
|
}
|
|
10437
10491
|
}), []);
|
|
10438
|
-
(0,
|
|
10492
|
+
(0, import_react60.useEffect)(() => {
|
|
10439
10493
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
10440
10494
|
textBoxWantsFocusRef.current = false;
|
|
10441
10495
|
const box = textareaRef.current;
|
|
@@ -10466,7 +10520,7 @@ var ChatInput = (0, import_react59.forwardRef)(function ChatInput2({ placeholder
|
|
|
10466
10520
|
});
|
|
10467
10521
|
|
|
10468
10522
|
// src/components/TabBar.tsx
|
|
10469
|
-
var
|
|
10523
|
+
var import_react61 = require("react");
|
|
10470
10524
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
10471
10525
|
var FIT_STEPS = [[0, false], [1, false], [1, true], [2, true], [3, true], [4, true], [5, true], [6, true]];
|
|
10472
10526
|
function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule, hasBuilder = false, gamesEnabled, clubEnabled, favouritesEnabled }) {
|
|
@@ -10489,16 +10543,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10489
10543
|
...favouritesEnabled && !clubEnabled ? [{ tab: "favourites", label: ui.tabFavourites, count: 0, dot: false }] : []
|
|
10490
10544
|
];
|
|
10491
10545
|
const track = useTrack();
|
|
10492
|
-
const listRef = (0,
|
|
10546
|
+
const listRef = (0, import_react61.useRef)(null);
|
|
10493
10547
|
const activeTab = monitor.activeTab;
|
|
10494
|
-
(0,
|
|
10548
|
+
(0, import_react61.useEffect)(() => {
|
|
10495
10549
|
const el = listRef.current?.querySelector("[data-on]");
|
|
10496
10550
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
10497
10551
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10498
10552
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
10499
10553
|
}, [activeTab]);
|
|
10500
10554
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
10501
|
-
(0,
|
|
10555
|
+
(0, import_react61.useLayoutEffect)(() => {
|
|
10502
10556
|
const strip = listRef.current;
|
|
10503
10557
|
if (!strip) return;
|
|
10504
10558
|
const fav = strip.querySelector("[data-fav-tab]");
|
|
@@ -10552,7 +10606,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
10552
10606
|
}
|
|
10553
10607
|
|
|
10554
10608
|
// src/components/MonitorTabs.tsx
|
|
10555
|
-
var
|
|
10609
|
+
var import_react73 = require("react");
|
|
10556
10610
|
|
|
10557
10611
|
// src/components/MarketAccordion.tsx
|
|
10558
10612
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
@@ -10614,16 +10668,66 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
10614
10668
|
}
|
|
10615
10669
|
|
|
10616
10670
|
// src/components/LiveFactBlock.tsx
|
|
10617
|
-
var
|
|
10671
|
+
var import_react63 = require("react");
|
|
10672
|
+
|
|
10673
|
+
// src/useFactView.ts
|
|
10674
|
+
var import_react62 = require("react");
|
|
10675
|
+
var DWELL_MS = 1e3;
|
|
10676
|
+
var seen = /* @__PURE__ */ new Set();
|
|
10677
|
+
function useFactView(ref, fact, entity2) {
|
|
10678
|
+
const log = useEventLog();
|
|
10679
|
+
const entityRef = (0, import_react62.useRef)(entity2);
|
|
10680
|
+
entityRef.current = entity2;
|
|
10681
|
+
const id = fact?.id;
|
|
10682
|
+
const factKey = fact?.factKey;
|
|
10683
|
+
(0, import_react62.useEffect)(() => {
|
|
10684
|
+
if (id === void 0 || factKey === void 0 || seen.has(id) || !log) return;
|
|
10685
|
+
const el = ref.current;
|
|
10686
|
+
if (!el) return;
|
|
10687
|
+
let timer;
|
|
10688
|
+
const fire = () => {
|
|
10689
|
+
if (seen.has(id)) return;
|
|
10690
|
+
seen.add(id);
|
|
10691
|
+
log.log({ name: "fact_view", ...entityRef.current, factId: String(id), factKey });
|
|
10692
|
+
};
|
|
10693
|
+
const clear = () => {
|
|
10694
|
+
if (timer !== void 0) {
|
|
10695
|
+
clearTimeout(timer);
|
|
10696
|
+
timer = void 0;
|
|
10697
|
+
}
|
|
10698
|
+
};
|
|
10699
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
10700
|
+
timer = setTimeout(fire, DWELL_MS);
|
|
10701
|
+
return clear;
|
|
10702
|
+
}
|
|
10703
|
+
const io = new IntersectionObserver((entries) => {
|
|
10704
|
+
const visible = entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5);
|
|
10705
|
+
if (visible) {
|
|
10706
|
+
if (timer === void 0) timer = setTimeout(fire, DWELL_MS);
|
|
10707
|
+
} else clear();
|
|
10708
|
+
}, { threshold: [0, 0.5] });
|
|
10709
|
+
io.observe(el);
|
|
10710
|
+
return () => {
|
|
10711
|
+
clear();
|
|
10712
|
+
io.disconnect();
|
|
10713
|
+
};
|
|
10714
|
+
}, [id, factKey, log, ref]);
|
|
10715
|
+
}
|
|
10716
|
+
|
|
10717
|
+
// src/components/LiveFactBlock.tsx
|
|
10618
10718
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
10619
10719
|
function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
10620
|
-
const [expanded, setExpanded] = (0,
|
|
10720
|
+
const [expanded, setExpanded] = (0, import_react63.useState)(false);
|
|
10621
10721
|
const { oddsFormat } = useOddsSettings();
|
|
10722
|
+
const log = useEventLog();
|
|
10723
|
+
const sectionRef = (0, import_react63.useRef)(null);
|
|
10622
10724
|
const [current, ...earlier] = facts;
|
|
10725
|
+
const entity2 = current?.market ? { entityType: "market", entityId: current.market.marketDeveloperName } : { entityType: "match", entityId: String(match.matchId) };
|
|
10726
|
+
useFactView(sectionRef, current, entity2);
|
|
10623
10727
|
if (!current) return null;
|
|
10624
10728
|
const m = current.market;
|
|
10625
10729
|
const chipPrice = m ? chipPriceText(m, oddsFormat) : void 0;
|
|
10626
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { ref: sectionRef, className: "ss-w-fact", "aria-label": ui.liveFactLabel, children: [
|
|
10627
10731
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ss-w-fact-k", children: [
|
|
10628
10732
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: ui.liveFactLabel }),
|
|
10629
10733
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ss-w-fact-min", children: [
|
|
@@ -10649,7 +10753,8 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10649
10753
|
marketDeveloperName: m.marketDeveloperName,
|
|
10650
10754
|
selectionLabel: m.selectionLabel,
|
|
10651
10755
|
slip,
|
|
10652
|
-
ui
|
|
10756
|
+
ui,
|
|
10757
|
+
fact: { id: current.id, factKey: current.factKey }
|
|
10653
10758
|
}
|
|
10654
10759
|
)
|
|
10655
10760
|
] })
|
|
@@ -10667,7 +10772,10 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10667
10772
|
{
|
|
10668
10773
|
type: "button",
|
|
10669
10774
|
className: "ss-w-fact-link",
|
|
10670
|
-
onClick: () =>
|
|
10775
|
+
onClick: () => {
|
|
10776
|
+
log?.log({ name: "fact_ask", ...entity2, factId: String(current.id), factKey: current.factKey });
|
|
10777
|
+
onAsk(current.text, { kind: "liveFact", matchId: match.matchId, subject: current.text.slice(0, 400) });
|
|
10778
|
+
},
|
|
10671
10779
|
children: ui.liveFactAsk
|
|
10672
10780
|
}
|
|
10673
10781
|
),
|
|
@@ -10686,7 +10794,7 @@ function LiveFactBlock({ facts, match, ui, slip, onAsk }) {
|
|
|
10686
10794
|
}
|
|
10687
10795
|
|
|
10688
10796
|
// src/components/MonitorFormH2H.tsx
|
|
10689
|
-
var
|
|
10797
|
+
var import_react64 = require("react");
|
|
10690
10798
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
10691
10799
|
function resultClass2(result) {
|
|
10692
10800
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -10702,7 +10810,7 @@ function FormDots({ form, ui }) {
|
|
|
10702
10810
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
10703
10811
|
}
|
|
10704
10812
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
10705
|
-
const [expanded, setExpanded] = (0,
|
|
10813
|
+
const [expanded, setExpanded] = (0, import_react64.useState)(false);
|
|
10706
10814
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
10707
10815
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
10708
10816
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, {});
|
|
@@ -10935,7 +11043,7 @@ var sportLabel = (ui, sport) => {
|
|
|
10935
11043
|
};
|
|
10936
11044
|
|
|
10937
11045
|
// src/components/NbaFormSection.tsx
|
|
10938
|
-
var
|
|
11046
|
+
var import_react65 = require("react");
|
|
10939
11047
|
|
|
10940
11048
|
// src/components/NbaFormRest.tsx
|
|
10941
11049
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
@@ -11034,8 +11142,8 @@ function Row2({ game, abbr, tonight, ui }) {
|
|
|
11034
11142
|
] });
|
|
11035
11143
|
}
|
|
11036
11144
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11037
|
-
const [open, setOpen] = (0,
|
|
11038
|
-
const [side, setSide] = (0,
|
|
11145
|
+
const [open, setOpen] = (0, import_react65.useState)(false);
|
|
11146
|
+
const [side, setSide] = (0, import_react65.useState)("away");
|
|
11039
11147
|
const form = useNbaForm(match, monitor);
|
|
11040
11148
|
const b = match.basketball;
|
|
11041
11149
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11077,10 +11185,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11077
11185
|
}
|
|
11078
11186
|
|
|
11079
11187
|
// src/components/NbaPropsSection.tsx
|
|
11080
|
-
var
|
|
11188
|
+
var import_react67 = require("react");
|
|
11081
11189
|
|
|
11082
11190
|
// src/components/PropsPieces.tsx
|
|
11083
|
-
var
|
|
11191
|
+
var import_react66 = require("react");
|
|
11084
11192
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11085
11193
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11086
11194
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -11093,9 +11201,9 @@ function preKickoff(match) {
|
|
|
11093
11201
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
11094
11202
|
}
|
|
11095
11203
|
function usePreKickoff(match) {
|
|
11096
|
-
const [, setTick] = (0,
|
|
11204
|
+
const [, setTick] = (0, import_react66.useState)(0);
|
|
11097
11205
|
const pre = preKickoff(match);
|
|
11098
|
-
(0,
|
|
11206
|
+
(0, import_react66.useEffect)(() => {
|
|
11099
11207
|
if (!pre || !match.kickoffUtc) return;
|
|
11100
11208
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
11101
11209
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -11109,7 +11217,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
11109
11217
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
11110
11218
|
const live = match.phase === "live";
|
|
11111
11219
|
const open = pre || live;
|
|
11112
|
-
(0,
|
|
11220
|
+
(0, import_react66.useEffect)(() => {
|
|
11113
11221
|
if (!open) return;
|
|
11114
11222
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
11115
11223
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -11187,7 +11295,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
11187
11295
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
11188
11296
|
const player = livePlayer(bundle, given);
|
|
11189
11297
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
11190
|
-
const [picked, setPicked] = (0,
|
|
11298
|
+
const [picked, setPicked] = (0, import_react66.useState)(null);
|
|
11191
11299
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
11192
11300
|
const sample = active?.games?.length ?? 0;
|
|
11193
11301
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -11236,7 +11344,7 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
11236
11344
|
] });
|
|
11237
11345
|
}
|
|
11238
11346
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
11239
|
-
const [openId, setOpenId] = (0,
|
|
11347
|
+
const [openId, setOpenId] = (0, import_react66.useState)(null);
|
|
11240
11348
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
11241
11349
|
const p = livePlayer(bundle, given);
|
|
11242
11350
|
const isOpen = openId === p.playerId;
|
|
@@ -11273,12 +11381,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
11273
11381
|
}
|
|
11274
11382
|
var BOX_QUIET_MS = 12e4;
|
|
11275
11383
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
11276
|
-
const [tick, setTick] = (0,
|
|
11384
|
+
const [tick, setTick] = (0, import_react66.useState)(0);
|
|
11277
11385
|
const time = clock2(boxAsOfUtc, ui);
|
|
11278
11386
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
11279
11387
|
const valid = !Number.isNaN(at2);
|
|
11280
11388
|
const onBreak = atBreak(match);
|
|
11281
|
-
(0,
|
|
11389
|
+
(0, import_react66.useEffect)(() => {
|
|
11282
11390
|
if (!valid || onBreak) return;
|
|
11283
11391
|
const age2 = Date.now() - at2;
|
|
11284
11392
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11339,12 +11447,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
11339
11447
|
tenGameBars: false
|
|
11340
11448
|
});
|
|
11341
11449
|
function StatsClock2({ bundle, match, ui }) {
|
|
11342
|
-
const [tick, setTick] = (0,
|
|
11450
|
+
const [tick, setTick] = (0, import_react67.useState)(0);
|
|
11343
11451
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
11344
11452
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
11345
11453
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
11346
11454
|
const onBreak = atBreak(match);
|
|
11347
|
-
(0,
|
|
11455
|
+
(0, import_react67.useEffect)(() => {
|
|
11348
11456
|
if (!valid || onBreak) return;
|
|
11349
11457
|
const age2 = Date.now() - at2;
|
|
11350
11458
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -11358,7 +11466,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
11358
11466
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
11359
11467
|
}
|
|
11360
11468
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
11361
|
-
const [side, setSide] = (0,
|
|
11469
|
+
const [side, setSide] = (0, import_react67.useState)("home");
|
|
11362
11470
|
const descriptor = nbaDescriptor(ui, match);
|
|
11363
11471
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11364
11472
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11507,7 +11615,7 @@ function NbaMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11507
11615
|
}
|
|
11508
11616
|
|
|
11509
11617
|
// src/components/NflFormSection.tsx
|
|
11510
|
-
var
|
|
11618
|
+
var import_react68 = require("react");
|
|
11511
11619
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11512
11620
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
11513
11621
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -11559,7 +11667,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
11559
11667
|
] });
|
|
11560
11668
|
}
|
|
11561
11669
|
function NflFormSection({ match, monitor, ui }) {
|
|
11562
|
-
const [segment, setSegment] = (0,
|
|
11670
|
+
const [segment, setSegment] = (0, import_react68.useState)("away");
|
|
11563
11671
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
11564
11672
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
11565
11673
|
const form = bundle?.form;
|
|
@@ -11592,7 +11700,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
11592
11700
|
}
|
|
11593
11701
|
|
|
11594
11702
|
// src/components/NflPropsSection.tsx
|
|
11595
|
-
var
|
|
11703
|
+
var import_react69 = require("react");
|
|
11596
11704
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11597
11705
|
var TRENDS_SHOWN = 3;
|
|
11598
11706
|
var SCORERS_SHOWN = 8;
|
|
@@ -11665,7 +11773,7 @@ function ShowMore({ label, onClick }) {
|
|
|
11665
11773
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
11666
11774
|
}
|
|
11667
11775
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
11668
|
-
const [all, setAll] = (0,
|
|
11776
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11669
11777
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
11670
11778
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
11671
11779
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -11698,7 +11806,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
11698
11806
|
] });
|
|
11699
11807
|
}
|
|
11700
11808
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
11701
|
-
const [all, setAll] = (0,
|
|
11809
|
+
const [all, setAll] = (0, import_react69.useState)(false);
|
|
11702
11810
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
11703
11811
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
11704
11812
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -11725,7 +11833,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
11725
11833
|
] });
|
|
11726
11834
|
}
|
|
11727
11835
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
11728
|
-
const [tab, setTab] = (0,
|
|
11836
|
+
const [tab, setTab] = (0, import_react69.useState)(null);
|
|
11729
11837
|
const descriptor = nflDescriptor(ui);
|
|
11730
11838
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
11731
11839
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -11911,7 +12019,7 @@ function NflMonitorCard({ match, monitor, ui, slip }) {
|
|
|
11911
12019
|
}
|
|
11912
12020
|
|
|
11913
12021
|
// src/components/TennisMonitorCard.tsx
|
|
11914
|
-
var
|
|
12022
|
+
var import_react71 = require("react");
|
|
11915
12023
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
11916
12024
|
|
|
11917
12025
|
// src/components/TennisFixtureRow.tsx
|
|
@@ -12172,7 +12280,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
12172
12280
|
}
|
|
12173
12281
|
|
|
12174
12282
|
// src/components/TennisStatsTables.tsx
|
|
12175
|
-
var
|
|
12283
|
+
var import_react70 = require("react");
|
|
12176
12284
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12177
12285
|
function formatStat(row, value, locale) {
|
|
12178
12286
|
if (value == null) return "\u2013";
|
|
@@ -12210,8 +12318,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
12210
12318
|
] });
|
|
12211
12319
|
}
|
|
12212
12320
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
12213
|
-
const [tab, setTab] = (0,
|
|
12214
|
-
(0,
|
|
12321
|
+
const [tab, setTab] = (0, import_react70.useState)("match");
|
|
12322
|
+
(0, import_react70.useEffect)(() => {
|
|
12215
12323
|
setTab("match");
|
|
12216
12324
|
}, [resetKey]);
|
|
12217
12325
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -12242,7 +12350,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
12242
12350
|
] }),
|
|
12243
12351
|
today.rows.map((r) => {
|
|
12244
12352
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
12245
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
12353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react70.Fragment, { children: [
|
|
12246
12354
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
12247
12355
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
12248
12356
|
f(r.p1Today),
|
|
@@ -12377,7 +12485,7 @@ function HeadToHead({ t, ui }) {
|
|
|
12377
12485
|
] });
|
|
12378
12486
|
}
|
|
12379
12487
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
12380
|
-
const lastTables = (0,
|
|
12488
|
+
const lastTables = (0, import_react71.useRef)(null);
|
|
12381
12489
|
const t = match.tennis;
|
|
12382
12490
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
12383
12491
|
const preMatch = match.phase === "preMatch";
|
|
@@ -12457,7 +12565,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12457
12565
|
}
|
|
12458
12566
|
|
|
12459
12567
|
// src/components/ScoreboardStrip.tsx
|
|
12460
|
-
var
|
|
12568
|
+
var import_react72 = require("react");
|
|
12461
12569
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12462
12570
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12463
12571
|
function nbaStatus(m, ui) {
|
|
@@ -12552,8 +12660,8 @@ function rowsFor(m) {
|
|
|
12552
12660
|
];
|
|
12553
12661
|
}
|
|
12554
12662
|
function useStripScroll(selectedKey) {
|
|
12555
|
-
const stripRef = (0,
|
|
12556
|
-
(0,
|
|
12663
|
+
const stripRef = (0, import_react72.useRef)(null);
|
|
12664
|
+
(0, import_react72.useEffect)(() => {
|
|
12557
12665
|
const strip = stripRef.current;
|
|
12558
12666
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
12559
12667
|
if (!strip || !pressed) return;
|
|
@@ -12727,7 +12835,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12727
12835
|
] });
|
|
12728
12836
|
}
|
|
12729
12837
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
12730
|
-
const seedIndex = (0,
|
|
12838
|
+
const seedIndex = (0, import_react73.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
12731
12839
|
const tiles = orderTiles(
|
|
12732
12840
|
monitor.pins,
|
|
12733
12841
|
monitor.snapshot,
|
|
@@ -12799,7 +12907,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
12799
12907
|
}
|
|
12800
12908
|
|
|
12801
12909
|
// src/components/LivePanel.tsx
|
|
12802
|
-
var
|
|
12910
|
+
var import_react76 = require("react");
|
|
12803
12911
|
var import_widget_sdk35 = require("@sensiblestats/widget-sdk");
|
|
12804
12912
|
|
|
12805
12913
|
// src/scheduleView.ts
|
|
@@ -12974,20 +13082,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
12974
13082
|
}
|
|
12975
13083
|
|
|
12976
13084
|
// src/components/MatchSheet.tsx
|
|
12977
|
-
var
|
|
13085
|
+
var import_react75 = require("react");
|
|
12978
13086
|
var import_widget_sdk33 = require("@sensiblestats/widget-sdk");
|
|
12979
13087
|
|
|
12980
13088
|
// src/useModalDialog.ts
|
|
12981
|
-
var
|
|
13089
|
+
var import_react74 = require("react");
|
|
12982
13090
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
12983
13091
|
function useModalDialog(onClose, opts = {}) {
|
|
12984
|
-
const dialogRef = (0,
|
|
12985
|
-
const onCloseRef = (0,
|
|
13092
|
+
const dialogRef = (0, import_react74.useRef)(null);
|
|
13093
|
+
const onCloseRef = (0, import_react74.useRef)(onClose);
|
|
12986
13094
|
onCloseRef.current = onClose;
|
|
12987
|
-
const openerRef = (0,
|
|
13095
|
+
const openerRef = (0, import_react74.useRef)(opts.opener);
|
|
12988
13096
|
openerRef.current = opts.opener;
|
|
12989
13097
|
const restore = opts.restoreFocus ?? true;
|
|
12990
|
-
(0,
|
|
13098
|
+
(0, import_react74.useEffect)(() => {
|
|
12991
13099
|
const dialog = dialogRef.current;
|
|
12992
13100
|
const root = dialog?.getRootNode();
|
|
12993
13101
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -12998,7 +13106,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
12998
13106
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
12999
13107
|
};
|
|
13000
13108
|
}, []);
|
|
13001
|
-
(0,
|
|
13109
|
+
(0, import_react74.useEffect)(() => {
|
|
13002
13110
|
const onKey = (e) => {
|
|
13003
13111
|
if (e.key !== "Escape") return;
|
|
13004
13112
|
e.stopPropagation();
|
|
@@ -13039,8 +13147,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
13039
13147
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
13040
13148
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
13041
13149
|
const log = useEventLog();
|
|
13042
|
-
const titleId = (0,
|
|
13043
|
-
const [limitHit, setLimitHit] = (0,
|
|
13150
|
+
const titleId = (0, import_react75.useId)();
|
|
13151
|
+
const [limitHit, setLimitHit] = (0, import_react75.useState)(false);
|
|
13044
13152
|
const pinSport = (0, import_widget_sdk33.slipSportOf)(match.sport);
|
|
13045
13153
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
13046
13154
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -13141,10 +13249,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
13141
13249
|
var QUIET_ROWS = 4;
|
|
13142
13250
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
13143
13251
|
const { groups, states, stale } = discovery;
|
|
13144
|
-
const [mine, setMine] = (0,
|
|
13145
|
-
const [toggled, setToggled] = (0,
|
|
13146
|
-
const [sheet, setSheet] = (0,
|
|
13147
|
-
const pinnedKeys = (0,
|
|
13252
|
+
const [mine, setMine] = (0, import_react76.useState)(false);
|
|
13253
|
+
const [toggled, setToggled] = (0, import_react76.useState)(/* @__PURE__ */ new Map());
|
|
13254
|
+
const [sheet, setSheet] = (0, import_react76.useState)(null);
|
|
13255
|
+
const pinnedKeys = (0, import_react76.useMemo)(
|
|
13148
13256
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk35.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13149
13257
|
[monitor.pins]
|
|
13150
13258
|
);
|
|
@@ -13250,20 +13358,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
13250
13358
|
}
|
|
13251
13359
|
|
|
13252
13360
|
// src/components/ScheduleMatchesPanel.tsx
|
|
13253
|
-
var
|
|
13361
|
+
var import_react80 = require("react");
|
|
13254
13362
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
13255
13363
|
|
|
13256
13364
|
// src/useTennisRowPrices.ts
|
|
13257
|
-
var
|
|
13365
|
+
var import_react77 = require("react");
|
|
13258
13366
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13259
13367
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
13260
13368
|
function useTennisRowPrices(a) {
|
|
13261
|
-
const [state, setState] = (0,
|
|
13262
|
-
const getPricesRef = (0,
|
|
13369
|
+
const [state, setState] = (0, import_react77.useState)({ byId: null, stale: false });
|
|
13370
|
+
const getPricesRef = (0, import_react77.useRef)(a.getPrices);
|
|
13263
13371
|
getPricesRef.current = a.getPrices;
|
|
13264
|
-
const latest = (0,
|
|
13372
|
+
const latest = (0, import_react77.useRef)(0);
|
|
13265
13373
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
13266
|
-
(0,
|
|
13374
|
+
(0, import_react77.useEffect)(() => {
|
|
13267
13375
|
if (!a.enabled || idsKey === "") {
|
|
13268
13376
|
latest.current++;
|
|
13269
13377
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -13301,11 +13409,11 @@ function useTennisRowPrices(a) {
|
|
|
13301
13409
|
}
|
|
13302
13410
|
|
|
13303
13411
|
// src/components/DayStrip.tsx
|
|
13304
|
-
var
|
|
13412
|
+
var import_react78 = require("react");
|
|
13305
13413
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13306
13414
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
13307
|
-
const listRef = (0,
|
|
13308
|
-
(0,
|
|
13415
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
13416
|
+
(0, import_react78.useEffect)(() => {
|
|
13309
13417
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
13310
13418
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
13311
13419
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -13334,7 +13442,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
13334
13442
|
}
|
|
13335
13443
|
|
|
13336
13444
|
// src/components/games/ui/SearchField.tsx
|
|
13337
|
-
var
|
|
13445
|
+
var import_react79 = require("react");
|
|
13338
13446
|
|
|
13339
13447
|
// src/components/games/ui/icons.tsx
|
|
13340
13448
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -13373,8 +13481,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
13373
13481
|
// src/components/games/ui/SearchField.tsx
|
|
13374
13482
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13375
13483
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
13376
|
-
const localRef = (0,
|
|
13377
|
-
const setInputRef = (0,
|
|
13484
|
+
const localRef = (0, import_react79.useRef)(null);
|
|
13485
|
+
const setInputRef = (0, import_react79.useCallback)((node) => {
|
|
13378
13486
|
localRef.current = node;
|
|
13379
13487
|
if (typeof inputRef === "function") inputRef(node);
|
|
13380
13488
|
else if (inputRef) inputRef.current = node;
|
|
@@ -13420,18 +13528,18 @@ var TOP_ROW_CAP = 3;
|
|
|
13420
13528
|
var SKELETON_ROWS = 3;
|
|
13421
13529
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
13422
13530
|
const { localDate: today, states, stale } = discovery;
|
|
13423
|
-
const searchId = (0,
|
|
13424
|
-
const [query, setQuery] = (0,
|
|
13425
|
-
const [toggled, setToggled] = (0,
|
|
13426
|
-
const [expanded, setExpanded] = (0,
|
|
13427
|
-
const listRef = (0,
|
|
13428
|
-
const [sheet, setSheet] = (0,
|
|
13531
|
+
const searchId = (0, import_react80.useId)();
|
|
13532
|
+
const [query, setQuery] = (0, import_react80.useState)("");
|
|
13533
|
+
const [toggled, setToggled] = (0, import_react80.useState)(/* @__PURE__ */ new Map());
|
|
13534
|
+
const [expanded, setExpanded] = (0, import_react80.useState)(/* @__PURE__ */ new Set());
|
|
13535
|
+
const listRef = (0, import_react80.useRef)(null);
|
|
13536
|
+
const [sheet, setSheet] = (0, import_react80.useState)(null);
|
|
13429
13537
|
const { chips, selected } = loaded;
|
|
13430
|
-
(0,
|
|
13538
|
+
(0, import_react80.useEffect)(() => {
|
|
13431
13539
|
if (selected !== day) onDay(selected);
|
|
13432
13540
|
}, [day, selected, onDay]);
|
|
13433
13541
|
const isToday = selected === today;
|
|
13434
|
-
const pinnedKeys = (0,
|
|
13542
|
+
const pinnedKeys = (0, import_react80.useMemo)(
|
|
13435
13543
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk37.matchKey)(p.sport, p.matchId, p.tour))),
|
|
13436
13544
|
[monitor.pins]
|
|
13437
13545
|
);
|
|
@@ -13569,7 +13677,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13569
13677
|
}
|
|
13570
13678
|
|
|
13571
13679
|
// src/components/GamesPanel.tsx
|
|
13572
|
-
var
|
|
13680
|
+
var import_react95 = require("react");
|
|
13573
13681
|
|
|
13574
13682
|
// src/components/GamesLoginWall.tsx
|
|
13575
13683
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
@@ -13578,7 +13686,7 @@ function GamesLoginWall({ ui }) {
|
|
|
13578
13686
|
}
|
|
13579
13687
|
|
|
13580
13688
|
// src/components/GamesHub.tsx
|
|
13581
|
-
var
|
|
13689
|
+
var import_react81 = require("react");
|
|
13582
13690
|
|
|
13583
13691
|
// src/components/games/ui/gameMeta.ts
|
|
13584
13692
|
function prettifyGameId(gameId) {
|
|
@@ -13729,8 +13837,8 @@ function pickHeroGame(games) {
|
|
|
13729
13837
|
}
|
|
13730
13838
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
13731
13839
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
13732
|
-
const [, setTick] = (0,
|
|
13733
|
-
(0,
|
|
13840
|
+
const [, setTick] = (0, import_react81.useState)(0);
|
|
13841
|
+
(0, import_react81.useEffect)(() => {
|
|
13734
13842
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
13735
13843
|
return () => clearInterval(id);
|
|
13736
13844
|
}, []);
|
|
@@ -13790,10 +13898,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
13790
13898
|
}
|
|
13791
13899
|
|
|
13792
13900
|
// src/components/GameScreenHost.tsx
|
|
13793
|
-
var
|
|
13901
|
+
var import_react93 = require("react");
|
|
13794
13902
|
|
|
13795
13903
|
// src/useGamePlay.ts
|
|
13796
|
-
var
|
|
13904
|
+
var import_react82 = require("react");
|
|
13797
13905
|
function toSubmitResult(payload) {
|
|
13798
13906
|
return {
|
|
13799
13907
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -13805,17 +13913,17 @@ function toSubmitResult(payload) {
|
|
|
13805
13913
|
};
|
|
13806
13914
|
}
|
|
13807
13915
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
13808
|
-
const [result, setResult] = (0,
|
|
13809
|
-
const [submitting, setSubmitting] = (0,
|
|
13810
|
-
const [rawStatus, setRawStatus] = (0,
|
|
13811
|
-
const inFlightRef = (0,
|
|
13812
|
-
const convRef = (0,
|
|
13916
|
+
const [result, setResult] = (0, import_react82.useState)(null);
|
|
13917
|
+
const [submitting, setSubmitting] = (0, import_react82.useState)(false);
|
|
13918
|
+
const [rawStatus, setRawStatus] = (0, import_react82.useState)(null);
|
|
13919
|
+
const inFlightRef = (0, import_react82.useRef)(false);
|
|
13920
|
+
const convRef = (0, import_react82.useRef)(conversation);
|
|
13813
13921
|
convRef.current = conversation;
|
|
13814
|
-
const optsRef = (0,
|
|
13922
|
+
const optsRef = (0, import_react82.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
13815
13923
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
13816
|
-
const resultRef = (0,
|
|
13924
|
+
const resultRef = (0, import_react82.useRef)(null);
|
|
13817
13925
|
resultRef.current = result;
|
|
13818
|
-
const refetch = (0,
|
|
13926
|
+
const refetch = (0, import_react82.useCallback)(async () => {
|
|
13819
13927
|
const conv = convRef.current;
|
|
13820
13928
|
if (!conv) return;
|
|
13821
13929
|
const opts = optsRef.current;
|
|
@@ -13831,7 +13939,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13831
13939
|
} catch {
|
|
13832
13940
|
}
|
|
13833
13941
|
}, []);
|
|
13834
|
-
const submit = (0,
|
|
13942
|
+
const submit = (0, import_react82.useCallback)(async (answerJson) => {
|
|
13835
13943
|
const conv = convRef.current;
|
|
13836
13944
|
if (!conv || inFlightRef.current) return;
|
|
13837
13945
|
inFlightRef.current = true;
|
|
@@ -13858,14 +13966,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
13858
13966
|
setSubmitting(false);
|
|
13859
13967
|
}
|
|
13860
13968
|
}, [refetch]);
|
|
13861
|
-
const hydrate = (0,
|
|
13969
|
+
const hydrate = (0, import_react82.useCallback)(() => {
|
|
13862
13970
|
void refetch();
|
|
13863
13971
|
}, [refetch]);
|
|
13864
13972
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
13865
13973
|
}
|
|
13866
13974
|
|
|
13867
13975
|
// src/components/games/MysteryTigerGame.tsx
|
|
13868
|
-
var
|
|
13976
|
+
var import_react84 = require("react");
|
|
13869
13977
|
|
|
13870
13978
|
// src/components/games/nationFlags.ts
|
|
13871
13979
|
var FLAGS = {
|
|
@@ -14076,7 +14184,7 @@ function isNationCode(flag) {
|
|
|
14076
14184
|
}
|
|
14077
14185
|
|
|
14078
14186
|
// src/components/games/PlayerAvatar.tsx
|
|
14079
|
-
var
|
|
14187
|
+
var import_react83 = require("react");
|
|
14080
14188
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14081
14189
|
function initialsOf(name) {
|
|
14082
14190
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -14094,7 +14202,7 @@ function PlayerAvatar({
|
|
|
14094
14202
|
imagePath,
|
|
14095
14203
|
className
|
|
14096
14204
|
}) {
|
|
14097
|
-
const [failed, setFailed] = (0,
|
|
14205
|
+
const [failed, setFailed] = (0, import_react83.useState)(false);
|
|
14098
14206
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
14099
14207
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
14100
14208
|
}
|
|
@@ -14338,8 +14446,8 @@ function MysteryTigerGame({
|
|
|
14338
14446
|
onBack
|
|
14339
14447
|
}) {
|
|
14340
14448
|
const t = ui.games.mysteryTiger;
|
|
14341
|
-
const [query, setQuery] = (0,
|
|
14342
|
-
const inputId = (0,
|
|
14449
|
+
const [query, setQuery] = (0, import_react84.useState)("");
|
|
14450
|
+
const inputId = (0, import_react84.useId)();
|
|
14343
14451
|
const clientState = parseClientState(result?.clientStateJson);
|
|
14344
14452
|
const guessResults = clientState?.guessResults ?? [];
|
|
14345
14453
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -14600,13 +14708,13 @@ function HigherOrLowerGame({
|
|
|
14600
14708
|
}
|
|
14601
14709
|
|
|
14602
14710
|
// src/components/games/CareerPathGame.tsx
|
|
14603
|
-
var
|
|
14711
|
+
var import_react86 = require("react");
|
|
14604
14712
|
|
|
14605
14713
|
// src/components/games/ui/CrestShield.tsx
|
|
14606
|
-
var
|
|
14714
|
+
var import_react85 = require("react");
|
|
14607
14715
|
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
14608
14716
|
function CrestShield({ src, name, size = 28 }) {
|
|
14609
|
-
const [failed, setFailed] = (0,
|
|
14717
|
+
const [failed, setFailed] = (0, import_react85.useState)(false);
|
|
14610
14718
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
14611
14719
|
return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
14612
14720
|
}
|
|
@@ -14638,8 +14746,8 @@ function CareerPathGame({
|
|
|
14638
14746
|
}) {
|
|
14639
14747
|
const s = ui.games.careerPath;
|
|
14640
14748
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
14641
|
-
const [query, setQuery] = (0,
|
|
14642
|
-
const inputId = (0,
|
|
14749
|
+
const [query, setQuery] = (0, import_react86.useState)("");
|
|
14750
|
+
const inputId = (0, import_react86.useId)();
|
|
14643
14751
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
14644
14752
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
14645
14753
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -14745,7 +14853,7 @@ function CareerPathGame({
|
|
|
14745
14853
|
}
|
|
14746
14854
|
|
|
14747
14855
|
// src/components/games/BeatTheGridGame.tsx
|
|
14748
|
-
var
|
|
14856
|
+
var import_react87 = __toESM(require("react"), 1);
|
|
14749
14857
|
|
|
14750
14858
|
// src/components/games/ui/OptionList.tsx
|
|
14751
14859
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
@@ -14834,10 +14942,10 @@ function SearchSheet({
|
|
|
14834
14942
|
ui
|
|
14835
14943
|
}) {
|
|
14836
14944
|
const s = ui.games.beatTheGrid;
|
|
14837
|
-
const [query, setQuery] = (0,
|
|
14838
|
-
const inputId = (0,
|
|
14839
|
-
const inputRef = (0,
|
|
14840
|
-
(0,
|
|
14945
|
+
const [query, setQuery] = (0, import_react87.useState)("");
|
|
14946
|
+
const inputId = (0, import_react87.useId)();
|
|
14947
|
+
const inputRef = (0, import_react87.useRef)(null);
|
|
14948
|
+
(0, import_react87.useEffect)(() => {
|
|
14841
14949
|
inputRef.current?.focus();
|
|
14842
14950
|
}, [row, col]);
|
|
14843
14951
|
const filtered = playerPool.filter(
|
|
@@ -14902,7 +15010,7 @@ function BeatTheGridGame({
|
|
|
14902
15010
|
}) {
|
|
14903
15011
|
const s = ui.games.beatTheGrid;
|
|
14904
15012
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
14905
|
-
const [activeCell, setActiveCell] = (0,
|
|
15013
|
+
const [activeCell, setActiveCell] = (0, import_react87.useState)(null);
|
|
14906
15014
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
14907
15015
|
const filledCells = clientState?.cells ?? [];
|
|
14908
15016
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -14976,7 +15084,7 @@ function BeatTheGridGame({
|
|
|
14976
15084
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
14977
15085
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
14978
15086
|
] });
|
|
14979
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
15087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react87.default.Fragment, { children: [
|
|
14980
15088
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
14981
15089
|
cols.map((colLabel, colIdx) => {
|
|
14982
15090
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -15057,7 +15165,7 @@ function BeatTheGridGame({
|
|
|
15057
15165
|
}
|
|
15058
15166
|
|
|
15059
15167
|
// src/components/games/GuessTheXiGame.tsx
|
|
15060
|
-
var
|
|
15168
|
+
var import_react88 = require("react");
|
|
15061
15169
|
|
|
15062
15170
|
// src/components/games/ui/PitchSvg.tsx
|
|
15063
15171
|
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
@@ -15146,8 +15254,8 @@ function GuessTheXiGame({
|
|
|
15146
15254
|
onBack
|
|
15147
15255
|
}) {
|
|
15148
15256
|
const t = ui.games.guessTheXi;
|
|
15149
|
-
const [query, setQuery] = (0,
|
|
15150
|
-
const inputId = (0,
|
|
15257
|
+
const [query, setQuery] = (0, import_react88.useState)("");
|
|
15258
|
+
const inputId = (0, import_react88.useId)();
|
|
15151
15259
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
15152
15260
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
15153
15261
|
const solved = clientState?.status === "solved";
|
|
@@ -15289,7 +15397,7 @@ function GuessTheXiGame({
|
|
|
15289
15397
|
}
|
|
15290
15398
|
|
|
15291
15399
|
// src/components/games/DailyQuizGame.tsx
|
|
15292
|
-
var
|
|
15400
|
+
var import_react89 = require("react");
|
|
15293
15401
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
15294
15402
|
function parseClientState6(json) {
|
|
15295
15403
|
if (!json) return null;
|
|
@@ -15330,8 +15438,8 @@ function DailyQuizGame({
|
|
|
15330
15438
|
}) {
|
|
15331
15439
|
const s = ui.games.dailyQuiz;
|
|
15332
15440
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
15333
|
-
const [selections, setSelections] = (0,
|
|
15334
|
-
const [page, setPage] = (0,
|
|
15441
|
+
const [selections, setSelections] = (0, import_react89.useState)(/* @__PURE__ */ new Map());
|
|
15442
|
+
const [page, setPage] = (0, import_react89.useState)(0);
|
|
15335
15443
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
15336
15444
|
const results2 = clientState?.results ?? [];
|
|
15337
15445
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -15441,7 +15549,7 @@ function DailyQuizGame({
|
|
|
15441
15549
|
}
|
|
15442
15550
|
|
|
15443
15551
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
15444
|
-
var
|
|
15552
|
+
var import_react90 = require("react");
|
|
15445
15553
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
15446
15554
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
15447
15555
|
function parseClientState7(json) {
|
|
@@ -15537,12 +15645,12 @@ function MatchdayPredictorGame({
|
|
|
15537
15645
|
onBack
|
|
15538
15646
|
}) {
|
|
15539
15647
|
const t = ui.games.predictor;
|
|
15540
|
-
const [homeScore, setHomeScore] = (0,
|
|
15541
|
-
const [awayScore, setAwayScore] = (0,
|
|
15542
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
15543
|
-
const [lastEdited, setLastEdited] = (0,
|
|
15544
|
-
const [query, setQuery] = (0,
|
|
15545
|
-
const searchId = (0,
|
|
15648
|
+
const [homeScore, setHomeScore] = (0, import_react90.useState)(0);
|
|
15649
|
+
const [awayScore, setAwayScore] = (0, import_react90.useState)(0);
|
|
15650
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react90.useState)(null);
|
|
15651
|
+
const [lastEdited, setLastEdited] = (0, import_react90.useState)("home");
|
|
15652
|
+
const [query, setQuery] = (0, import_react90.useState)("");
|
|
15653
|
+
const searchId = (0, import_react90.useId)();
|
|
15546
15654
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
15547
15655
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15548
15656
|
const header = /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
@@ -15709,7 +15817,7 @@ function MatchdayPredictorGame({
|
|
|
15709
15817
|
}
|
|
15710
15818
|
|
|
15711
15819
|
// src/components/games/StartingXiGame.tsx
|
|
15712
|
-
var
|
|
15820
|
+
var import_react91 = require("react");
|
|
15713
15821
|
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
15714
15822
|
var POINTS_PER_STARTER = 8;
|
|
15715
15823
|
var XI_SIZE = 11;
|
|
@@ -15753,10 +15861,10 @@ function StartingXiGame({
|
|
|
15753
15861
|
lockAtUtc
|
|
15754
15862
|
}) {
|
|
15755
15863
|
const t = ui.games.startingXi;
|
|
15756
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
15757
|
-
const [active, setActive] = (0,
|
|
15758
|
-
const [query, setQuery] = (0,
|
|
15759
|
-
const searchId = (0,
|
|
15864
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react91.useState)(() => Array(XI_SIZE).fill(null));
|
|
15865
|
+
const [active, setActive] = (0, import_react91.useState)(0);
|
|
15866
|
+
const [query, setQuery] = (0, import_react91.useState)("");
|
|
15867
|
+
const searchId = (0, import_react91.useId)();
|
|
15760
15868
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
15761
15869
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
15762
15870
|
const header = /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
@@ -15895,7 +16003,7 @@ function StartingXiGame({
|
|
|
15895
16003
|
}
|
|
15896
16004
|
|
|
15897
16005
|
// src/components/games/StatLadderGame.tsx
|
|
15898
|
-
var
|
|
16006
|
+
var import_react92 = require("react");
|
|
15899
16007
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15900
16008
|
function ladderClue(ladder) {
|
|
15901
16009
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -15932,9 +16040,9 @@ function StatLadderGame({
|
|
|
15932
16040
|
onBack
|
|
15933
16041
|
}) {
|
|
15934
16042
|
const t = ui.games.statLadder;
|
|
15935
|
-
const [query, setQuery] = (0,
|
|
15936
|
-
const [selectedId, setSelectedId] = (0,
|
|
15937
|
-
const searchId = (0,
|
|
16043
|
+
const [query, setQuery] = (0, import_react92.useState)("");
|
|
16044
|
+
const [selectedId, setSelectedId] = (0, import_react92.useState)(null);
|
|
16045
|
+
const searchId = (0, import_react92.useId)();
|
|
15938
16046
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
15939
16047
|
const revealed = clientState != null;
|
|
15940
16048
|
const header = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -16140,8 +16248,8 @@ function GameScreenHost({
|
|
|
16140
16248
|
ui
|
|
16141
16249
|
}) {
|
|
16142
16250
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
16143
|
-
const [configJson, setConfigJson] = (0,
|
|
16144
|
-
(0,
|
|
16251
|
+
const [configJson, setConfigJson] = (0, import_react93.useState)(null);
|
|
16252
|
+
(0, import_react93.useEffect)(() => {
|
|
16145
16253
|
setConfigJson(null);
|
|
16146
16254
|
if (!conversation) return;
|
|
16147
16255
|
let cancelled = false;
|
|
@@ -16164,12 +16272,12 @@ function GameScreenHost({
|
|
|
16164
16272
|
fixtureId: fixtureId || void 0,
|
|
16165
16273
|
locale: ui.hostTag
|
|
16166
16274
|
});
|
|
16167
|
-
(0,
|
|
16275
|
+
(0, import_react93.useEffect)(() => {
|
|
16168
16276
|
if (conversation) hydrate();
|
|
16169
16277
|
}, [conversation, gameId]);
|
|
16170
|
-
const hydrateRef = (0,
|
|
16278
|
+
const hydrateRef = (0, import_react93.useRef)(hydrate);
|
|
16171
16279
|
hydrateRef.current = hydrate;
|
|
16172
|
-
(0,
|
|
16280
|
+
(0, import_react93.useEffect)(() => {
|
|
16173
16281
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
16174
16282
|
if (rawStatus !== "pending") return;
|
|
16175
16283
|
const timerId = setInterval(() => {
|
|
@@ -16282,7 +16390,7 @@ function GameScreenHost({
|
|
|
16282
16390
|
}
|
|
16283
16391
|
|
|
16284
16392
|
// src/components/Leaderboard.tsx
|
|
16285
|
-
var
|
|
16393
|
+
var import_react94 = require("react");
|
|
16286
16394
|
|
|
16287
16395
|
// src/components/LeaderboardRow.tsx
|
|
16288
16396
|
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
@@ -16369,7 +16477,7 @@ function Leaderboard({
|
|
|
16369
16477
|
ui,
|
|
16370
16478
|
onPlay
|
|
16371
16479
|
}) {
|
|
16372
|
-
const [segment, setSegment] = (0,
|
|
16480
|
+
const [segment, setSegment] = (0, import_react94.useState)("weekly");
|
|
16373
16481
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
16374
16482
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
16375
16483
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -16474,9 +16582,9 @@ function GamesPanel({
|
|
|
16474
16582
|
leaderboardLoading,
|
|
16475
16583
|
refreshHub
|
|
16476
16584
|
}) {
|
|
16477
|
-
const [selected, setSelected] = (0,
|
|
16478
|
-
const [segment, setSegment] = (0,
|
|
16479
|
-
(0,
|
|
16585
|
+
const [selected, setSelected] = (0, import_react95.useState)(null);
|
|
16586
|
+
const [segment, setSegment] = (0, import_react95.useState)("play");
|
|
16587
|
+
(0, import_react95.useEffect)(() => {
|
|
16480
16588
|
ensureGamesFonts();
|
|
16481
16589
|
}, []);
|
|
16482
16590
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(GamesLoginWall, { ui });
|
|
@@ -16540,10 +16648,10 @@ function GamesPanel({
|
|
|
16540
16648
|
}
|
|
16541
16649
|
|
|
16542
16650
|
// src/components/FavouritesPanel.tsx
|
|
16543
|
-
var
|
|
16651
|
+
var import_react98 = require("react");
|
|
16544
16652
|
|
|
16545
16653
|
// src/components/FavouriteChips.tsx
|
|
16546
|
-
var
|
|
16654
|
+
var import_react96 = require("react");
|
|
16547
16655
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16548
16656
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
16549
16657
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -16590,12 +16698,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
16590
16698
|
] });
|
|
16591
16699
|
}
|
|
16592
16700
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
16593
|
-
const [confirming, setConfirming] = (0,
|
|
16701
|
+
const [confirming, setConfirming] = (0, import_react96.useState)(false);
|
|
16594
16702
|
const data = controller.data;
|
|
16595
|
-
(0,
|
|
16703
|
+
(0, import_react96.useEffect)(() => {
|
|
16596
16704
|
setConfirming(false);
|
|
16597
16705
|
}, [sport]);
|
|
16598
|
-
(0,
|
|
16706
|
+
(0, import_react96.useEffect)(() => {
|
|
16599
16707
|
if (!confirming) return;
|
|
16600
16708
|
const onPointerDown = (e) => {
|
|
16601
16709
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -16649,21 +16757,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
16649
16757
|
}
|
|
16650
16758
|
|
|
16651
16759
|
// src/components/FavouritesSearch.tsx
|
|
16652
|
-
var
|
|
16760
|
+
var import_react97 = require("react");
|
|
16653
16761
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16654
16762
|
var MIN_LETTERS = 2;
|
|
16655
16763
|
var MAX_LENGTH = 64;
|
|
16656
16764
|
var DEBOUNCE_MS = 250;
|
|
16657
16765
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
16658
|
-
const [query, setQuery] = (0,
|
|
16659
|
-
const [answer, setAnswer] = (0,
|
|
16660
|
-
const controllerRef = (0,
|
|
16766
|
+
const [query, setQuery] = (0, import_react97.useState)("");
|
|
16767
|
+
const [answer, setAnswer] = (0, import_react97.useState)(null);
|
|
16768
|
+
const controllerRef = (0, import_react97.useRef)(controller);
|
|
16661
16769
|
controllerRef.current = controller;
|
|
16662
16770
|
const trimmed = query.trim();
|
|
16663
16771
|
const queryKey = `${sport}|${trimmed}`;
|
|
16664
16772
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
16665
16773
|
const settled = answer?.key === queryKey;
|
|
16666
|
-
(0,
|
|
16774
|
+
(0, import_react97.useEffect)(() => {
|
|
16667
16775
|
setAnswer(null);
|
|
16668
16776
|
if (trimmed.length < MIN_LETTERS) return;
|
|
16669
16777
|
let cancelled = false;
|
|
@@ -16726,13 +16834,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
16726
16834
|
// src/components/FavouritesPanel.tsx
|
|
16727
16835
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
16728
16836
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
16729
|
-
const [notice, setNotice] = (0,
|
|
16730
|
-
const refreshRef = (0,
|
|
16837
|
+
const [notice, setNotice] = (0, import_react98.useState)(null);
|
|
16838
|
+
const refreshRef = (0, import_react98.useRef)(controller.refresh);
|
|
16731
16839
|
refreshRef.current = controller.refresh;
|
|
16732
|
-
(0,
|
|
16840
|
+
(0, import_react98.useEffect)(() => {
|
|
16733
16841
|
void refreshRef.current();
|
|
16734
16842
|
}, []);
|
|
16735
|
-
(0,
|
|
16843
|
+
(0, import_react98.useEffect)(() => {
|
|
16736
16844
|
setNotice(null);
|
|
16737
16845
|
}, [sport]);
|
|
16738
16846
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -16758,7 +16866,7 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
16758
16866
|
}
|
|
16759
16867
|
|
|
16760
16868
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
16761
|
-
var
|
|
16869
|
+
var import_react99 = require("react");
|
|
16762
16870
|
var import_jsx_runtime138 = require("react/jsx-runtime");
|
|
16763
16871
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
16764
16872
|
var BASE_LEGS = [1, 2, 3, 4];
|
|
@@ -16784,8 +16892,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16784
16892
|
const opening = openingGames(preset);
|
|
16785
16893
|
const gamesOptions = opening.options;
|
|
16786
16894
|
const marketOptions = usableMarkets(preset);
|
|
16787
|
-
const [fingerprint] = (0,
|
|
16788
|
-
const [saved] = (0,
|
|
16895
|
+
const [fingerprint] = (0, import_react99.useState)(() => JSON.stringify(preset));
|
|
16896
|
+
const [saved] = (0, import_react99.useState)(() => {
|
|
16789
16897
|
const kept = memory3?.savedView(sport);
|
|
16790
16898
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
16791
16899
|
});
|
|
@@ -16799,9 +16907,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16799
16907
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
16800
16908
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
16801
16909
|
};
|
|
16802
|
-
const [view, setView] = (0,
|
|
16803
|
-
const autoWidened = (0,
|
|
16804
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
16910
|
+
const [view, setView] = (0, import_react99.useState)(() => saved?.view ?? openingView);
|
|
16911
|
+
const autoWidened = (0, import_react99.useRef)(false);
|
|
16912
|
+
const [widenedNote, setWidenedNote] = (0, import_react99.useState)(saved?.widenedNote ?? false);
|
|
16805
16913
|
const requestFor = (v) => ({
|
|
16806
16914
|
sport,
|
|
16807
16915
|
...v.marketKey !== null ? { marketKey: v.marketKey } : {},
|
|
@@ -16813,10 +16921,10 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16813
16921
|
...operatorUserId ? { operatorUserId } : {},
|
|
16814
16922
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
16815
16923
|
});
|
|
16816
|
-
const [first] = (0,
|
|
16924
|
+
const [first] = (0, import_react99.useState)(() => requestFor(view));
|
|
16817
16925
|
const { grid, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
16818
|
-
const lastRequest = (0,
|
|
16819
|
-
(0,
|
|
16926
|
+
const lastRequest = (0, import_react99.useRef)(first);
|
|
16927
|
+
(0, import_react99.useEffect)(() => {
|
|
16820
16928
|
void request(lastRequest.current);
|
|
16821
16929
|
}, [request]);
|
|
16822
16930
|
const send = (req) => {
|
|
@@ -16849,17 +16957,17 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16849
16957
|
const rows = ready && grid.status === "ok" ? legsOf(grid, sport) : null;
|
|
16850
16958
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
16851
16959
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
16852
|
-
const [startedNote, setStartedNote] = (0,
|
|
16960
|
+
const [startedNote, setStartedNote] = (0, import_react99.useState)(false);
|
|
16853
16961
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
16854
|
-
(0,
|
|
16962
|
+
(0, import_react99.useEffect)(() => {
|
|
16855
16963
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
16856
16964
|
}, [startedNote, status2, anyStarted]);
|
|
16857
16965
|
const market = rows?.[0]?.market;
|
|
16858
|
-
const [
|
|
16859
|
-
(0,
|
|
16966
|
+
const [seen2, setSeen] = (0, import_react99.useState)(null);
|
|
16967
|
+
(0, import_react99.useEffect)(() => {
|
|
16860
16968
|
if (market) setSeen(market);
|
|
16861
16969
|
}, [market]);
|
|
16862
|
-
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ??
|
|
16970
|
+
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
16863
16971
|
const paused = ready && grid.status === "paused";
|
|
16864
16972
|
const coolOff = status2 === "ready" && grid === null;
|
|
16865
16973
|
const empty2 = ready && (grid.status === "miss" || grid.status === "ok" && (rows === null || rows.length === 0));
|
|
@@ -16869,14 +16977,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16869
16977
|
const quotedAt = rows ? oldestQuote(rows) : null;
|
|
16870
16978
|
const combo = ready && grid.total !== null ? { sport, totalChosen: view.total, totalActual: grid.total } : void 0;
|
|
16871
16979
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
16872
|
-
(0,
|
|
16980
|
+
(0, import_react99.useEffect)(() => {
|
|
16873
16981
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
16874
16982
|
autoWidened.current = true;
|
|
16875
16983
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
16876
16984
|
commit(next, true);
|
|
16877
16985
|
send(requestFor(next));
|
|
16878
16986
|
}, [empty2, singles, widened, canWiden, view]);
|
|
16879
|
-
(0,
|
|
16987
|
+
(0, import_react99.useEffect)(() => {
|
|
16880
16988
|
if (coolOff) onCoolOff?.(sport);
|
|
16881
16989
|
}, [coolOff, onCoolOff, sport]);
|
|
16882
16990
|
if (coolOff) return null;
|
|
@@ -17279,10 +17387,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
17279
17387
|
}
|
|
17280
17388
|
|
|
17281
17389
|
// src/components/PlayerPhoto.tsx
|
|
17282
|
-
var
|
|
17390
|
+
var import_react100 = require("react");
|
|
17283
17391
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17284
17392
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
17285
|
-
const [failed, setFailed] = (0,
|
|
17393
|
+
const [failed, setFailed] = (0, import_react100.useState)(false);
|
|
17286
17394
|
const box = { width: size, height: size };
|
|
17287
17395
|
if (photoUrl && !failed) {
|
|
17288
17396
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -17317,7 +17425,7 @@ function MiniPitch({ positionCode }) {
|
|
|
17317
17425
|
}
|
|
17318
17426
|
|
|
17319
17427
|
// src/components/PerformanceBars.tsx
|
|
17320
|
-
var
|
|
17428
|
+
var import_react101 = require("react");
|
|
17321
17429
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17322
17430
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
17323
17431
|
function finite4(v) {
|
|
@@ -17363,7 +17471,7 @@ function unrankedLine(ui, reason) {
|
|
|
17363
17471
|
}
|
|
17364
17472
|
}
|
|
17365
17473
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
17366
|
-
const [mode, setMode] = (0,
|
|
17474
|
+
const [mode, setMode] = (0, import_react101.useState)("total");
|
|
17367
17475
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
17368
17476
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
17369
17477
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -17535,11 +17643,11 @@ function PlayerDetail({ detail, loading, ui, seasonName, onClose }) {
|
|
|
17535
17643
|
}
|
|
17536
17644
|
|
|
17537
17645
|
// src/components/PresetTools.tsx
|
|
17538
|
-
var
|
|
17646
|
+
var import_react102 = require("react");
|
|
17539
17647
|
var import_jsx_runtime148 = require("react/jsx-runtime");
|
|
17540
17648
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17541
17649
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17542
|
-
const titleId = (0,
|
|
17650
|
+
const titleId = (0, import_react102.useId)();
|
|
17543
17651
|
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17544
17652
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17545
17653
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17589,9 +17697,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17589
17697
|
const totalOptions = comboTotals(grid);
|
|
17590
17698
|
const totals = totalOptions.map((o) => o.value);
|
|
17591
17699
|
const legChoices = comboLegChoices(grid);
|
|
17592
|
-
const [total, setTotal] = (0,
|
|
17593
|
-
const [legs, setLegs] = (0,
|
|
17594
|
-
const [announcement, setAnnouncement] = (0,
|
|
17700
|
+
const [total, setTotal] = (0, import_react102.useState)(() => nearest(totals, initialTotal));
|
|
17701
|
+
const [legs, setLegs] = (0, import_react102.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17702
|
+
const [announcement, setAnnouncement] = (0, import_react102.useState)("");
|
|
17595
17703
|
const cell2 = findCombo(grid, total, legs);
|
|
17596
17704
|
const minLegs = legChoices[0] ?? legs;
|
|
17597
17705
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17661,8 +17769,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
17661
17769
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
17662
17770
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
17663
17771
|
function useIsModal() {
|
|
17664
|
-
const [modal, setModal] = (0,
|
|
17665
|
-
(0,
|
|
17772
|
+
const [modal, setModal] = (0, import_react103.useState)(false);
|
|
17773
|
+
(0, import_react103.useEffect)(() => {
|
|
17666
17774
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
17667
17775
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
17668
17776
|
const sync = () => setModal(mql.matches);
|
|
@@ -17674,14 +17782,14 @@ function useIsModal() {
|
|
|
17674
17782
|
}
|
|
17675
17783
|
var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden", display: "flex", flexDirection: "column" };
|
|
17676
17784
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
17677
|
-
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder }) {
|
|
17785
|
+
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
17678
17786
|
const { state, close, stop, send, reset } = controller;
|
|
17679
|
-
const [squadView, setSquadView] = (0,
|
|
17680
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
17787
|
+
const [squadView, setSquadView] = (0, import_react103.useState)("roster");
|
|
17788
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react103.useState)(null);
|
|
17681
17789
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
17682
17790
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
17683
|
-
const squadLayerRef = (0,
|
|
17684
|
-
const squadScrollRef = (0,
|
|
17791
|
+
const squadLayerRef = (0, import_react103.useRef)(null);
|
|
17792
|
+
const squadScrollRef = (0, import_react103.useRef)(null);
|
|
17685
17793
|
const selectPlayer = (playerId) => {
|
|
17686
17794
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
17687
17795
|
setSelectedPlayerId(playerId);
|
|
@@ -17691,7 +17799,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17691
17799
|
setSelectedPlayerId(null);
|
|
17692
17800
|
clearPlayerDetail?.();
|
|
17693
17801
|
};
|
|
17694
|
-
(0,
|
|
17802
|
+
(0, import_react103.useLayoutEffect)(() => {
|
|
17695
17803
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
17696
17804
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
17697
17805
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -17704,16 +17812,16 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17704
17812
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
17705
17813
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
17706
17814
|
const activeTab = tabs?.activeTab;
|
|
17707
|
-
(0,
|
|
17815
|
+
(0, import_react103.useEffect)(() => {
|
|
17708
17816
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
17709
17817
|
setSelectedPlayerId(null);
|
|
17710
17818
|
clearPlayerDetail?.();
|
|
17711
17819
|
}, [activeTab, selectedPlayerId, clearPlayerDetail]);
|
|
17712
|
-
(0,
|
|
17820
|
+
(0, import_react103.useEffect)(() => {
|
|
17713
17821
|
if (activeTab === "favourites" && !favouritesEnabled) setMonitorTab?.("chat");
|
|
17714
17822
|
}, [activeTab, favouritesEnabled, setMonitorTab]);
|
|
17715
17823
|
const storedTab = tabState?.activeTab;
|
|
17716
|
-
(0,
|
|
17824
|
+
(0, import_react103.useEffect)(() => {
|
|
17717
17825
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
17718
17826
|
if (unreachable) setMonitorTab?.("chat");
|
|
17719
17827
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -17722,11 +17830,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17722
17830
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
17723
17831
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
17724
17832
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
17725
|
-
const closeWith = (0,
|
|
17833
|
+
const closeWith = (0, import_react103.useCallback)((method) => {
|
|
17726
17834
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17835
|
+
if (onCloseRequested) onCloseRequested();
|
|
17836
|
+
else close();
|
|
17837
|
+
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
17838
|
+
(0, import_react103.useEffect)(() => {
|
|
17730
17839
|
const onKey = (e) => {
|
|
17731
17840
|
if (e.key === "Escape") closeWith("escape");
|
|
17732
17841
|
};
|
|
@@ -17742,68 +17851,93 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
17742
17851
|
tabs?.setActiveTab("chat");
|
|
17743
17852
|
send(text2, { grounding, source });
|
|
17744
17853
|
};
|
|
17745
|
-
(0,
|
|
17854
|
+
(0, import_react103.useEffect)(() => {
|
|
17746
17855
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
17747
17856
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
17748
17857
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
17749
|
-
const inputRef = (0,
|
|
17750
|
-
const limitRef = (0,
|
|
17751
|
-
const typedSendRef = (0,
|
|
17752
|
-
const focusAfterCloseRef = (0,
|
|
17753
|
-
const [tool, setTool] = (0,
|
|
17754
|
-
const panelRef = (0,
|
|
17858
|
+
const inputRef = (0, import_react103.useRef)(null);
|
|
17859
|
+
const limitRef = (0, import_react103.useRef)(null);
|
|
17860
|
+
const typedSendRef = (0, import_react103.useRef)(false);
|
|
17861
|
+
const focusAfterCloseRef = (0, import_react103.useRef)(null);
|
|
17862
|
+
const [tool, setTool] = (0, import_react103.useState)(null);
|
|
17863
|
+
const panelRef = (0, import_react103.useRef)(null);
|
|
17755
17864
|
const settings = useOddsSettings();
|
|
17756
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
17865
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react103.useState)(false);
|
|
17757
17866
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
17758
|
-
const openSettings = (0,
|
|
17867
|
+
const openSettings = (0, import_react103.useCallback)(() => {
|
|
17759
17868
|
setTool(null);
|
|
17760
17869
|
setSettingsOpen(true);
|
|
17761
17870
|
}, []);
|
|
17762
|
-
const closeSettings = (0,
|
|
17871
|
+
const closeSettings = (0, import_react103.useCallback)(() => {
|
|
17763
17872
|
setSettingsOpen(false);
|
|
17764
17873
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
17765
17874
|
}, []);
|
|
17766
17875
|
const paused = isPaused(state.limit);
|
|
17767
|
-
(0,
|
|
17876
|
+
(0, import_react103.useEffect)(() => {
|
|
17768
17877
|
if (paused) setTool(null);
|
|
17769
17878
|
}, [paused]);
|
|
17770
|
-
(0,
|
|
17879
|
+
(0, import_react103.useEffect)(() => {
|
|
17771
17880
|
if (!paused) return;
|
|
17772
17881
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
17773
17882
|
typedSendRef.current = false;
|
|
17774
17883
|
}, [paused]);
|
|
17775
|
-
const openTool = (0,
|
|
17884
|
+
const openTool = (0, import_react103.useCallback)((next) => {
|
|
17776
17885
|
setTool(next);
|
|
17777
17886
|
}, []);
|
|
17778
|
-
const toolsValue = (0,
|
|
17887
|
+
const toolsValue = (0, import_react103.useMemo)(
|
|
17779
17888
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
17780
17889
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
17781
17890
|
);
|
|
17782
|
-
const closeTool = (0,
|
|
17891
|
+
const closeTool = (0, import_react103.useCallback)(() => {
|
|
17783
17892
|
focusAfterCloseRef.current = "composer";
|
|
17784
17893
|
setTool(null);
|
|
17785
17894
|
}, []);
|
|
17786
|
-
const sendAsk = (0,
|
|
17895
|
+
const sendAsk = (0, import_react103.useCallback)((ask) => {
|
|
17787
17896
|
focusAfterCloseRef.current = "composer";
|
|
17788
17897
|
setTool(null);
|
|
17789
17898
|
tabs?.setActiveTab("chat");
|
|
17790
17899
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
17791
17900
|
}, [tabs, send]);
|
|
17792
|
-
const formatKickoff = (0,
|
|
17901
|
+
const formatKickoff = (0, import_react103.useCallback)((kickoffUtc) => {
|
|
17793
17902
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
17794
17903
|
return `${k.dayLabel} ${k.time}`;
|
|
17795
17904
|
}, [ui]);
|
|
17796
|
-
(0,
|
|
17905
|
+
(0, import_react103.useEffect)(() => {
|
|
17797
17906
|
if (tool) return;
|
|
17798
17907
|
const target = focusAfterCloseRef.current;
|
|
17799
17908
|
focusAfterCloseRef.current = null;
|
|
17800
17909
|
if (target === "composer") inputRef.current?.focus();
|
|
17801
17910
|
}, [tool]);
|
|
17802
|
-
(0,
|
|
17911
|
+
(0, import_react103.useEffect)(() => {
|
|
17803
17912
|
if (!tool || onChatTab && presetGrid) return;
|
|
17804
17913
|
focusAfterCloseRef.current = "composer";
|
|
17805
17914
|
setTool(null);
|
|
17806
17915
|
}, [tool, onChatTab, presetGrid]);
|
|
17916
|
+
const backRef = (0, import_react103.useRef)(() => false);
|
|
17917
|
+
backRef.current = () => {
|
|
17918
|
+
if (settingsOpen && hasSettings) {
|
|
17919
|
+
closeSettings();
|
|
17920
|
+
return true;
|
|
17921
|
+
}
|
|
17922
|
+
if (tool) {
|
|
17923
|
+
closeTool();
|
|
17924
|
+
return true;
|
|
17925
|
+
}
|
|
17926
|
+
if (selectedPlayerId !== null) {
|
|
17927
|
+
closePlayer();
|
|
17928
|
+
return true;
|
|
17929
|
+
}
|
|
17930
|
+
if (tabs && tabs.activeTab !== "chat") {
|
|
17931
|
+
tabs.setActiveTab("chat");
|
|
17932
|
+
return true;
|
|
17933
|
+
}
|
|
17934
|
+
return false;
|
|
17935
|
+
};
|
|
17936
|
+
(0, import_react103.useEffect)(() => {
|
|
17937
|
+
if (!onRegisterBack) return;
|
|
17938
|
+
onRegisterBack(() => backRef.current());
|
|
17939
|
+
return () => onRegisterBack(null);
|
|
17940
|
+
}, [onRegisterBack]);
|
|
17807
17941
|
return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { ref: panelRef, className: "ss-w-panel", role: "dialog", "aria-modal": isModal, "aria-label": ui.chatDialogLabel, children: [
|
|
17808
17942
|
/* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
|
|
17809
17943
|
ChatHeader,
|
|
@@ -18165,6 +18299,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
18165
18299
|
.ss-w-root[data-ss-w-pos="right"] .ss-w-panel,
|
|
18166
18300
|
.ss-w-root[data-ss-w-pos="left"] .ss-w-panel { inset: 0; width: auto; height: auto; border: none; border-radius: 0; }
|
|
18167
18301
|
}
|
|
18302
|
+
.ss-w-root[data-ss-w-mobile] .ss-w-panel { inset: 0; width: 100%; height: 100%; max-width: none; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
|
|
18168
18303
|
.ss-w-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--ss-w-line); }
|
|
18169
18304
|
.ss-w-header-mark { width: 18px; height: 18px; display: block; object-fit: contain; }
|
|
18170
18305
|
.ss-w-header-title { font-weight: 660; flex: 1; }
|
|
@@ -20751,12 +20886,12 @@ function injectStyles(root) {
|
|
|
20751
20886
|
function StatsWidget(props) {
|
|
20752
20887
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
20753
20888
|
const cfg = props.config;
|
|
20754
|
-
const built = (0,
|
|
20755
|
-
const trackingRef = (0,
|
|
20756
|
-
const track = (0,
|
|
20757
|
-
const eventTextRef = (0,
|
|
20889
|
+
const built = (0, import_react104.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
20890
|
+
const trackingRef = (0, import_react104.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
20891
|
+
const track = (0, import_react104.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
20892
|
+
const eventTextRef = (0, import_react104.useRef)(false);
|
|
20758
20893
|
eventTextRef.current = cfg?.eventText === true;
|
|
20759
|
-
const logger = (0,
|
|
20894
|
+
const logger = (0, import_react104.useMemo)(() => {
|
|
20760
20895
|
if (!built) return null;
|
|
20761
20896
|
const raw = built.client.createEventLogger({
|
|
20762
20897
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -20766,34 +20901,34 @@ function StatsWidget(props) {
|
|
|
20766
20901
|
}, [built?.client, track]);
|
|
20767
20902
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
20768
20903
|
const stringsPending = widgetStrings.strings === void 0;
|
|
20769
|
-
const ui = (0,
|
|
20904
|
+
const ui = (0, import_react104.useMemo)(
|
|
20770
20905
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
20771
20906
|
[props.config, widgetStrings.strings]
|
|
20772
20907
|
);
|
|
20773
20908
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
20774
|
-
const rootRef = (0,
|
|
20775
|
-
const introDoneRef = (0,
|
|
20776
|
-
const markIntroDone = (0,
|
|
20909
|
+
const rootRef = (0, import_react104.useRef)(null);
|
|
20910
|
+
const introDoneRef = (0, import_react104.useRef)(false);
|
|
20911
|
+
const markIntroDone = (0, import_react104.useCallback)(() => {
|
|
20777
20912
|
introDoneRef.current = true;
|
|
20778
20913
|
}, []);
|
|
20779
20914
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
20780
20915
|
const threadLanguage = familyOf(language);
|
|
20781
20916
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
20782
|
-
const sportScope = (0,
|
|
20917
|
+
const sportScope = (0, import_react104.useMemo)(
|
|
20783
20918
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
20784
20919
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
20785
20920
|
);
|
|
20786
|
-
const chatTracking = (0,
|
|
20921
|
+
const chatTracking = (0, import_react104.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
20787
20922
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
20788
20923
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
20789
|
-
const liveCardWatches = (0,
|
|
20790
|
-
const
|
|
20924
|
+
const liveCardWatches = (0, import_react104.useMemo)(() => {
|
|
20925
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
20791
20926
|
const out = [];
|
|
20792
20927
|
for (const msg of controller.state.messages) {
|
|
20793
20928
|
if (msg.role !== "assistant") continue;
|
|
20794
20929
|
for (const vm of msg.marketOdds) {
|
|
20795
|
-
if (vm.live == null ||
|
|
20796
|
-
|
|
20930
|
+
if (vm.live == null || seen2.has(vm.matchId)) continue;
|
|
20931
|
+
seen2.add(vm.matchId);
|
|
20797
20932
|
out.push({ key: `live:card:${vm.matchId}`, kind: "market", matchId: vm.matchId, marketDeveloperName: vm.marketDeveloperName ?? "FULLTIME_RESULT" });
|
|
20798
20933
|
}
|
|
20799
20934
|
}
|
|
@@ -20812,19 +20947,19 @@ function StatsWidget(props) {
|
|
|
20812
20947
|
});
|
|
20813
20948
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
20814
20949
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
20815
|
-
const getSchedule = (0,
|
|
20950
|
+
const getSchedule = (0, import_react104.useCallback)(
|
|
20816
20951
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
20817
20952
|
[built, operatorUserId, anonymousUserId]
|
|
20818
20953
|
);
|
|
20819
|
-
const getStates = (0,
|
|
20954
|
+
const getStates = (0, import_react104.useCallback)(
|
|
20820
20955
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
20821
20956
|
[built, requestTag]
|
|
20822
20957
|
);
|
|
20823
|
-
const getTennisPrices = (0,
|
|
20958
|
+
const getTennisPrices = (0, import_react104.useCallback)(
|
|
20824
20959
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
20825
20960
|
[built, requestTag]
|
|
20826
20961
|
);
|
|
20827
|
-
const pinnedMatchIds = (0,
|
|
20962
|
+
const pinnedMatchIds = (0, import_react104.useMemo)(
|
|
20828
20963
|
() => footballMatchPinIds(monitor.pins),
|
|
20829
20964
|
[monitor.pins]
|
|
20830
20965
|
);
|
|
@@ -20838,13 +20973,13 @@ function StatsWidget(props) {
|
|
|
20838
20973
|
pinnedMatchIds,
|
|
20839
20974
|
timeZone: ui.timeZone
|
|
20840
20975
|
});
|
|
20841
|
-
const offeredSports = (0,
|
|
20842
|
-
const
|
|
20843
|
-
for (const g of discovery.groups)
|
|
20844
|
-
return [...
|
|
20976
|
+
const offeredSports = (0, import_react104.useMemo)(() => {
|
|
20977
|
+
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
20978
|
+
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
20979
|
+
return [...seen2];
|
|
20845
20980
|
}, [discovery.matchDays, discovery.groups]);
|
|
20846
20981
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
20847
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
20982
|
+
const [liveLeague, setLiveLeague] = (0, import_react104.useState)(null);
|
|
20848
20983
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
20849
20984
|
const matchesLoaded = useMatchesDay({
|
|
20850
20985
|
discovery,
|
|
@@ -20854,8 +20989,8 @@ function StatsWidget(props) {
|
|
|
20854
20989
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20855
20990
|
timeZone: ui.timeZone
|
|
20856
20991
|
});
|
|
20857
|
-
const prevLiveSnapshotRef = (0,
|
|
20858
|
-
(0,
|
|
20992
|
+
const prevLiveSnapshotRef = (0, import_react104.useRef)(monitor.snapshot);
|
|
20993
|
+
(0, import_react104.useEffect)(() => {
|
|
20859
20994
|
const snap = monitor.snapshot;
|
|
20860
20995
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
20861
20996
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -20895,14 +21030,14 @@ function StatsWidget(props) {
|
|
|
20895
21030
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20896
21031
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
20897
21032
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
20898
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
20899
|
-
const latestGreeting = (0,
|
|
21033
|
+
const [favSportPick, setFavSportPick] = (0, import_react104.useState)(null);
|
|
21034
|
+
const latestGreeting = (0, import_react104.useMemo)(() => {
|
|
20900
21035
|
for (const m of [...controller.state.messages].reverse()) {
|
|
20901
21036
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
20902
21037
|
}
|
|
20903
21038
|
return null;
|
|
20904
21039
|
}, [controller.state.messages]);
|
|
20905
|
-
const favSportOptions = (0,
|
|
21040
|
+
const favSportOptions = (0, import_react104.useMemo)(
|
|
20906
21041
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
20907
21042
|
[latestGreeting]
|
|
20908
21043
|
);
|
|
@@ -20911,20 +21046,20 @@ function StatsWidget(props) {
|
|
|
20911
21046
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
20912
21047
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
20913
21048
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
20914
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
20915
|
-
const builderGreeting = (0,
|
|
21049
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react104.useState)(null);
|
|
21050
|
+
const builderGreeting = (0, import_react104.useMemo)(
|
|
20916
21051
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
20917
21052
|
[controller.state.messages]
|
|
20918
21053
|
);
|
|
20919
|
-
const [coolOff, setCoolOff] = (0,
|
|
20920
|
-
const onBuilderCoolOff = (0,
|
|
21054
|
+
const [coolOff, setCoolOff] = (0, import_react104.useState)(null);
|
|
21055
|
+
const onBuilderCoolOff = (0, import_react104.useCallback)((sport) => {
|
|
20921
21056
|
if (!builderGreeting) return;
|
|
20922
21057
|
setCoolOff((prev) => {
|
|
20923
21058
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
20924
21059
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
20925
21060
|
});
|
|
20926
21061
|
}, [builderGreeting]);
|
|
20927
|
-
const builderOptions = (0,
|
|
21062
|
+
const builderOptions = (0, import_react104.useMemo)(() => {
|
|
20928
21063
|
const greeting = builderGreeting;
|
|
20929
21064
|
if (!greeting) return [];
|
|
20930
21065
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -20937,7 +21072,7 @@ function StatsWidget(props) {
|
|
|
20937
21072
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
20938
21073
|
}, [builderGreeting, coolOff, ui]);
|
|
20939
21074
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
20940
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
21075
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react104.useState)(panelOpen);
|
|
20941
21076
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
20942
21077
|
const favourites = useFavourites({
|
|
20943
21078
|
conversation: built?.conversation ?? null,
|
|
@@ -20949,14 +21084,14 @@ function StatsWidget(props) {
|
|
|
20949
21084
|
onChanged: discovery.refreshSchedule
|
|
20950
21085
|
});
|
|
20951
21086
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
20952
|
-
const getPricePresets = (0,
|
|
21087
|
+
const getPricePresets = (0, import_react104.useCallback)(
|
|
20953
21088
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
20954
21089
|
[built]
|
|
20955
21090
|
);
|
|
20956
21091
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
20957
21092
|
const markLiveActivity = monitor.markLiveActivity;
|
|
20958
|
-
const prevLiveCountRef = (0,
|
|
20959
|
-
(0,
|
|
21093
|
+
const prevLiveCountRef = (0, import_react104.useRef)(0);
|
|
21094
|
+
(0, import_react104.useEffect)(() => {
|
|
20960
21095
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
20961
21096
|
prevLiveCountRef.current = discovery.liveCount;
|
|
20962
21097
|
if (rose) markLiveActivity();
|
|
@@ -20970,7 +21105,7 @@ function StatsWidget(props) {
|
|
|
20970
21105
|
closePanel: controller.close
|
|
20971
21106
|
});
|
|
20972
21107
|
const markAdded = hostEvents.markAdded;
|
|
20973
|
-
const slip = (0,
|
|
21108
|
+
const slip = (0, import_react104.useMemo)(
|
|
20974
21109
|
() => {
|
|
20975
21110
|
const handler = props.config?.onAddToSlip;
|
|
20976
21111
|
return {
|
|
@@ -20990,12 +21125,10 @@ function StatsWidget(props) {
|
|
|
20990
21125
|
},
|
|
20991
21126
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
20992
21127
|
);
|
|
20993
|
-
const onDashboardTap = (0,
|
|
21128
|
+
const onDashboardTap = (0, import_react104.useMemo)(
|
|
20994
21129
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
20995
21130
|
[built, logger]
|
|
20996
21131
|
);
|
|
20997
|
-
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup);
|
|
20998
|
-
useOpenTelemetry(logger, panelOpen);
|
|
20999
21132
|
const asks = bubbleAsks(controller.state.messages, ui.presets.standoutAsk, oddsSettings.oddsFormat).map((ask) => ({
|
|
21000
21133
|
label: ask.label,
|
|
21001
21134
|
onTap: () => runBubbleAsk(ask, {
|
|
@@ -21006,10 +21139,24 @@ function StatsWidget(props) {
|
|
|
21006
21139
|
log: logger
|
|
21007
21140
|
})
|
|
21008
21141
|
}));
|
|
21009
|
-
const
|
|
21142
|
+
const dismissPopupRef = (0, import_react104.useRef)(() => {
|
|
21143
|
+
});
|
|
21144
|
+
const mobile = useMobileBinding({
|
|
21145
|
+
binding: props.mobile,
|
|
21146
|
+
panelOpen,
|
|
21147
|
+
popupText: controller.state.popupText,
|
|
21148
|
+
asks,
|
|
21149
|
+
open: controller.open,
|
|
21150
|
+
close: controller.close,
|
|
21151
|
+
dismissPopup: () => dismissPopupRef.current()
|
|
21152
|
+
});
|
|
21153
|
+
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
21154
|
+
dismissPopupRef.current = dismissPopup;
|
|
21155
|
+
useOpenTelemetry(logger, panelOpen);
|
|
21156
|
+
const onControlRef = (0, import_react104.useRef)(props.onControl);
|
|
21010
21157
|
onControlRef.current = props.onControl;
|
|
21011
21158
|
const { open: openPanel, close: closePanel } = controller;
|
|
21012
|
-
(0,
|
|
21159
|
+
(0, import_react104.useEffect)(() => {
|
|
21013
21160
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
21014
21161
|
return () => onControlRef.current?.(null);
|
|
21015
21162
|
}, [openPanel, closePanel]);
|
|
@@ -21026,11 +21173,11 @@ function StatsWidget(props) {
|
|
|
21026
21173
|
page: cfg?.page
|
|
21027
21174
|
}
|
|
21028
21175
|
};
|
|
21029
|
-
(0,
|
|
21176
|
+
(0, import_react104.useEffect)(() => {
|
|
21030
21177
|
if (!logger) return;
|
|
21031
21178
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
21032
21179
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
21033
|
-
(0,
|
|
21180
|
+
(0, import_react104.useEffect)(() => {
|
|
21034
21181
|
if (!logger) return;
|
|
21035
21182
|
logger.resume();
|
|
21036
21183
|
const onHide = () => {
|
|
@@ -21048,15 +21195,15 @@ function StatsWidget(props) {
|
|
|
21048
21195
|
logger.dispose();
|
|
21049
21196
|
};
|
|
21050
21197
|
}, [logger]);
|
|
21051
|
-
(0,
|
|
21198
|
+
(0, import_react104.useEffect)(() => {
|
|
21052
21199
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
21053
21200
|
const node = rootRef.current?.getRootNode();
|
|
21054
21201
|
if (node) injectStyles(node);
|
|
21055
21202
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
21056
21203
|
const holds = useSessionHolds();
|
|
21057
21204
|
const builderConversation = built?.conversation ?? null;
|
|
21058
|
-
const builderMemory = (0,
|
|
21059
|
-
const personalGreeting = (0,
|
|
21205
|
+
const builderMemory = (0, import_react104.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
21206
|
+
const personalGreeting = (0, import_react104.useMemo)(() => ({
|
|
21060
21207
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
21061
21208
|
conversation: built?.conversation ?? null,
|
|
21062
21209
|
openFavourites: () => monitor.setActiveTab("favourites"),
|
|
@@ -21069,7 +21216,7 @@ function StatsWidget(props) {
|
|
|
21069
21216
|
}), [favouritesEnabled, monitor.enabled, clubFixturesResult.settled, clubFixturesResult.tabReady, clubFixturesResult.enabled, monitor.setActiveTab, favourites, built, holds, builderMemory]);
|
|
21070
21217
|
if (!built || widgetStrings.state === "unavailable") return null;
|
|
21071
21218
|
const attrs = themeAttrs(ui, oddsSettings.userTheme);
|
|
21072
|
-
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("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: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(EventLogContext.Provider, { value: logger, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(TrackingContext.Provider, { value: track, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(SportScopeContext.Provider, { value: sportScope, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OddsSettingsContext.Provider, { value: oddsSettings, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(HostEventsProvider, { value: hostEvents, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("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"], "data-ss-w-mobile": props.mobile ? "" : void 0, style: attrs.style, children: panelOpen ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PersonalGreetingContext.Provider, { value: personalGreeting, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21073
21220
|
ChatPanel,
|
|
21074
21221
|
{
|
|
21075
21222
|
controller,
|
|
@@ -21101,9 +21248,11 @@ function StatsWidget(props) {
|
|
|
21101
21248
|
presetGrid,
|
|
21102
21249
|
favouritesEnabled: favouritesEnabled && clubFixturesResult.tabReady && !clubFixturesResult.enabled,
|
|
21103
21250
|
favourites: { controller: favourites, sport: favSport, sports: favSports, onSportChange: setFavSportPick },
|
|
21104
|
-
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor }
|
|
21251
|
+
builder: { options: builderOptions, sport: builderSport, onSportChange: setBuilderSportPick, onCoolOff: onBuilderCoolOff, tabs: monitor },
|
|
21252
|
+
onCloseRequested: mobile.onCloseRequested,
|
|
21253
|
+
onRegisterBack: mobile.onRegisterBack
|
|
21105
21254
|
}
|
|
21106
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21255
|
+
) }) : props.mobile ? null : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
|
|
21107
21256
|
ChatFab,
|
|
21108
21257
|
{
|
|
21109
21258
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -21129,6 +21278,7 @@ function emptyConversation() {
|
|
|
21129
21278
|
0 && (module.exports = {
|
|
21130
21279
|
StatsWidget,
|
|
21131
21280
|
WIDGET_CSS,
|
|
21281
|
+
WIDGET_REACT_VERSION,
|
|
21132
21282
|
createWidgetHost
|
|
21133
21283
|
});
|
|
21134
21284
|
//# sourceMappingURL=index.cjs.map
|