@agg-market/ui 8.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/{chunk-SBLIHCN2.mjs → chunk-55YYUTBK.mjs} +807 -358
  2. package/dist/{chunk-JE4MV5RL.mjs → chunk-5G4T5R2H.mjs} +6 -2
  3. package/dist/{chunk-TLFRGJ5B.mjs → chunk-GYOCLZGH.mjs} +564 -414
  4. package/dist/{chunk-KRCRD4AJ.mjs → chunk-RYQSVETG.mjs} +212 -174
  5. package/dist/{chunk-WKY3IN52.mjs → chunk-XP7DREIX.mjs} +54 -15
  6. package/dist/events.js +604 -421
  7. package/dist/events.mjs +6 -4
  8. package/dist/index.js +1616 -948
  9. package/dist/index.mjs +10 -6
  10. package/dist/modals.js +1185 -374
  11. package/dist/modals.mjs +4 -2
  12. package/dist/pages.js +1434 -1005
  13. package/dist/pages.mjs +4 -4
  14. package/dist/primitives.js +53 -14
  15. package/dist/primitives.mjs +1 -1
  16. package/dist/styles.css +1 -1
  17. package/dist/tailwind.css +1 -1
  18. package/dist/trading.js +20 -4
  19. package/dist/trading.mjs +2 -2
  20. package/dist/types/events/item/event-list-item.types.d.mts +6 -4
  21. package/dist/types/events/item/event-list-item.types.d.ts +6 -4
  22. package/dist/types/events/item/event-list-item.utils.d.mts +5 -5
  23. package/dist/types/events/item/event-list-item.utils.d.ts +5 -5
  24. package/dist/types/events/item/index.d.mts +1 -1
  25. package/dist/types/events/item/index.d.ts +1 -1
  26. package/dist/types/events/item-details/event-list-item-details.types.d.mts +3 -5
  27. package/dist/types/events/item-details/event-list-item-details.types.d.ts +3 -5
  28. package/dist/types/events/item-details/event-list-item-details.utils.d.mts +42 -3
  29. package/dist/types/events/item-details/event-list-item-details.utils.d.ts +42 -3
  30. package/dist/types/events/list/event-list.types.d.mts +6 -5
  31. package/dist/types/events/list/event-list.types.d.ts +6 -5
  32. package/dist/types/events/list/event-list.utils.d.mts +5 -5
  33. package/dist/types/events/list/event-list.utils.d.ts +5 -5
  34. package/dist/types/events/list/index.d.mts +1 -1
  35. package/dist/types/events/list/index.d.ts +1 -1
  36. package/dist/types/events/market-details/index.d.mts +6 -2
  37. package/dist/types/events/market-details/index.d.ts +6 -2
  38. package/dist/types/events/market-details/market-details.types.d.mts +35 -9
  39. package/dist/types/events/market-details/market-details.types.d.ts +35 -9
  40. package/dist/types/events/market-details/market-details.utils.d.mts +28 -12
  41. package/dist/types/events/market-details/market-details.utils.d.ts +28 -12
  42. package/dist/types/modals/index.d.mts +1 -0
  43. package/dist/types/modals/index.d.ts +1 -0
  44. package/dist/types/onramp/index.d.mts +6 -0
  45. package/dist/types/onramp/index.d.ts +6 -0
  46. package/dist/types/onramp/onramp-modal.constants.d.mts +9 -0
  47. package/dist/types/onramp/onramp-modal.constants.d.ts +9 -0
  48. package/dist/types/onramp/onramp-modal.types.d.mts +64 -0
  49. package/dist/types/onramp/onramp-modal.types.d.ts +64 -0
  50. package/dist/types/onramp/steps/quote-card.d.mts +8 -0
  51. package/dist/types/onramp/steps/quote-card.d.ts +8 -0
  52. package/dist/types/onramp/steps/quote-form.d.mts +12 -0
  53. package/dist/types/onramp/steps/quote-form.d.ts +12 -0
  54. package/dist/types/onramp/steps/quote-selection.d.mts +14 -0
  55. package/dist/types/onramp/steps/quote-selection.d.ts +14 -0
  56. package/dist/types/onramp/steps/widget.d.mts +7 -0
  57. package/dist/types/onramp/steps/widget.d.ts +7 -0
  58. package/dist/types/pages/event-market/event-market.types.d.mts +4 -2
  59. package/dist/types/pages/event-market/event-market.types.d.ts +4 -2
  60. package/dist/types/pages/home/home.constants.d.mts +1 -3
  61. package/dist/types/pages/home/home.constants.d.ts +1 -3
  62. package/dist/types/pages/home/home.types.d.mts +0 -2
  63. package/dist/types/pages/home/home.types.d.ts +0 -2
  64. package/dist/types/pages/home/home.utils.d.mts +4 -0
  65. package/dist/types/pages/home/home.utils.d.ts +4 -0
  66. package/dist/types/pages/home/index.d.mts +1 -1
  67. package/dist/types/pages/home/index.d.ts +1 -1
  68. package/dist/types/primitives/chart/index.d.mts +18 -1
  69. package/dist/types/primitives/chart/index.d.ts +18 -1
  70. package/dist/types/primitives/venue-logo/index.d.mts +1 -1
  71. package/dist/types/primitives/venue-logo/index.d.ts +1 -1
  72. package/dist/types/trading/types.d.mts +2 -2
  73. package/dist/types/trading/types.d.ts +2 -2
  74. package/package.json +3 -3
package/dist/pages.js CHANGED
@@ -67,15 +67,18 @@ module.exports = __toCommonJS(pages_exports);
67
67
 
68
68
  // src/pages/home/index.tsx
69
69
  var import_react8 = require("react");
70
- var import_hooks17 = require("@agg-market/hooks");
70
+ var import_hooks18 = require("@agg-market/hooks");
71
71
 
72
72
  // src/events/list/index.tsx
73
73
  var import_react7 = require("react");
74
- var import_hooks16 = require("@agg-market/hooks");
74
+ var import_hooks17 = require("@agg-market/hooks");
75
75
 
76
76
  // src/primitives/card/index.tsx
77
77
  var import_hooks = require("@agg-market/hooks");
78
78
 
79
+ // src/constants.ts
80
+ var AGG_ROOT_CLASS_NAME = "agg-root";
81
+
79
82
  // src/shared/utils.ts
80
83
  var cn = (...values) => values.filter(Boolean).join(" ");
81
84
  var getMotionClassName = (enabled, ...values) => {
@@ -2447,7 +2450,11 @@ var StateMessage = ({
2447
2450
  size: "large",
2448
2451
  className: "text-agg-base leading-agg-6",
2449
2452
  "aria-label": actionLabel,
2450
- onClick: onAction,
2453
+ onClick: (e) => {
2454
+ e.stopPropagation();
2455
+ e.preventDefault();
2456
+ onAction == null ? void 0 : onAction();
2457
+ },
2451
2458
  children: actionLabel
2452
2459
  }
2453
2460
  ) : null
@@ -2743,7 +2750,7 @@ var getTabButtonClassName = ({
2743
2750
  return cn(
2744
2751
  "cursor-pointer disabled:cursor-not-allowed",
2745
2752
  "relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
2746
- isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
2753
+ isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-agg-bold",
2747
2754
  getMotionClassName(
2748
2755
  enableAnimations,
2749
2756
  "transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
@@ -3169,8 +3176,17 @@ var Tabs = ({
3169
3176
  )
3170
3177
  }
3171
3178
  ) }) : null,
3172
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
3173
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase", children: item.label })
3179
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center empty:hidden", children: item.icon }) : null,
3180
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
3181
+ "span",
3182
+ {
3183
+ className: cn(
3184
+ "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase"
3185
+ ),
3186
+ "data-text": item.label,
3187
+ children: item.label
3188
+ }
3189
+ )
3174
3190
  ]
3175
3191
  },
3176
3192
  item.value
@@ -3541,9 +3557,12 @@ var VenueLogo = ({
3541
3557
  title
3542
3558
  }) => {
3543
3559
  var _a;
3560
+ const { showVenueLogo = true } = (0, import_hooks11.useAggUiConfig)();
3544
3561
  const labels = (0, import_hooks11.useLabels)();
3545
3562
  const sizeClass = sizeClasses2[size];
3546
3563
  const resolvedLabel = (_a = ariaLabel != null ? ariaLabel : labels.venues[venue]) != null ? _a : venueLogoLabels[venue];
3564
+ if (!showVenueLogo)
3565
+ return null;
3547
3566
  if (variant === "logo") {
3548
3567
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
3549
3568
  RemoteImage,
@@ -3573,7 +3592,7 @@ VenueLogo.displayName = "VenueLogo";
3573
3592
  // src/events/item/index.tsx
3574
3593
  var import_dayjs2 = __toESM(require("dayjs"));
3575
3594
  var import_react6 = require("react");
3576
- var import_hooks15 = require("@agg-market/hooks");
3595
+ var import_hooks16 = require("@agg-market/hooks");
3577
3596
 
3578
3597
  // src/primitives/badge/index.tsx
3579
3598
  var import_hooks12 = require("@agg-market/hooks");
@@ -3621,9 +3640,9 @@ function Badge({
3621
3640
  )
3622
3641
  }, onClick && { onClick }), {
3623
3642
  children: [
3624
- prefix ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
3643
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.prefix, "empty:hidden"), children: prefix }) : null,
3625
3644
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
3626
- suffix ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
3645
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.suffix, "empty:hidden"), children: suffix }) : null
3627
3646
  ]
3628
3647
  })
3629
3648
  );
@@ -3717,7 +3736,7 @@ var SwitchButton = ({
3717
3736
  "div",
3718
3737
  {
3719
3738
  className: cn(
3720
- "group/agg-switch",
3739
+ "group/agg-switch min-w-fit",
3721
3740
  "inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
3722
3741
  getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
3723
3742
  "cursor-pointer hover:bg-agg-tertiary",
@@ -3763,6 +3782,7 @@ var SwitchButton = ({
3763
3782
  tabIndex: isActive ? 0 : -1,
3764
3783
  disabled: option.disabled,
3765
3784
  className: cn(
3785
+ "whitespace-nowrap",
3766
3786
  "relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
3767
3787
  getMotionClassName(
3768
3788
  enableAnimations,
@@ -3955,11 +3975,16 @@ var LineChart = ({
3955
3975
  isLoading = false,
3956
3976
  chartType = "line",
3957
3977
  showSeriesControls = true,
3958
- renderSeriesControls
3978
+ renderSeriesControls,
3979
+ liveCandle: liveForming,
3980
+ lineData,
3981
+ lineValue,
3982
+ live
3959
3983
  }) => {
3960
3984
  var _a, _b;
3961
3985
  const labels = (0, import_hooks14.useLabels)();
3962
- const { theme } = (0, import_hooks14.useSdkUiConfig)();
3986
+ const { theme, enableGradients, enableLiveUpdates } = (0, import_hooks14.useSdkUiConfig)();
3987
+ const isLive = enableLiveUpdates && (live != null ? live : true);
3963
3988
  const normalizedSeries = (0, import_react5.useMemo)(() => {
3964
3989
  return normalizeSeries(series);
3965
3990
  }, [series]);
@@ -3982,7 +4007,19 @@ var LineChart = ({
3982
4007
  if (!primarySeries) {
3983
4008
  return [];
3984
4009
  }
3985
- return toLivelinePoints(primarySeries.points);
4010
+ const points = toLivelinePoints(primarySeries.points);
4011
+ if (points.length < 3) {
4012
+ return [
4013
+ ...points,
4014
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
4015
+ time: point.time + 1500
4016
+ })),
4017
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
4018
+ time: point.time + 3e3
4019
+ }))
4020
+ ];
4021
+ }
4022
+ return points;
3986
4023
  }, [primarySeries]);
3987
4024
  const primaryCandles = (0, import_react5.useMemo)(() => {
3988
4025
  if (!primarySeries) {
@@ -4016,7 +4053,7 @@ var LineChart = ({
4016
4053
  const timeFormatter = (0, import_react5.useMemo)(() => {
4017
4054
  return resolveTimeFormatter(windowSeconds);
4018
4055
  }, [windowSeconds]);
4019
- const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
4056
+ const seriesControls = showSeriesControls ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
4020
4057
  series: normalizedSeries,
4021
4058
  activeSeriesId,
4022
4059
  handleSeriesChange
@@ -4049,13 +4086,17 @@ var LineChart = ({
4049
4086
  series: livelineSeries,
4050
4087
  color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
4051
4088
  theme: livelineTheme,
4089
+ fill: enableGradients,
4052
4090
  grid: true,
4053
- momentum: false,
4054
- pulse: false,
4091
+ momentum: isLive,
4092
+ pulse: isLive,
4055
4093
  window: windowSeconds,
4056
4094
  mode: chartType === "candlestick" ? "candle" : "line",
4057
4095
  candles: chartType === "candlestick" ? primaryCandles : void 0,
4058
4096
  candleWidth: chartType === "candlestick" ? candleWidth : void 0,
4097
+ liveCandle: chartType === "candlestick" ? liveForming : void 0,
4098
+ lineData,
4099
+ lineValue,
4059
4100
  formatValue: defaultValueFormatter,
4060
4101
  formatTime: timeFormatter,
4061
4102
  padding: {
@@ -4064,7 +4105,8 @@ var LineChart = ({
4064
4105
  bottom: 28,
4065
4106
  left: 12
4066
4107
  },
4067
- loading: isLoading
4108
+ loading: isLoading,
4109
+ lineWidth: 1
4068
4110
  }
4069
4111
  )
4070
4112
  }
@@ -4184,14 +4226,215 @@ var InlineAlert = ({
4184
4226
  };
4185
4227
  InlineAlert.displayName = "InlineAlert";
4186
4228
 
4229
+ // src/primitives/modal/index.tsx
4230
+ var Dialog = __toESM(require("@radix-ui/react-dialog"));
4231
+ var import_hooks15 = require("@agg-market/hooks");
4232
+ var import_jsx_runtime77 = require("react/jsx-runtime");
4233
+ var Modal = ({
4234
+ open,
4235
+ onOpenChange,
4236
+ children,
4237
+ "aria-label": _ariaLabel,
4238
+ "aria-labelledby": _ariaLabelledBy
4239
+ }) => {
4240
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Dialog.Root, { open, onOpenChange, children });
4241
+ };
4242
+ var ModalContainer = ({
4243
+ children,
4244
+ maxWidth = "600px",
4245
+ classNames,
4246
+ "aria-label": ariaLabel,
4247
+ "aria-labelledby": ariaLabelledBy
4248
+ }) => {
4249
+ const { rootClassName, enableAnimations } = (0, import_hooks15.useSdkUiConfig)();
4250
+ const overlayAnimationClassName = enableAnimations ? "motion-safe:data-[state=open]:animate-agg-modal-overlay-in motion-safe:data-[state=closed]:animate-agg-modal-overlay-out motion-reduce:animate-none" : void 0;
4251
+ const panelAnimationClassName = enableAnimations ? "motion-safe:data-[state=open]:animate-agg-modal-panel-in motion-safe:data-[state=closed]:animate-agg-modal-panel-out motion-reduce:animate-none" : void 0;
4252
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(Dialog.Portal, { children: [
4253
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4254
+ Dialog.Overlay,
4255
+ {
4256
+ className: cn(
4257
+ "fixed inset-0 z-agg-overlay bg-agg-overlay",
4258
+ overlayAnimationClassName,
4259
+ classNames == null ? void 0 : classNames.overlay
4260
+ )
4261
+ }
4262
+ ),
4263
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4264
+ Dialog.Content,
4265
+ {
4266
+ className: cn(
4267
+ "group/agg-modal",
4268
+ "fixed inset-0 z-agg-modal",
4269
+ "flex items-center justify-center p-4",
4270
+ "sm:p-5",
4271
+ classNames == null ? void 0 : classNames.content
4272
+ ),
4273
+ "aria-label": ariaLabel,
4274
+ "aria-labelledby": ariaLabelledBy,
4275
+ onCloseAutoFocus: (event) => {
4276
+ event.preventDefault();
4277
+ },
4278
+ children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4279
+ "div",
4280
+ {
4281
+ className: cn(
4282
+ AGG_ROOT_CLASS_NAME,
4283
+ rootClassName,
4284
+ "flex w-full max-h-[calc(100%-2rem)] flex-col font-agg-sans",
4285
+ "rounded-agg-2xl border border-agg-separator",
4286
+ "bg-agg-secondary text-agg-foreground shadow-agg-modal",
4287
+ "origin-bottom overflow-hidden will-change-transform",
4288
+ panelAnimationClassName,
4289
+ classNames == null ? void 0 : classNames.container
4290
+ ),
4291
+ "data-agg-animations": enableAnimations ? "true" : "false",
4292
+ style: { maxWidth },
4293
+ children
4294
+ }
4295
+ )
4296
+ }
4297
+ )
4298
+ ] });
4299
+ };
4300
+ Modal.Container = ModalContainer;
4301
+ var ModalHeader = ({
4302
+ title,
4303
+ subtitle,
4304
+ leftElement,
4305
+ rightElement,
4306
+ hideClose = false,
4307
+ closeIcon,
4308
+ classNames,
4309
+ children,
4310
+ hideBorder = false
4311
+ }) => {
4312
+ const { enableAnimations } = (0, import_hooks15.useSdkUiConfig)();
4313
+ const labels = (0, import_hooks15.useLabels)();
4314
+ const defaultCloseIcon = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(CloseIcon, { className: "h-6 w-6" });
4315
+ const resolvedCloseIcon = closeIcon != null ? closeIcon : defaultCloseIcon;
4316
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4317
+ "div",
4318
+ {
4319
+ className: cn(
4320
+ "group/agg-modal-header",
4321
+ "flex flex-col",
4322
+ "sticky top-0 z-20",
4323
+ "bg-agg-secondary",
4324
+ hideBorder ? "border-0" : "border-b border-agg-separator",
4325
+ subtitle ? "min-h-20" : "min-h-16",
4326
+ classNames == null ? void 0 : classNames.root
4327
+ ),
4328
+ children: [
4329
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4330
+ "div",
4331
+ {
4332
+ className: cn(
4333
+ "flex items-center justify-between",
4334
+ "px-4 py-4",
4335
+ "sm:px-8 sm:py-6",
4336
+ subtitle && "sm:py-4",
4337
+ children ? "pb-3 sm:pb-4" : void 0,
4338
+ classNames == null ? void 0 : classNames.container
4339
+ ),
4340
+ children: [
4341
+ leftElement ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: leftElement }) : null,
4342
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("max-w-[calc(100%-1rem)] flex-1", classNames == null ? void 0 : classNames.titleContainer), children: [
4343
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4344
+ Dialog.Title,
4345
+ {
4346
+ className: cn(
4347
+ !title && "invisible",
4348
+ "flex items-center text-agg-lg font-agg-bold leading-agg-6",
4349
+ "sm:text-agg-2xl sm:leading-agg-8",
4350
+ "text-ellipsis overflow-hidden whitespace-nowrap",
4351
+ classNames == null ? void 0 : classNames.title
4352
+ ),
4353
+ children: title
4354
+ }
4355
+ ),
4356
+ subtitle ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4357
+ "span",
4358
+ {
4359
+ className: cn(
4360
+ "text-agg-sm leading-agg-4 text-agg-muted-foreground sm:leading-agg-5",
4361
+ classNames == null ? void 0 : classNames.subtitle
4362
+ ),
4363
+ children: subtitle
4364
+ }
4365
+ ) : null
4366
+ ] }),
4367
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-row gap-6 items-center justify-end", children: [
4368
+ rightElement ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: rightElement }) : null,
4369
+ !hideClose && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4370
+ Dialog.Close,
4371
+ {
4372
+ className: cn(
4373
+ "outline-0 flex items-center hover:cursor-pointer justify-center text-agg-foreground hover:text-agg-foreground/80",
4374
+ getMotionClassName(enableAnimations, "transition-colors"),
4375
+ classNames == null ? void 0 : classNames.close
4376
+ ),
4377
+ "aria-label": labels.common.close,
4378
+ children: resolvedCloseIcon
4379
+ }
4380
+ )
4381
+ ] })
4382
+ ]
4383
+ }
4384
+ ),
4385
+ children ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children }) : null
4386
+ ]
4387
+ }
4388
+ );
4389
+ };
4390
+ Modal.Header = ModalHeader;
4391
+ var ModalBody = ({ children, classNames }) => {
4392
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4393
+ "div",
4394
+ {
4395
+ className: cn(
4396
+ "group/agg-modal-body",
4397
+ "grow overflow-y-auto",
4398
+ "px-4 py-6",
4399
+ "sm:p-8",
4400
+ "bg-agg-secondary text-agg-foreground",
4401
+ classNames == null ? void 0 : classNames.root
4402
+ ),
4403
+ children
4404
+ }
4405
+ );
4406
+ };
4407
+ Modal.Body = ModalBody;
4408
+ var ModalFooter = ({
4409
+ children,
4410
+ classNames,
4411
+ hideBorder = false
4412
+ }) => {
4413
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4414
+ "div",
4415
+ {
4416
+ className: cn(
4417
+ "group/agg-modal-footer",
4418
+ "sticky bottom-0",
4419
+ "bg-agg-secondary",
4420
+ "flex h-[73px] w-full flex-row items-center justify-between gap-3",
4421
+ "border-agg-separator p-4",
4422
+ "sm:h-20 sm:justify-end sm:px-8 sm:py-5",
4423
+ hideBorder ? "border-0" : "border-t",
4424
+ classNames == null ? void 0 : classNames.root
4425
+ ),
4426
+ children
4427
+ }
4428
+ );
4429
+ };
4430
+ Modal.Footer = ModalFooter;
4431
+ Modal.displayName = "Modal";
4432
+
4187
4433
  // src/events/item/event-list-item.utils.ts
4188
4434
  var resolveEventListItemEvent = (fetchedEvent) => {
4189
4435
  if (!fetchedEvent)
4190
4436
  return void 0;
4191
- const mergedVenueMarkets = fetchedEvent.markets.flatMap(
4192
- (market) => market.venueMarkets
4193
- );
4194
- if (mergedVenueMarkets.length === 0)
4437
+ if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
4195
4438
  return void 0;
4196
4439
  return fetchedEvent;
4197
4440
  };
@@ -4324,13 +4567,13 @@ var resolveVenueLabel = (venue, venueInfo, labels) => {
4324
4567
  };
4325
4568
 
4326
4569
  // src/events/item/index.tsx
4327
- var import_jsx_runtime77 = require("react/jsx-runtime");
4570
+ var import_jsx_runtime78 = require("react/jsx-runtime");
4328
4571
  var EventListItemLoadingState = ({
4329
4572
  classNames,
4330
4573
  ariaLabel
4331
4574
  }) => {
4332
- const labels = (0, import_hooks15.useLabels)();
4333
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4575
+ const labels = (0, import_hooks16.useLabels)();
4576
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4334
4577
  Skeleton,
4335
4578
  {
4336
4579
  view: "event-list-item",
@@ -4343,16 +4586,16 @@ var EventListItemUnavailableState = ({
4343
4586
  classNames,
4344
4587
  ariaLabel
4345
4588
  }) => {
4346
- const labels = (0, import_hooks15.useLabels)();
4347
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4589
+ const labels = (0, import_hooks16.useLabels)();
4590
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4348
4591
  Card,
4349
4592
  {
4350
4593
  className: cn(baseCardClassName, classNames == null ? void 0 : classNames.root),
4351
4594
  role: "status",
4352
4595
  "aria-label": ariaLabel != null ? ariaLabel : labels.eventItem.unavailableAria,
4353
- children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4354
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
4355
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
4596
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
4597
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItem.unavailableTitle }),
4598
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItem.unavailableDescription })
4356
4599
  ] })
4357
4600
  }
4358
4601
  );
