@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/pages.js CHANGED
@@ -23497,64 +23497,15 @@ var SPORTS_LEGACY_PROP_CATEGORY_KEY_SET = /* @__PURE__ */ new Set([
23497
23497
  "assists",
23498
23498
  "shots"
23499
23499
  ]);
23500
- var SPORTS_CATEGORY_OVERRIDE_TAB_KEY_SET = /* @__PURE__ */ new Set([
23501
- "exact_score",
23502
- ...SPORTS_LEGACY_PROP_CATEGORY_KEY_SET
23503
- ]);
23504
- var SPORTS_MARKET_GROUP_TO_TAB = {
23505
- game_lines: "game_lines",
23506
- spreads: "game_lines",
23507
- totals: "game_lines",
23508
- period_lines: "halves",
23509
- exact_score: "exact_score",
23510
- team_props: "other",
23511
- player_props: "other",
23512
- specials: "other",
23513
- completion: "other",
23514
- other: "other"
23515
- };
23516
- var SPORTS_SECTION_TAB_DEFINITIONS = [
23517
- {
23518
- key: "game_lines",
23519
- // NO sportsMarketType filter: spread/total markets on some sports (e.g.
23520
- // esports "Map 1 Rounds Handicap"/"Total Rounds") are sportsMarketType="other"
23521
- // with marketGroup=spreads/totals; AND-ing the game-line types would drop them
23522
- // and leave only the moneyline. marketGroup already scopes the tab. (Safe now
23523
- // that classify_market no longer mis-groups prop/to-score-first/extra-innings
23524
- // markets into game_lines/totals — see agg-venue-core market_group.rs.)
23525
- marketGroup: ["game_lines", "spreads", "totals"]
23526
- // No server-side period filter: many regular-time game-line markets arrive
23527
- // with period=null (moneyline sides, team totals, BTTS), and a
23528
- // period=["full"] filter would drop them server-side. The Game Lines tab
23529
- // narrows to the regular-time group client-side instead (see SportsMarkets).
23530
- },
23531
- { key: "exact_score", marketGroup: ["exact_score"] },
23532
- {
23533
- key: "halves",
23534
- // NO sportsMarketType filter: half-result legs ("France leading at halftime?")
23535
- // are sportsMarketType="other"; AND-ing the game-line types would drop them.
23536
- // marketGroup=period_lines + period already scope the tab.
23537
- marketGroup: ["period_lines"],
23538
- period: ["1h", "2h"]
23539
- },
23540
- { key: "corners", marketCategory: "corners" },
23541
- { key: "goals", marketCategory: "goals" },
23542
- { key: "assists", marketCategory: "assists" },
23543
- { key: "shots", marketCategory: "shots" },
23544
- {
23545
- key: "other",
23546
- // `player_props` is deliberately NOT fetched here: goals/assists/shots/corners
23547
- // props already have dedicated tabs (resolveMarketSectionTabKey routes them
23548
- // there by category), so including the group would re-fetch hundreds of props
23549
- // already shown elsewhere. The handful with no stat category (e.g. "saves")
23550
- // are back-filled from the game-wide set in resolveSportsSectionMarkets.
23551
- marketGroup: ["other", "team_props", "specials", "completion"]
23552
- }
23500
+ var SPORTS_GAME_LINE_GROUPS = [
23501
+ "game_lines",
23502
+ "spreads",
23503
+ "totals",
23504
+ "team_props",
23505
+ "specials",
23506
+ "completion"
23553
23507
  ];
23554
- var SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS = ["game_lines", "other"];
23555
- var SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET = new Set(
23556
- SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS
23557
- );
23508
+ var SPORTS_GENERIC_STAT = "player_props";
23558
23509
  var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
23559
23510
  "esports",
23560
23511
  "video games",
@@ -23565,9 +23516,6 @@ var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
23565
23516
  ]);
23566
23517
  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;
23567
23518
  var SERIES_SCOPE_PATTERN = /\b(?:bo[1-9]|best of \d+|map \d+|game \d+)\b/i;
