@agg-build/ui 2.7.3 → 2.8.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 (42) hide show
  1. package/dist/{chunk-MZBYIXYA.mjs → chunk-2QCNDFNC.mjs} +193 -103
  2. package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
  3. package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
  4. package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
  5. package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
  6. package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
  7. package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
  8. package/dist/events.js +168 -91
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +1315 -746
  11. package/dist/index.mjs +7 -7
  12. package/dist/modals.js +941 -418
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +978 -609
  15. package/dist/pages.mjs +6 -6
  16. package/dist/primitives.js +94 -26
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1403 -902
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
  23. package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
  24. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  25. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  26. package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
  27. package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
  28. package/dist/types/primitives/select/index.d.mts +1 -1
  29. package/dist/types/primitives/select/index.d.ts +1 -1
  30. package/dist/types/primitives/select/select.types.d.mts +8 -0
  31. package/dist/types/primitives/select/select.types.d.ts +8 -0
  32. package/dist/types/profile/profile-modal.constants.d.mts +2 -1
  33. package/dist/types/profile/profile-modal.constants.d.ts +2 -1
  34. package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
  35. package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
  36. package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
  37. package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
  38. package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
  39. package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
  40. package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
  41. package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
  42. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -8776,7 +8776,11 @@ var Select = ({
8776
8776
  triggerClassName,
8777
8777
  contentClassName,
8778
8778
  itemClassName,
8779
- disabled = SELECT_DEFAULT_IS_DISABLED
8779
+ disabled = SELECT_DEFAULT_IS_DISABLED,
8780
+ variant = "default",
8781
+ openOnHover = false,
8782
+ contentAlign = "start",
8783
+ contentSideOffset = 8
8780
8784
  }) => {
8781
8785
  var _a;
8782
8786
  const labels = (0, import_hooks32.useLabels)();
@@ -8787,17 +8791,30 @@ var Select = ({
8787
8791
  const isDisabled = resolveIsSelectDisabled({ disabled, items });
8788
8792
  const selectedItem = resolveSelectedItem(items, value);
8789
8793
  const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
8790
- const [menuRect, setMenuRect] = (0, import_react11.useState)(
8791
- null
8792
- );
8794
+ const [menuRect, setMenuRect] = (0, import_react11.useState)(null);
8793
8795
  const containerRef = (0, import_react11.useRef)(null);
8794
8796
  const portalRef = (0, import_react11.useRef)(null);
8795
- const handleClose = (0, import_react11.useCallback)(() => setIsOpen(false), []);
8797
+ const closeTimerRef = (0, import_react11.useRef)(null);
8798
+ const openedByHoverRef = (0, import_react11.useRef)(false);
8799
+ const handleClose = (0, import_react11.useCallback)(() => {
8800
+ setIsOpen(false);
8801
+ openedByHoverRef.current = false;
8802
+ }, []);
8796
8803
  const updateMenuRect = (0, import_react11.useCallback)(() => {
8797
8804
  const el = containerRef.current;
8798
8805
  if (!el) return;
8799
8806
  const r = el.getBoundingClientRect();
8800
- setMenuRect({ top: r.bottom + 8, left: r.left, width: r.width });
8807
+ setMenuRect({
8808
+ top: r.bottom + contentSideOffset,
8809
+ left: r.left,
8810
+ right: r.right,
8811
+ width: r.width
8812
+ });
8813
+ }, [contentSideOffset]);
8814
+ (0, import_react11.useEffect)(() => {
8815
+ return () => {
8816
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8817
+ };
8801
8818
  }, []);
8802
8819
  (0, import_react11.useLayoutEffect)(() => {
8803
8820
  if (!isOpen) {
@@ -8835,7 +8852,33 @@ var Select = ({
8835
8852
  document.addEventListener("keydown", handleKeyDown);
8836
8853
  return () => document.removeEventListener("keydown", handleKeyDown);
8837
8854
  }, [isOpen, handleClose]);
8838
- const triggerRadiusClass = triggerClassName != null ? triggerClassName : "rounded-agg-md";
8855
+ const handlePointerEnter = (event) => {
8856
+ if (!openOnHover || isDisabled || event.pointerType === "touch") return;
8857
+ if (closeTimerRef.current) {
8858
+ clearTimeout(closeTimerRef.current);
8859
+ closeTimerRef.current = null;
8860
+ }
8861
+ if (isOpen) return;
8862
+ openedByHoverRef.current = true;
8863
+ setIsOpen(true);
8864
+ };
8865
+ const handlePointerLeave = (event) => {
8866
+ if (!openOnHover || event.pointerType === "touch") return;
8867
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
8868
+ closeTimerRef.current = setTimeout(() => {
8869
+ handleClose();
8870
+ closeTimerRef.current = null;
8871
+ }, 120);
8872
+ };
8873
+ const handleTriggerClick = () => {
8874
+ if (openedByHoverRef.current && isOpen) {
8875
+ openedByHoverRef.current = false;
8876
+ return;
8877
+ }
8878
+ setIsOpen((previousValue) => !previousValue);
8879
+ };
8880
+ const isInline = variant === "inline";
8881
+ const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
8839
8882
  const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8840
8883
  "div",
8841
8884
  {
@@ -8846,16 +8889,20 @@ var Select = ({
8846
8889
  style: {
8847
8890
  position: "fixed",
8848
8891
  top: menuRect.top,
8849
- left: menuRect.left,
8892
+ left: contentAlign === "start" ? menuRect.left : void 0,
8893
+ right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
8850
8894
  width: menuRect.width,
8851
8895
  zIndex: SELECT_DROPDOWN_Z
8852
8896
  },
8853
8897
  className: cn(
8854
8898
  AGG_ROOT_CLASS_NAME,
8855
8899
  rootClassName,
8856
- "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto rounded-[12px] border border-agg-separator bg-agg-secondary p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)] flex flex-col gap-1",
8900
+ "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto border border-agg-separator bg-agg-secondary flex flex-col",
8901
+ isInline ? "min-w-[120px] gap-0 rounded-agg-lg py-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]" : "gap-1 rounded-[12px] p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]",
8857
8902
  contentClassName
8858
8903
  ),
8904
+ onPointerEnter: handlePointerEnter,
8905
+ onPointerLeave: handlePointerLeave,
8859
8906
  children: items.map((item) => {
8860
8907
  const isSelected = item.value === value;
8861
8908
  const isHidden = item.hidden === true;
@@ -8869,9 +8916,10 @@ var Select = ({
8869
8916
  disabled: item.disabled,
8870
8917
  className: cn(
8871
8918
  "agg-select-item",
8872
- "relative flex w-full items-center gap-3 rounded-[6px] pl-3 pr-5 py-3 text-left text-agg-sm leading-agg-5 outline-none",
8919
+ "relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
8920
+ isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
8873
8921
  "hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
8874
- isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8922
+ isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
8875
8923
  item.disabled && "cursor-not-allowed opacity-60",
8876
8924
  itemClassName
8877
8925
  ),
@@ -8883,6 +8931,13 @@ var Select = ({
8883
8931
  handleClose();
8884
8932
  },
8885
8933
  children: [
8934
+ isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8935
+ "span",
8936
+ {
8937
+ className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
8938
+ "aria-hidden": true
8939
+ }
8940
+ ) : null,
8886
8941
  item.icon ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8887
8942
  "span",
8888
8943
  {
@@ -8912,7 +8967,11 @@ var Select = ({
8912
8967
  "div",
8913
8968
  {
8914
8969
  ref: containerRef,
8915
- className: cn("group/agg-select", "relative inline-flex w-full", className),
8970
+ className: cn(
8971
+ "group/agg-select relative inline-flex",
8972
+ isInline ? "w-auto" : "w-full",
8973
+ className
8974
+ ),
8916
8975
  children: [
8917
8976
  /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
8918
8977
  "button",
@@ -8924,19 +8983,19 @@ var Select = ({
8924
8983
  disabled: isDisabled,
8925
8984
  className: cn(
8926
8985
  "agg-select-trigger",
8927
- "flex h-10 w-full items-center gap-2 rounded-[8px] border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
8928
- "flex items-center gap-2 text-left",
8986
+ "flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
8987
+ isInline ? "h-auto w-auto bg-transparent px-2 py-1 pr-8 text-left text-agg-base leading-agg-6" : "h-10 w-full border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 text-left text-agg-sm leading-agg-5",
8929
8988
  triggerRadiusClass,
8930
- getMotionClassName(
8989
+ !isInline && getMotionClassName(
8931
8990
  enableAnimations,
8932
8991
  "transition-[border-color,box-shadow] duration-200 ease-in-out"
8933
8992
  ),
8934
- isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8935
- "hover:border-agg-primary",
8936
- "focus:border-agg-primary focus:ring-0",
8937
- "disabled:cursor-not-allowed disabled:opacity-60"
8993
+ !isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
8994
+ !isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
8938
8995
  ),
8939
- onClick: () => setIsOpen((previousValue) => !previousValue),
8996
+ onClick: handleTriggerClick,
8997
+ onPointerEnter: handlePointerEnter,
8998
+ onPointerLeave: handlePointerLeave,
8940
8999
  children: [
8941
9000
  (selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "h-4 w-4 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: selectedItem.icon }) : (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8942
9001
  RemoteImage,
@@ -8950,14 +9009,23 @@ var Select = ({
8950
9009
  ]
8951
9010
  }
8952
9011
  ),
8953
- /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "agg-select-chevron pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
8954
- Icon,
9012
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
9013
+ "span",
8955
9014
  {
8956
- name: isOpen ? "chevron-up" : "chevron-down-thin",
8957
- size: "small",
8958
- color: "currentColor"
9015
+ className: cn(
9016
+ "agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
9017
+ isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
9018
+ ),
9019
+ children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
9020
+ Icon,
9021
+ {
9022
+ name: isOpen ? "chevron-up" : "chevron-down-thin",
9023
+ size: "small",
9024
+ color: "currentColor"
9025
+ }
9026
+ )
8959
9027
  }
8960
- ) }),
9028
+ ),
8961
9029
  isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
8962
9030
  ]
8963
9031
  }
@@ -12698,8 +12766,9 @@ var isOrderBookRow = (v) => (0, import_sdk13.hasShape)(v, {
12698
12766
  total: (t) => typeof t === "number" && t >= 0,
12699
12767
  tone: (x) => x === "positive" || x === "negative"
12700
12768
  });
12701
- var formatProbabilityCents = (value) => {
12769
+ var formatProbabilityCents = (value, formatPrice) => {
12702
12770
  if (value == null) return "-";
12771
+ if (formatPrice) return formatPrice(value);
12703
12772
  const cents = (value * 100).toFixed(1).replace(/\.0$/, "");
12704
12773
  return `${cents}\xA2`;
12705
12774
  };
@@ -15000,7 +15069,7 @@ var EventListItemDetailsGraphSection = ({
15000
15069
  }, [chartOutcomeLabel, (_d = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _d.label]);
15001
15070
  const {
15002
15071
  chart: { selectedChartTimeRange },
15003
- formatting: { formatPercent },
15072
+ formatting: { formatPercent, formatPrice },
15004
15073
  general: { theme }
15005
15074
  } = (0, import_hooks48.useSdkUiConfig)();
15006
15075
  const isDarkTheme = theme === "dark";
@@ -15275,8 +15344,8 @@ var EventListItemDetailsGraphSection = ({
15275
15344
  });
15276
15345
  return {
15277
15346
  value: outcome.id,
15278
- label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
15279
- ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
15347
+ label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
15348
+ ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
15280
15349
  };
15281
15350
  })
15282
15351
  }
@@ -15698,7 +15767,7 @@ var EventListItemDetails = (props) => {
15698
15767
  EventListItemDetails.displayName = "EventListItemDetails";
15699
15768
 
15700
15769
  // src/events/market-details/index.tsx
15701
- var import_hooks51 = require("@agg-build/hooks");
15770
+ var import_hooks52 = require("@agg-build/hooks");
15702
15771
  var import_react28 = require("react");
15703
15772
 
15704
15773
  // src/events/orderbook/index.tsx
@@ -15946,6 +16015,7 @@ var OrderbookRow = ({
15946
16015
  entry,
15947
16016
  formatNumber,
15948
16017
  formatCurrency: formatCurrency2,
16018
+ formatPrice,
15949
16019
  enableAnimations,
15950
16020
  showBadge,
15951
16021
  badgeLabel
@@ -16014,7 +16084,7 @@ var OrderbookRow = ({
16014
16084
  "w-9 min-w-9 md:min-w-10 md:w-10 text-agg-sm font-agg-bold leading-agg-5",
16015
16085
  priceClassName
16016
16086
  ),
16017
- children: formatProbabilityCents(entry.row.price)
16087
+ children: formatProbabilityCents(entry.row.price, formatPrice)
16018
16088
  }
16019
16089
  ),
16020
16090
  /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(OrderbookVenueLogos, { venues })
@@ -16036,7 +16106,10 @@ var Orderbook = ({
16036
16106
  className
16037
16107
  }) => {
16038
16108
  var _a, _b, _c, _d, _e;
16039
- const { enableWebsocketsLogs } = (0, import_hooks49.useAggUiConfig)();
16109
+ const {
16110
+ enableWebsocketsLogs,
16111
+ formatting: { formatPrice }
16112
+ } = (0, import_hooks49.useAggUiConfig)();
16040
16113
  const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
16041
16114
  const scrollContainerRef = (0, import_react26.useRef)(null);
16042
16115
  const spreadRowRef = (0, import_react26.useRef)(null);
@@ -16101,6 +16174,7 @@ var Orderbook = ({
16101
16174
  entry,
16102
16175
  formatNumber,
16103
16176
  formatCurrency: formatCurrency2,
16177
+ formatPrice,
16104
16178
  enableAnimations,
16105
16179
  showBadge: index === askEntries.length - 1,
16106
16180
  badgeLabel: labels.asks
@@ -16113,7 +16187,7 @@ var Orderbook = ({
16113
16187
  ref: spreadRowRef,
16114
16188
  className: "agg-orderbook-spread flex items-center border-y border-agg-separator h-9 px-5 py-2 gap-3 md:gap-10",
16115
16189
  role: "separator",
16116
- "aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
16190
+ "aria-label": `${labels.midPrice}: ${formatProbabilityCents((_b = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _b : null, formatPrice)}, ${labels.spread}: ${formatProbabilityCents((_c = spreadEntry == null ? void 0 : spreadEntry.spread) != null ? _c : null)}`,
16117
16191
  children: [
16118
16192
  /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
16119
16193
  Typography,
@@ -16123,7 +16197,7 @@ var Orderbook = ({
16123
16197
  children: [
16124
16198
  "Last: ",
16125
16199
  labels.lastOutcome ? `${labels.lastOutcome} ` : "",
16126
- formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null)
16200
+ formatProbabilityCents((_d = spreadEntry == null ? void 0 : spreadEntry.midPrice) != null ? _d : null, formatPrice)
16127
16201
  ]
16128
16202
  }
16129
16203
  ),
@@ -16150,6 +16224,7 @@ var Orderbook = ({
16150
16224
  entry,
16151
16225
  formatNumber,
16152
16226
  formatCurrency: formatCurrency2,
16227
+ formatPrice,
16153
16228
  enableAnimations,
16154
16229
  showBadge: index === 0,
16155
16230
  badgeLabel: labels.bids
@@ -16345,6 +16420,7 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
16345
16420
  };
16346
16421
 
16347
16422
  // src/events/market-details/market-details-outcome-button.tsx
16423
+ var import_hooks50 = require("@agg-build/hooks");
16348
16424
  var import_jsx_runtime149 = require("react/jsx-runtime");
16349
16425
  var marketDetailsOutcomeButtonToneClasses = {
16350
16426
  positive: {
@@ -16395,6 +16471,7 @@ var OutcomePriceContent = ({
16395
16471
  value,
16396
16472
  textClassName
16397
16473
  }) => {
16474
+ const { formatPrice } = (0, import_hooks50.useAggUiConfig)().formatting;
16398
16475
  if (isLoading) {
16399
16476
  return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
16400
16477
  "span",
@@ -16413,7 +16490,7 @@ var OutcomePriceContent = ({
16413
16490
  as: "span",
16414
16491
  variant: isSelected ? "body-strong" : "body",
16415
16492
  className: cn("shrink-0 whitespace-nowrap", textClassName),
16416
- children: formatProbabilityCents(value)
16493
+ children: formatProbabilityCents(value, formatPrice)
16417
16494
  }
16418
16495
  );
16419
16496
  };
@@ -16507,7 +16584,7 @@ var MarketDetailsOutcomeButton = ({
16507
16584
  MarketDetailsOutcomeButton.displayName = "MarketDetailsOutcomeButton";
16508
16585
 
16509
16586
  // src/events/market-details/market-details-graph-panel.tsx
16510
- var import_hooks50 = require("@agg-build/hooks");
16587
+ var import_hooks51 = require("@agg-build/hooks");
16511
16588
  var import_react27 = require("react");
16512
16589
  var import_jsx_runtime150 = require("react/jsx-runtime");
16513
16590
  var MarketDetailsGraphPanel = ({
@@ -16524,13 +16601,13 @@ var MarketDetailsGraphPanel = ({
16524
16601
  classNames
16525
16602
  }) => {
16526
16603
  var _a, _b, _c;
16527
- const config = (0, import_hooks50.useSdkUiConfig)();
16604
+ const config = (0, import_hooks51.useSdkUiConfig)();
16528
16605
  const {
16529
- formatting: { formatPercent, formatCompactCurrency },
16606
+ formatting: { formatPercent, formatCompactCurrency, formatPrice },
16530
16607
  general: { theme }
16531
16608
  } = config;
16532
16609
  const isDarkTheme = theme === "dark";
16533
- const labels = (0, import_hooks50.useLabels)();
16610
+ const labels = (0, import_hooks51.useLabels)();
16534
16611
  const selectedTimeRange = config.chart.selectedChartTimeRange;
16535
16612
  const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
16536
16613
  const [chartRangeOverride, setChartRangeOverride] = (0, import_react27.useState)(null);
@@ -16550,7 +16627,7 @@ var MarketDetailsGraphPanel = ({
16550
16627
  livePrices
16551
16628
  });
16552
16629
  }, [livePrices, venueMarkets, resolvedChartOutcomeLabel, chartSelectedOutcomeId]);
16553
- const rollingWindow = (0, import_hooks50.useRollingChartWindow)({ range: effectiveChartTimeRange });
16630
+ const rollingWindow = (0, import_hooks51.useRollingChartWindow)({ range: effectiveChartTimeRange });
16554
16631
  const chartPrimaryOutcomeId = (_b = (_a = chartOutcomesByVenue[0]) == null ? void 0 : _a.outcome.id) != null ? _b : null;
16555
16632
  const chartVenueOutcomeIds = (0, import_react27.useMemo)(() => {
16556
16633
  return chartOutcomesByVenue.map((item) => item.outcome.id);
@@ -16560,7 +16637,7 @@ var MarketDetailsGraphPanel = ({
16560
16637
  isLoading: isMarketChartLoading,
16561
16638
  error: marketChartError,
16562
16639
  refetch: refetchMarketChart
16563
- } = (0, import_hooks50.useMarketChart)({
16640
+ } = (0, import_hooks51.useMarketChart)({
16564
16641
  marketId: chartPrimaryOutcomeId,
16565
16642
  venueMarketIds: chartVenueOutcomeIds,
16566
16643
  interval: rollingWindow.interval,
@@ -16740,8 +16817,8 @@ var MarketDetailsGraphPanel = ({
16740
16817
  const price = outcome.probability;
16741
16818
  return {
16742
16819
  value: outcome.id,
16743
- label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price)}`,
16744
- ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price)}`
16820
+ label: `${(_a3 = outcome == null ? void 0 : outcome.title) != null ? _a3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
16821
+ ariaLabel: `${(_b3 = outcome == null ? void 0 : outcome.title) != null ? _b3 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`
16745
16822
  };
16746
16823
  })
16747
16824
  }
@@ -16770,7 +16847,7 @@ var MarketDetailsGraphPanel = ({
16770
16847
  }
16771
16848
  ),
16772
16849
  /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", { "aria-hidden": "true", className: "hidden h-4 w-px bg-agg-separator md:block" }),
16773
- import_hooks50.CHART_TIME_RANGES.map((timeRange) => {
16850
+ import_hooks51.CHART_TIME_RANGES.map((timeRange) => {
16774
16851
  const isActive = effectiveChartTimeRange === timeRange;
16775
16852
  const isDisabled = isResolvedMarket && timeRange !== "ALL";
16776
16853
  return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
@@ -16813,7 +16890,7 @@ var MarketDetailsUnavailableState = ({
16813
16890
  ariaLabel,
16814
16891
  classNames
16815
16892
  }) => {
16816
- const labels = (0, import_hooks51.useLabels)();
16893
+ const labels = (0, import_hooks52.useLabels)();
16817
16894
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16818
16895
  Card,
16819
16896
  {
@@ -16837,7 +16914,7 @@ var MarketDetailsNotFoundState = ({
16837
16914
  ariaLabel: _ariaLabel,
16838
16915
  classNames: _classNames
16839
16916
  }) => {
16840
- const labels = (0, import_hooks51.useLabels)();
16917
+ const labels = (0, import_hooks52.useLabels)();
16841
16918
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16842
16919
  StateMessage,
16843
16920
  {
@@ -16875,33 +16952,33 @@ var MarketDetailsContent = ({
16875
16952
  midpointsResult
16876
16953
  }) => {
16877
16954
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
16878
- const config = (0, import_hooks51.useSdkUiConfig)();
16955
+ const config = (0, import_hooks52.useSdkUiConfig)();
16879
16956
  const {
16880
16957
  features: { enableAnimations },
16881
16958
  formatting: { formatPercent }
16882
16959
  } = config;
16883
- const labels = (0, import_hooks51.useLabels)();
16884
- const tradingContext = (0, import_hooks51.useEventTradingContext)();
16960
+ const labels = (0, import_hooks52.useLabels)();
16961
+ const tradingContext = (0, import_hooks52.useEventTradingContext)();
16885
16962
  const detailsContentId = (0, import_react28.useId)();
16886
16963
  const tradeSide = (_a = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a : "buy";
16887
16964
  const resolvedMarket = (0, import_react28.useMemo)(() => {
16888
16965
  return resolveMarketFromVenueMarkets(venueMarkets, marketId);
16889
16966
  }, [venueMarkets, marketId]);
16890
16967
  const clusterVenueMarkets = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets;
16891
- const wsLivePrices = (0, import_hooks51.useLiveOutcomePrices)(clusterVenueMarkets);
16892
- const wsBestPrices = (0, import_hooks51.useLiveBestPrices)(clusterVenueMarkets);
16893
- const wsBestCandidates = (0, import_hooks51.useLiveBestPriceCandidates)(clusterVenueMarkets);
16968
+ const wsLivePrices = (0, import_hooks52.useLiveOutcomePrices)(clusterVenueMarkets);
16969
+ const wsBestPrices = (0, import_hooks52.useLiveBestPrices)(clusterVenueMarkets);
16970
+ const wsBestCandidates = (0, import_hooks52.useLiveBestPriceCandidates)(clusterVenueMarkets);
16894
16971
  const scopedResolvedMarket = (0, import_react28.useMemo)(() => {
16895
16972
  var _a2, _b2;
16896
16973
  if (!resolvedMarket) return null;
16897
16974
  return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
16898
16975
  }, [resolvedMarket]);
16899
- const isResolvedMarket = (0, import_hooks51.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
16900
- (0, import_hooks51.useEventOrderbookData)(
16976
+ const isResolvedMarket = (0, import_hooks52.resolveMarketTradingState)(scopedResolvedMarket).kind === "resolved";
16977
+ (0, import_hooks52.useEventOrderbookData)(
16901
16978
  isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
16902
16979
  (_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
16903
16980
  );
16904
- const fetchedClusterMidpointResult = (0, import_hooks51.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
16981
+ const fetchedClusterMidpointResult = (0, import_hooks52.useMidpoints)(midpointsResult ? [] : clusterVenueMarkets);
16905
16982
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
16906
16983
  const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
16907
16984
  const clusterBestMidpointsByOutcomeId = clusterMidpoints;
@@ -16910,7 +16987,7 @@ var MarketDetailsContent = ({
16910
16987
  const clusterBestMidpointVenue = clusterMidpointResult.bestMidpointVenue;
16911
16988
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
16912
16989
  const clusterBestPrices = (0, import_react28.useMemo)(
16913
- () => (0, import_hooks51.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
16990
+ () => (0, import_hooks52.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
16914
16991
  [clusterBestPricesRest, wsBestPrices]
16915
16992
  );
16916
16993
  const clusterBestPriceVenuesByOutcomeId = clusterMidpointResult.bestPriceVenuesByOutcomeId;
@@ -16965,7 +17042,7 @@ var MarketDetailsContent = ({
16965
17042
  return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
16966
17043
  }, [model]);
16967
17044
  const marketTradingState = (0, import_react28.useMemo)(() => {
16968
- return (0, import_hooks51.resolveMarketTradingState)(scopedMarketForCard);
17045
+ return (0, import_hooks52.resolveMarketTradingState)(scopedMarketForCard);
16969
17046
  }, [scopedMarketForCard]);
16970
17047
  const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
16971
17048
  const isUpcomingMarket = marketTradingState.kind === "unopened";
@@ -17126,7 +17203,7 @@ var MarketDetailsContent = ({
17126
17203
  fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
17127
17204
  });
17128
17205
  if (referencePrice != null) return referencePrice;
17129
- return (0, import_hooks51.findLivePriceById)(wsLivePrices, displayOutcome.id);
17206
+ return (0, import_hooks52.findLivePriceById)(wsLivePrices, displayOutcome.id);
17130
17207
  }, [
17131
17208
  clusterBestMidpoint,
17132
17209
  clusterBestMidpointsByOutcomeId,
@@ -17152,7 +17229,7 @@ var MarketDetailsContent = ({
17152
17229
  const orderBookEnabled = isOpened && effectiveSelectedTab === "order-book" && !marketTradingState.isTradingDisabled;
17153
17230
  const primaryVenueMarketId = (_g = (_f = selectedOutcomesByVenue[0]) == null ? void 0 : _f.market.id) != null ? _g : null;
17154
17231
  const primaryOutcomeId = (_i = (_h = selectedOutcomesByVenue[0]) == null ? void 0 : _h.outcome.id) != null ? _i : null;
17155
- const marketOrderbookResult = (0, import_hooks51.useMarketOrderbook)({
17232
+ const marketOrderbookResult = (0, import_hooks52.useMarketOrderbook)({
17156
17233
  marketId: primaryVenueMarketId,
17157
17234
  enabled: orderBookEnabled && !!primaryVenueMarketId,
17158
17235
  venueOutcomes: selectedOutcomesByVenue.map((item) => ({
@@ -17333,7 +17410,7 @@ var MarketDetailsContent = ({
17333
17410
  !compactHeader ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17334
17411
  RemoteImage,
17335
17412
  {
17336
- src: (0, import_hooks51.optimizedImageUrl)(model.image, 60),
17413
+ src: (0, import_hooks52.optimizedImageUrl)(model.image, 60),
17337
17414
  alt: "",
17338
17415
  className: "agg-market-image size-12 rounded-agg-lg object-cover md:size-[60px]"
17339
17416
  }
@@ -17584,7 +17661,7 @@ var MarketDetailsContent = ({
17584
17661
  };
17585
17662
  var MarketDetails = (_a) => {
17586
17663
  var _b = _a, { isOpened } = _b, props = __objRest(_b, ["isOpened"]);
17587
- const labels = (0, import_hooks51.useLabels)();
17664
+ const labels = (0, import_hooks52.useLabels)();
17588
17665
  if (props.isLoading) {
17589
17666
  return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
17590
17667
  Skeleton,
@@ -17639,13 +17716,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
17639
17716
  return eventTradingState.kind === "resolved";
17640
17717
  }
17641
17718
  if (sourceMarkets.length === 0) return false;
17642
- return sourceMarkets.every((market) => (0, import_hooks51.resolveMarketTradingState)(market).kind === "resolved");
17719
+ return sourceMarkets.every((market) => (0, import_hooks52.resolveMarketTradingState)(market).kind === "resolved");
17643
17720
  };
17644
17721
  var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
17645
17722
  var _a, _b, _c, _d, _e;
17646
17723
  const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
17647
17724
  if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
17648
- if ((0, import_hooks51.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
17725
+ if ((0, import_hooks52.resolveMarketTradingState)(preferredMarket).kind === "resolved") {
17649
17726
  return preferredMarket.id;
17650
17727
  }
17651
17728
  }
@@ -17665,8 +17742,8 @@ var MarketDetailsList = ({
17665
17742
  midpointsResult
17666
17743
  }) => {
17667
17744
  var _a, _b;
17668
- const labels = (0, import_hooks51.useLabels)();
17669
- const tradingContext = (0, import_hooks51.useEventTradingContext)();
17745
+ const labels = (0, import_hooks52.useLabels)();
17746
+ const tradingContext = (0, import_hooks52.useEventTradingContext)();
17670
17747
  const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
17671
17748
  const [expandedMarketId, setExpandedMarketId] = (0, import_react28.useState)(null);
17672
17749
  const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = (0, import_react28.useState)(false);
@@ -17675,10 +17752,10 @@ var MarketDetailsList = ({
17675
17752
  markets: rawMarkets,
17676
17753
  isLoading,
17677
17754
  error
17678
- } = (0, import_hooks51.useVenueMarkets)({
17755
+ } = (0, import_hooks52.useVenueMarkets)({
17679
17756
  venueEventId: resolvedEventId,
17680
17757
  enabled: !providedMarkets && !!resolvedEventId,
17681
- status: import_hooks51.MarketStatus.open,
17758
+ status: import_hooks52.MarketStatus.open,
17682
17759
  // Keep in lockstep with useEnrichedVenueEvent: limit is part of the React
17683
17760
  // Query key, so a mismatch would fork the shared cache into two requests.
17684
17761
  // fetchAll drains every page — events can exceed any single-page limit
@@ -17722,7 +17799,7 @@ var MarketDetailsList = ({
17722
17799
  const resolved = [];
17723
17800
  const closed = [];
17724
17801
  sourceMarkets.forEach((market) => {
17725
- const marketStateKind = (0, import_hooks51.resolveMarketTradingState)(market).kind;
17802
+ const marketStateKind = (0, import_hooks52.resolveMarketTradingState)(market).kind;
17726
17803
  if (marketStateKind === "resolved") {
17727
17804
  resolved.push(market);
17728
17805
  return;
@@ -17750,10 +17827,10 @@ var MarketDetailsList = ({
17750
17827
  const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
17751
17828
  const midpointEligibleMarkets = (0, import_react28.useMemo)(() => {
17752
17829
  return displayedMarkets.filter(
17753
- (market) => (0, import_hooks51.resolveMarketTradingState)(market).kind !== "resolved"
17830
+ (market) => (0, import_hooks52.resolveMarketTradingState)(market).kind !== "resolved"
17754
17831
  );
17755
17832
  }, [displayedMarkets]);
17756
- const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks51.useViewportMidpoints)(midpointEligibleMarkets);
17833
+ const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks52.useViewportMidpoints)(midpointEligibleMarkets);
17757
17834
  (0, import_react28.useEffect)(() => {
17758
17835
  if (isResolvedEvent) {
17759
17836
  setAreResolvedMarketsVisible(false);
@@ -17772,7 +17849,7 @@ var MarketDetailsList = ({
17772
17849
  return;
17773
17850
  }
17774
17851
  const fallbackSelectableMarket = displayedMarkets.find(
17775
- (market) => !(0, import_hooks51.resolveMarketTradingState)(market).isTradingDisabled
17852
+ (market) => !(0, import_hooks52.resolveMarketTradingState)(market).isTradingDisabled
17776
17853
  );
17777
17854
  if (!fallbackSelectableMarket) {
17778
17855
  return;
@@ -17794,7 +17871,7 @@ var MarketDetailsList = ({
17794
17871
  setExpandedMarketId(marketId);
17795
17872
  onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
17796
17873
  if (marketId === selectedMarketId) return;
17797
- if ((0, import_hooks51.resolveMarketTradingState)(market).isTradingDisabled) return;
17874
+ if ((0, import_hooks52.resolveMarketTradingState)(market).isTradingDisabled) return;
17798
17875
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
17799
17876
  };
17800
17877
  if (!hasPrefetchedMarkets && isLoading) {
@@ -17887,7 +17964,7 @@ var MarketDetailsList = ({
17887
17964
  MarketDetailsList.displayName = "MarketDetailsList";
17888
17965
 
17889
17966
  // src/events/list/index.tsx
17890
- var import_hooks53 = require("@agg-build/hooks");
17967
+ var import_hooks54 = require("@agg-build/hooks");
17891
17968
  var import_sdk17 = require("@agg-build/sdk");
17892
17969
  var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
17893
17970
  var import_react31 = require("react");
@@ -18010,7 +18087,7 @@ var CategorySidebar = ({
18010
18087
  CategorySidebar.displayName = "CategorySidebar";
18011
18088
 
18012
18089
  // src/events/list/event-list-tabs.tsx
18013
- var import_hooks52 = require("@agg-build/hooks");
18090
+ var import_hooks53 = require("@agg-build/hooks");
18014
18091
  var import_sdk16 = require("@agg-build/sdk");
18015
18092
  var import_react30 = require("react");
18016
18093
 
@@ -18098,14 +18175,14 @@ var renderTabIcon = (tab, isActive) => {
18098
18175
  );
18099
18176
  };
18100
18177
  var useEventListTabs = (tabs) => {
18101
- const labels = (0, import_hooks52.useLabels)();
18102
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks52.useAppConfig)();
18103
- const { isLocationBlocked } = (0, import_hooks52.useGeoBlock)();
18178
+ const labels = (0, import_hooks53.useLabels)();
18179
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks53.useAppConfig)();
18180
+ const { isLocationBlocked } = (0, import_hooks53.useGeoBlock)();
18104
18181
  return (0, import_react30.useMemo)(() => {
18105
18182
  const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
18106
18183
  return baseTabs.flatMap((tab) => {
18107
18184
  if (!tab.venueLogo) return [tab];
18108
- const availabilityState = (0, import_hooks52.getVenueAvailabilityState)({
18185
+ const availabilityState = (0, import_hooks53.getVenueAvailabilityState)({
18109
18186
  venueId: tab.venueLogo,
18110
18187
  disabledVenues,
18111
18188
  isConfigLoading: isAppConfigLoading && tab.venueLogo === import_sdk16.Venue.kalshi,
@@ -18290,15 +18367,15 @@ var EventList = ({
18290
18367
  stateRef
18291
18368
  }) => {
18292
18369
  var _a, _b, _c, _d, _e;
18293
- const labels = (0, import_hooks53.useLabels)();
18294
- const { disabledVenues } = (0, import_hooks53.useAppConfig)();
18370
+ const labels = (0, import_hooks54.useLabels)();
18371
+ const { disabledVenues } = (0, import_hooks54.useAppConfig)();
18295
18372
  const {
18296
18373
  features: { enableVenueEventDiscoveryFilters, showSportsMarkets }
18297
- } = (0, import_hooks53.useSdkUiConfig)();
18374
+ } = (0, import_hooks54.useSdkUiConfig)();
18298
18375
  const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
18299
18376
  const resolvedTabs = useEventListTabs();
18300
18377
  const visibleVenues = (0, import_react31.useMemo)(
18301
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks53.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
18378
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks54.getVisibleVenueIdsByConfig)(import_sdk17.VENUES, disabledVenues),
18302
18379
  [disabledVenues]
18303
18380
  );
18304
18381
  const [activeTabValue, setActiveTabValue] = (0, import_react31.useState)(
@@ -18343,7 +18420,7 @@ var EventList = ({
18343
18420
  setCategoryPath([]);
18344
18421
  setCollapsedCategoryIds(/* @__PURE__ */ new Set());
18345
18422
  }, [baseCategoryId, isDiscoveryFiltersEnabled]);
18346
- const { categories: topLevelCategories } = (0, import_hooks53.useCategories)({
18423
+ const { categories: topLevelCategories } = (0, import_hooks54.useCategories)({
18347
18424
  queryKeyScope: "event-list-top-categories",
18348
18425
  enabled: isDiscoveryFiltersEnabled,
18349
18426
  limit: 100
@@ -18359,7 +18436,7 @@ var EventList = ({
18359
18436
  ])
18360
18437
  );
18361
18438
  }, [categoryPath, sortedTopLevelCategories]);
18362
- const { childrenByParentId: baseChildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18439
+ const { childrenByParentId: baseChildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18363
18440
  queryKeyScope: "event-list-category-children",
18364
18441
  enabled: isDiscoveryFiltersEnabled,
18365
18442
  parentIds: baseCategoryChildPrefetchIds,
@@ -18380,7 +18457,7 @@ var EventList = ({
18380
18457
  }
18381
18458
  return Array.from(ids);
18382
18459
  }, [baseCategoryId, baseChildrenByParentId, categoryPath]);
18383
- const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18460
+ const { childrenByParentId: visibleChildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18384
18461
  queryKeyScope: "event-list-category-children",
18385
18462
  enabled: isDiscoveryFiltersEnabled,
18386
18463
  parentIds: visibleChildPrefetchIds,
@@ -18396,7 +18473,7 @@ var EventList = ({
18396
18473
  }
18397
18474
  return Array.from(ids);
18398
18475
  }, [categoryPath, visibleChildrenByParentId]);
18399
- const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks53.useCategoryChildren)({
18476
+ const { childrenByParentId: visibleGrandchildrenByParentId } = (0, import_hooks54.useCategoryChildren)({
18400
18477
  queryKeyScope: "event-list-category-children",
18401
18478
  enabled: isDiscoveryFiltersEnabled,
18402
18479
  parentIds: visibleGrandchildPrefetchIds,
@@ -18452,14 +18529,14 @@ var EventList = ({
18452
18529
  isFetchingNextPage,
18453
18530
  isPlaceholderData,
18454
18531
  loadedPageCount
18455
- } = (0, import_hooks53.useVenueEvents)({
18532
+ } = (0, import_hooks54.useVenueEvents)({
18456
18533
  queryKeyScope: "event-list",
18457
18534
  venues,
18458
18535
  search,
18459
18536
  categoryIds: resolvedCategoryIds,
18460
18537
  matchStatus,
18461
18538
  limit: requestLimit,
18462
- status: [import_hooks53.MarketStatus.open],
18539
+ status: [import_hooks54.MarketStatus.open],
18463
18540
  sortBy: sortQueryParams.sortBy,
18464
18541
  sortDir: sortQueryParams.sortDir,
18465
18542
  endDateFrom,
@@ -18494,7 +18571,7 @@ var EventList = ({
18494
18571
  const visibleMidpointVenueMarketIds = (0, import_react31.useMemo)(() => {
18495
18572
  return collectMidpointVenueMarketIds(visibleVenueMarkets);
18496
18573
  }, [visibleVenueMarkets]);
18497
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks53.useVenueMarketMidpoints)({
18574
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks54.useVenueMarketMidpoints)({
18498
18575
  venueMarketIds: visibleMidpointVenueMarketIds,
18499
18576
  enabled: visibleMidpointVenueMarketIds.length > 0
18500
18577
  });
@@ -18675,7 +18752,7 @@ var EventList = ({
18675
18752
  onMarketClick,
18676
18753
  getMarketHref,
18677
18754
  href: getEventHref == null ? void 0 : getEventHref(event),
18678
- marketStatus: import_hooks53.MarketStatus.open
18755
+ marketStatus: import_hooks54.MarketStatus.open
18679
18756
  },
18680
18757
  event.id
18681
18758
  )),
@@ -18755,12 +18832,12 @@ var EventList = ({
18755
18832
  EventList.displayName = "EventList";
18756
18833
 
18757
18834
  // src/pages/home/index.tsx
18758
- var import_hooks71 = require("@agg-build/hooks");
18835
+ var import_hooks72 = require("@agg-build/hooks");
18759
18836
  var import_sdk24 = require("@agg-build/sdk");
18760
18837
  var import_react49 = require("react");
18761
18838
 
18762
18839
  // src/pages/event-market/index.tsx
18763
- var import_hooks70 = require("@agg-build/hooks");
18840
+ var import_hooks71 = require("@agg-build/hooks");
18764
18841
  var import_react46 = require("react");
18765
18842
 
18766
18843
  // src/trading/types.ts
@@ -18770,7 +18847,7 @@ var parseVenue = (v) => (0, import_sdk18.safeParse)(v, isVenue);
18770
18847
  var parseAmount = (v) => (0, import_sdk18.safeParse)(v, import_sdk18.isFiniteNonNeg);
18771
18848
 
18772
18849
  // src/trading/settlement/settlement-details.tsx
18773
- var import_hooks54 = require("@agg-build/hooks");
18850
+ var import_hooks55 = require("@agg-build/hooks");
18774
18851
  var import_jsx_runtime155 = require("react/jsx-runtime");
18775
18852
  var hasContent = (value) => {
18776
18853
  return typeof value === "string" && value.trim().length > 0;
@@ -18794,11 +18871,11 @@ var buildVenueSettlementRules = (venueMarkets) => {
18794
18871
  };
18795
18872
  var SettlementDetails = ({ className }) => {
18796
18873
  var _a, _b, _c, _d, _e, _f;
18797
- const tradingContext = (0, import_hooks54.useEventTradingContext)();
18874
+ const tradingContext = (0, import_hooks55.useEventTradingContext)();
18798
18875
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
18799
18876
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
18800
18877
  if (!selectedEvent) return null;
18801
- const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks54.resolveDefaultTradingMarket)(selectedEvent);
18878
+ const activeMarket = selectedMarket != null ? selectedMarket : (0, import_hooks55.resolveDefaultTradingMarket)(selectedEvent);
18802
18879
  if (!activeMarket) return null;
18803
18880
  const allVenueMarkets = normalizeVenueMarketCluster(selectedEvent.venueMarkets);
18804
18881
  const activeMarketCluster = normalizeVenueMarketCluster(
@@ -18839,10 +18916,9 @@ var SettlementDetails = ({ className }) => {
18839
18916
  SettlementDetails.displayName = "SettlementDetails";
18840
18917
 
18841
18918
  // src/trading/place-order/index.tsx
18842
- var import_hooks63 = require("@agg-build/hooks");
18919
+ var import_hooks64 = require("@agg-build/hooks");
18843
18920
  var import_sdk23 = require("@agg-build/sdk");
18844
18921
  var import_react38 = __toESM(require("@number-flow/react"));
18845
- var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
18846
18922
  var Popover = __toESM(require("@radix-ui/react-popover"));
18847
18923
  var import_dayjs8 = __toESM(require("dayjs"));
18848
18924
  var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
@@ -18850,14 +18926,14 @@ var import_utc2 = __toESM(require("dayjs/plugin/utc"));
18850
18926
  var import_react39 = require("react");
18851
18927
 
18852
18928
  // src/geo-block-banner/index.tsx
18853
- var import_hooks55 = require("@agg-build/hooks");
18929
+ var import_hooks56 = require("@agg-build/hooks");
18854
18930
  var import_jsx_runtime156 = require("react/jsx-runtime");
18855
18931
  var GeoBlockBanner = ({
18856
18932
  venue,
18857
18933
  termsUrl = AGG_TERMS_OF_SERVICE_URL,
18858
18934
  className
18859
18935
  }) => {
18860
- const labels = (0, import_hooks55.useLabels)();
18936
+ const labels = (0, import_hooks56.useLabels)();
18861
18937
  const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
18862
18938
  return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
18863
18939
  "div",
@@ -18879,7 +18955,7 @@ GeoBlockBanner.displayName = "GeoBlockBanner";
18879
18955
 
18880
18956
  // src/onboarding/index.tsx
18881
18957
  var import_react36 = require("react");
18882
- var import_hooks61 = require("@agg-build/hooks");
18958
+ var import_hooks62 = require("@agg-build/hooks");
18883
18959
  var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
18884
18960
 
18885
18961
  // src/onboarding/onboarding-modal.constants.ts
@@ -18903,7 +18979,7 @@ var ONCHAIN_VENUES = [
18903
18979
 
18904
18980
  // src/onboarding/steps/how-it-works.tsx
18905
18981
  var import_react32 = require("react");
18906
- var import_hooks56 = require("@agg-build/hooks");
18982
+ var import_hooks57 = require("@agg-build/hooks");
18907
18983
  var import_jsx_runtime157 = require("react/jsx-runtime");
18908
18984
  var defaultIcons = {
18909
18985
  createAccount: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
@@ -18912,7 +18988,7 @@ var defaultIcons = {
18912
18988
  stayInControl: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
18913
18989
  };
18914
18990
  var HowItWorksStep = ({ onContinue, icons }) => {
18915
- const labels = (0, import_hooks56.useLabels)();
18991
+ const labels = (0, import_hooks57.useLabels)();
18916
18992
  const scrollRef = (0, import_react32.useRef)(null);
18917
18993
  const [showTopGradient, setShowTopGradient] = (0, import_react32.useState)(false);
18918
18994
  const [showBottomGradient, setShowBottomGradient] = (0, import_react32.useState)(true);
@@ -18986,10 +19062,10 @@ HowItWorksStep.displayName = "HowItWorksStep";
18986
19062
 
18987
19063
  // src/onboarding/steps/profile-setup.tsx
18988
19064
  var import_react33 = require("react");
18989
- var import_hooks57 = require("@agg-build/hooks");
19065
+ var import_hooks58 = require("@agg-build/hooks");
18990
19066
  var import_jsx_runtime158 = require("react/jsx-runtime");
18991
19067
  var ProfileSetupStep = ({ onContinue }) => {
18992
- const labels = (0, import_hooks57.useLabels)();
19068
+ const labels = (0, import_hooks58.useLabels)();
18993
19069
  const [username, setUsername] = (0, import_react33.useState)("");
18994
19070
  const [avatarFile, setAvatarFile] = (0, import_react33.useState)();
18995
19071
  const [avatarPreview, setAvatarPreview] = (0, import_react33.useState)();
@@ -19119,7 +19195,7 @@ var ProfileSetupStep = ({ onContinue }) => {
19119
19195
  ProfileSetupStep.displayName = "ProfileSetupStep";
19120
19196
 
19121
19197
  // src/onboarding/steps/connect-accounts.tsx
19122
- var import_hooks58 = require("@agg-build/hooks");
19198
+ var import_hooks59 = require("@agg-build/hooks");
19123
19199
  var import_jsx_runtime159 = require("react/jsx-runtime");
19124
19200
  var OnchainVenueLogos = () => {
19125
19201
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
@@ -19133,7 +19209,7 @@ var VenueCard = ({
19133
19209
  onConnect,
19134
19210
  connected = false
19135
19211
  }) => {
19136
- const labels = (0, import_hooks58.useLabels)();
19212
+ const labels = (0, import_hooks59.useLabels)();
19137
19213
  const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(
19138
19214
  Button,
19139
19215
  {
@@ -19192,7 +19268,7 @@ var ConnectAccountsStep = ({
19192
19268
  onContinue,
19193
19269
  connectedOnchain = false
19194
19270
  }) => {
19195
- const labels = (0, import_hooks58.useLabels)();
19271
+ const labels = (0, import_hooks59.useLabels)();
19196
19272
  const canContinue = connectedOnchain;
19197
19273
  return /* @__PURE__ */ (0, import_jsx_runtime159.jsxs)("div", { className: "flex flex-col gap-6", children: [
19198
19274
  /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
@@ -19227,7 +19303,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
19227
19303
 
19228
19304
  // src/onboarding/steps/connect-onchain-modal.tsx
19229
19305
  var import_react34 = require("react");
19230
- var import_hooks59 = require("@agg-build/hooks");
19306
+ var import_hooks60 = require("@agg-build/hooks");
19231
19307
  var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
19232
19308
  var import_jsx_runtime160 = require("react/jsx-runtime");
19233
19309
  var ConnectOnchainModal = ({
@@ -19235,7 +19311,7 @@ var ConnectOnchainModal = ({
19235
19311
  onOpenChange,
19236
19312
  onConnect
19237
19313
  }) => {
19238
- const labels = (0, import_hooks59.useLabels)();
19314
+ const labels = (0, import_hooks60.useLabels)();
19239
19315
  const [connecting, setConnecting] = (0, import_react34.useState)(false);
19240
19316
  const [error, setError] = (0, import_react34.useState)();
19241
19317
  const handleCancel = (0, import_react34.useCallback)(() => {
@@ -19334,7 +19410,7 @@ var ConnectOnchainModal = ({
19334
19410
  ConnectOnchainModal.displayName = "ConnectOnchainModal";
19335
19411
 
19336
19412
  // src/onboarding/steps/connect-kalshi-modal.tsx
19337
- var import_hooks60 = require("@agg-build/hooks");
19413
+ var import_hooks61 = require("@agg-build/hooks");
19338
19414
  var import_sdk20 = require("@agg-build/sdk");
19339
19415
  var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
19340
19416
  var import_react35 = require("react");
@@ -19361,8 +19437,8 @@ var ConnectKalshiModal = ({
19361
19437
  onOpenChange,
19362
19438
  onVerify
19363
19439
  }) => {
19364
- const labels = (0, import_hooks60.useLabels)();
19365
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks60.useAppConfig)();
19440
+ const labels = (0, import_hooks61.useLabels)();
19441
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks61.useAppConfig)();
19366
19442
  const apiKeyInputRef = (0, import_react35.useRef)(null);
19367
19443
  const errorId = (0, import_react35.useId)();
19368
19444
  const [apiKeyId, setApiKeyId] = (0, import_react35.useState)("");
@@ -19370,7 +19446,7 @@ var ConnectKalshiModal = ({
19370
19446
  const [isVerifying, setIsVerifying] = (0, import_react35.useState)(false);
19371
19447
  const [isConnected, setIsConnected] = (0, import_react35.useState)(false);
19372
19448
  const [error, setError] = (0, import_react35.useState)();
19373
- const availabilityState = (0, import_hooks60.getVenueAvailabilityState)({
19449
+ const availabilityState = (0, import_hooks61.getVenueAvailabilityState)({
19374
19450
  venueId: import_sdk20.Venue.kalshi,
19375
19451
  disabledVenues,
19376
19452
  isConfigLoading: isAppConfigLoading
@@ -19672,7 +19748,7 @@ var OnboardingModal = ({
19672
19748
  connectedOnchain = false
19673
19749
  }) => {
19674
19750
  var _a;
19675
- const labels = (0, import_hooks61.useLabels)();
19751
+ const labels = (0, import_hooks62.useLabels)();
19676
19752
  const [step, setStep] = (0, import_react36.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
19677
19753
  const stepLabels = {
19678
19754
  [ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
@@ -19757,12 +19833,12 @@ var requestAggWithdrawModalOpen = () => {
19757
19833
  };
19758
19834
 
19759
19835
  // src/trading/fund-kalshi-modal.tsx
19760
- var import_hooks62 = require("@agg-build/hooks");
19836
+ var import_hooks63 = require("@agg-build/hooks");
19761
19837
  var import_sdk21 = require("@agg-build/sdk");
19762
19838
  var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
19763
19839
  var import_jsx_runtime163 = require("react/jsx-runtime");
19764
19840
  var FundKalshiModal = ({ open, onOpenChange }) => {
19765
- const labels = (0, import_hooks62.useLabels)();
19841
+ const labels = (0, import_hooks63.useLabels)();
19766
19842
  const modalLabels = labels.trading.fundKalshiModal;
19767
19843
  return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(
19768
19844
  Modal.Container,
@@ -19834,11 +19910,12 @@ var MIN_SELL_ORDER_SHARES = 1;
19834
19910
  var DEFAULT_SLIPPAGE_VALUE = "0.5";
19835
19911
  var HIGH_SLIPPAGE_THRESHOLD = 10;
19836
19912
  var PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT = 3;
19913
+ var PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME = "bg-transparent text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal text-agg-foreground outline-none";
19837
19914
  var PLACE_ORDER_CONTAINER_CLASS_NAME = "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-none hover:shadow-none";
19838
19915
  var PLACE_ORDER_OUTCOME_BUTTON_CLASS_NAMES = {
19839
19916
  activeNegative: "border-agg-error/50 bg-agg-error/15 font-agg-bold text-agg-error",
19840
19917
  activePositive: "border-agg-success/50 bg-agg-success/15 font-agg-bold text-agg-success",
19841
- base: "flex h-10 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
19918
+ base: "flex h-11 flex-1 items-center justify-center rounded-agg-full border px-6 text-agg-base leading-agg-6",
19842
19919
  inactive: "border-transparent bg-agg-secondary-hover font-agg-normal text-agg-foreground hover:bg-agg-tertiary"
19843
19920
  };
19844
19921
 
@@ -20307,6 +20384,93 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
20307
20384
  maximumFractionDigits: 1
20308
20385
  });
20309
20386
  var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
20387
+ var normalizeOutcomeName = (value) => {
20388
+ var _a;
20389
+ return (_a = value == null ? void 0 : value.trim().toLowerCase()) != null ? _a : "";
20390
+ };
20391
+ var findMatchingVenueOutcome = (market, selectedOutcome) => {
20392
+ var _a, _b;
20393
+ const selectedNames = new Set(
20394
+ [selectedOutcome.label, selectedOutcome.title].map(normalizeOutcomeName).filter(Boolean)
20395
+ );
20396
+ return (_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.find((outcome) => {
20397
+ const normalizedLabel = normalizeOutcomeName(outcome.label);
20398
+ return normalizedLabel !== "" && selectedNames.has(normalizedLabel);
20399
+ })) != null ? _b : null;
20400
+ };
20401
+ var buildLimitOrderVenueOptions = ({
20402
+ currentPrices,
20403
+ livePrices,
20404
+ market,
20405
+ selectedOutcomeId
20406
+ }) => {
20407
+ var _a, _b, _c, _d;
20408
+ if (!market || !selectedOutcomeId) return [];
20409
+ const selectedOutcome = market.venueMarketOutcomes.find(
20410
+ (outcome) => outcome.id === selectedOutcomeId
20411
+ );
20412
+ if (!selectedOutcome) return [];
20413
+ const options = /* @__PURE__ */ new Map();
20414
+ const addOption = ({
20415
+ outcomeId,
20416
+ venue,
20417
+ venueMarketId
20418
+ }) => {
20419
+ var _a2;
20420
+ const parsedVenue = parseVenue(venue);
20421
+ if (!parsedVenue.success || options.has(parsedVenue.data)) return;
20422
+ options.set(parsedVenue.data, {
20423
+ currentPrice: (_a2 = livePrices == null ? void 0 : livePrices.get(outcomeId)) != null ? _a2 : currentPrices.get(outcomeId),
20424
+ venue: parsedVenue.data,
20425
+ venueMarketId,
20426
+ venueMarketOutcomeId: outcomeId
20427
+ });
20428
+ };
20429
+ addOption({
20430
+ outcomeId: selectedOutcome.id,
20431
+ venue: market.venue,
20432
+ venueMarketId: market.id
20433
+ });
20434
+ const matchedMarketsById = new Map(
20435
+ ((_a = market.matchedVenueMarkets) != null ? _a : []).map((matchedMarket) => [matchedMarket.id, matchedMarket])
20436
+ );
20437
+ const matchedOutcomeRefs = (_b = selectedOutcome.matchedVenueMarketOutcomes) != null ? _b : [];
20438
+ for (const ref of matchedOutcomeRefs) {
20439
+ const matchedMarket = matchedMarketsById.get(ref.venueMarketId);
20440
+ const matchedOutcome = (_c = matchedMarket == null ? void 0 : matchedMarket.venueMarketOutcomes) == null ? void 0 : _c.find(
20441
+ (outcome) => outcome.id === ref.venueMarketOutcomeId
20442
+ );
20443
+ if (!matchedMarket || !matchedOutcome) continue;
20444
+ addOption({
20445
+ outcomeId: matchedOutcome.id,
20446
+ venue: matchedMarket.venue,
20447
+ venueMarketId: matchedMarket.id
20448
+ });
20449
+ }
20450
+ if (matchedOutcomeRefs.length === 0) {
20451
+ for (const matchedMarket of (_d = market.matchedVenueMarkets) != null ? _d : []) {
20452
+ const matchedOutcome = findMatchingVenueOutcome(matchedMarket, selectedOutcome);
20453
+ if (!matchedOutcome) continue;
20454
+ addOption({
20455
+ outcomeId: matchedOutcome.id,
20456
+ venue: matchedMarket.venue,
20457
+ venueMarketId: matchedMarket.id
20458
+ });
20459
+ }
20460
+ }
20461
+ return [...options.values()];
20462
+ };
20463
+ var resolveAutomaticLimitOrderVenueOption = (options, side) => {
20464
+ if (options.length === 0) return null;
20465
+ return [...options].sort((left, right) => {
20466
+ if (left.currentPrice == null && right.currentPrice == null) {
20467
+ return left.venue.localeCompare(right.venue);
20468
+ }
20469
+ if (left.currentPrice == null) return 1;
20470
+ if (right.currentPrice == null) return -1;
20471
+ return side === "buy" ? left.currentPrice - right.currentPrice : right.currentPrice - left.currentPrice;
20472
+ })[0];
20473
+ };
20310
20474
  var isGeoBlockWarningReason = (reason) => reason.startsWith(GEO_BLOCK_WARNING_PREFIX);
20311
20475
  var extractGeoBlockedVenues = (warnings) => {
20312
20476
  if (!(warnings == null ? void 0 : warnings.length)) return /* @__PURE__ */ new Set();
@@ -20314,6 +20478,12 @@ var extractGeoBlockedVenues = (warnings) => {
20314
20478
  warnings.filter((w) => w.venue && isGeoBlockWarningReason(w.reason)).map((w) => w.venue)
20315
20479
  );
20316
20480
  };
20481
+ var getSmartRouteTotalFees = (feeBreakdown) => {
20482
+ if (!feeBreakdown) return null;
20483
+ const feeParts = [feeBreakdown.venueFees, feeBreakdown.bridgeFees, feeBreakdown.executionGas];
20484
+ if (!feeParts.every(Number.isFinite)) return null;
20485
+ return feeParts.reduce((total, fee) => total + fee, 0);
20486
+ };
20317
20487
  var hasLowLiquidityWarning = (warnings) => {
20318
20488
  if (!(warnings == null ? void 0 : warnings.length)) return false;
20319
20489
  return warnings.some((warning) => (warning == null ? void 0 : warning.reason) === "low_liquidity");
@@ -21965,7 +22135,7 @@ var PlaceOrderSlippageControl = ({
21965
22135
  minimumValue: slippageMinimumValue
21966
22136
  }) => {
21967
22137
  var _a, _b;
21968
- const labels = (0, import_hooks63.useLabels)();
22138
+ const labels = (0, import_hooks64.useLabels)();
21969
22139
  const containerRef = (0, import_react39.useRef)(null);
21970
22140
  const triggerRef = (0, import_react39.useRef)(null);
21971
22141
  const inputRef = (0, import_react39.useRef)(null);
@@ -22238,7 +22408,7 @@ var PlaceOrderResolvedView = ({
22238
22408
  isSportsEvent = false
22239
22409
  }) => {
22240
22410
  var _a, _b;
22241
- const labels = (0, import_hooks63.useLabels)();
22411
+ const labels = (0, import_hooks64.useLabels)();
22242
22412
  const tradingLabels = labels.trading;
22243
22413
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
22244
22414
  const isResolvingMarket = false;
@@ -22602,23 +22772,24 @@ var PlaceOrder = ({
22602
22772
  resolvedClaim,
22603
22773
  midpointsResult
22604
22774
  }) => {
22605
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y;
22775
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$;
22606
22776
  const {
22607
22777
  enableDebug: isExecutionDebugEnabled,
22608
22778
  features: { enableAnimations, showFeesBreakdown, showLimitOrders },
22779
+ formatting: { formatPrice },
22609
22780
  general: { locale },
22610
22781
  trading: { executionMode: configuredExecutionMode = "live" } = { executionMode: "live" }
22611
- } = (0, import_hooks63.useSdkUiConfig)();
22612
- const labels = (0, import_hooks63.useLabels)();
22782
+ } = (0, import_hooks64.useSdkUiConfig)();
22783
+ const labels = (0, import_hooks64.useLabels)();
22613
22784
  const tradingLabels = labels.trading;
22614
22785
  const toastCtx = useOptionalToast();
22615
- const { isTradingBlocked } = (0, import_hooks63.useGeoBlock)();
22616
- const tradingContext = (0, import_hooks63.useEventTradingContext)();
22786
+ const { isTradingBlocked } = (0, import_hooks64.useGeoBlock)();
22787
+ const tradingContext = (0, import_hooks64.useEventTradingContext)();
22617
22788
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
22618
22789
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
22619
22790
  const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
22620
22791
  const resolvedEventTradingState = (0, import_react39.useMemo)(() => {
22621
- return eventTradingState != null ? eventTradingState : (0, import_hooks63.resolveEventTradingState)(selectedEvent);
22792
+ return eventTradingState != null ? eventTradingState : (0, import_hooks64.resolveEventTradingState)(selectedEvent);
22622
22793
  }, [eventTradingState, selectedEvent]);
22623
22794
  const scopedSelectedEvent = (0, import_react39.useMemo)(() => {
22624
22795
  var _a2;
@@ -22646,7 +22817,7 @@ var PlaceOrder = ({
22646
22817
  )) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
22647
22818
  const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
22648
22819
  const resolvedTradingState = (0, import_react39.useMemo)(() => {
22649
- return (0, import_hooks63.resolveMarketTradingState)(scopedSelectedMarket);
22820
+ return (0, import_hooks64.resolveMarketTradingState)(scopedSelectedMarket);
22650
22821
  }, [scopedSelectedMarket]);
22651
22822
  const resolvedReadOnlyMarket = (0, import_react39.useMemo)(() => {
22652
22823
  var _a2;
@@ -22660,11 +22831,11 @@ var PlaceOrder = ({
22660
22831
  scopedSelectedMarket
22661
22832
  ]);
22662
22833
  const resolvedReadOnlyTradingState = (0, import_react39.useMemo)(() => {
22663
- return (0, import_hooks63.resolveMarketTradingState)(resolvedReadOnlyMarket);
22834
+ return (0, import_hooks64.resolveMarketTradingState)(resolvedReadOnlyMarket);
22664
22835
  }, [resolvedReadOnlyMarket]);
22665
22836
  const isEndedWithoutKnownWinner = false;
22666
22837
  const orderEligibility = (0, import_react39.useMemo)(
22667
- () => (0, import_hooks63.resolveOrderEligibility)({
22838
+ () => (0, import_hooks64.resolveOrderEligibility)({
22668
22839
  event: scopedSelectedEvent,
22669
22840
  market: scopedSelectedMarket,
22670
22841
  outcome: scopedSelectedOutcome,
@@ -22673,11 +22844,11 @@ var PlaceOrder = ({
22673
22844
  [scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
22674
22845
  );
22675
22846
  const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
22676
- const { isAuthenticated, user } = (0, import_hooks63.useAggAuthContext)();
22847
+ const { isAuthenticated, user } = (0, import_hooks64.useAggAuthContext)();
22677
22848
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
22678
22849
  const isPaperMode = resolvedExecutionMode === "paper";
22679
- const liveBalanceState = (0, import_hooks63.useAggBalanceState)();
22680
- const paperBalancesQuery = (0, import_hooks63.useManagedBalances)({
22850
+ const liveBalanceState = (0, import_hooks64.useAggBalanceState)();
22851
+ const paperBalancesQuery = (0, import_hooks64.useManagedBalances)({
22681
22852
  enabled: Boolean(isAuthenticated && isPaperMode),
22682
22853
  mode: "paper"
22683
22854
  });
@@ -22697,22 +22868,22 @@ var PlaceOrder = ({
22697
22868
  const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
22698
22869
  const totalBalance = isPaperMode ? paperTotalBalance : liveAvailableBalance;
22699
22870
  const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : liveBalanceState.isLoading;
22700
- const executeManaged = (0, import_hooks63.useExecuteManaged)();
22701
- const placeLimitOrder = (0, import_hooks63.usePlaceLimitOrder)();
22702
- const aggClient = (0, import_hooks63.useAggClient)();
22703
- const queryClient = (0, import_hooks63.useQueryClient)();
22704
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks63.useAppConfig)();
22705
- const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks63.useVenueKeyStatus)(
22871
+ const executeManaged = (0, import_hooks64.useExecuteManaged)();
22872
+ const placeLimitOrder = (0, import_hooks64.usePlaceLimitOrder)();
22873
+ const aggClient = (0, import_hooks64.useAggClient)();
22874
+ const queryClient = (0, import_hooks64.useQueryClient)();
22875
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks64.useAppConfig)();
22876
+ const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks64.useVenueKeyStatus)(
22706
22877
  import_sdk23.Venue.kalshi,
22707
22878
  isAuthenticated
22708
22879
  );
22709
22880
  const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react39.useState)(false);
22710
22881
  const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react39.useState)(false);
22711
- const livePrices = (0, import_hooks63.useLiveOutcomePrices)(
22882
+ const livePrices = (0, import_hooks64.useLiveOutcomePrices)(
22712
22883
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
22713
22884
  );
22714
- const wsBestPrices = (0, import_hooks63.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
22715
- const fetchedClusterMidpointResult = (0, import_hooks63.useMidpoints)(
22885
+ const wsBestPrices = (0, import_hooks64.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
22886
+ const fetchedClusterMidpointResult = (0, import_hooks64.useMidpoints)(
22716
22887
  midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
22717
22888
  );
22718
22889
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
@@ -22720,12 +22891,12 @@ var PlaceOrder = ({
22720
22891
  const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
22721
22892
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
22722
22893
  const clusterBestPrices = (0, import_react39.useMemo)(
22723
- () => (0, import_hooks63.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
22894
+ () => (0, import_hooks64.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
22724
22895
  [clusterBestPricesRest, wsBestPrices]
22725
22896
  );
22726
22897
  const [internalTab, setInternalTab] = (0, import_react39.useState)("buy");
22727
22898
  const [executionType, setExecutionType] = (0, import_react39.useState)("market");
22728
- const [isExecutionTypeMenuOpen, setIsExecutionTypeMenuOpen] = (0, import_react39.useState)(false);
22899
+ const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react39.useState)(null);
22729
22900
  const [limitPrice, setLimitPrice] = (0, import_react39.useState)(0.5);
22730
22901
  const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react39.useState)(formatLimitPriceInputValue(0.5));
22731
22902
  const [limitPriceInputError, setLimitPriceInputError] = (0, import_react39.useState)(null);
@@ -22775,7 +22946,6 @@ var PlaceOrder = ({
22775
22946
  ]);
22776
22947
  const buyTabRef = (0, import_react39.useRef)(null);
22777
22948
  const sellTabRef = (0, import_react39.useRef)(null);
22778
- const executionTypeTriggerRef = (0, import_react39.useRef)(null);
22779
22949
  const expirationTriggerRef = (0, import_react39.useRef)(null);
22780
22950
  const limitPriceInitializedForOutcomeRef = (0, import_react39.useRef)(void 0);
22781
22951
  const expirationOptionRefs = (0, import_react39.useRef)([]);
@@ -22811,16 +22981,37 @@ var PlaceOrder = ({
22811
22981
  scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
22812
22982
  scopedSelectedOutcomeId
22813
22983
  ]);
22814
- const debouncedAmount = (0, import_hooks63.useDebouncedValue)(internalAmount, 300);
22984
+ const debouncedAmount = (0, import_hooks64.useDebouncedValue)(internalAmount, 300);
22815
22985
  const isQuoteInputEditing = internalAmount !== debouncedAmount;
22816
22986
  const isLimitOrder = showLimitOrders && executionType === "limit";
22817
22987
  const isSell = (0, import_react39.useMemo)(() => internalTab === "sell", [internalTab]);
22988
+ const limitVenueOptions = (0, import_react39.useMemo)(
22989
+ () => {
22990
+ var _a2;
22991
+ return buildLimitOrderVenueOptions({
22992
+ currentPrices: (_a2 = clusterMidpointResult.currentMidpointsByOutcomeId) != null ? _a2 : clusterMidpointResult.prices,
22993
+ livePrices,
22994
+ market: scopedSelectedMarket,
22995
+ selectedOutcomeId: scopedSelectedOutcomeId
22996
+ });
22997
+ },
22998
+ [clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
22999
+ );
23000
+ const visibleLimitVenueOptions = (0, import_react39.useMemo)(() => {
23001
+ return limitVenueOptions.filter((option) => {
23002
+ return (0, import_hooks64.getVenueAvailabilityState)({
23003
+ venueId: option.venue,
23004
+ disabledVenues,
23005
+ isConfigLoading: isAppConfigLoading
23006
+ }) !== "hidden";
23007
+ });
23008
+ }, [disabledVenues, isAppConfigLoading, limitVenueOptions]);
22818
23009
  const {
22819
23010
  positions: executionPositions,
22820
23011
  dataUpdatedAt: executionPositionsUpdatedAt,
22821
23012
  isLoading: isExecutionPositionsLoading,
22822
23013
  isFetching: isExecutionPositionsFetching
22823
- } = (0, import_hooks63.useExecutionPositions)({
23014
+ } = (0, import_hooks64.useExecutionPositions)({
22824
23015
  enabled: Boolean(isAuthenticated && isSell),
22825
23016
  mode: isPaperMode ? "paper" : void 0
22826
23017
  });
@@ -22835,9 +23026,70 @@ var PlaceOrder = ({
22835
23026
  isEditing: isQuoteInputEditing,
22836
23027
  isMarketOpen: resolvedTradingState.kind === "open" && !isEndedWithoutKnownWinner,
22837
23028
  isPanelActive: isQuotePanelActive,
22838
- isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending
23029
+ isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
22839
23030
  };
22840
- const smartRoute = (0, import_hooks63.useSmartRoute)(__spreadProps(__spreadValues({
23031
+ const limitVenueQuoteRequests = (0, import_react39.useMemo)(
23032
+ () => visibleLimitVenueOptions.map((option) => ({
23033
+ venue: option.venue,
23034
+ venueMarketOutcomeId: option.venueMarketOutcomeId
23035
+ })),
23036
+ [visibleLimitVenueOptions]
23037
+ );
23038
+ const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
23039
+ const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
23040
+ const limitVenueQuotes = (0, import_hooks64.useLimitOrderVenueQuotes)({
23041
+ requests: limitVenueQuoteRequests,
23042
+ tradeSide: internalTab,
23043
+ amount: debouncedAmount,
23044
+ marketId: scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
23045
+ accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
23046
+ chainBalances: chainBalancesOverride,
23047
+ mode: isPaperMode ? "paper" : void 0,
23048
+ slipCapBps: 1e6,
23049
+ enabled: isLimitVenueQuoteEnabled,
23050
+ refreshContext: smartRouteRefreshContext
23051
+ });
23052
+ const limitVenueQuoteByVenue = (0, import_react39.useMemo)(
23053
+ () => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
23054
+ [limitVenueQuotes.quotes]
23055
+ );
23056
+ const geoBlockedLimitVenues = (0, import_react39.useMemo)(() => {
23057
+ var _a2;
23058
+ const venues = /* @__PURE__ */ new Set();
23059
+ for (const quote of limitVenueQuotes.quotes) {
23060
+ if (extractGeoBlockedVenues((_a2 = quote.data) == null ? void 0 : _a2.warnings).has(quote.request.venue)) {
23061
+ venues.add(quote.request.venue);
23062
+ }
23063
+ }
23064
+ return venues;
23065
+ }, [limitVenueQuotes.quotes]);
23066
+ const availableLimitVenueOptions = (0, import_react39.useMemo)(() => {
23067
+ return visibleLimitVenueOptions.filter((option) => {
23068
+ return !geoBlockedLimitVenues.has(option.venue) && (0, import_hooks64.getVenueAvailabilityState)({
23069
+ venueId: option.venue,
23070
+ disabledVenues,
23071
+ isConfigLoading: isAppConfigLoading
23072
+ }) === "available";
23073
+ });
23074
+ }, [disabledVenues, geoBlockedLimitVenues, isAppConfigLoading, visibleLimitVenueOptions]);
23075
+ const automaticLimitVenueOption = (0, import_react39.useMemo)(
23076
+ () => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
23077
+ [availableLimitVenueOptions, internalTab]
23078
+ );
23079
+ const selectedLimitVenueOption = (0, import_react39.useMemo)(() => {
23080
+ if (selectedLimitVenue) {
23081
+ const selectedOption = availableLimitVenueOptions.find(
23082
+ (option) => option.venue === selectedLimitVenue
23083
+ );
23084
+ if (selectedOption) return selectedOption;
23085
+ }
23086
+ return automaticLimitVenueOption;
23087
+ }, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
23088
+ (0, import_react39.useEffect)(() => {
23089
+ if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
23090
+ setSelectedLimitVenue(null);
23091
+ }, [geoBlockedLimitVenues, selectedLimitVenue]);
23092
+ const smartRoute = (0, import_hooks64.useSmartRoute)(__spreadProps(__spreadValues({
22841
23093
  venueMarketOutcomeId: scopedSelectedOutcomeId,
22842
23094
  maxSpend: isSell ? void 0 : debouncedAmount,
22843
23095
  sellShares: isSell ? debouncedAmount : void 0,
@@ -22852,7 +23104,7 @@ var PlaceOrder = ({
22852
23104
  enabled: isSmartRouteEnabled
22853
23105
  }, isSell ? {
22854
23106
  sellCacheScope: {
22855
- accountId: (_k = user == null ? void 0 : user.id) != null ? _k : null,
23107
+ accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
22856
23108
  positionVersion: executionPositionsUpdatedAt
22857
23109
  }
22858
23110
  } : {}), {
@@ -22906,14 +23158,14 @@ var PlaceOrder = ({
22906
23158
  },
22907
23159
  [debouncedAmount, isSell, scopedSelectedOutcomeId, smartRoute.data, smartRoute.isLoading]
22908
23160
  );
22909
- const venueSellQuotes = (0, import_hooks63.useVenueSellQuotes)({
23161
+ const venueSellQuotes = (0, import_hooks64.useVenueSellQuotes)({
22910
23162
  venueMarketOutcomeId: scopedSelectedOutcomeId,
22911
- accountId: (_l = user == null ? void 0 : user.id) != null ? _l : null,
23163
+ accountId: (_m = user == null ? void 0 : user.id) != null ? _m : null,
22912
23164
  positionVersion: executionPositionsUpdatedAt,
22913
23165
  requests: venueSellQuoteRequests,
22914
23166
  mode: isPaperMode ? "paper" : void 0,
22915
23167
  slipCapBps: 1e6,
22916
- enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_m = smartRoute.data) == null ? void 0 : _m.venueMarketOutcomeId) === scopedSelectedOutcomeId,
23168
+ enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_n = smartRoute.data) == null ? void 0 : _n.venueMarketOutcomeId) === scopedSelectedOutcomeId,
22917
23169
  refreshContext: smartRouteRefreshContext
22918
23170
  });
22919
23171
  const currentSellableShares = (0, import_react39.useMemo)(() => {
@@ -22948,13 +23200,13 @@ var PlaceOrder = ({
22948
23200
  isSell,
22949
23201
  scopedSelectedMarket,
22950
23202
  scopedSelectedOutcome,
22951
- (_o = (_n = smartRoute.data) == null ? void 0 : _n.positionAvailability) == null ? void 0 : _o.totalSellableShares
23203
+ (_p = (_o = smartRoute.data) == null ? void 0 : _o.positionAvailability) == null ? void 0 : _p.totalSellableShares
22952
23204
  ]);
22953
23205
  const maxSellableShares = (0, import_react39.useMemo)(
22954
23206
  () => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
22955
23207
  [currentSellableShares]
22956
23208
  );
22957
- const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
23209
+ const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_r = (_q = smartRoute.data) == null ? void 0 : _q.positionAvailability) == null ? void 0 : _r.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
22958
23210
  const displayedCurrentSellableShares = (0, import_react39.useMemo)(() => {
22959
23211
  if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
22960
23212
  return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
@@ -22964,7 +23216,7 @@ var PlaceOrder = ({
22964
23216
  [maxSellableShares]
22965
23217
  );
22966
23218
  const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
22967
- const isSellAmountAboveAvailability = isSell && ((_r = smartRoute.data) == null ? void 0 : _r.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_s = smartRoute.data.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number" && internalAmount > maxSellableShares;
23219
+ const isSellAmountAboveAvailability = isSell && ((_s = smartRoute.data) == null ? void 0 : _s.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_t = smartRoute.data.positionAvailability) == null ? void 0 : _t.totalSellableShares) === "number" && internalAmount > maxSellableShares;
22968
23220
  (0, import_react39.useEffect)(() => {
22969
23221
  if (submissionProgressState != null) return;
22970
23222
  if (!isSell || isCurrentSellableSharesLoading) return;
@@ -23000,8 +23252,8 @@ var PlaceOrder = ({
23000
23252
  isSell,
23001
23253
  onAmountChange,
23002
23254
  scopedSelectedOutcomeId,
23003
- (_u = (_t = smartRoute.data) == null ? void 0 : _t.positionAvailability) == null ? void 0 : _u.totalSellableShares,
23004
- (_v = smartRoute.data) == null ? void 0 : _v.venueMarketOutcomeId,
23255
+ (_v = (_u = smartRoute.data) == null ? void 0 : _u.positionAvailability) == null ? void 0 : _v.totalSellableShares,
23256
+ (_w = smartRoute.data) == null ? void 0 : _w.venueMarketOutcomeId,
23005
23257
  submissionProgressState
23006
23258
  ]);
23007
23259
  const routeCards = (0, import_react39.useMemo)(() => {
@@ -23039,7 +23291,7 @@ var PlaceOrder = ({
23039
23291
  return selectedRouteCardId;
23040
23292
  }
23041
23293
  return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
23042
- }, [routeCards, selectedRouteCardId, isSell, (_w = smartRoute.data) == null ? void 0 : _w.status]);
23294
+ }, [routeCards, selectedRouteCardId, isSell, (_x = smartRoute.data) == null ? void 0 : _x.status]);
23043
23295
  (0, import_react39.useEffect)(() => {
23044
23296
  if (routeCards.length === 0) {
23045
23297
  setSelectedRouteCardId(null);
@@ -23062,7 +23314,6 @@ var PlaceOrder = ({
23062
23314
  (0, import_react39.useEffect)(() => {
23063
23315
  if (showLimitOrders || executionType !== "limit") return;
23064
23316
  setExecutionType("market");
23065
- setIsExecutionTypeMenuOpen(false);
23066
23317
  setIsLimitExpirationPickerOpen(false);
23067
23318
  }, [executionType, showLimitOrders]);
23068
23319
  (0, import_react39.useEffect)(() => {
@@ -23078,15 +23329,19 @@ var PlaceOrder = ({
23078
23329
  setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
23079
23330
  setLimitPriceInputError(null);
23080
23331
  }, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
23332
+ (0, import_react39.useEffect)(() => {
23333
+ setSelectedLimitVenue(null);
23334
+ }, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
23081
23335
  const orderedRouteCards = routeCards;
23082
- const selectedRouteCard = (_y = (_x = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _x : orderedRouteCards[0]) != null ? _y : null;
23336
+ const selectedRouteCard = (_z = (_y = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _y : orderedRouteCards[0]) != null ? _z : null;
23083
23337
  const isKalshiRoute = (0, import_react39.useMemo)(() => {
23338
+ if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk23.Venue.kalshi;
23084
23339
  if (selectedRouteCard) {
23085
23340
  return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
23086
23341
  }
23087
23342
  return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
23088
- }, [selectedRouteCard, scopedSelectedMarket]);
23089
- const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_z = liveBalanceState.kalshiBalance) != null ? _z : 0 : liveAvailableBalance;
23343
+ }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
23344
+ const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_A = liveBalanceState.kalshiBalance) != null ? _A : 0 : liveAvailableBalance;
23090
23345
  const legacyKalshiAccount = (0, import_react39.useMemo)(
23091
23346
  () => {
23092
23347
  var _a2;
@@ -23094,10 +23349,10 @@ var PlaceOrder = ({
23094
23349
  },
23095
23350
  [user == null ? void 0 : user.venueAccounts]
23096
23351
  );
23097
- const isKalshiAccountActive = (_A = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _A : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
23098
- const isKalshiVerified = ((_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _B : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
23352
+ const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
23353
+ const isKalshiVerified = ((_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _C : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
23099
23354
  const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
23100
- const isKalshiAvailable = (0, import_hooks63.getVenueAvailabilityState)({
23355
+ const isKalshiAvailable = (0, import_hooks64.getVenueAvailabilityState)({
23101
23356
  venueId: "kalshi",
23102
23357
  disabledVenues,
23103
23358
  isConfigLoading: isAppConfigLoading
@@ -23122,7 +23377,7 @@ var PlaceOrder = ({
23122
23377
  [aggClient, onConnectKalshi, refetchKalshiKeyStatus]
23123
23378
  );
23124
23379
  const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
23125
- const verifyKalshiConnectionLabel = (_F = (_E = (_D = (_C = labels.onboarding) == null ? void 0 : _C.connectKalshiModal) == null ? void 0 : _D.actions) == null ? void 0 : _E.verifyConnection) != null ? _F : tradingLabels.kycRequired;
23380
+ const verifyKalshiConnectionLabel = (_G = (_F = (_E = (_D = labels.onboarding) == null ? void 0 : _D.connectKalshiModal) == null ? void 0 : _E.actions) == null ? void 0 : _F.verifyConnection) != null ? _G : tradingLabels.kycRequired;
23126
23381
  const handleRouteCardSelect = (0, import_react39.useCallback)(
23127
23382
  (cardId) => {
23128
23383
  if (cardId === resolvedSelectedRouteCardId) {
@@ -23136,16 +23391,16 @@ var PlaceOrder = ({
23136
23391
  },
23137
23392
  [resolvedSelectedRouteCardId, routeCards]
23138
23393
  );
23139
- const executionProgress = (0, import_hooks63.useExecutionProgress)({
23140
- orderIds: (_G = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _G : null,
23141
- quoteId: (_H = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _H : null,
23394
+ const executionProgress = (0, import_hooks64.useExecutionProgress)({
23395
+ orderIds: (_H = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _H : null,
23396
+ quoteId: (_I = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _I : null,
23142
23397
  mode: isPaperMode ? "paper" : void 0,
23143
- enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
23398
+ enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_J = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _J.length)
23144
23399
  });
23145
- const selectedOutcomeLabel = (_L = (_K = (_J = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _J.label) != null ? _K : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _L : "";
23146
- const headerImage = (_N = (_M = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _M : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _N : null;
23147
- const headerTitle = (_P = (_O = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _O : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _P : "";
23148
- const headerSubtitle = (_Q = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
23400
+ const selectedOutcomeLabel = (_M = (_L = (_K = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _K.label) != null ? _L : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _M : "";
23401
+ const headerImage = (_O = (_N = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _N : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _O : null;
23402
+ const headerTitle = (_Q = (_P = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _P : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
23403
+ const headerSubtitle = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _R : "";
23149
23404
  const buildExecutionSummary = (0, import_react39.useCallback)(
23150
23405
  (quoteData, executionVenue, orderId, partialFillSummary) => {
23151
23406
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
@@ -23411,8 +23666,8 @@ var PlaceOrder = ({
23411
23666
  }
23412
23667
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
23413
23668
  emitTerminalOrderNotifications();
23414
- (0, import_hooks63.invalidateBalanceQueries)(queryClient);
23415
- (0, import_hooks63.invalidatePositionQueries)(queryClient);
23669
+ (0, import_hooks64.invalidateBalanceQueries)(queryClient);
23670
+ (0, import_hooks64.invalidatePositionQueries)(queryClient);
23416
23671
  if (debugStore && debugAttemptId) {
23417
23672
  debugStore.updateAttempt(debugAttemptId, {
23418
23673
  status: "succeeded",
@@ -23443,19 +23698,19 @@ var PlaceOrder = ({
23443
23698
  queryClient,
23444
23699
  submissionProgressState
23445
23700
  ]);
23446
- const activeQuoteData = (_S = (_R = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _R : smartRoute.data) != null ? _S : null;
23447
- const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
23701
+ const activeQuoteData = isLimitOrder ? null : (_T = (_S = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _S : smartRoute.data) != null ? _T : null;
23702
+ const visibleMarketRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
23448
23703
  const hasEnteredAmount = internalAmount > 0;
23449
23704
  const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
23450
23705
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
23451
- const selectedRouteFills = (_T = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _T : [];
23706
+ const selectedRouteFills = (_U = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _U : [];
23452
23707
  const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk23.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk23.Venue.kalshi));
23453
23708
  const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== import_sdk23.Venue.kalshi);
23454
23709
  const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk23.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
23455
23710
  const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== import_sdk23.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
23456
23711
  const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
23457
23712
  const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
23458
- const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_U = liveBalanceState.kalshiBalance) != null ? _U : 0);
23713
+ const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_V = liveBalanceState.kalshiBalance) != null ? _V : 0);
23459
23714
  const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
23460
23715
  const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
23461
23716
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
@@ -23549,9 +23804,9 @@ var PlaceOrder = ({
23549
23804
  }
23550
23805
  return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
23551
23806
  }, [selectedRouteCard, tradingLabels]);
23552
- const displayedToWinValue = (_V = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _V : 0;
23807
+ const displayedToWinValue = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _W : 0;
23553
23808
  const limitOrderPayload = (0, import_react39.useMemo)(() => {
23554
- if (!scopedSelectedMarket || !scopedSelectedOutcomeId || internalAmount <= 0) return null;
23809
+ if (!selectedLimitVenueOption || internalAmount <= 0) return null;
23555
23810
  if (limitPriceInputError) return null;
23556
23811
  const expirationDate = resolveLimitExpirationDate({
23557
23812
  expirationType: limitExpirationType,
@@ -23567,8 +23822,8 @@ var PlaceOrder = ({
23567
23822
  });
23568
23823
  const expiresAt = expirationDate ? serializeLimitOrderExpiration(expirationDate) : void 0;
23569
23824
  return __spreadValues({
23570
- venue: scopedSelectedMarket.venue,
23571
- venueMarketOutcomeId: scopedSelectedOutcomeId,
23825
+ venue: selectedLimitVenueOption.venue,
23826
+ venueMarketOutcomeId: selectedLimitVenueOption.venueMarketOutcomeId,
23572
23827
  side: internalTab,
23573
23828
  limitPriceRaw,
23574
23829
  sizeRaw,
@@ -23582,8 +23837,7 @@ var PlaceOrder = ({
23582
23837
  limitExpirationType,
23583
23838
  limitPrice,
23584
23839
  limitPriceInputError,
23585
- scopedSelectedMarket,
23586
- scopedSelectedOutcomeId
23840
+ selectedLimitVenueOption
23587
23841
  ]);
23588
23842
  const resolvedLimitExpirationDraftDate = (0, import_react39.useMemo)(() => {
23589
23843
  return resolveLimitExpirationDate({
@@ -23626,11 +23880,70 @@ var PlaceOrder = ({
23626
23880
  )
23627
23881
  ) / Number(LIMIT_ORDER_RAW_SCALE);
23628
23882
  }, [internalTab, limitOrderPayload]);
23883
+ const limitRouteCards = (0, import_react39.useMemo)(() => {
23884
+ return visibleLimitVenueOptions.map((option) => {
23885
+ var _a2, _b2;
23886
+ const availabilityState = (0, import_hooks64.getVenueAvailabilityState)({
23887
+ venueId: option.venue,
23888
+ disabledVenues,
23889
+ isConfigLoading: isAppConfigLoading
23890
+ });
23891
+ const isGeoBlocked = geoBlockedLimitVenues.has(option.venue);
23892
+ const isUnavailable = isTradingBlocked || isGeoBlocked || availabilityState !== "available";
23893
+ const currentPriceLabel = option.currentPrice == null ? "\u2014" : formatProbabilityCents(option.currentPrice, formatPrice);
23894
+ const totalFees = getSmartRouteTotalFees(
23895
+ (_b2 = (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.data) == null ? void 0 : _b2.feeBreakdown
23896
+ );
23897
+ const feeLabel = totalFees == null ? void 0 : formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
23898
+ return {
23899
+ id: `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
23900
+ hint: isGeoBlocked ? tradingLabels.venueUnavailableInRegion : tradingLabels.limitRoutingCurrentPrice(currentPriceLabel, feeLabel),
23901
+ isUnavailable,
23902
+ kind: "venue",
23903
+ label: getTradingVenueLabel(option.venue),
23904
+ numericValue: displayedLimitToWinValue,
23905
+ value: formatUsd(displayedLimitToWinValue, {
23906
+ maximumFractionDigits: 2,
23907
+ minimumFractionDigits: 2
23908
+ }),
23909
+ venue: option.venue
23910
+ };
23911
+ });
23912
+ }, [
23913
+ disabledVenues,
23914
+ displayedLimitToWinValue,
23915
+ formatPrice,
23916
+ geoBlockedLimitVenues,
23917
+ isAppConfigLoading,
23918
+ isTradingBlocked,
23919
+ limitVenueQuoteByVenue,
23920
+ tradingLabels,
23921
+ visibleLimitVenueOptions
23922
+ ]);
23923
+ const limitVenueOptionByCardId = (0, import_react39.useMemo)(() => {
23924
+ return new Map(
23925
+ visibleLimitVenueOptions.map((option) => [
23926
+ `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
23927
+ option
23928
+ ])
23929
+ );
23930
+ }, [visibleLimitVenueOptions]);
23931
+ const activeRouteCards = isLimitOrder ? limitRouteCards : visibleMarketRouteCards;
23932
+ const activeRouteCardCount = isLimitOrder ? limitRouteCards.length : orderedRouteCards.length;
23933
+ const handleActiveRouteCardSelect = (cardId) => {
23934
+ if (!isLimitOrder) {
23935
+ handleRouteCardSelect(cardId);
23936
+ return;
23937
+ }
23938
+ const option = limitVenueOptionByCardId.get(cardId);
23939
+ if (!option) return;
23940
+ setSelectedLimitVenue(option.venue);
23941
+ };
23629
23942
  const displayedLimitToWinHint = formatLimitPriceLabel(limitPrice);
23630
23943
  const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
23631
23944
  const estimatedFeesValue = (0, import_react39.useMemo)(() => {
23632
- if (!activeFeeBreakdown) return null;
23633
- const totalFees = activeFeeBreakdown.venueFees + activeFeeBreakdown.bridgeFees + activeFeeBreakdown.executionGas;
23945
+ const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
23946
+ if (totalFees == null) return null;
23634
23947
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
23635
23948
  }, [activeFeeBreakdown]);
23636
23949
  const feeBreakdownRows = (0, import_react39.useMemo)(() => {
@@ -23668,13 +23981,15 @@ var PlaceOrder = ({
23668
23981
  ];
23669
23982
  }, [activeFeeBreakdown, tradingLabels]);
23670
23983
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
23671
- const selectedRouteGeoBlocked = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _W : false;
23984
+ const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
23985
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_X = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _X : null : null;
23986
+ const selectedRouteGeoBlocked = isLimitOrder ? (_Y = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _Y : false : (_Z = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _Z : false;
23672
23987
  const geoBlockedVenuesFromWarnings = (0, import_react39.useMemo)(
23673
23988
  () => {
23674
23989
  var _a2;
23675
23990
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
23676
23991
  },
23677
- [(_X = smartRoute.data) == null ? void 0 : _X.warnings]
23992
+ [(__ = smartRoute.data) == null ? void 0 : __.warnings]
23678
23993
  );
23679
23994
  const isPrimaryVenueGeoBlocked = (0, import_react39.useMemo)(() => {
23680
23995
  var _a2, _b2;
@@ -23682,12 +23997,12 @@ var PlaceOrder = ({
23682
23997
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
23683
23998
  return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
23684
23999
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
23685
- const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked;
24000
+ const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
23686
24001
  const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && hasLowLiquidityWarning(activeQuoteData.warnings);
23687
24002
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
23688
24003
  const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
23689
- const shouldShowSmartRouting = !isLimitOrder && orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
23690
- const shouldShowRouteToggle = !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
24004
+ const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : orderedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
24005
+ const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
23691
24006
  const handleReturnToOrderForm = (0, import_react39.useCallback)(() => {
23692
24007
  const submittedSelection = submittedSelectionRef.current;
23693
24008
  submittedSelectionRef.current = null;
@@ -24332,7 +24647,7 @@ var PlaceOrder = ({
24332
24647
  PlaceOrderResolvedView,
24333
24648
  {
24334
24649
  tradingState: resolvedReadOnlyTradingState,
24335
- resolutionTimestamp: (_Y = resolvedEventTradingState.resolvesAt) != null ? _Y : resolvedReadOnlyTradingState.resolvesAt,
24650
+ resolutionTimestamp: (_$ = resolvedEventTradingState.resolvesAt) != null ? _$ : resolvedReadOnlyTradingState.resolvesAt,
24336
24651
  resolvedClaim,
24337
24652
  classNames,
24338
24653
  className,
@@ -24415,261 +24730,228 @@ var PlaceOrder = ({
24415
24730
  tabItem.value
24416
24731
  );
24417
24732
  }) }),
24418
- showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24419
- DropdownMenu2.Root,
24733
+ showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24734
+ Select,
24420
24735
  {
24421
- open: isExecutionTypeMenuOpen,
24422
- onOpenChange: setIsExecutionTypeMenuOpen,
24423
- children: [
24424
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24425
- "button",
24426
- {
24427
- ref: executionTypeTriggerRef,
24428
- type: "button",
24429
- className: cn(
24430
- "agg-order-type-trigger mb-2 flex cursor-pointer items-center gap-2 rounded-agg-sm px-2 py-1 text-agg-base leading-agg-6 text-agg-foreground",
24431
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24432
- ),
24433
- "aria-label": tradingLabels.orderTypeAria,
24434
- children: [
24435
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: isLimitOrder ? tradingLabels.orderTypeLimit : tradingLabels.orderTypeMarket }),
24436
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "chevron-down", size: "small", className: "h-4 w-4", "aria-hidden": true })
24437
- ]
24438
- }
24439
- ) }),
24440
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24441
- DropdownMenu2.Portal,
24442
- {
24443
- container: resolvePlaceOrderPortalContainer(executionTypeTriggerRef.current),
24444
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24445
- DropdownMenu2.Content,
24446
- {
24447
- align: "end",
24448
- sideOffset: 8,
24449
- className: "z-50 min-w-[140px] rounded-agg-lg border border-agg-separator bg-agg-secondary p-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]",
24450
- children: [
24451
- { value: "market", label: tradingLabels.orderTypeMarket },
24452
- { value: "limit", label: tradingLabels.orderTypeLimit }
24453
- ].map((item) => /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24454
- DropdownMenu2.Item,
24455
- {
24456
- className: cn(
24457
- "cursor-pointer rounded-agg-sm px-3 py-2 text-agg-sm leading-agg-5 text-agg-foreground outline-none hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover",
24458
- executionType === item.value && "font-agg-bold text-agg-primary"
24459
- ),
24460
- onSelect: () => handleExecutionTypeChange(item.value),
24461
- children: item.label
24462
- },
24463
- item.value
24464
- ))
24465
- }
24466
- )
24467
- }
24468
- )
24469
- ]
24736
+ ariaLabel: tradingLabels.orderTypeAria,
24737
+ className: "mb-2",
24738
+ triggerClassName: "agg-order-type-trigger",
24739
+ items: [
24740
+ { value: "market", label: tradingLabels.orderTypeMarket },
24741
+ { value: "limit", label: tradingLabels.orderTypeLimit }
24742
+ ],
24743
+ value: executionType,
24744
+ onChange: handleExecutionTypeChange,
24745
+ variant: "inline",
24746
+ openOnHover: true,
24747
+ contentAlign: "end",
24748
+ contentSideOffset: 4
24470
24749
  }
24471
24750
  ) : null
24472
24751
  ]
24473
24752
  }
24474
24753
  ),
24475
- outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
24476
- var _a2, _b2, _c2;
24477
- const price = getDisplayOutcomePrice({
24478
- outcomeId: outcome.id,
24479
- outcomeLabel: outcome.label,
24480
- selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
24481
- bestPrices: clusterBestPrices,
24482
- bestMidpoint: clusterBestMidpoint,
24483
- bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
24484
- livePrices
24485
- });
24486
- const isActive = outcome.id === scopedSelectedOutcomeId;
24487
- const isPositive = resolveIsPositiveOutcome(outcome, index);
24488
- const isPriceLoading = clusterMidpointResult.isLoading && price == null;
24489
- return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24490
- "button",
24491
- {
24492
- "data-id": outcome.id,
24493
- type: "button",
24494
- className: cn(
24495
- "agg-outcome-button",
24496
- getOutcomeButtonClassName({
24497
- enableAnimations,
24498
- isActive,
24499
- isPositive
24500
- }),
24501
- "disabled:cursor-not-allowed disabled:opacity-60",
24502
- "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
24503
- ),
24504
- "aria-pressed": isActive,
24505
- "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price)}`,
24506
- disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
24507
- onClick: () => handleOutcomeChange(outcome.id),
24508
- children: [
24754
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
24755
+ outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
24756
+ var _a2, _b2, _c2;
24757
+ const price = getDisplayOutcomePrice({
24758
+ outcomeId: outcome.id,
24759
+ outcomeLabel: outcome.label,
24760
+ selection: (_a2 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _a2 : isSell ? "sell" : "buy",
24761
+ bestPrices: clusterBestPrices,
24762
+ bestMidpoint: clusterBestMidpoint,
24763
+ bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
24764
+ livePrices
24765
+ });
24766
+ const isActive = outcome.id === scopedSelectedOutcomeId;
24767
+ const isPositive = resolveIsPositiveOutcome(outcome, index);
24768
+ const isPriceLoading = clusterMidpointResult.isLoading && price == null;
24769
+ return /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24770
+ "button",
24771
+ {
24772
+ "data-id": outcome.id,
24773
+ type: "button",
24774
+ className: cn(
24775
+ "agg-outcome-button",
24776
+ getOutcomeButtonClassName({
24777
+ enableAnimations,
24778
+ isActive,
24779
+ isPositive
24780
+ }),
24781
+ "disabled:cursor-not-allowed disabled:opacity-60",
24782
+ "leading-agg-5! flex-1 min-w-0 gap-1 md:gap-2"
24783
+ ),
24784
+ "aria-pressed": isActive,
24785
+ "aria-label": `${(_b2 = outcome.title) != null ? _b2 : outcome.label} ${formatProbabilityCents(price, formatPrice)}`,
24786
+ disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
24787
+ onClick: () => handleOutcomeChange(outcome.id),
24788
+ children: [
24789
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24790
+ Typography,
24791
+ {
24792
+ as: "span",
24793
+ variant: isActive ? "body-strong" : "body",
24794
+ className: cn("whitespace-nowrap truncate"),
24795
+ children: (_c2 = outcome.title) != null ? _c2 : outcome.label
24796
+ }
24797
+ ),
24798
+ isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24799
+ "span",
24800
+ {
24801
+ "aria-hidden": "true",
24802
+ className: cn(
24803
+ "agg-place-order-outcome-price-loading",
24804
+ "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
24805
+ )
24806
+ }
24807
+ ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
24808
+ ]
24809
+ },
24810
+ outcome.id
24811
+ );
24812
+ }) }) : null,
24813
+ isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
24814
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
24815
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
24816
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
24817
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("label", { className: "relative flex items-center", children: [
24818
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24819
+ "input",
24820
+ {
24821
+ type: "text",
24822
+ inputMode: "decimal",
24823
+ "aria-label": tradingLabels.limitPriceInputAria,
24824
+ "aria-invalid": Boolean(limitPriceInputError),
24825
+ value: limitPriceInputValue,
24826
+ onChange: handleLimitPriceInputChange,
24827
+ onBlur: handleLimitPriceInputBlur,
24828
+ className: cn(
24829
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
24830
+ "h-9 w-[108px] pr-5",
24831
+ limitPriceInputError && "text-agg-error focus-visible:text-agg-error"
24832
+ )
24833
+ }
24834
+ ),
24835
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
24836
+ ] }),
24509
24837
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24510
- Typography,
24838
+ "button",
24511
24839
  {
24512
- as: "span",
24513
- variant: isActive ? "body-strong" : "body",
24514
- className: cn("whitespace-nowrap truncate"),
24515
- children: (_c2 = outcome.title) != null ? _c2 : outcome.label
24840
+ type: "button",
24841
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24842
+ "aria-label": tradingLabels.limitPriceDecreaseAria,
24843
+ onClick: () => handleLimitPriceStep("decrease"),
24844
+ children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24516
24845
  }
24517
24846
  ),
24518
- isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24519
- "span",
24847
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24848
+ "button",
24520
24849
  {
24521
- "aria-hidden": "true",
24522
- className: cn(
24523
- "agg-place-order-outcome-price-loading",
24524
- "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
24525
- )
24850
+ type: "button",
24851
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24852
+ "aria-label": tradingLabels.limitPriceIncreaseAria,
24853
+ onClick: () => handleLimitPriceStep("increase"),
24854
+ children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24526
24855
  }
24527
- ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
24528
- ]
24529
- },
24530
- outcome.id
24531
- );
24532
- }) }) : null,
24533
- isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
24534
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
24535
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
24536
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-2", children: [
24537
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("label", { className: "relative flex items-center", children: [
24538
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24539
- "input",
24856
+ )
24857
+ ] }),
24858
+ limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
24859
+ ] })
24860
+ ] }) : null,
24861
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
24862
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
24863
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
24864
+ isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(import_jsx_runtime166.Fragment, { children: [
24865
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
24866
+ displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24867
+ "button",
24540
24868
  {
24541
- type: "text",
24542
- inputMode: "decimal",
24543
- "aria-label": tradingLabels.limitPriceInputAria,
24544
- "aria-invalid": Boolean(limitPriceInputError),
24545
- value: limitPriceInputValue,
24546
- onChange: handleLimitPriceInputChange,
24547
- onBlur: handleLimitPriceInputBlur,
24869
+ type: "button",
24548
24870
  className: cn(
24549
- "h-9 w-[108px] rounded-agg-sm bg-transparent pr-5 text-right text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground outline-none",
24550
- "focus-visible:ring-2 focus-visible:ring-agg-primary",
24551
- limitPriceInputError && "text-agg-error focus-visible:ring-agg-error"
24552
- )
24871
+ "agg-max-shares-button",
24872
+ "cursor-pointer disabled:cursor-not-allowed",
24873
+ "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
24874
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24875
+ ),
24876
+ "aria-label": tradingLabels.maxShares,
24877
+ disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
24878
+ onClick: handleFillSellableShares,
24879
+ children: tradingLabels.maxShares
24553
24880
  }
24554
- ),
24555
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
24556
- ] }),
24557
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24558
- "button",
24559
- {
24560
- type: "button",
24561
- className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24562
- "aria-label": tradingLabels.limitPriceDecreaseAria,
24563
- onClick: () => handleLimitPriceStep("decrease"),
24564
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24881
+ ) : null
24882
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
24883
+ ] }),
24884
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24885
+ CurrencyInput,
24886
+ {
24887
+ value: internalAmount,
24888
+ onChange: handleAmountChange,
24889
+ ariaLabel: tradingLabels.amount(internalTab),
24890
+ max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
24891
+ isInvalid: isInsufficientBalance || isBelowMinimum,
24892
+ disabled: !orderEligibility.canPlaceOrder,
24893
+ prefix: internalTab === "buy" ? "$" : "",
24894
+ decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
24895
+ classNames: {
24896
+ input: cn(
24897
+ "agg-order-amount-input",
24898
+ PLACE_ORDER_NUMERIC_INPUT_CLASS_NAME,
24899
+ "w-full max-w-[168px]",
24900
+ hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
24901
+ )
24565
24902
  }
24566
- ),
24903
+ }
24904
+ )
24905
+ ] }),
24906
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
24907
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-1.5", children: [
24567
24908
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24568
- "button",
24909
+ Typography,
24569
24910
  {
24570
- type: "button",
24571
- className: "flex size-8 cursor-pointer items-center justify-center rounded-agg-lg bg-agg-secondary-hover text-agg-foreground hover:bg-agg-tertiary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24572
- "aria-label": tradingLabels.limitPriceIncreaseAria,
24573
- onClick: () => handleLimitPriceStep("increase"),
24574
- children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
24911
+ variant: "text-sm",
24912
+ className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
24913
+ children: tradingLabels.estimatedFees
24575
24914
  }
24576
- )
24577
- ] }),
24578
- limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
24579
- ] })
24580
- ] }) : null,
24581
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
24582
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
24583
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-order-amount-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground whitespace-nowrap", children: tradingLabels.amount(internalTab) }),
24584
- isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-balance-value flex items-baseline gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isCurrentSellableSharesLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(import_jsx_runtime166.Fragment, { children: [
24585
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
24586
- displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24587
- "button",
24915
+ ),
24916
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24917
+ Tooltip,
24588
24918
  {
24589
- type: "button",
24590
- className: cn(
24591
- "agg-max-shares-button",
24592
- "cursor-pointer disabled:cursor-not-allowed",
24593
- "bg-transparent p-0 text-agg-sm font-agg-bold leading-agg-5 text-agg-primary disabled:text-agg-muted-foreground",
24594
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
24595
- ),
24596
- "aria-label": tradingLabels.maxShares,
24597
- disabled: !orderEligibility.canPlaceOrder || isAtMaxSellableShares,
24598
- onClick: handleFillSellableShares,
24599
- children: tradingLabels.maxShares
24919
+ "aria-label": tradingLabels.estimatedFeesTooltipAria,
24920
+ classNames: {
24921
+ content: cn(
24922
+ "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
24923
+ "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
24924
+ ),
24925
+ icon: "h-3 w-3 text-agg-muted-foreground",
24926
+ trigger: "h-3 w-3 text-agg-muted-foreground"
24927
+ },
24928
+ content: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24929
+ "div",
24930
+ {
24931
+ className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
24932
+ children: [
24933
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: row.label }),
24934
+ row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24935
+ "span",
24936
+ {
24937
+ className: cn(
24938
+ "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
24939
+ "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
24940
+ "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
24941
+ ),
24942
+ children: row.badgeLabel
24943
+ }
24944
+ ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "text-right", children: row.value })
24945
+ ]
24946
+ },
24947
+ row.label
24948
+ )) })
24600
24949
  }
