@agg-market/ui 9.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 (52) hide show
  1. package/dist/{chunk-N7U7QCSB.mjs → chunk-55YYUTBK.mjs} +807 -358
  2. package/dist/{chunk-3U4VHAP6.mjs → chunk-5G4T5R2H.mjs} +6 -2
  3. package/dist/{chunk-6CRY27SQ.mjs → chunk-GYOCLZGH.mjs} +538 -418
  4. package/dist/{chunk-HJ4UPYM7.mjs → chunk-RYQSVETG.mjs} +201 -165
  5. package/dist/{chunk-3G7C6WEC.mjs → chunk-XP7DREIX.mjs} +47 -15
  6. package/dist/events.js +575 -429
  7. package/dist/events.mjs +6 -4
  8. package/dist/index.js +1577 -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 +1400 -1010
  13. package/dist/pages.mjs +4 -4
  14. package/dist/primitives.js +46 -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 +1 -2
  21. package/dist/types/events/item/event-list-item.types.d.ts +1 -2
  22. package/dist/types/events/item-details/event-list-item-details.types.d.mts +1 -4
  23. package/dist/types/events/item-details/event-list-item-details.types.d.ts +1 -4
  24. package/dist/types/events/item-details/event-list-item-details.utils.d.mts +42 -3
  25. package/dist/types/events/item-details/event-list-item-details.utils.d.ts +42 -3
  26. package/dist/types/events/list/event-list.types.d.mts +2 -1
  27. package/dist/types/events/list/event-list.types.d.ts +2 -1
  28. package/dist/types/events/list/index.d.mts +1 -1
  29. package/dist/types/events/list/index.d.ts +1 -1
  30. package/dist/types/events/market-details/index.d.mts +6 -2
  31. package/dist/types/events/market-details/index.d.ts +6 -2
  32. package/dist/types/events/market-details/market-details.types.d.mts +33 -9
  33. package/dist/types/events/market-details/market-details.types.d.ts +33 -9
  34. package/dist/types/events/market-details/market-details.utils.d.mts +15 -10
  35. package/dist/types/events/market-details/market-details.utils.d.ts +15 -10
  36. package/dist/types/modals/index.d.mts +1 -0
  37. package/dist/types/modals/index.d.ts +1 -0
  38. package/dist/types/pages/event-market/event-market.types.d.mts +2 -0
  39. package/dist/types/pages/event-market/event-market.types.d.ts +2 -0
  40. package/dist/types/pages/home/home.constants.d.mts +1 -3
  41. package/dist/types/pages/home/home.constants.d.ts +1 -3
  42. package/dist/types/pages/home/home.types.d.mts +0 -2
  43. package/dist/types/pages/home/home.types.d.ts +0 -2
  44. package/dist/types/pages/home/home.utils.d.mts +4 -0
  45. package/dist/types/pages/home/home.utils.d.ts +4 -0
  46. package/dist/types/pages/home/index.d.mts +1 -1
  47. package/dist/types/pages/home/index.d.ts +1 -1
  48. package/dist/types/primitives/chart/index.d.mts +9 -1
  49. package/dist/types/primitives/chart/index.d.ts +9 -1
  50. package/dist/types/primitives/venue-logo/index.d.mts +1 -1
  51. package/dist/types/primitives/venue-logo/index.d.ts +1 -1
  52. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -128,9 +128,11 @@ __export(src_exports, {
128
128
  LinkAccountsIcon: () => LinkAccountsIcon,
129
129
  LoadingIcon: () => LoadingIcon,
130
130
  MarketDetails: () => MarketDetails,
131
+ MarketDetailsList: () => MarketDetailsList,
131
132
  Modal: () => Modal,
132
133
  NumberValue: () => NumberValue,
133
134
  OnboardingModal: () => OnboardingModal,
135
+ OnrampModal: () => OnrampModal,
134
136
  PencilIcon: () => PencilIcon,
135
137
  PlaceOrder: () => PlaceOrder,
136
138
  PlaySquareIcon: () => PlaySquareIcon,
@@ -915,7 +917,7 @@ var SwitchButton = ({
915
917
  "div",
916
918
  {
917
919
  className: cn(
918
- "group/agg-switch",
920
+ "group/agg-switch min-w-fit",
919
921
  "inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
920
922
  getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
921
923
  "cursor-pointer hover:bg-agg-tertiary",
@@ -961,6 +963,7 @@ var SwitchButton = ({
961
963
  tabIndex: isActive ? 0 : -1,
962
964
  disabled: option.disabled,
963
965
  className: cn(
966
+ "whitespace-nowrap",
964
967
  "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",
965
968
  getMotionClassName(
966
969
  enableAnimations,
@@ -1236,11 +1239,12 @@ var LineChart = ({
1236
1239
  liveCandle: liveForming,
1237
1240
  lineData,
1238
1241
  lineValue,
1239
- live = false
1242
+ live
1240
1243
  }) => {
1241
1244
  var _a, _b;
1242
1245
  const labels = (0, import_hooks11.useLabels)();
1243
- const { theme } = (0, import_hooks11.useSdkUiConfig)();
1246
+ const { theme, enableGradients, enableLiveUpdates } = (0, import_hooks11.useSdkUiConfig)();
1247
+ const isLive = enableLiveUpdates && (live != null ? live : true);
1244
1248
  const normalizedSeries = (0, import_react2.useMemo)(() => {
1245
1249
  return normalizeSeries(series);
1246
1250
  }, [series]);
@@ -1263,7 +1267,19 @@ var LineChart = ({
1263
1267
  if (!primarySeries) {
1264
1268
  return [];
1265
1269
  }
1266
- return toLivelinePoints(primarySeries.points);
1270
+ const points = toLivelinePoints(primarySeries.points);
1271
+ if (points.length < 3) {
1272
+ return [
1273
+ ...points,
1274
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
1275
+ time: point.time + 1500
1276
+ })),
1277
+ ...points.map((point) => __spreadProps(__spreadValues({}, point), {
1278
+ time: point.time + 3e3
1279
+ }))
1280
+ ];
1281
+ }
1282
+ return points;
1267
1283
  }, [primarySeries]);
1268
1284
  const primaryCandles = (0, import_react2.useMemo)(() => {
1269
1285
  if (!primarySeries) {
@@ -1297,7 +1313,7 @@ var LineChart = ({
1297
1313
  const timeFormatter = (0, import_react2.useMemo)(() => {
1298
1314
  return resolveTimeFormatter(windowSeconds);
1299
1315
  }, [windowSeconds]);
1300
- const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
1316
+ const seriesControls = showSeriesControls ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
1301
1317
  series: normalizedSeries,
1302
1318
  activeSeriesId,
1303
1319
  handleSeriesChange
@@ -1330,9 +1346,10 @@ var LineChart = ({
1330
1346
  series: livelineSeries,
1331
1347
  color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
1332
1348
  theme: livelineTheme,
1349
+ fill: enableGradients,
1333
1350
  grid: true,
1334
- momentum: live,
1335
- pulse: live,
1351
+ momentum: isLive,
1352
+ pulse: isLive,
1336
1353
  window: windowSeconds,
1337
1354
  mode: chartType === "candlestick" ? "candle" : "line",
1338
1355
  candles: chartType === "candlestick" ? primaryCandles : void 0,
@@ -1348,7 +1365,8 @@ var LineChart = ({
1348
1365
  bottom: 28,
1349
1366
  left: 12
1350
1367
  },
1351
- loading: isLoading
1368
+ loading: isLoading,
1369
+ lineWidth: 1
1352
1370
  }
1353
1371
  )
1354
1372
  }
@@ -3652,9 +3670,12 @@ var VenueLogo = ({
3652
3670
  title
3653
3671
  }) => {
3654
3672
  var _a;
3673
+ const { showVenueLogo = true } = (0, import_hooks14.useAggUiConfig)();
3655
3674
  const labels = (0, import_hooks14.useLabels)();
3656
3675
  const sizeClass = sizeClasses2[size];
3657
3676
  const resolvedLabel = (_a = ariaLabel != null ? ariaLabel : labels.venues[venue]) != null ? _a : venueLogoLabels[venue];
3677
+ if (!showVenueLogo)
3678
+ return null;
3658
3679
  if (variant === "logo") {
3659
3680
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
3660
3681
  RemoteImage,
@@ -3728,9 +3749,9 @@ function Badge({
3728
3749
  )
3729
3750
  }, onClick && { onClick }), {
3730
3751
  children: [
3731
- prefix ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
3752
+ prefix ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.prefix, "empty:hidden"), children: prefix }) : null,
3732
3753
  /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
3733
- suffix ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
3754
+ suffix ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.suffix, "empty:hidden"), children: suffix }) : null
3734
3755
  ]
3735
3756
  })
3736
3757
  );
@@ -4236,7 +4257,11 @@ var StateMessage = ({
4236
4257
  size: "large",
4237
4258
  className: "text-agg-base leading-agg-6",
4238
4259
  "aria-label": actionLabel,
4239
- onClick: onAction,
4260
+ onClick: (e) => {
4261
+ e.stopPropagation();
4262
+ e.preventDefault();
4263
+ onAction == null ? void 0 : onAction();
4264
+ },
4240
4265
  children: actionLabel
4241
4266
  }
4242
4267
  ) : null
@@ -4288,7 +4313,7 @@ var getTabButtonClassName = ({
4288
4313
  return cn(
4289
4314
  "cursor-pointer disabled:cursor-not-allowed",
4290
4315
  "relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
4291
- isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
4316
+ isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-agg-bold",
4292
4317
  getMotionClassName(
4293
4318
  enableAnimations,
4294
4319
  "transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
@@ -4714,8 +4739,17 @@ var Tabs = ({
4714
4739
  )
4715
4740
  }
4716
4741
  ) }) : null,
4717
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
4718
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase", children: item.label })
4742
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center empty:hidden", children: item.icon }) : null,
4743
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
4744
+ "span",
4745
+ {
4746
+ className: cn(
4747
+ "relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase"
4748
+ ),
4749
+ "data-text": item.label,
4750
+ children: item.label
4751
+ }
4752
+ )
4719
4753
  ]
4720
4754
  },
4721
4755
  item.value
@@ -5743,7 +5777,6 @@ var EventListItemContent = ({
5743
5777
  event,
5744
5778
  title,
5745
5779
  image,
5746
- showVenueLogo = true,
5747
5780
  maxOutcomes = 2,
5748
5781
  classNames,
5749
5782
  venueInfo,
@@ -5779,7 +5812,7 @@ var EventListItemContent = ({
5779
5812
  return;
5780
5813
  if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
5781
5814
  eventToHandle == null ? void 0 : eventToHandle.preventDefault();
5782
- onClick();
5815
+ onClick == null ? void 0 : onClick(event);
5783
5816
  }
5784
5817
  };
5785
5818
  const renderArbitrage = (value) => {
@@ -5806,7 +5839,7 @@ var EventListItemContent = ({
5806
5839
  className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
5807
5840
  role: onClick ? "button" : void 0,
5808
5841
  tabIndex: onClick ? 0 : void 0,
5809
- onClick,
5842
+ onClick: () => onClick == null ? void 0 : onClick(event),
5810
5843
  onKeyDown: handleKeyDown,
5811
5844
  "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
5812
5845
  children: [
@@ -5860,7 +5893,7 @@ var EventListItemContent = ({
5860
5893
  Badge,
5861
5894
  {
5862
5895
  text: config.formatPercent(probability),
5863
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }) : void 0,
5896
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }),
5864
5897
  size: "large",
5865
5898
  classNames: {
5866
5899
  root: cn(
@@ -5893,7 +5926,7 @@ var EventListItemContent = ({
5893
5926
  ) }),
5894
5927
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
5895
5928
  singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
5896
- showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
5929
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
5897
5930
  VenueLogo,
5898
5931
  {
5899
5932
  venue: singleVenue,
@@ -5901,14 +5934,14 @@ var EventListItemContent = ({
5901
5934
  isMonochromatic: true,
5902
5935
  className: "text-agg-muted-foreground!"
5903
5936
  }
5904
- ) : null,
5937
+ ),
5905
5938
  /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: venueLabel })
5906
5939
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
5907
5940
  venueCount,
5908
5941
  labels.eventItem.venueSingular,
5909
5942
  labels.eventItem.venuePlural
5910
5943
  ) }),
5911
- showVenueLogo && !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
5944
+ !singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
5912
5945
  VenueLogo,
5913
5946
  {
5914
5947
  venue,
@@ -6039,7 +6072,9 @@ var ChartTypeSwitch = ({
6039
6072
  "transition-colors duration-200 ease-in-out",
6040
6073
  isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
6041
6074
  ),
6042
- onClick: () => {
6075
+ onClick: (e) => {
6076
+ e.stopPropagation();
6077
+ e.preventDefault();
6043
6078
  if (isActive) {
6044
6079
  return;
6045
6080
  }
@@ -6068,14 +6103,9 @@ var isDateLikeLabel = (value) => {
6068
6103
  return false;
6069
6104
  return (0, import_dayjs3.default)(value).isValid();
6070
6105
  };
6071
- var formatDateLabel = (value) => {
6072
- if (!isDateLikeLabel(value))
6073
- return value;
6074
- return (0, import_dayjs3.default)(value).format("MMM D, YYYY");
6075
- };
6076
- var getDefaultSelectedTimeRange = (value) => {
6106
+ var getDefaultSelectedTimeRange = (value, fallback = "1D") => {
6077
6107
  if (!value)
6078
- return "1M";
6108
+ return fallback;
6079
6109
  return value;
6080
6110
  };
6081
6111
  var getTimeWindowByRange = (range) => {
@@ -6157,24 +6187,6 @@ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
6157
6187
  };
6158
6188
  }).filter((item) => item != null);
6159
6189
  };
6160
- var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
6161
- const marketIdByVenue = /* @__PURE__ */ new Map();
6162
- selectedOutcomes.forEach(({ venue, market }) => {
6163
- var _a, _b;
6164
- const marketWithCanonicalId = market;
6165
- const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
6166
- if (!canonicalMarketId)
6167
- return;
6168
- if (!marketIdByVenue.has(venue)) {
6169
- marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
6170
- }
6171
- (_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
6172
- });
6173
- return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
6174
- venue,
6175
- venueMarketOutcomeIds: [...marketIds]
6176
- })).filter((group) => group.venueMarketOutcomeIds.length > 0);
6177
- };
6178
6190
  var resolveSeriesColor = (venue, index) => {
6179
6191
  var _a;
6180
6192
  const colorFromVenue = lineColorByVenue[venue];
@@ -6182,6 +6194,98 @@ var resolveSeriesColor = (venue, index) => {
6182
6194
  return colorFromVenue;
6183
6195
  return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
6184
6196
  };
6197
+ var toNonEmptyString = (value) => {
6198
+ if (typeof value !== "string")
6199
+ return void 0;
6200
+ const trimmedValue = value.trim();
6201
+ return trimmedValue ? trimmedValue : void 0;
6202
+ };
6203
+ var resolveCanonicalMarketId = (venueMarkets, fallbackMarketId) => {
6204
+ var _a;
6205
+ const uniqueMarketIds = Array.from(
6206
+ new Set(venueMarkets.map((market) => toNonEmptyString(market.marketId)).filter(Boolean))
6207
+ );
6208
+ if (uniqueMarketIds.length === 1) {
6209
+ return uniqueMarketIds[0];
6210
+ }
6211
+ return (_a = toNonEmptyString(fallbackMarketId)) != null ? _a : uniqueMarketIds[0];
6212
+ };
6213
+ var toChartDisplayValue = (value, transformProbability) => {
6214
+ if (value == null || !Number.isFinite(value))
6215
+ return void 0;
6216
+ return transformProbability(value) * 100;
6217
+ };
6218
+ var marketChartCandleToLineChartPoint = (candle, transformProbability) => {
6219
+ var _a, _b, _c, _d;
6220
+ const open = (_a = toChartDisplayValue(candle.open, transformProbability)) != null ? _a : 0;
6221
+ const high = (_b = toChartDisplayValue(candle.high, transformProbability)) != null ? _b : open;
6222
+ const low = (_c = toChartDisplayValue(candle.low, transformProbability)) != null ? _c : open;
6223
+ const close = (_d = toChartDisplayValue(candle.close, transformProbability)) != null ? _d : open;
6224
+ return {
6225
+ time: candle.time,
6226
+ value: close,
6227
+ open,
6228
+ high,
6229
+ low,
6230
+ close
6231
+ };
6232
+ };
6233
+ var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
6234
+ var _a, _b, _c, _d;
6235
+ const point = marketChartCandleToLineChartPoint(candle, transformProbability);
6236
+ return {
6237
+ time: point.time,
6238
+ open: (_a = point.open) != null ? _a : point.value,
6239
+ high: (_b = point.high) != null ? _b : point.value,
6240
+ low: (_c = point.low) != null ? _c : point.value,
6241
+ close: (_d = point.close) != null ? _d : point.value,
6242
+ v: candle.volume
6243
+ };
6244
+ };
6245
+ var resolveMarketChartVenueSeries = ({
6246
+ chartData,
6247
+ transformProbability
6248
+ }) => {
6249
+ if (!chartData)
6250
+ return [];
6251
+ return Object.entries(chartData.venues).map(([venue, venueData]) => ({
6252
+ venue,
6253
+ points: venueData.candles.map(
6254
+ (candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
6255
+ )
6256
+ })).filter((item) => item.points.length > 0);
6257
+ };
6258
+ var resolveMarketChartLiveState = ({
6259
+ chartData,
6260
+ selectedVenue,
6261
+ transformProbability
6262
+ }) => {
6263
+ var _a, _b;
6264
+ if (!chartData) {
6265
+ return {
6266
+ liveCandle: null,
6267
+ lineValue: void 0,
6268
+ live: false
6269
+ };
6270
+ }
6271
+ const venueEntries = selectedVenue ? Object.entries(chartData.venues).filter(([venue]) => venue === selectedVenue) : Object.entries(chartData.venues);
6272
+ if (venueEntries.length === 0) {
6273
+ return {
6274
+ liveCandle: null,
6275
+ lineValue: void 0,
6276
+ live: false
6277
+ };
6278
+ }
6279
+ const singleVenueView = selectedVenue != null || venueEntries.length === 1;
6280
+ const liveCandleEntry = singleVenueView ? venueEntries.find(([, venueData]) => venueData.liveCandle != null) : null;
6281
+ const primaryLineValue = (_b = (_a = venueEntries[0]) == null ? void 0 : _a[1]) == null ? void 0 : _b.lineValue;
6282
+ const lineValue = primaryLineValue != null ? toChartDisplayValue(primaryLineValue, transformProbability) : void 0;
6283
+ return {
6284
+ liveCandle: (liveCandleEntry == null ? void 0 : liveCandleEntry[1].liveCandle) ? marketChartCandleToScaledCandlePoint(liveCandleEntry[1].liveCandle, transformProbability) : null,
6285
+ lineValue,
6286
+ live: liveCandleEntry != null
6287
+ };
6288
+ };
6185
6289
 
6186
6290
  // src/events/item-details/index.tsx
6187
6291
  var import_jsx_runtime85 = require("react/jsx-runtime");
@@ -6246,31 +6350,23 @@ var resolveAverageProbability = (values) => {
6246
6350
  return void 0;
6247
6351
  return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
6248
6352
  };
6249
- var resolveOutcomeCandidateIds = (market, outcome) => {
6250
- var _a, _b;
6251
- const marketWithCanonicalId = market;
6252
- return [
6253
- outcome.id,
6254
- (_a = outcome.externalIdentifier) != null ? _a : void 0,
6255
- market.externalIdentifier,
6256
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0
6257
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
6258
- };
6259
6353
  var EventListItemDetailsGraphSection = ({
6260
6354
  venueMarkets,
6261
- canonicalMarketId,
6262
6355
  selectedOutcomeLabel,
6263
6356
  onSelectedOutcomeLabelChange,
6264
6357
  switchLabels,
6265
6358
  isDateOutcomeMarket,
6266
6359
  classNames,
6267
- showVenueLogo,
6268
6360
  venueInfo,
6269
6361
  formatPercent,
6270
6362
  selectedTimeRange,
6271
- selectedChartType
6363
+ selectedChartType,
6364
+ selectedOutcome: _selectedOutcome,
6365
+ selectedMarket
6272
6366
  }) => {
6367
+ var _a, _b;
6273
6368
  const labels = (0, import_hooks23.useLabels)();
6369
+ const { enableLiveUpdates } = (0, import_hooks23.useSdkUiConfig)();
6274
6370
  const [selectedVenue, setSelectedVenue] = (0, import_react10.useState)(null);
6275
6371
  const [activeProbabilityMode, setActiveProbabilityMode] = (0, import_react10.useState)("yes");
6276
6372
  const probabilityModeConfigs = (0, import_react10.useMemo)(() => {
@@ -6339,105 +6435,71 @@ var EventListItemDetailsGraphSection = ({
6339
6435
  no: buildModeData("no")
6340
6436
  };
6341
6437
  }, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
6342
- const allOutcomesForHistory = (0, import_react10.useMemo)(() => {
6343
- const outcomeByModeAndId = /* @__PURE__ */ new Map();
6344
- probabilityModeOrder.forEach((mode) => {
6345
- selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
6346
- outcomeByModeAndId.set(
6347
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
6348
- outcomeByVenue
6349
- );
6350
- });
6351
- });
6352
- return [...outcomeByModeAndId.values()];
6353
- }, [selectedOutcomesByMode]);
6354
- const priceHistoryGroups = (0, import_react10.useMemo)(() => {
6355
- return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
6356
- }, [allOutcomesForHistory, canonicalMarketId]);
6357
6438
  const timeWindow = (0, import_react10.useMemo)(() => {
6358
6439
  return getTimeWindowByRange(selectedTimeRange);
6359
6440
  }, [selectedTimeRange]);
6441
+ const activeOutcomes = selectedOutcomesByMode[activeProbabilityMode];
6442
+ const activeCanonicalMarketId = (0, import_react10.useMemo)(() => {
6443
+ return resolveCanonicalMarketId(activeOutcomes.map((item) => item.market));
6444
+ }, [activeOutcomes]);
6445
+ const venueMarketIds = (0, import_react10.useMemo)(() => {
6446
+ return activeOutcomes.map((item) => item.market.id);
6447
+ }, [activeOutcomes]);
6360
6448
  const {
6361
- data: priceHistoryData,
6362
- isLoading: isPriceHistoryLoading,
6363
- error: priceHistoryError,
6364
- results: priceHistoryResults
6365
- } = (0, import_hooks23.usePriceHistory)(__spreadProps(__spreadValues({
6366
- groups: priceHistoryGroups
6367
- }, timeWindow), {
6368
- enabled: priceHistoryGroups.length > 0
6369
- }));
6370
- const priceHistoryByVenue = (0, import_react10.useMemo)(() => {
6371
- const historyByVenue = /* @__PURE__ */ new Map();
6372
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
6373
- return historyByVenue;
6374
- }
6375
- priceHistoryData.forEach((historyItem) => {
6376
- const venue = historyItem.venue;
6377
- const venueHistory = historyByVenue.get(venue);
6378
- if (venueHistory) {
6379
- venueHistory.push(historyItem);
6380
- return;
6381
- }
6382
- historyByVenue.set(venue, [historyItem]);
6383
- });
6384
- return historyByVenue;
6385
- }, [priceHistoryData]);
6386
- const chartSeriesByMode = (0, import_react10.useMemo)(() => {
6387
- const buildSeries = (mode) => {
6388
- const modeConfig = probabilityModeConfigs[mode];
6389
- const chartSeries = [];
6390
- normalizedVenueDataByMode[mode].forEach((venueData) => {
6391
- var _a;
6392
- const venueHistory = priceHistoryByVenue.get(venueData.venue);
6393
- if (!(venueHistory == null ? void 0 : venueHistory.length))
6394
- return;
6395
- const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
6396
- const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
6397
- if (!matchingHistory)
6398
- return;
6399
- const points = matchingHistory.points.map((point) => {
6400
- const probability = normalizeProbability(point.price);
6401
- if (probability == null || !Number.isFinite(point.timestamp))
6402
- return null;
6403
- const open = normalizeProbability(point.open);
6404
- const high = normalizeProbability(point.high);
6405
- const low = normalizeProbability(point.low);
6406
- const close = normalizeProbability(point.close);
6407
- const transformedPoint = {
6408
- time: point.timestamp,
6409
- value: clampProbability(modeConfig.transformProbability(probability)) * 100,
6410
- open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
6411
- high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
6412
- low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
6413
- close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
6414
- };
6415
- return transformedPoint;
6416
- }).filter((point) => point != null);
6417
- if (points.length === 0)
6418
- return;
6419
- chartSeries.push({
6420
- id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
6421
- venue: venueData.venue,
6422
- color: venueData.color,
6423
- points,
6424
- lineWidth: 2,
6425
- lineStyle: "solid"
6426
- });
6427
- });
6428
- return chartSeries;
6429
- };
6430
- return {
6431
- yes: buildSeries("yes"),
6432
- no: buildSeries("no")
6433
- };
6434
- }, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
6449
+ data: marketChartData,
6450
+ isLoading: isMarketChartLoading,
6451
+ error: marketChartError,
6452
+ refetch: refetchMarketChart
6453
+ } = (0, import_hooks23.useMarketChart)({
6454
+ marketId: (_a = selectedMarket == null ? void 0 : selectedMarket.id) != null ? _a : null,
6455
+ venueMarketIds,
6456
+ interval: (0, import_hooks23.timeRangeToInterval)(selectedTimeRange),
6457
+ startTs: timeWindow.startTs * 1e3,
6458
+ endTs: timeWindow.endTs * 1e3,
6459
+ enabled: !!(selectedMarket == null ? void 0 : selectedMarket.id),
6460
+ live: enableLiveUpdates
6461
+ });
6435
6462
  const visibleChartSeries = (0, import_react10.useMemo)(() => {
6436
- const modeSeries = chartSeriesByMode[activeProbabilityMode];
6463
+ const transformProbability = probabilityModeConfigs[activeProbabilityMode].transformProbability;
6464
+ const colorByVenue = new Map(
6465
+ normalizedVenueDataByMode[activeProbabilityMode].map((venueData) => [
6466
+ venueData.venue,
6467
+ venueData.color
6468
+ ])
6469
+ );
6470
+ const series = resolveMarketChartVenueSeries({
6471
+ chartData: marketChartData,
6472
+ transformProbability
6473
+ }).map((seriesItem) => {
6474
+ var _a2;
6475
+ const resolvedVenue = seriesItem.venue;
6476
+ return {
6477
+ id: `${activeProbabilityMode}-${resolvedVenue}-${activeCanonicalMarketId != null ? activeCanonicalMarketId : "chart"}`,
6478
+ venue: resolvedVenue,
6479
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
6480
+ points: seriesItem.points,
6481
+ lineWidth: 2,
6482
+ lineStyle: "solid"
6483
+ };
6484
+ });
6437
6485
  if (!selectedVenue)
6438
- return modeSeries;
6439
- return modeSeries.filter((seriesItem) => seriesItem.venue === selectedVenue);
6440
- }, [activeProbabilityMode, chartSeriesByMode, selectedVenue]);
6486
+ return series;
6487
+ return series.filter((seriesItem) => seriesItem.venue === selectedVenue);
6488
+ }, [
6489
+ activeCanonicalMarketId,
6490
+ activeProbabilityMode,
6491
+ marketChartData,
6492
+ normalizedVenueDataByMode,
6493
+ probabilityModeConfigs,
6494
+ selectedVenue
6495
+ ]);
6496
+ const chartLiveState = (0, import_react10.useMemo)(() => {
6497
+ return resolveMarketChartLiveState({
6498
+ chartData: marketChartData,
6499
+ selectedVenue,
6500
+ transformProbability: probabilityModeConfigs[activeProbabilityMode].transformProbability
6501
+ });
6502
+ }, [activeProbabilityMode, marketChartData, probabilityModeConfigs, selectedVenue]);
6441
6503
  const segmentedDisplayItems = (0, import_react10.useMemo)(() => {
6442
6504
  return probabilityModeOrder.map((mode) => {
6443
6505
  const averageProbability = resolveAverageProbability(
@@ -6475,31 +6537,22 @@ var EventListItemDetailsGraphSection = ({
6475
6537
  return venue;
6476
6538
  });
6477
6539
  };
6478
- const handleRetryPriceHistory = () => {
6479
- void Promise.all(priceHistoryResults.map((result) => result.refetch()));
6540
+ const handleRetryMarketChart = () => {
6541
+ void refetchMarketChart();
6480
6542
  };
6481
- if (priceHistoryError) {
6482
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6483
- "div",
6543
+ if (marketChartError) {
6544
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cn("w-full", classNames == null ? void 0 : classNames.chart), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6545
+ StateMessage,
6484
6546
  {
6485
- className: cn(
6486
- "w-full rounded-agg-xl border border-agg-separator bg-agg-secondary",
6487
- classNames == null ? void 0 : classNames.chart
6488
- ),
6489
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6490
- StateMessage,
6491
- {
6492
- ariaLabel: labels.eventItemDetails.chartUnavailableAria,
6493
- tone: "warning",
6494
- title: labels.eventItemDetails.chartUnavailableTitle,
6495
- description: labels.eventItemDetails.chartUnavailableDescription,
6496
- actionLabel: labels.common.retry,
6497
- onAction: handleRetryPriceHistory,
6498
- className: "min-h-[300px] px-5 py-10 md:px-10"
6499
- }
6500
- )
6547
+ tone: "warning",
6548
+ ariaLabel: labels.eventItemDetails.chartUnavailableAria,
6549
+ title: labels.eventItemDetails.chartUnavailableTitle,
6550
+ description: labels.eventItemDetails.chartUnavailableDescription,
6551
+ actionLabel: labels.common.retry,
6552
+ onAction: handleRetryMarketChart,
6553
+ className: "min-h-[300px] px-5 py-10 md:px-10"
6501
6554
  }
6502
- );
6555
+ ) });
6503
6556
  }
6504
6557
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6505
6558
  LineChart,
@@ -6507,8 +6560,10 @@ var EventListItemDetailsGraphSection = ({
6507
6560
  classNames: { root: classNames == null ? void 0 : classNames.chart },
6508
6561
  series: visibleChartSeries,
6509
6562
  height: 300,
6510
- isLoading: isPriceHistoryLoading,
6563
+ isLoading: isMarketChartLoading,
6511
6564
  chartType: selectedChartType,
6565
+ liveCandle: selectedChartType === "candlestick" ? (_b = chartLiveState.liveCandle) != null ? _b : void 0 : void 0,
6566
+ lineValue: chartLiveState.lineValue,
6512
6567
  showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
6513
6568
  renderSeriesControls: () => {
6514
6569
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
@@ -6524,7 +6579,7 @@ var EventListItemDetailsGraphSection = ({
6524
6579
  classNames == null ? void 0 : classNames.outcomeBadges
6525
6580
  ),
6526
6581
  children: activeModeVenueData.map((venueData) => {
6527
- var _a;
6582
+ var _a2;
6528
6583
  const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
6529
6584
  const isActiveVenue = selectedVenue === venueData.venue;
6530
6585
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
@@ -6541,14 +6596,14 @@ var EventListItemDetailsGraphSection = ({
6541
6596
  {
6542
6597
  text,
6543
6598
  size: "large",
6544
- prefix: showVenueLogo ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6599
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6545
6600
  VenueLogo,
6546
6601
  {
6547
6602
  venue: venueData.venue,
6548
6603
  size: "small",
6549
- title: (_a = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a.label
6604
+ title: (_a2 = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a2.label
6550
6605
  }
6551
- ) : void 0,
6606
+ ),
6552
6607
  classNames: {
6553
6608
  root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
6554
6609
  },
@@ -6589,45 +6644,55 @@ var EventListItemDetailsGraphSection = ({
6589
6644
  };
6590
6645
  var EventListItemDetailsContent = ({
6591
6646
  event,
6592
- title,
6593
- image,
6594
- showVenueLogo = true,
6595
6647
  classNames,
6596
6648
  venueInfo,
6597
6649
  detailsStats,
6598
6650
  ariaLabel,
6599
- defaultTimeRange
6651
+ defaultTimeRange,
6652
+ onClick
6600
6653
  }) => {
6654
+ var _a;
6601
6655
  const config = (0, import_hooks23.useSdkUiConfig)();
6602
6656
  const labels = (0, import_hooks23.useLabels)();
6603
6657
  const venueMarkets = (0, import_react10.useMemo)(() => {
6604
- var _a;
6605
- return (_a = event.venueMarkets) != null ? _a : [];
6658
+ var _a2;
6659
+ return (_a2 = event.venueMarkets) != null ? _a2 : [];
6606
6660
  }, [event.venueMarkets]);
6661
+ const [selectedMarket, setSelectedMarket] = (0, import_react10.useState)(venueMarkets[0]);
6662
+ const [selectedOutcome] = (0, import_react10.useState)(
6663
+ (_a = selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes.find(
6664
+ (outcome) => outcome.winner
6665
+ )) != null ? _a : selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes[0]
6666
+ );
6607
6667
  const primaryVenueMarket = (0, import_react10.useMemo)(() => {
6608
6668
  return selectPrimaryVenueMarket(venueMarkets);
6609
6669
  }, [venueMarkets]);
6670
+ const filteredVenueMarkets = (0, import_react10.useMemo)(() => {
6671
+ if (!selectedMarket)
6672
+ return venueMarkets;
6673
+ return venueMarkets.filter(
6674
+ (vm) => vm.question === (selectedMarket == null ? void 0 : selectedMarket.question)
6675
+ );
6676
+ }, [venueMarkets, selectedMarket]);
6610
6677
  const outcomeLabels = (0, import_react10.useMemo)(() => {
6611
- return resolveOutcomeLabels(venueMarkets);
6612
- }, [venueMarkets]);
6678
+ return resolveOutcomeLabels(filteredVenueMarkets);
6679
+ }, [filteredVenueMarkets]);
6613
6680
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react10.useState)(() => {
6614
6681
  return resolveDefaultOutcomeLabel(outcomeLabels);
6615
6682
  });
6683
+ const configTimeRange = config.defaultChartTimeRange;
6616
6684
  const [selectedTimeRange, setSelectedTimeRange] = (0, import_react10.useState)(() => {
6617
- return getDefaultSelectedTimeRange(defaultTimeRange);
6685
+ return getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange);
6618
6686
  });
6619
6687
  const [selectedChartType, setSelectedChartType] = (0, import_react10.useState)("line");
6620
6688
  (0, import_react10.useEffect)(() => {
6621
- setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
6622
- }, [defaultTimeRange]);
6623
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
6624
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
6689
+ setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange));
6690
+ }, [defaultTimeRange, configTimeRange]);
6625
6691
  const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
6626
- const outcomeSelectorLabels = outcomeLabels;
6627
6692
  const probabilityByLabel = (0, import_react10.useMemo)(() => {
6628
6693
  return new Map(
6629
6694
  outcomeLabels.map((label) => {
6630
- const outcomesByVenue = resolveOutcomesByVenue(venueMarkets, label);
6695
+ const outcomesByVenue = resolveOutcomesByVenue(filteredVenueMarkets, label);
6631
6696
  const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
6632
6697
  if (probabilities.length === 0) {
6633
6698
  return [label, void 0];
@@ -6636,13 +6701,13 @@ var EventListItemDetailsContent = ({
6636
6701
  return [label, averageProbability];
6637
6702
  })
6638
6703
  );
6639
- }, [outcomeLabels, venueMarkets]);
6704
+ }, [outcomeLabels, filteredVenueMarkets]);
6640
6705
  const mainOutcomeLabel = (0, import_react10.useMemo)(() => {
6641
6706
  if (outcomeLabels.length === 0)
6642
6707
  return void 0;
6643
6708
  return [...outcomeLabels].sort((left, right) => {
6644
- var _a, _b;
6645
- const leftProbability = (_a = probabilityByLabel.get(left)) != null ? _a : -1;
6709
+ var _a2, _b;
6710
+ const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
6646
6711
  const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
6647
6712
  return rightProbability - leftProbability;
6648
6713
  })[0];
@@ -6659,17 +6724,17 @@ var EventListItemDetailsContent = ({
6659
6724
  setSelectedOutcomeLabel(fallbackOutcomeLabel);
6660
6725
  }, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
6661
6726
  const switchLabels = (0, import_react10.useMemo)(() => {
6662
- var _a, _b;
6727
+ var _a2, _b;
6663
6728
  if (isDateOutcomeMarket) {
6664
6729
  return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
6665
6730
  }
6666
6731
  const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
6667
- var _a2, _b2;
6668
- const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
6732
+ var _a3, _b2;
6733
+ const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
6669
6734
  const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
6670
6735
  return rightProbability - leftProbability;
6671
6736
  });
6672
- const firstLabel = (_a = sortedOutcomeLabels[0]) != null ? _a : labels.eventItemDetails.yes;
6737
+ const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
6673
6738
  const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
6674
6739
  return [firstLabel, secondLabel];
6675
6740
  }, [
@@ -6680,34 +6745,44 @@ var EventListItemDetailsContent = ({
6680
6745
  probabilityByLabel
6681
6746
  ]);
6682
6747
  const volumeLabel = (0, import_react10.useMemo)(() => {
6683
- var _a;
6684
- const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a : void 0;
6748
+ var _a2;
6749
+ const resolvedVolume = typeof event.volume === "number" ? event.volume : (_a2 = primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume) != null ? _a2 : void 0;
6685
6750
  if (typeof resolvedVolume !== "number")
6686
6751
  return "";
6687
6752
  return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
6688
6753
  }, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
6689
6754
  if (!primaryVenueMarket || !selectedOutcomeLabel) {
6690
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventListItemDetailsUnavailableState, { classNames, ariaLabel });
6755
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6756
+ EventListItemDetailsUnavailableState,
6757
+ {
6758
+ classNames,
6759
+ ariaLabel: ariaLabel != null ? ariaLabel : event.title
6760
+ }
6761
+ );
6691
6762
  }
6692
6763
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
6693
6764
  Card,
6694
6765
  {
6695
6766
  className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
6696
- "aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
6767
+ "aria-label": ariaLabel != null ? ariaLabel : event.title,
6768
+ onClick: () => {
6769
+ onClick == null ? void 0 : onClick(event);
6770
+ },
6697
6771
  children: [
6698
6772
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
6699
6773
  "div",
6700
6774
  {
6701
6775
  className: cn(
6702
6776
  "flex flex-row gap-3 md:gap-4",
6703
- "items-center justify-start",
6777
+ venueMarkets.length > 1 ? "items-start" : "items-center",
6778
+ "justify-start",
6704
6779
  classNames == null ? void 0 : classNames.header
6705
6780
  ),
6706
6781
  children: [
6707
- resolvedImage ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6782
+ event.image ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6708
6783
  RemoteImage,
6709
6784
  {
6710
- src: resolvedImage,
6785
+ src: event.image,
6711
6786
  alt: "",
6712
6787
  className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
6713
6788
  }
@@ -6722,19 +6797,18 @@ var EventListItemDetailsContent = ({
6722
6797
  "truncate text-wrap wrap-break-word line-clamp-2",
6723
6798
  classNames == null ? void 0 : classNames.title
6724
6799
  ),
6725
- children: resolvedTitle
6800
+ children: event.title
6726
6801
  }
6727
6802
  ),
6728
- outcomeSelectorLabels.length > 2 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6803
+ venueMarkets.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6729
6804
  "div",
6730
6805
  {
6731
6806
  className: cn(
6732
- "flex items-center gap-2 overflow-x-auto pb-1 md:flex-wrap md:overflow-visible md:pb-0",
6807
+ "flex flex-row flex-nowrap items-center gap-2 overflow-x-auto pb-1 md:pb-0",
6733
6808
  classNames == null ? void 0 : classNames.headerPills
6734
6809
  ),
6735
- children: outcomeSelectorLabels.map((outcomeSelectorLabel) => {
6736
- const isActive = outcomeSelectorLabel === selectedOutcomeLabel;
6737
- const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
6810
+ children: venueMarkets.map((venueMarket) => {
6811
+ const isActive = (selectedMarket == null ? void 0 : selectedMarket.id) === venueMarket.id;
6738
6812
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6739
6813
  Button,
6740
6814
  {
@@ -6746,10 +6820,14 @@ var EventListItemDetailsContent = ({
6746
6820
  "border-2",
6747
6821
  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"
6748
6822
  ),
6749
- onClick: () => setSelectedOutcomeLabel(outcomeSelectorLabel),
6750
- children: displayLabel
6823
+ onClick: (e) => {
6824
+ e.stopPropagation();
6825
+ e.preventDefault();
6826
+ setSelectedMarket(venueMarket);
6827
+ },
6828
+ children: venueMarket.question
6751
6829
  },
6752
- outcomeSelectorLabel
6830
+ venueMarket.id
6753
6831
  );
6754
6832
  })
6755
6833
  }
@@ -6778,14 +6856,14 @@ var EventListItemDetailsContent = ({
6778
6856
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6779
6857
  EventListItemDetailsGraphSection,
6780
6858
  {
6781
- venueMarkets,
6782
- canonicalMarketId: event.id,
6859
+ selectedOutcome,
6860
+ selectedMarket,
6861
+ venueMarkets: filteredVenueMarkets,
6783
6862
  selectedOutcomeLabel,
6784
6863
  onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
6785
6864
  switchLabels,
6786
6865
  isDateOutcomeMarket,
6787
6866
  classNames,
6788
- showVenueLogo,
6789
6867
  venueInfo,
6790
6868
  formatPercent: config.formatPercent,
6791
6869
  selectedTimeRange,
@@ -6811,7 +6889,11 @@ var EventListItemDetailsContent = ({
6811
6889
  isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
6812
6890
  ),
6813
6891
  "aria-pressed": isActive,
6814
- onClick: () => setSelectedTimeRange(timeRange),
6892
+ onClick: (e) => {
6893
+ e.stopPropagation();
6894
+ e.preventDefault();
6895
+ setSelectedTimeRange(timeRange);
6896
+ },
6815
6897
  children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
6816
6898
  },
6817
6899
  timeRange
@@ -6829,19 +6911,20 @@ var EventListItemDetailsByEventId = (_a) => {
6829
6911
  } = _b, rest = __objRest(_b, [
6830
6912
  "eventId"
6831
6913
  ]);
6914
+ const resolvedEventId = eventId != null ? eventId : "";
6832
6915
  const {
6833
6916
  event: fetchedEvent,
6834
6917
  error,
6835
6918
  isError,
6836
6919
  isLoading
6837
6920
  } = (0, import_hooks23.useVenueEvent)({
6838
- eventId: eventId != null ? eventId : "",
6839
- enabled: !!eventId
6921
+ eventId: resolvedEventId,
6922
+ enabled: !!resolvedEventId
6840
6923
  });
6841
6924
  const resolvedEvent = (0, import_react10.useMemo)(() => {
6842
6925
  return resolveEventListItemEvent(fetchedEvent);
6843
6926
  }, [fetchedEvent]);
6844
- if (!eventId) {
6927
+ if (!resolvedEventId) {
6845
6928
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
6846
6929
  EventListItemDetailsUnavailableState,
6847
6930
  {
@@ -6880,26 +6963,22 @@ var EventListItemDetails = (props) => {
6880
6963
  }
6881
6964
  if ("eventId" in props && typeof props.eventId === "string") {
6882
6965
  const {
6883
- title: titleOverride,
6884
- image: imageOverride,
6885
- showVenueLogo: showVenueLogoOverride,
6886
6966
  classNames,
6887
6967
  venueInfo,
6888
6968
  detailsStats,
6889
6969
  ariaLabel: ariaLabelOverride,
6890
- defaultTimeRange: defaultTimeRangeOverride
6970
+ defaultTimeRange: defaultTimeRangeOverride,
6971
+ onClick
6891
6972
  } = props;
6892
6973
  const byEventIdProps = {
6893
6974
  eventId: props.eventId,
6894
6975
  isLoading: false,
6895
- title: titleOverride,
6896
- image: imageOverride,
6897
- showVenueLogo: showVenueLogoOverride,
6898
6976
  classNames,
6899
6977
  venueInfo,
6900
6978
  detailsStats,
6901
6979
  ariaLabel: ariaLabelOverride,
6902
- defaultTimeRange: defaultTimeRangeOverride
6980
+ defaultTimeRange: defaultTimeRangeOverride,
6981
+ onClick
6903
6982
  };
6904
6983
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
6905
6984
  }
@@ -6946,24 +7025,29 @@ var resolveInitialTab = (defaultTab) => {
6946
7025
  return parsedTab.data;
6947
7026
  return "order-book";
6948
7027
  };
6949
- var resolveMarket = (event, marketId) => {
6950
- var _a, _b, _c, _d, _e;
6951
- if (!event.venueMarkets || event.venueMarkets.length === 0)
7028
+ var resolveMarketFromVenueMarkets = (venueMarkets, marketId) => {
7029
+ var _a, _b;
7030
+ if (!venueMarkets || venueMarkets.length === 0)
6952
7031
  return void 0;
6953
7032
  if (!marketId) {
7033
+ const primary = selectPrimaryVenueMarket(venueMarkets);
7034
+ const totalVolume2 = venueMarkets.reduce((sum, vm) => {
7035
+ return sum + (typeof vm.volume === "number" ? vm.volume : 0);
7036
+ }, 0);
6954
7037
  return {
6955
- id: event.id,
6956
- venueMarkets: event.venueMarkets,
6957
- volume: event.volume,
6958
- status: event.status,
6959
- startDate: event.startDate,
6960
- endDate: event.endDate,
6961
- creationDate: event.creationDate,
6962
- question: event.title
7038
+ id: (_a = primary == null ? void 0 : primary.id) != null ? _a : venueMarkets[0].id,
7039
+ venueMarkets,
7040
+ volume: totalVolume2 || (primary == null ? void 0 : primary.volume),
7041
+ status: primary == null ? void 0 : primary.status,
7042
+ startDate: primary == null ? void 0 : primary.startDate,
7043
+ endDate: primary == null ? void 0 : primary.endDate,
7044
+ creationDate: primary == null ? void 0 : primary.creationDate,
7045
+ question: (_b = primary == null ? void 0 : primary.question) != null ? _b : venueMarkets[0].question
6963
7046
  };
6964
7047
  }
6965
- const venueMarkets = event.venueMarkets;
6966
- const matchedVenueMarket = venueMarkets.find((vm) => vm.id === marketId);
7048
+ const matchedVenueMarket = venueMarkets.find(
7049
+ (vm) => vm.id === marketId || vm.externalIdentifier === marketId
7050
+ );
6967
7051
  if (!matchedVenueMarket)
6968
7052
  return void 0;
6969
7053
  const siblingVenueMarkets = venueMarkets.filter(
@@ -6976,11 +7060,11 @@ var resolveMarket = (event, marketId) => {
6976
7060
  id: matchedVenueMarket.id,
6977
7061
  venueMarkets: siblingVenueMarkets,
6978
7062
  volume: totalVolume || matchedVenueMarket.volume,
6979
- status: (_a = matchedVenueMarket.status) != null ? _a : event.status,
6980
- startDate: (_b = matchedVenueMarket.startDate) != null ? _b : event.startDate,
6981
- endDate: (_c = matchedVenueMarket.endDate) != null ? _c : event.endDate,
6982
- creationDate: (_d = matchedVenueMarket.creationDate) != null ? _d : event.creationDate,
6983
- question: (_e = matchedVenueMarket.question) != null ? _e : event.title
7063
+ status: matchedVenueMarket.status,
7064
+ startDate: matchedVenueMarket.startDate,
7065
+ endDate: matchedVenueMarket.endDate,
7066
+ creationDate: matchedVenueMarket.creationDate,
7067
+ question: matchedVenueMarket.question
6984
7068
  };
6985
7069
  };
6986
7070
  var resolveDisplayOutcomeLabels = (labels) => {
@@ -7049,7 +7133,8 @@ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
7049
7133
  label,
7050
7134
  probability: probabilityByLabel.get(label),
7051
7135
  tone: resolveOutcomeTone(label, index),
7052
- isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
7136
+ isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : ""),
7137
+ venue: venueMarkets[0].venue
7053
7138
  };
7054
7139
  });
7055
7140
  };
@@ -7140,23 +7225,23 @@ var resolveOtherTabRows = (market, labels) => {
7140
7225
  return rows;
7141
7226
  };
7142
7227
  var buildMarketDetailsModel = ({
7143
- event,
7228
+ venueMarkets,
7144
7229
  marketId,
7145
7230
  title,
7146
7231
  image,
7147
7232
  formatCompactCurrency,
7148
7233
  labels
7149
7234
  }) => {
7150
- var _a;
7151
- const market = resolveMarket(event, marketId);
7235
+ var _a, _b;
7236
+ const market = resolveMarketFromVenueMarkets(venueMarkets, marketId);
7152
7237
  if (!market)
7153
7238
  return void 0;
7154
7239
  const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
7155
7240
  if (!primaryVenueMarket)
7156
7241
  return void 0;
7157
- const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
7158
- const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
7159
- const resolvedVolume = typeof market.volume === "number" ? market.volume : (_a = primaryVenueMarket.volume) != null ? _a : void 0;
7242
+ const resolvedTitle = (title == null ? void 0 : title.trim()) || primaryVenueMarket.question || market.question;
7243
+ const resolvedImage = (_a = typeof image === "string" && image.trim() ? image : void 0) != null ? _a : typeof primaryVenueMarket.image === "string" && primaryVenueMarket.image.trim() ? primaryVenueMarket.image : void 0;
7244
+ const resolvedVolume = typeof market.volume === "number" ? market.volume : (_b = primaryVenueMarket.volume) != null ? _b : void 0;
7160
7245
  const subtitle = resolveSubtitle({
7161
7246
  venueMarkets: market.venueMarkets,
7162
7247
  volume: resolvedVolume,
@@ -7302,7 +7387,7 @@ var getOutcomeButtonClassName = ({
7302
7387
  );
7303
7388
  };
7304
7389
  var MarketDetailsContent = ({
7305
- event,
7390
+ venueMarkets,
7306
7391
  marketId,
7307
7392
  title,
7308
7393
  image,
@@ -7310,29 +7395,29 @@ var MarketDetailsContent = ({
7310
7395
  onOpenChange,
7311
7396
  defaultTab,
7312
7397
  defaultOutcomeLabel,
7313
- defaultTimeRange = "1M",
7398
+ defaultTimeRange,
7314
7399
  orderBookDepth = orderBookRowLimitDefault,
7315
7400
  ariaLabel,
7316
7401
  classNames,
7317
- otherContent,
7318
- liveUpdate = false
7402
+ otherContent
7319
7403
  }) => {
7404
+ var _a, _b, _c, _d;
7320
7405
  const config = (0, import_hooks24.useSdkUiConfig)();
7321
7406
  const labels = (0, import_hooks24.useLabels)();
7322
7407
  const detailsContentId = (0, import_react11.useId)();
7323
7408
  const model = (0, import_react11.useMemo)(() => {
7324
7409
  return buildMarketDetailsModel({
7325
- event,
7410
+ venueMarkets,
7326
7411
  marketId,
7327
7412
  title,
7328
7413
  image,
7329
7414
  formatCompactCurrency: config.formatCompactCurrency,
7330
7415
  labels
7331
7416
  });
7332
- }, [config.formatCompactCurrency, event, image, labels, marketId, title]);
7417
+ }, [config.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
7333
7418
  const resolvedMarket = (0, import_react11.useMemo)(() => {
7334
- return resolveMarket(event, marketId);
7335
- }, [event, marketId]);
7419
+ return resolveMarketFromVenueMarkets(venueMarkets, marketId);
7420
+ }, [venueMarkets, marketId]);
7336
7421
  const marketDetailsTabs = (0, import_react11.useMemo)(() => {
7337
7422
  return getMarketDetailsTabs(labels);
7338
7423
  }, [labels]);
@@ -7343,22 +7428,23 @@ var MarketDetailsContent = ({
7343
7428
  (0, import_react11.useEffect)(() => {
7344
7429
  setSelectedTab(resolveInitialTab(defaultTab));
7345
7430
  }, [defaultTab]);
7346
- const [selectedTimeRange, setSelectedTimeRange] = (0, import_react11.useState)(defaultTimeRange);
7431
+ const resolvedDefaultTimeRange = (_a = defaultTimeRange != null ? defaultTimeRange : config.defaultChartTimeRange) != null ? _a : "1D";
7432
+ const [selectedTimeRange, setSelectedTimeRange] = (0, import_react11.useState)(resolvedDefaultTimeRange);
7347
7433
  const [selectedChartType, setSelectedChartType] = (0, import_react11.useState)("line");
7348
7434
  (0, import_react11.useEffect)(() => {
7349
- setSelectedTimeRange(defaultTimeRange);
7350
- }, [defaultTimeRange]);
7435
+ setSelectedTimeRange(resolvedDefaultTimeRange);
7436
+ }, [resolvedDefaultTimeRange]);
7351
7437
  const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react11.useState)(
7352
7438
  () => {
7353
- var _a;
7354
- return resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel);
7439
+ var _a2;
7440
+ return resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel);
7355
7441
  }
7356
7442
  );
7357
7443
  const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react11.useState)(null);
7358
7444
  (0, import_react11.useEffect)(() => {
7359
- var _a;
7445
+ var _a2;
7360
7446
  setSelectedOutcomeLabel(
7361
- resolveInitialOutcomeLabel((_a = model == null ? void 0 : model.outcomeLabels) != null ? _a : [], defaultOutcomeLabel)
7447
+ resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel)
7362
7448
  );
7363
7449
  }, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
7364
7450
  const headerOutcomeItems = (0, import_react11.useMemo)(() => {
@@ -7385,52 +7471,66 @@ var MarketDetailsContent = ({
7385
7471
  return outcomesByLabelMap;
7386
7472
  }, [headerOutcomeItems, model]);
7387
7473
  const selectedOutcomesByVenue = (0, import_react11.useMemo)(() => {
7388
- var _a;
7474
+ var _a2;
7389
7475
  if (!selectedOutcomeLabel)
7390
7476
  return [];
7391
- return (_a = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a : [];
7477
+ return (_a2 = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a2 : [];
7392
7478
  }, [outcomesByLabel, selectedOutcomeLabel]);
7479
+ const chartEnabled = isOpened && selectedTab === "graph";
7480
+ const orderBookEnabled = isOpened && selectedTab === "order-book";
7393
7481
  const timeWindow = (0, import_react11.useMemo)(() => {
7394
7482
  return getTimeWindowByRange(selectedTimeRange);
7395
7483
  }, [selectedTimeRange]);
7396
- const graphOutcomes = (0, import_react11.useMemo)(() => {
7397
- const uniqueOutcomesByVenueAndId = /* @__PURE__ */ new Map();
7398
- outcomesByLabel.forEach((outcomes) => {
7399
- outcomes.forEach((outcomeByVenue) => {
7400
- uniqueOutcomesByVenueAndId.set(
7401
- `${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
7402
- outcomeByVenue
7403
- );
7404
- });
7405
- });
7406
- return [...uniqueOutcomesByVenueAndId.values()];
7407
- }, [outcomesByLabel]);
7408
- const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
7409
- const priceHistoryGroups = (0, import_react11.useMemo)(() => {
7410
- return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
7411
- }, [canonicalMarketIdForHistory, graphOutcomes]);
7412
- const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = (0, import_hooks24.usePriceHistory)(__spreadProps(__spreadValues({
7413
- groups: priceHistoryGroups
7414
- }, timeWindow), {
7415
- enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
7416
- }));
7417
- const orderBookInputs = (0, import_react11.useMemo)(() => {
7418
- return selectedOutcomesByVenue.map(({ market, outcome }) => ({
7419
- market,
7420
- outcome,
7421
- liveUpdate
7422
- }));
7423
- }, [selectedOutcomesByVenue, liveUpdate]);
7484
+ const primaryVenueMarketId = (_c = (_b = selectedOutcomesByVenue[0]) == null ? void 0 : _b.market.id) != null ? _c : null;
7485
+ const venueMarketIds = (0, import_react11.useMemo)(() => {
7486
+ return selectedOutcomesByVenue.map((item) => item.market.id);
7487
+ }, [selectedOutcomesByVenue]);
7488
+ const {
7489
+ data: marketChartData,
7490
+ isLoading: isMarketChartLoading,
7491
+ error: marketChartError,
7492
+ refetch: refetchMarketChart
7493
+ } = (0, import_hooks24.useMarketChart)({
7494
+ marketId: primaryVenueMarketId,
7495
+ venueMarketIds,
7496
+ interval: (0, import_hooks24.timeRangeToInterval)(selectedTimeRange),
7497
+ startTs: timeWindow.startTs * 1e3,
7498
+ endTs: timeWindow.endTs * 1e3,
7499
+ enabled: chartEnabled && !!primaryVenueMarketId
7500
+ });
7424
7501
  const {
7425
- data: orderBookData,
7502
+ data: marketOrderbookData,
7426
7503
  isLoading: isOrderBookLoading,
7427
7504
  error: orderBookError,
7428
- results: orderBookResults
7429
- } = (0, import_hooks24.useOrderBook)({
7430
- orderbooks: orderBookInputs,
7431
- enabled: isOpened && selectedTab === "order-book" && orderBookInputs.length > 0,
7432
- canonicalMarketId: liveUpdate ? canonicalMarketIdForHistory : void 0
7505
+ refetch: refetchOrderBook
7506
+ } = (0, import_hooks24.useMarketOrderbook)({
7507
+ marketId: primaryVenueMarketId,
7508
+ enabled: orderBookEnabled && !!primaryVenueMarketId,
7509
+ venueOutcomes: selectedOutcomesByVenue.map((item) => ({
7510
+ venue: item.market.venue,
7511
+ venueMarketOutcomeId: item.outcome.id
7512
+ }))
7433
7513
  });
7514
+ const orderBookData = (0, import_react11.useMemo)(() => {
7515
+ if (!marketOrderbookData)
7516
+ return void 0;
7517
+ const results = selectedOutcomesByVenue.flatMap(({ market, outcome }) => {
7518
+ const venueOrderbook = marketOrderbookData.venueOrderbooks[market.venue];
7519
+ if (!venueOrderbook)
7520
+ return [];
7521
+ return [
7522
+ {
7523
+ market,
7524
+ outcome,
7525
+ orderbook: {
7526
+ bids: venueOrderbook.bids,
7527
+ asks: venueOrderbook.asks
7528
+ }
7529
+ }
7530
+ ];
7531
+ });
7532
+ return results.length === selectedOutcomesByVenue.length ? results : void 0;
7533
+ }, [marketOrderbookData, selectedOutcomesByVenue]);
7434
7534
  const askRows = (0, import_react11.useMemo)(() => {
7435
7535
  return resolveOrderBookRows({
7436
7536
  data: orderBookData,
@@ -7443,78 +7543,43 @@ var MarketDetailsContent = ({
7443
7543
  side: "bids"
7444
7544
  });
7445
7545
  }, [orderBookData]);
7446
- const priceHistoryByVenue = (0, import_react11.useMemo)(() => {
7447
- const historyByVenue = /* @__PURE__ */ new Map();
7448
- if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
7449
- return historyByVenue;
7450
- }
7451
- priceHistoryData.forEach((historyItem) => {
7452
- const venue = historyItem.venue;
7453
- const venueHistory = historyByVenue.get(venue);
7454
- if (venueHistory) {
7455
- venueHistory.push(historyItem);
7456
- return;
7457
- }
7458
- historyByVenue.set(venue, [historyItem]);
7459
- });
7460
- return historyByVenue;
7461
- }, [priceHistoryData]);
7462
- const graphSeriesByOutcomeLabel = (0, import_react11.useMemo)(() => {
7463
- const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
7464
- const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
7465
- var _a, _b;
7466
- const marketWithCanonicalId = outcomeByVenue.market;
7467
- return [
7468
- outcomeByVenue.outcome.id,
7469
- (_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
7470
- outcomeByVenue.market.externalIdentifier,
7471
- (_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
7472
- canonicalMarketIdForHistory
7473
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
7474
- };
7475
- headerOutcomeItems.forEach((headerOutcomeItem) => {
7476
- var _a;
7477
- const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
7478
- const graphSeries2 = [];
7479
- outcomes.forEach((outcomeByVenue, index) => {
7480
- var _a2;
7481
- const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
7482
- if (!(venueHistory == null ? void 0 : venueHistory.length))
7483
- return;
7484
- const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
7485
- const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
7486
- if (!matchingHistory)
7487
- return;
7488
- const points = matchingHistory.points.map((point) => ({
7489
- time: point.timestamp,
7490
- value: point.price * 100,
7491
- open: point.open == null ? void 0 : point.open * 100,
7492
- high: point.high == null ? void 0 : point.high * 100,
7493
- low: point.low == null ? void 0 : point.low * 100,
7494
- close: point.close == null ? void 0 : point.close * 100
7495
- })).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
7496
- if (points.length === 0)
7497
- return;
7498
- graphSeries2.push({
7499
- id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
7500
- venue: outcomeByVenue.venue,
7501
- color: resolveSeriesColor(outcomeByVenue.venue, index),
7502
- points
7503
- });
7504
- });
7505
- seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
7506
- });
7507
- return seriesByOutcomeLabel;
7508
- }, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
7509
7546
  const graphSeries = (0, import_react11.useMemo)(() => {
7510
- var _a;
7511
- if (!selectedOutcomeLabel)
7512
- return [];
7513
- const seriesForOutcomeLabel = (_a = graphSeriesByOutcomeLabel.get(selectedOutcomeLabel)) != null ? _a : [];
7547
+ const colorByVenue = new Map(
7548
+ selectedOutcomesByVenue.map((item, index) => [
7549
+ item.venue,
7550
+ resolveSeriesColor(item.venue, index)
7551
+ ])
7552
+ );
7553
+ const seriesForOutcomeLabel = resolveMarketChartVenueSeries({
7554
+ chartData: marketChartData,
7555
+ transformProbability: (value) => value
7556
+ }).map((seriesItem) => {
7557
+ var _a2;
7558
+ const resolvedVenue = seriesItem.venue;
7559
+ return {
7560
+ id: `${selectedOutcomeLabel != null ? selectedOutcomeLabel : "graph"}-${resolvedVenue}-${primaryVenueMarketId != null ? primaryVenueMarketId : "chart"}`,
7561
+ venue: resolvedVenue,
7562
+ color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
7563
+ points: seriesItem.points
7564
+ };
7565
+ });
7514
7566
  if (!selectedGraphVenue)
7515
7567
  return seriesForOutcomeLabel;
7516
7568
  return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
7517
- }, [graphSeriesByOutcomeLabel, selectedGraphVenue, selectedOutcomeLabel]);
7569
+ }, [
7570
+ primaryVenueMarketId,
7571
+ marketChartData,
7572
+ selectedGraphVenue,
7573
+ selectedOutcomeLabel,
7574
+ selectedOutcomesByVenue
7575
+ ]);
7576
+ const graphLiveState = (0, import_react11.useMemo)(() => {
7577
+ return resolveMarketChartLiveState({
7578
+ chartData: marketChartData,
7579
+ selectedVenue: selectedGraphVenue,
7580
+ transformProbability: (value) => value
7581
+ });
7582
+ }, [marketChartData, selectedGraphVenue]);
7518
7583
  const otherRows = (0, import_react11.useMemo)(() => {
7519
7584
  if (!model)
7520
7585
  return [];
@@ -7522,9 +7587,10 @@ var MarketDetailsContent = ({
7522
7587
  }, [labels, model]);
7523
7588
  const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
7524
7589
  const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
7525
- const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (orderBookInputs.length === 0 || askRows.length === 0 && bidRows.length === 0);
7590
+ const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || askRows.length === 0 && bidRows.length === 0);
7591
+ const hasChartError = !!marketChartError;
7526
7592
  const handleOutcomeKeyDown = (eventToHandle) => {
7527
- var _a;
7593
+ var _a2;
7528
7594
  if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
7529
7595
  return;
7530
7596
  }
@@ -7535,14 +7601,14 @@ var MarketDetailsContent = ({
7535
7601
  });
7536
7602
  const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
7537
7603
  const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
7538
- setSelectedOutcomeLabel((_a = headerOutcomeItems[nextIndex]) == null ? void 0 : _a.label);
7604
+ setSelectedOutcomeLabel((_a2 = headerOutcomeItems[nextIndex]) == null ? void 0 : _a2.label);
7539
7605
  };
7540
- const handleToggleExpanded = (event2) => {
7541
- if (event2 && "key" in event2 && (event2 == null ? void 0 : event2.key) !== "Enter" && (event2 == null ? void 0 : event2.key) !== " ") {
7606
+ const handleToggleExpanded = (event) => {
7607
+ if (event && "key" in event && (event == null ? void 0 : event.key) !== "Enter" && (event == null ? void 0 : event.key) !== " ") {
7542
7608
  return;
7543
7609
  }
7544
- event2 == null ? void 0 : event2.preventDefault();
7545
- event2 == null ? void 0 : event2.stopPropagation();
7610
+ event == null ? void 0 : event.preventDefault();
7611
+ event == null ? void 0 : event.stopPropagation();
7546
7612
  setIsOpened((prev) => {
7547
7613
  const next = !prev;
7548
7614
  onOpenChange == null ? void 0 : onOpenChange(next);
@@ -7557,7 +7623,10 @@ var MarketDetailsContent = ({
7557
7623
  });
7558
7624
  };
7559
7625
  const handleRetryOrderBook = () => {
7560
- void Promise.all(orderBookResults.map((result) => result.refetch()));
7626
+ void refetchOrderBook();
7627
+ };
7628
+ const handleRetryMarketChart = () => {
7629
+ void refetchMarketChart();
7561
7630
  };
7562
7631
  (0, import_react11.useEffect)(() => {
7563
7632
  if (!selectedGraphVenue) {
@@ -7600,7 +7669,7 @@ var MarketDetailsContent = ({
7600
7669
  onClick: handleToggleExpanded,
7601
7670
  onKeyDown: handleToggleExpanded,
7602
7671
  children: [
7603
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
7672
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex min-w-52 max-w-3/4 items-center gap-3 md:gap-4", children: [
7604
7673
  model.image ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7605
7674
  RemoteImage,
7606
7675
  {
@@ -7647,7 +7716,7 @@ var MarketDetailsContent = ({
7647
7716
  /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7648
7717
  VenueLogo,
7649
7718
  {
7650
- venue: isPositive ? "polymarket" : "probable",
7719
+ venue: "polymarket",
7651
7720
  size: "small",
7652
7721
  color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
7653
7722
  }
@@ -7754,13 +7823,26 @@ var MarketDetailsContent = ({
7754
7823
  )
7755
7824
  ] }) }) : null,
7756
7825
  selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
7757
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7826
+ hasChartError ? /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7827
+ StateMessage,
7828
+ {
7829
+ ariaLabel: labels.marketDetails.chartUnavailableAria,
7830
+ tone: "warning",
7831
+ title: labels.marketDetails.chartUnavailableTitle,
7832
+ description: labels.marketDetails.chartUnavailableDescription,
7833
+ actionLabel: labels.common.retry,
7834
+ onAction: handleRetryMarketChart,
7835
+ className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
7836
+ }
7837
+ ) : /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7758
7838
  LineChart,
7759
7839
  {
7760
7840
  series: graphSeries,
7761
7841
  height: 260,
7762
- isLoading: isPriceHistoryLoading,
7842
+ isLoading: isMarketChartLoading,
7763
7843
  chartType: selectedChartType,
7844
+ liveCandle: selectedChartType === "candlestick" ? (_d = graphLiveState.liveCandle) != null ? _d : void 0 : void 0,
7845
+ lineValue: graphLiveState.lineValue,
7764
7846
  classNames: { root: "w-full" },
7765
7847
  showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
7766
7848
  renderSeriesControls: () => {
@@ -7884,7 +7966,7 @@ var MarketDetailsContent = ({
7884
7966
  );
7885
7967
  };
7886
7968
  var MarketDetails = (props) => {
7887
- var _a, _b;
7969
+ var _a;
7888
7970
  const [uncontrolledIsOpened, setUncontrolledIsOpened] = (0, import_react11.useState)(
7889
7971
  (_a = props.defaultIsOpened) != null ? _a : marketDetailsDefaultIsOpened
7890
7972
  );
@@ -7901,15 +7983,6 @@ var MarketDetails = (props) => {
7901
7983
  }
7902
7984
  (_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
7903
7985
  };
7904
- const hasEventProp = "event" in props && !!props.event;
7905
- const {
7906
- event: fetchedEvent,
7907
- error: eventError,
7908
- isLoading: isFetchingEvent
7909
- } = (0, import_hooks24.useVenueEvent)({
7910
- eventId: hasEventProp ? "" : (_b = props.eventId) != null ? _b : "",
7911
- enabled: !props.isLoading && !hasEventProp && !!props.eventId
7912
- });
7913
7986
  if (props.isLoading) {
7914
7987
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7915
7988
  MarketDetailsLoadingState,
@@ -7920,42 +7993,115 @@ var MarketDetails = (props) => {
7920
7993
  }
7921
7994
  );
7922
7995
  }
7923
- if ("event" in props && props.event) {
7996
+ if ("venueMarkets" in props && props.venueMarkets) {
7924
7997
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7925
7998
  MarketDetailsContent,
7926
7999
  __spreadProps(__spreadValues({}, props), {
7927
8000
  isOpened: resolvedIsOpened,
7928
8001
  onOpenChange: handleOpenChange,
7929
- event: props.event
8002
+ venueMarkets: props.venueMarkets
7930
8003
  })
7931
8004
  );
7932
8005
  }
7933
- if (isFetchingEvent) {
7934
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7935
- MarketDetailsLoadingState,
8006
+ const { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames } = props;
8007
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetailsUnavailableState, { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames });
8008
+ };
8009
+ MarketDetails.displayName = "MarketDetails";
8010
+ var resolveInitialExpandedId = (markets, defaultId) => {
8011
+ var _a, _b;
8012
+ if (!markets.length)
8013
+ return null;
8014
+ if (defaultId) {
8015
+ const match = markets.find((m) => m.id === defaultId);
8016
+ if (match)
8017
+ return match.id;
8018
+ }
8019
+ return (_b = (_a = markets[0]) == null ? void 0 : _a.id) != null ? _b : null;
8020
+ };
8021
+ var MarketDetailsList = ({
8022
+ eventId,
8023
+ expandedMarketId,
8024
+ defaultExpandedMarketId,
8025
+ onExpandedMarketChange,
8026
+ defaultTab,
8027
+ defaultTimeRange,
8028
+ classNames,
8029
+ ariaLabel
8030
+ }) => {
8031
+ const labels = (0, import_hooks24.useLabels)();
8032
+ const resolvedEventId = eventId || "";
8033
+ const { markets, isLoading, error } = (0, import_hooks24.useVenueMarkets)({
8034
+ venueEventId: resolvedEventId,
8035
+ enabled: !!resolvedEventId
8036
+ });
8037
+ const [internalExpandedId, setInternalExpandedId] = (0, import_react11.useState)(
8038
+ () => resolveInitialExpandedId(markets, defaultExpandedMarketId)
8039
+ );
8040
+ (0, import_react11.useEffect)(() => {
8041
+ if (typeof expandedMarketId !== "undefined")
8042
+ return;
8043
+ setInternalExpandedId((current) => {
8044
+ if (current && markets.some((m) => m.id === current))
8045
+ return current;
8046
+ return resolveInitialExpandedId(markets, defaultExpandedMarketId);
8047
+ });
8048
+ }, [defaultExpandedMarketId, expandedMarketId, markets]);
8049
+ (0, import_react11.useEffect)(() => {
8050
+ if (typeof expandedMarketId === "undefined")
8051
+ return;
8052
+ setInternalExpandedId(expandedMarketId);
8053
+ }, [expandedMarketId]);
8054
+ const resolvedExpandedId = typeof expandedMarketId === "undefined" ? internalExpandedId : expandedMarketId;
8055
+ const handleToggle = (marketId, isOpened) => {
8056
+ const next = isOpened ? marketId : null;
8057
+ if (typeof expandedMarketId === "undefined") {
8058
+ setInternalExpandedId(next);
8059
+ }
8060
+ onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(next);
8061
+ };
8062
+ if (isLoading) {
8063
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: [
8064
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetailsLoadingState, { isOpened: true, classNames: { root: classNames == null ? void 0 : classNames.item } }),
8065
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetailsLoadingState, { isOpened: false, classNames: { root: classNames == null ? void 0 : classNames.item } })
8066
+ ] });
8067
+ }
8068
+ if (error) {
8069
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8070
+ StateMessage,
7936
8071
  {
7937
- isOpened: resolvedIsOpened,
7938
- ariaLabel: props.ariaLabel,
7939
- classNames: props.classNames
8072
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
8073
+ title: labels.marketDetails.unavailableTitle,
8074
+ description: labels.marketDetails.unavailableDescription,
8075
+ className: "min-h-[280px] md:min-h-[320px]"
7940
8076
  }
7941
- );
8077
+ ) });
7942
8078
  }
7943
- if (!fetchedEvent) {
7944
- if (isErrorWithStatus(eventError, 404)) {
7945
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetailsNotFoundState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
7946
- }
7947
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MarketDetailsUnavailableState, { ariaLabel: props.ariaLabel, classNames: props.classNames });
8079
+ if (markets.length === 0) {
8080
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
8081
+ StateMessage,
8082
+ {
8083
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
8084
+ title: labels.marketDetails.notFoundTitle,
8085
+ description: labels.marketDetails.notFoundDescription,
8086
+ className: "min-h-[280px] md:min-h-[320px]"
8087
+ }
8088
+ ) });
7948
8089
  }
7949
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
7950
- MarketDetailsContent,
7951
- __spreadProps(__spreadValues({}, props), {
7952
- isOpened: resolvedIsOpened,
7953
- onOpenChange: handleOpenChange,
7954
- event: fetchedEvent
7955
- })
7956
- );
8090
+ return /* @__PURE__ */ (0, import_jsx_runtime86.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_runtime86.jsx)(
8091
+ MarketDetails,
8092
+ {
8093
+ venueMarkets: [market],
8094
+ isOpened: resolvedExpandedId === market.id,
8095
+ onOpenChange: (nextIsOpened) => handleToggle(market.id, nextIsOpened),
8096
+ defaultTab,
8097
+ defaultTimeRange,
8098
+ ariaLabel: market.question,
8099
+ classNames: { root: classNames == null ? void 0 : classNames.item }
8100
+ },
8101
+ market.id
8102
+ )) });
7957
8103
  };
7958
- MarketDetails.displayName = "MarketDetails";
8104
+ MarketDetailsList.displayName = "MarketDetailsList";
7959
8105
 
7960
8106
  // src/events/list/index.tsx
7961
8107
  var import_react12 = require("react");
@@ -8054,11 +8200,11 @@ var estimateTabsWidth = (items) => {
8054
8200
  var EventList = ({
8055
8201
  title,
8056
8202
  maxItemsPerRow = 3,
8057
- limit = 3,
8203
+ limit = 9,
8058
8204
  maxVisibleItems,
8059
- showVenueLogo = true,
8060
8205
  search,
8061
- categoryIds
8206
+ categoryIds,
8207
+ onClick
8062
8208
  }) => {
8063
8209
  var _a, _b;
8064
8210
  const labels = (0, import_hooks25.useLabels)();
@@ -8213,10 +8359,10 @@ var EventList = ({
8213
8359
  EventListItem,
8214
8360
  {
8215
8361
  event,
8216
- showVenueLogo,
8217
8362
  classNames: {
8218
8363
  root: "w-full min-w-0 max-w-none"
8219
- }
8364
+ },
8365
+ onClick
8220
8366
  },
8221
8367
  event.id
8222
8368
  )),
@@ -8261,51 +8407,6 @@ var import_hooks26 = require("@agg-market/hooks");
8261
8407
  var ALL_CATEGORIES_TAB_VALUE = "trending";
8262
8408
  var DEFAULT_CATEGORIES_LIMIT = 100;
8263
8409
  var DEFAULT_ALL_CATEGORY_TAB_LABEL = "Trending";
8264
- var CATEGORY_TAB_NAME_ORDER = [
8265
- "crypto",
8266
- "economy",
8267
- "entertainment",
8268
- "finance",
8269
- "geopolitics",
8270
- "health",
8271
- "mentions",
8272
- "politics",
8273
- "science",
8274
- "sports",
8275
- "technology",
8276
- "weather",
8277
- "world"
8278
- ];
8279
- var getDefaultHomePageTabs = (allCategoryTabLabel) => {
8280
- return [
8281
- {
8282
- value: ALL_CATEGORIES_TAB_VALUE,
8283
- label: allCategoryTabLabel,
8284
- iconName: "arrow-trend-up"
8285
- },
8286
- { value: "crypto", label: "crypto", categoryIds: ["crypto"] },
8287
- { value: "economy", label: "economy", categoryIds: ["economy"] },
8288
- {
8289
- value: "entertainment",
8290
- label: "entertainment",
8291
- categoryIds: ["entertainment"]
8292
- },
8293
- { value: "finance", label: "finance", categoryIds: ["finance"] },
8294
- {
8295
- value: "geopolitics",
8296
- label: "geopolitics",
8297
- categoryIds: ["geopolitics"]
8298
- },
8299
- { value: "health", label: "health", categoryIds: ["health"] },
8300
- { value: "mentions", label: "mentions", categoryIds: ["mentions"] },
8301
- { value: "politics", label: "politics", categoryIds: ["politics"] },
8302
- { value: "science", label: "science", categoryIds: ["science"] },
8303
- { value: "sports", label: "sports", categoryIds: ["sports"] },
8304
- { value: "technology", label: "technology", categoryIds: ["technology"] },
8305
- { value: "weather", label: "weather", categoryIds: ["weather"] },
8306
- { value: "world", label: "world", categoryIds: ["world"] }
8307
- ];
8308
- };
8309
8410
  var getDefaultEventSectionItems = (labels) => {
8310
8411
  return [
8311
8412
  {
@@ -8326,31 +8427,7 @@ var getDefaultEventSectionItems = (labels) => {
8326
8427
  };
8327
8428
 
8328
8429
  // src/pages/home/home.utils.ts
8329
- var categoryOrderMap = CATEGORY_TAB_NAME_ORDER.reduce(
8330
- (accumulator, name, index) => {
8331
- accumulator.set(name, index);
8332
- return accumulator;
8333
- },
8334
- /* @__PURE__ */ new Map()
8335
- );
8336
- var normalizeCategoryName = (name) => {
8337
- return name.trim().toLowerCase();
8338
- };
8339
8430
  var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
8340
- const sortedCategories = [...categories].sort((left, right) => {
8341
- const leftName = normalizeCategoryName(left.name);
8342
- const rightName = normalizeCategoryName(right.name);
8343
- const leftOrder = categoryOrderMap.get(leftName);
8344
- const rightOrder = categoryOrderMap.get(rightName);
8345
- if (leftOrder != null && rightOrder != null) {
8346
- return leftOrder - rightOrder;
8347
- }
8348
- if (leftOrder != null)
8349
- return -1;
8350
- if (rightOrder != null)
8351
- return 1;
8352
- return leftName.localeCompare(rightName);
8353
- });
8354
8431
  const seenCategoryIds = /* @__PURE__ */ new Set();
8355
8432
  const tabs = [
8356
8433
  {
@@ -8359,13 +8436,13 @@ var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
8359
8436
  iconName: "arrow-trend-up"
8360
8437
  }
8361
8438
  ];
8362
- for (const category of sortedCategories) {
8439
+ for (const category of categories) {
8363
8440
  if (seenCategoryIds.has(category.id))
8364
8441
  continue;
8365
8442
  seenCategoryIds.add(category.id);
8366
8443
  tabs.push({
8367
8444
  value: category.id,
8368
- label: normalizeCategoryName(category.name),
8445
+ label: category.name.trim().toLowerCase(),
8369
8446
  categoryIds: [category.id]
8370
8447
  });
8371
8448
  }
@@ -8378,7 +8455,7 @@ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
8378
8455
  if (hasDefaultTab)
8379
8456
  return defaultActiveTab;
8380
8457
  }
8381
- return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "trending";
8458
+ return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : ALL_CATEGORIES_TAB_VALUE;
8382
8459
  };
8383
8460
 
8384
8461
  // src/pages/home/index.tsx
@@ -8389,17 +8466,15 @@ var HomePage = ({
8389
8466
  onTabChange,
8390
8467
  eventSectionItems,
8391
8468
  classNames,
8392
- useCategoriesTabs = true,
8393
8469
  categoriesLimit = DEFAULT_CATEGORIES_LIMIT,
8394
8470
  allCategoryTabLabel = DEFAULT_ALL_CATEGORY_TAB_LABEL
8395
8471
  }) => {
8396
8472
  const labels = (0, import_hooks26.useLabels)();
8397
8473
  const hasCustomTabs = !!tabs && tabs.length > 0;
8398
- const shouldUseCategoriesTabs = !hasCustomTabs && useCategoriesTabs;
8399
8474
  const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
8400
- const { categories } = (0, import_hooks26.useCategories)({
8475
+ const { categories, isLoading: isCategoriesLoading } = (0, import_hooks26.useCategories)({
8401
8476
  limit: categoriesLimit,
8402
- enabled: shouldUseCategoriesTabs
8477
+ enabled: !hasCustomTabs
8403
8478
  });
8404
8479
  const categoryTabs = (0, import_react13.useMemo)(() => {
8405
8480
  return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
@@ -8407,10 +8482,8 @@ var HomePage = ({
8407
8482
  const resolvedTabs = (0, import_react13.useMemo)(() => {
8408
8483
  if (hasCustomTabs && tabs)
8409
8484
  return tabs;
8410
- if (shouldUseCategoriesTabs)
8411
- return categoryTabs;
8412
- return getDefaultHomePageTabs(resolvedAllCategoryTabLabel);
8413
- }, [categoryTabs, hasCustomTabs, resolvedAllCategoryTabLabel, shouldUseCategoriesTabs, tabs]);
8485
+ return categoryTabs;
8486
+ }, [categoryTabs, hasCustomTabs, tabs]);
8414
8487
  const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
8415
8488
  const [activeTabValue, setActiveTabValue] = (0, import_react13.useState)(() => {
8416
8489
  return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
@@ -8445,22 +8518,20 @@ var HomePage = ({
8445
8518
  return resolvedTabs.find((tab) => tab.value === activeTabValue);
8446
8519
  }, [activeTabValue, resolvedTabs]);
8447
8520
  const resolvedSectionItems = (0, import_react13.useMemo)(() => {
8448
- var _a, _b, _c, _d, _e;
8521
+ var _a, _b, _c, _d;
8449
8522
  if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
8450
8523
  return resolvedEventSectionItems;
8451
8524
  }
8452
8525
  const maxItemsPerRow = (_b = (_a = resolvedEventSectionItems[0]) == null ? void 0 : _a.maxItemsPerRow) != null ? _b : 3;
8453
- const showVenueLogo = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.showVenueLogo;
8454
- const firstSectionLimit = (_d = resolvedEventSectionItems[0]) == null ? void 0 : _d.limit;
8526
+ const firstSectionLimit = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.limit;
8455
8527
  const limit = firstSectionLimit && Number.isFinite(firstSectionLimit) ? Math.max(9, Math.floor(firstSectionLimit)) : 9;
8456
8528
  return [
8457
8529
  {
8458
8530
  id: `${activeTabValue}-markets`,
8459
- title: (_e = activeTab == null ? void 0 : activeTab.label) != null ? _e : activeTabValue,
8531
+ title: (_d = activeTab == null ? void 0 : activeTab.label) != null ? _d : activeTabValue,
8460
8532
  maxItemsPerRow,
8461
8533
  limit,
8462
8534
  maxVisibleItems: void 0,
8463
- showVenueLogo,
8464
8535
  search: activeTab == null ? void 0 : activeTab.search,
8465
8536
  categoryIds: activeTab == null ? void 0 : activeTab.categoryIds
8466
8537
  }
@@ -8470,6 +8541,18 @@ var HomePage = ({
8470
8541
  setActiveTabValue(value);
8471
8542
  onTabChange == null ? void 0 : onTabChange(value);
8472
8543
  };
8544
+ if (!hasCustomTabs && isCategoriesLoading) {
8545
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
8546
+ "header",
8547
+ {
8548
+ className: cn(
8549
+ "w-full bg-agg-secondary border-b border-agg-separator",
8550
+ classNames == null ? void 0 : classNames.header
8551
+ ),
8552
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: cn("w-full px-4 md:px-10 h-10", classNames == null ? void 0 : classNames.tabs) })
8553
+ }
8554
+ ) });
8555
+ }
8473
8556
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
8474
8557
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
8475
8558
  "header",
@@ -8504,7 +8587,6 @@ var HomePage = ({
8504
8587
  maxItemsPerRow: eventSectionItem.maxItemsPerRow,
8505
8588
  limit: eventSectionItem.limit,
8506
8589
  maxVisibleItems: eventSectionItem.maxVisibleItems,
8507
- showVenueLogo: eventSectionItem.showVenueLogo,
8508
8590
  search: (_b = eventSectionItem.search) != null ? _b : activeTab == null ? void 0 : activeTab.search,
8509
8591
  categoryIds: (_c = eventSectionItem.categoryIds) != null ? _c : activeTab == null ? void 0 : activeTab.categoryIds
8510
8592
  },
@@ -9120,7 +9202,11 @@ var Settlement = ({
9120
9202
  ),
9121
9203
  "aria-expanded": isExpanded,
9122
9204
  "aria-label": labels.trading.settlementDetailsAria(venueLabel),
9123
- onClick: () => handleVenueClick(venue.venue),
9205
+ onClick: (e) => {
9206
+ e.stopPropagation();
9207
+ e.preventDefault();
9208
+ handleVenueClick(venue.venue);
9209
+ },
9124
9210
  children: [
9125
9211
  /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
9126
9212
  VenueLogo,
@@ -9276,6 +9362,69 @@ var resolveInitialExpandedMarketId = (detailedMarkets, defaultExpandedMarketId)
9276
9362
  }
9277
9363
  return (_b = (_a = detailedMarkets[0]) == null ? void 0 : _a.id) != null ? _b : null;
9278
9364
  };
9365
+ var EventMarketPageMobileTrade = ({
9366
+ placeOrder,
9367
+ classNames
9368
+ }) => {
9369
+ const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
9370
+ const handleOpen = () => {
9371
+ setIsOpen(true);
9372
+ };
9373
+ const handleOpenChange = (nextOpen) => {
9374
+ setIsOpen(nextOpen);
9375
+ };
9376
+ const handleClose = () => {
9377
+ setIsOpen(false);
9378
+ };
9379
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(import_jsx_runtime91.Fragment, { children: [
9380
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9381
+ "div",
9382
+ {
9383
+ className: cn(
9384
+ "fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
9385
+ classNames == null ? void 0 : classNames.mobileTradeCta
9386
+ ),
9387
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9388
+ Button,
9389
+ {
9390
+ size: "large",
9391
+ className: "min-w-[168px] shadow-agg-modal",
9392
+ "aria-label": placeOrder.actionLabel,
9393
+ "data-testid": "event-market-page-mobile-trade-cta",
9394
+ onClick: (e) => {
9395
+ e.stopPropagation();
9396
+ e.preventDefault();
9397
+ handleOpen();
9398
+ },
9399
+ children: placeOrder.actionLabel
9400
+ }
9401
+ )
9402
+ }
9403
+ ),
9404
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Modal, { open: isOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9405
+ Modal.Container,
9406
+ {
9407
+ "aria-label": placeOrder.title,
9408
+ maxWidth: "420px",
9409
+ classNames: {
9410
+ content: "items-end p-0 sm:items-center sm:p-4",
9411
+ container: cn(
9412
+ "w-full max-w-[420px] border-0 bg-transparent shadow-none",
9413
+ classNames == null ? void 0 : classNames.mobileTradeModal
9414
+ )
9415
+ },
9416
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9417
+ PlaceOrder,
9418
+ __spreadProps(__spreadValues({}, placeOrder), {
9419
+ isDismissible: true,
9420
+ className: cn("w-full rounded-t-agg-2xl sm:rounded-agg-xl", classNames == null ? void 0 : classNames.mobileTrade),
9421
+ onClose: handleClose
9422
+ })
9423
+ )
9424
+ }
9425
+ ) })
9426
+ ] });
9427
+ };
9279
9428
  var EventMarketPageUnavailableState = ({
9280
9429
  ariaLabel
9281
9430
  }) => {
@@ -9325,46 +9474,66 @@ var EventMarketPageLoadingState = ({
9325
9474
  }
9326
9475
  ]
9327
9476
  };
9328
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("section", { className: cn("w-full", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
9329
- "div",
9330
- {
9331
- className: cn(
9332
- "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",
9333
- classNames == null ? void 0 : classNames.content
9334
- ),
9335
- children: [
9336
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
9337
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9338
- EventListItemDetails,
9339
- {
9340
- isLoading: true,
9341
- classNames: {
9342
- root: classNames == null ? void 0 : classNames.hero
9477
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("section", { className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root), children: [
9478
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
9479
+ "div",
9480
+ {
9481
+ className: cn(
9482
+ "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",
9483
+ classNames == null ? void 0 : classNames.content
9484
+ ),
9485
+ children: [
9486
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
9487
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9488
+ EventListItemDetails,
9489
+ {
9490
+ isLoading: true,
9491
+ classNames: {
9492
+ root: classNames == null ? void 0 : classNames.hero
9493
+ }
9343
9494
  }
9344
- }
9345
- ),
9346
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
9347
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
9348
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
9349
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
9495
+ ),
9496
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: [
9497
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: true, classNames: { root: "w-full" } }),
9498
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } }),
9499
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MarketDetails, { isLoading: true, isOpened: false, classNames: { root: "w-full" } })
9500
+ ] }),
9501
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
9502
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) })
9350
9503
  ] }),
9351
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
9352
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, fallbackSettlement), { isLoading: true, className: classNames == null ? void 0 : classNames.settlement })) }),
9353
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.mobileTrade })) }) : null
9354
- ] }),
9355
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9356
- "aside",
9504
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9505
+ "aside",
9506
+ {
9507
+ className: cn(
9508
+ "hidden w-full shrink-0 lg:sticky lg:top-6 lg:block lg:w-[343px]",
9509
+ classNames == null ? void 0 : classNames.sidebar
9510
+ ),
9511
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.trade }))
9512
+ }
9513
+ ) : null
9514
+ ]
9515
+ }
9516
+ ),
9517
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9518
+ "div",
9519
+ {
9520
+ className: cn(
9521
+ "fixed inset-x-0 bottom-0 z-20 flex justify-end p-4 lg:hidden",
9522
+ classNames == null ? void 0 : classNames.mobileTradeCta
9523
+ ),
9524
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9525
+ Button,
9357
9526
  {
9358
- className: cn(
9359
- "hidden w-full shrink-0 lg:sticky lg:top-6 lg:block lg:w-[343px]",
9360
- classNames == null ? void 0 : classNames.sidebar
9361
- ),
9362
- children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { isLoading: true, className: classNames == null ? void 0 : classNames.trade }))
9527
+ size: "large",
9528
+ className: "min-w-[168px] shadow-agg-modal",
9529
+ "aria-label": placeOrder.actionLabel,
9530
+ disabled: true,
9531
+ children: placeOrder.actionLabel
9363
9532
  }
9364
- ) : null
9365
- ]
9366
- }
9367
- ) });
9533
+ )
9534
+ }
9535
+ ) : null
9536
+ ] });
9368
9537
  };
9369
9538
  var EventMarketPageContent = ({
9370
9539
  event,
@@ -9417,49 +9586,65 @@ var EventMarketPageContent = ({
9417
9586
  if (!heroEvent || !event.venueMarkets.length) {
9418
9587
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(EventMarketPageUnavailableState, { ariaLabel });
9419
9588
  }
9420
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("section", { className: cn("w-full", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel != null ? ariaLabel : event.title, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
9421
- "div",
9589
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
9590
+ "section",
9422
9591
  {
9423
- className: cn(
9424
- "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",
9425
- classNames == null ? void 0 : classNames.content
9426
- ),
9592
+ className: cn("w-full pb-24 lg:pb-0", classNames == null ? void 0 : classNames.root),
9593
+ "aria-label": ariaLabel != null ? ariaLabel : event.title,
9427
9594
  children: [
9428
- /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
9429
- /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9430
- EventListItemDetails,
9431
- {
9432
- event: heroEvent,
9433
- defaultTimeRange: heroDefaultTimeRange,
9434
- classNames: {
9435
- root: classNames == null ? void 0 : classNames.hero
9436
- }
9437
- }
9438
- ),
9439
- detailedMarkets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: detailedMarkets.map((market) => {
9440
- const isOpened = resolvedExpandedMarketId === market.id;
9441
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9442
- MarketDetails,
9443
- {
9444
- event,
9445
- marketId: market.id,
9446
- isOpened,
9447
- defaultTab: "order-book",
9448
- ariaLabel: market.endDate && (0, import_dayjs6.default)(market.endDate).isValid() ? labels.eventMarketPage.marketDetailsAriaByDate(
9449
- (0, import_dayjs6.default)(market.endDate).format("MMM D, YYYY")
9450
- ) : labels.eventMarketPage.marketDetailsAriaByQuestion(market.question),
9451
- onOpenChange: (nextIsOpened) => handleExpandedMarketChange(market.id, nextIsOpened)
9452
- },
9453
- market.id
9454
- );
9455
- }) }) : null,
9456
- settlement ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null,
9457
- settlement ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null
9458
- ] }),
9459
- placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("aside", { className: cn("w-full lg:block lg:max-w-[360px]", classNames == null ? void 0 : classNames.sidebar), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { className: classNames == null ? void 0 : classNames.trade })) }) : null
9595
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
9596
+ "div",
9597
+ {
9598
+ className: cn(
9599
+ "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",
9600
+ classNames == null ? void 0 : classNames.content
9601
+ ),
9602
+ children: [
9603
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: cn("flex min-w-0 flex-1 flex-col gap-6", classNames == null ? void 0 : classNames.main), children: [
9604
+ /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9605
+ EventListItemDetails,
9606
+ {
9607
+ event: heroEvent,
9608
+ defaultTimeRange: heroDefaultTimeRange,
9609
+ classNames: {
9610
+ root: classNames == null ? void 0 : classNames.hero
9611
+ }
9612
+ }
9613
+ ),
9614
+ detailedMarkets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.markets), children: detailedMarkets.map((market) => {
9615
+ const isOpened = resolvedExpandedMarketId === market.id;
9616
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9617
+ MarketDetails,
9618
+ {
9619
+ venueMarkets: [market],
9620
+ isOpened,
9621
+ defaultTab: "order-book",
9622
+ ariaLabel: market.endDate && (0, import_dayjs6.default)(market.endDate).isValid() ? labels.eventMarketPage.marketDetailsAriaByDate(
9623
+ (0, import_dayjs6.default)(market.endDate).format("MMM D, YYYY")
9624
+ ) : labels.eventMarketPage.marketDetailsAriaByQuestion(market.question),
9625
+ onOpenChange: (nextIsOpened) => handleExpandedMarketChange(market.id, nextIsOpened)
9626
+ },
9627
+ market.id
9628
+ );
9629
+ }) }) : null,
9630
+ settlement ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null,
9631
+ settlement ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Settlement, __spreadProps(__spreadValues({}, settlement), { className: classNames == null ? void 0 : classNames.settlement })) }) : null
9632
+ ] }),
9633
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
9634
+ "aside",
9635
+ {
9636
+ className: cn("hidden w-full lg:block lg:max-w-[360px]", classNames == null ? void 0 : classNames.sidebar),
9637
+ "data-testid": "event-market-page-desktop-trade",
9638
+ children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(PlaceOrder, __spreadProps(__spreadValues({}, placeOrder), { className: classNames == null ? void 0 : classNames.trade }))
9639
+ }
9640
+ ) : null
9641
+ ]
9642
+ }
9643
+ ),
9644
+ placeOrder ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(EventMarketPageMobileTrade, { placeOrder, classNames }) : null
9460
9645
  ]
9461
9646
  }
9462
- ) });
9647
+ );
9463
9648
  };
9464
9649
  var EventMarketPage = (props) => {
9465
9650
  var _a;
@@ -10771,20 +10956,460 @@ var DepositModal = ({
10771
10956
  };
10772
10957
  DepositModal.displayName = "DepositModal";
10773
10958
 
10774
- // src/withdraw/index.tsx
10959
+ // src/onramp/index.tsx
10960
+ var import_react24 = require("react");
10961
+
10962
+ // src/onramp/steps/quote-form.tsx
10963
+ var import_react22 = require("react");
10964
+
10965
+ // src/onramp/onramp-modal.constants.ts
10966
+ var FIAT_OPTIONS = [
10967
+ { value: "USD", label: "USD" },
10968
+ { value: "EUR", label: "EUR" },
10969
+ { value: "GBP", label: "GBP" }
10970
+ ];
10971
+ var FIAT_SYMBOLS = {
10972
+ USD: "$",
10973
+ EUR: "\u20AC",
10974
+ GBP: "\xA3"
10975
+ };
10976
+ var CRYPTO_OPTIONS = [
10977
+ { value: "USDC", label: "USDC (Ethereum)" },
10978
+ { value: "USDC_BASE", label: "USDC (Base)" },
10979
+ { value: "USDC_SOLANA", label: "USDC (Solana)" },
10980
+ { value: "USDC_POLYGON", label: "USDC (Polygon)" },
10981
+ { value: "USDC_ARBITRUM", label: "USDC (Arbitrum)" }
10982
+ ];
10983
+
10984
+ // src/onramp/steps/quote-form.tsx
10985
+ var import_jsx_runtime107 = require("react/jsx-runtime");
10986
+ var QuoteFormStep = ({
10987
+ title,
10988
+ values,
10989
+ onAmountChange,
10990
+ onFiatChange,
10991
+ onCryptoChange,
10992
+ onWalletAddressChange,
10993
+ onSubmit
10994
+ }) => {
10995
+ var _a;
10996
+ const numericAmount = Number(values.amount) || 0;
10997
+ const isFormValid = numericAmount > 0 && values.walletAddress.length > 0;
10998
+ const handleAmountChange = (0, import_react22.useCallback)(
10999
+ (e) => {
11000
+ const v = e.target.value.replace(/[^0-9.]/g, "");
11001
+ const parts = v.split(".");
11002
+ onAmountChange(parts.length > 2 ? `${parts[0]}.${parts.slice(1).join("")}` : v);
11003
+ },
11004
+ [onAmountChange]
11005
+ );
11006
+ return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
11007
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Modal.Header, { title, hideBorder: true }),
11008
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col gap-6", children: [
11009
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col gap-2", children: [
11010
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: "You pay" }),
11011
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex items-center gap-3", children: [
11012
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11013
+ Select,
11014
+ {
11015
+ items: FIAT_OPTIONS,
11016
+ value: values.fiatCurrency,
11017
+ onChange: onFiatChange,
11018
+ ariaLabel: "Fiat currency",
11019
+ className: "w-auto"
11020
+ }
11021
+ ) }),
11022
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex items-baseline", children: [
11023
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "agg-type-display text-agg-foreground", children: (_a = FIAT_SYMBOLS[values.fiatCurrency]) != null ? _a : "$" }),
11024
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11025
+ "input",
11026
+ {
11027
+ type: "text",
11028
+ inputMode: "decimal",
11029
+ "aria-label": "Amount",
11030
+ className: cn(
11031
+ "agg-type-display w-full bg-transparent outline-none",
11032
+ numericAmount > 0 ? "text-agg-foreground" : "text-agg-muted-foreground"
11033
+ ),
11034
+ placeholder: "0",
11035
+ value: values.amount ? formatAmountDisplay(values.amount) : "",
11036
+ onChange: handleAmountChange
11037
+ }
11038
+ )
11039
+ ] }) })
11040
+ ] })
11041
+ ] }),
11042
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "border-t border-agg-separator" }),
11043
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col gap-2", children: [
11044
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: "You receive" }),
11045
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11046
+ Select,
11047
+ {
11048
+ items: CRYPTO_OPTIONS,
11049
+ value: values.cryptoCurrency,
11050
+ onChange: onCryptoChange,
11051
+ ariaLabel: "Cryptocurrency"
11052
+ }
11053
+ )
11054
+ ] }),
11055
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "border-t border-agg-separator" }),
11056
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col gap-2", children: [
11057
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: "Destination wallet" }),
11058
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11059
+ "input",
11060
+ {
11061
+ type: "text",
11062
+ "aria-label": "Wallet address",
11063
+ className: cn(
11064
+ "w-full rounded-agg-md border border-agg-separator bg-agg-secondary",
11065
+ "px-4 py-2 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
11066
+ "placeholder:text-agg-muted-foreground",
11067
+ "transition-[border-color,box-shadow] duration-200 ease-in-out",
11068
+ "focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15"
11069
+ ),
11070
+ placeholder: "0x...",
11071
+ value: values.walletAddress,
11072
+ onChange: (e) => onWalletAddressChange(e.target.value)
11073
+ }
11074
+ )
11075
+ ] }),
11076
+ /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11077
+ Button,
11078
+ {
11079
+ variant: "primary",
11080
+ size: "large",
11081
+ className: "w-full",
11082
+ disabled: !isFormValid,
11083
+ onClick: onSubmit,
11084
+ children: "Get Quotes"
11085
+ }
11086
+ )
11087
+ ] }) })
11088
+ ] });
11089
+ };
11090
+
11091
+ // src/onramp/steps/quote-card.tsx
11092
+ var import_jsx_runtime108 = require("react/jsx-runtime");
11093
+ var QuoteCard = ({ quote, rank, onSelect }) => {
11094
+ var _a;
11095
+ const isBest = rank === 1;
11096
+ return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
11097
+ "div",
11098
+ {
11099
+ className: cn(
11100
+ "flex items-center gap-3 sm:gap-4",
11101
+ "rounded-xl border",
11102
+ "p-3 sm:p-4",
11103
+ "transition-colors cursor-pointer",
11104
+ isBest ? "border-agg-primary bg-agg-primary/5 hover:bg-agg-primary/10" : "border-agg-separator hover:bg-agg-secondary-hover"
11105
+ ),
11106
+ role: "button",
11107
+ tabIndex: 0,
11108
+ onClick: onSelect,
11109
+ onKeyDown: (e) => {
11110
+ if (e.key === "Enter" || e.key === " ") {
11111
+ e.preventDefault();
11112
+ onSelect();
11113
+ }
11114
+ },
11115
+ children: [
11116
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11117
+ "div",
11118
+ {
11119
+ className: cn(
11120
+ "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg",
11121
+ isBest ? "bg-agg-primary/10" : "bg-agg-secondary-hover"
11122
+ ),
11123
+ children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11124
+ "span",
11125
+ {
11126
+ className: cn(
11127
+ "text-agg-lg font-agg-bold",
11128
+ isBest ? "text-agg-primary" : "text-agg-muted-foreground"
11129
+ ),
11130
+ children: rank
11131
+ }
11132
+ )
11133
+ }
11134
+ ),
11135
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex-1 min-w-0", children: [
11136
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex items-center gap-2", children: [
11137
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: quote.serviceProvider }),
11138
+ isBest ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11139
+ Badge,
11140
+ {
11141
+ text: "Best",
11142
+ size: "small",
11143
+ classNames: { root: "bg-agg-primary! text-white! border-agg-primary!" }
11144
+ }
11145
+ ) : null,
11146
+ quote.lowKyc ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Badge, { text: "Low KYC", size: "small" }) : null
11147
+ ] }),
11148
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex items-center gap-2 mt-0.5", children: [
11149
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11150
+ quote.destinationAmount.toFixed(6),
11151
+ " ",
11152
+ quote.destinationCurrencyCode.split("_")[0]
11153
+ ] }),
11154
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "text-agg-muted-foreground", children: "\xB7" }),
11155
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11156
+ "Fee ",
11157
+ (_a = FIAT_SYMBOLS[quote.sourceCurrencyCode]) != null ? _a : "",
11158
+ quote.totalFee.toFixed(2)
11159
+ ] })
11160
+ ] })
11161
+ ] }),
11162
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11163
+ Button,
11164
+ {
11165
+ variant: "secondary",
11166
+ size: "small",
11167
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ChevronRightIcon, {}),
11168
+ onClick: (e) => {
11169
+ e.stopPropagation();
11170
+ onSelect();
11171
+ },
11172
+ children: "Select"
11173
+ }
11174
+ ) })
11175
+ ]
11176
+ }
11177
+ );
11178
+ };
11179
+
11180
+ // src/onramp/steps/quote-selection.tsx
11181
+ var import_jsx_runtime109 = require("react/jsx-runtime");
11182
+ var BACK_BUTTON_CLASS = "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80";
11183
+ var BackButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("button", { type: "button", className: BACK_BUTTON_CLASS, onClick, "aria-label": "Go back", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChevronLeftIcon, { className: "h-6 w-6" }) });
11184
+ var QuoteSelectionStep = ({
11185
+ quotes,
11186
+ isLoading,
11187
+ error,
11188
+ fiatCurrency,
11189
+ cryptoCurrency,
11190
+ amount,
11191
+ onBack,
11192
+ onSelectQuote,
11193
+ onRetry
11194
+ }) => {
11195
+ var _a;
11196
+ const subtitle = `${cryptoCurrency.split("_")[0]} \xB7 ${(_a = FIAT_SYMBOLS[fiatCurrency]) != null ? _a : ""}${amount.toLocaleString()} ${fiatCurrency}`;
11197
+ return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
11198
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11199
+ Modal.Header,
11200
+ {
11201
+ title: "Select Provider",
11202
+ subtitle,
11203
+ hideBorder: true,
11204
+ leftElement: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(BackButton, { onClick: onBack })
11205
+ }
11206
+ ),
11207
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: [
11208
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex min-h-[240px] items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(LoadingIcon, { size: "large" }) }) : null,
11209
+ !isLoading && error ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex flex-col gap-4", children: [
11210
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(InlineAlert, { tone: "error", message: error }),
11211
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Button, { variant: "secondary", size: "medium", className: "w-full", onClick: onRetry, children: "Retry" })
11212
+ ] }) : null,
11213
+ !isLoading && !error && quotes.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11214
+ StateMessage,
11215
+ {
11216
+ tone: "empty",
11217
+ title: "No quotes available",
11218
+ description: "No providers returned quotes for this pair. Try a different amount or cryptocurrency.",
11219
+ actionLabel: "Go back",
11220
+ onAction: onBack
11221
+ }
11222
+ ) : null,
11223
+ !isLoading && quotes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: "flex flex-col gap-3", children: quotes.map((quote, i) => /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11224
+ QuoteCard,
11225
+ {
11226
+ quote,
11227
+ rank: i + 1,
11228
+ onSelect: () => onSelectQuote(quote)
11229
+ },
11230
+ `${quote.serviceProvider}-${quote.paymentMethodType}`
11231
+ )) }) : null
11232
+ ] })
11233
+ ] });
11234
+ };
11235
+
11236
+ // src/onramp/steps/widget.tsx
10775
11237
  var import_react23 = require("react");
11238
+ var import_jsx_runtime110 = require("react/jsx-runtime");
11239
+ var BACK_BUTTON_CLASS2 = "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80";
11240
+ var BackButton2 = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("button", { type: "button", className: BACK_BUTTON_CLASS2, onClick, "aria-label": "Go back", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(ChevronLeftIcon, { className: "h-6 w-6" }) });
11241
+ var WidgetStep = ({ widgetUrl, isLoading, onBack }) => {
11242
+ const iframeRef = (0, import_react23.useRef)(null);
11243
+ return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
11244
+ /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11245
+ Modal.Header,
11246
+ {
11247
+ title: "Complete Purchase",
11248
+ hideBorder: true,
11249
+ leftElement: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(BackButton2, { onClick: onBack })
11250
+ }
11251
+ ),
11252
+ /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(Modal.Body, { classNames: { root: "p-0! sm:p-0! overflow-hidden" }, children: [
11253
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "flex min-h-[400px] items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(LoadingIcon, { size: "large" }) }) : null,
11254
+ widgetUrl ? /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11255
+ "iframe",
11256
+ {
11257
+ ref: iframeRef,
11258
+ src: widgetUrl,
11259
+ title: "Meld payment widget",
11260
+ className: "h-[700px] w-full border-0 block",
11261
+ allow: "camera; microphone; payment; encrypted-media"
11262
+ }
11263
+ ) : null
11264
+ ] })
11265
+ ] });
11266
+ };
11267
+
11268
+ // src/onramp/index.tsx
11269
+ var import_jsx_runtime111 = require("react/jsx-runtime");
11270
+ var OnrampModal = ({
11271
+ open,
11272
+ onOpenChange,
11273
+ transactionType,
11274
+ walletAddress: initialWalletAddress = "",
11275
+ defaultFiatCurrency = "USD",
11276
+ defaultCryptoCurrency = "USDC",
11277
+ onGetQuotes,
11278
+ onSelectQuote
11279
+ }) => {
11280
+ const [step, setStep] = (0, import_react24.useState)("form");
11281
+ const [formValues, setFormValues] = (0, import_react24.useState)({
11282
+ amount: "",
11283
+ fiatCurrency: defaultFiatCurrency,
11284
+ cryptoCurrency: defaultCryptoCurrency,
11285
+ walletAddress: initialWalletAddress
11286
+ });
11287
+ const [quotes, setQuotes] = (0, import_react24.useState)([]);
11288
+ const [isLoadingQuotes, setIsLoadingQuotes] = (0, import_react24.useState)(false);
11289
+ const [quoteError, setQuoteError] = (0, import_react24.useState)(null);
11290
+ const [widgetUrl, setWidgetUrl] = (0, import_react24.useState)(null);
11291
+ const [isCreatingSession, setIsCreatingSession] = (0, import_react24.useState)(false);
11292
+ const handleOpenChange = (0, import_react24.useCallback)(
11293
+ (isOpen) => {
11294
+ if (!isOpen) {
11295
+ setStep("form");
11296
+ setQuotes([]);
11297
+ setQuoteError(null);
11298
+ setWidgetUrl(null);
11299
+ }
11300
+ onOpenChange(isOpen);
11301
+ },
11302
+ [onOpenChange]
11303
+ );
11304
+ const handleGetQuotes = (0, import_react24.useCallback)(() => __async(void 0, null, function* () {
11305
+ const numericAmount2 = Number(formValues.amount);
11306
+ if (!numericAmount2 || numericAmount2 <= 0)
11307
+ return;
11308
+ setStep("quotes");
11309
+ setIsLoadingQuotes(true);
11310
+ setQuoteError(null);
11311
+ try {
11312
+ const result = yield onGetQuotes({
11313
+ transactionType,
11314
+ sourceAmount: numericAmount2,
11315
+ sourceCurrencyCode: formValues.fiatCurrency,
11316
+ destinationCurrencyCode: formValues.cryptoCurrency,
11317
+ countryCode: "US"
11318
+ });
11319
+ setQuotes(result);
11320
+ } catch (err) {
11321
+ setQuoteError(err instanceof Error ? err.message : "Failed to fetch quotes");
11322
+ } finally {
11323
+ setIsLoadingQuotes(false);
11324
+ }
11325
+ }), [formValues, transactionType, onGetQuotes]);
11326
+ const handleSelectQuote = (0, import_react24.useCallback)(
11327
+ (quote) => __async(void 0, null, function* () {
11328
+ setStep("widget");
11329
+ setIsCreatingSession(true);
11330
+ try {
11331
+ const session = yield onSelectQuote({
11332
+ transactionType,
11333
+ serviceProvider: quote.serviceProvider,
11334
+ sourceAmount: quote.sourceAmount,
11335
+ sourceCurrencyCode: quote.sourceCurrencyCode,
11336
+ destinationCurrencyCode: quote.destinationCurrencyCode,
11337
+ countryCode: quote.countryCode,
11338
+ walletAddress: formValues.walletAddress
11339
+ });
11340
+ setWidgetUrl(session.serviceProviderWidgetUrl);
11341
+ } catch (e) {
11342
+ setStep("quotes");
11343
+ } finally {
11344
+ setIsCreatingSession(false);
11345
+ }
11346
+ }),
11347
+ [transactionType, formValues.walletAddress, onSelectQuote]
11348
+ );
11349
+ const numericAmount = Number(formValues.amount) || 0;
11350
+ return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(
11351
+ Modal.Container,
11352
+ {
11353
+ maxWidth: "520px",
11354
+ "aria-label": transactionType === "BUY" ? "Buy Crypto" : "Sell Crypto",
11355
+ children: [
11356
+ step === "form" ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
11357
+ QuoteFormStep,
11358
+ {
11359
+ title: transactionType === "BUY" ? "Buy Crypto" : "Sell Crypto",
11360
+ values: formValues,
11361
+ onAmountChange: (amount) => setFormValues((prev) => __spreadProps(__spreadValues({}, prev), { amount })),
11362
+ onFiatChange: (fiatCurrency) => setFormValues((prev) => __spreadProps(__spreadValues({}, prev), { fiatCurrency })),
11363
+ onCryptoChange: (cryptoCurrency) => setFormValues((prev) => __spreadProps(__spreadValues({}, prev), { cryptoCurrency })),
11364
+ onWalletAddressChange: (walletAddress) => setFormValues((prev) => __spreadProps(__spreadValues({}, prev), { walletAddress })),
11365
+ onSubmit: handleGetQuotes
11366
+ }
11367
+ ) : null,
11368
+ step === "quotes" ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
11369
+ QuoteSelectionStep,
11370
+ {
11371
+ quotes,
11372
+ isLoading: isLoadingQuotes,
11373
+ error: quoteError,
11374
+ fiatCurrency: formValues.fiatCurrency,
11375
+ cryptoCurrency: formValues.cryptoCurrency,
11376
+ amount: numericAmount,
11377
+ onBack: () => setStep("form"),
11378
+ onSelectQuote: handleSelectQuote,
11379
+ onRetry: handleGetQuotes
11380
+ }
11381
+ ) : null,
11382
+ step === "widget" ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
11383
+ WidgetStep,
11384
+ {
11385
+ widgetUrl,
11386
+ isLoading: isCreatingSession,
11387
+ onBack: () => {
11388
+ setWidgetUrl(null);
11389
+ setStep("quotes");
11390
+ }
11391
+ }
11392
+ ) : null
11393
+ ]
11394
+ }
11395
+ ) });
11396
+ };
11397
+ OnrampModal.displayName = "OnrampModal";
11398
+
11399
+ // src/withdraw/index.tsx
11400
+ var import_react26 = require("react");
10776
11401
 
10777
11402
  // src/withdraw/withdraw-modal.constants.ts
10778
11403
  var KALSHI_VENUE3 = "kalshi";
10779
11404
  var KALSHI_WITHDRAW_URL_DEFAULT = "https://kalshi.com/account/withdraw";
10780
11405
 
10781
11406
  // src/withdraw/steps/venue-selection.tsx
10782
- var import_jsx_runtime107 = require("react/jsx-runtime");
11407
+ var import_jsx_runtime112 = require("react/jsx-runtime");
10783
11408
  var VenueRow2 = ({ venue, onSelect }) => {
10784
11409
  var _a, _b;
10785
11410
  const displayName = (_a = venueLogoLabels[venue.venue]) != null ? _a : venue.venue;
10786
11411
  const isDisabled = venue.disabled === true;
10787
- return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
11412
+ return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
10788
11413
  "div",
10789
11414
  {
10790
11415
  className: cn(
@@ -10797,7 +11422,9 @@ var VenueRow2 = ({ venue, onSelect }) => {
10797
11422
  role: "button",
10798
11423
  tabIndex: isDisabled ? -1 : 0,
10799
11424
  "aria-disabled": isDisabled,
10800
- onClick: () => {
11425
+ onClick: (e) => {
11426
+ e.stopPropagation();
11427
+ e.preventDefault();
10801
11428
  if (!isDisabled)
10802
11429
  onSelect(venue.venue);
10803
11430
  },
@@ -10808,20 +11435,20 @@ var VenueRow2 = ({ venue, onSelect }) => {
10808
11435
  }
10809
11436
  },
10810
11437
  children: [
10811
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(VenueLogo, { venue: venue.venue, size: "large", className: "rounded-lg" }) }),
10812
- /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex-1 min-w-0", children: [
10813
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: displayName }),
10814
- /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11438
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(VenueLogo, { venue: venue.venue, size: "large", className: "rounded-lg" }) }),
11439
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex-1 min-w-0", children: [
11440
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: displayName }),
11441
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
10815
11442
  "Balance ",
10816
11443
  formatCompactUsd(venue.balance)
10817
11444
  ] })
10818
11445
  ] }),
10819
- isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { className: "agg-type-label text-agg-muted-foreground", children: (_b = venue.disabledReason) != null ? _b : "Unavailable" }) }) : /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
11446
+ isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("span", { className: "agg-type-label text-agg-muted-foreground", children: (_b = venue.disabledReason) != null ? _b : "Unavailable" }) }) : /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
10820
11447
  Button,
10821
11448
  {
10822
11449
  variant: "secondary",
10823
11450
  size: "small",
10824
- suffix: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(ChevronRightIcon, {}),
11451
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ChevronRightIcon, {}),
10825
11452
  onClick: (e) => {
10826
11453
  e.stopPropagation();
10827
11454
  onSelect(venue.venue);
@@ -10836,22 +11463,22 @@ var VenueRow2 = ({ venue, onSelect }) => {
10836
11463
  var VenueSelectionStep2 = ({
10837
11464
  venues,
10838
11465
  onSelectVenue
10839
- }) => /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
10840
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Modal.Header, { title: "Withdraw", hideBorder: true }),
10841
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex flex-col gap-4", children: [
10842
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("p", { className: "agg-type-body text-agg-foreground", children: "Choose where to withdraw funds from:" }),
10843
- /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("div", { className: "flex flex-col gap-3", children: venues.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(VenueRow2, { venue, onSelect: onSelectVenue }, venue.venue)) })
11466
+ }) => /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
11467
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Modal.Header, { title: "Withdraw", hideBorder: true }),
11468
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex flex-col gap-4", children: [
11469
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "agg-type-body text-agg-foreground", children: "Choose where to withdraw funds from:" }),
11470
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "flex flex-col gap-3", children: venues.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(VenueRow2, { venue, onSelect: onSelectVenue }, venue.venue)) })
10844
11471
  ] }) })
10845
11472
  ] });
10846
11473
 
10847
11474
  // src/withdraw/steps/withdraw-method.tsx
10848
- var import_jsx_runtime108 = require("react/jsx-runtime");
11475
+ var import_jsx_runtime113 = require("react/jsx-runtime");
10849
11476
  var WithdrawMethodCard = ({
10850
11477
  icon,
10851
11478
  title,
10852
11479
  description,
10853
11480
  onContinue
10854
- }) => /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
11481
+ }) => /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(
10855
11482
  "div",
10856
11483
  {
10857
11484
  className: cn(
@@ -10870,17 +11497,17 @@ var WithdrawMethodCard = ({
10870
11497
  }
10871
11498
  },
10872
11499
  children: [
10873
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
10874
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex-1 min-w-0", children: [
10875
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
10876
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
11500
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
11501
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex-1 min-w-0", children: [
11502
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: title }),
11503
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
10877
11504
  ] }),
10878
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11505
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
10879
11506
  Button,
10880
11507
  {
10881
11508
  variant: "secondary",
10882
11509
  size: "small",
10883
- suffix: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ChevronRightIcon, {}),
11510
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ChevronRightIcon, {}),
10884
11511
  onClick: (e) => {
10885
11512
  e.stopPropagation();
10886
11513
  onContinue();
@@ -10898,47 +11525,47 @@ var WithdrawMethodStep = ({
10898
11525
  }) => {
10899
11526
  var _a;
10900
11527
  const displayName = (_a = venueLogoLabels[venue.venue]) != null ? _a : venue.venue;
10901
- return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [
10902
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11528
+ return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(import_jsx_runtime113.Fragment, { children: [
11529
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
10903
11530
  Modal.Header,
10904
11531
  {
10905
11532
  title: `Withdraw from ${displayName}`,
10906
11533
  hideBorder: true,
10907
- leftElement: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11534
+ leftElement: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
10908
11535
  "button",
10909
11536
  {
10910
11537
  type: "button",
10911
11538
  className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
10912
11539
  onClick: onBack,
10913
11540
  "aria-label": "Go back",
10914
- children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
11541
+ children: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
10915
11542
  }
10916
11543
  )
10917
11544
  }
10918
11545
  ),
10919
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex flex-col gap-4", children: [
10920
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex items-center gap-2", children: [
10921
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(VenueLogo, { venue: venue.venue, size: "small", className: "rounded-sm" }),
10922
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11546
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-4", children: [
11547
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex items-center gap-2", children: [
11548
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(VenueLogo, { venue: venue.venue, size: "small", className: "rounded-sm" }),
11549
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
10923
11550
  displayName,
10924
11551
  " balance: ",
10925
11552
  formatCompactUsd(venue.balance)
10926
11553
  ] })
10927
11554
  ] }),
10928
- /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex flex-col gap-3", children: [
10929
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11555
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-3", children: [
11556
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
10930
11557
  WithdrawMethodCard,
10931
11558
  {
10932
- icon: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(WalletIcon, { className: "h-6 w-6 text-agg-foreground" }),
11559
+ icon: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(WalletIcon, { className: "h-6 w-6 text-agg-foreground" }),
10933
11560
  title: "Withdraw to Wallet",
10934
11561
  description: "Send funds to your crypto wallet as USDC.",
10935
11562
  onContinue: () => onSelectMethod("wallet")
10936
11563
  }
10937
11564
  ),
10938
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
11565
+ /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
10939
11566
  WithdrawMethodCard,
10940
11567
  {
10941
- icon: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(BankIcon, { className: "h-6 w-6 text-agg-foreground" }),
11568
+ icon: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(BankIcon, { className: "h-6 w-6 text-agg-foreground" }),
10942
11569
  title: "Withdraw to Bank",
10943
11570
  description: "Transfer funds to your linked bank account.",
10944
11571
  onContinue: () => onSelectMethod("bank")
@@ -10950,8 +11577,8 @@ var WithdrawMethodStep = ({
10950
11577
  };
10951
11578
 
10952
11579
  // src/withdraw/steps/withdraw-amount.tsx
10953
- var import_react22 = require("react");
10954
- var import_jsx_runtime109 = require("react/jsx-runtime");
11580
+ var import_react25 = require("react");
11581
+ var import_jsx_runtime114 = require("react/jsx-runtime");
10955
11582
  var WithdrawAmountStep = ({
10956
11583
  venue,
10957
11584
  method,
@@ -10959,50 +11586,50 @@ var WithdrawAmountStep = ({
10959
11586
  onContinue
10960
11587
  }) => {
10961
11588
  var _a;
10962
- const [rawAmount, setRawAmount] = (0, import_react22.useState)("");
11589
+ const [rawAmount, setRawAmount] = (0, import_react25.useState)("");
10963
11590
  const displayName = (_a = venueLogoLabels[venue.venue]) != null ? _a : venue.venue;
10964
11591
  const numericAmount = Number(rawAmount) || 0;
10965
11592
  const isValid = numericAmount > 0 && numericAmount <= venue.balance;
10966
11593
  const exceedsBalance = numericAmount > venue.balance;
10967
11594
  const methodLabel = method === "wallet" ? "Wallet" : "Bank";
10968
- const handleAmountChange = (0, import_react22.useCallback)((e) => {
11595
+ const handleAmountChange = (0, import_react25.useCallback)((e) => {
10969
11596
  const v = e.target.value.replace(/[^0-9.]/g, "");
10970
11597
  const parts = v.split(".");
10971
11598
  const sanitized = parts.length > 2 ? `${parts[0]}.${parts.slice(1).join("")}` : v;
10972
11599
  setRawAmount(sanitized);
10973
11600
  }, []);
10974
- const handleMax = (0, import_react22.useCallback)(() => {
11601
+ const handleMax = (0, import_react25.useCallback)(() => {
10975
11602
  setRawAmount(venue.balance.toString());
10976
11603
  }, [venue.balance]);
10977
- return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
10978
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11604
+ return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
11605
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
10979
11606
  Modal.Header,
10980
11607
  {
10981
11608
  title: `Withdraw to ${methodLabel}`,
10982
11609
  hideBorder: true,
10983
- leftElement: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11610
+ leftElement: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
10984
11611
  "button",
10985
11612
  {
10986
11613
  type: "button",
10987
11614
  className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
10988
11615
  onClick: onBack,
10989
11616
  "aria-label": "Go back",
10990
- children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
11617
+ children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
10991
11618
  }
10992
11619
  )
10993
11620
  }
10994
11621
  ),
10995
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex flex-col gap-6", children: [
10996
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center justify-between", children: [
10997
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-center gap-2", children: [
10998
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(VenueLogo, { venue: venue.venue, size: "small", className: "rounded-sm" }),
10999
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11622
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-6", children: [
11623
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex items-center justify-between", children: [
11624
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex items-center gap-2", children: [
11625
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(VenueLogo, { venue: venue.venue, size: "small", className: "rounded-sm" }),
11626
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
11000
11627
  displayName,
11001
11628
  " balance: ",
11002
11629
  formatCompactUsd(venue.balance)
11003
11630
  ] })
11004
11631
  ] }),
11005
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11632
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
11006
11633
  "button",
11007
11634
  {
11008
11635
  type: "button",
@@ -11012,10 +11639,10 @@ var WithdrawAmountStep = ({
11012
11639
  }
11013
11640
  )
11014
11641
  ] }),
11015
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex-1 min-w-0", children: [
11016
- /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: "flex items-baseline", children: [
11017
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "agg-type-display text-agg-foreground", children: "$" }),
11018
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11642
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex-1 min-w-0", children: [
11643
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex items-baseline", children: [
11644
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { className: "agg-type-display text-agg-foreground", children: "$" }),
11645
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
11019
11646
  "input",
11020
11647
  {
11021
11648
  type: "text",
@@ -11031,9 +11658,9 @@ var WithdrawAmountStep = ({
11031
11658
  }
11032
11659
  )
11033
11660
  ] }),
11034
- exceedsBalance ? /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("p", { className: "agg-type-label mt-2 text-agg-error", children: "Amount exceeds available balance" }) : null
11661
+ exceedsBalance ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "agg-type-label mt-2 text-agg-error", children: "Amount exceeds available balance" }) : null
11035
11662
  ] }),
11036
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(
11663
+ /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
11037
11664
  Button,
11038
11665
  {
11039
11666
  variant: "primary",
@@ -11049,30 +11676,30 @@ var WithdrawAmountStep = ({
11049
11676
  };
11050
11677
 
11051
11678
  // src/withdraw/steps/kalshi-withdraw.tsx
11052
- var import_jsx_runtime110 = require("react/jsx-runtime");
11679
+ var import_jsx_runtime115 = require("react/jsx-runtime");
11053
11680
  var KalshiStepCard2 = ({
11054
11681
  step,
11055
11682
  title,
11056
11683
  description,
11057
11684
  children
11058
- }) => /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex flex-col gap-2 rounded-xl bg-agg-secondary-hover p-4", children: [
11059
- /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("p", { className: "agg-type-caption-caps text-agg-muted-foreground", children: [
11685
+ }) => /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-2 rounded-xl bg-agg-secondary-hover p-4", children: [
11686
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("p", { className: "agg-type-caption-caps text-agg-muted-foreground", children: [
11060
11687
  "Step ",
11061
11688
  step
11062
11689
  ] }),
11063
- /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex flex-col gap-1", children: [
11064
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: title }),
11065
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("p", { className: "agg-type-label text-agg-foreground", children: description })
11690
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-1", children: [
11691
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: title }),
11692
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "agg-type-label text-agg-foreground", children: description })
11066
11693
  ] }),
11067
11694
  children
11068
11695
  ] });
11069
11696
  var KalshiWithdrawStep = ({
11070
11697
  withdrawUrl,
11071
11698
  onDone
11072
- }) => /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [
11073
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Modal.Header, { title: "", hideBorder: true }),
11074
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
11075
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11699
+ }) => /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(import_jsx_runtime115.Fragment, { children: [
11700
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Modal.Header, { title: "", hideBorder: true }),
11701
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
11702
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
11076
11703
  VenueLogo,
11077
11704
  {
11078
11705
  venue: "kalshi",
@@ -11080,23 +11707,23 @@ var KalshiWithdrawStep = ({
11080
11707
  className: "h-[60px] w-[60px] rounded-lg"
11081
11708
  }
11082
11709
  ),
11083
- /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [
11084
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("h2", { className: "agg-type-heading text-agg-foreground", children: "Withdraw from Kalshi" }),
11085
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("p", { className: "agg-type-body text-agg-foreground", children: "To withdraw from Kalshi you'll need to initiate the withdrawal from your Kalshi account directly on Kalshi's site." })
11710
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [
11711
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("h2", { className: "agg-type-heading text-agg-foreground", children: "Withdraw from Kalshi" }),
11712
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "agg-type-body text-agg-foreground", children: "To withdraw from Kalshi you'll need to initiate the withdrawal from your Kalshi account directly on Kalshi's site." })
11086
11713
  ] }),
11087
- /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
11088
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11714
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
11715
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
11089
11716
  KalshiStepCard2,
11090
11717
  {
11091
11718
  step: 1,
11092
11719
  title: "Open Kalshi Withdraw Page",
11093
11720
  description: "Sign in to your Kalshi account and go to Withdraw from your account menu.",
11094
- children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11721
+ children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("div", { className: "mt-1", children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
11095
11722
  Button,
11096
11723
  {
11097
11724
  variant: "secondary",
11098
11725
  size: "small",
11099
- suffix: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(ExternalLinkIcon, { className: "h-3.5 w-3.5" }),
11726
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(ExternalLinkIcon, { className: "h-3.5 w-3.5" }),
11100
11727
  onClick: () => {
11101
11728
  window.open(withdrawUrl, "_blank", "noopener,noreferrer");
11102
11729
  },
@@ -11105,7 +11732,7 @@ var KalshiWithdrawStep = ({
11105
11732
  ) })
11106
11733
  }
11107
11734
  ),
11108
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11735
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
11109
11736
  KalshiStepCard2,
11110
11737
  {
11111
11738
  step: 2,
@@ -11113,7 +11740,7 @@ var KalshiWithdrawStep = ({
11113
11740
  description: "Select a withdrawal method: Bank transfer (ACH), Wire, or USDC (crypto)."
11114
11741
  }
11115
11742
  ),
11116
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
11743
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
11117
11744
  KalshiStepCard2,
11118
11745
  {
11119
11746
  step: 3,
@@ -11122,12 +11749,12 @@ var KalshiWithdrawStep = ({
11122
11749
  }
11123
11750
  )
11124
11751
  ] }),
11125
- /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(Button, { variant: "secondary", size: "large", onClick: onDone, children: "Done" })
11752
+ /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Button, { variant: "secondary", size: "large", onClick: onDone, children: "Done" })
11126
11753
  ] }) })
11127
11754
  ] });
11128
11755
 
11129
11756
  // src/withdraw/index.tsx
11130
- var import_jsx_runtime111 = require("react/jsx-runtime");
11757
+ var import_jsx_runtime116 = require("react/jsx-runtime");
11131
11758
  var WithdrawModal = ({
11132
11759
  open,
11133
11760
  onOpenChange,
@@ -11139,9 +11766,9 @@ var WithdrawModal = ({
11139
11766
  onDoneKalshi,
11140
11767
  kalshiWithdrawUrl = KALSHI_WITHDRAW_URL_DEFAULT
11141
11768
  }) => {
11142
- const [step, setStep] = (0, import_react23.useState)("venues");
11143
- const [selectedVenue, setSelectedVenue] = (0, import_react23.useState)(null);
11144
- const [selectedMethod, setSelectedMethod] = (0, import_react23.useState)(null);
11769
+ const [step, setStep] = (0, import_react26.useState)("venues");
11770
+ const [selectedVenue, setSelectedVenue] = (0, import_react26.useState)(null);
11771
+ const [selectedMethod, setSelectedMethod] = (0, import_react26.useState)(null);
11145
11772
  const handleSelectVenue = (venueSlug) => {
11146
11773
  onSelectVenue(venueSlug);
11147
11774
  if (venueSlug === KALSHI_VENUE3) {
@@ -11191,9 +11818,9 @@ var WithdrawModal = ({
11191
11818
  }
11192
11819
  onOpenChange(isOpen);
11193
11820
  };
11194
- return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)(Modal.Container, { maxWidth: "600px", "aria-label": "Withdraw", children: [
11195
- step === "venues" ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(VenueSelectionStep2, { venues, onSelectVenue: handleSelectVenue }) : null,
11196
- step === "method" && selectedVenue ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
11821
+ return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Modal.Container, { maxWidth: "600px", "aria-label": "Withdraw", children: [
11822
+ step === "venues" ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(VenueSelectionStep2, { venues, onSelectVenue: handleSelectVenue }) : null,
11823
+ step === "method" && selectedVenue ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
11197
11824
  WithdrawMethodStep,
11198
11825
  {
11199
11826
  venue: selectedVenue,
@@ -11201,7 +11828,7 @@ var WithdrawModal = ({
11201
11828
  onSelectMethod: handleSelectMethod
11202
11829
  }
11203
11830
  ) : null,
11204
- step === "withdraw-amount" && selectedVenue && selectedMethod ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
11831
+ step === "withdraw-amount" && selectedVenue && selectedMethod ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
11205
11832
  WithdrawAmountStep,
11206
11833
  {
11207
11834
  venue: selectedVenue,
@@ -11210,13 +11837,13 @@ var WithdrawModal = ({
11210
11837
  onContinue: handleContinueWithdraw
11211
11838
  }
11212
11839
  ) : null,
11213
- step === "kalshi" ? /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(KalshiWithdrawStep, { withdrawUrl: kalshiWithdrawUrl, onDone: handleDoneKalshi }) : null
11840
+ step === "kalshi" ? /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(KalshiWithdrawStep, { withdrawUrl: kalshiWithdrawUrl, onDone: handleDoneKalshi }) : null
11214
11841
  ] }) });
11215
11842
  };
11216
11843
  WithdrawModal.displayName = "WithdrawModal";
11217
11844
 
11218
11845
  // src/onboarding/index.tsx
11219
- var import_react28 = require("react");
11846
+ var import_react31 = require("react");
11220
11847
  var import_hooks36 = require("@agg-market/hooks");
11221
11848
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
11222
11849
 
@@ -11239,31 +11866,31 @@ var ONCHAIN_VENUES = [
11239
11866
  ];
11240
11867
 
11241
11868
  // src/onboarding/steps/how-it-works.tsx
11242
- var import_react24 = require("react");
11869
+ var import_react27 = require("react");
11243
11870
  var import_hooks31 = require("@agg-market/hooks");
11244
- var import_jsx_runtime112 = require("react/jsx-runtime");
11871
+ var import_jsx_runtime117 = require("react/jsx-runtime");
11245
11872
  var defaultIcons = {
11246
- createAccount: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11247
- linkAccounts: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11248
- bestPrices: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11249
- stayInControl: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
11873
+ createAccount: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11874
+ linkAccounts: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11875
+ bestPrices: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
11876
+ stayInControl: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
11250
11877
  };
11251
11878
  var HowItWorksStep = ({ onContinue, icons }) => {
11252
11879
  const labels = (0, import_hooks31.useLabels)();
11253
- const scrollRef = (0, import_react24.useRef)(null);
11254
- const [showTopGradient, setShowTopGradient] = (0, import_react24.useState)(false);
11255
- const [showBottomGradient, setShowBottomGradient] = (0, import_react24.useState)(true);
11256
- const handleScroll = (0, import_react24.useCallback)(() => {
11880
+ const scrollRef = (0, import_react27.useRef)(null);
11881
+ const [showTopGradient, setShowTopGradient] = (0, import_react27.useState)(false);
11882
+ const [showBottomGradient, setShowBottomGradient] = (0, import_react27.useState)(true);
11883
+ const handleScroll = (0, import_react27.useCallback)(() => {
11257
11884
  const el = scrollRef.current;
11258
11885
  if (!el)
11259
11886
  return;
11260
11887
  setShowTopGradient(el.scrollTop > 0);
11261
11888
  setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
11262
11889
  }, []);
11263
- return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
11264
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
11265
- /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
11266
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
11890
+ return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
11891
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
11892
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
11893
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11267
11894
  "div",
11268
11895
  {
11269
11896
  ref: scrollRef,
@@ -11273,7 +11900,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
11273
11900
  var _a;
11274
11901
  const icon = (_a = icons == null ? void 0 : icons[featureKey]) != null ? _a : defaultIcons[featureKey];
11275
11902
  const feature = labels.onboarding.howItWorks.features[featureKey];
11276
- return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
11903
+ return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
11277
11904
  "div",
11278
11905
  {
11279
11906
  className: cn(
@@ -11282,11 +11909,11 @@ var HowItWorksStep = ({ onContinue, icons }) => {
11282
11909
  "bg-agg-secondary-hover"
11283
11910
  ),
11284
11911
  children: [
11285
- /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
11286
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
11287
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
11912
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
11913
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
11914
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
11288
11915
  ] }),
11289
- icon ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
11916
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
11290
11917
  ]
11291
11918
  },
11292
11919
  featureKey
@@ -11294,7 +11921,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
11294
11921
  })
11295
11922
  }
11296
11923
  ),
11297
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
11924
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11298
11925
  "div",
11299
11926
  {
11300
11927
  className: cn(
@@ -11305,7 +11932,7 @@ var HowItWorksStep = ({ onContinue, icons }) => {
11305
11932
  )
11306
11933
  }
11307
11934
  ),
11308
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
11935
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
11309
11936
  "div",
11310
11937
  {
11311
11938
  className: cn(
@@ -11317,26 +11944,26 @@ var HowItWorksStep = ({ onContinue, icons }) => {
11317
11944
  }
11318
11945
  )
11319
11946
  ] }),
11320
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
11947
+ /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
11321
11948
  ] });
11322
11949
  };
11323
11950
  HowItWorksStep.displayName = "HowItWorksStep";
11324
11951
 
11325
11952
  // src/onboarding/steps/profile-setup.tsx
11326
- var import_react25 = require("react");
11953
+ var import_react28 = require("react");
11327
11954
  var import_hooks32 = require("@agg-market/hooks");
11328
- var import_jsx_runtime113 = require("react/jsx-runtime");
11955
+ var import_jsx_runtime118 = require("react/jsx-runtime");
11329
11956
  var ProfileSetupStep = ({ onContinue }) => {
11330
11957
  const labels = (0, import_hooks32.useLabels)();
11331
- const [username, setUsername] = (0, import_react25.useState)("");
11332
- const [avatarFile, setAvatarFile] = (0, import_react25.useState)();
11333
- const [avatarPreview, setAvatarPreview] = (0, import_react25.useState)();
11334
- const fileInputRef = (0, import_react25.useRef)(null);
11335
- const handleAvatarClick = (0, import_react25.useCallback)(() => {
11958
+ const [username, setUsername] = (0, import_react28.useState)("");
11959
+ const [avatarFile, setAvatarFile] = (0, import_react28.useState)();
11960
+ const [avatarPreview, setAvatarPreview] = (0, import_react28.useState)();
11961
+ const fileInputRef = (0, import_react28.useRef)(null);
11962
+ const handleAvatarClick = (0, import_react28.useCallback)(() => {
11336
11963
  var _a;
11337
11964
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
11338
11965
  }, []);
11339
- const handleFileChange = (0, import_react25.useCallback)((e) => {
11966
+ const handleFileChange = (0, import_react28.useCallback)((e) => {
11340
11967
  var _a;
11341
11968
  const file = (_a = e.target.files) == null ? void 0 : _a[0];
11342
11969
  if (!file)
@@ -11349,18 +11976,18 @@ var ProfileSetupStep = ({ onContinue }) => {
11349
11976
  };
11350
11977
  reader.readAsDataURL(file);
11351
11978
  }, []);
11352
- const handleContinue = (0, import_react25.useCallback)(() => {
11979
+ const handleContinue = (0, import_react28.useCallback)(() => {
11353
11980
  onContinue({
11354
11981
  username,
11355
11982
  avatarFile,
11356
11983
  avatarPreview
11357
11984
  });
11358
11985
  }, [username, avatarFile, avatarPreview, onContinue]);
11359
- return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-7", children: [
11360
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
11361
- /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-5 items-center w-full", children: [
11362
- /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex justify-center", children: [
11363
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
11986
+ return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-7", children: [
11987
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
11988
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-5 items-center w-full", children: [
11989
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex justify-center", children: [
11990
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
11364
11991
  "button",
11365
11992
  {
11366
11993
  type: "button",
@@ -11376,17 +12003,17 @@ var ProfileSetupStep = ({ onContinue }) => {
11376
12003
  "overflow-hidden"
11377
12004
  ),
11378
12005
  "aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
11379
- children: avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
12006
+ children: avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
11380
12007
  RemoteImage,
11381
12008
  {
11382
12009
  src: avatarPreview,
11383
12010
  alt: labels.onboarding.profileSetup.profilePreviewAlt,
11384
12011
  className: "h-full w-full object-cover"
11385
12012
  }
11386
- ) : /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
12013
+ ) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
11387
12014
  }
11388
12015
  ),
11389
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
12016
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
11390
12017
  "input",
11391
12018
  {
11392
12019
  ref: fileInputRef,
@@ -11398,8 +12025,8 @@ var ProfileSetupStep = ({ onContinue }) => {
11398
12025
  }
11399
12026
  )
11400
12027
  ] }),
11401
- /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: "flex flex-col gap-2 w-full", children: [
11402
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
12028
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-2 w-full", children: [
12029
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
11403
12030
  "label",
11404
12031
  {
11405
12032
  htmlFor: "onboarding-username",
@@ -11407,7 +12034,7 @@ var ProfileSetupStep = ({ onContinue }) => {
11407
12034
  children: labels.onboarding.profileSetup.usernameLabel
11408
12035
  }
11409
12036
  ),
11410
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
12037
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
11411
12038
  "input",
11412
12039
  {
11413
12040
  id: "onboarding-username",
@@ -11431,16 +12058,16 @@ var ProfileSetupStep = ({ onContinue }) => {
11431
12058
  )
11432
12059
  ] })
11433
12060
  ] }),
11434
- /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
12061
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
11435
12062
  ] });
11436
12063
  };
11437
12064
  ProfileSetupStep.displayName = "ProfileSetupStep";
11438
12065
 
11439
12066
  // src/onboarding/steps/connect-accounts.tsx
11440
12067
  var import_hooks33 = require("@agg-market/hooks");
11441
- var import_jsx_runtime114 = require("react/jsx-runtime");
12068
+ var import_jsx_runtime119 = require("react/jsx-runtime");
11442
12069
  var OnchainVenueLogos = () => {
11443
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
12070
+ return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
11444
12071
  };
11445
12072
  var VenueCard = ({
11446
12073
  logos,
@@ -11452,7 +12079,7 @@ var VenueCard = ({
11452
12079
  connected = false
11453
12080
  }) => {
11454
12081
  const labels = (0, import_hooks33.useLabels)();
11455
- const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12082
+ const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11456
12083
  Button,
11457
12084
  {
11458
12085
  variant: "tertiary",
@@ -11462,18 +12089,18 @@ var VenueCard = ({
11462
12089
  children: labels.onboarding.connectAccounts.connect
11463
12090
  }
11464
12091
  );
11465
- const mobileAction = connected ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12092
+ const mobileAction = connected ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11466
12093
  Button,
11467
12094
  {
11468
12095
  variant: "tertiary",
11469
12096
  size: "medium",
11470
12097
  className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
11471
12098
  onClick: onConnect,
11472
- suffix: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(ChevronRightIcon, { className: "h-4 w-4" }),
12099
+ suffix: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ChevronRightIcon, { className: "h-4 w-4" }),
11473
12100
  children: labels.onboarding.connectAccounts.connectAccount
11474
12101
  }
11475
12102
  );
11476
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(
12103
+ return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
11477
12104
  "div",
11478
12105
  {
11479
12106
  className: cn(
@@ -11481,23 +12108,23 @@ var VenueCard = ({
11481
12108
  connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
11482
12109
  ),
11483
12110
  children: [
11484
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "hidden sm:flex items-center justify-between", children: [
11485
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex items-center gap-5", children: [
11486
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "shrink-0", children: logos }),
11487
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-[2px]", children: [
11488
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
11489
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "text-agg-sm text-agg-foreground", children: description })
12111
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "hidden sm:flex items-center justify-between", children: [
12112
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-5", children: [
12113
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "shrink-0", children: logos }),
12114
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-[2px]", children: [
12115
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
12116
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-agg-sm text-agg-foreground", children: description })
11490
12117
  ] })
11491
12118
  ] }),
11492
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "shrink-0", children: action })
12119
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "shrink-0", children: action })
11493
12120
  ] }),
11494
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-3 sm:hidden", children: [
11495
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-3", children: [
11496
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "shrink-0", children: logos }),
11497
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
12121
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-3 sm:hidden", children: [
12122
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-3", children: [
12123
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "shrink-0", children: logos }),
12124
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
11498
12125
  ] }),
11499
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
11500
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
12126
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
12127
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
11501
12128
  mobileAction
11502
12129
  ] })
11503
12130
  ] })
@@ -11514,13 +12141,13 @@ var ConnectAccountsStep = ({
11514
12141
  }) => {
11515
12142
  const labels = (0, import_hooks33.useLabels)();
11516
12143
  const canContinue = connectedOnchain || connectedKalshi;
11517
- return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-6", children: [
11518
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
11519
- /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "flex flex-col gap-4", children: [
11520
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12144
+ return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-6", children: [
12145
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
12146
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-4", children: [
12147
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11521
12148
  VenueCard,
11522
12149
  {
11523
- logos: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(OnchainVenueLogos, {}),
12150
+ logos: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(OnchainVenueLogos, {}),
11524
12151
  title: labels.onboarding.connectAccounts.onchainTitle,
11525
12152
  mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
11526
12153
  ONCHAIN_VENUES.length - 1
@@ -11531,10 +12158,10 @@ var ConnectAccountsStep = ({
11531
12158
  connected: connectedOnchain
11532
12159
  }
11533
12160
  ),
11534
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12161
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11535
12162
  VenueCard,
11536
12163
  {
11537
- logos: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12164
+ logos: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "sm:flex sm:w-14 sm:items-center sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11538
12165
  VenueLogo,
11539
12166
  {
11540
12167
  venue: "kalshi",
@@ -11552,7 +12179,7 @@ var ConnectAccountsStep = ({
11552
12179
  }
11553
12180
  )
11554
12181
  ] }),
11555
- /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
12182
+ /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
11556
12183
  Button,
11557
12184
  {
11558
12185
  variant: "primary",
@@ -11568,25 +12195,25 @@ var ConnectAccountsStep = ({
11568
12195
  ConnectAccountsStep.displayName = "ConnectAccountsStep";
11569
12196
 
11570
12197
  // src/onboarding/steps/connect-kalshi-modal.tsx
11571
- var import_react26 = require("react");
12198
+ var import_react29 = require("react");
11572
12199
  var import_hooks34 = require("@agg-market/hooks");
11573
12200
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
11574
- var import_jsx_runtime115 = require("react/jsx-runtime");
12201
+ var import_jsx_runtime120 = require("react/jsx-runtime");
11575
12202
  var ConnectKalshiModal = ({
11576
12203
  open,
11577
12204
  onOpenChange,
11578
12205
  onVerify
11579
12206
  }) => {
11580
12207
  const labels = (0, import_hooks34.useLabels)();
11581
- const [apiKeyId, setApiKeyId] = (0, import_react26.useState)("");
11582
- const [privateKey, setPrivateKey] = (0, import_react26.useState)("");
11583
- const [verifying, setVerifying] = (0, import_react26.useState)(false);
11584
- const [error, setError] = (0, import_react26.useState)();
12208
+ const [apiKeyId, setApiKeyId] = (0, import_react29.useState)("");
12209
+ const [privateKey, setPrivateKey] = (0, import_react29.useState)("");
12210
+ const [verifying, setVerifying] = (0, import_react29.useState)(false);
12211
+ const [error, setError] = (0, import_react29.useState)();
11585
12212
  const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
11586
- const handleCancel = (0, import_react26.useCallback)(() => {
12213
+ const handleCancel = (0, import_react29.useCallback)(() => {
11587
12214
  onOpenChange(false);
11588
12215
  }, [onOpenChange]);
11589
- const handleVerify = (0, import_react26.useCallback)(() => __async(void 0, null, function* () {
12216
+ const handleVerify = (0, import_react29.useCallback)(() => __async(void 0, null, function* () {
11590
12217
  if (!canVerify || verifying)
11591
12218
  return;
11592
12219
  setVerifying(true);
@@ -11616,7 +12243,7 @@ var ConnectKalshiModal = ({
11616
12243
  privateKey,
11617
12244
  verifying
11618
12245
  ]);
11619
- const handleOpenChange = (0, import_react26.useCallback)(
12246
+ const handleOpenChange = (0, import_react29.useCallback)(
11620
12247
  (value) => {
11621
12248
  if (value) {
11622
12249
  setApiKeyId("");
@@ -11628,15 +12255,15 @@ var ConnectKalshiModal = ({
11628
12255
  },
11629
12256
  [onOpenChange]
11630
12257
  );
11631
- return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
12258
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
11632
12259
  Modal.Container,
11633
12260
  {
11634
12261
  maxWidth: "600px",
11635
12262
  "aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
11636
12263
  classNames: { container: "!rounded-agg-lg" },
11637
12264
  children: [
11638
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
11639
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12265
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectKalshiModal.title }),
12266
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11640
12267
  Modal.Header,
11641
12268
  {
11642
12269
  hideClose: false,
@@ -11647,8 +12274,8 @@ var ConnectKalshiModal = ({
11647
12274
  }
11648
12275
  }
11649
12276
  ),
11650
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
11651
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12277
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
12278
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11652
12279
  VenueLogo,
11653
12280
  {
11654
12281
  venue: "kalshi",
@@ -11657,54 +12284,54 @@ var ConnectKalshiModal = ({
11657
12284
  className: "h-[60px] w-[60px]"
11658
12285
  }
11659
12286
  ),
11660
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
11661
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
11662
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
12287
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
12288
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
12289
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
11663
12290
  ] }),
11664
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
11665
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
11666
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-1", children: [
11667
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
11668
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
12291
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
12292
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
12293
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-1", children: [
12294
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
12295
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
11669
12296
  ] }),
11670
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
11671
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
11672
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("p", { children: [
12297
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "space-y-0 text-agg-sm leading-agg-5 text-agg-foreground", children: [
12298
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
12299
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("p", { children: [
11673
12300
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
11674
12301
  " ",
11675
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
12302
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
11676
12303
  labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
11677
12304
  " ",
11678
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
12305
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "text-agg-foreground underline", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl })
11679
12306
  ] }),
11680
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("p", { children: [
12307
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("p", { children: [
11681
12308
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
11682
12309
  " ",
11683
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
12310
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
11684
12311
  labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
11685
12312
  ] }),
11686
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("p", { children: [
12313
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("p", { children: [
11687
12314
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
11688
12315
  " ",
11689
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
12316
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
11690
12317
  labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
11691
12318
  ] }),
11692
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
12319
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
11693
12320
  ] }),
11694
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
12321
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
11695
12322
  labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
11696
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("br", {}),
12323
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("br", {}),
11697
12324
  labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
11698
12325
  ] })
11699
12326
  ] }),
11700
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
11701
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-1", children: [
11702
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
11703
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
12327
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-lg bg-agg-secondary-hover p-4", children: [
12328
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-1", children: [
12329
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
12330
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
11704
12331
  ] }),
11705
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
11706
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-2", children: [
11707
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12332
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
12333
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-2", children: [
12334
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11708
12335
  "label",
11709
12336
  {
11710
12337
  htmlFor: "kalshi-api-key-id",
@@ -11712,7 +12339,7 @@ var ConnectKalshiModal = ({
11712
12339
  children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
11713
12340
  }
11714
12341
  ),
11715
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12342
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11716
12343
  "input",
11717
12344
  {
11718
12345
  id: "kalshi-api-key-id",
@@ -11732,8 +12359,8 @@ var ConnectKalshiModal = ({
11732
12359
  }
11733
12360
  )
11734
12361
  ] }),
11735
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-2", children: [
11736
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12362
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-2", children: [
12363
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11737
12364
  "label",
11738
12365
  {
11739
12366
  htmlFor: "kalshi-private-key",
@@ -11741,7 +12368,7 @@ var ConnectKalshiModal = ({
11741
12368
  children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
11742
12369
  }
11743
12370
  ),
11744
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12371
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11745
12372
  "textarea",
11746
12373
  {
11747
12374
  id: "kalshi-private-key",
@@ -11763,42 +12390,42 @@ var ConnectKalshiModal = ({
11763
12390
  ] })
11764
12391
  ] })
11765
12392
  ] }),
11766
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
11767
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
11768
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex items-center gap-3", children: [
11769
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
12393
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
12394
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
12395
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-3", children: [
12396
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
11770
12397
  "a",
11771
12398
  {
11772
12399
  href: "#",
11773
12400
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
11774
12401
  children: [
11775
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(DocumentIcon, { className: "h-4 w-4" }),
12402
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(DocumentIcon, { className: "h-4 w-4" }),
11776
12403
  labels.onboarding.connectKalshiModal.help.docsLinkLabel
11777
12404
  ]
11778
12405
  }
11779
12406
  ),
11780
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
11781
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
12407
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
12408
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
11782
12409
  "a",
11783
12410
  {
11784
12411
  href: "#",
11785
12412
  className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary hover:text-agg-primary-hover",
11786
12413
  children: [
11787
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
12414
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(PlaySquareIcon, { className: "h-4 w-4" }),
11788
12415
  labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
11789
12416
  ]
11790
12417
  }
11791
12418
  )
11792
12419
  ] })
11793
12420
  ] }),
11794
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
11795
- error ? /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex items-center gap-2", children: [
11796
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
11797
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
12421
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col gap-5 items-center", children: [
12422
+ error ? /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-2", children: [
12423
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
12424
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
11798
12425
  ] }) : null,
11799
- /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
11800
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
11801
- /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
12426
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex items-center gap-3 justify-center", children: [
12427
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, children: labels.onboarding.connectKalshiModal.actions.cancel }),
12428
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
11802
12429
  Button,
11803
12430
  {
11804
12431
  variant: "primary",
@@ -11819,22 +12446,22 @@ var ConnectKalshiModal = ({
11819
12446
  ConnectKalshiModal.displayName = "ConnectKalshiModal";
11820
12447
 
11821
12448
  // src/onboarding/steps/connect-onchain-modal.tsx
11822
- var import_react27 = require("react");
12449
+ var import_react30 = require("react");
11823
12450
  var import_hooks35 = require("@agg-market/hooks");
11824
12451
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
11825
- var import_jsx_runtime116 = require("react/jsx-runtime");
12452
+ var import_jsx_runtime121 = require("react/jsx-runtime");
11826
12453
  var ConnectOnchainModal = ({
11827
12454
  open,
11828
12455
  onOpenChange,
11829
12456
  onConnect
11830
12457
  }) => {
11831
12458
  const labels = (0, import_hooks35.useLabels)();
11832
- const [connecting, setConnecting] = (0, import_react27.useState)(false);
11833
- const [error, setError] = (0, import_react27.useState)();
11834
- const handleCancel = (0, import_react27.useCallback)(() => {
12459
+ const [connecting, setConnecting] = (0, import_react30.useState)(false);
12460
+ const [error, setError] = (0, import_react30.useState)();
12461
+ const handleCancel = (0, import_react30.useCallback)(() => {
11835
12462
  onOpenChange(false);
11836
12463
  }, [onOpenChange]);
11837
- const handleConnect = (0, import_react27.useCallback)(() => __async(void 0, null, function* () {
12464
+ const handleConnect = (0, import_react30.useCallback)(() => __async(void 0, null, function* () {
11838
12465
  if (connecting)
11839
12466
  return;
11840
12467
  setConnecting(true);
@@ -11850,7 +12477,7 @@ var ConnectOnchainModal = ({
11850
12477
  setConnecting(false);
11851
12478
  }
11852
12479
  }), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
11853
- const handleOpenChange = (0, import_react27.useCallback)(
12480
+ const handleOpenChange = (0, import_react30.useCallback)(
11854
12481
  (value) => {
11855
12482
  if (value) {
11856
12483
  setError(void 0);
@@ -11860,15 +12487,15 @@ var ConnectOnchainModal = ({
11860
12487
  },
11861
12488
  [onOpenChange]
11862
12489
  );
11863
- return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(
12490
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
11864
12491
  Modal.Container,
11865
12492
  {
11866
12493
  maxWidth: "600px",
11867
12494
  "aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
11868
12495
  classNames: { container: "!rounded-agg-lg" },
11869
12496
  children: [
11870
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
11871
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
12497
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog3.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
12498
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
11872
12499
  Modal.Header,
11873
12500
  {
11874
12501
  hideClose: false,
@@ -11879,26 +12506,26 @@ var ConnectOnchainModal = ({
11879
12506
  }
11880
12507
  }
11881
12508
  ),
11882
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
11883
- /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
11884
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
11885
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
12509
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
12510
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
12511
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
12512
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
11886
12513
  ] }),
11887
- /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
11888
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
11889
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
11890
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
11891
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(VenueLogo, { venue, size: "medium" }),
11892
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
12514
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
12515
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
12516
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
12517
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
12518
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VenueLogo, { venue, size: "medium" }),
12519
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
11893
12520
  ] }, venue)) })
11894
12521
  ] }),
11895
- /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
11896
- /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
11897
- error ? /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { className: "flex items-center gap-2", children: [
11898
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
11899
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
12522
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
12523
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
12524
+ error ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2", children: [
12525
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
12526
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
11900
12527
  ] }) : null,
11901
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
12528
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
11902
12529
  Button,
11903
12530
  {
11904
12531
  variant: "primary",
@@ -11909,7 +12536,7 @@ var ConnectOnchainModal = ({
11909
12536
  }
11910
12537
  )
11911
12538
  ] }),
11912
- /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
12539
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
11913
12540
  Button,
11914
12541
  {
11915
12542
  variant: "tertiary",
@@ -11928,7 +12555,7 @@ var ConnectOnchainModal = ({
11928
12555
  ConnectOnchainModal.displayName = "ConnectOnchainModal";
11929
12556
 
11930
12557
  // src/onboarding/index.tsx
11931
- var import_jsx_runtime117 = require("react/jsx-runtime");
12558
+ var import_jsx_runtime122 = require("react/jsx-runtime");
11932
12559
  var OnboardingModal = ({
11933
12560
  open,
11934
12561
  onOpenChange,
@@ -11942,67 +12569,67 @@ var OnboardingModal = ({
11942
12569
  }) => {
11943
12570
  var _a;
11944
12571
  const labels = (0, import_hooks36.useLabels)();
11945
- const [step, setStep] = (0, import_react28.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
12572
+ const [step, setStep] = (0, import_react31.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
11946
12573
  const stepLabels = {
11947
12574
  [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
11948
12575
  [ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
11949
12576
  [ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
11950
12577
  };
11951
12578
  const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
11952
- const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react28.useState)(false);
11953
- const [kalshiConnected, setKalshiConnected] = (0, import_react28.useState)(false);
11954
- const [onchainModalOpen, setOnchainModalOpen] = (0, import_react28.useState)(false);
11955
- const [onchainConnected, setOnchainConnected] = (0, import_react28.useState)(false);
11956
- (0, import_react28.useEffect)(() => {
12579
+ const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react31.useState)(false);
12580
+ const [kalshiConnected, setKalshiConnected] = (0, import_react31.useState)(false);
12581
+ const [onchainModalOpen, setOnchainModalOpen] = (0, import_react31.useState)(false);
12582
+ const [onchainConnected, setOnchainConnected] = (0, import_react31.useState)(false);
12583
+ (0, import_react31.useEffect)(() => {
11957
12584
  if (open) {
11958
12585
  setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
11959
12586
  setKalshiConnected(false);
11960
12587
  setOnchainConnected(false);
11961
12588
  }
11962
12589
  }, [open]);
11963
- const handleHowItWorksContinue = (0, import_react28.useCallback)(() => {
12590
+ const handleHowItWorksContinue = (0, import_react31.useCallback)(() => {
11964
12591
  setStep(ONBOARDING_STEPS.PROFILE_SETUP);
11965
12592
  }, []);
11966
- const handleProfileContinue = (0, import_react28.useCallback)(
12593
+ const handleProfileContinue = (0, import_react31.useCallback)(
11967
12594
  (data) => {
11968
12595
  onProfileSubmit == null ? void 0 : onProfileSubmit(data);
11969
12596
  setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
11970
12597
  },
11971
12598
  [onProfileSubmit]
11972
12599
  );
11973
- const handleConnectContinue = (0, import_react28.useCallback)(() => {
12600
+ const handleConnectContinue = (0, import_react31.useCallback)(() => {
11974
12601
  onComplete == null ? void 0 : onComplete();
11975
12602
  }, [onComplete]);
11976
- const handleOpenOnchainModal = (0, import_react28.useCallback)(() => {
12603
+ const handleOpenOnchainModal = (0, import_react31.useCallback)(() => {
11977
12604
  setOnchainModalOpen(true);
11978
12605
  }, []);
11979
- const handleOnchainConnect = (0, import_react28.useCallback)(() => __async(void 0, null, function* () {
12606
+ const handleOnchainConnect = (0, import_react31.useCallback)(() => __async(void 0, null, function* () {
11980
12607
  yield onConnectOnchain == null ? void 0 : onConnectOnchain();
11981
12608
  setOnchainConnected(true);
11982
12609
  }), [onConnectOnchain]);
11983
- const handleOpenKalshiModal = (0, import_react28.useCallback)(() => {
12610
+ const handleOpenKalshiModal = (0, import_react31.useCallback)(() => {
11984
12611
  setKalshiModalOpen(true);
11985
12612
  }, []);
11986
- const handleKalshiVerify = (0, import_react28.useCallback)(
12613
+ const handleKalshiVerify = (0, import_react31.useCallback)(
11987
12614
  (credentials) => __async(void 0, null, function* () {
11988
12615
  yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
11989
12616
  setKalshiConnected(true);
11990
12617
  }),
11991
12618
  [onConnectKalshi]
11992
12619
  );
11993
- return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(import_jsx_runtime117.Fragment, { children: [
11994
- /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
12620
+ return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
12621
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(
11995
12622
  Modal.Container,
11996
12623
  {
11997
12624
  maxWidth: "600px",
11998
12625
  "aria-label": resolvedTitle,
11999
12626
  classNames: { container: "!rounded-agg-lg" },
12000
12627
  children: [
12001
- /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(Dialog4.Title, { className: "sr-only", children: resolvedTitle }),
12002
- /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
12003
- step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
12004
- step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
12005
- step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
12628
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(Dialog4.Title, { className: "sr-only", children: resolvedTitle }),
12629
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
12630
+ step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
12631
+ step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
12632
+ step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
12006
12633
  ConnectAccountsStep,
12007
12634
  {
12008
12635
  onConnectOnchain: handleOpenOnchainModal,
@@ -12016,7 +12643,7 @@ var OnboardingModal = ({
12016
12643
  ]
12017
12644
  }
12018
12645
  ) }),
12019
- /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
12646
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
12020
12647
  ConnectOnchainModal,
12021
12648
  {
12022
12649
  open: onchainModalOpen,
@@ -12024,7 +12651,7 @@ var OnboardingModal = ({
12024
12651
  onConnect: handleOnchainConnect
12025
12652
  }
12026
12653
  ),
12027
- /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
12654
+ /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
12028
12655
  ConnectKalshiModal,
12029
12656
  {
12030
12657
  open: kalshiModalOpen,
@@ -12037,7 +12664,7 @@ var OnboardingModal = ({
12037
12664
  OnboardingModal.displayName = "OnboardingModal";
12038
12665
 
12039
12666
  // src/profile/index.tsx
12040
- var import_react30 = require("react");
12667
+ var import_react33 = require("react");
12041
12668
 
12042
12669
  // src/profile/profile-modal.constants.ts
12043
12670
  var PROFILE_TAB_KEYS = {
@@ -12050,9 +12677,9 @@ var PROFILE_TAB_ITEMS = [
12050
12677
  ];
12051
12678
 
12052
12679
  // src/profile/tabs/about-tab.tsx
12053
- var import_react29 = require("react");
12680
+ var import_react32 = require("react");
12054
12681
  var import_hooks37 = require("@agg-market/hooks");
12055
- var import_jsx_runtime118 = require("react/jsx-runtime");
12682
+ var import_jsx_runtime123 = require("react/jsx-runtime");
12056
12683
  var AboutTab = ({
12057
12684
  avatarPreview,
12058
12685
  onDeleteProfile,
@@ -12062,12 +12689,12 @@ var AboutTab = ({
12062
12689
  draftAvatarPreview
12063
12690
  }) => {
12064
12691
  const labels = (0, import_hooks37.useLabels)();
12065
- const fileInputRef = (0, import_react29.useRef)(null);
12066
- const handleAvatarClick = (0, import_react29.useCallback)(() => {
12692
+ const fileInputRef = (0, import_react32.useRef)(null);
12693
+ const handleAvatarClick = (0, import_react32.useCallback)(() => {
12067
12694
  var _a;
12068
12695
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
12069
12696
  }, []);
12070
- const handleFileChange = (0, import_react29.useCallback)(
12697
+ const handleFileChange = (0, import_react32.useCallback)(
12071
12698
  (e) => {
12072
12699
  var _a;
12073
12700
  const file = (_a = e.target.files) == null ? void 0 : _a[0];
@@ -12083,9 +12710,9 @@ var AboutTab = ({
12083
12710
  [onDraftAvatarChange]
12084
12711
  );
12085
12712
  const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
12086
- return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-8", children: [
12087
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex justify-center", children: [
12088
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12713
+ return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-8", children: [
12714
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex justify-center", children: [
12715
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12089
12716
  "button",
12090
12717
  {
12091
12718
  type: "button",
@@ -12101,17 +12728,17 @@ var AboutTab = ({
12101
12728
  "overflow-hidden"
12102
12729
  ),
12103
12730
  "aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
12104
- children: resolvedPreview ? /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12731
+ children: resolvedPreview ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12105
12732
  RemoteImage,
12106
12733
  {
12107
12734
  src: resolvedPreview,
12108
12735
  alt: labels.onboarding.profileSetup.profilePreviewAlt,
12109
12736
  className: "h-full w-full object-cover"
12110
12737
  }
12111
- ) : /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(ProfileIcon, { className: "h-8 w-8 text-agg-muted-foreground" })
12738
+ ) : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(ProfileIcon, { className: "h-8 w-8 text-agg-muted-foreground" })
12112
12739
  }
12113
12740
  ),
12114
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12741
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12115
12742
  "input",
12116
12743
  {
12117
12744
  ref: fileInputRef,
@@ -12123,8 +12750,8 @@ var AboutTab = ({
12123
12750
  }
12124
12751
  )
12125
12752
  ] }),
12126
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-2", children: [
12127
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12753
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-2", children: [
12754
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12128
12755
  "label",
12129
12756
  {
12130
12757
  htmlFor: "profile-username",
@@ -12132,7 +12759,7 @@ var AboutTab = ({
12132
12759
  children: "Username"
12133
12760
  }
12134
12761
  ),
12135
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12762
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12136
12763
  "input",
12137
12764
  {
12138
12765
  id: "profile-username",
@@ -12154,12 +12781,12 @@ var AboutTab = ({
12154
12781
  }
12155
12782
  )
12156
12783
  ] }),
12157
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-4", children: [
12158
- /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "flex flex-col gap-1", children: [
12159
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Delete your profile" }),
12160
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("span", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: "This will permanently delete your account and all of its data. You will not be able to reactivate this account." })
12784
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-4", children: [
12785
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: "flex flex-col gap-1", children: [
12786
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: "Delete your profile" }),
12787
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: "This will permanently delete your account and all of its data. You will not be able to reactivate this account." })
12161
12788
  ] }),
12162
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
12789
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
12163
12790
  "button",
12164
12791
  {
12165
12792
  type: "button",
@@ -12181,9 +12808,9 @@ var AboutTab = ({
12181
12808
  AboutTab.displayName = "AboutTab";
12182
12809
 
12183
12810
  // src/profile/tabs/accounts-wallets-tab.tsx
12184
- var import_jsx_runtime119 = require("react/jsx-runtime");
12185
- var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
12186
- var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
12811
+ var import_jsx_runtime124 = require("react/jsx-runtime");
12812
+ var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
12813
+ var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12187
12814
  "div",
12188
12815
  {
12189
12816
  className: cn(
@@ -12195,7 +12822,7 @@ var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_run
12195
12822
  children
12196
12823
  }
12197
12824
  );
12198
- var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
12825
+ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12199
12826
  "button",
12200
12827
  {
12201
12828
  type: "button",
@@ -12204,7 +12831,7 @@ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime1
12204
12831
  children: "Connect"
12205
12832
  }
12206
12833
  );
12207
- var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
12834
+ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12208
12835
  "button",
12209
12836
  {
12210
12837
  type: "button",
@@ -12229,19 +12856,19 @@ var AccountsWalletsTab = ({
12229
12856
  const twitter = socialAccounts == null ? void 0 : socialAccounts.twitter;
12230
12857
  const discord = socialAccounts == null ? void 0 : socialAccounts.discord;
12231
12858
  const telegram = socialAccounts == null ? void 0 : socialAccounts.telegram;
12232
- return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-8", children: [
12233
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-3", children: [
12234
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(SectionTitle, { children: "Exchanges" }),
12235
- exchanges.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: "No exchange accounts connected." }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "flex flex-col gap-2", children: exchanges.map((account) => {
12859
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-8", children: [
12860
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3", children: [
12861
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SectionTitle, { children: "Exchanges" }),
12862
+ exchanges.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: "No exchange accounts connected." }) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "flex flex-col gap-2", children: exchanges.map((account) => {
12236
12863
  var _a;
12237
12864
  const displayName = (_a = venueLogoLabels[account.venue]) != null ? _a : account.venue;
12238
- return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(AccountRow, { children: [
12239
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-3 min-w-0", children: [
12240
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VenueLogo, { venue: account.venue, size: "small" }),
12241
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: displayName }),
12242
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
12243
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: account.displayAddress }),
12244
- account.verified ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
12865
+ return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(AccountRow, { children: [
12866
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3 min-w-0", children: [
12867
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(VenueLogo, { venue: account.venue, size: "small" }),
12868
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: displayName }),
12869
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
12870
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: account.displayAddress }),
12871
+ account.verified ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
12245
12872
  Icon,
12246
12873
  {
12247
12874
  name: "check-badge",
@@ -12251,39 +12878,39 @@ var AccountsWalletsTab = ({
12251
12878
  ) : null
12252
12879
  ] })
12253
12880
  ] }),
12254
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DisconnectTextButton, { onClick: () => onDisconnectExchange(account.venue) })
12881
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DisconnectTextButton, { onClick: () => onDisconnectExchange(account.venue) })
12255
12882
  ] }, account.venue);
12256
12883
  }) })
12257
12884
  ] }),
12258
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-3", children: [
12259
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(SectionTitle, { children: "Social Accounts" }),
12260
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-2", children: [
12261
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(AccountRow, { children: [
12262
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-3", children: [
12263
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "twitter", size: "small", color: "currentColor" }) }),
12264
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "X (Twitter)" })
12885
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3", children: [
12886
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SectionTitle, { children: "Social Accounts" }),
12887
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-2", children: [
12888
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(AccountRow, { children: [
12889
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3", children: [
12890
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "twitter", size: "small", color: "currentColor" }) }),
12891
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "X (Twitter)" })
12265
12892
  ] }),
12266
- (twitter == null ? void 0 : twitter.connected) ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DisconnectTextButton, { onClick: onDisconnectTwitter }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ConnectTextButton, { onClick: onConnectTwitter })
12893
+ (twitter == null ? void 0 : twitter.connected) ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DisconnectTextButton, { onClick: onDisconnectTwitter }) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ConnectTextButton, { onClick: onConnectTwitter })
12267
12894
  ] }),
12268
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(AccountRow, { children: [
12269
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-3", children: [
12270
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[#5865F2]", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "discord", size: "small", color: "currentColor" }) }),
12271
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Discord" })
12895
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(AccountRow, { children: [
12896
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3", children: [
12897
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[#5865F2]", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "discord", size: "small", color: "currentColor" }) }),
12898
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Discord" })
12272
12899
  ] }),
12273
- (discord == null ? void 0 : discord.connected) ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DisconnectTextButton, { onClick: onDisconnectDiscord }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ConnectTextButton, { onClick: onConnectDiscord })
12900
+ (discord == null ? void 0 : discord.connected) ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DisconnectTextButton, { onClick: onDisconnectDiscord }) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ConnectTextButton, { onClick: onConnectDiscord })
12274
12901
  ] }),
12275
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(AccountRow, { children: [
12276
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-3", children: [
12277
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[#26A5E4]", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "telegram", size: "small", color: "currentColor" }) }),
12278
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Telegram" })
12902
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(AccountRow, { children: [
12903
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3", children: [
12904
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[#26A5E4]", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "telegram", size: "small", color: "currentColor" }) }),
12905
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: "Telegram" })
12279
12906
  ] }),
12280
- (telegram == null ? void 0 : telegram.connected) ? /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(DisconnectTextButton, { onClick: onDisconnectTelegram }) : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ConnectTextButton, { onClick: onConnectTelegram })
12907
+ (telegram == null ? void 0 : telegram.connected) ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DisconnectTextButton, { onClick: onDisconnectTelegram }) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ConnectTextButton, { onClick: onConnectTelegram })
12281
12908
  ] })
12282
12909
  ] })
12283
12910
  ] }),
12284
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-col gap-3", children: [
12285
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(SectionTitle, { children: "Email Address" }),
12286
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
12911
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex flex-col gap-3", children: [
12912
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SectionTitle, { children: "Email Address" }),
12913
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
12287
12914
  "button",
12288
12915
  {
12289
12916
  type: "button",
@@ -12295,11 +12922,11 @@ var AccountsWalletsTab = ({
12295
12922
  "cursor-pointer hover:bg-agg-secondary-hover"
12296
12923
  ),
12297
12924
  children: [
12298
- /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex items-center gap-3", children: [
12299
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "email", size: "small", color: "currentColor" }) }),
12300
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: email != null ? email : "Connect email" })
12925
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: "flex items-center gap-3", children: [
12926
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-agg-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "email", size: "small", color: "currentColor" }) }),
12927
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "text-agg-base font-agg-normal leading-6 text-agg-foreground whitespace-nowrap", children: email != null ? email : "Connect email" })
12301
12928
  ] }),
12302
- /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
12929
+ /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
12303
12930
  ]
12304
12931
  }
12305
12932
  )
@@ -12309,7 +12936,7 @@ var AccountsWalletsTab = ({
12309
12936
  AccountsWalletsTab.displayName = "AccountsWalletsTab";
12310
12937
 
12311
12938
  // src/profile/index.tsx
12312
- var import_jsx_runtime120 = require("react/jsx-runtime");
12939
+ var import_jsx_runtime125 = require("react/jsx-runtime");
12313
12940
  var ProfileModal = ({
12314
12941
  open,
12315
12942
  onOpenChange,
@@ -12329,15 +12956,15 @@ var ProfileModal = ({
12329
12956
  onDisconnectTelegram,
12330
12957
  onConnectEmail
12331
12958
  }) => {
12332
- const [activeTab, setActiveTab] = (0, import_react30.useState)(PROFILE_TAB_KEYS.ABOUT);
12333
- const [draftUsername, setDraftUsername] = (0, import_react30.useState)(username != null ? username : "");
12334
- const [draftAvatarFile, setDraftAvatarFile] = (0, import_react30.useState)();
12335
- const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react30.useState)();
12336
- const [isSaving, setIsSaving] = (0, import_react30.useState)(false);
12337
- (0, import_react30.useEffect)(() => {
12959
+ const [activeTab, setActiveTab] = (0, import_react33.useState)(PROFILE_TAB_KEYS.ABOUT);
12960
+ const [draftUsername, setDraftUsername] = (0, import_react33.useState)(username != null ? username : "");
12961
+ const [draftAvatarFile, setDraftAvatarFile] = (0, import_react33.useState)();
12962
+ const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react33.useState)();
12963
+ const [isSaving, setIsSaving] = (0, import_react33.useState)(false);
12964
+ (0, import_react33.useEffect)(() => {
12338
12965
  setDraftUsername(username != null ? username : "");
12339
12966
  }, [username]);
12340
- const handleOpenChange = (0, import_react30.useCallback)(
12967
+ const handleOpenChange = (0, import_react33.useCallback)(
12341
12968
  (isOpen) => {
12342
12969
  if (!isOpen) {
12343
12970
  setActiveTab(PROFILE_TAB_KEYS.ABOUT);
@@ -12358,7 +12985,7 @@ var ProfileModal = ({
12358
12985
  setDraftAvatarPreview
12359
12986
  ]
12360
12987
  );
12361
- const handleDraftAvatarChange = (0, import_react30.useCallback)(
12988
+ const handleDraftAvatarChange = (0, import_react33.useCallback)(
12362
12989
  (file, preview) => {
12363
12990
  setDraftAvatarFile(file);
12364
12991
  setDraftAvatarPreview(preview);
@@ -12366,7 +12993,7 @@ var ProfileModal = ({
12366
12993
  []
12367
12994
  );
12368
12995
  const hasChanges = draftUsername !== (username != null ? username : "") || draftAvatarFile !== void 0;
12369
- const handleSave = (0, import_react30.useCallback)(() => {
12996
+ const handleSave = (0, import_react33.useCallback)(() => {
12370
12997
  setIsSaving(true);
12371
12998
  onSave({
12372
12999
  username: draftUsername || void 0,
@@ -12378,16 +13005,16 @@ var ProfileModal = ({
12378
13005
  onOpenChange(false);
12379
13006
  }, 500);
12380
13007
  }, [draftUsername, draftAvatarFile, draftAvatarPreview, onSave, onOpenChange]);
12381
- const handleCancel = (0, import_react30.useCallback)(() => {
13008
+ const handleCancel = (0, import_react33.useCallback)(() => {
12382
13009
  handleOpenChange(false);
12383
13010
  }, [handleOpenChange]);
12384
- return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(Modal.Container, { maxWidth: "800px", "aria-label": "Edit Profile", children: [
12385
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Modal.Header, { title: "Edit Profile" }),
12386
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Modal.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "flex flex-col sm:flex-row sm:gap-10", children: [
12387
- /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "shrink-0", children: [
12388
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "flex gap-2 sm:hidden mb-6", children: PROFILE_TAB_ITEMS.map((tab) => {
13011
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Modal.Container, { maxWidth: "800px", "aria-label": "Edit Profile", children: [
13012
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal.Header, { title: "Edit Profile" }),
13013
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Modal.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "flex flex-col sm:flex-row sm:gap-10", children: [
13014
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "shrink-0", children: [
13015
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "flex gap-2 sm:hidden mb-6", children: PROFILE_TAB_ITEMS.map((tab) => {
12389
13016
  const isActive = activeTab === tab.value;
12390
- return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
13017
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
12391
13018
  "button",
12392
13019
  {
12393
13020
  type: "button",
@@ -12400,14 +13027,14 @@ var ProfileModal = ({
12400
13027
  isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover border-agg-primary" : "font-agg-normal text-agg-foreground border-transparent"
12401
13028
  ),
12402
13029
  children: [
12403
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
12404
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "whitespace-nowrap", children: tab.label })
13030
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
13031
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "whitespace-nowrap", children: tab.label })
12405
13032
  ]
12406
13033
  },
12407
13034
  tab.value
12408
13035
  );
12409
13036
  }) }),
12410
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
13037
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
12411
13038
  "nav",
12412
13039
  {
12413
13040
  className: cn(
@@ -12422,7 +13049,7 @@ var ProfileModal = ({
12422
13049
  "aria-label": "Profile sections",
12423
13050
  children: PROFILE_TAB_ITEMS.map((tab) => {
12424
13051
  const isActive = activeTab === tab.value;
12425
- return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(
13052
+ return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
12426
13053
  "button",
12427
13054
  {
12428
13055
  type: "button",
@@ -12437,9 +13064,9 @@ var ProfileModal = ({
12437
13064
  isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
12438
13065
  ),
12439
13066
  children: [
12440
- isActive ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
12441
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
12442
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
13067
+ isActive ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
13068
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
13069
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
12443
13070
  ]
12444
13071
  },
12445
13072
  tab.value
@@ -12448,8 +13075,8 @@ var ProfileModal = ({
12448
13075
  }
12449
13076
  )
12450
13077
  ] }),
12451
- /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "min-w-0 flex-1", children: [
12452
- activeTab === PROFILE_TAB_KEYS.ABOUT ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
13078
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { className: "min-w-0 flex-1", children: [
13079
+ activeTab === PROFILE_TAB_KEYS.ABOUT ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
12453
13080
  AboutTab,
12454
13081
  {
12455
13082
  username,
@@ -12462,7 +13089,7 @@ var ProfileModal = ({
12462
13089
  draftAvatarPreview
12463
13090
  }
12464
13091
  ) : null,
12465
- activeTab === PROFILE_TAB_KEYS.ACCOUNTS_WALLETS ? /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
13092
+ activeTab === PROFILE_TAB_KEYS.ACCOUNTS_WALLETS ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
12466
13093
  AccountsWalletsTab,
12467
13094
  {
12468
13095
  exchanges,
@@ -12480,9 +13107,9 @@ var ProfileModal = ({
12480
13107
  ) : null
12481
13108
  ] })
12482
13109
  ] }) }),
12483
- /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(Modal.Footer, { children: [
12484
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
12485
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
13110
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Modal.Footer, { children: [
13111
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
13112
+ /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
12486
13113
  Button,
12487
13114
  {
12488
13115
  variant: "primary",
@@ -12621,9 +13248,11 @@ var placeOrderViewModelSchema = import_zod3.z.object({
12621
13248
  LinkAccountsIcon,
12622
13249
  LoadingIcon,
12623
13250
  MarketDetails,
13251
+ MarketDetailsList,
12624
13252
  Modal,
12625
13253
  NumberValue,
12626
13254
  OnboardingModal,
13255
+ OnrampModal,
12627
13256
  PencilIcon,
12628
13257
  PlaceOrder,
12629
13258
  PlaySquareIcon,