23568
- var SPORTS_SECTION_TAB_BY_KEY = new Map(
23569
- SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => [definition.key, definition])
23570
- );
23571
23519
  var SPORTS_PERIOD_ORDER = [
23572
23520
  "full",
23573
23521
  "1h",
@@ -23632,12 +23580,13 @@ var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
23632
23580
  const marketTypeIndex = SPORTS_MARKET_TYPE_ORDER.indexOf(sportsMarketType);
23633
23581
  return marketTypeIndex >= 0 ? marketTypeIndex : SPORTS_MARKET_TYPE_ORDER.length;
23634
23582
  };
23635
- var resolveSportsSectionDefinition = (key) => {
23636
- const resolvedDefinition = SPORTS_SECTION_TAB_BY_KEY.get(key);
23637
- if (!resolvedDefinition) {
23638
- return SPORTS_SECTION_TAB_DEFINITIONS[0];
23639
- }
23640
- return resolvedDefinition;
23583
+ var resolveSportsPeriodFamily = (period) => {
23584
+ if (period === "1h" || period === "2h") return "halves";
23585
+ if (period === "q1" || period === "q2" || period === "q3" || period === "q4") return "quarters";
23586
+ if (/^inning_\d{1,2}$/.test(period)) return "innings";
23587
+ if (/^set_\d{1,2}$/.test(period)) return "sets";
23588
+ if (/^(?:map|game)_\d{1,2}$/.test(period)) return "maps";
23589
+ return period;
23641
23590
  };
23642
23591
  var normalizeSportsPeriod = (value) => {
23643
23592
  const resolvedValue = toTrimmedString(value).toLowerCase();
@@ -23682,34 +23631,134 @@ var resolveFallbackSportsMarketCategory = (market) => {
23682
23631
  if (question.includes("goal")) return "goals";
23683
23632
  return null;
23684
23633
  };
23634
+ var resolveSportsStatToken = (market) => {
23635
+ const subtype = toTrimmedString(market.marketSubtype).toLowerCase();
23636
+ const playerMatch = /_player_(.+)$/.exec(subtype);
23637
+ if (playerMatch) return playerMatch[1];
23638
+ const category = normalizeSportsMarketCategory(market.marketCategory);
23639
+ if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return category;
23640
+ return null;
23641
+ };
23685
23642
  var resolveMarketSectionTabKey = (market) => {
23643
+ var _a;
23686
23644
  if (normalizeSportsMarketType(market.sportsMarketType) === "to_advance") {
23687
23645
  return "game_lines";
23688
23646
  }
23689
23647
  const normalizedCategory = normalizeSportsMarketCategory(market.marketCategory);
23690
23648
  const fallbackCategory = !normalizedCategory || normalizedCategory === "other" ? resolveFallbackSportsMarketCategory(market) : null;
23691
23649
  const category = fallbackCategory != null ? fallbackCategory : normalizedCategory;
23692
- if (category && SPORTS_CATEGORY_OVERRIDE_TAB_KEY_SET.has(category)) {
23693
- return category;
23694
- }
23650
+ if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return `stat:${category}`;
23651
+ if (category === "exact_score") return "exact_score";
23695
23652
  const group = normalizeSportsMarketGroup(market.marketGroup);
23696
- if (group) return SPORTS_MARKET_GROUP_TO_TAB[group];
23653
+ if (group === "exact_score") return "exact_score";
23654
+ if (group === "player_props") {
23655
+ return `stat:${(_a = resolveSportsStatToken(market)) != null ? _a : SPORTS_GENERIC_STAT}`;
23656
+ }
23657
+ if (group === "period_lines") {
23658
+ return `period:${resolveSportsPeriodFamily(normalizeSportsPeriod(market.period))}`;
23659
+ }
23660
+ if (group === "other") return "other";
23661
+ if (group) return "game_lines";
23697
23662
  if (category === "game_lines") return "game_lines";
23698
23663
  if (category === "other") return "other";
23699
23664
  return null;
23700
23665
  };
23701
- var resolveSportsSectionFilters = (key) => {
23702
- var _a;
23703
- const resolvedDefinition = resolveSportsSectionDefinition(key);
23704
- const useMarketGroup = !!((_a = resolvedDefinition.marketGroup) == null ? void 0 : _a.length);
23666
+ var resolveVisibleSportsSectionTabs = (event) => {
23667
+ var _a, _b, _c;
23668
+ const periodsByFamily = /* @__PURE__ */ new Map();
23669
+ const statVolume = /* @__PURE__ */ new Map();
23670
+ let hasGameLines = false;
23671
+ let hasExactScore = false;
23672
+ let hasOther = false;
23673
+ for (const market of event.venueMarkets) {
23674
+ const key = resolveMarketSectionTabKey(market);
23675
+ if (!key) continue;
23676
+ if (key === "game_lines") hasGameLines = true;
23677
+ else if (key === "exact_score") hasExactScore = true;
23678
+ else if (key === "other") hasOther = true;
23679
+ else if (key.startsWith("period:")) {
23680
+ const family = key.slice("period:".length);
23681
+ const periods = (_a = periodsByFamily.get(family)) != null ? _a : /* @__PURE__ */ new Set();
23682
+ periods.add(normalizeSportsPeriod(market.period));
23683
+ periodsByFamily.set(family, periods);
23684
+ } else if (key.startsWith("stat:")) {
23685
+ const stat = key.slice("stat:".length);
23686
+ statVolume.set(stat, ((_b = statVolume.get(stat)) != null ? _b : 0) + ((_c = market.volume) != null ? _c : 0));
23687
+ }
23688
+ }
23689
+ const tabs = [];
23690
+ if (hasGameLines) tabs.push({ key: "game_lines", kind: "game_lines" });
23691
+ const periodTabs = Array.from(periodsByFamily.entries()).map(([periodFamily, periods]) => ({
23692
+ key: `period:${periodFamily}`,
23693
+ kind: "period",
23694
+ periodFamily,
23695
+ periods: Array.from(periods).sort(
23696
+ (left, right) => getSportsPeriodOrderIndex(left) - getSportsPeriodOrderIndex(right)
23697
+ )
23698
+ })).sort(
23699
+ (left, right) => getSportsPeriodOrderIndex(left.periods[0]) - getSportsPeriodOrderIndex(right.periods[0])
23700
+ );
23701
+ tabs.push(...periodTabs);
23702
+ const statTabs = Array.from(statVolume.entries()).sort((left, right) => {
23703
+ if (left[0] === SPORTS_GENERIC_STAT !== (right[0] === SPORTS_GENERIC_STAT)) {
23704
+ return left[0] === SPORTS_GENERIC_STAT ? 1 : -1;
23705
+ }
23706
+ return right[1] - left[1];
23707
+ }).map(([stat]) => ({ key: `stat:${stat}`, kind: "stat", stat }));
23708
+ tabs.push(...statTabs);
23709
+ if (hasExactScore) tabs.push({ key: "exact_score", kind: "exact_score" });
23710
+ if (hasOther) tabs.push({ key: "other", kind: "other" });
23711
+ if (isNonStandardSportsLikeEvent(event)) {
23712
+ return tabs.filter((tab) => tab.kind === "game_lines" || tab.kind === "other");
23713
+ }
23714
+ return tabs;
23715
+ };
23716
+ var resolveSportsSectionFilters = (tab) => {
23717
+ if (tab.kind === "period") {
23718
+ return {
23719
+ marketGroup: ["period_lines"],
23720
+ marketCategory: void 0,
23721
+ sportsMarketType: void 0,
23722
+ period: tab.periods ? [...tab.periods] : void 0
23723
+ };
23724
+ }
23725
+ if (tab.kind === "stat") {
23726
+ const legacyCategory = SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(
23727
+ tab.stat
23728
+ ) ? tab.stat : null;
23729
+ return legacyCategory ? {
23730
+ marketGroup: void 0,
23731
+ marketCategory: [legacyCategory],
23732
+ sportsMarketType: void 0,
23733
+ period: void 0
23734
+ } : {
23735
+ marketGroup: ["player_props"],
23736
+ marketCategory: void 0,
23737
+ sportsMarketType: void 0,
23738
+ period: void 0
23739
+ };
23740
+ }
23741
+ if (tab.kind === "exact_score") {
23742
+ return {
23743
+ marketGroup: ["exact_score"],
23744
+ marketCategory: void 0,
23745
+ sportsMarketType: void 0,
23746
+ period: void 0
23747
+ };
23748
+ }
23749
+ if (tab.kind === "other") {
23750
+ return {
23751
+ marketGroup: ["other"],
23752
+ marketCategory: void 0,
23753
+ sportsMarketType: void 0,
23754
+ period: void 0
23755
+ };
23756
+ }
23705
23757
  return {
23706
- marketGroup: useMarketGroup ? [...resolvedDefinition.marketGroup] : void 0,
23707
- // Only fall back to the deprecated marketCategory filter when the tab has no
23708
- // marketGroup mapping. Sending both would AND them server-side and drop
23709
- // markets that carry only one of the two.
23710
- marketCategory: !useMarketGroup && resolvedDefinition.marketCategory ? [resolvedDefinition.marketCategory] : void 0,
23711
- sportsMarketType: resolvedDefinition.sportsMarketType ? [...resolvedDefinition.sportsMarketType] : void 0,
23712
- period: resolvedDefinition.period ? [...resolvedDefinition.period] : void 0
23758
+ marketGroup: [...SPORTS_GAME_LINE_GROUPS],
23759
+ marketCategory: void 0,
23760
+ sportsMarketType: void 0,
23761
+ period: void 0
23713
23762
  };
23714
23763
  };
23715
23764
  var hasTeamTitledOutcomes = (market) => {
@@ -23723,28 +23772,41 @@ var isClusterRelation = (left, right) => {
23723
23772
  var _a, _b;
23724
23773
  return ((_a = left.matchedVenueMarkets) != null ? _a : []).some((market) => market.id === right.id) || ((_b = right.matchedVenueMarkets) != null ? _b : []).some((market) => market.id === left.id);
23725
23774
  };
23726
- var dropDecomposedLegsMergedIntoSingle = (markets) => markets.filter(
23727
- (market) => hasTeamTitledOutcomes(market) || !markets.some(
23728
- (other) => other !== market && hasTeamTitledOutcomes(other) && isClusterRelation(market, other)
23729
- )
23730
- );
23775
+ var isDecomposedLeg = (market) => {
23776
+ var _a;
23777
+ const labels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
23778
+ (outcome) => toTrimmedString(outcome.label).toLowerCase()
23779
+ );
23780
+ return labels.length === 2 && labels.every((label2) => YES_NO_LABELS.has(label2)) && !hasTeamTitledOutcomes(market);
23781
+ };
23782
+ var dropDecomposedLegsMergedIntoSingle = (markets) => {
23783
+ const legs = markets.filter((market) => isDecomposedLeg(market));
23784
+ if (legs.length === 0) return markets;
23785
+ const hasMergedSingle = markets.some(
23786
+ (market) => {
23787
+ var _a, _b;
23788
+ 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));
23789
+ }
23790
+ );
23791
+ return hasMergedSingle ? markets.filter((market) => !isDecomposedLeg(market)) : markets;
23792
+ };
23731
23793
  var resolveSportsSectionMarkets = ({
23732
- tabKey,
23794
+ tab,
23733
23795
  eventMarkets,
23734
23796
  sectionMarkets
23735
23797
  }) => {
23736
- const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tabKey);
23798
+ const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tab.key);
23737
23799
  const filteredSectionMarkets = effectiveSectionMarkets.filter(
23738
- (market) => resolveMarketSectionTabKey(market) === tabKey
23800
+ (market) => resolveMarketSectionTabKey(market) === tab.key
23739
23801
  );