24601
24950
  ) : null
24602
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-balance-value flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(LoadingIcon, { size: "small" }) : tradingLabels.balance(formatUsd(displayedBalance)) }) : null
24603
- ] }),
24604
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24605
- CurrencyInput,
24606
- {
24607
- value: internalAmount,
24608
- onChange: handleAmountChange,
24609
- ariaLabel: tradingLabels.amount(internalTab),
24610
- max: isLimitOrder && !isSell && isAuthenticated && !isBalanceLoading ? totalBalance : void 0,
24611
- isInvalid: isInsufficientBalance || isBelowMinimum,
24612
- disabled: !orderEligibility.canPlaceOrder,
24613
- prefix: internalTab === "buy" ? "$" : "",
24614
- decimalPlaces: isSell ? SELL_SHARE_INPUT_DECIMALS : 2,
24615
- classNames: {
24616
- input: cn(
24617
- "agg-order-amount-input",
24618
- "w-full max-w-[168px] text-right text-agg-3xl font-agg-bold leading-agg-9 tracking-agg-normal",
24619
- hasEnteredAmount ? "text-agg-foreground" : "text-agg-separator caret-agg-foreground"
24620
- )
24621
- }
24622
- }
24623
- )
24951
+ ] }),
24952
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
24953
+ ] }) : null
24624
24954
  ] }),
