@sensiblestats/widget-react 0.150.1 → 0.152.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/dist/index.cjs +453 -375
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +243 -165
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
40
40
|
// src/StatsWidget.tsx
|
|
41
|
-
var
|
|
41
|
+
var import_react123 = require("react");
|
|
42
42
|
var import_widget_sdk40 = require("@sensiblestats/widget-sdk");
|
|
43
43
|
|
|
44
44
|
// src/strings/tag.ts
|
|
@@ -1386,7 +1386,7 @@ function parseCustomTotal(text2, format2) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
|
|
1388
1388
|
// src/version.generated.ts
|
|
1389
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1389
|
+
var WIDGET_REACT_VERSION = "0.152.0";
|
|
1390
1390
|
|
|
1391
1391
|
// src/config.ts
|
|
1392
1392
|
function hostTag(cfg) {
|
|
@@ -6200,7 +6200,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
|
|
|
6200
6200
|
{
|
|
6201
6201
|
className: "ss-w-v8-card ss-w-v2-alt-row",
|
|
6202
6202
|
"data-match-id": r.matchId,
|
|
6203
|
-
"aria-label": ui.v2CardLabel(r.home, r.away, marketLabel),
|
|
6203
|
+
"aria-label": ui.v2CardLabel(r.home, r.away, r.marketLabel ?? marketLabel),
|
|
6204
6204
|
onClickCapture: logRowTap(events, slotBase + i),
|
|
6205
6205
|
children: [
|
|
6206
6206
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("header", { className: "ss-w-v8-card-head", children: [
|
|
@@ -6211,6 +6211,7 @@ function AlternativeRows({ rows, market, marketLabel, ui, slotBase, add }) {
|
|
|
6211
6211
|
] }),
|
|
6212
6212
|
sub ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-v8-card-sub", children: sub }) : null
|
|
6213
6213
|
] }),
|
|
6214
|
+
r.marketLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ss-w-v2-head", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ss-w-v2-market", children: r.marketLabel }) }) : null,
|
|
6214
6215
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PriceButtons, { selections: r.selections, ui, onAdd: add ? (s) => add(r.matchId, market, s) : void 0 }),
|
|
6215
6216
|
r.stat ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "ss-w-v2-stat", children: r.stat }) : null
|
|
6216
6217
|
]
|
|
@@ -6412,7 +6413,7 @@ function oldestQuote(legs) {
|
|
|
6412
6413
|
|
|
6413
6414
|
// src/components/dashboard/v2/useRepriceAdd.ts
|
|
6414
6415
|
var NO_SLIP = {};
|
|
6415
|
-
function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
6416
|
+
function useRepriceAdd({ conversation, locale, slip, ui, sport = "football" }) {
|
|
6416
6417
|
const scope = useSportScope();
|
|
6417
6418
|
const operatorUserId = scope?.operatorUserId;
|
|
6418
6419
|
const anonymousUserId = scope?.anonymousUserId;
|
|
@@ -6431,7 +6432,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6431
6432
|
if (!conversation || !slip) return { outcome: "failed" };
|
|
6432
6433
|
try {
|
|
6433
6434
|
const grid = await conversation.getBuilderGrid(locale, {
|
|
6434
|
-
sport
|
|
6435
|
+
sport,
|
|
6435
6436
|
matchIds: [matchId],
|
|
6436
6437
|
marketKey: market,
|
|
6437
6438
|
legs: 1,
|
|
@@ -6442,8 +6443,8 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6442
6443
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
6443
6444
|
});
|
|
6444
6445
|
if (grid === null) return { outcome: "cool_off" };
|
|
6445
|
-
if (grid.status !== "ok" || grid.legs.length !== 1) return { outcome: "gone" };
|
|
6446
|
-
const leg = legsOf(grid,
|
|
6446
|
+
if (grid.status !== "ok" || grid.sport !== sport || grid.legs.length !== 1) return { outcome: "gone" };
|
|
6447
|
+
const leg = legsOf(grid, sport)?.[0];
|
|
6447
6448
|
if (!leg) return { outcome: "gone" };
|
|
6448
6449
|
kickoffs.current.set(leg.matchId, leg.kickoffUtc);
|
|
6449
6450
|
const outcome = await addToSlip(comboLegToSlipSelection(leg, slip.conversationId), {
|
|
@@ -6457,7 +6458,7 @@ function useRepriceAdd({ conversation, locale, slip, ui }) {
|
|
|
6457
6458
|
} catch {
|
|
6458
6459
|
return { outcome: "failed" };
|
|
6459
6460
|
}
|
|
6460
|
-
}, [conversation, locale, slip, ui, addToSlip, operatorUserId, anonymousUserId]);
|
|
6461
|
+
}, [conversation, locale, slip, ui, sport, addToSlip, operatorUserId, anonymousUserId]);
|
|
6461
6462
|
return canAdd2 ? add : void 0;
|
|
6462
6463
|
}
|
|
6463
6464
|
|
|
@@ -6471,11 +6472,11 @@ var CHIP_LABEL = {
|
|
|
6471
6472
|
build_combo: (ui) => ui.v2ChipBuildCombo
|
|
6472
6473
|
};
|
|
6473
6474
|
var chipsFor = (section2) => section2.chips.filter((c) => Object.prototype.hasOwnProperty.call(CHIP_LABEL, c) && (!section2.coolOff || c === "live_games"));
|
|
6474
|
-
function MarketFirstGreeting({ section: section2, ui, slip, onAct }) {
|
|
6475
|
+
function MarketFirstGreeting({ section: section2, ui, slip, sport, onAct }) {
|
|
6475
6476
|
const log = useEventLog();
|
|
6476
6477
|
const personal = usePersonalGreeting();
|
|
6477
6478
|
const openTab = personal?.openTab;
|
|
6478
|
-
const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui });
|
|
6479
|
+
const add = useRepriceAdd({ conversation: personal?.conversation ?? null, locale: ui.hostTag, slip, ui, sport });
|
|
6479
6480
|
const [chosen, setChosen] = (0, import_react34.useState)(null);
|
|
6480
6481
|
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
6481
6482
|
const base = section2.coolOff ? void 0 : section2.featured;
|
|
@@ -8000,7 +8001,7 @@ function GreetingDashboard({ dashboard, dashboards, defaultSport, greeting, onTa
|
|
|
8000
8001
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-dash-title", children: shown2.title }),
|
|
8001
8002
|
shown2.subtitle && !shown2.marketFirst ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "ss-w-dash-subtitle", children: shown2.subtitle }) : null
|
|
8002
8003
|
] }),
|
|
8003
|
-
shown2.marketFirst ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8004
|
+
shown2.marketFirst ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MarketFirstGreeting, { section: shown2.marketFirst, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), onAct }, active?.sport ?? "") : personal && slip ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersonalGreeting, { personal, ui, slip, sport: active?.sport ?? (defaultSport || greeting?.sport || "football"), starsElsewhere, onAct }, active?.sport ?? "") : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ss-w-dash-grid", children: shown2.tiles.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8004
8005
|
DashboardTile,
|
|
8005
8006
|
{
|
|
8006
8007
|
tile: tileForFormat(t, oddsFormat),
|
|
@@ -8227,14 +8228,16 @@ function usePopupTelemetry(log, isOpen, popupText, dismissPopup, confirmedShown)
|
|
|
8227
8228
|
var import_react55 = require("react");
|
|
8228
8229
|
var CLEARED = { text: null, asks: [] };
|
|
8229
8230
|
function useMobileBinding(args) {
|
|
8230
|
-
const { binding, panelOpen, popupText, asks, cta } = args;
|
|
8231
|
+
const { binding, panelOpen, popupText, asks, cta, price } = args;
|
|
8231
8232
|
const latest = (0, import_react55.useRef)(args);
|
|
8232
8233
|
latest.current = args;
|
|
8233
8234
|
const bindingRef = (0, import_react55.useRef)(binding);
|
|
8234
8235
|
bindingRef.current = binding;
|
|
8235
8236
|
const backRef = (0, import_react55.useRef)(null);
|
|
8237
|
+
const priceRef = (0, import_react55.useRef)(null);
|
|
8238
|
+
const priceInFlight = (0, import_react55.useRef)(/* @__PURE__ */ new Set()).current;
|
|
8236
8239
|
const [confirmedShown, setConfirmedShown] = (0, import_react55.useState)(null);
|
|
8237
|
-
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta]);
|
|
8240
|
+
const teaserKey = panelOpen || !popupText ? "" : JSON.stringify([popupText, asks.map((a) => a.label), cta, price]);
|
|
8238
8241
|
const reported = (0, import_react55.useRef)({ binding: void 0, key: "" });
|
|
8239
8242
|
(0, import_react55.useEffect)(() => {
|
|
8240
8243
|
if (!binding) return;
|
|
@@ -8242,7 +8245,7 @@ function useMobileBinding(args) {
|
|
|
8242
8245
|
if (prev.binding === binding && prev.key === teaserKey) return;
|
|
8243
8246
|
reported.current = { binding, key: teaserKey };
|
|
8244
8247
|
if (teaserKey === "" && prev.binding !== binding) return;
|
|
8245
|
-
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {} });
|
|
8248
|
+
binding.onTeaser(teaserKey === "" ? CLEARED : { text: popupText, asks: asks.map((a, index) => ({ index, label: a.label })), ...cta ? { cta } : {}, ...price ? { price } : {} });
|
|
8246
8249
|
}, [binding, teaserKey]);
|
|
8247
8250
|
(0, import_react55.useEffect)(() => {
|
|
8248
8251
|
if (!binding) return;
|
|
@@ -8258,6 +8261,12 @@ function useMobileBinding(args) {
|
|
|
8258
8261
|
tapCta: () => {
|
|
8259
8262
|
if (latest.current.cta) latest.current.onCta();
|
|
8260
8263
|
},
|
|
8264
|
+
tapTeaser: () => latest.current.onTeaserTap(),
|
|
8265
|
+
tapPrice: (matchOddsId) => {
|
|
8266
|
+
const { panelOpen: open, popupText: text2, price: shown2 } = latest.current;
|
|
8267
|
+
if (open || !text2 || shown2?.matchOddsId !== matchOddsId) return;
|
|
8268
|
+
priceRef.current?.();
|
|
8269
|
+
},
|
|
8261
8270
|
dismissTeaser: () => latest.current.dismissPopup(),
|
|
8262
8271
|
teaserShown: () => setConfirmedShown(latest.current.popupText),
|
|
8263
8272
|
back: () => backRef.current?.() ?? false
|
|
@@ -8268,8 +8277,12 @@ function useMobileBinding(args) {
|
|
|
8268
8277
|
const onRegisterBack = (0, import_react55.useCallback)((fn) => {
|
|
8269
8278
|
backRef.current = fn;
|
|
8270
8279
|
}, []);
|
|
8271
|
-
|
|
8272
|
-
|
|
8280
|
+
const onRegisterPrice = (0, import_react55.useCallback)((fn) => {
|
|
8281
|
+
priceRef.current = fn;
|
|
8282
|
+
}, []);
|
|
8283
|
+
const onPriceResult = (0, import_react55.useCallback)((result) => bindingRef.current?.onPriceResult(result), []);
|
|
8284
|
+
if (!binding) return { confirmedShown: void 0, onCloseRequested: void 0, onRegisterBack: void 0, onRegisterPrice: void 0, onPriceResult: void 0, priceInFlight: void 0 };
|
|
8285
|
+
return { confirmedShown, onCloseRequested, onRegisterBack, onRegisterPrice, onPriceResult, priceInFlight };
|
|
8273
8286
|
}
|
|
8274
8287
|
|
|
8275
8288
|
// src/openTelemetry.ts
|
|
@@ -8362,20 +8375,53 @@ function ChatFab({ label, busy = false, greeting, popupText, logoUrl, onOpen, on
|
|
|
8362
8375
|
// src/components/BubblePrice.tsx
|
|
8363
8376
|
var import_react59 = require("react");
|
|
8364
8377
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8365
|
-
function BubblePrice({ matchId, price, conversation, slip, ui, hook }) {
|
|
8378
|
+
function BubblePrice({ matchId, price, conversation, slip, ui, hook, sport }) {
|
|
8366
8379
|
const selections = (0, import_react59.useMemo)(() => [price.selection], [price.selection]);
|
|
8367
|
-
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui });
|
|
8380
|
+
const add = useRepriceAdd({ conversation, locale: ui.hostTag, slip, ui, sport });
|
|
8368
8381
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ss-w-greeting-price", children: [
|
|
8369
8382
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ss-w-v2-market", children: price.marketLabel }),
|
|
8370
8383
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PriceButtons, { selections, ui, onAdd: add ? (s) => add(matchId, price.market, s, hook) : void 0 })
|
|
8371
8384
|
] });
|
|
8372
8385
|
}
|
|
8373
8386
|
|
|
8387
|
+
// src/components/MobileBubblePrice.tsx
|
|
8388
|
+
var import_react60 = require("react");
|
|
8389
|
+
function MobileBubblePrice(props) {
|
|
8390
|
+
const add = useRepriceAdd({ conversation: props.conversation, locale: props.ui.hostTag, slip: props.slip, ui: props.ui, sport: props.sport });
|
|
8391
|
+
const latest = (0, import_react60.useRef)({ props, add });
|
|
8392
|
+
latest.current = { props, add };
|
|
8393
|
+
const { onRegister, inFlight: inFlight2 } = props;
|
|
8394
|
+
(0, import_react60.useEffect)(() => {
|
|
8395
|
+
onRegister(() => {
|
|
8396
|
+
const { props: p, add: run } = latest.current;
|
|
8397
|
+
const id = p.price.selection.matchOddsId;
|
|
8398
|
+
if (inFlight2.has(id)) return;
|
|
8399
|
+
const report = (r) => {
|
|
8400
|
+
const now = latest.current.props;
|
|
8401
|
+
try {
|
|
8402
|
+
now.onResult({ matchOddsId: id, outcome: r.outcome, text: r.toast?.text ?? (r.outcome === "gone" ? now.ui.v2PriceGone : null) });
|
|
8403
|
+
} catch {
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
if (!run) {
|
|
8407
|
+
report({ outcome: "failed" });
|
|
8408
|
+
return;
|
|
8409
|
+
}
|
|
8410
|
+
inFlight2.add(id);
|
|
8411
|
+
run(p.matchId, p.price.market, p.price.selection, p.hook).then(report, () => report({ outcome: "failed" })).finally(() => {
|
|
8412
|
+
inFlight2.delete(id);
|
|
8413
|
+
});
|
|
8414
|
+
});
|
|
8415
|
+
return () => onRegister(null);
|
|
8416
|
+
}, [onRegister, inFlight2]);
|
|
8417
|
+
return null;
|
|
8418
|
+
}
|
|
8419
|
+
|
|
8374
8420
|
// src/components/ChatPanel.tsx
|
|
8375
|
-
var
|
|
8421
|
+
var import_react122 = require("react");
|
|
8376
8422
|
|
|
8377
8423
|
// src/components/ChatHeader.tsx
|
|
8378
|
-
var
|
|
8424
|
+
var import_react61 = require("react");
|
|
8379
8425
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8380
8426
|
function ChatHeader({
|
|
8381
8427
|
onClose,
|
|
@@ -8391,18 +8437,18 @@ function ChatHeader({
|
|
|
8391
8437
|
onOpenFavourites,
|
|
8392
8438
|
favouritesLabel
|
|
8393
8439
|
}) {
|
|
8394
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
8395
|
-
const wrapRef = (0,
|
|
8396
|
-
const kebabRef = (0,
|
|
8397
|
-
const firstItemRef = (0,
|
|
8440
|
+
const [menuOpen, setMenuOpen] = (0, import_react61.useState)(false);
|
|
8441
|
+
const wrapRef = (0, import_react61.useRef)(null);
|
|
8442
|
+
const kebabRef = (0, import_react61.useRef)(null);
|
|
8443
|
+
const firstItemRef = (0, import_react61.useRef)(null);
|
|
8398
8444
|
const hasNew = !!(canReset && onNewConversation);
|
|
8399
8445
|
const hasSettings = !!onOpenSettings;
|
|
8400
8446
|
const hasFavourites = !!onOpenFavourites;
|
|
8401
8447
|
const hasMenu = hasFavourites || hasNew || hasSettings;
|
|
8402
|
-
(0,
|
|
8448
|
+
(0, import_react61.useEffect)(() => {
|
|
8403
8449
|
if (menuOpen) firstItemRef.current?.focus();
|
|
8404
8450
|
}, [menuOpen]);
|
|
8405
|
-
(0,
|
|
8451
|
+
(0, import_react61.useEffect)(() => {
|
|
8406
8452
|
if (!menuOpen) return;
|
|
8407
8453
|
const onPointer = (e) => {
|
|
8408
8454
|
if (!(wrapRef.current && e.composedPath().includes(wrapRef.current))) setMenuOpen(false);
|
|
@@ -8490,10 +8536,10 @@ function ChatHeader({
|
|
|
8490
8536
|
}
|
|
8491
8537
|
|
|
8492
8538
|
// src/components/MessageList.tsx
|
|
8493
|
-
var
|
|
8539
|
+
var import_react76 = require("react");
|
|
8494
8540
|
|
|
8495
8541
|
// src/components/ChatMessage.tsx
|
|
8496
|
-
var
|
|
8542
|
+
var import_react75 = require("react");
|
|
8497
8543
|
|
|
8498
8544
|
// src/components/Markdown.tsx
|
|
8499
8545
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
@@ -8511,7 +8557,7 @@ function Markdown({ text: text2 }) {
|
|
|
8511
8557
|
}
|
|
8512
8558
|
|
|
8513
8559
|
// src/components/EntityCardList.tsx
|
|
8514
|
-
var
|
|
8560
|
+
var import_react62 = require("react");
|
|
8515
8561
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8516
8562
|
var MAX_VISIBLE = 3;
|
|
8517
8563
|
var RECORD_RE = /^(\d+)-(\d+)-(\d+)$/;
|
|
@@ -8614,7 +8660,7 @@ function ScopeTabs({ scopes, active, onSelect }) {
|
|
|
8614
8660
|
)) });
|
|
8615
8661
|
}
|
|
8616
8662
|
function EntityCardItem({ c }) {
|
|
8617
|
-
const [active, setActive] = (0,
|
|
8663
|
+
const [active, setActive] = (0, import_react62.useState)(0);
|
|
8618
8664
|
const hasBody = c.scopes.length > 0;
|
|
8619
8665
|
if (!hasBody) {
|
|
8620
8666
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ss-w-ecard ss-w-ecard-bare", "data-kind": c.kind, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CardHeader, { c, showScopeCrest: false }) });
|
|
@@ -8629,7 +8675,7 @@ function EntityCardItem({ c }) {
|
|
|
8629
8675
|
] });
|
|
8630
8676
|
}
|
|
8631
8677
|
function EntityCardList({ cards, disabled, showLessLabel, showMoreLabel }) {
|
|
8632
|
-
const [expanded, setExpanded] = (0,
|
|
8678
|
+
const [expanded, setExpanded] = (0, import_react62.useState)(false);
|
|
8633
8679
|
if (cards.length === 0) return null;
|
|
8634
8680
|
const visible = expanded ? cards : cards.slice(0, MAX_VISIBLE);
|
|
8635
8681
|
const overflow = cards.length - MAX_VISIBLE;
|
|
@@ -8778,20 +8824,20 @@ function BettingInsightList({ insights, ui, slip, monitor }) {
|
|
|
8778
8824
|
}
|
|
8779
8825
|
|
|
8780
8826
|
// src/components/ComboCardList.tsx
|
|
8781
|
-
var
|
|
8827
|
+
var import_react65 = require("react");
|
|
8782
8828
|
|
|
8783
8829
|
// src/components/AddAllToSlipButton.tsx
|
|
8784
|
-
var
|
|
8830
|
+
var import_react63 = require("react");
|
|
8785
8831
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
8786
8832
|
function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless, hold, onStartedGame }) {
|
|
8787
8833
|
const add = useSlipAdd(slip, ui);
|
|
8788
8834
|
const slipState = useSlipState();
|
|
8789
8835
|
const log = useEventLog();
|
|
8790
8836
|
const track = useTrack();
|
|
8791
|
-
const [pending, setPending] = (0,
|
|
8792
|
-
const [settledLocal, setSettledLocal] = (0,
|
|
8793
|
-
const [toast, setToast] = (0,
|
|
8794
|
-
const dismiss = (0,
|
|
8837
|
+
const [pending, setPending] = (0, import_react63.useState)(false);
|
|
8838
|
+
const [settledLocal, setSettledLocal] = (0, import_react63.useState)({});
|
|
8839
|
+
const [toast, setToast] = (0, import_react63.useState)(null);
|
|
8840
|
+
const dismiss = (0, import_react63.useCallback)(() => setToast(null), []);
|
|
8795
8841
|
if (!slip.onAddToSlip || legs.length < 2) return null;
|
|
8796
8842
|
const settled = slipState ? slipState.settled : settledLocal;
|
|
8797
8843
|
const open = legs.filter((leg) => !settled[slipKey(leg)]);
|
|
@@ -8864,10 +8910,10 @@ function AddAllToSlipButton({ legs, slip, ui, labels, combo, chatCombo, sizeless
|
|
|
8864
8910
|
}
|
|
8865
8911
|
|
|
8866
8912
|
// src/presetToolsContext.ts
|
|
8867
|
-
var
|
|
8868
|
-
var PresetToolsContext = (0,
|
|
8913
|
+
var import_react64 = require("react");
|
|
8914
|
+
var PresetToolsContext = (0, import_react64.createContext)(null);
|
|
8869
8915
|
function usePresetTools() {
|
|
8870
|
-
return (0,
|
|
8916
|
+
return (0, import_react64.useContext)(PresetToolsContext);
|
|
8871
8917
|
}
|
|
8872
8918
|
|
|
8873
8919
|
// src/components/ComboCardList.tsx
|
|
@@ -8881,7 +8927,7 @@ function ComboLegRow({ leg, addToSlipEnabled, ui, slip, monitor, hold, closed, s
|
|
|
8881
8927
|
const showPin = !!monitor && leg.pinEnabled;
|
|
8882
8928
|
const factText = leg.fact ? (leg.fact.direction === "over" ? ui.presets.legFactOver : ui.presets.legFactUnder)(leg.fact.hits, leg.fact.games) : void 0;
|
|
8883
8929
|
const line = leg.statText ?? factText;
|
|
8884
|
-
const noteId = (0,
|
|
8930
|
+
const noteId = (0, import_react65.useId)();
|
|
8885
8931
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("li", { className: "ss-w-combo-leg", children: [
|
|
8886
8932
|
leg.competition || kickoff || showPin ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "ss-w-combo-leg-meta", children: [
|
|
8887
8933
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "ss-w-bi-comp", children: leg.competition ?? "" }),
|
|
@@ -9505,7 +9551,7 @@ function NbaInsightList({ insights, ui, slip, monitor }) {
|
|
|
9505
9551
|
}
|
|
9506
9552
|
|
|
9507
9553
|
// src/components/NflInsightList.tsx
|
|
9508
|
-
var
|
|
9554
|
+
var import_react66 = require("react");
|
|
9509
9555
|
|
|
9510
9556
|
// src/strings/types.ts
|
|
9511
9557
|
var fillNfl = (template, values) => template.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
|
|
@@ -9522,7 +9568,7 @@ function teamImage(vm, abbr) {
|
|
|
9522
9568
|
return void 0;
|
|
9523
9569
|
}
|
|
9524
9570
|
function Badge({ abbr, url }) {
|
|
9525
|
-
const [failed, setFailed] = (0,
|
|
9571
|
+
const [failed, setFailed] = (0, import_react66.useState)(false);
|
|
9526
9572
|
if (url && !failed) {
|
|
9527
9573
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { className: "ss-w-nfl-badge ss-w-nfl-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
9528
9574
|
}
|
|
@@ -10133,7 +10179,7 @@ function TennisInsightList({ insights, ui }) {
|
|
|
10133
10179
|
}
|
|
10134
10180
|
|
|
10135
10181
|
// src/components/CompactOddsList.tsx
|
|
10136
|
-
var
|
|
10182
|
+
var import_react67 = require("react");
|
|
10137
10183
|
var import_widget_sdk24 = require("@sensiblestats/widget-sdk");
|
|
10138
10184
|
|
|
10139
10185
|
// src/compactList.ts
|
|
@@ -10255,11 +10301,11 @@ function Row2({ row, columns, ui, slip, monitor, rowRef }) {
|
|
|
10255
10301
|
] });
|
|
10256
10302
|
}
|
|
10257
10303
|
function CompactOddsList({ list, ui, slip, monitor }) {
|
|
10258
|
-
const [shown2, setShown] = (0,
|
|
10304
|
+
const [shown2, setShown] = (0, import_react67.useState)(COMPACT_PAGE);
|
|
10259
10305
|
const hidden = list.rowCount - shown2;
|
|
10260
|
-
const [focusIndex, setFocusIndex] = (0,
|
|
10261
|
-
const focusRef = (0,
|
|
10262
|
-
(0,
|
|
10306
|
+
const [focusIndex, setFocusIndex] = (0, import_react67.useState)(null);
|
|
10307
|
+
const focusRef = (0, import_react67.useRef)(null);
|
|
10308
|
+
(0, import_react67.useEffect)(() => {
|
|
10263
10309
|
if (focusIndex !== null) focusRef.current?.focus();
|
|
10264
10310
|
}, [focusIndex]);
|
|
10265
10311
|
let left = shown2;
|
|
@@ -10494,7 +10540,7 @@ function FixtureCard({ card, ui }) {
|
|
|
10494
10540
|
}
|
|
10495
10541
|
|
|
10496
10542
|
// src/components/dashboard/CountdownCard.tsx
|
|
10497
|
-
var
|
|
10543
|
+
var import_react68 = require("react");
|
|
10498
10544
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10499
10545
|
var DAY_MS3 = 864e5;
|
|
10500
10546
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
@@ -10513,12 +10559,12 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
10513
10559
|
function CountdownCard({ card, ui }) {
|
|
10514
10560
|
const { data } = card;
|
|
10515
10561
|
const unitLabel = { d: data.daysUnit, h: data.hoursUnit, m: data.minutesUnit, s: data.secondsUnit };
|
|
10516
|
-
const [nowMs, setNowMs] = (0,
|
|
10517
|
-
const [reduced] = (0,
|
|
10562
|
+
const [nowMs, setNowMs] = (0, import_react68.useState)(() => Date.now());
|
|
10563
|
+
const [reduced] = (0, import_react68.useState)(
|
|
10518
10564
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
10519
10565
|
);
|
|
10520
10566
|
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
10521
|
-
(0,
|
|
10567
|
+
(0, import_react68.useEffect)(() => {
|
|
10522
10568
|
if (reduced) return;
|
|
10523
10569
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
10524
10570
|
return () => window.clearInterval(id);
|
|
@@ -10526,7 +10572,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10526
10572
|
const segments = remainingSegments(data.kickoffUnix, nowMs, withinDay && !reduced);
|
|
10527
10573
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ss-w-fandash-card ss-w-fandash-countdown", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ss-w-fandash-countdown-top", children: [
|
|
10528
10574
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-eyebrow", children: card.title ?? ui.countdownTitle }),
|
|
10529
|
-
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
10575
|
+
segments ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-clock", children: segments.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react68.Fragment, { children: [
|
|
10530
10576
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-colon", children: ":" }) : null,
|
|
10531
10577
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: "ss-w-fandash-countdown-seg", children: [
|
|
10532
10578
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ss-w-fandash-countdown-value", children: s.value }),
|
|
@@ -10537,7 +10583,7 @@ function CountdownCard({ card, ui }) {
|
|
|
10537
10583
|
}
|
|
10538
10584
|
|
|
10539
10585
|
// src/components/dashboard/InjuriesCard.tsx
|
|
10540
|
-
var
|
|
10586
|
+
var import_react69 = require("react");
|
|
10541
10587
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10542
10588
|
var SHOWN = 3;
|
|
10543
10589
|
function ColHead({ name, crestUrl }) {
|
|
@@ -10560,7 +10606,7 @@ function InjuryList({ rows, emptyLabel, limit }) {
|
|
|
10560
10606
|
}
|
|
10561
10607
|
function InjuriesCard({ card, ui }) {
|
|
10562
10608
|
const { data } = card;
|
|
10563
|
-
const [expanded, setExpanded] = (0,
|
|
10609
|
+
const [expanded, setExpanded] = (0, import_react69.useState)(false);
|
|
10564
10610
|
const hidden = Math.max(0, data.ours.length - SHOWN) + Math.max(0, data.theirs.length - SHOWN);
|
|
10565
10611
|
const limit = expanded ? void 0 : SHOWN;
|
|
10566
10612
|
const { showMore, showLess } = ui;
|
|
@@ -10665,7 +10711,7 @@ function LinksCard({ card }) {
|
|
|
10665
10711
|
}
|
|
10666
10712
|
|
|
10667
10713
|
// src/components/dashboard/PostMatchResultCard.tsx
|
|
10668
|
-
var
|
|
10714
|
+
var import_react70 = require("react");
|
|
10669
10715
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10670
10716
|
function initials3(name) {
|
|
10671
10717
|
return name.trim().slice(0, 3).toUpperCase();
|
|
@@ -10675,7 +10721,7 @@ function PostMatchCrest({
|
|
|
10675
10721
|
name,
|
|
10676
10722
|
side
|
|
10677
10723
|
}) {
|
|
10678
|
-
const [failed, setFailed] = (0,
|
|
10724
|
+
const [failed, setFailed] = (0, import_react70.useState)(false);
|
|
10679
10725
|
const cls = `ss-w-fandash-postmatch-crest ss-w-fandash-postmatch-crest--${side}`;
|
|
10680
10726
|
if (url && !failed) {
|
|
10681
10727
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10874,10 +10920,10 @@ function RestingFormCard({ card }) {
|
|
|
10874
10920
|
}
|
|
10875
10921
|
|
|
10876
10922
|
// src/components/dashboard/LiveScoreCard.tsx
|
|
10877
|
-
var
|
|
10923
|
+
var import_react72 = require("react");
|
|
10878
10924
|
|
|
10879
10925
|
// src/useLiveClock.ts
|
|
10880
|
-
var
|
|
10926
|
+
var import_react71 = require("react");
|
|
10881
10927
|
var TICK_MS = 6e4;
|
|
10882
10928
|
var MAX_LIVE_TICK_MINUTES = 15;
|
|
10883
10929
|
function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
@@ -10886,10 +10932,10 @@ function computeDisplayMinute(minute, clockRunning, receivedAtMs) {
|
|
|
10886
10932
|
return minute + Math.min(Math.max(0, elapsedMinutes), MAX_LIVE_TICK_MINUTES);
|
|
10887
10933
|
}
|
|
10888
10934
|
function useLiveClock(minute, clockRunning, receivedAtMs) {
|
|
10889
|
-
const [displayMinute, setDisplayMinute] = (0,
|
|
10935
|
+
const [displayMinute, setDisplayMinute] = (0, import_react71.useState)(
|
|
10890
10936
|
() => computeDisplayMinute(minute, clockRunning, receivedAtMs)
|
|
10891
10937
|
);
|
|
10892
|
-
(0,
|
|
10938
|
+
(0, import_react71.useEffect)(() => {
|
|
10893
10939
|
setDisplayMinute(computeDisplayMinute(minute, clockRunning, receivedAtMs));
|
|
10894
10940
|
if (!clockRunning) return;
|
|
10895
10941
|
const id = window.setInterval(() => {
|
|
@@ -10906,7 +10952,7 @@ function initials5(name) {
|
|
|
10906
10952
|
return name.trim().slice(0, 3).toUpperCase();
|
|
10907
10953
|
}
|
|
10908
10954
|
function LiveCrest({ url, name, side }) {
|
|
10909
|
-
const [failed, setFailed] = (0,
|
|
10955
|
+
const [failed, setFailed] = (0, import_react72.useState)(false);
|
|
10910
10956
|
const cls = `ss-w-fandash-live-crest ss-w-fandash-live-crest--${side}`;
|
|
10911
10957
|
if (url && !failed) {
|
|
10912
10958
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { className: cls, src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -10928,7 +10974,7 @@ function LiveScoreCard({
|
|
|
10928
10974
|
}) {
|
|
10929
10975
|
const { data } = card;
|
|
10930
10976
|
const seedKey = `${data.minute}:${data.homeScore}:${data.awayScore}`;
|
|
10931
|
-
const seedRef = (0,
|
|
10977
|
+
const seedRef = (0, import_react72.useRef)(null);
|
|
10932
10978
|
if (!seedRef.current || seedRef.current.key !== seedKey) {
|
|
10933
10979
|
seedRef.current = { key: seedKey, receivedAtMs: Date.now() };
|
|
10934
10980
|
}
|
|
@@ -10974,7 +11020,7 @@ function LiveScoreCard({
|
|
|
10974
11020
|
}
|
|
10975
11021
|
|
|
10976
11022
|
// src/components/dashboard/LiveTimelineCard.tsx
|
|
10977
|
-
var
|
|
11023
|
+
var import_react73 = require("react");
|
|
10978
11024
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
10979
11025
|
var SHOWN2 = 3;
|
|
10980
11026
|
function EventIcon({ type }) {
|
|
@@ -11016,7 +11062,7 @@ function EventRow({ e }) {
|
|
|
11016
11062
|
] });
|
|
11017
11063
|
}
|
|
11018
11064
|
function LiveTimelineCard({ card, ui }) {
|
|
11019
|
-
const [expanded, setExpanded] = (0,
|
|
11065
|
+
const [expanded, setExpanded] = (0, import_react73.useState)(false);
|
|
11020
11066
|
const events = card.data.events;
|
|
11021
11067
|
if (!events || events.length === 0) return null;
|
|
11022
11068
|
const sorted2 = [...events].sort((a, b) => b.minute - a.minute);
|
|
@@ -11040,7 +11086,7 @@ function LiveTimelineCard({ card, ui }) {
|
|
|
11040
11086
|
}
|
|
11041
11087
|
|
|
11042
11088
|
// src/components/dashboard/MomentumWave.tsx
|
|
11043
|
-
var
|
|
11089
|
+
var import_react74 = require("react");
|
|
11044
11090
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
11045
11091
|
var WIDTH = 270;
|
|
11046
11092
|
var HEIGHT = 56;
|
|
@@ -11065,7 +11111,7 @@ function MomentumWave({
|
|
|
11065
11111
|
}) {
|
|
11066
11112
|
if (points.length === 0) return null;
|
|
11067
11113
|
const { area, line, lastLeftPct, lastTopPx } = buildPaths(points);
|
|
11068
|
-
const clipId = (0,
|
|
11114
|
+
const clipId = (0, import_react74.useId)();
|
|
11069
11115
|
const topClipId = `${clipId}-top`;
|
|
11070
11116
|
const bottomClipId = `${clipId}-bottom`;
|
|
11071
11117
|
const topClass = clubIsHome ? "ss-w-fandash-live-mom-home" : "ss-w-fandash-live-mom-away";
|
|
@@ -11215,7 +11261,7 @@ function FanDashboardCard({ card, onTap, ui, goalEvents }) {
|
|
|
11215
11261
|
// src/components/ChatMessage.tsx
|
|
11216
11262
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11217
11263
|
function ChatMessage({ message, disabled, onAct, onTap, ui, slip, monitor, onGreetingSport }) {
|
|
11218
|
-
const [sport, setSport] = (0,
|
|
11264
|
+
const [sport, setSport] = (0, import_react75.useState)(null);
|
|
11219
11265
|
if (message.role === "user") {
|
|
11220
11266
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-msg ss-w-user", "data-msg-id": message.id, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ss-w-bubble", children: message.text }) });
|
|
11221
11267
|
}
|
|
@@ -11270,11 +11316,11 @@ function turnAnchor(messages) {
|
|
|
11270
11316
|
function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreetingSport }) {
|
|
11271
11317
|
const { state, send } = controller;
|
|
11272
11318
|
const { oddsFormat } = useOddsSettings();
|
|
11273
|
-
const listRef = (0,
|
|
11274
|
-
const endRef = (0,
|
|
11275
|
-
const pinnedRef = (0,
|
|
11276
|
-
const anchoredTurnRef = (0,
|
|
11277
|
-
(0,
|
|
11319
|
+
const listRef = (0, import_react76.useRef)(null);
|
|
11320
|
+
const endRef = (0, import_react76.useRef)(null);
|
|
11321
|
+
const pinnedRef = (0, import_react76.useRef)(true);
|
|
11322
|
+
const anchoredTurnRef = (0, import_react76.useRef)(null);
|
|
11323
|
+
(0, import_react76.useEffect)(() => {
|
|
11278
11324
|
const anchor = turnAnchor(state.messages);
|
|
11279
11325
|
const list = listRef.current;
|
|
11280
11326
|
if (anchor && anchor.turnId !== anchoredTurnRef.current) {
|
|
@@ -11333,13 +11379,13 @@ function MessageList({ controller, ui, slip, onDashboardTap, monitor, onGreeting
|
|
|
11333
11379
|
}
|
|
11334
11380
|
|
|
11335
11381
|
// src/components/ChatInput.tsx
|
|
11336
|
-
var
|
|
11382
|
+
var import_react77 = require("react");
|
|
11337
11383
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
11338
|
-
var ChatInput = (0,
|
|
11339
|
-
const [value, setValue] = (0,
|
|
11340
|
-
const textareaRef = (0,
|
|
11341
|
-
const stopRef = (0,
|
|
11342
|
-
const textBoxWantsFocusRef = (0,
|
|
11384
|
+
var ChatInput = (0, import_react77.forwardRef)(function ChatInput2({ placeholder, streaming, onSend, onStop, stopLabel, sendLabel, disabled = false }, ref) {
|
|
11385
|
+
const [value, setValue] = (0, import_react77.useState)("");
|
|
11386
|
+
const textareaRef = (0, import_react77.useRef)(null);
|
|
11387
|
+
const stopRef = (0, import_react77.useRef)(null);
|
|
11388
|
+
const textBoxWantsFocusRef = (0, import_react77.useRef)(false);
|
|
11343
11389
|
const submit = () => {
|
|
11344
11390
|
if (disabled) return;
|
|
11345
11391
|
const t = value.trim();
|
|
@@ -11353,7 +11399,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11353
11399
|
submit();
|
|
11354
11400
|
}
|
|
11355
11401
|
};
|
|
11356
|
-
(0,
|
|
11402
|
+
(0, import_react77.useImperativeHandle)(ref, () => ({
|
|
11357
11403
|
focus() {
|
|
11358
11404
|
const box = textareaRef.current;
|
|
11359
11405
|
if (box && !box.disabled) {
|
|
@@ -11365,7 +11411,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11365
11411
|
stopRef.current?.focus();
|
|
11366
11412
|
}
|
|
11367
11413
|
}), []);
|
|
11368
|
-
(0,
|
|
11414
|
+
(0, import_react77.useEffect)(() => {
|
|
11369
11415
|
if (streaming || disabled || !textBoxWantsFocusRef.current) return;
|
|
11370
11416
|
textBoxWantsFocusRef.current = false;
|
|
11371
11417
|
const box = textareaRef.current;
|
|
@@ -11396,7 +11442,7 @@ var ChatInput = (0, import_react76.forwardRef)(function ChatInput2({ placeholder
|
|
|
11396
11442
|
});
|
|
11397
11443
|
|
|
11398
11444
|
// src/components/TabBar.tsx
|
|
11399
|
-
var
|
|
11445
|
+
var import_react78 = require("react");
|
|
11400
11446
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
11401
11447
|
var TIGHT_LEVELS = [0, 1, 2, 3, 4, 5, 6, 7];
|
|
11402
11448
|
var FOCUS_EDGE = 24;
|
|
@@ -11419,16 +11465,16 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11419
11465
|
...gamesEnabled ? [{ tab: "games", label: ui.tabGames, count: 0, dot: false }] : []
|
|
11420
11466
|
];
|
|
11421
11467
|
const track = useTrack();
|
|
11422
|
-
const listRef = (0,
|
|
11468
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
11423
11469
|
const activeTab = monitor.activeTab;
|
|
11424
|
-
(0,
|
|
11470
|
+
(0, import_react78.useEffect)(() => {
|
|
11425
11471
|
const el = listRef.current?.querySelector("[data-on]");
|
|
11426
11472
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
11427
11473
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11428
11474
|
el.scrollIntoView({ block: "nearest", inline: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
11429
11475
|
}, [activeTab]);
|
|
11430
11476
|
const labelSignature = tabs.map((t) => `${t.tab}:${t.label}:${t.count}`).join("|");
|
|
11431
|
-
(0,
|
|
11477
|
+
(0, import_react78.useLayoutEffect)(() => {
|
|
11432
11478
|
const strip = listRef.current;
|
|
11433
11479
|
if (!strip) return;
|
|
11434
11480
|
const measure = () => {
|
|
@@ -11452,7 +11498,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11452
11498
|
fonts?.removeEventListener?.("loadingdone", measure);
|
|
11453
11499
|
};
|
|
11454
11500
|
}, [labelSignature]);
|
|
11455
|
-
const pointerDown = (0,
|
|
11501
|
+
const pointerDown = (0, import_react78.useRef)(false);
|
|
11456
11502
|
const keepFocusedTabInView = (e) => {
|
|
11457
11503
|
const strip = e.currentTarget;
|
|
11458
11504
|
const tab = e.target;
|
|
@@ -11512,7 +11558,7 @@ function TabBar({ monitor, ui, matchCount, trendsCount, liveCount, hasSchedule,
|
|
|
11512
11558
|
}
|
|
11513
11559
|
|
|
11514
11560
|
// src/components/MonitorTabs.tsx
|
|
11515
|
-
var
|
|
11561
|
+
var import_react91 = require("react");
|
|
11516
11562
|
|
|
11517
11563
|
// src/components/MarketAccordion.tsx
|
|
11518
11564
|
var import_widget_sdk25 = require("@sensiblestats/widget-sdk");
|
|
@@ -11574,7 +11620,7 @@ function MarketAccordion({ match, monitor, ui, slip }) {
|
|
|
11574
11620
|
}
|
|
11575
11621
|
|
|
11576
11622
|
// src/components/MonitorFormH2H.tsx
|
|
11577
|
-
var
|
|
11623
|
+
var import_react79 = require("react");
|
|
11578
11624
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11579
11625
|
function resultClass2(result) {
|
|
11580
11626
|
if (result === "W") return "ss-w-h2h-result--win";
|
|
@@ -11590,7 +11636,7 @@ function FormDots({ form, ui }) {
|
|
|
11590
11636
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ss-w-h2h-dots", children: form.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: `ss-w-h2h-result ${resultClass2(m.result)}`, children: resultLabel(m.result, ui) }, i)) });
|
|
11591
11637
|
}
|
|
11592
11638
|
function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
11593
|
-
const [expanded, setExpanded] = (0,
|
|
11639
|
+
const [expanded, setExpanded] = (0, import_react79.useState)(false);
|
|
11594
11640
|
const { homeForm, awayForm, h2h, homeShortCode, awayShortCode } = formAndH2H;
|
|
11595
11641
|
if (homeForm.length === 0 && awayForm.length === 0 && !h2h) {
|
|
11596
11642
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, {});
|
|
@@ -11668,10 +11714,10 @@ function MonitorFormH2H({ formAndH2H, homeTeamName, awayTeamName, ui }) {
|
|
|
11668
11714
|
}
|
|
11669
11715
|
|
|
11670
11716
|
// src/components/CompLogo.tsx
|
|
11671
|
-
var
|
|
11717
|
+
var import_react80 = require("react");
|
|
11672
11718
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11673
11719
|
function CompLogo({ url }) {
|
|
11674
|
-
const [failed, setFailed] = (0,
|
|
11720
|
+
const [failed, setFailed] = (0, import_react80.useState)(null);
|
|
11675
11721
|
if (!url || failed === url) return null;
|
|
11676
11722
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("img", { className: "ss-w-mon-comp-logo", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(url) });
|
|
11677
11723
|
}
|
|
@@ -11829,7 +11875,7 @@ function MonitorSkeleton({ pin, monitor, ui }) {
|
|
|
11829
11875
|
}
|
|
11830
11876
|
|
|
11831
11877
|
// src/components/NbaMonitorCard.tsx
|
|
11832
|
-
var
|
|
11878
|
+
var import_react84 = require("react");
|
|
11833
11879
|
|
|
11834
11880
|
// src/sportLabel.ts
|
|
11835
11881
|
var CODE = { football: "football", basketball: "nba", nba: "nba", americanfootball: "nfl", nfl: "nfl", tennis: "tennis" };
|
|
@@ -11839,7 +11885,7 @@ var sportLabel = (ui, sport) => {
|
|
|
11839
11885
|
};
|
|
11840
11886
|
|
|
11841
11887
|
// src/components/NbaFormSection.tsx
|
|
11842
|
-
var
|
|
11888
|
+
var import_react81 = require("react");
|
|
11843
11889
|
|
|
11844
11890
|
// src/components/NbaFormRest.tsx
|
|
11845
11891
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
@@ -11939,8 +11985,8 @@ function Row3({ game, abbr, tonight, ui }) {
|
|
|
11939
11985
|
] });
|
|
11940
11986
|
}
|
|
11941
11987
|
function NbaFormSection({ match, monitor, ui }) {
|
|
11942
|
-
const [open, setOpen] = (0,
|
|
11943
|
-
const [side, setSide] = (0,
|
|
11988
|
+
const [open, setOpen] = (0, import_react81.useState)(false);
|
|
11989
|
+
const [side, setSide] = (0, import_react81.useState)("away");
|
|
11944
11990
|
const form = useNbaForm(match, monitor);
|
|
11945
11991
|
const b = match.basketball;
|
|
11946
11992
|
if (!form || !b || !form.home && !form.away) return null;
|
|
@@ -11985,10 +12031,10 @@ function NbaFormSection({ match, monitor, ui }) {
|
|
|
11985
12031
|
}
|
|
11986
12032
|
|
|
11987
12033
|
// src/components/NbaPropsSection.tsx
|
|
11988
|
-
var
|
|
12034
|
+
var import_react83 = require("react");
|
|
11989
12035
|
|
|
11990
12036
|
// src/components/PropsPieces.tsx
|
|
11991
|
-
var
|
|
12037
|
+
var import_react82 = require("react");
|
|
11992
12038
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
11993
12039
|
var livePlayer = (bundle, p) => bundle.live === true || !p.live && !p.nflLive ? p : { ...p, live: null, nflLive: null };
|
|
11994
12040
|
var hasLiveLine = (p) => p.live != null || p.nflLive != null;
|
|
@@ -12001,9 +12047,9 @@ function preKickoff(match) {
|
|
|
12001
12047
|
return Number.isFinite(kickoff) && Date.now() < kickoff;
|
|
12002
12048
|
}
|
|
12003
12049
|
function usePreKickoff(match) {
|
|
12004
|
-
const [, setTick] = (0,
|
|
12050
|
+
const [, setTick] = (0, import_react82.useState)(0);
|
|
12005
12051
|
const pre = preKickoff(match);
|
|
12006
|
-
(0,
|
|
12052
|
+
(0, import_react82.useEffect)(() => {
|
|
12007
12053
|
if (!pre || !match.kickoffUtc) return;
|
|
12008
12054
|
const wait = Math.min(Math.max(Date.parse(match.kickoffUtc) - Date.now(), 0), MAX_TIMER_MS);
|
|
12009
12055
|
const id = setTimeout(() => setTick((t) => t + 1), wait);
|
|
@@ -12017,7 +12063,7 @@ function usePropsOpen(match, monitor, descriptor) {
|
|
|
12017
12063
|
const pre = descriptor.sport === "basketball" ? match.phase === "preMatch" : beforeKickoff;
|
|
12018
12064
|
const live = match.phase === "live";
|
|
12019
12065
|
const open = pre || live;
|
|
12020
|
-
(0,
|
|
12066
|
+
(0, import_react82.useEffect)(() => {
|
|
12021
12067
|
if (!open) return;
|
|
12022
12068
|
if (sport) monitor.loadPlayerProps?.(match.matchId, sport);
|
|
12023
12069
|
else monitor.loadPlayerProps?.(match.matchId);
|
|
@@ -12095,7 +12141,7 @@ function PropBars({ bars, line, title, wide, ui, note }) {
|
|
|
12095
12141
|
function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
12096
12142
|
const player = livePlayer(bundle, given);
|
|
12097
12143
|
const stats = descriptor.stats.map((k) => player.stats.find((s) => s.stat === k)).filter((s) => s != null);
|
|
12098
|
-
const [picked, setPicked] = (0,
|
|
12144
|
+
const [picked, setPicked] = (0, import_react82.useState)(null);
|
|
12099
12145
|
const active = stats.find((s) => s.stat === picked) ?? stats[0];
|
|
12100
12146
|
const sample = active?.games?.length ?? 0;
|
|
12101
12147
|
const hitsOf = (price, text2) => descriptor.showHits && sample > 0 && price.hits != null ? text2(price.hits) : null;
|
|
@@ -12144,8 +12190,8 @@ function PropPlayerPanel({ player: given, bundle, descriptor, ui, slip }) {
|
|
|
12144
12190
|
] });
|
|
12145
12191
|
}
|
|
12146
12192
|
function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
12147
|
-
const [openId, setOpenId] = (0,
|
|
12148
|
-
const [brokenShots, setBrokenShots] = (0,
|
|
12193
|
+
const [openId, setOpenId] = (0, import_react82.useState)(null);
|
|
12194
|
+
const [brokenShots, setBrokenShots] = (0, import_react82.useState)(/* @__PURE__ */ new Set());
|
|
12149
12195
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "ss-w-props-list", children: players.map((given) => {
|
|
12150
12196
|
const p = livePlayer(bundle, given);
|
|
12151
12197
|
const isOpen = openId === p.playerId;
|
|
@@ -12191,12 +12237,12 @@ function PropRoster({ bundle, players, side, descriptor, ui, slip }) {
|
|
|
12191
12237
|
}
|
|
12192
12238
|
var BOX_QUIET_MS = 12e4;
|
|
12193
12239
|
function StatsClock({ boxAsOfUtc, match, live, atBreak: atBreak2, ago, ui }) {
|
|
12194
|
-
const [tick, setTick] = (0,
|
|
12240
|
+
const [tick, setTick] = (0, import_react82.useState)(0);
|
|
12195
12241
|
const time = clock2(boxAsOfUtc, ui);
|
|
12196
12242
|
const at2 = time === "" ? Number.NaN : Date.parse(boxAsOfUtc);
|
|
12197
12243
|
const valid = !Number.isNaN(at2);
|
|
12198
12244
|
const onBreak = atBreak(match);
|
|
12199
|
-
(0,
|
|
12245
|
+
(0, import_react82.useEffect)(() => {
|
|
12200
12246
|
if (!valid || onBreak) return;
|
|
12201
12247
|
const age2 = Date.now() - at2;
|
|
12202
12248
|
const wait = age2 < BOX_QUIET_MS ? BOX_QUIET_MS - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12257,12 +12303,12 @@ var nbaDescriptor = (ui, match) => ({
|
|
|
12257
12303
|
tenGameBars: false
|
|
12258
12304
|
});
|
|
12259
12305
|
function StatsClock2({ bundle, match, ui }) {
|
|
12260
|
-
const [tick, setTick] = (0,
|
|
12306
|
+
const [tick, setTick] = (0, import_react83.useState)(0);
|
|
12261
12307
|
const at2 = bundle.live === true && bundle.boxAsOfUtc ? Date.parse(bundle.boxAsOfUtc) : Number.NaN;
|
|
12262
12308
|
const time = clock2(bundle.boxAsOfUtc, ui);
|
|
12263
12309
|
const valid = !Number.isNaN(at2) && time !== "";
|
|
12264
12310
|
const onBreak = atBreak(match);
|
|
12265
|
-
(0,
|
|
12311
|
+
(0, import_react83.useEffect)(() => {
|
|
12266
12312
|
if (!valid || onBreak) return;
|
|
12267
12313
|
const age2 = Date.now() - at2;
|
|
12268
12314
|
const wait = age2 < BOX_QUIET_MS2 ? BOX_QUIET_MS2 - age2 : 6e4 - age2 % 6e4;
|
|
@@ -12276,7 +12322,7 @@ function StatsClock2({ bundle, match, ui }) {
|
|
|
12276
12322
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "ss-w-props-asof ss-w-props-asof--live", children: ui.nba.propsStatsLive(time) });
|
|
12277
12323
|
}
|
|
12278
12324
|
function NbaPropsSection({ match, monitor, ui, slip }) {
|
|
12279
|
-
const [side, setSide] = (0,
|
|
12325
|
+
const [side, setSide] = (0, import_react83.useState)("home");
|
|
12280
12326
|
const descriptor = nbaDescriptor(ui, match);
|
|
12281
12327
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12282
12328
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12314,7 +12360,7 @@ function city(teamName, nickname) {
|
|
|
12314
12360
|
return name.slice(0, name.length - nickname.length).trim() || null;
|
|
12315
12361
|
}
|
|
12316
12362
|
function BadgeCrest({ url, abbreviation }) {
|
|
12317
|
-
const [failed, setFailed] = (0,
|
|
12363
|
+
const [failed, setFailed] = (0, import_react84.useState)(false);
|
|
12318
12364
|
if (url && !failed) {
|
|
12319
12365
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { className: "ss-w-nbamon-badge ss-w-nbamon-badge--img", src: url, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
12320
12366
|
}
|
|
@@ -12449,7 +12495,7 @@ function NbaMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12449
12495
|
}
|
|
12450
12496
|
|
|
12451
12497
|
// src/components/NflFormSection.tsx
|
|
12452
|
-
var
|
|
12498
|
+
var import_react85 = require("react");
|
|
12453
12499
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12454
12500
|
var outcomeOf = (g) => g.teamScore > g.opponentScore ? "win" : g.teamScore < g.opponentScore ? "loss" : "tie";
|
|
12455
12501
|
var signedSpread2 = (v) => v > 0 ? `+${v}` : String(v);
|
|
@@ -12502,7 +12548,7 @@ function H2hRow({ game, home, ui }) {
|
|
|
12502
12548
|
] });
|
|
12503
12549
|
}
|
|
12504
12550
|
function NflFormSection({ match, monitor, ui }) {
|
|
12505
|
-
const [segment, setSegment] = (0,
|
|
12551
|
+
const [segment, setSegment] = (0, import_react85.useState)("away");
|
|
12506
12552
|
const { live, open } = usePropsOpen(match, monitor, { sport: "americanfootball" });
|
|
12507
12553
|
const bundle = monitor.playerProps?.[monitorMatchKey("americanfootball", match.matchId)]?.bundle;
|
|
12508
12554
|
const form = bundle?.form;
|
|
@@ -12535,7 +12581,7 @@ function NflFormSection({ match, monitor, ui }) {
|
|
|
12535
12581
|
}
|
|
12536
12582
|
|
|
12537
12583
|
// src/components/NflPropsSection.tsx
|
|
12538
|
-
var
|
|
12584
|
+
var import_react86 = require("react");
|
|
12539
12585
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12540
12586
|
var TRENDS_SHOWN = 3;
|
|
12541
12587
|
var SCORERS_SHOWN = 8;
|
|
@@ -12608,7 +12654,7 @@ function ShowMore({ label, onClick }) {
|
|
|
12608
12654
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { type: "button", className: "ss-w-props-more", onClick, children: label });
|
|
12609
12655
|
}
|
|
12610
12656
|
function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
12611
|
-
const [all, setAll] = (0,
|
|
12657
|
+
const [all, setAll] = (0, import_react86.useState)(false);
|
|
12612
12658
|
const shown2 = all ? facts : facts.slice(0, TRENDS_SHOWN);
|
|
12613
12659
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("section", { className: "ss-w-props ss-w-props-trends", lang: ui.locale, children: [
|
|
12614
12660
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "ss-w-props-head", children: ui.nfl.propsTrends }),
|
|
@@ -12641,7 +12687,7 @@ function Trends({ bundle, facts, descriptor, ui, slip }) {
|
|
|
12641
12687
|
] });
|
|
12642
12688
|
}
|
|
12643
12689
|
function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
12644
|
-
const [all, setAll] = (0,
|
|
12690
|
+
const [all, setAll] = (0, import_react86.useState)(false);
|
|
12645
12691
|
const shown2 = all ? scorers : scorers.slice(0, SCORERS_SHOWN);
|
|
12646
12692
|
const cell2 = (name, column, price, stat) => price && stat ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(PropPrice, { price, label: "", ariaName: `${name}, ${column}`, player: name, stat, bundle, descriptor, ui, slip }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "ss-w-props-scorer-none", children: "\u2014" });
|
|
12647
12693
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "ss-w-props-scorers", children: [
|
|
@@ -12671,7 +12717,7 @@ function Scorers({ bundle, scorers, abbreviations, descriptor, ui, slip }) {
|
|
|
12671
12717
|
] });
|
|
12672
12718
|
}
|
|
12673
12719
|
function NflPropsSection({ match, monitor, ui, slip }) {
|
|
12674
|
-
const [tab, setTab] = (0,
|
|
12720
|
+
const [tab, setTab] = (0, import_react86.useState)(null);
|
|
12675
12721
|
const descriptor = nflDescriptor(ui);
|
|
12676
12722
|
const { bundle, live, open } = usePropsOpen(match, monitor, descriptor);
|
|
12677
12723
|
if (!open || !bundle || bundle.players.length === 0 || (bundle.live ?? false) !== live) return null;
|
|
@@ -12871,14 +12917,14 @@ function NflMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
12871
12917
|
}
|
|
12872
12918
|
|
|
12873
12919
|
// src/components/TennisMonitorCard.tsx
|
|
12874
|
-
var
|
|
12920
|
+
var import_react89 = require("react");
|
|
12875
12921
|
var import_widget_sdk28 = require("@sensiblestats/widget-sdk");
|
|
12876
12922
|
|
|
12877
12923
|
// src/components/TennisFixtureRow.tsx
|
|
12878
12924
|
var import_widget_sdk27 = require("@sensiblestats/widget-sdk");
|
|
12879
12925
|
|
|
12880
12926
|
// src/components/FixtureRow.tsx
|
|
12881
|
-
var
|
|
12927
|
+
var import_react87 = require("react");
|
|
12882
12928
|
var import_widget_sdk26 = require("@sensiblestats/widget-sdk");
|
|
12883
12929
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12884
12930
|
function splitAtFirstSpace(label) {
|
|
@@ -12892,7 +12938,7 @@ function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
|
12892
12938
|
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
12893
12939
|
}
|
|
12894
12940
|
function Side2({ name, crest, abbr, away = false }) {
|
|
12895
|
-
const [failed, setFailed] = (0,
|
|
12941
|
+
const [failed, setFailed] = (0, import_react87.useState)(false);
|
|
12896
12942
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
12897
12943
|
crest && !failed ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("img", { className: abbr ? "ss-w-drow-crest ss-w-drow-crest--wide" : "ss-w-drow-crest", src: crest, alt: "", onError: () => setFailed(true) }) : abbr ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-crest ss-w-drow-crest--abbr", children: abbr }) : null,
|
|
12898
12944
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "ss-w-drow-nm", children: name })
|
|
@@ -13134,7 +13180,7 @@ function TennisLiveScoreboard({ t, score, live, ui }) {
|
|
|
13134
13180
|
}
|
|
13135
13181
|
|
|
13136
13182
|
// src/components/TennisStatsTables.tsx
|
|
13137
|
-
var
|
|
13183
|
+
var import_react88 = require("react");
|
|
13138
13184
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13139
13185
|
function formatStat(row, value, locale) {
|
|
13140
13186
|
if (value == null) return "\u2013";
|
|
@@ -13172,8 +13218,8 @@ function Tables({ table, labels, names, locale }) {
|
|
|
13172
13218
|
] });
|
|
13173
13219
|
}
|
|
13174
13220
|
function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey }) {
|
|
13175
|
-
const [tab, setTab] = (0,
|
|
13176
|
-
(0,
|
|
13221
|
+
const [tab, setTab] = (0, import_react88.useState)("match");
|
|
13222
|
+
(0, import_react88.useEffect)(() => {
|
|
13177
13223
|
setTab("match");
|
|
13178
13224
|
}, [resetKey]);
|
|
13179
13225
|
const sets = serveReturn.sets.filter((s) => s.table.serve.length + s.table.return.length > 0);
|
|
@@ -13204,7 +13250,7 @@ function TennisStatsTables({ serveReturn, today, labels, names, ui, resetKey })
|
|
|
13204
13250
|
] }),
|
|
13205
13251
|
today.rows.map((r) => {
|
|
13206
13252
|
const f = (v) => formatStat({ kind: "pct" }, v, locale);
|
|
13207
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
13253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_react88.Fragment, { children: [
|
|
13208
13254
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "ss-w-ts-l", children: r.label }),
|
|
13209
13255
|
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("span", { className: "ss-w-ts-today-v ss-w-ts-today-v--a", children: [
|
|
13210
13256
|
f(r.p1Today),
|
|
@@ -13339,7 +13385,7 @@ function HeadToHead({ t, ui }) {
|
|
|
13339
13385
|
] });
|
|
13340
13386
|
}
|
|
13341
13387
|
function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
13342
|
-
const lastTables = (0,
|
|
13388
|
+
const lastTables = (0, import_react89.useRef)(null);
|
|
13343
13389
|
const t = match.tennis;
|
|
13344
13390
|
if (!t) return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(UnavailableCard, { match, monitor, ui, sport: "tennis" });
|
|
13345
13391
|
const preMatch = match.phase === "preMatch";
|
|
@@ -13419,7 +13465,7 @@ function TennisMonitorCard({ match, monitor, ui, slip, onAsk }) {
|
|
|
13419
13465
|
}
|
|
13420
13466
|
|
|
13421
13467
|
// src/components/ScoreboardStrip.tsx
|
|
13422
|
-
var
|
|
13468
|
+
var import_react90 = require("react");
|
|
13423
13469
|
var import_widget_sdk29 = require("@sensiblestats/widget-sdk");
|
|
13424
13470
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13425
13471
|
function nbaStatus(m, ui) {
|
|
@@ -13514,8 +13560,8 @@ function rowsFor(m) {
|
|
|
13514
13560
|
];
|
|
13515
13561
|
}
|
|
13516
13562
|
function useStripScroll(selectedKey) {
|
|
13517
|
-
const stripRef = (0,
|
|
13518
|
-
(0,
|
|
13563
|
+
const stripRef = (0, import_react90.useRef)(null);
|
|
13564
|
+
(0, import_react90.useEffect)(() => {
|
|
13519
13565
|
const strip = stripRef.current;
|
|
13520
13566
|
const pressed = strip?.querySelector('[aria-pressed="true"]');
|
|
13521
13567
|
if (!strip || !pressed) return;
|
|
@@ -13689,7 +13735,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
13689
13735
|
] });
|
|
13690
13736
|
}
|
|
13691
13737
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
13692
|
-
const seedIndex = (0,
|
|
13738
|
+
const seedIndex = (0, import_react91.useMemo)(() => buildSeedIndex(discovery?.groups ?? []), [discovery?.groups]);
|
|
13693
13739
|
const tiles = orderTiles(
|
|
13694
13740
|
monitor.pins,
|
|
13695
13741
|
monitor.snapshot,
|
|
@@ -13761,7 +13807,7 @@ function TrendsPanel({ monitor, ui, slip }) {
|
|
|
13761
13807
|
}
|
|
13762
13808
|
|
|
13763
13809
|
// src/components/LivePanel.tsx
|
|
13764
|
-
var
|
|
13810
|
+
var import_react94 = require("react");
|
|
13765
13811
|
var import_widget_sdk36 = require("@sensiblestats/widget-sdk");
|
|
13766
13812
|
|
|
13767
13813
|
// src/scheduleView.ts
|
|
@@ -13936,20 +13982,20 @@ function LeagueGroup({ view, open, onToggle, disambiguate, rowCap, onShowAll, on
|
|
|
13936
13982
|
}
|
|
13937
13983
|
|
|
13938
13984
|
// src/components/MatchSheet.tsx
|
|
13939
|
-
var
|
|
13985
|
+
var import_react93 = require("react");
|
|
13940
13986
|
var import_widget_sdk34 = require("@sensiblestats/widget-sdk");
|
|
13941
13987
|
|
|
13942
13988
|
// src/useModalDialog.ts
|
|
13943
|
-
var
|
|
13989
|
+
var import_react92 = require("react");
|
|
13944
13990
|
var FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
13945
13991
|
function useModalDialog(onClose, opts = {}) {
|
|
13946
|
-
const dialogRef = (0,
|
|
13947
|
-
const onCloseRef = (0,
|
|
13992
|
+
const dialogRef = (0, import_react92.useRef)(null);
|
|
13993
|
+
const onCloseRef = (0, import_react92.useRef)(onClose);
|
|
13948
13994
|
onCloseRef.current = onClose;
|
|
13949
|
-
const openerRef = (0,
|
|
13995
|
+
const openerRef = (0, import_react92.useRef)(opts.opener);
|
|
13950
13996
|
openerRef.current = opts.opener;
|
|
13951
13997
|
const restore = opts.restoreFocus ?? true;
|
|
13952
|
-
(0,
|
|
13998
|
+
(0, import_react92.useEffect)(() => {
|
|
13953
13999
|
const dialog = dialogRef.current;
|
|
13954
14000
|
const root = dialog?.getRootNode();
|
|
13955
14001
|
const focusedAtMount = root?.activeElement ?? null;
|
|
@@ -13960,7 +14006,7 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
13960
14006
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
13961
14007
|
};
|
|
13962
14008
|
}, []);
|
|
13963
|
-
(0,
|
|
14009
|
+
(0, import_react92.useEffect)(() => {
|
|
13964
14010
|
const onKey = (e) => {
|
|
13965
14011
|
if (e.key !== "Escape") return;
|
|
13966
14012
|
e.stopPropagation();
|
|
@@ -14001,8 +14047,8 @@ function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
|
14001
14047
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
14002
14048
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
14003
14049
|
const log = useEventLog();
|
|
14004
|
-
const titleId = (0,
|
|
14005
|
-
const [limitHit, setLimitHit] = (0,
|
|
14050
|
+
const titleId = (0, import_react93.useId)();
|
|
14051
|
+
const [limitHit, setLimitHit] = (0, import_react93.useState)(false);
|
|
14006
14052
|
const pinSport = (0, import_widget_sdk34.slipSportOf)(match.sport);
|
|
14007
14053
|
const tour = pinSport === "tennis" && isKnownTour(match.tour) ? match.tour : void 0;
|
|
14008
14054
|
const followable = pinSport !== "tennis" || tour !== void 0;
|
|
@@ -14103,10 +14149,10 @@ var OPEN_TOP_GROUPS = 2;
|
|
|
14103
14149
|
var QUIET_ROWS = 4;
|
|
14104
14150
|
function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, onLeague, onSeeAll, onAsk }) {
|
|
14105
14151
|
const { groups, states, stale } = discovery;
|
|
14106
|
-
const [mine, setMine] = (0,
|
|
14107
|
-
const [toggled, setToggled] = (0,
|
|
14108
|
-
const [sheet, setSheet] = (0,
|
|
14109
|
-
const pinnedKeys = (0,
|
|
14152
|
+
const [mine, setMine] = (0, import_react94.useState)(false);
|
|
14153
|
+
const [toggled, setToggled] = (0, import_react94.useState)(/* @__PURE__ */ new Map());
|
|
14154
|
+
const [sheet, setSheet] = (0, import_react94.useState)(null);
|
|
14155
|
+
const pinnedKeys = (0, import_react94.useMemo)(
|
|
14110
14156
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk36.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14111
14157
|
[monitor.pins]
|
|
14112
14158
|
);
|
|
@@ -14212,20 +14258,20 @@ function LivePanel({ discovery, ui, monitor, sport, offered, onSport, league, on
|
|
|
14212
14258
|
}
|
|
14213
14259
|
|
|
14214
14260
|
// src/components/ScheduleMatchesPanel.tsx
|
|
14215
|
-
var
|
|
14261
|
+
var import_react98 = require("react");
|
|
14216
14262
|
var import_widget_sdk38 = require("@sensiblestats/widget-sdk");
|
|
14217
14263
|
|
|
14218
14264
|
// src/useTennisRowPrices.ts
|
|
14219
|
-
var
|
|
14265
|
+
var import_react95 = require("react");
|
|
14220
14266
|
var import_widget_sdk37 = require("@sensiblestats/widget-sdk");
|
|
14221
14267
|
var TENNIS_PRICE_POLL_MS = 6e4;
|
|
14222
14268
|
function useTennisRowPrices(a) {
|
|
14223
|
-
const [state, setState] = (0,
|
|
14224
|
-
const getPricesRef = (0,
|
|
14269
|
+
const [state, setState] = (0, import_react95.useState)({ byId: null, stale: false });
|
|
14270
|
+
const getPricesRef = (0, import_react95.useRef)(a.getPrices);
|
|
14225
14271
|
getPricesRef.current = a.getPrices;
|
|
14226
|
-
const latest = (0,
|
|
14272
|
+
const latest = (0, import_react95.useRef)(0);
|
|
14227
14273
|
const idsKey = a.keys.filter((k) => isKnownTour(k.tour)).slice(0, MAX_TENNIS_KEYS).map((k) => `${k.tour}:${k.matchId}`).sort().join(",");
|
|
14228
|
-
(0,
|
|
14274
|
+
(0, import_react95.useEffect)(() => {
|
|
14229
14275
|
if (!a.enabled || idsKey === "") {
|
|
14230
14276
|
latest.current++;
|
|
14231
14277
|
setState((prev) => prev.byId === null && !prev.stale ? prev : { byId: null, stale: false });
|
|
@@ -14263,11 +14309,11 @@ function useTennisRowPrices(a) {
|
|
|
14263
14309
|
}
|
|
14264
14310
|
|
|
14265
14311
|
// src/components/DayStrip.tsx
|
|
14266
|
-
var
|
|
14312
|
+
var import_react96 = require("react");
|
|
14267
14313
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
14268
14314
|
function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
14269
|
-
const listRef = (0,
|
|
14270
|
-
(0,
|
|
14315
|
+
const listRef = (0, import_react96.useRef)(null);
|
|
14316
|
+
(0, import_react96.useEffect)(() => {
|
|
14271
14317
|
const el = listRef.current?.querySelector('[aria-pressed="true"]');
|
|
14272
14318
|
if (!el || typeof el.scrollIntoView !== "function") return;
|
|
14273
14319
|
const reduce = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -14296,7 +14342,7 @@ function DayStrip({ chips, selected, onSelect, ui, locale }) {
|
|
|
14296
14342
|
}
|
|
14297
14343
|
|
|
14298
14344
|
// src/components/games/ui/SearchField.tsx
|
|
14299
|
-
var
|
|
14345
|
+
var import_react97 = require("react");
|
|
14300
14346
|
|
|
14301
14347
|
// src/components/games/ui/icons.tsx
|
|
14302
14348
|
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
@@ -14335,8 +14381,8 @@ var IconFlame = ({ size = 16 }) => svg(size, /* @__PURE__ */ (0, import_jsx_runt
|
|
|
14335
14381
|
// src/components/games/ui/SearchField.tsx
|
|
14336
14382
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
14337
14383
|
function SearchField({ id, label, labelHidden = false, placeholder, value, onChange, disabled, inputRef, onKeyDown, clearLabel }) {
|
|
14338
|
-
const localRef = (0,
|
|
14339
|
-
const setInputRef = (0,
|
|
14384
|
+
const localRef = (0, import_react97.useRef)(null);
|
|
14385
|
+
const setInputRef = (0, import_react97.useCallback)((node) => {
|
|
14340
14386
|
localRef.current = node;
|
|
14341
14387
|
if (typeof inputRef === "function") inputRef(node);
|
|
14342
14388
|
else if (inputRef) inputRef.current = node;
|
|
@@ -14382,18 +14428,18 @@ var TOP_ROW_CAP = 3;
|
|
|
14382
14428
|
var SKELETON_ROWS = 3;
|
|
14383
14429
|
function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport, day, onDay, loaded, onOpenLive, onAsk, locale, getTennisPrices, slip }) {
|
|
14384
14430
|
const { localDate: today, states, stale } = discovery;
|
|
14385
|
-
const searchId = (0,
|
|
14386
|
-
const [query, setQuery] = (0,
|
|
14387
|
-
const [toggled, setToggled] = (0,
|
|
14388
|
-
const [expanded, setExpanded] = (0,
|
|
14389
|
-
const listRef = (0,
|
|
14390
|
-
const [sheet, setSheet] = (0,
|
|
14431
|
+
const searchId = (0, import_react98.useId)();
|
|
14432
|
+
const [query, setQuery] = (0, import_react98.useState)("");
|
|
14433
|
+
const [toggled, setToggled] = (0, import_react98.useState)(/* @__PURE__ */ new Map());
|
|
14434
|
+
const [expanded, setExpanded] = (0, import_react98.useState)(/* @__PURE__ */ new Set());
|
|
14435
|
+
const listRef = (0, import_react98.useRef)(null);
|
|
14436
|
+
const [sheet, setSheet] = (0, import_react98.useState)(null);
|
|
14391
14437
|
const { chips, selected } = loaded;
|
|
14392
|
-
(0,
|
|
14438
|
+
(0, import_react98.useEffect)(() => {
|
|
14393
14439
|
if (selected !== day) onDay(selected);
|
|
14394
14440
|
}, [day, selected, onDay]);
|
|
14395
14441
|
const isToday = selected === today;
|
|
14396
|
-
const pinnedKeys = (0,
|
|
14442
|
+
const pinnedKeys = (0, import_react98.useMemo)(
|
|
14397
14443
|
() => new Set(monitor.pins.filter((p) => p.kind === "match").map((p) => (0, import_widget_sdk38.matchKey)(p.sport, p.matchId, p.tour))),
|
|
14398
14444
|
[monitor.pins]
|
|
14399
14445
|
);
|
|
@@ -14531,7 +14577,7 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
14531
14577
|
}
|
|
14532
14578
|
|
|
14533
14579
|
// src/components/GamesPanel.tsx
|
|
14534
|
-
var
|
|
14580
|
+
var import_react113 = require("react");
|
|
14535
14581
|
|
|
14536
14582
|
// src/components/GamesLoginWall.tsx
|
|
14537
14583
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
@@ -14540,7 +14586,7 @@ function GamesLoginWall({ ui }) {
|
|
|
14540
14586
|
}
|
|
14541
14587
|
|
|
14542
14588
|
// src/components/GamesHub.tsx
|
|
14543
|
-
var
|
|
14589
|
+
var import_react99 = require("react");
|
|
14544
14590
|
|
|
14545
14591
|
// src/components/games/ui/gameMeta.ts
|
|
14546
14592
|
function prettifyGameId(gameId) {
|
|
@@ -14691,8 +14737,8 @@ function pickHeroGame(games) {
|
|
|
14691
14737
|
}
|
|
14692
14738
|
var tileKey = (g) => `${g.gameId}-${g.gameDay}-${g.fixtureId}`;
|
|
14693
14739
|
function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
14694
|
-
const [, setTick] = (0,
|
|
14695
|
-
(0,
|
|
14740
|
+
const [, setTick] = (0, import_react99.useState)(0);
|
|
14741
|
+
(0, import_react99.useEffect)(() => {
|
|
14696
14742
|
const id = setInterval(() => setTick((t) => t + 1), 6e4);
|
|
14697
14743
|
return () => clearInterval(id);
|
|
14698
14744
|
}, []);
|
|
@@ -14752,10 +14798,10 @@ function GamesHub({ games, myWeeklyRow, weeklyPrize, onOpen, ui }) {
|
|
|
14752
14798
|
}
|
|
14753
14799
|
|
|
14754
14800
|
// src/components/GameScreenHost.tsx
|
|
14755
|
-
var
|
|
14801
|
+
var import_react111 = require("react");
|
|
14756
14802
|
|
|
14757
14803
|
// src/useGamePlay.ts
|
|
14758
|
-
var
|
|
14804
|
+
var import_react100 = require("react");
|
|
14759
14805
|
function toSubmitResult(payload) {
|
|
14760
14806
|
return {
|
|
14761
14807
|
// 'pending' means the play is recorded but awaiting resolution (fixture games)
|
|
@@ -14767,17 +14813,17 @@ function toSubmitResult(payload) {
|
|
|
14767
14813
|
};
|
|
14768
14814
|
}
|
|
14769
14815
|
function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh }) {
|
|
14770
|
-
const [result, setResult] = (0,
|
|
14771
|
-
const [submitting, setSubmitting] = (0,
|
|
14772
|
-
const [rawStatus, setRawStatus] = (0,
|
|
14773
|
-
const inFlightRef = (0,
|
|
14774
|
-
const convRef = (0,
|
|
14816
|
+
const [result, setResult] = (0, import_react100.useState)(null);
|
|
14817
|
+
const [submitting, setSubmitting] = (0, import_react100.useState)(false);
|
|
14818
|
+
const [rawStatus, setRawStatus] = (0, import_react100.useState)(null);
|
|
14819
|
+
const inFlightRef = (0, import_react100.useRef)(false);
|
|
14820
|
+
const convRef = (0, import_react100.useRef)(conversation);
|
|
14775
14821
|
convRef.current = conversation;
|
|
14776
|
-
const optsRef = (0,
|
|
14822
|
+
const optsRef = (0, import_react100.useRef)({ gameId, gameDay, fixtureId, locale, refresh });
|
|
14777
14823
|
optsRef.current = { gameId, gameDay, fixtureId, locale, refresh };
|
|
14778
|
-
const resultRef = (0,
|
|
14824
|
+
const resultRef = (0, import_react100.useRef)(null);
|
|
14779
14825
|
resultRef.current = result;
|
|
14780
|
-
const refetch = (0,
|
|
14826
|
+
const refetch = (0, import_react100.useCallback)(async () => {
|
|
14781
14827
|
const conv = convRef.current;
|
|
14782
14828
|
if (!conv) return;
|
|
14783
14829
|
const opts = optsRef.current;
|
|
@@ -14793,7 +14839,7 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14793
14839
|
} catch {
|
|
14794
14840
|
}
|
|
14795
14841
|
}, []);
|
|
14796
|
-
const submit = (0,
|
|
14842
|
+
const submit = (0, import_react100.useCallback)(async (answerJson) => {
|
|
14797
14843
|
const conv = convRef.current;
|
|
14798
14844
|
if (!conv || inFlightRef.current) return;
|
|
14799
14845
|
inFlightRef.current = true;
|
|
@@ -14820,14 +14866,14 @@ function useGamePlay(conversation, { gameId, gameDay, fixtureId, locale, refresh
|
|
|
14820
14866
|
setSubmitting(false);
|
|
14821
14867
|
}
|
|
14822
14868
|
}, [refetch]);
|
|
14823
|
-
const hydrate = (0,
|
|
14869
|
+
const hydrate = (0, import_react100.useCallback)(() => {
|
|
14824
14870
|
void refetch();
|
|
14825
14871
|
}, [refetch]);
|
|
14826
14872
|
return { result, submitting, submit, hydrate, rawStatus };
|
|
14827
14873
|
}
|
|
14828
14874
|
|
|
14829
14875
|
// src/components/games/MysteryTigerGame.tsx
|
|
14830
|
-
var
|
|
14876
|
+
var import_react102 = require("react");
|
|
14831
14877
|
|
|
14832
14878
|
// src/components/games/nationFlags.ts
|
|
14833
14879
|
var FLAGS = {
|
|
@@ -15038,7 +15084,7 @@ function isNationCode(flag) {
|
|
|
15038
15084
|
}
|
|
15039
15085
|
|
|
15040
15086
|
// src/components/games/PlayerAvatar.tsx
|
|
15041
|
-
var
|
|
15087
|
+
var import_react101 = require("react");
|
|
15042
15088
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
15043
15089
|
function initialsOf(name) {
|
|
15044
15090
|
const parts2 = name.trim().split(/\s+/).filter(Boolean);
|
|
@@ -15056,7 +15102,7 @@ function PlayerAvatar({
|
|
|
15056
15102
|
imagePath,
|
|
15057
15103
|
className
|
|
15058
15104
|
}) {
|
|
15059
|
-
const [failed, setFailed] = (0,
|
|
15105
|
+
const [failed, setFailed] = (0, import_react101.useState)(false);
|
|
15060
15106
|
const showImage = Boolean(imagePath) && !isPlaceholderImage(imagePath) && !failed;
|
|
15061
15107
|
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className, "aria-hidden": "true", children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("img", { src: imagePath, alt: "", loading: "lazy", onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "ss-w-av-initials", children: initialsOf(name) }) });
|
|
15062
15108
|
}
|
|
@@ -15300,8 +15346,8 @@ function MysteryTigerGame({
|
|
|
15300
15346
|
onBack
|
|
15301
15347
|
}) {
|
|
15302
15348
|
const t = ui.games.mysteryTiger;
|
|
15303
|
-
const [query, setQuery] = (0,
|
|
15304
|
-
const inputId = (0,
|
|
15349
|
+
const [query, setQuery] = (0, import_react102.useState)("");
|
|
15350
|
+
const inputId = (0, import_react102.useId)();
|
|
15305
15351
|
const clientState = parseClientState(result?.clientStateJson);
|
|
15306
15352
|
const guessResults = clientState?.guessResults ?? [];
|
|
15307
15353
|
const alreadyGuessedIds = new Set(guessResults.map((g) => g.playerId));
|
|
@@ -15562,13 +15608,13 @@ function HigherOrLowerGame({
|
|
|
15562
15608
|
}
|
|
15563
15609
|
|
|
15564
15610
|
// src/components/games/CareerPathGame.tsx
|
|
15565
|
-
var
|
|
15611
|
+
var import_react104 = require("react");
|
|
15566
15612
|
|
|
15567
15613
|
// src/components/games/ui/CrestShield.tsx
|
|
15568
|
-
var
|
|
15614
|
+
var import_react103 = require("react");
|
|
15569
15615
|
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
15570
15616
|
function CrestShield({ src, name, size = 28 }) {
|
|
15571
|
-
const [failed, setFailed] = (0,
|
|
15617
|
+
const [failed, setFailed] = (0, import_react103.useState)(false);
|
|
15572
15618
|
if (src && !isPlaceholderImage(src) && !failed) {
|
|
15573
15619
|
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("img", { className: "ss-g-crest", src, alt: name, width: size, height: size, loading: "lazy", onError: () => setFailed(true) });
|
|
15574
15620
|
}
|
|
@@ -15600,8 +15646,8 @@ function CareerPathGame({
|
|
|
15600
15646
|
}) {
|
|
15601
15647
|
const s = ui.games.careerPath;
|
|
15602
15648
|
const title = gameTitle({ gameId: "career-path" }, ui.games.titles);
|
|
15603
|
-
const [query, setQuery] = (0,
|
|
15604
|
-
const inputId = (0,
|
|
15649
|
+
const [query, setQuery] = (0, import_react104.useState)("");
|
|
15650
|
+
const inputId = (0, import_react104.useId)();
|
|
15605
15651
|
const clientState = parseClientState3(result?.clientStateJson);
|
|
15606
15652
|
const alreadyGuessedIds = new Set(clientState?.guessResults.map((g) => g.playerId) ?? []);
|
|
15607
15653
|
const isOver = result?.alreadyPlayed === true || clientState?.solved === true || clientState?.failed === true;
|
|
@@ -15707,7 +15753,7 @@ function CareerPathGame({
|
|
|
15707
15753
|
}
|
|
15708
15754
|
|
|
15709
15755
|
// src/components/games/BeatTheGridGame.tsx
|
|
15710
|
-
var
|
|
15756
|
+
var import_react105 = __toESM(require("react"), 1);
|
|
15711
15757
|
|
|
15712
15758
|
// src/components/games/ui/OptionList.tsx
|
|
15713
15759
|
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
@@ -15796,10 +15842,10 @@ function SearchSheet({
|
|
|
15796
15842
|
ui
|
|
15797
15843
|
}) {
|
|
15798
15844
|
const s = ui.games.beatTheGrid;
|
|
15799
|
-
const [query, setQuery] = (0,
|
|
15800
|
-
const inputId = (0,
|
|
15801
|
-
const inputRef = (0,
|
|
15802
|
-
(0,
|
|
15845
|
+
const [query, setQuery] = (0, import_react105.useState)("");
|
|
15846
|
+
const inputId = (0, import_react105.useId)();
|
|
15847
|
+
const inputRef = (0, import_react105.useRef)(null);
|
|
15848
|
+
(0, import_react105.useEffect)(() => {
|
|
15803
15849
|
inputRef.current?.focus();
|
|
15804
15850
|
}, [row, col]);
|
|
15805
15851
|
const filtered = playerPool.filter(
|
|
@@ -15864,7 +15910,7 @@ function BeatTheGridGame({
|
|
|
15864
15910
|
}) {
|
|
15865
15911
|
const s = ui.games.beatTheGrid;
|
|
15866
15912
|
const title = gameTitle({ gameId: "beat-the-grid" }, ui.games.titles);
|
|
15867
|
-
const [activeCell, setActiveCell] = (0,
|
|
15913
|
+
const [activeCell, setActiveCell] = (0, import_react105.useState)(null);
|
|
15868
15914
|
const clientState = parseClientState4(result?.clientStateJson);
|
|
15869
15915
|
const filledCells = clientState?.cells ?? [];
|
|
15870
15916
|
const isLocked2 = result?.alreadyPlayed === true || clientState?.isComplete === true;
|
|
@@ -15938,7 +15984,7 @@ function BeatTheGridGame({
|
|
|
15938
15984
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { "aria-hidden": "true", children: abbr }),
|
|
15939
15985
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "ss-g-sr", children: rowLabel })
|
|
15940
15986
|
] });
|
|
15941
|
-
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
15987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_react105.default.Fragment, { children: [
|
|
15942
15988
|
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "ss-g-btg-rowhdr", "data-meta": rowMeta ? "true" : void 0, children: rowHeaderContent }),
|
|
15943
15989
|
cols.map((colLabel, colIdx) => {
|
|
15944
15990
|
const filled = findCellResult(filledCells, rowIdx, colIdx);
|
|
@@ -16019,7 +16065,7 @@ function BeatTheGridGame({
|
|
|
16019
16065
|
}
|
|
16020
16066
|
|
|
16021
16067
|
// src/components/games/GuessTheXiGame.tsx
|
|
16022
|
-
var
|
|
16068
|
+
var import_react106 = require("react");
|
|
16023
16069
|
|
|
16024
16070
|
// src/components/games/ui/PitchSvg.tsx
|
|
16025
16071
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
@@ -16108,8 +16154,8 @@ function GuessTheXiGame({
|
|
|
16108
16154
|
onBack
|
|
16109
16155
|
}) {
|
|
16110
16156
|
const t = ui.games.guessTheXi;
|
|
16111
|
-
const [query, setQuery] = (0,
|
|
16112
|
-
const inputId = (0,
|
|
16157
|
+
const [query, setQuery] = (0, import_react106.useState)("");
|
|
16158
|
+
const inputId = (0, import_react106.useId)();
|
|
16113
16159
|
const clientState = parseClientState5(result?.clientStateJson);
|
|
16114
16160
|
const isOver = result?.alreadyPlayed === true || clientState?.status === "solved" || clientState?.status === "failed";
|
|
16115
16161
|
const solved = clientState?.status === "solved";
|
|
@@ -16251,7 +16297,7 @@ function GuessTheXiGame({
|
|
|
16251
16297
|
}
|
|
16252
16298
|
|
|
16253
16299
|
// src/components/games/DailyQuizGame.tsx
|
|
16254
|
-
var
|
|
16300
|
+
var import_react107 = require("react");
|
|
16255
16301
|
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
16256
16302
|
function parseClientState6(json) {
|
|
16257
16303
|
if (!json) return null;
|
|
@@ -16292,8 +16338,8 @@ function DailyQuizGame({
|
|
|
16292
16338
|
}) {
|
|
16293
16339
|
const s = ui.games.dailyQuiz;
|
|
16294
16340
|
const title = gameTitle({ gameId: "daily-quiz" }, ui.games.titles);
|
|
16295
|
-
const [selections, setSelections] = (0,
|
|
16296
|
-
const [page, setPage] = (0,
|
|
16341
|
+
const [selections, setSelections] = (0, import_react107.useState)(/* @__PURE__ */ new Map());
|
|
16342
|
+
const [page, setPage] = (0, import_react107.useState)(0);
|
|
16297
16343
|
const clientState = parseClientState6(result?.clientStateJson);
|
|
16298
16344
|
const results2 = clientState?.results ?? [];
|
|
16299
16345
|
const isRevealed = results2.length > 0 || result?.alreadyPlayed === true;
|
|
@@ -16403,7 +16449,7 @@ function DailyQuizGame({
|
|
|
16403
16449
|
}
|
|
16404
16450
|
|
|
16405
16451
|
// src/components/games/MatchdayPredictorGame.tsx
|
|
16406
|
-
var
|
|
16452
|
+
var import_react108 = require("react");
|
|
16407
16453
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
16408
16454
|
var SCORER_SEARCH_THRESHOLD = 9;
|
|
16409
16455
|
function parseClientState7(json) {
|
|
@@ -16499,12 +16545,12 @@ function MatchdayPredictorGame({
|
|
|
16499
16545
|
onBack
|
|
16500
16546
|
}) {
|
|
16501
16547
|
const t = ui.games.predictor;
|
|
16502
|
-
const [homeScore, setHomeScore] = (0,
|
|
16503
|
-
const [awayScore, setAwayScore] = (0,
|
|
16504
|
-
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0,
|
|
16505
|
-
const [lastEdited, setLastEdited] = (0,
|
|
16506
|
-
const [query, setQuery] = (0,
|
|
16507
|
-
const searchId = (0,
|
|
16548
|
+
const [homeScore, setHomeScore] = (0, import_react108.useState)(0);
|
|
16549
|
+
const [awayScore, setAwayScore] = (0, import_react108.useState)(0);
|
|
16550
|
+
const [firstScorerPlayerId, setFirstScorerPlayerId] = (0, import_react108.useState)(null);
|
|
16551
|
+
const [lastEdited, setLastEdited] = (0, import_react108.useState)("home");
|
|
16552
|
+
const [query, setQuery] = (0, import_react108.useState)("");
|
|
16553
|
+
const searchId = (0, import_react108.useId)();
|
|
16508
16554
|
const clientState = parseClientState7(result?.clientStateJson);
|
|
16509
16555
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16510
16556
|
const header = /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
@@ -16671,7 +16717,7 @@ function MatchdayPredictorGame({
|
|
|
16671
16717
|
}
|
|
16672
16718
|
|
|
16673
16719
|
// src/components/games/StartingXiGame.tsx
|
|
16674
|
-
var
|
|
16720
|
+
var import_react109 = require("react");
|
|
16675
16721
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
16676
16722
|
var POINTS_PER_STARTER = 8;
|
|
16677
16723
|
var XI_SIZE = 11;
|
|
@@ -16715,10 +16761,10 @@ function StartingXiGame({
|
|
|
16715
16761
|
lockAtUtc
|
|
16716
16762
|
}) {
|
|
16717
16763
|
const t = ui.games.startingXi;
|
|
16718
|
-
const [slotPlayers, setSlotPlayers] = (0,
|
|
16719
|
-
const [active, setActive] = (0,
|
|
16720
|
-
const [query, setQuery] = (0,
|
|
16721
|
-
const searchId = (0,
|
|
16764
|
+
const [slotPlayers, setSlotPlayers] = (0, import_react109.useState)(() => Array(XI_SIZE).fill(null));
|
|
16765
|
+
const [active, setActive] = (0, import_react109.useState)(0);
|
|
16766
|
+
const [query, setQuery] = (0, import_react109.useState)("");
|
|
16767
|
+
const searchId = (0, import_react109.useId)();
|
|
16722
16768
|
const clientState = parseClientState8(result?.clientStateJson);
|
|
16723
16769
|
const alreadyPlayed = result?.alreadyPlayed === true;
|
|
16724
16770
|
const header = /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
@@ -16857,7 +16903,7 @@ function StartingXiGame({
|
|
|
16857
16903
|
}
|
|
16858
16904
|
|
|
16859
16905
|
// src/components/games/StatLadderGame.tsx
|
|
16860
|
-
var
|
|
16906
|
+
var import_react110 = require("react");
|
|
16861
16907
|
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
16862
16908
|
function ladderClue(ladder) {
|
|
16863
16909
|
const mystery = ladder.find((r) => r.rank === 2);
|
|
@@ -16894,9 +16940,9 @@ function StatLadderGame({
|
|
|
16894
16940
|
onBack
|
|
16895
16941
|
}) {
|
|
16896
16942
|
const t = ui.games.statLadder;
|
|
16897
|
-
const [query, setQuery] = (0,
|
|
16898
|
-
const [selectedId, setSelectedId] = (0,
|
|
16899
|
-
const searchId = (0,
|
|
16943
|
+
const [query, setQuery] = (0, import_react110.useState)("");
|
|
16944
|
+
const [selectedId, setSelectedId] = (0, import_react110.useState)(null);
|
|
16945
|
+
const searchId = (0, import_react110.useId)();
|
|
16900
16946
|
const clientState = parseClientState9(result?.clientStateJson);
|
|
16901
16947
|
const revealed = clientState != null;
|
|
16902
16948
|
const header = /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(GameHeader, { title: gameTitle({ gameId: "stat-ladder" }, ui.games.titles), eyebrow: t.eyebrow, onBack, backLabel: ui.back });
|
|
@@ -17102,8 +17148,8 @@ function GameScreenHost({
|
|
|
17102
17148
|
ui
|
|
17103
17149
|
}) {
|
|
17104
17150
|
const { gameId, fixtureId, gameDay = "", lockAtUtc = null } = selected;
|
|
17105
|
-
const [configJson, setConfigJson] = (0,
|
|
17106
|
-
(0,
|
|
17151
|
+
const [configJson, setConfigJson] = (0, import_react111.useState)(null);
|
|
17152
|
+
(0, import_react111.useEffect)(() => {
|
|
17107
17153
|
setConfigJson(null);
|
|
17108
17154
|
if (!conversation) return;
|
|
17109
17155
|
let cancelled = false;
|
|
@@ -17126,12 +17172,12 @@ function GameScreenHost({
|
|
|
17126
17172
|
fixtureId: fixtureId || void 0,
|
|
17127
17173
|
locale: ui.hostTag
|
|
17128
17174
|
});
|
|
17129
|
-
(0,
|
|
17175
|
+
(0, import_react111.useEffect)(() => {
|
|
17130
17176
|
if (conversation) hydrate();
|
|
17131
17177
|
}, [conversation, gameId]);
|
|
17132
|
-
const hydrateRef = (0,
|
|
17178
|
+
const hydrateRef = (0, import_react111.useRef)(hydrate);
|
|
17133
17179
|
hydrateRef.current = hydrate;
|
|
17134
|
-
(0,
|
|
17180
|
+
(0, import_react111.useEffect)(() => {
|
|
17135
17181
|
if (!FIXTURE_GAME_IDS.has(gameId)) return;
|
|
17136
17182
|
if (rawStatus !== "pending") return;
|
|
17137
17183
|
const timerId = setInterval(() => {
|
|
@@ -17244,7 +17290,7 @@ function GameScreenHost({
|
|
|
17244
17290
|
}
|
|
17245
17291
|
|
|
17246
17292
|
// src/components/Leaderboard.tsx
|
|
17247
|
-
var
|
|
17293
|
+
var import_react112 = require("react");
|
|
17248
17294
|
|
|
17249
17295
|
// src/components/LeaderboardRow.tsx
|
|
17250
17296
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
@@ -17331,7 +17377,7 @@ function Leaderboard({
|
|
|
17331
17377
|
ui,
|
|
17332
17378
|
onPlay
|
|
17333
17379
|
}) {
|
|
17334
|
-
const [segment, setSegment] = (0,
|
|
17380
|
+
const [segment, setSegment] = (0, import_react112.useState)("weekly");
|
|
17335
17381
|
const myRow = segment === "weekly" ? data.myWeeklyRow : data.myAllTimeRow;
|
|
17336
17382
|
const offBoard = myRow !== null && myRow !== void 0 && myRow.rank === -1;
|
|
17337
17383
|
const isEmpty = segment === "weekly" ? data.weeklyTop.length === 0 : data.allTimeTop.length === 0;
|
|
@@ -17436,9 +17482,9 @@ function GamesPanel({
|
|
|
17436
17482
|
leaderboardLoading,
|
|
17437
17483
|
refreshHub
|
|
17438
17484
|
}) {
|
|
17439
|
-
const [selected, setSelected] = (0,
|
|
17440
|
-
const [segment, setSegment] = (0,
|
|
17441
|
-
(0,
|
|
17485
|
+
const [selected, setSelected] = (0, import_react113.useState)(null);
|
|
17486
|
+
const [segment, setSegment] = (0, import_react113.useState)("play");
|
|
17487
|
+
(0, import_react113.useEffect)(() => {
|
|
17442
17488
|
ensureGamesFonts();
|
|
17443
17489
|
}, []);
|
|
17444
17490
|
if (!loggedIn) return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(GamesLoginWall, { ui });
|
|
@@ -17502,10 +17548,10 @@ function GamesPanel({
|
|
|
17502
17548
|
}
|
|
17503
17549
|
|
|
17504
17550
|
// src/components/FavouritesPanel.tsx
|
|
17505
|
-
var
|
|
17551
|
+
var import_react116 = require("react");
|
|
17506
17552
|
|
|
17507
17553
|
// src/components/FavouriteChips.tsx
|
|
17508
|
-
var
|
|
17554
|
+
var import_react114 = require("react");
|
|
17509
17555
|
var import_jsx_runtime144 = require("react/jsx-runtime");
|
|
17510
17556
|
async function toggleWithNotice(controller, kind, id, onNotice) {
|
|
17511
17557
|
const outcome = await controller.toggle(kind, id);
|
|
@@ -17551,12 +17597,12 @@ function Group({ title, entities, sport, ui, controller, onNotice }) {
|
|
|
17551
17597
|
] });
|
|
17552
17598
|
}
|
|
17553
17599
|
function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNotice }) {
|
|
17554
|
-
const [confirming, setConfirming] = (0,
|
|
17600
|
+
const [confirming, setConfirming] = (0, import_react114.useState)(false);
|
|
17555
17601
|
const data = controller.data;
|
|
17556
|
-
(0,
|
|
17602
|
+
(0, import_react114.useEffect)(() => {
|
|
17557
17603
|
setConfirming(false);
|
|
17558
17604
|
}, [sport]);
|
|
17559
|
-
(0,
|
|
17605
|
+
(0, import_react114.useEffect)(() => {
|
|
17560
17606
|
if (!confirming) return;
|
|
17561
17607
|
const onPointerDown = (e) => {
|
|
17562
17608
|
if (!(e.target instanceof Element) || !e.target.closest("[data-fav-confirm]")) setConfirming(false);
|
|
@@ -17610,21 +17656,21 @@ function FavouriteChips({ controller, ui, sport, sportLabel: sportLabel2, onNoti
|
|
|
17610
17656
|
}
|
|
17611
17657
|
|
|
17612
17658
|
// src/components/FavouritesSearch.tsx
|
|
17613
|
-
var
|
|
17659
|
+
var import_react115 = require("react");
|
|
17614
17660
|
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
17615
17661
|
var MIN_LETTERS = 2;
|
|
17616
17662
|
var MAX_LENGTH = 64;
|
|
17617
17663
|
var DEBOUNCE_MS = 250;
|
|
17618
17664
|
function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
17619
|
-
const [query, setQuery] = (0,
|
|
17620
|
-
const [answer, setAnswer] = (0,
|
|
17621
|
-
const controllerRef = (0,
|
|
17665
|
+
const [query, setQuery] = (0, import_react115.useState)("");
|
|
17666
|
+
const [answer, setAnswer] = (0, import_react115.useState)(null);
|
|
17667
|
+
const controllerRef = (0, import_react115.useRef)(controller);
|
|
17622
17668
|
controllerRef.current = controller;
|
|
17623
17669
|
const trimmed = query.trim();
|
|
17624
17670
|
const queryKey = `${sport}|${trimmed}`;
|
|
17625
17671
|
const results2 = answer?.key === queryKey ? answer.rows : [];
|
|
17626
17672
|
const settled = answer?.key === queryKey;
|
|
17627
|
-
(0,
|
|
17673
|
+
(0, import_react115.useEffect)(() => {
|
|
17628
17674
|
setAnswer(null);
|
|
17629
17675
|
if (trimmed.length < MIN_LETTERS) return;
|
|
17630
17676
|
let cancelled = false;
|
|
@@ -17687,13 +17733,13 @@ function FavouritesSearch({ controller, ui, sport, onNotice }) {
|
|
|
17687
17733
|
// src/components/FavouritesPanel.tsx
|
|
17688
17734
|
var import_jsx_runtime146 = require("react/jsx-runtime");
|
|
17689
17735
|
function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
17690
|
-
const [notice, setNotice] = (0,
|
|
17691
|
-
const refreshRef = (0,
|
|
17736
|
+
const [notice, setNotice] = (0, import_react116.useState)(null);
|
|
17737
|
+
const refreshRef = (0, import_react116.useRef)(controller.refresh);
|
|
17692
17738
|
refreshRef.current = controller.refresh;
|
|
17693
|
-
(0,
|
|
17739
|
+
(0, import_react116.useEffect)(() => {
|
|
17694
17740
|
void refreshRef.current();
|
|
17695
17741
|
}, []);
|
|
17696
|
-
(0,
|
|
17742
|
+
(0, import_react116.useEffect)(() => {
|
|
17697
17743
|
setNotice(null);
|
|
17698
17744
|
}, [sport]);
|
|
17699
17745
|
const sportLabel2 = sports.find((s) => s.sport === sport)?.label ?? sportLabel(ui, sport);
|
|
@@ -17719,11 +17765,11 @@ function FavouritesPanel({ controller, ui, sport, sports, onSportChange }) {
|
|
|
17719
17765
|
}
|
|
17720
17766
|
|
|
17721
17767
|
// src/components/PresetTools.tsx
|
|
17722
|
-
var
|
|
17768
|
+
var import_react117 = require("react");
|
|
17723
17769
|
var import_jsx_runtime147 = require("react/jsx-runtime");
|
|
17724
17770
|
function PresetToolModal({ title, closeLabel, onClose, children, footer, className }) {
|
|
17725
17771
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { restoreFocus: false });
|
|
17726
|
-
const titleId = (0,
|
|
17772
|
+
const titleId = (0, import_react117.useId)();
|
|
17727
17773
|
return /* @__PURE__ */ (0, import_jsx_runtime147.jsx)("div", { className: className ? `ss-w-tool-backdrop ${className}` : "ss-w-tool-backdrop", children: /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { ref: dialogRef, className: "ss-w-tool", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
17728
17774
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
17729
17775
|
/* @__PURE__ */ (0, import_jsx_runtime147.jsx)("h2", { id: titleId, className: "ss-w-tool-title", children: title }),
|
|
@@ -17773,9 +17819,9 @@ function BuildComboTool({ grid, strings, streaming, formatKickoff, initialTotal,
|
|
|
17773
17819
|
const totalOptions = comboTotals(grid);
|
|
17774
17820
|
const totals = totalOptions.map((o) => o.value);
|
|
17775
17821
|
const legChoices = comboLegChoices(grid);
|
|
17776
|
-
const [total, setTotal] = (0,
|
|
17777
|
-
const [legs, setLegs] = (0,
|
|
17778
|
-
const [announcement, setAnnouncement] = (0,
|
|
17822
|
+
const [total, setTotal] = (0, import_react117.useState)(() => nearest(totals, initialTotal));
|
|
17823
|
+
const [legs, setLegs] = (0, import_react117.useState)(() => legsForTotal(grid, nearest(totals, initialTotal), clampLegs(legChoices, initialLegs)));
|
|
17824
|
+
const [announcement, setAnnouncement] = (0, import_react117.useState)("");
|
|
17779
17825
|
const cell2 = findCombo(grid, total, legs);
|
|
17780
17826
|
const minLegs = legChoices[0] ?? legs;
|
|
17781
17827
|
const maxLegs = legChoices[legChoices.length - 1] ?? legs;
|
|
@@ -17814,10 +17860,10 @@ function FavouritesSheet({ ui, controller, sport, sports, onSportChange, onClose
|
|
|
17814
17860
|
}
|
|
17815
17861
|
|
|
17816
17862
|
// src/components/BuilderPanel.tsx
|
|
17817
|
-
var
|
|
17863
|
+
var import_react119 = require("react");
|
|
17818
17864
|
|
|
17819
17865
|
// src/components/dashboard/v8/SentenceBuilder.tsx
|
|
17820
|
-
var
|
|
17866
|
+
var import_react118 = require("react");
|
|
17821
17867
|
var import_widget_sdk39 = require("@sensiblestats/widget-sdk");
|
|
17822
17868
|
var import_jsx_runtime149 = require("react/jsx-runtime");
|
|
17823
17869
|
var TOTALS = ["any", "3", "5", "10", "20", "50"];
|
|
@@ -17858,9 +17904,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17858
17904
|
const opening = openingGames(preset);
|
|
17859
17905
|
const gamesOptions = opening.options;
|
|
17860
17906
|
const marketOptions = usableMarkets(preset);
|
|
17861
|
-
const [fingerprint] = (0,
|
|
17862
|
-
const [keepsMarket] = (0,
|
|
17863
|
-
const [saved] = (0,
|
|
17907
|
+
const [fingerprint] = (0, import_react118.useState)(() => JSON.stringify(preset));
|
|
17908
|
+
const [keepsMarket] = (0, import_react118.useState)(keepMarket);
|
|
17909
|
+
const [saved] = (0, import_react118.useState)(() => {
|
|
17864
17910
|
const kept = keepsMarket ? void 0 : memory3?.savedView(sport);
|
|
17865
17911
|
return kept && kept.fingerprint === fingerprint ? kept : null;
|
|
17866
17912
|
});
|
|
@@ -17875,9 +17921,9 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17875
17921
|
// The server never widens by itself: an all-games preset with no ids asks for it.
|
|
17876
17922
|
widen: opening.option ? opening.option.matchIds.length === 0 : preset.gamesScope === "all" && preset.matchIds.length === 0
|
|
17877
17923
|
};
|
|
17878
|
-
const [view, setView] = (0,
|
|
17879
|
-
const autoWidened = (0,
|
|
17880
|
-
const [widenedNote, setWidenedNote] = (0,
|
|
17924
|
+
const [view, setView] = (0, import_react118.useState)(() => saved?.view ?? openingView);
|
|
17925
|
+
const autoWidened = (0, import_react118.useRef)(false);
|
|
17926
|
+
const [widenedNote, setWidenedNote] = (0, import_react118.useState)(saved?.widenedNote ?? false);
|
|
17881
17927
|
const track = useTrack();
|
|
17882
17928
|
const requestFor = (v, extra) => ({
|
|
17883
17929
|
sport,
|
|
@@ -17893,18 +17939,18 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17893
17939
|
...operatorUserId ? { operatorUserId } : {},
|
|
17894
17940
|
...anonymousUserId ? { anonymousUserId } : {}
|
|
17895
17941
|
});
|
|
17896
|
-
const [editing, setEditing] = (0,
|
|
17897
|
-
const [draft, setDraft] = (0,
|
|
17898
|
-
const [invalid, setInvalid] = (0,
|
|
17899
|
-
const inputRef = (0,
|
|
17900
|
-
const pencilRef = (0,
|
|
17901
|
-
const noteId = (0,
|
|
17902
|
-
const customId = (0,
|
|
17903
|
-
(0,
|
|
17942
|
+
const [editing, setEditing] = (0, import_react118.useState)(false);
|
|
17943
|
+
const [draft, setDraft] = (0, import_react118.useState)("");
|
|
17944
|
+
const [invalid, setInvalid] = (0, import_react118.useState)(null);
|
|
17945
|
+
const inputRef = (0, import_react118.useRef)(null);
|
|
17946
|
+
const pencilRef = (0, import_react118.useRef)(null);
|
|
17947
|
+
const noteId = (0, import_react118.useId)();
|
|
17948
|
+
const customId = (0, import_react118.useId)();
|
|
17949
|
+
(0, import_react118.useEffect)(() => {
|
|
17904
17950
|
if (editing) inputRef.current?.focus();
|
|
17905
17951
|
}, [editing]);
|
|
17906
17952
|
const customLabel = (c) => c.format === oddsFormat ? c.text : c.decimal;
|
|
17907
|
-
(0,
|
|
17953
|
+
(0, import_react118.useEffect)(() => {
|
|
17908
17954
|
if (view.legs === 1) {
|
|
17909
17955
|
setEditing(false);
|
|
17910
17956
|
setDraft("");
|
|
@@ -17920,16 +17966,16 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17920
17966
|
setEditing(false);
|
|
17921
17967
|
pencilRef.current?.focus();
|
|
17922
17968
|
};
|
|
17923
|
-
const [first] = (0,
|
|
17969
|
+
const [first] = (0, import_react118.useState)(() => requestFor(view));
|
|
17924
17970
|
const { grid, answeredFor, status: status2, confirmed, request } = useBuilderGrid({ conversation, locale: ui.hostTag, memory: memory3, initial: first });
|
|
17925
|
-
const [shown2, setShown] = (0,
|
|
17971
|
+
const [shown2, setShown] = (0, import_react118.useState)(null);
|
|
17926
17972
|
if (grid === null) {
|
|
17927
17973
|
if (shown2 !== null && status2 === "ready") setShown(null);
|
|
17928
17974
|
} else if (answeredFor && (shown2?.seen !== grid || shown2.seenReq !== answeredFor)) {
|
|
17929
17975
|
setShown(shownAfter(shown2, grid, answeredFor));
|
|
17930
17976
|
}
|
|
17931
|
-
const lastRequest = (0,
|
|
17932
|
-
(0,
|
|
17977
|
+
const lastRequest = (0, import_react118.useRef)(first);
|
|
17978
|
+
(0, import_react118.useEffect)(() => {
|
|
17933
17979
|
void request(lastRequest.current);
|
|
17934
17980
|
}, [request]);
|
|
17935
17981
|
const send = (req) => {
|
|
@@ -17967,7 +18013,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17967
18013
|
};
|
|
17968
18014
|
const canNarrow = preset.matchIds.length > 0;
|
|
17969
18015
|
const ready = status2 === "ready" && grid !== null;
|
|
17970
|
-
const [tapped, setTapped] = (0,
|
|
18016
|
+
const [tapped, setTapped] = (0, import_react118.useState)(null);
|
|
17971
18017
|
const busy = tapped !== null && status2 === "loading" && shown2 !== null;
|
|
17972
18018
|
const g = ready ? shown2?.grid ?? grid : busy ? shown2.grid : null;
|
|
17973
18019
|
const suggested = g?.status === "miss" || g?.nearest === true ? g.legCountThatLands : null;
|
|
@@ -17976,8 +18022,8 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17976
18022
|
...[preset.legs, suggested].filter((n) => n !== null && n > 4)
|
|
17977
18023
|
])).sort((a, b) => a - b);
|
|
17978
18024
|
const rows = g && g.status === "ok" ? legsOf(g, sport) : null;
|
|
17979
|
-
const sectionRef = (0,
|
|
17980
|
-
(0,
|
|
18025
|
+
const sectionRef = (0, import_react118.useRef)(null);
|
|
18026
|
+
(0, import_react118.useEffect)(() => {
|
|
17981
18027
|
if (tapped === null || status2 !== "ready") return;
|
|
17982
18028
|
setTapped(null);
|
|
17983
18029
|
const root = sectionRef.current;
|
|
@@ -17994,14 +18040,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
17994
18040
|
}, [tapped, status2]);
|
|
17995
18041
|
const rowSlip = rows ? guardLegsPreMatch(slip, rows, ui) : slip;
|
|
17996
18042
|
useNextKickoffRender(rows ? rows.map((l) => l.kickoffUtc) : []);
|
|
17997
|
-
const [startedNote, setStartedNote] = (0,
|
|
18043
|
+
const [startedNote, setStartedNote] = (0, import_react118.useState)(false);
|
|
17998
18044
|
const anyStarted = rows !== null && rows.some((l) => !preMatchOpen(l.kickoffUtc, Date.now()));
|
|
17999
|
-
(0,
|
|
18045
|
+
(0, import_react118.useEffect)(() => {
|
|
18000
18046
|
if (startedNote && status2 === "ready" && !anyStarted) setStartedNote(false);
|
|
18001
18047
|
}, [startedNote, status2, anyStarted]);
|
|
18002
18048
|
const market = rows?.[0]?.market;
|
|
18003
|
-
const [seen2, setSeen] = (0,
|
|
18004
|
-
(0,
|
|
18049
|
+
const [seen2, setSeen] = (0, import_react118.useState)(null);
|
|
18050
|
+
(0, import_react118.useEffect)(() => {
|
|
18005
18051
|
if (market) setSeen(market);
|
|
18006
18052
|
}, [market]);
|
|
18007
18053
|
const marketName = view.marketKey === null ? null : marketOptions?.find((m) => m.key === view.marketKey)?.label ?? market ?? seen2;
|
|
@@ -18045,14 +18091,14 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, keepMarket
|
|
|
18045
18091
|
};
|
|
18046
18092
|
};
|
|
18047
18093
|
const canWiden = gamesOptions === null || allGames !== null;
|
|
18048
|
-
(0,
|
|
18094
|
+
(0, import_react118.useEffect)(() => {
|
|
18049
18095
|
if (!empty2 || !singles || widened || !canWiden || autoWidened.current) return;
|
|
18050
18096
|
autoWidened.current = true;
|
|
18051
18097
|
const next = { ...view, widen: true, matchIds: [], gamesId: allGames ? allGames.id : view.gamesId };
|
|
18052
18098
|
commit(next, true);
|
|
18053
18099
|
send(requestFor(next));
|
|
18054
18100
|
}, [empty2, singles, widened, canWiden, view]);
|
|
18055
|
-
(0,
|
|
18101
|
+
(0, import_react118.useEffect)(() => {
|
|
18056
18102
|
if (coolOff) onCoolOff?.(sport);
|
|
18057
18103
|
}, [coolOff, onCoolOff, sport]);
|
|
18058
18104
|
if (coolOff) return null;
|
|
@@ -18252,7 +18298,7 @@ function BuilderPanel({ options, sport, onSportChange, ui, slip, onCoolOff, onHa
|
|
|
18252
18298
|
const scope = useSportScope();
|
|
18253
18299
|
const active = options.find((o) => o.sport === sport) ?? options[0];
|
|
18254
18300
|
const handingOff = active?.keepMarket === true;
|
|
18255
|
-
(0,
|
|
18301
|
+
(0, import_react119.useEffect)(() => {
|
|
18256
18302
|
if (handingOff) onHandOffMounted?.();
|
|
18257
18303
|
}, [handingOff]);
|
|
18258
18304
|
if (!active) return null;
|
|
@@ -18524,10 +18570,10 @@ function Squad({ squad, loading, ui, view, onToggleView, stats, statsLoading, se
|
|
|
18524
18570
|
}
|
|
18525
18571
|
|
|
18526
18572
|
// src/components/PlayerPhoto.tsx
|
|
18527
|
-
var
|
|
18573
|
+
var import_react120 = require("react");
|
|
18528
18574
|
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
18529
18575
|
function PlayerPhoto({ photoUrl, jerseyNumber, size }) {
|
|
18530
|
-
const [failed, setFailed] = (0,
|
|
18576
|
+
const [failed, setFailed] = (0, import_react120.useState)(false);
|
|
18531
18577
|
const box = { width: size, height: size };
|
|
18532
18578
|
if (photoUrl && !failed) {
|
|
18533
18579
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("img", { className: "ss-w-pd-photo", style: box, src: photoUrl, alt: "", "aria-hidden": "true", onError: () => setFailed(true) });
|
|
@@ -18562,7 +18608,7 @@ function MiniPitch({ positionCode }) {
|
|
|
18562
18608
|
}
|
|
18563
18609
|
|
|
18564
18610
|
// src/components/PerformanceBars.tsx
|
|
18565
|
-
var
|
|
18611
|
+
var import_react121 = require("react");
|
|
18566
18612
|
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
18567
18613
|
var GROUPS = ["shooting", "passing", "possession", "defending"];
|
|
18568
18614
|
function finite4(v) {
|
|
@@ -18608,7 +18654,7 @@ function unrankedLine(ui, reason) {
|
|
|
18608
18654
|
}
|
|
18609
18655
|
}
|
|
18610
18656
|
function PerformanceBars({ performance, competitionName, strings }) {
|
|
18611
|
-
const [mode, setMode] = (0,
|
|
18657
|
+
const [mode, setMode] = (0, import_react121.useState)("total");
|
|
18612
18658
|
const labelled = performance.metrics.filter((m) => Object.prototype.hasOwnProperty.call(strings.perfMetric, m.key));
|
|
18613
18659
|
if (!labelled.some((m) => valueOf(m, "total") !== null || valueOf(m, "per90") !== null)) return null;
|
|
18614
18660
|
const subtitle = !performance.ranked ? unrankedLine(strings, performance.unrankedReason) : competitionName ? strings.perfRankedAgainst(competitionName, performance.positionGroup) : null;
|
|
@@ -18817,8 +18863,8 @@ function SettingsSheet({ ui, onClose }) {
|
|
|
18817
18863
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
18818
18864
|
var FULLSCREEN_QUERY = "(max-width: 639px)";
|
|
18819
18865
|
function useIsModal() {
|
|
18820
|
-
const [modal, setModal] = (0,
|
|
18821
|
-
(0,
|
|
18866
|
+
const [modal, setModal] = (0, import_react122.useState)(false);
|
|
18867
|
+
(0, import_react122.useEffect)(() => {
|
|
18822
18868
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
18823
18869
|
const mql = window.matchMedia(FULLSCREEN_QUERY);
|
|
18824
18870
|
const sync = () => setModal(mql.matches);
|
|
@@ -18832,12 +18878,12 @@ var HIDDEN_LAYER_STYLE = { position: "absolute", inset: 0, visibility: "hidden",
|
|
|
18832
18878
|
var SQUAD_LAYER_STYLE = { display: "flex", flexDirection: "column", flex: 1, minHeight: 0 };
|
|
18833
18879
|
function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, schedule, gamesResult, leaderboardResult, clubFixturesResult, clubStandingsResult, clubSquadResult, clubSquadStatsResult, clubPlayerDetailResult, loggedIn, conversation, presetGrid, favouritesEnabled, favourites, builder, onCloseRequested, onRegisterBack }) {
|
|
18834
18880
|
const { state, close, stop, send, reset } = controller;
|
|
18835
|
-
const [squadView, setSquadView] = (0,
|
|
18836
|
-
const [selectedPlayerId, setSelectedPlayerId] = (0,
|
|
18881
|
+
const [squadView, setSquadView] = (0, import_react122.useState)("roster");
|
|
18882
|
+
const [selectedPlayerId, setSelectedPlayerId] = (0, import_react122.useState)(null);
|
|
18837
18883
|
const clearPlayerDetail = clubPlayerDetailResult?.clear;
|
|
18838
18884
|
const fetchPlayerDetail = clubPlayerDetailResult?.fetch;
|
|
18839
|
-
const squadLayerRef = (0,
|
|
18840
|
-
const squadScrollRef = (0,
|
|
18885
|
+
const squadLayerRef = (0, import_react122.useRef)(null);
|
|
18886
|
+
const squadScrollRef = (0, import_react122.useRef)(null);
|
|
18841
18887
|
const selectPlayer = (playerId) => {
|
|
18842
18888
|
squadScrollRef.current = squadLayerRef.current?.querySelector(".ss-w-mon-list")?.scrollTop ?? null;
|
|
18843
18889
|
setSelectedPlayerId(playerId);
|
|
@@ -18847,7 +18893,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18847
18893
|
setSelectedPlayerId(null);
|
|
18848
18894
|
clearPlayerDetail?.();
|
|
18849
18895
|
};
|
|
18850
|
-
(0,
|
|
18896
|
+
(0, import_react122.useLayoutEffect)(() => {
|
|
18851
18897
|
if (selectedPlayerId !== null || squadScrollRef.current === null) return;
|
|
18852
18898
|
const list = squadLayerRef.current?.querySelector(".ss-w-mon-list");
|
|
18853
18899
|
if (list) list.scrollTop = squadScrollRef.current;
|
|
@@ -18860,7 +18906,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18860
18906
|
const hasBuilder = !clubBrand && (builderOptions?.length ?? 0) > 0;
|
|
18861
18907
|
const tabs = monitor ?? (hasBuilder ? tabState : void 0);
|
|
18862
18908
|
const activeTab = tabs?.activeTab;
|
|
18863
|
-
(0,
|
|
18909
|
+
(0, import_react122.useEffect)(() => {
|
|
18864
18910
|
if (activeTab === "squad" || selectedPlayerId === null) return;
|
|
18865
18911
|
setSelectedPlayerId(null);
|
|
18866
18912
|
clearPlayerDetail?.();
|
|
@@ -18869,11 +18915,11 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18869
18915
|
const favouritesOpen = favouritesOffered && (favourites?.open ?? false);
|
|
18870
18916
|
const favouritesAskedOpen = favourites?.open ?? false;
|
|
18871
18917
|
const setFavouritesOpen = favourites?.onOpenChange;
|
|
18872
|
-
(0,
|
|
18918
|
+
(0, import_react122.useEffect)(() => {
|
|
18873
18919
|
if (favouritesAskedOpen && !favouritesOffered) setFavouritesOpen?.(false);
|
|
18874
18920
|
}, [favouritesAskedOpen, favouritesOffered, setFavouritesOpen]);
|
|
18875
18921
|
const storedTab = tabState?.activeTab;
|
|
18876
|
-
(0,
|
|
18922
|
+
(0, import_react122.useEffect)(() => {
|
|
18877
18923
|
const unreachable = storedTab === "builder" ? !hasBuilder : !monitor && storedTab !== void 0 && storedTab !== "chat";
|
|
18878
18924
|
if (unreachable) setMonitorTab?.("chat");
|
|
18879
18925
|
}, [storedTab, hasBuilder, monitor, setMonitorTab]);
|
|
@@ -18882,12 +18928,12 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18882
18928
|
const closeTab = tabs?.activeTab ?? "chat";
|
|
18883
18929
|
const lastMessage = state.messages[state.messages.length - 1];
|
|
18884
18930
|
const answering = state.isStreaming && !(lastMessage?.role === "assistant" && lastMessage.isGreeting);
|
|
18885
|
-
const closeWith = (0,
|
|
18931
|
+
const closeWith = (0, import_react122.useCallback)((method) => {
|
|
18886
18932
|
track({ name: "widget_close", method, tab: closeTab, answering });
|
|
18887
18933
|
if (onCloseRequested) onCloseRequested();
|
|
18888
18934
|
else close();
|
|
18889
18935
|
}, [track, closeTab, answering, close, onCloseRequested]);
|
|
18890
|
-
(0,
|
|
18936
|
+
(0, import_react122.useEffect)(() => {
|
|
18891
18937
|
const onKey = (e) => {
|
|
18892
18938
|
if (e.key === "Escape") closeWith("escape");
|
|
18893
18939
|
};
|
|
@@ -18903,80 +18949,80 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
18903
18949
|
tabs?.setActiveTab("chat");
|
|
18904
18950
|
send(text2, { grounding, source });
|
|
18905
18951
|
};
|
|
18906
|
-
(0,
|
|
18952
|
+
(0, import_react122.useEffect)(() => {
|
|
18907
18953
|
if (monitor && monitor.activeTab !== "chat" && state.isStreaming) monitor.markChatActivity();
|
|
18908
18954
|
}, [monitor, state.isStreaming, state.messages.length]);
|
|
18909
18955
|
const onChatTab = !tabs || tabs.activeTab === "chat";
|
|
18910
|
-
const inputRef = (0,
|
|
18911
|
-
const limitRef = (0,
|
|
18912
|
-
const typedSendRef = (0,
|
|
18913
|
-
const focusAfterCloseRef = (0,
|
|
18914
|
-
const [tool, setTool] = (0,
|
|
18915
|
-
const panelRef = (0,
|
|
18956
|
+
const inputRef = (0, import_react122.useRef)(null);
|
|
18957
|
+
const limitRef = (0, import_react122.useRef)(null);
|
|
18958
|
+
const typedSendRef = (0, import_react122.useRef)(false);
|
|
18959
|
+
const focusAfterCloseRef = (0, import_react122.useRef)(null);
|
|
18960
|
+
const [tool, setTool] = (0, import_react122.useState)(null);
|
|
18961
|
+
const panelRef = (0, import_react122.useRef)(null);
|
|
18916
18962
|
const settings = useOddsSettings();
|
|
18917
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
18963
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react122.useState)(false);
|
|
18918
18964
|
const hasSettings = settings.oddsOffered || !settings.themeLocked;
|
|
18919
|
-
const openSettings = (0,
|
|
18965
|
+
const openSettings = (0, import_react122.useCallback)(() => {
|
|
18920
18966
|
setTool(null);
|
|
18921
18967
|
setFavouritesOpen?.(false);
|
|
18922
18968
|
setSettingsOpen(true);
|
|
18923
18969
|
}, [setFavouritesOpen]);
|
|
18924
|
-
const closeSettings = (0,
|
|
18970
|
+
const closeSettings = (0, import_react122.useCallback)(() => {
|
|
18925
18971
|
setSettingsOpen(false);
|
|
18926
18972
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18927
18973
|
}, []);
|
|
18928
|
-
const openFavourites = (0,
|
|
18929
|
-
const closeFavourites = (0,
|
|
18974
|
+
const openFavourites = (0, import_react122.useCallback)(() => setFavouritesOpen?.(true), [setFavouritesOpen]);
|
|
18975
|
+
const closeFavourites = (0, import_react122.useCallback)(() => {
|
|
18930
18976
|
setFavouritesOpen?.(false);
|
|
18931
18977
|
panelRef.current?.querySelector(".ss-w-kebab")?.focus();
|
|
18932
18978
|
}, [setFavouritesOpen]);
|
|
18933
|
-
(0,
|
|
18979
|
+
(0, import_react122.useEffect)(() => {
|
|
18934
18980
|
if (!favouritesOpen) return;
|
|
18935
18981
|
setTool(null);
|
|
18936
18982
|
setSettingsOpen(false);
|
|
18937
18983
|
}, [favouritesOpen]);
|
|
18938
18984
|
const paused = isPaused(state.limit);
|
|
18939
|
-
(0,
|
|
18985
|
+
(0, import_react122.useEffect)(() => {
|
|
18940
18986
|
if (paused) setTool(null);
|
|
18941
18987
|
}, [paused]);
|
|
18942
|
-
(0,
|
|
18988
|
+
(0, import_react122.useEffect)(() => {
|
|
18943
18989
|
if (!paused) return;
|
|
18944
18990
|
if (typedSendRef.current) limitRef.current?.focus();
|
|
18945
18991
|
typedSendRef.current = false;
|
|
18946
18992
|
}, [paused]);
|
|
18947
|
-
const openTool = (0,
|
|
18993
|
+
const openTool = (0, import_react122.useCallback)((next) => {
|
|
18948
18994
|
setTool(next);
|
|
18949
18995
|
}, []);
|
|
18950
|
-
const toolsValue = (0,
|
|
18996
|
+
const toolsValue = (0, import_react122.useMemo)(
|
|
18951
18997
|
() => presetGrid && !paused ? { openBuilder: (total, legs) => openTool({ total, legs }), changeLabel: ui.presets.changeCombo } : null,
|
|
18952
18998
|
[presetGrid, paused, openTool, ui.presets.changeCombo]
|
|
18953
18999
|
);
|
|
18954
|
-
const closeTool = (0,
|
|
19000
|
+
const closeTool = (0, import_react122.useCallback)(() => {
|
|
18955
19001
|
focusAfterCloseRef.current = "composer";
|
|
18956
19002
|
setTool(null);
|
|
18957
19003
|
}, []);
|
|
18958
|
-
const sendAsk = (0,
|
|
19004
|
+
const sendAsk = (0, import_react122.useCallback)((ask) => {
|
|
18959
19005
|
focusAfterCloseRef.current = "composer";
|
|
18960
19006
|
setTool(null);
|
|
18961
19007
|
tabs?.setActiveTab("chat");
|
|
18962
19008
|
send(ask.message, { displayText: ask.displayText, preset: ask.preset, source: "preset" });
|
|
18963
19009
|
}, [tabs, send]);
|
|
18964
|
-
const formatKickoff = (0,
|
|
19010
|
+
const formatKickoff = (0, import_react122.useCallback)((kickoffUtc) => {
|
|
18965
19011
|
const k = ui.bettingKickoff(kickoffUtc);
|
|
18966
19012
|
return `${k.dayLabel} ${k.time}`;
|
|
18967
19013
|
}, [ui]);
|
|
18968
|
-
(0,
|
|
19014
|
+
(0, import_react122.useEffect)(() => {
|
|
18969
19015
|
if (tool) return;
|
|
18970
19016
|
const target = focusAfterCloseRef.current;
|
|
18971
19017
|
focusAfterCloseRef.current = null;
|
|
18972
19018
|
if (target === "composer") inputRef.current?.focus();
|
|
18973
19019
|
}, [tool]);
|
|
18974
|
-
(0,
|
|
19020
|
+
(0, import_react122.useEffect)(() => {
|
|
18975
19021
|
if (!tool || onChatTab && presetGrid) return;
|
|
18976
19022
|
focusAfterCloseRef.current = "composer";
|
|
18977
19023
|
setTool(null);
|
|
18978
19024
|
}, [tool, onChatTab, presetGrid]);
|
|
18979
|
-
const backRef = (0,
|
|
19025
|
+
const backRef = (0, import_react122.useRef)(() => false);
|
|
18980
19026
|
backRef.current = () => {
|
|
18981
19027
|
if (favouritesOpen) {
|
|
18982
19028
|
closeFavourites();
|
|
@@ -19000,7 +19046,7 @@ function ChatPanel({ controller, ui, slip, onDashboardTap, monitor, discovery, s
|
|
|
19000
19046
|
}
|
|
19001
19047
|
return false;
|
|
19002
19048
|
};
|
|
19003
|
-
(0,
|
|
19049
|
+
(0, import_react122.useEffect)(() => {
|
|
19004
19050
|
if (!onRegisterBack) return;
|
|
19005
19051
|
onRegisterBack(() => backRef.current());
|
|
19006
19052
|
return () => onRegisterBack(null);
|
|
@@ -22070,12 +22116,12 @@ function injectStyles(root) {
|
|
|
22070
22116
|
function StatsWidget(props) {
|
|
22071
22117
|
const injectedClient = "client" in props ? props.client : void 0;
|
|
22072
22118
|
const cfg = props.config;
|
|
22073
|
-
const built = (0,
|
|
22074
|
-
const trackingRef = (0,
|
|
22075
|
-
const track = (0,
|
|
22076
|
-
const eventTextRef = (0,
|
|
22119
|
+
const built = (0, import_react123.useMemo)(() => buildClient(props), [injectedClient, cfg?.operatorId, cfg?.publicKey, cfg?.baseUrl]);
|
|
22120
|
+
const trackingRef = (0, import_react123.useRef)({ envelope: { operatorId: "", widgetVersion: WIDGET_REACT_VERSION } });
|
|
22121
|
+
const track = (0, import_react123.useMemo)(() => createTracker(() => trackingRef.current), []);
|
|
22122
|
+
const eventTextRef = (0, import_react123.useRef)(false);
|
|
22077
22123
|
eventTextRef.current = cfg?.eventText === true;
|
|
22078
|
-
const logger = (0,
|
|
22124
|
+
const logger = (0, import_react123.useMemo)(() => {
|
|
22079
22125
|
if (!built) return null;
|
|
22080
22126
|
const raw = built.client.createEventLogger({
|
|
22081
22127
|
operatorUserId: cfg?.userContext?.operatorUserId,
|
|
@@ -22085,27 +22131,27 @@ function StatsWidget(props) {
|
|
|
22085
22131
|
}, [built?.client, track]);
|
|
22086
22132
|
const widgetStrings = useWidgetStrings(cfg, built?.conversation ?? null);
|
|
22087
22133
|
const stringsPending = widgetStrings.strings === void 0;
|
|
22088
|
-
const ui = (0,
|
|
22134
|
+
const ui = (0, import_react123.useMemo)(
|
|
22089
22135
|
() => normalizeUi(props.config ?? { operatorId: "", publicKey: "" }, widgetStrings.strings ?? BUNDLED),
|
|
22090
22136
|
[props.config, widgetStrings.strings]
|
|
22091
22137
|
);
|
|
22092
22138
|
const oddsSettings = useOddsSettingsState(ui, built?.conversation, cfg?.operatorId || "default");
|
|
22093
|
-
const rootRef = (0,
|
|
22094
|
-
const introDoneRef = (0,
|
|
22095
|
-
const markIntroDone = (0,
|
|
22139
|
+
const rootRef = (0, import_react123.useRef)(null);
|
|
22140
|
+
const introDoneRef = (0, import_react123.useRef)(false);
|
|
22141
|
+
const markIntroDone = (0, import_react123.useCallback)(() => {
|
|
22096
22142
|
introDoneRef.current = true;
|
|
22097
22143
|
}, []);
|
|
22098
22144
|
const language = injectedClient ? void 0 : hostTag(cfg);
|
|
22099
22145
|
const threadLanguage = familyOf(language);
|
|
22100
22146
|
const convStorageKey = `ss-w-conv:${cfg?.operatorId ?? ""}:${cfg?.userContext?.operatorUserId ?? "anon"}${threadLanguage ? `:lang=${threadLanguage}` : ""}`;
|
|
22101
|
-
const sportScope = (0,
|
|
22147
|
+
const sportScope = (0, import_react123.useMemo)(
|
|
22102
22148
|
() => ({ operatorId: cfg?.operatorId ?? "", operatorUserId: cfg?.userContext?.operatorUserId, anonymousUserId: cfg?.userContext?.anonymousUserId }),
|
|
22103
22149
|
[cfg?.operatorId, cfg?.userContext?.operatorUserId, cfg?.userContext?.anonymousUserId]
|
|
22104
22150
|
);
|
|
22105
|
-
const chatTracking = (0,
|
|
22151
|
+
const chatTracking = (0, import_react123.useMemo)(() => ({ track, eventText: () => eventTextRef.current }), [track]);
|
|
22106
22152
|
const controller = useChatStream(built?.conversation ?? emptyConversation(), ui.starters, built ? ui.greetingMessage : void 0, convStorageKey, cfg?.page, sportScope, language, chatTracking, injectedClient ? oddsSettings.userOddsFormat : oddsSettings.oddsFormat);
|
|
22107
22153
|
const panelOpen = controller.state.isOpen && !stringsPending;
|
|
22108
|
-
const liveCardWatches = (0,
|
|
22154
|
+
const liveCardWatches = (0, import_react123.useMemo)(() => {
|
|
22109
22155
|
const seen2 = /* @__PURE__ */ new Set();
|
|
22110
22156
|
const out = [];
|
|
22111
22157
|
for (const msg of controller.state.messages) {
|
|
@@ -22131,19 +22177,19 @@ function StatsWidget(props) {
|
|
|
22131
22177
|
});
|
|
22132
22178
|
const operatorUserId = cfg?.userContext?.operatorUserId;
|
|
22133
22179
|
const anonymousUserId = cfg?.userContext?.anonymousUserId;
|
|
22134
|
-
const getSchedule = (0,
|
|
22180
|
+
const getSchedule = (0, import_react123.useCallback)(
|
|
22135
22181
|
(localDate, utcOffsetMinutes) => built ? built.conversation.getSchedule(localDate, utcOffsetMinutes, operatorUserId, anonymousUserId) : Promise.resolve(null),
|
|
22136
22182
|
[built, operatorUserId, anonymousUserId]
|
|
22137
22183
|
);
|
|
22138
|
-
const getStates = (0,
|
|
22184
|
+
const getStates = (0, import_react123.useCallback)(
|
|
22139
22185
|
(matchIds, nbaGameIds, nflGameIds, tennisMatches) => built ? built.conversation.getStates(matchIds, nbaGameIds, nflGameIds, requestTag, tennisMatches) : Promise.resolve(null),
|
|
22140
22186
|
[built, requestTag]
|
|
22141
22187
|
);
|
|
22142
|
-
const getTennisPrices = (0,
|
|
22188
|
+
const getTennisPrices = (0, import_react123.useCallback)(
|
|
22143
22189
|
(keys) => built ? built.conversation.getStates([], [], [], requestTag, [], keys).then((p) => p?.tennisPrices ?? null) : Promise.resolve(null),
|
|
22144
22190
|
[built, requestTag]
|
|
22145
22191
|
);
|
|
22146
|
-
const pinnedMatchIds = (0,
|
|
22192
|
+
const pinnedMatchIds = (0, import_react123.useMemo)(
|
|
22147
22193
|
() => footballMatchPinIds(monitor.pins),
|
|
22148
22194
|
[monitor.pins]
|
|
22149
22195
|
);
|
|
@@ -22157,13 +22203,13 @@ function StatsWidget(props) {
|
|
|
22157
22203
|
pinnedMatchIds,
|
|
22158
22204
|
timeZone: ui.timeZone
|
|
22159
22205
|
});
|
|
22160
|
-
const offeredSports = (0,
|
|
22206
|
+
const offeredSports = (0, import_react123.useMemo)(() => {
|
|
22161
22207
|
const seen2 = new Set(discovery.matchDays.map((d) => d.sport));
|
|
22162
22208
|
for (const g of discovery.groups) seen2.add(g.sport ?? "football");
|
|
22163
22209
|
return [...seen2];
|
|
22164
22210
|
}, [discovery.matchDays, discovery.groups]);
|
|
22165
22211
|
const scheduleSport = useScheduleSport(offeredSports);
|
|
22166
|
-
const [liveLeague, setLiveLeague] = (0,
|
|
22212
|
+
const [liveLeague, setLiveLeague] = (0, import_react123.useState)(null);
|
|
22167
22213
|
const [matchesDay, setMatchesDay] = useMatchesDayPick(discovery.localDate);
|
|
22168
22214
|
const matchesLoaded = useMatchesDay({
|
|
22169
22215
|
discovery,
|
|
@@ -22173,8 +22219,8 @@ function StatsWidget(props) {
|
|
|
22173
22219
|
enabled: panelOpen && monitor.activeTab === "matches",
|
|
22174
22220
|
timeZone: ui.timeZone
|
|
22175
22221
|
});
|
|
22176
|
-
const prevLiveSnapshotRef = (0,
|
|
22177
|
-
(0,
|
|
22222
|
+
const prevLiveSnapshotRef = (0, import_react123.useRef)(monitor.snapshot);
|
|
22223
|
+
(0, import_react123.useEffect)(() => {
|
|
22178
22224
|
const snap = monitor.snapshot;
|
|
22179
22225
|
if (!snap || snap === prevLiveSnapshotRef.current) return;
|
|
22180
22226
|
prevLiveSnapshotRef.current = snap;
|
|
@@ -22214,14 +22260,14 @@ function StatsWidget(props) {
|
|
|
22214
22260
|
const clubSquadResult = useClubSquad(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22215
22261
|
const clubSquadStatsResult = useClubSquadStats(built?.conversation ?? null, { activeTab: monitor.activeTab, enabled: clubFixturesResult.enabled });
|
|
22216
22262
|
const clubPlayerDetailResult = useClubPlayerDetail(built?.conversation ?? null);
|
|
22217
|
-
const [favSportPick, setFavSportPick] = (0,
|
|
22218
|
-
const latestGreeting = (0,
|
|
22263
|
+
const [favSportPick, setFavSportPick] = (0, import_react123.useState)(null);
|
|
22264
|
+
const latestGreeting = (0, import_react123.useMemo)(() => {
|
|
22219
22265
|
for (const m of [...controller.state.messages].reverse()) {
|
|
22220
22266
|
if (m.role === "assistant" && m.defaultSport !== void 0) return m;
|
|
22221
22267
|
}
|
|
22222
22268
|
return null;
|
|
22223
22269
|
}, [controller.state.messages]);
|
|
22224
|
-
const favSportOptions = (0,
|
|
22270
|
+
const favSportOptions = (0, import_react123.useMemo)(
|
|
22225
22271
|
() => (switchSets(latestGreeting?.greetingDashboards) ?? []).map((set) => ({ sport: set.sport, label: set.label })),
|
|
22226
22272
|
[latestGreeting]
|
|
22227
22273
|
);
|
|
@@ -22230,26 +22276,26 @@ function StatsWidget(props) {
|
|
|
22230
22276
|
const favSport = [favSportPick, rememberedSport, latestGreeting?.defaultSport].find(offered) ?? "football";
|
|
22231
22277
|
const favSports = favSportOptions.length > 0 ? favSportOptions : [{ sport: favSport, label: sportLabel(ui, favSport) }];
|
|
22232
22278
|
const hasFavouritesIdentity = !!(operatorUserId || anonymousUserId);
|
|
22233
|
-
const [builderSportPick, setBuilderSportPick] = (0,
|
|
22234
|
-
const builderGreeting = (0,
|
|
22279
|
+
const [builderSportPick, setBuilderSportPick] = (0, import_react123.useState)(null);
|
|
22280
|
+
const builderGreeting = (0, import_react123.useMemo)(
|
|
22235
22281
|
() => [...controller.state.messages].reverse().find((m) => m.role === "assistant" && (m.greetingDashboard !== void 0 || m.greetingDashboards !== void 0)) ?? null,
|
|
22236
22282
|
[controller.state.messages]
|
|
22237
22283
|
);
|
|
22238
|
-
const [coolOff, setCoolOff] = (0,
|
|
22239
|
-
const onBuilderCoolOff = (0,
|
|
22284
|
+
const [coolOff, setCoolOff] = (0, import_react123.useState)(null);
|
|
22285
|
+
const onBuilderCoolOff = (0, import_react123.useCallback)((sport) => {
|
|
22240
22286
|
if (!builderGreeting) return;
|
|
22241
22287
|
setCoolOff((prev) => {
|
|
22242
22288
|
const sports = prev?.greeting === builderGreeting ? prev.sports : [];
|
|
22243
22289
|
return sports.includes(sport) ? prev : { greeting: builderGreeting, sports: [...sports, sport] };
|
|
22244
22290
|
});
|
|
22245
22291
|
}, [builderGreeting]);
|
|
22246
|
-
const [handOffPending, setHandOffPending] = (0,
|
|
22247
|
-
const consumeHandOff = (0,
|
|
22248
|
-
const openTabFromChip = (0,
|
|
22292
|
+
const [handOffPending, setHandOffPending] = (0, import_react123.useState)(false);
|
|
22293
|
+
const consumeHandOff = (0, import_react123.useCallback)(() => setHandOffPending(false), []);
|
|
22294
|
+
const openTabFromChip = (0, import_react123.useCallback)((tab) => {
|
|
22249
22295
|
if (tab === "builder") setHandOffPending(true);
|
|
22250
22296
|
monitor.setActiveTab(tab);
|
|
22251
22297
|
}, [monitor.setActiveTab]);
|
|
22252
|
-
const builderOptions = (0,
|
|
22298
|
+
const builderOptions = (0, import_react123.useMemo)(() => {
|
|
22253
22299
|
const greeting = builderGreeting;
|
|
22254
22300
|
if (!greeting) return [];
|
|
22255
22301
|
const cooled = coolOff?.greeting === greeting ? coolOff.sports : [];
|
|
@@ -22266,7 +22312,7 @@ function StatsWidget(props) {
|
|
|
22266
22312
|
return options.filter((o) => !cooled.includes(o.sport));
|
|
22267
22313
|
}, [builderGreeting, coolOff, ui, handOffPending]);
|
|
22268
22314
|
const builderSport = [builderSportPick, rememberedSport, latestGreeting?.defaultSport].find((s) => !!s && builderOptions.some((o) => o.sport === s)) ?? builderOptions[0]?.sport ?? "";
|
|
22269
|
-
const [panelEverOpened, setPanelEverOpened] = (0,
|
|
22315
|
+
const [panelEverOpened, setPanelEverOpened] = (0, import_react123.useState)(panelOpen);
|
|
22270
22316
|
if (panelOpen && !panelEverOpened) setPanelEverOpened(true);
|
|
22271
22317
|
const favourites = useFavourites({
|
|
22272
22318
|
conversation: built?.conversation ?? null,
|
|
@@ -22278,16 +22324,16 @@ function StatsWidget(props) {
|
|
|
22278
22324
|
onChanged: discovery.refreshSchedule
|
|
22279
22325
|
});
|
|
22280
22326
|
const favouritesEnabled = hasFavouritesIdentity && favourites.status !== "refused";
|
|
22281
|
-
const [favouritesOpen, setFavouritesOpen] = (0,
|
|
22327
|
+
const [favouritesOpen, setFavouritesOpen] = (0, import_react123.useState)(false);
|
|
22282
22328
|
if (!panelOpen && favouritesOpen) setFavouritesOpen(false);
|
|
22283
|
-
const getPricePresets = (0,
|
|
22329
|
+
const getPricePresets = (0, import_react123.useCallback)(
|
|
22284
22330
|
(locale) => built ? built.conversation.getPricePresets(locale, { pool: "open" }) : Promise.resolve(null),
|
|
22285
22331
|
[built]
|
|
22286
22332
|
);
|
|
22287
22333
|
const presetGrid = usePresetGrid({ getPricePresets, isOpen: panelOpen, locale: ui.hostTag });
|
|
22288
22334
|
const markLiveActivity = monitor.markLiveActivity;
|
|
22289
|
-
const prevLiveCountRef = (0,
|
|
22290
|
-
(0,
|
|
22335
|
+
const prevLiveCountRef = (0, import_react123.useRef)(0);
|
|
22336
|
+
(0, import_react123.useEffect)(() => {
|
|
22291
22337
|
const rose = prevLiveCountRef.current === 0 && discovery.liveCount > 0;
|
|
22292
22338
|
prevLiveCountRef.current = discovery.liveCount;
|
|
22293
22339
|
if (rose) markLiveActivity();
|
|
@@ -22301,7 +22347,7 @@ function StatsWidget(props) {
|
|
|
22301
22347
|
closePanel: controller.close
|
|
22302
22348
|
});
|
|
22303
22349
|
const markAdded = hostEvents.markAdded;
|
|
22304
|
-
const slip = (0,
|
|
22350
|
+
const slip = (0, import_react123.useMemo)(
|
|
22305
22351
|
() => {
|
|
22306
22352
|
const handler = props.config?.onAddToSlip;
|
|
22307
22353
|
return {
|
|
@@ -22321,7 +22367,7 @@ function StatsWidget(props) {
|
|
|
22321
22367
|
},
|
|
22322
22368
|
[props.config?.onAddToSlip, props.config?.slipSports, controller.state.conversationId, markAdded]
|
|
22323
22369
|
);
|
|
22324
|
-
const onDashboardTap = (0,
|
|
22370
|
+
const onDashboardTap = (0, import_react123.useMemo)(
|
|
22325
22371
|
() => built ? createDashboardTapSignal((input) => built.conversation.sendSignal(input), logger) : void 0,
|
|
22326
22372
|
[built, logger]
|
|
22327
22373
|
);
|
|
@@ -22335,17 +22381,28 @@ function StatsWidget(props) {
|
|
|
22335
22381
|
log: logger
|
|
22336
22382
|
})
|
|
22337
22383
|
}));
|
|
22338
|
-
const dismissPopupRef = (0,
|
|
22384
|
+
const dismissPopupRef = (0, import_react123.useRef)(() => {
|
|
22339
22385
|
});
|
|
22340
|
-
const onCtaRef = (0,
|
|
22386
|
+
const onCtaRef = (0, import_react123.useRef)(() => {
|
|
22341
22387
|
});
|
|
22388
|
+
const onTeaserTapRef = (0, import_react123.useRef)(() => {
|
|
22389
|
+
});
|
|
22390
|
+
const bubble = controller.state.greetingBubble;
|
|
22391
|
+
const bubblePrice = !stringsPending && controller.state.popupText && bubble?.price && bubble.matchId ? { matchId: bubble.matchId, price: bubble.price, sport: bubble.sport } : null;
|
|
22342
22392
|
const bubbleCta = controller.state.popupText ? controller.state.greetingBubble?.cta ?? null : null;
|
|
22343
22393
|
const mobile = useMobileBinding({
|
|
22344
22394
|
binding: props.mobile,
|
|
22345
22395
|
panelOpen,
|
|
22346
22396
|
popupText: controller.state.popupText,
|
|
22347
22397
|
cta: bubbleCta,
|
|
22398
|
+
price: bubblePrice ? {
|
|
22399
|
+
matchOddsId: bubblePrice.price.selection.matchOddsId,
|
|
22400
|
+
marketLabel: bubblePrice.price.marketLabel,
|
|
22401
|
+
label: bubblePrice.price.selection.label,
|
|
22402
|
+
odds: formatOdds(bubblePrice.price.selection.formats, oddsSettings.oddsFormat)
|
|
22403
|
+
} : null,
|
|
22348
22404
|
onCta: () => onCtaRef.current(),
|
|
22405
|
+
onTeaserTap: () => onTeaserTapRef.current(),
|
|
22349
22406
|
asks,
|
|
22350
22407
|
open: controller.open,
|
|
22351
22408
|
close: controller.close,
|
|
@@ -22354,16 +22411,16 @@ function StatsWidget(props) {
|
|
|
22354
22411
|
const dismissPopup = usePopupTelemetry(logger, panelOpen, controller.state.popupText, controller.dismissPopup, mobile.confirmedShown);
|
|
22355
22412
|
dismissPopupRef.current = dismissPopup;
|
|
22356
22413
|
const greetingMeta = latestGreetingMeta(controller.state.messages);
|
|
22357
|
-
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText,
|
|
22358
|
-
const [highlight, setHighlight] = (0,
|
|
22359
|
-
const clearHighlight = (0,
|
|
22360
|
-
(0,
|
|
22414
|
+
useBubbleGreetingShown(logger, logger ?? NO_OWNER, controller.state.popupText, greetingMeta, mobile.confirmedShown);
|
|
22415
|
+
const [highlight, setHighlight] = (0, import_react123.useState)(null);
|
|
22416
|
+
const clearHighlight = (0, import_react123.useCallback)(() => setHighlight(null), []);
|
|
22417
|
+
(0, import_react123.useEffect)(() => {
|
|
22361
22418
|
if (!panelOpen) setHighlight(null);
|
|
22362
22419
|
}, [panelOpen]);
|
|
22363
|
-
const highlightRequest = (0,
|
|
22420
|
+
const highlightRequest = (0, import_react123.useMemo)(() => highlight ? { ...highlight, clear: clearHighlight } : null, [highlight, clearHighlight]);
|
|
22364
22421
|
const { open: openFromCta, state: { greetingBubble } } = controller;
|
|
22365
22422
|
const setTab = monitor.setActiveTab;
|
|
22366
|
-
const logCtaClick = (0,
|
|
22423
|
+
const logCtaClick = (0, import_react123.useCallback)(() => {
|
|
22367
22424
|
if (!logger || !greetingMeta) return;
|
|
22368
22425
|
logger.log({ name: "greeting_cta_click", greeting: { greetingId: greetingMeta.greetingId, case: greetingMeta.case, sport: greetingMeta.sport, market: greetingMeta.market ?? null } });
|
|
22369
22426
|
}, [logger, greetingMeta]);
|
|
@@ -22374,12 +22431,18 @@ function StatsWidget(props) {
|
|
|
22374
22431
|
const matchId = greetingBubble?.matchId;
|
|
22375
22432
|
if (matchId) setHighlight((prev) => ({ matchId, token: (prev?.token ?? 0) + 1 }));
|
|
22376
22433
|
};
|
|
22377
|
-
|
|
22434
|
+
onTeaserTapRef.current = () => {
|
|
22435
|
+
if (!controller.state.popupText) return;
|
|
22436
|
+
track({ name: "bubble_click" });
|
|
22437
|
+
if (!bubbleCta) logCtaClick();
|
|
22438
|
+
openFromCta();
|
|
22439
|
+
};
|
|
22440
|
+
const onCta = (0, import_react123.useCallback)(() => onCtaRef.current(), []);
|
|
22378
22441
|
useOpenTelemetry(logger, panelOpen);
|
|
22379
|
-
const onControlRef = (0,
|
|
22442
|
+
const onControlRef = (0, import_react123.useRef)(props.onControl);
|
|
22380
22443
|
onControlRef.current = props.onControl;
|
|
22381
22444
|
const { open: openPanel, close: closePanel } = controller;
|
|
22382
|
-
(0,
|
|
22445
|
+
(0, import_react123.useEffect)(() => {
|
|
22383
22446
|
onControlRef.current?.({ open: openPanel, close: closePanel });
|
|
22384
22447
|
return () => onControlRef.current?.(null);
|
|
22385
22448
|
}, [openPanel, closePanel]);
|
|
@@ -22396,11 +22459,11 @@ function StatsWidget(props) {
|
|
|
22396
22459
|
page: cfg?.page
|
|
22397
22460
|
}
|
|
22398
22461
|
};
|
|
22399
|
-
(0,
|
|
22462
|
+
(0, import_react123.useEffect)(() => {
|
|
22400
22463
|
if (!logger) return;
|
|
22401
22464
|
logger.setIdentity({ operatorUserId, anonymousUserId, conversationId });
|
|
22402
22465
|
}, [logger, operatorUserId, anonymousUserId, conversationId]);
|
|
22403
|
-
(0,
|
|
22466
|
+
(0, import_react123.useEffect)(() => {
|
|
22404
22467
|
if (!logger) return;
|
|
22405
22468
|
logger.resume();
|
|
22406
22469
|
const onHide = () => {
|
|
@@ -22418,15 +22481,15 @@ function StatsWidget(props) {
|
|
|
22418
22481
|
logger.dispose();
|
|
22419
22482
|
};
|
|
22420
22483
|
}, [logger]);
|
|
22421
|
-
(0,
|
|
22484
|
+
(0, import_react123.useEffect)(() => {
|
|
22422
22485
|
if (!built || !ui.injectStyles || widgetStrings.state === "unavailable") return;
|
|
22423
22486
|
const node = rootRef.current?.getRootNode();
|
|
22424
22487
|
if (node) injectStyles(node);
|
|
22425
22488
|
}, [built, ui.injectStyles, widgetStrings.state]);
|
|
22426
22489
|
const holds = useSessionHolds();
|
|
22427
22490
|
const builderConversation = built?.conversation ?? null;
|
|
22428
|
-
const builderMemory = (0,
|
|
22429
|
-
const personalGreeting = (0,
|
|
22491
|
+
const builderMemory = (0, import_react123.useMemo)(() => createBuilderMemory(), [builderConversation, controller.state.threadEpoch]);
|
|
22492
|
+
const personalGreeting = (0, import_react123.useMemo)(() => ({
|
|
22430
22493
|
favourites: favouritesEnabled && monitor.enabled ? favourites : null,
|
|
22431
22494
|
conversation: built?.conversation ?? null,
|
|
22432
22495
|
openFavourites: () => setFavouritesOpen(true),
|
|
@@ -22476,7 +22539,21 @@ function StatsWidget(props) {
|
|
|
22476
22539
|
onCloseRequested: mobile.onCloseRequested,
|
|
22477
22540
|
onRegisterBack: mobile.onRegisterBack
|
|
22478
22541
|
}
|
|
22479
|
-
) }) }) : props.mobile ?
|
|
22542
|
+
) }) }) : props.mobile ? bubblePrice && mobile.onRegisterPrice && mobile.onPriceResult && mobile.priceInFlight ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22543
|
+
MobileBubblePrice,
|
|
22544
|
+
{
|
|
22545
|
+
matchId: bubblePrice.matchId,
|
|
22546
|
+
price: bubblePrice.price,
|
|
22547
|
+
conversation: built?.conversation ?? null,
|
|
22548
|
+
slip,
|
|
22549
|
+
ui,
|
|
22550
|
+
hook: hookOf(greetingMeta),
|
|
22551
|
+
sport: bubblePrice.sport,
|
|
22552
|
+
inFlight: mobile.priceInFlight,
|
|
22553
|
+
onRegister: mobile.onRegisterPrice,
|
|
22554
|
+
onResult: mobile.onPriceResult
|
|
22555
|
+
}
|
|
22556
|
+
) : null : /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22480
22557
|
ChatFab,
|
|
22481
22558
|
{
|
|
22482
22559
|
label: stringsPending ? cfg?.launcherLabel : ui.launcherLabel,
|
|
@@ -22493,15 +22570,16 @@ function StatsWidget(props) {
|
|
|
22493
22570
|
cta: bubbleCta ?? void 0,
|
|
22494
22571
|
onCta,
|
|
22495
22572
|
onBubbleClick: logCtaClick,
|
|
22496
|
-
price:
|
|
22573
|
+
price: bubblePrice ? /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
22497
22574
|
BubblePrice,
|
|
22498
22575
|
{
|
|
22499
|
-
matchId:
|
|
22500
|
-
price:
|
|
22576
|
+
matchId: bubblePrice.matchId,
|
|
22577
|
+
price: bubblePrice.price,
|
|
22501
22578
|
conversation: built?.conversation ?? null,
|
|
22502
22579
|
slip,
|
|
22503
22580
|
ui,
|
|
22504
|
-
hook: hookOf(greetingMeta)
|
|
22581
|
+
hook: hookOf(greetingMeta),
|
|
22582
|
+
sport: bubblePrice.sport
|
|
22505
22583
|
}
|
|
22506
22584
|
) : void 0
|
|
22507
22585
|
}
|