@agg-build/ui 2.5.3 → 2.6.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/dist/{chunk-AELMIG74.mjs → chunk-TQL5I4GX.mjs} +241 -161
- package/dist/index.js +241 -161
- package/dist/index.mjs +1 -1
- package/dist/pages.js +241 -161
- package/dist/pages.mjs +1 -1
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +5 -5
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +5 -5
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +34 -43
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +34 -43
- package/dist/types/pages/event-market/sports-markets.d.mts +1 -2
- package/dist/types/pages/event-market/sports-markets.d.ts +1 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -25718,64 +25718,15 @@ var SPORTS_LEGACY_PROP_CATEGORY_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
25718
25718
|
"assists",
|
|
25719
25719
|
"shots"
|
|
25720
25720
|
]);
|
|
25721
|
-
var
|
|
25722
|
-
"
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
totals: "game_lines",
|
|
25729
|
-
period_lines: "halves",
|
|
25730
|
-
exact_score: "exact_score",
|
|
25731
|
-
team_props: "other",
|
|
25732
|
-
player_props: "other",
|
|
25733
|
-
specials: "other",
|
|
25734
|
-
completion: "other",
|
|
25735
|
-
other: "other"
|
|
25736
|
-
};
|
|
25737
|
-
var SPORTS_SECTION_TAB_DEFINITIONS = [
|
|
25738
|
-
{
|
|
25739
|
-
key: "game_lines",
|
|
25740
|
-
// NO sportsMarketType filter: spread/total markets on some sports (e.g.
|
|
25741
|
-
// esports "Map 1 Rounds Handicap"/"Total Rounds") are sportsMarketType="other"
|
|
25742
|
-
// with marketGroup=spreads/totals; AND-ing the game-line types would drop them
|
|
25743
|
-
// and leave only the moneyline. marketGroup already scopes the tab. (Safe now
|
|
25744
|
-
// that classify_market no longer mis-groups prop/to-score-first/extra-innings
|
|
25745
|
-
// markets into game_lines/totals — see agg-venue-core market_group.rs.)
|
|
25746
|
-
marketGroup: ["game_lines", "spreads", "totals"]
|
|
25747
|
-
// No server-side period filter: many regular-time game-line markets arrive
|
|
25748
|
-
// with period=null (moneyline sides, team totals, BTTS), and a
|
|
25749
|
-
// period=["full"] filter would drop them server-side. The Game Lines tab
|
|
25750
|
-
// narrows to the regular-time group client-side instead (see SportsMarkets).
|
|
25751
|
-
},
|
|
25752
|
-
{ key: "exact_score", marketGroup: ["exact_score"] },
|
|
25753
|
-
{
|
|
25754
|
-
key: "halves",
|
|
25755
|
-
// NO sportsMarketType filter: half-result legs ("France leading at halftime?")
|
|
25756
|
-
// are sportsMarketType="other"; AND-ing the game-line types would drop them.
|
|
25757
|
-
// marketGroup=period_lines + period already scope the tab.
|
|
25758
|
-
marketGroup: ["period_lines"],
|
|
25759
|
-
period: ["1h", "2h"]
|
|
25760
|
-
},
|
|
25761
|
-
{ key: "corners", marketCategory: "corners" },
|
|
25762
|
-
{ key: "goals", marketCategory: "goals" },
|
|
25763
|
-
{ key: "assists", marketCategory: "assists" },
|
|
25764
|
-
{ key: "shots", marketCategory: "shots" },
|
|
25765
|
-
{
|
|
25766
|
-
key: "other",
|
|
25767
|
-
// `player_props` is deliberately NOT fetched here: goals/assists/shots/corners
|
|
25768
|
-
// props already have dedicated tabs (resolveMarketSectionTabKey routes them
|
|
25769
|
-
// there by category), so including the group would re-fetch hundreds of props
|
|
25770
|
-
// already shown elsewhere. The handful with no stat category (e.g. "saves")
|
|
25771
|
-
// are back-filled from the game-wide set in resolveSportsSectionMarkets.
|
|
25772
|
-
marketGroup: ["other", "team_props", "specials", "completion"]
|
|
25773
|
-
}
|
|
25721
|
+
var SPORTS_GAME_LINE_GROUPS = [
|
|
25722
|
+
"game_lines",
|
|
25723
|
+
"spreads",
|
|
25724
|
+
"totals",
|
|
25725
|
+
"team_props",
|
|
25726
|
+
"specials",
|
|
25727
|
+
"completion"
|
|
25774
25728
|
];
|
|
25775
|
-
var
|
|
25776
|
-
var SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET = new Set(
|
|
25777
|
-
SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS
|
|
25778
|
-
);
|
|
25729
|
+
var SPORTS_GENERIC_STAT = "player_props";
|
|
25779
25730
|
var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
|
|
25780
25731
|
"esports",
|
|
25781
25732
|
"video games",
|
|
@@ -25786,9 +25737,6 @@ var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
|
|
|
25786
25737
|
]);
|
|
25787
25738
|
var ESPORTS_TITLE_PATTERN = /\b(?:esports?|valorant|counter-strike|cs2|league of legends|lol|dota|rocket league|overwatch|rainbow six|starcraft|call of duty)\b/i;
|
|
25788
25739
|
var SERIES_SCOPE_PATTERN = /\b(?:bo[1-9]|best of \d+|map \d+|game \d+)\b/i;
|
|
25789
|
-
var SPORTS_SECTION_TAB_BY_KEY = new Map(
|
|
25790
|
-
SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => [definition.key, definition])
|
|
25791
|
-
);
|
|
25792
25740
|
var SPORTS_PERIOD_ORDER = [
|
|
25793
25741
|
"full",
|
|
25794
25742
|
"1h",
|
|
@@ -25853,12 +25801,13 @@ var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
|
|
|
25853
25801
|
const marketTypeIndex = SPORTS_MARKET_TYPE_ORDER.indexOf(sportsMarketType);
|
|
25854
25802
|
return marketTypeIndex >= 0 ? marketTypeIndex : SPORTS_MARKET_TYPE_ORDER.length;
|
|
25855
25803
|
};
|
|
25856
|
-
var
|
|
25857
|
-
|
|
25858
|
-
if (
|
|
25859
|
-
|
|
25860
|
-
}
|
|
25861
|
-
return
|
|
25804
|
+
var resolveSportsPeriodFamily = (period) => {
|
|
25805
|
+
if (period === "1h" || period === "2h") return "halves";
|
|
25806
|
+
if (period === "q1" || period === "q2" || period === "q3" || period === "q4") return "quarters";
|
|
25807
|
+
if (/^inning_\d{1,2}$/.test(period)) return "innings";
|
|
25808
|
+
if (/^set_\d{1,2}$/.test(period)) return "sets";
|
|
25809
|
+
if (/^(?:map|game)_\d{1,2}$/.test(period)) return "maps";
|
|
25810
|
+
return period;
|
|
25862
25811
|
};
|
|
25863
25812
|
var normalizeSportsPeriod = (value) => {
|
|
25864
25813
|
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
@@ -25903,34 +25852,134 @@ var resolveFallbackSportsMarketCategory = (market) => {
|
|
|
25903
25852
|
if (question.includes("goal")) return "goals";
|
|
25904
25853
|
return null;
|
|
25905
25854
|
};
|
|
25855
|
+
var resolveSportsStatToken = (market) => {
|
|
25856
|
+
const subtype = toTrimmedString(market.marketSubtype).toLowerCase();
|
|
25857
|
+
const playerMatch = /_player_(.+)$/.exec(subtype);
|
|
25858
|
+
if (playerMatch) return playerMatch[1];
|
|
25859
|
+
const category = normalizeSportsMarketCategory(market.marketCategory);
|
|
25860
|
+
if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return category;
|
|
25861
|
+
return null;
|
|
25862
|
+
};
|
|
25906
25863
|
var resolveMarketSectionTabKey = (market) => {
|
|
25864
|
+
var _a;
|
|
25907
25865
|
if (normalizeSportsMarketType(market.sportsMarketType) === "to_advance") {
|
|
25908
25866
|
return "game_lines";
|
|
25909
25867
|
}
|
|
25910
25868
|
const normalizedCategory = normalizeSportsMarketCategory(market.marketCategory);
|
|
25911
25869
|
const fallbackCategory = !normalizedCategory || normalizedCategory === "other" ? resolveFallbackSportsMarketCategory(market) : null;
|
|
25912
25870
|
const category = fallbackCategory != null ? fallbackCategory : normalizedCategory;
|
|
25913
|
-
if (category &&
|
|
25914
|
-
|
|
25915
|
-
}
|
|
25871
|
+
if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return `stat:${category}`;
|
|
25872
|
+
if (category === "exact_score") return "exact_score";
|
|
25916
25873
|
const group = normalizeSportsMarketGroup(market.marketGroup);
|
|
25917
|
-
if (group) return
|
|
25874
|
+
if (group === "exact_score") return "exact_score";
|
|
25875
|
+
if (group === "player_props") {
|
|
25876
|
+
return `stat:${(_a = resolveSportsStatToken(market)) != null ? _a : SPORTS_GENERIC_STAT}`;
|
|
25877
|
+
}
|
|
25878
|
+
if (group === "period_lines") {
|
|
25879
|
+
return `period:${resolveSportsPeriodFamily(normalizeSportsPeriod(market.period))}`;
|
|
25880
|
+
}
|
|
25881
|
+
if (group === "other") return "other";
|
|
25882
|
+
if (group) return "game_lines";
|
|
25918
25883
|
if (category === "game_lines") return "game_lines";
|
|
25919
25884
|
if (category === "other") return "other";
|
|
25920
25885
|
return null;
|
|
25921
25886
|
};
|
|
25922
|
-
var
|
|
25923
|
-
var _a;
|
|
25924
|
-
const
|
|
25925
|
-
const
|
|
25887
|
+
var resolveVisibleSportsSectionTabs = (event) => {
|
|
25888
|
+
var _a, _b, _c;
|
|
25889
|
+
const periodsByFamily = /* @__PURE__ */ new Map();
|
|
25890
|
+
const statVolume = /* @__PURE__ */ new Map();
|
|
25891
|
+
let hasGameLines = false;
|
|
25892
|
+
let hasExactScore = false;
|
|
25893
|
+
let hasOther = false;
|
|
25894
|
+
for (const market of event.venueMarkets) {
|
|
25895
|
+
const key = resolveMarketSectionTabKey(market);
|
|
25896
|
+
if (!key) continue;
|
|
25897
|
+
if (key === "game_lines") hasGameLines = true;
|
|
25898
|
+
else if (key === "exact_score") hasExactScore = true;
|
|
25899
|
+
else if (key === "other") hasOther = true;
|
|
25900
|
+
else if (key.startsWith("period:")) {
|
|
25901
|
+
const family = key.slice("period:".length);
|
|
25902
|
+
const periods = (_a = periodsByFamily.get(family)) != null ? _a : /* @__PURE__ */ new Set();
|
|
25903
|
+
periods.add(normalizeSportsPeriod(market.period));
|
|
25904
|
+
periodsByFamily.set(family, periods);
|
|
25905
|
+
} else if (key.startsWith("stat:")) {
|
|
25906
|
+
const stat = key.slice("stat:".length);
|
|
25907
|
+
statVolume.set(stat, ((_b = statVolume.get(stat)) != null ? _b : 0) + ((_c = market.volume) != null ? _c : 0));
|
|
25908
|
+
}
|
|
25909
|
+
}
|
|
25910
|
+
const tabs = [];
|
|
25911
|
+
if (hasGameLines) tabs.push({ key: "game_lines", kind: "game_lines" });
|
|
25912
|
+
const periodTabs = Array.from(periodsByFamily.entries()).map(([periodFamily, periods]) => ({
|
|
25913
|
+
key: `period:${periodFamily}`,
|
|
25914
|
+
kind: "period",
|
|
25915
|
+
periodFamily,
|
|
25916
|
+
periods: Array.from(periods).sort(
|
|
25917
|
+
(left, right) => getSportsPeriodOrderIndex(left) - getSportsPeriodOrderIndex(right)
|
|
25918
|
+
)
|
|
25919
|
+
})).sort(
|
|
25920
|
+
(left, right) => getSportsPeriodOrderIndex(left.periods[0]) - getSportsPeriodOrderIndex(right.periods[0])
|
|
25921
|
+
);
|
|
25922
|
+
tabs.push(...periodTabs);
|
|
25923
|
+
const statTabs = Array.from(statVolume.entries()).sort((left, right) => {
|
|
25924
|
+
if (left[0] === SPORTS_GENERIC_STAT !== (right[0] === SPORTS_GENERIC_STAT)) {
|
|
25925
|
+
return left[0] === SPORTS_GENERIC_STAT ? 1 : -1;
|
|
25926
|
+
}
|
|
25927
|
+
return right[1] - left[1];
|
|
25928
|
+
}).map(([stat]) => ({ key: `stat:${stat}`, kind: "stat", stat }));
|
|
25929
|
+
tabs.push(...statTabs);
|
|
25930
|
+
if (hasExactScore) tabs.push({ key: "exact_score", kind: "exact_score" });
|
|
25931
|
+
if (hasOther) tabs.push({ key: "other", kind: "other" });
|
|
25932
|
+
if (isNonStandardSportsLikeEvent(event)) {
|
|
25933
|
+
return tabs.filter((tab) => tab.kind === "game_lines" || tab.kind === "other");
|
|
25934
|
+
}
|
|
25935
|
+
return tabs;
|
|
25936
|
+
};
|
|
25937
|
+
var resolveSportsSectionFilters = (tab) => {
|
|
25938
|
+
if (tab.kind === "period") {
|
|
25939
|
+
return {
|
|
25940
|
+
marketGroup: ["period_lines"],
|
|
25941
|
+
marketCategory: void 0,
|
|
25942
|
+
sportsMarketType: void 0,
|
|
25943
|
+
period: tab.periods ? [...tab.periods] : void 0
|
|
25944
|
+
};
|
|
25945
|
+
}
|
|
25946
|
+
if (tab.kind === "stat") {
|
|
25947
|
+
const legacyCategory = SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(
|
|
25948
|
+
tab.stat
|
|
25949
|
+
) ? tab.stat : null;
|
|
25950
|
+
return legacyCategory ? {
|
|
25951
|
+
marketGroup: void 0,
|
|
25952
|
+
marketCategory: [legacyCategory],
|
|
25953
|
+
sportsMarketType: void 0,
|
|
25954
|
+
period: void 0
|
|
25955
|
+
} : {
|
|
25956
|
+
marketGroup: ["player_props"],
|
|
25957
|
+
marketCategory: void 0,
|
|
25958
|
+
sportsMarketType: void 0,
|
|
25959
|
+
period: void 0
|
|
25960
|
+
};
|
|
25961
|
+
}
|
|
25962
|
+
if (tab.kind === "exact_score") {
|
|
25963
|
+
return {
|
|
25964
|
+
marketGroup: ["exact_score"],
|
|
25965
|
+
marketCategory: void 0,
|
|
25966
|
+
sportsMarketType: void 0,
|
|
25967
|
+
period: void 0
|
|
25968
|
+
};
|
|
25969
|
+
}
|
|
25970
|
+
if (tab.kind === "other") {
|
|
25971
|
+
return {
|
|
25972
|
+
marketGroup: ["other"],
|
|
25973
|
+
marketCategory: void 0,
|
|
25974
|
+
sportsMarketType: void 0,
|
|
25975
|
+
period: void 0
|
|
25976
|
+
};
|
|
25977
|
+
}
|
|
25926
25978
|
return {
|
|
25927
|
-
marketGroup:
|
|
25928
|
-
|
|
25929
|
-
|
|
25930
|
-
|
|
25931
|
-
marketCategory: !useMarketGroup && resolvedDefinition.marketCategory ? [resolvedDefinition.marketCategory] : void 0,
|
|
25932
|
-
sportsMarketType: resolvedDefinition.sportsMarketType ? [...resolvedDefinition.sportsMarketType] : void 0,
|
|
25933
|
-
period: resolvedDefinition.period ? [...resolvedDefinition.period] : void 0
|
|
25979
|
+
marketGroup: [...SPORTS_GAME_LINE_GROUPS],
|
|
25980
|
+
marketCategory: void 0,
|
|
25981
|
+
sportsMarketType: void 0,
|
|
25982
|
+
period: void 0
|
|
25934
25983
|
};
|
|
25935
25984
|
};
|
|
25936
25985
|
var hasTeamTitledOutcomes = (market) => {
|
|
@@ -25944,28 +25993,41 @@ var isClusterRelation = (left, right) => {
|
|
|
25944
25993
|
var _a, _b;
|
|
25945
25994
|
return ((_a = left.matchedVenueMarkets) != null ? _a : []).some((market) => market.id === right.id) || ((_b = right.matchedVenueMarkets) != null ? _b : []).some((market) => market.id === left.id);
|
|
25946
25995
|
};
|
|
25947
|
-
var
|
|
25948
|
-
|
|
25949
|
-
|
|
25950
|
-
|
|
25951
|
-
);
|
|
25996
|
+
var isDecomposedLeg = (market) => {
|
|
25997
|
+
var _a;
|
|
25998
|
+
const labels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
|
|
25999
|
+
(outcome) => toTrimmedString(outcome.label).toLowerCase()
|
|
26000
|
+
);
|
|
26001
|
+
return labels.length === 2 && labels.every((label2) => YES_NO_LABELS.has(label2)) && !hasTeamTitledOutcomes(market);
|
|
26002
|
+
};
|
|
26003
|
+
var dropDecomposedLegsMergedIntoSingle = (markets) => {
|
|
26004
|
+
const legs = markets.filter((market) => isDecomposedLeg(market));
|
|
26005
|
+
if (legs.length === 0) return markets;
|
|
26006
|
+
const hasMergedSingle = markets.some(
|
|
26007
|
+
(market) => {
|
|
26008
|
+
var _a, _b;
|
|
26009
|
+
return hasTeamTitledOutcomes(market) && ((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.length) != null ? _b : 0) >= legs.length && markets.some((other) => other !== market && isClusterRelation(market, other));
|
|
26010
|
+
}
|
|
26011
|
+
);
|
|
26012
|
+
return hasMergedSingle ? markets.filter((market) => !isDecomposedLeg(market)) : markets;
|
|
26013
|
+
};
|
|
25952
26014
|
var resolveSportsSectionMarkets = ({
|
|
25953
|
-
|
|
26015
|
+
tab,
|
|
25954
26016
|
eventMarkets,
|
|
25955
26017
|
sectionMarkets
|
|
25956
26018
|
}) => {
|
|
25957
|
-
const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) ===
|
|
26019
|
+
const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tab.key);
|
|
25958
26020
|
const filteredSectionMarkets = effectiveSectionMarkets.filter(
|
|
25959
|
-
(market) => resolveMarketSectionTabKey(market) ===
|
|
26021
|
+
(market) => resolveMarketSectionTabKey(market) === tab.key
|
|
25960
26022
|
);
|
|
25961
|
-
if (
|
|
26023
|
+
if (tab.key === "other" || tab.key === `stat:${SPORTS_GENERIC_STAT}`) {
|
|
25962
26024
|
const seenIds = new Set(filteredSectionMarkets.map((market) => market.id));
|
|
25963
|
-
const
|
|
25964
|
-
(market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) ===
|
|
26025
|
+
const strayMarkets = eventMarkets.filter(
|
|
26026
|
+
(market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) === tab.key
|
|
25965
26027
|
);
|
|
25966
|
-
return [...filteredSectionMarkets, ...
|
|
26028
|
+
return [...filteredSectionMarkets, ...strayMarkets];
|
|
25967
26029
|
}
|
|
25968
|
-
if (
|
|
26030
|
+
if (tab.kind !== "game_lines") return filteredSectionMarkets;
|
|
25969
26031
|
const dedupeEventMarketsOfType = (type) => {
|
|
25970
26032
|
const dedupedMarkets = [];
|
|
25971
26033
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
@@ -26065,7 +26127,9 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
|
|
|
26065
26127
|
return toTrimmedString((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a[index]) == null ? void 0 : _b.title);
|
|
26066
26128
|
}).filter((title2) => isSpreadTeamTitle(title2));
|
|
26067
26129
|
if (cleanTitles.length === 0) return null;
|
|
26068
|
-
return cleanTitles.reduce(
|
|
26130
|
+
return cleanTitles.reduce(
|
|
26131
|
+
(longest, title2) => title2.length > longest.length ? title2 : longest
|
|
26132
|
+
);
|
|
26069
26133
|
};
|
|
26070
26134
|
return { favored: pickName(0), dog: pickName(1) };
|
|
26071
26135
|
};
|
|
@@ -26074,9 +26138,7 @@ var resolveCombinedMoneylineLegLabel = (market) => {
|
|
|
26074
26138
|
return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
|
|
26075
26139
|
};
|
|
26076
26140
|
var areCombinedMoneylineLegsDistinct = (markets) => {
|
|
26077
|
-
const labels = markets.map(
|
|
26078
|
-
(market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
|
|
26079
|
-
);
|
|
26141
|
+
const labels = markets.map((market) => resolveCombinedMoneylineLegLabel(market).toLowerCase());
|
|
26080
26142
|
return labels.every((label2) => label2.length > 0) && new Set(labels).size === labels.length;
|
|
26081
26143
|
};
|
|
26082
26144
|
var resolveDisplayGroupFamilyKey = (market) => {
|
|
@@ -26361,6 +26423,15 @@ var buildSportsSlideFromGroup = (group) => {
|
|
|
26361
26423
|
defaultStopIndex
|
|
26362
26424
|
};
|
|
26363
26425
|
};
|
|
26426
|
+
var formatSportsPeriodGrammarLabel = (period) => {
|
|
26427
|
+
const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
|
|
26428
|
+
if (!grammarMatch) return null;
|
|
26429
|
+
if (grammarMatch[1]) {
|
|
26430
|
+
const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
|
|
26431
|
+
return `${family} ${Number(grammarMatch[2])}`;
|
|
26432
|
+
}
|
|
26433
|
+
return `First ${Number(grammarMatch[3])} Innings`;
|
|
26434
|
+
};
|
|
26364
26435
|
var resolveSportsCategoryTokens = (event) => {
|
|
26365
26436
|
return new Set(
|
|
26366
26437
|
event.categories.flatMap((entry) => {
|
|
@@ -26383,39 +26454,20 @@ var isNonStandardSportsLikeEvent = (event) => {
|
|
|
26383
26454
|
return ESPORTS_TITLE_PATTERN.test(question) || SERIES_SCOPE_PATTERN.test(question);
|
|
26384
26455
|
});
|
|
26385
26456
|
};
|
|
26386
|
-
var resolveVisibleSportsSectionTabDefinitions = (event) => {
|
|
26387
|
-
const presentTabKeys = /* @__PURE__ */ new Set();
|
|
26388
|
-
for (const market of event.venueMarkets) {
|
|
26389
|
-
const tabKey = resolveMarketSectionTabKey(market);
|
|
26390
|
-
if (tabKey) presentTabKeys.add(tabKey);
|
|
26391
|
-
}
|
|
26392
|
-
let definitions = SPORTS_SECTION_TAB_DEFINITIONS.filter(
|
|
26393
|
-
(definition) => presentTabKeys.has(definition.key)
|
|
26394
|
-
);
|
|
26395
|
-
if (isNonStandardSportsLikeEvent(event)) {
|
|
26396
|
-
definitions = definitions.filter(
|
|
26397
|
-
(definition) => SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET.has(definition.key)
|
|
26398
|
-
);
|
|
26399
|
-
}
|
|
26400
|
-
return definitions;
|
|
26401
|
-
};
|
|
26402
26457
|
var mergeSportsSectionMarketsIntoEvent = ({
|
|
26403
26458
|
event,
|
|
26404
26459
|
sectionMarketsByKey
|
|
26405
26460
|
}) => {
|
|
26406
|
-
var _a;
|
|
26407
26461
|
const orderedVenueMarkets = [...event.venueMarkets];
|
|
26408
26462
|
const seenMarketIds = new Set(orderedVenueMarkets.map((market) => market.id));
|
|
26409
|
-
for (const
|
|
26410
|
-
for (const market of
|
|
26463
|
+
for (const markets of Object.values(sectionMarketsByKey)) {
|
|
26464
|
+
for (const market of markets != null ? markets : []) {
|
|
26411
26465
|
if (seenMarketIds.has(market.id)) continue;
|
|
26412
26466
|
seenMarketIds.add(market.id);
|
|
26413
26467
|
orderedVenueMarkets.push(market);
|
|
26414
26468
|
}
|
|
26415
26469
|
}
|
|
26416
|
-
return __spreadProps(__spreadValues({}, event), {
|
|
26417
|
-
venueMarkets: orderedVenueMarkets
|
|
26418
|
-
});
|
|
26470
|
+
return __spreadProps(__spreadValues({}, event), { venueMarkets: orderedVenueMarkets });
|
|
26419
26471
|
};
|
|
26420
26472
|
|
|
26421
26473
|
// src/pages/event-market/sports-market-card.tsx
|
|
@@ -26898,24 +26950,48 @@ SportsMarketCard.displayName = "SportsMarketCard";
|
|
|
26898
26950
|
|
|
26899
26951
|
// src/pages/event-market/sports-markets.tsx
|
|
26900
26952
|
var import_jsx_runtime170 = require("react/jsx-runtime");
|
|
26901
|
-
var
|
|
26902
|
-
|
|
26953
|
+
var STAT_LABEL_OVERRIDES = {
|
|
26954
|
+
rbis: "RBIs",
|
|
26955
|
+
hits_runs_rbis: "Hits + Runs + RBIs",
|
|
26956
|
+
ot: "OT"
|
|
26957
|
+
};
|
|
26958
|
+
var formatStatLabel = (stat) => {
|
|
26959
|
+
var _a;
|
|
26960
|
+
return (_a = STAT_LABEL_OVERRIDES[stat]) != null ? _a : stat.split("_").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
26961
|
+
};
|
|
26962
|
+
var LEGACY_STAT_LABEL_KEYS = {
|
|
26963
|
+
corners: "cornersTab",
|
|
26964
|
+
goals: "goalsTab",
|
|
26965
|
+
assists: "assistsTab",
|
|
26966
|
+
shots: "shotsTab"
|
|
26967
|
+
};
|
|
26968
|
+
var resolveSportsSectionLabel = (labels, tab) => {
|
|
26969
|
+
var _a, _b, _c, _d, _e;
|
|
26970
|
+
const sports = labels.eventMarketPage.sports;
|
|
26971
|
+
switch (tab.kind) {
|
|
26903
26972
|
case "game_lines":
|
|
26904
|
-
return
|
|
26905
|
-
case "halves":
|
|
26906
|
-
return labels.eventMarketPage.sports.halvesTab;
|
|
26973
|
+
return sports.gameLinesTab;
|
|
26907
26974
|
case "exact_score":
|
|
26908
|
-
return
|
|
26909
|
-
case "corners":
|
|
26910
|
-
return labels.eventMarketPage.sports.cornersTab;
|
|
26911
|
-
case "goals":
|
|
26912
|
-
return labels.eventMarketPage.sports.goalsTab;
|
|
26913
|
-
case "assists":
|
|
26914
|
-
return labels.eventMarketPage.sports.assistsTab;
|
|
26915
|
-
case "shots":
|
|
26916
|
-
return labels.eventMarketPage.sports.shotsTab;
|
|
26975
|
+
return sports.exactScoreTab;
|
|
26917
26976
|
case "other":
|
|
26918
|
-
return
|
|
26977
|
+
return sports.otherTab;
|
|
26978
|
+
case "stat": {
|
|
26979
|
+
if (tab.stat === "player_props") return sports.playerPropsTab;
|
|
26980
|
+
const legacyLabelKey = tab.stat ? LEGACY_STAT_LABEL_KEYS[tab.stat] : void 0;
|
|
26981
|
+
return legacyLabelKey ? sports[legacyLabelKey] : formatStatLabel((_a = tab.stat) != null ? _a : "");
|
|
26982
|
+
}
|
|
26983
|
+
case "period": {
|
|
26984
|
+
switch (tab.periodFamily) {
|
|
26985
|
+
case "halves":
|
|
26986
|
+
return sports.halvesTab;
|
|
26987
|
+
case "quarters":
|
|
26988
|
+
return sports.quartersTab;
|
|
26989
|
+
case "sets":
|
|
26990
|
+
return sports.setsTab;
|
|
26991
|
+
default:
|
|
26992
|
+
return (_e = (_c = formatSportsPeriodGrammarLabel((_b = tab.periodFamily) != null ? _b : "")) == null ? void 0 : _c.replace(/^First /, "")) != null ? _e : formatStatLabel((_d = tab.periodFamily) != null ? _d : "");
|
|
26993
|
+
}
|
|
26994
|
+
}
|
|
26919
26995
|
}
|
|
26920
26996
|
};
|
|
26921
26997
|
var SportsTabButton = ({
|
|
@@ -27003,18 +27079,23 @@ var SportsMarkets = ({
|
|
|
27003
27079
|
}
|
|
27004
27080
|
return merged;
|
|
27005
27081
|
}, [event.venueMarkets, gameMarkets]);
|
|
27006
|
-
const
|
|
27007
|
-
() =>
|
|
27082
|
+
const visibleTabs = (0, import_react44.useMemo)(
|
|
27083
|
+
() => resolveVisibleSportsSectionTabs(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
|
|
27008
27084
|
[event, tabSourceMarkets]
|
|
27009
27085
|
);
|
|
27010
|
-
const shouldRenderTabs =
|
|
27011
|
-
const [activeTabKey, setActiveTabKey] = (0, import_react44.useState)(
|
|
27012
|
-
|
|
27086
|
+
const shouldRenderTabs = visibleTabs.length > 1 && tabSourceMarkets.length > 1;
|
|
27087
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react44.useState)((_b = (_a = visibleTabs[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines");
|
|
27088
|
+
const activeTab = (0, import_react44.useMemo)(
|
|
27089
|
+
() => {
|
|
27090
|
+
var _a2, _b2;
|
|
27091
|
+
return (_b2 = (_a2 = visibleTabs.find((tab) => tab.key === activeTabKey)) != null ? _a2 : visibleTabs[0]) != null ? _b2 : { key: "game_lines", kind: "game_lines" };
|
|
27092
|
+
},
|
|
27093
|
+
[visibleTabs, activeTabKey]
|
|
27013
27094
|
);
|
|
27014
27095
|
const [expandedGroupId, setExpandedGroupId] = (0, import_react44.useState)(null);
|
|
27015
27096
|
const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react44.useState)({});
|
|
27016
|
-
const activeTabLabel = resolveSportsSectionLabel(labels,
|
|
27017
|
-
const sectionFilters = resolveSportsSectionFilters(
|
|
27097
|
+
const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
|
|
27098
|
+
const sectionFilters = resolveSportsSectionFilters(activeTab);
|
|
27018
27099
|
const sectionMarketsQuery = (0, import_hooks68.useVenueMarkets)({
|
|
27019
27100
|
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
27020
27101
|
sportsMarketType: sectionFilters.sportsMarketType,
|
|
@@ -27037,26 +27118,25 @@ var SportsMarkets = ({
|
|
|
27037
27118
|
} = sectionMarketsQuery;
|
|
27038
27119
|
const resolvedSectionMarkets = (0, import_react44.useMemo)(
|
|
27039
27120
|
() => resolveSportsSectionMarkets({
|
|
27040
|
-
|
|
27121
|
+
tab: activeTab,
|
|
27041
27122
|
eventMarkets: tabSourceMarkets,
|
|
27042
27123
|
sectionMarkets
|
|
27043
27124
|
}),
|
|
27044
|
-
[
|
|
27125
|
+
[activeTab, tabSourceMarkets, sectionMarkets]
|
|
27045
27126
|
);
|
|
27046
27127
|
const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
|
|
27047
27128
|
const stableSectionMarkets = stableMarketsByTab[activeTabKey];
|
|
27048
|
-
const displayedSectionMarkets =
|
|
27129
|
+
const displayedSectionMarkets = (0, import_react44.useMemo)(
|
|
27130
|
+
() => stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [],
|
|
27131
|
+
[stableSectionMarkets, isSectionSettled, resolvedSectionMarkets]
|
|
27132
|
+
);
|
|
27049
27133
|
const periodGroups = (0, import_react44.useMemo)(
|
|
27050
27134
|
() => groupSportsMarketsByPeriod(displayedSectionMarkets),
|
|
27051
27135
|
[displayedSectionMarkets]
|
|
27052
27136
|
);
|
|
27053
|
-
const displayedPeriodGroups = (0, import_react44.useMemo)(
|
|
27054
|
-
() => activeTabKey === "game_lines" ? periodGroups.filter((periodGroup) => periodGroup.key === "full") : periodGroups,
|
|
27055
|
-
[activeTabKey, periodGroups]
|
|
27056
|
-
);
|
|
27057
27137
|
const allGroups = (0, import_react44.useMemo)(
|
|
27058
|
-
() =>
|
|
27059
|
-
[
|
|
27138
|
+
() => periodGroups.flatMap((periodGroup) => periodGroup.groups),
|
|
27139
|
+
[periodGroups]
|
|
27060
27140
|
);
|
|
27061
27141
|
(0, import_react44.useEffect)(() => {
|
|
27062
27142
|
if (hasNextPage && !isFetchingNextPage) {
|
|
@@ -27090,9 +27170,9 @@ var SportsMarkets = ({
|
|
|
27090
27170
|
}, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
|
|
27091
27171
|
(0, import_react44.useEffect)(() => {
|
|
27092
27172
|
var _a2, _b2;
|
|
27093
|
-
if (
|
|
27094
|
-
setActiveTabKey((_b2 = (_a2 =
|
|
27095
|
-
}, [activeTabKey,
|
|
27173
|
+
if (visibleTabs.some((tab) => tab.key === activeTabKey)) return;
|
|
27174
|
+
setActiveTabKey((_b2 = (_a2 = visibleTabs[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
|
|
27175
|
+
}, [activeTabKey, visibleTabs]);
|
|
27096
27176
|
const lastActiveTabRef = (0, import_react44.useRef)(null);
|
|
27097
27177
|
(0, import_react44.useEffect)(() => {
|
|
27098
27178
|
if (allGroups.length === 0) return;
|
|
@@ -27139,14 +27219,14 @@ var SportsMarkets = ({
|
|
|
27139
27219
|
role: "tablist",
|
|
27140
27220
|
"aria-label": labels.eventMarketPage.sports.sectionTabsAria,
|
|
27141
27221
|
className: "flex flex-nowrap items-center gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
27142
|
-
children:
|
|
27222
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
27143
27223
|
SportsTabButton,
|
|
27144
27224
|
{
|
|
27145
|
-
isActive:
|
|
27146
|
-
label: resolveSportsSectionLabel(labels,
|
|
27147
|
-
onClick: () => setActiveTabKey(
|
|
27225
|
+
isActive: tab.key === activeTabKey,
|
|
27226
|
+
label: resolveSportsSectionLabel(labels, tab),
|
|
27227
|
+
onClick: () => setActiveTabKey(tab.key)
|
|
27148
27228
|
},
|
|
27149
|
-
|
|
27229
|
+
tab.key
|
|
27150
27230
|
))
|
|
27151
27231
|
}
|
|
27152
27232
|
) : null,
|
|
@@ -27160,7 +27240,7 @@ var SportsMarkets = ({
|
|
|
27160
27240
|
classNames: { root: "min-h-[220px]" }
|
|
27161
27241
|
}
|
|
27162
27242
|
) : null,
|
|
27163
|
-
|
|
27243
|
+
periodGroups.map((periodGroup) => {
|
|
27164
27244
|
return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(
|
|
27165
27245
|
"section",
|
|
27166
27246
|
{
|
|
@@ -27217,7 +27297,7 @@ var SportsEventMarketPage = ({
|
|
|
27217
27297
|
}, [event, sectionMarketsByKey]);
|
|
27218
27298
|
const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks69.resolveEventTradingState)(composedEvent), [composedEvent]);
|
|
27219
27299
|
const hasSportsSections = (0, import_react45.useMemo)(
|
|
27220
|
-
() =>
|
|
27300
|
+
() => resolveVisibleSportsSectionTabs(event).length > 0,
|
|
27221
27301
|
[event]
|
|
27222
27302
|
);
|
|
27223
27303
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|