24625
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
24626
- /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "flex items-center gap-1.5", children: [
24627
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24628
- Typography,
24629
- {
24630
- variant: "text-sm",
24631
- className: "text-agg-sm leading-agg-5 text-agg-muted-foreground",
24632
- children: tradingLabels.estimatedFees
24633
- }
24634
- ),
24635
- feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24636
- Tooltip,
24637
- {
24638
- "aria-label": tradingLabels.estimatedFeesTooltipAria,
24639
- classNames: {
24640
- content: cn(
24641
- "min-w-[220px] max-w-[320px] rounded-[10px] px-5 py-4",
24642
- "shadow-[0_12px_12px_rgba(0,0,0,0.10)]"
24643
- ),
24644
- icon: "h-3 w-3 text-agg-muted-foreground",
24645
- trigger: "h-3 w-3 text-agg-muted-foreground"
24646
- },
24647
- content: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)(
24648
- "div",
24649
- {
24650
- className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
24651
- children: [
24652
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: row.label }),
24653
- row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24654
- "span",
24655
- {
24656
- className: cn(
24657
- "agg-fee-badge inline-flex items-center justify-center rounded-agg-sm border border-agg-primary/50",
24658
- "bg-linear-to-b from-agg-primary/8 to-agg-primary/15 px-1.5 py-1",
24659
- "text-agg-xs font-agg-bold leading-agg-4 text-agg-primary uppercase whitespace-nowrap"
24660
- ),
24661
- children: row.badgeLabel
24662
- }
24663
- ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "text-right", children: row.value })
24664
- ]
24665
- },
24666
- row.label
24667
- )) })
24668
- }
24669
- ) : null
24670
- ] }),
24671
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
24672
- ] }) : null,
24673
24955
  shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-panel flex flex-col gap-3", children: [
