@sensiblestats/widget-react 0.128.0 → 0.129.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 +12 -0
- package/dist/index.cjs +291 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +291 -184
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -935,19 +935,69 @@ var formatTime = (when, tag2, clock3, opts) => formatDate(when, tag2, { ...clock
|
|
|
935
935
|
var clockOf = (ui) => ui.clock ?? "24h";
|
|
936
936
|
var formatFixed = (n, tag2, digits) => formatNumber(n, tag2, { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
937
937
|
|
|
938
|
+
// src/zone.ts
|
|
939
|
+
var DAY_MS = 864e5;
|
|
940
|
+
var formatters = /* @__PURE__ */ new Map();
|
|
941
|
+
var formatterFor = (timeZone) => {
|
|
942
|
+
let f = formatters.get(timeZone);
|
|
943
|
+
if (!f) {
|
|
944
|
+
f = new Intl.DateTimeFormat(BUNDLED_TAG, {
|
|
945
|
+
timeZone,
|
|
946
|
+
year: "numeric",
|
|
947
|
+
month: "2-digit",
|
|
948
|
+
day: "2-digit",
|
|
949
|
+
hour: "2-digit",
|
|
950
|
+
minute: "2-digit",
|
|
951
|
+
second: "2-digit",
|
|
952
|
+
hourCycle: "h23"
|
|
953
|
+
});
|
|
954
|
+
formatters.set(timeZone, f);
|
|
955
|
+
}
|
|
956
|
+
return f;
|
|
957
|
+
};
|
|
958
|
+
function validZone(timeZone) {
|
|
959
|
+
if (typeof timeZone !== "string" || timeZone.trim() === "") return void 0;
|
|
960
|
+
const zone = timeZone.trim();
|
|
961
|
+
try {
|
|
962
|
+
new Intl.DateTimeFormat("en", { timeZone: zone });
|
|
963
|
+
return zone;
|
|
964
|
+
} catch {
|
|
965
|
+
return void 0;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
function zonedParts(ms, timeZone) {
|
|
969
|
+
const out = { year: NaN, month: NaN, day: NaN, hour: NaN, minute: NaN, second: NaN };
|
|
970
|
+
if (Number.isNaN(ms)) return out;
|
|
971
|
+
if (timeZone === void 0) {
|
|
972
|
+
const d = new Date(ms);
|
|
973
|
+
return { year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate(), hour: d.getHours(), minute: d.getMinutes(), second: d.getSeconds() };
|
|
974
|
+
}
|
|
975
|
+
for (const p of formatterFor(timeZone).formatToParts(ms)) {
|
|
976
|
+
if (p.type in out) out[p.type] = Number(p.value);
|
|
977
|
+
}
|
|
978
|
+
return out;
|
|
979
|
+
}
|
|
980
|
+
function zonedDayNumber(ms, timeZone) {
|
|
981
|
+
const p = zonedParts(ms, timeZone);
|
|
982
|
+
return Date.UTC(p.year, p.month - 1, p.day) / DAY_MS;
|
|
983
|
+
}
|
|
984
|
+
function zoneOffsetMinutes(ms, timeZone) {
|
|
985
|
+
const p = zonedParts(ms, timeZone);
|
|
986
|
+
const wall = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
|
|
987
|
+
return Math.round((wall - Math.floor(ms / 1e3) * 1e3) / 6e4);
|
|
988
|
+
}
|
|
989
|
+
|
|
938
990
|
// src/kickoff.ts
|
|
939
|
-
function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date()) {
|
|
991
|
+
function formatBettingKickoff(kickoffUtc, ui, tag2, clock3 = "24h", now = /* @__PURE__ */ new Date(), timeZone) {
|
|
940
992
|
const at2 = new Date(kickoffUtc);
|
|
941
|
-
const time = formatTime(at2, tag2, clock3);
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const dayDiff = Math.round((atLocalDate.getTime() - nowLocalDate.getTime()) / 864e5);
|
|
945
|
-
const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short" });
|
|
993
|
+
const time = formatTime(at2, tag2, clock3, { timeZone });
|
|
994
|
+
const dayDiff = zonedDayNumber(at2.getTime(), timeZone) - zonedDayNumber(now.getTime(), timeZone);
|
|
995
|
+
const dayLabel = dayDiff === 0 ? ui.today : dayDiff === 1 ? ui.tomorrow : formatDate(at2, tag2, { weekday: "short", day: "numeric", month: "short", timeZone });
|
|
946
996
|
return { dayLabel, time };
|
|
947
997
|
}
|
|
948
998
|
|
|
949
999
|
// src/nbaFormDay.ts
|
|
950
|
-
var
|
|
1000
|
+
var DAY_MS2 = 864e5;
|
|
951
1001
|
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
952
1002
|
function utcMs(etDate) {
|
|
953
1003
|
if (!ISO_DATE.test(etDate)) return null;
|
|
@@ -959,7 +1009,7 @@ function formDay(etDate, anchorEtDate, tag2) {
|
|
|
959
1009
|
const at2 = utcMs(etDate);
|
|
960
1010
|
if (at2 === null) return etDate;
|
|
961
1011
|
const anchor = utcMs(anchorEtDate);
|
|
962
|
-
const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) /
|
|
1012
|
+
const days = anchor === null ? Infinity : Math.abs(Math.round((at2 - anchor) / DAY_MS2));
|
|
963
1013
|
const options = days <= 6 ? { weekday: "short", timeZone: "UTC" } : { day: "numeric", month: "short", timeZone: "UTC" };
|
|
964
1014
|
return formatDate(at2, tag2, options);
|
|
965
1015
|
}
|
|
@@ -1015,13 +1065,13 @@ var shortDate = (tag2, ms, opts) => nbsp(formatDate(ms, tag2, opts).replace("Sep
|
|
|
1015
1065
|
var signed = (line) => line.replace(/^-/, "\u2212");
|
|
1016
1066
|
var decimalMark = (tag2) => new Intl.NumberFormat(tag2).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
1017
1067
|
var INTL_LEAVES = {
|
|
1018
|
-
chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock) }),
|
|
1019
|
-
logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short" }),
|
|
1068
|
+
chartTimeLabel: (c) => (ms) => formatDate(ms, c.tag, { day: "numeric", month: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
|
|
1069
|
+
logShortDate: (c) => (ms) => shortDate(c.tag, ms, { day: "numeric", month: "short", timeZone: c.timeZone }),
|
|
1020
1070
|
"games.formatPts": (c) => (n) => formatNumber(n, c.tag),
|
|
1021
|
-
"games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock) }),
|
|
1071
|
+
"games.formatDayTime": (c) => (iso) => formatDate(iso, c.tag, { weekday: "short", ...clockFields(c.clock), timeZone: c.timeZone }),
|
|
1022
1072
|
"nba.lineText": (c) => (line) => signed(line).replace(".", decimalMark(c.tag)),
|
|
1023
1073
|
"nba.formDay": (c) => (etDate, anchorEtDate) => formDay(etDate, anchorEtDate, c.tag),
|
|
1024
|
-
bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now),
|
|
1074
|
+
bettingKickoff: (c) => (kickoffUtc, now) => formatBettingKickoff(kickoffUtc, { today: c.t("widget.today"), tomorrow: c.t("widget.tomorrow") }, c.tag, c.clock, now, c.timeZone),
|
|
1025
1075
|
v8FormResult: (c) => (result) => codeLabel(c.table, "result", result) ?? result
|
|
1026
1076
|
};
|
|
1027
1077
|
var pairs = (c, key, list) => list.map(([home, away]) => c.t(key, { home, away })).join(", ");
|
|
@@ -1054,7 +1104,7 @@ var ROW_LEAVES = {
|
|
|
1054
1104
|
availabilityNext: (c) => (opponent, isHome, ms) => {
|
|
1055
1105
|
const line = c.t(isHome ? "widget.availabilityNext.home" : "widget.availabilityNext.away", { opponent });
|
|
1056
1106
|
if (ms === null || !(ms > 0)) return line;
|
|
1057
|
-
return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short" }) });
|
|
1107
|
+
return c.t("widget.availabilityNext.dated", { text: line, date: shortDate(c.tag, ms, { weekday: "short", day: "numeric", month: "short", timeZone: c.timeZone }) });
|
|
1058
1108
|
},
|
|
1059
1109
|
availabilityBack: (c) => (ms) => c.t("widget.availabilityBack", { date: shortDate(c.tag, ms, { day: "numeric", month: "short" }) }),
|
|
1060
1110
|
perfRankedAgainst: (c) => (competition, group) => c.t("widget.perfRankedAgainst", { competition, group: codeLabel(c.table, "groupNoun", group) ?? group }),
|
|
@@ -1225,7 +1275,7 @@ function setPath(root, path, value) {
|
|
|
1225
1275
|
node[parts2[parts2.length - 1]] = value;
|
|
1226
1276
|
}
|
|
1227
1277
|
var ownedByLeaf = (key) => key.startsWith("widget.code.") || Object.keys(LEAVES).some((path) => key === `widget.${path}` || key.startsWith(`widget.${path}.`));
|
|
1228
|
-
function buildLocaleStrings(table, tag2, clock3 = "24h") {
|
|
1278
|
+
function buildLocaleStrings(table, tag2, clock3 = "24h", timeZone) {
|
|
1229
1279
|
const root = {};
|
|
1230
1280
|
for (const [key, row] of Object.entries(table)) {
|
|
1231
1281
|
if (key.startsWith("widget.") && typeof row === "string" && !ownedByLeaf(key)) setPath(root, key.slice("widget.".length), row);
|
|
@@ -1233,6 +1283,7 @@ function buildLocaleStrings(table, tag2, clock3 = "24h") {
|
|
|
1233
1283
|
const ctx = {
|
|
1234
1284
|
tag: tag2,
|
|
1235
1285
|
clock: clock3,
|
|
1286
|
+
timeZone,
|
|
1236
1287
|
table,
|
|
1237
1288
|
t: (key, tokens = {}) => fill(table[key] ?? key, tokens, tag2)
|
|
1238
1289
|
};
|
|
@@ -1257,7 +1308,7 @@ function parseOddsFormat(value) {
|
|
|
1257
1308
|
}
|
|
1258
1309
|
|
|
1259
1310
|
// src/version.generated.ts
|
|
1260
|
-
var WIDGET_REACT_VERSION = "0.
|
|
1311
|
+
var WIDGET_REACT_VERSION = "0.129.0";
|
|
1261
1312
|
|
|
1262
1313
|
// src/config.ts
|
|
1263
1314
|
function hostTag(cfg) {
|
|
@@ -1266,7 +1317,8 @@ function hostTag(cfg) {
|
|
|
1266
1317
|
}
|
|
1267
1318
|
var isBundledFamily = (tag2) => sameFamily(tag2, BUNDLED_TAG);
|
|
1268
1319
|
function normalizeUi(cfg, loaded) {
|
|
1269
|
-
const
|
|
1320
|
+
const timeZone = validZone(cfg.timeZone);
|
|
1321
|
+
const strings = buildLocaleStrings(loaded.strings, loaded.tag, loaded.clock, timeZone);
|
|
1270
1322
|
return {
|
|
1271
1323
|
theme: cfg.theme ?? "auto",
|
|
1272
1324
|
oddsFormat: parseOddsFormat(cfg.oddsFormat) ?? "decimal",
|
|
@@ -1275,6 +1327,7 @@ function normalizeUi(cfg, loaded) {
|
|
|
1275
1327
|
headerTitle: cfg.headerTitle,
|
|
1276
1328
|
locale: loaded.tag,
|
|
1277
1329
|
clock: loaded.clock,
|
|
1330
|
+
timeZone,
|
|
1278
1331
|
hostTag: hostTag(cfg),
|
|
1279
1332
|
rawBettingLabels: isBundledFamily(loaded.tag),
|
|
1280
1333
|
cta: cfg.cta,
|
|
@@ -1780,9 +1833,9 @@ function projectSeries(samples) {
|
|
|
1780
1833
|
yMin = pMin - FLAT_DOMAIN_PAD;
|
|
1781
1834
|
yMax = pMax + FLAT_DOMAIN_PAD;
|
|
1782
1835
|
} else {
|
|
1783
|
-
const
|
|
1784
|
-
yMin = pMin -
|
|
1785
|
-
yMax = pMax +
|
|
1836
|
+
const pad = (pMax - pMin) * 0.1;
|
|
1837
|
+
yMin = pMin - pad;
|
|
1838
|
+
yMax = pMax + pad;
|
|
1786
1839
|
}
|
|
1787
1840
|
const x = (atMs) => round2(PLOT_X0 + (atMs - tMin) / (tMax - tMin) * (PLOT_X1 - PLOT_X0));
|
|
1788
1841
|
const y = (price) => round2(PLOT_Y1 - (price - yMin) / (yMax - yMin) * (PLOT_Y1 - PLOT_Y0));
|
|
@@ -3545,12 +3598,12 @@ var import_widget_sdk13 = require("@sensiblestats/widget-sdk");
|
|
|
3545
3598
|
var PREFIX2 = "ss-w-schedule:";
|
|
3546
3599
|
var SCHEMA_VERSION = 7;
|
|
3547
3600
|
var TTL_MS3 = 6 * 36e5;
|
|
3548
|
-
function scheduleCacheKey(operatorId, encodedUserKey2, localDate) {
|
|
3549
|
-
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${localDate}`;
|
|
3601
|
+
function scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3602
|
+
return `${PREFIX2}${operatorId}:${encodedUserKey2}:${timeZone ?? "local"}:${localDate}`;
|
|
3550
3603
|
}
|
|
3551
|
-
function read(operatorId, encodedUserKey2, localDate) {
|
|
3604
|
+
function read(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3552
3605
|
try {
|
|
3553
|
-
const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
|
|
3606
|
+
const raw = localStorage.getItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
|
|
3554
3607
|
if (!raw) return null;
|
|
3555
3608
|
const entry = JSON.parse(raw);
|
|
3556
3609
|
if (entry.v !== SCHEMA_VERSION || !entry.payload) return null;
|
|
@@ -3559,13 +3612,13 @@ function read(operatorId, encodedUserKey2, localDate) {
|
|
|
3559
3612
|
return null;
|
|
3560
3613
|
}
|
|
3561
3614
|
}
|
|
3562
|
-
function readSchedule(operatorId, encodedUserKey2, localDate, nowMs) {
|
|
3563
|
-
const entry = read(operatorId, encodedUserKey2, localDate);
|
|
3615
|
+
function readSchedule(operatorId, encodedUserKey2, localDate, nowMs, timeZone) {
|
|
3616
|
+
const entry = read(operatorId, encodedUserKey2, localDate, timeZone);
|
|
3564
3617
|
if (!entry) return null;
|
|
3565
3618
|
return nowMs - entry.at > TTL_MS3 ? null : entry.payload;
|
|
3566
3619
|
}
|
|
3567
|
-
function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate) {
|
|
3568
|
-
return read(operatorId, encodedUserKey2, localDate)?.payload ?? null;
|
|
3620
|
+
function readScheduleIgnoringTtl(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3621
|
+
return read(operatorId, encodedUserKey2, localDate, timeZone)?.payload ?? null;
|
|
3569
3622
|
}
|
|
3570
3623
|
function skeletonOnly(payload) {
|
|
3571
3624
|
return {
|
|
@@ -3604,8 +3657,8 @@ function skeletonOnly(payload) {
|
|
|
3604
3657
|
}))
|
|
3605
3658
|
};
|
|
3606
3659
|
}
|
|
3607
|
-
function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
|
|
3608
|
-
const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate);
|
|
3660
|
+
function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs, timeZone) {
|
|
3661
|
+
const keep = scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone);
|
|
3609
3662
|
const mine = `${PREFIX2}${operatorId}:${encodedUserKey2}:`;
|
|
3610
3663
|
try {
|
|
3611
3664
|
for (let i = localStorage.length - 1; i >= 0; i--) {
|
|
@@ -3617,9 +3670,9 @@ function writeSchedule(operatorId, encodedUserKey2, localDate, payload, nowMs) {
|
|
|
3617
3670
|
} catch {
|
|
3618
3671
|
}
|
|
3619
3672
|
}
|
|
3620
|
-
function clearSchedule(operatorId, encodedUserKey2, localDate) {
|
|
3673
|
+
function clearSchedule(operatorId, encodedUserKey2, localDate, timeZone) {
|
|
3621
3674
|
try {
|
|
3622
|
-
localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate));
|
|
3675
|
+
localStorage.removeItem(scheduleCacheKey(operatorId, encodedUserKey2, localDate, timeZone));
|
|
3623
3676
|
} catch {
|
|
3624
3677
|
}
|
|
3625
3678
|
}
|
|
@@ -3661,6 +3714,51 @@ function nearestTennisKeys(open) {
|
|
|
3661
3714
|
return [...open.values()].sort((a, b) => a.kickoffUnix - b.kickoffUnix).slice(0, MAX_TENNIS_KEYS).map((e) => e.key);
|
|
3662
3715
|
}
|
|
3663
3716
|
|
|
3717
|
+
// src/scheduleDays.ts
|
|
3718
|
+
var MAX_AFTER_TODAY = 6;
|
|
3719
|
+
var parts = (date) => {
|
|
3720
|
+
const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
|
|
3721
|
+
return [y, m, d];
|
|
3722
|
+
};
|
|
3723
|
+
function offsetOf(localDate, timeZone) {
|
|
3724
|
+
const [y, m, d] = parts(localDate);
|
|
3725
|
+
if (timeZone === void 0) return -new Date(y, m - 1, d, 12).getTimezoneOffset();
|
|
3726
|
+
const utcNoon = Date.UTC(y, m - 1, d, 12);
|
|
3727
|
+
return zoneOffsetMinutes(utcNoon - zoneOffsetMinutes(utcNoon, timeZone) * 6e4, timeZone);
|
|
3728
|
+
}
|
|
3729
|
+
function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
|
|
3730
|
+
return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
|
|
3731
|
+
}
|
|
3732
|
+
var dayAfter = (date) => {
|
|
3733
|
+
const [y, m, d] = parts(date);
|
|
3734
|
+
return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
|
|
3735
|
+
};
|
|
3736
|
+
function buildDayChips(today, matchDays, sport) {
|
|
3737
|
+
const dates = /* @__PURE__ */ new Set();
|
|
3738
|
+
for (const md of matchDays) {
|
|
3739
|
+
if (sport !== "all" && md.sport !== sport) continue;
|
|
3740
|
+
for (const date of md.dates) if (date > today) dates.add(date);
|
|
3741
|
+
}
|
|
3742
|
+
const chips = [{ date: today, isToday: true, gapBefore: false }];
|
|
3743
|
+
for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
|
|
3744
|
+
const prev = chips[chips.length - 1];
|
|
3745
|
+
chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
|
|
3746
|
+
}
|
|
3747
|
+
return chips;
|
|
3748
|
+
}
|
|
3749
|
+
function weekdayAndDay(date, tag2) {
|
|
3750
|
+
const [y, m, d] = parts(date);
|
|
3751
|
+
const at2 = new Date(Date.UTC(y, m - 1, d, 12));
|
|
3752
|
+
return {
|
|
3753
|
+
weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
|
|
3754
|
+
day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
|
|
3755
|
+
};
|
|
3756
|
+
}
|
|
3757
|
+
function weekdayLong(date, tag2) {
|
|
3758
|
+
const [y, m, d] = parts(date);
|
|
3759
|
+
return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
|
|
3760
|
+
}
|
|
3761
|
+
|
|
3664
3762
|
// src/liveClock.ts
|
|
3665
3763
|
var import_widget_sdk12 = require("@sensiblestats/widget-sdk");
|
|
3666
3764
|
function isTreatedLive(state, pollStale) {
|
|
@@ -3680,7 +3778,11 @@ var STALE_AFTER_FAILURES = 2;
|
|
|
3680
3778
|
function encodedUserKey(operatorUserId, anonymousUserId) {
|
|
3681
3779
|
return encodeURIComponent(operatorUserId || anonymousUserId || "none");
|
|
3682
3780
|
}
|
|
3683
|
-
function localDateOf(now) {
|
|
3781
|
+
function localDateOf(now, timeZone) {
|
|
3782
|
+
if (timeZone !== void 0) {
|
|
3783
|
+
const p = zonedParts(now.getTime(), timeZone);
|
|
3784
|
+
return `${p.year}-${`${p.month}`.padStart(2, "0")}-${`${p.day}`.padStart(2, "0")}`;
|
|
3785
|
+
}
|
|
3684
3786
|
const y = now.getFullYear();
|
|
3685
3787
|
const m = `${now.getMonth() + 1}`.padStart(2, "0");
|
|
3686
3788
|
const d = `${now.getDate()}`.padStart(2, "0");
|
|
@@ -3706,19 +3808,19 @@ function useMatchDiscovery(opts) {
|
|
|
3706
3808
|
statesRef.current = states;
|
|
3707
3809
|
const getStatesRef = (0, import_react5.useRef)(opts.getStates);
|
|
3708
3810
|
getStatesRef.current = opts.getStates;
|
|
3709
|
-
const [localDate, setLocalDate] = (0, import_react5.useState)(() => localDateOf(/* @__PURE__ */ new Date()));
|
|
3811
|
+
const [localDate, setLocalDate] = (0, import_react5.useState)(() => localDateOf(/* @__PURE__ */ new Date(), opts.timeZone));
|
|
3710
3812
|
(0, import_react5.useEffect)(() => {
|
|
3711
3813
|
const id = setInterval(() => {
|
|
3712
|
-
const next = localDateOf(/* @__PURE__ */ new Date());
|
|
3814
|
+
const next = localDateOf(/* @__PURE__ */ new Date(), opts.timeZone);
|
|
3713
3815
|
setLocalDate((prev) => prev === next ? prev : next);
|
|
3714
3816
|
}, ROLLOVER_CHECK_MS);
|
|
3715
3817
|
return () => clearInterval(id);
|
|
3716
|
-
}, []);
|
|
3818
|
+
}, [opts.timeZone]);
|
|
3717
3819
|
(0, import_react5.useEffect)(() => {
|
|
3718
3820
|
let cancelled = false;
|
|
3719
|
-
const utcOffsetMinutes = -(/* @__PURE__ */ new Date()).getTimezoneOffset();
|
|
3821
|
+
const utcOffsetMinutes = opts.timeZone === void 0 ? -(/* @__PURE__ */ new Date()).getTimezoneOffset() : offsetOf(localDate, opts.timeZone);
|
|
3720
3822
|
const key = encodedUserKey(opts.operatorUserId, opts.anonymousUserId);
|
|
3721
|
-
const cached = readSchedule(opts.operatorId, key, localDate, Date.now());
|
|
3823
|
+
const cached = readSchedule(opts.operatorId, key, localDate, Date.now(), opts.timeZone);
|
|
3722
3824
|
if (cached) {
|
|
3723
3825
|
if (!cancelled) {
|
|
3724
3826
|
setGroups(cached.groups);
|
|
@@ -3738,12 +3840,12 @@ function useMatchDiscovery(opts) {
|
|
|
3738
3840
|
setScheduleLoaded(true);
|
|
3739
3841
|
return;
|
|
3740
3842
|
}
|
|
3741
|
-
writeSchedule(opts.operatorId, key, localDate, payload, Date.now());
|
|
3843
|
+
writeSchedule(opts.operatorId, key, localDate, payload, Date.now(), opts.timeZone);
|
|
3742
3844
|
setGroups(payload.groups);
|
|
3743
3845
|
setMatchDays(payload.matchDays ?? []);
|
|
3744
3846
|
setScheduleLoaded(true);
|
|
3745
3847
|
} catch {
|
|
3746
|
-
const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate);
|
|
3848
|
+
const fallback = readScheduleIgnoringTtl(opts.operatorId, key, localDate, opts.timeZone);
|
|
3747
3849
|
if (!cancelled && fallback) {
|
|
3748
3850
|
setGroups(fallback.groups);
|
|
3749
3851
|
setMatchDays(fallback.matchDays ?? []);
|
|
@@ -3754,7 +3856,7 @@ function useMatchDiscovery(opts) {
|
|
|
3754
3856
|
return () => {
|
|
3755
3857
|
cancelled = true;
|
|
3756
3858
|
};
|
|
3757
|
-
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey]);
|
|
3859
|
+
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, refreshKey, opts.timeZone]);
|
|
3758
3860
|
const tick = (0, import_react5.useCallback)(async () => {
|
|
3759
3861
|
const ids = dueMatchIds(groupsRef.current, statesRef.current, Date.now());
|
|
3760
3862
|
if (ids.football.length === 0 && ids.nba.length === 0 && ids.nfl.length === 0 && ids.tennis.length === 0) return;
|
|
@@ -3789,10 +3891,10 @@ function useMatchDiscovery(opts) {
|
|
|
3789
3891
|
return n;
|
|
3790
3892
|
}, [groups, states, stale]);
|
|
3791
3893
|
const refreshSchedule = (0, import_react5.useCallback)(async () => {
|
|
3792
|
-
clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate);
|
|
3894
|
+
clearSchedule(opts.operatorId, encodedUserKey(opts.operatorUserId, opts.anonymousUserId), localDate, opts.timeZone);
|
|
3793
3895
|
setRefreshKey((n) => n + 1);
|
|
3794
3896
|
setScheduleVersion((n) => n + 1);
|
|
3795
|
-
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate]);
|
|
3897
|
+
}, [opts.operatorId, opts.operatorUserId, opts.anonymousUserId, localDate, opts.timeZone]);
|
|
3796
3898
|
return { groups, localDate, matchDays, scheduleLoaded, states, liveCount, stale, refreshSchedule, scheduleVersion, _tick: tick };
|
|
3797
3899
|
}
|
|
3798
3900
|
|
|
@@ -6327,8 +6429,8 @@ function OddsRow({ vm, row, ui, slip, inSlipIds, history, suppressSlip }) {
|
|
|
6327
6429
|
] });
|
|
6328
6430
|
}
|
|
6329
6431
|
var STALE_AFTER_MS = 12e4;
|
|
6330
|
-
function fmtHhMm(iso, tag2, clock3) {
|
|
6331
|
-
return formatTime(iso, tag2, clock3);
|
|
6432
|
+
function fmtHhMm(iso, tag2, clock3, timeZone) {
|
|
6433
|
+
return formatTime(iso, tag2, clock3, { timeZone });
|
|
6332
6434
|
}
|
|
6333
6435
|
function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }) {
|
|
6334
6436
|
const [open, setOpen] = (0, import_react33.useState)(false);
|
|
@@ -6341,7 +6443,7 @@ function MarketOddsCard({ vm, ui, slip, monitor, inSlipIds, hideHeader, pinRef }
|
|
|
6341
6443
|
const isClosed = closedReason !== null;
|
|
6342
6444
|
const asOfMs = live ? new Date(live.asOfUtc).getTime() : NaN;
|
|
6343
6445
|
const isStale = live != null && !isClosed && (vm.awaitingLiveUpdate === true || Date.now() - asOfMs > STALE_AFTER_MS);
|
|
6344
|
-
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui)) : null;
|
|
6446
|
+
const staleTime = isStale && live ? fmtHhMm(live.asOfUtc, ui.locale, clockOf(ui), ui.timeZone) : null;
|
|
6345
6447
|
const [, setStaleTick] = (0, import_react33.useState)(0);
|
|
6346
6448
|
const watchStale = live != null && !isClosed && !isStale;
|
|
6347
6449
|
(0, import_react33.useEffect)(() => {
|
|
@@ -6467,9 +6569,9 @@ function allowedForStars(stars, leg) {
|
|
|
6467
6569
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
6468
6570
|
var asOf = (iso, ui) => {
|
|
6469
6571
|
const at2 = new Date(iso);
|
|
6470
|
-
const time = fmtHhMm(iso, ui.locale, clockOf(ui));
|
|
6471
|
-
if (at2.
|
|
6472
|
-
return `${formatDate(at2, ui.locale, { day: "numeric", month: "short" })} ${time}`;
|
|
6572
|
+
const time = fmtHhMm(iso, ui.locale, clockOf(ui), ui.timeZone);
|
|
6573
|
+
if (zonedDayNumber(at2.getTime(), ui.timeZone) === zonedDayNumber(Date.now(), ui.timeZone)) return time;
|
|
6574
|
+
return `${formatDate(at2, ui.locale, { day: "numeric", month: "short", timeZone: ui.timeZone })} ${time}`;
|
|
6473
6575
|
};
|
|
6474
6576
|
function CardLine({ card, ui, slip, sport, marketKey, conversation, operatorUserId, anonymousUserId }) {
|
|
6475
6577
|
const matchId = card.matchId;
|
|
@@ -6691,9 +6793,8 @@ function instantMs(iso) {
|
|
|
6691
6793
|
const ms = Date.parse(iso);
|
|
6692
6794
|
return Number.isNaN(ms) ? null : ms;
|
|
6693
6795
|
}
|
|
6694
|
-
function localDayStart(ms) {
|
|
6695
|
-
|
|
6696
|
-
return new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
6796
|
+
function localDayStart(ms, timeZone) {
|
|
6797
|
+
return zonedDayNumber(ms, timeZone) * 864e5;
|
|
6697
6798
|
}
|
|
6698
6799
|
function kickoffText(ui, iso) {
|
|
6699
6800
|
if (instantMs(iso) === null) return null;
|
|
@@ -6858,15 +6959,15 @@ function MatchCard({ card, ui, slip, sport, marketKey, conversation, operatorUse
|
|
|
6858
6959
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6859
6960
|
var STATUSES = ["available", "doubtful", "out"];
|
|
6860
6961
|
var MAX_MARKS = 30;
|
|
6861
|
-
|
|
6862
|
-
function clock(iso) {
|
|
6962
|
+
function clock(iso, ui) {
|
|
6863
6963
|
if (!iso) return null;
|
|
6864
6964
|
const at2 = new Date(iso);
|
|
6865
|
-
|
|
6965
|
+
if (Number.isNaN(at2.getTime())) return null;
|
|
6966
|
+
return formatTime(at2, ui.locale, clockOf(ui), { timeZone: ui.timeZone });
|
|
6866
6967
|
}
|
|
6867
6968
|
function badge(card, ui) {
|
|
6868
6969
|
if (card.status === "out") {
|
|
6869
|
-
const time = clock(card.statusAsOfUtc);
|
|
6970
|
+
const time = clock(card.statusAsOfUtc, ui);
|
|
6870
6971
|
return { kind: "out", text: time ? ui.v8Out(time) : ui.v8OutNoTime };
|
|
6871
6972
|
}
|
|
6872
6973
|
return card.status === "doubtful" ? { kind: "doubtful", text: ui.v8Doubtful } : null;
|
|
@@ -6914,10 +7015,10 @@ function SinceLines({ since, ui }) {
|
|
|
6914
7015
|
// src/components/dashboard/v8/YouRibbon.tsx
|
|
6915
7016
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
6916
7017
|
var FROM_CHATS_SHOWN = 2;
|
|
6917
|
-
function showsNoGamesNote(chip, now = Date.now()) {
|
|
7018
|
+
function showsNoGamesNote(chip, now = Date.now(), timeZone) {
|
|
6918
7019
|
if (chip.kind !== "competition") return false;
|
|
6919
7020
|
const at2 = instantMs(chip.nextGameAtUtc);
|
|
6920
|
-
if (at2 !== null) return localDayStart(at2) > localDayStart(now);
|
|
7021
|
+
if (at2 !== null) return localDayStart(at2, timeZone) > localDayStart(now, timeZone);
|
|
6921
7022
|
return chip.noGamesToday === true;
|
|
6922
7023
|
}
|
|
6923
7024
|
function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
|
|
@@ -6927,7 +7028,7 @@ function YouRibbon({ ribbon, ui, controller, holds, sport, onMore }) {
|
|
|
6927
7028
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { className: "ss-w-v8-sec ss-w-v8-ribbon", children: [
|
|
6928
7029
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ss-w-v8-chips", children: [
|
|
6929
7030
|
ribbon.stars.map((chip, i) => {
|
|
6930
|
-
const quiet = showsNoGamesNote(chip);
|
|
7031
|
+
const quiet = showsNoGamesNote(chip, Date.now(), ui.timeZone);
|
|
6931
7032
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: `ss-w-v8-chip ss-w-v8-chip--${chip.kind}`, children: [
|
|
6932
7033
|
chip.playing && !quiet ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("i", { className: "ss-w-v8-playing", "aria-hidden": "true" }) : null,
|
|
6933
7034
|
chip.label,
|
|
@@ -7140,54 +7241,9 @@ var import_react40 = require("react");
|
|
|
7140
7241
|
|
|
7141
7242
|
// src/useScheduleDay.ts
|
|
7142
7243
|
var import_react39 = require("react");
|
|
7143
|
-
|
|
7144
|
-
// src/scheduleDays.ts
|
|
7145
|
-
var MAX_AFTER_TODAY = 6;
|
|
7146
|
-
var parts = (date) => {
|
|
7147
|
-
const [y = 0, m = 1, d = 1] = date.split("-").map(Number);
|
|
7148
|
-
return [y, m, d];
|
|
7149
|
-
};
|
|
7150
|
-
function offsetOf(localDate) {
|
|
7151
|
-
const [y, m, d] = parts(localDate);
|
|
7152
|
-
return -new Date(y, m - 1, d, 12).getTimezoneOffset();
|
|
7153
|
-
}
|
|
7154
|
-
function localDateOfUnix(unix, offsetMinutes = -new Date(unix * 1e3).getTimezoneOffset()) {
|
|
7155
|
-
return new Date((unix + offsetMinutes * 60) * 1e3).toISOString().slice(0, 10);
|
|
7156
|
-
}
|
|
7157
|
-
var dayAfter = (date) => {
|
|
7158
|
-
const [y, m, d] = parts(date);
|
|
7159
|
-
return new Date(Date.UTC(y, m - 1, d + 1)).toISOString().slice(0, 10);
|
|
7160
|
-
};
|
|
7161
|
-
function buildDayChips(today, matchDays, sport) {
|
|
7162
|
-
const dates = /* @__PURE__ */ new Set();
|
|
7163
|
-
for (const md of matchDays) {
|
|
7164
|
-
if (sport !== "all" && md.sport !== sport) continue;
|
|
7165
|
-
for (const date of md.dates) if (date > today) dates.add(date);
|
|
7166
|
-
}
|
|
7167
|
-
const chips = [{ date: today, isToday: true, gapBefore: false }];
|
|
7168
|
-
for (const date of [...dates].sort().slice(0, MAX_AFTER_TODAY)) {
|
|
7169
|
-
const prev = chips[chips.length - 1];
|
|
7170
|
-
chips.push({ date, isToday: false, gapBefore: prev !== void 0 && dayAfter(prev.date) !== date });
|
|
7171
|
-
}
|
|
7172
|
-
return chips;
|
|
7173
|
-
}
|
|
7174
|
-
function weekdayAndDay(date, tag2) {
|
|
7175
|
-
const [y, m, d] = parts(date);
|
|
7176
|
-
const at2 = new Date(Date.UTC(y, m - 1, d, 12));
|
|
7177
|
-
return {
|
|
7178
|
-
weekday: formatDate(at2, tag2, { weekday: "short", timeZone: "UTC" }),
|
|
7179
|
-
day: formatDate(at2, tag2, { day: "numeric", timeZone: "UTC" })
|
|
7180
|
-
};
|
|
7181
|
-
}
|
|
7182
|
-
function weekdayLong(date, tag2) {
|
|
7183
|
-
const [y, m, d] = parts(date);
|
|
7184
|
-
return formatDate(new Date(Date.UTC(y, m - 1, d, 12)), tag2, { weekday: "long", timeZone: "UTC" });
|
|
7185
|
-
}
|
|
7186
|
-
|
|
7187
|
-
// src/useScheduleDay.ts
|
|
7188
7244
|
var EMPTY = [];
|
|
7189
7245
|
function useScheduleDay(opts) {
|
|
7190
|
-
const { localDate, today, todayGroups, enabled, resetKey } = opts;
|
|
7246
|
+
const { localDate, today, todayGroups, enabled, resetKey, timeZone } = opts;
|
|
7191
7247
|
const getRef = (0, import_react39.useRef)(opts.getSchedule);
|
|
7192
7248
|
getRef.current = opts.getSchedule;
|
|
7193
7249
|
const daysRef = (0, import_react39.useRef)(/* @__PURE__ */ new Map());
|
|
@@ -7195,12 +7251,14 @@ function useScheduleDay(opts) {
|
|
|
7195
7251
|
const [retryKey, setRetryKey] = (0, import_react39.useState)(0);
|
|
7196
7252
|
const [seenDate, setSeenDate] = (0, import_react39.useState)(localDate);
|
|
7197
7253
|
const [seenReset, setSeenReset] = (0, import_react39.useState)(resetKey);
|
|
7254
|
+
const [seenZone, setSeenZone] = (0, import_react39.useState)(timeZone);
|
|
7198
7255
|
if (seenDate !== localDate) {
|
|
7199
7256
|
setSeenDate(localDate);
|
|
7200
7257
|
setFetched({ status: "idle", groups: EMPTY });
|
|
7201
7258
|
}
|
|
7202
|
-
if (seenReset !== resetKey) {
|
|
7259
|
+
if (seenReset !== resetKey || seenZone !== timeZone) {
|
|
7203
7260
|
setSeenReset(resetKey);
|
|
7261
|
+
setSeenZone(timeZone);
|
|
7204
7262
|
daysRef.current.clear();
|
|
7205
7263
|
setFetched({ status: "idle", groups: EMPTY });
|
|
7206
7264
|
}
|
|
@@ -7211,7 +7269,7 @@ function useScheduleDay(opts) {
|
|
|
7211
7269
|
setFetched({ status: "loading", groups: EMPTY });
|
|
7212
7270
|
void (async () => {
|
|
7213
7271
|
try {
|
|
7214
|
-
const payload = await getRef.current(localDate, offsetOf(localDate));
|
|
7272
|
+
const payload = await getRef.current(localDate, offsetOf(localDate, timeZone));
|
|
7215
7273
|
if (cancelled) return;
|
|
7216
7274
|
if (!payload) {
|
|
7217
7275
|
setFetched({ status: "error", groups: EMPTY });
|
|
@@ -7226,7 +7284,7 @@ function useScheduleDay(opts) {
|
|
|
7226
7284
|
return () => {
|
|
7227
7285
|
cancelled = true;
|
|
7228
7286
|
};
|
|
7229
|
-
}, [localDate, isToday, enabled, retryKey, resetKey]);
|
|
7287
|
+
}, [localDate, isToday, enabled, retryKey, resetKey, timeZone]);
|
|
7230
7288
|
const retry = (0, import_react39.useCallback)(() => {
|
|
7231
7289
|
setRetryKey((k) => k + 1);
|
|
7232
7290
|
}, []);
|
|
@@ -7238,7 +7296,7 @@ function useScheduleDay(opts) {
|
|
|
7238
7296
|
}
|
|
7239
7297
|
|
|
7240
7298
|
// src/useMatchesDay.ts
|
|
7241
|
-
function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
|
|
7299
|
+
function useMatchesDay({ discovery, day, sport, getSchedule, enabled, timeZone }) {
|
|
7242
7300
|
const { localDate: today, matchDays } = discovery;
|
|
7243
7301
|
const chips = (0, import_react40.useMemo)(() => buildDayChips(today, matchDays, sport), [today, matchDays, sport]);
|
|
7244
7302
|
const selected = chips.some((c) => c.date === day) ? day : today;
|
|
@@ -7248,6 +7306,7 @@ function useMatchesDay({ discovery, day, sport, getSchedule, enabled }) {
|
|
|
7248
7306
|
todayGroups: discovery.groups,
|
|
7249
7307
|
getSchedule,
|
|
7250
7308
|
enabled,
|
|
7309
|
+
timeZone,
|
|
7251
7310
|
resetKey: String(discovery.scheduleVersion)
|
|
7252
7311
|
});
|
|
7253
7312
|
return { ...loaded, chips, selected };
|
|
@@ -8767,6 +8826,7 @@ var SCATTER_VIEW = { w: 400, h: 250, pad: { l: 34, r: 12, t: 12, b: 30 } };
|
|
|
8767
8826
|
var FORM_VIEW = { w: 400, h: 170, pad: { l: 28, r: 8, t: 14, b: 40 } };
|
|
8768
8827
|
var PATH_VIEW = { w: 400, h: 165, pad: { l: 8, r: 8, t: 18, b: 22 } };
|
|
8769
8828
|
var ROUND_STEPS = 11;
|
|
8829
|
+
var MIN_SPAN_STEPS = 3;
|
|
8770
8830
|
var MAX_BAR_W = 28;
|
|
8771
8831
|
var BAR_GAP = 4;
|
|
8772
8832
|
var MAX_TICKS = 6;
|
|
@@ -8781,7 +8841,7 @@ function ticksFor(lo, hi) {
|
|
|
8781
8841
|
return out;
|
|
8782
8842
|
}
|
|
8783
8843
|
function scatterScale(e) {
|
|
8784
|
-
const { w, h, pad
|
|
8844
|
+
const { w, h, pad } = SCATTER_VIEW;
|
|
8785
8845
|
const xs = finite3([...e.field.map((d) => d.returnPct), ...e.marked.map((m) => m.returnPct), e.tourReturnPct]);
|
|
8786
8846
|
const ys = finite3([...e.field.map((d) => d.servePct), ...e.marked.map((m) => m.servePct), e.tourServePct]);
|
|
8787
8847
|
const x0 = Math.floor(Math.min(...xs) - 1);
|
|
@@ -8789,49 +8849,94 @@ function scatterScale(e) {
|
|
|
8789
8849
|
const y0 = Math.floor(Math.min(...ys) - 1);
|
|
8790
8850
|
const y1 = Math.ceil(Math.max(...ys) + 1);
|
|
8791
8851
|
return {
|
|
8792
|
-
x: (v) => round22(
|
|
8793
|
-
y: (v) => round22(h -
|
|
8852
|
+
x: (v) => round22(pad.l + (v - x0) / (x1 - x0) * (w - pad.l - pad.r)),
|
|
8853
|
+
y: (v) => round22(h - pad.b - (v - y0) / (y1 - y0) * (h - pad.t - pad.b)),
|
|
8794
8854
|
ticksX: ticksFor(x0, x1),
|
|
8795
8855
|
ticksY: ticksFor(y0, y1)
|
|
8796
8856
|
};
|
|
8797
8857
|
}
|
|
8798
8858
|
function formBars(e) {
|
|
8799
|
-
const { w, h, pad
|
|
8859
|
+
const { w, h, pad } = FORM_VIEW;
|
|
8800
8860
|
const n = e.matches.length;
|
|
8801
8861
|
const bounds = finite3([e.min, e.max, e.tourServePct]);
|
|
8802
8862
|
const lo = Math.min(...bounds) - 4;
|
|
8803
8863
|
const hi = Math.max(...bounds) + 2;
|
|
8804
|
-
const plotW = w -
|
|
8805
|
-
const base = h -
|
|
8806
|
-
const y = (v) => round22(base - (v - lo) / (hi - lo) * (h -
|
|
8864
|
+
const plotW = w - pad.l - pad.r;
|
|
8865
|
+
const base = h - pad.b;
|
|
8866
|
+
const y = (v) => round22(base - (v - lo) / (hi - lo) * (h - pad.t - pad.b));
|
|
8807
8867
|
const slot = plotW / Math.max(n, 1);
|
|
8808
8868
|
const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
|
|
8809
8869
|
const bars = e.matches.map((m, i) => {
|
|
8810
8870
|
const top = y(clampTo(m.servePct, lo, hi));
|
|
8811
|
-
return { x: round22(
|
|
8871
|
+
return { x: round22(pad.l + slot * i + (slot - bw) / 2), w: round22(bw), y: top, h: round22(base - top), won: m.result === "W" };
|
|
8812
8872
|
});
|
|
8813
8873
|
return { bars, tourY: y(e.tourServePct) };
|
|
8814
8874
|
}
|
|
8815
|
-
|
|
8816
|
-
|
|
8875
|
+
var GLYPH_W = 4.6;
|
|
8876
|
+
var FORM_GLYPH_W = 5.1;
|
|
8877
|
+
var FORM_LABEL_GAP = 10;
|
|
8878
|
+
var GUTTER_PAD = 6;
|
|
8879
|
+
var ROUND_LABEL_FONT = 9;
|
|
8880
|
+
var ROUND_LABEL_MIN_GAP = ROUND_LABEL_FONT * 1.4;
|
|
8881
|
+
function fitLabel(text2, width, glyph = GLYPH_W) {
|
|
8882
|
+
const max = Math.max(Math.floor((width - 1) / glyph), 2);
|
|
8883
|
+
return text2.length <= max ? text2 : `${text2.slice(0, max - 1)}\u2026`;
|
|
8884
|
+
}
|
|
8885
|
+
function formLabelWidth(slot) {
|
|
8886
|
+
return Math.max(slot * 2 - FORM_LABEL_GAP, 0);
|
|
8887
|
+
}
|
|
8888
|
+
function roundSpan(e) {
|
|
8889
|
+
const known = e.events.filter((ev) => ev.roundIndex >= 0).map((ev) => clampTo(ev.roundIndex, 0, ROUND_STEPS - 1));
|
|
8890
|
+
const lo = Math.min(ROUND_STEPS - MIN_SPAN_STEPS, ...known);
|
|
8891
|
+
return { lo, span: ROUND_STEPS - lo };
|
|
8892
|
+
}
|
|
8893
|
+
function pathRounds(e) {
|
|
8894
|
+
const { h, pad } = PATH_VIEW;
|
|
8895
|
+
const base = h - pad.b;
|
|
8896
|
+
const plotH = h - pad.t - pad.b;
|
|
8897
|
+
const { lo, span } = roundSpan(e);
|
|
8898
|
+
const seen = /* @__PURE__ */ new Map();
|
|
8899
|
+
for (const ev of e.events) {
|
|
8900
|
+
if (ev.roundIndex < 0) continue;
|
|
8901
|
+
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8902
|
+
const short = typeof ev.roundShort === "string" ? ev.roundShort : "";
|
|
8903
|
+
if (short !== "" && !seen.has(idx)) seen.set(idx, short);
|
|
8904
|
+
}
|
|
8905
|
+
const kept = [];
|
|
8906
|
+
for (const [roundIndex, label] of [...seen.entries()].sort((a, b) => b[0] - a[0])) {
|
|
8907
|
+
const y = round22(base - (roundIndex - lo + 1) / span * plotH);
|
|
8908
|
+
const last = kept[kept.length - 1];
|
|
8909
|
+
if (last === void 0 || y - last.y >= ROUND_LABEL_MIN_GAP) kept.push({ roundIndex, label, y });
|
|
8910
|
+
}
|
|
8911
|
+
return kept.reverse();
|
|
8912
|
+
}
|
|
8913
|
+
function pathGutter(e) {
|
|
8914
|
+
const rounds = pathRounds(e);
|
|
8915
|
+
if (rounds.length === 0) return PATH_VIEW.pad.l;
|
|
8916
|
+
const longest = Math.max(...rounds.map((r) => r.label.length));
|
|
8917
|
+
return Math.max(PATH_VIEW.pad.l, Math.ceil(longest * GLYPH_W) + GUTTER_PAD + 4);
|
|
8918
|
+
}
|
|
8919
|
+
function pathBars(e, left = PATH_VIEW.pad.l) {
|
|
8920
|
+
const { w, h, pad } = PATH_VIEW;
|
|
8817
8921
|
const n = e.events.length;
|
|
8818
|
-
const plotW = w -
|
|
8819
|
-
const plotH = h -
|
|
8820
|
-
const base = h -
|
|
8922
|
+
const plotW = w - left - pad.r;
|
|
8923
|
+
const plotH = h - pad.t - pad.b;
|
|
8924
|
+
const base = h - pad.b;
|
|
8821
8925
|
const slot = plotW / Math.max(n, 1);
|
|
8822
8926
|
const bw = Math.max(1, Math.min(MAX_BAR_W, slot - BAR_GAP));
|
|
8823
|
-
const
|
|
8927
|
+
const { lo, span } = roundSpan(e);
|
|
8928
|
+
const heightOf = (steps) => Math.min(steps, span) / span * plotH;
|
|
8824
8929
|
return e.events.map((ev, i) => {
|
|
8825
|
-
const idx = clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8826
|
-
const bh = heightOf(idx + 1);
|
|
8930
|
+
const idx = ev.roundIndex < 0 ? lo : clampTo(ev.roundIndex, 0, ROUND_STEPS - 1);
|
|
8931
|
+
const bh = heightOf(idx - lo + 1);
|
|
8827
8932
|
return {
|
|
8828
|
-
x: round22(
|
|
8933
|
+
x: round22(left + slot * i + (slot - bw) / 2),
|
|
8829
8934
|
w: round22(bw),
|
|
8830
8935
|
h: round22(bh),
|
|
8831
8936
|
y: round22(base - bh),
|
|
8832
8937
|
surface: ev.surface ?? null,
|
|
8833
8938
|
title: ev.title,
|
|
8834
|
-
capY: ev.laterRoundsMissing ? round22(base - heightOf(idx + 2)) : null
|
|
8939
|
+
capY: ev.laterRoundsMissing ? round22(base - heightOf(idx - lo + 2)) : null
|
|
8835
8940
|
};
|
|
8836
8941
|
});
|
|
8837
8942
|
}
|
|
@@ -8844,12 +8949,7 @@ function labelSide(p, view) {
|
|
|
8844
8949
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
8845
8950
|
var SURFACES = /* @__PURE__ */ new Set(["hard", "clay", "grass"]);
|
|
8846
8951
|
var surfaceOf = (code) => code && SURFACES.has(code) ? code : "other";
|
|
8847
|
-
var GLYPH_W = 4.6;
|
|
8848
8952
|
var pct = (v, ui, digits = 1) => formatNumber(v / 100, ui.locale, { style: "percent", minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
8849
|
-
function fitLabel(text2, slot) {
|
|
8850
|
-
const max = Math.max(Math.floor((slot - 1) / GLYPH_W), 2);
|
|
8851
|
-
return text2.length <= max ? text2 : `${text2.slice(0, max - 1)}\u2026`;
|
|
8852
|
-
}
|
|
8853
8953
|
function Country({ code }) {
|
|
8854
8954
|
return code ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ss-w-tni-cc", children: code }) : null;
|
|
8855
8955
|
}
|
|
@@ -8881,7 +8981,7 @@ function TennisInsightPriceRow({ prices }) {
|
|
|
8881
8981
|
] });
|
|
8882
8982
|
}
|
|
8883
8983
|
function ServeReturnChart({ vm, e, ui }) {
|
|
8884
|
-
const { w, h, pad
|
|
8984
|
+
const { w, h, pad } = SCATTER_VIEW;
|
|
8885
8985
|
const s = scatterScale(e);
|
|
8886
8986
|
const tx = s.x(e.tourReturnPct);
|
|
8887
8987
|
const ty = s.y(e.tourServePct);
|
|
@@ -8893,19 +8993,19 @@ function ServeReturnChart({ vm, e, ui }) {
|
|
|
8893
8993
|
});
|
|
8894
8994
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8895
8995
|
s.ticksX.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
8896
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1:
|
|
8897
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: s.x(t), y: h -
|
|
8996
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: s.x(t), x2: s.x(t), y1: pad.t, y2: h - pad.b }),
|
|
8997
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: s.x(t), y: h - pad.b + 11, textAnchor: "middle", children: pct(t, ui, 0) })
|
|
8898
8998
|
] }, `x${t}`)),
|
|
8899
8999
|
s.ticksY.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
8900
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1:
|
|
8901
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x:
|
|
9000
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: s.y(t), y2: s.y(t) }),
|
|
9001
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: s.y(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
|
|
8902
9002
|
] }, `y${t}`)),
|
|
8903
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x:
|
|
8904
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", transform: `translate(8 ${
|
|
9003
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad.l + (w - pad.l - pad.r) / 2, y: h - 3, textAnchor: "middle", children: e.xAxis }),
|
|
9004
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", transform: `translate(8 ${pad.t + (h - pad.t - pad.b) / 2}) rotate(-90)`, textAnchor: "middle", children: e.yAxis }),
|
|
8905
9005
|
e.field.map((d) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { className: "ss-w-tni-dot", cx: s.x(d.returnPct), cy: s.y(d.servePct), r: 2.4 }, d.playerId)),
|
|
8906
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1:
|
|
8907
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1:
|
|
8908
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w -
|
|
9006
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: tx, x2: tx, y1: pad.t, y2: h - pad.b }),
|
|
9007
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: ty, y2: ty }),
|
|
9008
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad.r - 2, y: ty - 4, textAnchor: "end", children: e.tourAverage }),
|
|
8909
9009
|
e.marked.map((m, i) => {
|
|
8910
9010
|
const l = labels[i];
|
|
8911
9011
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
@@ -8926,15 +9026,15 @@ function ServeReturnCard({ vm, e, ui }) {
|
|
|
8926
9026
|
] });
|
|
8927
9027
|
}
|
|
8928
9028
|
function ServeFormCard({ vm, e, ui }) {
|
|
8929
|
-
const { w, h, pad
|
|
9029
|
+
const { w, h, pad } = FORM_VIEW;
|
|
8930
9030
|
const { bars, tourY } = formBars(e);
|
|
8931
9031
|
const lo = Math.min(e.min, e.tourServePct) - 4;
|
|
8932
9032
|
const hi = Math.max(e.max, e.tourServePct) + 2;
|
|
8933
|
-
const base = h -
|
|
8934
|
-
const yOf = (v) => base - (v - lo) / (hi - lo) * (h -
|
|
9033
|
+
const base = h - pad.b;
|
|
9034
|
+
const yOf = (v) => base - (v - lo) / (hi - lo) * (h - pad.t - pad.b);
|
|
8935
9035
|
const ticks = [];
|
|
8936
9036
|
for (let t = Math.ceil(lo / 5) * 5; t <= hi; t += 5) ticks.push(t);
|
|
8937
|
-
const slot = (w -
|
|
9037
|
+
const slot = (w - pad.l - pad.r) / Math.max(e.matches.length, 1);
|
|
8938
9038
|
const tiles = [
|
|
8939
9039
|
{ label: e.labels.average, value: pct(e.average, ui) },
|
|
8940
9040
|
e.winsAverage == null ? null : { label: e.labels.inWins, value: pct(e.winsAverage, ui) },
|
|
@@ -8943,10 +9043,10 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8943
9043
|
].filter((t) => t !== null);
|
|
8944
9044
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
8945
9045
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8946
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x:
|
|
9046
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-axis", x: pad.l, y: 9, children: e.labels.metric }),
|
|
8947
9047
|
ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
8948
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1:
|
|
8949
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x:
|
|
9048
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: pad.l, x2: w - pad.r, y1: yOf(t), y2: yOf(t) }),
|
|
9049
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: pad.l - 4, y: yOf(t) + 3, textAnchor: "end", children: pct(t, ui, 0) })
|
|
8950
9050
|
] }, t)),
|
|
8951
9051
|
bars.map((b, i) => {
|
|
8952
9052
|
const m = e.matches[i];
|
|
@@ -8955,11 +9055,11 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8955
9055
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
8956
9056
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("rect", { className: `ss-w-tni-fbar ss-w-tni-fbar-${b.won ? "w" : "l"}`, x: b.x, y: b.y, width: b.w, height: b.h, rx: 2, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("title", { children: `${m.opponent} \xB7 ${resultLabel2} \xB7 ${pct(m.servePct, ui)}` }) }),
|
|
8957
9057
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: `ss-w-tni-xl ss-w-tni-xl-${b.won ? "w" : "l"}`, x: cx, y: base + 11, textAnchor: "middle", children: resultLabel2 }),
|
|
8958
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-xl", x: cx, y: base + (i % 2 === 0 ? 22 : 32), textAnchor: "middle", children: fitLabel(m.opponent, slot
|
|
9058
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-xl", x: cx, y: base + (i % 2 === 0 ? 22 : 32), textAnchor: "middle", children: fitLabel(m.opponent, formLabelWidth(slot), FORM_GLYPH_W) })
|
|
8959
9059
|
] }, m.matchId);
|
|
8960
9060
|
}),
|
|
8961
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1:
|
|
8962
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w -
|
|
9061
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-tour", x1: pad.l, x2: w - pad.r, y1: tourY, y2: tourY }),
|
|
9062
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-lab ss-w-tni-lab-faint", x: w - pad.r - 2, y: pad.t - 4, textAnchor: "end", children: `${e.labels.tourAverage} ${pct(e.tourServePct, ui)}` })
|
|
8963
9063
|
] }),
|
|
8964
9064
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ss-w-tni-tiles", children: tiles.map((t) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ss-w-tni-tile", children: [
|
|
8965
9065
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ss-w-tni-tile-v", children: t.value }),
|
|
@@ -8968,22 +9068,27 @@ function ServeFormCard({ vm, e, ui }) {
|
|
|
8968
9068
|
] });
|
|
8969
9069
|
}
|
|
8970
9070
|
function SeasonPathCard({ vm, e, ui }) {
|
|
8971
|
-
const { w, h, pad
|
|
8972
|
-
const
|
|
8973
|
-
const
|
|
8974
|
-
const
|
|
8975
|
-
const
|
|
9071
|
+
const { w, h, pad } = PATH_VIEW;
|
|
9072
|
+
const left = pathGutter(e);
|
|
9073
|
+
const bars = pathBars(e, left);
|
|
9074
|
+
const rounds = pathRounds(e);
|
|
9075
|
+
const base = h - pad.b;
|
|
9076
|
+
const labelled = (w - pad.l - pad.r) / Math.max(e.events.length, 1) >= 22;
|
|
8976
9077
|
const NAME_ROOM = 46;
|
|
9078
|
+
const namesShown = labelled && e.events.some((ev) => ev.name);
|
|
8977
9079
|
const hasTitle = e.events.some((ev) => ev.title);
|
|
8978
9080
|
const hasCap = e.events.some((ev) => ev.laterRoundsMissing);
|
|
8979
9081
|
const aliveChip = e.aliveLabel ? e.events.some((ev) => ev.alive) : false;
|
|
8980
9082
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
8981
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h + NAME_ROOM}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
8982
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.
|
|
9083
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { className: "ss-w-tni-svg", viewBox: `0 0 ${w} ${h + (namesShown ? NAME_ROOM : -14)}`, width: "100%", role: "img", "aria-label": summaryOf(vm, ui), children: [
|
|
9084
|
+
rounds.map((r) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
9085
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid ss-w-tni-rline", x1: left, x2: w - pad.r, y1: r.y, y2: r.y }),
|
|
9086
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-tick", x: left - 4, y: r.y + 3, textAnchor: "end", children: r.label })
|
|
9087
|
+
] }, `r${r.roundIndex}`)),
|
|
9088
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { className: "ss-w-tni-grid", x1: left, x2: w - pad.r, y1: base, y2: base }),
|
|
8983
9089
|
bars.map((b, i) => {
|
|
8984
9090
|
const ev = e.events[i];
|
|
8985
9091
|
const surface = surfaceOf(b.surface);
|
|
8986
|
-
const short = typeof ev.roundShort === "string" && ev.roundShort !== "" ? ev.roundShort : null;
|
|
8987
9092
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("g", { children: [
|
|
8988
9093
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8989
9094
|
"rect",
|
|
@@ -9001,7 +9106,6 @@ function SeasonPathCard({ vm, e, ui }) {
|
|
|
9001
9106
|
),
|
|
9002
9107
|
b.capY !== null ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("rect", { className: "ss-w-tni-cap", x: b.x, y: b.capY, width: b.w, height: b.y - b.capY, rx: Math.min(2, b.w / 2), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("title", { children: e.laterRoundsMissingLabel }) }) : null,
|
|
9003
9108
|
b.title ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { className: "ss-w-tni-titlemark", d: `M${b.x + b.w / 2} ${b.y - 9} l3.5 6 h-7 z`, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("title", { children: e.titleMark }) }) : null,
|
|
9004
|
-
labelled && short && short.length * GLYPH_W <= slot - 1 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-xl", x: b.x + b.w / 2, y: base + 12, textAnchor: "middle", children: short }) : null,
|
|
9005
9109
|
labelled && ev.name ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("text", { className: "ss-w-tni-xl ss-w-tni-xl-name", transform: `translate(${b.x + b.w / 2 + 3} ${base + 19}) rotate(90)`, children: fitLabel(ev.name, NAME_ROOM * 1.1) }) : null
|
|
9006
9110
|
] }, `${ev.tournamentId}:${i}`);
|
|
9007
9111
|
})
|
|
@@ -9405,7 +9509,7 @@ function FixtureCard({ card, ui }) {
|
|
|
9405
9509
|
// src/components/dashboard/CountdownCard.tsx
|
|
9406
9510
|
var import_react50 = require("react");
|
|
9407
9511
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9408
|
-
var
|
|
9512
|
+
var DAY_MS3 = 864e5;
|
|
9409
9513
|
function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
9410
9514
|
const totalSeconds = Math.floor((kickoffUnix * 1e3 - nowMs) / 1e3);
|
|
9411
9515
|
if (totalSeconds <= 0) return null;
|
|
@@ -9413,10 +9517,10 @@ function remainingSegments(kickoffUnix, nowMs, withSeconds) {
|
|
|
9413
9517
|
const hours = Math.floor(totalSeconds % 86400 / 3600);
|
|
9414
9518
|
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
9415
9519
|
const seconds = totalSeconds % 60;
|
|
9416
|
-
const
|
|
9417
|
-
if (days > 0) return [{ value:
|
|
9418
|
-
const segs = [{ value:
|
|
9419
|
-
if (withSeconds) segs.push({ value:
|
|
9520
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
9521
|
+
if (days > 0) return [{ value: pad(days), unit: "d" }, { value: pad(hours), unit: "h" }];
|
|
9522
|
+
const segs = [{ value: pad(hours), unit: "h" }, { value: pad(minutes), unit: "m" }];
|
|
9523
|
+
if (withSeconds) segs.push({ value: pad(seconds), unit: "s" });
|
|
9420
9524
|
return segs;
|
|
9421
9525
|
}
|
|
9422
9526
|
function CountdownCard({ card, ui }) {
|
|
@@ -9426,7 +9530,7 @@ function CountdownCard({ card, ui }) {
|
|
|
9426
9530
|
const [reduced] = (0, import_react50.useState)(
|
|
9427
9531
|
() => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
9428
9532
|
);
|
|
9429
|
-
const withinDay = data.kickoffUnix * 1e3 - nowMs <
|
|
9533
|
+
const withinDay = data.kickoffUnix * 1e3 - nowMs < DAY_MS3;
|
|
9430
9534
|
(0, import_react50.useEffect)(() => {
|
|
9431
9535
|
if (reduced) return;
|
|
9432
9536
|
const id = window.setInterval(() => setNowMs(Date.now()), withinDay ? 1e3 : 6e4);
|
|
@@ -10734,7 +10838,7 @@ function MonitorMatchCard({ match, promotedPins, monitor, ui, slip, onAsk }) {
|
|
|
10734
10838
|
] })
|
|
10735
10839
|
] }, row.label);
|
|
10736
10840
|
}) }),
|
|
10737
|
-
match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui))) }),
|
|
10841
|
+
match.status === "stale" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(match.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) }),
|
|
10738
10842
|
match.momentum.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "ss-w-mon-mom", children: [
|
|
10739
10843
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ss-w-mon-stat-l", children: ui.momentumLabel }),
|
|
10740
10844
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MomentumWave, { points: match.momentum, label: ui.momentumLabel, clubIsHome: true })
|
|
@@ -11761,12 +11865,11 @@ function splitAtFirstSpace(label) {
|
|
|
11761
11865
|
const i = label.indexOf(" ");
|
|
11762
11866
|
return i > 0 && i < label.length - 1 ? [label.slice(0, i), label.slice(i + 1)] : null;
|
|
11763
11867
|
}
|
|
11764
|
-
function isOtherLocalDay(kickoffUnix, now) {
|
|
11765
|
-
|
|
11766
|
-
return at2.getFullYear() !== now.getFullYear() || at2.getMonth() !== now.getMonth() || at2.getDate() !== now.getDate();
|
|
11868
|
+
function isOtherLocalDay(kickoffUnix, now, timeZone) {
|
|
11869
|
+
return zonedDayNumber(kickoffUnix * 1e3, timeZone) !== zonedDayNumber(now.getTime(), timeZone);
|
|
11767
11870
|
}
|
|
11768
|
-
function kickoffLabel(kickoffUnix, tag2, clock3) {
|
|
11769
|
-
return formatTime(kickoffUnix * 1e3, tag2, clock3);
|
|
11871
|
+
function kickoffLabel(kickoffUnix, tag2, clock3, timeZone) {
|
|
11872
|
+
return formatTime(kickoffUnix * 1e3, tag2, clock3, { timeZone });
|
|
11770
11873
|
}
|
|
11771
11874
|
function Side2({ name, crest, abbr, away = false }) {
|
|
11772
11875
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: away ? "ss-w-drow-side ss-w-drow-side--away" : "ss-w-drow-side", children: [
|
|
@@ -11784,12 +11887,12 @@ function rowStatusOf(state, stale, ui) {
|
|
|
11784
11887
|
}
|
|
11785
11888
|
function FixtureRow({ match, state, stale, ui, monitor, onOpen }) {
|
|
11786
11889
|
const { isLive, hasScore, score, ticked, when: clock3 } = rowStatusOf(state, stale, ui);
|
|
11787
|
-
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui));
|
|
11890
|
+
const when = clock3 ?? kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone);
|
|
11788
11891
|
const isUsSport = sportKeyOf(match.sport) !== "football";
|
|
11789
11892
|
const pinSport = (0, import_widget_sdk25.slipSportOf)(match.sport);
|
|
11790
11893
|
const liveTone = isLive || state?.isHalfTime;
|
|
11791
11894
|
const clockParts = isUsSport && isLive && ticked !== null && !state?.isHalfTime ? splitAtFirstSpace(ticked) : null;
|
|
11792
|
-
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date()) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short" }) : null;
|
|
11895
|
+
const dayMarker = isUsSport && !liveTone && state?.phase !== "live" && isOtherLocalDay(match.kickoffUnix, /* @__PURE__ */ new Date(), ui.timeZone) ? formatDate(match.kickoffUnix * 1e3, ui.locale, { weekday: "short", timeZone: ui.timeZone }) : null;
|
|
11793
11896
|
const twoLines = clockParts ?? (dayMarker !== null ? [when, dayMarker] : null);
|
|
11794
11897
|
const whenClass = [
|
|
11795
11898
|
"ss-w-drow-when",
|
|
@@ -11959,7 +12062,7 @@ function TennisFixtureRow({ match, state, stale, ui, prices, slip, monitor }) {
|
|
|
11959
12062
|
live ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "ss-w-trow-when ss-w-trow-live", children: [
|
|
11960
12063
|
ui.liveLabel,
|
|
11961
12064
|
setLabel ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-set", children: setLabel }) : null
|
|
11962
|
-
] }) : endMark ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)) }),
|
|
12065
|
+
] }) : endMark ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--end", children: endMark }) : match.timeTba ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when ss-w-trow-when--tba", children: ui.tennis.timeTba }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-when", children: kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone) }),
|
|
11963
12066
|
pinned ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", className: "ss-w-trow-players ss-w-trow-open", onClick: open, children: players }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-players", children: players }),
|
|
11964
12067
|
showPrices && (entry === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-prices" }) : entry === null ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-prices", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "ss-w-trow-noodds", children: ui.tennis.noOdds }) }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TennisPriceCell, { match, price: entry, ui, slip })),
|
|
11965
12068
|
pinnable && monitor && pin && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PinToggle, { ui, monitor, pin })
|
|
@@ -12554,7 +12657,7 @@ function OddsLiveStrip({ m, ui }) {
|
|
|
12554
12657
|
m.minuteLabel && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-min", children: m.minuteLabel }),
|
|
12555
12658
|
m.isSuspended && !m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-susp", children: ui.suspendedLabel }),
|
|
12556
12659
|
m.isSettled && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-pill", children: ui.fullTimeLabel }),
|
|
12557
|
-
stale && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui))) })
|
|
12660
|
+
stale && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "ss-w-mon-asof", children: ui.asOf(formatTime(m.asOfUtc, ui.locale, clockOf(ui), { timeZone: ui.timeZone })) })
|
|
12558
12661
|
] });
|
|
12559
12662
|
}
|
|
12560
12663
|
function MatchesPanel({ monitor, ui, slip, onAsk, discovery }) {
|
|
@@ -12681,7 +12784,7 @@ var countryThenName = (a, b) => {
|
|
|
12681
12784
|
};
|
|
12682
12785
|
function matchSections(a) {
|
|
12683
12786
|
const live = (m) => isTreatedLive(a.states.get(keyOf3(m)), a.stale);
|
|
12684
|
-
const offset = offsetOf(a.date);
|
|
12787
|
+
const offset = offsetOf(a.date, a.timeZone);
|
|
12685
12788
|
const onDate = (m) => localDateOfUnix(m.kickoffUnix, offset) === a.date;
|
|
12686
12789
|
const afterMidnight = [];
|
|
12687
12790
|
const built = [];
|
|
@@ -12864,8 +12967,8 @@ function useModalDialog(onClose, opts = {}) {
|
|
|
12864
12967
|
|
|
12865
12968
|
// src/components/MatchSheet.tsx
|
|
12866
12969
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
12867
|
-
function kickoffDate(kickoffUnix, lang) {
|
|
12868
|
-
return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short" });
|
|
12970
|
+
function kickoffDate(kickoffUnix, lang, timeZone) {
|
|
12971
|
+
return formatDate(kickoffUnix * 1e3, lang, { weekday: "short", day: "numeric", month: "short", timeZone });
|
|
12869
12972
|
}
|
|
12870
12973
|
function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose, opener }) {
|
|
12871
12974
|
const { dialogRef, onKeyDown } = useModalDialog(onClose, { opener });
|
|
@@ -12918,7 +13021,7 @@ function MatchSheet({ match, league, state, stale, ui, monitor, onAsk, onClose,
|
|
|
12918
13021
|
};
|
|
12919
13022
|
const { score, when } = rowStatusOf(state, stale, ui);
|
|
12920
13023
|
const statusParts = [when, score].filter((v) => v !== null && v !== void 0);
|
|
12921
|
-
const status2 = statusParts.length > 0 ? statusParts.join(" \xB7 ") : ui.kickoffLine(kickoffDate(match.kickoffUnix, ui.locale), kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui)));
|
|
13024
|
+
const status2 = statusParts.length > 0 ? statusParts.join(" \xB7 ") : ui.kickoffLine(kickoffDate(match.kickoffUnix, ui.locale, ui.timeZone), kickoffLabel(match.kickoffUnix, ui.locale, clockOf(ui), ui.timeZone));
|
|
12922
13025
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "ss-w-tool-backdrop ss-w-sheet-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { ref: dialogRef, className: "ss-w-tool ss-w-sheet", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown, children: [
|
|
12923
13026
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "ss-w-tool-head", children: [
|
|
12924
13027
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("h2", { id: titleId, className: "ss-w-tool-title", children: [
|
|
@@ -13275,7 +13378,8 @@ function ScheduleMatchesPanel({ discovery, ui, monitor, sport, offered, onSport,
|
|
|
13275
13378
|
pinnedKeys,
|
|
13276
13379
|
isToday,
|
|
13277
13380
|
date: selected,
|
|
13278
|
-
query: q
|
|
13381
|
+
query: q,
|
|
13382
|
+
timeZone: ui.timeZone
|
|
13279
13383
|
});
|
|
13280
13384
|
const priced = sectionsFor("");
|
|
13281
13385
|
const { sections, afterMidnight } = searching ? sectionsFor(query) : priced;
|
|
@@ -16817,7 +16921,7 @@ function SentenceBuilder({ preset, ui, conversation, memory: memory3, slip, spor
|
|
|
16817
16921
|
void request(lastRequest.current);
|
|
16818
16922
|
} }) : null
|
|
16819
16923
|
] }),
|
|
16820
|
-
quotedAt ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui))) }) : null
|
|
16924
|
+
quotedAt ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("p", { className: "ss-w-v8-builder-note", "data-testid": "v8-asof", children: ui.v8PricesAsOf(fmtHhMm(quotedAt, ui.locale, clockOf(ui), ui.timeZone)) }) : null
|
|
16821
16925
|
] }) : null
|
|
16822
16926
|
] }) : null });
|
|
16823
16927
|
}
|
|
@@ -20508,6 +20612,7 @@ var WIDGET_CSS = `.ss-w-root { all: revert; }
|
|
|
20508
20612
|
.ss-w-root[data-ss-w-theme="dark"] .ss-w-tni { --ss-w-tni-hard: #5b83c8; --ss-w-tni-clay: #e0835a; --ss-w-tni-grass: #5cc069; --ss-w-tni-other: #8b95a1; }
|
|
20509
20613
|
.ss-w-tni-svg { display: block; width: 100%; height: auto; max-width: 100%; overflow: hidden; font-variant-numeric: tabular-nums; }
|
|
20510
20614
|
.ss-w-tni-grid { stroke: var(--ss-w-line); stroke-width: 1; }
|
|
20615
|
+
.ss-w-tni-rline { stroke-dasharray: 2 3; opacity: 0.6; }
|
|
20511
20616
|
.ss-w-tni-tick { font-size: 9px; fill: var(--ss-w-faint); }
|
|
20512
20617
|
.ss-w-tni-axis { font-size: 9.5px; fill: var(--ss-w-faint); }
|
|
20513
20618
|
.ss-w-tni-dot { fill: var(--ss-w-ink); opacity: 0.35; }
|
|
@@ -20661,7 +20766,8 @@ function StatsWidget(props) {
|
|
|
20661
20766
|
operatorUserId,
|
|
20662
20767
|
anonymousUserId,
|
|
20663
20768
|
isOpen: panelOpen,
|
|
20664
|
-
pinnedMatchIds
|
|
20769
|
+
pinnedMatchIds,
|
|
20770
|
+
timeZone: ui.timeZone
|
|
20665
20771
|
});
|
|
20666
20772
|
const offeredSports = (0, import_react102.useMemo)(() => {
|
|
20667
20773
|
const seen = new Set(discovery.matchDays.map((d) => d.sport));
|
|
@@ -20676,7 +20782,8 @@ function StatsWidget(props) {
|
|
|
20676
20782
|
day: matchesDay,
|
|
20677
20783
|
sport: scheduleSport.sport,
|
|
20678
20784
|
getSchedule,
|
|
20679
|
-
enabled: panelOpen && monitor.activeTab === "matches"
|
|
20785
|
+
enabled: panelOpen && monitor.activeTab === "matches",
|
|
20786
|
+
timeZone: ui.timeZone
|
|
20680
20787
|
});
|
|
20681
20788
|
const prevLiveSnapshotRef = (0, import_react102.useRef)(monitor.snapshot);
|
|
20682
20789
|
(0, import_react102.useEffect)(() => {
|