@@ -4361,8 +4604,8 @@ var EventListItemNotFoundState = ({
4361
4604
  classNames,
4362
4605
  ariaLabel
4363
4606
  }) => {
4364
- const labels = (0, import_hooks15.useLabels)();
4365
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Card, { className: cn("w-full gap-0 overflow-hidden p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4607
+ const labels = (0, import_hooks16.useLabels)();
4608
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card, { className: cn("w-full gap-0 overflow-hidden p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4366
4609
  StateMessage,
4367
4610
  {
4368
4611
  ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
@@ -4376,7 +4619,6 @@ var EventListItemContent = ({
4376
4619
  event,
4377
4620
  title,
4378
4621
  image,
4379
- showVenueLogo = true,
4380
4622
  maxOutcomes = 2,
4381
4623
  classNames,
4382
4624
  venueInfo,
@@ -4385,11 +4627,11 @@ var EventListItemContent = ({
4385
4627
  ariaLabel
4386
4628
  }) => {
4387
4629
  var _a;
4388
- const config = (0, import_hooks15.useSdkUiConfig)();
4389
- const labels = (0, import_hooks15.useLabels)();
4630
+ const config = (0, import_hooks16.useSdkUiConfig)();
4631
+ const labels = (0, import_hooks16.useLabels)();
4390
4632
  const allVenueMarkets = (0, import_react6.useMemo)(() => {
4391
- return event.markets.flatMap((market) => market.venueMarkets);
4392
- }, [event.markets]);
4633
+ return event.venueMarkets;
4634
+ }, [event.venueMarkets]);
4393
4635
  const primaryVenueMarket = (0, import_react6.useMemo)(() => {
4394
4636
  return selectPrimaryVenueMarket(allVenueMarkets);
4395
4637
  }, [allVenueMarkets]);
@@ -4412,7 +4654,7 @@ var EventListItemContent = ({
4412
4654
  return;
4413
4655
  if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
4414
4656
  eventToHandle == null ? void 0 : eventToHandle.preventDefault();
4415
- onClick();
4657
+ onClick == null ? void 0 : onClick(event);
4416
4658
  }
4417
4659
  };
4418
4660
  const renderArbitrage = (value) => {
@@ -4420,9 +4662,9 @@ var EventListItemContent = ({
4420
4662
  return null;
4421
4663
  if (Math.abs(value) < config.arbitrageThreshold)
4422
4664
  return null;
4423
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
4424
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatPercent(value) }),
4425
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4665
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-success"), children: [
4666
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "label-strong", className: "text-agg-success", children: config.formatPercent(value) }),
4667
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4426
4668
  Icon,
4427
4669
  {
4428
4670
  name: "triangle-up",
@@ -4433,18 +4675,18 @@ var EventListItemContent = ({
4433
4675
  )
4434
4676
  ] });
4435
4677
  };
4436
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4678
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
4437
4679
  Card,
4438
4680
  {
4439
4681
  className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
4440
4682
  role: onClick ? "button" : void 0,
4441
4683
  tabIndex: onClick ? 0 : void 0,
4442
- onClick,
4684
+ onClick: () => onClick == null ? void 0 : onClick(event),
4443
4685
  onKeyDown: handleKeyDown,
4444
4686
  "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
4445
4687
  children: [
4446
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
4447
- resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4688
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex items-center gap-3", classNames == null ? void 0 : classNames.header), children: [
4689
+ resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4448
4690
  RemoteImage,
4449
4691
  {
4450
4692
  src: resolvedImage,
@@ -4452,7 +4694,7 @@ var EventListItemContent = ({
4452
4694
  className: cn("h-10 w-10", "rounded-agg-lg object-cover")
4453
4695
  }
4454
4696
  ) : null,
4455
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4697
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4456
4698
  Typography,
4457
4699
  {
4458
4700
  variant: "body-strong",
@@ -4465,13 +4707,13 @@ var EventListItemContent = ({
4465
4707
  }
4466
4708
  )
4467
4709
  ] }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.outcomes), children: visibleOutcomes.map((visibleOutcome) => {
4710
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.outcomes), children: visibleOutcomes.map((visibleOutcome) => {
4469
4711
  const probability = normalizeProbability(visibleOutcome.outcome.price);
4470
4712
  const showBadge = typeof probability === "number";
4471
4713
  const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[visibleOutcome.outcome.id];
4472
4714
  const outcomeTitle = resolveOutcomeTitle(visibleOutcome.outcome);
4473
4715
  const formattedTitle = (0, import_dayjs2.default)(outcomeTitle).isValid() ? (0, import_dayjs2.default)(outcomeTitle).format("MMMM D, YYYY") : outcomeTitle;
4474
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4716
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
4475
4717
  "div",
4476
4718
  {
4477
4719
  className: cn(
@@ -4479,7 +4721,7 @@ var EventListItemContent = ({
4479
4721
  classNames == null ? void 0 : classNames.outcomeRow
4480
4722
  ),
4481
4723
  children: [
4482
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4724
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4483
4725
  Typography,
4484
4726
  {
4485
4727
  variant: "body",
@@ -4487,13 +4729,13 @@ var EventListItemContent = ({
4487
4729
  children: formattedTitle
4488
4730
  }
4489
4731
  ),
4490
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
4732
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-row gap-3 items-center justify-end", children: [
4491
4733
  renderArbitrage(arbitragePercent),
4492
- showBadge ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4734
+ showBadge ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4493
4735
  Badge,
4494
4736
  {
4495
4737
  text: config.formatPercent(probability),
4496
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }) : void 0,
4738
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }),
4497
4739
  size: "large",
4498
4740
  classNames: {
4499
4741
  root: cn(
@@ -4509,7 +4751,7 @@ var EventListItemContent = ({
4509
4751
  `${visibleOutcome.market.id}-${visibleOutcome.outcome.id}`
4510
4752
  );
4511
4753
  }) }),
4512
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
4754
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
4513
4755
  "div",
4514
4756
  {
4515
4757
  className: cn(
@@ -4518,15 +4760,15 @@ var EventListItemContent = ({
4518
4760
  classNames == null ? void 0 : classNames.footer
4519
4761
  ),
4520
4762
  children: [
4521
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
4522
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4763
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: cn("flex items-center gap-1", "text-agg-sm leading-agg-5"), children: [
4764
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4523
4765
  marketCount,
4524
4766
  labels.eventItem.marketSingular,
4525
4767
  labels.eventItem.marketPlural
4526
4768
  ) }),
4527
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
4528
- singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
4529
- showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4769
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
4770
+ singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
4771
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4530
4772
  VenueLogo,
4531
4773
  {
4532
4774
  venue: singleVenue,
@@ -4534,14 +4776,14 @@ var EventListItemContent = ({
4534
4776
  isMonochromatic: true,
4535
4777
  className: "text-agg-muted-foreground!"
4536
4778
  }
4537
- ) : null,
4538
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: venueLabel })
4539
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4779
+ ),
4780
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: venueLabel })
4781
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
4540
4782
  venueCount,
4541
4783
  labels.eventItem.venueSingular,
4542
4784
  labels.eventItem.venuePlural
4543
4785
  ) }),
4544
- showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
4786
+ !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4545
4787
  VenueLogo,
4546
4788
  {
4547
4789
  venue,
@@ -4552,7 +4794,7 @@ var EventListItemContent = ({
4552
4794
  venue
4553
4795
  )) }) : null
4554
4796
  ] }),
4555
- volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
4797
+ volumeLabel ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { variant: "label", className: "text-agg-sm text-agg-muted-foreground", children: volumeLabel }) : null
4556
4798
  ]
4557
4799
  }
4558
4800
  )
@@ -4571,38 +4813,39 @@ var EventListItemByEventId = (_a) => {
4571
4813
  error,
4572
4814
  isError,
4573
4815
  isLoading
4574
- } = (0, import_hooks15.useEvent)(eventId, {
4816
+ } = (0, import_hooks16.useVenueEvent)({
4817
+ eventId: eventId != null ? eventId : "",
4575
4818
  enabled: !!eventId
4576
4819
  });
4577
4820
  const resolvedEvent = (0, import_react6.useMemo)(() => {
4578
4821
  return resolveEventListItemEvent(fetchedEvent);
4579
4822
  }, [fetchedEvent]);
4580
4823
  if (!eventId) {
4581
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4824
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4582
4825
  }
4583
4826
  if (isLoading) {
4584
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4827
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4585
4828
  }
4586
4829
  if (isErrorWithStatus(error, 404)) {
4587
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4830
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4588
4831
  }
4589
4832
  if (!fetchedEvent && !isError) {
4590
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4833
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4591
4834
  }
4592
4835
  if (!resolvedEvent) {
4593
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4836
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemUnavailableState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
4594
4837
  }
4595
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemContent, __spreadValues({ event: resolvedEvent }, rest));
4838
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemContent, __spreadValues({ event: resolvedEvent }, rest));
4596
4839
  };
4597
4840
  var EventListItem = (props) => {
4598
4841
  if (props.isLoading) {
4599
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
4842
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
4600
4843
  }
4601
4844
  if ("event" in props && props.event) {
4602
4845
  const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
4603
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemContent, __spreadValues({ event }, rest));
4846
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemContent, __spreadValues({ event }, rest));
4604
4847
  }
4605
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EventListItemByEventId, __spreadValues({}, props));
4848
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemByEventId, __spreadValues({}, props));
4606
4849
  };
4607
4850
  EventListItem.displayName = "EventListItem";
4608
4851
 