24674
24956
  /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
24675
24957
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
@@ -24678,10 +24960,10 @@ var PlaceOrder = ({
24678
24960
  {
24679
24961
  type: "button",
24680
24962
  className: "agg-route-toggle flex cursor-pointer items-center gap-1.5 text-agg-sm leading-agg-5 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary",
24681
- "aria-label": tradingLabels.viewAllRoutes(orderedRouteCards.length),
24963
+ "aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
24682
24964
  onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
24683
24965
  children: [
24684
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: tradingLabels.viewAllRoutes(orderedRouteCards.length) }),
24966
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
24685
24967
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
24686
24968
  Icon,
24687
24969
  {
@@ -24695,16 +24977,16 @@ var PlaceOrder = ({
24695
24977
  }
24696
24978
  ) : null
24697
24979
  ] }),
24698
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
24980
+ /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading ? /* @__PURE__ */ (0, import_jsx_runtime166.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
24699
24981
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(PlaceOrderRouteCardSkeleton, {}),
24700
24982
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(PlaceOrderRouteCardSkeleton, {})
24701
- ] }) : visibleRouteCards.length > 0 ? visibleRouteCards.map((card) => {
24983
+ ] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
24702
24984
  return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_react39.Fragment, { children: renderRouteCard({
24703
24985
  card,
24704
24986
  enableAnimations,
24705
24987
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
24706
- isSelected: !card.isUnavailable && card.id === resolvedSelectedRouteCardId,
24707
- onSelect: handleRouteCardSelect,
24988
+ isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
24989
+ onSelect: handleActiveRouteCardSelect,
24708
24990
  tradingLabels
24709
24991
  }) }, card.id);
24710
24992
  }) : null })
