@agg-build/ui 2.1.1 → 2.1.3

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.
Files changed (74) hide show
  1. package/dist/{chunk-XHDGSRG7.mjs → chunk-BW7S2YR3.mjs} +1139 -308
  2. package/dist/{chunk-TERG43WW.mjs → chunk-R2YNZJZ3.mjs} +69 -27
  3. package/dist/{chunk-RPXRTXCY.mjs → chunk-T4YZGAYS.mjs} +22 -1
  4. package/dist/{chunk-IQT4I5B4.mjs → chunk-TAGPAADA.mjs} +2108 -767
  5. package/dist/{chunk-NK57KMYN.mjs → chunk-TBZWRUFB.mjs} +752 -589
  6. package/dist/{chunk-YJO6LMRT.mjs → chunk-VP76G6PN.mjs} +87 -25
  7. package/dist/{chunk-WU2C3C6K.mjs → chunk-XHE2VO3S.mjs} +4 -21
  8. package/dist/events.js +1014 -760
  9. package/dist/events.mjs +5 -3
  10. package/dist/index.js +9937 -7880
  11. package/dist/index.mjs +117 -456
  12. package/dist/modals.js +1 -1
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +8513 -6380
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +85 -25
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +979 -402
  21. package/dist/trading.mjs +10 -6
  22. package/dist/types/events/item/event-list-item.utils.d.mts +1 -25
  23. package/dist/types/events/item/event-list-item.utils.d.ts +1 -25
  24. package/dist/types/events/item-details/index.d.mts +2 -1
  25. package/dist/types/events/item-details/index.d.ts +2 -1
  26. package/dist/types/events/market-details/market-details-graph-panel.d.mts +39 -0
  27. package/dist/types/events/market-details/market-details-graph-panel.d.ts +39 -0
  28. package/dist/types/events/market-details/market-details-outcome-button.d.mts +2 -1
  29. package/dist/types/events/market-details/market-details-outcome-button.d.ts +2 -1
  30. package/dist/types/events/market-details/market-details.types.d.mts +31 -0
  31. package/dist/types/events/market-details/market-details.types.d.ts +31 -0
  32. package/dist/types/events/market-details/market-details.utils.d.mts +3 -16
  33. package/dist/types/events/market-details/market-details.utils.d.ts +3 -16
  34. package/dist/types/events/shared/format-event-title.d.mts +24 -0
  35. package/dist/types/events/shared/format-event-title.d.ts +24 -0
  36. package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
  37. package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
  38. package/dist/types/events/shared/select-best-outcome.d.mts +88 -0
  39. package/dist/types/events/shared/select-best-outcome.d.ts +88 -0
  40. package/dist/types/notifications/agg-notification-events-provider.d.mts +10 -1
  41. package/dist/types/notifications/agg-notification-events-provider.d.ts +10 -1
  42. package/dist/types/pages/event-market/event-market.shared.d.mts +30 -0
  43. package/dist/types/pages/event-market/event-market.shared.d.ts +30 -0
  44. package/dist/types/pages/event-market/event-market.types.d.mts +7 -0
  45. package/dist/types/pages/event-market/event-market.types.d.ts +7 -0
  46. package/dist/types/pages/event-market/sports-event-market-page.d.mts +8 -0
  47. package/dist/types/pages/event-market/sports-event-market-page.d.ts +8 -0
  48. package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +13 -0
  49. package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +13 -0
  50. package/dist/types/pages/event-market/sports-event-market.utils.d.mts +156 -0
  51. package/dist/types/pages/event-market/sports-event-market.utils.d.ts +156 -0
  52. package/dist/types/pages/event-market/sports-line-rail.d.mts +17 -0
  53. package/dist/types/pages/event-market/sports-line-rail.d.ts +17 -0
  54. package/dist/types/pages/event-market/sports-market-card.d.mts +22 -0
  55. package/dist/types/pages/event-market/sports-market-card.d.ts +22 -0
  56. package/dist/types/pages/event-market/sports-markets.d.mts +13 -0
  57. package/dist/types/pages/event-market/sports-markets.d.ts +13 -0
  58. package/dist/types/primitives/state-message/index.d.mts +1 -1
  59. package/dist/types/primitives/state-message/index.d.ts +1 -1
  60. package/dist/types/primitives/state-message/state-message.types.d.mts +1 -1
  61. package/dist/types/primitives/state-message/state-message.types.d.ts +1 -1
  62. package/dist/types/trading/index.d.mts +2 -0
  63. package/dist/types/trading/index.d.ts +2 -0
  64. package/dist/types/trading/place-order/index.d.mts +1 -1
  65. package/dist/types/trading/place-order/index.d.ts +1 -1
  66. package/dist/types/trading/place-order/index.place-order.types.d.mts +30 -1
  67. package/dist/types/trading/place-order/index.place-order.types.d.ts +30 -1
  68. package/dist/types/trading/settlement/settlement-text.utils.d.mts +5 -2
  69. package/dist/types/trading/settlement/settlement-text.utils.d.ts +5 -2
  70. package/dist/types/trading/use-claim-winnings.d.mts +84 -0
  71. package/dist/types/trading/use-claim-winnings.d.ts +84 -0
  72. package/dist/types/trading/use-resolved-market-claim.d.mts +26 -0
  73. package/dist/types/trading/use-resolved-market-claim.d.ts +26 -0
  74. package/package.json +3 -3
@@ -10,13 +10,15 @@ import {
10
10
  isErrorWithStatus,
11
11
  useEventListTabs,
12
12
  useEventListTabsHeaderOverflow
13
- } from "./chunk-NK57KMYN.mjs";
13
+ } from "./chunk-TBZWRUFB.mjs";
14
14
  import {
15
15
  DEPOSIT_MODAL_OPEN_EVENT,
16
16
  PlaceOrder,
17
17
  SettlementDetails,
18
- WITHDRAW_MODAL_OPEN_EVENT
19
- } from "./chunk-XHDGSRG7.mjs";
18
+ WITHDRAW_MODAL_OPEN_EVENT,
19
+ useClaimWinnings,
20
+ useResolvedMarketClaim
21
+ } from "./chunk-BW7S2YR3.mjs";
20
22
  import {
21
23
  AggErrorBoundary,
22
24
  Button,
@@ -45,9 +47,8 @@ import {
45
47
  filterOpenEvents,
46
48
  resolveTabVenus,
47
49
  shortenAddress,
48
- sortCategoriesForNavigation,
49
- useOptionalToast
50
- } from "./chunk-YJO6LMRT.mjs";
50
+ sortCategoriesForNavigation
51
+ } from "./chunk-VP76G6PN.mjs";
51
52
 
52
53
  // src/pages/home/index.tsx
53
54
  import {
@@ -55,25 +56,23 @@ import {
55
56
  useAppConfig,
56
57
  useCategories,
57
58
  useEventListState,
58
- useLabels as useLabels2,
59
- useSdkUiConfig as useSdkUiConfig2,
59
+ useLabels as useLabels4,
60
+ useSdkUiConfig as useSdkUiConfig4,
60
61
  useSearch
61
62
  } from "@agg-build/hooks";
62
63
  import { VENUES } from "@agg-build/sdk";
63
- import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
64
+ import { useCallback as useCallback4, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef7, useState as useState9 } from "react";
64
65
 
65
66
  // src/pages/event-market/index.tsx
66
67
  import {
67
- resolveEventTradingState,
68
- TradeSide,
68
+ resolveEventTradingState as resolveEventTradingState3,
69
+ TradeSide as TradeSide2,
69
70
  useEnrichedVenueEvent,
70
- useEventTradingContext,
71
- useLabels,
72
- useMidpoints,
73
- useSdkUiConfig
71
+ useEventTradingContext as useEventTradingContext4,
72
+ useMidpoints as useMidpoints2,
73
+ useSdkUiConfig as useSdkUiConfig3
74
74
  } from "@agg-build/hooks";
75
- import * as Dialog from "@radix-ui/react-dialog";
76
- import { useEffect, useMemo, useRef, useState } from "react";
75
+ import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
77
76
 
78
77
  // src/pages/event-market/event-market.utils.ts
79
78
  var EVENT_MARKET_PAGE_STICKY_HEADER_OFFSET_PX = 48;
@@ -129,20 +128,26 @@ var resolveEventMarketPageStickyState = ({
129
128
  };
130
129
  };
131
130
 
132
- // src/pages/event-market/index.tsx
131
+ // src/pages/event-market/event-market.shared.tsx
132
+ import { useLabels } from "@agg-build/hooks";
133
+ import * as Dialog from "@radix-ui/react-dialog";
134
+ import { useEffect, useState } from "react";
133
135
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
134
136
  var MOBILE_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1023px)";
135
- var getIsMobileEventMarketViewport = () => {
137
+ var SPORTS_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1279px)";
138
+ var getIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
136
139
  if (typeof window === "undefined") return false;
137
140
  if (typeof window.matchMedia !== "function") return false;
138
- return window.matchMedia(MOBILE_EVENT_MARKET_MEDIA_QUERY).matches;
141
+ return window.matchMedia(mediaQuery).matches;
139
142
  };
140
- var useIsMobileEventMarketViewport = () => {
141
- const [isMobileViewport, setIsMobileViewport] = useState(getIsMobileEventMarketViewport);
143
+ var useIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
144
+ const [isMobileViewport, setIsMobileViewport] = useState(
145
+ () => getIsMobileEventMarketViewport(mediaQuery)
146
+ );
142
147
  useEffect(() => {
143
148
  if (typeof window === "undefined") return;
144
149
  if (typeof window.matchMedia !== "function") return;
145
- const mediaQueryList = window.matchMedia(MOBILE_EVENT_MARKET_MEDIA_QUERY);
150
+ const mediaQueryList = window.matchMedia(mediaQuery);
146
151
  const handleChange = () => {
147
152
  setIsMobileViewport(mediaQueryList.matches);
148
153
  };
@@ -151,7 +156,7 @@ var useIsMobileEventMarketViewport = () => {
151
156
  return () => {
152
157
  mediaQueryList.removeEventListener("change", handleChange);
153
158
  };
154
- }, []);
159
+ }, [mediaQuery]);
155
160
  return isMobileViewport;
156
161
  };