23740
- if (tabKey === "other") {
23802
+ if (tab.key === "other" || tab.key === `stat:${SPORTS_GENERIC_STAT}`) {
23741
23803
  const seenIds = new Set(filteredSectionMarkets.map((market) => market.id));
23742
- const strayOtherMarkets = eventMarkets.filter(
23743
- (market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) === "other"
23804
+ const strayMarkets = eventMarkets.filter(
23805
+ (market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) === tab.key
23744
23806
  );
23745
- return [...filteredSectionMarkets, ...strayOtherMarkets];
23807
+ return [...filteredSectionMarkets, ...strayMarkets];
23746
23808
  }
23747
- if (tabKey !== "game_lines") return filteredSectionMarkets;
23809
+ if (tab.kind !== "game_lines") return filteredSectionMarkets;
23748
23810
  const dedupeEventMarketsOfType = (type) => {
23749
23811
  const dedupedMarkets = [];
23750
23812
  const seenKeys = /* @__PURE__ */ new Set();
@@ -23844,7 +23906,9 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
23844
23906
  return toTrimmedString((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a[index]) == null ? void 0 : _b.title);
23845
23907
  }).filter((title2) => isSpreadTeamTitle(title2));
23846
23908
  if (cleanTitles.length === 0) return null;
23847
- return cleanTitles.reduce((longest, title2) => title2.length > longest.length ? title2 : longest);
23909
+ return cleanTitles.reduce(
23910
+ (longest, title2) => title2.length > longest.length ? title2 : longest
23911
+ );
23848
23912
  };