@@ -24725,7 +25007,6 @@ var PlaceOrder = ({
24725
25007
  className: "flex min-w-0 cursor-pointer items-center justify-end gap-2 text-right text-agg-base leading-agg-6 text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
24726
25008
  "aria-label": tradingLabels.expirationMenuAria,
24727
25009
  children: [
24728
- /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(Icon, { name: "calendar", size: "small", className: "h-4 w-4 shrink-0", "aria-hidden": true }),
24729
25010
  /* @__PURE__ */ (0, import_jsx_runtime166.jsx)("span", { className: "min-w-0 truncate", children: limitExpirationType === "GTC" ? tradingLabels.expirationGoodTilCanceled : limitExpirationType === "FIVE_MINUTES" ? tradingLabels.expirationFiveMinutes : limitExpirationType === "ONE_HOUR" ? tradingLabels.expirationOneHour : limitExpirationType === "END_OF_DAY" ? tradingLabels.expirationEndOfDay : resolvedCustomExpirationDate ? (0, import_dayjs8.default)(resolvedCustomExpirationDate).format(
24730
25011
  "MMM D, YYYY [at] HH:mm"
24731
25012
  ) : tradingLabels.expirationCustom }),
@@ -25029,7 +25310,7 @@ var PlaceOrder = ({
25029
25310
  className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
25030
25311
  disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
25031
25312
  "aria-label": tradingLabels.signInToTrade,
25032
- onClick: import_hooks63.requestAggAuthChooserOpen,
25313
+ onClick: import_hooks64.requestAggAuthChooserOpen,
25033
25314
  children: tradingLabels.signInToTrade
25034
25315
  }
25035
25316
  ) : /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(
@@ -25101,7 +25382,7 @@ var PlaceOrder = ({
25101
25382
  PlaceOrder.displayName = "PlaceOrder";
25102
25383
 
25103
25384
  // src/trading/use-claim-winnings.ts
25104
- var import_hooks64 = require("@agg-build/hooks");
25385
+ var import_hooks65 = require("@agg-build/hooks");
25105
25386
  var import_react40 = require("react");
25106
25387
  var toClaimError = (err) => {
25107
25388
  if (err instanceof Error) return err;
@@ -25109,11 +25390,11 @@ var toClaimError = (err) => {
25109
25390
  };
25110
25391
  function useClaimWinnings(options = {}) {
25111
25392
  const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
25112
- const labels = (0, import_hooks64.useLabels)();
25393
+ const labels = (0, import_hooks65.useLabels)();
25113
25394
  const claimNotificationLabels = labels.notifications.claim;
25114
25395
  const toastCtx = useOptionalToast();
25115
- const queryClient = (0, import_hooks64.useQueryClient)();
25116
- const redeemMutation = (0, import_hooks64.useRedeem)();
25396
+ const queryClient = (0, import_hooks65.useQueryClient)();
25397
+ const redeemMutation = (0, import_hooks65.useRedeem)();
25117
25398
  const [activeRedeems, setActiveRedeems] = (0, import_react40.useState)({});
25118
25399
  const activeClaimKeysRef = (0, import_react40.useRef)(/* @__PURE__ */ new Set());
25119
25400
  const pendingClaimToastIdsRef = (0, import_react40.useRef)({});
@@ -25123,7 +25404,7 @@ function useClaimWinnings(options = {}) {
25123
25404
  () => Object.values(activeRedeems),
25124
25405
  [activeRedeems]
25125
25406
  );
25126
- const lifecycleStates = (0, import_hooks64.useRedeemLifecycles)(lifecycleInputs);
25407
+ const lifecycleStates = (0, import_hooks65.useRedeemLifecycles)(lifecycleInputs);
25127
25408
  const internalClaimingIds = (0, import_react40.useMemo)(() => {
25128
25409
  const out = __spreadValues({}, submittingClaimKeys);
25129
25410
  for (const [claimKey, active] of Object.entries(activeRedeems)) {
@@ -25138,13 +25419,13 @@ function useClaimWinnings(options = {}) {
25138
25419
  [externalClaimingKeys, internalClaimingIds]
25139
25420
  );
25140
25421
  const invalidateClaimUiState = (0, import_react40.useCallback)(() => {
25141
- (0, import_hooks64.invalidateBalanceQueries)(queryClient);
25142
- (0, import_hooks64.invalidatePositionQueries)(queryClient);
25422
+ (0, import_hooks65.invalidateBalanceQueries)(queryClient);
25423
+ (0, import_hooks65.invalidatePositionQueries)(queryClient);
25143
25424
  queryClient.invalidateQueries({
25144
- queryKey: import_hooks64.executionKeys.claimablePositionsCount(),
25425
+ queryKey: import_hooks65.executionKeys.claimablePositionsCount(),
25145
25426
  refetchType: "active"
25146
25427
  });
25147
- (0, import_hooks64.invalidateUserActivityQueries)(queryClient);
25428
+ (0, import_hooks65.invalidateUserActivityQueries)(queryClient);
25148
25429
  }, [queryClient]);
25149
25430
  const claim = (0, import_react40.useCallback)(
25150
25431
  (_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
@@ -25341,7 +25622,7 @@ function useClaimWinnings(options = {}) {
25341
25622
  }
25342
25623
 
25343
25624
  // src/trading/use-resolved-market-claim.ts
25344
- var import_hooks65 = require("@agg-build/hooks");
25625
+ var import_hooks66 = require("@agg-build/hooks");
25345
25626
  var import_react41 = require("react");
25346
25627
  var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
25347
25628
  var dateFormatter = new Intl.DateTimeFormat("en-US", {
@@ -25358,12 +25639,12 @@ var formatResolutionDate = (value) => {
25358
25639
  function useResolvedMarketClaim(options = {}) {
25359
25640
  var _a;
25360
25641
  const { market, enabled = true, executionMode } = options;
25361
- const { isAuthenticated } = (0, import_hooks65.useAggAuthState)();
25362
- const tradingState = (0, import_react41.useMemo)(() => (0, import_hooks65.resolveMarketTradingState)(market), [market]);
25642
+ const { isAuthenticated } = (0, import_hooks66.useAggAuthState)();
25643
+ const tradingState = (0, import_react41.useMemo)(() => (0, import_hooks66.resolveMarketTradingState)(market), [market]);
25363
25644
  const isResolved = tradingState.kind === "resolved";
25364
25645
  const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
25365
25646
  const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
25366
- const { positions } = (0, import_hooks65.useExecutionPositions)(__spreadValues({
25647
+ const { positions } = (0, import_hooks66.useExecutionPositions)(__spreadValues({
25367
25648
  enabled: shouldFetch,
25368
25649
  status: "active",
25369
25650
  limit: 50
@@ -25380,7 +25661,7 @@ function useResolvedMarketClaim(options = {}) {
25380
25661
  (outcome) => outcome.winner === true && outcome.totalSize > 0
25381
25662
  );
25382
25663
  if (winningOutcomes.length === 0) return void 0;
25383
- const totals = (0, import_hooks65.computeClosedPositionTotals)(group);
25664
+ const totals = (0, import_hooks66.computeClosedPositionTotals)(group);
25384
25665
  const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
25385
25666
  const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
25386
25667
  market: market != null ? market : group.venueMarket,
@@ -25464,7 +25745,7 @@ var resolveEventMarketPageStickyState = ({
25464
25745
  };
25465
25746
 
25466
25747
  // src/pages/event-market/event-market.shared.tsx
25467
- var import_hooks66 = require("@agg-build/hooks");
25748
+ var import_hooks67 = require("@agg-build/hooks");
25468
25749
  var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
25469
25750
  var import_react42 = require("react");
25470
25751
  var import_jsx_runtime167 = require("react/jsx-runtime");
@@ -25533,7 +25814,7 @@ var EventMarketPageMobileTrade = ({
25533
25814
  midpointsResult,
25534
25815
  onBeforePrimaryAction
25535
25816
  }) => {
25536
- const labels = (0, import_hooks66.useLabels)();
25817
+ const labels = (0, import_hooks67.useLabels)();
25537
25818
  if (!showPlaceOrder) return null;
25538
25819
  const handleOpenChange = (nextOpen) => {
25539
25820
  onOpenChange(nextOpen);
@@ -25588,7 +25869,7 @@ var EventMarketPageMobileTrade = ({
25588
25869
  var EventMarketPageUnavailableState = ({
25589
25870
  ariaLabel: _ariaLabel
25590
25871
  }) => {
25591
- const labels = (0, import_hooks66.useLabels)();
25872
+ const labels = (0, import_hooks67.useLabels)();
25592
25873
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
25593
25874
  StateMessage,
25594
25875
  {
@@ -25604,7 +25885,7 @@ var EventMarketPageUnavailableState = ({
25604
25885
  var EventMarketPageNotFoundState = ({
25605
25886
  ariaLabel: _ariaLabel
25606
25887
  }) => {
25607
- const labels = (0, import_hooks66.useLabels)();
25888
+ const labels = (0, import_hooks67.useLabels)();
25608
25889
  return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
25609
25890
  StateMessage,
25610
25891
  {
@@ -25701,11 +25982,11 @@ var EventMarketPageLoadingState = ({
25701
25982
  };
25702
25983
 
25703
25984
  // src/pages/event-market/sports-event-market-page.tsx
25704
- var import_hooks69 = require("@agg-build/hooks");
25985
+ var import_hooks70 = require("@agg-build/hooks");
25705
25986
  var import_react45 = require("react");
25706
25987
 
25707
25988
  // src/pages/event-market/sports-markets.tsx
25708
- var import_hooks68 = require("@agg-build/hooks");
25989
+ var import_hooks69 = require("@agg-build/hooks");
25709
25990
  var import_react44 = require("react");
25710
25991
 
25711
25992
  // src/pages/event-market/sports-event-market.utils.ts
@@ -26554,7 +26835,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
26554
26835
  };
26555
26836
 
26556
26837
  // src/pages/event-market/sports-market-card.tsx
26557
- var import_hooks67 = require("@agg-build/hooks");
26838
+ var import_hooks68 = require("@agg-build/hooks");
26558
26839
  var import_react43 = require("react");
26559
26840
 
26560
26841
  // src/pages/event-market/sports-line-rail.tsx
@@ -26604,7 +26885,7 @@ function SportsLineRail({
26604
26885
  const didInit = React.useRef(false);
26605
26886
  const programmatic = React.useRef(false);
26606
26887
  const progTimer = React.useRef(void 0);
26607
- const skipCenterOnPropSync = React.useRef(false);
26888
+ const skipCenterForIndex = React.useRef(null);
26608
26889
  const pendingScrollIndex = React.useRef(null);
26609
26890
  const scrollSettleTimer = React.useRef(void 0);
26610
26891
  const stopCount = stops.length;
@@ -26644,9 +26925,15 @@ function SportsLineRail({
26644
26925
  if (!w) return;
26645
26926
  const firstW = (_b = (_a = itemRefs.current[0]) == null ? void 0 : _a.offsetWidth) != null ? _b : 0;
26646
26927
  const lastW = (_d = (_c = itemRefs.current[stopCount - 1]) == null ? void 0 : _c.offsetWidth) != null ? _d : 0;
26647
- setPad({
26928
+ const nextPad = {
26648
26929
  left: Math.max(0, w / 2 - firstW / 2),
26649
26930
  right: Math.max(0, w / 2 - lastW / 2)
26931
+ };
26932
+ setPad((currentPad) => {
26933
+ if (currentPad.left === nextPad.left && currentPad.right === nextPad.right) {
26934
+ return currentPad;
26935
+ }
26936
+ return nextPad;
26650
26937
  });
26651
26938
  updateMask();
26652
26939
  };
@@ -26659,7 +26946,7 @@ function SportsLineRail({
26659
26946
  scrollSettleTimer.current = setTimeout(() => {
26660
26947
  const nextIndex = pendingScrollIndex.current;
26661
26948
  if (nextIndex == null || nextIndex === selectedIndex) return;
26662
- skipCenterOnPropSync.current = true;
26949
+ skipCenterForIndex.current = nextIndex;
26663
26950
  onSelect(nextIndex);
26664
26951
  }, 120);
26665
26952
  }
@@ -26683,11 +26970,12 @@ function SportsLineRail({
26683
26970
  const c = scrollRef.current;
26684
26971
  const el = itemRefs.current[selectedIndex];
26685
26972
  if (!c || !el || !c.clientWidth) return;
26686
- if (skipCenterOnPropSync.current) {
26687
- skipCenterOnPropSync.current = false;
26973
+ if (skipCenterForIndex.current === selectedIndex) {
26974
+ skipCenterForIndex.current = null;
26688
26975
  updateMask();
26689
26976
  return;
26690
26977
  }
26978
+ skipCenterForIndex.current = null;
26691
26979
  const max = c.scrollWidth - c.clientWidth;
26692
26980
  const target = el.offsetLeft - c.clientWidth / 2 + el.clientWidth / 2;
26693
26981
  programmatic.current = true;
@@ -26702,11 +26990,18 @@ function SportsLineRail({
26702
26990
  }, 500);
26703
26991
  updateMask();
26704
26992
  }, [selectedIndex, stopCount, pad, updateMask]);
26705
- const select = (index) => {
26706
- const next = Math.min(stops.length - 1, Math.max(0, index));
26993
+ const clampStopIndex = (index) => Math.min(stops.length - 1, Math.max(0, index));
26994
+ const handleStopClick = (index) => {
26995
+ const next = clampStopIndex(index);
26996
+ if (next !== selectedIndex) {
26997
+ skipCenterForIndex.current = next;
26998
+ }
26999
+ onSelect(next);
27000
+ };
27001
+ const handleStep = (delta) => {
27002
+ const next = clampStopIndex(selectedIndex + delta);
26707
27003
  if (next !== selectedIndex) onSelect(next);
26708
27004
  };
26709
- const step = (delta) => select(selectedIndex + delta);
26710
27005
  if (stopCount === 0) return null;
26711
27006
  return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(
26712
27007
  "div",
@@ -26718,7 +27013,7 @@ function SportsLineRail({
26718
27013
  "button",
26719
27014
  {
26720
27015
  type: "button",
26721
- onClick: () => step(-1),
27016
+ onClick: () => handleStep(-1),
26722
27017
  disabled: selectedIndex === 0,
26723
27018
  "aria-label": previousAriaLabel != null ? previousAriaLabel : "Previous line",
26724
27019
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -26741,7 +27036,7 @@ function SportsLineRail({
26741
27036
  ref: (el) => {
26742
27037
  itemRefs.current[index] = el;
26743
27038
  },
26744
- onClick: () => select(index),
27039
+ onClick: () => handleStopClick(index),
26745
27040
  disabled: stop.disabled,
26746
27041
  "aria-pressed": active,
26747
27042
  className: "flex shrink-0 cursor-pointer flex-col items-center gap-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
@@ -26787,7 +27082,7 @@ function SportsLineRail({
26787
27082
  "button",
26788
27083
  {
26789
27084
  type: "button",
26790
- onClick: () => step(1),
27085
+ onClick: () => handleStep(1),
26791
27086
  disabled: selectedIndex === stopCount - 1,
26792
27087
  "aria-label": nextAriaLabel != null ? nextAriaLabel : "Next line",
26793
27088
  className: "flex size-5! shrink-0 cursor-pointer items-center justify-center text-agg-muted-foreground transition-colors hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-30",
@@ -26801,15 +27096,81 @@ function SportsLineRail({
26801
27096
 
26802
27097
  // src/pages/event-market/sports-market-card.tsx
26803
27098
  var import_jsx_runtime169 = require("react/jsx-runtime");
26804
- var resolveSportsLineOutcomeSide = (outcome) => {
27099
+ var resolveSpreadHeaderOutcomeItems = ({
27100
+ market,
27101
+ groupMarkets,
27102
+ midpointsResult
27103
+ }) => {
26805
27104
  var _a;
26806
- for (const candidate of [outcome.label, outcome.title]) {
26807
- if (typeof candidate !== "string") continue;
26808
- const matchedSide = (_a = candidate.trim().toLowerCase().match(/(?:^|\s)(over|under)(?=\s|$)/)) == null ? void 0 : _a[1];
26809
- if (matchedSide === "over" || matchedSide === "under") return matchedSide;
26810
- }
27105
+ const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
27106
+ const lineValue = market.lineValue;
27107
+ if (outcomes.length < 2 || lineValue == null) return void 0;
27108
+ const { favored, dog } = resolveSpreadOutcomeTeamNames(market, groupMarkets);
27109
+ if (!favored && !dog) return void 0;
27110
+ const magnitude = Math.abs(lineValue);
27111
+ const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
27112
+ return [
27113
+ { index: 0, name: favored, signedLine: -magnitude },
27114
+ { index: 1, name: dog, signedLine: magnitude }
27115
+ ].flatMap(({ index, name, signedLine }) => {
27116
+ var _a2;
27117
+ const outcome = outcomes[index];
27118
+ if (!outcome) return [];
27119
+ const label2 = name != null ? name : outcome.label.trim();
27120
+ const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
27121
+ outcomeId: outcome.id,
27122
+ outcomeLabel: outcome.label,
27123
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
27124
+ });
27125
+ return [
27126
+ {
27127
+ id: outcome.id,
27128
+ label: label2,
27129
+ title: label2,
27130
+ lineLabel: formatLine(signedLine),
27131
+ probability,
27132
+ isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
27133
+ tone: index === 0 ? "positive" : "negative",
27134
+ variant: "line",
27135
+ venue: market.venue
27136
+ }
27137
+ ];
27138
+ });
27139
+ };
27140
+ var resolveDisplayedOutcomes = ({
27141
+ market,
27142
+ venueMarkets,
27143
+ groupMarkets,
27144
+ useSpreadOverride
27145
+ }) => {
27146
+ var _a;
27147
+ const spreadHeaderOutcomeItems = useSpreadOverride ? resolveSpreadHeaderOutcomeItems({ market, groupMarkets }) : void 0;
27148
+ const resolvedMarket = resolveMarketFromVenueMarkets(venueMarkets, market.id);
27149
+ const headerOutcomeItems = spreadHeaderOutcomeItems != null ? spreadHeaderOutcomeItems : resolveHeaderOutcomeItems(
27150
+ (_a = resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets) != null ? _a : [market],
27151
+ market,
27152
+ resolveSportsMarketCardVariant(market)
27153
+ );
27154
+ return headerOutcomeItems.flatMap((item) => {
27155
+ const outcome = market.venueMarketOutcomes.find((candidate) => candidate.id === item.id);
27156
+ return outcome ? [outcome] : [];
27157
+ });
27158
+ };
27159
+ var resolveSelectedOutcomeSide = ({
27160
+ displayedOutcomes,
27161
+ selectedOutcomeId
27162
+ }) => {
27163
+ const selectedOutcomeIndex = displayedOutcomes.findIndex(
27164
+ (outcome) => outcome.id === selectedOutcomeId
27165
+ );
27166
+ if (selectedOutcomeIndex === 0) return "left";
27167
+ if (selectedOutcomeIndex === 1) return "right";
26811
27168
  return null;
26812
27169
  };
27170
+ var resolveOutcomeBySide = (displayedOutcomes, side) => {
27171
+ var _a;
27172
+ return (_a = displayedOutcomes[side === "right" ? 1 : 0]) != null ? _a : displayedOutcomes[0];
27173
+ };
26813
27174
  var SportsMarketCard = ({
26814
27175
  group,
26815
27176
  venueMarkets,
@@ -26822,11 +27183,11 @@ var SportsMarketCard = ({
26822
27183
  midpointsResult
26823
27184
  }) => {
26824
27185
  var _a, _b, _c, _d, _e, _f, _g;
26825
- const labels = (0, import_hooks67.useLabels)();
27186
+ const labels = (0, import_hooks68.useLabels)();
26826
27187
  const {
26827
27188
  formatting: { formatCompactCurrency }
26828
- } = (0, import_hooks67.useSdkUiConfig)();
26829
- const tradingContext = (0, import_hooks67.useEventTradingContext)();
27189
+ } = (0, import_hooks68.useSdkUiConfig)();
27190
+ const tradingContext = (0, import_hooks68.useEventTradingContext)();
26830
27191
  const slide = (0, import_react43.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
26831
27192
  const [selectedLineIndex, setSelectedLineIndex] = (0, import_react43.useState)(slide.defaultStopIndex);
26832
27193
  const combinedMoneylineMarkets = (0, import_react43.useMemo)(
@@ -26867,7 +27228,7 @@ var SportsMarketCard = ({
26867
27228
  const justOpened = isExpanded && !wasExpandedRef.current;
26868
27229
  wasExpandedRef.current = isExpanded;
26869
27230
  if (!justOpened || !activeMarket) return;
26870
- if ((0, import_hooks67.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
27231
+ if ((0, import_hooks68.resolveMarketTradingState)(activeMarket).isTradingDisabled) return;
26871
27232
  const selectedOutcomeId = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId;
26872
27233
  const hasInScopeOutcome = selectedOutcomeId != null && activeMarket.venueMarketOutcomes.some((outcome) => outcome.id === selectedOutcomeId);
26873
27234
  if (hasInScopeOutcome) return;
@@ -26927,69 +27288,46 @@ var SportsMarketCard = ({
26927
27288
  });
26928
27289
  }, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
26929
27290
  const spreadHeaderOutcomeItems = (0, import_react43.useMemo)(() => {
26930
- var _a2;
26931
27291
  if (slide.kind !== "spread" || !activeMarket) return void 0;
26932
- const outcomes = (_a2 = activeMarket.venueMarketOutcomes) != null ? _a2 : [];
26933
- const lineValue = activeMarket.lineValue;
26934
- if (outcomes.length < 2 || lineValue == null) return void 0;
26935
- const { favored, dog } = resolveSpreadOutcomeTeamNames(activeMarket, group.markets);
26936
- if (!favored && !dog) return void 0;
26937
- const magnitude = Math.abs(lineValue);
26938
- const formatLine = (value) => `${value > 0 ? "+" : "\u2212"}${Number.isInteger(magnitude) ? String(magnitude) : magnitude.toFixed(1)}`;
26939
- return [
26940
- { index: 0, name: favored, signedLine: -magnitude },
26941
- { index: 1, name: dog, signedLine: magnitude }
26942
- ].flatMap(({ index, name, signedLine }) => {
26943
- var _a3;
26944
- const outcome = outcomes[index];
26945
- if (!outcome) return [];
26946
- const label2 = name != null ? name : outcome.label.trim();
26947
- const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
26948
- outcomeId: outcome.id,
26949
- outcomeLabel: outcome.label,
26950
- bestMidpointsByOutcomeId: (_a3 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a3 : midpointsResult.prices
26951
- });
26952
- return [
26953
- {
26954
- id: outcome.id,
26955
- label: label2,
26956
- title: label2,
26957
- lineLabel: formatLine(signedLine),
26958
- probability,
26959
- isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
26960
- tone: index === 0 ? "positive" : "negative",
26961
- variant: "line",
26962
- venue: activeMarket.venue
26963
- }
26964
- ];
27292
+ return resolveSpreadHeaderOutcomeItems({
27293
+ market: activeMarket,
27294
+ groupMarkets: group.markets,
27295
+ midpointsResult
26965
27296
  });
26966
27297
  }, [slide.kind, activeMarket, group.markets, midpointsResult]);
26967
27298
  const headerOutcomeItemsOverride = combinedMoneylineHeaderOutcomeItems != null ? combinedMoneylineHeaderOutcomeItems : spreadHeaderOutcomeItems;
26968
27299
  const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
26969
27300
  const handleLineSelect = (index) => {
26970
- var _a2, _b2;
26971
- const previousMarket = activeMarket;
27301
+ var _a2, _b2, _c2;
27302
+ const targetMarket = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
27303
+ if (!targetMarket) return;
27304
+ const selectedMarket = (_c2 = (_b2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b2 : venueMarkets.find((market) => market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId))) != null ? _c2 : null;
27305
+ const selectedMarketIsInGroup = selectedMarket != null && group.markets.some((market) => market.id === selectedMarket.id);
27306
+ const selectedSide = selectedMarket ? resolveSelectedOutcomeSide({
27307
+ displayedOutcomes: resolveDisplayedOutcomes({
27308
+ market: selectedMarket,
27309
+ venueMarkets,
27310
+ groupMarkets: group.markets,
27311
+ useSpreadOverride: slide.kind === "spread" && selectedMarketIsInGroup
27312
+ }),
27313
+ selectedOutcomeId: tradingContext == null ? void 0 : tradingContext.selectedOutcomeId
27314
+ }) : null;
27315
+ const targetDisplayedOutcomes = resolveDisplayedOutcomes({
27316
+ market: targetMarket,
27317
+ venueMarkets,
27318
+ groupMarkets: group.markets,
27319
+ useSpreadOverride: slide.kind === "spread"
27320
+ });
27321
+ const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
26972
27322
  setSelectedLineIndex(index);
26973
- const market = (_a2 = slide.stops[index]) == null ? void 0 : _a2.market;
26974
- if (!market) return;
26975
- const previousOutcomeIndex = previousMarket ? previousMarket.venueMarketOutcomes.findIndex(
26976
- (outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
26977
- ) : -1;
26978
- const previousOutcome = previousOutcomeIndex >= 0 ? previousMarket == null ? void 0 : previousMarket.venueMarketOutcomes[previousOutcomeIndex] : void 0;
26979
- const previousOutcomeSide = previousOutcome ? resolveSportsLineOutcomeSide(previousOutcome) : null;
26980
- const matchingSideOutcomes = previousOutcomeSide ? market.venueMarketOutcomes.filter(
26981
- (outcome) => resolveSportsLineOutcomeSide(outcome) === previousOutcomeSide
26982
- ) : [];
26983
- const matchingSideOutcome = matchingSideOutcomes.length === 1 ? matchingSideOutcomes[0] : void 0;
26984
- const nextOutcome = (_b2 = matchingSideOutcome != null ? matchingSideOutcome : previousOutcomeIndex >= 0 ? market.venueMarketOutcomes[previousOutcomeIndex] : void 0) != null ? _b2 : market.venueMarketOutcomes[0];
26985
27323
  if (nextOutcome) {
26986
- tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(market.id, nextOutcome.id);
27324
+ tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
26987
27325
  onOutcomeSelect == null ? void 0 : onOutcomeSelect(group.id, {
26988
- marketId: market.id,
27326
+ marketId: targetMarket.id,
26989
27327
  outcomeId: nextOutcome.id
26990
27328
  });
26991
27329
  } else {
26992
- tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
27330
+ tradingContext == null ? void 0 : tradingContext.selectMarket(targetMarket.id, targetMarket);
26993
27331
  }
26994
27332
  };
26995
27333
  return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(
@@ -27012,7 +27350,7 @@ var SportsMarketCard = ({
27012
27350
  stops: slide.stops.map((stop) => ({
27013
27351
  value: stop.value,
27014
27352
  venues: stop.venues,
27015
- disabled: stop.market.status !== import_hooks67.MarketStatus.open
27353
+ disabled: stop.market.status !== import_hooks68.MarketStatus.open
27016
27354
  })),
27017
27355
  selectedIndex: selectedLineIndex,
27018
27356
  onSelect: handleLineSelect,
@@ -27099,7 +27437,7 @@ var SportsTabButton = ({
27099
27437
  );
27100
27438
  };
27101
27439
  var SportsMarketsLoadingState = () => {
27102
- const labels = (0, import_hooks68.useLabels)();
27440
+ const labels = (0, import_hooks69.useLabels)();
27103
27441
  return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)(
27104
27442
  "div",
27105
27443
  {
@@ -27137,13 +27475,13 @@ var SportsMarkets = ({
27137
27475
  midpointsResult
27138
27476
  }) => {
27139
27477
  var _a, _b;
27140
- const labels = (0, import_hooks68.useLabels)();
27141
- const tradingContext = (0, import_hooks68.useEventTradingContext)();
27478
+ const labels = (0, import_hooks69.useLabels)();
27479
+ const tradingContext = (0, import_hooks69.useEventTradingContext)();
27142
27480
  const hasAggKey = Boolean(event.aggKey);
27143
- const gameMarketsQuery = (0, import_hooks68.useVenueMarkets)({
27481
+ const gameMarketsQuery = (0, import_hooks69.useVenueMarkets)({
27144
27482
  aggKey: event.aggKey ? [event.aggKey] : void 0,
27145
27483
  limit: 100,
27146
- status: import_hooks68.MarketStatus.open,
27484
+ status: import_hooks69.MarketStatus.open,
27147
27485
  enabled: hasAggKey
27148
27486
  });
27149
27487
  const {
@@ -27179,7 +27517,7 @@ var SportsMarkets = ({
27179
27517
  const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react44.useState)({});
27180
27518
  const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
27181
27519
  const sectionFilters = resolveSportsSectionFilters(activeTab);
27182
- const sectionMarketsQuery = (0, import_hooks68.useVenueMarkets)({
27520
+ const sectionMarketsQuery = (0, import_hooks69.useVenueMarkets)({
27183
27521
  aggKey: event.aggKey ? [event.aggKey] : void 0,
27184
27522
  sportsMarketType: sectionFilters.sportsMarketType,
27185
27523
  period: sectionFilters.period,
@@ -27189,7 +27527,7 @@ var SportsMarkets = ({
27189
27527
  // heavy tab (e.g. "Other" spans other/team_props/player_props/specials/
27190
27528
  // completion — hundreds of markets on prop-rich events) from ~15 calls to 1-3.
27191
27529
  limit: 100,
27192
- status: import_hooks68.MarketStatus.open,
27530
+ status: import_hooks69.MarketStatus.open,
27193
27531
  enabled: hasAggKey
27194
27532
  });
27195
27533
  const {
@@ -27275,7 +27613,7 @@ var SportsMarkets = ({
27275
27613
  return;
27276
27614
  }
27277
27615
  setExpandedGroupId(groupId);
27278
- if ((0, import_hooks68.resolveMarketTradingState)(market).isTradingDisabled) return;
27616
+ if ((0, import_hooks69.resolveMarketTradingState)(market).isTradingDisabled) return;
27279
27617
  if (market.id !== (tradingContext == null ? void 0 : tradingContext.selectedMarketId)) {
27280
27618
  tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
27281
27619
  }
@@ -27379,7 +27717,7 @@ var SportsEventMarketPage = ({
27379
27717
  sectionMarketsByKey
27380
27718
  });
27381
27719
  }, [event, sectionMarketsByKey]);
27382
- const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks69.resolveEventTradingState)(composedEvent), [composedEvent]);
27720
+ const eventTradingState = (0, import_react45.useMemo)(() => (0, import_hooks70.resolveEventTradingState)(composedEvent), [composedEvent]);
27383
27721
  const hasSportsSections = (0, import_react45.useMemo)(
27384
27722
  () => resolveVisibleSportsSectionTabs(event).length > 0,
27385
27723
  [event]
@@ -27389,12 +27727,12 @@ var SportsEventMarketPage = ({
27389
27727
  });
27390
27728
  const {
27391
27729
  trading: { executionMode: configuredExecutionMode }
27392
- } = (0, import_hooks69.useSdkUiConfig)();
27730
+ } = (0, import_hooks70.useSdkUiConfig)();
27393
27731
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
27394
27732
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react45.useState)(false);
27395
27733
  const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
27396
- const tradingContext = (0, import_hooks69.useEventTradingContext)();
27397
- const midpointsResult = (0, import_hooks69.useMidpoints)(composedEvent.venueMarkets);
27734
+ const tradingContext = (0, import_hooks70.useEventTradingContext)();
27735
+ const midpointsResult = (0, import_hooks70.useMidpoints)(composedEvent.venueMarkets);
27398
27736
  const internalResolvedClaim = useResolvedMarketClaim({
27399
27737
  market: eventTradingState.primaryMarket,
27400
27738
  enabled: eventTradingState.kind === "resolved",
@@ -27406,7 +27744,7 @@ var SportsEventMarketPage = ({
27406
27744
  (0, import_react45.useEffect)(() => {
27407
27745
  return () => {
27408
27746
  var _a;
27409
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks69.TradeSide.Buy);
27747
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks70.TradeSide.Buy);
27410
27748
  };
27411
27749
  }, []);
27412
27750
  const handleSectionMarketsChange = (0, import_react45.useCallback)(
@@ -27578,22 +27916,22 @@ var EventMarketPageContent = ({
27578
27916
  resolvedClaim,
27579
27917
  onBeforePrimaryAction
27580
27918
  }) => {
27581
- const eventTradingState = (0, import_react46.useMemo)(() => (0, import_hooks70.resolveEventTradingState)(event), [event]);
27919
+ const eventTradingState = (0, import_react46.useMemo)(() => (0, import_hooks71.resolveEventTradingState)(event), [event]);
27582
27920
  const stickyOrderPanelState = resolveEventMarketPageStickyState({
27583
27921
  stickyOrderPanel
27584
27922
  });
27585
27923
  const {
27586
27924
  trading: { executionMode: configuredExecutionMode }
27587
- } = (0, import_hooks70.useSdkUiConfig)();
27925
+ } = (0, import_hooks71.useSdkUiConfig)();
27588
27926
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
27589
27927
  const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react46.useState)(false);
27590
27928
  const isMobileViewport = useIsMobileEventMarketViewport();
27591
- const tradingContext = (0, import_hooks70.useEventTradingContext)();
27929
+ const tradingContext = (0, import_hooks71.useEventTradingContext)();
27592
27930
  const eventDetailVenueMarkets = (0, import_react46.useMemo)(
27593
27931
  () => normalizeVenueMarketCluster(event.venueMarkets),
27594
27932
  [event.venueMarkets]
27595
27933
  );
27596
- const midpointsResult = (0, import_hooks70.useMidpoints)(eventDetailVenueMarkets);
27934
+ const midpointsResult = (0, import_hooks71.useMidpoints)(eventDetailVenueMarkets);
27597
27935
  const internalResolvedClaim = useResolvedMarketClaim({
27598
27936
  market: eventTradingState.primaryMarket,
27599
27937
  enabled: eventTradingState.kind === "resolved",
@@ -27605,7 +27943,7 @@ var EventMarketPageContent = ({
27605
27943
  (0, import_react46.useEffect)(() => {
27606
27944
  return () => {
27607
27945
  var _a;
27608
- (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks70.TradeSide.Buy);
27946
+ (_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks71.TradeSide.Buy);
27609
27947
  };
27610
27948
  }, []);
27611
27949
  if (!event.venueMarkets.length) {
@@ -27739,14 +28077,14 @@ var EventMarketPage = (props) => {
27739
28077
  var _a;
27740
28078
  const {
27741
28079
  features: { showSportsMarkets }
27742
- } = (0, import_hooks70.useSdkUiConfig)();
28080
+ } = (0, import_hooks71.useSdkUiConfig)();
27743
28081
  const hasEventProp = "event" in props && !!props.event;
27744
28082
  const {
27745
28083
  event: fetchedEvent,
27746
28084
  error: eventError,
27747
28085
  isLoading: isFetchingEvent,
27748
28086
  isEnriching
27749
- } = (0, import_hooks70.useEnrichedVenueEvent)({
28087
+ } = (0, import_hooks71.useEnrichedVenueEvent)({
27750
28088
  eventId: hasEventProp ? "" : (_a = props.eventId) != null ? _a : "",
27751
28089
  enabled: !props.isLoading && !hasEventProp && !!props.eventId
27752
28090
  });
@@ -27933,14 +28271,14 @@ var HomeSearchResults = ({
27933
28271
  onEventClick,
27934
28272
  onMarketClick
27935
28273
  }) => {
27936
- const labels = (0, import_hooks71.useLabels)();
27937
- const { search: searchConfig } = (0, import_hooks71.useSdkUiConfig)();
27938
- const { disabledVenues } = (0, import_hooks71.useAppConfig)();
28274
+ const labels = (0, import_hooks72.useLabels)();
28275
+ const { search: searchConfig } = (0, import_hooks72.useSdkUiConfig)();
28276
+ const { disabledVenues } = (0, import_hooks72.useAppConfig)();
27939
28277
  const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react49.useState)("all");
27940
28278
  const eventListTabs = useEventListTabs();
27941
28279
  const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
27942
28280
  const visibleVenues = (0, import_react49.useMemo)(
27943
- () => disabledVenues.length === 0 ? void 0 : (0, import_hooks71.getVisibleVenueIdsByConfig)(import_sdk24.VENUES, disabledVenues),
28281
+ () => disabledVenues.length === 0 ? void 0 : (0, import_hooks72.getVisibleVenueIdsByConfig)(import_sdk24.VENUES, disabledVenues),
27944
28282
  [disabledVenues]
27945
28283
  );
27946
28284
  const activeVenueTab = (0, import_react49.useMemo)(() => {
@@ -27958,7 +28296,7 @@ var HomeSearchResults = ({
27958
28296
  hasNextPage,
27959
28297
  isFetchingNextPage,
27960
28298
  isPlaceholderData
27961
- } = (0, import_hooks71.useSearch)({
28299
+ } = (0, import_hooks72.useSearch)({
27962
28300
  q: query,
27963
28301
  type: "events",
27964
28302
  categoryIds: activeTabValue === ALL_CATEGORIES_TAB_VALUE ? void 0 : activeCategoryTab == null ? void 0 : activeCategoryTab.categoryIds,
@@ -27986,7 +28324,7 @@ var HomeSearchResults = ({
27986
28324
  const visibleMidpointVenueMarketIds = (0, import_react49.useMemo)(() => {
27987
28325
  return collectVisibleVenueMarketIds(visibleVenueMarkets);
27988
28326
  }, [visibleVenueMarkets]);
27989
- const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks71.useVenueMarketMidpoints)({
28327
+ const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks72.useVenueMarketMidpoints)({
27990
28328
  venueMarketIds: visibleMidpointVenueMarketIds,
27991
28329
  enabled: visibleMidpointVenueMarketIds.length > 0
27992
28330
  });
@@ -28135,7 +28473,7 @@ var HomePage = ({
28135
28473
  stickyOrderPanel
28136
28474
  }) => {
28137
28475
  var _a, _b, _c, _d;
28138
- const labels = (0, import_hooks71.useLabels)();
28476
+ const labels = (0, import_hooks72.useLabels)();
28139
28477
  const {
28140
28478
  search: {
28141
28479
  value: searchValue,
@@ -28145,8 +28483,8 @@ var HomePage = ({
28145
28483
  onSelect: onSelectEventInternal
28146
28484
  },
28147
28485
  trading: { executionMode }
28148
- } = (0, import_hooks71.useSdkUiConfig)();
28149
- const { capture, consume } = (0, import_hooks71.useEventListState)();
28486
+ } = (0, import_hooks72.useSdkUiConfig)();
28487
+ const { capture, consume } = (0, import_hooks72.useEventListState)();
28150
28488
  const [snapshot] = (0, import_react49.useState)(() => consume());
28151
28489
  const eventListStateRef = (0, import_react49.useRef)(null);
28152
28490
  const handleSelectEvent = (0, import_react49.useCallback)(
@@ -28216,7 +28554,7 @@ var HomePage = ({
28216
28554
  }, [isShowingAllResults, normalizedSearchValue, selectedEvent]);
28217
28555
  const resolvedSelectedEvent = selectedEvent != null ? selectedEvent : stickySelectedEvent;
28218
28556
  const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
28219
- const { categories } = (0, import_hooks71.useCategories)({
28557
+ const { categories } = (0, import_hooks72.useCategories)({
28220
28558
  limit: categoriesLimit,
28221
28559
  enabled: !hasCustomTabs
28222
28560
  });
@@ -28426,7 +28764,7 @@ var HomePage = ({
28426
28764
  HomePage.displayName = "HomePage";
28427
28765
 
28428
28766
  // src/pages/user-profile/index.tsx
28429
- var import_hooks78 = require("@agg-build/hooks");
28767
+ var import_hooks79 = require("@agg-build/hooks");
28430
28768
  var import_sdk26 = require("@agg-build/sdk");
28431
28769
  var import_dayjs9 = __toESM(require("dayjs"));
28432
28770
  var import_react51 = require("react");
@@ -28452,7 +28790,7 @@ var formatChainIdLabel = (chainId) => {
28452
28790
  };
28453
28791
 
28454
28792
  // src/pages/user-profile/components/available-balance-card.tsx
28455
- var import_hooks72 = require("@agg-build/hooks");
28793
+ var import_hooks73 = require("@agg-build/hooks");
28456
28794
  var import_jsx_runtime174 = require("react/jsx-runtime");
28457
28795
  var BASE_URL = "https://assets.snagsolutions.io";
28458
28796
  var CHAIN_ID_TO_ICON_URL = {
@@ -28508,7 +28846,7 @@ var AvailableBalanceCard = ({
28508
28846
  isLoading = false,
28509
28847
  className
28510
28848
  }) => {
28511
- const labels = (0, import_hooks72.useLabels)();
28849
+ const labels = (0, import_hooks73.useLabels)();
28512
28850
  const balanceLabels = labels.userProfile.balance;
28513
28851
  const resolvedLabel = label2 != null ? label2 : balanceLabels.availableBalance;
28514
28852
  const hasPaperBalance = chains.some(isPaperChain);
@@ -28668,7 +29006,7 @@ var AvailableBalanceCard = ({
28668
29006
  AvailableBalanceCard.displayName = "AvailableBalanceCard";
28669
29007
 
28670
29008
  // src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
28671
- var import_hooks73 = require("@agg-build/hooks");
29009
+ var import_hooks74 = require("@agg-build/hooks");
28672
29010
  var import_sdk25 = require("@agg-build/sdk");
28673
29011
  var import_jsx_runtime175 = require("react/jsx-runtime");
28674
29012
  var CLAIM_VENUE_LABELS = {
@@ -28687,7 +29025,7 @@ var ClaimActivityBreakdownModal = ({
28687
29025
  onTransactionSelect
28688
29026
  }) => {
28689
29027
  var _a;
28690
- const labels = (0, import_hooks73.useLabels)();
29028
+ const labels = (0, import_hooks74.useLabels)();
28691
29029
  return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
28692
29030
  Modal,
28693
29031
  {
@@ -28796,7 +29134,7 @@ var ClaimActivityBreakdownModal = ({
28796
29134
  };
28797
29135
 
28798
29136
  // src/pages/user-profile/components/positions-activity.tsx
28799
- var import_hooks76 = require("@agg-build/hooks");
29137
+ var import_hooks77 = require("@agg-build/hooks");
28800
29138
  var import_react50 = require("react");
28801
29139
 
28802
29140
  // src/pages/user-profile/user-profile.constants.ts
@@ -28846,17 +29184,19 @@ var parsePercentLabel = (label2) => {
28846
29184
  const parsed = Number(match[1].replace(/,/g, ""));
28847
29185
  return Number.isFinite(parsed) ? parsed : null;
28848
29186
  };
28849
- var formatCurrency = (value) => {
29187
+ var formatCurrency = (value, formatCurrencyOverride) => {
28850
29188
  if (!isFiniteNumber(value)) return missingLabel;
29189
+ if (formatCurrencyOverride) return formatCurrencyOverride(value);
28851
29190
  return usdFormatter.format(value);
28852
29191
  };
28853
- var formatSignedCurrency = (value) => {
29192
+ var formatSignedCurrency = (value, formatCurrencyOverride) => {
28854
29193
  if (!isFiniteNumber(value)) return missingLabel;
28855
- if (value === 0) return usdFormatter.format(0);
28856
- return `${value > 0 ? "+" : "-"}${usdFormatter.format(Math.abs(value))}`;
29194
+ if (value === 0) return formatCurrency(0, formatCurrencyOverride);
29195
+ return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
28857
29196
  };
28858
- var formatPriceCents2 = (value) => {
29197
+ var formatPriceCents2 = (value, formatPrice) => {
28859
29198
  if (!isFiniteNumber(value)) return missingLabel;
29199
+ if (formatPrice) return formatPrice(value);
28860
29200
  return `${Math.round(value * 100)}\xA2`;
28861
29201
  };
28862
29202
  var formatSignedPercent = (value) => {
@@ -28951,7 +29291,8 @@ var getPositionTone = (value) => {
28951
29291
  if (!isFiniteNumber(value) || value === 0) return "neutral";
28952
29292
  return value > 0 ? "positive" : "negative";
28953
29293
  };
28954
- var toPositionRowViewModel = (position, labels = defaultLabels2) => {
29294
+ var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}) => {
29295
+ const { formatCurrency: currency, formatPrice: price } = formatters;
28955
29296
  const positionStatus = resolvePositionStatus(position);
28956
29297
  const currentValue = getCurrentValue(position);
28957
29298
  const currentPnl = getPnlValue(position, currentValue);
@@ -28969,20 +29310,20 @@ var toPositionRowViewModel = (position, labels = defaultLabels2) => {
28969
29310
  resolutionLabel: position.resolutionLabel || position.outcomeLabel || missingLabel,
28970
29311
  venueShareBreakdown: position.venueShareBreakdown,
28971
29312
  totalTraded: {
28972
- primaryLabel: formatCurrency(getTotalTradedValue(position)),
28973
- averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position))}`
29313
+ primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
29314
+ averageLabel: `${labels.avgPrefix} ${formatPriceCents2(getAveragePrice(position), price)}`
28974
29315
  },
28975
29316
  currentValue: {
28976
- primaryLabel: formatCurrency(currentValue),
28977
- deltaLabel: formatSignedCurrency(currentPnl),
28978
- priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position))}`,
29317
+ primaryLabel: formatCurrency(currentValue, currency),
29318
+ deltaLabel: formatSignedCurrency(currentPnl, currency),
29319
+ priceLabel: `${labels.nowPrefix} ${formatPriceCents2(getCurrentPrice(position), price)}`,
28979
29320
  percentLabel: formatSignedPercent(currentPercent),
28980
29321
  tone: getPositionTone(currentPnl)
28981
29322
  },
28982
29323
  payout: {
28983
- primaryLabel: formatCurrency(finalPayout),
28984
- deltaLabel: formatSignedCurrency(payoutPnl),
28985
- priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position))}`,
29324
+ primaryLabel: formatCurrency(finalPayout, currency),
29325
+ deltaLabel: formatSignedCurrency(payoutPnl, currency),
29326
+ priceLabel: `${labels.finalPrefix} ${formatPriceCents2(getFinalPrice(position), price)}`,
28986
29327
  percentLabel: formatSignedPercent(payoutPercent),
28987
29328
  tone: getPositionTone(payoutPnl)
28988
29329
  },
@@ -29584,11 +29925,24 @@ var EmptyState = ({ title: title2, description, className }) => {
29584
29925
  EmptyState.displayName = "EmptyState";
29585
29926
 
29586
29927
  // src/pages/user-profile/components/open-order-row.tsx
29587
- var import_hooks74 = require("@agg-build/hooks");
29928
+ var import_hooks75 = require("@agg-build/hooks");
29588
29929
  var import_jsx_runtime178 = require("react/jsx-runtime");
29589
29930
  var shouldUseNativeLinkNavigation2 = (event) => {
29590
29931
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
29591
29932
  };
29933
+ var CANCELLABLE_LIMIT_ORDER_STATUSES = /* @__PURE__ */ new Set([
29934
+ "submitted",
29935
+ "open",
29936
+ "partially_filled_open",
29937
+ "cancel_pending"
29938
+ ]);
29939
+ var canCancelOpenOrder = (order) => {
29940
+ const status = order.status.trim().toLowerCase();
29941
+ if (status === "pending" && !order.dagRunId) return true;
29942
+ const isLimitOrder = order.orderType === "limit" || order.limitPriceLabel != null;
29943
+ if (!isLimitOrder) return false;
29944
+ return CANCELLABLE_LIMIT_ORDER_STATUSES.has(status);
29945
+ };
29592
29946
  var OpenOrderRow = ({
29593
29947
  order,
29594
29948
  href,
@@ -29603,7 +29957,7 @@ var OpenOrderRow = ({
29603
29957
  expirationHeader
29604
29958
  }) => {
29605
29959
  var _a, _b, _c, _d;
29606
- const labels = (0, import_hooks74.useLabels)().userProfile.openOrders;
29960
+ const labels = (0, import_hooks75.useLabels)().userProfile.openOrders;
29607
29961
  const resolvedCancelLabel = cancelLabel != null ? cancelLabel : labels.cancel;
29608
29962
  const resolvedCancelAriaLabel = cancelAriaLabel != null ? cancelAriaLabel : labels.cancelOrderAria(order.id);
29609
29963
  const resolvedLimitPriceHeader = limitPriceHeader != null ? limitPriceHeader : labels.limitPriceHeader;
@@ -29624,9 +29978,7 @@ var OpenOrderRow = ({
29624
29978
  event.stopPropagation();
29625
29979
  onCancel == null ? void 0 : onCancel(order);
29626
29980
  };
29627
- const status = order.status.toLowerCase();
29628
- const isLimitOrder = order.orderType === "limit";
29629
- const canCancel = status === "open" || status === "partially_filled_open" || status === "cancel_pending" || status === "submitted" && isLimitOrder || status === "pending" && !order.dagRunId;
29981
+ const canCancel = canCancelOpenOrder(order);
29630
29982
  const Wrapper = href ? "a" : "div";
29631
29983
  const wrapperProps = href ? {
29632
29984
  href,
@@ -29658,7 +30010,7 @@ var OpenOrderRow = ({
29658
30010
  /* @__PURE__ */ (0, import_jsx_runtime178.jsx)("div", { className: "agg-open-order-image flex h-10 w-10 shrink-0 items-center justify-center lg:h-15 lg:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
29659
30011
  RemoteImage,
29660
30012
  {
29661
- src: (0, import_hooks74.optimizedImageUrl)(order.thumbnailSrc, 60),
30013
+ src: (0, import_hooks75.optimizedImageUrl)(order.thumbnailSrc, 60),
29662
30014
  alt: "",
29663
30015
  className: "h-full w-full rounded-agg-sm object-cover"
29664
30016
  }
@@ -29713,7 +30065,7 @@ var OpenOrderRow = ({
29713
30065
  OpenOrderRow.displayName = "OpenOrderRow";
29714
30066
 
29715
30067
  // src/pages/user-profile/components/position-row.tsx
29716
- var import_hooks75 = require("@agg-build/hooks");
30068
+ var import_hooks76 = require("@agg-build/hooks");
29717
30069
  var import_jsx_runtime179 = require("react/jsx-runtime");
29718
30070
  var shouldUseNativeLinkNavigation3 = (event) => {
29719
30071
  return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
@@ -29851,12 +30203,17 @@ var PositionRow = ({
29851
30203
  onClaim,
29852
30204
  isClaiming = false
29853
30205
  }) => {
29854
- const labels = (0, import_hooks75.useLabels)().userProfile.positions;
29855
- const model = toPositionRowViewModel(position, {
29856
- avgPrefix: labels.avgPrefix,
29857
- nowPrefix: labels.nowPrefix,
29858
- finalPrefix: labels.finalPrefix
29859
- });
30206
+ const labels = (0, import_hooks76.useLabels)().userProfile.positions;
30207
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks76.useAggUiConfig)().formatting;
30208
+ const model = toPositionRowViewModel(
30209
+ position,
30210
+ {
30211
+ avgPrefix: labels.avgPrefix,
30212
+ nowPrefix: labels.nowPrefix,
30213
+ finalPrefix: labels.finalPrefix
30214
+ },
30215
+ { formatCurrency: formatCurrency2, formatPrice }
30216
+ );
29860
30217
  const isClosed = (variant != null ? variant : model.bucket) === "closed";
29861
30218
  const handleClaim = (event) => {
29862
30219
  event.preventDefault();
@@ -29905,7 +30262,7 @@ var PositionRow = ({
29905
30262
  /* @__PURE__ */ (0, import_jsx_runtime179.jsx)("div", { className: "agg-position-image flex h-10 w-10 shrink-0 items-center justify-center md:h-15 md:w-15", children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(
29906
30263
  RemoteImage,
29907
30264
  {
29908
- src: (0, import_hooks75.optimizedImageUrl)(model.thumbnailSrc, 60),
30265
+ src: (0, import_hooks76.optimizedImageUrl)(model.thumbnailSrc, 60),
29909
30266
  alt: "",
29910
30267
  className: "h-full w-full rounded-agg-sm object-cover"
29911
30268
  }
@@ -30074,9 +30431,10 @@ var PositionsActivity = ({
30074
30431
  initialPositionFilter = "active",
30075
30432
  className
30076
30433
  }) => {
30077
- const userProfileLabels = (0, import_hooks76.useLabels)().userProfile;
30434
+ const userProfileLabels = (0, import_hooks77.useLabels)().userProfile;
30078
30435
  const positionsLabels = userProfileLabels.positions;
30079
30436
  const openOrdersLabels = userProfileLabels.openOrders;
30437
+ const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks77.useAggUiConfig)().formatting;
30080
30438
  const tabItems = (0, import_react50.useMemo)(
30081
30439
  () => getTabItems(userProfileLabels.tabs, showOpenOrders),
30082
30440
  [showOpenOrders, userProfileLabels.tabs]
@@ -30155,14 +30513,25 @@ var PositionsActivity = ({
30155
30513
  title: position.title,
30156
30514
  thumbnailSrc: position.thumbnailSrc,
30157
30515
  metaPrimary: position.outcomeLabel,
30158
- metaSecondary: toPositionRowViewModel(position, {
30159
- avgPrefix: positionsLabels.avgPrefix,
30160
- nowPrefix: positionsLabels.nowPrefix,
30161
- finalPrefix: positionsLabels.finalPrefix
30162
- }).currentValue.primaryLabel,
30516
+ metaSecondary: toPositionRowViewModel(
30517
+ position,
30518
+ {
30519
+ avgPrefix: positionsLabels.avgPrefix,
30520
+ nowPrefix: positionsLabels.nowPrefix,
30521
+ finalPrefix: positionsLabels.finalPrefix
30522
+ },
30523
+ { formatCurrency: formatCurrency2, formatPrice }
30524
+ ).currentValue.primaryLabel,
30163
30525
  raw: position
30164
30526
  }));
30165
- }, [filteredPositions, isPositionsTab, positionsLabels, searchValue]);
30527
+ }, [
30528
+ filteredPositions,
30529
+ formatCurrency2,
30530
+ formatPrice,
30531
+ isPositionsTab,
30532
+ positionsLabels,
30533
+ searchValue
30534
+ ]);
30166
30535
  const handleSearchChange = (event) => {
30167
30536
  setSearchValue(event.target.value);
30168
30537
  };
@@ -30333,7 +30702,7 @@ var PositionsActivity = ({
30333
30702
  /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
30334
30703
  "img",
30335
30704
  {
30336
- src: (0, import_hooks76.optimizedImageUrl)(item.thumbnailSrc, 48),
30705
+ src: (0, import_hooks77.optimizedImageUrl)(item.thumbnailSrc, 48),
30337
30706
  alt: "",
30338
30707
  className: "size-12 shrink-0 rounded-agg-lg object-cover"
30339
30708
  }
@@ -30654,7 +31023,7 @@ var buildAggTxExplorerHref = (chainId, txHash) => {
30654
31023
  };
30655
31024
 
30656
31025
  // src/pages/user-profile/components/user-info-card.tsx
30657
- var import_hooks77 = require("@agg-build/hooks");
31026
+ var import_hooks78 = require("@agg-build/hooks");
30658
31027
  var import_jsx_runtime182 = require("react/jsx-runtime");
30659
31028
  var UserInfoCard = ({
30660
31029
  user,
@@ -30665,7 +31034,7 @@ var UserInfoCard = ({
30665
31034
  className
30666
31035
  }) => {
30667
31036
  var _a;
30668
- const labels = (0, import_hooks77.useLabels)();
31037
+ const labels = (0, import_hooks78.useLabels)();
30669
31038
  const wallets = (_a = user.connectedWallets) != null ? _a : [];
30670
31039
  const hasWallets = wallets.length > 0;
30671
31040
  return /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(
@@ -30681,7 +31050,7 @@ var UserInfoCard = ({
30681
31050
  /* @__PURE__ */ (0, import_jsx_runtime182.jsx)("div", { className: "agg-profile-avatar shrink-0", children: user.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(
30682
31051
  RemoteImage,
30683
31052
  {
30684
- src: (0, import_hooks77.optimizedImageUrl)(user.avatarUrl, 120),
31053
+ src: (0, import_hooks78.optimizedImageUrl)(user.avatarUrl, 120),
30685
31054
  alt: user.username,
30686
31055
  className: "h-20 w-20 rounded-full object-cover sm:h-[120px] sm:w-[120px]"
30687
31056
  }
@@ -31301,16 +31670,16 @@ var UserProfilePage = ({
31301
31670
  (0, import_react51.useEffect)(() => {
31302
31671
  setIsHydrated(true);
31303
31672
  }, []);
31304
- const { user: currentUser, isAuthenticated } = (0, import_hooks78.useAggAuthState)();
31305
- const { isDepositBlocked } = (0, import_hooks78.useGeoBlock)();
31306
- const balanceState = (0, import_hooks78.useAggBalance)();
31307
- const labels = (0, import_hooks78.useLabels)();
31673
+ const { user: currentUser, isAuthenticated } = (0, import_hooks79.useAggAuthState)();
31674
+ const { isDepositBlocked } = (0, import_hooks79.useGeoBlock)();
31675
+ const balanceState = (0, import_hooks79.useAggBalance)();
31676
+ const labels = (0, import_hooks79.useLabels)();
31308
31677
  const {
31309
31678
  features: { showLimitOrders },
31310
31679
  trading: { executionMode: configuredExecutionMode }
31311
- } = (0, import_hooks78.useSdkUiConfig)();
31312
- const client = (0, import_hooks78.useAggClient)();
31313
- const cancelOrderMutation = (0, import_hooks78.useCancelManagedOrder)();
31680
+ } = (0, import_hooks79.useSdkUiConfig)();
31681
+ const client = (0, import_hooks79.useAggClient)();
31682
+ const cancelOrderMutation = (0, import_hooks79.useCancelManagedOrder)();
31314
31683
  const toastContext = useOptionalToast();
31315
31684
  const [internalCancellingIds, setInternalCancellingIds] = (0, import_react51.useState)({});
31316
31685
  const { claim: startClaim, claimingKeys } = useClaimWinnings({
@@ -31331,13 +31700,13 @@ var UserProfilePage = ({
31331
31700
  const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react51.useState)(null);
31332
31701
  const resolvedExecutionMode = executionMode != null ? executionMode : configuredExecutionMode;
31333
31702
  const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
31334
- const activePositionsQuery = (0, import_hooks78.useExecutionPositions)({
31703
+ const activePositionsQuery = (0, import_hooks79.useExecutionPositions)({
31335
31704
  enabled: shouldUseHookData && isAuthenticated,
31336
31705
  status: "active",
31337
31706
  limit: 25,
31338
31707
  mode: queryExecutionMode
31339
31708
  });
31340
- const closedPositionsQuery = (0, import_hooks78.useExecutionPositions)({
31709
+ const closedPositionsQuery = (0, import_hooks79.useExecutionPositions)({
31341
31710
  enabled: shouldUseHookData && isAuthenticated,
31342
31711
  status: "closed",
31343
31712
  limit: 25,
@@ -31353,55 +31722,55 @@ var UserProfilePage = ({
31353
31722
  (0, import_react51.useEffect)(() => {
31354
31723
  setPositionFilter(initialPositionFilter);
31355
31724
  }, [initialPositionFilter]);
31356
- const ordersQuery = (0, import_hooks78.useExecutionOrders)({
31725
+ const ordersQuery = (0, import_hooks79.useExecutionOrders)({
31357
31726
  enabled: shouldUseHookData && isAuthenticated,
31358
31727
  limit: 25,
31359
31728
  mode: queryExecutionMode,
31360
31729
  refetchIntervalMs: 5e3
31361
31730
  });
31362
- const pendingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31731
+ const pendingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31363
31732
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31364
31733
  status: OPEN_ORDER_QUERY_STATUSES[0],
31365
31734
  limit: 25,
31366
31735
  mode: queryExecutionMode
31367
31736
  });
31368
- const signingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31737
+ const signingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31369
31738
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31370
31739
  status: OPEN_ORDER_QUERY_STATUSES[1],
31371
31740
  limit: 25,
31372
31741
  mode: queryExecutionMode
31373
31742
  });
31374
- const pendingBridgeOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31743
+ const pendingBridgeOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31375
31744
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31376
31745
  status: OPEN_ORDER_QUERY_STATUSES[2],
31377
31746
  limit: 25,
31378
31747
  mode: queryExecutionMode
31379
31748
  });
31380
- const submittingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31749
+ const submittingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31381
31750
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31382
31751
  status: OPEN_ORDER_QUERY_STATUSES[3],
31383
31752
  limit: 25,
31384
31753
  mode: queryExecutionMode
31385
31754
  });
31386
- const submittedOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31755
+ const submittedOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31387
31756
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31388
31757
  status: OPEN_ORDER_QUERY_STATUSES[4],
31389
31758
  limit: 25,
31390
31759
  mode: queryExecutionMode
31391
31760
  });
31392
- const openOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31761
+ const openOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31393
31762
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31394
31763
  status: OPEN_ORDER_QUERY_STATUSES[5],
31395
31764
  limit: 25,
31396
31765
  mode: queryExecutionMode
31397
31766
  });
31398
- const partiallyFilledOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31767
+ const partiallyFilledOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31399
31768
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31400
31769
  status: OPEN_ORDER_QUERY_STATUSES[6],
31401
31770
  limit: 25,
31402
31771
  mode: queryExecutionMode
31403
31772
  });
31404
- const cancelPendingOpenOrdersQuery = (0, import_hooks78.useExecutionOrders)({
31773
+ const cancelPendingOpenOrdersQuery = (0, import_hooks79.useExecutionOrders)({
31405
31774
  enabled: shouldUseHookData && isAuthenticated && !openOrders,
31406
31775
  status: OPEN_ORDER_QUERY_STATUSES[7],
31407
31776
  limit: 25,
@@ -31429,7 +31798,7 @@ var UserProfilePage = ({
31429
31798
  submittingOpenOrdersQuery
31430
31799
  ]
31431
31800
  );
31432
- const activityQuery = (0, import_hooks78.useUserActivity)({
31801
+ const activityQuery = (0, import_hooks79.useUserActivity)({
31433
31802
  enabled: shouldUseHookData && isAuthenticated,
31434
31803
  limit: 25
31435
31804
  });
@@ -31516,7 +31885,7 @@ var UserProfilePage = ({
31516
31885
  var _a2, _b2, _c, _d, _e, _f;
31517
31886
  if (user) return user;
31518
31887
  const fullUser = profileUser != null ? profileUser : currentUser;
31519
- const walletAddress = (0, import_hooks78.getWalletAddressFromUserProfile)(fullUser);
31888
+ const walletAddress = (0, import_hooks79.getWalletAddressFromUserProfile)(fullUser);
31520
31889
  const fallbackUsername = walletAddress && shortenAddress(walletAddress) || "username";
31521
31890
  const twitterAccount = (_a2 = fullUser == null ? void 0 : fullUser.accounts) == null ? void 0 : _a2.find(
31522
31891
  (account) => String(account.provider).toLowerCase() === "twitter"
@@ -31571,8 +31940,8 @@ var UserProfilePage = ({
31571
31940
  const reserved = (_a2 = balanceState.reservedBalance) != null ? _a2 : 0;
31572
31941
  return reserved > 0 ? formatUsd2(reserved) : void 0;
31573
31942
  }, [balanceState.reservedBalance]);
31574
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks78.useAppConfig)();
31575
- const isKalshiAvailable = (0, import_hooks78.getVenueAvailabilityState)({
31943
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks79.useAppConfig)();
31944
+ const isKalshiAvailable = (0, import_hooks79.getVenueAvailabilityState)({
31576
31945
  venueId: import_sdk26.Venue.kalshi,
31577
31946
  disabledVenues,
31578
31947
  isConfigLoading: isAppConfigLoading
@@ -31798,7 +32167,7 @@ var UserProfilePage = ({
31798
32167
  (groups) => {
31799
32168
  return groups.flatMap((group) => {
31800
32169
  var _a2, _b2, _c, _d;
31801
- const closedTotals = (0, import_hooks78.computeClosedPositionTotals)(group);
32170
+ const closedTotals = (0, import_hooks79.computeClosedPositionTotals)(group);
31802
32171
  const winningOutcome = group.venueMarket.venueMarketOutcomes.find(
31803
32172
  (outcome) => outcome.winner === true
31804
32173
  );
@@ -32038,7 +32407,7 @@ var UserProfilePage = ({
32038
32407
  UserProfilePage.displayName = "UserProfilePage";
32039
32408
 
32040
32409
  // src/deposit/index.tsx
32041
- var import_hooks89 = require("@agg-build/hooks");
32410
+ var import_hooks90 = require("@agg-build/hooks");
32042
32411
  var import_deposit = require("@agg-build/hooks/deposit");
32043
32412
  var import_react54 = require("react");
32044
32413
 
@@ -32271,7 +32640,7 @@ var NETWORK_TO_CURRENCY_CODE = {
32271
32640
  };
32272
32641
 
32273
32642
  // src/deposit/steps/card-deposit.tsx
32274
- var import_hooks79 = require("@agg-build/hooks");
32643
+ var import_hooks80 = require("@agg-build/hooks");
32275
32644
  var import_react52 = require("react");
32276
32645
  var import_jsx_runtime184 = require("react/jsx-runtime");
32277
32646
  var CardDepositStep = ({
@@ -32289,7 +32658,7 @@ var CardDepositStep = ({
32289
32658
  onNetworkChange,
32290
32659
  onContinue
32291
32660
  }) => {
32292
- const labels = (0, import_hooks79.useLabels)();
32661
+ const labels = (0, import_hooks80.useLabels)();
32293
32662
  const [localAmount, setLocalAmount] = (0, import_react52.useState)(amount);
32294
32663
  (0, import_react52.useEffect)(() => {
32295
32664
  setLocalAmount(amount);
@@ -32406,7 +32775,7 @@ var CardDepositStep = ({
32406
32775
  };
32407
32776
 
32408
32777
  // src/deposit/steps/card-payment-pending.tsx
32409
- var import_hooks80 = require("@agg-build/hooks");
32778
+ var import_hooks81 = require("@agg-build/hooks");
32410
32779
  var import_jsx_runtime185 = require("react/jsx-runtime");
32411
32780
  var CardPaymentPendingStep = ({
32412
32781
  providerName,
@@ -32415,7 +32784,7 @@ var CardPaymentPendingStep = ({
32415
32784
  onViewActivity,
32416
32785
  onChooseAnotherProvider
32417
32786
  }) => {
32418
- const labels = (0, import_hooks80.useLabels)();
32787
+ const labels = (0, import_hooks81.useLabels)();
32419
32788
  return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
32420
32789
  /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(
32421
32790
  "button",
@@ -32465,10 +32834,10 @@ var CardPaymentPendingStep = ({
32465
32834
  };
32466
32835
 
32467
32836
  // src/deposit/steps/card-provider.tsx
32468
- var import_hooks81 = require("@agg-build/hooks");
32837
+ var import_hooks82 = require("@agg-build/hooks");
32469
32838
  var import_jsx_runtime186 = require("react/jsx-runtime");
32470
32839
  var CardProviderItem = ({ provider, onSelect }) => {
32471
- const labels = (0, import_hooks81.useLabels)();
32840
+ const labels = (0, import_hooks82.useLabels)();
32472
32841
  const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
32473
32842
  return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
32474
32843
  "button",
@@ -32514,7 +32883,7 @@ var CardProviderStep = ({
32514
32883
  onSelectProvider,
32515
32884
  onRetry
32516
32885
  }) => {
32517
- const labels = (0, import_hooks81.useLabels)();
32886
+ const labels = (0, import_hooks82.useLabels)();
32518
32887
  return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [
32519
32888
  /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(
32520
32889
  Modal.Header,
@@ -32578,7 +32947,7 @@ var CardProviderStep = ({
32578
32947
  };
32579
32948
 
32580
32949
  // src/deposit/steps/card-purchase-success.tsx
32581
- var import_hooks82 = require("@agg-build/hooks");
32950
+ var import_hooks83 = require("@agg-build/hooks");
32582
32951
  var import_jsx_runtime187 = require("react/jsx-runtime");
32583
32952
  var SummaryRow = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
32584
32953
  /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -32589,7 +32958,7 @@ var CardPurchaseSuccessStep = ({
32589
32958
  onDone,
32590
32959
  onClose
32591
32960
  }) => {
32592
- const labels = (0, import_hooks82.useLabels)();
32961
+ const labels = (0, import_hooks83.useLabels)();
32593
32962
  return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
32594
32963
  /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(
32595
32964
  "button",
@@ -32624,10 +32993,10 @@ var CardPurchaseSuccessStep = ({
32624
32993
  };
32625
32994
 
32626
32995
  // src/deposit/steps/crypto-transfer.tsx
32627
- var import_hooks84 = require("@agg-build/hooks");
32996
+ var import_hooks85 = require("@agg-build/hooks");
32628
32997
 
32629
32998
  // src/shared/transfer-fee-summary.tsx
32630
- var import_hooks83 = require("@agg-build/hooks");
32999
+ var import_hooks84 = require("@agg-build/hooks");
32631
33000
  var import_jsx_runtime188 = require("react/jsx-runtime");
32632
33001
  var separator = /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": "true", children: "\xB7" });
32633
33002
  var normalizeFeeLabel = (label2) => label2.replace(/\s*~\s*$/, "");
@@ -32637,7 +33006,7 @@ var TransferFeeSummary = ({
32637
33006
  minDeposit,
32638
33007
  eta
32639
33008
  }) => {
32640
- const labels = (0, import_hooks83.useLabels)();
33009
+ const labels = (0, import_hooks84.useLabels)();
32641
33010
  if (!estimate) return null;
32642
33011
  if (view === "deposit") {
32643
33012
  return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("p", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
@@ -32743,7 +33112,7 @@ DepositQRCode.displayName = "DepositQRCode";
32743
33112
  // src/deposit/steps/crypto-transfer.tsx
32744
33113
  var import_jsx_runtime190 = require("react/jsx-runtime");
32745
33114
  var CryptoAddressLoadingState = () => {
32746
- const labels = (0, import_hooks84.useLabels)();
33115
+ const labels = (0, import_hooks85.useLabels)();
32747
33116
  const sendCryptoLabels = labels.deposit.sendCrypto;
32748
33117
  return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
32749
33118
  "div",
@@ -32788,11 +33157,11 @@ var CryptoTransferStep = ({
32788
33157
  onDone
32789
33158
  }) => {
32790
33159
  var _a;
32791
- const labels = (0, import_hooks84.useLabels)();
33160
+ const labels = (0, import_hooks85.useLabels)();
32792
33161
  const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
32793
33162
  const networkLogoUrl = (_a = selectedNetworkOption == null ? void 0 : selectedNetworkOption.iconUrl) != null ? _a : "";
32794
33163
  const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
32795
- const transferFeeEstimate = (0, import_hooks84.useWithdrawEstimate)({
33164
+ const transferFeeEstimate = (0, import_hooks85.useWithdrawEstimate)({
32796
33165
  amount: getEstimateAmountFromMinDeposit(minDeposit),
32797
33166
  selectedToken,
32798
33167
  selectedNetwork
@@ -32895,7 +33264,7 @@ var CryptoTransferStep = ({
32895
33264
  };
32896
33265
 
32897
33266
  // src/deposit/steps/deposit-method.tsx
32898
- var import_hooks85 = require("@agg-build/hooks");
33267
+ var import_hooks86 = require("@agg-build/hooks");
32899
33268
  var import_jsx_runtime191 = require("react/jsx-runtime");
32900
33269
  var DepositMethodCard = ({
32901
33270
  icon,
@@ -32948,7 +33317,7 @@ var DepositMethodStep = ({
32948
33317
  depositAddressesReady = true,
32949
33318
  onSelectMethod
32950
33319
  }) => {
32951
- const labels = (0, import_hooks85.useLabels)();
33320
+ const labels = (0, import_hooks86.useLabels)();
32952
33321
  return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [
32953
33322
  /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
32954
33323
  /* @__PURE__ */ (0, import_jsx_runtime191.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_runtime191.jsxs)("div", { className: "flex flex-col gap-5", children: [
@@ -32997,7 +33366,7 @@ var DepositMethodStep = ({
32997
33366
  };
32998
33367
 
32999
33368
  // src/deposit/steps/wallet-form.tsx
33000
- var import_hooks86 = require("@agg-build/hooks");
33369
+ var import_hooks87 = require("@agg-build/hooks");
33001
33370
  var import_jsx_runtime192 = require("react/jsx-runtime");
33002
33371
  var WalletFormStep = ({
33003
33372
  walletLabel,
@@ -33021,7 +33390,7 @@ var WalletFormStep = ({
33021
33390
  onMax,
33022
33391
  onConfirm
33023
33392
  }) => {
33024
- const labels = (0, import_hooks86.useLabels)();
33393
+ const labels = (0, import_hooks87.useLabels)();
33025
33394
  const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount) > 0 && Number(amount) <= walletBalance;
33026
33395
  return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(import_jsx_runtime192.Fragment, { children: [
33027
33396
  /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
@@ -33147,7 +33516,7 @@ var WalletFormStep = ({
33147
33516
  };
33148
33517
 
33149
33518
  // src/deposit/steps/wallet-processing.tsx
33150
- var import_hooks87 = require("@agg-build/hooks");
33519
+ var import_hooks88 = require("@agg-build/hooks");
33151
33520
  var import_react53 = require("react");
33152
33521
  var import_jsx_runtime193 = require("react/jsx-runtime");
33153
33522
  var WalletProcessingStep = ({
@@ -33155,7 +33524,7 @@ var WalletProcessingStep = ({
33155
33524
  errorMessage,
33156
33525
  onComplete
33157
33526
  }) => {
33158
- const labels = (0, import_hooks87.useLabels)();
33527
+ const labels = (0, import_hooks88.useLabels)();
33159
33528
  (0, import_react53.useEffect)(() => {
33160
33529
  const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
33161
33530
  if (allDone) {
@@ -33194,7 +33563,7 @@ var WalletProcessingStep = ({
33194
33563
  };
33195
33564
 
33196
33565
  // src/deposit/steps/wallet-success.tsx
33197
- var import_hooks88 = require("@agg-build/hooks");
33566
+ var import_hooks89 = require("@agg-build/hooks");
33198
33567
  var import_jsx_runtime194 = require("react/jsx-runtime");
33199
33568
  var SummaryRow2 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
33200
33569
  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -33205,7 +33574,7 @@ var WalletSuccessStep = ({
33205
33574
  onDone,
33206
33575
  onClose
33207
33576
  }) => {
33208
- const labels = (0, import_hooks88.useLabels)();
33577
+ const labels = (0, import_hooks89.useLabels)();
33209
33578
  return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
33210
33579
  /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(
33211
33580
  "button",
@@ -33325,9 +33694,9 @@ function DepositModalControlled({
33325
33694
  pendingCardPurchaseSummary
33326
33695
  }) {
33327
33696
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33328
- const { isWeb3User } = (0, import_hooks89.useAggAuthState)();
33329
- const { walletActions } = (0, import_hooks89.useAggUiConfig)();
33330
- const labels = (0, import_hooks89.useLabels)();
33697
+ const { isWeb3User } = (0, import_hooks90.useAggAuthState)();
33698
+ const { walletActions } = (0, import_hooks90.useAggUiConfig)();
33699
+ const labels = (0, import_hooks90.useLabels)();
33331
33700
  const defaultMethod = isWeb3User ? "wallet" : "crypto";
33332
33701
  const [step, setStep] = (0, import_react54.useState)(
33333
33702
  () => pendingCardPurchaseSummary ? "card-success" : "method"
@@ -33359,7 +33728,7 @@ function DepositModalControlled({
33359
33728
  error: addrError,
33360
33729
  supportedChains,
33361
33730
  getAddress
33362
- } = (0, import_hooks89.useDepositAddresses)({ enabled: open });
33731
+ } = (0, import_hooks90.useDepositAddresses)({ enabled: open });
33363
33732
  const fallbackNetworkOptions = (0, import_react54.useMemo)(() => mapNetworksToOptions(), []);
33364
33733
  const networkOptions = (0, import_react54.useMemo)(() => {
33365
33734
  if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
@@ -33805,13 +34174,13 @@ var import_react55 = require("react");
33805
34174
  var import_withdraw = require("@agg-build/hooks/withdraw");
33806
34175
 
33807
34176
  // src/withdraw/steps/withdraw-method.tsx
33808
- var import_hooks90 = require("@agg-build/hooks");
34177
+ var import_hooks91 = require("@agg-build/hooks");
33809
34178
  var import_jsx_runtime196 = require("react/jsx-runtime");
33810
34179
  var WithdrawMethodStep = ({
33811
34180
  balance,
33812
34181
  onSelectMethod
33813
34182
  }) => {
33814
- const labels = (0, import_hooks90.useLabels)();
34183
+ const labels = (0, import_hooks91.useLabels)();
33815
34184
  return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)(import_jsx_runtime196.Fragment, { children: [
33816
34185
  /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
33817
34186
  /* @__PURE__ */ (0, import_jsx_runtime196.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_runtime196.jsxs)("div", { className: "flex flex-col gap-5", children: [
@@ -33851,7 +34220,7 @@ var WithdrawMethodStep = ({
33851
34220
  };
33852
34221
 
33853
34222
  // src/withdraw/steps/withdraw-amount.tsx
33854
- var import_hooks91 = require("@agg-build/hooks");
34223
+ var import_hooks92 = require("@agg-build/hooks");
33855
34224
  var import_jsx_runtime197 = require("react/jsx-runtime");
33856
34225
  var formatRawTokenAmount = (rawAmount, decimals) => {
33857
34226
  if (!rawAmount) return "0";
@@ -33896,7 +34265,7 @@ var WithdrawAmountStep = ({
33896
34265
  onContinue
33897
34266
  }) => {
33898
34267
  var _a, _b, _c, _d;
33899
- const labels = (0, import_hooks91.useLabels)();
34268
+ const labels = (0, import_hooks92.useLabels)();
33900
34269
  const SOLANA_CHAIN_ID = "792703809";
33901
34270
  const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
33902
34271
  const trimmedDestination = destinationWallet.trim();
@@ -33904,7 +34273,7 @@ var WithdrawAmountStep = ({
33904
34273
  const isValid = Number(amount) > 0 && isValidAddress;
33905
34274
  const amountRaw = amount && Number(amount) > 0 ? parseTokenAmountToRaw(amount, destDecimals) : null;
33906
34275
  const destinationChainId = Number(selectedNetwork) || null;
33907
- const preview = (0, import_hooks91.useWithdrawPreview)({
34276
+ const preview = (0, import_hooks92.useWithdrawPreview)({
33908
34277
  amountRaw,
33909
34278
  tokenSymbol: selectedToken || null,
33910
34279
  destinationChainId,
@@ -34043,7 +34412,7 @@ var WithdrawAmountStep = ({
34043
34412
  };
34044
34413
 
34045
34414
  // src/withdraw/steps/withdraw-success.tsx
34046
- var import_hooks92 = require("@agg-build/hooks");
34415
+ var import_hooks93 = require("@agg-build/hooks");
34047
34416
  var import_jsx_runtime198 = require("react/jsx-runtime");
34048
34417
  var SummaryRow3 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0", children: [
34049
34418
  /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("p", { className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
@@ -34088,10 +34457,10 @@ var WithdrawLoadingStep = ({
34088
34457
  lifecycleState,
34089
34458
  onClose
34090
34459
  }) => {
34091
- const labels = (0, import_hooks92.useLabels)();
34460
+ const labels = (0, import_hooks93.useLabels)();
34092
34461
  const {
34093
34462
  features: { enableAnimations }
34094
- } = (0, import_hooks92.useSdkUiConfig)();
34463
+ } = (0, import_hooks93.useSdkUiConfig)();
34095
34464
  const walletFlowLabels = labels.withdraw.walletFlow;
34096
34465
  const activeIndex = loadingActiveIndexFor(lifecycleState);
34097
34466
  const loadingSteps = getLoadingSteps(walletFlowLabels);
@@ -34175,7 +34544,7 @@ var WithdrawSuccessStep = ({
34175
34544
  onRetry,
34176
34545
  onClose
34177
34546
  }) => {
34178
- const labels = (0, import_hooks92.useLabels)();
34547
+ const labels = (0, import_hooks93.useLabels)();
34179
34548
  const walletFlowLabels = labels.withdraw.walletFlow;
34180
34549
  const { title: title2, description } = resultCopyFor({
34181
34550
  status: resultStatus,
@@ -34482,27 +34851,33 @@ var WithdrawModal = (props) => {
34482
34851
  WithdrawModal.displayName = "WithdrawModal";
34483
34852
 
34484
34853
  // src/profile/index.tsx
34485
- var import_react58 = require("react");
34486
- var import_hooks95 = require("@agg-build/hooks");
34854
+ var import_react59 = require("react");
34855
+ var import_hooks97 = require("@agg-build/hooks");
34487
34856
  var import_sdk27 = require("@agg-build/sdk");
34488
34857
 
34489
34858
  // src/profile/profile-modal.constants.ts
34490
34859
  var PROFILE_TAB_KEYS = {
34491
34860
  PROFILE_ACCOUNTS: "profile-accounts",
34492
- TRADING_ACCESS: "trading-access"
34861
+ TRADING_ACCESS: "trading-access",
34862
+ BALANCE_MANAGEMENT: "balance-management"
34493
34863
  };
34494
- var PROFILE_TAB_ITEMS = [
34864
+ var getProfileTabItems = (balanceManagementLabel) => [
34495
34865
  {
34496
34866
  value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
34497
34867
  label: "Profile & accounts",
34498
34868
  icon: "profile-about-tab"
34499
34869
  },
34500
- { value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" }
34870
+ { value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" },
34871
+ {
34872
+ value: PROFILE_TAB_KEYS.BALANCE_MANAGEMENT,
34873
+ label: balanceManagementLabel,
34874
+ icon: "bolt"
34875
+ }
34501
34876
  ];
34502
34877
 
34503
34878
  // src/profile/tabs/about-tab.tsx
34504
34879
  var import_react56 = require("react");
34505
- var import_hooks93 = require("@agg-build/hooks");
34880
+ var import_hooks94 = require("@agg-build/hooks");
34506
34881
  var import_jsx_runtime200 = require("react/jsx-runtime");
34507
34882
  var AboutTab = ({
34508
34883
  avatarPreview,
@@ -34513,7 +34888,7 @@ var AboutTab = ({
34513
34888
  draftAvatarPreview,
34514
34889
  avatarError: _avatarError
34515
34890
  }) => {
34516
- const labels = (0, import_hooks93.useLabels)();
34891
+ const labels = (0, import_hooks94.useLabels)();
34517
34892
  const fileInputRef = (0, import_react56.useRef)(null);
34518
34893
  const handleAvatarClick = (0, import_react56.useCallback)(() => {
34519
34894
  var _a;
@@ -34788,7 +35163,7 @@ var AccountsWalletsTab = ({
34788
35163
  AccountsWalletsTab.displayName = "AccountsWalletsTab";
34789
35164
 
34790
35165
  // src/profile/tabs/trading-access-tab.tsx
34791
- var import_hooks94 = require("@agg-build/hooks");
35166
+ var import_hooks95 = require("@agg-build/hooks");
34792
35167
  var import_react57 = require("react");
34793
35168
  var import_jsx_runtime202 = require("react/jsx-runtime");
34794
35169
  var TRADING_ACCESS_VENUES = [
@@ -34815,14 +35190,14 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)
34815
35190
  }
34816
35191
  );
34817
35192
  var AvailableStatus = () => {
34818
- const labels = (0, import_hooks94.useLabels)();
35193
+ const labels = (0, import_hooks95.useLabels)();
34819
35194
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "flex items-center gap-2", children: [
34820
35195
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Icon, { name: "check-badge", size: "small", className: "text-agg-primary" }),
34821
35196
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: labels.trading.tradingAccessAvailable })
34822
35197
  ] });
34823
35198
  };
34824
35199
  var GeoblockedStatus = () => {
34825
- const labels = (0, import_hooks94.useLabels)();
35200
+ const labels = (0, import_hooks95.useLabels)();
34826
35201
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "flex items-center gap-2 text-agg-muted-foreground", children: [
34827
35202
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" }),
34828
35203
  /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap", children: labels.trading.venueUnavailableInRegion })
@@ -34834,12 +35209,12 @@ var TradingAccessTab = ({
34834
35209
  onDisconnectKalshi
34835
35210
  }) => {
34836
35211
  var _a, _b, _c, _d;
34837
- const labels = (0, import_hooks94.useLabels)();
35212
+ const labels = (0, import_hooks95.useLabels)();
34838
35213
  const verifyConnectionLabel = (_d = (_c = (_b = (_a = labels.onboarding) == null ? void 0 : _a.connectKalshiModal) == null ? void 0 : _b.actions) == null ? void 0 : _c.verifyConnection) != null ? _d : labels.trading.kycVerify;
34839
- const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks94.useAppConfig)();
34840
- const { isLocationBlocked } = (0, import_hooks94.useGeoBlock)();
35214
+ const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks95.useAppConfig)();
35215
+ const { isLocationBlocked } = (0, import_hooks95.useGeoBlock)();
34841
35216
  const visibleVenues = (0, import_react57.useMemo)(
34842
- () => (0, import_hooks94.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
35217
+ () => (0, import_hooks95.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
34843
35218
  [disabledVenues]
34844
35219
  );
34845
35220
  return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
@@ -34850,7 +35225,7 @@ var TradingAccessTab = ({
34850
35225
  const isKalshi = venue === "kalshi";
34851
35226
  const isConnected = (venueAccount == null ? void 0 : venueAccount.status) === "active";
34852
35227
  const isVerified = (venueAccount == null ? void 0 : venueAccount.kycStatus) === "verified";
34853
- const availabilityState = (0, import_hooks94.getVenueAvailabilityState)({
35228
+ const availabilityState = (0, import_hooks95.getVenueAvailabilityState)({
34854
35229
  venueId: venue,
34855
35230
  disabledVenues,
34856
35231
  isConfigLoading: isKalshi && isAppConfigLoading,
@@ -34903,8 +35278,187 @@ var TradingAccessTab = ({
34903
35278
  };
34904
35279
  TradingAccessTab.displayName = "TradingAccessTab";
34905
35280
 
34906
- // src/profile/index.tsx
35281
+ // src/profile/tabs/balance-management-tab.tsx
35282
+ var import_react58 = require("react");
35283
+ var import_hooks96 = require("@agg-build/hooks");
34907
35284
  var import_jsx_runtime203 = require("react/jsx-runtime");
35285
+ var CHAIN_IDS_BY_NETWORK = {
35286
+ mainnet: 1,
35287
+ bnb: 56,
35288
+ polygon: 137,
35289
+ base: 8453,
35290
+ arbitrum: 42161,
35291
+ solana: 792703809,
35292
+ hyperliquid: 1337
35293
+ };
35294
+ var NETWORK_BY_CHAIN_ID = Object.fromEntries(
35295
+ Object.entries(CHAIN_IDS_BY_NETWORK).map(([network, chainId]) => [chainId, network])
35296
+ );
35297
+ var networkItems = SUPPORTED_NETWORKS.filter(
35298
+ (network) => network.value in CHAIN_IDS_BY_NETWORK
35299
+ ).map((network) => ({
35300
+ value: network.value,
35301
+ label: network.label,
35302
+ iconUrl: network.iconUrl
35303
+ }));
35304
+ var dollarsToRaw = (amount) => String(Math.round(amount * 1e6));
35305
+ var rawToDollars = (amount) => Number(amount) / 1e6;
35306
+ var BalanceManagementTab = ({ enabled }) => {
35307
+ const labels = (0, import_hooks96.useAggLabels)().balanceRefill;
35308
+ const { policies, isLoading, isError, createPolicy, updatePolicy } = (0, import_hooks96.useBalanceRefillPolicies)({
35309
+ enabled
35310
+ });
35311
+ const policy = policies[0];
35312
+ const [network, setNetwork] = (0, import_react58.useState)("polygon");
35313
+ const [minimum, setMinimum] = (0, import_react58.useState)(100);
35314
+ const [refillAmount, setRefillAmount] = (0, import_react58.useState)(50);
35315
+ const [dailyCap, setDailyCap] = (0, import_react58.useState)(200);
35316
+ const [maximumFee, setMaximumFee] = (0, import_react58.useState)(2);
35317
+ const [feedback, setFeedback] = (0, import_react58.useState)(null);
35318
+ (0, import_react58.useEffect)(() => {
35319
+ var _a;
35320
+ if (!policy) return;
35321
+ setNetwork((_a = NETWORK_BY_CHAIN_ID[policy.targetChainId]) != null ? _a : "polygon");
35322
+ setMinimum(rawToDollars(policy.minimumRaw));
35323
+ setRefillAmount(rawToDollars(policy.refillAmountRaw));
35324
+ setDailyCap(rawToDollars(policy.dailyCapRaw));
35325
+ setMaximumFee(rawToDollars(policy.maxFeeRaw));
35326
+ }, [policy]);
35327
+ const validationError = (0, import_react58.useMemo)(() => {
35328
+ if (minimum <= 0 || refillAmount <= 0 || dailyCap <= 0 || maximumFee <= 0) {
35329
+ return labels.saveError;
35330
+ }
35331
+ if (dailyCap < Math.max(minimum, refillAmount) + maximumFee) {
35332
+ return labels.saveError;
35333
+ }
35334
+ return null;
35335
+ }, [dailyCap, labels.saveError, maximumFee, minimum, refillAmount]);
35336
+ const isPending = createPolicy.isPending || updatePolicy.isPending;
35337
+ const handleSave = () => __async(null, null, function* () {
35338
+ if (validationError) {
35339
+ setFeedback(validationError);
35340
+ return;
35341
+ }
35342
+ setFeedback(null);
35343
+ const params = {
35344
+ minimumRaw: dollarsToRaw(minimum),
35345
+ refillAmountRaw: dollarsToRaw(refillAmount),
35346
+ dailyCapRaw: dollarsToRaw(dailyCap),
35347
+ maxFeeRaw: dollarsToRaw(maximumFee)
35348
+ };
35349
+ try {
35350
+ if (policy) {
35351
+ yield updatePolicy.mutateAsync({ policyId: policy.id, params });
35352
+ } else {
35353
+ yield createPolicy.mutateAsync(__spreadProps(__spreadValues({}, params), {
35354
+ targetChainId: CHAIN_IDS_BY_NETWORK[network],
35355
+ targetTokenSymbol: "USDC"
35356
+ }));
35357
+ }
35358
+ setFeedback(labels.saved);
35359
+ } catch (e) {
35360
+ setFeedback(labels.saveError);
35361
+ }
35362
+ });
35363
+ const handleStatus = () => __async(null, null, function* () {
35364
+ if (!policy) return;
35365
+ try {
35366
+ yield updatePolicy.mutateAsync({
35367
+ policyId: policy.id,
35368
+ params: { status: policy.status === "enabled" ? "paused" : "enabled" }
35369
+ });
35370
+ setFeedback(labels.saved);
35371
+ } catch (e) {
35372
+ setFeedback(labels.saveError);
35373
+ }
35374
+ });
35375
+ if (isLoading)
35376
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.loading });
35377
+ if (isError)
35378
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { role: "alert", className: "text-agg-sm text-agg-error", children: labels.loadError });
35379
+ const latestAttempt = policy == null ? void 0 : policy.latestAttempt;
35380
+ return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("section", { className: "agg-balance-management-tab flex flex-col gap-6", children: [
35381
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "flex flex-col gap-2", children: [
35382
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("h2", { className: "text-agg-lg font-agg-semibold text-agg-foreground", children: labels.title }),
35383
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.description })
35384
+ ] }),
35385
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "rounded-agg-lg border border-agg-separator p-5 flex flex-col gap-5", children: [
35386
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("label", { className: "flex flex-col gap-2 text-agg-sm text-agg-foreground", children: [
35387
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { children: labels.networkLabel }),
35388
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35389
+ Select,
35390
+ {
35391
+ items: networkItems,
35392
+ value: network,
35393
+ onChange: (value) => setNetwork(value),
35394
+ ariaLabel: labels.networkLabel,
35395
+ disabled: Boolean(policy)
35396
+ }
35397
+ )
35398
+ ] }),
35399
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
35400
+ [labels.minimumLabel, minimum, setMinimum],
35401
+ [labels.refillAmountLabel, refillAmount, setRefillAmount],
35402
+ [labels.dailyCapLabel, dailyCap, setDailyCap],
35403
+ [labels.maximumFeeLabel, maximumFee, setMaximumFee]
35404
+ ].map(([label2, value, onChange]) => /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35405
+ "label",
35406
+ {
35407
+ className: "flex flex-col gap-2 rounded-agg-md bg-agg-secondary px-4 py-3 text-agg-sm text-agg-foreground",
35408
+ children: [
35409
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { children: label2 }),
35410
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35411
+ CurrencyInput,
35412
+ {
35413
+ value,
35414
+ onChange,
35415
+ min: 0.01,
35416
+ decimalPlaces: 2,
35417
+ ariaLabel: label2,
35418
+ classNames: { input: "w-full text-agg-base font-agg-semibold" }
35419
+ }
35420
+ )
35421
+ ]
35422
+ },
35423
+ label2
35424
+ )) }),
35425
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-xs text-agg-secondary-foreground", children: labels.consent }),
35426
+ policy ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: policy.status === "enabled" ? labels.activeLabel : labels.pausedLabel }) : null,
35427
+ latestAttempt ? /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: [
35428
+ labels.lastRefill,
35429
+ ": ",
35430
+ labels.statuses[latestAttempt.status]
35431
+ ] }) : null,
35432
+ feedback ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("p", { role: feedback === labels.saveError ? "alert" : "status", className: "text-agg-sm", children: feedback }) : null,
35433
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "flex flex-wrap gap-3", children: [
35434
+ /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35435
+ Button,
35436
+ {
35437
+ variant: "primary",
35438
+ size: "large",
35439
+ isLoading: isPending,
35440
+ disabled: Boolean(validationError),
35441
+ onClick: () => void handleSave(),
35442
+ children: policy ? labels.saveAction : labels.enableAction
35443
+ }
35444
+ ),
35445
+ policy ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35446
+ Button,
35447
+ {
35448
+ variant: "secondary",
35449
+ size: "large",
35450
+ isLoading: isPending,
35451
+ onClick: () => void handleStatus(),
35452
+ children: policy.status === "enabled" ? labels.pauseAction : labels.resumeAction
35453
+ }
35454
+ ) : null
35455
+ ] })
35456
+ ] })
35457
+ ] });
35458
+ };
35459
+
35460
+ // src/profile/index.tsx
35461
+ var import_jsx_runtime204 = require("react/jsx-runtime");
34908
35462
  var ProfileModal = ({
34909
35463
  open,
34910
35464
  onOpenChange,
@@ -34928,30 +35482,35 @@ var ProfileModal = ({
34928
35482
  onDisconnectExchange
34929
35483
  }) => {
34930
35484
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
34931
- const client = (0, import_hooks95.useAggClient)();
34932
- const { user } = (0, import_hooks95.useAggAuthState)();
35485
+ const client = (0, import_hooks97.useAggClient)();
35486
+ const labels = (0, import_hooks97.useAggLabels)();
35487
+ const { user } = (0, import_hooks97.useAggAuthState)();
34933
35488
  const toastCtx = useOptionalToast();
34934
- const [activeTab, setActiveTab] = (0, import_react58.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
35489
+ const [activeTab, setActiveTab] = (0, import_react59.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
35490
+ const profileTabItems = (0, import_react59.useMemo)(
35491
+ () => getProfileTabItems(labels.balanceRefill.tabLabel),
35492
+ [labels.balanceRefill.tabLabel]
35493
+ );
34935
35494
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
34936
- const [draftUsername, setDraftUsername] = (0, import_react58.useState)(resolvedInitialUsername);
34937
- const [draftAvatarFile, setDraftAvatarFile] = (0, import_react58.useState)();
34938
- const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react58.useState)();
34939
- const [isSaving, setIsSaving] = (0, import_react58.useState)(false);
34940
- const [avatarTypeError, setAvatarTypeError] = (0, import_react58.useState)(null);
34941
- const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react58.useState)(false);
34942
- const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks95.useVenueKeyStatus)(
35495
+ const [draftUsername, setDraftUsername] = (0, import_react59.useState)(resolvedInitialUsername);
35496
+ const [draftAvatarFile, setDraftAvatarFile] = (0, import_react59.useState)();
35497
+ const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react59.useState)();
35498
+ const [isSaving, setIsSaving] = (0, import_react59.useState)(false);
35499
+ const [avatarTypeError, setAvatarTypeError] = (0, import_react59.useState)(null);
35500
+ const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react59.useState)(false);
35501
+ const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks97.useVenueKeyStatus)(
34943
35502
  import_sdk27.Venue.kalshi,
34944
35503
  open
34945
35504
  );
34946
- (0, import_react58.useEffect)(() => {
35505
+ (0, import_react59.useEffect)(() => {
34947
35506
  var _a2;
34948
35507
  setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
34949
35508
  }, [username, user == null ? void 0 : user.username]);
34950
- (0, import_react58.useEffect)(() => {
35509
+ (0, import_react59.useEffect)(() => {
34951
35510
  if (open) return;
34952
35511
  setIsConnectKalshiModalOpen(false);
34953
35512
  }, [open]);
34954
- const handleOpenChange = (0, import_react58.useCallback)(
35513
+ const handleOpenChange = (0, import_react59.useCallback)(
34955
35514
  (isOpen) => {
34956
35515
  var _a2;
34957
35516
  if (!isOpen) {
@@ -34975,7 +35534,7 @@ var ProfileModal = ({
34975
35534
  setDraftAvatarPreview
34976
35535
  ]
34977
35536
  );
34978
- const handleDraftAvatarChange = (0, import_react58.useCallback)(
35537
+ const handleDraftAvatarChange = (0, import_react59.useCallback)(
34979
35538
  (file, preview) => {
34980
35539
  const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
34981
35540
  if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
@@ -34990,7 +35549,7 @@ var ProfileModal = ({
34990
35549
  );
34991
35550
  const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
34992
35551
  const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
34993
- const handleSave = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35552
+ const handleSave = (0, import_react59.useCallback)(() => __async(null, null, function* () {
34994
35553
  var _a2, _b2, _c2;
34995
35554
  setIsSaving(true);
34996
35555
  try {
@@ -35045,10 +35604,10 @@ var ProfileModal = ({
35045
35604
  originalUsername,
35046
35605
  toastCtx
35047
35606
  ]);
35048
- const handleCancel = (0, import_react58.useCallback)(() => {
35607
+ const handleCancel = (0, import_react59.useCallback)(() => {
35049
35608
  handleOpenChange(false);
35050
35609
  }, [handleOpenChange]);
35051
- const handleVerifyKalshi = (0, import_react58.useCallback)(
35610
+ const handleVerifyKalshi = (0, import_react59.useCallback)(
35052
35611
  (credentials) => __async(null, null, function* () {
35053
35612
  if (onConnectKalshi) {
35054
35613
  yield onConnectKalshi(credentials);
@@ -35066,12 +35625,12 @@ var ProfileModal = ({
35066
35625
  }),
35067
35626
  [client, onConnectKalshi, refetchKalshiStatus]
35068
35627
  );
35069
- const handleDisconnectKalshi = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35628
+ const handleDisconnectKalshi = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35070
35629
  yield client.deleteVenueKey(import_sdk27.Venue.kalshi);
35071
35630
  yield refetchKalshiStatus();
35072
35631
  onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk27.Venue.kalshi);
35073
35632
  }), [client, onDisconnectExchange, refetchKalshiStatus]);
35074
- const resolvedVenueAccounts = (0, import_react58.useMemo)(() => {
35633
+ const resolvedVenueAccounts = (0, import_react59.useMemo)(() => {
35075
35634
  var _a2;
35076
35635
  const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
35077
35636
  if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
@@ -35127,7 +35686,7 @@ var ProfileModal = ({
35127
35686
  if (typeof window === "undefined") return;
35128
35687
  ((_a2 = window.top) != null ? _a2 : window).location.assign(url);
35129
35688
  };
35130
- const surfaceError = (0, import_react58.useCallback)(
35689
+ const surfaceError = (0, import_react59.useCallback)(
35131
35690
  (err, title2) => {
35132
35691
  const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
35133
35692
  if (toastCtx) {
@@ -35138,7 +35697,7 @@ var ProfileModal = ({
35138
35697
  },
35139
35698
  [toastCtx]
35140
35699
  );
35141
- const handleConnectTwitter = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35700
+ const handleConnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35142
35701
  try {
35143
35702
  const result = yield client.linkAccount({
35144
35703
  provider: "twitter",
@@ -35152,7 +35711,7 @@ var ProfileModal = ({
35152
35711
  surfaceError(err, "Could not connect X (Twitter)");
35153
35712
  }
35154
35713
  }), [client, onConnectTwitter, surfaceError]);
35155
- const handleConnectGoogle = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35714
+ const handleConnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35156
35715
  try {
35157
35716
  const result = yield client.linkAccount({
35158
35717
  provider: "google",
@@ -35166,7 +35725,7 @@ var ProfileModal = ({
35166
35725
  surfaceError(err, "Could not connect Google");
35167
35726
  }
35168
35727
  }), [client, onConnectGoogle, surfaceError]);
35169
- const handleConnectApple = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35728
+ const handleConnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35170
35729
  try {
35171
35730
  const result = yield client.linkAccount({
35172
35731
  provider: "apple",
@@ -35180,7 +35739,7 @@ var ProfileModal = ({
35180
35739
  surfaceError(err, "Could not connect Apple");
35181
35740
  }
35182
35741
  }), [client, onConnectApple, surfaceError]);
35183
- const handleDisconnectTwitter = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35742
+ const handleDisconnectTwitter = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35184
35743
  try {
35185
35744
  yield client.disconnectAccount("twitter");
35186
35745
  yield client.getCurrentUser();
@@ -35189,7 +35748,7 @@ var ProfileModal = ({
35189
35748
  surfaceError(err, "Could not disconnect X (Twitter)");
35190
35749
  }
35191
35750
  }), [client, onDisconnectTwitter, surfaceError]);
35192
- const handleDisconnectGoogle = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35751
+ const handleDisconnectGoogle = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35193
35752
  try {
35194
35753
  yield client.disconnectAccount("google");
35195
35754
  yield client.getCurrentUser();
@@ -35198,7 +35757,7 @@ var ProfileModal = ({
35198
35757
  surfaceError(err, "Could not disconnect Google");
35199
35758
  }
35200
35759
  }), [client, onDisconnectGoogle, surfaceError]);
35201
- const handleDisconnectApple = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35760
+ const handleDisconnectApple = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35202
35761
  try {
35203
35762
  yield client.disconnectAccount("apple");
35204
35763
  yield client.getCurrentUser();
@@ -35207,7 +35766,7 @@ var ProfileModal = ({
35207
35766
  surfaceError(err, "Could not disconnect Apple");
35208
35767
  }
35209
35768
  }), [client, onDisconnectApple, surfaceError]);
35210
- const handleConnectEmail = (0, import_react58.useCallback)(() => __async(null, null, function* () {
35769
+ const handleConnectEmail = (0, import_react59.useCallback)(() => __async(null, null, function* () {
35211
35770
  var _a2;
35212
35771
  const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
35213
35772
  if (!typedEmail) return;
@@ -35226,7 +35785,7 @@ var ProfileModal = ({
35226
35785
  surfaceError(err, "Could not connect email");
35227
35786
  }
35228
35787
  }), [client, onConnectEmail, surfaceError, toastCtx]);
35229
- const handleDisconnectWallet = (0, import_react58.useCallback)(
35788
+ const handleDisconnectWallet = (0, import_react59.useCallback)(
35230
35789
  (wallet) => __async(null, null, function* () {
35231
35790
  const normalizedChain = wallet.chain.toLowerCase();
35232
35791
  const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
@@ -35240,7 +35799,7 @@ var ProfileModal = ({
35240
35799
  }),
35241
35800
  [client, onDisconnectWallet, surfaceError]
35242
35801
  );
35243
- const providerActionMap = (0, import_react58.useMemo)(
35802
+ const providerActionMap = (0, import_react59.useMemo)(
35244
35803
  () => ({
35245
35804
  twitter: {
35246
35805
  connect: () => {
@@ -35282,7 +35841,7 @@ var ProfileModal = ({
35282
35841
  handleDisconnectTwitter
35283
35842
  ]
35284
35843
  );
35285
- const resolvedWallets = (0, import_react58.useMemo)(() => {
35844
+ const resolvedWallets = (0, import_react59.useMemo)(() => {
35286
35845
  var _a2, _b2;
35287
35846
  if (wallets) return wallets;
35288
35847
  const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
@@ -35301,8 +35860,8 @@ var ProfileModal = ({
35301
35860
  };
35302
35861
  });
35303
35862
  }, [user == null ? void 0 : user.accounts, wallets]);
35304
- return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
35305
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35863
+ return /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
35864
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
35306
35865
  Modal.Container,
35307
35866
  {
35308
35867
  maxWidth: "800px",
@@ -35311,24 +35870,24 @@ var ProfileModal = ({
35311
35870
  container: cn("agg-profile-modal", "min-h-[37.5rem]")
35312
35871
  },
35313
35872
  children: [
35314
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
35315
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35873
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
35874
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35316
35875
  Tabs,
35317
35876
  {
35318
35877
  className: "w-full [&>div]:w-full",
35319
35878
  variant: "underline",
35320
35879
  classNames: { tabList: "w-full" },
35321
- items: PROFILE_TAB_ITEMS.map((tab) => ({
35880
+ items: profileTabItems.map((tab) => ({
35322
35881
  value: tab.value,
35323
35882
  label: tab.label,
35324
- icon: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Icon, { name: tab.icon, size: "small" })
35883
+ icon: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Icon, { name: tab.icon, size: "small" })
35325
35884
  })),
35326
35885
  value: activeTab,
35327
35886
  onChange: (val) => setActiveTab(val)
35328
35887
  }
35329
35888
  ) }),
35330
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
35331
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35889
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
35890
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35332
35891
  "nav",
35333
35892
  {
35334
35893
  className: cn(
@@ -35342,9 +35901,9 @@ var ProfileModal = ({
35342
35901
  ),
35343
35902
  role: "tablist",
35344
35903
  "aria-label": "Profile sections",
35345
- children: PROFILE_TAB_ITEMS.map((tab) => {
35904
+ children: profileTabItems.map((tab) => {
35346
35905
  const isActive = activeTab === tab.value;
35347
- return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(
35906
+ return /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
35348
35907
  "button",
35349
35908
  {
35350
35909
  type: "button",
@@ -35360,9 +35919,9 @@ var ProfileModal = ({
35360
35919
  isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
35361
35920
  ),
35362
35921
  children: [
35363
- isActive ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
35364
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
35365
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
35922
+ isActive ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
35923
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
35924
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
35366
35925
  ]
35367
35926
  },
35368
35927
  tab.value
@@ -35370,9 +35929,9 @@ var ProfileModal = ({
35370
35929
  })
35371
35930
  }
35372
35931
  ) }),
35373
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
35374
- activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
35375
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35932
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
35933
+ activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
35934
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35376
35935
  AboutTab,
35377
35936
  {
35378
35937
  username: username != null ? username : user == null ? void 0 : user.username,
@@ -35386,7 +35945,7 @@ var ProfileModal = ({
35386
35945
  avatarError: avatarTypeError
35387
35946
  }
35388
35947
  ),
35389
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35948
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35390
35949
  AccountsWalletsTab,
35391
35950
  {
35392
35951
  socialAccounts: resolvedSocialAccounts,
@@ -35405,7 +35964,7 @@ var ProfileModal = ({
35405
35964
  }
35406
35965
  )
35407
35966
  ] }) : null,
35408
- activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35967
+ activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35409
35968
  TradingAccessTab,
35410
35969
  {
35411
35970
  venueAccounts: resolvedVenueAccounts,
@@ -35413,12 +35972,22 @@ var ProfileModal = ({
35413
35972
  onDisconnectKalshi: handleDisconnectKalshi,
35414
35973
  onKycError
35415
35974
  }
35416
- ) : null
35975
+ ) : null,
35976
+ activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(BalanceManagementTab, { enabled: open }) : null
35417
35977
  ] })
35418
35978
  ] }) }),
35419
- /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
35420
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
35421
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
35979
+ activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? null : /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
35980
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35981
+ Button,
35982
+ {
35983
+ variant: "secondary",
35984
+ size: "large",
35985
+ onClick: handleCancel,
35986
+ className: "min-w-[120px]",
35987
+ children: "Cancel"
35988
+ }
35989
+ ),
35990
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35422
35991
  Button,
35423
35992
  {
35424
35993
  variant: "primary",
@@ -35433,7 +36002,7 @@ var ProfileModal = ({
35433
36002
  ]
35434
36003
  }
35435
36004
  ),
35436
- /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
36005
+ /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
35437
36006
  ConnectKalshiModal,
35438
36007
  {
35439
36008
  open: open && isConnectKalshiModalOpen,
@@ -35446,33 +36015,33 @@ var ProfileModal = ({
35446
36015
  ProfileModal.displayName = "ProfileModal";
35447
36016
 
35448
36017
  // src/geo-block-modal/index.tsx
35449
- var import_hooks96 = require("@agg-build/hooks");
35450
- var import_react59 = require("react");
35451
- var import_jsx_runtime204 = require("react/jsx-runtime");
36018
+ var import_hooks98 = require("@agg-build/hooks");
36019
+ var import_react60 = require("react");
36020
+ var import_jsx_runtime205 = require("react/jsx-runtime");
35452
36021
  var GeoBlockModal = ({
35453
36022
  open,
35454
36023
  onOpenChange,
35455
36024
  onConfirm,
35456
36025
  classNames
35457
36026
  }) => {
35458
- const labels = (0, import_hooks96.useLabels)();
35459
- const handleConfirm = (0, import_react59.useCallback)(() => {
36027
+ const labels = (0, import_hooks98.useLabels)();
36028
+ const handleConfirm = (0, import_react60.useCallback)(() => {
35460
36029
  onConfirm == null ? void 0 : onConfirm();
35461
36030
  onOpenChange(false);
35462
36031
  }, [onConfirm, onOpenChange]);
35463
- return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36032
+ return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35464
36033
  Modal,
35465
36034
  {
35466
36035
  open,
35467
36036
  onOpenChange,
35468
36037
  "aria-label": labels.trading.geoBlockModalAriaLabel,
35469
- children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(
36038
+ children: /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(
35470
36039
  Modal.Container,
35471
36040
  {
35472
36041
  maxWidth: "480px",
35473
36042
  classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
35474
36043
  children: [
35475
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36044
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35476
36045
  Modal.Header,
35477
36046
  {
35478
36047
  title: "",
@@ -35484,19 +36053,19 @@ var GeoBlockModal = ({
35484
36053
  }
35485
36054
  }
35486
36055
  ),
35487
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
35488
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36056
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
36057
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35489
36058
  Icon,
35490
36059
  {
35491
36060
  name: "internet-security",
35492
36061
  className: "h-[60px] w-[60px] text-agg-muted-foreground"
35493
36062
  }
35494
36063
  ),
35495
- /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
35496
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
35497
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
36064
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
36065
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
36066
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
35498
36067
  ] }),
35499
- /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
36068
+ /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(
35500
36069
  Button,
35501
36070
  {
35502
36071
  variant: "secondary",