@agg-build/ui 4.21.1 → 4.22.2

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.
@@ -21,7 +21,7 @@ import {
21
21
  parseRawMicroValue,
22
22
  selectOpenLimitOrders,
23
23
  useOpenOrderCancellation
24
- } from "./chunk-R7ARCUYW.mjs";
24
+ } from "./chunk-NDD5IHAU.mjs";
25
25
  import {
26
26
  DEPOSIT_MODAL_OPEN_EVENT,
27
27
  WITHDRAW_MODAL_OPEN_EVENT,
@@ -266,7 +266,7 @@ var useHomePageModals = () => {
266
266
  // src/pages/home/index.tsx
267
267
  import { jsx, jsxs } from "react/jsx-runtime";
268
268
  var DeferredEventMarketPage = lazy(
269
- () => import("./event-market-5SIXH2XF.mjs").then((module) => ({ default: module.EventMarketPage }))
269
+ () => import("./event-market-F2FPSTAB.mjs").then((module) => ({ default: module.EventMarketPage }))
270
270
  );
271
271
  var MIN_SEARCH_LENGTH = 3;
272
272
  var SEARCH_DEBOUNCE_MS = 300;
@@ -1914,7 +1914,11 @@ var resolveSportsLadderTitle = (group, selectedLineDisplay) => {
1914
1914
  const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
1915
1915
  return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
1916
1916
  };
1917
- var buildSportsSlideFromGroup = (group) => {
1917
+ var resolveDistanceFromEvenMoney = (market, prices) => {
1918
+ const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
1919
+ return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
1920
+ };
1921
+ var buildSportsSlideFromGroup = (group, prices) => {
1918
1922
  const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
1919
1923
  const hasLadder = lineStops.length > 1;
1920
1924
  const stops = hasLadder ? lineStops.map((lineStop) => ({
@@ -1922,10 +1926,16 @@ var buildSportsSlideFromGroup = (group) => {
1922
1926
  venues: lineStop.venues,
1923
1927
  market: lineStop.representative
1924
1928
  })) : [];
1925
- const defaultStopIndex = hasLadder ? lineStops.reduce(
1926
- (bestIndex, lineStop, index) => lineStop.volume > lineStops[bestIndex].volume ? index : bestIndex,
1927
- 0
1928
- ) : 0;
1929
+ const evenMoneyDistances = lineStops.map(
1930
+ (lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
1931
+ );
1932
+ const defaultStopIndex = hasLadder ? lineStops.reduce((bestIndex, lineStop, index) => {
1933
+ const best = lineStops[bestIndex];
1934
+ if (lineStop.volume !== best.volume) {
1935
+ return lineStop.volume > best.volume ? index : bestIndex;
1936
+ }
1937
+ return evenMoneyDistances[index] < evenMoneyDistances[bestIndex] ? index : bestIndex;
1938
+ }, 0) : 0;
1929
1939
  return {
1930
1940
  id: group.id,
1931
1941
  kind: resolveSlideKind(group),
@@ -2337,14 +2347,18 @@ var SportsMarketCard = ({
2337
2347
  midpointsFallbackVenues,
2338
2348
  midpointsResult
2339
2349
  }) => {
2340
- var _a, _b, _c, _d, _e, _f, _g, _h;
2350
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2341
2351
  const labels = useLabels6();
2342
2352
  const {
2343
2353
  formatting: { formatCompactCurrency }
2344
2354
  } = useSdkUiConfig2();
2345
2355
  const tradingContext = useEventTradingContext();
2346
- const slide = useMemo2(() => buildSportsSlideFromGroup(group), [group]);
2356
+ const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
2357
+ const slide = useMemo2(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
2347
2358
  const [selectedLineIndex, setSelectedLineIndex] = useState4(slide.defaultStopIndex);
2359
+ const userPickedLineRef = useRef2(false);
2360
+ const autoLineIndexRef = useRef2(slide.defaultStopIndex);
2361
+ const autoSelectedMarketIdRef = useRef2(null);
2348
2362
  const combinedLegs = useMemo2(() => resolveSportsCombinedLegs(group), [group]);
2349
2363
  const isCombinedLegGroup = combinedLegs != null;
2350
2364
  const combinedLegMarkets = useMemo2(
@@ -2373,11 +2387,30 @@ var SportsMarketCard = ({
2373
2387
  const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
2374
2388
  if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
2375
2389
  }, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
2376
- const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_a = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _a : null : null : null;
2377
- const activeMarket = slide.hasLadder ? (_d = (_c = (_b = slide.stops[selectedLineIndex]) == null ? void 0 : _b.market) != null ? _c : group.markets[0]) != null ? _d : null : (_f = (_e = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _e : group.markets[0]) != null ? _f : null;
2378
- const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_g = activeMarket.venueMarketOutcomes.find(
2390
+ useEffect3(() => {
2391
+ var _a2;
2392
+ if (!slide.hasLadder || userPickedLineRef.current) return;
2393
+ const nextIndex = slide.defaultStopIndex;
2394
+ if (nextIndex === autoLineIndexRef.current) return;
2395
+ const tradingIndex = slide.stops.findIndex(
2396
+ (stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
2397
+ );
2398
+ if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
2399
+ return;
2400
+ }
2401
+ autoLineIndexRef.current = nextIndex;
2402
+ setSelectedLineIndex(nextIndex);
2403
+ const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
2404
+ if (tradingIndex >= 0 && nextMarket) {
2405
+ autoSelectedMarketIdRef.current = nextMarket.id;
2406
+ tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
2407
+ }
2408
+ }, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
2409
+ const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
2410
+ const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
2411
+ const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
2379
2412
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
2380
- )) != null ? _g : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
2413
+ )) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
2381
2414
  const wasExpandedRef = useRef2(isExpanded);
2382
2415
  useEffect3(() => {
2383
2416
  const justOpened = isExpanded && !wasExpandedRef.current;
@@ -2389,6 +2422,7 @@ var SportsMarketCard = ({
2389
2422
  if (hasInScopeOutcome) return;
2390
2423
  const firstOutcome = activeDefaultOutcome;
2391
2424
  if (firstOutcome) {
2425
+ autoSelectedMarketIdRef.current = activeMarket.id;
2392
2426
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
2393
2427
  }
2394
2428
  }, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
@@ -2430,9 +2464,9 @@ var SportsMarketCard = ({
2430
2464
  if (!activeMarket) return null;
2431
2465
  const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
2432
2466
  const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
2433
- const activeOutcome = (_h = activeMarket.venueMarketOutcomes.find(
2467
+ const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
2434
2468
  (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
2435
- )) != null ? _h : activeDefaultOutcome;
2469
+ )) != null ? _i : activeDefaultOutcome;
2436
2470
  const activeOutcomeVenueCount = (() => {
2437
2471
  var _a2, _b2;
2438
2472
  if (!activeOutcome) return collectVenueNames(activeMarket).length;
@@ -2474,6 +2508,7 @@ var SportsMarketCard = ({
2474
2508
  useSpreadOverride: slide.kind === "spread"
2475
2509
  });
2476
2510
  const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
2511
+ userPickedLineRef.current = true;
2477
2512
  setSelectedLineIndex(index);
2478
2513
  if (nextOutcome) {
2479
2514
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
@@ -6,7 +6,7 @@ import {
6
6
  EventOpenOrdersCard,
7
7
  formatRecurringCountdown,
8
8
  useEventOpenOrders
9
- } from "./chunk-R7ARCUYW.mjs";
9
+ } from "./chunk-NDD5IHAU.mjs";
10
10
  import "./chunk-LTFRGJPL.mjs";
11
11
  import "./chunk-NV6WT3TN.mjs";
12
12
  import "./chunk-WOCZ4TVT.mjs";
package/dist/index.js CHANGED
@@ -31954,7 +31954,7 @@ var init_event_market_shared = __esm({
31954
31954
  });
31955
31955
 
31956
31956
  // src/pages/event-market/sports-event-market.utils.ts
31957
- var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
31957
+ var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, resolveDistanceFromEvenMoney, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
31958
31958
  var init_sports_event_market_utils = __esm({
31959
31959
  "src/pages/event-market/sports-event-market.utils.ts"() {
31960
31960
  "use strict";
@@ -32911,7 +32911,11 @@ var init_sports_event_market_utils = __esm({
32911
32911
  const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
32912
32912
  return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
32913
32913
  };
32914
- buildSportsSlideFromGroup = (group) => {
32914
+ resolveDistanceFromEvenMoney = (market, prices) => {
32915
+ const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
32916
+ return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
32917
+ };
32918
+ buildSportsSlideFromGroup = (group, prices) => {
32915
32919
  const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
32916
32920
  const hasLadder = lineStops.length > 1;
32917
32921
  const stops = hasLadder ? lineStops.map((lineStop) => ({
@@ -32919,10 +32923,16 @@ var init_sports_event_market_utils = __esm({
32919
32923
  venues: lineStop.venues,
32920
32924
  market: lineStop.representative
32921
32925
  })) : [];
32922
- const defaultStopIndex = hasLadder ? lineStops.reduce(
32923
- (bestIndex, lineStop, index) => lineStop.volume > lineStops[bestIndex].volume ? index : bestIndex,
32924
- 0
32925
- ) : 0;
32926
+ const evenMoneyDistances = lineStops.map(
32927
+ (lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
32928
+ );
32929
+ const defaultStopIndex = hasLadder ? lineStops.reduce((bestIndex, lineStop, index) => {
32930
+ const best = lineStops[bestIndex];
32931
+ if (lineStop.volume !== best.volume) {
32932
+ return lineStop.volume > best.volume ? index : bestIndex;
32933
+ }
32934
+ return evenMoneyDistances[index] < evenMoneyDistances[bestIndex] ? index : bestIndex;
32935
+ }, 0) : 0;
32926
32936
  return {
32927
32937
  id: group.id,
32928
32938
  kind: resolveSlideKind(group),
@@ -33348,14 +33358,18 @@ var init_sports_market_card = __esm({
33348
33358
  midpointsFallbackVenues,
33349
33359
  midpointsResult
33350
33360
  }) => {
33351
- var _a, _b, _c, _d, _e, _f, _g, _h;
33361
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33352
33362
  const labels = (0, import_hooks96.useLabels)();
33353
33363
  const {
33354
33364
  formatting: { formatCompactCurrency }
33355
33365
  } = (0, import_hooks96.useSdkUiConfig)();
33356
33366
  const tradingContext = (0, import_hooks96.useEventTradingContext)();
33357
- const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
33367
+ const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
33368
+ const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
33358
33369
  const [selectedLineIndex, setSelectedLineIndex] = (0, import_react65.useState)(slide.defaultStopIndex);
33370
+ const userPickedLineRef = (0, import_react65.useRef)(false);
33371
+ const autoLineIndexRef = (0, import_react65.useRef)(slide.defaultStopIndex);
33372
+ const autoSelectedMarketIdRef = (0, import_react65.useRef)(null);
33359
33373
  const combinedLegs = (0, import_react65.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
33360
33374
  const isCombinedLegGroup = combinedLegs != null;
33361
33375
  const combinedLegMarkets = (0, import_react65.useMemo)(
@@ -33384,11 +33398,30 @@ var init_sports_market_card = __esm({
33384
33398
  const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
33385
33399
  if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
33386
33400
  }, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
33387
- const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_a = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _a : null : null : null;
33388
- const activeMarket = slide.hasLadder ? (_d = (_c = (_b = slide.stops[selectedLineIndex]) == null ? void 0 : _b.market) != null ? _c : group.markets[0]) != null ? _d : null : (_f = (_e = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _e : group.markets[0]) != null ? _f : null;
33389
- const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_g = activeMarket.venueMarketOutcomes.find(
33401
+ (0, import_react65.useEffect)(() => {
33402
+ var _a2;
33403
+ if (!slide.hasLadder || userPickedLineRef.current) return;
33404
+ const nextIndex = slide.defaultStopIndex;
33405
+ if (nextIndex === autoLineIndexRef.current) return;
33406
+ const tradingIndex = slide.stops.findIndex(
33407
+ (stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
33408
+ );
33409
+ if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
33410
+ return;
33411
+ }
33412
+ autoLineIndexRef.current = nextIndex;
33413
+ setSelectedLineIndex(nextIndex);
33414
+ const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
33415
+ if (tradingIndex >= 0 && nextMarket) {
33416
+ autoSelectedMarketIdRef.current = nextMarket.id;
33417
+ tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
33418
+ }
33419
+ }, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
33420
+ const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
33421
+ const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
33422
+ const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
33390
33423
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
33391
- )) != null ? _g : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
33424
+ )) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
33392
33425
  const wasExpandedRef = (0, import_react65.useRef)(isExpanded);
33393
33426
  (0, import_react65.useEffect)(() => {
33394
33427
  const justOpened = isExpanded && !wasExpandedRef.current;
@@ -33400,6 +33433,7 @@ var init_sports_market_card = __esm({
33400
33433
  if (hasInScopeOutcome) return;
33401
33434
  const firstOutcome = activeDefaultOutcome;
33402
33435
  if (firstOutcome) {
33436
+ autoSelectedMarketIdRef.current = activeMarket.id;
33403
33437
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
33404
33438
  }
33405
33439
  }, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
@@ -33441,9 +33475,9 @@ var init_sports_market_card = __esm({
33441
33475
  if (!activeMarket) return null;
33442
33476
  const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
33443
33477
  const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
33444
- const activeOutcome = (_h = activeMarket.venueMarketOutcomes.find(
33478
+ const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
33445
33479
  (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
33446
- )) != null ? _h : activeDefaultOutcome;
33480
+ )) != null ? _i : activeDefaultOutcome;
33447
33481
  const activeOutcomeVenueCount = (() => {
33448
33482
  var _a2, _b2;
33449
33483
  if (!activeOutcome) return collectVenueNames(activeMarket).length;
@@ -33485,6 +33519,7 @@ var init_sports_market_card = __esm({
33485
33519
  useSpreadOverride: slide.kind === "spread"
33486
33520
  });
33487
33521
  const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
33522
+ userPickedLineRef.current = true;
33488
33523
  setSelectedLineIndex(index);
33489
33524
  if (nextOutcome) {
33490
33525
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  buildAggTxExplorerHref,
17
17
  formatShareAmount,
18
18
  useHomePageModals
19
- } from "./chunk-YBMDEGTJ.mjs";
19
+ } from "./chunk-4IO5CRSG.mjs";
20
20
  import {
21
21
  EventList,
22
22
  EventListItem,
@@ -40,7 +40,7 @@ import {
40
40
  EventOpenOrdersCard,
41
41
  formatRecurringCountdown,
42
42
  useEventOpenOrders
43
- } from "./chunk-R7ARCUYW.mjs";
43
+ } from "./chunk-NDD5IHAU.mjs";
44
44
  import {
45
45
  EventListItemDetails,
46
46
  MarketDetails,
package/dist/pages.js CHANGED
@@ -31229,7 +31229,7 @@ var init_event_market_shared = __esm({
31229
31229
  });
31230
31230
 
31231
31231
  // src/pages/event-market/sports-event-market.utils.ts
31232
- var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
31232
+ var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, resolveDistanceFromEvenMoney, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
31233
31233
  var init_sports_event_market_utils = __esm({
31234
31234
  "src/pages/event-market/sports-event-market.utils.ts"() {
31235
31235
  "use strict";
@@ -32186,7 +32186,11 @@ var init_sports_event_market_utils = __esm({
32186
32186
  const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
32187
32187
  return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
32188
32188
  };
32189
- buildSportsSlideFromGroup = (group) => {
32189
+ resolveDistanceFromEvenMoney = (market, prices) => {
32190
+ const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
32191
+ return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
32192
+ };
32193
+ buildSportsSlideFromGroup = (group, prices) => {
32190
32194
  const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
32191
32195
  const hasLadder = lineStops.length > 1;
32192
32196
  const stops = hasLadder ? lineStops.map((lineStop) => ({
@@ -32194,10 +32198,16 @@ var init_sports_event_market_utils = __esm({
32194
32198
  venues: lineStop.venues,
32195
32199
  market: lineStop.representative
32196
32200
  })) : [];
32197
- const defaultStopIndex = hasLadder ? lineStops.reduce(
32198
- (bestIndex, lineStop, index) => lineStop.volume > lineStops[bestIndex].volume ? index : bestIndex,
32199
- 0
32200
- ) : 0;
32201
+ const evenMoneyDistances = lineStops.map(
32202
+ (lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
32203
+ );
32204
+ const defaultStopIndex = hasLadder ? lineStops.reduce((bestIndex, lineStop, index) => {
32205
+ const best = lineStops[bestIndex];
32206
+ if (lineStop.volume !== best.volume) {
32207
+ return lineStop.volume > best.volume ? index : bestIndex;
32208
+ }
32209
+ return evenMoneyDistances[index] < evenMoneyDistances[bestIndex] ? index : bestIndex;
32210
+ }, 0) : 0;
32201
32211
  return {
32202
32212
  id: group.id,
32203
32213
  kind: resolveSlideKind(group),
@@ -32623,14 +32633,18 @@ var init_sports_market_card = __esm({
32623
32633
  midpointsFallbackVenues,
32624
32634
  midpointsResult
32625
32635
  }) => {
32626
- var _a, _b, _c, _d, _e, _f, _g, _h;
32636
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
32627
32637
  const labels = (0, import_hooks93.useLabels)();
32628
32638
  const {
32629
32639
  formatting: { formatCompactCurrency }
32630
32640
  } = (0, import_hooks93.useSdkUiConfig)();
32631
32641
  const tradingContext = (0, import_hooks93.useEventTradingContext)();
32632
- const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
32642
+ const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
32643
+ const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
32633
32644
  const [selectedLineIndex, setSelectedLineIndex] = (0, import_react65.useState)(slide.defaultStopIndex);
32645
+ const userPickedLineRef = (0, import_react65.useRef)(false);
32646
+ const autoLineIndexRef = (0, import_react65.useRef)(slide.defaultStopIndex);
32647
+ const autoSelectedMarketIdRef = (0, import_react65.useRef)(null);
32634
32648
  const combinedLegs = (0, import_react65.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
32635
32649
  const isCombinedLegGroup = combinedLegs != null;
32636
32650
  const combinedLegMarkets = (0, import_react65.useMemo)(
@@ -32659,11 +32673,30 @@ var init_sports_market_card = __esm({
32659
32673
  const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
32660
32674
  if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
32661
32675
  }, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
32662
- const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_a = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _a : null : null : null;
32663
- const activeMarket = slide.hasLadder ? (_d = (_c = (_b = slide.stops[selectedLineIndex]) == null ? void 0 : _b.market) != null ? _c : group.markets[0]) != null ? _d : null : (_f = (_e = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _e : group.markets[0]) != null ? _f : null;
32664
- const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_g = activeMarket.venueMarketOutcomes.find(
32676
+ (0, import_react65.useEffect)(() => {
32677
+ var _a2;
32678
+ if (!slide.hasLadder || userPickedLineRef.current) return;
32679
+ const nextIndex = slide.defaultStopIndex;
32680
+ if (nextIndex === autoLineIndexRef.current) return;
32681
+ const tradingIndex = slide.stops.findIndex(
32682
+ (stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
32683
+ );
32684
+ if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
32685
+ return;
32686
+ }
32687
+ autoLineIndexRef.current = nextIndex;
32688
+ setSelectedLineIndex(nextIndex);
32689
+ const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
32690
+ if (tradingIndex >= 0 && nextMarket) {
32691
+ autoSelectedMarketIdRef.current = nextMarket.id;
32692
+ tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
32693
+ }
32694
+ }, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
32695
+ const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
32696
+ const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
32697
+ const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
32665
32698
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
32666
- )) != null ? _g : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
32699
+ )) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
32667
32700
  const wasExpandedRef = (0, import_react65.useRef)(isExpanded);
32668
32701
  (0, import_react65.useEffect)(() => {
32669
32702
  const justOpened = isExpanded && !wasExpandedRef.current;
@@ -32675,6 +32708,7 @@ var init_sports_market_card = __esm({
32675
32708
  if (hasInScopeOutcome) return;
32676
32709
  const firstOutcome = activeDefaultOutcome;
32677
32710
  if (firstOutcome) {
32711
+ autoSelectedMarketIdRef.current = activeMarket.id;
32678
32712
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
32679
32713
  }
32680
32714
  }, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
@@ -32716,9 +32750,9 @@ var init_sports_market_card = __esm({
32716
32750
  if (!activeMarket) return null;
32717
32751
  const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
32718
32752
  const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
32719
- const activeOutcome = (_h = activeMarket.venueMarketOutcomes.find(
32753
+ const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
32720
32754
  (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
32721
- )) != null ? _h : activeDefaultOutcome;
32755
+ )) != null ? _i : activeDefaultOutcome;
32722
32756
  const activeOutcomeVenueCount = (() => {
32723
32757
  var _a2, _b2;
32724
32758
  if (!activeOutcome) return collectVenueNames(activeMarket).length;
@@ -32760,6 +32794,7 @@ var init_sports_market_card = __esm({
32760
32794
  useSpreadOverride: slide.kind === "spread"
32761
32795
  });
32762
32796
  const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
32797
+ userPickedLineRef.current = true;
32763
32798
  setSelectedLineIndex(index);
32764
32799
  if (nextOutcome) {
32765
32800
  tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
package/dist/pages.mjs CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  buildAggTxExplorerHref,
14
14
  formatShareAmount,
15
15
  useHomePageModals
16
- } from "./chunk-YBMDEGTJ.mjs";
16
+ } from "./chunk-4IO5CRSG.mjs";
17
17
  import "./chunk-LIB6TLLV.mjs";
18
18
  import {
19
19
  EventMarketPage,
@@ -21,7 +21,7 @@ import {
21
21
  EventOpenOrdersCard,
22
22
  formatRecurringCountdown,
23
23
  useEventOpenOrders
24
- } from "./chunk-R7ARCUYW.mjs";
24
+ } from "./chunk-NDD5IHAU.mjs";
25
25
  import "./chunk-LTFRGJPL.mjs";
26
26
  import {
27
27
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -211,7 +211,12 @@ export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplay
211
211
  * returned untouched.
212
212
  */
213
213
  export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
214
- export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup) => SportsGameLineSlide;
214
+ /**
215
+ * `prices` (outcomeId → midpoint) breaks volume ties toward the line priced
216
+ * closest to 50/50 — the main line, where the books are deepest. Most line
217
+ * markets carry zero volume, so without it the default was the lowest rung.
218
+ */
219
+ export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup, prices?: ReadonlyMap<string, number>) => SportsGameLineSlide;
215
220
  /**
216
221
  * Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
217
222
  * flat list of venue markets. Reuses {@link buildSportsMarketDisplayGroups} so
@@ -211,7 +211,12 @@ export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplay
211
211
  * returned untouched.
212
212
  */
213
213
  export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
214
- export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup) => SportsGameLineSlide;
214
+ /**
215
+ * `prices` (outcomeId → midpoint) breaks volume ties toward the line priced
216
+ * closest to 50/50 — the main line, where the books are deepest. Most line
217
+ * markets carry zero volume, so without it the default was the lowest rung.
218
+ */
219
+ export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup, prices?: ReadonlyMap<string, number>) => SportsGameLineSlide;
215
220
  /**
216
221
  * Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
217
222
  * flat list of venue markets. Reuses {@link buildSportsMarketDisplayGroups} so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "4.21.1",
3
+ "version": "4.22.2",
4
4
  "description": "Pre-built React component library for the AGG prediction market aggregator. Tailwind-based, themeable, with primitives, event surfaces, trading flows, full pages, and modals.",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -101,7 +101,7 @@
101
101
  "react": "^18.0.0 || ^19.0.0",
102
102
  "react-dom": "^18.0.0 || ^19.0.0",
103
103
  "@agg-build/hooks": "^4.21.1",
104
- "@agg-build/sdk": "^4.21.0"
104
+ "@agg-build/sdk": "^4.22.1"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",