23849
23913
  return { favored: pickName(0), dog: pickName(1) };
23850
23914
  };
@@ -23853,9 +23917,7 @@ var resolveCombinedMoneylineLegLabel = (market) => {
23853
23917
  return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
23854
23918
  };
23855
23919
  var areCombinedMoneylineLegsDistinct = (markets) => {
23856
- const labels = markets.map(
23857
- (market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
23858
- );
23920
+ const labels = markets.map((market) => resolveCombinedMoneylineLegLabel(market).toLowerCase());
23859
23921
  return labels.every((label2) => label2.length > 0) && new Set(labels).size === labels.length;
23860
23922
  };
23861
23923
  var resolveDisplayGroupFamilyKey = (market) => {
@@ -24140,6 +24202,15 @@ var buildSportsSlideFromGroup = (group) => {
24140
24202
  defaultStopIndex
24141
24203
  };
24142
24204
  };
24205
+ var formatSportsPeriodGrammarLabel = (period) => {
24206
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
24207
+ if (!grammarMatch) return null;
24208
+ if (grammarMatch[1]) {
24209
+ const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
24210
+ return `${family} ${Number(grammarMatch[2])}`;
24211
+ }
24212
+ return `First ${Number(grammarMatch[3])} Innings`;
24213
+ };
24143
24214
  var resolveSportsCategoryTokens = (event) => {
24144
24215
  return new Set(
24145
24216
  event.categories.flatMap((entry) => {
@@ -24162,39 +24233,20 @@ var isNonStandardSportsLikeEvent = (event) => {
24162
24233
  return ESPORTS_TITLE_PATTERN.test(question) || SERIES_SCOPE_PATTERN.test(question);
24163
24234
  });
24164
24235
  };
24165
- var resolveVisibleSportsSectionTabDefinitions = (event) => {
24166
- const presentTabKeys = /* @__PURE__ */ new Set();
24167
- for (const market of event.venueMarkets) {
24168
- const tabKey = resolveMarketSectionTabKey(market);
24169
- if (tabKey) presentTabKeys.add(tabKey);
24170
- }
24171
- let definitions = SPORTS_SECTION_TAB_DEFINITIONS.filter(
24172
- (definition) => presentTabKeys.has(definition.key)
24173
- );
24174
- if (isNonStandardSportsLikeEvent(event)) {
24175
- definitions = definitions.filter(
24176
- (definition) => SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET.has(definition.key)
24177
- );
24178
- }
24179
- return definitions;
24180
- };
24181
24236
  var mergeSportsSectionMarketsIntoEvent = ({
24182
24237
  event,
24183
24238
  sectionMarketsByKey
24184
24239
  }) => {
24185
- var _a;
24186
24240
  const orderedVenueMarkets = [...event.venueMarkets];
24187
24241
  const seenMarketIds = new Set(orderedVenueMarkets.map((market) => market.id));
24188
- for (const sectionKey of SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => definition.key)) {
24189
- for (const market of (_a = sectionMarketsByKey[sectionKey]) != null ? _a : []) {
24242
+ for (const markets of Object.values(sectionMarketsByKey)) {
24243
+ for (const market of markets != null ? markets : []) {
24190
24244
  if (seenMarketIds.has(market.id)) continue;
24191
24245
  seenMarketIds.add(market.id);
24192
24246
  orderedVenueMarkets.push(market);
24193
24247
  }
24194
24248
  }
24195
- return __spreadProps(__spreadValues({}, event), {
24196
- venueMarkets: orderedVenueMarkets
24197
- });
24249
+ return __spreadProps(__spreadValues({}, event), { venueMarkets: orderedVenueMarkets });
24198
24250
  };
24199
24251
 
24200
24252
  // src/pages/event-market/sports-market-card.tsx
@@ -24677,24 +24729,48 @@ SportsMarketCard.displayName = "SportsMarketCard";
24677
24729
 
24678
24730
  // src/pages/event-market/sports-markets.tsx
24679
24731
  var import_jsx_runtime162 = require("react/jsx-runtime");
24680
- var resolveSportsSectionLabel = (labels, key) => {
24681
- switch (key) {
24732
+ var STAT_LABEL_OVERRIDES = {
24733
+ rbis: "RBIs",
24734
+ hits_runs_rbis: "Hits + Runs + RBIs",
24735
+ ot: "OT"
24736
+ };
24737
+ var formatStatLabel = (stat) => {
24738
+ var _a;
24739
+ return (_a = STAT_LABEL_OVERRIDES[stat]) != null ? _a : stat.split("_").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
24740
+ };
24741
+ var LEGACY_STAT_LABEL_KEYS = {
24742
+ corners: "cornersTab",
24743
+ goals: "goalsTab",
24744
+ assists: "assistsTab",
24745
+ shots: "shotsTab"
24746
+ };
24747
+ var resolveSportsSectionLabel = (labels, tab) => {
24748
+ var _a, _b, _c, _d, _e;
24749
+ const sports = labels.eventMarketPage.sports;
24750
+ switch (tab.kind) {
24682
24751
  case "game_lines":
24683
- return labels.eventMarketPage.sports.gameLinesTab;
24684
- case "halves":
24685
- return labels.eventMarketPage.sports.halvesTab;
24752
+ return sports.gameLinesTab;
24686
24753
  case "exact_score":
24687
- return labels.eventMarketPage.sports.exactScoreTab;
24688
- case "corners":
24689
- return labels.eventMarketPage.sports.cornersTab;
24690
- case "goals":
24691
- return labels.eventMarketPage.sports.goalsTab;
24692
- case "assists":
24693
- return labels.eventMarketPage.sports.assistsTab;
24694
- case "shots":
24695
- return labels.eventMarketPage.sports.shotsTab;
24754
+ return sports.exactScoreTab;
24696
24755
  case "other":
24697
- return labels.eventMarketPage.sports.otherTab;
24756
+ return sports.otherTab;
24757
+ case "stat": {
24758
+ if (tab.stat === "player_props") return sports.playerPropsTab;
24759
+ const legacyLabelKey = tab.stat ? LEGACY_STAT_LABEL_KEYS[tab.stat] : void 0;
24760
+ return legacyLabelKey ? sports[legacyLabelKey] : formatStatLabel((_a = tab.stat) != null ? _a : "");
24761
+ }
24762
+ case "period": {
24763
+ switch (tab.periodFamily) {
24764
+ case "halves":
24765
+ return sports.halvesTab;
24766
+ case "quarters":
24767
+ return sports.quartersTab;
24768
+ case "sets":
24769
+ return sports.setsTab;
24770
+ default:
24771
+ return (_e = (_c = formatSportsPeriodGrammarLabel((_b = tab.periodFamily) != null ? _b : "")) == null ? void 0 : _c.replace(/^First /, "")) != null ? _e : formatStatLabel((_d = tab.periodFamily) != null ? _d : "");
24772
+ }
24773
+ }
24698
24774
  }
24699
24775
  };
24700
24776
  var SportsTabButton = ({
@@ -24782,18 +24858,23 @@ var SportsMarkets = ({
24782
24858
  }
24783
24859
  return merged;
24784
24860
  }, [event.venueMarkets, gameMarkets]);
24785
- const visibleSectionDefinitions = (0, import_react41.useMemo)(
24786
- () => resolveVisibleSportsSectionTabDefinitions(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
24861
+ const visibleTabs = (0, import_react41.useMemo)(
24862
+ () => resolveVisibleSportsSectionTabs(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
24787
24863
  [event, tabSourceMarkets]
24788
24864
  );
24789
- const shouldRenderTabs = visibleSectionDefinitions.length > 1 && tabSourceMarkets.length > 1;
24790
- const [activeTabKey, setActiveTabKey] = (0, import_react41.useState)(
24791
- (_b = (_a = visibleSectionDefinitions[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines"
24865
+ const shouldRenderTabs = visibleTabs.length > 1 && tabSourceMarkets.length > 1;
24866
+ const [activeTabKey, setActiveTabKey] = (0, import_react41.useState)((_b = (_a = visibleTabs[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines");
24867
+ const activeTab = (0, import_react41.useMemo)(
24868
+ () => {
24869
+ var _a2, _b2;
24870
+ return (_b2 = (_a2 = visibleTabs.find((tab) => tab.key === activeTabKey)) != null ? _a2 : visibleTabs[0]) != null ? _b2 : { key: "game_lines", kind: "game_lines" };
24871
+ },
24872
+ [visibleTabs, activeTabKey]
24792
24873
  );
24793
24874
  const [expandedGroupId, setExpandedGroupId] = (0, import_react41.useState)(null);
24794
24875
  const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react41.useState)({});
24795
- const activeTabLabel = resolveSportsSectionLabel(labels, activeTabKey);
24796
- const sectionFilters = resolveSportsSectionFilters(activeTabKey);
24876
+ const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
24877
+ const sectionFilters = resolveSportsSectionFilters(activeTab);
24797
24878
  const sectionMarketsQuery = (0, import_hooks65.useVenueMarkets)({
24798
24879
  aggKey: event.aggKey ? [event.aggKey] : void 0,
24799
24880
  sportsMarketType: sectionFilters.sportsMarketType,
@@ -24816,26 +24897,25 @@ var SportsMarkets = ({
24816
24897
  } = sectionMarketsQuery;
24817
24898
  const resolvedSectionMarkets = (0, import_react41.useMemo)(
24818
24899
  () => resolveSportsSectionMarkets({
24819
- tabKey: activeTabKey,
24900
+ tab: activeTab,
24820
24901
  eventMarkets: tabSourceMarkets,
24821
24902
  sectionMarkets
24822
24903
  }),
24823
- [activeTabKey, tabSourceMarkets, sectionMarkets]
24904
+ [activeTab, tabSourceMarkets, sectionMarkets]
24824
24905
  );
24825
24906
  const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
24826
24907
  const stableSectionMarkets = stableMarketsByTab[activeTabKey];
24827
- const displayedSectionMarkets = stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [];
24908
+ const displayedSectionMarkets = (0, import_react41.useMemo)(
24909
+ () => stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [],
24910
+ [stableSectionMarkets, isSectionSettled, resolvedSectionMarkets]
24911
+ );
24828
24912
  const periodGroups = (0, import_react41.useMemo)(
24829
24913
  () => groupSportsMarketsByPeriod(displayedSectionMarkets),
24830
24914
  [displayedSectionMarkets]
24831
24915
  );
24832
- const displayedPeriodGroups = (0, import_react41.useMemo)(
24833
- () => activeTabKey === "game_lines" ? periodGroups.filter((periodGroup) => periodGroup.key === "full") : periodGroups,
24834
- [activeTabKey, periodGroups]
24835
- );
24836
24916
  const allGroups = (0, import_react41.useMemo)(
24837
- () => displayedPeriodGroups.flatMap((periodGroup) => periodGroup.groups),
24838
- [displayedPeriodGroups]
24917
+ () => periodGroups.flatMap((periodGroup) => periodGroup.groups),
24918
+ [periodGroups]
24839
24919
  );
24840
24920
  (0, import_react41.useEffect)(() => {
24841
24921
  if (hasNextPage && !isFetchingNextPage) {
@@ -24869,9 +24949,9 @@ var SportsMarkets = ({
24869
24949
  }, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
24870
24950
  (0, import_react41.useEffect)(() => {
24871
24951
  var _a2, _b2;
24872
- if (visibleSectionDefinitions.some((definition) => definition.key === activeTabKey)) return;
24873
- setActiveTabKey((_b2 = (_a2 = visibleSectionDefinitions[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
24874
- }, [activeTabKey, visibleSectionDefinitions]);
24952
+ if (visibleTabs.some((tab) => tab.key === activeTabKey)) return;
24953
+ setActiveTabKey((_b2 = (_a2 = visibleTabs[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
24954
+ }, [activeTabKey, visibleTabs]);
24875
24955
  const lastActiveTabRef = (0, import_react41.useRef)(null);
24876
24956
  (0, import_react41.useEffect)(() => {
24877
24957
  if (allGroups.length === 0) return;
@@ -24918,14 +24998,14 @@ var SportsMarkets = ({
24918
24998
  role: "tablist",
24919
24999
  "aria-label": labels.eventMarketPage.sports.sectionTabsAria,
24920
25000
  className: "flex flex-nowrap items-center gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
24921
- children: visibleSectionDefinitions.map((definition) => /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
25001
+ children: visibleTabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
24922
25002
  SportsTabButton,
24923
25003
  {
24924
- isActive: definition.key === activeTabKey,
24925
- label: resolveSportsSectionLabel(labels, definition.key),
24926
- onClick: () => setActiveTabKey(definition.key)
25004
+ isActive: tab.key === activeTabKey,
25005
+ label: resolveSportsSectionLabel(labels, tab),
25006
+ onClick: () => setActiveTabKey(tab.key)
24927
25007
  },
24928
- definition.key
25008
+ tab.key
24929
25009
  ))
24930
25010
  }
24931
25011
  ) : null,
@@ -24939,7 +25019,7 @@ var SportsMarkets = ({
24939
25019
  classNames: { root: "min-h-[220px]" }
24940
25020
  }
24941
25021
  ) : null,
24942
- displayedPeriodGroups.map((periodGroup) => {
25022
+ periodGroups.map((periodGroup) => {
24943
25023
  return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
24944
25024
  "section",
24945
25025
  {
@@ -24996,7 +25076,7 @@ var SportsEventMarketPage = ({
24996
25076
  }, [event, sectionMarketsByKey]);
24997
25077
  const eventTradingState = (0, import_react42.useMemo)(() => (0, import_hooks66.resolveEventTradingState)(composedEvent), [composedEvent]);
24998
25078
  const hasSportsSections = (0, import_react42.useMemo)(
24999
- () => resolveVisibleSportsSectionTabDefinitions(event).length > 0,
25079
+ () => resolveVisibleSportsSectionTabs(event).length > 0,
25000
25080
  [event]
25001
25081
  );
25002
25082
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
package/dist/pages.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  UserProfilePage,
9
9
  buildAggTxExplorerHref,
10
10
  useHomePageModals
11
- } from "./chunk-AELMIG74.mjs";
11
+ } from "./chunk-TQL5I4GX.mjs";
12
12
  import "./chunk-XAG432PJ.mjs";
13
13
  import {
14
14
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -1,12 +1,12 @@
1
1
  import { type VenueEventWithMarkets, type VenueMarket } from "@agg-build/hooks";
2
2
  export declare const sportsSectionMarketsByTab: {
3
3
  game_lines: VenueMarket[];
4
- halves: readonly [VenueMarket, VenueMarket, VenueMarket];
4
+ "period:halves": readonly [VenueMarket, VenueMarket, VenueMarket];
5
5
  exact_score: readonly [VenueMarket];
6
- corners: readonly [VenueMarket, VenueMarket];
7
- goals: VenueMarket[];
8
- assists: readonly [VenueMarket];
9
- shots: readonly [VenueMarket];
6
+ "stat:corners": readonly [VenueMarket, VenueMarket];
7
+ "stat:goals": VenueMarket[];
8
+ "stat:assists": readonly [VenueMarket];
9
+ "stat:shots": readonly [VenueMarket];
10
10
  other: readonly [VenueMarket];
11
11
  };
12
12
  export declare const sportsEventPageFixture: VenueEventWithMarkets;
@@ -1,12 +1,12 @@
1
1
  import { type VenueEventWithMarkets, type VenueMarket } from "@agg-build/hooks";
2
2
  export declare const sportsSectionMarketsByTab: {
3
3
  game_lines: VenueMarket[];
4
- halves: readonly [VenueMarket, VenueMarket, VenueMarket];
4
+ "period:halves": readonly [VenueMarket, VenueMarket, VenueMarket];
5
5
  exact_score: readonly [VenueMarket];
6
- corners: readonly [VenueMarket, VenueMarket];
7
- goals: VenueMarket[];
8
- assists: readonly [VenueMarket];
9
- shots: readonly [VenueMarket];
6
+ "stat:corners": readonly [VenueMarket, VenueMarket];
7
+ "stat:goals": VenueMarket[];
8
+ "stat:assists": readonly [VenueMarket];
9
+ "stat:shots": readonly [VenueMarket];
10
10
  other: readonly [VenueMarket];
11
11
  };
12
12
  export declare const sportsEventPageFixture: VenueEventWithMarkets;