157
162
  var resolveDesktopTradePlaceOrderClassNames = (classNames) => {
@@ -190,7 +195,8 @@ var EventMarketPageMobileTrade = ({
190
195
  showPlaceOrder = true,
191
196
  isOpen,
192
197
  onOpenChange,
193
- midpointsResult
198
+ midpointsResult,
199
+ onBeforePrimaryAction
194
200
  }) => {
195
201
  const labels = useLabels();
196
202
  if (!showPlaceOrder) return null;
@@ -229,7 +235,9 @@ var EventMarketPageMobileTrade = ({
229
235
  {
230
236
  eventTradingState,
231
237
  executionMode,
238
+ isQuotePanelActive: isOpen,
232
239
  midpointsResult,
240
+ onBeforePrimaryAction,
233
241
  className: cn(
234
242
  "agg-mobile-trade-panel w-full overflow-hidden rounded-t-agg-2xl sm:rounded-agg-xl",
235
243
  classNames == null ? void 0 : classNames.mobileTrade
@@ -284,71 +292,1574 @@ var EventMarketPageLoadingState = ({
284
292
  {
285
293
  className: cn(
286
294
  "agg-event-market-page",
287
- "w-full mx-auto max-w-[1440px] px-6 lg:px-10 pb-10",
295
+ "w-full mx-auto max-w-[1440px] px-6 lg:px-10 pb-10",
296
+ classNames == null ? void 0 : classNames.root
297
+ ),
298
+ children: /* @__PURE__ */ jsxs(
299
+ "div",
300
+ {
301
+ className: cn(
302
+ "agg-page-content",
303
+ "flex w-full flex-col gap-6 lg:flex-row lg:items-start lg:gap-8",
304
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
305
+ classNames == null ? void 0 : classNames.content
306
+ ),
307
+ style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
308
+ children: [
309
+ /* @__PURE__ */ jsxs(
310
+ "div",
311
+ {
312
+ className: cn(
313
+ "agg-page-main flex min-w-0 flex-1 flex-col gap-6 mb-10",
314
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
315
+ classNames == null ? void 0 : classNames.main
316
+ ),
317
+ children: [
318
+ /* @__PURE__ */ jsx(
319
+ EventListItemDetails,
320
+ {
321
+ isLoading: true,
322
+ classNames: {
323
+ root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
324
+ }
325
+ }
326
+ ),
327
+ /* @__PURE__ */ jsxs("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
328
+ /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
329
+ /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
330
+ /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
331
+ ] })
332
+ ]
333
+ }
334
+ ),
335
+ /* @__PURE__ */ jsx(
336
+ "aside",
337
+ {
338
+ className: cn(
339
+ "agg-sidebar",
340
+ "hidden w-full shrink-0 lg:block lg:w-[342px] lg:shrink-0",
341
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
342
+ classNames == null ? void 0 : classNames.sidebar
343
+ ),
344
+ children: /* @__PURE__ */ jsx(
345
+ PlaceOrder,
346
+ {
347
+ isLoading: true,
348
+ className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
349
+ classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
350
+ }
351
+ )
352
+ }
353
+ )
354
+ ]
355
+ }
356
+ )
357
+ }
358
+ );
359
+ };
360
+
361
+ // src/pages/event-market/sports-event-market-page.tsx
362
+ import {
363
+ resolveEventTradingState as resolveEventTradingState2,
364
+ TradeSide,
365
+ useEventTradingContext as useEventTradingContext3,
366
+ useMidpoints,
367
+ useSdkUiConfig as useSdkUiConfig2
368
+ } from "@agg-build/hooks";
369
+ import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
370
+
371
+ // src/pages/event-market/sports-markets.tsx
372
+ import {
373
+ MarketStatus as MarketStatus2,
374
+ resolveMarketTradingState as resolveMarketTradingState2,
375
+ useEventTradingContext as useEventTradingContext2,
376
+ useLabels as useLabels3,
377
+ useVenueMarkets
378
+ } from "@agg-build/hooks";
379
+ import { useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
380
+
381
+ // src/pages/event-market/sports-market-card.tsx
382
+ import {
383
+ MarketStatus,
384
+ resolveMarketTradingState,
385
+ useEventTradingContext,
386
+ useLabels as useLabels2,
387
+ useSdkUiConfig
388
+ } from "@agg-build/hooks";
389
+ import { useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
390
+
391
+ // src/pages/event-market/sports-line-rail.tsx
392
+ import * as React from "react";
393
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
394
+ function VenueRow({ venues, active }) {
395
+ if (!venues || venues.length === 0) return /* @__PURE__ */ jsx2("span", { className: "h-4" });
396
+ const shown = venues.length > 3 ? venues.slice(0, 2) : venues;
397
+ const extra = venues.length - shown.length;
398
+ return /* @__PURE__ */ jsxs2(
399
+ "span",
400
+ {
401
+ className: cn(
402
+ "flex h-4 items-center justify-center gap-1",
403
+ !active && "text-agg-muted-foreground"
404
+ ),
405
+ children: [
406
+ shown.map((venue, index) => /* @__PURE__ */ jsx2(
407
+ VenueLogo,
408
+ {
409
+ venue,
410
+ isMonochromatic: !active,
411
+ size: "small",
412
+ className: "size-3! shrink-0"
413
+ },
414
+ `${venue}-${index}`
415
+ )),
416
+ extra > 0 && /* @__PURE__ */ jsxs2("span", { className: "text-[10px] font-agg-bold uppercase leading-[14px] text-agg-muted-foreground", children: [
417
+ "+",
418
+ extra
419
+ ] })
420
+ ]
421
+ }
422
+ );
423
+ }
424
+ function SportsLineRail({
425
+ stops,
426
+ selectedIndex,
427
+ onSelect,
428
+ ariaLabel,
429
+ previousAriaLabel,
430
+ nextAriaLabel,
431
+ className
432
+ }) {
433
+ const scrollRef = React.useRef(null);
434
+ const itemRefs = React.useRef([]);
435
+ const didInit = React.useRef(false);
436
+ const programmatic = React.useRef(false);
437
+ const progTimer = React.useRef(void 0);
438
+ const skipCenterOnPropSync = React.useRef(false);
439
+ const pendingScrollIndex = React.useRef(null);
440
+ const scrollSettleTimer = React.useRef(void 0);
441
+ const stopCount = stops.length;
442
+ const [pad, setPad] = React.useState({ left: 0, right: 0 });
443
+ const [mask, setMask] = React.useState({ left: false, right: false });
444
+ const updateMask = React.useCallback(() => {
445
+ const c = scrollRef.current;
446
+ if (!c || !c.clientWidth) return;
447
+ setMask({
448
+ left: c.scrollLeft > 1,
449
+ right: c.scrollLeft + c.clientWidth < c.scrollWidth - 1
450
+ });
451
+ }, []);
452
+ const resolveNearestIndexToViewportCenter = React.useCallback(() => {
453
+ const container = scrollRef.current;
454
+ if (!container || !container.clientWidth) return null;
455
+ const viewportCenter = container.scrollLeft + container.clientWidth / 2;
456
+ let nearestIndex = null;
457
+ let nearestDistance = Number.POSITIVE_INFINITY;
458
+ itemRefs.current.forEach((item, index) => {
459
+ if (!item) return;
460
+ const itemCenter = item.offsetLeft + item.offsetWidth / 2;
461
+ const distance = Math.abs(itemCenter - viewportCenter);
462
+ if (distance < nearestDistance) {
463
+ nearestDistance = distance;
464
+ nearestIndex = index;
465
+ }
466
+ });
467
+ return nearestIndex;
468
+ }, []);
469
+ React.useLayoutEffect(() => {
470
+ const c = scrollRef.current;
471
+ if (!c) return;
472
+ const measure = () => {
473
+ var _a, _b, _c, _d;
474
+ const w = c.clientWidth;
475
+ if (!w) return;
476
+ const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
477
+ const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
478
+ setPad({
479
+ left: Math.max(0, w / 2 - firstW / 2),
480
+ right: Math.max(0, w / 2 - lastW / 2)
481
+ });
482
+ updateMask();
483
+ };
484
+ const onScroll = () => {
485
+ if (!programmatic.current) {
486
+ const nearestIndex = resolveNearestIndexToViewportCenter();
487
+ if (nearestIndex != null && nearestIndex !== selectedIndex) {
488
+ pendingScrollIndex.current = nearestIndex;
489
+ clearTimeout(scrollSettleTimer.current);
490
+ scrollSettleTimer.current = setTimeout(() => {
491
+ const nextIndex = pendingScrollIndex.current;
492
+ if (nextIndex == null || nextIndex === selectedIndex) return;
493
+ skipCenterOnPropSync.current = true;
494
+ onSelect(nextIndex);
495
+ }, 120);
496
+ }
497
+ }
498
+ updateMask();
499
+ };
500
+ measure();
501
+ const ro = new ResizeObserver(measure);
502
+ ro.observe(c);
503
+ c.addEventListener("scroll", onScroll, { passive: true });
504
+ return () => {
505
+ ro.disconnect();
506
+ c.removeEventListener("scroll", onScroll);
507
+ clearTimeout(scrollSettleTimer.current);
508
+ };
509
+ }, [onSelect, resolveNearestIndexToViewportCenter, selectedIndex, stopCount, updateMask]);
510
+ React.useEffect(() => {
511
+ pendingScrollIndex.current = selectedIndex;
512
+ }, [selectedIndex]);
513
+ React.useEffect(() => {
514
+ const c = scrollRef.current;
515
+ const el = itemRefs.current[selectedIndex];
516
+ if (!c || !el || !c.clientWidth) return;
517
+ if (skipCenterOnPropSync.current) {
518
+ skipCenterOnPropSync.current = false;
519
+ updateMask();
520
+ return;
521
+ }
522
+ const max = c.scrollWidth - c.clientWidth;
523
+ const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
524
+ programmatic.current = true;
525
+ c.scrollTo({
526
+ left: Math.max(0, Math.min(max, target)),
527
+ behavior: didInit.current ? "smooth" : "auto"
528
+ });
529
+ if (pad.left > 0 || pad.right > 0) didInit.current = true;
530
+ clearTimeout(progTimer.current);
531
+ progTimer.current = setTimeout(() => {
532
+ programmatic.current = false;
533
+ }, 500);
534
+ updateMask();
535
+ }, [selectedIndex, stopCount, pad, updateMask]);
536
+ const select = (index) => {
537
+ const next = Math.min(stops.length - 1, Math.max(0, index));
538
+ if (next !== selectedIndex) onSelect(next);
539
+ };
540
+ const step = (delta) => select(selectedIndex + delta);
541
+ if (stopCount === 0) return null;
542
+ return /* @__PURE__ */ jsxs2(
543
+ "div",
544
+ {
545
+ className: cn("flex items-center justify-center gap-3 px-3 py-3 sm:gap-4 sm:px-5", className),
546
+ "aria-label": ariaLabel,
547
+ children: [
548
+ /* @__PURE__ */ jsx2(
549
+ "button",
550
+ {
551
+ type: "button",
552
+ onClick: () => step(-1),
553
+ disabled: selectedIndex === 0,
554
+ "aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
555
+ className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
556
+ children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-left", className: "size-4" })
557
+ }
558
+ ),
559
+ /* @__PURE__ */ jsxs2("div", { className: "relative min-w-0 flex-1", children: [
560
+ /* @__PURE__ */ jsx2(
561
+ "div",
562
+ {
563
+ ref: scrollRef,
564
+ style: { paddingLeft: pad.left, paddingRight: pad.right },
565
+ className: "flex items-end gap-1 overflow-x-hidden py-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
566
+ children: stops.map((stop, index) => {
567
+ const active = index === selectedIndex;
568
+ return /* @__PURE__ */ jsxs2(
569
+ "button",
570
+ {
571
+ type: "button",
572
+ ref: (el) => {
573
+ itemRefs.current[index] = el;
574
+ },
575
+ onClick: () => select(index),
576
+ disabled: stop.disabled,
577
+ "aria-pressed": active,
578
+ className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
579
+ children: [
580
+ /* @__PURE__ */ jsx2(
581
+ "span",
582
+ {
583
+ className: cn(
584
+ "flex h-8 min-w-[60px] items-center justify-center rounded-agg-full border px-3 text-agg-sm leading-agg-5 tabular-nums transition-colors",
585
+ active ? "border-agg-primary bg-agg-secondary font-agg-bold text-agg-foreground" : "border-transparent bg-agg-secondary text-agg-muted-foreground hover:bg-agg-secondary-hover hover:text-agg-foreground"
586
+ ),
587
+ children: stop.value
588
+ }
589
+ ),
590
+ /* @__PURE__ */ jsx2(VenueRow, { venues: stop.venues, active })
591
+ ]
592
+ },
593
+ index
594
+ );
595
+ })
596
+ }
597
+ ),
598
+ /* @__PURE__ */ jsx2(
599
+ "span",
600
+ {
601
+ className: cn(
602
+ "pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r from-agg-secondary to-transparent transition-opacity duration-200",
603
+ mask.left ? "opacity-100" : "opacity-0"
604
+ )
605
+ }
606
+ ),
607
+ /* @__PURE__ */ jsx2(
608
+ "span",
609
+ {
610
+ className: cn(
611
+ "pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l from-agg-secondary to-transparent transition-opacity duration-200",
612
+ mask.right ? "opacity-100" : "opacity-0"
613
+ )
614
+ }
615
+ )
616
+ ] }),
617
+ /* @__PURE__ */ jsx2(
618
+ "button",
619
+ {
620
+ type: "button",
621
+ onClick: () => step(1),
622
+ disabled: selectedIndex === stopCount - 1,
623
+ "aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
624
+ className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
625
+ children: /* @__PURE__ */ jsx2(Icon, { name: "chevron-right", className: "size-4" })
626
+ }
627
+ )
628
+ ]
629
+ }
630
+ );
631
+ }
632
+
633
+ // src/pages/event-market/sports-event-market.utils.ts
634
+ var SPORTS_MARKET_TYPE_KEYS = [
635
+ "moneyline",
636
+ "spread",
637
+ "total",
638
+ "prop",
639
+ "completion",
640
+ "other"
641
+ ];
642
+ var SPORTS_PERIOD_KEYS = [
643
+ "full",
644
+ "1h",
645
+ "2h",
646
+ "q1",
647
+ "q2",
648
+ "q3",
649
+ "q4",
650
+ "ot",
651
+ "first_inning",
652
+ "second_inning",
653
+ "third_inning",
654
+ "first_5_innings",
655
+ "other"
656
+ ];
657
+ var SPORTS_MARKET_CATEGORY_KEYS = [
658
+ "game_lines",
659
+ "exact_score",
660
+ "corners",
661
+ "goals",
662
+ "assists",
663
+ "shots",
664
+ "other"
665
+ ];
666
+ var SPORTS_MARKET_GROUP_KEYS = [
667
+ "game_lines",
668
+ "spreads",
669
+ "totals",
670
+ "period_lines",
671
+ "exact_score",
672
+ "team_props",
673
+ "player_props",
674
+ "specials",
675
+ "completion",
676
+ "other"
677
+ ];
678
+ var SPORTS_PERIOD_KEY_SET = new Set(SPORTS_PERIOD_KEYS);
679
+ var SPORTS_MARKET_TYPE_KEY_SET = new Set(SPORTS_MARKET_TYPE_KEYS);
680
+ var SPORTS_MARKET_CATEGORY_KEY_SET = new Set(SPORTS_MARKET_CATEGORY_KEYS);
681
+ var SPORTS_MARKET_GROUP_KEY_SET = new Set(SPORTS_MARKET_GROUP_KEYS);
682
+ var SPORTS_LEGACY_PROP_CATEGORY_KEY_SET = /* @__PURE__ */ new Set([
683
+ "corners",
684
+ "goals",
685
+ "assists",
686
+ "shots"
687
+ ]);
688
+ var SPORTS_MARKET_GROUP_TO_TAB = {
689
+ game_lines: "game_lines",
690
+ spreads: "game_lines",
691
+ totals: "game_lines",
692
+ period_lines: "halves",
693
+ exact_score: "exact_score",
694
+ team_props: "other",
695
+ player_props: "other",
696
+ specials: "other",
697
+ completion: "other",
698
+ other: "other"
699
+ };
700
+ var SPORTS_SECTION_TAB_DEFINITIONS = [
701
+ {
702
+ key: "game_lines",
703
+ // NO sportsMarketType filter: spread/total markets on some sports (e.g.
704
+ // esports "Map 1 Rounds Handicap"/"Total Rounds") are sportsMarketType="other"
705
+ // with marketGroup=spreads/totals; AND-ing the game-line types would drop them
706
+ // and leave only the moneyline. marketGroup already scopes the tab. (Safe now
707
+ // that classify_market no longer mis-groups prop/to-score-first/extra-innings
708
+ // markets into game_lines/totals — see agg-venue-core market_group.rs.)
709
+ marketGroup: ["game_lines", "spreads", "totals"]
710
+ // No server-side period filter: many regular-time game-line markets arrive
711
+ // with period=null (moneyline sides, team totals, BTTS), and a
712
+ // period=["full"] filter would drop them server-side. The Game Lines tab
713
+ // narrows to the regular-time group client-side instead (see SportsMarkets).
714
+ },
715
+ { key: "exact_score", marketGroup: ["exact_score"] },
716
+ {
717
+ key: "halves",
718
+ // NO sportsMarketType filter: half-result legs ("France leading at halftime?")
719
+ // are sportsMarketType="other"; AND-ing the game-line types would drop them.
720
+ // marketGroup=period_lines + period already scope the tab.
721
+ marketGroup: ["period_lines"],
722
+ period: ["1h", "2h"]
723
+ },
724
+ { key: "corners", marketCategory: "corners" },
725
+ { key: "goals", marketCategory: "goals" },
726
+ { key: "assists", marketCategory: "assists" },
727
+ { key: "shots", marketCategory: "shots" },
728
+ {
729
+ key: "other",
730
+ marketGroup: ["other", "team_props", "player_props", "specials", "completion"]
731
+ }
732
+ ];
733
+ var SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS = ["game_lines", "other"];
734
+ var SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET = new Set(
735
+ SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS
736
+ );
737
+ var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
738
+ "esports",
739
+ "video games",
740
+ "video game",
741
+ "computer games",
742
+ "computer game",
743
+ "gaming"
744
+ ]);
745
+ 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;
746
+ var SERIES_SCOPE_PATTERN = /\b(?:bo[1-9]|best of \d+|map \d+|game \d+)\b/i;
747
+ var SPORTS_SECTION_TAB_BY_KEY = new Map(
748
+ SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => [definition.key, definition])
749
+ );
750
+ var SPORTS_PERIOD_ORDER = [
751
+ "full",
752
+ "1h",
753
+ "2h",
754
+ "q1",
755
+ "q2",
756
+ "q3",
757
+ "q4",
758
+ "ot",
759
+ "first_inning",
760
+ "second_inning",
761
+ "third_inning",
762
+ "first_5_innings",
763
+ "other"
764
+ ];
765
+ var SPORTS_MARKET_TYPE_ORDER = [
766
+ "moneyline",
767
+ "spread",
768
+ "total",
769
+ "prop",
770
+ "completion",
771
+ "other"
772
+ ];
773
+ var YES_NO_LABELS = /* @__PURE__ */ new Set(["yes", "no"]);
774
+ var LINE_MARKET_TYPES = /* @__PURE__ */ new Set(["spread", "total"]);
775
+ var toTrimmedString = (value) => {
776
+ return typeof value === "string" ? value.trim() : "";
777
+ };
778
+ var sanitizeFamilyValue = (value) => {
779
+ return value.toLowerCase().replace(/[-+]?\d+(?:\.\d+)?/g, "").replace(/[¢$]/g, "").replace(/\s+/g, " ").replace(/[|:()[\]{}]/g, "").trim();
780
+ };
781
+ var stripLineValueFromQuestion = (question) => {
782
+ const strippedQuestion = sanitizeFamilyValue(question);
783
+ return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
784
+ };
785
+ var getSportsPeriodOrderIndex = (period) => {
786
+ const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
787
+ return periodIndex >= 0 ? periodIndex : SPORTS_PERIOD_ORDER.length;
788
+ };
789
+ var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
790
+ if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
791
+ const marketTypeIndex = SPORTS_MARKET_TYPE_ORDER.indexOf(sportsMarketType);
792
+ return marketTypeIndex >= 0 ? marketTypeIndex : SPORTS_MARKET_TYPE_ORDER.length;
793
+ };
794
+ var resolveSportsSectionDefinition = (key) => {
795
+ const resolvedDefinition = SPORTS_SECTION_TAB_BY_KEY.get(key);
796
+ if (!resolvedDefinition) {
797
+ return SPORTS_SECTION_TAB_DEFINITIONS[0];
798
+ }
799
+ return resolvedDefinition;
800
+ };
801
+ var normalizeSportsPeriod = (value) => {
802
+ const resolvedValue = toTrimmedString(value).toLowerCase();
803
+ if (!resolvedValue) return "full";
804
+ return SPORTS_PERIOD_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
805
+ };
806
+ var normalizeSportsMarketType = (value) => {
807
+ const resolvedValue = toTrimmedString(value).toLowerCase();
808
+ if (!resolvedValue) return null;
809
+ return SPORTS_MARKET_TYPE_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
810
+ };
811
+ var normalizeSportsMarketCategory = (value) => {
812
+ const resolvedValue = toTrimmedString(value).toLowerCase();
813
+ if (!resolvedValue) return null;
814
+ return SPORTS_MARKET_CATEGORY_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
815
+ };
816
+ var normalizeSportsMarketGroup = (value) => {
817
+ const resolvedValue = toTrimmedString(value).toLowerCase();
818
+ if (!resolvedValue) return null;
819
+ return SPORTS_MARKET_GROUP_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
820
+ };
821
+ var resolveMarketSectionTabKey = (market) => {
822
+ const category = normalizeSportsMarketCategory(market.marketCategory);
823
+ if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) {
824
+ return category;
825
+ }
826
+ const group = normalizeSportsMarketGroup(market.marketGroup);
827
+ if (group) return SPORTS_MARKET_GROUP_TO_TAB[group];
828
+ if (category === "game_lines") return "game_lines";
829
+ if (category === "exact_score") return "exact_score";
830
+ if (category === "other") return "other";
831
+ return null;
832
+ };
833
+ var resolveSportsSectionFilters = (key) => {
834
+ var _a;
835
+ const resolvedDefinition = resolveSportsSectionDefinition(key);
836
+ const useMarketGroup = !!((_a = resolvedDefinition.marketGroup) == null ? void 0 : _a.length);
837
+ return {
838
+ marketGroup: useMarketGroup ? [...resolvedDefinition.marketGroup] : void 0,
839
+ // Only fall back to the deprecated marketCategory filter when the tab has no
840
+ // marketGroup mapping. Sending both would AND them server-side and drop
841
+ // markets that carry only one of the two.
842
+ marketCategory: !useMarketGroup && resolvedDefinition.marketCategory ? [resolvedDefinition.marketCategory] : void 0,
843
+ sportsMarketType: resolvedDefinition.sportsMarketType ? [...resolvedDefinition.sportsMarketType] : void 0,
844
+ period: resolvedDefinition.period ? [...resolvedDefinition.period] : void 0
845
+ };
846
+ };
847
+ var resolveSportsSectionMarkets = ({
848
+ tabKey,
849
+ eventMarkets,
850
+ sectionMarkets
851
+ }) => {
852
+ const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tabKey);
853
+ if (tabKey !== "game_lines") return effectiveSectionMarkets;
854
+ const eventMoneylineMarkets = eventMarkets.filter(
855
+ (market) => normalizeSportsMarketType(market.sportsMarketType) === "moneyline" && resolveMarketSectionTabKey(market) === "game_lines"
856
+ );
857
+ if (eventMoneylineMarkets.length === 0) return effectiveSectionMarkets;
858
+ const lineSectionMarkets = effectiveSectionMarkets.filter(
859
+ (market) => normalizeSportsMarketType(market.sportsMarketType) !== "moneyline"
860
+ );
861
+ return [...eventMoneylineMarkets, ...lineSectionMarkets];
862
+ };
863
+ var resolveSportsMarketCardVariant = (market) => {
864
+ var _a;
865
+ const normalizedOutcomeLabels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
866
+ (outcome) => toTrimmedString(outcome.label).toLowerCase()
867
+ );
868
+ const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
869
+ if (sportsMarketType && LINE_MARKET_TYPES.has(sportsMarketType)) {
870
+ return "line";
871
+ }
872
+ if (market.lineValue != null) {
873
+ return "line";
874
+ }
875
+ if (normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label))) {
876
+ return "yes_no";
877
+ }
878
+ return "outcome";
879
+ };
880
+ var isBinarySportsMoneylineMarket = (market) => {
881
+ var _a;
882
+ const normalizedOutcomeLabels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
883
+ (outcome) => toTrimmedString(outcome.label).toLowerCase()
884
+ );
885
+ const marketSubtype = toTrimmedString(market.marketSubtype).toLowerCase();
886
+ const marketGroup = normalizeSportsMarketGroup(market.marketGroup);
887
+ return marketSubtype === "moneyline" && marketGroup === "game_lines" && normalizeSportsPeriod(market.period) === "full" && normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label));
888
+ };
889
+ var resolveDisplayGroupFamilyKey = (market) => {
890
+ var _a, _b, _c;
891
+ const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
892
+ const outcomeKey = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
893
+ (outcome) => sanitizeFamilyValue(toTrimmedString(outcome.title) || toTrimmedString(outcome.label))
894
+ ).filter(Boolean).sort((left, right) => left.localeCompare(right)).join("|");
895
+ const sportsMarketType = (_b = normalizeSportsMarketType(market.sportsMarketType)) != null ? _b : "other";
896
+ const period = normalizeSportsPeriod(market.period);
897
+ const marketCategory = (_c = normalizeSportsMarketCategory(market.marketCategory)) != null ? _c : "other";
898
+ if (isBinarySportsMoneylineMarket(market)) {
899
+ return `${period}|moneyline|${marketCategory}`;
900
+ }
901
+ if (sportsMarketType === "spread") {
902
+ return `${period}|spread|${marketCategory}`;
903
+ }
904
+ if (market.lineValue != null || LINE_MARKET_TYPES.has(sportsMarketType)) {
905
+ return `${period}|${sportsMarketType}|${marketCategory}|${normalizedQuestion}|${outcomeKey}`;
906
+ }
907
+ return `${period}|${sportsMarketType}|${marketCategory}|${toTrimmedString(market.question)}|${outcomeKey}|${market.id}`;
908
+ };
909
+ var resolveDisplayGroupTitle = (market) => {
910
+ const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
911
+ const question = toTrimmedString(market.question);
912
+ if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
913
+ if (sportsMarketType === "spread") return "Spreads";
914
+ if (!question) {
915
+ return sportsMarketType != null ? sportsMarketType : market.id;
916
+ }
917
+ if (sportsMarketType === "total") {
918
+ const base = stripLineValueFromQuestion(question).replace(/o\s*\/\s*u/gi, " ").replace(/\btotals?\b/gi, " ").replace(/\s+/g, " ").trim();
919
+ return base ? `${base} Totals` : "Totals";
920
+ }
921
+ if (market.lineValue != null) {
922
+ const strippedQuestion = stripLineValueFromQuestion(question);
923
+ return strippedQuestion || question;
924
+ }
925
+ return question;
926
+ };
927
+ var sortMarketsByLineValue = (markets) => {
928
+ return [...markets].sort((leftMarket, rightMarket) => {
929
+ var _a, _b;
930
+ const leftLineValue = (_a = leftMarket.lineValue) != null ? _a : Number.NEGATIVE_INFINITY;
931
+ const rightLineValue = (_b = rightMarket.lineValue) != null ? _b : Number.NEGATIVE_INFINITY;
932
+ if (leftLineValue !== rightLineValue) {
933
+ return leftLineValue - rightLineValue;
934
+ }
935
+ return leftMarket.question.localeCompare(rightMarket.question);
936
+ });
937
+ };
938
+ var buildSportsMarketDisplayGroups = (markets) => {
939
+ var _a;
940
+ const groupsByKey = /* @__PURE__ */ new Map();
941
+ for (const market of markets) {
942
+ const groupKey = resolveDisplayGroupFamilyKey(market);
943
+ const currentMarkets = (_a = groupsByKey.get(groupKey)) != null ? _a : [];
944
+ currentMarkets.push(market);
945
+ groupsByKey.set(groupKey, currentMarkets);
946
+ }
947
+ const groups = Array.from(groupsByKey.entries()).map(([id, groupMarkets]) => {
948
+ var _a2;
949
+ const orderedMarkets = sortMarketsByLineValue(groupMarkets);
950
+ const firstMarket = orderedMarkets[0];
951
+ const sportsMarketType = normalizeSportsMarketType(firstMarket == null ? void 0 : firstMarket.sportsMarketType);
952
+ const marketCategory = normalizeSportsMarketCategory(firstMarket == null ? void 0 : firstMarket.marketCategory);
953
+ const period = normalizeSportsPeriod(firstMarket == null ? void 0 : firstMarket.period);
954
+ const sectionRank = (_a2 = firstMarket == null ? void 0 : firstMarket.sectionRank) != null ? _a2 : Number.MAX_SAFE_INTEGER;
955
+ return {
956
+ id,
957
+ title: resolveDisplayGroupTitle(firstMarket),
958
+ questionKey: sanitizeFamilyValue(toTrimmedString(firstMarket == null ? void 0 : firstMarket.question)),
959
+ sportsMarketType,
960
+ marketCategory,
961
+ period,
962
+ sectionRank,
963
+ markets: orderedMarkets,
964
+ hasLineVariants: orderedMarkets.some((market) => market.lineValue != null)
965
+ };
966
+ });
967
+ return groups.sort((leftGroup, rightGroup) => {
968
+ var _a2, _b, _c, _d;
969
+ if (leftGroup.sectionRank !== rightGroup.sectionRank) {
970
+ return leftGroup.sectionRank - rightGroup.sectionRank;
971
+ }
972
+ const leftMarketTypeOrder = getSportsMarketTypeOrderIndex(leftGroup.sportsMarketType);
973
+ const rightMarketTypeOrder = getSportsMarketTypeOrderIndex(rightGroup.sportsMarketType);
974
+ if (leftMarketTypeOrder !== rightMarketTypeOrder) {
975
+ return leftMarketTypeOrder - rightMarketTypeOrder;
976
+ }
977
+ const leftLineValue = (_b = (_a2 = leftGroup.markets[0]) == null ? void 0 : _a2.lineValue) != null ? _b : Number.NEGATIVE_INFINITY;
978
+ const rightLineValue = (_d = (_c = rightGroup.markets[0]) == null ? void 0 : _c.lineValue) != null ? _d : Number.NEGATIVE_INFINITY;
979
+ if (leftLineValue !== rightLineValue) {
980
+ return leftLineValue - rightLineValue;
981
+ }
982
+ return leftGroup.title.localeCompare(rightGroup.title);
983
+ });
984
+ };
985
+ var groupSportsMarketsByPeriod = (markets) => {
986
+ var _a;
987
+ const periodGroups = /* @__PURE__ */ new Map();
988
+ for (const market of markets) {
989
+ const period = normalizeSportsPeriod(market.period);
990
+ const currentMarkets = (_a = periodGroups.get(period)) != null ? _a : [];
991
+ currentMarkets.push(market);
992
+ periodGroups.set(period, currentMarkets);
993
+ }
994
+ return Array.from(periodGroups.entries()).map(([key, groupedMarkets]) => ({
995
+ key,
996
+ markets: groupedMarkets,
997
+ groups: buildSportsMarketDisplayGroups(groupedMarkets)
998
+ })).sort((leftGroup, rightGroup) => {
999
+ return getSportsPeriodOrderIndex(leftGroup.key) - getSportsPeriodOrderIndex(rightGroup.key);
1000
+ });
1001
+ };
1002
+ var resolveSelectedSportsLineValue = (lineValue) => {
1003
+ if (lineValue == null) return "0";
1004
+ return Number.isInteger(lineValue) ? String(lineValue) : lineValue.toFixed(1);
1005
+ };
1006
+ var collectVenueNames = (market) => {
1007
+ var _a;
1008
+ const venues = /* @__PURE__ */ new Set([market.venue]);
1009
+ for (const matchedVenueMarket of (_a = market.matchedVenueMarkets) != null ? _a : []) {
1010
+ venues.add(matchedVenueMarket.venue);
1011
+ }
1012
+ return Array.from(venues);
1013
+ };
1014
+ var resolveTotalGroupVolume = (markets) => {
1015
+ return markets.reduce((totalVolume, market) => {
1016
+ var _a;
1017
+ return totalVolume + ((_a = market.volume) != null ? _a : 0);
1018
+ }, 0);
1019
+ };
1020
+ var resolveSportsExpandedMarkets = (markets) => {
1021
+ var _a;
1022
+ const expandedMarkets = [];
1023
+ const seenMarketIds = /* @__PURE__ */ new Set();
1024
+ for (const market of markets) {
1025
+ if (!seenMarketIds.has(market.id)) {
1026
+ seenMarketIds.add(market.id);
1027
+ expandedMarkets.push(market);
1028
+ }
1029
+ for (const matchedVenueMarket of (_a = market.matchedVenueMarkets) != null ? _a : []) {
1030
+ if (seenMarketIds.has(matchedVenueMarket.id)) continue;
1031
+ seenMarketIds.add(matchedVenueMarket.id);
1032
+ expandedMarkets.push(matchedVenueMarket);
1033
+ }
1034
+ }
1035
+ return expandedMarkets;
1036
+ };
1037
+ var resolveSportsExpandedMarketsVolume = (markets) => {
1038
+ return resolveSportsExpandedMarkets(markets).reduce((totalVolume, market) => {
1039
+ var _a;
1040
+ return totalVolume + ((_a = market.volume) != null ? _a : 0);
1041
+ }, 0);
1042
+ };
1043
+ var resolveHighestVolumeIndex = (markets) => {
1044
+ let bestIndex = 0;
1045
+ let bestVolume = Number.NEGATIVE_INFINITY;
1046
+ markets.forEach((market, index) => {
1047
+ var _a;
1048
+ const volume = (_a = market.volume) != null ? _a : 0;
1049
+ if (volume > bestVolume) {
1050
+ bestVolume = volume;
1051
+ bestIndex = index;
1052
+ }
1053
+ });
1054
+ return bestIndex;
1055
+ };
1056
+ var resolveSlideKind = (group) => {
1057
+ if (group.sportsMarketType === "moneyline") return "moneyline";
1058
+ if (group.sportsMarketType === "spread") return "spread";
1059
+ if (group.sportsMarketType === "total") return "total";
1060
+ return "other";
1061
+ };
1062
+ var aggregateSportsLineStops = (markets) => {
1063
+ var _a;
1064
+ const marketsByLineValue = /* @__PURE__ */ new Map();
1065
+ for (const market of markets) {
1066
+ const value = resolveSelectedSportsLineValue(market.lineValue);
1067
+ const lineMarkets = (_a = marketsByLineValue.get(value)) != null ? _a : [];
1068
+ lineMarkets.push(market);
1069
+ marketsByLineValue.set(value, lineMarkets);
1070
+ }
1071
+ return Array.from(marketsByLineValue.entries()).map(([value, lineMarkets]) => {
1072
+ var _a2, _b;
1073
+ const representative = (_a2 = lineMarkets[resolveHighestVolumeIndex(lineMarkets)]) != null ? _a2 : lineMarkets[0];
1074
+ const venues = /* @__PURE__ */ new Set();
1075
+ for (const lineMarket of lineMarkets) {
1076
+ for (const venue of collectVenueNames(lineMarket)) {
1077
+ venues.add(venue);
1078
+ }
1079
+ }
1080
+ return {
1081
+ value,
1082
+ representative,
1083
+ venues: Array.from(venues),
1084
+ volume: resolveTotalGroupVolume(lineMarkets),
1085
+ lineValue: (_b = representative.lineValue) != null ? _b : Number.NEGATIVE_INFINITY
1086
+ };
1087
+ }).sort(
1088
+ (left, right) => left.lineValue !== right.lineValue ? left.lineValue - right.lineValue : left.value.localeCompare(right.value)
1089
+ );
1090
+ };
1091
+ var buildSportsSlideFromGroup = (group) => {
1092
+ const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets) : [];
1093
+ const hasLadder = lineStops.length > 1;
1094
+ const stops = hasLadder ? lineStops.map((lineStop) => ({
1095
+ value: lineStop.value,
1096
+ venues: lineStop.venues,
1097
+ market: lineStop.representative
1098
+ })) : [];
1099
+ const defaultStopIndex = hasLadder ? lineStops.reduce(
1100
+ (bestIndex, lineStop, index) => lineStop.volume > lineStops[bestIndex].volume ? index : bestIndex,
1101
+ 0
1102
+ ) : 0;
1103
+ return {
1104
+ id: group.id,
1105
+ kind: resolveSlideKind(group),
1106
+ group,
1107
+ hasLadder,
1108
+ stops,
1109
+ defaultStopIndex
1110
+ };
1111
+ };
1112
+ var resolveSportsCategoryTokens = (event) => {
1113
+ return new Set(
1114
+ event.categories.flatMap((entry) => {
1115
+ const categoryName = toTrimmedString(entry.category.name).toLowerCase();
1116
+ const categoryDisplayName = toTrimmedString(entry.category.displayName).toLowerCase();
1117
+ return [categoryName, categoryDisplayName].filter(Boolean);
1118
+ })
1119
+ );
1120
+ };
1121
+ var isNonStandardSportsLikeEvent = (event) => {
1122
+ const categoryTokens = resolveSportsCategoryTokens(event);
1123
+ if ([...categoryTokens].some((token) => ESPORTS_CATEGORY_TOKENS.has(token))) {
1124
+ return true;
1125
+ }
1126
+ if (ESPORTS_TITLE_PATTERN.test(event.title) || SERIES_SCOPE_PATTERN.test(event.title)) {
1127
+ return true;
1128
+ }
1129
+ return event.venueMarkets.some((market) => {
1130
+ const question = toTrimmedString(market.question);
1131
+ return ESPORTS_TITLE_PATTERN.test(question) || SERIES_SCOPE_PATTERN.test(question);
1132
+ });
1133
+ };
1134
+ var resolveVisibleSportsSectionTabDefinitions = (event) => {
1135
+ const presentTabKeys = /* @__PURE__ */ new Set();
1136
+ for (const market of event.venueMarkets) {
1137
+ const tabKey = resolveMarketSectionTabKey(market);
1138
+ if (tabKey) presentTabKeys.add(tabKey);
1139
+ }
1140
+ let definitions = SPORTS_SECTION_TAB_DEFINITIONS.filter(
1141
+ (definition) => presentTabKeys.has(definition.key)
1142
+ );
1143
+ if (isNonStandardSportsLikeEvent(event)) {
1144
+ definitions = definitions.filter(
1145
+ (definition) => SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET.has(definition.key)
1146
+ );
1147
+ }
1148
+ return definitions;
1149
+ };
1150
+ var mergeSportsSectionMarketsIntoEvent = ({
1151
+ event,
1152
+ sectionMarketsByKey
1153
+ }) => {
1154
+ var _a;
1155
+ const orderedVenueMarkets = [...event.venueMarkets];
1156
+ const seenMarketIds = new Set(orderedVenueMarkets.map((market) => market.id));
1157
+ for (const sectionKey of SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => definition.key)) {
1158
+ for (const market of (_a = sectionMarketsByKey[sectionKey]) != null ? _a : []) {
1159
+ if (seenMarketIds.has(market.id)) continue;
1160
+ seenMarketIds.add(market.id);
1161
+ orderedVenueMarkets.push(market);
1162
+ }
1163
+ }
1164
+ return __spreadProps(__spreadValues({}, event), {
1165
+ venueMarkets: orderedVenueMarkets
1166
+ });
1167
+ };
1168
+
1169
+ // src/pages/event-market/sports-market-card.tsx
1170
+ import { jsx as jsx3 } from "react/jsx-runtime";
1171
+ var SportsMarketCard = ({
1172
+ group,
1173
+ venueMarkets,
1174
+ isExpanded,
1175
+ onToggle,
1176
+ onOutcomeSelect,
1177
+ live,
1178
+ midpointsFallback,
1179
+ midpointsFallbackVenues,
1180
+ midpointsResult
1181
+ }) => {
1182
+ var _a, _b, _c, _d, _e, _f, _g;
1183
+ const labels = useLabels2();
1184
+ const {
1185
+ formatting: { formatCompactCurrency }
1186
+ } = useSdkUiConfig();
1187
+ const tradingContext = useEventTradingContext();
1188
+ const slide = useMemo(() => buildSportsSlideFromGroup(group), [group]);
1189
+ const [selectedLineIndex, setSelectedLineIndex] = useState3(slide.defaultStopIndex);
1190
+ const combinedMoneylineMarkets = useMemo(
1191
+ () => group.markets.filter((market) => isBinarySportsMoneylineMarket(market)),
1192
+ [group.markets]
1193
+ );
1194
+ const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length;
1195
+ useEffect3(() => {
1196
+ if (!slide.hasLadder) return;
1197
+ const tradingMarketId = tradingContext == null ? void 0 : tradingContext.selectedMarketId;
1198
+ if (!tradingMarketId) return;
1199
+ const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
1200
+ if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
1201
+ }, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
1202
+ const activeMoneylineMarket = isCombinedMoneylineGroup && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_a = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _a : null : null;
1203
+ const activeMarket = slide.hasLadder ? (_d = (_c = (_b = slide.stops[selectedLineIndex]) == null ? void 0 : _b.market) != null ? _c : group.markets[0]) != null ? _d : null : (_e = activeMoneylineMarket != null ? activeMoneylineMarket : group.markets[0]) != null ? _e : null;
1204
+ const activeDefaultOutcome = isCombinedMoneylineGroup && activeMarket ? (_f = activeMarket.venueMarketOutcomes.find(
1205
+ (outcome) => outcome.label.trim().toLowerCase() === "yes"
1206
+ )) != null ? _f : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
1207
+ const wasExpandedRef = useRef2(isExpanded);
1208
+ useEffect3(() => {
1209
+ const justOpened = isExpanded && !wasExpandedRef.current;
1210
+ wasExpandedRef.current = isExpanded;
1211
+ if (!justOpened || !activeMarket) return;
1212
+ if (resolveMarketTradingState(activeMarket).isTradingDisabled) return;
1213
+ const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
1214
+ const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
1215
+ if (hasInScopeOutcome) return;
1216
+ const firstOutcome = activeDefaultOutcome;
1217
+ if (firstOutcome) {
1218
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
1219
+ }
1220
+ }, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
1221
+ if (!activeMarket) return null;
1222
+ const activeOutcome = (_g = activeMarket.venueMarketOutcomes.find(
1223
+ (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
1224
+ )) != null ? _g : activeDefaultOutcome;
1225
+ const activeOutcomeVenueCount = (() => {
1226
+ var _a2, _b2;
1227
+ if (!activeOutcome) return collectVenueNames(activeMarket).length;
1228
+ const venueNames = /* @__PURE__ */ new Set([activeMarket.venue]);
1229
+ for (const matchedOutcome of (_a2 = activeOutcome.matchedVenueMarketOutcomes) != null ? _a2 : []) {
1230
+ const matchedVenueMarket = (_b2 = activeMarket.matchedVenueMarkets) == null ? void 0 : _b2.find(
1231
+ (market) => market.id === matchedOutcome.venueMarketId
1232
+ );
1233
+ if (matchedVenueMarket == null ? void 0 : matchedVenueMarket.venue) {
1234
+ venueNames.add(matchedVenueMarket.venue);
1235
+ }
1236
+ }
1237
+ return venueNames.size > 0 ? venueNames.size : collectVenueNames(activeMarket).length;
1238
+ })();
1239
+ const activeMarketVolume = resolveSportsExpandedMarketsVolume([activeMarket]);
1240
+ const totalGroupVolume = resolveSportsExpandedMarketsVolume(group.markets);
1241
+ const compactSubtitle = `${activeOutcomeVenueCount} ${activeOutcomeVenueCount === 1 ? labels.marketDetails.meta.venueSingular : labels.marketDetails.meta.venuePlural} \xB7 ${formatCompactCurrency(activeMarketVolume || resolveTotalGroupVolume([activeMarket]))} ${labels.eventMarketPage.sports.volumeShort} \xB7 ${formatCompactCurrency(totalGroupVolume || resolveTotalGroupVolume(group.markets))} ${labels.eventMarketPage.sports.totalVolumeShort}`;
1242
+ const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
1243
+ if (!isCombinedMoneylineGroup) return void 0;
1244
+ return combinedMoneylineMarkets.flatMap((market, index) => {
1245
+ var _a2;
1246
+ const typedMarket = market;
1247
+ const yesOutcome = market.venueMarketOutcomes.find(
1248
+ (outcome) => outcome.label.trim().toLowerCase() === "yes"
1249
+ );
1250
+ if (!yesOutcome) return [];
1251
+ const label = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
1252
+ if (!label) return [];
1253
+ return [
1254
+ {
1255
+ id: yesOutcome.id,
1256
+ label,
1257
+ title: label,
1258
+ probability: yesOutcome.price,
1259
+ tone: index === 0 ? "positive" : "negative",
1260
+ variant: "outcome",
1261
+ venue: market.venue
1262
+ }
1263
+ ];
1264
+ });
1265
+ }, [combinedMoneylineMarkets, isCombinedMoneylineGroup]);
1266
+ const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
1267
+ const handleLineSelect = (index) => {
1268
+ var _a2, _b2;
1269
+ const previousMarket = activeMarket;
1270
+ setSelectedLineIndex(index);
1271
+ const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
1272
+ if (!market) return;
1273
+ const isGroupBeingTraded = group.markets.some(
1274
+ (groupMarket) => groupMarket.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
1275
+ );
1276
+ if (!isGroupBeingTraded) return;
1277
+ const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
1278
+ (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
1279
+ ) : -1;
1280
+ const nextOutcome = (_b2 = previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
1281
+ if (nextOutcome) {
1282
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
1283
+ } else {
1284
+ tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
1285
+ }
1286
+ };
1287
+ return /* @__PURE__ */ jsx3(
1288
+ MarketDetails,
1289
+ {
1290
+ marketId: activeMarket.id,
1291
+ venueMarkets,
1292
+ title: group.title,
1293
+ compactHeader: true,
1294
+ subtitleOverride: compactSubtitle,
1295
+ headerOutcomeVariant,
1296
+ headerOutcomeItemsOverride: combinedMoneylineHeaderOutcomeItems,
1297
+ isOpened: isExpanded,
1298
+ suppressOutcomeFallbackSelection: activeMarket.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId),
1299
+ onOpenChange: () => onToggle(group.id, activeMarket),
1300
+ onOutcomeSelect: (selection) => onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, selection),
1301
+ headerAccessory: slide.hasLadder ? /* @__PURE__ */ jsx3(
1302
+ SportsLineRail,
1303
+ {
1304
+ stops: slide.stops.map((stop) => ({
1305
+ value: stop.value,
1306
+ venues: stop.venues,
1307
+ disabled: stop.market.status !== MarketStatus.open
1308
+ })),
1309
+ selectedIndex: selectedLineIndex,
1310
+ onSelect: handleLineSelect,
1311
+ ariaLabel: labels.eventMarketPage.sports.lineSelectorAria(group.title),
1312
+ previousAriaLabel: labels.eventMarketPage.sports.previousLineAria(group.title),
1313
+ nextAriaLabel: labels.eventMarketPage.sports.nextLineAria(group.title)
1314
+ }
1315
+ ) : void 0,
1316
+ classNames: { root: "agg-market-list-item agg-sports-market-card" },
1317
+ live,
1318
+ midpointsFallback,
1319
+ midpointsFallbackVenues,
1320
+ midpointsResult
1321
+ }
1322
+ );
1323
+ };
1324
+ SportsMarketCard.displayName = "SportsMarketCard";
1325
+
1326
+ // src/pages/event-market/sports-markets.tsx
1327
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
1328
+ var resolveSportsSectionLabel = (labels, key) => {
1329
+ switch (key) {
1330
+ case "game_lines":
1331
+ return labels.eventMarketPage.sports.gameLinesTab;
1332
+ case "halves":
1333
+ return labels.eventMarketPage.sports.halvesTab;
1334
+ case "exact_score":
1335
+ return labels.eventMarketPage.sports.exactScoreTab;
1336
+ case "corners":
1337
+ return labels.eventMarketPage.sports.cornersTab;
1338
+ case "goals":
1339
+ return labels.eventMarketPage.sports.goalsTab;
1340
+ case "assists":
1341
+ return labels.eventMarketPage.sports.assistsTab;
1342
+ case "shots":
1343
+ return labels.eventMarketPage.sports.shotsTab;
1344
+ case "other":
1345
+ return labels.eventMarketPage.sports.otherTab;
1346
+ }
1347
+ };
1348
+ var resolveSportsPeriodLabel = (labels, period) => {
1349
+ switch (period) {
1350
+ case "full":
1351
+ return labels.eventMarketPage.sports.fullPeriod;
1352
+ case "1h":
1353
+ return labels.eventMarketPage.sports.firstHalfPeriod;
1354
+ case "2h":
1355
+ return labels.eventMarketPage.sports.secondHalfPeriod;
1356
+ case "q1":
1357
+ return labels.eventMarketPage.sports.quarterOnePeriod;
1358
+ case "q2":
1359
+ return labels.eventMarketPage.sports.quarterTwoPeriod;
1360
+ case "q3":
1361
+ return labels.eventMarketPage.sports.quarterThreePeriod;
1362
+ case "q4":
1363
+ return labels.eventMarketPage.sports.quarterFourPeriod;
1364
+ case "ot":
1365
+ return labels.eventMarketPage.sports.overtimePeriod;
1366
+ case "first_inning":
1367
+ return "1st Inning";
1368
+ case "second_inning":
1369
+ return "2nd Inning";
1370
+ case "third_inning":
1371
+ return "3rd Inning";
1372
+ case "first_5_innings":
1373
+ return "1st 5 Innings";
1374
+ case "other":
1375
+ return labels.eventMarketPage.sports.otherPeriod;
1376
+ }
1377
+ };
1378
+ var SportsTabButton = ({
1379
+ isActive,
1380
+ label,
1381
+ onClick
1382
+ }) => {
1383
+ return /* @__PURE__ */ jsx4(
1384
+ "button",
1385
+ {
1386
+ type: "button",
1387
+ role: "tab",
1388
+ "aria-selected": isActive,
1389
+ "data-testid": "sports-section-tab",
1390
+ className: cn(
1391
+ "inline-flex h-9 shrink-0 cursor-pointer items-center justify-center rounded-agg-full border px-4 text-agg-sm leading-agg-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary",
1392
+ isActive ? "border-agg-primary bg-agg-secondary font-agg-bold text-agg-foreground" : "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
1393
+ ),
1394
+ onClick,
1395
+ children: label
1396
+ }
1397
+ );
1398
+ };
1399
+ var SportsMarketsLoadingState = () => {
1400
+ const labels = useLabels3();
1401
+ return /* @__PURE__ */ jsxs3(
1402
+ "div",
1403
+ {
1404
+ className: "flex flex-col gap-3",
1405
+ role: "status",
1406
+ "aria-label": labels.eventMarketPage.sports.loadingTitle,
1407
+ children: [
1408
+ /* @__PURE__ */ jsx4("span", { className: "sr-only", children: labels.eventMarketPage.sports.loadingDescription }),
1409
+ Array.from({ length: 3 }).map((_, index) => /* @__PURE__ */ jsxs3(
1410
+ "div",
1411
+ {
1412
+ className: "flex min-h-[76px] animate-pulse flex-col gap-3 rounded-agg-2xl border border-agg-separator bg-agg-secondary px-5 py-3 sm:flex-row sm:items-center sm:justify-between",
1413
+ children: [
1414
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
1415
+ /* @__PURE__ */ jsx4("div", { className: "h-5 w-32 rounded-agg-sm bg-agg-secondary-hover" }),
1416
+ /* @__PURE__ */ jsx4("div", { className: "h-4 w-40 rounded-agg-sm bg-agg-secondary-hover" })
1417
+ ] }),
1418
+ /* @__PURE__ */ jsxs3("div", { className: "flex gap-2", children: [
1419
+ /* @__PURE__ */ jsx4("div", { className: "h-9 w-32 rounded-agg-full bg-agg-secondary-hover" }),
1420
+ /* @__PURE__ */ jsx4("div", { className: "hidden h-9 w-32 rounded-agg-full bg-agg-secondary-hover sm:block" })
1421
+ ] })
1422
+ ]
1423
+ },
1424
+ `sports-card-skeleton-${index}`
1425
+ ))
1426
+ ]
1427
+ }
1428
+ );
1429
+ };
1430
+ var SportsMarkets = ({
1431
+ event,
1432
+ onSectionMarketsChange,
1433
+ onOutcomeSelect,
1434
+ live,
1435
+ midpointsResult
1436
+ }) => {
1437
+ var _a, _b;
1438
+ const labels = useLabels3();
1439
+ const tradingContext = useEventTradingContext2();
1440
+ const hasAggKey = Boolean(event.aggKey);
1441
+ const gameMarketsQuery = useVenueMarkets({
1442
+ aggKey: event.aggKey ? [event.aggKey] : void 0,
1443
+ limit: 100,
1444
+ status: MarketStatus2.open,
1445
+ enabled: hasAggKey
1446
+ });
1447
+ const {
1448
+ markets: gameMarkets,
1449
+ hasNextPage: hasNextGameMarketsPage,
1450
+ isFetchingNextPage: isFetchingNextGameMarketsPage,
1451
+ fetchNextPage: fetchNextGameMarketsPage
1452
+ } = gameMarketsQuery;
1453
+ const tabSourceMarkets = useMemo2(() => {
1454
+ const seen = /* @__PURE__ */ new Set();
1455
+ const merged = [];
1456
+ for (const market of [...event.venueMarkets, ...gameMarkets]) {
1457
+ if (seen.has(market.id)) continue;
1458
+ seen.add(market.id);
1459
+ merged.push(market);
1460
+ }
1461
+ return merged;
1462
+ }, [event.venueMarkets, gameMarkets]);
1463
+ const visibleSectionDefinitions = useMemo2(
1464
+ () => resolveVisibleSportsSectionTabDefinitions(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
1465
+ [event, tabSourceMarkets]
1466
+ );
1467
+ const shouldRenderTabs = visibleSectionDefinitions.length > 1 && tabSourceMarkets.length > 1;
1468
+ const [activeTabKey, setActiveTabKey] = useState4(
1469
+ (_b = (_a = visibleSectionDefinitions[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines"
1470
+ );
1471
+ const [expandedGroupId, setExpandedGroupId] = useState4(null);
1472
+ const [stableMarketsByTab, setStableMarketsByTab] = useState4({});
1473
+ const activeTabLabel = resolveSportsSectionLabel(labels, activeTabKey);
1474
+ const sectionFilters = resolveSportsSectionFilters(activeTabKey);
1475
+ const sectionMarketsQuery = useVenueMarkets({
1476
+ aggKey: event.aggKey ? [event.aggKey] : void 0,
1477
+ sportsMarketType: sectionFilters.sportsMarketType,
1478
+ period: sectionFilters.period,
1479
+ marketCategory: sectionFilters.marketCategory,
1480
+ marketGroup: sectionFilters.marketGroup,
1481
+ limit: 20,
1482
+ status: MarketStatus2.open,
1483
+ enabled: hasAggKey
1484
+ });
1485
+ const {
1486
+ markets: sectionMarkets,
1487
+ isLoading: isSectionLoading,
1488
+ hasNextPage,
1489
+ isFetchingNextPage,
1490
+ fetchNextPage
1491
+ } = sectionMarketsQuery;
1492
+ const resolvedSectionMarkets = useMemo2(
1493
+ () => resolveSportsSectionMarkets({
1494
+ tabKey: activeTabKey,
1495
+ eventMarkets: tabSourceMarkets,
1496
+ sectionMarkets
1497
+ }),
1498
+ [activeTabKey, tabSourceMarkets, sectionMarkets]
1499
+ );
1500
+ const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
1501
+ const stableSectionMarkets = stableMarketsByTab[activeTabKey];
1502
+ const displayedSectionMarkets = stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [];
1503
+ const periodGroups = useMemo2(
1504
+ () => groupSportsMarketsByPeriod(displayedSectionMarkets),
1505
+ [displayedSectionMarkets]
1506
+ );
1507
+ const displayedPeriodGroups = useMemo2(
1508
+ () => activeTabKey === "game_lines" ? periodGroups.filter((periodGroup) => periodGroup.key === "full") : periodGroups,
1509
+ [activeTabKey, periodGroups]
1510
+ );
1511
+ const allGroups = useMemo2(
1512
+ () => displayedPeriodGroups.flatMap((periodGroup) => periodGroup.groups),
1513
+ [displayedPeriodGroups]
1514
+ );
1515
+ useEffect4(() => {
1516
+ if (hasNextPage && !isFetchingNextPage) {
1517
+ void fetchNextPage();
1518
+ }
1519
+ }, [hasNextPage, isFetchingNextPage, fetchNextPage]);
1520
+ useEffect4(() => {
1521
+ if (hasNextGameMarketsPage && !isFetchingNextGameMarketsPage) {
1522
+ void fetchNextGameMarketsPage();
1523
+ }
1524
+ }, [hasNextGameMarketsPage, isFetchingNextGameMarketsPage, fetchNextGameMarketsPage]);
1525
+ useEffect4(() => {
1526
+ if (!isSectionSettled) return;
1527
+ setStableMarketsByTab((currentStableMarketsByTab) => {
1528
+ var _a2;
1529
+ const currentMarkets = (_a2 = currentStableMarketsByTab[activeTabKey]) != null ? _a2 : [];
1530
+ if (currentMarkets.length === resolvedSectionMarkets.length && currentMarkets.every((market, index) => {
1531
+ var _a3;
1532
+ return market.id === ((_a3 = resolvedSectionMarkets[index]) == null ? void 0 : _a3.id);
1533
+ })) {
1534
+ return currentStableMarketsByTab;
1535
+ }
1536
+ return __spreadProps(__spreadValues({}, currentStableMarketsByTab), {
1537
+ [activeTabKey]: resolvedSectionMarkets
1538
+ });
1539
+ });
1540
+ }, [activeTabKey, isSectionSettled, resolvedSectionMarkets]);
1541
+ useEffect4(() => {
1542
+ if (!hasAggKey) return;
1543
+ onSectionMarketsChange(activeTabKey, displayedSectionMarkets);
1544
+ }, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
1545
+ useEffect4(() => {
1546
+ var _a2, _b2;
1547
+ if (visibleSectionDefinitions.some((definition) => definition.key === activeTabKey)) return;
1548
+ setActiveTabKey((_b2 = (_a2 = visibleSectionDefinitions[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
1549
+ }, [activeTabKey, visibleSectionDefinitions]);
1550
+ const lastActiveTabRef = useRef3(null);
1551
+ useEffect4(() => {
1552
+ if (allGroups.length === 0) return;
1553
+ if (lastActiveTabRef.current !== activeTabKey) {
1554
+ lastActiveTabRef.current = activeTabKey;
1555
+ setExpandedGroupId(null);
1556
+ return;
1557
+ }
1558
+ if (expandedGroupId && !allGroups.some((group) => group.id === expandedGroupId)) {
1559
+ setExpandedGroupId(null);
1560
+ }
1561
+ }, [activeTabKey, allGroups, expandedGroupId]);
1562
+ const handleToggleGroup = (groupId, market) => {
1563
+ if (groupId === expandedGroupId) {
1564
+ setExpandedGroupId(null);
1565
+ return;
1566
+ }
1567
+ setExpandedGroupId(groupId);
1568
+ if (resolveMarketTradingState2(market).isTradingDisabled) return;
1569
+ if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
1570
+ tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
1571
+ }
1572
+ };
1573
+ const handleGroupOutcomeSelect = (groupId) => {
1574
+ setExpandedGroupId(groupId);
1575
+ onOutcomeSelect == null ? void 0 : onOutcomeSelect();
1576
+ };
1577
+ if (!hasAggKey && event.venueMarkets.length === 0) {
1578
+ return /* @__PURE__ */ jsx4(
1579
+ StateMessage,
1580
+ {
1581
+ title: labels.eventMarketPage.sports.emptyTitle,
1582
+ description: labels.eventMarketPage.unavailableDescription,
1583
+ icon: /* @__PURE__ */ jsx4(Icon, { name: "warning", className: "h-10 w-10 text-agg-warning" }),
1584
+ classNames: { root: "min-h-[220px]" }
1585
+ }
1586
+ );
1587
+ }
1588
+ const shouldShowLoadingState = stableSectionMarkets == null && !isSectionSettled;
1589
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-5", "data-testid": "sports-markets", children: [
1590
+ shouldRenderTabs ? /* @__PURE__ */ jsx4(
1591
+ "div",
1592
+ {
1593
+ role: "tablist",
1594
+ "aria-label": labels.eventMarketPage.sports.sectionTabsAria,
1595
+ className: "flex flex-nowrap items-center gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
1596
+ children: visibleSectionDefinitions.map((definition) => /* @__PURE__ */ jsx4(
1597
+ SportsTabButton,
1598
+ {
1599
+ isActive: definition.key === activeTabKey,
1600
+ label: resolveSportsSectionLabel(labels, definition.key),
1601
+ onClick: () => setActiveTabKey(definition.key)
1602
+ },
1603
+ definition.key
1604
+ ))
1605
+ }
1606
+ ) : null,
1607
+ shouldShowLoadingState ? /* @__PURE__ */ jsx4(SportsMarketsLoadingState, {}) : null,
1608
+ !shouldShowLoadingState && allGroups.length === 0 ? /* @__PURE__ */ jsx4(
1609
+ StateMessage,
1610
+ {
1611
+ title: labels.eventMarketPage.sports.emptyTitle,
1612
+ description: labels.eventMarketPage.sports.emptyDescription(activeTabLabel),
1613
+ icon: /* @__PURE__ */ jsx4(Icon, { name: "search", className: "h-10 w-10 text-agg-muted-foreground" }),
1614
+ classNames: { root: "min-h-[220px]" }
1615
+ }
1616
+ ) : null,
1617
+ displayedPeriodGroups.map((periodGroup) => {
1618
+ const hasMultiplePeriods = displayedPeriodGroups.length > 1;
1619
+ return /* @__PURE__ */ jsxs3(
1620
+ "section",
1621
+ {
1622
+ className: "flex flex-col gap-3",
1623
+ "data-period-key": periodGroup.key,
1624
+ children: [
1625
+ hasMultiplePeriods ? /* @__PURE__ */ jsx4(Typography, { variant: "body-large-strong", className: "text-agg-foreground", children: resolveSportsPeriodLabel(labels, periodGroup.key) }) : null,
1626
+ periodGroup.groups.map((group) => /* @__PURE__ */ jsx4(
1627
+ SportsMarketCard,
1628
+ {
1629
+ group,
1630
+ venueMarkets: displayedSectionMarkets,
1631
+ isExpanded: expandedGroupId === group.id,
1632
+ onToggle: handleToggleGroup,
1633
+ onOutcomeSelect: (_groupId, _selection) => handleGroupOutcomeSelect(group.id),
1634
+ live,
1635
+ midpointsResult
1636
+ },
1637
+ group.id
1638
+ ))
1639
+ ]
1640
+ },
1641
+ `${activeTabKey}-${periodGroup.key}`
1642
+ );
1643
+ })
1644
+ ] });
1645
+ };
1646
+ SportsMarkets.displayName = "SportsMarkets";
1647
+
1648
+ // src/pages/event-market/sports-event-market-page.tsx
1649
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
1650
+ var areSportsSectionMarketsEqual = (leftMarkets, rightMarkets) => {
1651
+ if (leftMarkets.length !== rightMarkets.length) return false;
1652
+ return leftMarkets.every((market, index) => {
1653
+ var _a;
1654
+ return market.id === ((_a = rightMarkets[index]) == null ? void 0 : _a.id);
1655
+ });
1656
+ };
1657
+ var SportsEventMarketPage = ({
1658
+ event,
1659
+ defaultMarketId,
1660
+ defaultOutcomeId,
1661
+ classNames,
1662
+ ariaLabel,
1663
+ showPlaceOrder,
1664
+ executionMode,
1665
+ stickyOrderPanel,
1666
+ resolvedClaim,
1667
+ onBeforePrimaryAction
1668
+ }) => {
1669
+ const [sectionMarketsByKey, setSectionMarketsByKey] = useState5({});
1670
+ const composedEvent = useMemo3(() => {
1671
+ return mergeSportsSectionMarketsIntoEvent({
1672
+ event,
1673
+ sectionMarketsByKey
1674
+ });
1675
+ }, [event, sectionMarketsByKey]);
1676
+ const eventTradingState = useMemo3(() => resolveEventTradingState2(composedEvent), [composedEvent]);
1677
+ const hasSportsSections = useMemo3(
1678
+ () => resolveVisibleSportsSectionTabDefinitions(event).length > 0,
1679
+ [event]
1680
+ );
1681
+ const stickyOrderPanelState = resolveEventMarketPageStickyState({
1682
+ stickyOrderPanel
1683
+ });
1684
+ const {
1685
+ trading: { executionMode: configuredExecutionMode }
1686
+ } = useSdkUiConfig2();
1687
+ const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
1688
+ const [isMobileTradeOpen, setIsMobileTradeOpen] = useState5(false);
1689
+ const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
1690
+ const tradingContext = useEventTradingContext3();
1691
+ const midpointsResult = useMidpoints(composedEvent.venueMarkets);
1692
+ const internalResolvedClaim = useResolvedMarketClaim({
1693
+ market: eventTradingState.primaryMarket,
1694
+ enabled: eventTradingState.kind === "resolved",
1695
+ executionMode: resolvedExecutionMode
1696
+ });
1697
+ const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
1698
+ const setTradeSideRef = useRef4(tradingContext == null ? void 0 : tradingContext.setTradeSide);
1699
+ setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
1700
+ useEffect5(() => {
1701
+ return () => {
1702
+ var _a;
1703
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide.Buy);
1704
+ };
1705
+ }, []);
1706
+ const handleSectionMarketsChange = useCallback2(
1707
+ (tabKey, markets) => {
1708
+ setSectionMarketsByKey((currentSectionMarketsByKey) => {
1709
+ var _a;
1710
+ const currentMarkets = (_a = currentSectionMarketsByKey[tabKey]) != null ? _a : [];
1711
+ if (areSportsSectionMarketsEqual(currentMarkets, markets)) {
1712
+ return currentSectionMarketsByKey;
1713
+ }
1714
+ return __spreadProps(__spreadValues({}, currentSectionMarketsByKey), {
1715
+ [tabKey]: markets
1716
+ });
1717
+ });
1718
+ },
1719
+ []
1720
+ );
1721
+ if (!composedEvent.venueMarkets.length) {
1722
+ return /* @__PURE__ */ jsx5(EventMarketPageUnavailableState, { ariaLabel });
1723
+ }
1724
+ return /* @__PURE__ */ jsxs4(
1725
+ "section",
1726
+ {
1727
+ className: cn(
1728
+ "agg-event-market-page",
1729
+ "mx-auto w-full max-w-[1440px] px-4 pb-10 pt-4 sm:px-6 sm:pt-6 xl:px-9 xl:pt-8",
288
1730
  classNames == null ? void 0 : classNames.root
289
1731
  ),
290
- children: /* @__PURE__ */ jsxs(
291
- "div",
292
- {
293
- className: cn(
294
- "agg-page-content",
295
- "flex w-full flex-col gap-6 lg:flex-row lg:items-start lg:gap-8",
296
- stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
297
- classNames == null ? void 0 : classNames.content
298
- ),
299
- style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
300
- children: [
301
- /* @__PURE__ */ jsxs(
302
- "div",
303
- {
304
- className: cn(
305
- "agg-page-main flex min-w-0 flex-1 flex-col gap-6 mb-10",
306
- stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
307
- classNames == null ? void 0 : classNames.main
308
- ),
309
- children: [
310
- /* @__PURE__ */ jsx(
311
- EventListItemDetails,
312
- {
313
- isLoading: true,
314
- classNames: {
315
- root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero)
1732
+ "aria-label": ariaLabel != null ? ariaLabel : composedEvent.title,
1733
+ children: [
1734
+ /* @__PURE__ */ jsxs4(
1735
+ "div",
1736
+ {
1737
+ className: cn(
1738
+ "agg-page-content",
1739
+ "flex w-full flex-col gap-6 xl:flex-row xl:items-start xl:gap-[60px]",
1740
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.contentClassName,
1741
+ classNames == null ? void 0 : classNames.content
1742
+ ),
1743
+ style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
1744
+ children: [
1745
+ /* @__PURE__ */ jsxs4(
1746
+ "div",
1747
+ {
1748
+ className: cn(
1749
+ "agg-page-main mb-10 flex min-w-0 flex-1 flex-col gap-10",
1750
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.mainClassName,
1751
+ classNames == null ? void 0 : classNames.main
1752
+ ),
1753
+ children: [
1754
+ /* @__PURE__ */ jsx5(
1755
+ EventListItemDetails,
1756
+ {
1757
+ event: composedEvent,
1758
+ defaultMarketId,
1759
+ defaultOutcomeId,
1760
+ eventTradingState,
1761
+ midpointsResult,
1762
+ classNames: {
1763
+ root: cn("agg-event-hero", classNames == null ? void 0 : classNames.hero),
1764
+ // The sports tabs + market cards own market navigation, so hide the
1765
+ // hero's per-market selector pills (one per line market would be noise).
1766
+ headerPills: "hidden"
1767
+ }
316
1768
  }
317
- }
1769
+ ),
1770
+ hasSportsSections ? /* @__PURE__ */ jsx5(
1771
+ SportsMarkets,
1772
+ {
1773
+ event,
1774
+ onSectionMarketsChange: handleSectionMarketsChange,
1775
+ midpointsResult,
1776
+ onOutcomeSelect: isMobileViewport ? () => {
1777
+ setIsMobileTradeOpen(true);
1778
+ } : void 0
1779
+ }
1780
+ ) : /* @__PURE__ */ jsx5(
1781
+ MarketDetailsList,
1782
+ {
1783
+ eventId: composedEvent.id,
1784
+ markets: eventTradingState.displayMarkets,
1785
+ eventTradingState,
1786
+ live: true,
1787
+ expandSelectedMarketOnChange: !isMobileViewport,
1788
+ autoExpandFallbackMarket: !isMobileViewport,
1789
+ autoSelectFallbackMarket: !isMobileViewport,
1790
+ onOutcomeSelect: () => {
1791
+ if (!isMobileViewport) return;
1792
+ setIsMobileTradeOpen(true);
1793
+ },
1794
+ classNames: { root: "agg-market-list", item: "agg-market-list-item" },
1795
+ midpointsResult
1796
+ }
1797
+ ),
1798
+ showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx5("div", { className: "xl:hidden", children: /* @__PURE__ */ jsx5(
1799
+ PlaceOrder,
1800
+ {
1801
+ eventTradingState,
1802
+ executionMode: resolvedExecutionMode,
1803
+ resolvedClaim: effectiveResolvedClaim,
1804
+ midpointsResult,
1805
+ onBeforePrimaryAction,
1806
+ className: cn(
1807
+ "agg-mobile-trade-panel w-full overflow-hidden",
1808
+ classNames == null ? void 0 : classNames.mobileTrade
1809
+ ),
1810
+ classNames: resolveMobileTradePlaceOrderClassNames(classNames)
1811
+ }
1812
+ ) }) : null,
1813
+ /* @__PURE__ */ jsx5(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
1814
+ ]
1815
+ }
1816
+ ),
1817
+ /* @__PURE__ */ jsx5(
1818
+ "aside",
1819
+ {
1820
+ className: cn(
1821
+ "agg-sidebar hidden w-full xl:block xl:max-w-[343px] xl:shrink-0",
1822
+ stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
1823
+ classNames == null ? void 0 : classNames.sidebar
318
1824
  ),
319
- /* @__PURE__ */ jsxs("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
320
- /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
321
- /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
322
- /* @__PURE__ */ jsx(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
323
- ] })
324
- ]
325
- }
326
- ),
327
- /* @__PURE__ */ jsx(
328
- "aside",
329
- {
330
- className: cn(
331
- "agg-sidebar",
332
- "hidden w-full shrink-0 lg:block lg:w-[342px] lg:shrink-0",
333
- stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
334
- classNames == null ? void 0 : classNames.sidebar
335
- ),
336
- children: /* @__PURE__ */ jsx(
337
- PlaceOrder,
338
- {
339
- isLoading: true,
340
- className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
341
- classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
342
- }
343
- )
344
- }
345
- )
346
- ]
347
- }
348
- )
1825
+ children: showPlaceOrder !== false ? /* @__PURE__ */ jsx5(
1826
+ PlaceOrder,
1827
+ {
1828
+ eventTradingState,
1829
+ executionMode: resolvedExecutionMode,
1830
+ resolvedClaim: effectiveResolvedClaim,
1831
+ midpointsResult,
1832
+ onBeforePrimaryAction,
1833
+ className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
1834
+ classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
1835
+ }
1836
+ ) : null
1837
+ }
1838
+ )
1839
+ ]
1840
+ }
1841
+ ),
1842
+ !eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx5(
1843
+ EventMarketPageMobileTrade,
1844
+ {
1845
+ classNames,
1846
+ eventTradingState,
1847
+ executionMode: resolvedExecutionMode,
1848
+ showPlaceOrder,
1849
+ isOpen: isMobileTradeOpen,
1850
+ onOpenChange: setIsMobileTradeOpen,
1851
+ midpointsResult,
1852
+ onBeforePrimaryAction
1853
+ }
1854
+ ) : null
1855
+ ]
349
1856
  }
350
1857
  );
351
1858
  };
1859
+ SportsEventMarketPage.displayName = "SportsEventMarketPage";
1860
+
1861
+ // src/pages/event-market/index.tsx
1862
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
352
1863
  var EventMarketPageContent = ({
353
1864
  event,
354
1865
  defaultMarketId,
@@ -358,32 +1869,39 @@ var EventMarketPageContent = ({
358
1869
  showPlaceOrder,
359
1870
  executionMode,
360
1871
  stickyOrderPanel,
361
- resolvedClaim
1872
+ resolvedClaim,
1873
+ onBeforePrimaryAction
362
1874
  }) => {
363
- const eventTradingState = useMemo(() => resolveEventTradingState(event), [event]);
1875
+ const eventTradingState = useMemo4(() => resolveEventTradingState3(event), [event]);
364
1876
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
365
1877
  stickyOrderPanel
366
1878
  });
367
1879
  const {
368
1880
  trading: { executionMode: configuredExecutionMode }
369
- } = useSdkUiConfig();
1881
+ } = useSdkUiConfig3();
370
1882
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
371
- const [isMobileTradeOpen, setIsMobileTradeOpen] = useState(false);
1883
+ const [isMobileTradeOpen, setIsMobileTradeOpen] = useState6(false);
372
1884
  const isMobileViewport = useIsMobileEventMarketViewport();
373
- const tradingContext = useEventTradingContext();
374
- const midpointsResult = useMidpoints(event.venueMarkets);
375
- const setTradeSideRef = useRef(tradingContext == null ? void 0 : tradingContext.setTradeSide);
1885
+ const tradingContext = useEventTradingContext4();
1886
+ const midpointsResult = useMidpoints2(event.venueMarkets);
1887
+ const internalResolvedClaim = useResolvedMarketClaim({
1888
+ market: eventTradingState.primaryMarket,
1889
+ enabled: eventTradingState.kind === "resolved",
1890
+ executionMode: resolvedExecutionMode
1891
+ });
1892
+ const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
1893
+ const setTradeSideRef = useRef5(tradingContext == null ? void 0 : tradingContext.setTradeSide);
376
1894
  setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
377
- useEffect(() => {
1895
+ useEffect6(() => {
378
1896
  return () => {
379
1897
  var _a;
380
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide.Buy);
1898
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, TradeSide2.Buy);
381
1899
  };
382
1900
  }, []);
383
1901
  if (!event.venueMarkets.length) {
384
- return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel });
1902
+ return /* @__PURE__ */ jsx6(EventMarketPageUnavailableState, { ariaLabel });
385
1903
  }
386
- return /* @__PURE__ */ jsxs(
1904
+ return /* @__PURE__ */ jsxs5(
387
1905
  "section",
388
1906
  {
389
1907
  className: cn(
@@ -393,7 +1911,7 @@ var EventMarketPageContent = ({
393
1911
  ),
394
1912
  "aria-label": ariaLabel != null ? ariaLabel : event.title,
395
1913
  children: [
396
- /* @__PURE__ */ jsxs(
1914
+ /* @__PURE__ */ jsxs5(
397
1915
  "div",
398
1916
  {
399
1917
  className: cn(
@@ -404,7 +1922,7 @@ var EventMarketPageContent = ({
404
1922
  ),
405
1923
  style: stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.style,
406
1924
  children: [
407
- /* @__PURE__ */ jsxs(
1925
+ /* @__PURE__ */ jsxs5(
408
1926
  "div",
409
1927
  {
410
1928
  className: cn(
@@ -413,7 +1931,7 @@ var EventMarketPageContent = ({
413
1931
  classNames == null ? void 0 : classNames.main
414
1932
  ),
415
1933
  children: [
416
- /* @__PURE__ */ jsx(
1934
+ /* @__PURE__ */ jsx6(
417
1935
  EventListItemDetails,
418
1936
  {
419
1937
  event,
@@ -426,7 +1944,7 @@ var EventMarketPageContent = ({
426
1944
  }
427
1945
  }
428
1946
  ),
429
- /* @__PURE__ */ jsx(
1947
+ /* @__PURE__ */ jsx6(
430
1948
  MarketDetailsList,
431
1949
  {
432
1950
  eventId: event.id,
@@ -444,13 +1962,15 @@ var EventMarketPageContent = ({
444
1962
  midpointsResult
445
1963
  }
446
1964
  ),
447
- showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(
1965
+ showPlaceOrder !== false && eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx6("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx6(
448
1966
  PlaceOrder,
449
1967
  {
450
1968
  eventTradingState,
451
1969
  executionMode: resolvedExecutionMode,
452
- resolvedClaim,
1970
+ isQuotePanelActive: isMobileViewport,
1971
+ resolvedClaim: effectiveResolvedClaim,
453
1972
  midpointsResult,
1973
+ onBeforePrimaryAction,
454
1974
  className: cn(
455
1975
  "agg-mobile-trade-panel w-full overflow-hidden",
456
1976
  classNames == null ? void 0 : classNames.mobileTrade
@@ -458,11 +1978,11 @@ var EventMarketPageContent = ({
458
1978
  classNames: resolveMobileTradePlaceOrderClassNames(classNames)
459
1979
  }
460
1980
  ) }) : null,
461
- /* @__PURE__ */ jsx(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
1981
+ /* @__PURE__ */ jsx6(SettlementDetails, { eventId: event.id, className: classNames == null ? void 0 : classNames.settlement })
462
1982
  ]
463
1983
  }
464
1984
  ),
465
- /* @__PURE__ */ jsx(
1985
+ /* @__PURE__ */ jsx6(
466
1986
  "aside",
467
1987
  {
468
1988
  className: cn(
@@ -470,13 +1990,15 @@ var EventMarketPageContent = ({
470
1990
  stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.sidebarClassName,
471
1991
  classNames == null ? void 0 : classNames.sidebar
472
1992
  ),
473
- children: showPlaceOrder !== false ? /* @__PURE__ */ jsx(
1993
+ children: showPlaceOrder !== false ? /* @__PURE__ */ jsx6(
474
1994
  PlaceOrder,
475
1995
  {
476
1996
  eventTradingState,
477
1997
  executionMode: resolvedExecutionMode,
478
- resolvedClaim,
1998
+ isQuotePanelActive: !isMobileViewport,
1999
+ resolvedClaim: effectiveResolvedClaim,
479
2000
  midpointsResult,
2001
+ onBeforePrimaryAction,
480
2002
  className: cn(stickyOrderPanelState == null ? void 0 : stickyOrderPanelState.placeOrder, classNames == null ? void 0 : classNames.trade),
481
2003
  classNames: resolveDesktopTradePlaceOrderClassNames(classNames)
482
2004
  }
@@ -486,7 +2008,7 @@ var EventMarketPageContent = ({
486
2008
  ]
487
2009
  }
488
2010
  ),
489
- !eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx(
2011
+ !eventTradingState.isTradingDisabled ? /* @__PURE__ */ jsx6(
490
2012
  EventMarketPageMobileTrade,
491
2013
  {
492
2014
  classNames,
@@ -495,7 +2017,8 @@ var EventMarketPageContent = ({
495
2017
  showPlaceOrder,
496
2018
  isOpen: isMobileTradeOpen,
497
2019
  onOpenChange: setIsMobileTradeOpen,
498
- midpointsResult
2020
+ midpointsResult,
2021
+ onBeforePrimaryAction
499
2022
  }
500
2023
  ) : null
501
2024
  ]
@@ -504,18 +2027,33 @@ var EventMarketPageContent = ({
504
2027
  };
505
2028
  var EventMarketPage = (props) => {
506
2029
  var _a;
2030
+ const {
2031
+ features: { showSportsMarkets }
2032
+ } = useSdkUiConfig3();
507
2033
  const hasEventProp = "event" in props && !!props.event;
508
2034
  const {
509
2035
  event: fetchedEvent,
510
2036
  error: eventError,
511
- isLoading: isFetchingEvent
2037
+ isLoading: isFetchingEvent,
2038
+ isEnriching
512
2039
  } = useEnrichedVenueEvent({
513
2040
  eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
514
2041
  enabled: !props.isLoading && !hasEventProp && !!props.eventId
515
2042
  });
2043
+ const renderEventContent = (event) => {
2044
+ const contentProps = __spreadProps(__spreadValues({}, props), {
2045
+ event,
2046
+ isLoading: false
2047
+ });
2048
+ const hasKnownSport = !!event.sport && event.sport !== "other_sport";
2049
+ if (showSportsMarkets === true && event.structureType === "sport" && hasKnownSport) {
2050
+ return /* @__PURE__ */ jsx6(SportsEventMarketPage, __spreadValues({}, contentProps));
2051
+ }
2052
+ return /* @__PURE__ */ jsx6(EventMarketPageContent, __spreadValues({}, contentProps));
2053
+ };
516
2054
  const content = (() => {
517
2055
  if (props.isLoading) {
518
- return /* @__PURE__ */ jsx(
2056
+ return /* @__PURE__ */ jsx6(
519
2057
  EventMarketPageLoadingState,
520
2058
  {
521
2059
  classNames: props.classNames,
@@ -524,10 +2062,10 @@ var EventMarketPage = (props) => {
524
2062
  );
525
2063
  }
526
2064
  if ("event" in props && props.event) {
527
- return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: props.event }));
2065
+ return renderEventContent(props.event);
528
2066
  }
529
- if (isFetchingEvent) {
530
- return /* @__PURE__ */ jsx(
2067
+ if (isFetchingEvent || fetchedEvent && !fetchedEvent.venueMarkets.length && isEnriching) {
2068
+ return /* @__PURE__ */ jsx6(
531
2069
  EventMarketPageLoadingState,
532
2070
  {
533
2071
  classNames: props.classNames,
@@ -537,13 +2075,13 @@ var EventMarketPage = (props) => {
537
2075
  }
538
2076
  if (!fetchedEvent) {
539
2077
  if (isErrorWithStatus(eventError, 404)) {
540
- return /* @__PURE__ */ jsx(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
2078
+ return /* @__PURE__ */ jsx6(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
541
2079
  }
542
- return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
2080
+ return /* @__PURE__ */ jsx6(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
543
2081
  }
544
- return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
2082
+ return renderEventContent(fetchedEvent);
545
2083
  })();
546
- return /* @__PURE__ */ jsx(AggErrorBoundary, { onError: props.onError, children: content });
2084
+ return /* @__PURE__ */ jsx6(AggErrorBoundary, { onError: props.onError, children: content });
547
2085
  };
548
2086
  EventMarketPage.displayName = "EventMarketPage";
549
2087
 
@@ -608,15 +2146,15 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
608
2146
  };
609
2147
 
610
2148
  // src/pages/home/use-scroll-restoration.ts
611
- import { useLayoutEffect, useRef as useRef2, useState as useState2 } from "react";
2149
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef6, useState as useState7 } from "react";
612
2150
  function useScrollRestoration({
613
2151
  enabled,
614
2152
  scrollY,
615
2153
  isReady
616
2154
  }) {
617
- const restoredRef = useRef2(false);
618
- const [isRestoring, setIsRestoring] = useState2(enabled && scrollY > 0);
619
- useLayoutEffect(() => {
2155
+ const restoredRef = useRef6(false);
2156
+ const [isRestoring, setIsRestoring] = useState7(enabled && scrollY > 0);
2157
+ useLayoutEffect2(() => {
620
2158
  if (!enabled || restoredRef.current) return;
621
2159
  if (!isReady) return;
622
2160
  restoredRef.current = true;
@@ -629,15 +2167,15 @@ function useScrollRestoration({
629
2167
  }
630
2168
 
631
2169
  // src/pages/home/use-home-page-modals.ts
632
- import { useCallback, useEffect as useEffect2, useState as useState3 } from "react";
2170
+ import { useCallback as useCallback3, useEffect as useEffect7, useState as useState8 } from "react";
633
2171
  var useHomePageModals = () => {
634
- const [profileOpen, setProfileOpen] = useState3(false);
635
- const [depositOpen, setDepositOpen] = useState3(false);
636
- const [withdrawOpen, setWithdrawOpen] = useState3(false);
637
- const onProfileClick = useCallback(() => setProfileOpen(true), []);
638
- const onDepositClick = useCallback(() => setDepositOpen(true), []);
639
- const onWithdrawClick = useCallback(() => setWithdrawOpen(true), []);
640
- useEffect2(() => {
2172
+ const [profileOpen, setProfileOpen] = useState8(false);
2173
+ const [depositOpen, setDepositOpen] = useState8(false);
2174
+ const [withdrawOpen, setWithdrawOpen] = useState8(false);
2175
+ const onProfileClick = useCallback3(() => setProfileOpen(true), []);
2176
+ const onDepositClick = useCallback3(() => setDepositOpen(true), []);
2177
+ const onWithdrawClick = useCallback3(() => setWithdrawOpen(true), []);
2178
+ useEffect7(() => {
641
2179
  if (typeof window === "undefined") return;
642
2180
  window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
643
2181
  window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
@@ -659,7 +2197,7 @@ var useHomePageModals = () => {
659
2197
  };
660
2198
 
661
2199
  // src/pages/home/index.tsx
662
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2200
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
663
2201
  var MIN_SEARCH_LENGTH = 3;
664
2202
  var SEARCH_DEBOUNCE_MS = 300;
665
2203
  var SEARCH_RESULTS_LIMIT = 20;
@@ -674,20 +2212,20 @@ var HomeSearchResults = ({
674
2212
  onEventClick,
675
2213
  onMarketClick
676
2214
  }) => {
677
- const labels = useLabels2();
678
- const { search: searchConfig } = useSdkUiConfig2();
2215
+ const labels = useLabels4();
2216
+ const { search: searchConfig } = useSdkUiConfig4();
679
2217
  const { disabledVenues } = useAppConfig();
680
- const [activeVenueTabValue, setActiveVenueTabValue] = useState4("matched");
2218
+ const [activeVenueTabValue, setActiveVenueTabValue] = useState9("all");
681
2219
  const eventListTabs = useEventListTabs();
682
2220
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
683
- const visibleVenues = useMemo2(
2221
+ const visibleVenues = useMemo5(
684
2222
  () => disabledVenues.length === 0 ? void 0 : getVisibleVenueIdsByConfig(VENUES, disabledVenues),
685
2223
  [disabledVenues]
686
2224
  );
687
- const activeVenueTab = useMemo2(() => {
2225
+ const activeVenueTab = useMemo5(() => {
688
2226
  return eventListTabs.find((tab) => tab.value === activeVenueTabValue);
689
2227
  }, [activeVenueTabValue, eventListTabs]);
690
- const activeCategoryTab = useMemo2(() => {
2228
+ const activeCategoryTab = useMemo5(() => {
691
2229
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
692
2230
  }, [activeTabValue, resolvedTabs]);
693
2231
  const activeVenues = resolveTabVenus(activeVenueTab, visibleVenues);
@@ -711,15 +2249,15 @@ var HomeSearchResults = ({
711
2249
  // so debounced keystrokes don't pay reranker latency.
712
2250
  deep: true
713
2251
  });
714
- const openEvents = useMemo2(() => {
2252
+ const openEvents = useMemo5(() => {
715
2253
  let filtered = filterOpenEvents(searchResults);
716
2254
  if (activeVenues == null ? void 0 : activeVenues.length) {
717
2255
  filtered = filtered.filter((e) => activeVenues.includes(e.venue));
718
2256
  }
719
2257
  return filtered;
720
2258
  }, [searchResults, activeVenues]);
721
- const loadMoreRef = useRef3(null);
722
- useEffect3(() => {
2259
+ const loadMoreRef = useRef7(null);
2260
+ useEffect8(() => {
723
2261
  if (!hasNextPage) return;
724
2262
  const target = loadMoreRef.current;
725
2263
  if (!target) return;
@@ -746,10 +2284,10 @@ var HomeSearchResults = ({
746
2284
  const loadingPlaceholderCount = isFetchingNextPage ? 6 : 0;
747
2285
  const shouldRenderPaginationLoadingItems = hasNextPage;
748
2286
  if (isLoading && !isPlaceholderData) {
749
- return /* @__PURE__ */ jsx2(Skeleton, { view: "event-list", ariaLabel: labels.search.loadingResults, className });
2287
+ return /* @__PURE__ */ jsx7(Skeleton, { view: "event-list", ariaLabel: labels.search.loadingResults, className });
750
2288
  }
751
- return /* @__PURE__ */ jsxs2("section", { className: cn("agg-search-results-section flex w-full flex-col gap-5", className), children: [
752
- /* @__PURE__ */ jsxs2(
2289
+ return /* @__PURE__ */ jsxs6("section", { className: cn("agg-search-results-section flex w-full flex-col gap-5", className), children: [
2290
+ /* @__PURE__ */ jsxs6(
753
2291
  "header",
754
2292
  {
755
2293
  ref: headerRef,
@@ -759,8 +2297,8 @@ var HomeSearchResults = ({
759
2297
  "gap-2 sm:flex-row sm:items-center sm:gap-4"
760
2298
  ),
761
2299
  children: [
762
- /* @__PURE__ */ jsx2("div", { ref: titleRef, className: "agg-search-results-title min-w-32", children: /* @__PURE__ */ jsx2(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: resultsTitle }) }),
763
- /* @__PURE__ */ jsx2(
2300
+ /* @__PURE__ */ jsx7("div", { ref: titleRef, className: "agg-search-results-title min-w-32", children: /* @__PURE__ */ jsx7(Typography, { as: "h2", variant: "title", className: "truncate first-letter:uppercase", children: resultsTitle }) }),
2301
+ /* @__PURE__ */ jsx7(
764
2302
  EventListTabs,
765
2303
  {
766
2304
  ariaLabel: labels.eventList.tabsAria(resultsTitle),
@@ -773,7 +2311,7 @@ var HomeSearchResults = ({
773
2311
  ]
774
2312
  }
775
2313
  ),
776
- !isError && openEvents.length === 0 ? /* @__PURE__ */ jsx2("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx2(
2314
+ !isError && openEvents.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "col-span-full w-full", children: /* @__PURE__ */ jsx7(
777
2315
  StateMessage,
778
2316
  {
779
2317
  title: labels.eventList.emptyTitle,
@@ -782,18 +2320,18 @@ var HomeSearchResults = ({
782
2320
  title: "!text-agg-base leading-agg-6",
783
2321
  description: "!text-agg-sm leading-agg-5"
784
2322
  },
785
- icon: /* @__PURE__ */ jsx2(Icon, { name: "search-empty" })
2323
+ icon: /* @__PURE__ */ jsx7(Icon, { name: "search-empty" })
786
2324
  }
787
2325
  ) }) : null,
788
- isError ? /* @__PURE__ */ jsx2(
2326
+ isError ? /* @__PURE__ */ jsx7(
789
2327
  StateMessage,
790
2328
  {
791
2329
  title: labels.eventList.errorTitle,
792
2330
  description: labels.eventList.errorDescription,
793
- icon: /* @__PURE__ */ jsx2(Icon, { name: "warning" })
2331
+ icon: /* @__PURE__ */ jsx7(Icon, { name: "warning" })
794
2332
  }
795
2333
  ) : null,
796
- /* @__PURE__ */ jsxs2(
2334
+ /* @__PURE__ */ jsxs6(
797
2335
  "div",
798
2336
  {
799
2337
  className: cn(
@@ -804,7 +2342,7 @@ var HomeSearchResults = ({
804
2342
  isPlaceholderData && "opacity-60"
805
2343
  ),
806
2344
  children: [
807
- openEvents.map((event) => /* @__PURE__ */ jsx2(
2345
+ openEvents.map((event) => /* @__PURE__ */ jsx7(
808
2346
  EventListItem,
809
2347
  {
810
2348
  event,
@@ -826,7 +2364,7 @@ var HomeSearchResults = ({
826
2364
  },
827
2365
  event.id
828
2366
  )),
829
- shouldRenderPaginationLoadingItems ? Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx2(
2367
+ shouldRenderPaginationLoadingItems ? Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ jsx7(
830
2368
  EventListItem,
831
2369
  {
832
2370
  isLoading: true,
@@ -839,7 +2377,7 @@ var HomeSearchResults = ({
839
2377
  ]
840
2378
  }
841
2379
  ),
842
- hasNextPage ? /* @__PURE__ */ jsx2("div", { ref: loadMoreRef, className: "agg-search-results-sentinel h-px w-full", "aria-hidden": true }) : null
2380
+ hasNextPage ? /* @__PURE__ */ jsx7("div", { ref: loadMoreRef, className: "agg-search-results-sentinel h-px w-full", "aria-hidden": true }) : null
843
2381
  ] });
844
2382
  };
845
2383
  var HomePage = ({
@@ -861,7 +2399,7 @@ var HomePage = ({
861
2399
  stickyOrderPanel
862
2400
  }) => {
863
2401
  var _a, _b, _c, _d;
864
- const labels = useLabels2();
2402
+ const labels = useLabels4();
865
2403
  const {
866
2404
  search: {
867
2405
  value: searchValue,
@@ -871,11 +2409,11 @@ var HomePage = ({
871
2409
  onSelect: onSelectEventInternal
872
2410
  },
873
2411
  trading: { executionMode }
874
- } = useSdkUiConfig2();
2412
+ } = useSdkUiConfig4();
875
2413
  const { capture, consume } = useEventListState();
876
- const [snapshot] = useState4(() => consume());
877
- const eventListStateRef = useRef3(null);
878
- const handleSelectEvent = useCallback2(
2414
+ const [snapshot] = useState9(() => consume());
2415
+ const eventListStateRef = useRef7(null);
2416
+ const handleSelectEvent = useCallback4(
879
2417
  (event) => {
880
2418
  var _a2, _b2, _c2, _d2;
881
2419
  capture({
@@ -894,14 +2432,14 @@ var HomePage = ({
894
2432
  );
895
2433
  const hasCustomTabs = !!tabs && tabs.length > 0;
896
2434
  const normalizedSearchValue = searchValue.trim();
897
- const [stickySelectedEvent, setStickySelectedEvent] = useState4(
2435
+ const [stickySelectedEvent, setStickySelectedEvent] = useState9(
898
2436
  selectedEvent
899
2437
  );
900
- const [debouncedSearchValue, setDebouncedSearchValue] = useState4(() => {
2438
+ const [debouncedSearchValue, setDebouncedSearchValue] = useState9(() => {
901
2439
  return normalizedSearchValue.length >= MIN_SEARCH_LENGTH ? normalizedSearchValue : "";
902
2440
  });
903
- const [isMobileSearchViewport, setIsMobileSearchViewport] = useState4(false);
904
- useEffect3(() => {
2441
+ const [isMobileSearchViewport, setIsMobileSearchViewport] = useState9(false);
2442
+ useEffect8(() => {
905
2443
  if (typeof window === "undefined") return;
906
2444
  const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
907
2445
  const handleMediaQueryChange = (event) => {
@@ -919,7 +2457,7 @@ var HomePage = ({
919
2457
  mediaQueryList.removeListener(handleMediaQueryChange);
920
2458
  };
921
2459
  }, []);
922
- useEffect3(() => {
2460
+ useEffect8(() => {
923
2461
  if (normalizedSearchValue.length < MIN_SEARCH_LENGTH) {
924
2462
  setDebouncedSearchValue("");
925
2463
  return;
@@ -931,7 +2469,7 @@ var HomePage = ({
931
2469
  window.clearTimeout(timeoutId);
932
2470
  };
933
2471
  }, [normalizedSearchValue]);
934
- useEffect3(() => {
2472
+ useEffect8(() => {
935
2473
  if (selectedEvent) {
936
2474
  setStickySelectedEvent(selectedEvent);
937
2475
  return;
@@ -946,53 +2484,53 @@ var HomePage = ({
946
2484
  limit: categoriesLimit,
947
2485
  enabled: !hasCustomTabs
948
2486
  });
949
- const categoryTabs = useMemo2(() => {
2487
+ const categoryTabs = useMemo5(() => {
950
2488
  return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
951
2489
  }, [categories, resolvedAllCategoryTabLabel]);
952
- const resolvedTabs = useMemo2(() => {
2490
+ const resolvedTabs = useMemo5(() => {
953
2491
  if (hasCustomTabs && tabs) return tabs;
954
2492
  return categoryTabs;
955
2493
  }, [categoryTabs, hasCustomTabs, tabs]);
956
2494
  const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
957
- const [activeTabValue, setActiveTabValue] = useState4(() => {
2495
+ const [activeTabValue, setActiveTabValue] = useState9(() => {
958
2496
  if (snapshot == null ? void 0 : snapshot.categoryTab) {
959
2497
  return snapshot.categoryTab;
960
2498
  }
961
2499
  return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
962
2500
  });
963
- const activeTabValueRef = useRef3(activeTabValue);
2501
+ const activeTabValueRef = useRef7(activeTabValue);
964
2502
  activeTabValueRef.current = activeTabValue;
965
- useEffect3(() => {
2503
+ useEffect8(() => {
966
2504
  setActiveTabValue((currentValue) => {
967
2505
  const hasCurrentValue = resolvedTabs.some((tab) => tab.value === currentValue);
968
2506
  if (hasCurrentValue) return currentValue;
969
2507
  return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
970
2508
  });
971
2509
  }, [defaultActiveTab, resolvedTabs]);
972
- const tabsItems = useMemo2(() => {
2510
+ const tabsItems = useMemo5(() => {
973
2511
  return resolvedTabs.map((tab) => {
974
2512
  const isActive = tab.value === activeTabValue;
975
2513
  return {
976
2514
  value: tab.value,
977
2515
  label: tab.label,
978
- icon: tab.iconName ? /* @__PURE__ */ jsx2(
2516
+ icon: tab.iconName ? /* @__PURE__ */ jsx7(
979
2517
  "span",
980
2518
  {
981
2519
  className: cn(
982
2520
  "transition-colors duration-300 ease-in-out",
983
2521
  isActive ? "text-agg-primary" : "text-agg-foreground group-hover/agg-tab:text-agg-muted-foreground"
984
2522
  ),
985
- children: /* @__PURE__ */ jsx2(Icon, { name: tab.iconName, size: "small", color: "currentColor" })
2523
+ children: /* @__PURE__ */ jsx7(Icon, { name: tab.iconName, size: "small", color: "currentColor" })
986
2524
  }
987
2525
  ) : void 0,
988
2526
  disabled: tab.disabled
989
2527
  };
990
2528
  });
991
2529
  }, [activeTabValue, resolvedTabs]);
992
- const activeTab = useMemo2(() => {
2530
+ const activeTab = useMemo5(() => {
993
2531
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
994
2532
  }, [activeTabValue, resolvedTabs]);
995
- const resolvedSectionItems = useMemo2(() => {
2533
+ const resolvedSectionItems = useMemo5(() => {
996
2534
  var _a2, _b2, _c2;
997
2535
  if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
998
2536
  return resolvedEventSectionItems;
@@ -1037,8 +2575,8 @@ var HomePage = ({
1037
2575
  scrollY: (_d = snapshot == null ? void 0 : snapshot.scrollY) != null ? _d : 0,
1038
2576
  isReady: isScrollRestorationReady
1039
2577
  });
1040
- return /* @__PURE__ */ jsx2(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs2("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
1041
- withHeader ? /* @__PURE__ */ jsx2(
2578
+ return /* @__PURE__ */ jsx7(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsxs6("section", { className: cn("agg-home-page flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
2579
+ withHeader ? /* @__PURE__ */ jsx7(
1042
2580
  Header,
1043
2581
  {
1044
2582
  search: isMobileSearchViewport ? null : void 0,
@@ -1047,7 +2585,7 @@ var HomePage = ({
1047
2585
  onLogoClick: handleLogoClick
1048
2586
  }
1049
2587
  ) : null,
1050
- !resolvedSelectedEvent && !isShowingAllResults ? /* @__PURE__ */ jsx2(
2588
+ !resolvedSelectedEvent && !isShowingAllResults ? /* @__PURE__ */ jsx7(
1051
2589
  "header",
1052
2590
  {
1053
2591
  className: cn(
@@ -1055,7 +2593,7 @@ var HomePage = ({
1055
2593
  "w-full bg-agg-secondary border-b border-agg-separator h-14! md:h-15!",
1056
2594
  classNames == null ? void 0 : classNames.header
1057
2595
  ),
1058
- children: /* @__PURE__ */ jsx2("div", { className: "mx-auto h-full w-full max-w-[1440px] px-6 lg:px-10", children: /* @__PURE__ */ jsx2(
2596
+ children: /* @__PURE__ */ jsx7("div", { className: "mx-auto h-full w-full max-w-[1440px] px-6 lg:px-10", children: /* @__PURE__ */ jsx7(
1059
2597
  Tabs,
1060
2598
  {
1061
2599
  ariaLabel: labels.home.categoryTabsAria,
@@ -1069,14 +2607,14 @@ var HomePage = ({
1069
2607
  ) })
1070
2608
  }
1071
2609
  ) : null,
1072
- resolvedSelectedEvent ? /* @__PURE__ */ jsx2(
2610
+ resolvedSelectedEvent ? /* @__PURE__ */ jsx7(
1073
2611
  EventMarketPage,
1074
2612
  {
1075
2613
  eventId: resolvedSelectedEvent.id,
1076
2614
  executionMode,
1077
2615
  stickyOrderPanel
1078
2616
  }
1079
- ) : /* @__PURE__ */ jsxs2(
2617
+ ) : /* @__PURE__ */ jsxs6(
1080
2618
  "div",
1081
2619
  {
1082
2620
  className: cn(
@@ -1084,14 +2622,14 @@ var HomePage = ({
1084
2622
  "pt-4 sm:pt-6 md:pt-8 pb-10"
1085
2623
  ),
1086
2624
  children: [
1087
- shouldRenderMobileSearch ? /* @__PURE__ */ jsx2("div", { className: "agg-page-mobile-search w-full pb-5 md:hidden", children: /* @__PURE__ */ jsx2(
2625
+ shouldRenderMobileSearch ? /* @__PURE__ */ jsx7("div", { className: "agg-page-mobile-search w-full pb-5 md:hidden", children: /* @__PURE__ */ jsx7(
1088
2626
  Search,
1089
2627
  {
1090
2628
  onSelectEvent: handleMobileSearchSelect,
1091
2629
  onSeeAllEvents: onSeeAllEventsProp
1092
2630
  }
1093
2631
  ) }) : null,
1094
- /* @__PURE__ */ jsx2(
2632
+ /* @__PURE__ */ jsx7(
1095
2633
  "main",
1096
2634
  {
1097
2635
  className: cn(
@@ -1099,7 +2637,7 @@ var HomePage = ({
1099
2637
  "flex w-full flex-col gap-4 sm:gap-6 md:gap-10 mb-10",
1100
2638
  classNames == null ? void 0 : classNames.sections
1101
2639
  ),
1102
- children: isShowingAllResults && debouncedSearchValue ? /* @__PURE__ */ jsx2(
2640
+ children: isShowingAllResults && debouncedSearchValue ? /* @__PURE__ */ jsx7(
1103
2641
  HomeSearchResults,
1104
2642
  {
1105
2643
  activeTabValue,
@@ -1112,11 +2650,11 @@ var HomePage = ({
1112
2650
  }
1113
2651
  ) : resolvedSectionItems.map((eventSectionItem, sectionIndex) => {
1114
2652
  var _a2, _b2, _c2, _d2;
1115
- return /* @__PURE__ */ jsx2(
2653
+ return /* @__PURE__ */ jsx7(
1116
2654
  "div",
1117
2655
  {
1118
2656
  className: "agg-home-section",
1119
- children: /* @__PURE__ */ jsx2(
2657
+ children: /* @__PURE__ */ jsx7(
1120
2658
  EventList,
1121
2659
  __spreadValues({
1122
2660
  title: eventSectionItem.title,
@@ -1154,26 +2692,20 @@ HomePage.displayName = "HomePage";
1154
2692
  // src/pages/user-profile/index.tsx
1155
2693
  import {
1156
2694
  computeClosedPositionTotals,
1157
- executionKeys,
1158
2695
  getWalletAddressFromUserProfile,
1159
- invalidateBalanceQueries,
1160
- invalidatePositionQueries,
1161
- invalidateUserActivityQueries,
1162
2696
  useAggAuthState,
1163
2697
  useAggBalance,
1164
2698
  useAggClient,
1165
2699
  useExecutionOrders,
1166
2700
  useExecutionPositions,
1167
2701
  useGeoBlock,
1168
- useLabels as useLabels7,
2702
+ useLabels as useLabels9,
1169
2703
  useQueryClient,
1170
- useRedeem,
1171
- useRedeemLifecycles,
1172
- useSdkUiConfig as useSdkUiConfig3,
2704
+ useSdkUiConfig as useSdkUiConfig5,
1173
2705
  useUserActivity
1174
2706
  } from "@agg-build/hooks";
1175
2707
  import { Venue } from "@agg-build/sdk";
1176
- import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
2708
+ import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo7, useState as useState11 } from "react";
1177
2709
 
1178
2710
  // src/pages/user-profile/chain-display.ts
1179
2711
  var CHAIN_ID_TO_LABEL = {
@@ -1196,8 +2728,8 @@ var formatChainIdLabel = (chainId) => {
1196
2728
  };
1197
2729
 
1198
2730
  // src/pages/user-profile/components/available-balance-card.tsx
1199
- import { useLabels as useLabels3 } from "@agg-build/hooks";
1200
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2731
+ import { useLabels as useLabels5 } from "@agg-build/hooks";
2732
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1201
2733
  var BASE_URL = "https://assets.snagsolutions.io";
1202
2734
  var CHAIN_ID_TO_ICON_URL = {
1203
2735
  "1": `${BASE_URL}/public/prediction-markets/logos/ETH.svg`,
@@ -1251,11 +2783,11 @@ var AvailableBalanceCard = ({
1251
2783
  isLoading = false,
1252
2784
  className
1253
2785
  }) => {
1254
- const labels = useLabels3();
2786
+ const labels = useLabels5();
1255
2787
  const balanceLabels = labels.userProfile.balance;
1256
2788
  const resolvedLabel = label != null ? label : balanceLabels.availableBalance;
1257
2789
  const hasPaperBalance = chains.some(isPaperChain);
1258
- return /* @__PURE__ */ jsxs3(
2790
+ return /* @__PURE__ */ jsxs7(
1259
2791
  "div",
1260
2792
  {
1261
2793
  className: cn(
@@ -1264,8 +2796,8 @@ var AvailableBalanceCard = ({
1264
2796
  className
1265
2797
  ),
1266
2798
  children: [
1267
- /* @__PURE__ */ jsx3("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
1268
- /* @__PURE__ */ jsx3(
2799
+ /* @__PURE__ */ jsx8("div", { className: "agg-balance-header flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
2800
+ /* @__PURE__ */ jsx8(
1269
2801
  "svg",
1270
2802
  {
1271
2803
  xmlns: "http://www.w3.org/2000/svg",
@@ -1275,7 +2807,7 @@ var AvailableBalanceCard = ({
1275
2807
  fill: "none",
1276
2808
  "aria-hidden": "true",
1277
2809
  focusable: "false",
1278
- children: /* @__PURE__ */ jsx3(
2810
+ children: /* @__PURE__ */ jsx8(
1279
2811
  "path",
1280
2812
  {
1281
2813
  d: "M14 4.00065H3.33333C2.76067 4.00065 2.21867 3.75265 1.84333 3.33465C2.21 2.92532 2.74267 2.66732 3.33333 2.66732H15.3333C15.702 2.66732 16 2.36865 16 2.00065C16 1.63265 15.702 1.33398 15.3333 1.33398H3.33333C1.49267 1.33398 0 2.82665 0 4.66732V11.334C0 13.1747 1.49267 14.6673 3.33333 14.6673H14C15.1047 14.6673 16 13.772 16 12.6673V6.00065C16 4.89598 15.1047 4.00065 14 4.00065ZM14.6667 12.6673C14.6667 13.0347 14.368 13.334 14 13.334H3.33333C2.23067 13.334 1.33333 12.4367 1.33333 11.334V4.66598C1.90267 5.09198 2.60267 5.33398 3.33333 5.33398H14C14.368 5.33398 14.6667 5.63332 14.6667 6.00065V12.6673ZM13.3333 9.33399C13.3333 9.70199 13.0347 10.0007 12.6667 10.0007C12.2987 10.0007 12 9.70199 12 9.33399C12 8.96599 12.2987 8.66732 12.6667 8.66732C13.0347 8.66732 13.3333 8.96599 13.3333 9.33399Z",
@@ -1284,31 +2816,31 @@ var AvailableBalanceCard = ({
1284
2816
  )
1285
2817
  }
1286
2818
  ),
1287
- /* @__PURE__ */ jsx3("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
2819
+ /* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: resolvedLabel })
1288
2820
  ] }) }),
1289
- /* @__PURE__ */ jsxs3("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
1290
- /* @__PURE__ */ jsx3("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx3("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx3(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
1291
- /* @__PURE__ */ jsx3(
2821
+ /* @__PURE__ */ jsxs7("div", { className: "agg-balance-summary flex items-center justify-between gap-3", children: [
2822
+ /* @__PURE__ */ jsx8("div", { className: "agg-balance-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading available balance", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel }),
2823
+ /* @__PURE__ */ jsx8(
1292
2824
  Tooltip,
1293
2825
  {
1294
2826
  "aria-label": balanceLabels.balanceByNetwork,
1295
2827
  size: "medium",
1296
2828
  side: "bottom",
1297
- content: /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
1298
- /* @__PURE__ */ jsx3("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
1299
- /* @__PURE__ */ jsx3("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
2829
+ content: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-4 items-start justify-start", children: [
2830
+ /* @__PURE__ */ jsx8("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: balanceLabels.balanceByNetwork }),
2831
+ /* @__PURE__ */ jsx8("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
1300
2832
  var _a;
1301
2833
  const iconUrl = chainIconUrl(row.label, row.key);
1302
2834
  const isPaper = isPaperChain(row);
1303
2835
  const rowLabel = isPaper ? balanceLabels.paperModeNetwork : row.label;
1304
- return /* @__PURE__ */ jsxs3(
2836
+ return /* @__PURE__ */ jsxs7(
1305
2837
  "div",
1306
2838
  {
1307
2839
  role: "listitem",
1308
2840
  className: "agg-balance-row flex items-center justify-between self-stretch gap-3 w-full",
1309
2841
  children: [
1310
- /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
1311
- iconUrl ? /* @__PURE__ */ jsx3("span", { className: "overflow-clip flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx3(
2842
+ /* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
2843
+ iconUrl ? /* @__PURE__ */ jsx8("span", { className: "overflow-clip flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx8(
1312
2844
  "img",
1313
2845
  {
1314
2846
  src: iconUrl,
@@ -1316,16 +2848,16 @@ var AvailableBalanceCard = ({
1316
2848
  "aria-hidden": true,
1317
2849
  className: "size-full object-contain"
1318
2850
  }
1319
- ) }) : isPaper ? /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary-hover text-agg-primary", children: /* @__PURE__ */ jsx3(Icon, { name: "paper-mode", size: "small", className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx3("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: rowLabel.slice(0, 2).toUpperCase() }),
1320
- /* @__PURE__ */ jsx3("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: rowLabel })
2851
+ ) }) : isPaper ? /* @__PURE__ */ jsx8("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary-hover text-agg-primary", children: /* @__PURE__ */ jsx8(Icon, { name: "paper-mode", size: "small", className: "h-4 w-4" }) }) : /* @__PURE__ */ jsx8("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: rowLabel.slice(0, 2).toUpperCase() }),
2852
+ /* @__PURE__ */ jsx8("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: rowLabel })
1321
2853
  ] }),
1322
- /* @__PURE__ */ jsx3("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
2854
+ /* @__PURE__ */ jsx8("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
1323
2855
  style: "currency",
1324
2856
  currency: "USD",
1325
2857
  minimumFractionDigits: Number.isInteger(row.balance) ? 0 : 1,
1326
2858
  maximumFractionDigits: 2
1327
2859
  }) }),
1328
- /* @__PURE__ */ jsx3("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: ((_a = CHAIN_VENUE_MAP[row.key]) != null ? _a : []).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx3(
2860
+ /* @__PURE__ */ jsx8("div", { className: "flex w-12 shrink-0 items-center justify-end gap-1", children: ((_a = CHAIN_VENUE_MAP[row.key]) != null ? _a : []).slice(0, 2).map((venue, venueIndex) => /* @__PURE__ */ jsx8(
1329
2861
  VenueLogo,
1330
2862
  {
1331
2863
  venue,
@@ -1339,8 +2871,8 @@ var AvailableBalanceCard = ({
1339
2871
  row.key
1340
2872
  );
1341
2873
  }) }),
1342
- hasPaperBalance ? /* @__PURE__ */ jsx3("div", { className: "agg-balance-paper-warning rounded-agg-lg bg-agg-primary/10 p-3", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-2", children: [
1343
- /* @__PURE__ */ jsx3(
2874
+ hasPaperBalance ? /* @__PURE__ */ jsx8("div", { className: "agg-balance-paper-warning rounded-agg-lg bg-agg-primary/10 p-3", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
2875
+ /* @__PURE__ */ jsx8(
1344
2876
  Icon,
1345
2877
  {
1346
2878
  name: "paper-mode",
@@ -1348,11 +2880,11 @@ var AvailableBalanceCard = ({
1348
2880
  className: "mt-0.5 h-4 w-4 shrink-0 text-agg-primary"
1349
2881
  }
1350
2882
  ),
1351
- /* @__PURE__ */ jsx3("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.paperModeWarning })
2883
+ /* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.paperModeWarning })
1352
2884
  ] }) }) : null,
1353
- /* @__PURE__ */ jsx3("div", { className: "agg-balance-note rounded-agg-lg bg-agg-secondary-hover p-3", children: /* @__PURE__ */ jsx3("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.networkTooltipDescription }) })
2885
+ /* @__PURE__ */ jsx8("div", { className: "agg-balance-note rounded-agg-lg bg-agg-secondary-hover p-3", children: /* @__PURE__ */ jsx8("p", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-foreground", children: balanceLabels.networkTooltipDescription }) })
1354
2886
  ] }),
1355
- children: /* @__PURE__ */ jsxs3(
2887
+ children: /* @__PURE__ */ jsxs7(
1356
2888
  "button",
1357
2889
  {
1358
2890
  type: "button",
@@ -1362,18 +2894,18 @@ var AvailableBalanceCard = ({
1362
2894
  (chains.slice(0, 4).length > 0 ? chains.slice(0, 4) : [{ key: "placeholder", label: "", balance: 0, accountCount: 0 }]).map((row) => {
1363
2895
  const iconUrl = chainIconUrl(row.label, row.key);
1364
2896
  const isPaper = isPaperChain(row);
1365
- return iconUrl ? /* @__PURE__ */ jsx3(
2897
+ return iconUrl ? /* @__PURE__ */ jsx8(
1366
2898
  "span",
1367
2899
  {
1368
2900
  className: "overflow-clip relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary",
1369
- children: /* @__PURE__ */ jsx3("img", { src: iconUrl, alt: row.label, className: "size-full object-contain" })
2901
+ children: /* @__PURE__ */ jsx8("img", { src: iconUrl, alt: row.label, className: "size-full object-contain" })
1370
2902
  },
1371
2903
  `icon-${row.key}`
1372
- ) : isPaper ? /* @__PURE__ */ jsx3(
2904
+ ) : isPaper ? /* @__PURE__ */ jsx8(
1373
2905
  "span",
1374
2906
  {
1375
2907
  className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-agg-primary",
1376
- children: /* @__PURE__ */ jsx3(
2908
+ children: /* @__PURE__ */ jsx8(
1377
2909
  Icon,
1378
2910
  {
1379
2911
  name: "paper-mode",
@@ -1384,7 +2916,7 @@ var AvailableBalanceCard = ({
1384
2916
  )
1385
2917
  },
1386
2918
  `icon-${row.key}`
1387
- ) : /* @__PURE__ */ jsx3(
2919
+ ) : /* @__PURE__ */ jsx8(
1388
2920
  "span",
1389
2921
  {
1390
2922
  className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-[10px] leading-3 text-agg-muted-foreground",
@@ -1393,7 +2925,7 @@ var AvailableBalanceCard = ({
1393
2925
  `icon-${row.key}`
1394
2926
  );
1395
2927
  }),
1396
- chains.length > 4 ? /* @__PURE__ */ jsxs3("span", { className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary font-agg-sans text-[10px] leading-3 text-agg-muted-foreground", children: [
2928
+ chains.length > 4 ? /* @__PURE__ */ jsxs7("span", { className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary font-agg-sans text-[10px] leading-3 text-agg-muted-foreground", children: [
1397
2929
  "+",
1398
2930
  chains.length - 4
1399
2931
  ] }) : null
@@ -1410,8 +2942,8 @@ var AvailableBalanceCard = ({
1410
2942
  AvailableBalanceCard.displayName = "AvailableBalanceCard";
1411
2943
 
1412
2944
  // src/pages/user-profile/components/positions-activity.tsx
1413
- import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels5 } from "@agg-build/hooks";
1414
- import { Fragment as Fragment4, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
2945
+ import { optimizedImageUrl as optimizedImageUrl2, useLabels as useLabels7 } from "@agg-build/hooks";
2946
+ import { Fragment as Fragment4, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef8, useState as useState10 } from "react";
1415
2947
 
1416
2948
  // src/pages/user-profile/user-profile.constants.ts
1417
2949
  var USER_PROFILE_TAB_POSITIONS = "positions";
@@ -1616,7 +3148,7 @@ var ConditionalWrapper = ({
1616
3148
  ConditionalWrapper.displayName = "ConditionalWrapper";
1617
3149
 
1618
3150
  // src/pages/user-profile/components/activity-row.tsx
1619
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
3151
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1620
3152
  var shouldOpenInNewTab = (activity) => {
1621
3153
  return activity.kind === "redeem" || activity.kind === "deposit" || activity.kind === "withdrawal";
1622
3154
  };
@@ -1633,7 +3165,7 @@ var RowWrapper = ({
1633
3165
  }) => {
1634
3166
  if (href) {
1635
3167
  const opensInNewTab = target === "_blank";
1636
- return /* @__PURE__ */ jsx4(
3168
+ return /* @__PURE__ */ jsx9(
1637
3169
  "a",
1638
3170
  {
1639
3171
  href,
@@ -1649,7 +3181,7 @@ var RowWrapper = ({
1649
3181
  }
1650
3182
  );
1651
3183
  }
1652
- return /* @__PURE__ */ jsx4("button", { type: "button", className, onClick, children });
3184
+ return /* @__PURE__ */ jsx9("button", { type: "button", className, onClick, children });
1653
3185
  };
1654
3186
  var TRANSFER_ICON = {
1655
3187
  withdrawal: "upload",
@@ -1684,7 +3216,7 @@ var AmountTimeStack = ({
1684
3216
  timeLabel,
1685
3217
  tone,
1686
3218
  mobile
1687
- }) => /* @__PURE__ */ jsxs4(
3219
+ }) => /* @__PURE__ */ jsxs8(
1688
3220
  "div",
1689
3221
  {
1690
3222
  className: cn(
@@ -1692,7 +3224,7 @@ var AmountTimeStack = ({
1692
3224
  mobile ? "sm:hidden" : "hidden sm:flex sm:w-[120px] sm:shrink-0"
1693
3225
  ),
1694
3226
  children: [
1695
- /* @__PURE__ */ jsx4(
3227
+ /* @__PURE__ */ jsx9(
1696
3228
  "p",
1697
3229
  {
1698
3230
  className: cn(
@@ -1703,7 +3235,7 @@ var AmountTimeStack = ({
1703
3235
  children: amountLabel
1704
3236
  }
1705
3237
  ),
1706
- /* @__PURE__ */ jsx4(
3238
+ /* @__PURE__ */ jsx9(
1707
3239
  "p",
1708
3240
  {
1709
3241
  className: cn(
@@ -1720,9 +3252,9 @@ var AmountTimeStack = ({
1720
3252
  var TradeTypeCell = ({
1721
3253
  activity,
1722
3254
  tone
1723
- }) => /* @__PURE__ */ jsxs4("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
1724
- /* @__PURE__ */ jsx4(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
1725
- /* @__PURE__ */ jsx4(
3255
+ }) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
3256
+ /* @__PURE__ */ jsx9(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
3257
+ /* @__PURE__ */ jsx9(
1726
3258
  "p",
1727
3259
  {
1728
3260
  className: cn(
@@ -1737,8 +3269,8 @@ var TradeTypeCell = ({
1737
3269
  var TransferTypeCell = ({
1738
3270
  activity,
1739
3271
  tone
1740
- }) => /* @__PURE__ */ jsxs4("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
1741
- /* @__PURE__ */ jsx4(
3272
+ }) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
3273
+ /* @__PURE__ */ jsx9(
1742
3274
  Icon,
1743
3275
  {
1744
3276
  name: TRANSFER_ICON[activity.kind],
@@ -1749,7 +3281,7 @@ var TransferTypeCell = ({
1749
3281
  )
1750
3282
  }
1751
3283
  ),
1752
- /* @__PURE__ */ jsx4(
3284
+ /* @__PURE__ */ jsx9(
1753
3285
  "p",
1754
3286
  {
1755
3287
  className: cn(
@@ -1764,8 +3296,8 @@ var TransferTypeCell = ({
1764
3296
  var RedeemTypeCell = ({
1765
3297
  activity,
1766
3298
  tone
1767
- }) => /* @__PURE__ */ jsxs4("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
1768
- /* @__PURE__ */ jsx4(
3299
+ }) => /* @__PURE__ */ jsxs8("div", { className: "hidden w-[108px] shrink-0 items-center gap-3 sm:flex", children: [
3300
+ /* @__PURE__ */ jsx9(
1769
3301
  Icon,
1770
3302
  {
1771
3303
  name: "gift-bonus",
@@ -1776,7 +3308,7 @@ var RedeemTypeCell = ({
1776
3308
  )
1777
3309
  }
1778
3310
  ),
1779
- /* @__PURE__ */ jsx4(
3311
+ /* @__PURE__ */ jsx9(
1780
3312
  "p",
1781
3313
  {
1782
3314
  className: cn(
@@ -1793,7 +3325,7 @@ var OutcomeBadge = ({
1793
3325
  tone
1794
3326
  }) => {
1795
3327
  if (!label) return null;
1796
- return /* @__PURE__ */ jsx4("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx4(
3328
+ return /* @__PURE__ */ jsx9("span", { className: "agg-activity-outcome inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx9(
1797
3329
  "span",
1798
3330
  {
1799
3331
  className: cn(
@@ -1807,9 +3339,9 @@ var OutcomeBadge = ({
1807
3339
  var TradeOutcomeShares = ({
1808
3340
  activity,
1809
3341
  tone
1810
- }) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
1811
- /* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone }),
1812
- /* @__PURE__ */ jsx4(
3342
+ }) => /* @__PURE__ */ jsxs8(Fragment2, { children: [
3343
+ /* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone }),
3344
+ /* @__PURE__ */ jsx9(
1813
3345
  "span",
1814
3346
  {
1815
3347
  className: cn(
@@ -1830,7 +3362,7 @@ var RedeemRow = ({
1830
3362
  const statusVisual = getStatusVisual(activity);
1831
3363
  const activityStatus = resolveActivityStatus(activity);
1832
3364
  const shouldShowInlineStatus = activityStatus !== "completed";
1833
- return /* @__PURE__ */ jsx4(
3365
+ return /* @__PURE__ */ jsx9(
1834
3366
  RowWrapper,
1835
3367
  {
1836
3368
  className,
@@ -1838,23 +3370,23 @@ var RedeemRow = ({
1838
3370
  target: href ? "_blank" : void 0,
1839
3371
  rel: href ? "noopener noreferrer" : void 0,
1840
3372
  onClick,
1841
- children: /* @__PURE__ */ jsx4(
3373
+ children: /* @__PURE__ */ jsx9(
1842
3374
  ConditionalWrapper,
1843
3375
  {
1844
3376
  condition: !!activity.errorMessage,
1845
- wrapper: (children) => /* @__PURE__ */ jsx4(
3377
+ wrapper: (children) => /* @__PURE__ */ jsx9(
1846
3378
  Tooltip,
1847
3379
  {
1848
3380
  size: "medium",
1849
- content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
1850
- /* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
1851
- /* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
3381
+ content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
3382
+ /* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
3383
+ /* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
1852
3384
  ] }),
1853
3385
  sideOffset: 4,
1854
3386
  children
1855
3387
  }
1856
3388
  ),
1857
- children: /* @__PURE__ */ jsxs4(
3389
+ children: /* @__PURE__ */ jsxs8(
1858
3390
  "div",
1859
3391
  {
1860
3392
  className: cn(
@@ -1863,10 +3395,10 @@ var RedeemRow = ({
1863
3395
  ),
1864
3396
  "data-status": activityStatus,
1865
3397
  children: [
1866
- /* @__PURE__ */ jsx4(RedeemTypeCell, { activity, tone }),
1867
- /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
1868
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
1869
- /* @__PURE__ */ jsx4(
3398
+ /* @__PURE__ */ jsx9(RedeemTypeCell, { activity, tone }),
3399
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
3400
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
3401
+ /* @__PURE__ */ jsx9(
1870
3402
  Icon,
1871
3403
  {
1872
3404
  name: "gift-bonus",
@@ -1877,7 +3409,7 @@ var RedeemRow = ({
1877
3409
  )
1878
3410
  }
1879
3411
  ),
1880
- /* @__PURE__ */ jsx4(
3412
+ /* @__PURE__ */ jsx9(
1881
3413
  "p",
1882
3414
  {
1883
3415
  className: cn(
@@ -1889,11 +3421,11 @@ var RedeemRow = ({
1889
3421
  }
1890
3422
  )
1891
3423
  ] }),
1892
- /* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone })
3424
+ /* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone })
1893
3425
  ] }),
1894
- /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
1895
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
1896
- /* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx4(
3426
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
3427
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
3428
+ /* @__PURE__ */ jsx9("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx9(
1897
3429
  RemoteImage,
1898
3430
  {
1899
3431
  src: activity.thumbnailSrc,
@@ -1902,9 +3434,9 @@ var RedeemRow = ({
1902
3434
  classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
1903
3435
  }
1904
3436
  ) }),
1905
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
1906
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center gap-2", children: [
1907
- /* @__PURE__ */ jsx4(
3437
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1 sm:gap-2", children: [
3438
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2", children: [
3439
+ /* @__PURE__ */ jsx9(
1908
3440
  "p",
1909
3441
  {
1910
3442
  className: cn(
@@ -1914,13 +3446,13 @@ var RedeemRow = ({
1914
3446
  children: activity.title
1915
3447
  }
1916
3448
  ),
1917
- shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx4(
3449
+ shouldShowInlineStatus ? statusVisual.spin ? /* @__PURE__ */ jsx9(
1918
3450
  LoadingIcon,
1919
3451
  {
1920
3452
  size: "small",
1921
3453
  className: cn("shrink-0", statusVisual.iconClassName)
1922
3454
  }
1923
- ) : /* @__PURE__ */ jsx4(
3455
+ ) : /* @__PURE__ */ jsx9(
1924
3456
  Icon,
1925
3457
  {
1926
3458
  name: statusVisual.icon,
@@ -1929,9 +3461,9 @@ var RedeemRow = ({
1929
3461
  }
1930
3462
  ) : null
1931
3463
  ] }),
1932
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
1933
- /* @__PURE__ */ jsx4("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx4(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
1934
- /* @__PURE__ */ jsx4(
3464
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: [
3465
+ /* @__PURE__ */ jsx9("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx9(OutcomeBadge, { label: activity.outcomeLabel, tone }) }),
3466
+ /* @__PURE__ */ jsx9(
1935
3467
  "p",
1936
3468
  {
1937
3469
  className: cn(
@@ -1944,7 +3476,7 @@ var RedeemRow = ({
1944
3476
  ] })
1945
3477
  ] })
1946
3478
  ] }),
1947
- /* @__PURE__ */ jsx4(
3479
+ /* @__PURE__ */ jsx9(
1948
3480
  AmountTimeStack,
1949
3481
  {
1950
3482
  amountLabel: activity.amountLabel,
@@ -1954,7 +3486,7 @@ var RedeemRow = ({
1954
3486
  }
1955
3487
  )
1956
3488
  ] }),
1957
- /* @__PURE__ */ jsx4(
3489
+ /* @__PURE__ */ jsx9(
1958
3490
  AmountTimeStack,
1959
3491
  {
1960
3492
  amountLabel: activity.amountLabel,
@@ -1977,23 +3509,23 @@ var TradeRow = ({
1977
3509
  onClick
1978
3510
  }) => {
1979
3511
  const tone = resolveToneClasses(activity);
1980
- return /* @__PURE__ */ jsx4(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsx4(
3512
+ return /* @__PURE__ */ jsx9(RowWrapper, { className: cn(className), href, onClick, children: /* @__PURE__ */ jsx9(
1981
3513
  ConditionalWrapper,
1982
3514
  {
1983
3515
  condition: !!activity.errorMessage,
1984
- wrapper: (children) => /* @__PURE__ */ jsx4(
3516
+ wrapper: (children) => /* @__PURE__ */ jsx9(
1985
3517
  Tooltip,
1986
3518
  {
1987
3519
  size: "medium",
1988
- content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
1989
- /* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
1990
- /* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
3520
+ content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
3521
+ /* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
3522
+ /* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
1991
3523
  ] }),
1992
3524
  sideOffset: 4,
1993
3525
  children
1994
3526
  }
1995
3527
  ),
1996
- children: /* @__PURE__ */ jsxs4(
3528
+ children: /* @__PURE__ */ jsxs8(
1997
3529
  "div",
1998
3530
  {
1999
3531
  className: cn(
@@ -2001,10 +3533,10 @@ var TradeRow = ({
2001
3533
  "relative z-10"
2002
3534
  ),
2003
3535
  children: [
2004
- /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
2005
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2006
- /* @__PURE__ */ jsx4(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
2007
- /* @__PURE__ */ jsx4(
3536
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:hidden", children: [
3537
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
3538
+ /* @__PURE__ */ jsx9(VenueLogo, { venue: activity.venue, size: "small", className: "size-5 shrink-0" }),
3539
+ /* @__PURE__ */ jsx9(
2008
3540
  "p",
2009
3541
  {
2010
3542
  className: cn(
@@ -2016,12 +3548,12 @@ var TradeRow = ({
2016
3548
  }
2017
3549
  )
2018
3550
  ] }),
2019
- /* @__PURE__ */ jsx4("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
3551
+ /* @__PURE__ */ jsx9("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx9(TradeOutcomeShares, { activity, tone }) })
2020
3552
  ] }),
2021
- /* @__PURE__ */ jsx4(TradeTypeCell, { activity, tone }),
2022
- /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
2023
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
2024
- /* @__PURE__ */ jsx4("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx4(
3553
+ /* @__PURE__ */ jsx9(TradeTypeCell, { activity, tone }),
3554
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
3555
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
3556
+ /* @__PURE__ */ jsx9("div", { className: "agg-activity-image flex h-10 w-10 shrink-0 items-center justify-center sm:h-15 sm:w-15", children: /* @__PURE__ */ jsx9(
2025
3557
  RemoteImage,
2026
3558
  {
2027
3559
  src: activity.thumbnailSrc,
@@ -2030,8 +3562,8 @@ var TradeRow = ({
2030
3562
  classNames: { placeholder: "rounded-agg-sm sm:rounded-agg-lg" }
2031
3563
  }
2032
3564
  ) }),
2033
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
2034
- /* @__PURE__ */ jsx4(
3565
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
3566
+ /* @__PURE__ */ jsx9(
2035
3567
  "p",
2036
3568
  {
2037
3569
  className: cn(
@@ -2041,10 +3573,10 @@ var TradeRow = ({
2041
3573
  children: activity.title
2042
3574
  }
2043
3575
  ),
2044
- /* @__PURE__ */ jsx4("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx4(TradeOutcomeShares, { activity, tone }) })
3576
+ /* @__PURE__ */ jsx9("div", { className: "hidden flex-wrap items-center gap-2 sm:flex sm:gap-3", children: /* @__PURE__ */ jsx9(TradeOutcomeShares, { activity, tone }) })
2045
3577
  ] })
2046
3578
  ] }),
2047
- /* @__PURE__ */ jsx4(
3579
+ /* @__PURE__ */ jsx9(
2048
3580
  AmountTimeStack,
2049
3581
  {
2050
3582
  amountLabel: activity.amountLabel,
@@ -2054,7 +3586,7 @@ var TradeRow = ({
2054
3586
  }
2055
3587
  )
2056
3588
  ] }),
2057
- /* @__PURE__ */ jsx4(
3589
+ /* @__PURE__ */ jsx9(
2058
3590
  AmountTimeStack,
2059
3591
  {
2060
3592
  amountLabel: activity.amountLabel,
@@ -2078,7 +3610,7 @@ var TransferRow = ({
2078
3610
  const transferStatus = resolveActivityStatus(activity);
2079
3611
  const transferIconName = TRANSFER_ICON[activity.kind];
2080
3612
  const statusVisual = getStatusVisual(activity);
2081
- return /* @__PURE__ */ jsx4(
3613
+ return /* @__PURE__ */ jsx9(
2082
3614
  RowWrapper,
2083
3615
  {
2084
3616
  className,
@@ -2086,23 +3618,23 @@ var TransferRow = ({
2086
3618
  target: href ? "_blank" : void 0,
2087
3619
  rel: href ? "noopener noreferrer" : void 0,
2088
3620
  onClick,
2089
- children: /* @__PURE__ */ jsx4(
3621
+ children: /* @__PURE__ */ jsx9(
2090
3622
  ConditionalWrapper,
2091
3623
  {
2092
3624
  condition: !!activity.errorMessage,
2093
- wrapper: (children) => /* @__PURE__ */ jsx4(
3625
+ wrapper: (children) => /* @__PURE__ */ jsx9(
2094
3626
  Tooltip,
2095
3627
  {
2096
3628
  size: "medium",
2097
- content: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-4", children: [
2098
- /* @__PURE__ */ jsx4(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
2099
- /* @__PURE__ */ jsx4("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
3629
+ content: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-4", children: [
3630
+ /* @__PURE__ */ jsx9(Icon, { name: "info", size: "small", className: "shrink-0 text-agg-error" }),
3631
+ /* @__PURE__ */ jsx9("p", { className: "font-agg-sans text-agg-sm font-agg-normal text-left", children: activity.errorMessage })
2100
3632
  ] }),
2101
3633
  sideOffset: 4,
2102
3634
  children
2103
3635
  }
2104
3636
  ),
2105
- children: /* @__PURE__ */ jsxs4(
3637
+ children: /* @__PURE__ */ jsxs8(
2106
3638
  "div",
2107
3639
  {
2108
3640
  className: cn(
@@ -2110,9 +3642,9 @@ var TransferRow = ({
2110
3642
  "relative z-10"
2111
3643
  ),
2112
3644
  children: [
2113
- /* @__PURE__ */ jsx4(TransferTypeCell, { activity, tone }),
2114
- /* @__PURE__ */ jsx4("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
2115
- /* @__PURE__ */ jsx4(
3645
+ /* @__PURE__ */ jsx9(TransferTypeCell, { activity, tone }),
3646
+ /* @__PURE__ */ jsx9("div", { className: "flex w-full items-center justify-between sm:hidden", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
3647
+ /* @__PURE__ */ jsx9(
2116
3648
  Icon,
2117
3649
  {
2118
3650
  name: transferIconName,
@@ -2123,7 +3655,7 @@ var TransferRow = ({
2123
3655
  )
2124
3656
  }
2125
3657
  ),
2126
- /* @__PURE__ */ jsx4(
3658
+ /* @__PURE__ */ jsx9(
2127
3659
  "p",
2128
3660
  {
2129
3661
  className: cn(
@@ -2135,14 +3667,14 @@ var TransferRow = ({
2135
3667
  }
2136
3668
  )
2137
3669
  ] }) }),
2138
- /* @__PURE__ */ jsxs4("div", { className: "flex w-full items-center justify-between sm:contents", children: [
2139
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
2140
- /* @__PURE__ */ jsx4(
3670
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between sm:contents", children: [
3671
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
3672
+ /* @__PURE__ */ jsx9(
2141
3673
  "div",
2142
3674
  {
2143
3675
  className: "agg-activity-deposit-square hidden h-15 w-15 shrink-0 items-center justify-center rounded-agg-lg bg-agg-secondary-hover sm:flex",
2144
3676
  "data-status": transferStatus,
2145
- children: statusVisual.spin ? /* @__PURE__ */ jsx4(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx4(
3677
+ children: statusVisual.spin ? /* @__PURE__ */ jsx9(LoadingIcon, { size: "medium", className: cn(statusVisual.iconClassName) }) : /* @__PURE__ */ jsx9(
2146
3678
  Icon,
2147
3679
  {
2148
3680
  name: statusVisual.icon,
@@ -2152,8 +3684,8 @@ var TransferRow = ({
2152
3684
  )
2153
3685
  }
2154
3686
  ),
2155
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
2156
- /* @__PURE__ */ jsx4(
3687
+ /* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-1", children: [
3688
+ /* @__PURE__ */ jsx9(
2157
3689
  "p",
2158
3690
  {
2159
3691
  className: cn(
@@ -2163,7 +3695,7 @@ var TransferRow = ({
2163
3695
  children: activity.title
2164
3696
  }
2165
3697
  ),
2166
- /* @__PURE__ */ jsx4(
3698
+ /* @__PURE__ */ jsx9(
2167
3699
  "p",
2168
3700
  {
2169
3701
  className: cn(
@@ -2175,7 +3707,7 @@ var TransferRow = ({
2175
3707
  )
2176
3708
  ] })
2177
3709
  ] }),
2178
- /* @__PURE__ */ jsx4(
3710
+ /* @__PURE__ */ jsx9(
2179
3711
  AmountTimeStack,
2180
3712
  {
2181
3713
  amountLabel: activity.amountLabel,
@@ -2185,7 +3717,7 @@ var TransferRow = ({
2185
3717
  }
2186
3718
  )
2187
3719
  ] }),
2188
- /* @__PURE__ */ jsx4(
3720
+ /* @__PURE__ */ jsx9(
2189
3721
  AmountTimeStack,
2190
3722
  {
2191
3723
  amountLabel: activity.amountLabel,
@@ -2213,10 +3745,10 @@ var ActivityRow = ({ activity, href, onClick }) => {
2213
3745
  "before:bg-agg-secondary-hover before:rounded-agg-xl"
2214
3746
  );
2215
3747
  if (activity.kind === "trade") {
2216
- return /* @__PURE__ */ jsx4(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
3748
+ return /* @__PURE__ */ jsx9(TradeRow, { activity, className: sharedClassName, href, onClick: handleClick });
2217
3749
  }
2218
3750
  if (activity.kind === "redeem") {
2219
- return /* @__PURE__ */ jsx4(
3751
+ return /* @__PURE__ */ jsx9(
2220
3752
  RedeemRow,
2221
3753
  {
2222
3754
  activity,
@@ -2226,7 +3758,7 @@ var ActivityRow = ({ activity, href, onClick }) => {
2226
3758
  }
2227
3759
  );
2228
3760
  }
2229
- return /* @__PURE__ */ jsx4(
3761
+ return /* @__PURE__ */ jsx9(
2230
3762
  TransferRow,
2231
3763
  {
2232
3764
  activity,
@@ -2239,19 +3771,19 @@ var ActivityRow = ({ activity, href, onClick }) => {
2239
3771
  ActivityRow.displayName = "ActivityRow";
2240
3772
 
2241
3773
  // src/pages/user-profile/components/empty-state.tsx
2242
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
3774
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2243
3775
  var EmptyState = ({ title, description, className }) => {
2244
- return /* @__PURE__ */ jsx5(
3776
+ return /* @__PURE__ */ jsx10(
2245
3777
  "div",
2246
3778
  {
2247
3779
  className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
2248
3780
  role: "status",
2249
3781
  "aria-live": "polite",
2250
- children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-5", children: [
2251
- /* @__PURE__ */ jsx5(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
2252
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
2253
- /* @__PURE__ */ jsx5("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
2254
- description ? /* @__PURE__ */ jsx5("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
3782
+ children: /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center gap-5", children: [
3783
+ /* @__PURE__ */ jsx10(SearchEmptyIcon, { className: "h-10 w-10 text-agg-muted-foreground", "aria-hidden": true }),
3784
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
3785
+ /* @__PURE__ */ jsx10("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
3786
+ description ? /* @__PURE__ */ jsx10("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
2255
3787
  ] })
2256
3788
  ] })
2257
3789
  }
@@ -2260,8 +3792,12 @@ var EmptyState = ({ title, description, className }) => {
2260
3792
  EmptyState.displayName = "EmptyState";
2261
3793
 
2262
3794
  // src/pages/user-profile/components/position-row.tsx
2263
- import { optimizedImageUrl, useLabels as useLabels4 } from "@agg-build/hooks";
2264
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3795
+ import { optimizedImageUrl, useLabels as useLabels6 } from "@agg-build/hooks";
3796
+ import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3797
+ var floorToTwoDecimals = (value) => {
3798
+ if (!Number.isFinite(value) || value <= 0) return 0;
3799
+ return Math.trunc(value * 100) / 100;
3800
+ };
2265
3801
  var shouldUseNativeLinkNavigation2 = (event) => {
2266
3802
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
2267
3803
  };
@@ -2270,25 +3806,36 @@ var toneTextClassName = (tone) => {
2270
3806
  if (tone === "negative") return "text-agg-error";
2271
3807
  return "text-agg-muted-foreground";
2272
3808
  };
2273
- var OutcomePill = ({ label }) => /* @__PURE__ */ jsx6("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx6("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
2274
- var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx6("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx6("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
3809
+ var OutcomePill = ({ label }) => /* @__PURE__ */ jsx11("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ jsx11("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label }) });
3810
+ var ResolutionPill = ({ label }) => /* @__PURE__ */ jsx11("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ jsx11("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label }) });
2275
3811
  var VenueShares = ({
2276
3812
  model,
3813
+ totalSharesLabel,
2277
3814
  className,
2278
3815
  keyPrefix
2279
3816
  }) => {
2280
- if (model.venueShareBreakdown.length === 0) return null;
2281
- return /* @__PURE__ */ jsx6("div", { className, children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsxs6(
2282
- "div",
2283
- {
2284
- className: "flex items-center gap-1",
2285
- children: [
2286
- /* @__PURE__ */ jsx6(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" }),
2287
- /* @__PURE__ */ jsx6("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: row.sharesLabel })
2288
- ]
2289
- },
2290
- `${keyPrefix}-${row.venue}-${row.sharesLabel}-${String(index)}`
2291
- )) });
3817
+ if (!totalSharesLabel && model.venueShareBreakdown.length === 0) return null;
3818
+ return /* @__PURE__ */ jsxs10("div", { className: cn(className, "gap-2"), children: [
3819
+ model.venueShareBreakdown.length > 0 ? /* @__PURE__ */ jsx11("div", { className: "flex items-center gap-1", children: model.venueShareBreakdown.map((row, index) => /* @__PURE__ */ jsx11(
3820
+ Tooltip,
3821
+ {
3822
+ content: /* @__PURE__ */ jsx11("span", { children: row.sharesLabel }),
3823
+ "aria-label": `${row.venue} shares`,
3824
+ side: "top",
3825
+ children: /* @__PURE__ */ jsx11(
3826
+ "span",
3827
+ {
3828
+ tabIndex: 0,
3829
+ className: "cursor-help rounded-agg-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
3830
+ "aria-label": `${row.venue} shares`,
3831
+ children: /* @__PURE__ */ jsx11(VenueLogo, { venue: row.venue, size: "small", className: "size-4 shrink-0" })
3832
+ }
3833
+ )
3834
+ },
3835
+ `${keyPrefix}-${row.venue}-${String(index)}`
3836
+ )) }) : null,
3837
+ totalSharesLabel ? /* @__PURE__ */ jsx11("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: totalSharesLabel }) : null
3838
+ ] });
2292
3839
  };
2293
3840
  var StatusBadge = ({
2294
3841
  status,
@@ -2296,7 +3843,7 @@ var StatusBadge = ({
2296
3843
  }) => {
2297
3844
  if (status === "lost" || status === "won_claimed") return null;
2298
3845
  const isWon = status === "won_unclaimed";
2299
- return /* @__PURE__ */ jsxs6(
3846
+ return /* @__PURE__ */ jsxs10(
2300
3847
  "span",
2301
3848
  {
2302
3849
  className: cn(
@@ -2305,7 +3852,7 @@ var StatusBadge = ({
2305
3852
  isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-foreground"
2306
3853
  ),
2307
3854
  children: [
2308
- /* @__PURE__ */ jsx6(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
3855
+ /* @__PURE__ */ jsx11(Icon, { name: isWon ? "check-circle" : "hourglass-start", size: "small", className: "size-2.5!" }),
2309
3856
  isWon ? labels.won : labels.open
2310
3857
  ]
2311
3858
  }
@@ -2318,7 +3865,7 @@ var ResultBadge = ({
2318
3865
  if (status !== "won_claimed" && status !== "lost" && status !== "sold") return null;
2319
3866
  const isWon = status === "won_claimed";
2320
3867
  const isSold = status === "sold";
2321
- return /* @__PURE__ */ jsxs6(
3868
+ return /* @__PURE__ */ jsxs10(
2322
3869
  "span",
2323
3870
  {
2324
3871
  className: cn(
@@ -2327,7 +3874,7 @@ var ResultBadge = ({
2327
3874
  isWon ? "border-agg-success/50 bg-agg-success/10 text-agg-success" : isSold ? "border-agg-muted-foreground/30 bg-agg-secondary-hover text-agg-muted-foreground" : "border-agg-error/50 bg-agg-error/10 text-agg-error"
2328
3875
  ),
2329
3876
  children: [
2330
- /* @__PURE__ */ jsx6(
3877
+ /* @__PURE__ */ jsx11(
2331
3878
  Icon,
2332
3879
  {
2333
3880
  name: isWon ? "check-circle" : isSold ? "hourglass-start" : "cross-circle",
@@ -2343,27 +3890,27 @@ var ResultBadge = ({
2343
3890
  var TotalTradedCell = ({
2344
3891
  model,
2345
3892
  className
2346
- }) => /* @__PURE__ */ jsxs6(
3893
+ }) => /* @__PURE__ */ jsxs10(
2347
3894
  "div",
2348
3895
  {
2349
3896
  className: cn("agg-position-total-traded flex flex-col gap-[2px] whitespace-nowrap", className),
2350
3897
  children: [
2351
- /* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
2352
- /* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
3898
+ /* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: model.totalTraded.primaryLabel }),
3899
+ /* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: model.totalTraded.averageLabel })
2353
3900
  ]
2354
3901
  }
2355
3902
  );
2356
3903
  var PositionValueCell = ({
2357
3904
  value,
2358
3905
  className
2359
- }) => /* @__PURE__ */ jsxs6(
3906
+ }) => /* @__PURE__ */ jsxs10(
2360
3907
  "div",
2361
3908
  {
2362
3909
  className: cn("agg-position-value-cell flex flex-col gap-[2px] whitespace-nowrap", className),
2363
3910
  children: [
2364
- /* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
2365
- /* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
2366
- /* @__PURE__ */ jsx6(
3911
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-baseline gap-1.5", children: [
3912
+ /* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: value.primaryLabel }),
3913
+ /* @__PURE__ */ jsx11(
2367
3914
  "p",
2368
3915
  {
2369
3916
  className: cn(
@@ -2374,9 +3921,9 @@ var PositionValueCell = ({
2374
3921
  }
2375
3922
  )
2376
3923
  ] }),
2377
- /* @__PURE__ */ jsxs6("div", { className: "flex items-baseline gap-1.5", children: [
2378
- /* @__PURE__ */ jsx6("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
2379
- /* @__PURE__ */ jsx6(
3924
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-baseline gap-1.5", children: [
3925
+ /* @__PURE__ */ jsx11("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: value.priceLabel }),
3926
+ /* @__PURE__ */ jsx11(
2380
3927
  "p",
2381
3928
  {
2382
3929
  className: cn(
@@ -2398,13 +3945,14 @@ var PositionRow = ({
2398
3945
  onClaim,
2399
3946
  isClaiming = false
2400
3947
  }) => {
2401
- const labels = useLabels4().userProfile.positions;
3948
+ const labels = useLabels6().userProfile.positions;
2402
3949
  const model = toPositionRowViewModel(position, {
2403
3950
  avgPrefix: labels.avgPrefix,
2404
3951
  nowPrefix: labels.nowPrefix,
2405
3952
  finalPrefix: labels.finalPrefix
2406
3953
  });
2407
3954
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
3955
+ const totalSharesLabel = typeof position.totalShares === "number" && Number.isFinite(position.totalShares) ? `${String(floorToTwoDecimals(position.totalShares))} shares` : null;
2408
3956
  const handleClaim = (event) => {
2409
3957
  event.preventDefault();
2410
3958
  event.stopPropagation();
@@ -2439,7 +3987,7 @@ var PositionRow = ({
2439
3987
  handleDivClick();
2440
3988
  }
2441
3989
  };
2442
- return /* @__PURE__ */ jsx6(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs6(
3990
+ return /* @__PURE__ */ jsx11(Wrapper, __spreadProps(__spreadValues({ className: sharedClassName }, wrapperProps), { children: /* @__PURE__ */ jsxs10(
2443
3991
  "div",
2444
3992
  {
2445
3993
  className: cn(
@@ -2447,9 +3995,9 @@ var PositionRow = ({
2447
3995
  isClosed ? "md:gap-8" : "md:gap-6"
2448
3996
  ),
2449
3997
  children: [
2450
- /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
2451
- /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
2452
- /* @__PURE__ */ jsx6("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx6(
3998
+ /* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between gap-3 md:w-auto md:min-w-0 md:flex-1 md:justify-start md:gap-4", children: [
3999
+ /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 items-center gap-3 md:gap-4", children: [
4000
+ /* @__PURE__ */ jsx11("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ jsx11(
2453
4001
  RemoteImage,
2454
4002
  {
2455
4003
  src: optimizedImageUrl(model.thumbnailSrc, 60),
@@ -2457,14 +4005,15 @@ var PositionRow = ({
2457
4005
  className: "h-full w-full rounded-agg-sm object-cover"
2458
4006
  }
2459
4007
  ) }),
2460
- /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 flex-1 flex-col", children: [
2461
- /* @__PURE__ */ jsx6("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
2462
- /* @__PURE__ */ jsxs6("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
2463
- /* @__PURE__ */ jsx6(OutcomePill, { label: model.selectedOutcomeLabel }),
2464
- /* @__PURE__ */ jsx6(
4008
+ /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 flex-1 flex-col", children: [
4009
+ /* @__PURE__ */ jsx11("p", { className: "agg-position-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] md:block md:truncate md:text-agg-base md:leading-agg-6", children: model.title }),
4010
+ /* @__PURE__ */ jsxs10("div", { className: "hidden min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 pt-1 md:flex", children: [
4011
+ /* @__PURE__ */ jsx11(OutcomePill, { label: model.selectedOutcomeLabel }),
4012
+ /* @__PURE__ */ jsx11(
2465
4013
  VenueShares,
2466
4014
  {
2467
4015
  model,
4016
+ totalSharesLabel,
2468
4017
  keyPrefix: "desktop",
2469
4018
  className: "agg-position-venues flex flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2"
2470
4019
  }
@@ -2472,25 +4021,26 @@ var PositionRow = ({
2472
4021
  ] })
2473
4022
  ] })
2474
4023
  ] }),
2475
- /* @__PURE__ */ jsx6("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx6(OutcomePill, { label: model.selectedOutcomeLabel }) })
4024
+ /* @__PURE__ */ jsx11("div", { className: "flex shrink-0 items-center justify-end md:hidden", children: /* @__PURE__ */ jsx11(OutcomePill, { label: model.selectedOutcomeLabel }) })
2476
4025
  ] }),
2477
- isClosed ? /* @__PURE__ */ jsx6("div", { className: "md:hidden", children: /* @__PURE__ */ jsx6(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
2478
- /* @__PURE__ */ jsx6(
4026
+ isClosed ? /* @__PURE__ */ jsx11("div", { className: "md:hidden", children: /* @__PURE__ */ jsx11(ResolutionPill, { label: `${labels.resolutionHeader}: ${model.resolutionLabel}` }) }) : null,
4027
+ /* @__PURE__ */ jsx11(
2479
4028
  VenueShares,
2480
4029
  {
2481
4030
  model,
4031
+ totalSharesLabel,
2482
4032
  keyPrefix: "mobile",
2483
4033
  className: "agg-position-venues flex min-w-0 flex-1 flex-wrap content-center items-center gap-x-3 gap-y-2 md:hidden"
2484
4034
  }
2485
4035
  ),
2486
- /* @__PURE__ */ jsxs6("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
2487
- /* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 items-center gap-5", children: [
2488
- /* @__PURE__ */ jsx6(TotalTradedCell, { model }),
2489
- /* @__PURE__ */ jsx6(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
4036
+ /* @__PURE__ */ jsxs10("div", { className: "flex w-full items-center justify-between gap-3 md:hidden", children: [
4037
+ /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-5", children: [
4038
+ /* @__PURE__ */ jsx11(TotalTradedCell, { model }),
4039
+ /* @__PURE__ */ jsx11(PositionValueCell, { value: isClosed ? model.payout : model.currentValue })
2490
4040
  ] }),
2491
- isClosed ? /* @__PURE__ */ jsx6(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
2492
- /* @__PURE__ */ jsx6(StatusBadge, { status: model.positionStatus, labels }),
2493
- model.canClaim ? /* @__PURE__ */ jsxs6(
4041
+ isClosed ? /* @__PURE__ */ jsx11(ResultBadge, { status: model.positionStatus, labels }) : /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 flex-col items-start justify-center gap-2", children: [
4042
+ /* @__PURE__ */ jsx11(StatusBadge, { status: model.positionStatus, labels }),
4043
+ model.canClaim ? /* @__PURE__ */ jsxs10(
2494
4044
  "button",
2495
4045
  {
2496
4046
  type: "button",
@@ -2499,48 +4049,48 @@ var PositionRow = ({
2499
4049
  disabled: isClaiming,
2500
4050
  "aria-busy": isClaiming || void 0,
2501
4051
  children: [
2502
- isClaiming ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
4052
+ isClaiming ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
2503
4053
  labels.claim
2504
4054
  ]
2505
4055
  }
2506
4056
  ) : null
2507
4057
  ] })
2508
4058
  ] }),
2509
- isClosed ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
2510
- /* @__PURE__ */ jsx6("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx6(ResolutionPill, { label: model.resolutionLabel }) }),
2511
- /* @__PURE__ */ jsx6(
4059
+ isClosed ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
4060
+ /* @__PURE__ */ jsx11("div", { className: "hidden w-[90px] shrink-0 md:block lg:w-[120px]", children: /* @__PURE__ */ jsx11(ResolutionPill, { label: model.resolutionLabel }) }),
4061
+ /* @__PURE__ */ jsx11(
2512
4062
  TotalTradedCell,
2513
4063
  {
2514
4064
  model,
2515
4065
  className: "hidden w-[110px] shrink-0 md:flex lg:w-[130px]"
2516
4066
  }
2517
4067
  ),
2518
- /* @__PURE__ */ jsx6(
4068
+ /* @__PURE__ */ jsx11(
2519
4069
  PositionValueCell,
2520
4070
  {
2521
4071
  value: model.payout,
2522
4072
  className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
2523
4073
  }
2524
4074
  ),
2525
- /* @__PURE__ */ jsx6("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx6(ResultBadge, { status: model.positionStatus, labels }) })
2526
- ] }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
2527
- /* @__PURE__ */ jsx6(
4075
+ /* @__PURE__ */ jsx11("div", { className: "hidden w-[60px] shrink-0 items-center md:flex", children: /* @__PURE__ */ jsx11(ResultBadge, { status: model.positionStatus, labels }) })
4076
+ ] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
4077
+ /* @__PURE__ */ jsx11(
2528
4078
  TotalTradedCell,
2529
4079
  {
2530
4080
  model,
2531
4081
  className: "hidden w-[120px] shrink-0 md:flex lg:w-[140px]"
2532
4082
  }
2533
4083
  ),
2534
- /* @__PURE__ */ jsx6(
4084
+ /* @__PURE__ */ jsx11(
2535
4085
  PositionValueCell,
2536
4086
  {
2537
4087
  value: model.currentValue,
2538
4088
  className: "hidden w-[130px] shrink-0 md:flex lg:w-[160px]"
2539
4089
  }
2540
4090
  ),
2541
- /* @__PURE__ */ jsxs6("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
2542
- /* @__PURE__ */ jsx6(StatusBadge, { status: model.positionStatus, labels }),
2543
- model.canClaim ? /* @__PURE__ */ jsxs6(
4091
+ /* @__PURE__ */ jsxs10("div", { className: "hidden w-[100px] shrink-0 items-center gap-3 md:flex", children: [
4092
+ /* @__PURE__ */ jsx11(StatusBadge, { status: model.positionStatus, labels }),
4093
+ model.canClaim ? /* @__PURE__ */ jsxs10(
2544
4094
  "button",
2545
4095
  {
2546
4096
  type: "button",
@@ -2549,14 +4099,14 @@ var PositionRow = ({
2549
4099
  disabled: isClaiming,
2550
4100
  "aria-busy": isClaiming || void 0,
2551
4101
  children: [
2552
- isClaiming ? /* @__PURE__ */ jsx6(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
4102
+ isClaiming ? /* @__PURE__ */ jsx11(LoadingIcon, { size: "small", className: "text-agg-primary" }) : null,
2553
4103
  labels.claim
2554
4104
  ]
2555
4105
  }
2556
4106
  ) : null
2557
4107
  ] })
2558
4108
  ] }),
2559
- /* @__PURE__ */ jsx6("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx6(
4109
+ /* @__PURE__ */ jsx11("div", { className: "hidden w-5 shrink-0 items-center justify-end md:flex", children: /* @__PURE__ */ jsx11(
2560
4110
  Icon,
2561
4111
  {
2562
4112
  name: "chevron-right",
@@ -2571,16 +4121,16 @@ var PositionRow = ({
2571
4121
  PositionRow.displayName = "PositionRow";
2572
4122
 
2573
4123
  // src/pages/user-profile/components/positions-activity.tsx
2574
- import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
4124
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2575
4125
  var tabItems = [
2576
4126
  { value: USER_PROFILE_TAB_POSITIONS, label: "Positions" },
2577
4127
  // Open orders is intentionally hidden from the user-profile tab group.
2578
4128
  // Restore by re-adding USER_PROFILE_TAB_OPEN_ORDERS here and the renderer below.
2579
4129
  { value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
2580
4130
  ];
2581
- var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx7("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
2582
- /* @__PURE__ */ jsx7("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
2583
- index < acc.length - 1 ? /* @__PURE__ */ jsx7("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
4131
+ var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ jsx12("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
4132
+ /* @__PURE__ */ jsx12("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
4133
+ index < acc.length - 1 ? /* @__PURE__ */ jsx12("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
2584
4134
  ] }, index)) });
2585
4135
  var PositionsActivity = ({
2586
4136
  activePositions = [],
@@ -2611,9 +4161,9 @@ var PositionsActivity = ({
2611
4161
  initialPositionFilter = "active",
2612
4162
  className
2613
4163
  }) => {
2614
- const positionsLabels = useLabels5().userProfile.positions;
4164
+ const positionsLabels = useLabels7().userProfile.positions;
2615
4165
  const isTabControlled = tab !== void 0;
2616
- const [internalActiveTab, setInternalActiveTab] = useState5(
4166
+ const [internalActiveTab, setInternalActiveTab] = useState10(
2617
4167
  tab != null ? tab : USER_PROFILE_TAB_POSITIONS
2618
4168
  );
2619
4169
  const activeTab = isTabControlled ? tab : internalActiveTab;
@@ -2621,19 +4171,19 @@ var PositionsActivity = ({
2621
4171
  if (!isTabControlled) setInternalActiveTab(next);
2622
4172
  onTabChange == null ? void 0 : onTabChange(next);
2623
4173
  };
2624
- const [positionFilter, setPositionFilter] = useState5(initialPositionFilter);
2625
- const [searchValue, setSearchValue] = useState5("");
2626
- const [isSearchFocused, setIsSearchFocused] = useState5(false);
2627
- const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState5(
4174
+ const [positionFilter, setPositionFilter] = useState10(initialPositionFilter);
4175
+ const [searchValue, setSearchValue] = useState10("");
4176
+ const [isSearchFocused, setIsSearchFocused] = useState10(false);
4177
+ const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = useState10(
2628
4178
  () => /* @__PURE__ */ new Set()
2629
4179
  );
2630
- const positionsLoadMoreRef = useRef4(null);
2631
- const activitiesLoadMoreRef = useRef4(null);
2632
- const rowsScrollRef = useRef4(null);
4180
+ const positionsLoadMoreRef = useRef8(null);
4181
+ const activitiesLoadMoreRef = useRef8(null);
4182
+ const rowsScrollRef = useRef8(null);
2633
4183
  const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
2634
4184
  const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
2635
4185
  const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
2636
- const positionsForCurrentFilter = useMemo3(() => {
4186
+ const positionsForCurrentFilter = useMemo6(() => {
2637
4187
  if (positionFilter === "active") {
2638
4188
  return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
2639
4189
  }
@@ -2650,7 +4200,7 @@ var PositionsActivity = ({
2650
4200
  }
2651
4201
  return Array.from(byId.values());
2652
4202
  }, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
2653
- const filteredPositions = useMemo3(() => {
4203
+ const filteredPositions = useMemo6(() => {
2654
4204
  if (!searchValue.trim()) return positionsForCurrentFilter;
2655
4205
  const q = searchValue.toLowerCase();
2656
4206
  return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
@@ -2675,7 +4225,7 @@ var PositionsActivity = ({
2675
4225
  const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
2676
4226
  const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
2677
4227
  const filteredActivities = activities;
2678
- const searchResults = useMemo3(() => {
4228
+ const searchResults = useMemo6(() => {
2679
4229
  if (!isPositionsTab || !searchValue.trim()) return [];
2680
4230
  return filteredPositions.slice(0, 5).map((position) => ({
2681
4231
  id: position.id,
@@ -2693,11 +4243,11 @@ var PositionsActivity = ({
2693
4243
  const handleSearchChange = (event) => {
2694
4244
  setSearchValue(event.target.value);
2695
4245
  };
2696
- useEffect4(() => {
4246
+ useEffect9(() => {
2697
4247
  if (isPositionsTab) return;
2698
4248
  setIsSearchFocused(false);
2699
4249
  }, [isPositionsTab]);
2700
- useEffect4(() => {
4250
+ useEffect9(() => {
2701
4251
  if (!isPositionsTab || !hasMorePositions) return;
2702
4252
  const target = positionsLoadMoreRef.current;
2703
4253
  if (!target || !loadMorePositions) return;
@@ -2719,7 +4269,7 @@ var PositionsActivity = ({
2719
4269
  isPositionsTab,
2720
4270
  loadMorePositions
2721
4271
  ]);
2722
- useEffect4(() => {
4272
+ useEffect9(() => {
2723
4273
  if (!isActivityTab || !hasMoreActivities) return;
2724
4274
  const target = activitiesLoadMoreRef.current;
2725
4275
  if (!target || !onLoadMoreActivities) return;
@@ -2741,7 +4291,7 @@ var PositionsActivity = ({
2741
4291
  isLoadingMoreActivities,
2742
4292
  onLoadMoreActivities
2743
4293
  ]);
2744
- return /* @__PURE__ */ jsxs7(
4294
+ return /* @__PURE__ */ jsxs11(
2745
4295
  "div",
2746
4296
  {
2747
4297
  className: cn(
@@ -2750,7 +4300,7 @@ var PositionsActivity = ({
2750
4300
  className
2751
4301
  ),
2752
4302
  children: [
2753
- /* @__PURE__ */ jsx7(
4303
+ /* @__PURE__ */ jsx12(
2754
4304
  Tabs,
2755
4305
  {
2756
4306
  items: tabItems,
@@ -2764,7 +4314,7 @@ var PositionsActivity = ({
2764
4314
  }
2765
4315
  }
2766
4316
  ),
2767
- /* @__PURE__ */ jsxs7(
4317
+ /* @__PURE__ */ jsxs11(
2768
4318
  "div",
2769
4319
  {
2770
4320
  className: cn(
@@ -2772,12 +4322,12 @@ var PositionsActivity = ({
2772
4322
  isPositionsTab ? "pt-4 md:pt-6" : "pt-0 md:pt-6"
2773
4323
  ),
2774
4324
  children: [
2775
- isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
2776
- /* @__PURE__ */ jsx7("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
4325
+ isPositionsTab ? /* @__PURE__ */ jsxs11("div", { className: "agg-toolbar flex flex-row items-start gap-3 px-4 sm:gap-5 sm:px-6", children: [
4326
+ /* @__PURE__ */ jsx12("div", { className: "agg-position-filters flex h-10 w-[45%] max-w-[169px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto sm:min-w-[200px] sm:max-w-[270px]", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
2777
4327
  const isActive = filter.value === positionFilter;
2778
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 items-stretch", children: [
2779
- idx > 0 ? /* @__PURE__ */ jsx7("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
2780
- /* @__PURE__ */ jsx7(
4328
+ return /* @__PURE__ */ jsxs11("div", { className: "flex flex-1 items-stretch", children: [
4329
+ idx > 0 ? /* @__PURE__ */ jsx12("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
4330
+ /* @__PURE__ */ jsx12(
2781
4331
  "button",
2782
4332
  {
2783
4333
  type: "button",
@@ -2792,7 +4342,7 @@ var PositionsActivity = ({
2792
4342
  )
2793
4343
  ] }, filter.value);
2794
4344
  }) }),
2795
- /* @__PURE__ */ jsxs7(
4345
+ /* @__PURE__ */ jsxs11(
2796
4346
  "div",
2797
4347
  {
2798
4348
  className: "agg-position-search relative flex w-full min-w-0 flex-1",
@@ -2803,9 +4353,9 @@ var PositionsActivity = ({
2803
4353
  setIsSearchFocused(false);
2804
4354
  },
2805
4355
  children: [
2806
- /* @__PURE__ */ jsx7("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs7("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
2807
- /* @__PURE__ */ jsx7(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
2808
- /* @__PURE__ */ jsx7(
4356
+ /* @__PURE__ */ jsx12("label", { className: "flex w-full min-w-0 flex-1", children: /* @__PURE__ */ jsxs11("div", { className: "flex h-11 w-full items-center gap-3 rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5 focus-within:border-2 focus-within:border-agg-primary sm:h-10", children: [
4357
+ /* @__PURE__ */ jsx12(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
4358
+ /* @__PURE__ */ jsx12(
2809
4359
  "input",
2810
4360
  {
2811
4361
  value: searchValue,
@@ -2820,7 +4370,7 @@ var PositionsActivity = ({
2820
4370
  }
2821
4371
  )
2822
4372
  ] }) }),
2823
- isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx7("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ jsx7(
4373
+ isSearchFocused && searchValue.trim() ? /* @__PURE__ */ jsx12("div", { className: "agg-position-search-results absolute left-0 right-0 top-full z-50 mt-1 w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary pt-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]", children: searchResults.length > 0 ? /* @__PURE__ */ jsx12(
2824
4374
  "ul",
2825
4375
  {
2826
4376
  className: "agg-position-search-results-list m-0 flex list-none flex-col p-0",
@@ -2833,9 +4383,9 @@ var PositionsActivity = ({
2833
4383
  setIsSearchFocused(false);
2834
4384
  onPositionClick == null ? void 0 : onPositionClick(item.raw);
2835
4385
  };
2836
- const innerContent = /* @__PURE__ */ jsxs7(Fragment5, { children: [
2837
- /* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
2838
- /* @__PURE__ */ jsx7(
4386
+ const innerContent = /* @__PURE__ */ jsxs11(Fragment5, { children: [
4387
+ /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
4388
+ /* @__PURE__ */ jsx12(
2839
4389
  "img",
2840
4390
  {
2841
4391
  src: optimizedImageUrl2(item.thumbnailSrc, 48),
@@ -2843,16 +4393,16 @@ var PositionsActivity = ({
2843
4393
  className: "size-12 shrink-0 rounded-agg-lg object-cover"
2844
4394
  }
2845
4395
  ),
2846
- /* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
2847
- /* @__PURE__ */ jsx7("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
2848
- /* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
2849
- /* @__PURE__ */ jsx7("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
2850
- /* @__PURE__ */ jsx7("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
2851
- /* @__PURE__ */ jsx7("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
4396
+ /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
4397
+ /* @__PURE__ */ jsx12("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: item.title }),
4398
+ /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 items-center gap-2 text-agg-muted-foreground", children: [
4399
+ /* @__PURE__ */ jsx12("p", { className: "shrink-0 whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaPrimary }),
4400
+ /* @__PURE__ */ jsx12("span", { className: "text-agg-muted-foreground", "aria-hidden": true, children: "\xB7" }),
4401
+ /* @__PURE__ */ jsx12("p", { className: "min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: item.metaSecondary })
2852
4402
  ] })
2853
4403
  ] })
2854
4404
  ] }),
2855
- /* @__PURE__ */ jsx7(
4405
+ /* @__PURE__ */ jsx12(
2856
4406
  Icon,
2857
4407
  {
2858
4408
  name: "chevron-right",
@@ -2861,7 +4411,7 @@ var PositionsActivity = ({
2861
4411
  }
2862
4412
  )
2863
4413
  ] });
2864
- return /* @__PURE__ */ jsx7(
4414
+ return /* @__PURE__ */ jsx12(
2865
4415
  "li",
2866
4416
  {
2867
4417
  role: "presentation",
@@ -2869,7 +4419,7 @@ var PositionsActivity = ({
2869
4419
  "agg-position-search-result-item",
2870
4420
  index > 0 && "border-t border-agg-separator"
2871
4421
  ),
2872
- children: itemHref ? /* @__PURE__ */ jsx7(
4422
+ children: itemHref ? /* @__PURE__ */ jsx12(
2873
4423
  "a",
2874
4424
  {
2875
4425
  href: itemHref,
@@ -2884,7 +4434,7 @@ var PositionsActivity = ({
2884
4434
  },
2885
4435
  children: innerContent
2886
4436
  }
2887
- ) : /* @__PURE__ */ jsx7(
4437
+ ) : /* @__PURE__ */ jsx12(
2888
4438
  "button",
2889
4439
  {
2890
4440
  type: "button",
@@ -2898,34 +4448,34 @@ var PositionsActivity = ({
2898
4448
  );
2899
4449
  })
2900
4450
  }
2901
- ) : /* @__PURE__ */ jsx7("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
4451
+ ) : /* @__PURE__ */ jsx12("div", { className: "px-5 py-6 font-agg-sans text-agg-sm leading-agg-5 text-agg-muted-foreground", children: positionsLabels.noResults }) }) : null
2902
4452
  ]
2903
4453
  }
2904
4454
  )
2905
4455
  ] }) : null,
2906
- /* @__PURE__ */ jsxs7("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
2907
- /* @__PURE__ */ jsxs7("div", { className: "w-full px-4 sm:px-6", children: [
2908
- isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
2909
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
2910
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
2911
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
2912
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
2913
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
2914
- /* @__PURE__ */ jsx7("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
2915
- ] }) : /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
2916
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
2917
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
2918
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
2919
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
2920
- /* @__PURE__ */ jsx7("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
4456
+ /* @__PURE__ */ jsxs11("div", { className: "agg-positions-table-wrapper flex w-full gap-0 flex-col", children: [
4457
+ /* @__PURE__ */ jsxs11("div", { className: "w-full px-4 sm:px-6", children: [
4458
+ isPositionsTab && filteredPositions.length > 0 ? isClosedPositionsFilter ? /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-8 px-0 md:flex", children: [
4459
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
4460
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[90px] shrink-0 lg:w-[120px]", children: positionsLabels.resolutionHeader }),
4461
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[110px] shrink-0 lg:w-[130px]", children: positionsLabels.totalTradedHeader }),
4462
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.payoutHeader }),
4463
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[60px] shrink-0", children: positionsLabels.resultHeader }),
4464
+ /* @__PURE__ */ jsx12("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
4465
+ ] }) : /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
4466
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: positionsLabels.marketHeader }),
4467
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 lg:w-[140px]", children: positionsLabels.totalTradedHeader }),
4468
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[130px] shrink-0 lg:w-[160px]", children: positionsLabels.currentValueHeader }),
4469
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[100px] shrink-0", children: positionsLabels.statusHeader }),
4470
+ /* @__PURE__ */ jsx12("span", { className: "hidden w-5 shrink-0 sm:block", "aria-hidden": true })
2921
4471
  ] }) : null,
2922
- isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs7("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
2923
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
2924
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
2925
- /* @__PURE__ */ jsx7("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
4472
+ isActivityTab && filteredActivities.length > 0 ? /* @__PURE__ */ jsxs11("div", { className: "hidden items-start gap-6 px-0 md:flex", children: [
4473
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-22 shrink-0", children: "Type" }),
4474
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header min-w-0 flex-1", children: "Market" }),
4475
+ /* @__PURE__ */ jsx12("p", { className: "agg-user-profile-table-header w-[120px] shrink-0 text-right", children: "Amount" })
2926
4476
  ] }) : null
2927
4477
  ] }),
2928
- /* @__PURE__ */ jsx7(
4478
+ /* @__PURE__ */ jsx12(
2929
4479
  "div",
2930
4480
  {
2931
4481
  ref: rowsScrollRef,
@@ -2937,8 +4487,8 @@ var PositionsActivity = ({
2937
4487
  "[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-agg-muted-foreground/50",
2938
4488
  "[&::-webkit-scrollbar-thumb:hover]:bg-agg-muted-foreground/70"
2939
4489
  ),
2940
- children: isPositionsTab ? /* @__PURE__ */ jsxs7("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
2941
- isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx7(
4490
+ children: isPositionsTab ? /* @__PURE__ */ jsxs11("div", { className: "agg-portfolio-list flex flex-col gap-5", children: [
4491
+ isLoadingPositions && filteredPositions.length === 0 ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading positions" }) : positionsError && filteredPositions.length === 0 ? /* @__PURE__ */ jsx12(
2942
4492
  EmptyState,
2943
4493
  {
2944
4494
  title: "Unable to load positions",
@@ -2946,15 +4496,15 @@ var PositionsActivity = ({
2946
4496
  }
2947
4497
  ) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
2948
4498
  var _a;
2949
- return /* @__PURE__ */ jsxs7(Fragment4, { children: [
2950
- index > 0 ? /* @__PURE__ */ jsx7(
4499
+ return /* @__PURE__ */ jsxs11(Fragment4, { children: [
4500
+ index > 0 ? /* @__PURE__ */ jsx12(
2951
4501
  "div",
2952
4502
  {
2953
4503
  className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator",
2954
4504
  "aria-hidden": true
2955
4505
  }
2956
4506
  ) : null,
2957
- /* @__PURE__ */ jsx7(
4507
+ /* @__PURE__ */ jsx12(
2958
4508
  PositionRow,
2959
4509
  {
2960
4510
  position,
@@ -2968,15 +4518,15 @@ var PositionsActivity = ({
2968
4518
  }
2969
4519
  )
2970
4520
  ] }, position.id);
2971
- }) : /* @__PURE__ */ jsx7(
4521
+ }) : /* @__PURE__ */ jsx12(
2972
4522
  EmptyState,
2973
4523
  {
2974
4524
  title: "No positions yet",
2975
4525
  description: "Your open trades will appear here once you place an order."
2976
4526
  }
2977
4527
  ),
2978
- isLoadingMorePositions ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
2979
- hasMorePositions ? /* @__PURE__ */ jsx7(
4528
+ isLoadingMorePositions ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading more positions" }) : null,
4529
+ hasMorePositions ? /* @__PURE__ */ jsx12(
2980
4530
  "div",
2981
4531
  {
2982
4532
  ref: positionsLoadMoreRef,
@@ -2984,22 +4534,22 @@ var PositionsActivity = ({
2984
4534
  "aria-hidden": true
2985
4535
  }
2986
4536
  ) : null
2987
- ] }) : /* @__PURE__ */ jsxs7("div", { className: "agg-activity-list flex flex-col gap-5", children: [
2988
- isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx7(
4537
+ ] }) : /* @__PURE__ */ jsxs11("div", { className: "agg-activity-list flex flex-col gap-5", children: [
4538
+ isLoadingActivities && filteredActivities.length === 0 ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading activity" }) : activitiesError && filteredActivities.length === 0 ? /* @__PURE__ */ jsx12(
2989
4539
  EmptyState,
2990
4540
  {
2991
4541
  title: "Unable to load activity",
2992
4542
  description: "Please try again in a moment."
2993
4543
  }
2994
- ) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs7(Fragment4, { children: [
2995
- index > 0 ? /* @__PURE__ */ jsx7(
4544
+ ) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
4545
+ index > 0 ? /* @__PURE__ */ jsx12(
2996
4546
  "div",
2997
4547
  {
2998
4548
  className: "agg-activity-divider h-px w-full shrink-0 bg-agg-separator",
2999
4549
  "aria-hidden": true
3000
4550
  }
3001
4551
  ) : null,
3002
- /* @__PURE__ */ jsx7(
4552
+ /* @__PURE__ */ jsx12(
3003
4553
  ActivityRow,
3004
4554
  {
3005
4555
  activity,
@@ -3007,15 +4557,15 @@ var PositionsActivity = ({
3007
4557
  onClick: onActivityClick
3008
4558
  }
3009
4559
  )
3010
- ] }, activity.id)) : /* @__PURE__ */ jsx7(
4560
+ ] }, activity.id)) : /* @__PURE__ */ jsx12(
3011
4561
  EmptyState,
3012
4562
  {
3013
4563
  title: "No activity yet",
3014
4564
  description: "Your trading activity will appear here."
3015
4565
  }
3016
4566
  ),
3017
- isLoadingMoreActivities ? /* @__PURE__ */ jsx7(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
3018
- hasMoreActivities ? /* @__PURE__ */ jsx7(
4567
+ isLoadingMoreActivities ? /* @__PURE__ */ jsx12(TabRowsSkeleton, { ariaLabel: "Loading more activity" }) : null,
4568
+ hasMoreActivities ? /* @__PURE__ */ jsx12(
3019
4569
  "div",
3020
4570
  {
3021
4571
  ref: activitiesLoadMoreRef,
@@ -3037,14 +4587,14 @@ var PositionsActivity = ({
3037
4587
  PositionsActivity.displayName = "PositionsActivity";
3038
4588
 
3039
4589
  // src/pages/user-profile/components/positions-value-card.tsx
3040
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
4590
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
3041
4591
  var PositionsValueCard = ({
3042
4592
  label = "Positions Value",
3043
4593
  valueLabel,
3044
4594
  isLoading = false,
3045
4595
  className
3046
4596
  }) => {
3047
- return /* @__PURE__ */ jsxs8(
4597
+ return /* @__PURE__ */ jsxs12(
3048
4598
  "div",
3049
4599
  {
3050
4600
  className: cn(
@@ -3053,8 +4603,8 @@ var PositionsValueCard = ({
3053
4603
  className
3054
4604
  ),
3055
4605
  children: [
3056
- /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
3057
- /* @__PURE__ */ jsx8(
4606
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
4607
+ /* @__PURE__ */ jsx13(
3058
4608
  "svg",
3059
4609
  {
3060
4610
  xmlns: "http://www.w3.org/2000/svg",
@@ -3062,7 +4612,7 @@ var PositionsValueCard = ({
3062
4612
  height: "16",
3063
4613
  viewBox: "0 0 16 16",
3064
4614
  fill: "none",
3065
- children: /* @__PURE__ */ jsx8(
4615
+ children: /* @__PURE__ */ jsx13(
3066
4616
  "path",
3067
4617
  {
3068
4618
  d: "M16 7.99957C16 8.36757 15.702 8.66623 15.3333 8.66623H13.6893C13.388 8.66623 13.1233 8.86957 13.0453 9.15957L11.9273 13.3209C11.8 13.7376 11.444 13.9996 11.0333 13.9996H11.022C10.6067 13.9949 10.252 13.7229 10.1393 13.3236L7.95667 4.50623L5.838 11.9989C5.71067 12.3969 5.378 12.6496 4.98467 12.6649C4.57667 12.6869 4.23867 12.4549 4.088 12.0902L3.02133 9.10757C2.926 8.84357 2.674 8.66557 2.39333 8.66557H0.666667C0.298 8.66557 0 8.3669 0 7.9989C0 7.6309 0.298 7.33223 0.666667 7.33223H2.394C3.23667 7.33223 3.99267 7.8649 4.27733 8.65823L4.90267 10.4089L7.092 2.66557C7.226 2.2489 7.57667 1.9809 7.99933 1.9989C8.41133 2.00623 8.76333 2.27757 8.876 2.67357L11.0487 11.4509L11.7567 8.81357C11.9907 7.94157 12.7847 7.33223 13.688 7.33223H15.332C15.7007 7.33223 15.9987 7.6309 15.9987 7.9989L16 7.99957Z",
@@ -3071,9 +4621,9 @@ var PositionsValueCard = ({
3071
4621
  )
3072
4622
  }
3073
4623
  ),
3074
- /* @__PURE__ */ jsx8("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
4624
+ /* @__PURE__ */ jsx13("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground", children: label })
3075
4625
  ] }),
3076
- /* @__PURE__ */ jsx8("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx8("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx8(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
4626
+ /* @__PURE__ */ jsx13("div", { className: "agg-portfolio-value font-agg-sans text-agg-2xl leading-8 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ jsx13("div", { role: "status", "aria-label": "Loading positions value", children: /* @__PURE__ */ jsx13(SkeletonBlock, { className: "h-8 w-24 rounded-agg-sm" }) }) : valueLabel })
3077
4627
  ]
3078
4628
  }
3079
4629
  );
@@ -3081,12 +4631,12 @@ var PositionsValueCard = ({
3081
4631
  PositionsValueCard.displayName = "PositionsValueCard";
3082
4632
 
3083
4633
  // src/pages/user-profile/components/user-info-card.tsx
3084
- import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels6 } from "@agg-build/hooks";
4634
+ import { optimizedImageUrl as optimizedImageUrl3, useLabels as useLabels8 } from "@agg-build/hooks";
3085
4635
 
3086
4636
  // src/pages/user-profile/components/default-avatar.tsx
3087
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
4637
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
3088
4638
  var DefaultAvatar = ({ className }) => {
3089
- return /* @__PURE__ */ jsxs9(
4639
+ return /* @__PURE__ */ jsxs13(
3090
4640
  "svg",
3091
4641
  {
3092
4642
  xmlns: "http://www.w3.org/2000/svg",
@@ -3097,15 +4647,15 @@ var DefaultAvatar = ({ className }) => {
3097
4647
  className: cn("shrink-0 text-agg-muted-foreground", className),
3098
4648
  "aria-hidden": true,
3099
4649
  children: [
3100
- /* @__PURE__ */ jsxs9("g", { clipPath: "url(#clip0_default_avatar)", children: [
3101
- /* @__PURE__ */ jsx9(
4650
+ /* @__PURE__ */ jsxs13("g", { clipPath: "url(#clip0_default_avatar)", children: [
4651
+ /* @__PURE__ */ jsx14(
3102
4652
  "path",
3103
4653
  {
3104
4654
  d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
3105
4655
  fill: "var(--agg-color-secondary-hover)"
3106
4656
  }
3107
4657
  ),
3108
- /* @__PURE__ */ jsx9(
4658
+ /* @__PURE__ */ jsx14(
3109
4659
  "path",
3110
4660
  {
3111
4661
  d: "M60 120C93.1371 120 120 93.1371 120 60C120 26.8629 93.1371 0 60 0C26.8629 0 0 26.8629 0 60C0 93.1371 26.8629 120 60 120Z",
@@ -3113,7 +4663,7 @@ var DefaultAvatar = ({ className }) => {
3113
4663
  fillOpacity: "0.12"
3114
4664
  }
3115
4665
  ),
3116
- /* @__PURE__ */ jsx9(
4666
+ /* @__PURE__ */ jsx14(
3117
4667
  "path",
3118
4668
  {
3119
4669
  d: "M73.7338 64.1259C80.4187 59.6756 84.8276 52.0804 84.8276 43.4487C84.8276 29.7376 73.7111 18.6211 60 18.6211C46.2890 18.6211 35.1724 29.7376 35.1724 43.4487C35.1724 52.0804 39.5814 59.6756 46.2662 64.1259C46.2662 64.1259 46.2683 64.1280 46.2704 64.1280C46.2683 64.1280 46.2683 64.1259 46.2683 64.1259C30.2669 68.9487 17.8076 81.9356 13.7959 98.2742L13.7980 98.2763C14.4518 99.0645 15.1304 99.8342 15.8235 100.589C15.9911 100.774 16.1669 100.949 16.3387 101.129C16.8724 101.696 17.4124 102.255 17.9669 102.801C18.1966 103.027 18.4304 103.244 18.6642 103.465C19.1773 103.954 19.6966 104.436 20.2262 104.905C20.4890 105.137 20.7559 105.367 21.0207 105.594C21.5400 106.039 22.0656 106.476 22.6014 106.902C22.8828 107.127 23.1662 107.349 23.4497 107.570C23.9918 107.988 24.5421 108.394 25.0987 108.791C25.3862 108.996 25.6697 109.205 25.9614 109.405C26.5490 109.811 27.1469 110.200 27.7490 110.585C28.0200 110.756 28.2849 110.934 28.5580 111.104C29.2531 111.532 29.9607 111.942 30.6745 112.343C30.8628 112.449 31.0469 112.562 31.2373 112.666C32.1600 113.171 33.0973 113.655 34.0490 114.112C34.0718 114.122 34.0966 114.133 34.1193 114.143C35.0276 114.578 35.9504 114.989 36.8835 115.378C37.1731 115.500 37.4690 115.608 37.7607 115.724C38.4352 115.993 39.1097 116.258 39.7966 116.502C40.1607 116.632 40.5290 116.750 40.8952 116.874C41.5200 117.085 42.1490 117.290 42.7821 117.478C43.1835 117.598 43.5869 117.710 43.9924 117.822C44.6049 117.991 45.2214 118.153 45.8442 118.304C46.2642 118.405 46.6862 118.502 47.1104 118.596C47.7331 118.732 48.3580 118.856 48.9869 118.972C49.4131 119.051 49.8373 119.131 50.2676 119.200C50.9173 119.305 51.5711 119.394 52.2269 119.479C52.6407 119.533 53.0524 119.593 53.4683 119.636C54.1924 119.715 54.9228 119.771 55.6531 119.822C56.0069 119.847 56.3566 119.885 56.7104 119.903C57.8007 119.965 58.8952 120 60 120C61.1049 120 62.1993 119.965 63.2897 119.907C63.6435 119.889 63.9952 119.851 64.3469 119.827C65.0793 119.775 65.8097 119.719 66.5318 119.640C66.9476 119.595 67.3593 119.537 67.7731 119.483C68.4290 119.398 69.0828 119.309 69.7324 119.204C70.1607 119.134 70.5869 119.055 71.0131 118.976C71.6421 118.860 72.2690 118.736 72.8897 118.600C73.3138 118.507 73.7359 118.409 74.1559 118.308C74.7766 118.157 75.3931 117.996 76.0076 117.826C76.4111 117.714 76.8166 117.602 77.2180 117.482C77.8531 117.292 78.4800 117.087 79.1049 116.878C79.4711 116.754 79.8414 116.636 80.2035 116.506C80.8883 116.260 81.5649 115.997 82.2393 115.728C82.5311 115.612 82.8269 115.502 83.1166 115.382C84.0456 114.994 84.9642 114.586 85.8683 114.151C85.8952 114.139 85.9242 114.127 85.9511 114.114C86.9028 113.657 87.8400 113.173 88.7628 112.668C88.9531 112.565 89.1373 112.451 89.3256 112.345C90.0393 111.944 90.7469 111.534 91.4421 111.106C91.7152 110.938 91.9821 110.760 92.2511 110.587C92.8531 110.202 93.4511 109.811 94.0387 109.407C94.3283 109.207 94.6138 109.000 94.9014 108.793C95.4580 108.394 96.0083 107.988 96.5504 107.572C96.8359 107.353 97.1173 107.129 97.3987 106.904C97.9324 106.478 98.4600 106.041 98.9793 105.596C99.2462 105.369 99.5131 105.139 99.7738 104.907C100.303 104.438 100.823 103.956 101.336 103.467C101.568 103.246 101.803 103.027 102.033 102.803C102.588 102.257 103.130 101.698 103.661 101.131C103.831 100.949 104.007 100.774 104.177 100.591C104.870 99.8363 105.548 99.0666 106.202 98.2783L106.204 98.2763C102.195 81.9356 89.7352 68.9487 73.7338 64.1259Z",
@@ -3122,7 +4672,7 @@ var DefaultAvatar = ({ className }) => {
3122
4672
  }
3123
4673
  )
3124
4674
  ] }),
3125
- /* @__PURE__ */ jsx9("defs", { children: /* @__PURE__ */ jsx9("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx9("rect", { width: "120", height: "120", fill: "white" }) }) })
4675
+ /* @__PURE__ */ jsx14("defs", { children: /* @__PURE__ */ jsx14("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ jsx14("rect", { width: "120", height: "120", fill: "white" }) }) })
3126
4676
  ]
3127
4677
  }
3128
4678
  );
@@ -3130,7 +4680,7 @@ var DefaultAvatar = ({ className }) => {
3130
4680
  DefaultAvatar.displayName = "DefaultAvatar";
3131
4681
 
3132
4682
  // src/pages/user-profile/components/user-info-card.tsx
3133
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
4683
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
3134
4684
  var UserInfoCard = ({
3135
4685
  user,
3136
4686
  onEditProfile,
@@ -3140,10 +4690,10 @@ var UserInfoCard = ({
3140
4690
  className
3141
4691
  }) => {
3142
4692
  var _a;
3143
- const labels = useLabels6();
4693
+ const labels = useLabels8();
3144
4694
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
3145
4695
  const hasWallets = wallets.length > 0;
3146
- return /* @__PURE__ */ jsxs10(
4696
+ return /* @__PURE__ */ jsxs14(
3147
4697
  "div",
3148
4698
  {
3149
4699
  className: cn(
@@ -3152,26 +4702,26 @@ var UserInfoCard = ({
3152
4702
  className
3153
4703
  ),
3154
4704
  children: [
3155
- /* @__PURE__ */ jsxs10("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
3156
- /* @__PURE__ */ jsx10("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx10(
4705
+ /* @__PURE__ */ jsxs14("div", { className: "agg-profile-header flex w-full flex-row flex-wrap items-center gap-4 sm:gap-5 pt-5", children: [
4706
+ /* @__PURE__ */ jsx15("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ jsx15(
3157
4707
  RemoteImage,
3158
4708
  {
3159
4709
  src: optimizedImageUrl3(user.avatarUrl, 120),
3160
4710
  alt: user.username,
3161
4711
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
3162
4712
  }
3163
- ) : /* @__PURE__ */ jsx10(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
3164
- /* @__PURE__ */ jsxs10("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
3165
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
3166
- /* @__PURE__ */ jsxs10("div", { className: "flex min-w-0 items-center gap-2", children: [
3167
- /* @__PURE__ */ jsx10("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
3168
- user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
4713
+ ) : /* @__PURE__ */ jsx15(DefaultAvatar, { className: "h-20 w-20 rounded-full sm:h-[120px] sm:w-[120px]" }) }),
4714
+ /* @__PURE__ */ jsxs14("div", { className: "agg-profile-details flex min-w-0 w-full flex-1 flex-col gap-3 sm:gap-4", children: [
4715
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:gap-4", children: [
4716
+ /* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2", children: [
4717
+ /* @__PURE__ */ jsx15("h2", { className: "truncate text-[22px] leading-7 font-agg-bold text-agg-foreground sm:agg-type-heading", children: user.username }),
4718
+ user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ jsx15("div", { className: "agg-profile-social-links flex items-center gap-2", children: user.socialLinks.map((social) => {
3169
4719
  const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
3170
- const iconNode = /* @__PURE__ */ jsx10("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ jsx10(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
4720
+ const iconNode = /* @__PURE__ */ jsx15("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary sm:size-8", children: /* @__PURE__ */ jsx15(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) });
3171
4721
  if (!social.handle) {
3172
- return /* @__PURE__ */ jsx10("span", { children: iconNode }, `${social.platform}-icon`);
4722
+ return /* @__PURE__ */ jsx15("span", { children: iconNode }, `${social.platform}-icon`);
3173
4723
  }
3174
- return /* @__PURE__ */ jsx10(
4724
+ return /* @__PURE__ */ jsx15(
3175
4725
  "a",
3176
4726
  {
3177
4727
  href: social.handle,
@@ -3184,55 +4734,55 @@ var UserInfoCard = ({
3184
4734
  );
3185
4735
  }) }) : null
3186
4736
  ] }),
3187
- onEditProfile ? /* @__PURE__ */ jsxs10(
4737
+ onEditProfile ? /* @__PURE__ */ jsxs14(
3188
4738
  "button",
3189
4739
  {
3190
4740
  type: "button",
3191
4741
  onClick: onEditProfile,
3192
4742
  className: "hidden sm:flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
3193
4743
  children: [
3194
- /* @__PURE__ */ jsx10(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
3195
- /* @__PURE__ */ jsx10("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
4744
+ /* @__PURE__ */ jsx15(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
4745
+ /* @__PURE__ */ jsx15("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
3196
4746
  ]
3197
4747
  }
3198
4748
  ) : null
3199
4749
  ] }),
3200
- hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs10("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
4750
+ hasWallets || !!user.socialHandle ? /* @__PURE__ */ jsxs14("div", { className: "agg-profile-accounts flex w-full flex-col gap-2.5 sm:gap-3", children: [
3201
4751
  wallets.map((wallet, idx) => {
3202
4752
  const chainLower = wallet.chain.toLowerCase();
3203
4753
  const iconName = chainLower === "solana" || chainLower === "svm" ? "solana" : "ethereum";
3204
- return /* @__PURE__ */ jsxs10(
4754
+ return /* @__PURE__ */ jsxs14(
3205
4755
  "div",
3206
4756
  {
3207
4757
  className: "flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",
3208
4758
  children: [
3209
- /* @__PURE__ */ jsx10("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx10(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
3210
- /* @__PURE__ */ jsx10("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
4759
+ /* @__PURE__ */ jsx15("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx15(Icon, { name: iconName, size: "small", className: "text-agg-foreground" }) }),
4760
+ /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: wallet.displayAddress })
3211
4761
  ]
3212
4762
  },
3213
4763
  `wallet-${idx}`
3214
4764
  );
3215
4765
  }),
3216
- user.socialHandle ? /* @__PURE__ */ jsx10("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx10("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
4766
+ user.socialHandle ? /* @__PURE__ */ jsx15("div", { className: "flex min-w-0 items-center gap-2 sm:gap-3", children: /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate text-agg-sm font-agg-normal leading-5 text-agg-foreground sm:text-agg-base sm:leading-6", children: user.socialHandle }) }) : null
3217
4767
  ] }) : null
3218
4768
  ] })
3219
4769
  ] }),
3220
- (onDeposit || onWithdraw) && /* @__PURE__ */ jsxs10("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
3221
- onDeposit ? /* @__PURE__ */ jsx10(
4770
+ (onDeposit || onWithdraw) && /* @__PURE__ */ jsxs14("div", { className: "agg-profile-actions flex w-full flex-1 items-center gap-3 py-5", children: [
4771
+ onDeposit ? /* @__PURE__ */ jsx15(
3222
4772
  ConditionalWrapper,
3223
4773
  {
3224
4774
  condition: isDepositBlocked,
3225
- wrapper: (children) => /* @__PURE__ */ jsx10(
4775
+ wrapper: (children) => /* @__PURE__ */ jsx15(
3226
4776
  Tooltip,
3227
4777
  {
3228
- content: /* @__PURE__ */ jsx10("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
4778
+ content: /* @__PURE__ */ jsx15("p", { className: "text-center", children: labels.auth.depositGeoBlocked }),
3229
4779
  size: "small",
3230
4780
  side: "bottom",
3231
4781
  sideOffset: 4,
3232
4782
  children
3233
4783
  }
3234
4784
  ),
3235
- children: /* @__PURE__ */ jsx10(
4785
+ children: /* @__PURE__ */ jsx15(
3236
4786
  Button,
3237
4787
  __spreadProps(__spreadValues({
3238
4788
  variant: "primary",
@@ -3244,7 +4794,7 @@ var UserInfoCard = ({
3244
4794
  )
3245
4795
  }
3246
4796
  ) : null,
3247
- onWithdraw ? /* @__PURE__ */ jsx10(
4797
+ onWithdraw ? /* @__PURE__ */ jsx15(
3248
4798
  Button,
3249
4799
  {
3250
4800
  variant: "secondary",
@@ -3254,15 +4804,15 @@ var UserInfoCard = ({
3254
4804
  children: labels.auth.withdraw
3255
4805
  }
3256
4806
  ) : null,
3257
- onEditProfile ? /* @__PURE__ */ jsxs10(
4807
+ onEditProfile ? /* @__PURE__ */ jsxs14(
3258
4808
  "button",
3259
4809
  {
3260
4810
  type: "button",
3261
4811
  onClick: onEditProfile,
3262
4812
  className: "flex sm:hidden shrink-0 cursor-pointer items-center gap-1.5 bg-transparent px-2 py-2 text-agg-primary hover:opacity-80",
3263
4813
  children: [
3264
- /* @__PURE__ */ jsx10(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
3265
- /* @__PURE__ */ jsx10("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
4814
+ /* @__PURE__ */ jsx15(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
4815
+ /* @__PURE__ */ jsx15("span", { className: "text-agg-sm font-agg-bold leading-5", children: "Edit" })
3266
4816
  ]
3267
4817
  }
3268
4818
  ) : null
@@ -3295,7 +4845,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
3295
4845
  };
3296
4846
 
3297
4847
  // src/pages/user-profile/index.tsx
3298
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4848
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
3299
4849
  var currencyFormatter = new Intl.NumberFormat("en-US", {
3300
4850
  style: "currency",
3301
4851
  currency: "USD",
@@ -3652,10 +5202,6 @@ function buildVenueShareBreakdown(outcome) {
3652
5202
  sharesLabel: `${twoDecimalNumberFormatter.format(row.size)} shares`
3653
5203
  }));
3654
5204
  }
3655
- var toClaimError = (err) => {
3656
- if (err instanceof Error) return err;
3657
- return new Error(String(err));
3658
- };
3659
5205
  var UserProfilePage = ({
3660
5206
  user,
3661
5207
  balanceChainsOverride,
@@ -3705,50 +5251,35 @@ var UserProfilePage = ({
3705
5251
  classNames,
3706
5252
  onError
3707
5253
  }) => {
3708
- const [isHydrated, setIsHydrated] = useState6(false);
3709
- useEffect5(() => {
5254
+ const [isHydrated, setIsHydrated] = useState11(false);
5255
+ useEffect10(() => {
3710
5256
  setIsHydrated(true);
3711
5257
  }, []);
3712
5258
  const { user: currentUser, isAuthenticated } = useAggAuthState();
3713
5259
  const { isDepositBlocked } = useGeoBlock();
3714
5260
  const balanceState = useAggBalance();
3715
5261
  const client = useAggClient();
3716
- const labels = useLabels7();
5262
+ const labels = useLabels9();
3717
5263
  const {
3718
5264
  trading: { executionMode: configuredExecutionMode }
3719
- } = useSdkUiConfig3();
3720
- const claimNotificationLabels = labels.notifications.claim;
3721
- const toastCtx = useOptionalToast();
5265
+ } = useSdkUiConfig5();
3722
5266
  const queryClient = useQueryClient();
3723
- const redeemMutation = useRedeem();
3724
- const [internalCancellingIds, setInternalCancellingIds] = useState6({});
3725
- const [activeRedeems, setActiveRedeems] = useState6({});
3726
- const activeClaimKeysRef = useRef5(/* @__PURE__ */ new Set());
3727
- const pendingClaimToastIdsRef = useRef5({});
3728
- const submittedClaimToastKeysRef = useRef5(/* @__PURE__ */ new Set());
3729
- const [submittingClaimKeys, setSubmittingClaimKeys] = useState6({});
3730
- const lifecycleInputs = useMemo4(
3731
- () => Object.values(activeRedeems),
3732
- [activeRedeems]
3733
- );
3734
- const lifecycleStates = useRedeemLifecycles(lifecycleInputs);
3735
- const internalClaimingIds = useMemo4(() => {
3736
- const out = __spreadValues({}, submittingClaimKeys);
3737
- for (const [claimKey, active] of Object.entries(activeRedeems)) {
3738
- const state = lifecycleStates[active.redeemId];
3739
- if (!state || !state.terminal) out[claimKey] = true;
3740
- }
3741
- return out;
3742
- }, [activeRedeems, lifecycleStates, submittingClaimKeys]);
3743
- const [profileUser, setProfileUser] = useState6(void 0);
5267
+ const [internalCancellingIds, setInternalCancellingIds] = useState11({});
5268
+ const { claim: startClaim, claimingKeys } = useClaimWinnings({
5269
+ onClaim,
5270
+ onClaimResult,
5271
+ onClaimSubmitError,
5272
+ externalClaimingKeys: claimingPositionKeys
5273
+ });
5274
+ const [profileUser, setProfileUser] = useState11(void 0);
3744
5275
  const shouldUseHookData = !user;
3745
- const connectedVenues = useMemo4(() => {
5276
+ const connectedVenues = useMemo7(() => {
3746
5277
  var _a;
3747
5278
  if (!shouldUseHookData) return [];
3748
5279
  const fromBalance = (_a = balanceState.connectedVenues) != null ? _a : [];
3749
5280
  return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
3750
5281
  }, [balanceState, shouldUseHookData]);
3751
- const [positionFilter, setPositionFilter] = useState6(initialPositionFilter);
5282
+ const [positionFilter, setPositionFilter] = useState11(initialPositionFilter);
3752
5283
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
3753
5284
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
3754
5285
  const activePositionsQuery = useExecutionPositions({
@@ -3763,14 +5294,14 @@ var UserProfilePage = ({
3763
5294
  limit: 25,
3764
5295
  mode: queryExecutionMode
3765
5296
  });
3766
- const handlePositionFilterChange = useCallback3(
5297
+ const handlePositionFilterChange = useCallback5(
3767
5298
  (filter) => {
3768
5299
  setPositionFilter(filter);
3769
5300
  onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
3770
5301
  },
3771
5302
  [onPositionFilterChangeProp]
3772
5303
  );
3773
- useEffect5(() => {
5304
+ useEffect10(() => {
3774
5305
  setPositionFilter(initialPositionFilter);
3775
5306
  }, [initialPositionFilter]);
3776
5307
  const ordersQuery = useExecutionOrders({
@@ -3782,7 +5313,7 @@ var UserProfilePage = ({
3782
5313
  enabled: shouldUseHookData && isAuthenticated,
3783
5314
  limit: 25
3784
5315
  });
3785
- const handleCancelOrder = useCallback3(
5316
+ const handleCancelOrder = useCallback5(
3786
5317
  (order) => __async(null, null, function* () {
3787
5318
  if (onCancelOrder) {
3788
5319
  onCancelOrder(order);
@@ -3802,208 +5333,18 @@ var UserProfilePage = ({
3802
5333
  }),
3803
5334
  [client, onCancelOrder, queryClient]
3804
5335
  );
3805
- const invalidateClaimUiState = useCallback3(() => {
3806
- invalidateBalanceQueries(queryClient);
3807
- invalidatePositionQueries(queryClient);
3808
- queryClient.invalidateQueries({
3809
- queryKey: executionKeys.claimablePositionsCount(),
3810
- refetchType: "active"
3811
- });
3812
- invalidateUserActivityQueries(queryClient);
3813
- }, [queryClient]);
3814
- const handleClaimPosition = useCallback3(
3815
- (position) => __async(null, null, function* () {
5336
+ const handleClaimPosition = useCallback5(
5337
+ (position) => {
3816
5338
  var _a, _b;
3817
- const claimKey = (_a = position.marketId) != null ? _a : position.id;
3818
- if (activeClaimKeysRef.current.has(claimKey) || (claimingPositionKeys == null ? void 0 : claimingPositionKeys[claimKey]) || internalClaimingIds[claimKey]) {
3819
- return;
3820
- }
3821
- activeClaimKeysRef.current.add(claimKey);
3822
- setSubmittingClaimKeys((prev) => __spreadProps(__spreadValues({}, prev), { [claimKey]: true }));
3823
- const pendingToastId = toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.pendingMessage, {
3824
- title: claimNotificationLabels.pendingTitle,
3825
- tone: "info"
5339
+ return startClaim({
5340
+ claimKey: (_a = position.marketId) != null ? _a : position.id,
5341
+ winningOutcomeIds: (_b = position.winningOutcomeIds) != null ? _b : [],
5342
+ payload: position
3826
5343
  });
3827
- if (pendingToastId != null) {
3828
- pendingClaimToastIdsRef.current[claimKey] = pendingToastId;
3829
- }
3830
- if (onClaim) {
3831
- try {
3832
- yield onClaim(position);
3833
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3834
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3835
- delete pendingClaimToastIdsRef.current[claimKey];
3836
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
3837
- title: claimNotificationLabels.successTitle,
3838
- tone: "success"
3839
- });
3840
- } catch (err) {
3841
- const error = toClaimError(err);
3842
- console.error("[UserProfilePage] redeem failed", error);
3843
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3844
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3845
- delete pendingClaimToastIdsRef.current[claimKey];
3846
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
3847
- title: claimNotificationLabels.failedTitle,
3848
- tone: "error"
3849
- });
3850
- onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
3851
- throw error;
3852
- } finally {
3853
- invalidateClaimUiState();
3854
- activeClaimKeysRef.current.delete(claimKey);
3855
- setSubmittingClaimKeys((prev) => {
3856
- const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
3857
- return rest;
3858
- });
3859
- }
3860
- return;
3861
- }
3862
- const venueMarketOutcomeIds = (_b = position.winningOutcomeIds) != null ? _b : [];
3863
- if (venueMarketOutcomeIds.length === 0) {
3864
- const error = new Error(claimNotificationLabels.missingOutcomeMessage);
3865
- console.error("[UserProfilePage] redeem failed", error);
3866
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3867
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3868
- delete pendingClaimToastIdsRef.current[claimKey];
3869
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
3870
- title: claimNotificationLabels.failedTitle,
3871
- tone: "error"
3872
- });
3873
- onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
3874
- invalidateClaimUiState();
3875
- activeClaimKeysRef.current.delete(claimKey);
3876
- setSubmittingClaimKeys((prev) => {
3877
- const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
3878
- return rest;
3879
- });
3880
- throw error;
3881
- }
3882
- try {
3883
- const response = yield redeemMutation.mutateAsync({ venueMarketOutcomeIds });
3884
- const expectedOutcomeIds = [];
3885
- const preFailedOutcomeIds = [];
3886
- const preFailedReasons = {};
3887
- const preConfirmedOutcomeIds = [];
3888
- const preConfirmedTxHashes = {};
3889
- for (const result of response.results) {
3890
- if (result.status === "submitted") {
3891
- expectedOutcomeIds.push(result.venueMarketOutcomeId);
3892
- } else if (result.status === "confirmed") {
3893
- preConfirmedOutcomeIds.push(result.venueMarketOutcomeId);
3894
- preConfirmedTxHashes[result.venueMarketOutcomeId] = result.txHash;
3895
- } else if (result.status === "ineligible" || result.status === "rejected") {
3896
- preFailedOutcomeIds.push(result.venueMarketOutcomeId);
3897
- preFailedReasons[result.venueMarketOutcomeId] = result.reason;
3898
- }
3899
- }
3900
- if (expectedOutcomeIds.length > 0) {
3901
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3902
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3903
- delete pendingClaimToastIdsRef.current[claimKey];
3904
- submittedClaimToastKeysRef.current.add(claimKey);
3905
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.submittedMessage, {
3906
- title: claimNotificationLabels.submittedTitle,
3907
- tone: "success"
3908
- });
3909
- }
3910
- setActiveRedeems((prev) => __spreadProps(__spreadValues({}, prev), {
3911
- [claimKey]: {
3912
- redeemId: response.redeemId,
3913
- expectedOutcomeIds,
3914
- preFailedOutcomeIds,
3915
- preFailedReasons,
3916
- preConfirmedOutcomeIds,
3917
- preConfirmedTxHashes
3918
- }
3919
- }));
3920
- yield queryClient.invalidateQueries({ queryKey: ["current-user"] });
3921
- } catch (err) {
3922
- const error = toClaimError(err);
3923
- console.error("[UserProfilePage] redeem failed", error);
3924
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3925
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3926
- delete pendingClaimToastIdsRef.current[claimKey];
3927
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage(error.message), {
3928
- title: claimNotificationLabels.failedTitle,
3929
- tone: "error"
3930
- });
3931
- onClaimSubmitError == null ? void 0 : onClaimSubmitError(claimKey, error);
3932
- throw error;
3933
- } finally {
3934
- activeClaimKeysRef.current.delete(claimKey);
3935
- setSubmittingClaimKeys((prev) => {
3936
- const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
3937
- return rest;
3938
- });
3939
- }
3940
- }),
3941
- [
3942
- claimingPositionKeys,
3943
- claimNotificationLabels,
3944
- invalidateClaimUiState,
3945
- internalClaimingIds,
3946
- onClaim,
3947
- onClaimSubmitError,
3948
- queryClient,
3949
- redeemMutation,
3950
- toastCtx
3951
- ]
5344
+ },
5345
+ [startClaim]
3952
5346
  );
3953
- const firedTerminalRef = useRef5({});
3954
- useEffect5(() => {
3955
- var _a, _b;
3956
- for (const [claimKey, active] of Object.entries(activeRedeems)) {
3957
- const state = lifecycleStates[active.redeemId];
3958
- if (!state || !state.terminal) continue;
3959
- if (firedTerminalRef.current[active.redeemId]) continue;
3960
- firedTerminalRef.current[active.redeemId] = true;
3961
- onClaimResult == null ? void 0 : onClaimResult(claimKey, {
3962
- allConfirmed: state.allConfirmed,
3963
- anyFailed: state.anyFailed,
3964
- errorMessage: state.errorMessage
3965
- });
3966
- const pendingId = pendingClaimToastIdsRef.current[claimKey];
3967
- if (pendingId != null) toastCtx == null ? void 0 : toastCtx.dismiss(pendingId);
3968
- delete pendingClaimToastIdsRef.current[claimKey];
3969
- if (state.allConfirmed) {
3970
- if (!submittedClaimToastKeysRef.current.has(claimKey)) {
3971
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.successMessage, {
3972
- title: claimNotificationLabels.successTitle,
3973
- tone: "success"
3974
- });
3975
- }
3976
- } else if (state.anyFailed) {
3977
- const hasConfirmedLeg = Object.values(state.legs).some((leg) => leg.status === "confirmed");
3978
- if (hasConfirmedLeg) {
3979
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.partialMessage((_a = state.errorMessage) != null ? _a : void 0), {
3980
- title: claimNotificationLabels.partialTitle,
3981
- tone: "warning"
3982
- });
3983
- } else {
3984
- toastCtx == null ? void 0 : toastCtx.toast(claimNotificationLabels.failedMessage((_b = state.errorMessage) != null ? _b : void 0), {
3985
- title: claimNotificationLabels.failedTitle,
3986
- tone: "error"
3987
- });
3988
- }
3989
- }
3990
- submittedClaimToastKeysRef.current.delete(claimKey);
3991
- invalidateClaimUiState();
3992
- delete firedTerminalRef.current[active.redeemId];
3993
- setActiveRedeems((prev) => {
3994
- const _a2 = prev, { [claimKey]: _removed } = _a2, rest = __objRest(_a2, [__restKey(claimKey)]);
3995
- return rest;
3996
- });
3997
- }
3998
- }, [
3999
- activeRedeems,
4000
- claimNotificationLabels,
4001
- invalidateClaimUiState,
4002
- lifecycleStates,
4003
- onClaimResult,
4004
- toastCtx
4005
- ]);
4006
- useEffect5(() => {
5347
+ useEffect10(() => {
4007
5348
  if (!shouldUseHookData || !isAuthenticated) {
4008
5349
  setProfileUser(void 0);
4009
5350
  return;
@@ -4022,7 +5363,7 @@ var UserProfilePage = ({
4022
5363
  isActive = false;
4023
5364
  };
4024
5365
  }, [client, currentUser, isAuthenticated, shouldUseHookData]);
4025
- const resolvedUser = useMemo4(() => {
5366
+ const resolvedUser = useMemo7(() => {
4026
5367
  var _a, _b, _c, _d, _e, _f;
4027
5368
  if (user) return user;
4028
5369
  const fullUser = profileUser != null ? profileUser : currentUser;
@@ -4056,7 +5397,7 @@ var UserProfilePage = ({
4056
5397
  socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
4057
5398
  };
4058
5399
  }, [connectedVenues, currentUser, profileUser, user]);
4059
- const _resolvedVenueBalances = useMemo4(() => {
5400
+ const _resolvedVenueBalances = useMemo7(() => {
4060
5401
  if (_venueBalances) return _venueBalances;
4061
5402
  return balanceState.balanceBreakdown.map((item) => ({
4062
5403
  chain: item.label,
@@ -4064,7 +5405,7 @@ var UserProfilePage = ({
4064
5405
  balanceLabel: formatUsd(item.balance)
4065
5406
  }));
4066
5407
  }, [_venueBalances, balanceState.balanceBreakdown]);
4067
- const positionsValueLabel = useMemo4(() => {
5408
+ const positionsValueLabel = useMemo7(() => {
4068
5409
  var _a;
4069
5410
  if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
4070
5411
  const managed = balanceState.managedBalances;
@@ -4072,13 +5413,13 @@ var UserProfilePage = ({
4072
5413
  const positionsValueTotal = positions.reduce((sum, p) => sum + (Number(p.balance) || 0), 0);
4073
5414
  return formatUsd(positionsValueTotal);
4074
5415
  }, [balance, balanceState]);
4075
- const availableBalanceLabel = useMemo4(() => {
5416
+ const availableBalanceLabel = useMemo7(() => {
4076
5417
  var _a;
4077
5418
  return formatUsd((_a = balanceState.totalBalance) != null ? _a : 0);
4078
5419
  }, [balanceState.totalBalance]);
4079
5420
  const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
4080
5421
  const isAvailableBalanceLoading = balanceState.isLoading;
4081
- const resolvedActivities = useMemo4(() => {
5422
+ const resolvedActivities = useMemo7(() => {
4082
5423
  if (activities) return activities.filter(isVisibleUserProfileActivity);
4083
5424
  const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
4084
5425
  return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
@@ -4227,7 +5568,7 @@ var UserProfilePage = ({
4227
5568
  };
4228
5569
  });
4229
5570
  }, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
4230
- const resolvedOpenOrders = useMemo4(() => {
5571
+ const resolvedOpenOrders = useMemo7(() => {
4231
5572
  if (openOrders) return openOrders;
4232
5573
  return ordersQuery.orders.filter((order) => isOpenOrderStatus(order.status)).map((order) => {
4233
5574
  var _a, _b, _c, _d, _e, _f, _g;
@@ -4244,7 +5585,7 @@ var UserProfilePage = ({
4244
5585
  };
4245
5586
  });
4246
5587
  }, [openOrders, ordersQuery.orders]);
4247
- const adaptPositionGroups = useCallback3(
5588
+ const adaptPositionGroups = useCallback5(
4248
5589
  (groups) => {
4249
5590
  return groups.flatMap((group) => {
4250
5591
  var _a, _b, _c, _d;
@@ -4314,15 +5655,15 @@ var UserProfilePage = ({
4314
5655
  },
4315
5656
  []
4316
5657
  );
4317
- const resolvedActivePositions = useMemo4(() => {
5658
+ const resolvedActivePositions = useMemo7(() => {
4318
5659
  const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
4319
5660
  return source.filter(shouldIncludeByShares);
4320
5661
  }, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
4321
- const resolvedClosedPositions = useMemo4(() => {
5662
+ const resolvedClosedPositions = useMemo7(() => {
4322
5663
  const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
4323
5664
  return source.filter(shouldIncludeByShares);
4324
5665
  }, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
4325
- return /* @__PURE__ */ jsx11(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx11(
5666
+ return /* @__PURE__ */ jsx16(AggErrorBoundary, { onError, children: /* @__PURE__ */ jsx16(
4326
5667
  "section",
4327
5668
  {
4328
5669
  className: cn(
@@ -4330,7 +5671,7 @@ var UserProfilePage = ({
4330
5671
  "w-full mx-auto px-6 lg:px-10 pb-10 max-w-[1440px]",
4331
5672
  classNames == null ? void 0 : classNames.root
4332
5673
  ),
4333
- children: /* @__PURE__ */ jsxs11(
5674
+ children: /* @__PURE__ */ jsxs15(
4334
5675
  "div",
4335
5676
  {
4336
5677
  className: cn(
@@ -4340,8 +5681,8 @@ var UserProfilePage = ({
4340
5681
  classNames == null ? void 0 : classNames.topRow
4341
5682
  ),
4342
5683
  children: [
4343
- /* @__PURE__ */ jsxs11("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
4344
- /* @__PURE__ */ jsx11(
5684
+ /* @__PURE__ */ jsxs15("div", { className: "agg-profile-summary grid grid-cols-1 gap-6 lg:grid-cols-[1fr_minmax(300px,420px)] lg:items-stretch lg:gap-8", children: [
5685
+ /* @__PURE__ */ jsx16(
4345
5686
  "div",
4346
5687
  {
4347
5688
  className: cn(
@@ -4349,7 +5690,7 @@ var UserProfilePage = ({
4349
5690
  "flex min-w-0 flex-1 flex-col gap-4 sm:gap-6 h-full",
4350
5691
  classNames == null ? void 0 : classNames.leftColumn
4351
5692
  ),
4352
- children: /* @__PURE__ */ jsx11(
5693
+ children: /* @__PURE__ */ jsx16(
4353
5694
  UserInfoCard,
4354
5695
  {
4355
5696
  user: resolvedUser,
@@ -4362,7 +5703,7 @@ var UserProfilePage = ({
4362
5703
  )
4363
5704
  }
4364
5705
  ),
4365
- /* @__PURE__ */ jsxs11(
5706
+ /* @__PURE__ */ jsxs15(
4366
5707
  "div",
4367
5708
  {
4368
5709
  className: cn(
@@ -4370,14 +5711,14 @@ var UserProfilePage = ({
4370
5711
  classNames == null ? void 0 : classNames.rightColumn
4371
5712
  ),
4372
5713
  children: [
4373
- /* @__PURE__ */ jsx11(
5714
+ /* @__PURE__ */ jsx16(
4374
5715
  PositionsValueCard,
4375
5716
  {
4376
5717
  valueLabel: positionsValueLabel,
4377
5718
  isLoading: isPositionsValueLoading
4378
5719
  }
4379
5720
  ),
4380
- /* @__PURE__ */ jsx11(
5721
+ /* @__PURE__ */ jsx16(
4381
5722
  AvailableBalanceCard,
4382
5723
  {
4383
5724
  valueLabel: availableBalanceLabel,
@@ -4395,7 +5736,7 @@ var UserProfilePage = ({
4395
5736
  }
4396
5737
  )
4397
5738
  ] }),
4398
- /* @__PURE__ */ jsx11(
5739
+ /* @__PURE__ */ jsx16(
4399
5740
  PositionsActivity,
4400
5741
  {
4401
5742
  tab,
@@ -4407,7 +5748,7 @@ var UserProfilePage = ({
4407
5748
  onPositionClick,
4408
5749
  getPositionHref,
4409
5750
  onClaim: handleClaimPosition,
4410
- claimingPositionKeys: claimingPositionKeys != null ? claimingPositionKeys : internalClaimingIds,
5751
+ claimingPositionKeys: claimingKeys,
4411
5752
  onActivityClick,
4412
5753
  getActivityHref,
4413
5754
  onOpenOrderClick,