@@ -4635,8 +4878,7 @@ var getDefaultEventListTabs = (labels) => {
4635
4878
 
4636
4879
  // src/events/list/event-list.utils.ts
4637
4880
  var mapEventToEventListItemEvent = (event) => {
4638
- const mergedVenueMarkets = event.markets.flatMap((m) => m.venueMarkets);
4639
- if (mergedVenueMarkets.length === 0)
4881
+ if (!event.venueMarkets || event.venueMarkets.length === 0)
4640
4882
  return null;
4641
4883
  return event;
4642
4884
  };
@@ -4655,14 +4897,14 @@ var resolveTabVenus = (tab) => {
4655
4897
  };
4656
4898
 
4657
4899
  // src/events/list/index.tsx
4658
- var import_jsx_runtime78 = require("react/jsx-runtime");
4900
+ var import_jsx_runtime79 = require("react/jsx-runtime");
4659
4901
  var renderTabIcon = (tab, isActive) => {
4660
4902
  if (tab.venueLogo) {
4661
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
4903
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(VenueLogo, { venue: tab.venueLogo, size: "small" });
4662
4904
  }
4663
4905
  if (!tab.iconName)
4664
4906
  return null;
4665
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
4907
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4666
4908
  Icon,
4667
4909
  {
4668
4910
  name: tab.iconName,
@@ -4700,14 +4942,14 @@ var estimateTabsWidth = (items) => {
4700
4942
  var EventList = ({
4701
4943
  title,
4702
4944
  maxItemsPerRow = 3,
4703
- limit = 3,
4945
+ limit = 9,
4704
4946
  maxVisibleItems,
4705
- showVenueLogo = true,
4706
4947
  search,
4707
- categoryIds
4948
+ categoryIds,
4949
+ onClick
4708
4950
  }) => {
4709
4951
  var _a, _b;
4710
- const labels = (0, import_hooks16.useLabels)();
4952
+ const labels = (0, import_hooks17.useLabels)();
4711
4953
  const defaultEventListTabs = (0, import_react7.useMemo)(() => {
4712
4954
  return getDefaultEventListTabs(labels);
4713
4955
  }, [labels]);
@@ -4728,7 +4970,7 @@ var EventList = ({
4728
4970
  }, [maxVisibleItems]);
4729
4971
  const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
4730
4972
  const shouldPaginate = resolvedMaxVisibleItems == null;
4731
- const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks16.useEvents)({
4973
+ const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks17.useVenueEvents)({
4732
4974
  venues,
4733
4975
  search,
4734
4976
  categoryIds,
@@ -4832,17 +5074,17 @@ var EventList = ({
4832
5074
  "md:[grid-template-columns:repeat(var(--agg-event-list-columns),minmax(0,1fr))]"
4833
5075
  );
4834
5076
  if (shouldRenderLoadingState) {
4835
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
5077
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Skeleton, { view: "event-list", ariaLabel: labels.eventList.loading(title) });
4836
5078
  }
4837
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("section", { className: "flex w-full flex-col gap-5", children: [
4838
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
5079
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("section", { className: "flex w-full flex-col gap-5", children: [
5080
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
4839
5081
  "header",
4840
5082
  {
4841
5083
  ref: headerRef,
4842
5084
  className: "flex flex-col sm:flex-row w-full flex-nowrap items-start sm:items-center justify-between gap-2 sm:gap-4",
4843
5085
  children: [
4844
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
4845
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5086
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { ref: titleRef, className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Typography, { as: "h2", variant: "title", className: "truncate [&::first-letter]:uppercase", children: title }) }),
5087
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4846
5088
  Tabs,
4847
5089
  {
4848
5090
  ariaLabel: labels.eventList.tabsAria(title),
@@ -4854,19 +5096,19 @@ var EventList = ({
4854
5096
  ]
4855
5097
  }
4856
5098
  ),
4857
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: gridClassName, style: gridStyle, children: [
4858
- tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5099
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: gridClassName, style: gridStyle, children: [
5100
+ tileEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4859
5101
  EventListItem,
4860
5102
  {
4861
5103
  event,
4862
- showVenueLogo,
4863
5104
  classNames: {
4864
5105
  root: "w-full min-w-0 max-w-none"
4865
- }
5106
+ },
5107
+ onClick
4866
5108
  },
4867
5109
  event.id
4868
5110
  )),
4869
- Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5111
+ Array.from({ length: loadingPlaceholderCount }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4870
5112
  EventListItem,
4871
5113
  {
4872
5114
  isLoading: true,
@@ -4876,7 +5118,7 @@ var EventList = ({
4876
5118
  },
4877
5119
  `loading-${index}`
4878
5120
  )),
4879
- !isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5121
+ !isLoading && !isError && (tileEvents == null ? void 0 : tileEvents.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Card, { className: "col-span-full overflow-hidden shadow-none hover:shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4880
5122
  StateMessage,
4881
5123
  {
4882
5124
  ariaLabel: labels.eventList.emptyAria,
@@ -4885,7 +5127,7 @@ var EventList = ({
4885
5127
  className: "min-h-[320px]"
4886
5128
  }
4887
5129
  ) }) : null,
4888
- isError ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
5130
+ isError ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
4889
5131
  Typography,
4890
5132
  {
4891
5133
  variant: "body",
@@ -4894,7 +5136,7 @@ var EventList = ({
4894
5136
  }
4895
5137
  ) : null
4896
5138
  ] }),
4897
- shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
5139
+ shouldPaginate && hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { ref: loadMoreRef, className: "h-px w-full", "aria-hidden": true }) : null
4898
5140
  ] });
4899
5141
  };
4900
5142
  EventList.displayName = "EventList";
@@ -4903,51 +5145,6 @@ EventList.displayName = "EventList";
4903
5145
  var ALL_CATEGORIES_TAB_VALUE = "trending";
4904
5146
  var DEFAULT_CATEGORIES_LIMIT = 100;
4905
5147
  var DEFAULT_ALL_CATEGORY_TAB_LABEL = "Trending";
4906
- var CATEGORY_TAB_NAME_ORDER = [
4907
- "crypto",
4908
- "economy",
4909
- "entertainment",
4910
- "finance",
4911
- "geopolitics",
4912
- "health",
4913
- "mentions",
4914
- "politics",
4915
- "science",
4916
- "sports",
4917
- "technology",
4918
- "weather",
4919
- "world"
4920
- ];
4921
- var getDefaultHomePageTabs = (allCategoryTabLabel) => {
4922
- return [
4923
- {
4924
- value: ALL_CATEGORIES_TAB_VALUE,
4925
- label: allCategoryTabLabel,
4926
- iconName: "arrow-trend-up"
4927
- },
4928
- { value: "crypto", label: "crypto", categoryIds: ["crypto"] },
4929
- { value: "economy", label: "economy", categoryIds: ["economy"] },
4930
- {
4931
- value: "entertainment",
4932
- label: "entertainment",
4933
- categoryIds: ["entertainment"]
4934
- },
4935
- { value: "finance", label: "finance", categoryIds: ["finance"] },
4936
- {
4937
- value: "geopolitics",
4938
- label: "geopolitics",
4939
- categoryIds: ["geopolitics"]
4940
- },
4941
- { value: "health", label: "health", categoryIds: ["health"] },
4942
- { value: "mentions", label: "mentions", categoryIds: ["mentions"] },
4943
- { value: "politics", label: "politics", categoryIds: ["politics"] },
4944
- { value: "science", label: "science", categoryIds: ["science"] },
4945
- { value: "sports", label: "sports", categoryIds: ["sports"] },
4946
- { value: "technology", label: "technology", categoryIds: ["technology"] },
4947
- { value: "weather", label: "weather", categoryIds: ["weather"] },
4948
- { value: "world", label: "world", categoryIds: ["world"] }
4949
- ];
4950
- };
4951
5148
  var getDefaultEventSectionItems = (labels) => {
4952
5149
  return [
4953
5150
  {
@@ -4968,31 +5165,7 @@ var getDefaultEventSectionItems = (labels) => {
4968
5165
  };
4969
5166
 
4970
5167
  // src/pages/home/home.utils.ts
4971
- var categoryOrderMap = CATEGORY_TAB_NAME_ORDER.reduce(
4972
- (accumulator, name, index) => {
4973
- accumulator.set(name, index);
4974
- return accumulator;
4975
- },
4976
- /* @__PURE__ */ new Map()
4977
- );
4978
- var normalizeCategoryName = (name) => {
4979
- return name.trim().toLowerCase();
4980
- };
4981
5168
  var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
4982
- const sortedCategories = [...categories].sort((left, right) => {
4983
- const leftName = normalizeCategoryName(left.name);
4984
- const rightName = normalizeCategoryName(right.name);
4985
- const leftOrder = categoryOrderMap.get(leftName);
4986
- const rightOrder = categoryOrderMap.get(rightName);
4987
- if (leftOrder != null && rightOrder != null) {
4988
- return leftOrder - rightOrder;
4989
- }
4990
- if (leftOrder != null)
4991
- return -1;
4992
- if (rightOrder != null)
4993
- return 1;
4994
- return leftName.localeCompare(rightName);
4995
- });
4996
5169
  const seenCategoryIds = /* @__PURE__ */ new Set();
4997
5170
  const tabs = [
4998
5171
  {
@@ -5001,13 +5174,13 @@ var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
5001
5174
  iconName: "arrow-trend-up"
5002
5175
  }
5003
5176
  ];
5004
- for (const category of sortedCategories) {
5177
+ for (const category of categories) {
5005
5178
  if (seenCategoryIds.has(category.id))
5006
5179
  continue;
5007
5180
  seenCategoryIds.add(category.id);
5008
5181
  tabs.push({
5009
5182
  value: category.id,
5010
- label: normalizeCategoryName(category.name),
5183
+ label: category.name.trim().toLowerCase(),
5011
5184
  categoryIds: [category.id]
5012
5185
  });
5013
5186
  }
@@ -5020,28 +5193,26 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
5020
5193
  if (hasDefaultTab)
5021
5194
  return defaultActiveTab;
5022
5195
  }
5023
- return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "trending";
5196
+ return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
5024
5197
  };
5025
5198
 
5026
5199
  // src/pages/home/index.tsx
5027
- var import_jsx_runtime79 = require("react/jsx-runtime");
5200
+ var import_jsx_runtime80 = require("react/jsx-runtime");
5028
5201
  var HomePage = ({
5029
5202
  tabs,
5030
5203
  defaultActiveTab,
5031
5204
  onTabChange,
5032
5205
  eventSectionItems,
5033
5206
  classNames,
5034
- useCategoriesTabs = true,
5035
5207
  categoriesLimit = DEFAULT_CATEGORIES_LIMIT,
5036
5208
  allCategoryTabLabel = DEFAULT_ALL_CATEGORY_TAB_LABEL
5037
5209
  }) => {
5038
- const labels = (0, import_hooks17.useLabels)();
5210
+ const labels = (0, import_hooks18.useLabels)();
5039
5211
  const hasCustomTabs = !!tabs && tabs.length > 0;
5040
- const shouldUseCategoriesTabs = !hasCustomTabs && useCategoriesTabs;
5041
5212
  const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
5042
- const { categories } = (0, import_hooks17.useCategories)({
5213
+ const { categories, isLoading: isCategoriesLoading } = (0, import_hooks18.useCategories)({
5043
5214
  limit: categoriesLimit,
5044
- enabled: shouldUseCategoriesTabs
5215
+ enabled: !hasCustomTabs
5045
5216
  });
5046
5217
  const categoryTabs = (0, import_react8.useMemo)(() => {
5047
5218
  return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
@@ -5049,10 +5220,8 @@ var HomePage = ({
5049
5220
  const resolvedTabs = (0, import_react8.useMemo)(() => {
5050
5221
  if (hasCustomTabs && tabs)
5051
5222
  return tabs;
5052
- if (shouldUseCategoriesTabs)
5053
- return categoryTabs;
5054
- return getDefaultHomePageTabs(resolvedAllCategoryTabLabel);
5055
- }, [categoryTabs, hasCustomTabs, resolvedAllCategoryTabLabel, shouldUseCategoriesTabs, tabs]);
5223
+ return categoryTabs;
5224
+ }, [categoryTabs, hasCustomTabs, tabs]);
5056
5225
  const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
5057
5226
  const [activeTabValue, setActiveTabValue] = (0, import_react8.useState)(() => {
5058
5227
  return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
@@ -5071,7 +5240,7 @@ var HomePage = ({
5071
5240
  return {
5072
5241
  value: tab.value,
5073
5242
  label: tab.label,
5074
- icon: tab.iconName ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5243
+ icon: tab.iconName ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5075
5244
  Icon,
5076
5245
  {
5077
5246
  name: tab.iconName,
@@ -5087,22 +5256,20 @@ var HomePage = ({
5087
5256
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
5088
5257
  }, [activeTabValue, resolvedTabs]);
5089
5258
  const resolvedSectionItems = (0, import_react8.useMemo)(() => {
5090
- var _a, _b, _c, _d, _e;
5259
+ var _a, _b, _c, _d;
5091
5260
  if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
5092
5261
  return resolvedEventSectionItems;
5093
5262
  }
5094
5263
  const maxItemsPerRow = (_b = (_a = resolvedEventSectionItems[0]) == null ? void 0 : _a.maxItemsPerRow) != null ? _b : 3;
5095
- const showVenueLogo = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.showVenueLogo;
5096
- const firstSectionLimit = (_d = resolvedEventSectionItems[0]) == null ? void 0 : _d.limit;
5264
+ const firstSectionLimit = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.limit;
5097
5265
  const limit = firstSectionLimit && Number.isFinite(firstSectionLimit) ? Math.max(9, Math.floor(firstSectionLimit)) : 9;
5098
5266
  return [
5099
5267
  {
5100
5268
  id: `${activeTabValue}-markets`,
5101
- title: (_e = activeTab == null ? void 0 : activeTab.label) != null ? _e : activeTabValue,
5269
+ title: (_d = activeTab == null ? void 0 : activeTab.label) != null ? _d : activeTabValue,
5102
5270
  maxItemsPerRow,
5103
5271
  limit,
5104
5272
  maxVisibleItems: void 0,
5105
- showVenueLogo,
5106
5273
  search: activeTab == null ? void 0 : activeTab.search,
5107
5274
  categoryIds: activeTab == null ? void 0 : activeTab.categoryIds
5108
5275
  }
@@ -5112,12 +5279,24 @@ var HomePage = ({
5112
5279
  setActiveTabValue(value);
5113
5280
  onTabChange == null ? void 0 : onTabChange(value);
5114
5281
  };
5115
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
5116
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5282
+ if (!hasCustomTabs && isCategoriesLoading) {
5283
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5284
+ "header",
5285
+ {
5286
+ className: cn(
5287
+ "w-full bg-agg-secondary border-b border-agg-separator",
5288
+ classNames == null ? void 0 : classNames.header
5289
+ ),
5290
+ children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("w-full px-4 md:px-10 h-10", classNames == null ? void 0 : classNames.tabs) })
5291
+ }
5292
+ ) });
5293
+ }
5294
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
5295
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5117
5296
  "header",
5118
5297
  {
5119
5298
  className: cn("w-full bg-agg-secondary border-b border-agg-separator", classNames == null ? void 0 : classNames.header),
5120
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5299
+ children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5121
5300
  Tabs,
5122
5301
  {
5123
5302
  ariaLabel: labels.home.categoryTabsAria,
@@ -5130,7 +5309,7 @@ var HomePage = ({
5130
5309
  )
5131
5310
  }
5132
5311
  ),
5133
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5312
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5134
5313
  "main",
5135
5314
  {
5136
5315
  className: cn(
@@ -5139,14 +5318,13 @@ var HomePage = ({
5139
5318
  ),
5140
5319
  children: resolvedSectionItems.map((eventSectionItem) => {
5141
5320
  var _a, _b, _c;
5142
- return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
5321
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5143
5322
  EventList,
5144
5323
  {
5145
5324
  title: eventSectionItem.title,
5146
5325
  maxItemsPerRow: eventSectionItem.maxItemsPerRow,
5147
5326
  limit: eventSectionItem.limit,
5148
5327
  maxVisibleItems: eventSectionItem.maxVisibleItems,
5149
- showVenueLogo: eventSectionItem.showVenueLogo,
5150
5328
  search: (_b = eventSectionItem.search) != null ? _b : activeTab == null ? void 0 : activeTab.search,
5151
5329
  categoryIds: (_c = eventSectionItem.categoryIds) != null ? _c : activeTab == null ? void 0 : activeTab.categoryIds
5152
5330
  },
@@ -5161,23 +5339,23 @@ HomePage.displayName = "HomePage";
5161
5339
 
5162
5340
  // src/pages/event-market/index.tsx
5163
5341
  var import_react14 = require("react");
5164
- var import_hooks24 = require("@agg-market/hooks");
5342
+ var import_hooks25 = require("@agg-market/hooks");
5165
5343
  var import_dayjs6 = __toESM(require("dayjs"));
5166
5344
 
5167
5345
  // src/events/item-details/index.tsx
5168
5346
  var import_react10 = require("react");
5169
- var import_hooks19 = require("@agg-market/hooks");
5347
+ var import_hooks20 = require("@agg-market/hooks");
5170
5348
 
5171
5349
  // src/primitives/chart/chart-type-switch.tsx
5172
- var import_hooks18 = require("@agg-market/hooks");
5350
+ var import_hooks19 = require("@agg-market/hooks");
5173
5351
  var import_react9 = require("react");
5174
- var import_jsx_runtime80 = require("react/jsx-runtime");
5352
+ var import_jsx_runtime81 = require("react/jsx-runtime");
5175
5353
  var ChartTypeSwitch = ({
5176
5354
  value,
5177
5355
  onValueChange,
5178
5356
  className
5179
5357
  }) => {
5180
- const labels = (0, import_hooks18.useLabels)();
5358
+ const labels = (0, import_hooks19.useLabels)();
5181
5359
  const options = (0, import_react9.useMemo)(
5182
5360
  () => [
5183
5361
  {
@@ -5206,7 +5384,7 @@ var ChartTypeSwitch = ({
5206
5384
  }
5207
5385
  onValueChange(nextOption.value);
5208
5386
  };
5209
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5387
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5210
5388
  "div",
5211
5389
  {
5212
5390
  className: cn("inline-flex items-center gap-2", className),
@@ -5214,7 +5392,7 @@ var ChartTypeSwitch = ({
5214
5392
  "aria-label": labels.common.chartTypeSwitchAria,
5215
5393
  children: options.map((option, index) => {
5216
5394
  const isActive = option.value === value;
5217
- return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
5395
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5218
5396
  "button",
5219
5397
  {
5220
5398
  type: "button",
@@ -5229,7 +5407,9 @@ var ChartTypeSwitch = ({
5229
5407
  "transition-colors duration-200 ease-in-out",
5230
5408
  isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
5231
5409
  ),
5232
- onClick: () => {
5410
+ onClick: (e) => {
5411
+ e.stopPropagation();
5412
+ e.preventDefault();
5233
5413
  if (isActive) {
5234
5414
  return;
5235
5415
  }
@@ -5238,7 +5418,7 @@ var ChartTypeSwitch = ({
5238
5418
  onKeyDown: (event) => {
5239
5419
  handleKeyDown(event, index);
5240
5420
  },
5241
- children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
5421
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Icon, { name: option.iconName, color: "currentColor", className: "h-5 w-5" })
5242
5422
  },
5243
5423
  option.value
5244
5424
  );
@@ -5258,14 +5438,9 @@ var isDateLikeLabel = (value) => {
5258
5438
  return false;
5259
5439
  return (0, import_dayjs3.default)(value).isValid();
5260
5440
  };
5261
- var formatDateLabel = (value) => {
5262
- if (!isDateLikeLabel(value))
5263
- return value;
5264
- return (0, import_dayjs3.default)(value).format("MMM D, YYYY");
5265
- };
5266
- var getDefaultSelectedTimeRange = (value) => {
5441
+ var getDefaultSelectedTimeRange = (value, fallback = "1D") => {
5267
5442
  if (!value)
5268
- return "1M";
5443
+ return fallback;
5269
5444
  return value;
5270
5445
  };
5271
5446
  var getTimeWindowByRange = (range) => {
@@ -5347,24 +5522,6 @@ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
5347
5522
  };
5348
5523
  }).filter((item) => item != null);
5349
5524
  };
5350
- var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
5351
- const marketIdByVenue = /* @__PURE__ */ new Map();
5352
- selectedOutcomes.forEach(({ venue, market }) => {
5353
- var _a, _b;
5354
- const marketWithCanonicalId = market;
5355
- const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
5356
- if (!canonicalMarketId)
5357
- return;
5358
- if (!marketIdByVenue.has(venue)) {
5359
- marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
5360
- }
5361
- (_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
5362
- });
5363
- return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
5364
- venue,
5365
- venueMarketOutcomeIds: [...marketIds]
5366
- })).filter((group) => group.venueMarketOutcomeIds.length > 0);
5367
- };
5368
5525
  var resolveSeriesColor = (venue, index) => {
5369
5526
  var _a;
5370
5527
  const colorFromVenue = lineColorByVenue[venue];
@@ -5372,15 +5529,107 @@ var resolveSeriesColor = (venue, index) => {
5372
5529
  return colorFromVenue;
5373
5530
  return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
5374
5531
  };
5532
+ var toNonEmptyString = (value) => {
5533
+ if (typeof value !== "string")
5534
+ return void 0;
5535
+ const trimmedValue = value.trim();
5536
+ return trimmedValue ? trimmedValue : void 0;
5537
+ };
5538
+ var resolveCanonicalMarketId = (venueMarkets, fallbackMarketId) => {
5539
+ var _a;
5540
+ const uniqueMarketIds = Array.from(
5541
+ new Set(venueMarkets.map((market) => toNonEmptyString(market.marketId)).filter(Boolean))
5542
+ );
5543
+ if (uniqueMarketIds.length === 1) {
5544
+ return uniqueMarketIds[0];
5545
+ }
5546
+ return (_a = toNonEmptyString(fallbackMarketId)) != null ? _a : uniqueMarketIds[0];
5547
+ };
5548
+ var toChartDisplayValue = (value, transformProbability) => {
5549
+ if (value == null || !Number.isFinite(value))
5550
+ return void 0;
5551
+ return transformProbability(value) * 100;
5552
+ };
5553
+ var marketChartCandleToLineChartPoint = (candle, transformProbability) => {
5554
+ var _a, _b, _c, _d;
5555
+ const open = (_a = toChartDisplayValue(candle.open, transformProbability)) != null ? _a : 0;
5556
+ const high = (_b = toChartDisplayValue(candle.high, transformProbability)) != null ? _b : open;
5557
+ const low = (_c = toChartDisplayValue(candle.low, transformProbability)) != null ? _c : open;
5558
+ const close = (_d = toChartDisplayValue(candle.close, transformProbability)) != null ? _d : open;
5559
+ return {
5560
+ time: candle.time,
5561
+ value: close,
5562
+ open,
5563
+ high,
5564
+ low,
5565
+ close
5566
+ };
5567
+ };
5568
+ var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
5569
+ var _a, _b, _c, _d;
5570
+ const point = marketChartCandleToLineChartPoint(candle, transformProbability);
5571
+ return {
5572
+ time: point.time,
5573
+ open: (_a = point.open) != null ? _a : point.value,
5574
+ high: (_b = point.high) != null ? _b : point.value,
5575
+ low: (_c = point.low) != null ? _c : point.value,
5576
+ close: (_d = point.close) != null ? _d : point.value,
5577
+ v: candle.volume
5578
+ };
5579
+ };
5580
+ var resolveMarketChartVenueSeries = ({
5581
+ chartData,
5582
+ transformProbability
5583
+ }) => {
5584
+ if (!chartData)
5585
+ return [];
5586
+ return Object.entries(chartData.venues).map(([venue, venueData]) => ({
5587
+ venue,
5588
+ points: venueData.candles.map(
5589
+ (candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
5590
+ )
5591
+ })).filter((item) => item.points.length > 0);
5592
+ };
5593
+ var resolveMarketChartLiveState = ({
5594
+ chartData,
5595
+ selectedVenue,
5596
+ transformProbability
5597
+ }) => {
5598
+ var _a, _b;
5599
+ if (!chartData) {
5600
+ return {
5601
+ liveCandle: null,
5602
+ lineValue: void 0,
5603
+ live: false
5604
+ };
5605
+ }
5606
+ const venueEntries = selectedVenue ? Object.entries(chartData.venues).filter(([venue]) => venue === selectedVenue) : Object.entries(chartData.venues);
5607
+ if (venueEntries.length === 0) {
5608
+ return {
5609
+ liveCandle: null,
5610
+ lineValue: void 0,
5611
+ live: false
5612
+ };
5613
+ }
5614
+ const singleVenueView = selectedVenue != null || venueEntries.length === 1;
5615
+ const liveCandleEntry = singleVenueView ? venueEntries.find(([, venueData]) => venueData.liveCandle != null) : null;
5616
+ const primaryLineValue = (_b = (_a = venueEntries[0]) == null ? void 0 : _a[1]) == null ? void 0 : _b.lineValue;
5617
+ const lineValue = primaryLineValue != null ? toChartDisplayValue(primaryLineValue, transformProbability) : void 0;
5618
+ return {
5619
+ liveCandle: (liveCandleEntry == null ? void 0 : liveCandleEntry[1].liveCandle) ? marketChartCandleToScaledCandlePoint(liveCandleEntry[1].liveCandle, transformProbability) : null,
5620
+ lineValue,
5621
+ live: liveCandleEntry != null
5622
+ };
5623
+ };
5375
5624
 
5376
5625
  // src/events/item-details/index.tsx
5377
- var import_jsx_runtime81 = require("react/jsx-runtime");
5626
+ var import_jsx_runtime82 = require("react/jsx-runtime");
5378
5627
  var EventListItemDetailsLoadingState = ({
5379
5628
  classNames,
5380
5629
  ariaLabel
5381
5630
  }) => {
5382
- const labels = (0, import_hooks19.useLabels)();
5383
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5631
+ const labels = (0, import_hooks20.useLabels)();
5632
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5384
5633
  Skeleton,
5385
5634
  {
5386
5635
  view: "event-list-item-details",
@@ -5393,16 +5642,16 @@ var EventListItemDetailsUnavailableState = ({
5393
5642
  classNames,
5394
5643
  ariaLabel
5395
5644
  }) => {
5396
- const labels = (0, import_hooks19.useLabels)();
5397
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5645
+ const labels = (0, import_hooks20.useLabels)();
5646
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5398
5647
  Card,
5399
5648
  {
5400
5649
  className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
5401
5650
  role: "status",
5402
5651
  "aria-label": ariaLabel != null ? ariaLabel : labels.eventItemDetails.unavailableAria,
5403
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
5404
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
5405
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
5652
+ children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
5653
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "body-large-strong", className: cn("truncate", classNames == null ? void 0 : classNames.title), children: labels.eventItemDetails.unavailableTitle }),
5654
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "body", className: "text-agg-muted-foreground", children: labels.eventItemDetails.unavailableDescription })
5406
5655
  ] })
5407
5656
  }
5408
5657
  );
@@ -5411,8 +5660,8 @@ var EventListItemDetailsNotFoundState = ({
5411
5660
  classNames,
5412
5661
  ariaLabel
5413
5662
  }) => {
5414
- const labels = (0, import_hooks19.useLabels)();
5415
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5663
+ const labels = (0, import_hooks20.useLabels)();
5664
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Card, { className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5416
5665
  StateMessage,
5417
5666
  {
5418
5667
  ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
@@ -5436,31 +5685,23 @@ var resolveAverageProbability = (values) => {
5436
5685
  return void 0;
5437
5686
  return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
5438
5687
  };
5439
- var resolveOutcomeCandidateIds = (market, outcome) => {
5440
- var _a, _b;
5441
- const marketWithCanonicalId = market;
5442
- return [
5443
- outcome.id,
5444
- (_a = outcome.externalIdentifier) != null ? _a : void 0,
5445
- market.externalIdentifier,
5446
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0
5447
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
5448
- };
5449
5688
  var EventListItemDetailsGraphSection = ({
5450
5689
  venueMarkets,
5451
- canonicalMarketId,
5452
5690
  selectedOutcomeLabel,
5453
5691
  onSelectedOutcomeLabelChange,
5454
5692
  switchLabels,
5455
5693
  isDateOutcomeMarket,
5456
5694
  classNames,
5457
- showVenueLogo,
5458
5695
  venueInfo,
5459
5696
  formatPercent,
5460
5697
  selectedTimeRange,
5461
- selectedChartType
5698
+ selectedChartType,
5699
+ selectedOutcome: _selectedOutcome,
5700
+ selectedMarket
5462
5701
  }) => {
5463
- const labels = (0, import_hooks19.useLabels)();
5702
+ var _a, _b;
5703
+ const labels = (0, import_hooks20.useLabels)();
5704
+ const { enableLiveUpdates } = (0, import_hooks20.useSdkUiConfig)();
5464
5705
  const [selectedVenue, setSelectedVenue] = (0, import_react10.useState)(null);
5465
5706
  const [activeProbabilityMode, setActiveProbabilityMode] = (0, import_react10.useState)("yes");
5466
5707
  const probabilityModeConfigs = (0, import_react10.useMemo)(() => {
@@ -5529,106 +5770,72 @@ var EventListItemDetailsGraphSection = ({
5529
5770
  no: buildModeData("no")
5530
5771
  };
5531
5772
  }, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
5532
- const allOutcomesForHistory = (0, import_react10.useMemo)(() => {
5533
- const outcomeByModeAndId = /* @__PURE__ */ new Map();
5534
- probabilityModeOrder.forEach((mode) => {
5535
- selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
5536
- outcomeByModeAndId.set(
5537
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
5538
- outcomeByVenue
5539
- );
5540
- });
5541
- });
5542
- return [...outcomeByModeAndId.values()];
5543
- }, [selectedOutcomesByMode]);
5544
- const priceHistoryGroups = (0, import_react10.useMemo)(() => {
5545
- return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
5546
- }, [allOutcomesForHistory, canonicalMarketId]);
5547
5773
  const timeWindow = (0, import_react10.useMemo)(() => {
5548
5774
  return getTimeWindowByRange(selectedTimeRange);
5549
5775
  }, [selectedTimeRange]);
5776
+ const activeOutcomes = selectedOutcomesByMode[activeProbabilityMode];
5777
+ const activeCanonicalMarketId = (0, import_react10.useMemo)(() => {
5778
+ return resolveCanonicalMarketId(activeOutcomes.map((item) => item.market));
5779
+ }, [activeOutcomes]);
5780
+ const venueMarketIds = (0, import_react10.useMemo)(() => {
5781
+ return activeOutcomes.map((item) => item.market.id);
5782
+ }, [activeOutcomes]);
5550
5783
  const {
5551
- data: priceHistoryData,
5552
- isLoading: isPriceHistoryLoading,
5553
- error: priceHistoryError,
5554
- results: priceHistoryResults
5555
- } = (0, import_hooks19.usePriceHistory)(__spreadProps(__spreadValues({
5556
- groups: priceHistoryGroups
5557
- }, timeWindow), {
5558
- enabled: priceHistoryGroups.length > 0
5559
- }));
5560
- const priceHistoryByVenue = (0, import_react10.useMemo)(() => {
5561
- const historyByVenue = /* @__PURE__ */ new Map();
5562
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
5563
- return historyByVenue;
5564
- }
5565
- priceHistoryData.forEach((historyItem) => {
5566
- const venue = historyItem.venue;
5567
- const venueHistory = historyByVenue.get(venue);
5568
- if (venueHistory) {
5569
- venueHistory.push(historyItem);
5570
- return;
5571
- }
5572
- historyByVenue.set(venue, [historyItem]);
5573
- });
5574
- return historyByVenue;
5575
- }, [priceHistoryData]);
5576
- const chartSeriesByMode = (0, import_react10.useMemo)(() => {
5577
- const buildSeries = (mode) => {
5578
- const modeConfig = probabilityModeConfigs[mode];
5579
- const chartSeries = [];
5580
- normalizedVenueDataByMode[mode].forEach((venueData) => {
5581
- var _a;
5582
- const venueHistory = priceHistoryByVenue.get(venueData.venue);
5583
- if (!(venueHistory == null ? void 0 : venueHistory.length))
5584
- return;
5585
- const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
5586
- const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
5587
- if (!matchingHistory)
5588
- return;
5589
- const points = matchingHistory.points.map((point) => {
5590
- const probability = normalizeProbability(point.price);
5591
- if (probability == null || !Number.isFinite(point.timestamp))
5592
- return null;
5593
- const open = normalizeProbability(point.open);
5594
- const high = normalizeProbability(point.high);
5595
- const low = normalizeProbability(point.low);
5596
- const close = normalizeProbability(point.close);
5597
- const transformedPoint = {
5598
- time: point.timestamp,
5599
- value: clampProbability(modeConfig.transformProbability(probability)) * 100,
5600
- open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
5601
- high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
5602
- low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
5603
- close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
5604
- };
5605
- return transformedPoint;
5606
- }).filter((point) => point != null);
5607
- if (points.length === 0)
5608
- return;
5609
- chartSeries.push({
5610
- id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
5611
- venue: venueData.venue,
5612
- color: venueData.color,
5613
- points,
5614
- lineWidth: 2,
5615
- lineStyle: "solid"
5616
- });
5617
- });
5618
- return chartSeries;
5619
- };
5620
- return {
5621
- yes: buildSeries("yes"),
5622
- no: buildSeries("no")
5623
- };
5624
- }, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
5784
+ data: marketChartData,
5785
+ isLoading: isMarketChartLoading,
5786
+ error: marketChartError,
5787
+ refetch: refetchMarketChart
5788
+ } = (0, import_hooks20.useMarketChart)({
5789
+ marketId: (_a = selectedMarket == null ? void 0 : selectedMarket.id) != null ? _a : null,
5790
+ venueMarketIds,
5791
+ interval: (0, import_hooks20.timeRangeToInterval)(selectedTimeRange),
5792
+ startTs: timeWindow.startTs * 1e3,
5793
+ endTs: timeWindow.endTs * 1e3,
5794
+ enabled: !!(selectedMarket == null ? void 0 : selectedMarket.id),
5795
+ live: enableLiveUpdates
5796
+ });
5625
5797
  const visibleChartSeries = (0, import_react10.useMemo)(() => {
5626
- const modeSeries = chartSeriesByMode[activeProbabilityMode];
5627
- if (!selectedVenue)
5628
- return modeSeries;
5629
- return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
5630
- }, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
5631
- const segmentedDisplayItems = (0, import_react10.useMemo)(() => {
5798
+ const transformProbability = probabilityModeConfigs[activeProbabilityMode].transformProbability;
5799
+ const colorByVenue = new Map(
5800
+ normalizedVenueDataByMode[activeProbabilityMode].map((venueData) => [
5801
+ venueData.venue,
5802
+ venueData.color
5803
+ ])
5804
+ );
5805
+ const series = resolveMarketChartVenueSeries({
5806
+ chartData: marketChartData,
5807
+ transformProbability
5808
+ }).map((seriesItem) => {
5809
+ var _a2;
5810
+ const resolvedVenue = seriesItem.venue;
5811
+ return {
5812
+ id: `${activeProbabilityMode}-${resolvedVenue}-${activeCanonicalMarketId != null ? activeCanonicalMarketId : "chart"}`,
5813
+ venue: resolvedVenue,
5814
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
5815
+ points: seriesItem.points,
5816
+ lineWidth: 2,
5817
+ lineStyle: "solid"
5818
+ };
5819
+ });
5820
+ if (!selectedVenue)
5821
+ return series;
5822
+ return series.filter((seriesItem) => seriesItem.venue === selectedVenue);
5823
+ }, [
5824
+ activeCanonicalMarketId,
5825
+ activeProbabilityMode,
5826
+ marketChartData,
5827
+ normalizedVenueDataByMode,
5828
+ probabilityModeConfigs,
5829
+ selectedVenue
5830
+ ]);
5831
+ const chartLiveState = (0, import_react10.useMemo)(() => {
5832
+ return resolveMarketChartLiveState({
5833
+ chartData: marketChartData,
5834
+ selectedVenue,
5835
+ transformProbability: probabilityModeConfigs[activeProbabilityMode].transformProbability
5836
+ });
5837
+ }, [activeProbabilityMode, marketChartData, probabilityModeConfigs, selectedVenue]);
5838
+ const segmentedDisplayItems = (0, import_react10.useMemo)(() => {
5632
5839
  return probabilityModeOrder.map((mode) => {
5633
5840
  const averageProbability = resolveAverageProbability(
5634
5841
  normalizedVenueDataByMode[mode].map((venueData) => venueData.probability)
@@ -5665,48 +5872,41 @@ var EventListItemDetailsGraphSection = ({
5665
5872
  return venue;
5666
5873
  });
5667
5874
  };
5668
- const handleRetryPriceHistory = () => {
5669
- void Promise.all(priceHistoryResults.map((result) => result.refetch()));
5875
+ const handleRetryMarketChart = () => {
5876
+ void refetchMarketChart();
5670
5877
  };
5671
- if (priceHistoryError) {
5672
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5673
- "div",
5878
+ if (marketChartError) {
5879
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: cn("w-full", classNames == null ? void 0 : classNames.chart), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5880
+ StateMessage,
5674
5881
  {
5675
- className: cn(
5676
- "w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
5677
- classNames == null ? void 0 : classNames.chart
5678
- ),
5679
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5680
- StateMessage,
5681
- {
5682
- ariaLabel: labels.eventItemDetails.chartUnavailableAria,
5683
- tone: "warning",
5684
- title: labels.eventItemDetails.chartUnavailableTitle,
5685
- description: labels.eventItemDetails.chartUnavailableDescription,
5686
- actionLabel: labels.common.retry,
5687
- onAction: handleRetryPriceHistory,
5688
- className: "min-h-[300px] px-5 py-10 md:px-10"
5689
- }
5690
- )
5882
+ tone: "warning",
5883
+ ariaLabel: labels.eventItemDetails.chartUnavailableAria,
5884
+ title: labels.eventItemDetails.chartUnavailableTitle,
5885
+ description: labels.eventItemDetails.chartUnavailableDescription,
5886
+ actionLabel: labels.common.retry,
5887
+ onAction: handleRetryMarketChart,
5888
+ className: "min-h-[300px] px-5 py-10 md:px-10"
5691
5889
  }
5692
- );
5890
+ ) });
5693
5891
  }
5694
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5892
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5695
5893
  LineChart,
5696
5894
  {
5697
5895
  classNames: { root: classNames == null ? void 0 : classNames.chart },
5698
5896
  series: visibleChartSeries,
5699
5897
  height: 300,
5700
- isLoading: isPriceHistoryLoading,
5898
+ isLoading: isMarketChartLoading,
5701
5899
  chartType: selectedChartType,
5900
+ liveCandle: selectedChartType === "candlestick" ? (_b = chartLiveState.liveCandle) != null ? _b : void 0 : void 0,
5901
+ lineValue: chartLiveState.lineValue,
5702
5902
  showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
5703
5903
  renderSeriesControls: () => {
5704
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
5904
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
5705
5905
  "div",
5706
5906
  {
5707
5907
  className: cn("flex flex-row items-center justify-between gap-4", classNames == null ? void 0 : classNames.summary),
5708
5908
  children: [
5709
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5909
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5710
5910
  "div",
5711
5911
  {
5712
5912
  className: cn(
@@ -5714,10 +5914,10 @@ var EventListItemDetailsGraphSection = ({
5714
5914
  classNames == null ? void 0 : classNames.outcomeBadges
5715
5915
  ),
5716
5916
  children: activeModeVenueData.map((venueData) => {
5717
- var _a;
5917
+ var _a2;
5718
5918
  const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
5719
5919
  const isActiveVenue = selectedVenue === venueData.venue;
5720
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5920
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5721
5921
  "button",
5722
5922
  {
5723
5923
  type: "button",
@@ -5726,19 +5926,19 @@ var EventListItemDetailsGraphSection = ({
5726
5926
  className: cn(
5727
5927
  "rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover"
5728
5928
  ),
5729
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5929
+ children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5730
5930
  Badge,
5731
5931
  {
5732
5932
  text,
5733
5933
  size: "large",
5734
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5934
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5735
5935
  VenueLogo,
5736
5936
  {
5737
5937
  venue: venueData.venue,
5738
5938
  size: "small",
5739
- title: (_a = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a.label
5939
+ title: (_a2 = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a2.label
5740
5940
  }
5741
- ) : void 0,
5941
+ ),
5742
5942
  classNames: {
5743
5943
  root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
5744
5944
  },
@@ -5756,7 +5956,7 @@ var EventListItemDetailsGraphSection = ({
5756
5956
  })
5757
5957
  }
5758
5958
  ),
5759
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
5959
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5760
5960
  SwitchButton,
5761
5961
  {
5762
5962
  ariaLabel: labels.eventItemDetails.outcomeSelectorAria,
@@ -5779,46 +5979,55 @@ var EventListItemDetailsGraphSection = ({
5779
5979
  };
5780
5980
  var EventListItemDetailsContent = ({
5781
5981
  event,
5782
- title,
5783
- image,
5784
- showVenueLogo = true,
5785
5982
  classNames,
5786
5983
  venueInfo,
5787
5984
  detailsStats,
5788
5985
  ariaLabel,
5789
- defaultTimeRange
5986
+ defaultTimeRange,
5987
+ onClick
5790
5988
  }) => {
5791
- var _a, _b;
5792
- const config = (0, import_hooks19.useSdkUiConfig)();
5793
- const labels = (0, import_hooks19.useLabels)();
5989
+ var _a;
5990
+ const config = (0, import_hooks20.useSdkUiConfig)();
5991
+ const labels = (0, import_hooks20.useLabels)();
5794
5992
  const venueMarkets = (0, import_react10.useMemo)(() => {
5795
- var _a2, _b2, _c;
5796
- return (_c = (_b2 = (_a2 = event.markets) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.venueMarkets) != null ? _c : [];
5797
- }, [event.markets]);
5993
+ var _a2;
5994
+ return (_a2 = event.venueMarkets) != null ? _a2 : [];
5995
+ }, [event.venueMarkets]);
5996
+ const [selectedMarket, setSelectedMarket] = (0, import_react10.useState)(venueMarkets[0]);
5997
+ const [selectedOutcome] = (0, import_react10.useState)(
5998
+ (_a = selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes.find(
5999
+ (outcome) => outcome.winner
6000
+ )) != null ? _a : selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes[0]
6001
+ );
5798
6002
  const primaryVenueMarket = (0, import_react10.useMemo)(() => {
5799
6003
  return selectPrimaryVenueMarket(venueMarkets);
5800
6004
  }, [venueMarkets]);
6005
+ const filteredVenueMarkets = (0, import_react10.useMemo)(() => {
6006
+ if (!selectedMarket)
6007
+ return venueMarkets;
6008
+ return venueMarkets.filter(
6009
+ (vm) => vm.question === (selectedMarket == null ? void 0 : selectedMarket.question)
6010
+ );
6011
+ }, [venueMarkets, selectedMarket]);
5801
6012
  const outcomeLabels = (0, import_react10.useMemo)(() => {
5802
- return resolveOutcomeLabels(venueMarkets);
5803
- }, [venueMarkets]);
6013
+ return resolveOutcomeLabels(filteredVenueMarkets);
6014
+ }, [filteredVenueMarkets]);
5804
6015
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react10.useState)(() => {
5805
6016
  return resolveDefaultOutcomeLabel(outcomeLabels);
5806
6017
  });
6018
+ const configTimeRange = config.defaultChartTimeRange;
5807
6019
  const [selectedTimeRange, setSelectedTimeRange] = (0, import_react10.useState)(() => {
5808
- return getDefaultSelectedTimeRange(defaultTimeRange);
6020
+ return getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange);
5809
6021
  });
5810
6022
  const [selectedChartType, setSelectedChartType] = (0, import_react10.useState)("line");
5811
6023
  (0, import_react10.useEffect)(() => {
5812
- setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
5813
- }, [defaultTimeRange]);
5814
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
5815
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
6024
+ setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange));
6025
+ }, [defaultTimeRange, configTimeRange]);
5816
6026
  const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
5817
- const outcomeSelectorLabels = outcomeLabels;
5818
6027
  const probabilityByLabel = (0, import_react10.useMemo)(() => {
5819
6028
  return new Map(
5820
6029
  outcomeLabels.map((label) => {
5821
- const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
6030
+ const outcomesByVenue = resolveOutcomesByVenue(filteredVenueMarkets, label);
5822
6031
  const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
5823
6032
  if (probabilities.length === 0) {
5824
6033
  return [label, void 0];
@@ -5827,14 +6036,14 @@ var EventListItemDetailsContent = ({
5827
6036
  return [label, averageProbability];
5828
6037
  })
5829
6038
  );
5830
- }, [outcomeLabels, venueMarkets]);
6039
+ }, [outcomeLabels, filteredVenueMarkets]);
5831
6040
  const mainOutcomeLabel = (0, import_react10.useMemo)(() => {
5832
6041
  if (outcomeLabels.length === 0)
5833
6042
  return void 0;
5834
6043
  return [...outcomeLabels].sort((left, right) => {
5835
- var _a2, _b2;
6044
+ var _a2, _b;
5836
6045
  const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
5837
- const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
6046
+ const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
5838
6047
  return rightProbability - leftProbability;
5839
6048
  })[0];
5840
6049
  }, [outcomeLabels, probabilityByLabel]);
@@ -5850,18 +6059,18 @@ var EventListItemDetailsContent = ({
5850
6059
  setSelectedOutcomeLabel(fallbackOutcomeLabel);
5851
6060
  }, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
5852
6061
  const switchLabels = (0, import_react10.useMemo)(() => {
5853
- var _a2, _b2;
6062
+ var _a2, _b;
5854
6063
  if (isDateOutcomeMarket) {
5855
6064
  return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
5856
6065
  }
5857
6066
  const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
5858
- var _a3, _b3;
6067
+ var _a3, _b2;
5859
6068
  const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
5860
- const rightProbability = (_b3 = probabilityByLabel.get(right)) != null ? _b3 : -1;
6069
+ const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
5861
6070
  return rightProbability - leftProbability;
5862
6071
  });
5863
6072
  const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
5864
- const secondLabel = (_b2 = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b2 : firstLabel;
6073
+ const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
5865
6074
  return [firstLabel, secondLabel];
5866
6075
  }, [
5867
6076
  isDateOutcomeMarket,
@@ -5878,33 +6087,43 @@ var EventListItemDetailsContent = ({
5878
6087
  return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
5879
6088
  }, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
5880
6089
  if (!primaryVenueMarket || !selectedOutcomeLabel) {
5881
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
6090
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6091
+ EventListItemDetailsUnavailableState,
6092
+ {
6093
+ classNames,
6094
+ ariaLabel: ariaLabel != null ? ariaLabel : event.title
6095
+ }
6096
+ );
5882
6097
  }
5883
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
6098
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
5884
6099
  Card,
5885
6100
  {
5886
6101
  className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
5887
- "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
6102
+ "aria-label": ariaLabel != null ? ariaLabel : event.title,
6103
+ onClick: () => {
6104
+ onClick == null ? void 0 : onClick(event);
6105
+ },
5888
6106
  children: [
5889
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
6107
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
5890
6108
  "div",
5891
6109
  {
5892
6110
  className: cn(
5893
6111
  "flex flex-row gap-3 md:gap-4",
5894
- "items-center justify-start",
6112
+ venueMarkets.length > 1 ? "items-start" : "items-center",
6113
+ "justify-start",
5895
6114
  classNames == null ? void 0 : classNames.header
5896
6115
  ),
5897
6116
  children: [
5898
- resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6117
+ event.image ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5899
6118
  RemoteImage,
5900
6119
  {
5901
- src: resolvedImage,
6120
+ src: event.image,
5902
6121
  alt: "",
5903
6122
  className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
5904
6123
  }
5905
6124
  ) : null,
5906
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
5907
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6125
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-3", children: [
6126
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5908
6127
  Typography,
5909
6128
  {
5910
6129
  variant: "body-strong",
@@ -5913,20 +6132,19 @@ var EventListItemDetailsContent = ({
5913
6132
  "truncate text-wrap wrap-break-word line-clamp-2",
5914
6133
  classNames == null ? void 0 : classNames.title
5915
6134
  ),
5916
- children: resolvedTitle
6135
+ children: event.title
5917
6136
  }
5918
6137
  ),
5919
- outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6138
+ venueMarkets.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5920
6139
  "div",
5921
6140
  {
5922
6141
  className: cn(
5923
- "flex items-center gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
6142
+ "flex flex-row flex-nowrap items-center gap-2 overflow-x-auto pb-1 md:pb-0",
5924
6143
  classNames == null ? void 0 : classNames.headerPills
5925
6144
  ),
5926
- children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
5927
- const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
5928
- const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
5929
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6145
+ children: venueMarkets.map((venueMarket) => {
6146
+ const isActive = (selectedMarket == null ? void 0 : selectedMarket.id) === venueMarket.id;
6147
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5930
6148
  Button,
5931
6149
  {
5932
6150
  size: "small",
@@ -5937,10 +6155,14 @@ var EventListItemDetailsContent = ({
5937
6155
  "border-2",
5938
6156
  isActive ? "border-agg-primary bg-agg-secondary text-agg-foreground font-agg-bold" : "border-transparent bg-agg-secondary-hover text-agg-foreground font-agg-normal"
5939
6157
  ),
5940
- onClick: () => setSelectedOutcomeLabel(outcomeSelectorLabel),
5941
- children: displayLabel
6158
+ onClick: (e) => {
6159
+ e.stopPropagation();
6160
+ e.preventDefault();
6161
+ setSelectedMarket(venueMarket);
6162
+ },
6163
+ children: venueMarket.question
5942
6164
  },
5943
- outcomeSelectorLabel
6165
+ venueMarket.id
5944
6166
  );
5945
6167
  })
5946
6168
  }
@@ -5949,12 +6171,12 @@ var EventListItemDetailsContent = ({
5949
6171
  ]
5950
6172
  }
5951
6173
  ),
5952
- detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
6174
+ detailsStats && detailsStats.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: cn("flex flex-wrap items-start gap-4 md:gap-6", classNames == null ? void 0 : classNames.headerStats), children: detailsStats.map((statItem) => {
5953
6175
  const deltaClassName = statItem.deltaTone === "positive" ? "text-agg-success!" : statItem.deltaTone === "negative" ? "text-agg-error!" : "text-agg-muted-foreground";
5954
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex flex-col gap-1", children: [
5955
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
5956
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "flex items-baseline gap-1", children: [
5957
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6176
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col gap-1", children: [
6177
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "caption-caps", className: "text-agg-muted-foreground", children: statItem.label }),
6178
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex items-baseline gap-1", children: [
6179
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5958
6180
  Typography,
5959
6181
  {
5960
6182
  variant: "body",
@@ -5962,35 +6184,35 @@ var EventListItemDetailsContent = ({
5962
6184
  children: statItem.value
5963
6185
  }
5964
6186
  ),
5965
- statItem.delta ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
6187
+ statItem.delta ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "label", className: cn(deltaClassName), children: statItem.delta }) : null
5966
6188
  ] })
5967
6189
  ] }, `${statItem.label}-${statItem.value}`);
5968
6190
  }) }) : null,
5969
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6191
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5970
6192
  EventListItemDetailsGraphSection,
5971
6193
  {
5972
- venueMarkets,
5973
- canonicalMarketId: (_b = (_a = event.markets) == null ? void 0 : _a[0]) == null ? void 0 : _b.id,
6194
+ selectedOutcome,
6195
+ selectedMarket,
6196
+ venueMarkets: filteredVenueMarkets,
5974
6197
  selectedOutcomeLabel,
5975
6198
  onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
5976
6199
  switchLabels,
5977
6200
  isDateOutcomeMarket,
5978
6201
  classNames,
5979
- showVenueLogo,
5980
6202
  venueInfo,
5981
6203
  formatPercent: config.formatPercent,
5982
6204
  selectedTimeRange,
5983
6205
  selectedChartType
5984
6206
  }
5985
6207
  ),
5986
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
5987
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
5988
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
5989
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
5990
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
6208
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("flex flex-wrap items-center justify-between gap-4", classNames == null ? void 0 : classNames.footer), children: [
6209
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: volumeLabel || "-" }),
6210
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("flex flex-wrap items-center gap-2 md:gap-3", classNames == null ? void 0 : classNames.timeRange), children: [
6211
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(ChartTypeSwitch, { value: selectedChartType, onValueChange: setSelectedChartType }),
6212
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
5991
6213
  eventListItemDetailsTimeRanges.map((timeRange) => {
5992
6214
  const isActive = timeRange === selectedTimeRange;
5993
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6215
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
5994
6216
  Button,
5995
6217
  {
5996
6218
  size: "small",
@@ -6002,7 +6224,11 @@ var EventListItemDetailsContent = ({
6002
6224
  isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
6003
6225
  ),
6004
6226
  "aria-pressed": isActive,
6005
- onClick: () => setSelectedTimeRange(timeRange),
6227
+ onClick: (e) => {
6228
+ e.stopPropagation();
6229
+ e.preventDefault();
6230
+ setSelectedTimeRange(timeRange);
6231
+ },
6006
6232
  children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
6007
6233
  },
6008
6234
  timeRange
@@ -6020,19 +6246,21 @@ var EventListItemDetailsByEventId = (_a) => {
6020
6246
  } = _b, rest = __objRest(_b, [
6021
6247
  "eventId"
6022
6248
  ]);
6249
+ const resolvedEventId = eventId != null ? eventId : "";
6023
6250
  const {
6024
6251
  event: fetchedEvent,
6025
6252
  error,
6026
6253
  isError,
6027
6254
  isLoading
6028
- } = (0, import_hooks19.useEvent)(eventId, {
6029
- enabled: !!eventId
6255
+ } = (0, import_hooks20.useVenueEvent)({
6256
+ eventId: resolvedEventId,
6257
+ enabled: !!resolvedEventId
6030
6258
  });
6031
6259
  const resolvedEvent = (0, import_react10.useMemo)(() => {
6032
6260
  return resolveEventListItemEvent(fetchedEvent);
6033
6261
  }, [fetchedEvent]);
6034
- if (!eventId) {
6035
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6262
+ if (!resolvedEventId) {
6263
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6036
6264
  EventListItemDetailsUnavailableState,
6037
6265
  {
6038
6266
  classNames: rest.classNames,
@@ -6041,16 +6269,16 @@ var EventListItemDetailsByEventId = (_a) => {
6041
6269
  );
6042
6270
  }
6043
6271
  if (isLoading) {
6044
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6272
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6045
6273
  }
6046
6274
  if (isErrorWithStatus(error, 404)) {
6047
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6275
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsNotFoundState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6048
6276
  }
6049
6277
  if (!fetchedEvent && !isError) {
6050
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6278
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsLoadingState, { classNames: rest.classNames, ariaLabel: rest.ariaLabel });
6051
6279
  }
6052
6280
  if (!resolvedEvent) {
6053
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6281
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6054
6282
  EventListItemDetailsUnavailableState,
6055
6283
  {
6056
6284
  classNames: rest.classNames,
@@ -6058,42 +6286,38 @@ var EventListItemDetailsByEventId = (_a) => {
6058
6286
  }
6059
6287
  );
6060
6288
  }
6061
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
6289
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsContent, __spreadValues({ event: resolvedEvent }, rest));
6062
6290
  };
6063
6291
  var EventListItemDetails = (props) => {
6064
6292
  if (props.isLoading) {
6065
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
6293
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsLoadingState, { classNames: props.classNames, ariaLabel: props.ariaLabel });
6066
6294
  }
6067
6295
  if ("event" in props && props.event) {
6068
6296
  const _a = props, { event } = _a, rest = __objRest(_a, ["event"]);
6069
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsContent, __spreadValues({ event }, rest));
6297
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsContent, __spreadValues({ event }, rest));
6070
6298
  }
6071
6299
  if ("eventId" in props && typeof props.eventId === "string") {
6072
6300
  const {
6073
- title: titleOverride,
6074
- image: imageOverride,
6075
- showVenueLogo: showVenueLogoOverride,
6076
6301
  classNames,
6077
6302
  venueInfo,
6078
6303
  detailsStats,
6079
6304
  ariaLabel: ariaLabelOverride,
6080
- defaultTimeRange: defaultTimeRangeOverride
6305
+ defaultTimeRange: defaultTimeRangeOverride,
6306
+ onClick
6081
6307
  } = props;
6082
6308
  const byEventIdProps = {
6083
6309
  eventId: props.eventId,
6084
6310
  isLoading: false,
6085
- title: titleOverride,
6086
- image: imageOverride,
6087
- showVenueLogo: showVenueLogoOverride,
6088
6311
  classNames,
6089
6312
  venueInfo,
6090
6313
  detailsStats,
6091
6314
  ariaLabel: ariaLabelOverride,
6092
- defaultTimeRange: defaultTimeRangeOverride
6315
+ defaultTimeRange: defaultTimeRangeOverride,
6316
+ onClick
6093
6317
  };
6094
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
6318
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
6095
6319
  }
6096
- return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
6320
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6097
6321
  EventListItemDetailsUnavailableState,
6098
6322
  {
6099
6323
  classNames: props.classNames,
@@ -6105,7 +6329,7 @@ EventListItemDetails.displayName = "EventListItemDetails";
6105
6329
 
6106
6330
  // src/events/market-details/index.tsx
6107
6331
  var import_react11 = require("react");
6108
- var import_hooks20 = require("@agg-market/hooks");
6332
+ var import_hooks21 = require("@agg-market/hooks");
6109
6333
 
6110
6334
  // src/events/market-details/market-details.utils.ts
6111
6335
  var import_dayjs4 = __toESM(require("dayjs"));
@@ -6136,12 +6360,47 @@ var resolveInitialTab = (defaultTab) => {
6136
6360
  return parsedTab.data;
6137
6361
  return "order-book";
6138
6362
  };
6139
- var resolveMarket = (event, marketId) => {
6140
- if (!event.markets.length)
6363
+ var resolveMarketFromVenueMarkets = (venueMarkets, marketId) => {
6364
+ var _a, _b;
6365
+ if (!venueMarkets || venueMarkets.length === 0)
6141
6366
  return void 0;
6142
- if (!marketId)
6143
- return event.markets[0];
6144
- return event.markets.find((market) => market.id === marketId);
6367
+ if (!marketId) {
6368
+ const primary = selectPrimaryVenueMarket(venueMarkets);
6369
+ const totalVolume2 = venueMarkets.reduce((sum, vm) => {
6370
+ return sum + (typeof vm.volume === "number" ? vm.volume : 0);
6371
+ }, 0);
6372
+ return {
6373
+ id: (_a = primary == null ? void 0 : primary.id) != null ? _a : venueMarkets[0].id,
6374
+ venueMarkets,
6375
+ volume: totalVolume2 || (primary == null ? void 0 : primary.volume),
6376
+ status: primary == null ? void 0 : primary.status,
6377
+ startDate: primary == null ? void 0 : primary.startDate,
6378
+ endDate: primary == null ? void 0 : primary.endDate,
6379
+ creationDate: primary == null ? void 0 : primary.creationDate,
6380
+ question: (_b = primary == null ? void 0 : primary.question) != null ? _b : venueMarkets[0].question
6381
+ };
6382
+ }
6383
+ const matchedVenueMarket = venueMarkets.find(
6384
+ (vm) => vm.id === marketId || vm.externalIdentifier === marketId
6385
+ );
6386
+ if (!matchedVenueMarket)
6387
+ return void 0;
6388
+ const siblingVenueMarkets = venueMarkets.filter(
6389
+ (vm) => vm.question === matchedVenueMarket.question
6390
+ );
6391
+ const totalVolume = siblingVenueMarkets.reduce((sum, vm) => {
6392
+ return sum + (typeof vm.volume === "number" ? vm.volume : 0);
6393
+ }, 0);
6394
+ return {
6395
+ id: matchedVenueMarket.id,
6396
+ venueMarkets: siblingVenueMarkets,
6397
+ volume: totalVolume || matchedVenueMarket.volume,
6398
+ status: matchedVenueMarket.status,
6399
+ startDate: matchedVenueMarket.startDate,
6400
+ endDate: matchedVenueMarket.endDate,
6401
+ creationDate: matchedVenueMarket.creationDate,
6402
+ question: matchedVenueMarket.question
6403
+ };
6145
6404
  };
6146
6405
  var resolveDisplayOutcomeLabels = (labels) => {
6147
6406
  if (!hasBinaryLabels(labels))
@@ -6209,7 +6468,8 @@ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
6209
6468
  label,
6210
6469
  probability: probabilityByLabel.get(label),
6211
6470
  tone: resolveOutcomeTone(label, index),
6212
- isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
6471
+ isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : ""),
6472
+ venue: venueMarkets[0].venue
6213
6473
  };
6214
6474
  });
6215
6475
  };
@@ -6300,23 +6560,23 @@ var resolveOtherTabRows = (market, labels) => {
6300
6560
  return rows;
6301
6561
  };
6302
6562
  var buildMarketDetailsModel = ({
6303
- event,
6563
+ venueMarkets,
6304
6564
  marketId,
6305
6565
  title,
6306
6566
  image,
6307
6567
  formatCompactCurrency,
6308
6568
  labels
6309
6569
  }) => {
6310
- var _a;
6311
- const market = resolveMarket(event, marketId);
6570
+ var _a, _b;
6571
+ const market = resolveMarketFromVenueMarkets(venueMarkets, marketId);
6312
6572
  if (!market)
6313
6573
  return void 0;
6314
6574
  const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
6315
6575
  if (!primaryVenueMarket)
6316
6576
  return void 0;
6317
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
6318
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
6319
- const resolvedVolume = typeof market.volume === "number" ? market.volume : (_a = primaryVenueMarket.volume) != null ? _a : void 0;
6577
+ const resolvedTitle = (title == null ? void 0 : title.trim()) || primaryVenueMarket.question || market.question;
6578
+ const resolvedImage = (_a = typeof image === "string" && image.trim() ? image : void 0) != null ? _a : typeof primaryVenueMarket.image === "string" && primaryVenueMarket.image.trim() ? primaryVenueMarket.image : void 0;
6579
+ const resolvedVolume = typeof market.volume === "number" ? market.volume : (_b = primaryVenueMarket.volume) != null ? _b : void 0;
6320
6580
  const subtitle = resolveSubtitle({
6321
6581
  venueMarkets: market.venueMarkets,
6322
6582
  volume: resolvedVolume,
@@ -6337,14 +6597,14 @@ var buildMarketDetailsModel = ({
6337
6597
  };
6338
6598
 
6339
6599
  // src/events/market-details/index.tsx
6340
- var import_jsx_runtime82 = require("react/jsx-runtime");
6600
+ var import_jsx_runtime83 = require("react/jsx-runtime");
6341
6601
  var MarketDetailsLoadingState = ({
6342
6602
  isOpened = marketDetailsDefaultIsOpened,
6343
6603
  ariaLabel,
6344
6604
  classNames
6345
6605
  }) => {
6346
- const labels = (0, import_hooks20.useLabels)();
6347
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6606
+ const labels = (0, import_hooks21.useLabels)();
6607
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6348
6608
  Skeleton,
6349
6609
  {
6350
6610
  view: isOpened ? "market-details-detailed" : "market-details-minified",
@@ -6357,16 +6617,16 @@ var MarketDetailsUnavailableState = ({
6357
6617
  ariaLabel,
6358
6618
  classNames
6359
6619
  }) => {
6360
- const labels = (0, import_hooks20.useLabels)();
6361
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6620
+ const labels = (0, import_hooks21.useLabels)();
6621
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6362
6622
  Card,
6363
6623
  {
6364
6624
  className: cn(marketDetailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
6365
6625
  role: "status",
6366
6626
  "aria-label": ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
6367
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col gap-1 p-5", children: [
6368
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
6369
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
6627
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-1 p-5", children: [
6628
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.unavailableTitle }),
6629
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.marketDetails.unavailableDescription })
6370
6630
  ] })
6371
6631
  }
6372
6632
  );
@@ -6375,8 +6635,8 @@ var MarketDetailsNotFoundState = ({
6375
6635
  ariaLabel,
6376
6636
  classNames
6377
6637
  }) => {
6378
- const labels = (0, import_hooks20.useLabels)();
6379
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6638
+ const labels = (0, import_hooks21.useLabels)();
6639
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6380
6640
  StateMessage,
6381
6641
  {
6382
6642
  ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
@@ -6393,7 +6653,7 @@ var OrderBookRows = ({
6393
6653
  formatCurrency,
6394
6654
  visibleRows
6395
6655
  }) => {
6396
- const labels = (0, import_hooks20.useLabels)();
6656
+ const labels = (0, import_hooks21.useLabels)();
6397
6657
  const isAsks = title === labels.marketDetails.asks;
6398
6658
  const priceClassName = isAsks ? "text-agg-orderbook-ask" : "text-agg-orderbook-bid";
6399
6659
  const barClassName = isAsks ? "bg-agg-orderbook-ask/10" : "bg-agg-orderbook-bid/10";
@@ -6402,20 +6662,20 @@ var OrderBookRows = ({
6402
6662
  const orderBookDividerHeightPx = 1;
6403
6663
  const orderBookRowGapPx = 8;
6404
6664
  const orderBookVisibleHeightPx = maxVisibleRows * orderBookRowHeightPx + Math.max(0, maxVisibleRows - 1) * (orderBookDividerHeightPx + orderBookRowGapPx);
6405
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col gap-2", children: [
6406
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "caption-caps", children: title }),
6407
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6665
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-2", children: [
6666
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "caption-caps", children: title }),
6667
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6408
6668
  "div",
6409
6669
  {
6410
6670
  className: "overflow-y-auto pr-1 flex flex-col gap-2",
6411
6671
  style: { maxHeight: `${orderBookVisibleHeightPx}px` },
6412
6672
  role: "region",
6413
6673
  "aria-label": `${title} order book levels`,
6414
- children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col gap-2", children: [
6415
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2 md:grid-cols-[88px_1fr_1fr_minmax(120px,220px)] md:gap-6", children: [
6416
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex items-center gap-1 md:gap-3", children: [
6417
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(VenueLogo, { venue: row.venue, size: "small" }),
6418
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6674
+ children: rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-2", children: [
6675
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "grid grid-cols-[52px_1fr_1fr_52px] items-center gap-2 md:grid-cols-[88px_1fr_1fr_minmax(120px,220px)] md:gap-6", children: [
6676
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center gap-1 md:gap-3", children: [
6677
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(VenueLogo, { venue: row.venue, size: "small" }),
6678
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6419
6679
  "span",
6420
6680
  {
6421
6681
  className: cn(
@@ -6426,9 +6686,9 @@ var OrderBookRows = ({
6426
6686
  }
6427
6687
  )
6428
6688
  ] }),
6429
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatNumber(row.size) }),
6430
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatCurrency(row.total) }),
6431
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
6689
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatNumber(row.size) }),
6690
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate text-agg-xs leading-agg-4 text-center text-agg-foreground md:text-agg-sm md:leading-agg-5", children: formatCurrency(row.total) }),
6691
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6432
6692
  "div",
6433
6693
  {
6434
6694
  "aria-hidden": "true",
@@ -6439,7 +6699,7 @@ var OrderBookRows = ({
6439
6699
  }
6440
6700
  ) })
6441
6701
  ] }),
6442
- index < rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null
6702
+ index < rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "h-px w-full bg-agg-separator" }) : null
6443
6703
  ] }, row.id))
6444
6704
  }
6445
6705
  )
@@ -6462,7 +6722,7 @@ var getOutcomeButtonClassName = ({
6462
6722
  );
6463
6723
  };
6464
6724
  var MarketDetailsContent = ({
6465
- event,
6725
+ venueMarkets,
6466
6726
  marketId,
6467
6727
  title,
6468
6728
  image,
@@ -6470,28 +6730,29 @@ var MarketDetailsContent = ({
6470
6730
  onOpenChange,
6471
6731
  defaultTab,
6472
6732
  defaultOutcomeLabel,
6473
- defaultTimeRange = "1M",
6733
+ defaultTimeRange,
6474
6734
  orderBookDepth = orderBookRowLimitDefault,
6475
6735
  ariaLabel,
6476
6736
  classNames,
6477
6737
  otherContent
6478
6738
  }) => {
6479
- const config = (0, import_hooks20.useSdkUiConfig)();
6480
- const labels = (0, import_hooks20.useLabels)();
6739
+ var _a, _b, _c, _d;
6740
+ const config = (0, import_hooks21.useSdkUiConfig)();
6741
+ const labels = (0, import_hooks21.useLabels)();
6481
6742
  const detailsContentId = (0, import_react11.useId)();
6482
6743
  const model = (0, import_react11.useMemo)(() => {
6483
6744
  return buildMarketDetailsModel({
6484
- event,
6745
+ venueMarkets,
6485
6746
  marketId,
6486
6747
  title,
6487
6748
  image,
6488
6749
  formatCompactCurrency: config.formatCompactCurrency,
6489
6750
  labels
6490
6751
  });
6491
- }, [config.formatCompactCurrency, event, image, labels, marketId, title]);
6752
+ }, [config.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
6492
6753
  const resolvedMarket = (0, import_react11.useMemo)(() => {
6493
- return resolveMarket(event, marketId);
6494
- }, [event, marketId]);
6754
+ return resolveMarketFromVenueMarkets(venueMarkets, marketId);
6755
+ }, [venueMarkets, marketId]);
6495
6756
  const marketDetailsTabs = (0, import_react11.useMemo)(() => {
6496
6757
  return getMarketDetailsTabs(labels);
6497
6758
  }, [labels]);
@@ -6502,22 +6763,23 @@ var MarketDetailsContent = ({
6502
6763
  (0, import_react11.useEffect)(() => {
6503
6764
  setSelectedTab(resolveInitialTab(defaultTab));
6504
6765
  }, [defaultTab]);
6505
- const [selectedTimeRange, setSelectedTimeRange] = (0, import_react11.useState)(defaultTimeRange);
6766
+ const resolvedDefaultTimeRange = (_a = defaultTimeRange != null ? defaultTimeRange : config.defaultChartTimeRange) != null ? _a : "1D";
6767
+ const [selectedTimeRange, setSelectedTimeRange] = (0, import_react11.useState)(resolvedDefaultTimeRange);
6506
6768
  const [selectedChartType, setSelectedChartType] = (0, import_react11.useState)("line");
6507
6769
  (0, import_react11.useEffect)(() => {
6508
- setSelectedTimeRange(defaultTimeRange);
6509
- }, [defaultTimeRange]);
6770
+ setSelectedTimeRange(resolvedDefaultTimeRange);
6771
+ }, [resolvedDefaultTimeRange]);
6510
6772
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react11.useState)(
6511
6773
  () => {
6512
- var _a;
6513
- return resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel);
6774
+ var _a2;
6775
+ return resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel);
6514
6776
  }
6515
6777
  );
6516
6778
  const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react11.useState)(null);
6517
6779
  (0, import_react11.useEffect)(() => {
6518
- var _a;
6780
+ var _a2;
6519
6781
  setSelectedOutcomeLabel(
6520
- resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel)
6782
+ resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel)
6521
6783
  );
6522
6784
  }, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
6523
6785
  const headerOutcomeItems = (0, import_react11.useMemo)(() => {
@@ -6544,51 +6806,66 @@ var MarketDetailsContent = ({
6544
6806
  return outcomesByLabelMap;
6545
6807
  }, [headerOutcomeItems, model]);
6546
6808
  const selectedOutcomesByVenue = (0, import_react11.useMemo)(() => {
6547
- var _a;
6809
+ var _a2;
6548
6810
  if (!selectedOutcomeLabel)
6549
6811
  return [];
6550
- return (_a = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a : [];
6812
+ return (_a2 = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a2 : [];
6551
6813
  }, [outcomesByLabel, selectedOutcomeLabel]);
6814
+ const chartEnabled = isOpened && selectedTab === "graph";
6815
+ const orderBookEnabled = isOpened && selectedTab === "order-book";
6552
6816
  const timeWindow = (0, import_react11.useMemo)(() => {
6553
6817
  return getTimeWindowByRange(selectedTimeRange);
6554
6818
  }, [selectedTimeRange]);
6555
- const graphOutcomes = (0, import_react11.useMemo)(() => {
6556
- const uniqueOutcomesByVenueAndId = /* @__PURE__ */ new Map();
6557
- outcomesByLabel.forEach((outcomes) => {
6558
- outcomes.forEach((outcomeByVenue) => {
6559
- uniqueOutcomesByVenueAndId.set(
6560
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
6561
- outcomeByVenue
6562
- );
6563
- });
6564
- });
6565
- return [...uniqueOutcomesByVenueAndId.values()];
6566
- }, [outcomesByLabel]);
6567
- const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
6568
- const priceHistoryGroups = (0, import_react11.useMemo)(() => {
6569
- return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
6570
- }, [canonicalMarketIdForHistory, graphOutcomes]);
6571
- const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = (0, import_hooks20.usePriceHistory)(__spreadProps(__spreadValues({
6572
- groups: priceHistoryGroups
6573
- }, timeWindow), {
6574
- enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
6575
- }));
6576
- const orderBookInputs = (0, import_react11.useMemo)(() => {
6577
- return selectedOutcomesByVenue.map(({ market, outcome }) => ({
6578
- market,
6579
- outcome,
6580
- liveUpdate: true
6581
- }));
6819
+ const primaryVenueMarketId = (_c = (_b = selectedOutcomesByVenue[0]) == null ? void 0 : _b.market.id) != null ? _c : null;
6820
+ const venueMarketIds = (0, import_react11.useMemo)(() => {
6821
+ return selectedOutcomesByVenue.map((item) => item.market.id);
6582
6822
  }, [selectedOutcomesByVenue]);
6583
6823
  const {
6584
- data: orderBookData,
6824
+ data: marketChartData,
6825
+ isLoading: isMarketChartLoading,
6826
+ error: marketChartError,
6827
+ refetch: refetchMarketChart
6828
+ } = (0, import_hooks21.useMarketChart)({
6829
+ marketId: primaryVenueMarketId,
6830
+ venueMarketIds,
6831
+ interval: (0, import_hooks21.timeRangeToInterval)(selectedTimeRange),
6832
+ startTs: timeWindow.startTs * 1e3,
6833
+ endTs: timeWindow.endTs * 1e3,
6834
+ enabled: chartEnabled && !!primaryVenueMarketId
6835
+ });
6836
+ const {
6837
+ data: marketOrderbookData,
6585
6838
  isLoading: isOrderBookLoading,
6586
6839
  error: orderBookError,
6587
- results: orderBookResults
6588
- } = (0, import_hooks20.useOrderBook)({
6589
- orderbooks: orderBookInputs,
6590
- enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0
6840
+ refetch: refetchOrderBook
6841
+ } = (0, import_hooks21.useMarketOrderbook)({
6842
+ marketId: primaryVenueMarketId,
6843
+ enabled: orderBookEnabled && !!primaryVenueMarketId,
6844
+ venueOutcomes: selectedOutcomesByVenue.map((item) => ({
6845
+ venue: item.market.venue,
6846
+ venueMarketOutcomeId: item.outcome.id
6847
+ }))
6591
6848
  });
6849
+ const orderBookData = (0, import_react11.useMemo)(() => {
6850
+ if (!marketOrderbookData)
6851
+ return void 0;
6852
+ const results = selectedOutcomesByVenue.flatMap(({ market, outcome }) => {
6853
+ const venueOrderbook = marketOrderbookData.venueOrderbooks[market.venue];
6854
+ if (!venueOrderbook)
6855
+ return [];
6856
+ return [
6857
+ {
6858
+ market,
6859
+ outcome,
6860
+ orderbook: {
6861
+ bids: venueOrderbook.bids,
6862
+ asks: venueOrderbook.asks
6863
+ }
6864
+ }
6865
+ ];
6866
+ });
6867
+ return results.length === selectedOutcomesByVenue.length ? results : void 0;
6868
+ }, [marketOrderbookData, selectedOutcomesByVenue]);
6592
6869
  const askRows = (0, import_react11.useMemo)(() => {
6593
6870
  return resolveOrderBookRows({
6594
6871
  data: orderBookData,
@@ -6601,88 +6878,54 @@ var MarketDetailsContent = ({
6601
6878
  side: "bids"
6602
6879
  });
6603
6880
  }, [orderBookData]);
6604
- const priceHistoryByVenue = (0, import_react11.useMemo)(() => {
6605
- const historyByVenue = /* @__PURE__ */ new Map();
6606
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
6607
- return historyByVenue;
6608
- }
6609
- priceHistoryData.forEach((historyItem) => {
6610
- const venue = historyItem.venue;
6611
- const venueHistory = historyByVenue.get(venue);
6612
- if (venueHistory) {
6613
- venueHistory.push(historyItem);
6614
- return;
6615
- }
6616
- historyByVenue.set(venue, [historyItem]);
6617
- });
6618
- return historyByVenue;
6619
- }, [priceHistoryData]);
6620
- const graphSeriesByOutcomeLabel = (0, import_react11.useMemo)(() => {
6621
- const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
6622
- const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
6623
- var _a, _b;
6624
- const marketWithCanonicalId = outcomeByVenue.market;
6625
- return [
6626
- outcomeByVenue.outcome.id,
6627
- (_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
6628
- outcomeByVenue.market.externalIdentifier,
6629
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
6630
- canonicalMarketIdForHistory
6631
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
6632
- };
6633
- headerOutcomeItems.forEach((headerOutcomeItem) => {
6634
- var _a;
6635
- const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
6636
- const graphSeries2 = [];
6637
- outcomes.forEach((outcomeByVenue, index) => {
6638
- var _a2;
6639
- const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
6640
- if (!(venueHistory == null ? void 0 : venueHistory.length))
6641
- return;
6642
- const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
6643
- const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
6644
- if (!matchingHistory)
6645
- return;
6646
- const points = matchingHistory.points.map((point) => ({
6647
- time: point.timestamp,
6648
- value: point.price * 100,
6649
- open: point.open == null ? void 0 : point.open * 100,
6650
- high: point.high == null ? void 0 : point.high * 100,
6651
- low: point.low == null ? void 0 : point.low * 100,
6652
- close: point.close == null ? void 0 : point.close * 100
6653
- })).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
6654
- if (points.length === 0)
6655
- return;
6656
- graphSeries2.push({
6657
- id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
6658
- venue: outcomeByVenue.venue,
6659
- color: resolveSeriesColor(outcomeByVenue.venue, index),
6660
- points
6661
- });
6662
- });
6663
- seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
6664
- });
6665
- return seriesByOutcomeLabel;
6666
- }, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
6667
6881
  const graphSeries = (0, import_react11.useMemo)(() => {
6668
- var _a;
6669
- if (!selectedOutcomeLabel)
6670
- return [];
6671
- const seriesForOutcomeLabel = (_a = graphSeriesByOutcomeLabel.get(selectedOutcomeLabel)) != null ? _a : [];
6882
+ const colorByVenue = new Map(
6883
+ selectedOutcomesByVenue.map((item, index) => [
6884
+ item.venue,
6885
+ resolveSeriesColor(item.venue, index)
6886
+ ])
6887
+ );
6888
+ const seriesForOutcomeLabel = resolveMarketChartVenueSeries({
6889
+ chartData: marketChartData,
6890
+ transformProbability: (value) => value
6891
+ }).map((seriesItem) => {
6892
+ var _a2;
6893
+ const resolvedVenue = seriesItem.venue;
6894
+ return {
6895
+ id: `${selectedOutcomeLabel != null ? selectedOutcomeLabel : "graph"}-${resolvedVenue}-${primaryVenueMarketId != null ? primaryVenueMarketId : "chart"}`,
6896
+ venue: resolvedVenue,
6897
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
6898
+ points: seriesItem.points
6899
+ };
6900
+ });
6672
6901
  if (!selectedGraphVenue)
6673
6902
  return seriesForOutcomeLabel;
6674
6903
  return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
6675
- }, [graphSeriesByOutcomeLabel, selectedGraphVenue, selectedOutcomeLabel]);
6904
+ }, [
6905
+ primaryVenueMarketId,
6906
+ marketChartData,
6907
+ selectedGraphVenue,
6908
+ selectedOutcomeLabel,
6909
+ selectedOutcomesByVenue
6910
+ ]);
6911
+ const graphLiveState = (0, import_react11.useMemo)(() => {
6912
+ return resolveMarketChartLiveState({
6913
+ chartData: marketChartData,
6914
+ selectedVenue: selectedGraphVenue,
6915
+ transformProbability: (value) => value
6916
+ });
6917
+ }, [marketChartData, selectedGraphVenue]);
6676
6918
  const otherRows = (0, import_react11.useMemo)(() => {
6677
6919
  if (!model)
6678
6920
  return [];
6679
6921
  return resolveOtherTabRows(model.market, labels);
6680
6922
  }, [labels, model]);
6681
- const isOrderBookNotFound = isErrorWithStatus(orderBookError, 404);
6923
+ const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
6682
6924
  const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
6683
- const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
6925
+ const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || askRows.length === 0 && bidRows.length === 0);
6926
+ const hasChartError = !!marketChartError;
6684
6927
  const handleOutcomeKeyDown = (eventToHandle) => {
6685
- var _a;
6928
+ var _a2;
6686
6929
  if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
6687
6930
  return;
6688
6931
  }
@@ -6693,14 +6936,14 @@ var MarketDetailsContent = ({
6693
6936
  });
6694
6937
  const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
6695
6938
  const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
6696
- setSelectedOutcomeLabel((_a = headerOutcomeItems[nextIndex]) == null ? void 0 : _a.label);
6939
+ setSelectedOutcomeLabel((_a2 = headerOutcomeItems[nextIndex]) == null ? void 0 : _a2.label);
6697
6940
  };
6698
- const handleToggleExpanded = (event2) => {
6699
- if (event2 && "key" in event2 && (event2 == null ? void 0 : event2.key) !== "Enter" && (event2 == null ? void 0 : event2.key) !== " ") {
6941
+ const handleToggleExpanded = (event) => {
6942
+ if (event && "key" in event && (event == null ? void 0 : event.key) !== "Enter" && (event == null ? void 0 : event.key) !== " ") {
6700
6943
  return;
6701
6944
  }
6702
- event2 == null ? void 0 : event2.preventDefault();
6703
- event2 == null ? void 0 : event2.stopPropagation();
6945
+ event == null ? void 0 : event.preventDefault();
6946
+ event == null ? void 0 : event.stopPropagation();
6704
6947
  setIsOpened((prev) => {
6705
6948
  const next = !prev;
6706
6949
  onOpenChange == null ? void 0 : onOpenChange(next);
@@ -6715,7 +6958,10 @@ var MarketDetailsContent = ({
6715
6958
  });
6716
6959
  };
6717
6960
  const handleRetryOrderBook = () => {
6718
- void Promise.all(orderBookResults.map((result) => result.refetch()));
6961
+ void refetchOrderBook();
6962
+ };
6963
+ const handleRetryMarketChart = () => {
6964
+ void refetchMarketChart();
6719
6965
  };
6720
6966
  (0, import_react11.useEffect)(() => {
6721
6967
  if (!selectedGraphVenue) {
@@ -6727,12 +6973,12 @@ var MarketDetailsContent = ({
6727
6973
  setSelectedGraphVenue(null);
6728
6974
  }, [selectedGraphVenue, selectedOutcomesByVenue]);
6729
6975
  if (marketId && !resolvedMarket) {
6730
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MarketDetailsNotFoundState, { ariaLabel, classNames });
6976
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsNotFoundState, { ariaLabel, classNames });
6731
6977
  }
6732
6978
  if (!model) {
6733
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MarketDetailsUnavailableState, { ariaLabel, classNames });
6979
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsUnavailableState, { ariaLabel, classNames });
6734
6980
  }
6735
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
6981
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
6736
6982
  Card,
6737
6983
  {
6738
6984
  className: cn(
@@ -6741,7 +6987,7 @@ var MarketDetailsContent = ({
6741
6987
  classNames == null ? void 0 : classNames.root
6742
6988
  ),
6743
6989
  children: [
6744
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
6990
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
6745
6991
  "div",
6746
6992
  {
6747
6993
  className: cn(
@@ -6758,8 +7004,8 @@ var MarketDetailsContent = ({
6758
7004
  onClick: handleToggleExpanded,
6759
7005
  onKeyDown: handleToggleExpanded,
6760
7006
  children: [
6761
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
6762
- model.image ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7007
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-52 max-w-3/4 items-center gap-3 md:gap-4", children: [
7008
+ model.image ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6763
7009
  RemoteImage,
6764
7010
  {
6765
7011
  src: model.image,
@@ -6767,13 +7013,13 @@ var MarketDetailsContent = ({
6767
7013
  className: "size-12 rounded-agg-lg object-cover md:size-[60px]"
6768
7014
  }
6769
7015
  ) : null,
6770
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
6771
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
6772
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
7016
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
7017
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { as: "h3", variant: "body-large-strong", className: "truncate", children: model.title }),
7018
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "label", className: "truncate text-agg-muted-foreground", children: model.subtitle }) })
6773
7019
  ] })
6774
7020
  ] }),
6775
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
6776
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7021
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { as: "div", variant: "heading", className: "shrink-0", children: formatProbabilityPercent(headlineProbability) }),
7022
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6777
7023
  "div",
6778
7024
  {
6779
7025
  className: "flex gap-2",
@@ -6784,7 +7030,7 @@ var MarketDetailsContent = ({
6784
7030
  children: headerOutcomeItems.map((item) => {
6785
7031
  const isPositive = item.tone === "positive";
6786
7032
  const isActiveOutcome = item.label === selectedOutcomeLabel;
6787
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7033
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6788
7034
  "button",
6789
7035
  {
6790
7036
  type: "button",
@@ -6801,16 +7047,16 @@ var MarketDetailsContent = ({
6801
7047
  e.stopPropagation();
6802
7048
  setSelectedOutcomeLabel(item.label);
6803
7049
  },
6804
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
6805
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7050
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
7051
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6806
7052
  VenueLogo,
6807
7053
  {
6808
- venue: isPositive ? "polymarket" : "probable",
7054
+ venue: "polymarket",
6809
7055
  size: "small",
6810
7056
  color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
6811
7057
  }
6812
7058
  ),
6813
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7059
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6814
7060
  Typography,
6815
7061
  {
6816
7062
  variant: isActiveOutcome ? "body-strong" : "body",
@@ -6831,7 +7077,7 @@ var MarketDetailsContent = ({
6831
7077
  ]
6832
7078
  }
6833
7079
  ),
6834
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7080
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6835
7081
  "div",
6836
7082
  {
6837
7083
  id: detailsContentId,
@@ -6841,9 +7087,9 @@ var MarketDetailsContent = ({
6841
7087
  isOpened ? "grid-rows-[1fr] opacity-100" : "pointer-events-none grid-rows-[0fr] opacity-0"
6842
7088
  ),
6843
7089
  "aria-hidden": !isOpened,
6844
- children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "min-h-0", children: [
6845
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6846
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
7090
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "min-h-0", children: [
7091
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
7092
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
6847
7093
  "div",
6848
7094
  {
6849
7095
  className: cn(
@@ -6857,7 +7103,7 @@ var MarketDetailsContent = ({
6857
7103
  ) : "translate-y-5 opacity-0"
6858
7104
  ),
6859
7105
  children: [
6860
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7106
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: cn("block", classNames == null ? void 0 : classNames.tabs), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6861
7107
  Tabs,
6862
7108
  {
6863
7109
  ariaLabel: labels.marketDetails.tabsAria,
@@ -6868,9 +7114,9 @@ var MarketDetailsContent = ({
6868
7114
  className: "w-full px-5"
6869
7115
  }
6870
7116
  ) }),
6871
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
6872
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
6873
- selectedTab === "order-book" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7117
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
7118
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: cn("p-5", classNames == null ? void 0 : classNames.content), children: [
7119
+ selectedTab === "order-book" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.orderBook), children: isOrderBookLoading ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsOderbookSkeleton, {}) : hasOrderBookError ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6874
7120
  StateMessage,
6875
7121
  {
6876
7122
  ariaLabel: labels.marketDetails.orderBookUnavailableAria,
@@ -6881,7 +7127,7 @@ var MarketDetailsContent = ({
6881
7127
  onAction: handleRetryOrderBook,
6882
7128
  className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
6883
7129
  }
6884
- ) : hasNoOrderBook ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7130
+ ) : hasNoOrderBook ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6885
7131
  StateMessage,
6886
7132
  {
6887
7133
  ariaLabel: labels.marketDetails.orderBookEmptyAria,
@@ -6889,8 +7135,8 @@ var MarketDetailsContent = ({
6889
7135
  description: labels.marketDetails.orderBookEmptyDescription,
6890
7136
  className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
6891
7137
  }
6892
- ) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
6893
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7138
+ ) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
7139
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6894
7140
  OrderBookRows,
6895
7141
  {
6896
7142
  rows: askRows,
@@ -6900,7 +7146,7 @@ var MarketDetailsContent = ({
6900
7146
  visibleRows: orderBookDepth
6901
7147
  }
6902
7148
  ),
6903
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7149
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6904
7150
  OrderBookRows,
6905
7151
  {
6906
7152
  rows: bidRows,
@@ -6911,22 +7157,35 @@ var MarketDetailsContent = ({
6911
7157
  }
6912
7158
  )
6913
7159
  ] }) }) : null,
6914
- selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
6915
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7160
+ selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
7161
+ hasChartError ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7162
+ StateMessage,
7163
+ {
7164
+ ariaLabel: labels.marketDetails.chartUnavailableAria,
7165
+ tone: "warning",
7166
+ title: labels.marketDetails.chartUnavailableTitle,
7167
+ description: labels.marketDetails.chartUnavailableDescription,
7168
+ actionLabel: labels.common.retry,
7169
+ onAction: handleRetryMarketChart,
7170
+ className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
7171
+ }
7172
+ ) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6916
7173
  LineChart,
6917
7174
  {
6918
7175
  series: graphSeries,
6919
7176
  height: 260,
6920
- isLoading: isPriceHistoryLoading,
7177
+ isLoading: isMarketChartLoading,
6921
7178
  chartType: selectedChartType,
7179
+ liveCandle: selectedChartType === "candlestick" ? (_d = graphLiveState.liveCandle) != null ? _d : void 0 : void 0,
7180
+ lineValue: graphLiveState.lineValue,
6922
7181
  classNames: { root: "w-full" },
6923
7182
  showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
6924
7183
  renderSeriesControls: () => {
6925
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
6926
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
7184
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
7185
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex flex-wrap gap-2", children: selectedOutcomesByVenue.map((item) => {
6927
7186
  const probability = formatProbabilityPercent(item.outcome.price);
6928
7187
  const isActiveVenue = selectedGraphVenue === item.venue;
6929
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
7188
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
6930
7189
  "button",
6931
7190
  {
6932
7191
  type: "button",
@@ -6943,14 +7202,14 @@ var MarketDetailsContent = ({
6943
7202
  handleGraphVenueToggle(item.venue);
6944
7203
  },
6945
7204
  children: [
6946
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(VenueLogo, { venue: item.venue, size: "small" }),
6947
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
7205
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(VenueLogo, { venue: item.venue, size: "small" }),
7206
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: probability })
6948
7207
  ]
6949
7208
  },
6950
7209
  `${item.market.id}-${item.outcome.id}`
6951
7210
  );
6952
7211
  }) }),
6953
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7212
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6954
7213
  SwitchButton,
6955
7214
  {
6956
7215
  ariaLabel: labels.marketDetails.outcomeSelectorAria,
@@ -6968,7 +7227,7 @@ var MarketDetailsContent = ({
6968
7227
  }
6969
7228
  }
6970
7229
  ),
6971
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
7230
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
6972
7231
  "div",
6973
7232
  {
6974
7233
  className: cn(
@@ -6976,9 +7235,9 @@ var MarketDetailsContent = ({
6976
7235
  classNames == null ? void 0 : classNames.footer
6977
7236
  ),
6978
7237
  children: [
6979
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: typeof model.market.volume === "number" ? `${config.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
6980
- /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
6981
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7238
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: typeof model.market.volume === "number" ? `${config.formatCompactCurrency(model.market.volume)} ${labels.marketDetails.meta.volumeSuffix}` : labels.marketDetails.volumeUnavailable }),
7239
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-wrap items-center gap-3 md:gap-4", children: [
7240
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6982
7241
  ChartTypeSwitch,
6983
7242
  {
6984
7243
  className: "shrink-0",
@@ -6986,7 +7245,7 @@ var MarketDetailsContent = ({
6986
7245
  onValueChange: setSelectedChartType
6987
7246
  }
6988
7247
  ),
6989
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7248
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6990
7249
  "span",
6991
7250
  {
6992
7251
  "aria-hidden": "true",
@@ -6995,7 +7254,7 @@ var MarketDetailsContent = ({
6995
7254
  ),
6996
7255
  eventListItemDetailsTimeRanges.map((timeRange) => {
6997
7256
  const isActive = selectedTimeRange === timeRange;
6998
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7257
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
6999
7258
  "button",
7000
7259
  {
7001
7260
  type: "button",
@@ -7019,13 +7278,13 @@ var MarketDetailsContent = ({
7019
7278
  }
7020
7279
  )
7021
7280
  ] }) : null,
7022
- selectedTab === "other" ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
7281
+ selectedTab === "other" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex flex-col gap-4", children: otherContent != null ? otherContent : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "grid grid-cols-1 gap-3", children: otherRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
7023
7282
  "div",
7024
7283
  {
7025
7284
  className: "flex items-center justify-between rounded-agg-xl bg-agg-secondary-hover px-4 py-3",
7026
7285
  children: [
7027
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
7028
- /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Typography, { variant: "body", className: "text-right", children: row.value })
7286
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: row.label }),
7287
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Typography, { variant: "body", className: "text-right", children: row.value })
7029
7288
  ]
7030
7289
  },
7031
7290
  row.label
@@ -7059,16 +7318,8 @@ var MarketDetails = (props) => {
7059
7318
  }
7060
7319
  (_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
7061
7320
  };
7062
- const hasEventProp = "event" in props && !!props.event;
7063
- const {
7064
- event: fetchedEvent,
7065
- error: eventError,
7066
- isLoading: isFetchingEvent
7067
- } = (0, import_hooks20.useEvent)(hasEventProp ? void 0 : props.eventId, {
7068
- enabled: !props.isLoading && !hasEventProp && !!props.eventId
7069
- });
7070
7321
  if (props.isLoading) {
7071
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7322
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7072
7323
  MarketDetailsLoadingState,
7073
7324
  {
7074
7325
  isOpened: resolvedIsOpened,
@@ -7077,51 +7328,124 @@ var MarketDetails = (props) => {
7077
7328
  }
7078
7329
  );
7079
7330
  }
7080
- if ("event" in props && props.event) {
7081
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7331
+ if ("venueMarkets" in props && props.venueMarkets) {
7332
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7082
7333
  MarketDetailsContent,
7083
7334
  __spreadProps(__spreadValues({}, props), {
7084
7335
  isOpened: resolvedIsOpened,
7085
7336
  onOpenChange: handleOpenChange,
7086
- event: props.event
7337
+ venueMarkets: props.venueMarkets
7087
7338
  })
7088
7339
  );
7089
7340
  }
7090
- if (isFetchingEvent) {
7091
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7092
- MarketDetailsLoadingState,
7341
+ const { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames } = props;
7342
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsUnavailableState, { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames });
7343
+ };
7344
+ MarketDetails.displayName = "MarketDetails";
7345
+ var resolveInitialExpandedId = (markets, defaultId) => {
7346
+ var _a, _b;
7347
+ if (!markets.length)
7348
+ return null;
7349
+ if (defaultId) {
7350
+ const match = markets.find((m) => m.id === defaultId);
7351
+ if (match)
7352
+ return match.id;
7353
+ }
7354
+ return (_b = (_a = markets[0]) == null ? void 0 : _a.id) != null ? _b : null;
7355
+ };
7356
+ var MarketDetailsList = ({
7357
+ eventId,
7358
+ expandedMarketId,
7359
+ defaultExpandedMarketId,
7360
+ onExpandedMarketChange,
7361
+ defaultTab,
7362
+ defaultTimeRange,
7363
+ classNames,
7364
+ ariaLabel
7365
+ }) => {
7366
+ const labels = (0, import_hooks21.useLabels)();
7367
+ const resolvedEventId = eventId || "";
7368
+ const { markets, isLoading, error } = (0, import_hooks21.useVenueMarkets)({
7369
+ venueEventId: resolvedEventId,
7370
+ enabled: !!resolvedEventId
7371
+ });
7372
+ const [internalExpandedId, setInternalExpandedId] = (0, import_react11.useState)(
7373
+ () => resolveInitialExpandedId(markets, defaultExpandedMarketId)
7374
+ );
7375
+ (0, import_react11.useEffect)(() => {
7376
+ if (typeof expandedMarketId !== "undefined")
7377
+ return;
7378
+ setInternalExpandedId((current) => {
7379
+ if (current && markets.some((m) => m.id === current))
7380
+ return current;
7381
+ return resolveInitialExpandedId(markets, defaultExpandedMarketId);
7382
+ });
7383
+ }, [defaultExpandedMarketId, expandedMarketId, markets]);
7384
+ (0, import_react11.useEffect)(() => {
7385
+ if (typeof expandedMarketId === "undefined")
7386
+ return;
7387
+ setInternalExpandedId(expandedMarketId);
7388
+ }, [expandedMarketId]);
7389
+ const resolvedExpandedId = typeof expandedMarketId === "undefined" ? internalExpandedId : expandedMarketId;
7390
+ const handleToggle = (marketId, isOpened) => {
7391
+ const next = isOpened ? marketId : null;
7392
+ if (typeof expandedMarketId === "undefined") {
7393
+ setInternalExpandedId(next);
7394
+ }
7395
+ onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(next);
7396
+ };
7397
+ if (isLoading) {
7398
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: [
7399
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsLoadingState, { isOpened: true, classNames: { root: classNames == null ? void 0 : classNames.item } }),
7400
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MarketDetailsLoadingState, { isOpened: false, classNames: { root: classNames == null ? void 0 : classNames.item } })
7401
+ ] });
7402
+ }
7403
+ if (error) {
7404
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7405
+ StateMessage,
7093
7406
  {
7094
- isOpened: resolvedIsOpened,
7095
- ariaLabel: props.ariaLabel,
7096
- classNames: props.classNames
7407
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
7408
+ title: labels.marketDetails.unavailableTitle,
7409
+ description: labels.marketDetails.unavailableDescription,
7410
+ className: "min-h-[280px] md:min-h-[320px]"
7097
7411
  }
7098
- );
7412
+ ) });
7099
7413
  }
7100
- if (!fetchedEvent) {
7101
- if (isErrorWithStatus(eventError, 404)) {
7102
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MarketDetailsNotFoundState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
7103
- }
7104
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MarketDetailsUnavailableState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
7414
+ if (markets.length === 0) {
7415
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7416
+ StateMessage,
7417
+ {
7418
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
7419
+ title: labels.marketDetails.notFoundTitle,
7420
+ description: labels.marketDetails.notFoundDescription,
7421
+ className: "min-h-[280px] md:min-h-[320px]"
7422
+ }
7423
+ ) });
7105
7424
  }
7106
- return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
7107
- MarketDetailsContent,
7108
- __spreadProps(__spreadValues({}, props), {
7109
- isOpened: resolvedIsOpened,
7110
- onOpenChange: handleOpenChange,
7111
- event: fetchedEvent
7112
- })
7113
- );
7425
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: markets.map((market) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7426
+ MarketDetails,
7427
+ {
7428
+ venueMarkets: [market],
7429
+ isOpened: resolvedExpandedId === market.id,
7430
+ onOpenChange: (nextIsOpened) => handleToggle(market.id, nextIsOpened),
7431
+ defaultTab,
7432
+ defaultTimeRange,
7433
+ ariaLabel: market.question,
7434
+ classNames: { root: classNames == null ? void 0 : classNames.item }
7435
+ },
7436
+ market.id
7437
+ )) });
7114
7438
  };
7115
- MarketDetails.displayName = "MarketDetails";
7439
+ MarketDetailsList.displayName = "MarketDetailsList";
7116
7440
 
7117
7441
  // src/trading/place-order/index.tsx
7118
7442
  var import_react12 = require("react");
7119
- var import_hooks22 = require("@agg-market/hooks");
7443
+ var import_hooks23 = require("@agg-market/hooks");
7120
7444
 
7121
7445
  // src/trading/utils.ts
7122
- var import_hooks21 = require("@agg-market/hooks");
7446
+ var import_hooks22 = require("@agg-market/hooks");
7123
7447
  var import_dayjs5 = __toESM(require("dayjs"));
7124
- var defaultLabels = (0, import_hooks21.resolveAggUiLabels)("en-US");
7448
+ var defaultLabels = (0, import_hooks22.resolveAggUiLabels)("en-US");
7125
7449
  var defaultSettlementSectionLabel = defaultLabels.trading.settlementSection;
7126
7450
  var defaultSettlementDifferencesTitle = defaultLabels.trading.settlementDifferencesTitle;
7127
7451
  var defaultTradingDisclaimer = defaultLabels.trading.disclaimer;
@@ -7139,7 +7463,7 @@ var getTradingVenueLabel = (venue, label) => {
7139
7463
  };
7140
7464
 
7141
7465
  // src/trading/place-order/index.tsx
7142
- var import_jsx_runtime83 = require("react/jsx-runtime");
7466
+ var import_jsx_runtime84 = require("react/jsx-runtime");
7143
7467
  var getPlaceOrderContainerClassName = () => {
7144
7468
  return "overflow-hidden rounded-agg-xl border border-agg-border bg-agg-secondary shadow-none hover:shadow-none";
7145
7469
  };
@@ -7182,9 +7506,9 @@ var getStatusContent = ({
7182
7506
  if (!status || status.placement !== placement)
7183
7507
  return null;
7184
7508
  if (status.tone === "warning") {
7185
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(InlineAlert, { tone: "warning", message: status.message });
7509
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(InlineAlert, { tone: "warning", message: status.message });
7186
7510
  }
7187
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7511
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7188
7512
  InlineAlert,
7189
7513
  {
7190
7514
  tone: "error",
@@ -7220,11 +7544,11 @@ var PlaceOrder = ({
7220
7544
  onStatusAction,
7221
7545
  onTabChange
7222
7546
  }) => {
7223
- const { enableAnimations } = (0, import_hooks22.useSdkUiConfig)();
7224
- const labels = (0, import_hooks22.useLabels)();
7547
+ const { enableAnimations } = (0, import_hooks23.useSdkUiConfig)();
7548
+ const labels = (0, import_hooks23.useLabels)();
7225
7549
  const resolvedDisclaimer = disclaimer === defaultTradingDisclaimer ? labels.trading.disclaimer : disclaimer;
7226
7550
  if (isLoading) {
7227
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7551
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7228
7552
  Skeleton,
7229
7553
  {
7230
7554
  ariaLabel: labels.common.loading,
@@ -7263,7 +7587,7 @@ var PlaceOrder = ({
7263
7587
  }
7264
7588
  onOutcomeChange == null ? void 0 : onOutcomeChange(nextOutcomeId);
7265
7589
  };
7266
- const actionButton = /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7590
+ const actionButton = /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7267
7591
  Button,
7268
7592
  {
7269
7593
  size: "large",
@@ -7275,11 +7599,11 @@ var PlaceOrder = ({
7275
7599
  children: actionLabel
7276
7600
  }
7277
7601
  );
7278
- const contentBody = /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [
7279
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-2", children: [
7280
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-start justify-between gap-5", children: [
7281
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
7282
- marketImageUrl ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7602
+ const contentBody = /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-6 p-5", children: [
7603
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-2", children: [
7604
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-start justify-between gap-5", children: [
7605
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
7606
+ marketImageUrl ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7283
7607
  RemoteImage,
7284
7608
  {
7285
7609
  src: marketImageUrl,
@@ -7287,16 +7611,16 @@ var PlaceOrder = ({
7287
7611
  className: "h-12 w-12 shrink-0 rounded-agg-lg object-cover"
7288
7612
  }
7289
7613
  ) : null,
7290
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "min-w-0 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: title })
7614
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "min-w-0 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: title })
7291
7615
  ] }),
7292
- isDismissible ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7616
+ isDismissible ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7293
7617
  "button",
7294
7618
  {
7295
7619
  type: "button",
7296
7620
  "aria-label": labels.common.close,
7297
7621
  className: "shrink-0 text-agg-foreground",
7298
7622
  onClick: onClose,
7299
- children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7623
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7300
7624
  Icon,
7301
7625
  {
7302
7626
  name: "close",
@@ -7308,9 +7632,9 @@ var PlaceOrder = ({
7308
7632
  }
7309
7633
  ) : null
7310
7634
  ] }),
7311
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: dateLabel })
7635
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: dateLabel })
7312
7636
  ] }),
7313
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7637
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7314
7638
  Tabs,
7315
7639
  {
7316
7640
  ariaLabel: labels.common.tabsAria,
@@ -7326,11 +7650,11 @@ var PlaceOrder = ({
7326
7650
  }
7327
7651
  }
7328
7652
  ),
7329
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-4", children: [
7330
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "flex w-full gap-2", children: outcomes.map((outcome, index) => {
7653
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-4", children: [
7654
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "flex w-full gap-2", children: outcomes.map((outcome, index) => {
7331
7655
  const isActive = outcome.id === resolvedOutcomeId;
7332
7656
  const isPositive = resolveIsPositiveOutcome(outcome, index);
7333
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7657
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7334
7658
  "button",
7335
7659
  {
7336
7660
  type: "button",
@@ -7347,16 +7671,16 @@ var PlaceOrder = ({
7347
7671
  outcome.id
7348
7672
  );
7349
7673
  }) }),
7350
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7351
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col", children: [
7352
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: primaryMetric.label }),
7353
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: primaryMetric.hint })
7674
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7675
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col", children: [
7676
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: primaryMetric.label }),
7677
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: primaryMetric.hint })
7354
7678
  ] }),
7355
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: primaryMetric.value })
7679
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: primaryMetric.value })
7356
7680
  ] })
7357
7681
  ] }),
7358
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-2", children: [
7359
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
7682
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-2", children: [
7683
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
7360
7684
  "div",
7361
7685
  {
7362
7686
  className: cn(
@@ -7364,7 +7688,7 @@ var PlaceOrder = ({
7364
7688
  getRoutingCardClassName(hasHighlightedRouting)
7365
7689
  ),
7366
7690
  children: [
7367
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7691
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7368
7692
  "div",
7369
7693
  {
7370
7694
  className: cn(
@@ -7373,11 +7697,11 @@ var PlaceOrder = ({
7373
7697
  )
7374
7698
  }
7375
7699
  ),
7376
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "relative flex flex-col gap-3", children: [
7377
- routing.rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col gap-3", children: [
7378
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7379
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
7380
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7700
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "relative flex flex-col gap-3", children: [
7701
+ routing.rows.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-3", children: [
7702
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7703
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
7704
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7381
7705
  VenueLogo,
7382
7706
  {
7383
7707
  venue: row.venue,
@@ -7385,11 +7709,11 @@ var PlaceOrder = ({
7385
7709
  ariaLabel: getTradingVenueLabel(row.venue)
7386
7710
  }
7387
7711
  ),
7388
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "truncate text-agg-base leading-agg-6 text-agg-foreground", children: row.label })
7712
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "truncate text-agg-base leading-agg-6 text-agg-foreground", children: row.label })
7389
7713
  ] }),
7390
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "shrink-0 text-agg-base leading-agg-6 text-agg-foreground", children: row.priceLabel })
7714
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "shrink-0 text-agg-base leading-agg-6 text-agg-foreground", children: row.priceLabel })
7391
7715
  ] }),
7392
- index < routing.rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7716
+ index < routing.rows.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7393
7717
  "div",
7394
7718
  {
7395
7719
  className: cn(
@@ -7399,19 +7723,19 @@ var PlaceOrder = ({
7399
7723
  }
7400
7724
  ) : null
7401
7725
  ] }, `${row.venue}-${row.label}`)),
7402
- routing.highlightLabel ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-center text-agg-sm font-agg-bold leading-agg-5 uppercase text-agg-trade-highlight-accent", children: routing.highlightLabel }) : null
7726
+ routing.highlightLabel ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-center text-agg-sm font-agg-bold leading-agg-5 uppercase text-agg-trade-highlight-accent", children: routing.highlightLabel }) : null
7403
7727
  ] })
7404
7728
  ]
7405
7729
  }
7406
7730
  ),
7407
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: routing.helperLabel })
7731
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: routing.helperLabel })
7408
7732
  ] }),
7409
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7410
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex flex-col", children: [
7411
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: result.label }),
7412
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: result.hint })
7733
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
7734
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col", children: [
7735
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: result.label }),
7736
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: result.hint })
7413
7737
  ] }),
7414
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
7738
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7415
7739
  "p",
7416
7740
  {
7417
7741
  className: cn(
@@ -7422,7 +7746,7 @@ var PlaceOrder = ({
7422
7746
  }
7423
7747
  )
7424
7748
  ] }),
7425
- /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
7749
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
7426
7750
  getStatusContent({
7427
7751
  placement: "above-action",
7428
7752
  status,
@@ -7435,16 +7759,16 @@ var PlaceOrder = ({
7435
7759
  onStatusAction
7436
7760
  })
7437
7761
  ] }),
7438
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { className: "text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: resolvedDisclaimer })
7762
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: resolvedDisclaimer })
7439
7763
  ] });
7440
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Card, { className: cn(getPlaceOrderContainerClassName(), className), children: contentBody });
7764
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Card, { className: cn(getPlaceOrderContainerClassName(), className), children: contentBody });
7441
7765
  };
7442
7766
  PlaceOrder.displayName = "PlaceOrder";
7443
7767
 
7444
7768
  // src/trading/settlement/index.tsx
7445
7769
  var import_react13 = require("react");
7446
- var import_hooks23 = require("@agg-market/hooks");
7447
- var import_jsx_runtime84 = require("react/jsx-runtime");
7770
+ var import_hooks24 = require("@agg-market/hooks");
7771
+ var import_jsx_runtime85 = require("react/jsx-runtime");
7448
7772
  var getSettlementHeaderClassName = () => {
7449
7773
  return "flex items-center justify-between gap-4";
7450
7774
  };
@@ -7462,8 +7786,8 @@ var Settlement = ({
7462
7786
  className
7463
7787
  }) => {
7464
7788
  var _a, _b;
7465
- const labels = (0, import_hooks23.useLabels)();
7466
- const { enableAnimations } = (0, import_hooks23.useSdkUiConfig)();
7789
+ const labels = (0, import_hooks24.useLabels)();
7790
+ const { enableAnimations } = (0, import_hooks24.useSdkUiConfig)();
7467
7791
  const resolvedSectionLabel = sectionLabel === defaultSettlementSectionLabel ? labels.trading.settlementSection : sectionLabel;
7468
7792
  const resolvedDifferencesTitle = differencesTitle === defaultSettlementDifferencesTitle ? labels.trading.settlementDifferencesTitle : differencesTitle;
7469
7793
  const [internalExpandedVenue, setInternalExpandedVenue] = (0, import_react13.useState)(
@@ -7636,7 +7960,7 @@ var Settlement = ({
7636
7960
  onShowMore == null ? void 0 : onShowMore(venue);
7637
7961
  };
7638
7962
  if (isLoading) {
7639
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
7963
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7640
7964
  Skeleton,
7641
7965
  {
7642
7966
  ariaLabel: labels.trading.settlementLoading,
@@ -7645,7 +7969,7 @@ var Settlement = ({
7645
7969
  }
7646
7970
  );
7647
7971
  }
7648
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
7972
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
7649
7973
  Card,
7650
7974
  {
7651
7975
  className: cn(
@@ -7653,16 +7977,16 @@ var Settlement = ({
7653
7977
  className
7654
7978
  ),
7655
7979
  children: [
7656
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getSettlementHeaderClassName(), children: [
7657
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
7658
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question })
7980
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getSettlementHeaderClassName(), children: [
7981
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-agg-xs font-agg-bold leading-agg-4 uppercase text-agg-muted-foreground", children: resolvedSectionLabel }),
7982
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: question })
7659
7983
  ] }),
7660
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col gap-2", children: [
7661
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: resolvedDifferencesTitle }),
7662
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("ul", { className: "list-disc pl-5 text-agg-sm leading-agg-5 text-agg-foreground", children: differences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("li", { children: difference }, difference)) })
7984
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex flex-col gap-2", children: [
7985
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: resolvedDifferencesTitle }),
7986
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("ul", { className: "list-disc pl-5 text-agg-sm leading-agg-5 text-agg-foreground", children: differences.map((difference) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("li", { children: difference }, difference)) })
7663
7987
  ] }),
7664
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
7665
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "flex flex-col gap-3", children: venues.map((venue) => {
7988
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
7989
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "flex flex-col gap-3", children: venues.map((venue) => {
7666
7990
  var _a2, _b2;
7667
7991
  const venueLabel = getTradingVenueLabel(venue.venue, venue.label);
7668
7992
  const isExpanded = resolvedExpandedVenue === venue.venue;
@@ -7670,8 +7994,8 @@ var Settlement = ({
7670
7994
  const isDescriptionOverflowing = !!overflowingDescriptionByVenue[venue.venue];
7671
7995
  const shouldShowDescriptionCta = isExpanded && isDescriptionOverflowing && !isDescriptionExpanded;
7672
7996
  const resolvedShowMoreLabel = (_a2 = venue.showMoreLabel) != null ? _a2 : "Show more";
7673
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "flex flex-col", children: [
7674
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
7997
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex flex-col", children: [
7998
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
7675
7999
  "button",
7676
8000
  {
7677
8001
  type: "button",
@@ -7685,9 +8009,13 @@ var Settlement = ({
7685
8009
  ),
7686
8010
  "aria-expanded": isExpanded,
7687
8011
  "aria-label": labels.trading.settlementDetailsAria(venueLabel),
7688
- onClick: () => handleVenueClick(venue.venue),
8012
+ onClick: (e) => {
8013
+ e.stopPropagation();
8014
+ e.preventDefault();
8015
+ handleVenueClick(venue.venue);
8016
+ },
7689
8017
  children: [
7690
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8018
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7691
8019
  VenueLogo,
7692
8020
  {
7693
8021
  venue: venue.venue,
@@ -7695,7 +8023,7 @@ var Settlement = ({
7695
8023
  ariaLabel: venueLabel
7696
8024
  }
7697
8025
  ),
7698
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8026
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7699
8027
  "span",
7700
8028
  {
7701
8029
  className: cn(
@@ -7705,7 +8033,7 @@ var Settlement = ({
7705
8033
  children: venueLabel
7706
8034
  }
7707
8035
  ),
7708
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8036
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7709
8037
  Icon,
7710
8038
  {
7711
8039
  name: isExpanded ? "chevron-up" : "chevron-down",
@@ -7717,7 +8045,7 @@ var Settlement = ({
7717
8045
  ]
7718
8046
  }
7719
8047
  ),
7720
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8048
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7721
8049
  "div",
7722
8050
  {
7723
8051
  "aria-hidden": !isExpanded,
@@ -7730,17 +8058,17 @@ var Settlement = ({
7730
8058
  "transition-[grid-template-rows,opacity,margin-top] duration-300 ease-in-out"
7731
8059
  )
7732
8060
  ),
7733
- children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
8061
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
7734
8062
  "div",
7735
8063
  {
7736
8064
  ref: (element) => handleDescriptionWrapperRef(venue.venue, element),
7737
8065
  className: "relative min-h-0",
7738
8066
  children: [
7739
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("p", { className: "min-h-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
8067
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("p", { className: "min-h-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
7740
8068
  isDescriptionExpanded || !isDescriptionOverflowing ? venue.description : (_b2 = collapsedDescriptionByVenue[venue.venue]) != null ? _b2 : venue.description,
7741
- shouldShowDescriptionCta ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(import_jsx_runtime84.Fragment, { children: [
8069
+ shouldShowDescriptionCta ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
7742
8070
  "... ",
7743
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8071
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7744
8072
  "button",
7745
8073
  {
7746
8074
  type: "button",
@@ -7763,7 +8091,7 @@ var Settlement = ({
7763
8091
  )
7764
8092
  ] }) : null
7765
8093
  ] }),
7766
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8094
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7767
8095
  "p",
7768
8096
  {
7769
8097
  ref: (element) => handleDescriptionMeasureRef(venue.venue, element),
@@ -7785,7 +8113,7 @@ var Settlement = ({
7785
8113
  Settlement.displayName = "Settlement";
7786
8114
 
7787
8115
  // src/pages/event-market/index.tsx
7788
- var import_jsx_runtime85 = require("react/jsx-runtime");
8116
+ var import_jsx_runtime86 = require("react/jsx-runtime");
7789
8117
  var getMarketDateValue = (market, fallbackIndex) => {
7790
8118
  var _a, _b, _c;
7791
8119
  const candidateDate = (_c = (_b = (_a = market.endDate) != null ? _a : market.startDate) != null ? _b : market.creationDate) != null ? _c : null;
@@ -7799,29 +8127,29 @@ var getMarketDateValue = (market, fallbackIndex) => {
7799
8127
  };
7800
8128
  var resolveHeroMarketId = (event, heroMarketId) => {
7801
8129
  var _a, _b;
7802
- if (!((_a = event == null ? void 0 : event.markets) == null ? void 0 : _a.length))
8130
+ if (!((_a = event == null ? void 0 : event.venueMarkets) == null ? void 0 : _a.length))
7803
8131
  return void 0;
7804
8132
  if (heroMarketId) {
7805
- const matchingHeroMarket = event.markets.find(
8133
+ const matchingHeroMarket = event.venueMarkets.find(
7806
8134
  (market) => market.id === heroMarketId
7807
8135
  );
7808
8136
  if (matchingHeroMarket)
7809
8137
  return matchingHeroMarket.id;
7810
8138
  }
7811
- return (_b = event.markets[0]) == null ? void 0 : _b.id;
8139
+ return (_b = event.venueMarkets[0]) == null ? void 0 : _b.id;
7812
8140
  };
7813
8141
  var buildHeroEvent = (event, heroMarketId) => {
7814
8142
  if (!heroMarketId)
7815
8143
  return void 0;
7816
- const heroMarket = event.markets.find((market) => market.id === heroMarketId);
8144
+ const heroMarket = event.venueMarkets.find((market) => market.id === heroMarketId);
7817
8145
  if (!heroMarket)
7818
8146
  return void 0;
7819
8147
  return __spreadProps(__spreadValues({}, event), {
7820
- markets: [heroMarket]
8148
+ venueMarkets: [heroMarket]
7821
8149
  });
7822
8150
  };
7823
8151
  var resolveDetailedMarkets = (event, heroMarketId) => {
7824
- return event.markets.filter((market) => market.id !== heroMarketId).map((market, index) => ({
8152
+ return event.venueMarkets.filter((market) => market.id !== heroMarketId).map((market, index) => ({
7825
8153
  market,
7826
8154
  index
7827
8155
  })).sort(
@@ -7841,19 +8169,82 @@ var resolveInitialExpandedMarketId = (detailedMarkets, defaultExpandedMarketId)
7841
8169
  }
7842
8170
  return (_b = (_a = detailedMarkets[0]) == null ? void 0 : _a.id) != null ? _b : null;
7843
8171
  };
8172
+ var EventMarketPageMobileTrade = ({
8173
+ placeOrder,
8174
+ classNames
8175
+ }) => {
8176
+ const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
8177
+ const handleOpen = () => {
8178
+ setIsOpen(true);
8179
+ };
8180
+ const handleOpenChange = (nextOpen) => {
8181
+ setIsOpen(nextOpen);
8182
+ };
8183
+ const handleClose = () => {
8184
+ setIsOpen(false);
8185
+ };
8186
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
8187
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8188
+ "div",
8189
+ {
8190
+ className: cn(
8191
+ "fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
8192
+ classNames == null ? void 0 : classNames.mobileTradeCta
8193
+ ),
8194
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8195
+ Button,
8196
+ {
8197
+ size: "large",
8198
+ className: "min-w-[168px] shadow-agg-modal",
8199
+ "aria-label": placeOrder.actionLabel,
8200
+ "data-testid": "event-market-page-mobile-trade-cta",
8201
+ onClick: (e) => {
8202
+ e.stopPropagation();
8203
+ e.preventDefault();
8204
+ handleOpen();
8205
+ },
8206
+ children: placeOrder.actionLabel
8207
+ }
8208
+ )
8209
+ }
8210
+ ),
8211
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Modal, { open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8212
+ Modal.Container,
8213
+ {
8214
+ "aria-label": placeOrder.title,
8215
+ maxWidth: "420px",
8216
+ classNames: {
8217
+ content: "items-end p-0 sm:items-center sm:p-4",
8218
+ container: cn(
8219
+ "w-full max-w-[420px] border-0 bg-transparent shadow-none",
8220
+ classNames == null ? void 0 : classNames.mobileTradeModal
8221
+ )
8222
+ },
8223
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8224
+ PlaceOrder,
8225
+ __spreadProps(__spreadValues({}, placeOrder), {
8226
+ isDismissible: true,
8227
+ className: cn("w-full rounded-t-agg-2xl sm:rounded-agg-xl", classNames == null ? void 0 : classNames.mobileTrade),
8228
+ onClose: handleClose
8229
+ })
8230
+ )
8231
+ }
8232
+ ) })
8233
+ ] });
8234
+ };
7844
8235
  var EventMarketPageUnavailableState = ({
7845
8236
  ariaLabel
7846
8237
  }) => {
7847
- const labels = (0, import_hooks24.useLabels)();
7848
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8238
+ const labels = (0, import_hooks25.useLabels)();
8239
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7849
8240
  Card,
7850
8241
  {
7851
8242
  className: "rounded-agg-xl border border-agg-separator bg-agg-secondary p-6 shadow-none hover:shadow-none",
7852
8243
  role: "status",
7853
8244
  "aria-label": ariaLabel != null ? ariaLabel : labels.eventMarketPage.unavailableAria,
7854
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "flex flex-col gap-1", children: [
7855
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography, { variant: "body-large-strong", children: labels.eventMarketPage.unavailableTitle }),
7856
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.eventMarketPage.unavailableDescription })
8245
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex flex-col gap-1", children: [
8246
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Typography, { variant: "body-large-strong", children: labels.eventMarketPage.unavailableTitle }),
8247
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Typography, { variant: "label", className: "text-agg-muted-foreground", children: labels.eventMarketPage.unavailableDescription })
7857
8248
  ] })
7858
8249
  }
7859
8250
  );
@@ -7861,8 +8252,8 @@ var EventMarketPageUnavailableState = ({
7861
8252
  var EventMarketPageNotFoundState = ({
7862
8253
  ariaLabel
7863
8254
  }) => {
7864
- const labels = (0, import_hooks24.useLabels)();
7865
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Card, { className: "overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-none hover:shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8255
+ const labels = (0, import_hooks25.useLabels)();
8256
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card, { className: "overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-none hover:shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7866
8257
  StateMessage,
7867
8258
  {
7868
8259
  ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
@@ -7877,7 +8268,7 @@ var EventMarketPageLoadingState = ({
7877
8268
  settlement,
7878
8269
  classNames
7879
8270
  }) => {
7880
- const labels = (0, import_hooks24.useLabels)();
8271
+ const labels = (0, import_hooks25.useLabels)();
7881
8272
  const fallbackSettlement = settlement != null ? settlement : {
7882
8273
  sectionLabel: labels.trading.settlementSection,
7883
8274
  question: labels.eventMarketPage.loadingSettlementQuestion,
@@ -7890,46 +8281,66 @@ var EventMarketPageLoadingState = ({
7890
8281
  }
7891
8282
  ]
7892
8283
  };
7893
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("section", { className: cn("w-full", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
7894
- "div",
7895
- {
7896
- className: cn(
7897
- "mx-auto flex w-full max-w-[1200px] flex-col gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
7898
- classNames == null ? void 0 : classNames.content
7899
- ),
7900
- children: [
7901
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
7902
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7903
- EventListItemDetails,
7904
- {
7905
- isLoading: true,
7906
- classNames: {
7907
- root: classNames == null ? void 0 : classNames.hero
8284
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("section", { className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root), children: [
8285
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
8286
+ "div",
8287
+ {
8288
+ className: cn(
8289
+ "mx-auto flex w-full max-w-[1200px] flex-col gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
8290
+ classNames == null ? void 0 : classNames.content
8291
+ ),
8292
+ children: [
8293
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
8294
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8295
+ EventListItemDetails,
8296
+ {
8297
+ isLoading: true,
8298
+ classNames: {
8299
+ root: classNames == null ? void 0 : classNames.hero
8300
+ }
7908
8301
  }
7909
- }
7910
- ),
7911
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
7912
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
7913
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
7914
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
8302
+ ),
8303
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
8304
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
8305
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
8306
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
8307
+ ] }),
8308
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
8309
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) })
7915
8310
  ] }),
7916
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
7917
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
7918
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.mobileTrade })) }) : null
7919
- ] }),
7920
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7921
- "aside",
8311
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8312
+ "aside",
8313
+ {
8314
+ className: cn(
8315
+ "hidden w-full shrink-0 lg:sticky lg:top-6 lg:block lg:w-[343px]",
8316
+ classNames == null ? void 0 : classNames.sidebar
8317
+ ),
8318
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.trade }))
8319
+ }
8320
+ ) : null
8321
+ ]
8322
+ }
8323
+ ),
8324
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8325
+ "div",
8326
+ {
8327
+ className: cn(
8328
+ "fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
8329
+ classNames == null ? void 0 : classNames.mobileTradeCta
8330
+ ),
8331
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8332
+ Button,
7922
8333
  {
7923
- className: cn(
7924
- "hidden w-full shrink-0 lg:sticky lg:top-6 lg:block lg:w-[343px]",
7925
- classNames == null ? void 0 : classNames.sidebar
7926
- ),
7927
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.trade }))
8334
+ size: "large",
8335
+ className: "min-w-[168px] shadow-agg-modal",
8336
+ "aria-label": placeOrder.actionLabel,
8337
+ disabled: true,
8338
+ children: placeOrder.actionLabel
7928
8339
  }
7929
- ) : null
7930
- ]
7931
- }
7932
- ) });
8340
+ )
8341
+ }
8342
+ ) : null
8343
+ ] });
7933
8344
  };
7934
8345
  var EventMarketPageContent = ({
7935
8346
  event,
@@ -7943,7 +8354,7 @@ var EventMarketPageContent = ({
7943
8354
  classNames,
7944
8355
  ariaLabel
7945
8356
  }) => {
7946
- const labels = (0, import_hooks24.useLabels)();
8357
+ const labels = (0, import_hooks25.useLabels)();
7947
8358
  const resolvedHeroMarketId = (0, import_react14.useMemo)(() => {
7948
8359
  return resolveHeroMarketId(event, heroMarketId);
7949
8360
  }, [event, heroMarketId]);
@@ -7979,70 +8390,88 @@ var EventMarketPageContent = ({
7979
8390
  }
7980
8391
  onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(nextExpandedMarketId);
7981
8392
  };
7982
- if (!heroEvent || !event.markets.length) {
7983
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageUnavailableState, { ariaLabel });
8393
+ if (!heroEvent || !event.venueMarkets.length) {
8394
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageUnavailableState, { ariaLabel });
7984
8395
  }
7985
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("section", { className: cn("w-full", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel != null ? ariaLabel : event.title, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
7986
- "div",
8396
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
8397
+ "section",
7987
8398
  {
7988
- className: cn(
7989
- "mx-auto flex w-full max-w-[1200px] flex-row gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
7990
- classNames == null ? void 0 : classNames.content
7991
- ),
8399
+ className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root),
8400
+ "aria-label": ariaLabel != null ? ariaLabel : event.title,
7992
8401
  children: [
7993
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
7994
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
7995
- EventListItemDetails,
7996
- {
7997
- event: heroEvent,
7998
- defaultTimeRange: heroDefaultTimeRange,
7999
- classNames: {
8000
- root: classNames == null ? void 0 : classNames.hero
8001
- }
8002
- }
8003
- ),
8004
- detailedMarkets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: detailedMarkets.map((market) => {
8005
- const isOpened = resolvedExpandedMarketId === market.id;
8006
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8007
- MarketDetails,
8008
- {
8009
- event,
8010
- marketId: market.id,
8011
- isOpened,
8012
- defaultTab: "order-book",
8013
- ariaLabel: market.endDate && (0, import_dayjs6.default)(market.endDate).isValid() ? labels.eventMarketPage.marketDetailsAriaByDate(
8014
- (0, import_dayjs6.default)(market.endDate).format("MMM D, YYYY")
8015
- ) : labels.eventMarketPage.marketDetailsAriaByQuestion(market.question),
8016
- onOpenChange: (nextIsOpened) => handleExpandedMarketChange(market.id, nextIsOpened)
8017
- },
8018
- market.id
8019
- );
8020
- }) }) : null,
8021
- settlement ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null,
8022
- settlement ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null
8023
- ] }),
8024
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("aside", { className: cn("w-full lg:block lg:max-w-[360px]", classNames == null ? void 0 : classNames.sidebar), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { className: classNames == null ? void 0 : classNames.trade })) }) : null
8402
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
8403
+ "div",
8404
+ {
8405
+ className: cn(
8406
+ "mx-auto flex w-full max-w-[1200px] flex-row gap-6 px-3 py-3 md:px-6 md:py-6 lg:flex-row lg:items-start lg:gap-8",
8407
+ classNames == null ? void 0 : classNames.content
8408
+ ),
8409
+ children: [
8410
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
8411
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8412
+ EventListItemDetails,
8413
+ {
8414
+ event: heroEvent,
8415
+ defaultTimeRange: heroDefaultTimeRange,
8416
+ classNames: {
8417
+ root: classNames == null ? void 0 : classNames.hero
8418
+ }
8419
+ }
8420
+ ),
8421
+ detailedMarkets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: detailedMarkets.map((market) => {
8422
+ const isOpened = resolvedExpandedMarketId === market.id;
8423
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8424
+ MarketDetails,
8425
+ {
8426
+ venueMarkets: [market],
8427
+ isOpened,
8428
+ defaultTab: "order-book",
8429
+ ariaLabel: market.endDate && (0, import_dayjs6.default)(market.endDate).isValid() ? labels.eventMarketPage.marketDetailsAriaByDate(
8430
+ (0, import_dayjs6.default)(market.endDate).format("MMM D, YYYY")
8431
+ ) : labels.eventMarketPage.marketDetailsAriaByQuestion(market.question),
8432
+ onOpenChange: (nextIsOpened) => handleExpandedMarketChange(market.id, nextIsOpened)
8433
+ },
8434
+ market.id
8435
+ );
8436
+ }) }) : null,
8437
+ settlement ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null,
8438
+ settlement ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null
8439
+ ] }),
8440
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8441
+ "aside",
8442
+ {
8443
+ className: cn("hidden w-full lg:block lg:max-w-[360px]", classNames == null ? void 0 : classNames.sidebar),
8444
+ "data-testid": "event-market-page-desktop-trade",
8445
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { className: classNames == null ? void 0 : classNames.trade }))
8446
+ }
8447
+ ) : null
8448
+ ]
8449
+ }
8450
+ ),
8451
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageMobileTrade, { placeOrder, classNames }) : null
8025
8452
  ]
8026
8453
  }
8027
- ) });
8454
+ );
8028
8455
  };
8029
8456
  var EventMarketPage = (props) => {
8457
+ var _a;
8030
8458
  const hasEventProp = "event" in props && !!props.event;
8031
8459
  const {
8032
8460
  event: fetchedEvent,
8033
8461
  error: eventError,
8034
8462
  isLoading: isFetchingEvent
8035
- } = (0, import_hooks24.useEvent)(hasEventProp ? void 0 : props.eventId, {
8463
+ } = (0, import_hooks25.useVenueEvent)({
8464
+ eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
8036
8465
  enabled: !props.isLoading && !hasEventProp && !!props.eventId
8037
8466
  });
8038
8467
  if (props.isLoading) {
8039
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageLoadingState, { placeOrder: props.placeOrder, settlement: props.settlement });
8468
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageLoadingState, { placeOrder: props.placeOrder, settlement: props.settlement });
8040
8469
  }
8041
8470
  if ("event" in props && props.event) {
8042
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: props.event }));
8471
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: props.event }));
8043
8472
  }
8044
8473
  if (isFetchingEvent) {
8045
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
8474
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8046
8475
  EventMarketPageLoadingState,
8047
8476
  {
8048
8477
  placeOrder: props.placeOrder,
@@ -8053,11 +8482,11 @@ var EventMarketPage = (props) => {
8053
8482
  }
8054
8483
  if (!fetchedEvent) {
8055
8484
  if (isErrorWithStatus(eventError, 404)) {
8056
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
8485
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
8057
8486
  }
8058
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
8487
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
8059
8488
  }
8060
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
8489
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
8061
8490
  };
8062
8491
  EventMarketPage.displayName = "EventMarketPage";
8063
8492
 
@@ -8074,7 +8503,7 @@ var USER_PROFILE_POSITION_FILTERS = [
8074
8503
  ];
8075
8504
 
8076
8505
  // src/pages/user-profile/components/balance-display.tsx
8077
- var import_jsx_runtime86 = require("react/jsx-runtime");
8506
+ var import_jsx_runtime87 = require("react/jsx-runtime");
8078
8507
  var BalanceDisplay = ({
8079
8508
  balance,
8080
8509
  defaultTimeRange = "All",
@@ -8088,7 +8517,7 @@ var BalanceDisplay = ({
8088
8517
  setActiveRange(range);
8089
8518
  onTimeRangeChange == null ? void 0 : onTimeRangeChange(range);
8090
8519
  };
8091
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
8520
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
8092
8521
  "div",
8093
8522
  {
8094
8523
  className: cn(
@@ -8096,11 +8525,11 @@ var BalanceDisplay = ({
8096
8525
  className
8097
8526
  ),
8098
8527
  children: [
8099
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-end gap-3", children: [
8100
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "agg-type-display text-agg-foreground", children: (_a = currentBalance == null ? void 0 : currentBalance.totalLabel) != null ? _a : "$0.00" }),
8101
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-muted-foreground", children: "Profit/Loss" }),
8102
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-1", children: [
8103
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8528
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-end gap-3", children: [
8529
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "agg-type-display text-agg-foreground", children: (_a = currentBalance == null ? void 0 : currentBalance.totalLabel) != null ? _a : "$0.00" }),
8530
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-muted-foreground", children: "Profit/Loss" }),
8531
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-1", children: [
8532
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
8104
8533
  "span",
8105
8534
  {
8106
8535
  className: cn(
@@ -8110,7 +8539,7 @@ var BalanceDisplay = ({
8110
8539
  children: (_b = currentBalance == null ? void 0 : currentBalance.changePercentLabel) != null ? _b : "0%"
8111
8540
  }
8112
8541
  ),
8113
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8542
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
8114
8543
  Icon,
8115
8544
  {
8116
8545
  name: "triangle-up-filled",
@@ -8122,9 +8551,9 @@ var BalanceDisplay = ({
8122
8551
  )
8123
8552
  ] })
8124
8553
  ] }),
8125
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "flex w-[100px] items-center justify-between", children: USER_PROFILE_TIME_RANGES.map((range) => {
8554
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "flex w-[100px] items-center justify-between", children: USER_PROFILE_TIME_RANGES.map((range) => {
8126
8555
  const isActive = range === activeRange;
8127
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8556
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
8128
8557
  "button",
8129
8558
  {
8130
8559
  type: "button",
@@ -8145,14 +8574,14 @@ var BalanceDisplay = ({
8145
8574
  BalanceDisplay.displayName = "BalanceDisplay";
8146
8575
 
8147
8576
  // src/pages/user-profile/components/balances-card.tsx
8148
- var import_jsx_runtime87 = require("react/jsx-runtime");
8577
+ var import_jsx_runtime88 = require("react/jsx-runtime");
8149
8578
  var BalancesCard = ({
8150
8579
  venueBalances = [],
8151
8580
  onDeposit,
8152
8581
  onWithdraw,
8153
8582
  className
8154
8583
  }) => {
8155
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
8584
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
8156
8585
  "div",
8157
8586
  {
8158
8587
  className: cn(
@@ -8160,16 +8589,16 @@ var BalancesCard = ({
8160
8589
  className
8161
8590
  ),
8162
8591
  children: [
8163
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h3", { className: "agg-type-body-large-strong text-agg-foreground", children: "Balances" }),
8164
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "relative min-h-0 flex-1 overflow-clip", children: [
8165
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "flex max-h-full flex-col gap-3 overflow-y-auto pr-1", children: venueBalances.map((balance, idx) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center justify-between", children: [
8166
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-1.5", children: [
8167
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(VenueLogo, { venue: balance.venue, size: "small" }),
8168
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground capitalize", children: balance.venue })
8592
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { className: "agg-type-body-large-strong text-agg-foreground", children: "Balances" }),
8593
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "relative min-h-0 flex-1 overflow-clip", children: [
8594
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "flex max-h-full flex-col gap-3 overflow-y-auto pr-1", children: venueBalances.map((balance, idx) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center justify-between", children: [
8595
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center gap-1.5", children: [
8596
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(VenueLogo, { venue: balance.venue, size: "small" }),
8597
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-normal text-agg-foreground capitalize", children: balance.venue })
8169
8598
  ] }),
8170
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-foreground", children: balance.balanceLabel })
8599
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-foreground", children: balance.balanceLabel })
8171
8600
  ] }, `${balance.venue}-${idx}`)) }),
8172
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
8601
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
8173
8602
  "div",
8174
8603
  {
8175
8604
  "aria-hidden": true,
@@ -8177,9 +8606,9 @@ var BalancesCard = ({
8177
8606
  }
8178
8607
  )
8179
8608
  ] }),
8180
- /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "flex items-center gap-3", children: [
8181
- onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { variant: "primary", size: "small", onClick: onDeposit, className: "flex-1", children: "Deposit" }) : null,
8182
- onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Button, { variant: "secondary", size: "small", onClick: onWithdraw, className: "flex-1", children: "Withdraw" }) : null
8609
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center gap-3", children: [
8610
+ onDeposit ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { variant: "primary", size: "small", onClick: onDeposit, className: "flex-1", children: "Deposit" }) : null,
8611
+ onWithdraw ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Button, { variant: "secondary", size: "small", onClick: onWithdraw, className: "flex-1", children: "Withdraw" }) : null
8183
8612
  ] })
8184
8613
  ]
8185
8614
  }
@@ -8191,12 +8620,12 @@ BalancesCard.displayName = "BalancesCard";
8191
8620
  var import_react16 = require("react");
8192
8621
 
8193
8622
  // src/pages/user-profile/components/activity-row.tsx
8194
- var import_jsx_runtime88 = require("react/jsx-runtime");
8623
+ var import_jsx_runtime89 = require("react/jsx-runtime");
8195
8624
  var ActivityRow = ({ activity, onClick }) => {
8196
8625
  const handleClick = () => {
8197
8626
  onClick == null ? void 0 : onClick(activity);
8198
8627
  };
8199
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
8628
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8200
8629
  "button",
8201
8630
  {
8202
8631
  type: "button",
@@ -8207,11 +8636,11 @@ var ActivityRow = ({ activity, onClick }) => {
8207
8636
  ),
8208
8637
  onClick: handleClick,
8209
8638
  children: [
8210
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "w-[60px] shrink-0 font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: activity.type }),
8211
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8212
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
8213
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8214
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
8639
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "w-[60px] shrink-0 font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground", children: activity.type }),
8640
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8641
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(VenueLogo, { venue: activity.venue, size: "small", className: "shrink-0" }),
8642
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8643
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
8215
8644
  RemoteImage,
8216
8645
  {
8217
8646
  src: activity.thumbnailSrc,
@@ -8219,18 +8648,18 @@ var ActivityRow = ({ activity, onClick }) => {
8219
8648
  className: "h-[60px] w-[60px] shrink-0 rounded-agg-sm object-cover"
8220
8649
  }
8221
8650
  ),
8222
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 justify-center", children: [
8223
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: activity.title }),
8224
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center gap-3", children: [
8225
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: activity.outcomeLabel }) }),
8226
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: activity.sharesLabel })
8651
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 justify-center", children: [
8652
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: activity.title }),
8653
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex items-center gap-3", children: [
8654
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: activity.outcomeLabel }) }),
8655
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: activity.sharesLabel })
8227
8656
  ] })
8228
8657
  ] })
8229
8658
  ] })
8230
8659
  ] }),
8231
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex w-[120px] shrink-0 flex-col items-end justify-center gap-1 text-agg-base leading-agg-6 whitespace-nowrap", children: [
8232
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "font-agg-sans font-agg-bold text-black", children: activity.amountLabel }),
8233
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "font-agg-sans font-agg-normal text-agg-muted-foreground", children: activity.timeLabel })
8660
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex w-[120px] shrink-0 flex-col items-end justify-center gap-1 text-agg-base leading-agg-6 whitespace-nowrap", children: [
8661
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "font-agg-sans font-agg-bold text-black", children: activity.amountLabel }),
8662
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "font-agg-sans font-agg-normal text-agg-muted-foreground", children: activity.timeLabel })
8234
8663
  ] })
8235
8664
  ]
8236
8665
  }
@@ -8239,8 +8668,8 @@ var ActivityRow = ({ activity, onClick }) => {
8239
8668
  ActivityRow.displayName = "ActivityRow";
8240
8669
 
8241
8670
  // src/pages/user-profile/components/empty-state.tsx
8242
- var import_jsx_runtime89 = require("react/jsx-runtime");
8243
- var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8671
+ var import_jsx_runtime90 = require("react/jsx-runtime");
8672
+ var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
8244
8673
  "svg",
8245
8674
  {
8246
8675
  width: "40",
@@ -8251,7 +8680,7 @@ var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8251
8680
  className: "text-agg-muted-foreground",
8252
8681
  "aria-hidden": true,
8253
8682
  children: [
8254
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
8683
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8255
8684
  "path",
8256
8685
  {
8257
8686
  d: "M33.3333 5H6.66667C5.74619 5 5 5.74619 5 6.66667V33.3333C5 34.2538 5.74619 35 6.66667 35H33.3333C34.2538 35 35 34.2538 35 33.3333V6.66667C35 5.74619 34.2538 5 33.3333 5Z",
@@ -8261,7 +8690,7 @@ var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8261
8690
  strokeLinejoin: "round"
8262
8691
  }
8263
8692
  ),
8264
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
8693
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8265
8694
  "path",
8266
8695
  {
8267
8696
  d: "M14.1667 16.6667C15.5474 16.6667 16.6667 15.5474 16.6667 14.1667C16.6667 12.786 15.5474 11.6667 14.1667 11.6667C12.786 11.6667 11.6667 12.786 11.6667 14.1667C11.6667 15.5474 12.786 16.6667 14.1667 16.6667Z",
@@ -8271,7 +8700,7 @@ var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8271
8700
  strokeLinejoin: "round"
8272
8701
  }
8273
8702
  ),
8274
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
8703
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8275
8704
  "path",
8276
8705
  {
8277
8706
  d: "M35 25L26.6667 16.6667L6.66667 36.6667",
@@ -8285,17 +8714,17 @@ var EmptyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
8285
8714
  }
8286
8715
  );
8287
8716
  var EmptyState = ({ title, description, className }) => {
8288
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
8717
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8289
8718
  "div",
8290
8719
  {
8291
8720
  className: cn("flex flex-col items-center justify-center gap-8 p-10", className),
8292
8721
  role: "status",
8293
8722
  "aria-live": "polite",
8294
- children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
8295
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(EmptyIcon, {}),
8296
- /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
8297
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
8298
- description ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
8723
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
8724
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(EmptyIcon, {}),
8725
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex flex-col items-center gap-1 text-center text-agg-foreground", children: [
8726
+ /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold", children: title }),
8727
+ description ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal", children: description }) : null
8299
8728
  ] })
8300
8729
  ] })
8301
8730
  }
@@ -8304,12 +8733,12 @@ var EmptyState = ({ title, description, className }) => {
8304
8733
  EmptyState.displayName = "EmptyState";
8305
8734
 
8306
8735
  // src/pages/user-profile/components/position-row.tsx
8307
- var import_jsx_runtime90 = require("react/jsx-runtime");
8736
+ var import_jsx_runtime91 = require("react/jsx-runtime");
8308
8737
  var PositionRow = ({ position, onClick }) => {
8309
8738
  const handleClick = () => {
8310
8739
  onClick == null ? void 0 : onClick(position);
8311
8740
  };
8312
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
8741
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
8313
8742
  "button",
8314
8743
  {
8315
8744
  type: "button",
@@ -8320,10 +8749,10 @@ var PositionRow = ({ position, onClick }) => {
8320
8749
  ),
8321
8750
  onClick: handleClick,
8322
8751
  children: [
8323
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8324
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(VenueLogo, { venue: position.venue, size: "small", className: "shrink-0" }),
8325
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8326
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8752
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8753
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(VenueLogo, { venue: position.venue, size: "small", className: "shrink-0" }),
8754
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
8755
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8327
8756
  RemoteImage,
8328
8757
  {
8329
8758
  src: position.thumbnailSrc,
@@ -8331,21 +8760,21 @@ var PositionRow = ({ position, onClick }) => {
8331
8760
  className: "h-[60px] w-[60px] shrink-0 rounded-agg-sm object-cover"
8332
8761
  }
8333
8762
  ),
8334
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 justify-center", children: [
8335
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: position.title }),
8336
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex items-center gap-3", children: [
8337
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: position.outcomeLabel }) }),
8338
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: position.sharesLabel })
8763
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 justify-center", children: [
8764
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "min-w-full overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: position.title }),
8765
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-3", children: [
8766
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "inline-flex items-center justify-center gap-1.5 rounded-full bg-agg-secondary-hover px-4 py-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: position.outcomeLabel }) }),
8767
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-black whitespace-nowrap", children: position.sharesLabel })
8339
8768
  ] })
8340
8769
  ] })
8341
8770
  ] })
8342
8771
  ] }),
8343
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "w-[120px] shrink-0 agg-type-title text-agg-foreground", children: position.averageLabel }),
8344
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "w-[120px] shrink-0 agg-type-title text-agg-foreground", children: position.currentLabel }),
8345
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex items-center gap-6 shrink-0", children: [
8346
- /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex w-[140px] flex-col items-end justify-center gap-1 text-agg-base leading-agg-6 whitespace-nowrap", children: [
8347
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "font-agg-sans font-agg-bold text-black", children: position.valueLabel }),
8348
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
8772
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[120px] shrink-0 agg-type-title text-agg-foreground", children: position.averageLabel }),
8773
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[120px] shrink-0 agg-type-title text-agg-foreground", children: position.currentLabel }),
8774
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-6 shrink-0", children: [
8775
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex w-[140px] flex-col items-end justify-center gap-1 text-agg-base leading-agg-6 whitespace-nowrap", children: [
8776
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "font-agg-sans font-agg-bold text-black", children: position.valueLabel }),
8777
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8349
8778
  "p",
8350
8779
  {
8351
8780
  className: cn(
@@ -8356,7 +8785,7 @@ var PositionRow = ({ position, onClick }) => {
8356
8785
  }
8357
8786
  )
8358
8787
  ] }),
8359
- /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "chevron-right", size: "small", className: "shrink-0 text-agg-muted-foreground" })
8788
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Icon, { name: "chevron-right", size: "small", className: "shrink-0 text-agg-muted-foreground" })
8360
8789
  ] })
8361
8790
  ]
8362
8791
  }
@@ -8365,7 +8794,7 @@ var PositionRow = ({ position, onClick }) => {
8365
8794
  PositionRow.displayName = "PositionRow";
8366
8795
 
8367
8796
  // src/pages/user-profile/components/positions-activity.tsx
8368
- var import_jsx_runtime91 = require("react/jsx-runtime");
8797
+ var import_jsx_runtime92 = require("react/jsx-runtime");
8369
8798
  var tabItems = [
8370
8799
  { value: USER_PROFILE_TAB_POSITIONS, label: "Positions" },
8371
8800
  { value: USER_PROFILE_TAB_ACTIVITY, label: "Activity" }
@@ -8398,7 +8827,7 @@ var PositionsActivity = ({
8398
8827
  const handleSearchChange = (event) => {
8399
8828
  setSearchValue(event.target.value);
8400
8829
  };
8401
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
8830
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
8402
8831
  "div",
8403
8832
  {
8404
8833
  className: cn(
@@ -8406,7 +8835,7 @@ var PositionsActivity = ({
8406
8835
  className
8407
8836
  ),
8408
8837
  children: [
8409
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8838
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8410
8839
  Tabs,
8411
8840
  {
8412
8841
  items: tabItems,
@@ -8416,13 +8845,13 @@ var PositionsActivity = ({
8416
8845
  className: "w-full [&>div]:w-full"
8417
8846
  }
8418
8847
  ),
8419
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex w-full flex-col gap-6 p-6", children: [
8420
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-start gap-5", children: [
8421
- isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex h-10 w-[270px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
8848
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex w-full flex-col gap-6 p-6", children: [
8849
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-start gap-5", children: [
8850
+ isPositionsTab ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "flex h-10 w-[270px] shrink-0 items-stretch overflow-clip rounded-agg-sm border border-agg-separator", children: USER_PROFILE_POSITION_FILTERS.map((filter, idx) => {
8422
8851
  const isActive = filter.value === positionFilter;
8423
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex flex-1 items-stretch", children: [
8424
- idx > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
8425
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8852
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex flex-1 items-stretch", children: [
8853
+ idx > 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
8854
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8426
8855
  "button",
8427
8856
  {
8428
8857
  type: "button",
@@ -8436,9 +8865,9 @@ var PositionsActivity = ({
8436
8865
  )
8437
8866
  ] }, filter.value);
8438
8867
  }) }) : null,
8439
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("label", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex h-10 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", children: [
8440
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
8441
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8868
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("label", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex h-10 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", children: [
8869
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Icon, { name: "search", size: "small", className: "shrink-0 text-agg-muted-foreground" }),
8870
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8442
8871
  "input",
8443
8872
  {
8444
8873
  value: searchValue,
@@ -8454,24 +8883,24 @@ var PositionsActivity = ({
8454
8883
  )
8455
8884
  ] }) })
8456
8885
  ] }),
8457
- isPositionsTab && filteredPositions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-6 px-0", children: [
8458
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
8459
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Average" }),
8460
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Current" }),
8461
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[184px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Value" })
8886
+ isPositionsTab && filteredPositions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-6 px-0", children: [
8887
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
8888
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Average" }),
8889
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Current" }),
8890
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "w-[184px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Value" })
8462
8891
  ] }) : null,
8463
- !isPositionsTab && filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: "flex items-center gap-6 px-0", children: [
8464
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[60px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Type" }),
8465
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
8466
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Amount" })
8892
+ !isPositionsTab && filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-6 px-0", children: [
8893
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "w-[60px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Type" }),
8894
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "min-w-0 flex-1 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground", children: "Market" }),
8895
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "w-[120px] shrink-0 font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-muted-foreground text-right", children: "Amount" })
8467
8896
  ] }) : null,
8468
- isPositionsTab ? filteredPositions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex flex-col gap-4", children: filteredPositions.map((position) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PositionRow, { position, onClick: onPositionClick }, position.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8897
+ isPositionsTab ? filteredPositions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "flex flex-col gap-4", children: filteredPositions.map((position) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PositionRow, { position, onClick: onPositionClick }, position.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8469
8898
  EmptyState,
8470
8899
  {
8471
8900
  title: "No positions yet",
8472
8901
  description: "Your open trades will appear here once you place an order."
8473
8902
  }
8474
- ) : filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex flex-col gap-4", children: filteredActivities.map((activity) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ActivityRow, { activity, onClick: onActivityClick }, activity.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
8903
+ ) : filteredActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "flex flex-col gap-4", children: filteredActivities.map((activity) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ActivityRow, { activity, onClick: onActivityClick }, activity.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8475
8904
  EmptyState,
8476
8905
  {
8477
8906
  title: "No activity yet",
@@ -8486,9 +8915,9 @@ var PositionsActivity = ({
8486
8915
  PositionsActivity.displayName = "PositionsActivity";
8487
8916
 
8488
8917
  // src/pages/user-profile/components/default-avatar.tsx
8489
- var import_jsx_runtime92 = require("react/jsx-runtime");
8918
+ var import_jsx_runtime93 = require("react/jsx-runtime");
8490
8919
  var DefaultAvatar = ({ className }) => {
8491
- return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
8920
+ return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
8492
8921
  "svg",
8493
8922
  {
8494
8923
  xmlns: "http://www.w3.org/2000/svg",
@@ -8499,15 +8928,15 @@ var DefaultAvatar = ({ className }) => {
8499
8928
  className: cn("shrink-0", className),
8500
8929
  "aria-hidden": true,
8501
8930
  children: [
8502
- /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("g", { clipPath: "url(#clip0_default_avatar)", children: [
8503
- /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8931
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("g", { clipPath: "url(#clip0_default_avatar)", children: [
8932
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8504
8933
  "path",
8505
8934
  {
8506
8935
  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",
8507
8936
  fill: "white"
8508
8937
  }
8509
8938
  ),
8510
- /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8939
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8511
8940
  "path",
8512
8941
  {
8513
8942
  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",
@@ -8515,7 +8944,7 @@ var DefaultAvatar = ({ className }) => {
8515
8944
  fillOpacity: "0.1"
8516
8945
  }
8517
8946
  ),
8518
- /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
8947
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8519
8948
  "path",
8520
8949
  {
8521
8950
  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",
@@ -8524,7 +8953,7 @@ var DefaultAvatar = ({ className }) => {
8524
8953
  }
8525
8954
  )
8526
8955
  ] }),
8527
- /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("rect", { width: "120", height: "120", fill: "white" }) }) })
8956
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("clipPath", { id: "clip0_default_avatar", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("rect", { width: "120", height: "120", fill: "white" }) }) })
8528
8957
  ]
8529
8958
  }
8530
8959
  );
@@ -8532,7 +8961,7 @@ var DefaultAvatar = ({ className }) => {
8532
8961
  DefaultAvatar.displayName = "DefaultAvatar";
8533
8962
 
8534
8963
  // src/pages/user-profile/components/user-info-card.tsx
8535
- var import_jsx_runtime93 = require("react/jsx-runtime");
8964
+ var import_jsx_runtime94 = require("react/jsx-runtime");
8536
8965
  var UserInfoCard = ({
8537
8966
  user,
8538
8967
  onEditProfile,
@@ -8542,54 +8971,54 @@ var UserInfoCard = ({
8542
8971
  const evmExchanges = ((_a = user.connectedExchanges) != null ? _a : []).filter((ex) => ex.venue !== "kalshi");
8543
8972
  const totalExchangeCount = (_c = (_b = user.connectedExchanges) == null ? void 0 : _b.length) != null ? _c : 0;
8544
8973
  const hasEvmExchanges = evmExchanges.length > 0;
8545
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8974
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
8546
8975
  "div",
8547
8976
  {
8548
8977
  className: cn(
8549
8978
  "flex flex-col items-start rounded-agg-md border border-agg-separator bg-agg-secondary p-5",
8550
8979
  className
8551
8980
  ),
8552
- children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex w-full items-start gap-5", children: [
8553
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8981
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex w-full items-start gap-5", children: [
8982
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
8554
8983
  RemoteImage,
8555
8984
  {
8556
8985
  src: user.avatarUrl,
8557
8986
  alt: user.username,
8558
8987
  className: "h-[120px] w-[120px] rounded-full object-cover"
8559
8988
  }
8560
- ) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DefaultAvatar, { className: "h-[120px] w-[120px]" }) }),
8561
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: [
8562
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
8563
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-2", children: [
8564
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("h2", { className: "agg-type-heading text-agg-foreground", children: user.username }),
8565
- user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex items-center gap-2", children: user.socialLinks.map((social) => {
8989
+ ) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultAvatar, { className: "h-[120px] w-[120px]" }) }),
8990
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: [
8991
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
8992
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-2", children: [
8993
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h2", { className: "agg-type-heading text-agg-foreground", children: user.username }),
8994
+ user.socialLinks && user.socialLinks.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex items-center gap-2", children: user.socialLinks.map((social) => {
8566
8995
  const iconName = social.platform === "twitter" ? "twitter" : social.platform === "discord" ? "discord" : "telegram";
8567
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
8996
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
8568
8997
  "span",
8569
8998
  {
8570
8999
  className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-agg-separator bg-agg-secondary",
8571
- children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" })
9000
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Icon, { name: iconName, size: "small", className: "text-agg-foreground" })
8572
9001
  },
8573
9002
  social.platform
8574
9003
  );
8575
9004
  }) }) : null
8576
9005
  ] }),
8577
- onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
9006
+ onEditProfile ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
8578
9007
  "button",
8579
9008
  {
8580
9009
  type: "button",
8581
9010
  onClick: onEditProfile,
8582
9011
  className: "flex shrink-0 cursor-pointer items-center gap-1.5 bg-transparent text-agg-primary hover:opacity-80",
8583
9012
  children: [
8584
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
8585
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
9013
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Icon, { name: "pencil", size: "small", className: "text-agg-primary" }),
9014
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-agg-base font-agg-bold leading-6", children: "Edit" })
8586
9015
  ]
8587
9016
  }
8588
9017
  ) : null
8589
9018
  ] }),
8590
- totalExchangeCount > 0 || user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-col gap-3", children: [
8591
- hasEvmExchanges ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-3", children: [
8592
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex items-center", children: evmExchanges.map((exchange, idx) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
9019
+ totalExchangeCount > 0 || user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex flex-col gap-3", children: [
9020
+ hasEvmExchanges ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-3", children: [
9021
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex items-center", children: evmExchanges.map((exchange, idx) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
8593
9022
  "div",
8594
9023
  {
8595
9024
  className: cn(
@@ -8597,23 +9026,23 @@ var UserInfoCard = ({
8597
9026
  idx > 0 && "-ml-2"
8598
9027
  ),
8599
9028
  style: { zIndex: evmExchanges.length - idx },
8600
- children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(VenueLogo, { venue: exchange.venue, size: "small", className: "h-5 w-5" })
9029
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(VenueLogo, { venue: exchange.venue, size: "small", className: "h-5 w-5" })
8601
9030
  },
8602
9031
  `${exchange.venue}-${idx}`
8603
9032
  )) }),
8604
- user.displayAddress ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground", children: user.displayAddress }) : null,
8605
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-1", children: [
8606
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-muted-foreground", children: [
9033
+ user.displayAddress ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground", children: user.displayAddress }) : null,
9034
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-1", children: [
9035
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { className: "text-agg-sm font-agg-normal leading-5 text-agg-muted-foreground", children: [
8607
9036
  totalExchangeCount,
8608
9037
  " exchange",
8609
9038
  totalExchangeCount !== 1 ? "s" : ""
8610
9039
  ] }),
8611
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Icon, { name: "info", size: "small", className: "text-agg-muted-foreground" })
9040
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Icon, { name: "info", size: "small", className: "text-agg-muted-foreground" })
8612
9041
  ] })
8613
9042
  ] }) : null,
8614
- user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex items-center gap-3", children: [
8615
- user.socialHandleVenue ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-[4px]", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(VenueLogo, { venue: user.socialHandleVenue, size: "small", className: "h-5 w-5" }) }) : null,
8616
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground", children: user.socialHandle })
9043
+ user.socialHandle ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex items-center gap-3", children: [
9044
+ user.socialHandleVenue ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-[4px]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(VenueLogo, { venue: user.socialHandleVenue, size: "small", className: "h-5 w-5" }) }) : null,
9045
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground", children: user.socialHandle })
8617
9046
  ] }) : null
8618
9047
  ] }) : null
8619
9048
  ] })
@@ -8624,7 +9053,7 @@ var UserInfoCard = ({
8624
9053
  UserInfoCard.displayName = "UserInfoCard";
8625
9054
 
8626
9055
  // src/pages/user-profile/index.tsx
8627
- var import_jsx_runtime94 = require("react/jsx-runtime");
9056
+ var import_jsx_runtime95 = require("react/jsx-runtime");
8628
9057
  var UserProfilePage = ({
8629
9058
  user,
8630
9059
  venueBalances,
@@ -8641,7 +9070,7 @@ var UserProfilePage = ({
8641
9070
  onActivityClick,
8642
9071
  classNames
8643
9072
  }) => {
8644
- return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "box-border w-full overflow-x-hidden p-10", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
9073
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "box-border w-full overflow-x-hidden p-10", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
8645
9074
  "section",
8646
9075
  {
8647
9076
  className: cn(
@@ -8649,9 +9078,9 @@ var UserProfilePage = ({
8649
9078
  classNames == null ? void 0 : classNames.root
8650
9079
  ),
8651
9080
  children: [
8652
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: cn("flex items-stretch gap-6", classNames == null ? void 0 : classNames.topRow), children: [
8653
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.leftColumn), children: [
8654
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
9081
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: cn("flex items-stretch gap-6", classNames == null ? void 0 : classNames.topRow), children: [
9082
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.leftColumn), children: [
9083
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
8655
9084
  UserInfoCard,
8656
9085
  {
8657
9086
  user,
@@ -8659,7 +9088,7 @@ var UserProfilePage = ({
8659
9088
  className: classNames == null ? void 0 : classNames.userInfoCard
8660
9089
  }
8661
9090
  ),
8662
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
9091
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
8663
9092
  BalanceDisplay,
8664
9093
  {
8665
9094
  balance,
@@ -8669,7 +9098,7 @@ var UserProfilePage = ({
8669
9098
  }
8670
9099
  )
8671
9100
  ] }),
8672
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "relative w-[465px] shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
9101
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "relative w-[465px] shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
8673
9102
  BalancesCard,
8674
9103
  {
8675
9104
  venueBalances,
@@ -8679,7 +9108,7 @@ var UserProfilePage = ({
8679
9108
  }
8680
9109
  ) })
8681
9110
  ] }),
8682
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
9111
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
8683
9112
  PositionsActivity,
8684
9113
  {
8685
9114
  activePositions,