@agg-build/ui 4.18.2 → 4.19.1

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 (61) hide show
  1. package/README.md +1 -0
  2. package/dist/chunk-CKHECAKV.mjs +2724 -0
  3. package/dist/{chunk-NSQQ62QK.mjs → chunk-DONMO42Q.mjs} +1 -1
  4. package/dist/{chunk-RFMA5ABT.mjs → chunk-KRYMEFPL.mjs} +505 -44
  5. package/dist/{chunk-5YHKIJ23.mjs → chunk-NV6WT3TN.mjs} +481 -826
  6. package/dist/{chunk-47CCGQH6.mjs → chunk-UXLC3FFY.mjs} +451 -1349
  7. package/dist/{event-market-2BAMDM5I.mjs → event-market-UREM3ZE7.mjs} +3 -3
  8. package/dist/index.js +21879 -21136
  9. package/dist/index.mjs +16 -8
  10. package/dist/modals.js +898 -335
  11. package/dist/modals.mjs +5 -5
  12. package/dist/pages.js +3270 -1629
  13. package/dist/pages.mjs +12 -4
  14. package/dist/styles.css +1 -1
  15. package/dist/tailwind.css +1 -1
  16. package/dist/trading.js +1746 -643
  17. package/dist/trading.mjs +2 -2
  18. package/dist/types/pages/index.d.mts +1 -0
  19. package/dist/types/pages/index.d.ts +1 -0
  20. package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.mts +7 -0
  21. package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.ts +7 -0
  22. package/dist/types/pages/leaderboard/components/leaderboard-row.d.mts +7 -0
  23. package/dist/types/pages/leaderboard/components/leaderboard-row.d.ts +7 -0
  24. package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.mts +3 -0
  25. package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.ts +3 -0
  26. package/dist/types/pages/leaderboard/components/segmented-control.d.mts +18 -0
  27. package/dist/types/pages/leaderboard/components/segmented-control.d.ts +18 -0
  28. package/dist/types/pages/leaderboard/index.d.mts +28 -0
  29. package/dist/types/pages/leaderboard/index.d.ts +28 -0
  30. package/dist/types/pages/leaderboard/leaderboard.constants.d.mts +8 -0
  31. package/dist/types/pages/leaderboard/leaderboard.constants.d.ts +8 -0
  32. package/dist/types/pages/leaderboard/leaderboard.types.d.mts +11 -0
  33. package/dist/types/pages/leaderboard/leaderboard.types.d.ts +11 -0
  34. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
  35. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
  36. package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +3 -1
  37. package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +3 -1
  38. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +2 -1
  39. package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +2 -1
  40. package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.mts +6 -0
  41. package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.ts +6 -0
  42. package/dist/types/pages/user-profile/position-view-model.d.mts +2 -4
  43. package/dist/types/pages/user-profile/position-view-model.d.ts +2 -4
  44. package/dist/types/profile/tabs/trading-access-tab.d.mts +2 -1
  45. package/dist/types/profile/tabs/trading-access-tab.d.ts +2 -1
  46. package/dist/types/shared/pnl-format.d.mts +20 -0
  47. package/dist/types/shared/pnl-format.d.ts +20 -0
  48. package/dist/types/trading/manage-betdex-account-modal.d.mts +2 -1
  49. package/dist/types/trading/manage-betdex-account-modal.d.ts +2 -1
  50. package/dist/types/trading/place-order/index.place-order.types.d.mts +1 -0
  51. package/dist/types/trading/place-order/index.place-order.types.d.ts +1 -0
  52. package/dist/types/trading/place-order/index.place-order.utils.d.mts +2 -2
  53. package/dist/types/trading/place-order/index.place-order.utils.d.ts +2 -2
  54. package/dist/types/withdraw/steps/withdraw-amount.d.mts +3 -1
  55. package/dist/types/withdraw/steps/withdraw-amount.d.ts +3 -1
  56. package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
  57. package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
  58. package/package.json +3 -3
  59. package/dist/chunk-ROA5K67W.mjs +0 -1237
  60. /package/dist/types/{pages/user-profile/components → shared}/default-avatar.d.mts +0 -0
  61. /package/dist/types/{pages/user-profile/components → shared}/default-avatar.d.ts +0 -0
package/dist/trading.js CHANGED
@@ -109,7 +109,7 @@ __export(trading_exports, {
109
109
  prepareSettlementDifferences: () => prepareSettlementDifferences,
110
110
  resolveDifferenceIconClassName: () => resolveDifferenceIconClassName,
111
111
  useClaimWinnings: () => useClaimWinnings,
112
- useEventTradingContext: () => import_hooks47.useEventTradingContext,
112
+ useEventTradingContext: () => import_hooks52.useEventTradingContext,
113
113
  useResolvedMarketClaim: () => useResolvedMarketClaim,
114
114
  venueRequiresSharedKyc: () => venueRequiresSharedKyc
115
115
  });
@@ -147,6 +147,10 @@ var formatUsd = (value, options) => {
147
147
  maximumFractionDigits
148
148
  });
149
149
  };
150
+ var formatCompactUsd = (amount2) => {
151
+ const formatted = amount2 % 1 === 0 ? amount2.toString() : amount2.toFixed(1);
152
+ return `$${formatted}`;
153
+ };
150
154
  var GENERIC_BINARY_OUTCOME_LABELS = /* @__PURE__ */ new Set(["yes", "no"]);
151
155
  var TOTAL_OUTCOME_LABELS = /* @__PURE__ */ new Set(["over", "under"]);
152
156
  var DIRECTIONAL_OUTCOME_LABELS = /* @__PURE__ */ new Set(["up", "down"]);
@@ -6196,14 +6200,14 @@ var SettlementDetailsContent = ({
6196
6200
  SettlementDetails.displayName = "SettlementDetails";
6197
6201
 
6198
6202
  // src/trading/place-order/index.tsx
6199
- var import_hooks46 = require("@agg-build/hooks");
6200
- var import_sdk21 = require("@agg-build/sdk");
6201
- var import_react22 = __toESM(require("@number-flow/react"));
6203
+ var import_hooks51 = require("@agg-build/hooks");
6204
+ var import_sdk22 = require("@agg-build/sdk");
6205
+ var import_react25 = __toESM(require("@number-flow/react"));
6202
6206
  var Popover = __toESM(require("@radix-ui/react-popover"));
6203
6207
  var import_dayjs5 = __toESM(require("dayjs"));
6204
6208
  var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
6205
6209
  var import_utc2 = __toESM(require("dayjs/plugin/utc"));
6206
- var import_react23 = require("react");
6210
+ var import_react26 = require("react");
6207
6211
 
6208
6212
  // src/events/market-details/market-details.utils.ts
6209
6213
  var import_sdk14 = require("@agg-build/sdk");
@@ -9212,7 +9216,8 @@ var FundKalshiModal = ({ open, onOpenChange }) => {
9212
9216
  FundKalshiModal.displayName = "FundKalshiModal";
9213
9217
 
9214
9218
  // src/trading/manage-betdex-account-modal.tsx
9215
- var import_hooks45 = require("@agg-build/hooks");
9219
+ var import_react23 = require("react");
9220
+ var import_hooks50 = require("@agg-build/hooks");
9216
9221
  var Dialog8 = __toESM(require("@radix-ui/react-dialog"));
9217
9222
 
9218
9223
  // src/pages/user-profile/components/betdex-account-card.tsx
@@ -9240,11 +9245,15 @@ function BetdexAccountTransfers({
9240
9245
  accountId,
9241
9246
  environment,
9242
9247
  availableRaw,
9243
- canDeposit
9248
+ canDeposit,
9249
+ onWalletDeposit
9244
9250
  }) {
9245
9251
  const labels = (0, import_hooks42.useLabels)().userProfile.hostedBetdex;
9246
9252
  const transfer = (0, import_hooks42.useHostedVenueTransfers)(accountId, environment);
9247
9253
  const [showWithdraw, setShowWithdraw] = (0, import_react18.useState)(false);
9254
+ const wallet = (0, import_hooks42.useDepositAddresses)({
9255
+ enabled: transfer.isAvailable && environment === "production" && showWithdraw
9256
+ });
9248
9257
  const [amount2, setAmount] = (0, import_react18.useState)("");
9249
9258
  const [destination, setDestination] = (0, import_react18.useState)("");
9250
9259
  const [actionError, setActionError] = (0, import_react18.useState)(false);
@@ -9260,6 +9269,21 @@ function BetdexAccountTransfers({
9260
9269
  if (!transfer.isAvailable) return null;
9261
9270
  return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "flex flex-col gap-3 border-t border-agg-separator pt-3", children: [
9262
9271
  /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
9272
+ canDeposit && environment === "production" && onWalletDeposit ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
9273
+ Button,
9274
+ {
9275
+ type: "button",
9276
+ variant: "secondary",
9277
+ size: "small",
9278
+ disabled: transfer.deposit.isPending,
9279
+ isLoading: transfer.deposit.isPending,
9280
+ onClick: () => run(() => __async(null, null, function* () {
9281
+ const response = yield transfer.deposit.mutateAsync();
9282
+ onWalletDeposit(response.result.address);
9283
+ })),
9284
+ children: labels.fromWallet
9285
+ }
9286
+ ) : null,
9263
9287
  canDeposit ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
9264
9288
  Button,
9265
9289
  {
@@ -9364,6 +9388,21 @@ function BetdexAccountTransfers({
9364
9388
  }
9365
9389
  )
9366
9390
  ] }),
9391
+ environment === "production" ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
9392
+ Button,
9393
+ {
9394
+ type: "button",
9395
+ variant: "secondary",
9396
+ size: "small",
9397
+ disabled: !wallet.isReady || !wallet.svmAddress || wallet.isError,
9398
+ isLoading: wallet.isLoading,
9399
+ onClick: () => {
9400
+ if (wallet.isReady && wallet.svmAddress && !wallet.isError)
9401
+ setDestination(wallet.svmAddress);
9402
+ },
9403
+ children: labels.toWallet
9404
+ }
9405
+ ) : null,
9367
9406
  /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("label", { className: "flex flex-col gap-1 agg-type-caption text-agg-muted-foreground", children: [
9368
9407
  labels.withdrawalDestination,
9369
9408
  /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
@@ -9483,7 +9522,9 @@ function BetdexAccountActivity({
9483
9522
 
9484
9523
  // src/pages/user-profile/components/betdex-account-card.tsx
9485
9524
  var import_jsx_runtime147 = require("react/jsx-runtime");
9486
- function BetdexAccountCard() {
9525
+ function BetdexAccountCard({
9526
+ onWalletDeposit
9527
+ } = {}) {
9487
9528
  var _a;
9488
9529
  const [showActivity, setShowActivity] = (0, import_react20.useState)(false);
9489
9530
  const labels = (0, import_hooks44.useLabels)().userProfile.hostedBetdex;
@@ -9546,16 +9587,30 @@ function BetdexAccountCard() {
9546
9587
  }
9547
9588
  ),
9548
9589
  (data == null ? void 0 : data.accountId) && data.environment && ["active", "suspended"].includes(data.status) ? /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)(import_jsx_runtime147.Fragment, { children: [
9549
- /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
9550
- BetdexAccountTransfers,
9551
- {
9552
- accountId: data.accountId,
9553
- environment: data.environment,
9554
- availableRaw: data.balanceStatus === "available" ? (_a = data.balance) == null ? void 0 : _a.availableRaw : void 0,
9555
- canDeposit: data.status === "active"
9556
- },
9557
- `transfers:${data.accountId}:${data.environment}`
9558
- ),
9590
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("details", { className: "group/agg-betdex-funds border-t border-agg-separator pt-3", children: [
9591
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsxs)("summary", { className: "flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 text-agg-sm font-agg-bold text-agg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary [&::-webkit-details-marker]:hidden", children: [
9592
+ labels.manageFunds,
9593
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
9594
+ Icon,
9595
+ {
9596
+ name: "chevron-down",
9597
+ size: "small",
9598
+ className: "transition-transform group-open/agg-betdex-funds:rotate-180"
9599
+ }
9600
+ )
9601
+ ] }),
9602
+ /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
9603
+ BetdexAccountTransfers,
9604
+ {
9605
+ accountId: data.accountId,
9606
+ environment: data.environment,
9607
+ availableRaw: data.balanceStatus === "available" ? (_a = data.balance) == null ? void 0 : _a.availableRaw : void 0,
9608
+ canDeposit: data.status === "active",
9609
+ onWalletDeposit
9610
+ },
9611
+ `transfers:${data.accountId}:${data.environment}`
9612
+ )
9613
+ ] }),
9559
9614
  /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(
9560
9615
  Button,
9561
9616
  {
@@ -9581,28 +9636,1028 @@ function BetdexAccountCard() {
9581
9636
  );
9582
9637
  }
9583
9638
 
9584
- // src/trading/manage-betdex-account-modal.tsx
9639
+ // src/pages/user-profile/components/betdex-wallet-deposit.tsx
9640
+ var import_react22 = require("react");
9641
+ var import_hooks49 = require("@agg-build/hooks");
9642
+ var import_withdraw2 = require("@agg-build/hooks/withdraw");
9643
+
9644
+ // src/withdraw/index.tsx
9645
+ var import_react21 = require("react");
9646
+ var import_withdraw = require("@agg-build/hooks/withdraw");
9647
+
9648
+ // src/shared/constants.ts
9649
+ var USDC = {
9650
+ value: "USDC",
9651
+ label: "USDC",
9652
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdc.svg"
9653
+ };
9654
+ var SUPPORTED_NETWORKS = [
9655
+ {
9656
+ value: "abstract",
9657
+ label: "Abstract",
9658
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Abstract.svg",
9659
+ tokens: [USDC]
9660
+ },
9661
+ {
9662
+ value: "arbitrum",
9663
+ label: "Arbitrum One",
9664
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Arbitrum.svg",
9665
+ tokens: [USDC]
9666
+ },
9667
+ {
9668
+ value: "base",
9669
+ label: "Base",
9670
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Base.svg",
9671
+ tokens: [USDC]
9672
+ },
9673
+ {
9674
+ value: "bnb",
9675
+ label: "BNB Chain",
9676
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/BNB.svg",
9677
+ tokens: [USDC]
9678
+ },
9679
+ {
9680
+ value: "flow",
9681
+ label: "Flow",
9682
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Flow.svg",
9683
+ tokens: [USDC]
9684
+ },
9685
+ {
9686
+ value: "hyperliquid",
9687
+ label: "Hyperliquid",
9688
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/hyperliquid.png",
9689
+ tokens: [USDC]
9690
+ },
9691
+ {
9692
+ value: "mainnet",
9693
+ label: "Ethereum",
9694
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/ETH.svg",
9695
+ tokens: [USDC]
9696
+ },
9697
+ {
9698
+ value: "optimism",
9699
+ label: "Optimism",
9700
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/optimism/colored.svg",
9701
+ tokens: [USDC]
9702
+ },
9703
+ {
9704
+ value: "polygon",
9705
+ label: "Polygon Mainnet",
9706
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Polygon.svg",
9707
+ tokens: [USDC]
9708
+ },
9709
+ {
9710
+ value: "solana",
9711
+ label: "Solana",
9712
+ iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Solana.svg",
9713
+ tokens: [USDC]
9714
+ },
9715
+ {
9716
+ value: "zksync",
9717
+ label: "zkSync Era",
9718
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/chains/zksync/colored.svg",
9719
+ tokens: [USDC]
9720
+ }
9721
+ ];
9722
+ var USDC_ICON_URL = "https://assets.snagsolutions.io/public/web/icons/usdc.svg";
9723
+ var DEFAULT_CURRENCY_OPTIONS = [
9724
+ {
9725
+ value: "USDC",
9726
+ label: "USDC",
9727
+ iconUrl: USDC_ICON_URL
9728
+ },
9729
+ {
9730
+ value: "USDC.e",
9731
+ label: "USDC.e",
9732
+ iconUrl: USDC_ICON_URL
9733
+ },
9734
+ {
9735
+ value: "USDH",
9736
+ label: "USDH",
9737
+ iconUrl: USDC_ICON_URL
9738
+ },
9739
+ {
9740
+ value: "pUSD",
9741
+ label: "pUSD",
9742
+ iconUrl: USDC_ICON_URL
9743
+ },
9744
+ {
9745
+ value: "USDT",
9746
+ label: "USDT",
9747
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
9748
+ },
9749
+ {
9750
+ value: "USDT",
9751
+ label: "USDT",
9752
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdt.svg"
9753
+ },
9754
+ // Add commonly-used tokens with icons. These can be overridden by props.
9755
+ {
9756
+ value: "ARB",
9757
+ label: "ARB",
9758
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/arb.svg"
9759
+ },
9760
+ {
9761
+ value: "BNB",
9762
+ label: "BNB",
9763
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/bnb.svg"
9764
+ },
9765
+ {
9766
+ value: "BTC",
9767
+ label: "BTC",
9768
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/btc.svg"
9769
+ },
9770
+ {
9771
+ value: "MATIC",
9772
+ label: "MATIC",
9773
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/matic.svg"
9774
+ },
9775
+ {
9776
+ value: "ETH",
9777
+ label: "ETH",
9778
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/eth.svg"
9779
+ },
9780
+ {
9781
+ value: "SOL",
9782
+ label: "SOL",
9783
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/sol.svg"
9784
+ },
9785
+ {
9786
+ value: "OP",
9787
+ label: "OP",
9788
+ iconUrl: "https://assets.snagsolutions.io/public/web/icons/tokens/op.svg"
9789
+ }
9790
+ ];
9791
+ var withTokenIcons = (options) => {
9792
+ const byValue = new Map(DEFAULT_CURRENCY_OPTIONS.map((o) => [o.value, o.iconUrl]));
9793
+ return options.map((o) => o.iconUrl ? o : __spreadProps(__spreadValues({}, o), { iconUrl: byValue.get(o.value) }));
9794
+ };
9795
+ var CHAIN_ID_TO_SLUG = {
9796
+ "1": "mainnet",
9797
+ "10": "optimism",
9798
+ "56": "bnb",
9799
+ "137": "polygon",
9800
+ "324": "zksync",
9801
+ "747": "flow",
9802
+ "1337": "hyperliquid",
9803
+ "8453": "base",
9804
+ "42161": "arbitrum",
9805
+ "2741": "abstract",
9806
+ "792703809": "solana"
9807
+ };
9808
+ var withNetworkIcons = (options) => {
9809
+ const bySlug = new Map(SUPPORTED_NETWORKS.map((n) => [n.value, n.iconUrl]));
9810
+ return options.map((o) => {
9811
+ var _a, _b;
9812
+ const slug = (_a = CHAIN_ID_TO_SLUG[o.value]) != null ? _a : o.value;
9813
+ return __spreadProps(__spreadValues({}, o), {
9814
+ iconUrl: (_b = o.iconUrl) != null ? _b : bySlug.get(slug)
9815
+ });
9816
+ });
9817
+ };
9818
+
9819
+ // src/withdraw/steps/withdraw-method.tsx
9820
+ var import_hooks45 = require("@agg-build/hooks");
9585
9821
  var import_jsx_runtime148 = require("react/jsx-runtime");
9586
- function ManageBetdexAccountModal({
9587
- open,
9588
- onOpenChange
9589
- }) {
9822
+ var WithdrawMethodStep = ({
9823
+ balance,
9824
+ onSelectMethod
9825
+ }) => {
9590
9826
  const labels = (0, import_hooks45.useLabels)();
9591
- return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(Modal.Container, { maxWidth: "600px", "aria-label": labels.trading.manageBetdexAccount, children: [
9592
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(
9593
- Dialog8.Close,
9827
+ return /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(import_jsx_runtime148.Fragment, { children: [
9828
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
9829
+ /* @__PURE__ */ (0, import_jsx_runtime148.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_runtime148.jsxs)("div", { className: "flex flex-col gap-5", children: [
9830
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("p", { className: "agg-type-body text-agg-foreground", children: [
9831
+ labels.withdraw.balancePrefix,
9832
+ " ",
9833
+ formatCompactUsd(balance)
9834
+ ] }),
9835
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
9836
+ "div",
9837
+ {
9838
+ className: cn(
9839
+ "flex items-center gap-3 sm:gap-4 rounded-xl border border-agg-separator bg-agg-secondary p-3 sm:p-4",
9840
+ "hover:bg-agg-secondary-hover transition-colors cursor-pointer"
9841
+ ),
9842
+ role: "button",
9843
+ tabIndex: 0,
9844
+ onClick: () => onSelectMethod("wallet"),
9845
+ onKeyDown: (e) => {
9846
+ if (e.key === "Enter" || e.key === " ") {
9847
+ e.preventDefault();
9848
+ onSelectMethod("wallet");
9849
+ }
9850
+ },
9851
+ children: [
9852
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }) }),
9853
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex-1 min-w-0", children: [
9854
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: labels.withdraw.methods.walletTitle }),
9855
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: labels.withdraw.methods.walletDescription })
9856
+ ] }),
9857
+ /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ChevronRightIcon, { className: "h-5 w-5" }) })
9858
+ ]
9859
+ }
9860
+ )
9861
+ ] }) })
9862
+ ] });
9863
+ };
9864
+
9865
+ // src/withdraw/steps/withdraw-amount.tsx
9866
+ var import_hooks47 = require("@agg-build/hooks");
9867
+
9868
+ // src/shared/transfer-fee-summary.tsx
9869
+ var import_hooks46 = require("@agg-build/hooks");
9870
+ var import_jsx_runtime149 = require("react/jsx-runtime");
9871
+ var separator = /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": "true", children: "\xB7" });
9872
+ var normalizeFeeLabel = (label2) => label2.replace(/\s*~\s*$/, "");
9873
+ var TransferFeeSummary = ({
9874
+ estimate,
9875
+ view,
9876
+ minDeposit,
9877
+ eta
9878
+ }) => {
9879
+ const labels = (0, import_hooks46.useLabels)();
9880
+ if (!estimate) return null;
9881
+ if (view === "deposit") {
9882
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("p", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
9883
+ minDeposit ? /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { children: [
9884
+ labels.deposit.sendCrypto.minDepositPrefix,
9885
+ " ",
9886
+ minDeposit
9887
+ ] }) : null,
9888
+ minDeposit ? separator : null,
9889
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { children: [
9890
+ normalizeFeeLabel(labels.deposit.walletFlow.feePrefix),
9891
+ ": ",
9892
+ estimate.estimatedFees
9893
+ ] }),
9894
+ eta ? separator : null,
9895
+ eta ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { children: eta }) : null
9896
+ ] });
9897
+ }
9898
+ return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
9899
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { children: [
9900
+ labels.withdraw.walletFlow.estimatedFees,
9901
+ ": ",
9902
+ estimate.estimatedFees
9903
+ ] }),
9904
+ separator,
9905
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
9906
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { children: [
9907
+ labels.withdraw.walletFlow.networkReserve,
9908
+ ": ",
9909
+ estimate.networkReserve
9910
+ ] }),
9911
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
9912
+ Tooltip,
9913
+ {
9914
+ "aria-label": labels.withdraw.walletFlow.networkReserveTooltipAria,
9915
+ size: "medium",
9916
+ content: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "text-center", children: [
9917
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineOne }),
9918
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineTwo })
9919
+ ] }),
9920
+ classNames: {
9921
+ content: "min-w-96 max-w-none!",
9922
+ arrow: "[&_polygon]:fill-agg-background",
9923
+ icon: "text-agg-foreground! h-3! w-3!"
9924
+ }
9925
+ }
9926
+ )
9927
+ ] }),
9928
+ separator,
9929
+ /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("span", { children: [
9930
+ labels.withdraw.walletFlow.youReceive,
9931
+ ": ",
9932
+ estimate.youReceive
9933
+ ] })
9934
+ ] });
9935
+ };
9936
+
9937
+ // src/withdraw/steps/withdraw-amount.tsx
9938
+ var import_jsx_runtime150 = require("react/jsx-runtime");
9939
+ var formatRawTokenAmount = (rawAmount, decimals) => {
9940
+ if (!rawAmount) return "0";
9941
+ const raw = BigInt(rawAmount);
9942
+ const divisor = BigInt(`1${"0".repeat(decimals)}`);
9943
+ const whole = raw / divisor;
9944
+ const remainder = raw % divisor;
9945
+ if (remainder === BigInt(0)) return whole.toString();
9946
+ return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
9947
+ };
9948
+ var parseTokenAmountToRaw = (amount2, decimals) => {
9949
+ const normalizedAmount = amount2.trim();
9950
+ if (!normalizedAmount || !/^\d*(?:\.\d*)?$/.test(normalizedAmount)) return null;
9951
+ const [wholePart = "0", fractionalPart = ""] = normalizedAmount.split(".");
9952
+ if (fractionalPart.length > decimals) return null;
9953
+ const normalizedWhole = wholePart === "" ? "0" : wholePart;
9954
+ const normalizedFraction = fractionalPart.padEnd(decimals, "0");
9955
+ try {
9956
+ return `${BigInt(normalizedWhole)}${normalizedFraction}`.replace(/^0+(?=\d)/, "");
9957
+ } catch (e) {
9958
+ return null;
9959
+ }
9960
+ };
9961
+ var WithdrawAmountStep = ({
9962
+ title: title2,
9963
+ fixedDestination = false,
9964
+ amount: amount2,
9965
+ destinationWallet,
9966
+ balanceDisplay,
9967
+ tokenOptions,
9968
+ networkOptions,
9969
+ selectedToken,
9970
+ selectedNetwork,
9971
+ destDecimals,
9972
+ isConfirming = false,
9973
+ error,
9974
+ max = false,
9975
+ onBack,
9976
+ onAmountChange,
9977
+ onDestinationChange,
9978
+ onTokenChange,
9979
+ onNetworkChange,
9980
+ onMaxClick,
9981
+ onContinue
9982
+ }) => {
9983
+ var _a, _b, _c, _d;
9984
+ const labels = (0, import_hooks47.useLabels)();
9985
+ const SOLANA_CHAIN_ID = "792703809";
9986
+ const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
9987
+ const trimmedDestination = destinationWallet.trim();
9988
+ const isValidAddress = isSolanaDest ? /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(trimmedDestination) : /^0x[a-fA-F0-9]{40}$/.test(trimmedDestination);
9989
+ const isValid = Number(amount2) > 0 && isValidAddress;
9990
+ const amountRaw = amount2 && Number(amount2) > 0 ? parseTokenAmountToRaw(amount2, destDecimals) : null;
9991
+ const destinationChainId = Number(selectedNetwork) || null;
9992
+ const preview = (0, import_hooks47.useWithdrawPreview)({
9993
+ amountRaw,
9994
+ tokenSymbol: selectedToken || null,
9995
+ destinationChainId,
9996
+ destinationAddress: trimmedDestination || null,
9997
+ max
9998
+ });
9999
+ const previewUnviable = ((_a = preview.data) == null ? void 0 : _a.pricingStatus) === "unviable";
10000
+ const previewUnviableMessage = previewUnviable ? ((_b = preview.data) == null ? void 0 : _b.maxDeliverableRaw) != null && BigInt(preview.data.maxDeliverableRaw) > BigInt(0) ? `Amount exceeds your withdrawable balance. Max: ~${formatRawTokenAmount(preview.data.maxDeliverableRaw, destDecimals)} ${selectedToken}` : (_d = (_c = preview.data) == null ? void 0 : _c.unviableReason) != null ? _d : "This amount can't be withdrawn right now." : null;
10001
+ const previewLoading = preview.isFetching;
10002
+ const isDisabled = !isValid || isConfirming || previewUnviable || previewLoading;
10003
+ const withdrawEstimate = preview.data && preview.data.pricingStatus === "quoted" ? {
10004
+ estimatedFees: preview.data.feeRaw != null ? `~${formatRawTokenAmount(preview.data.feeRaw, destDecimals)} ${selectedToken}` : "\u2014",
10005
+ networkReserve: preview.data.networkFeeRaw != null ? `~${formatRawTokenAmount(preview.data.networkFeeRaw, destDecimals)} ${selectedToken}` : "\u2014",
10006
+ youReceive: preview.data.receiveAmountRaw != null ? `~${formatRawTokenAmount(preview.data.receiveAmountRaw, destDecimals)} ${selectedToken}` : "\u2014"
10007
+ } : null;
10008
+ const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
10009
+ return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(import_jsx_runtime150.Fragment, { children: [
10010
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10011
+ Modal.Header,
9594
10012
  {
9595
- "aria-label": labels.common.close,
9596
- className: "absolute right-4 top-4 z-10 flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-muted-foreground hover:bg-agg-quaternary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
9597
- children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Icon, { name: "close", size: "medium" })
10013
+ title: title2 != null ? title2 : labels.withdraw.walletFlow.title,
10014
+ hideBorder: true,
10015
+ leftElement: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10016
+ "button",
10017
+ {
10018
+ type: "button",
10019
+ className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
10020
+ onClick: onBack,
10021
+ "aria-label": labels.withdraw.back,
10022
+ children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
10023
+ }
10024
+ )
9598
10025
  }
9599
10026
  ),
9600
- /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(Modal.Body, { classNames: { root: "!px-5 !py-16" }, children: [
9601
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Dialog8.Title, { className: "sr-only", children: labels.trading.manageBetdexAccount }),
9602
- /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Dialog8.Description, { className: "sr-only", children: labels.userProfile.hostedBetdex.description }),
9603
- open ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(BetdexAccountCard, {}) : null
10027
+ /* @__PURE__ */ (0, import_jsx_runtime150.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_runtime150.jsxs)("div", { className: "flex flex-col gap-5", children: [
10028
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-5", children: [
10029
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-2", children: [
10030
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.recipientAddressLabel }),
10031
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10032
+ "input",
10033
+ {
10034
+ type: "text",
10035
+ "aria-label": labels.withdraw.walletFlow.recipientAddressLabel,
10036
+ className: cn(
10037
+ "agg-type-body w-full h-10 rounded border border-agg-separator bg-agg-secondary px-3 outline-none",
10038
+ "text-agg-foreground placeholder:text-agg-muted-foreground",
10039
+ "focus:border-agg-primary transition-colors"
10040
+ ),
10041
+ placeholder: isSolanaDest ? "FwR3..." : "0x971d...",
10042
+ value: destinationWallet,
10043
+ readOnly: fixedDestination,
10044
+ onChange: (e) => onDestinationChange(e.target.value)
10045
+ }
10046
+ )
10047
+ ] }),
10048
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-2", children: [
10049
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex items-center justify-between", children: [
10050
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.amountLabel }),
10051
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
10052
+ labels.withdraw.balancePrefix,
10053
+ " ",
10054
+ balanceDisplay
10055
+ ] })
10056
+ ] }),
10057
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 focus-within:border-agg-primary transition-colors", children: [
10058
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10059
+ "input",
10060
+ {
10061
+ type: "text",
10062
+ inputMode: "decimal",
10063
+ "aria-label": labels.withdraw.walletFlow.amountLabel,
10064
+ className: cn(
10065
+ "agg-type-body flex-1 min-w-0 bg-transparent outline-none",
10066
+ Number(amount2) > 0 ? "text-agg-foreground" : "text-agg-muted-foreground"
10067
+ ),
10068
+ placeholder: "0.00",
10069
+ value: amount2,
10070
+ onChange: (e) => onAmountChange(e.target.value)
10071
+ }
10072
+ ),
10073
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("span", { className: "agg-type-body text-agg-muted-foreground shrink-0", children: selectedToken }),
10074
+ onMaxClick ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10075
+ "button",
10076
+ {
10077
+ type: "button",
10078
+ className: "agg-type-label-strong text-agg-primary hover:opacity-80 transition-opacity cursor-pointer shrink-0",
10079
+ onClick: onMaxClick,
10080
+ children: labels.withdraw.walletFlow.max
10081
+ }
10082
+ ) : null
10083
+ ] })
10084
+ ] }),
10085
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-3 sm:flex-row sm:gap-5", children: [
10086
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
10087
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.tokenLabel }),
10088
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10089
+ Select,
10090
+ {
10091
+ items: tokenOptions,
10092
+ disabled: fixedDestination,
10093
+ value: selectedToken,
10094
+ onChange: onTokenChange,
10095
+ ariaLabel: labels.withdraw.walletFlow.tokenLabel
10096
+ }
10097
+ )
10098
+ ] }),
10099
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
10100
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.networkLabel }),
10101
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10102
+ Select,
10103
+ {
10104
+ items: networkOptions,
10105
+ disabled: fixedDestination,
10106
+ value: selectedNetwork,
10107
+ onChange: onNetworkChange,
10108
+ ariaLabel: labels.withdraw.walletFlow.networkLabel
10109
+ }
10110
+ )
10111
+ ] })
10112
+ ] }),
10113
+ shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null,
10114
+ previewUnviableMessage ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label text-agg-error", role: "alert", children: previewUnviableMessage }) : null
10115
+ ] }),
10116
+ /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
10117
+ Button,
10118
+ {
10119
+ variant: isValid && !isConfirming && !previewUnviable && !previewLoading ? "primary" : "secondary",
10120
+ size: "large",
10121
+ className: "w-full",
10122
+ disabled: isDisabled,
10123
+ prefix: previewLoading && !isConfirming ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(LoadingIcon, { size: "small", className: "mr-2 text-current" }) : void 0,
10124
+ onClick: onContinue,
10125
+ children: isConfirming ? labels.common.loading : previewLoading ? labels.withdraw.walletFlow.calculatingFees : labels.withdraw.walletFlow.confirm
10126
+ }
10127
+ ),
10128
+ error ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "agg-type-label text-agg-error text-center", role: "alert", children: error }) : null
10129
+ ] }) })
10130
+ ] });
10131
+ };
10132
+
10133
+ // src/withdraw/steps/withdraw-success.tsx
10134
+ var import_hooks48 = require("@agg-build/hooks");
10135
+ var import_jsx_runtime151 = require("react/jsx-runtime");
10136
+ var SummaryRow = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0", children: [
10137
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
10138
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "min-w-0 text-right text-[14px] leading-5 text-agg-foreground", children: value })
10139
+ ] });
10140
+ var WithdrawCloseButton = ({ onClose, label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10141
+ "button",
10142
+ {
10143
+ type: "button",
10144
+ className: "absolute right-8 top-7 flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
10145
+ onClick: onClose,
10146
+ "aria-label": label2,
10147
+ children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, { className: "h-6 w-6" })
10148
+ }
10149
+ );
10150
+ var LoadingGlyph = ({
10151
+ className,
10152
+ enableAnimations
10153
+ }) => /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10154
+ "span",
10155
+ {
10156
+ "aria-hidden": "true",
10157
+ className: cn(
10158
+ "inline-block rounded-full border-2 border-current border-r-transparent",
10159
+ getMotionClassName(enableAnimations, "animate-spin"),
10160
+ className
10161
+ )
10162
+ }
10163
+ );
10164
+ var loadingActiveIndexFor = (state) => {
10165
+ if (state.status === "transferring") return 2;
10166
+ if (state.status === "bridging") return 1;
10167
+ return 0;
10168
+ };
10169
+ var getLoadingSteps = (labels) => [
10170
+ { id: "preparing", label: labels.lifecycle.loadingSteps.preparing },
10171
+ { id: "bridging", label: labels.lifecycle.loadingSteps.bridging },
10172
+ { id: "sending", label: labels.lifecycle.loadingSteps.sending },
10173
+ { id: "confirming", label: labels.lifecycle.loadingSteps.confirming }
10174
+ ];
10175
+ var WithdrawLoadingStep = ({
10176
+ lifecycleState,
10177
+ onClose
10178
+ }) => {
10179
+ const labels = (0, import_hooks48.useLabels)();
10180
+ const {
10181
+ features: { enableAnimations }
10182
+ } = (0, import_hooks48.useSdkUiConfig)();
10183
+ const walletFlowLabels = labels.withdraw.walletFlow;
10184
+ const activeIndex = loadingActiveIndexFor(lifecycleState);
10185
+ const loadingSteps = getLoadingSteps(walletFlowLabels);
10186
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Modal.Body, { classNames: { root: "px-8 py-7" }, children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-7", children: [
10187
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
10188
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: walletFlowLabels.successTitle }),
10189
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10190
+ "button",
10191
+ {
10192
+ type: "button",
10193
+ className: "flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
10194
+ onClick: onClose,
10195
+ "aria-label": labels.common.close,
10196
+ children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, { className: "h-6 w-6" })
10197
+ }
10198
+ )
10199
+ ] }),
10200
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "flex flex-col gap-5", role: "status", "aria-live": "polite", children: loadingSteps.map((step, index) => {
10201
+ const isComplete = index < activeIndex;
10202
+ const isActive = index === activeIndex;
10203
+ const textClassName = isActive || isComplete ? "text-agg-foreground" : "text-agg-muted-foreground";
10204
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-3", children: [
10205
+ isComplete ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10206
+ Icon,
10207
+ {
10208
+ name: "check-circle",
10209
+ size: "small",
10210
+ className: "h-4 w-4 shrink-0 text-agg-primary",
10211
+ "aria-hidden": "true"
10212
+ }
10213
+ ) : null,
10214
+ isActive ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10215
+ LoadingGlyph,
10216
+ {
10217
+ enableAnimations,
10218
+ className: "h-4 w-4 shrink-0 text-agg-primary"
10219
+ }
10220
+ ) : null,
10221
+ !isComplete && !isActive ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10222
+ "span",
10223
+ {
10224
+ "aria-hidden": "true",
10225
+ className: "h-4 w-4 shrink-0 rounded-full border border-agg-separator"
10226
+ }
10227
+ ) : null,
10228
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: cn("min-w-0 flex-1 text-agg-base leading-agg-6", textClassName), children: step.label })
10229
+ ] }, step.id);
10230
+ }) }),
10231
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: walletFlowLabels.loadingDescription })
10232
+ ] }) }) });
10233
+ };
10234
+ var resultCopyFor = ({
10235
+ status,
10236
+ tokenSymbol,
10237
+ labels
10238
+ }) => {
10239
+ if (status === "failed") {
10240
+ return {
10241
+ title: labels.successTitleFailed,
10242
+ description: labels.successDescriptionFailed(tokenSymbol)
10243
+ };
10244
+ }
10245
+ if (status === "partial_success") {
10246
+ return {
10247
+ title: labels.successTitlePartial,
10248
+ description: labels.successDescriptionPartial(tokenSymbol)
10249
+ };
10250
+ }
10251
+ return {
10252
+ title: labels.successTitleCompleted,
10253
+ description: labels.successDescriptionCompleted(tokenSymbol)
10254
+ };
10255
+ };
10256
+ var WithdrawSuccessStep = ({
10257
+ summary,
10258
+ tokenSymbol,
10259
+ requestedWithdrawal,
10260
+ resultStatus,
10261
+ errorMessage,
10262
+ onDone,
10263
+ onRetry,
10264
+ onClose
10265
+ }) => {
10266
+ const labels = (0, import_hooks48.useLabels)();
10267
+ const walletFlowLabels = labels.withdraw.walletFlow;
10268
+ const { title: title2, description } = resultCopyFor({
10269
+ status: resultStatus,
10270
+ tokenSymbol,
10271
+ labels: walletFlowLabels
10272
+ });
10273
+ const isFailed = resultStatus === "failed";
10274
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
10275
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(WithdrawCloseButton, { onClose, label: labels.common.close }),
10276
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col items-center justify-center gap-8 text-center", children: [
10277
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10278
+ "div",
10279
+ {
10280
+ className: cn(
10281
+ "flex h-[60px] w-[60px] items-center justify-center rounded-full",
10282
+ isFailed ? "bg-agg-error/15" : "bg-agg-success/15"
10283
+ ),
10284
+ "aria-hidden": "true",
10285
+ children: isFailed ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, { className: "h-6 w-6 text-agg-error" }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
10286
+ }
10287
+ ),
10288
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex w-full flex-col items-center gap-3 text-center text-agg-foreground", children: [
10289
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold", children: title2 }),
10290
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10291
+ "p",
10292
+ {
10293
+ className: "max-w-[400px] text-agg-base leading-agg-6",
10294
+ "data-withdraw-result-status": resultStatus,
10295
+ children: errorMessage && isFailed ? errorMessage : description
10296
+ }
10297
+ )
10298
+ ] }),
10299
+ !isFailed ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex w-full max-w-[400px] flex-col rounded-agg-lg border border-agg-separator bg-agg-secondary px-3 py-1 text-left", children: [
10300
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10301
+ SummaryRow,
10302
+ {
10303
+ label: walletFlowLabels.summary.requestedWithdrawal,
10304
+ value: requestedWithdrawal
10305
+ }
10306
+ ),
10307
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
10308
+ SummaryRow,
10309
+ {
10310
+ label: walletFlowLabels.summary.amountReceived,
10311
+ value: summary.amountReceived
10312
+ }
10313
+ ),
10314
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SummaryRow, { label: walletFlowLabels.summary.fees, value: summary.fees }),
10315
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SummaryRow, { label: walletFlowLabels.summary.network, value: summary.network }),
10316
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SummaryRow, { label: walletFlowLabels.summary.toWallet, value: summary.toWallet })
10317
+ ] }) : null,
10318
+ isFailed ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
10319
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: walletFlowLabels.close }),
10320
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Button, { variant: "primary", size: "large", className: "w-[123px]", onClick: onRetry, children: walletFlowLabels.retry })
10321
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.withdraw.done })
9604
10322
  ] })
9605
10323
  ] }) });
10324
+ };
10325
+
10326
+ // src/withdraw/index.tsx
10327
+ var import_jsx_runtime152 = require("react/jsx-runtime");
10328
+ var DEFAULT_TOKEN_DECIMALS = 6;
10329
+ var TOKEN_DECIMALS_BY_SYMBOL = {
10330
+ BNB: 18,
10331
+ ETH: 18,
10332
+ MATIC: 18,
10333
+ POL: 18,
10334
+ WETH: 18,
10335
+ USDC: 6,
10336
+ USDT: 6
10337
+ };
10338
+ var TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL = {
10339
+ "56": {
10340
+ USDC: 18,
10341
+ USDT: 18
10342
+ }
10343
+ };
10344
+ var getTokenDecimals = (tokenSymbol, chainId) => {
10345
+ var _a;
10346
+ const normalizedSymbol = tokenSymbol.trim().toUpperCase();
10347
+ const normalizedChainId = chainId == null ? void 0 : chainId.trim();
10348
+ if (normalizedChainId) {
10349
+ const chainDecimals = TOKEN_DECIMALS_BY_CHAIN_AND_SYMBOL[normalizedChainId];
10350
+ const chainTokenDecimals = chainDecimals == null ? void 0 : chainDecimals[normalizedSymbol];
10351
+ if (chainTokenDecimals != null) return chainTokenDecimals;
10352
+ }
10353
+ return (_a = TOKEN_DECIMALS_BY_SYMBOL[normalizedSymbol]) != null ? _a : DEFAULT_TOKEN_DECIMALS;
10354
+ };
10355
+ var formatRawTokenAmount2 = (rawAmount, decimals) => {
10356
+ const raw = BigInt(rawAmount);
10357
+ const divisor = BigInt(`1${"0".repeat(decimals)}`);
10358
+ const whole = raw / divisor;
10359
+ const remainder = raw % divisor;
10360
+ if (remainder === BigInt(0)) return whole.toString();
10361
+ return `${whole.toString()}.${remainder.toString().padStart(decimals, "0").replace(/0+$/, "")}`;
10362
+ };
10363
+ var formatLifecycleTokenAmount = ({
10364
+ rawAmount,
10365
+ tokenSymbol,
10366
+ chainId
10367
+ }) => `${formatRawTokenAmount2(rawAmount, getTokenDecimals(tokenSymbol, chainId))} ${tokenSymbol}`;
10368
+ var buildTerminalSummary = ({
10369
+ fallbackSummary,
10370
+ lifecycleCompletedAmountRaw,
10371
+ lifecycleRequestedAmountRaw,
10372
+ lifecycleFeeRaw,
10373
+ tokenSymbol,
10374
+ chainId
10375
+ }) => {
10376
+ if (!lifecycleCompletedAmountRaw) return fallbackSummary;
10377
+ const amountReceived = formatLifecycleTokenAmount({
10378
+ rawAmount: lifecycleCompletedAmountRaw,
10379
+ tokenSymbol,
10380
+ chainId
10381
+ });
10382
+ let feeRaw = lifecycleFeeRaw;
10383
+ if (feeRaw == null && lifecycleRequestedAmountRaw) {
10384
+ try {
10385
+ const r = BigInt(lifecycleRequestedAmountRaw);
10386
+ const c = BigInt(lifecycleCompletedAmountRaw);
10387
+ feeRaw = (r > c ? r - c : BigInt(0)).toString();
10388
+ } catch (e) {
10389
+ feeRaw = null;
10390
+ }
10391
+ }
10392
+ return __spreadValues(__spreadProps(__spreadValues({}, fallbackSummary), {
10393
+ amountReceived
10394
+ }), feeRaw != null ? {
10395
+ fees: formatLifecycleTokenAmount({
10396
+ rawAmount: feeRaw,
10397
+ tokenSymbol,
10398
+ chainId
10399
+ })
10400
+ } : {});
10401
+ };
10402
+ function isControlledWithdrawModalProps(props) {
10403
+ return "withdrawFlow" in props;
10404
+ }
10405
+ function WithdrawModalSelfDriven({
10406
+ open,
10407
+ onOpenChange
10408
+ }) {
10409
+ const withdrawProps = (0, import_withdraw.useWithdrawFlow)({ open, onOpenChange });
10410
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(WithdrawModalControlled, __spreadValues({}, withdrawProps));
10411
+ }
10412
+ function WithdrawModalControlled({
10413
+ open,
10414
+ onOpenChange,
10415
+ withdrawFlow,
10416
+ transferTarget,
10417
+ onWithdrawDestinationChange,
10418
+ onWithdrawAmountChange,
10419
+ onWithdrawTokenChange,
10420
+ onWithdrawNetworkChange,
10421
+ onMaxClick,
10422
+ onSelectWithdrawProvider,
10423
+ onDoneWithdraw
10424
+ }) {
10425
+ var _a;
10426
+ const initialFormStep = transferTarget ? "withdraw-amount" : "method";
10427
+ const [flowState, setFlowState] = (0, import_react21.useState)({
10428
+ status: "form",
10429
+ formStep: initialFormStep
10430
+ });
10431
+ const [isConfirming, setIsConfirming] = (0, import_react21.useState)(false);
10432
+ const [confirmError, setConfirmError] = (0, import_react21.useState)(null);
10433
+ const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
10434
+ (0, import_react21.useEffect)(() => {
10435
+ if (!open) {
10436
+ setFlowState({ status: "form", formStep: initialFormStep });
10437
+ setIsConfirming(false);
10438
+ setConfirmError(null);
10439
+ resetWithdrawalLifecycle();
10440
+ }
10441
+ }, [open, resetWithdrawalLifecycle, initialFormStep]);
10442
+ (0, import_react21.useEffect)(() => {
10443
+ if (flowState.status !== "loading") return;
10444
+ if (!withdrawalLifecycleState.terminal) return;
10445
+ if (withdrawalLifecycleState.status === "completed") {
10446
+ setFlowState({ status: "success" });
10447
+ return;
10448
+ }
10449
+ if (withdrawalLifecycleState.status === "partial") {
10450
+ setFlowState({ status: "partial_success" });
10451
+ return;
10452
+ }
10453
+ if (withdrawalLifecycleState.status === "failed") {
10454
+ setFlowState({
10455
+ status: "failed",
10456
+ errorMessage: withdrawalLifecycleState.errorMessage
10457
+ });
10458
+ }
10459
+ }, [
10460
+ flowState.status,
10461
+ withdrawalLifecycleState.errorMessage,
10462
+ withdrawalLifecycleState.status,
10463
+ withdrawalLifecycleState.terminal
10464
+ ]);
10465
+ const handleOpenChange = (isOpen) => {
10466
+ if (!isOpen) {
10467
+ setFlowState({ status: "form", formStep: initialFormStep });
10468
+ setIsConfirming(false);
10469
+ setConfirmError(null);
10470
+ resetWithdrawalLifecycle();
10471
+ }
10472
+ onOpenChange(isOpen);
10473
+ };
10474
+ const handleBack = () => {
10475
+ if (transferTarget) {
10476
+ handleOpenChange(false);
10477
+ return;
10478
+ }
10479
+ setConfirmError(null);
10480
+ setFlowState({ status: "form", formStep: initialFormStep });
10481
+ };
10482
+ const handleRetry = () => {
10483
+ setConfirmError(null);
10484
+ setIsConfirming(false);
10485
+ resetWithdrawalLifecycle();
10486
+ setFlowState({ status: "form", formStep: "withdraw-amount" });
10487
+ };
10488
+ const handleConfirm = () => __async(null, null, function* () {
10489
+ if (isConfirming || transferTarget && (withdrawFlow.destinationWallet !== transferTarget.address || withdrawFlow.selectedNetwork !== transferTarget.chainId || withdrawFlow.selectedToken !== transferTarget.tokenSymbol))
10490
+ return;
10491
+ setFlowState({ status: "loading" });
10492
+ setIsConfirming(true);
10493
+ setConfirmError(null);
10494
+ try {
10495
+ yield onSelectWithdrawProvider("wallet");
10496
+ } catch (err) {
10497
+ const errorMessage = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
10498
+ setConfirmError(errorMessage);
10499
+ setFlowState({ status: "failed", errorMessage });
10500
+ } finally {
10501
+ setIsConfirming(false);
10502
+ }
10503
+ });
10504
+ const withdrawTokenOptions = withTokenIcons(withdrawFlow.tokenOptions);
10505
+ const withdrawNetworkOptions = withNetworkIcons(withdrawFlow.networkOptions);
10506
+ const requestedWithdrawal = `${withdrawFlow.amount} ${withdrawFlow.selectedToken}`.trim();
10507
+ const modalMaxWidth = flowState.status === "form" && flowState.formStep === "method" ? "600px" : "480px";
10508
+ const resultStatus = flowState.status;
10509
+ const terminalSummary = buildTerminalSummary({
10510
+ fallbackSummary: withdrawFlow.purchaseSummary,
10511
+ lifecycleCompletedAmountRaw: withdrawalLifecycleState.completedAmountRaw,
10512
+ lifecycleRequestedAmountRaw: withdrawalLifecycleState.requestedAmountRaw,
10513
+ lifecycleFeeRaw: withdrawalLifecycleState.feeRaw,
10514
+ tokenSymbol: withdrawFlow.selectedToken,
10515
+ chainId: withdrawFlow.selectedNetwork
10516
+ });
10517
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(Modal.Container, { maxWidth: modalMaxWidth, "aria-label": (_a = transferTarget == null ? void 0 : transferTarget.title) != null ? _a : "Withdraw", children: [
10518
+ flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
10519
+ WithdrawMethodStep,
10520
+ {
10521
+ balance: withdrawFlow.balance,
10522
+ onSelectMethod: () => setFlowState({ status: "form", formStep: "withdraw-amount" })
10523
+ }
10524
+ ) : null,
10525
+ flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
10526
+ WithdrawAmountStep,
10527
+ {
10528
+ title: transferTarget == null ? void 0 : transferTarget.title,
10529
+ fixedDestination: !!transferTarget,
10530
+ amount: withdrawFlow.amount,
10531
+ destinationWallet: withdrawFlow.destinationWallet,
10532
+ balanceDisplay: withdrawFlow.balanceDisplay,
10533
+ tokenOptions: withdrawTokenOptions,
10534
+ networkOptions: withdrawNetworkOptions,
10535
+ selectedToken: withdrawFlow.selectedToken,
10536
+ selectedNetwork: withdrawFlow.selectedNetwork,
10537
+ destDecimals: getTokenDecimals(
10538
+ withdrawFlow.selectedToken,
10539
+ withdrawFlow.selectedNetwork
10540
+ ),
10541
+ isConfirming,
10542
+ error: confirmError,
10543
+ max: withdrawFlow.isMax,
10544
+ onBack: handleBack,
10545
+ onAmountChange: onWithdrawAmountChange,
10546
+ onDestinationChange: onWithdrawDestinationChange,
10547
+ onTokenChange: onWithdrawTokenChange,
10548
+ onNetworkChange: onWithdrawNetworkChange,
10549
+ onMaxClick,
10550
+ onContinue: handleConfirm
10551
+ }
10552
+ ) : null,
10553
+ flowState.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
10554
+ WithdrawLoadingStep,
10555
+ {
10556
+ lifecycleState: withdrawalLifecycleState,
10557
+ onClose: () => handleOpenChange(false)
10558
+ }
10559
+ ) : null,
10560
+ flowState.status === "success" || flowState.status === "partial_success" || flowState.status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
10561
+ WithdrawSuccessStep,
10562
+ {
10563
+ summary: terminalSummary,
10564
+ tokenSymbol: withdrawFlow.selectedToken,
10565
+ requestedWithdrawal,
10566
+ resultStatus,
10567
+ errorMessage: flowState.status === "failed" ? flowState.errorMessage : null,
10568
+ onDone: onDoneWithdraw,
10569
+ onRetry: handleRetry,
10570
+ onClose: () => handleOpenChange(false)
10571
+ }
10572
+ ) : null
10573
+ ] }) });
10574
+ }
10575
+ var WithdrawModal = (props) => {
10576
+ if (isControlledWithdrawModalProps(props)) {
10577
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(WithdrawModalControlled, __spreadValues({}, props));
10578
+ }
10579
+ return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(WithdrawModalSelfDriven, __spreadValues({}, props));
10580
+ };
10581
+ WithdrawModal.displayName = "WithdrawModal";
10582
+
10583
+ // src/pages/user-profile/components/betdex-wallet-deposit.tsx
10584
+ var import_jsx_runtime153 = require("react/jsx-runtime");
10585
+ function BetdexWalletDeposit({
10586
+ address,
10587
+ onClose
10588
+ }) {
10589
+ const labels = (0, import_hooks49.useLabels)().userProfile.hostedBetdex;
10590
+ const flow = (0, import_withdraw2.useWithdrawFlow)({
10591
+ open: true,
10592
+ onOpenChange: (open) => {
10593
+ if (!open) onClose();
10594
+ }
10595
+ });
10596
+ const { onWithdrawDestinationChange, onWithdrawNetworkChange, onWithdrawTokenChange } = flow;
10597
+ (0, import_react22.useEffect)(() => {
10598
+ onWithdrawDestinationChange(address);
10599
+ onWithdrawNetworkChange("792703809");
10600
+ onWithdrawTokenChange("USDC");
10601
+ }, [address, onWithdrawDestinationChange, onWithdrawNetworkChange, onWithdrawTokenChange]);
10602
+ return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
10603
+ WithdrawModal,
10604
+ __spreadProps(__spreadValues({}, flow), {
10605
+ transferTarget: {
10606
+ title: labels.transferToBetdex,
10607
+ address,
10608
+ chainId: "792703809",
10609
+ tokenSymbol: "USDC"
10610
+ }
10611
+ })
10612
+ );
10613
+ }
10614
+
10615
+ // src/trading/manage-betdex-account-modal.tsx
10616
+ var import_jsx_runtime154 = require("react/jsx-runtime");
10617
+ function ManageBetdexAccountModal({
10618
+ open,
10619
+ onOpenChange,
10620
+ userId
10621
+ }) {
10622
+ const labels = (0, import_hooks50.useLabels)();
10623
+ const [fundingTarget, setFundingTarget] = (0, import_react23.useState)(
10624
+ null
10625
+ );
10626
+ const currentTarget = (fundingTarget == null ? void 0 : fundingTarget.userId) === userId ? fundingTarget : null;
10627
+ (0, import_react23.useEffect)(() => {
10628
+ if (!open) setFundingTarget(null);
10629
+ }, [open]);
10630
+ (0, import_react23.useEffect)(() => setFundingTarget(null), [userId]);
10631
+ return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(import_jsx_runtime154.Fragment, { children: [
10632
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Modal, { open: open && !currentTarget, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(Modal.Container, { maxWidth: "600px", "aria-label": labels.trading.manageBetdexAccount, children: [
10633
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
10634
+ Dialog8.Close,
10635
+ {
10636
+ "aria-label": labels.common.close,
10637
+ className: "absolute right-4 top-4 z-10 flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-muted-foreground hover:bg-agg-quaternary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
10638
+ children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Icon, { name: "close", size: "medium" })
10639
+ }
10640
+ ),
10641
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(Modal.Body, { classNames: { root: "!px-5 !py-16" }, children: [
10642
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Dialog8.Title, { className: "sr-only", children: labels.trading.manageBetdexAccount }),
10643
+ /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Dialog8.Description, { className: "sr-only", children: labels.userProfile.hostedBetdex.description }),
10644
+ open ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
10645
+ BetdexAccountCard,
10646
+ {
10647
+ onWalletDeposit: userId ? (address) => setFundingTarget({ userId, address }) : void 0
10648
+ }
10649
+ ) : null
10650
+ ] })
10651
+ ] }) }),
10652
+ open && currentTarget ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
10653
+ BetdexWalletDeposit,
10654
+ {
10655
+ address: currentTarget.address,
10656
+ onClose: () => setFundingTarget(null)
10657
+ },
10658
+ currentTarget.userId
10659
+ ) : null
10660
+ ] });
9606
10661
  }
9607
10662
 
9608
10663
  // src/trading/place-order/index.place-order.execution-debug.ts
@@ -9897,6 +10952,7 @@ var formatChainIdLabel = (chainId) => {
9897
10952
  };
9898
10953
 
9899
10954
  // src/trading/place-order/index.place-order.utils.ts
10955
+ var import_sdk21 = require("@agg-build/sdk");
9900
10956
  var ATOMIC_UNITS = 1e6;
9901
10957
  var ATOMIC_UNITS_BIGINT = BigInt(ATOMIC_UNITS);
9902
10958
  var getPlaceOrderBalanceCacheKey = (balances) => {
@@ -10392,9 +11448,10 @@ var buildLiveRouteCards = ({
10392
11448
  quoteData,
10393
11449
  tradeSide,
10394
11450
  eventVenues = [],
10395
- geoBlockedVenues: inheritedGeoBlockedVenues
11451
+ geoBlockedVenues: inheritedGeoBlockedVenues,
11452
+ betdexFundingRequired = false
10396
11453
  }) => {
10397
- var _a, _b, _c, _d, _e;
11454
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10398
11455
  const geoBlockedVenues = extractGeoBlockedVenues(quoteData.warnings);
10399
11456
  for (const venue of inheritedGeoBlockedVenues != null ? inheritedGeoBlockedVenues : []) {
10400
11457
  geoBlockedVenues.add(venue);
@@ -10455,7 +11512,7 @@ var buildLiveRouteCards = ({
10455
11512
  // balance condition, and `handleExecuteQuote` rejects an empty quoteId.
10456
11513
  (primaryWinnerOutcomeId && sq.venueMarketOutcomeId ? sq.venueMarketOutcomeId !== primaryWinnerOutcomeId : sq.venue !== primaryWinnerVenue)
10457
11514
  ).map((sq) => {
10458
- var _a2, _b2, _c2, _d2, _e2, _f;
11515
+ var _a2, _b2, _c2, _d2, _e2, _f2;
10459
11516
  const parsedVenue = parseVenue(sq.venue);
10460
11517
  const venue = parsedVenue.success ? parsedVenue.data : void 0;
10461
11518
  if (geoBlockedVenues.has(sq.venue)) {
@@ -10510,7 +11567,7 @@ var buildLiveRouteCards = ({
10510
11567
  numericValue: (_e2 = sq.estimatedPayout) != null ? _e2 : sq.filledQty,
10511
11568
  quoteData: soloQuoteData,
10512
11569
  value: getTradingValueLabel({
10513
- amount: (_f = sq.estimatedPayout) != null ? _f : sq.filledQty,
11570
+ amount: (_f2 = sq.estimatedPayout) != null ? _f2 : sq.filledQty,
10514
11571
  minimumFractionDigits: 2,
10515
11572
  maximumFractionDigits: 2
10516
11573
  }),
@@ -10572,7 +11629,44 @@ var buildLiveRouteCards = ({
10572
11629
  }
10573
11630
  ];
10574
11631
  })() : [];
10575
- return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
11632
+ const betdexFundingWarnings = tradeSide === "buy" ? ((_f = quoteData.warnings) != null ? _f : []).filter(
11633
+ (warning) => warning.venue === import_sdk21.Venue.betdex && warning.reason === "hosted_cash_unavailable"
11634
+ ) : [];
11635
+ if (tradeSide === "buy" && betdexFundingRequired && betdexFundingWarnings.length === 0 && quoteData.matchedMarkets.some((market) => market.venue === import_sdk21.Venue.betdex) && !((_g = quoteData.warnings) != null ? _g : []).some((warning) => warning.venue === import_sdk21.Venue.betdex)) {
11636
+ betdexFundingWarnings.push({
11637
+ venue: import_sdk21.Venue.betdex,
11638
+ venueMarketOutcomeId: (_j = (_i = (_h = quoteData.venueSoloQuotes) == null ? void 0 : _h.find((solo) => solo.venue === import_sdk21.Venue.betdex)) == null ? void 0 : _i.venueMarketOutcomeId) != null ? _j : "",
11639
+ reason: "hosted_cash_unavailable"
11640
+ });
11641
+ }
11642
+ const fundingCards = eventVenueSet.has(import_sdk21.Venue.betdex) && !coveredVenueStrings.has(import_sdk21.Venue.betdex) && !geoBlockedVenues.has(import_sdk21.Venue.betdex) ? [
11643
+ ...new Map(
11644
+ betdexFundingWarnings.map((warning) => [warning.venueMarketOutcomeId, warning])
11645
+ ).values()
11646
+ ].map((warning) => ({
11647
+ id: `live-account-betdex-${warning.venueMarketOutcomeId}`,
11648
+ venueMarketOutcomeId: warning.venueMarketOutcomeId,
11649
+ hint: labels.manageBetdexAccount,
11650
+ kind: "venue",
11651
+ label: getTradingVenueLabel(import_sdk21.Venue.betdex),
11652
+ numericValue: 0,
11653
+ quoteData: __spreadProps(__spreadValues({}, quoteData), {
11654
+ quoteId: "",
11655
+ fills: [],
11656
+ totalFilled: 0,
11657
+ rawExecCost: 0,
11658
+ estimatedPayout: void 0,
11659
+ estimatedProfit: void 0,
11660
+ returnPct: void 0,
11661
+ feeBreakdown: void 0,
11662
+ venueSoloQuotes: void 0,
11663
+ status: "insufficient_balance",
11664
+ error: void 0
11665
+ }),
11666
+ value: "",
11667
+ venue: import_sdk21.Venue.betdex
11668
+ })) : [];
11669
+ return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards, ...fundingCards];
10576
11670
  };
10577
11671
  var routeCardRequiresKalshi = (card) => card.venue === "kalshi" || card.quoteData.fills.some((fill) => fill.venue === "kalshi");
10578
11672
  var resolveDefaultRouteCardId = (routeCards, primaryStatus, options) => {
@@ -12043,17 +13137,17 @@ var calculateExecutionProgress = ({
12043
13137
  };
12044
13138
 
12045
13139
  // src/trading/place-order/index.place-order.execution-view.tsx
12046
- var import_react21 = require("react");
12047
- var import_jsx_runtime149 = require("react/jsx-runtime");
13140
+ var import_react24 = require("react");
13141
+ var import_jsx_runtime155 = require("react/jsx-runtime");
12048
13142
  var PlaceOrderExecutionHeader = ({
12049
13143
  className,
12050
13144
  eventDateLabel,
12051
13145
  eventImage,
12052
13146
  eventTitle
12053
13147
  }) => {
12054
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
12055
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center gap-3", children: [
12056
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13148
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: cn("agg-order-execution-header flex flex-col gap-2", className), children: [
13149
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex items-center gap-3", children: [
13150
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12057
13151
  RemoteImage,
12058
13152
  {
12059
13153
  src: eventImage != null ? eventImage : null,
@@ -12061,17 +13155,17 @@ var PlaceOrderExecutionHeader = ({
12061
13155
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
12062
13156
  }
12063
13157
  ),
12064
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: eventTitle })
13158
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: eventTitle })
12065
13159
  ] }),
12066
- eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
13160
+ eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
12067
13161
  ] });
12068
13162
  };
12069
13163
  var PROGRESS_TWEEN_MS = 700;
12070
13164
  var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
12071
13165
  var useTweenedProgress = (target, enabled) => {
12072
- const [value, setValue] = (0, import_react21.useState)(target);
12073
- const valueRef = (0, import_react21.useRef)(target);
12074
- (0, import_react21.useEffect)(() => {
13166
+ const [value, setValue] = (0, import_react24.useState)(target);
13167
+ const valueRef = (0, import_react24.useRef)(target);
13168
+ (0, import_react24.useEffect)(() => {
12075
13169
  const from = valueRef.current;
12076
13170
  if (!enabled || from === target || prefersReducedMotion()) {
12077
13171
  valueRef.current = target;
@@ -12101,12 +13195,12 @@ var ExecutionProgressBar = ({
12101
13195
  const clamped = Math.max(0, Math.min(100, progress));
12102
13196
  const displayed = useTweenedProgress(clamped, enableAnimations);
12103
13197
  const isRunning = clamped < 100;
12104
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex items-center gap-3", children: [
12105
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
13198
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex items-center gap-3", children: [
13199
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
12106
13200
  displayed,
12107
13201
  "%"
12108
13202
  ] }),
12109
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13203
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12110
13204
  "div",
12111
13205
  {
12112
13206
  role: "progressbar",
@@ -12115,7 +13209,7 @@ var ExecutionProgressBar = ({
12115
13209
  "aria-valuemax": 100,
12116
13210
  "aria-valuenow": clamped,
12117
13211
  className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
12118
- children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13212
+ children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12119
13213
  "div",
12120
13214
  {
12121
13215
  className: cn(
@@ -12126,7 +13220,7 @@ var ExecutionProgressBar = ({
12126
13220
  )
12127
13221
  ),
12128
13222
  style: { width: `${clamped}%` },
12129
- children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13223
+ children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12130
13224
  "span",
12131
13225
  {
12132
13226
  "aria-hidden": "true",
@@ -12150,7 +13244,7 @@ var ExecutionStepIndicator = ({
12150
13244
  step
12151
13245
  }) => {
12152
13246
  if (step.status === "done") {
12153
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13247
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12154
13248
  Icon,
12155
13249
  {
12156
13250
  name: "check-circle",
@@ -12161,7 +13255,7 @@ var ExecutionStepIndicator = ({
12161
13255
  );
12162
13256
  }
12163
13257
  if (step.status === "loading") {
12164
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13258
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("span", { className: "inline-flex h-3 w-3 shrink-0 items-center justify-center", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12165
13259
  "span",
12166
13260
  {
12167
13261
  className: cn(
@@ -12172,7 +13266,7 @@ var ExecutionStepIndicator = ({
12172
13266
  ) });
12173
13267
  }
12174
13268
  if (step.status === "failed") {
12175
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13269
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12176
13270
  Icon,
12177
13271
  {
12178
13272
  name: "error-filled",
@@ -12183,7 +13277,7 @@ var ExecutionStepIndicator = ({
12183
13277
  );
12184
13278
  }
12185
13279
  if (step.status === "warning") {
12186
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13280
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12187
13281
  Icon,
12188
13282
  {
12189
13283
  name: "warning-filled",
@@ -12193,7 +13287,7 @@ var ExecutionStepIndicator = ({
12193
13287
  }
12194
13288
  );
12195
13289
  }
12196
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13290
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12197
13291
  "span",
12198
13292
  {
12199
13293
  className: "h-3 w-3 shrink-0 rounded-full border border-dashed border-agg-separator",
@@ -12206,17 +13300,17 @@ var PlaceOrderExecutionGroups = ({
12206
13300
  groups,
12207
13301
  labels
12208
13302
  }) => {
12209
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => {
13303
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("div", { className: "agg-order-execution-groups flex flex-col gap-5", children: groups.map((group) => {
12210
13304
  var _a, _b;
12211
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
13305
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
12212
13306
  "section",
12213
13307
  {
12214
13308
  className: "agg-order-execution-group flex flex-col gap-3",
12215
13309
  "aria-label": (_a = group.title) != null ? _a : labels.venueOrder(group.venueLabel),
12216
13310
  children: [
12217
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
12218
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
12219
- group.venue ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13311
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex min-h-5 items-center justify-between gap-3 text-agg-sm leading-agg-5", children: [
13312
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex min-w-0 items-center gap-2 text-agg-foreground", children: [
13313
+ group.venue ? /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12220
13314
  VenueLogo,
12221
13315
  {
12222
13316
  venue: group.venue,
@@ -12225,22 +13319,22 @@ var PlaceOrderExecutionGroups = ({
12225
13319
  className: "h-3.5 w-3.5 shrink-0"
12226
13320
  }
12227
13321
  ) : null,
12228
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("h3", { className: "truncate font-agg-normal", children: (_b = group.title) != null ? _b : labels.venueOrder(group.venueLabel) })
13322
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("h3", { className: "truncate font-agg-normal", children: (_b = group.title) != null ? _b : labels.venueOrder(group.venueLabel) })
12229
13323
  ] }),
12230
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "flex shrink-0 items-center gap-2", children: [
12231
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
12232
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "text-agg-foreground", children: group.amountLabel })
13324
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex shrink-0 items-center gap-2", children: [
13325
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("span", { className: "text-agg-muted-foreground", children: group.priceLabel }),
13326
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("span", { className: "text-agg-foreground", children: group.amountLabel })
12233
13327
  ] })
12234
13328
  ] }),
12235
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)(
13329
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("div", { className: "flex flex-col gap-3 pl-[22px]", children: group.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(
12236
13330
  "div",
12237
13331
  {
12238
13332
  className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
12239
13333
  "data-kind": step.kind,
12240
13334
  "data-status": step.status,
12241
13335
  children: [
12242
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ExecutionStepIndicator, { enableAnimations, step }),
12243
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
13336
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(ExecutionStepIndicator, { enableAnimations, step }),
13337
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "min-w-0 flex-1", children: step.status === "done" ? step.completedLabel : step.pendingLabel })
12244
13338
  ]
12245
13339
  },
12246
13340
  step.id
@@ -12263,7 +13357,7 @@ var PlaceOrderExecutionView = ({
12263
13357
  progress,
12264
13358
  settlementHint
12265
13359
  }) => {
12266
- return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13360
+ return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12267
13361
  Card,
12268
13362
  {
12269
13363
  className: cn(
@@ -12272,8 +13366,8 @@ var PlaceOrderExecutionView = ({
12272
13366
  classNames == null ? void 0 : classNames.root,
12273
13367
  className
12274
13368
  ),
12275
- children: /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
12276
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13369
+ children: /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: cn("flex flex-col gap-6 p-5", classNames == null ? void 0 : classNames.body), children: [
13370
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12277
13371
  PlaceOrderExecutionHeader,
12278
13372
  {
12279
13373
  className: classNames == null ? void 0 : classNames.header,
@@ -12282,8 +13376,8 @@ var PlaceOrderExecutionView = ({
12282
13376
  eventTitle
12283
13377
  }
12284
13378
  ),
12285
- /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
12286
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13379
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
13380
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12287
13381
  ExecutionProgressBar,
12288
13382
  {
12289
13383
  enableAnimations,
@@ -12291,7 +13385,7 @@ var PlaceOrderExecutionView = ({
12291
13385
  progress
12292
13386
  }
12293
13387
  ),
12294
- /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(
13388
+ /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
12295
13389
  PlaceOrderExecutionGroups,
12296
13390
  {
12297
13391
  enableAnimations,
@@ -12299,7 +13393,7 @@ var PlaceOrderExecutionView = ({
12299
13393
  labels
12300
13394
  }
12301
13395
  ),
12302
- settlementHint ? /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: settlementHint }) : null
13396
+ settlementHint ? /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: settlementHint }) : null
12303
13397
  ] })
12304
13398
  ] })
12305
13399
  }
@@ -12308,7 +13402,7 @@ var PlaceOrderExecutionView = ({
12308
13402
  PlaceOrderExecutionView.displayName = "PlaceOrderExecutionView";
12309
13403
 
12310
13404
  // src/trading/place-order/index.place-order.failure.tsx
12311
- var import_jsx_runtime150 = require("react/jsx-runtime");
13405
+ var import_jsx_runtime156 = require("react/jsx-runtime");
12312
13406
  var resolveFailureActionHandler = ({
12313
13407
  action,
12314
13408
  onDone,
@@ -12321,12 +13415,12 @@ var resolveFailureActionHandler = ({
12321
13415
  };
12322
13416
  var renderPartialFailureStep = (step) => {
12323
13417
  const isWarningStep = step.tone === "warning" || step.tone === "error";
12324
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)(
13418
+ return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(
12325
13419
  "div",
12326
13420
  {
12327
13421
  className: "flex items-center gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
12328
13422
  children: [
12329
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13423
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12330
13424
  Icon,
12331
13425
  {
12332
13426
  name: isWarningStep ? "warning-filled" : "check-circle",
@@ -12335,8 +13429,8 @@ var renderPartialFailureStep = (step) => {
12335
13429
  "aria-hidden": "true"
12336
13430
  }
12337
13431
  ),
12338
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
12339
- step.venue ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
13432
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "min-w-0 flex-1", children: step.label }),
13433
+ step.venue ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(VenueLogo, { venue: step.venue, size: "small", className: "h-4 w-4 shrink-0" }) : null
12340
13434
  ]
12341
13435
  },
12342
13436
  step.id
@@ -12355,10 +13449,10 @@ var PlaceOrderFailureView = ({
12355
13449
  const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
12356
13450
  const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
12357
13451
  if (shouldShowPartialFailureLayout) {
12358
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
12359
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
12360
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
12361
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13452
+ return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
13453
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
13454
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
13455
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12362
13456
  RemoteImage,
12363
13457
  {
12364
13458
  src: (_a = summary.eventImage) != null ? _a : null,
@@ -12366,19 +13460,19 @@ var PlaceOrderFailureView = ({
12366
13460
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
12367
13461
  }
12368
13462
  ),
12369
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
13463
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
12370
13464
  ] }),
12371
- summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
13465
+ summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
12372
13466
  ] }),
12373
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13467
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12374
13468
  PlaceOrderExecutionGroups,
12375
13469
  {
12376
13470
  enableAnimations: false,
12377
13471
  groups: summary.executionGroups,
12378
13472
  labels: tradingLabels
12379
13473
  }
12380
- ) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
12381
- summary.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13474
+ ) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
13475
+ summary.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12382
13476
  InlineAlert,
12383
13477
  {
12384
13478
  tone: "error",
@@ -12386,20 +13480,20 @@ var PlaceOrderFailureView = ({
12386
13480
  message: tradingLabels.orderFailureDescription(summary.errorMessage)
12387
13481
  }
12388
13482
  ) : null,
12389
- summary.result ? /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex flex-col gap-4", children: [
12390
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
12391
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
12392
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
12393
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
13483
+ summary.result ? /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "flex flex-col gap-4", children: [
13484
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13485
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
13486
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
13487
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
12394
13488
  ] }),
12395
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
13489
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
12396
13490
  ] }),
12397
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
12398
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
12399
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
13491
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13492
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
13493
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
12400
13494
  ] })
12401
13495
  ] }) : null,
12402
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13496
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12403
13497
  Button,
12404
13498
  {
12405
13499
  variant: action.variant === "retry" ? "primary" : "secondary",
@@ -12413,10 +13507,10 @@ var PlaceOrderFailureView = ({
12413
13507
  )) })
12414
13508
  ] }) });
12415
13509
  }
12416
- return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
12417
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
12418
- /* @__PURE__ */ (0, import_jsx_runtime150.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
12419
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13510
+ return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(Card, { className: cn("group/agg-order-panel", getPlaceOrderContainerClassName(), className), children: /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-body flex flex-col gap-6 p-5", children: [
13511
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-header flex flex-col gap-2", children: [
13512
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)("div", { className: "agg-order-failure-market flex items-center gap-3", children: [
13513
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12420
13514
  RemoteImage,
12421
13515
  {
12422
13516
  src: (_c = summary.eventImage) != null ? _c : null,
@@ -12424,11 +13518,11 @@ var PlaceOrderFailureView = ({
12424
13518
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
12425
13519
  }
12426
13520
  ),
12427
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
13521
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: summary.eventTitle })
12428
13522
  ] }),
12429
- summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
13523
+ summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
12430
13524
  ] }),
12431
- ((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13525
+ ((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12432
13526
  PlaceOrderExecutionGroups,
12433
13527
  {
12434
13528
  enableAnimations: false,
@@ -12436,7 +13530,7 @@ var PlaceOrderFailureView = ({
12436
13530
  labels: tradingLabels
12437
13531
  }
12438
13532
  ) : null,
12439
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13533
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12440
13534
  InlineAlert,
12441
13535
  {
12442
13536
  tone: "error",
@@ -12445,7 +13539,7 @@ var PlaceOrderFailureView = ({
12445
13539
  message: tradingLabels.orderFailureDescription((_e = summary.errorMessage) != null ? _e : "")
12446
13540
  }
12447
13541
  ),
12448
- /* @__PURE__ */ (0, import_jsx_runtime150.jsx)("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(
13542
+ /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
12449
13543
  Button,
12450
13544
  {
12451
13545
  variant: action.variant === "retry" ? "primary" : "secondary",
@@ -12462,7 +13556,7 @@ var PlaceOrderFailureView = ({
12462
13556
  PlaceOrderFailureView.displayName = "PlaceOrderFailureView";
12463
13557
 
12464
13558
  // src/trading/place-order/index.place-order.success.tsx
12465
- var import_jsx_runtime151 = require("react/jsx-runtime");
13559
+ var import_jsx_runtime157 = require("react/jsx-runtime");
12466
13560
  var resolveBuyPayoutLabel = (shares) => {
12467
13561
  if (!shares) return "$0";
12468
13562
  return shares.startsWith("$") ? shares : `$${shares}`;
@@ -12483,7 +13577,7 @@ var PlaceOrderSuccessView = ({
12483
13577
  const amountTitle = isLimitOrder ? tradingLabels.orderAmount : summary.resultState === "partial" ? tradingLabels.orderPartiallyFilled : tradingLabels.orderFullyFilled;
12484
13578
  const amountSubtitle = isLimitOrder ? tradingLabels.orderLimitPrice((_d = summary.limitPriceLabel) != null ? _d : summary.avgPrice) : tradingLabels.orderAveragePrice(summary.avgPrice);
12485
13579
  const legacyExecutionSteps = ((_e = summary.executionStepGroups) != null ? _e : []).flat();
12486
- return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
13580
+ return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
12487
13581
  Card,
12488
13582
  {
12489
13583
  className: cn(
@@ -12492,8 +13586,8 @@ var PlaceOrderSuccessView = ({
12492
13586
  "border-0 ring-1 ring-inset ring-agg-separator",
12493
13587
  className
12494
13588
  ),
12495
- children: /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
12496
- summary.eventTitle ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
13589
+ children: /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "agg-order-success-body flex flex-col gap-6 p-5", children: [
13590
+ summary.eventTitle ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
12497
13591
  PlaceOrderExecutionHeader,
12498
13592
  {
12499
13593
  eventDateLabel: summary.eventDateLabel,
@@ -12501,19 +13595,19 @@ var PlaceOrderSuccessView = ({
12501
13595
  eventTitle: summary.eventTitle
12502
13596
  }
12503
13597
  ) : null,
12504
- ((_f = summary.executionGroups) == null ? void 0 : _f.length) ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
13598
+ ((_f = summary.executionGroups) == null ? void 0 : _f.length) ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
12505
13599
  PlaceOrderExecutionGroups,
12506
13600
  {
12507
13601
  enableAnimations: false,
12508
13602
  groups: summary.executionGroups,
12509
13603
  labels: tradingLabels
12510
13604
  }
12511
- ) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
13605
+ ) : legacyExecutionSteps.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("div", { className: "flex flex-col gap-3 pl-[22px]", children: legacyExecutionSteps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)(
12512
13606
  "div",
12513
13607
  {
12514
13608
  className: "flex items-start gap-2 text-agg-xs leading-agg-4 text-agg-foreground",
12515
13609
  children: [
12516
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
13610
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
12517
13611
  Icon,
12518
13612
  {
12519
13613
  name: step.tone === "warning" || step.tone === "error" ? "warning-filled" : "check-circle",
@@ -12525,28 +13619,28 @@ var PlaceOrderSuccessView = ({
12525
13619
  "aria-hidden": "true"
12526
13620
  }
12527
13621
  ),
12528
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "min-w-0 flex-1", children: step.label })
13622
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "min-w-0 flex-1", children: step.label })
12529
13623
  ]
12530
13624
  },
12531
13625
  step.id
12532
13626
  )) }) : null,
12533
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
12534
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
12535
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
12536
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: amountTitle }),
12537
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: amountSubtitle })
13627
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
13628
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13629
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
13630
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: amountTitle }),
13631
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: amountSubtitle })
12538
13632
  ] }),
12539
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
13633
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
12540
13634
  ] }),
12541
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
12542
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
12543
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
12544
- potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
13635
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13636
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
13637
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
13638
+ potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
12545
13639
  ] }),
12546
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
13640
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
12547
13641
  ] })
12548
13642
  ] }),
12549
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
13643
+ /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
12550
13644
  Button,
12551
13645
  {
12552
13646
  variant: "secondary",
@@ -12564,7 +13658,7 @@ var PlaceOrderSuccessView = ({
12564
13658
  PlaceOrderSuccessView.displayName = "PlaceOrderSuccessView";
12565
13659
 
12566
13660
  // src/trading/place-order/index.tsx
12567
- var import_jsx_runtime152 = require("react/jsx-runtime");
13661
+ var import_jsx_runtime158 = require("react/jsx-runtime");
12568
13662
  var SELL_SHARE_INPUT_DECIMALS = 6;
12569
13663
  var SELL_SHARE_DISPLAY_DECIMALS = 2;
12570
13664
  var resolvePlaceOrderPortalContainer = (triggerElement) => {
@@ -12582,11 +13676,11 @@ var ceilDiv = (numerator, denominator) => {
12582
13676
  };
12583
13677
  var toRaw6 = (value) => {
12584
13678
  const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
12585
- return Math.ceil(normalizedValue * Number(import_sdk21.LIMIT_PRICE_RAW_SCALE)).toString();
13679
+ return Math.ceil(normalizedValue * Number(import_sdk22.LIMIT_PRICE_RAW_SCALE)).toString();
12586
13680
  };
12587
13681
  var toLimitPriceRaw = (value) => {
12588
13682
  const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
12589
- return Math.round(clampedValue * Number(import_sdk21.LIMIT_PRICE_RAW_SCALE)).toString();
13683
+ return Math.round(clampedValue * Number(import_sdk22.LIMIT_PRICE_RAW_SCALE)).toString();
12590
13684
  };
12591
13685
  var toLimitSizeRaw = ({
12592
13686
  amount: amount2,
@@ -12596,7 +13690,7 @@ var toLimitSizeRaw = ({
12596
13690
  if (side === "sell") return toRaw6(amount2);
12597
13691
  const spendRaw = BigInt(toRaw6(amount2));
12598
13692
  const priceRaw = BigInt(limitPriceRaw);
12599
- return ceilDiv(spendRaw * import_sdk21.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
13693
+ return ceilDiv(spendRaw * import_sdk22.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
12600
13694
  };
12601
13695
  var formatLimitPriceLabel = (value) => {
12602
13696
  return `${(value * 100).toLocaleString("en-US", {
@@ -12605,7 +13699,7 @@ var formatLimitPriceLabel = (value) => {
12605
13699
  })}\xA2`;
12606
13700
  };
12607
13701
  var formatLimitPriceRawLabel = (value) => {
12608
- return formatLimitPriceLabel(Number(BigInt(value)) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE));
13702
+ return formatLimitPriceLabel(Number(BigInt(value)) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE));
12609
13703
  };
12610
13704
  var LIMIT_ORDER_SUBMITTING_PROGRESS = 10;
12611
13705
  var buildLimitOrderExecutionGroup = ({
@@ -12640,10 +13734,10 @@ var getLimitOrderToWinValue = ({
12640
13734
  side
12641
13735
  }) => {
12642
13736
  const priceRaw = BigInt(limitPriceRaw);
12643
- if (priceRaw <= BigInt(0) || priceRaw >= import_sdk21.LIMIT_PRICE_RAW_SCALE) return 0;
13737
+ if (priceRaw <= BigInt(0) || priceRaw >= import_sdk22.LIMIT_PRICE_RAW_SCALE) return 0;
12644
13738
  const sizeRaw = BigInt(toLimitSizeRaw({ amount: amount2, limitPriceRaw, side }));
12645
- if (side === "buy") return Number(sizeRaw) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE);
12646
- return Number(ceilDiv(priceRaw * sizeRaw, import_sdk21.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE);
13739
+ if (side === "buy") return Number(sizeRaw) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE);
13740
+ return Number(ceilDiv(priceRaw * sizeRaw, import_sdk22.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE);
12647
13741
  };
12648
13742
  var normalizeLimitPrice = (value) => {
12649
13743
  if (!Number.isFinite(value)) return LIMIT_PRICE_MIN;
@@ -12709,25 +13803,25 @@ var PlaceOrderSlippageControl = ({
12709
13803
  minimumValue: slippageMinimumValue
12710
13804
  }) => {
12711
13805
  var _a, _b;
12712
- const labels = (0, import_hooks46.useLabels)();
12713
- const containerRef = (0, import_react23.useRef)(null);
12714
- const triggerRef = (0, import_react23.useRef)(null);
12715
- const inputRef = (0, import_react23.useRef)(null);
12716
- const warningId = (0, import_react23.useId)();
13806
+ const labels = (0, import_hooks51.useLabels)();
13807
+ const containerRef = (0, import_react26.useRef)(null);
13808
+ const triggerRef = (0, import_react26.useRef)(null);
13809
+ const inputRef = (0, import_react26.useRef)(null);
13810
+ const warningId = (0, import_react26.useId)();
12717
13811
  const defaultValue = finalizePercentageValue(slippageDefaultValue);
12718
13812
  const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
12719
- const [draftValue, setDraftValue] = (0, import_react23.useState)(committedValue);
12720
- const [isEditing, setIsEditing] = (0, import_react23.useState)(
13813
+ const [draftValue, setDraftValue] = (0, import_react26.useState)(committedValue);
13814
+ const [isEditing, setIsEditing] = (0, import_react26.useState)(
12721
13815
  () => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
12722
13816
  );
12723
- const [shouldFocusInput, setShouldFocusInput] = (0, import_react23.useState)(false);
12724
- (0, import_react23.useEffect)(() => {
13817
+ const [shouldFocusInput, setShouldFocusInput] = (0, import_react26.useState)(false);
13818
+ (0, import_react26.useEffect)(() => {
12725
13819
  setDraftValue(committedValue);
12726
13820
  if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
12727
13821
  setIsEditing(true);
12728
13822
  }
12729
13823
  }, [committedValue, slippageMinimumValue]);
12730
- (0, import_react23.useEffect)(() => {
13824
+ (0, import_react26.useEffect)(() => {
12731
13825
  if (!shouldFocusInput) return;
12732
13826
  requestAnimationFrame(() => {
12733
13827
  var _a2, _b2;
@@ -12744,7 +13838,7 @@ var PlaceOrderSlippageControl = ({
12744
13838
  Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
12745
13839
  );
12746
13840
  const resolvedAutoLabel = labels.trading.resetSlippage;
12747
- const resolvedWarningMessage = (0, import_react23.useMemo)(() => {
13841
+ const resolvedWarningMessage = (0, import_react26.useMemo)(() => {
12748
13842
  if (isLowSlippage) {
12749
13843
  return labels.trading.slippageLow(slippageMinimumValue);
12750
13844
  }
@@ -12807,8 +13901,8 @@ var PlaceOrderSlippageControl = ({
12807
13901
  if (!isEditing) return;
12808
13902
  handleCommitDraft(false);
12809
13903
  };
12810
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
12811
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
13904
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { ref: containerRef, className: "agg-slippage-control w-full", onBlur: handleContainerBlur, children: [
13905
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
12812
13906
  "button",
12813
13907
  {
12814
13908
  ref: triggerRef,
@@ -12826,8 +13920,8 @@ var PlaceOrderSlippageControl = ({
12826
13920
  ),
12827
13921
  onClick: handleToggleEditing,
12828
13922
  children: [
12829
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "agg-slippage-label", children: collapsedLabel }),
12830
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13923
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "agg-slippage-label", children: collapsedLabel }),
13924
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12831
13925
  Icon,
12832
13926
  {
12833
13927
  name: isEditing ? "chevron-up" : "pencil",
@@ -12839,7 +13933,7 @@ var PlaceOrderSlippageControl = ({
12839
13933
  ]
12840
13934
  }
12841
13935
  ),
12842
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13936
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12843
13937
  "div",
12844
13938
  {
12845
13939
  "aria-hidden": !isEditing,
@@ -12853,10 +13947,10 @@ var PlaceOrderSlippageControl = ({
12853
13947
  "transition-[grid-template-rows,opacity,margin-top] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]"
12854
13948
  )
12855
13949
  ),
12856
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
12857
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
12858
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
12859
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13950
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-slippage-editor-body flex flex-col gap-2", children: [
13951
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-slippage-input-row flex h-9 overflow-hidden rounded-agg-sm border border-agg-separator", children: [
13952
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-slippage-input-group flex min-w-0 flex-1 items-center gap-2 bg-agg-secondary px-3", children: [
13953
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12860
13954
  "input",
12861
13955
  {
12862
13956
  ref: inputRef,
@@ -12871,7 +13965,7 @@ var PlaceOrderSlippageControl = ({
12871
13965
  onKeyDown: handleInputKeyDown
12872
13966
  }
12873
13967
  ),
12874
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13968
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12875
13969
  "button",
12876
13970
  {
12877
13971
  type: "button",
@@ -12889,8 +13983,8 @@ var PlaceOrderSlippageControl = ({
12889
13983
  }
12890
13984
  )
12891
13985
  ] }),
12892
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
12893
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13986
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "h-full w-px bg-agg-separator", "aria-hidden": "true" }),
13987
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12894
13988
  "div",
12895
13989
  {
12896
13990
  className: "agg-slippage-suffix flex w-9 items-center justify-center bg-agg-secondary-hover text-agg-sm leading-agg-5 text-agg-muted-foreground",
@@ -12899,7 +13993,7 @@ var PlaceOrderSlippageControl = ({
12899
13993
  }
12900
13994
  )
12901
13995
  ] }),
12902
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
13996
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12903
13997
  "div",
12904
13998
  {
12905
13999
  "aria-hidden": !resolvedWarningMessage,
@@ -12913,13 +14007,13 @@ var PlaceOrderSlippageControl = ({
12913
14007
  "transition-[grid-template-rows,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]"
12914
14008
  )
12915
14009
  ),
12916
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
14010
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
12917
14011
  "div",
12918
14012
  {
12919
14013
  id: warningId,
12920
14014
  className: "agg-slippage-warning-message flex items-start gap-2 text-agg-sm leading-agg-5 text-agg-foreground",
12921
14015
  children: [
12922
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14016
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12923
14017
  Icon,
12924
14018
  {
12925
14019
  name: "warning-filled",
@@ -12928,7 +14022,7 @@ var PlaceOrderSlippageControl = ({
12928
14022
  color: "currentColor"
12929
14023
  }
12930
14024
  ),
12931
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
14025
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { children: resolvedWarningMessage != null ? resolvedWarningMessage : "" })
12932
14026
  ]
12933
14027
  }
12934
14028
  ) })
@@ -12949,30 +14043,30 @@ var renderCardHeader = ({
12949
14043
  onClose
12950
14044
  }) => {
12951
14045
  if (!headerTitle) return null;
12952
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
12953
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
12954
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14046
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: cn("agg-order-panel-header flex flex-col gap-2", className), children: [
14047
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-market-summary flex items-center gap-3", children: [
14048
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12955
14049
  RemoteImage,
12956
14050
  {
12957
14051
  src: headerImage,
12958
14052
  alt: "",
12959
- fallback: headerVenue ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VenueLogo, { venue: headerVenue, size: "large" }) : void 0,
14053
+ fallback: headerVenue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(VenueLogo, { venue: headerVenue, size: "large" }) : void 0,
12960
14054
  className: "agg-order-market-image h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
12961
14055
  }
12962
14056
  ),
12963
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-order-market-title min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: headerTitle }),
12964
- onClose ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14057
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-market-title min-w-0 flex-1 text-agg-base font-agg-bold leading-agg-6 text-agg-foreground line-clamp-2", children: headerTitle }),
14058
+ onClose ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12965
14059
  "button",
12966
14060
  {
12967
14061
  type: "button",
12968
14062
  className: "agg-order-close -mr-1 -mt-1 hidden shrink-0 cursor-pointer items-center justify-center p-1 text-agg-muted-foreground hover:text-agg-foreground sm:flex",
12969
14063
  "aria-label": "Close",
12970
14064
  onClick: onClose,
12971
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(CloseIcon, { className: "h-5 w-5" })
14065
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(CloseIcon, { className: "h-5 w-5" })
12972
14066
  }
12973
14067
  ) : null
12974
14068
  ] }),
12975
- headerSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
14069
+ headerSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-market-subtitle text-agg-base leading-agg-6 text-agg-foreground", children: headerSubtitle }) : null
12976
14070
  ] });
12977
14071
  };
12978
14072
  var PlaceOrderResolvedView = ({
@@ -12985,7 +14079,7 @@ var PlaceOrderResolvedView = ({
12985
14079
  showResolvingState = false
12986
14080
  }) => {
12987
14081
  var _a, _b;
12988
- const labels = (0, import_hooks46.useLabels)();
14082
+ const labels = (0, import_hooks51.useLabels)();
12989
14083
  const tradingLabels = labels.trading;
12990
14084
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
12991
14085
  const isResolvingMarket = showResolvingState && !tradingState.winningOutcome;
@@ -12994,7 +14088,7 @@ var PlaceOrderResolvedView = ({
12994
14088
  return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
12995
14089
  })() : "";
12996
14090
  if (isResolvingMarket) {
12997
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14091
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
12998
14092
  Card,
12999
14093
  {
13000
14094
  className: cn(
@@ -13005,7 +14099,7 @@ var PlaceOrderResolvedView = ({
13005
14099
  ),
13006
14100
  role: "status",
13007
14101
  "aria-label": labels.marketDetails.resolvingTitle,
13008
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
14102
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
13009
14103
  "div",
13010
14104
  {
13011
14105
  className: cn(
@@ -13013,12 +14107,12 @@ var PlaceOrderResolvedView = ({
13013
14107
  classNames == null ? void 0 : classNames.body
13014
14108
  ),
13015
14109
  children: [
13016
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(LoadingIcon, { variant: "prominent" }) }),
13017
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
13018
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
13019
- resolvingSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
14110
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(LoadingIcon, { variant: "prominent" }) }),
14111
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-1", classNames == null ? void 0 : classNames.content), children: [
14112
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "body-large-strong", children: labels.marketDetails.resolvingTitle }),
14113
+ resolvingSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "body", className: "text-center", children: resolvingSubtitle }) : null
13020
14114
  ] }),
13021
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14115
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13022
14116
  Typography,
13023
14117
  {
13024
14118
  variant: "label",
@@ -13032,7 +14126,7 @@ var PlaceOrderResolvedView = ({
13032
14126
  }
13033
14127
  );
13034
14128
  }
13035
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14129
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13036
14130
  Card,
13037
14131
  {
13038
14132
  className: cn(
@@ -13041,19 +14135,19 @@ var PlaceOrderResolvedView = ({
13041
14135
  classNames == null ? void 0 : classNames.root,
13042
14136
  className
13043
14137
  ),
13044
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
13045
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col items-center gap-6 p-8", children: [
13046
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14138
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: cn("agg-order-panel-body flex flex-col", classNames == null ? void 0 : classNames.body), children: [
14139
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex flex-col items-center gap-6 p-8", children: [
14140
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13047
14141
  "div",
13048
14142
  {
13049
14143
  className: cn(
13050
14144
  "flex h-15 w-15 items-center justify-center rounded-full",
13051
14145
  "bg-agg-primary/15"
13052
14146
  ),
13053
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
14147
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "success-check", className: cn("h-6 w-6", "text-agg-primary") })
13054
14148
  }
13055
14149
  ),
13056
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
14150
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
13057
14151
  "div",
13058
14152
  {
13059
14153
  className: cn(
@@ -13061,8 +14155,8 @@ var PlaceOrderResolvedView = ({
13061
14155
  classNames == null ? void 0 : classNames.content
13062
14156
  ),
13063
14157
  children: [
13064
- tradingState.market ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
13065
- tradingState.winningOutcome ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
14158
+ tradingState.market ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
14159
+ tradingState.winningOutcome ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
13066
14160
  shouldUseRawResolvedPlaceOrderOutcomeLabel(
13067
14161
  tradingState.market,
13068
14162
  tradingState.winningOutcome
@@ -13076,25 +14170,25 @@ var PlaceOrderResolvedView = ({
13076
14170
  }
13077
14171
  )
13078
14172
  ] }),
13079
- resolvedClaim ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
13080
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
13081
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex w-full flex-col gap-5 p-6", children: [
13082
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
13083
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
13084
- resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13085
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: tradingLabels.resolvedResolutionDateLabel }),
13086
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
14173
+ resolvedClaim ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
14174
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "h-px w-full bg-agg-separator" }),
14175
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex w-full flex-col gap-5 p-6", children: [
14176
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "body-strong", className: "text-center", children: tradingLabels.resolvedEarningsTitle }),
14177
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex flex-col gap-3 text-agg-sm leading-agg-5 text-agg-foreground", children: [
14178
+ resolvedClaim.resolutionDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
14179
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.resolvedResolutionDateLabel }),
14180
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.resolutionDateLabel })
13087
14181
  ] }) : null,
13088
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13089
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: tradingLabels.resolvedSharesLabel }),
13090
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
14182
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
14183
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.resolvedSharesLabel }),
14184
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.sharesLabel })
13091
14185
  ] }),
13092
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
13093
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
13094
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
14186
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
14187
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.resolvedTotalPayoutLabel }),
14188
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "font-agg-bold", children: resolvedClaim.totalPayoutLabel })
13095
14189
  ] })
13096
14190
  ] }),
13097
- resolvedClaim.onClaim ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14191
+ resolvedClaim.onClaim ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13098
14192
  Button,
13099
14193
  {
13100
14194
  size: "large",
@@ -13116,21 +14210,21 @@ var renderRouteBreakdownRow = (row, sharedKycStatus, tradingLabels) => {
13116
14210
  const venueLabel = getTradingVenueLabel(row.venue);
13117
14211
  const rowKey = `${row.venue}-${row.label}-${row.priceLabel}-${(_a = row.resultLabel) != null ? _a : ""}`;
13118
14212
  const showSharedKycRequirement = row.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified";
13119
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
14213
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
13120
14214
  "div",
13121
14215
  {
13122
14216
  className: "agg-route-breakdown-row flex items-center justify-between gap-4 text-left",
13123
14217
  children: [
13124
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
13125
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
13126
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
13127
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label }),
13128
- showSharedKycRequirement ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.sharedKyc.required }) : null
14218
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-breakdown-market flex min-w-0 items-center gap-2", children: [
14219
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(VenueLogo, { venue: row.venue, className: "size-3!", ariaLabel: venueLabel }),
14220
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
14221
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-breakdown-label truncate text-agg-sm leading-agg-5 text-agg-foreground", children: row.label }),
14222
+ showSharedKycRequirement ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.sharedKyc.required }) : null
13129
14223
  ] })
13130
14224
  ] }),
13131
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
13132
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
13133
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
14225
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-breakdown-value flex shrink-0 items-center gap-2 text-agg-sm leading-agg-5", children: [
14226
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-muted-foreground", children: row.priceLabel }),
14227
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-foreground", children: (_b = row.resultLabel) != null ? _b : "" })
13134
14228
  ] })
13135
14229
  ]
13136
14230
  },
@@ -13163,7 +14257,7 @@ var renderRouteCard = ({
13163
14257
  const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
13164
14258
  const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
13165
14259
  const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
13166
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14260
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13167
14261
  "button",
13168
14262
  {
13169
14263
  type: "button",
@@ -13182,10 +14276,10 @@ var renderRouteCard = ({
13182
14276
  isSelected && !card.isUnavailable ? "border border-agg-trade-highlight-border bg-linear-to-b from-agg-trade-highlight-surface-from to-agg-trade-highlight-surface-to" : "border-transparent bg-agg-secondary-hover"
13183
14277
  ),
13184
14278
  onClick: () => onSelect(card.id),
13185
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
13186
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
13187
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
13188
- card.kind === "split" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14279
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-card-content relative z-10 flex flex-col gap-3", children: [
14280
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-card-header flex items-center justify-between gap-4", children: [
14281
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-card-meta flex min-w-0 gap-3 items-center", children: [
14282
+ card.kind === "split" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13189
14283
  Icon,
13190
14284
  {
13191
14285
  name: "sparkles-filled",
@@ -13196,7 +14290,7 @@ var renderRouteCard = ({
13196
14290
  ),
13197
14291
  "aria-hidden": "true"
13198
14292
  }
13199
- ) : card.venue ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14293
+ ) : card.venue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13200
14294
  VenueLogo,
13201
14295
  {
13202
14296
  venue: card.venue,
@@ -13204,10 +14298,10 @@ var renderRouteCard = ({
13204
14298
  ariaLabel: getTradingVenueLabel(card.venue)
13205
14299
  }
13206
14300
  ) : null,
13207
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-1 min-w-0", children: [
13208
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-1.5", children: [
13209
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
13210
- card.isUnavailable ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14301
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex flex-col gap-1 min-w-0", children: [
14302
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
14303
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-card-title truncate text-agg-sm leading-agg-5 text-agg-foreground", children: card.label }),
14304
+ card.isUnavailable ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13211
14305
  Icon,
13212
14306
  {
13213
14307
  name: "lock",
@@ -13215,7 +14309,7 @@ var renderRouteCard = ({
13215
14309
  className: "shrink-0 text-agg-muted-foreground",
13216
14310
  "aria-hidden": "true"
13217
14311
  }
13218
- ) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14312
+ ) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13219
14313
  Icon,
13220
14314
  {
13221
14315
  name: "warning",
@@ -13223,7 +14317,7 @@ var renderRouteCard = ({
13223
14317
  className: "shrink-0 text-agg-muted-foreground",
13224
14318
  "aria-hidden": "true"
13225
14319
  }
13226
- ) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14320
+ ) : card.kind === "split" && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13227
14321
  Icon,
13228
14322
  {
13229
14323
  name: showSplitDetails ? "chevron-up" : "chevron-down",
@@ -13233,10 +14327,10 @@ var renderRouteCard = ({
13233
14327
  }
13234
14328
  ) : null
13235
14329
  ] }),
13236
- card.hint ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: displayedHint }) : null
14330
+ card.hint ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-card-hint text-agg-xs leading-agg-4 text-agg-muted-foreground", children: displayedHint }) : null
13237
14331
  ] })
13238
14332
  ] }),
13239
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
14333
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
13240
14334
  "p",
13241
14335
  {
13242
14336
  className: cn(
@@ -13248,9 +14342,9 @@ var renderRouteCard = ({
13248
14342
  }
13249
14343
  )
13250
14344
  ] }),
13251
- showSplitDetails ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
13252
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
13253
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map(
14345
+ showSplitDetails ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
14346
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-card-description text-agg-xs leading-agg-4 text-agg-foreground", children: (_b = card.description) != null ? _b : tradingLabels.splitOrderDescription }),
14347
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-breakdown flex flex-col gap-3", children: (_c = card.rows) == null ? void 0 : _c.map(
13254
14348
  (row) => renderRouteBreakdownRow(row, sharedKycStatus, tradingLabels)
13255
14349
  ) })
13256
14350
  ] }) : null
@@ -13283,25 +14377,25 @@ var PlaceOrder = ({
13283
14377
  showResolvingState = false,
13284
14378
  midpointsResult
13285
14379
  }) => {
13286
- 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, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia;
14380
+ 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, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja;
13287
14381
  const {
13288
14382
  enableDebug: isExecutionDebugEnabled,
13289
14383
  features: { enableAnimations, showFeesBreakdown, showLimitOrders: limitOrdersFeature },
13290
14384
  formatting: { formatPrice },
13291
14385
  general: { locale }
13292
- } = (0, import_hooks46.useSdkUiConfig)();
13293
- const labels = (0, import_hooks46.useLabels)();
14386
+ } = (0, import_hooks51.useSdkUiConfig)();
14387
+ const labels = (0, import_hooks51.useLabels)();
13294
14388
  const tradingLabels = labels.trading;
13295
14389
  const toastCtx = useOptionalToast();
13296
- const { isTradingBlocked } = (0, import_hooks46.useGeoBlock)();
13297
- const tradingContext = (0, import_hooks46.useEventTradingContext)();
14390
+ const { isTradingBlocked } = (0, import_hooks51.useGeoBlock)();
14391
+ const tradingContext = (0, import_hooks51.useEventTradingContext)();
13298
14392
  const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
13299
14393
  const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
13300
14394
  const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
13301
- const resolvedEventTradingState = (0, import_react23.useMemo)(() => {
13302
- return eventTradingState != null ? eventTradingState : (0, import_hooks46.resolveEventTradingState)(selectedEvent);
14395
+ const resolvedEventTradingState = (0, import_react26.useMemo)(() => {
14396
+ return eventTradingState != null ? eventTradingState : (0, import_hooks51.resolveEventTradingState)(selectedEvent);
13303
14397
  }, [eventTradingState, selectedEvent]);
13304
- const scopedSelectedEvent = (0, import_react23.useMemo)(() => {
14398
+ const scopedSelectedEvent = (0, import_react26.useMemo)(() => {
13305
14399
  var _a2;
13306
14400
  if (!selectedEvent) return null;
13307
14401
  const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
@@ -13311,7 +14405,7 @@ var PlaceOrder = ({
13311
14405
  );
13312
14406
  return isSelectedEventInScope ? selectedEvent : null;
13313
14407
  }, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
13314
- const scopedSelectedMarket = (0, import_react23.useMemo)(() => {
14408
+ const scopedSelectedMarket = (0, import_react26.useMemo)(() => {
13315
14409
  if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
13316
14410
  const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
13317
14411
  (item) => item.market.id === selectedMarket.id
@@ -13326,10 +14420,10 @@ var PlaceOrder = ({
13326
14420
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
13327
14421
  )) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
13328
14422
  const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
13329
- const resolvedTradingState = (0, import_react23.useMemo)(() => {
13330
- return (0, import_hooks46.resolveMarketTradingState)(scopedSelectedMarket);
14423
+ const resolvedTradingState = (0, import_react26.useMemo)(() => {
14424
+ return (0, import_hooks51.resolveMarketTradingState)(scopedSelectedMarket);
13331
14425
  }, [scopedSelectedMarket]);
13332
- const resolvedReadOnlyMarket = (0, import_react23.useMemo)(() => {
14426
+ const resolvedReadOnlyMarket = (0, import_react26.useMemo)(() => {
13333
14427
  var _a2;
13334
14428
  if (resolvedEventTradingState.kind !== "resolved") {
13335
14429
  return scopedSelectedMarket;
@@ -13340,12 +14434,12 @@ var PlaceOrder = ({
13340
14434
  resolvedEventTradingState.primaryMarket,
13341
14435
  scopedSelectedMarket
13342
14436
  ]);
13343
- const resolvedReadOnlyTradingState = (0, import_react23.useMemo)(() => {
13344
- return (0, import_hooks46.resolveMarketTradingState)(resolvedReadOnlyMarket);
14437
+ const resolvedReadOnlyTradingState = (0, import_react26.useMemo)(() => {
14438
+ return (0, import_hooks51.resolveMarketTradingState)(resolvedReadOnlyMarket);
13345
14439
  }, [resolvedReadOnlyMarket]);
13346
14440
  const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
13347
- const orderEligibility = (0, import_react23.useMemo)(
13348
- () => (0, import_hooks46.resolveOrderEligibility)({
14441
+ const orderEligibility = (0, import_react26.useMemo)(
14442
+ () => (0, import_hooks51.resolveOrderEligibility)({
13349
14443
  event: scopedSelectedEvent,
13350
14444
  market: scopedSelectedMarket,
13351
14445
  outcome: scopedSelectedOutcome,
@@ -13354,20 +14448,20 @@ var PlaceOrder = ({
13354
14448
  [scopedSelectedEvent, scopedSelectedMarket, scopedSelectedOutcome, resolvedEventTradingState]
13355
14449
  );
13356
14450
  const isResolvedOutcomeCtaLocked = resolvedEventTradingState.kind === "resolved" || resolvedTradingState.kind === "resolved";
13357
- const { isAuthenticated, user } = (0, import_hooks46.useAggAuthContext)();
14451
+ const { isAuthenticated, user } = (0, import_hooks51.useAggAuthContext)();
13358
14452
  const sharedKycFlow = useSharedKycFlow({
13359
14453
  integration: sharedKyc,
13360
14454
  userId: isAuthenticated ? user == null ? void 0 : user.id : null,
13361
14455
  fallbackErrorMessage: tradingLabels.sharedKyc.modal.error
13362
14456
  });
13363
- const { executionMode: resolvedExecutionMode, isPaperMode } = (0, import_hooks46.useResolvedExecutionMode)(executionMode);
14457
+ const { executionMode: resolvedExecutionMode, isPaperMode } = (0, import_hooks51.useResolvedExecutionMode)(executionMode);
13364
14458
  const showLimitOrders = limitOrdersFeature && !isPaperMode;
13365
- const liveBalanceState = (0, import_hooks46.useAggBalanceState)();
13366
- const paperBalancesQuery = (0, import_hooks46.useManagedBalances)({
14459
+ const liveBalanceState = (0, import_hooks51.useAggBalanceState)();
14460
+ const paperBalancesQuery = (0, import_hooks51.useManagedBalances)({
13367
14461
  enabled: Boolean(isAuthenticated && isPaperMode),
13368
14462
  mode: "paper"
13369
14463
  });
13370
- const paperTotalBalance = (0, import_react23.useMemo)(() => {
14464
+ const paperTotalBalance = (0, import_react26.useMemo)(() => {
13371
14465
  var _a2, _b2;
13372
14466
  const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
13373
14467
  return cash.reduce((sum, token) => {
@@ -13381,75 +14475,75 @@ var PlaceOrder = ({
13381
14475
  }, 0);
13382
14476
  }, [paperBalancesQuery.balances]);
13383
14477
  const liveAvailableBalance = (_i = liveBalanceState.availableBalance) != null ? _i : liveBalanceState.totalBalance;
13384
- const executeManaged = (0, import_hooks46.useExecuteManaged)();
13385
- const placeLimitOrder = (0, import_hooks46.usePlaceLimitOrder)();
13386
- const aggClient = (0, import_hooks46.useAggClient)();
13387
- const queryClient = (0, import_hooks46.useQueryClient)();
13388
- const { disabledVenues, isLoading: isAppConfigLoading, prophetxExecutionMode } = (0, import_hooks46.useAppConfig)();
14478
+ const executeManaged = (0, import_hooks51.useExecuteManaged)();
14479
+ const placeLimitOrder = (0, import_hooks51.usePlaceLimitOrder)();
14480
+ const aggClient = (0, import_hooks51.useAggClient)();
14481
+ const queryClient = (0, import_hooks51.useQueryClient)();
14482
+ const { disabledVenues, isLoading: isAppConfigLoading, prophetxExecutionMode } = (0, import_hooks51.useAppConfig)();
13389
14483
  const isProphetxDirect = !isPaperMode && prophetxExecutionMode === "direct";
13390
- const canConnectProphetx = (0, import_hooks46.getVenueAvailabilityState)({
13391
- venueId: import_sdk21.Venue.prophetx,
14484
+ const canConnectProphetx = (0, import_hooks51.getVenueAvailabilityState)({
14485
+ venueId: import_sdk22.Venue.prophetx,
13392
14486
  disabledVenues,
13393
14487
  isConfigLoading: isAppConfigLoading
13394
14488
  }) !== "hidden";
13395
- const { data: prophetxKeyStatus, refetch: refetchProphetxKeyStatus } = (0, import_hooks46.useVenueKeyStatus)(
13396
- import_sdk21.Venue.prophetx,
14489
+ const { data: prophetxKeyStatus, refetch: refetchProphetxKeyStatus } = (0, import_hooks51.useVenueKeyStatus)(
14490
+ import_sdk22.Venue.prophetx,
13397
14491
  isAuthenticated && !isPaperMode
13398
14492
  );
13399
- const [isConnectProphetxModalOpen, setIsConnectProphetxModalOpen] = (0, import_react23.useState)(false);
13400
- const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks46.useVenueKeyStatus)(
13401
- import_sdk21.Venue.kalshi,
14493
+ const [isConnectProphetxModalOpen, setIsConnectProphetxModalOpen] = (0, import_react26.useState)(false);
14494
+ const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks51.useVenueKeyStatus)(
14495
+ import_sdk22.Venue.kalshi,
13402
14496
  isAuthenticated
13403
14497
  );
13404
- const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react23.useState)(false);
13405
- const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react23.useState)(false);
13406
- const [isBetdexAccountModalOpen, setIsBetdexAccountModalOpen] = (0, import_react23.useState)(false);
13407
- const livePrices = (0, import_hooks46.useLiveOutcomePrices)(
14498
+ const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react26.useState)(false);
14499
+ const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react26.useState)(false);
14500
+ const [isBetdexAccountModalOpen, setIsBetdexAccountModalOpen] = (0, import_react26.useState)(false);
14501
+ const livePrices = (0, import_hooks51.useLiveOutcomePrices)(
13408
14502
  scopedSelectedMarket ? [scopedSelectedMarket] : void 0
13409
14503
  );
13410
- const wsBestPrices = (0, import_hooks46.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
13411
- const fetchedClusterMidpointResult = (0, import_hooks46.useMidpoints)(
14504
+ const wsBestPrices = (0, import_hooks51.useLiveBestPrices)(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
14505
+ const fetchedClusterMidpointResult = (0, import_hooks51.useMidpoints)(
13412
14506
  midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
13413
14507
  );
13414
14508
  const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
13415
14509
  const clusterBestMidpointsByOutcomeId = (_j = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _j : clusterMidpointResult.prices;
13416
14510
  const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
13417
14511
  const clusterBestPricesRest = clusterMidpointResult.bestPrices;
13418
- const clusterBestPrices = (0, import_react23.useMemo)(
13419
- () => (0, import_hooks46.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
14512
+ const clusterBestPrices = (0, import_react26.useMemo)(
14513
+ () => (0, import_hooks51.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
13420
14514
  [clusterBestPricesRest, wsBestPrices]
13421
14515
  );
13422
- const [internalTab, setInternalTab] = (0, import_react23.useState)("buy");
13423
- const [executionType, setExecutionType] = (0, import_react23.useState)("market");
13424
- const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react23.useState)(null);
13425
- const [limitPrice, setLimitPrice] = (0, import_react23.useState)(0.5);
13426
- const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react23.useState)(formatLimitPriceInputValue(0.5));
13427
- const [limitPriceInputError, setLimitPriceInputError] = (0, import_react23.useState)(null);
13428
- const [limitExpirationType, setLimitExpirationType] = (0, import_react23.useState)("GTC");
13429
- const [limitExpirationDate, setLimitExpirationDate] = (0, import_react23.useState)(void 0);
13430
- const [limitExpirationTime, setLimitExpirationTime] = (0, import_react23.useState)("17:00");
13431
- const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0, import_react23.useState)();
13432
- const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0, import_react23.useState)("17:00");
13433
- const [limitExpirationPickerView, setLimitExpirationPickerView] = (0, import_react23.useState)("options");
13434
- const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0, import_react23.useState)(false);
13435
- const [internalAmount, setInternalAmount] = (0, import_react23.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
13436
- const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react23.useState)(null);
13437
- const [internalSlippage] = (0, import_react23.useState)(DEFAULT_SLIPPAGE_VALUE);
13438
- const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react23.useState)(false);
13439
- const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react23.useState)(null);
13440
- const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0, import_react23.useState)(
14516
+ const [internalTab, setInternalTab] = (0, import_react26.useState)("buy");
14517
+ const [executionType, setExecutionType] = (0, import_react26.useState)("market");
14518
+ const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react26.useState)(null);
14519
+ const [limitPrice, setLimitPrice] = (0, import_react26.useState)(0.5);
14520
+ const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react26.useState)(formatLimitPriceInputValue(0.5));
14521
+ const [limitPriceInputError, setLimitPriceInputError] = (0, import_react26.useState)(null);
14522
+ const [limitExpirationType, setLimitExpirationType] = (0, import_react26.useState)("GTC");
14523
+ const [limitExpirationDate, setLimitExpirationDate] = (0, import_react26.useState)(void 0);
14524
+ const [limitExpirationTime, setLimitExpirationTime] = (0, import_react26.useState)("17:00");
14525
+ const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0, import_react26.useState)();
14526
+ const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0, import_react26.useState)("17:00");
14527
+ const [limitExpirationPickerView, setLimitExpirationPickerView] = (0, import_react26.useState)("options");
14528
+ const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0, import_react26.useState)(false);
14529
+ const [internalAmount, setInternalAmount] = (0, import_react26.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
14530
+ const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react26.useState)(null);
14531
+ const [internalSlippage] = (0, import_react26.useState)(DEFAULT_SLIPPAGE_VALUE);
14532
+ const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react26.useState)(false);
14533
+ const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react26.useState)(null);
14534
+ const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0, import_react26.useState)(
13441
14535
  null
13442
14536
  );
13443
- const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react23.useState)(false);
13444
- const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0, import_react23.useState)(null);
13445
- const [submissionFeedback, setSubmissionFeedback] = (0, import_react23.useState)(null);
13446
- const [submissionProgressState, setSubmissionProgressState] = (0, import_react23.useState)(null);
13447
- const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react23.useState)(false);
13448
- const outcomes = (0, import_react23.useMemo)(
14537
+ const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react26.useState)(false);
14538
+ const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0, import_react26.useState)(null);
14539
+ const [submissionFeedback, setSubmissionFeedback] = (0, import_react26.useState)(null);
14540
+ const [submissionProgressState, setSubmissionProgressState] = (0, import_react26.useState)(null);
14541
+ const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react26.useState)(false);
14542
+ const outcomes = (0, import_react26.useMemo)(
13449
14543
  () => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
13450
14544
  [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
13451
14545
  );
13452
- const selectedOutcomeDisplayPrice = (0, import_react23.useMemo)(() => {
14546
+ const selectedOutcomeDisplayPrice = (0, import_react26.useMemo)(() => {
13453
14547
  var _a2;
13454
14548
  if (!scopedSelectedOutcomeId || !scopedSelectedOutcome) return 0.5;
13455
14549
  return getDisplayOutcomePrice({
@@ -13472,25 +14566,25 @@ var PlaceOrder = ({
13472
14566
  scopedSelectedOutcomeId,
13473
14567
  tradingContext == null ? void 0 : tradingContext.tradeSide
13474
14568
  ]);
13475
- const buyTabRef = (0, import_react23.useRef)(null);
13476
- const sellTabRef = (0, import_react23.useRef)(null);
13477
- const expirationTriggerRef = (0, import_react23.useRef)(null);
13478
- const limitPriceInitializedForOutcomeRef = (0, import_react23.useRef)(void 0);
13479
- const expirationOptionRefs = (0, import_react23.useRef)([]);
13480
- const shouldFocusExpirationOptionsRef = (0, import_react23.useRef)(false);
13481
- const expirationTimeInputId = (0, import_react23.useId)();
13482
- const executionDebugStoreRef = (0, import_react23.useRef)(null);
13483
- const executionDebugAttemptIdRef = (0, import_react23.useRef)(null);
13484
- const submittedSelectionRef = (0, import_react23.useRef)(null);
13485
- const lastValidRouteCardsRef = (0, import_react23.useRef)(null);
13486
- (0, import_react23.useEffect)(() => {
14569
+ const buyTabRef = (0, import_react26.useRef)(null);
14570
+ const sellTabRef = (0, import_react26.useRef)(null);
14571
+ const expirationTriggerRef = (0, import_react26.useRef)(null);
14572
+ const limitPriceInitializedForOutcomeRef = (0, import_react26.useRef)(void 0);
14573
+ const expirationOptionRefs = (0, import_react26.useRef)([]);
14574
+ const shouldFocusExpirationOptionsRef = (0, import_react26.useRef)(false);
14575
+ const expirationTimeInputId = (0, import_react26.useId)();
14576
+ const executionDebugStoreRef = (0, import_react26.useRef)(null);
14577
+ const executionDebugAttemptIdRef = (0, import_react26.useRef)(null);
14578
+ const submittedSelectionRef = (0, import_react26.useRef)(null);
14579
+ const lastValidRouteCardsRef = (0, import_react26.useRef)(null);
14580
+ (0, import_react26.useEffect)(() => {
13487
14581
  if (!isExecutionDebugEnabled) {
13488
14582
  executionDebugStoreRef.current = null;
13489
14583
  return;
13490
14584
  }
13491
14585
  executionDebugStoreRef.current = enableExecutionDebugInBrowser();
13492
14586
  }, [isExecutionDebugEnabled]);
13493
- (0, import_react23.useEffect)(() => {
14587
+ (0, import_react26.useEffect)(() => {
13494
14588
  var _a2;
13495
14589
  if (!isLimitExpirationPickerOpen) return;
13496
14590
  if (limitExpirationPickerView !== "options") return;
@@ -13498,7 +14592,7 @@ var PlaceOrder = ({
13498
14592
  (_a2 = expirationOptionRefs.current[LIMIT_EXPIRATION_OPTION_COUNT - 1]) == null ? void 0 : _a2.focus();
13499
14593
  shouldFocusExpirationOptionsRef.current = false;
13500
14594
  }, [isLimitExpirationPickerOpen, limitExpirationPickerView]);
13501
- (0, import_react23.useEffect)(() => {
14595
+ (0, import_react26.useEffect)(() => {
13502
14596
  if (!isExecutionDebugEnabled) return;
13503
14597
  const store = executionDebugStoreRef.current;
13504
14598
  if (!store) return;
@@ -13510,11 +14604,11 @@ var PlaceOrder = ({
13510
14604
  scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id,
13511
14605
  scopedSelectedOutcomeId
13512
14606
  ]);
13513
- const debouncedAmount = (0, import_hooks46.useDebouncedValue)(internalAmount, 300);
14607
+ const debouncedAmount = (0, import_hooks51.useDebouncedValue)(internalAmount, 300);
13514
14608
  const isQuoteInputEditing = internalAmount !== debouncedAmount;
13515
14609
  const isLimitOrder = showLimitOrders && executionType === "limit";
13516
- const isSell = (0, import_react23.useMemo)(() => internalTab === "sell", [internalTab]);
13517
- const limitVenueOptions = (0, import_react23.useMemo)(
14610
+ const isSell = (0, import_react26.useMemo)(() => internalTab === "sell", [internalTab]);
14611
+ const limitVenueOptions = (0, import_react26.useMemo)(
13518
14612
  () => {
13519
14613
  var _a2;
13520
14614
  return buildLimitOrderVenueOptions({
@@ -13526,10 +14620,10 @@ var PlaceOrder = ({
13526
14620
  },
13527
14621
  [clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
13528
14622
  );
13529
- const visibleLimitVenueOptions = (0, import_react23.useMemo)(() => {
14623
+ const visibleLimitVenueOptions = (0, import_react26.useMemo)(() => {
13530
14624
  return limitVenueOptions.filter((option) => {
13531
- if (option.venue === import_sdk21.Venue.prophetx && (!isProphetxDirect || isSell)) return false;
13532
- return (0, import_hooks46.getVenueAvailabilityState)({
14625
+ if (option.venue === import_sdk22.Venue.prophetx && (!isProphetxDirect || isSell)) return false;
14626
+ return (0, import_hooks51.getVenueAvailabilityState)({
13533
14627
  venueId: option.venue,
13534
14628
  disabledVenues,
13535
14629
  isConfigLoading: isAppConfigLoading
@@ -13541,11 +14635,11 @@ var PlaceOrder = ({
13541
14635
  dataUpdatedAt: executionPositionsUpdatedAt,
13542
14636
  isLoading: isExecutionPositionsLoading,
13543
14637
  isFetching: isExecutionPositionsFetching
13544
- } = (0, import_hooks46.useExecutionPositions)({
14638
+ } = (0, import_hooks51.useExecutionPositions)({
13545
14639
  enabled: Boolean(isAuthenticated && isSell),
13546
14640
  mode: isPaperMode ? "paper" : void 0
13547
14641
  });
13548
- const sellableSharesByVenue = (0, import_react23.useMemo)(
14642
+ const sellableSharesByVenue = (0, import_react26.useMemo)(
13549
14643
  () => isSell ? resolveSellableSharesByVenue({
13550
14644
  positions: executionPositions,
13551
14645
  market: scopedSelectedMarket,
@@ -13566,7 +14660,7 @@ var PlaceOrder = ({
13566
14660
  isPanelActive: isQuotePanelActive,
13567
14661
  isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
13568
14662
  };
13569
- const limitVenueQuoteRequests = (0, import_react23.useMemo)(
14663
+ const limitVenueQuoteRequests = (0, import_react26.useMemo)(
13570
14664
  () => visibleLimitVenueOptions.map((option) => ({
13571
14665
  venue: option.venue,
13572
14666
  venueMarketOutcomeId: option.venueMarketOutcomeId
@@ -13575,7 +14669,7 @@ var PlaceOrder = ({
13575
14669
  );
13576
14670
  const hasValidLimitVenueQuoteAmount = debouncedAmount > 0;
13577
14671
  const isLimitVenueQuoteEnabled = isLimitOrder && isQuotePanelActive && !isEndedWithoutKnownWinner && !submissionProgressState && !isBeforeActionPending && !placeLimitOrder.isPending && hasValidLimitVenueQuoteAmount && orderEligibility.canPlaceOrder && (!isSell || sellFilledForOutcomeId === scopedSelectedOutcomeId && !isQuoteInputEditing);
13578
- const limitVenueQuotes = (0, import_hooks46.useLimitOrderVenueQuotes)({
14672
+ const limitVenueQuotes = (0, import_hooks51.useLimitOrderVenueQuotes)({
13579
14673
  requests: limitVenueQuoteRequests,
13580
14674
  tradeSide: internalTab,
13581
14675
  amount: debouncedAmount,
@@ -13587,11 +14681,11 @@ var PlaceOrder = ({
13587
14681
  enabled: isLimitVenueQuoteEnabled,
13588
14682
  refreshContext: smartRouteRefreshContext
13589
14683
  });
13590
- const limitVenueQuoteByVenue = (0, import_react23.useMemo)(
14684
+ const limitVenueQuoteByVenue = (0, import_react26.useMemo)(
13591
14685
  () => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
13592
14686
  [limitVenueQuotes.quotes]
13593
14687
  );
13594
- const geoBlockedLimitVenues = (0, import_react23.useMemo)(() => {
14688
+ const geoBlockedLimitVenues = (0, import_react26.useMemo)(() => {
13595
14689
  var _a2;
13596
14690
  const venues = /* @__PURE__ */ new Set();
13597
14691
  for (const quote of limitVenueQuotes.quotes) {
@@ -13601,7 +14695,7 @@ var PlaceOrder = ({
13601
14695
  }
13602
14696
  return venues;
13603
14697
  }, [limitVenueQuotes.quotes]);
13604
- const availableLimitVenueOptions = (0, import_react23.useMemo)(() => {
14698
+ const availableLimitVenueOptions = (0, import_react26.useMemo)(() => {
13605
14699
  return visibleLimitVenueOptions.filter((option) => {
13606
14700
  var _a2;
13607
14701
  return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
@@ -13609,7 +14703,7 @@ var PlaceOrder = ({
13609
14703
  // server's reservation check — and the automatic pick, which sorts on
13610
14704
  // price alone, would happily choose one. Only narrow once we know
13611
14705
  // where the shares are; an empty map means positions haven't resolved.
13612
- (!isSell || sellableSharesByVenue.size === 0 || ((_a2 = sellableSharesByVenue.get(option.venue)) != null ? _a2 : 0) > 0) && (0, import_hooks46.getVenueAvailabilityState)({
14706
+ (!isSell || sellableSharesByVenue.size === 0 || ((_a2 = sellableSharesByVenue.get(option.venue)) != null ? _a2 : 0) > 0) && (0, import_hooks51.getVenueAvailabilityState)({
13613
14707
  venueId: option.venue,
13614
14708
  disabledVenues,
13615
14709
  isConfigLoading: isAppConfigLoading
@@ -13623,11 +14717,11 @@ var PlaceOrder = ({
13623
14717
  sellableSharesByVenue,
13624
14718
  visibleLimitVenueOptions
13625
14719
  ]);
13626
- const automaticLimitVenueOption = (0, import_react23.useMemo)(
14720
+ const automaticLimitVenueOption = (0, import_react26.useMemo)(
13627
14721
  () => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
13628
14722
  [availableLimitVenueOptions, internalTab]
13629
14723
  );
13630
- const selectedLimitVenueOption = (0, import_react23.useMemo)(() => {
14724
+ const selectedLimitVenueOption = (0, import_react26.useMemo)(() => {
13631
14725
  if (selectedLimitVenue) {
13632
14726
  const selectedOption = availableLimitVenueOptions.find(
13633
14727
  (option) => option.venue === selectedLimitVenue
@@ -13636,11 +14730,11 @@ var PlaceOrder = ({
13636
14730
  }
13637
14731
  return automaticLimitVenueOption;
13638
14732
  }, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
13639
- (0, import_react23.useEffect)(() => {
14733
+ (0, import_react26.useEffect)(() => {
13640
14734
  if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
13641
14735
  setSelectedLimitVenue(null);
13642
14736
  }, [geoBlockedLimitVenues, selectedLimitVenue]);
13643
- const smartRoute = (0, import_hooks46.useSmartRoute)(__spreadProps(__spreadValues({
14737
+ const smartRoute = (0, import_hooks51.useSmartRoute)(__spreadProps(__spreadValues({
13644
14738
  venueMarketOutcomeId: scopedSelectedOutcomeId,
13645
14739
  maxSpend: isSell ? void 0 : debouncedAmount,
13646
14740
  sellShares: isSell ? debouncedAmount : void 0,
@@ -13664,7 +14758,7 @@ var PlaceOrder = ({
13664
14758
  } : {}), {
13665
14759
  refreshContext: smartRouteRefreshContext
13666
14760
  }));
13667
- (0, import_react23.useEffect)(() => {
14761
+ (0, import_react26.useEffect)(() => {
13668
14762
  var _a2, _b2, _c2;
13669
14763
  if (isSell || smartRoute.isFetching || ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) {
13670
14764
  return;
@@ -13686,7 +14780,7 @@ var PlaceOrder = ({
13686
14780
  smartRoute.isFetching,
13687
14781
  user == null ? void 0 : user.id
13688
14782
  ]);
13689
- const inheritedBuyGeoBlockedVenues = (0, import_react23.useMemo)(() => {
14783
+ const inheritedBuyGeoBlockedVenues = (0, import_react26.useMemo)(() => {
13690
14784
  var _a2, _b2;
13691
14785
  if (!isSell || !buyGeoBlockSnapshot || !scopedSelectedOutcomeId) return void 0;
13692
14786
  if (buyGeoBlockSnapshot.eventId !== ((_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id) != null ? _a2 : null)) return void 0;
@@ -13702,7 +14796,7 @@ var PlaceOrder = ({
13702
14796
  scopedSelectedOutcomeId,
13703
14797
  user == null ? void 0 : user.id
13704
14798
  ]);
13705
- const venueSellQuoteRequests = (0, import_react23.useMemo)(
14799
+ const venueSellQuoteRequests = (0, import_react26.useMemo)(
13706
14800
  () => {
13707
14801
  var _a2;
13708
14802
  return isSell && !smartRoute.isLoading && ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) === scopedSelectedOutcomeId ? buildVenueSellQuoteRequests({
@@ -13712,7 +14806,7 @@ var PlaceOrder = ({
13712
14806
  },
13713
14807
  [debouncedAmount, isSell, scopedSelectedOutcomeId, smartRoute.data, smartRoute.isLoading]
13714
14808
  );
13715
- const venueSellQuotes = (0, import_hooks46.useVenueSellQuotes)({
14809
+ const venueSellQuotes = (0, import_hooks51.useVenueSellQuotes)({
13716
14810
  venueMarketOutcomeId: scopedSelectedOutcomeId,
13717
14811
  accountId: (_n = user == null ? void 0 : user.id) != null ? _n : null,
13718
14812
  positionVersion: executionPositionsUpdatedAt,
@@ -13722,7 +14816,7 @@ var PlaceOrder = ({
13722
14816
  enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
13723
14817
  refreshContext: smartRouteRefreshContext
13724
14818
  });
13725
- const currentSellableShares = (0, import_react23.useMemo)(() => {
14819
+ const currentSellableShares = (0, import_react26.useMemo)(() => {
13726
14820
  var _a2, _b2;
13727
14821
  const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
13728
14822
  if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
@@ -13732,22 +14826,22 @@ var PlaceOrder = ({
13732
14826
  for (const size of sellableSharesByVenue.values()) resolvedShares += size;
13733
14827
  return Math.max(0, resolvedShares);
13734
14828
  }, [sellableSharesByVenue, (_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares]);
13735
- const maxSellableShares = (0, import_react23.useMemo)(
14829
+ const maxSellableShares = (0, import_react26.useMemo)(
13736
14830
  () => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
13737
14831
  [currentSellableShares]
13738
14832
  );
13739
14833
  const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
13740
- const displayedCurrentSellableShares = (0, import_react23.useMemo)(() => {
14834
+ const displayedCurrentSellableShares = (0, import_react26.useMemo)(() => {
13741
14835
  if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
13742
14836
  return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
13743
14837
  }, [currentSellableShares]);
13744
- const displayedCurrentSellableSharesLabel = (0, import_react23.useMemo)(
14838
+ const displayedCurrentSellableSharesLabel = (0, import_react26.useMemo)(
13745
14839
  () => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
13746
14840
  [maxSellableShares]
13747
14841
  );
13748
14842
  const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
13749
14843
  const isSellAmountAboveAvailability = isSell && ((_t = smartRoute.data) == null ? void 0 : _t.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_u = smartRoute.data.positionAvailability) == null ? void 0 : _u.totalSellableShares) === "number" && internalAmount > maxSellableShares;
13750
- (0, import_react23.useEffect)(() => {
14844
+ (0, import_react26.useEffect)(() => {
13751
14845
  if (submissionProgressState != null) return;
13752
14846
  if (!isSell || isCurrentSellableSharesLoading) return;
13753
14847
  if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
@@ -13763,7 +14857,7 @@ var PlaceOrder = ({
13763
14857
  onAmountChange,
13764
14858
  submissionProgressState
13765
14859
  ]);
13766
- (0, import_react23.useEffect)(() => {
14860
+ (0, import_react26.useEffect)(() => {
13767
14861
  var _a2, _b2;
13768
14862
  if (submissionProgressState != null || !isSell) return;
13769
14863
  if (((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) return;
@@ -13786,8 +14880,16 @@ var PlaceOrder = ({
13786
14880
  (_x = smartRoute.data) == null ? void 0 : _x.venueMarketOutcomeId,
13787
14881
  submissionProgressState
13788
14882
  ]);
13789
- const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
13790
- const routeCards = (0, import_react23.useMemo)(() => {
14883
+ const { account: betdexAccount, isAvailable: isBetdexAccountAvailable } = (0, import_hooks51.useHostedVenueAccount)(
14884
+ "betdex",
14885
+ !isPaperMode && isQuotePanelActive && ((scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === import_sdk22.Venue.betdex || (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.some((market) => market.venue === import_sdk22.Venue.betdex)) === true || ((_y = smartRoute.data) == null ? void 0 : _y.fills.some((fill) => fill.venue === import_sdk22.Venue.betdex)) === true)
14886
+ );
14887
+ const betdexAccountData = betdexAccount.data;
14888
+ const betdexBalance = isBetdexAccountAvailable && !betdexAccount.isError && (betdexAccountData == null ? void 0 : betdexAccountData.status) === "active" && betdexAccountData.balanceStatus === "available" ? betdexAccountData.balance : null;
14889
+ const betdexAvailableAmount = betdexBalance ? Number(betdexBalance.availableRaw) / __pow(10, betdexBalance.decimals) : NaN;
14890
+ const betdexAvailableBalance = Number.isFinite(betdexAvailableAmount) && betdexAvailableAmount >= 0 ? betdexAvailableAmount : null;
14891
+ const scopedSmartRouteData = ((_z = smartRoute.data) == null ? void 0 : _z.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
14892
+ const routeCards = (0, import_react26.useMemo)(() => {
13791
14893
  const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
13792
14894
  if (isSell) {
13793
14895
  return buildLiveSellRouteCards({
@@ -13806,10 +14908,13 @@ var PlaceOrder = ({
13806
14908
  eventVenues,
13807
14909
  labels: tradingLabels,
13808
14910
  quoteData: scopedSmartRouteData,
13809
- tradeSide: "buy"
14911
+ tradeSide: "buy",
14912
+ betdexFundingRequired: !isPaperMode && betdexAvailableBalance !== null && betdexAvailableBalance < debouncedAmount
13810
14913
  }) : [];
13811
14914
  }, [
13812
14915
  debouncedAmount,
14916
+ isPaperMode,
14917
+ betdexAvailableBalance,
13813
14918
  scopedSmartRouteData,
13814
14919
  tradingLabels,
13815
14920
  inheritedBuyGeoBlockedVenues,
@@ -13819,7 +14924,7 @@ var PlaceOrder = ({
13819
14924
  ]);
13820
14925
  const routeCardsScopeKey = [
13821
14926
  resolvedExecutionMode,
13822
- (_z = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _z : "",
14927
+ (_A = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _A : "",
13823
14928
  scopedSelectedOutcomeId != null ? scopedSelectedOutcomeId : "",
13824
14929
  internalTab
13825
14930
  ].join(":");
@@ -13827,26 +14932,26 @@ var PlaceOrder = ({
13827
14932
  if (routeCards.length > 0) {
13828
14933
  lastValidRouteCardsRef.current = { cards: routeCards, scopeKey: routeCardsScopeKey };
13829
14934
  }
13830
- const displayedRouteCards = routeCards.length > 0 ? routeCards : isRouteCardsTransient && ((_A = lastValidRouteCardsRef.current) == null ? void 0 : _A.scopeKey) === routeCardsScopeKey ? lastValidRouteCardsRef.current.cards : [];
14935
+ const displayedRouteCards = routeCards.length > 0 ? routeCards : isRouteCardsTransient && ((_B = lastValidRouteCardsRef.current) == null ? void 0 : _B.scopeKey) === routeCardsScopeKey ? lastValidRouteCardsRef.current.cards : [];
13831
14936
  const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
13832
14937
  (card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
13833
14938
  ) : void 0;
13834
- const legacyKalshiAccount = (0, import_react23.useMemo)(
14939
+ const legacyKalshiAccount = (0, import_react26.useMemo)(
13835
14940
  () => {
13836
14941
  var _a2;
13837
14942
  return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
13838
14943
  },
13839
14944
  [user == null ? void 0 : user.venueAccounts]
13840
14945
  );
13841
- const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
14946
+ const isKalshiAccountActive = (_C = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _C : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
13842
14947
  const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
13843
- const isKalshiAvailable = (0, import_hooks46.getVenueAvailabilityState)({
14948
+ const isKalshiAvailable = (0, import_hooks51.getVenueAvailabilityState)({
13844
14949
  venueId: "kalshi",
13845
14950
  disabledVenues,
13846
14951
  isConfigLoading: isAppConfigLoading
13847
14952
  }) === "available";
13848
14953
  const isKalshiDisconnected = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && !isKalshiAccountActive;
13849
- const resolvedSelectedRouteCardId = (0, import_react23.useMemo)(() => {
14954
+ const resolvedSelectedRouteCardId = (0, import_react26.useMemo)(() => {
13850
14955
  var _a2;
13851
14956
  if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
13852
14957
  return selectedManualRouteCard.id;
@@ -13866,9 +14971,9 @@ var PlaceOrder = ({
13866
14971
  routeCards,
13867
14972
  selectedManualRouteCard,
13868
14973
  selectedRouteCardId,
13869
- (_C = smartRoute.data) == null ? void 0 : _C.status
14974
+ (_D = smartRoute.data) == null ? void 0 : _D.status
13870
14975
  ]);
13871
- (0, import_react23.useEffect)(() => {
14976
+ (0, import_react26.useEffect)(() => {
13872
14977
  if (routeCards.length === 0) {
13873
14978
  if (isRouteCardsTransient) return;
13874
14979
  setSelectedRouteCardId(null);
@@ -13892,19 +14997,19 @@ var PlaceOrder = ({
13892
14997
  selectedRouteCardId
13893
14998
  ]);
13894
14999
  const isSubmissionLocked = submissionProgressState != null;
13895
- const isSubmissionLockedRef = (0, import_react23.useRef)(isSubmissionLocked);
15000
+ const isSubmissionLockedRef = (0, import_react26.useRef)(isSubmissionLocked);
13896
15001
  isSubmissionLockedRef.current = isSubmissionLocked;
13897
- (0, import_react23.useEffect)(() => {
15002
+ (0, import_react26.useEffect)(() => {
13898
15003
  if (isSubmissionLockedRef.current) return;
13899
15004
  setSubmissionFeedback(null);
13900
15005
  setSubmissionProgressState(null);
13901
15006
  }, [executionType, internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
13902
- (0, import_react23.useEffect)(() => {
15007
+ (0, import_react26.useEffect)(() => {
13903
15008
  if (showLimitOrders || executionType !== "limit") return;
13904
15009
  setExecutionType("market");
13905
15010
  setIsLimitExpirationPickerOpen(false);
13906
15011
  }, [executionType, showLimitOrders]);
13907
- (0, import_react23.useEffect)(() => {
15012
+ (0, import_react26.useEffect)(() => {
13908
15013
  if (executionType !== "limit") {
13909
15014
  limitPriceInitializedForOutcomeRef.current = void 0;
13910
15015
  return;
@@ -13917,21 +15022,21 @@ var PlaceOrder = ({
13917
15022
  setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
13918
15023
  setLimitPriceInputError(null);
13919
15024
  }, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
13920
- (0, import_react23.useEffect)(() => {
15025
+ (0, import_react26.useEffect)(() => {
13921
15026
  setSelectedLimitVenue(null);
13922
15027
  }, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
13923
- (0, import_react23.useEffect)(() => {
15028
+ (0, import_react26.useEffect)(() => {
13924
15029
  setSelectedRouteCardId(null);
13925
15030
  setManualRouteSelectionIdentity(null);
13926
15031
  setIsRoutesExpanded(false);
13927
15032
  setIsSplitDetailOpen(false);
13928
15033
  }, [executionType, internalTab, scopedSelectedOutcomeId]);
13929
15034
  const orderedRouteCards = routeCards;
13930
- const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
13931
- const hasDirectProphetxQuote = (_F = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.some(
13932
- (fill) => fill.venue === import_sdk21.Venue.prophetx && fill.executionBackend === "direct"
13933
- )) != null ? _F : false;
13934
- const selectedSharedKycVenue = (0, import_react23.useMemo)(() => {
15035
+ const selectedRouteCard = (_F = (_E = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _E : orderedRouteCards[0]) != null ? _F : null;
15036
+ const hasDirectProphetxQuote = (_G = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.some(
15037
+ (fill) => fill.venue === import_sdk22.Venue.prophetx && fill.executionBackend === "direct"
15038
+ )) != null ? _G : false;
15039
+ const selectedSharedKycVenue = (0, import_react26.useMemo)(() => {
13935
15040
  var _a2, _b2;
13936
15041
  const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
13937
15042
  (fill) => venueRequiresSharedKyc({
@@ -13939,7 +15044,7 @@ var PlaceOrder = ({
13939
15044
  requiresKyc: fill.executionBackend === "direct" ? false : void 0
13940
15045
  })
13941
15046
  )) == null ? void 0 : _a2.venue) != null ? _b2 : selectedRouteCard == null ? void 0 : selectedRouteCard.venue;
13942
- if (candidateVenue === import_sdk21.Venue.prophetx && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(import_sdk21.Venue.prophetx)))
15047
+ if (candidateVenue === import_sdk22.Venue.prophetx && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(import_sdk22.Venue.prophetx)))
13943
15048
  return null;
13944
15049
  if (!venueRequiresSharedKyc({ venue: candidateVenue })) return null;
13945
15050
  const parsedVenue = parseVenue(candidateVenue);
@@ -13954,46 +15059,38 @@ var PlaceOrder = ({
13954
15059
  sellableSharesByVenue
13955
15060
  ]);
13956
15061
  const needsSharedKycVerification = !isPaperMode && isAuthenticated && sharedKyc !== void 0 && selectedSharedKycVenue !== null && sharedKyc.status !== "verified";
13957
- const isKalshiRoute = (0, import_react23.useMemo)(() => {
13958
- if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk21.Venue.kalshi;
15062
+ const isKalshiRoute = (0, import_react26.useMemo)(() => {
15063
+ if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk22.Venue.kalshi;
13959
15064
  if (selectedRouteCard) {
13960
15065
  return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
13961
15066
  }
13962
15067
  return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
13963
15068
  }, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
13964
- const isProphetxDirectRoute = !isPaperMode && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(import_sdk21.Venue.prophetx)) && (isLimitOrder ? (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk21.Venue.prophetx : selectedRouteCard ? selectedRouteCard.venue === import_sdk21.Venue.prophetx || selectedRouteCard.quoteData.fills.some((fill) => fill.venue === import_sdk21.Venue.prophetx) : (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === import_sdk21.Venue.prophetx);
13965
- const prophetxBalance = (_H = (_G = liveBalanceState.venueCashBalances) == null ? void 0 : _G[import_sdk21.Venue.prophetx]) != null ? _H : 0;
15069
+ const isProphetxDirectRoute = !isPaperMode && (isProphetxDirect || hasDirectProphetxQuote) && (!isSell || !sellableSharesByVenue.get(import_sdk22.Venue.prophetx)) && (isLimitOrder ? (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk22.Venue.prophetx : selectedRouteCard ? selectedRouteCard.venue === import_sdk22.Venue.prophetx || selectedRouteCard.quoteData.fills.some((fill) => fill.venue === import_sdk22.Venue.prophetx) : (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === import_sdk22.Venue.prophetx);
15070
+ const prophetxBalance = (_I = (_H = liveBalanceState.venueCashBalances) == null ? void 0 : _H[import_sdk22.Venue.prophetx]) != null ? _I : 0;
13966
15071
  const needsProphetxConnection = !isPaperMode && isAuthenticated && canConnectProphetx && isProphetxDirectRoute && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.connected);
13967
- (0, import_react23.useEffect)(() => {
13968
- if ((selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk21.Venue.prophetx) {
15072
+ (0, import_react26.useEffect)(() => {
15073
+ if ((selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk22.Venue.prophetx) {
13969
15074
  setLimitExpirationType("GTC");
13970
15075
  setIsLimitExpirationPickerOpen(false);
13971
15076
  }
13972
15077
  }, [selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue]);
13973
- const selectedRouteFills = (_I = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _I : [];
13974
- const fallbackRouteVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_J = selectedRouteCard == null ? void 0 : selectedRouteCard.venue) != null ? _J : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue;
13975
- const isBetdexRoute = isLimitOrder || selectedRouteFills.length === 0 ? fallbackRouteVenue === import_sdk21.Venue.betdex : selectedRouteFills.some((fill) => fill.venue === import_sdk21.Venue.betdex);
13976
- const isBetdexOnlyRoute = isBetdexRoute && (isLimitOrder || selectedRouteFills.every((fill) => fill.venue === import_sdk21.Venue.betdex));
13977
- const { account: betdexAccount, isAvailable: isBetdexAccountAvailable } = (0, import_hooks46.useHostedVenueAccount)(
13978
- "betdex",
13979
- !isPaperMode && isBetdexRoute
13980
- );
13981
- const betdexAccountData = betdexAccount.data;
13982
- const betdexBalance = isBetdexAccountAvailable && !betdexAccount.isError && (betdexAccountData == null ? void 0 : betdexAccountData.status) === "active" && betdexAccountData.balanceStatus === "available" ? betdexAccountData.balance : null;
13983
- const betdexAvailableAmount = betdexBalance ? Number(betdexBalance.availableRaw) / __pow(10, betdexBalance.decimals) : NaN;
13984
- const betdexAvailableBalance = Number.isFinite(betdexAvailableAmount) && betdexAvailableAmount >= 0 ? betdexAvailableAmount : null;
13985
- const totalBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? betdexAvailableBalance != null ? betdexAvailableBalance : 0 : liveAvailableBalance;
13986
- const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : isBetdexOnlyRoute ? betdexAccount.isLoading : liveBalanceState.isLoading || isBetdexRoute && betdexAccount.isLoading;
13987
- const displayedBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? betdexAvailableBalance != null ? betdexAvailableBalance : 0 : isKalshiRoute ? (_K = liveBalanceState.kalshiBalance) != null ? _K : 0 : liveAvailableBalance;
15078
+ const selectedRouteFills = (_J = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _J : [];
15079
+ const fallbackRouteVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_K = selectedRouteCard == null ? void 0 : selectedRouteCard.venue) != null ? _K : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue;
15080
+ const isBetdexRoute = isLimitOrder || selectedRouteFills.length === 0 ? fallbackRouteVenue === import_sdk22.Venue.betdex : selectedRouteFills.some((fill) => fill.venue === import_sdk22.Venue.betdex);
15081
+ const isBetdexOnlyRoute = isBetdexRoute && (isLimitOrder || selectedRouteFills.every((fill) => fill.venue === import_sdk22.Venue.betdex));
15082
+ const totalBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? (betdexAvailableBalance != null ? betdexAvailableBalance : 0) + (isLimitOrder ? 0 : liveAvailableBalance) : liveAvailableBalance;
15083
+ const isBalanceLoading = isPaperMode ? paperBalancesQuery.isLoading : isBetdexOnlyRoute ? betdexAccount.isLoading || !isLimitOrder && liveBalanceState.isLoading : liveBalanceState.isLoading || isBetdexRoute && betdexAccount.isLoading;
15084
+ const displayedBalance = isPaperMode ? paperTotalBalance : isProphetxDirectRoute ? prophetxBalance : isBetdexOnlyRoute ? (betdexAvailableBalance != null ? betdexAvailableBalance : 0) + (isLimitOrder ? 0 : liveAvailableBalance) : isKalshiRoute ? (_L = liveBalanceState.kalshiBalance) != null ? _L : 0 : liveAvailableBalance;
13988
15085
  const betdexBalanceLabel = betdexAvailableBalance === null ? tradingLabels.betdexBalanceUnavailable : tradingLabels.betdexBalance(formatUsd(betdexAvailableBalance));
13989
15086
  const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
13990
- const handleVerifyKalshi = (0, import_react23.useCallback)(
15087
+ const handleVerifyKalshi = (0, import_react26.useCallback)(
13991
15088
  (credentials) => __async(null, null, function* () {
13992
15089
  if (onConnectKalshi) {
13993
15090
  yield onConnectKalshi(credentials);
13994
15091
  } else {
13995
15092
  yield aggClient.upsertVenueKey({
13996
- venue: import_sdk21.Venue.kalshi,
15093
+ venue: import_sdk22.Venue.kalshi,
13997
15094
  credentials: {
13998
15095
  keyId: credentials.apiKeyId,
13999
15096
  privateKey: credentials.privateKey
@@ -14005,7 +15102,7 @@ var PlaceOrder = ({
14005
15102
  }),
14006
15103
  [aggClient, onConnectKalshi, refetchKalshiKeyStatus]
14007
15104
  );
14008
- const handleRouteCardSelect = (0, import_react23.useCallback)(
15105
+ const handleRouteCardSelect = (0, import_react26.useCallback)(
14009
15106
  (cardId) => {
14010
15107
  const card = routeCards.find((routeCard) => routeCard.id === cardId);
14011
15108
  if (!card || card.isUnavailable) return;
@@ -14036,24 +15133,25 @@ var PlaceOrder = ({
14036
15133
  scopedSelectedOutcomeId
14037
15134
  ]
14038
15135
  );
14039
- const executionProgress = (0, import_hooks46.useExecutionProgress)({
14040
- orderIds: (_L = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _L : null,
14041
- quoteId: (_M = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _M : null,
15136
+ const executionProgress = (0, import_hooks51.useExecutionProgress)({
15137
+ orderIds: (_M = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _M : null,
15138
+ quoteId: (_N = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _N : null,
14042
15139
  mode: isPaperMode ? "paper" : void 0,
14043
- enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_N = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _N.length)
15140
+ enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_O = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _O.length)
14044
15141
  });
14045
- const executionProgressFloorRef = (0, import_react23.useRef)({
15142
+ const executionProgressFloorRef = (0, import_react26.useRef)({
14046
15143
  quoteId: null,
14047
15144
  value: 0
14048
15145
  });
14049
- const selectedOutcomeLabel = (_Q = (_P = (_O = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _O.label) != null ? _P : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _Q : "";
14050
- const headerImage = (_S = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _R : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _S : null;
14051
- const headerTitle = (_U = (_T = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _T : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _U : "";
14052
- const headerSubtitle = (_V = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _V : "";
14053
- const executionDateSource = (_W = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _W : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
15146
+ const selectedOutcome = (_P = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) != null ? _P : scopedSelectedOutcome;
15147
+ const selectedOutcomeLabel = (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === import_sdk22.Venue.betdex ? ((_Q = selectedOutcome == null ? void 0 : selectedOutcome.title) == null ? void 0 : _Q.trim()) || (selectedOutcome == null ? void 0 : selectedOutcome.label) || "" : (_R = selectedOutcome == null ? void 0 : selectedOutcome.label) != null ? _R : "";
15148
+ const headerImage = (_T = (_S = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _S : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _T : null;
15149
+ const headerTitle = (_V = (_U = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _U : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _V : "";
15150
+ const headerSubtitle = (_W = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _W : "";
15151
+ const executionDateSource = (_X = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _X : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
14054
15152
  const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
14055
- const executionQuoteData = (_Y = (_X = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _X : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _Y : null;
14056
- const executionOrderGroups = (0, import_react23.useMemo)(() => {
15153
+ const executionQuoteData = (_Z = (_Y = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _Y : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _Z : null;
15154
+ const executionOrderGroups = (0, import_react26.useMemo)(() => {
14057
15155
  var _a2, _b2, _c2;
14058
15156
  if (submissionProgressState == null ? void 0 : submissionProgressState.limitOrderGroup) return [submissionProgressState.limitOrderGroup];
14059
15157
  if (!executionQuoteData) return [];
@@ -14075,10 +15173,10 @@ var PlaceOrder = ({
14075
15173
  executionQuoteData,
14076
15174
  internalTab,
14077
15175
  submissionProgressState == null ? void 0 : submissionProgressState.limitOrderGroup,
14078
- (_Z = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _Z.length,
15176
+ (__ = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : __.length,
14079
15177
  tradingLabels
14080
15178
  ]);
14081
- const executionProgressPercent = (0, import_react23.useMemo)(() => {
15179
+ const executionProgressPercent = (0, import_react26.useMemo)(() => {
14082
15180
  var _a2, _b2, _c2;
14083
15181
  const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
14084
15182
  const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
@@ -14098,7 +15196,7 @@ var PlaceOrder = ({
14098
15196
  submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
14099
15197
  submissionProgressState == null ? void 0 : submissionProgressState.quoteId
14100
15198
  ]);
14101
- const buildExecutionSummary = (0, import_react23.useCallback)(
15199
+ const buildExecutionSummary = (0, import_react26.useCallback)(
14102
15200
  (quoteData, executionVenue, orderId, partialFillSummary) => {
14103
15201
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
14104
15202
  if (!quoteData) return void 0;
@@ -14202,7 +15300,7 @@ var PlaceOrder = ({
14202
15300
  tradingLabels
14203
15301
  ]
14204
15302
  );
14205
- (0, import_react23.useEffect)(() => {
15303
+ (0, import_react26.useEffect)(() => {
14206
15304
  if (executionProgress.phase === "order_submitted") {
14207
15305
  const submittedOrder = executionProgress.submittedOrders[0];
14208
15306
  setSubmissionProgressState((prev) => {
@@ -14215,7 +15313,7 @@ var PlaceOrder = ({
14215
15313
  });
14216
15314
  }
14217
15315
  }, [executionProgress.phase, executionProgress.submittedOrders]);
14218
- (0, import_react23.useEffect)(() => {
15316
+ (0, import_react26.useEffect)(() => {
14219
15317
  var _a2, _b2;
14220
15318
  const dp = executionProgress.dagProgress;
14221
15319
  if (!dp) return;
@@ -14270,7 +15368,7 @@ var PlaceOrder = ({
14270
15368
  return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
14271
15369
  });
14272
15370
  }, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
14273
- (0, import_react23.useEffect)(() => {
15371
+ (0, import_react26.useEffect)(() => {
14274
15372
  const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
14275
15373
  if (!(orderIds == null ? void 0 : orderIds.length)) return;
14276
15374
  const aggregateStatus = deriveAggregateOrderStatus(
@@ -14331,7 +15429,7 @@ var PlaceOrder = ({
14331
15429
  tradingLabels
14332
15430
  ]);
14333
15431
  const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
14334
- (0, import_react23.useEffect)(() => {
15432
+ (0, import_react26.useEffect)(() => {
14335
15433
  const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
14336
15434
  if (phase !== "submitting" && phase !== "executing") return;
14337
15435
  const timeoutMs = Math.max(6e4, 2 * estDurationMs);
@@ -14346,7 +15444,7 @@ var PlaceOrder = ({
14346
15444
  }, timeoutMs);
14347
15445
  return () => clearTimeout(id);
14348
15446
  }, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs, tradingLabels.orderStillSettling]);
14349
- const emitTerminalOrderNotifications = (0, import_react23.useCallback)(() => {
15447
+ const emitTerminalOrderNotifications = (0, import_react26.useCallback)(() => {
14350
15448
  const toast = toastCtx == null ? void 0 : toastCtx.toast;
14351
15449
  if (!toast) return;
14352
15450
  for (const event of executionProgress.terminalOrderEvents) {
@@ -14375,7 +15473,7 @@ var PlaceOrder = ({
14375
15473
  });
14376
15474
  }
14377
15475
  }, [executionProgress.terminalOrderEvents, labels, toastCtx]);
14378
- (0, import_react23.useEffect)(() => {
15476
+ (0, import_react26.useEffect)(() => {
14379
15477
  var _a2, _b2;
14380
15478
  if (!submissionProgressState) return;
14381
15479
  onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
@@ -14395,8 +15493,8 @@ var PlaceOrder = ({
14395
15493
  }
14396
15494
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
14397
15495
  emitTerminalOrderNotifications();
14398
- (0, import_hooks46.invalidateBalanceQueries)(queryClient);
14399
- (0, import_hooks46.invalidatePositionQueries)(queryClient);
15496
+ (0, import_hooks51.invalidateBalanceQueries)(queryClient);
15497
+ (0, import_hooks51.invalidatePositionQueries)(queryClient);
14400
15498
  if (debugStore && debugAttemptId) {
14401
15499
  debugStore.updateAttempt(debugAttemptId, {
14402
15500
  status: "succeeded",
@@ -14427,38 +15525,39 @@ var PlaceOrder = ({
14427
15525
  queryClient,
14428
15526
  submissionProgressState
14429
15527
  ]);
14430
- const activeQuoteData = isLimitOrder ? null : (__ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? __ : scopedSmartRouteData;
15528
+ const activeQuoteData = isLimitOrder ? null : (_$ = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _$ : scopedSmartRouteData;
14431
15529
  const visibleMarketRouteCards = displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? displayedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : displayedRouteCards;
14432
15530
  const hasEnteredAmount = internalAmount > 0;
14433
15531
  const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
14434
15532
  const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
14435
- const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk21.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk21.Venue.kalshi));
15533
+ const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk22.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk22.Venue.kalshi));
14436
15534
  const isOnchainOnlyRoute = !isKalshiRoute && !isBetdexRoute && !isProphetxDirectRoute;
14437
- const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk21.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
14438
- const betdexRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk21.Venue.betdex).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
15535
+ const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk22.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
15536
+ const betdexRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk22.Venue.betdex).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
14439
15537
  const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter(
14440
- (fill) => fill.venue !== import_sdk21.Venue.kalshi && fill.venue !== import_sdk21.Venue.betdex && !(fill.venue === import_sdk21.Venue.prophetx && (isProphetxDirect || fill.executionBackend === "direct"))
15538
+ (fill) => fill.venue !== import_sdk22.Venue.kalshi && fill.venue !== import_sdk22.Venue.betdex && !(fill.venue === import_sdk22.Venue.prophetx && (isProphetxDirect || fill.executionBackend === "direct"))
14441
15539
  ).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
14442
15540
  const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
14443
15541
  const resolvedBetdexRequiredAmount = isBetdexOnlyRoute ? internalAmount : betdexRequiredAmount;
14444
15542
  const resolvedOnchainRequiredAmount = isOnchainOnlyRoute ? internalAmount : onchainRequiredAmount;
14445
- const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_$ = liveBalanceState.kalshiBalance) != null ? _$ : 0);
15543
+ const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_aa = liveBalanceState.kalshiBalance) != null ? _aa : 0);
14446
15544
  const isBetdexBalanceInsufficient = !isPaperMode && isBetdexRoute && betdexAvailableBalance !== null && resolvedBetdexRequiredAmount > betdexAvailableBalance;
14447
15545
  const isBetdexBalanceUnavailable = !isPaperMode && !isSell && isAuthenticated && isBetdexRoute && betdexAvailableBalance === null;
14448
- const needsBetdexAccount = !isSell && isAuthenticated && !betdexAccount.isLoading && (isBetdexBalanceUnavailable || hasEnteredAmount && isBetdexBalanceInsufficient);
15546
+ const canExecuteBetdexQuote = !isPaperMode && !isSell && !isLimitOrder && isAuthenticated && isBetdexRoute && !(selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) && selectedRouteFills.length > 0 && (selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.status) === "ok" && !!selectedRouteCard.quoteData.quoteId;
15547
+ const needsBetdexAccount = !canExecuteBetdexQuote && !isSell && isAuthenticated && !betdexAccount.isLoading && (isBetdexBalanceUnavailable || hasEnteredAmount && isBetdexBalanceInsufficient);
14449
15548
  const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
14450
- const prophetxRequiredAmount = !isProphetxDirectRoute || isSell ? 0 : selectedRouteFills.length ? selectedRouteFills.filter((fill) => fill.venue === import_sdk21.Venue.prophetx).reduce((sum, fill) => sum + fill.venueQty * fill.avgPrice, 0) : internalAmount;
15549
+ const prophetxRequiredAmount = !isProphetxDirectRoute || isSell ? 0 : selectedRouteFills.length ? selectedRouteFills.filter((fill) => fill.venue === import_sdk22.Venue.prophetx).reduce((sum, fill) => sum + fill.venueQty * fill.avgPrice, 0) : internalAmount;
14451
15550
  const isProphetxBalanceInsufficient = !isPaperMode && !isBalanceLoading && prophetxRequiredAmount > prophetxBalance;
14452
- const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > (isProphetxDirectRoute ? prophetxBalance : totalBalance) : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isProphetxBalanceInsufficient || isBetdexBalanceInsufficient || isOnchainBalanceInsufficient);
15551
+ const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > (isProphetxDirectRoute ? prophetxBalance : totalBalance) : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isProphetxBalanceInsufficient || isBetdexBalanceInsufficient && !canExecuteBetdexQuote || isOnchainBalanceInsufficient);
14453
15552
  const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
14454
- const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance;
15553
+ const shouldShowInsufficientBalanceAlert = isInsufficientBalance || isQuoteInsufficientBalance && !canExecuteBetdexQuote;
14455
15554
  const insufficientBalanceDetails = isQuoteInsufficientBalance && (activeQuoteData == null ? void 0 : activeQuoteData.error) && activeQuoteData.error !== tradingLabels.insufficientBalance ? activeQuoteData.error : null;
14456
15555
  const isSelectedVenueInventoryInsufficient = isSell && (selectedRouteCard == null ? void 0 : selectedRouteCard.kind) === "venue" && selectedRouteCard.insufficientInventory === true;
14457
15556
  const isBelowClientMinimum = !isSell && hasEnteredAmount && internalAmount < MIN_BUY_ORDER_AMOUNT;
14458
15557
  const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
14459
15558
  const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
14460
15559
  const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
14461
- const quoteStatus = (0, import_react23.useMemo)(() => {
15560
+ const quoteStatus = (0, import_react26.useMemo)(() => {
14462
15561
  if (!orderEligibility.canPlaceOrder) return void 0;
14463
15562
  return resolvePlaceOrderQuoteStatus({
14464
15563
  amount: internalAmount,
@@ -14475,7 +15574,7 @@ var PlaceOrder = ({
14475
15574
  scopedSelectedMarket,
14476
15575
  tradingLabels
14477
15576
  ]);
14478
- const smartRouteErrorMessage = (0, import_react23.useMemo)(() => {
15577
+ const smartRouteErrorMessage = (0, import_react26.useMemo)(() => {
14479
15578
  var _a2;
14480
15579
  const quoteError = (_a2 = smartRoute.error) != null ? _a2 : isSell ? venueSellQuotes.error : null;
14481
15580
  if (!quoteError || orderedRouteCards.length > 0) return null;
@@ -14486,26 +15585,26 @@ var PlaceOrder = ({
14486
15585
  });
14487
15586
  }, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
14488
15587
  const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
14489
- const retryRemainingAmount = (0, import_react23.useMemo)(() => {
15588
+ const retryRemainingAmount = (0, import_react26.useMemo)(() => {
14490
15589
  return getCanonicalPlaceOrderUnfilledRemaining({
14491
15590
  originalAmount: internalAmount,
14492
15591
  tradeSide: internalTab,
14493
15592
  terminalOrderEvents: executionProgress.terminalOrderEvents
14494
15593
  });
14495
15594
  }, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
14496
- const canRetryRemaining = (0, import_react23.useMemo)(() => {
15595
+ const canRetryRemaining = (0, import_react26.useMemo)(() => {
14497
15596
  if (retryRemainingAmount == null) return false;
14498
15597
  const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
14499
15598
  return retryRemainingAmount >= minRemainder;
14500
15599
  }, [isSell, retryRemainingAmount]);
14501
15600
  const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
14502
- const shouldAutoSkipPartialFill = (0, import_react23.useMemo)(() => {
15601
+ const shouldAutoSkipPartialFill = (0, import_react26.useMemo)(() => {
14503
15602
  if (internalAmount <= 0 || retryRemainingAmount == null) return false;
14504
15603
  const filled = Math.max(0, internalAmount - retryRemainingAmount);
14505
15604
  const fillRatio = filled / internalAmount;
14506
15605
  return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
14507
15606
  }, [canRetryRemaining, internalAmount, retryRemainingAmount]);
14508
- const failureSummary = (0, import_react23.useMemo)(() => {
15607
+ const failureSummary = (0, import_react26.useMemo)(() => {
14509
15608
  var _a2;
14510
15609
  if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
14511
15610
  const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
@@ -14578,21 +15677,21 @@ var PlaceOrder = ({
14578
15677
  submissionProgressState,
14579
15678
  tradingLabels
14580
15679
  ]);
14581
- const displayedToWinHint = (0, import_react23.useMemo)(() => {
15680
+ const displayedToWinHint = (0, import_react26.useMemo)(() => {
14582
15681
  if (!selectedRouteCard) return "";
14583
15682
  const averagePrice = selectedRouteCard.executionPrice;
14584
15683
  return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
14585
15684
  }, [selectedRouteCard, tradingLabels]);
14586
- const displayedToWinValue = (_aa = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _aa : 0;
14587
- const originalLimitPriceRaw = (0, import_react23.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
14588
- const limitPriceAdjustmentByVenue = (0, import_react23.useMemo)(() => {
15685
+ const displayedToWinValue = (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _ba : 0;
15686
+ const originalLimitPriceRaw = (0, import_react26.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
15687
+ const limitPriceAdjustmentByVenue = (0, import_react26.useMemo)(() => {
14589
15688
  var _a2;
14590
15689
  const adjustments = /* @__PURE__ */ new Map();
14591
15690
  for (const option of visibleLimitVenueOptions) {
14592
15691
  try {
14593
15692
  adjustments.set(
14594
15693
  option.venue,
14595
- (0, import_sdk21.adjustLimitPriceRawToTick)({
15694
+ (0, import_sdk22.adjustLimitPriceRawToTick)({
14596
15695
  limitPriceRaw: originalLimitPriceRaw,
14597
15696
  side: internalTab,
14598
15697
  tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
@@ -14601,7 +15700,7 @@ var PlaceOrder = ({
14601
15700
  } catch (e) {
14602
15701
  adjustments.set(
14603
15702
  option.venue,
14604
- (0, import_sdk21.adjustLimitPriceRawToTick)({
15703
+ (0, import_sdk22.adjustLimitPriceRawToTick)({
14605
15704
  limitPriceRaw: originalLimitPriceRaw,
14606
15705
  side: internalTab,
14607
15706
  tickSize: null
@@ -14612,14 +15711,14 @@ var PlaceOrder = ({
14612
15711
  return adjustments;
14613
15712
  }, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
14614
15713
  const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
14615
- const selectedLimitPriceRaw = (_ba = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _ba : originalLimitPriceRaw;
14616
- const limitPriceAdjustmentMessage = (0, import_react23.useMemo)(() => {
15714
+ const selectedLimitPriceRaw = (_ca = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _ca : originalLimitPriceRaw;
15715
+ const limitPriceAdjustmentMessage = (0, import_react26.useMemo)(() => {
14617
15716
  if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
14618
15717
  return "";
14619
15718
  }
14620
15719
  return tradingLabels.limitPriceAdjusted(
14621
15720
  [getTradingVenueLabel(selectedLimitVenueOption.venue)],
14622
- Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE) * 100,
15721
+ Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE) * 100,
14623
15722
  formatLimitPriceRawLabel(originalLimitPriceRaw),
14624
15723
  internalTab,
14625
15724
  formatLimitPriceRawLabel(selectedLimitPriceAdjustment.adjustedPriceRaw)
@@ -14631,11 +15730,11 @@ var PlaceOrder = ({
14631
15730
  selectedLimitVenueOption,
14632
15731
  tradingLabels
14633
15732
  ]);
14634
- const limitOrderPayload = (0, import_react23.useMemo)(() => {
15733
+ const limitOrderPayload = (0, import_react26.useMemo)(() => {
14635
15734
  if (!selectedLimitVenueOption || internalAmount <= 0) return null;
14636
15735
  if (limitPriceInputError) return null;
14637
15736
  const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
14638
- if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >= import_sdk21.LIMIT_PRICE_RAW_SCALE) return null;
15737
+ if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >= import_sdk22.LIMIT_PRICE_RAW_SCALE) return null;
14639
15738
  const expirationDate = resolveLimitExpirationDate({
14640
15739
  expirationType: limitExpirationType,
14641
15740
  customDate: limitExpirationDate,
@@ -14655,8 +15754,8 @@ var PlaceOrder = ({
14655
15754
  side: internalTab,
14656
15755
  limitPriceRaw,
14657
15756
  sizeRaw,
14658
- timeInForce: selectedLimitVenueOption.venue === import_sdk21.Venue.prophetx || limitExpirationType === "GTC" ? "GTC" : "GTD"
14659
- }, expiresAt && selectedLimitVenueOption.venue !== import_sdk21.Venue.prophetx ? { expiresAt } : {});
15757
+ timeInForce: selectedLimitVenueOption.venue === import_sdk22.Venue.prophetx || limitExpirationType === "GTC" ? "GTC" : "GTD"
15758
+ }, expiresAt && selectedLimitVenueOption.venue !== import_sdk22.Venue.prophetx ? { expiresAt } : {});
14660
15759
  }, [
14661
15760
  internalAmount,
14662
15761
  internalTab,
@@ -14667,7 +15766,7 @@ var PlaceOrder = ({
14667
15766
  selectedLimitVenueOption,
14668
15767
  selectedLimitPriceRaw
14669
15768
  ]);
14670
- const resolvedLimitExpirationDraftDate = (0, import_react23.useMemo)(() => {
15769
+ const resolvedLimitExpirationDraftDate = (0, import_react26.useMemo)(() => {
14671
15770
  return resolveLimitExpirationDate({
14672
15771
  expirationType: "CUSTOM",
14673
15772
  customDate: limitExpirationDraftDate,
@@ -14675,7 +15774,7 @@ var PlaceOrder = ({
14675
15774
  });
14676
15775
  }, [limitExpirationDraftDate, limitExpirationDraftTime]);
14677
15776
  const isLimitExpirationDraftValid = isFutureLimitExpiration(resolvedLimitExpirationDraftDate);
14678
- const resolvedCustomExpirationDate = (0, import_react23.useMemo)(() => {
15777
+ const resolvedCustomExpirationDate = (0, import_react26.useMemo)(() => {
14679
15778
  return resolveLimitExpirationDate({
14680
15779
  expirationType: "CUSTOM",
14681
15780
  customDate: limitExpirationDate,
@@ -14697,18 +15796,18 @@ var PlaceOrder = ({
14697
15796
  expiresAt: serializeLimitOrderExpiration(expirationDate)
14698
15797
  });
14699
15798
  };
14700
- const displayedLimitToWinValue = (0, import_react23.useMemo)(() => {
15799
+ const displayedLimitToWinValue = (0, import_react26.useMemo)(() => {
14701
15800
  if (!limitOrderPayload) return 0;
14702
- const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE);
15801
+ const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE);
14703
15802
  if (internalTab === "buy") return size;
14704
15803
  return Number(
14705
15804
  ceilDiv(
14706
15805
  BigInt(limitOrderPayload.limitPriceRaw) * BigInt(limitOrderPayload.sizeRaw),
14707
- import_sdk21.LIMIT_PRICE_RAW_SCALE
15806
+ import_sdk22.LIMIT_PRICE_RAW_SCALE
14708
15807
  )
14709
- ) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE);
15808
+ ) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE);
14710
15809
  }, [internalTab, limitOrderPayload]);
14711
- const limitRouteCards = (0, import_react23.useMemo)(() => {
15810
+ const limitRouteCards = (0, import_react26.useMemo)(() => {
14712
15811
  return visibleLimitVenueOptions.map((option) => {
14713
15812
  var _a2, _b2, _c2, _d2;
14714
15813
  const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
@@ -14717,7 +15816,7 @@ var PlaceOrder = ({
14717
15816
  limitPriceRaw: effectiveLimitPriceRaw,
14718
15817
  side: internalTab
14719
15818
  });
14720
- const availabilityState = (0, import_hooks46.getVenueAvailabilityState)({
15819
+ const availabilityState = (0, import_hooks51.getVenueAvailabilityState)({
14721
15820
  venueId: option.venue,
14722
15821
  disabledVenues,
14723
15822
  isConfigLoading: isAppConfigLoading
@@ -14758,7 +15857,7 @@ var PlaceOrder = ({
14758
15857
  tradingLabels,
14759
15858
  visibleLimitVenueOptions
14760
15859
  ]);
14761
- const limitVenueOptionByCardId = (0, import_react23.useMemo)(() => {
15860
+ const limitVenueOptionByCardId = (0, import_react26.useMemo)(() => {
14762
15861
  return new Map(
14763
15862
  visibleLimitVenueOptions.map((option) => [
14764
15863
  `limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
@@ -14781,13 +15880,13 @@ var PlaceOrder = ({
14781
15880
  const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
14782
15881
  const executionReserve = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.executionReserve;
14783
15882
  const executionReserveValue = typeof executionReserve === "number" && Number.isFinite(executionReserve) && executionReserve > 0 ? formatUsd(executionReserve, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null;
14784
- const estimatedFeesValue = (0, import_react23.useMemo)(() => {
15883
+ const estimatedFeesValue = (0, import_react26.useMemo)(() => {
14785
15884
  const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
14786
15885
  if (totalFees == null) return null;
14787
15886
  return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
14788
15887
  }, [activeFeeBreakdown]);
14789
- const appFeeValue = (_ca = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? _ca : 0;
14790
- const feeBreakdownRows = (0, import_react23.useMemo)(() => {
15888
+ const appFeeValue = (_da = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? _da : 0;
15889
+ const feeBreakdownRows = (0, import_react26.useMemo)(() => {
14791
15890
  var _a2;
14792
15891
  if (!activeFeeBreakdown) return [];
14793
15892
  return [
@@ -14836,16 +15935,16 @@ var PlaceOrder = ({
14836
15935
  }, [activeFeeBreakdown, appFeeValue, tradingLabels]);
14837
15936
  const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
14838
15937
  const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
14839
- const selectedLimitRouteCard = selectedLimitRouteCardId ? (_da = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _da : null : null;
14840
- const selectedRouteGeoBlocked = isLimitOrder ? (_ea = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _ea : false : (_fa = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _fa : false;
14841
- const geoBlockedVenuesFromWarnings = (0, import_react23.useMemo)(
15938
+ const selectedLimitRouteCard = selectedLimitRouteCardId ? (_ea = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _ea : null : null;
15939
+ const selectedRouteGeoBlocked = isLimitOrder ? (_fa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _fa : false : (_ga = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ga : false;
15940
+ const geoBlockedVenuesFromWarnings = (0, import_react26.useMemo)(
14842
15941
  () => {
14843
15942
  var _a2;
14844
15943
  return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
14845
15944
  },
14846
- [(_ga = smartRoute.data) == null ? void 0 : _ga.warnings]
15945
+ [(_ha = smartRoute.data) == null ? void 0 : _ha.warnings]
14847
15946
  );
14848
- const isPrimaryVenueGeoBlocked = (0, import_react23.useMemo)(() => {
15947
+ const isPrimaryVenueGeoBlocked = (0, import_react26.useMemo)(() => {
14849
15948
  var _a2, _b2;
14850
15949
  if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
14851
15950
  const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
@@ -14853,10 +15952,10 @@ var PlaceOrder = ({
14853
15952
  }, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
14854
15953
  const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
14855
15954
  const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
14856
- const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBetdexBalanceUnavailable || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
15955
+ const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isBetdexBalanceUnavailable && !canExecuteBetdexQuote || isQuoteInsufficientBalance && !canExecuteBetdexQuote || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId && !canExecuteBetdexQuote) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0 && !canExecuteBetdexQuote;
14857
15956
  const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
14858
15957
  const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
14859
- const handleReturnToOrderForm = (0, import_react23.useCallback)(() => {
15958
+ const handleReturnToOrderForm = (0, import_react26.useCallback)(() => {
14860
15959
  const submittedSelection = submittedSelectionRef.current;
14861
15960
  submittedSelectionRef.current = null;
14862
15961
  setSubmissionProgressState(null);
@@ -14878,7 +15977,7 @@ var PlaceOrder = ({
14878
15977
  const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
14879
15978
  window.open(shareUrl, "_blank", "noopener,noreferrer");
14880
15979
  };
14881
- const handleExecuteQuote = (0, import_react23.useCallback)(
15980
+ const handleExecuteQuote = (0, import_react26.useCallback)(
14882
15981
  (quoteData) => __async(null, null, function* () {
14883
15982
  var _a2, _b2, _c2;
14884
15983
  const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
@@ -14995,7 +16094,7 @@ var PlaceOrder = ({
14995
16094
  venueSellQuotes.quotes
14996
16095
  ]
14997
16096
  );
14998
- const handlePlaceLimitOrder = (0, import_react23.useCallback)(
16097
+ const handlePlaceLimitOrder = (0, import_react26.useCallback)(
14999
16098
  (submissionLimitOrderPayload) => __async(null, null, function* () {
15000
16099
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
15001
16100
  if (!showLimitOrders) return;
@@ -15014,7 +16113,7 @@ var PlaceOrder = ({
15014
16113
  payload: submissionLimitOrderPayload
15015
16114
  });
15016
16115
  }
15017
- const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE);
16116
+ const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE);
15018
16117
  const sizeLabel = size.toLocaleString("en-US", {
15019
16118
  minimumFractionDigits: 2,
15020
16119
  maximumFractionDigits: 2
@@ -15023,9 +16122,9 @@ var PlaceOrder = ({
15023
16122
  Number(
15024
16123
  ceilDiv(
15025
16124
  BigInt(submissionLimitOrderPayload.limitPriceRaw) * BigInt(submissionLimitOrderPayload.sizeRaw),
15026
- import_sdk21.LIMIT_PRICE_RAW_SCALE
16125
+ import_sdk22.LIMIT_PRICE_RAW_SCALE
15027
16126
  )
15028
- ) / Number(import_sdk21.LIMIT_PRICE_RAW_SCALE)
16127
+ ) / Number(import_sdk22.LIMIT_PRICE_RAW_SCALE)
15029
16128
  );
15030
16129
  const estimatedCost = internalTab === "buy" ? notionalLabel : sizeLabel;
15031
16130
  const orderAmountLabel = internalTab === "buy" ? notionalLabel : tradingLabels.executionShares(sizeLabel);
@@ -15042,7 +16141,7 @@ var PlaceOrder = ({
15042
16141
  const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
15043
16142
  const eventTitle = (_b2 = (_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _a2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _b2 : "";
15044
16143
  const eventDateSource = (_c2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _c2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
15045
- const responseVenue = import_sdk21.Venue[response.venue];
16144
+ const responseVenue = import_sdk22.Venue[response.venue];
15046
16145
  setSubmissionProgressState({
15047
16146
  orderId: response.orderId,
15048
16147
  orderIds: [response.orderId],
@@ -15090,7 +16189,7 @@ var PlaceOrder = ({
15090
16189
  tradingLabels
15091
16190
  ]
15092
16191
  );
15093
- const handleSkipToSuccess = (0, import_react23.useCallback)(() => {
16192
+ const handleSkipToSuccess = (0, import_react26.useCallback)(() => {
15094
16193
  const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
15095
16194
  (e) => e.event === "filled" || e.event === "partial_fill"
15096
16195
  );
@@ -15115,7 +16214,7 @@ var PlaceOrder = ({
15115
16214
  failureSummary,
15116
16215
  selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
15117
16216
  ]);
15118
- (0, import_react23.useEffect)(() => {
16217
+ (0, import_react26.useEffect)(() => {
15119
16218
  if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
15120
16219
  if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
15121
16220
  if (!shouldAutoSkipPartialFill) return;
@@ -15126,7 +16225,7 @@ var PlaceOrder = ({
15126
16225
  shouldAutoSkipPartialFill,
15127
16226
  submissionProgressState == null ? void 0 : submissionProgressState.phase
15128
16227
  ]);
15129
- const handleRetrySubmission = (0, import_react23.useCallback)(() => __async(null, null, function* () {
16228
+ const handleRetrySubmission = (0, import_react26.useCallback)(() => __async(null, null, function* () {
15130
16229
  var _a2, _b2, _c2, _d2, _e2;
15131
16230
  if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
15132
16231
  handleReturnToOrderForm();
@@ -15276,7 +16375,7 @@ var PlaceOrder = ({
15276
16375
  ]);
15277
16376
  const resolvedStatusClassName = cn(classNames == null ? void 0 : classNames.root, className);
15278
16377
  if (isLoading) {
15279
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16378
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15280
16379
  Skeleton,
15281
16380
  {
15282
16381
  ariaLabel: labels.common.loading,
@@ -15287,7 +16386,7 @@ var PlaceOrder = ({
15287
16386
  }
15288
16387
  if (submissionProgressState) {
15289
16388
  if (submissionProgressState.phase === "success" && submissionProgressState.summary) {
15290
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16389
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15291
16390
  PlaceOrderSuccessView,
15292
16391
  {
15293
16392
  className: resolvedStatusClassName,
@@ -15299,7 +16398,7 @@ var PlaceOrder = ({
15299
16398
  );
15300
16399
  }
15301
16400
  if (submissionProgressState.phase === "failed") {
15302
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16401
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15303
16402
  PlaceOrderFailureView,
15304
16403
  {
15305
16404
  className: resolvedStatusClassName,
@@ -15312,7 +16411,7 @@ var PlaceOrder = ({
15312
16411
  }
15313
16412
  );
15314
16413
  }
15315
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16414
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15316
16415
  PlaceOrderExecutionView,
15317
16416
  {
15318
16417
  className,
@@ -15540,11 +16639,11 @@ var PlaceOrder = ({
15540
16639
  }
15541
16640
  });
15542
16641
  if (isEndedWithoutKnownWinner || !orderEligibility.canPlaceOrder && resolvedReadOnlyTradingState.kind !== "open") {
15543
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16642
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15544
16643
  PlaceOrderResolvedView,
15545
16644
  {
15546
16645
  tradingState: resolvedReadOnlyTradingState,
15547
- resolutionTimestamp: (_ha = resolvedEventTradingState.resolvesAt) != null ? _ha : resolvedReadOnlyTradingState.resolvesAt,
16646
+ resolutionTimestamp: (_ia = resolvedEventTradingState.resolvesAt) != null ? _ia : resolvedReadOnlyTradingState.resolvesAt,
15548
16647
  resolvedClaim,
15549
16648
  classNames,
15550
16649
  className,
@@ -15553,8 +16652,8 @@ var PlaceOrder = ({
15553
16652
  }
15554
16653
  );
15555
16654
  }
15556
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_react23.Fragment, { children: [
15557
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16655
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_react26.Fragment, { children: [
16656
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15558
16657
  Card,
15559
16658
  {
15560
16659
  className: cn(
@@ -15569,23 +16668,23 @@ var PlaceOrder = ({
15569
16668
  headerSubtitle,
15570
16669
  headerImage,
15571
16670
  headerTitle,
15572
- headerVenue: (_ia = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) != null ? _ia : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venue,
16671
+ headerVenue: (_ja = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) != null ? _ja : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venue,
15573
16672
  onClose
15574
16673
  }),
15575
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
15576
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16674
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: cn("agg-order-panel-content flex flex-col gap-6", classNames == null ? void 0 : classNames.content), children: [
16675
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15577
16676
  "div",
15578
16677
  {
15579
16678
  className: "agg-order-tabs flex items-end border-b border-agg-separator",
15580
16679
  role: "tablist",
15581
16680
  "aria-label": labels.common.tabsAria,
15582
16681
  children: [
15583
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex min-w-0 flex-1 items-end", children: [
16682
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex min-w-0 flex-1 items-end", children: [
15584
16683
  { value: "buy", label: tradingLabels.buy, ref: buyTabRef },
15585
16684
  { value: "sell", label: tradingLabels.sell, ref: sellTabRef }
15586
16685
  ].map((tabItem) => {
15587
16686
  const isActive = internalTab === tabItem.value;
15588
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16687
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15589
16688
  "button",
15590
16689
  {
15591
16690
  ref: tabItem.ref,
@@ -15609,7 +16708,7 @@ var PlaceOrder = ({
15609
16708
  onKeyDown: (event) => handleTabKeyDown(event, tabItem.value),
15610
16709
  children: [
15611
16710
  tabItem.label,
15612
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16711
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15613
16712
  "span",
15614
16713
  {
15615
16714
  "aria-hidden": "true",
@@ -15629,7 +16728,7 @@ var PlaceOrder = ({
15629
16728
  tabItem.value
15630
16729
  );
15631
16730
  }) }),
15632
- showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16731
+ showLimitOrders ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15633
16732
  Select,
15634
16733
  {
15635
16734
  ariaLabel: tradingLabels.orderTypeAria,
@@ -15650,8 +16749,8 @@ var PlaceOrder = ({
15650
16749
  ]
15651
16750
  }
15652
16751
  ),
15653
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
15654
- outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
16752
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-entry-section flex flex-col gap-4", children: [
16753
+ outcomes.length >= 2 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-outcomes flex w-full max-w-full gap-2", children: outcomes.map((outcome, index) => {
15655
16754
  var _a2, _b2, _c2;
15656
16755
  const price = getDisplayOutcomePrice({
15657
16756
  outcomeId: outcome.id,
@@ -15665,7 +16764,7 @@ var PlaceOrder = ({
15665
16764
  const isActive = outcome.id === scopedSelectedOutcomeId;
15666
16765
  const isPositive = resolveIsPositiveOutcome(outcome, index);
15667
16766
  const isPriceLoading = clusterMidpointResult.isLoading && price == null;
15668
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16767
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15669
16768
  "button",
15670
16769
  {
15671
16770
  "data-id": outcome.id,
@@ -15685,7 +16784,7 @@ var PlaceOrder = ({
15685
16784
  disabled: !orderEligibility.canPlaceOrder || isResolvedOutcomeCtaLocked,
15686
16785
  onClick: () => handleOutcomeChange(outcome.id),
15687
16786
  children: [
15688
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16787
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15689
16788
  Typography,
15690
16789
  {
15691
16790
  as: "span",
@@ -15694,7 +16793,7 @@ var PlaceOrder = ({
15694
16793
  children: (_c2 = outcome.title) != null ? _c2 : outcome.label
15695
16794
  }
15696
16795
  ),
15697
- isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16796
+ isPriceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15698
16797
  "span",
15699
16798
  {
15700
16799
  "aria-hidden": "true",
@@ -15703,18 +16802,18 @@ var PlaceOrder = ({
15703
16802
  "h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
15704
16803
  )
15705
16804
  }
15706
- ) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
16805
+ ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price, formatPrice) })
15707
16806
  ]
15708
16807
  },
15709
16808
  outcome.id
15710
16809
  );
15711
16810
  }) }) : null,
15712
- isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
15713
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
15714
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
15715
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-2", children: [
15716
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("label", { className: "relative flex items-center", children: [
15717
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16811
+ isLimitOrder ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-limit-price-section flex items-center justify-between gap-4", children: [
16812
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.limitPrice }),
16813
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex min-w-0 flex-col items-end gap-1", children: [
16814
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-2", children: [
16815
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("label", { className: "relative flex items-center", children: [
16816
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15718
16817
  "input",
15719
16818
  {
15720
16819
  type: "text",
@@ -15731,40 +16830,40 @@ var PlaceOrder = ({
15731
16830
  )
15732
16831
  }
15733
16832
  ),
15734
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
16833
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "pointer-events-none absolute right-1 text-agg-3xl font-agg-bold leading-agg-9 text-agg-foreground", children: "\xA2" })
15735
16834
  ] }),
15736
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16835
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15737
16836
  "button",
15738
16837
  {
15739
16838
  type: "button",
15740
16839
  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",
15741
16840
  "aria-label": tradingLabels.limitPriceDecreaseAria,
15742
16841
  onClick: () => handleLimitPriceStep("decrease"),
15743
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
16842
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "minus", size: "small", className: "h-4 w-4", "aria-hidden": true })
15744
16843
  }
15745
16844
  ),
15746
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16845
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15747
16846
  "button",
15748
16847
  {
15749
16848
  type: "button",
15750
16849
  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",
15751
16850
  "aria-label": tradingLabels.limitPriceIncreaseAria,
15752
16851
  onClick: () => handleLimitPriceStep("increase"),
15753
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
16852
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Icon, { name: "plus", size: "small", className: "h-4 w-4", "aria-hidden": true })
15754
16853
  }
15755
16854
  )
15756
16855
  ] }),
15757
- limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
16856
+ limitPriceInputError ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "max-w-[220px] text-right text-agg-xs leading-agg-4 text-agg-error", children: limitPriceInputError }) : null
15758
16857
  ] })
15759
16858
  ] }) : null,
15760
- isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16859
+ isLimitOrder && limitPriceAdjustmentMessage ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15761
16860
  "div",
15762
16861
  {
15763
16862
  className: "agg-limit-price-adjustment flex w-full items-center gap-2 rounded-agg-lg bg-agg-warning/10 px-3 py-2",
15764
16863
  role: "status",
15765
16864
  "aria-live": "polite",
15766
16865
  children: [
15767
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16866
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15768
16867
  Icon,
15769
16868
  {
15770
16869
  name: "warning-filled",
@@ -15773,16 +16872,16 @@ var PlaceOrder = ({
15773
16872
  "aria-hidden": "true"
15774
16873
  }
15775
16874
  ),
15776
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
16875
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "min-w-0 flex-1 wrap-break-word text-agg-sm leading-agg-5 text-agg-foreground", children: limitPriceAdjustmentMessage })
15777
16876
  ]
15778
16877
  }
15779
16878
  ) : null,
15780
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
15781
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
15782
- /* @__PURE__ */ (0, import_jsx_runtime152.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) }),
15783
- isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime152.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_runtime152.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
15784
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
15785
- displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16879
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-section flex items-start justify-between gap-4", children: [
16880
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-amount-meta flex flex-col", children: [
16881
+ /* @__PURE__ */ (0, import_jsx_runtime158.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) }),
16882
+ isAuthenticated ? isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.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_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
16883
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "whitespace-pre", children: displayedCurrentSellableSharesLabel }),
16884
+ displayedCurrentSellableShares > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15786
16885
  "button",
15787
16886
  {
15788
16887
  type: "button",
@@ -15798,12 +16897,12 @@ var PlaceOrder = ({
15798
16897
  children: tradingLabels.maxShares
15799
16898
  }
15800
16899
  ) : null
15801
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "agg-balance-value flex flex-col items-end gap-1 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
15802
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: !isPaperMode && isBetdexOnlyRoute ? betdexBalanceLabel : tradingLabels.balance(formatUsd(displayedBalance)) }),
15803
- !isPaperMode && isBetdexRoute && !isBetdexOnlyRoute ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: betdexBalanceLabel }) : null
16900
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-balance-value flex flex-col items-end gap-1 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(LoadingIcon, { size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
16901
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: !isPaperMode && isBetdexOnlyRoute && betdexAvailableBalance === null ? betdexBalanceLabel : tradingLabels.balance(formatUsd(displayedBalance)) }),
16902
+ !isPaperMode && isBetdexRoute && !isBetdexOnlyRoute ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: betdexBalanceLabel }) : null
15804
16903
  ] }) }) : null
15805
16904
  ] }),
15806
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16905
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15807
16906
  CurrencyInput,
15808
16907
  {
15809
16908
  value: internalAmount,
@@ -15825,10 +16924,10 @@ var PlaceOrder = ({
15825
16924
  }
15826
16925
  )
15827
16926
  ] }),
15828
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(import_jsx_runtime152.Fragment, { children: [
15829
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
15830
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-1.5", children: [
15831
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16927
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && estimatedFeesValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [
16928
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-fees-section flex items-center justify-between gap-4", children: [
16929
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
16930
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15832
16931
  Typography,
15833
16932
  {
15834
16933
  variant: "text-sm",
@@ -15836,7 +16935,7 @@ var PlaceOrder = ({
15836
16935
  children: tradingLabels.estimatedFees
15837
16936
  }
15838
16937
  ),
15839
- feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16938
+ feeBreakdownRows.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15840
16939
  Tooltip,
15841
16940
  {
15842
16941
  "aria-label": tradingLabels.estimatedFeesTooltipAria,
@@ -15848,13 +16947,13 @@ var PlaceOrder = ({
15848
16947
  icon: "h-3 w-3 text-agg-muted-foreground",
15849
16948
  trigger: "h-3 w-3 text-agg-muted-foreground"
15850
16949
  },
15851
- content: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
16950
+ content: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "flex w-full flex-col gap-2", children: feeBreakdownRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15852
16951
  "div",
15853
16952
  {
15854
16953
  className: "flex items-center justify-between gap-3 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground",
15855
16954
  children: [
15856
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: row.label }),
15857
- row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16955
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: row.label }),
16956
+ row.kind === "badge" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15858
16957
  "span",
15859
16958
  {
15860
16959
  className: cn(
@@ -15864,7 +16963,7 @@ var PlaceOrder = ({
15864
16963
  ),
15865
16964
  children: row.badgeLabel
15866
16965
  }
15867
- ) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-right", children: row.value })
16966
+ ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-right", children: row.value })
15868
16967
  ]
15869
16968
  },
15870
16969
  row.label
@@ -15872,9 +16971,9 @@ var PlaceOrder = ({
15872
16971
  }
15873
16972
  ) : null
15874
16973
  ] }),
15875
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
16974
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: estimatedFeesValue })
15876
16975
  ] }),
15877
- (activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === import_sdk21.Venue.betdex)) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16976
+ (activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === import_sdk22.Venue.betdex)) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15878
16977
  Typography,
15879
16978
  {
15880
16979
  variant: "text-sm",
@@ -15883,9 +16982,9 @@ var PlaceOrder = ({
15883
16982
  }
15884
16983
  ) : null
15885
16984
  ] }) : null,
15886
- showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && executionReserveValue ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-reserve-section flex items-center justify-between gap-4", children: [
15887
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-1.5", children: [
15888
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16985
+ showFeesBreakdown && hasEnteredAmount && !isBelowMinimum && executionReserveValue ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-reserve-section flex items-center justify-between gap-4", children: [
16986
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-1.5", children: [
16987
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15889
16988
  Typography,
15890
16989
  {
15891
16990
  variant: "text-sm",
@@ -15893,7 +16992,7 @@ var PlaceOrder = ({
15893
16992
  children: tradingLabels.executionReserve
15894
16993
  }
15895
16994
  ),
15896
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16995
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15897
16996
  Tooltip,
15898
16997
  {
15899
16998
  "aria-label": tradingLabels.executionReserveTooltipAria,
@@ -15906,18 +17005,18 @@ var PlaceOrder = ({
15906
17005
  }
15907
17006
  )
15908
17007
  ] }),
15909
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: executionReserveValue })
17008
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: executionReserveValue })
15910
17009
  ] }) : null
15911
17010
  ] }),
15912
- shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17011
+ shouldShowSmartRouting ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15913
17012
  "div",
15914
17013
  {
15915
17014
  className: "agg-route-panel flex flex-col gap-3",
15916
17015
  "aria-busy": !isLimitOrder && isQuoteLoading,
15917
17016
  children: [
15918
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
15919
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
15920
- shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17017
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-panel-header flex items-center justify-between gap-4", children: [
17018
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-route-panel-title text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.smartRouting }),
17019
+ shouldShowRouteToggle && !isRoutesExpanded ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15921
17020
  "button",
15922
17021
  {
15923
17022
  type: "button",
@@ -15925,8 +17024,8 @@ var PlaceOrder = ({
15925
17024
  "aria-label": tradingLabels.viewAllRoutes(activeRouteCardCount),
15926
17025
  onClick: () => setIsRoutesExpanded((currentValue) => !currentValue),
15927
17026
  children: [
15928
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
15929
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17027
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { children: tradingLabels.viewAllRoutes(activeRouteCardCount) }),
17028
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15930
17029
  Icon,
15931
17030
  {
15932
17031
  name: "chevron-down",
@@ -15939,11 +17038,11 @@ var PlaceOrder = ({
15939
17038
  }
15940
17039
  ) : null
15941
17040
  ] }),
15942
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading && activeRouteCards.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
15943
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PlaceOrderRouteCardSkeleton, {}),
15944
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(PlaceOrderRouteCardSkeleton, {})
17041
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "agg-route-list flex flex-col gap-2", children: !isLimitOrder && isQuoteLoading && activeRouteCards.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-route-loading flex flex-col gap-2", "aria-hidden": "true", children: [
17042
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {}),
17043
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(PlaceOrderRouteCardSkeleton, {})
15945
17044
  ] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
15946
- return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_react23.Fragment, { children: renderRouteCard({
17045
+ return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(import_react26.Fragment, { children: renderRouteCard({
15947
17046
  card,
15948
17047
  enableAnimations,
15949
17048
  isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
@@ -15957,15 +17056,15 @@ var PlaceOrder = ({
15957
17056
  ]
15958
17057
  }
15959
17058
  ) : null,
15960
- isLimitOrder && (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) !== import_sdk21.Venue.prophetx ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
15961
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
15962
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17059
+ isLimitOrder && (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) !== import_sdk22.Venue.prophetx ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-limit-expiration-section flex items-center justify-between gap-4", children: [
17060
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.expiration }),
17061
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15963
17062
  Popover.Root,
15964
17063
  {
15965
17064
  open: isLimitExpirationPickerOpen,
15966
17065
  onOpenChange: handleLimitExpirationPickerOpenChange,
15967
17066
  children: [
15968
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17067
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
15969
17068
  "button",
15970
17069
  {
15971
17070
  ref: expirationTriggerRef,
@@ -15973,10 +17072,10 @@ var PlaceOrder = ({
15973
17072
  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",
15974
17073
  "aria-label": tradingLabels.expirationMenuAria,
15975
17074
  children: [
15976
- /* @__PURE__ */ (0, import_jsx_runtime152.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_dayjs5.default)(resolvedCustomExpirationDate).format(
17075
+ /* @__PURE__ */ (0, import_jsx_runtime158.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_dayjs5.default)(resolvedCustomExpirationDate).format(
15977
17076
  "MMM D, YYYY [at] HH:mm"
15978
17077
  ) : tradingLabels.expirationCustom }),
15979
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17078
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15980
17079
  Icon,
15981
17080
  {
15982
17081
  name: isLimitExpirationPickerOpen ? "chevron-up" : "chevron-down",
@@ -15988,11 +17087,11 @@ var PlaceOrder = ({
15988
17087
  ]
15989
17088
  }
15990
17089
  ) }),
15991
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17090
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15992
17091
  Popover.Portal,
15993
17092
  {
15994
17093
  container: resolvePlaceOrderPortalContainer(expirationTriggerRef.current),
15995
- children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17094
+ children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
15996
17095
  Popover.Content,
15997
17096
  {
15998
17097
  align: "end",
@@ -16001,14 +17100,14 @@ var PlaceOrder = ({
16001
17100
  role: "dialog",
16002
17101
  "aria-label": tradingLabels.expirationMenuAria,
16003
17102
  className: "z-50 max-h-[calc(100dvh-2rem)] w-[min(312px,calc(100vw-2rem))] overflow-y-auto rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-[0_8px_16px_rgba(0,0,0,0.20)]",
16004
- children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex flex-col gap-3 p-4", children: [
16005
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17103
+ children: limitExpirationPickerView === "calendar" ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex flex-col gap-3 p-4", children: [
17104
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16006
17105
  Button,
16007
17106
  {
16008
17107
  variant: "tertiary",
16009
17108
  size: "small",
16010
17109
  className: "w-fit px-0",
16011
- prefix: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17110
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16012
17111
  Icon,
16013
17112
  {
16014
17113
  name: "chevron-left",
@@ -16021,7 +17120,7 @@ var PlaceOrder = ({
16021
17120
  children: tradingLabels.expirationOptions
16022
17121
  }
16023
17122
  ),
16024
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17123
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16025
17124
  Calendar,
16026
17125
  {
16027
17126
  mode: "single",
@@ -16036,9 +17135,9 @@ var PlaceOrder = ({
16036
17135
  }
16037
17136
  }
16038
17137
  ),
16039
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex items-center gap-4", children: [
16040
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
16041
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17138
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex items-center gap-4", children: [
17139
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex shrink-0 flex-col gap-0.5", children: [
17140
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16042
17141
  "label",
16043
17142
  {
16044
17143
  htmlFor: expirationTimeInputId,
@@ -16046,9 +17145,9 @@ var PlaceOrder = ({
16046
17145
  children: tradingLabels.expirationStartTime
16047
17146
  }
16048
17147
  ),
16049
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
17148
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: tradingLabels.expirationStartTimeHint })
16050
17149
  ] }),
16051
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17150
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16052
17151
  "input",
16053
17152
  {
16054
17153
  id: expirationTimeInputId,
@@ -16059,8 +17158,8 @@ var PlaceOrder = ({
16059
17158
  }
16060
17159
  )
16061
17160
  ] }),
16062
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "flex gap-2", children: [
16063
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17161
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "flex gap-2", children: [
17162
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16064
17163
  Button,
16065
17164
  {
16066
17165
  variant: "secondary",
@@ -16070,13 +17169,13 @@ var PlaceOrder = ({
16070
17169
  children: tradingLabels.expirationCancel
16071
17170
  }
16072
17171
  ),
16073
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17172
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16074
17173
  Button,
16075
17174
  {
16076
17175
  size: "small",
16077
17176
  className: "min-w-0 flex-1",
16078
17177
  disabled: !isLimitExpirationDraftValid,
16079
- prefix: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17178
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16080
17179
  Icon,
16081
17180
  {
16082
17181
  name: "success-check",
@@ -16090,7 +17189,7 @@ var PlaceOrder = ({
16090
17189
  }
16091
17190
  )
16092
17191
  ] })
16093
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17192
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16094
17193
  "div",
16095
17194
  {
16096
17195
  role: "radiogroup",
@@ -16108,7 +17207,7 @@ var PlaceOrder = ({
16108
17207
  { value: "ONE_HOUR", label: tradingLabels.expirationOneHour },
16109
17208
  { value: "END_OF_DAY", label: tradingLabels.expirationEndOfDay },
16110
17209
  { value: "CUSTOM", label: tradingLabels.expirationCustom }
16111
- ].map((item, optionIndex) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17210
+ ].map((item, optionIndex) => /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
16112
17211
  "button",
16113
17212
  {
16114
17213
  ref: (element) => {
@@ -16125,14 +17224,14 @@ var PlaceOrder = ({
16125
17224
  onClick: () => handleLimitExpirationTypeChange(item.value),
16126
17225
  onKeyDown: (event) => handleLimitExpirationOptionKeyDown(event, optionIndex),
16127
17226
  children: [
16128
- limitExpirationType === item.value ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17227
+ limitExpirationType === item.value ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16129
17228
  "span",
16130
17229
  {
16131
17230
  className: "absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
16132
17231
  "aria-hidden": true
16133
17232
  }
16134
17233
  ) : null,
16135
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "truncate", children: item.label })
17234
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "truncate", children: item.label })
16136
17235
  ]
16137
17236
  },
16138
17237
  item.value
@@ -16147,13 +17246,13 @@ var PlaceOrder = ({
16147
17246
  }
16148
17247
  )
16149
17248
  ] }) : null,
16150
- hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
16151
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-summary-meta flex flex-col", children: [
16152
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
16153
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
17249
+ hasEnteredAmount && (isLimitOrder ? limitOrderPayload : selectedRouteCard) && !isQuoteLoading && !isBelowMinimum && orderEligibility.canPlaceOrder ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-summary flex items-start justify-between gap-4", children: [
17250
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-summary-meta flex flex-col", children: [
17251
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-summary-label text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.toWin(internalTab) }),
17252
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
16154
17253
  ] }),
16155
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16156
- import_react22.default,
17254
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
17255
+ import_react25.default,
16157
17256
  {
16158
17257
  value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
16159
17258
  locales: locale,
@@ -16167,7 +17266,7 @@ var PlaceOrder = ({
16167
17266
  }
16168
17267
  )
16169
17268
  ] }) : null,
16170
- /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17269
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
16171
17270
  "div",
16172
17271
  {
16173
17272
  className: cn(
@@ -16175,17 +17274,17 @@ var PlaceOrder = ({
16175
17274
  classNames == null ? void 0 : classNames.footer
16176
17275
  ),
16177
17276
  children: [
16178
- !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
16179
- submissionFeedback ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17277
+ !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-alerts flex flex-col gap-3 empty:hidden mb-3", children: [
17278
+ submissionFeedback ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16180
17279
  InlineAlert,
16181
17280
  {
16182
17281
  tone: submissionFeedback.tone,
16183
17282
  message: submissionFeedback.message
16184
17283
  }
16185
17284
  ) : null,
16186
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
16187
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
16188
- !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17285
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(InlineAlert, { tone: "error", message: belowMinimumMessage }) : null,
17286
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && quoteStatus ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(InlineAlert, { tone: quoteStatus.tone, message: quoteStatus.message }) : null,
17287
+ !submissionFeedback && orderEligibility.canPlaceOrder && !isInsufficientBalance && !isBelowMinimum && !quoteStatus && hasEnteredAmount && smartRouteErrorMessage ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16189
17288
  InlineAlert,
16190
17289
  {
16191
17290
  tone: "error",
@@ -16197,14 +17296,14 @@ var PlaceOrder = ({
16197
17296
  }
16198
17297
  ) : null
16199
17298
  ] }) : null,
16200
- !submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsSharedKycVerification && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(
17299
+ !submissionFeedback && !shouldShowGeoBlockBanner && orderEligibility.canPlaceOrder && !needsSharedKycVerification && !needsKalshiConnection && shouldShowInsufficientBalanceAlert ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(
16201
17300
  "div",
16202
17301
  {
16203
17302
  className: "agg-order-insufficient-balance-alert flex items-center justify-center gap-2",
16204
17303
  role: "status",
16205
17304
  "aria-live": "polite",
16206
17305
  children: [
16207
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17306
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16208
17307
  Icon,
16209
17308
  {
16210
17309
  name: "warning-filled",
@@ -16213,8 +17312,8 @@ var PlaceOrder = ({
16213
17312
  "aria-hidden": "true"
16214
17313
  }
16215
17314
  ),
16216
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
16217
- insufficientBalanceDetails ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17315
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "text-agg-sm text-agg-foreground", children: tradingLabels.insufficientBalance }),
17316
+ insufficientBalanceDetails ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16218
17317
  Tooltip,
16219
17318
  {
16220
17319
  "aria-label": tradingLabels.insufficientBalanceDetails,
@@ -16230,7 +17329,7 @@ var PlaceOrder = ({
16230
17329
  ]
16231
17330
  }
16232
17331
  ) : null,
16233
- !submissionFeedback && !shouldShowGeoBlockBanner && needsSharedKycVerification ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17332
+ !submissionFeedback && !shouldShowGeoBlockBanner && needsSharedKycVerification ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16234
17333
  Button,
16235
17334
  {
16236
17335
  size: "large",
@@ -16244,7 +17343,7 @@ var PlaceOrder = ({
16244
17343
  },
16245
17344
  children: sharedKyc.status === "loading" ? tradingLabels.sharedKyc.checkingStatus : tradingLabels.sharedKyc.completeToTrade
16246
17345
  }
16247
- ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsProphetxConnection ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17346
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsProphetxConnection ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16248
17347
  Button,
16249
17348
  {
16250
17349
  size: "large",
@@ -16252,7 +17351,7 @@ var PlaceOrder = ({
16252
17351
  onClick: () => setIsConnectProphetxModalOpen(true),
16253
17352
  children: tradingLabels.connectProphetx
16254
17353
  }
16255
- ) : !submissionFeedback && isProphetxDirectRoute && isSell ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Button, { size: "large", className: "h-12 w-full", disabled: true, children: tradingLabels.prophetxSettlementNotice }) : !submissionFeedback && !shouldShowGeoBlockBanner && isProphetxBalanceInsufficient ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17354
+ ) : !submissionFeedback && isProphetxDirectRoute && isSell ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Button, { size: "large", className: "h-12 w-full", disabled: true, children: tradingLabels.prophetxSettlementNotice }) : !submissionFeedback && !shouldShowGeoBlockBanner && isProphetxBalanceInsufficient ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16256
17355
  "a",
16257
17356
  {
16258
17357
  className: "flex h-12 w-full items-center justify-center rounded-agg-md bg-agg-primary text-agg-on-primary",
@@ -16261,7 +17360,7 @@ var PlaceOrder = ({
16261
17360
  rel: "noopener noreferrer",
16262
17361
  children: tradingLabels.prophetxFundingNotice
16263
17362
  }
16264
- ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17363
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && needsKalshiConnection ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16265
17364
  Button,
16266
17365
  {
16267
17366
  size: "large",
@@ -16271,17 +17370,7 @@ var PlaceOrder = ({
16271
17370
  onClick: () => setIsConnectKalshiModalOpen(true),
16272
17371
  children: tradingLabels.connectKalshi
16273
17372
  }
16274
- ) : !submissionFeedback && !shouldShowGeoBlockBanner && (isInsufficientBalance || needsBetdexAccount) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
16275
- Button,
16276
- {
16277
- size: "large",
16278
- variant: "primary",
16279
- className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
16280
- "aria-label": isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit,
16281
- onClick: handleDepositRequiredClick,
16282
- children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit
16283
- }
16284
- ) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17373
+ ) : isQuoteLoading && !isActionLoading ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16285
17374
  Button,
16286
17375
  {
16287
17376
  size: "large",
@@ -16290,7 +17379,7 @@ var PlaceOrder = ({
16290
17379
  disabled: true,
16291
17380
  "aria-live": "polite",
16292
17381
  "aria-label": routeLoadingMessage != null ? routeLoadingMessage : labels.common.loading,
16293
- prefix: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17382
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16294
17383
  "span",
16295
17384
  {
16296
17385
  className: cn(
@@ -16302,7 +17391,17 @@ var PlaceOrder = ({
16302
17391
  ),
16303
17392
  children: routeLoadingMessage
16304
17393
  }
16305
- ) : !isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17394
+ ) : !submissionFeedback && !shouldShowGeoBlockBanner && (isInsufficientBalance || needsBetdexAccount) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
17395
+ Button,
17396
+ {
17397
+ size: "large",
17398
+ variant: "primary",
17399
+ className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
17400
+ "aria-label": isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit,
17401
+ onClick: handleDepositRequiredClick,
17402
+ children: isKalshiBalanceInsufficient ? tradingLabels.addFundsToKalshi : needsBetdexAccount ? tradingLabels.manageBetdexAccount : tradingLabels.deposit
17403
+ }
17404
+ ) : !isAuthenticated ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16306
17405
  Button,
16307
17406
  {
16308
17407
  size: "large",
@@ -16310,10 +17409,10 @@ var PlaceOrder = ({
16310
17409
  className: "agg-order-submit h-12 w-full px-8 text-agg-base leading-agg-6 shadow-none",
16311
17410
  disabled: !orderEligibility.canPlaceOrder || shouldShowGeoBlockBanner,
16312
17411
  "aria-label": tradingLabels.signInToTrade,
16313
- onClick: import_hooks46.requestAggAuthChooserOpen,
17412
+ onClick: import_hooks51.requestAggAuthChooserOpen,
16314
17413
  children: tradingLabels.signInToTrade
16315
17414
  }
16316
- ) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17415
+ ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16317
17416
  Button,
16318
17417
  {
16319
17418
  size: "large",
@@ -16328,8 +17427,8 @@ var PlaceOrder = ({
16328
17427
  children: actionLabel
16329
17428
  }
16330
17429
  ),
16331
- !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
16332
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17430
+ !shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
17431
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16333
17432
  Icon,
16334
17433
  {
16335
17434
  name: "shield-trust",
@@ -16338,10 +17437,10 @@ var PlaceOrder = ({
16338
17437
  "aria-hidden": "true"
16339
17438
  }
16340
17439
  ),
16341
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
17440
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(Typography, { variant: "text-xs-caps", className: "text-agg-primary", children: tradingLabels.platformFee })
16342
17441
  ] }) : null,
16343
- shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
16344
- !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
17442
+ shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(GeoBlockBanner, { termsUrl: AGG_TERMS_OF_SERVICE_URL }) : null,
17443
+ !shouldShowGeoBlockBanner ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { className: "agg-order-disclaimer text-center text-agg-xs leading-agg-4 text-agg-muted-foreground", children: tradingLabels.disclaimer }) : null
16345
17444
  ]
16346
17445
  }
16347
17446
  )
@@ -16349,7 +17448,7 @@ var PlaceOrder = ({
16349
17448
  ]
16350
17449
  }
16351
17450
  ),
16352
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17451
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16353
17452
  SharedKycModal,
16354
17453
  {
16355
17454
  open: sharedKycFlow.isModalOpen,
@@ -16363,7 +17462,7 @@ var PlaceOrder = ({
16363
17462
  }
16364
17463
  }
16365
17464
  ),
16366
- isAuthenticated && !isPaperMode && ((prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) || (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory)) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17465
+ isAuthenticated && !isPaperMode && ((prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) || (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory)) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16367
17466
  "button",
16368
17467
  {
16369
17468
  type: "button",
@@ -16372,7 +17471,7 @@ var PlaceOrder = ({
16372
17471
  children: tradingLabels.manageProphetx
16373
17472
  }
16374
17473
  ) : null,
16375
- isAuthenticated && isProphetxDirect && canConnectProphetx && !needsProphetxConnection && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.connected) && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory) ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17474
+ isAuthenticated && isProphetxDirect && canConnectProphetx && !needsProphetxConnection && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.connected) && !(prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory) ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16376
17475
  "button",
16377
17476
  {
16378
17477
  type: "button",
@@ -16381,27 +17480,27 @@ var PlaceOrder = ({
16381
17480
  children: tradingLabels.connectProphetx
16382
17481
  }
16383
17482
  ) : null,
16384
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17483
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16385
17484
  ConnectProphetxModal,
16386
17485
  {
16387
17486
  allowExistingConnection: Boolean(
16388
17487
  (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) || (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.hasAccountHistory)
16389
17488
  ),
16390
17489
  onDisconnect: (prophetxKeyStatus == null ? void 0 : prophetxKeyStatus.validatedAt) ? () => __async(null, null, function* () {
16391
- yield aggClient.deleteVenueKey(import_sdk21.Venue.prophetx);
17490
+ yield aggClient.deleteVenueKey(import_sdk22.Venue.prophetx);
16392
17491
  yield refetchProphetxKeyStatus();
16393
17492
  yield queryClient.invalidateQueries({ queryKey: ["agg"] });
16394
17493
  }) : void 0,
16395
17494
  open: isConnectProphetxModalOpen,
16396
17495
  onOpenChange: setIsConnectProphetxModalOpen,
16397
17496
  onVerify: (credentials) => __async(null, null, function* () {
16398
- yield aggClient.upsertVenueKey({ venue: import_sdk21.Venue.prophetx, credentials });
17497
+ yield aggClient.upsertVenueKey({ venue: import_sdk22.Venue.prophetx, credentials });
16399
17498
  yield refetchProphetxKeyStatus();
16400
17499
  yield queryClient.invalidateQueries({ queryKey: ["agg"] });
16401
17500
  })
16402
17501
  }
16403
17502
  ),
16404
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17503
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16405
17504
  ConnectKalshiModal,
16406
17505
  {
16407
17506
  open: isConnectKalshiModalOpen,
@@ -16409,12 +17508,16 @@ var PlaceOrder = ({
16409
17508
  onVerify: handleVerifyKalshi
16410
17509
  }
16411
17510
  ),
16412
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen }),
16413
- /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(
17511
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(FundKalshiModal, { open: isFundKalshiModalOpen, onOpenChange: setIsFundKalshiModalOpen }),
17512
+ /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(
16414
17513
  ManageBetdexAccountModal,
16415
17514
  {
17515
+ userId: user == null ? void 0 : user.id,
16416
17516
  open: isBetdexAccountModalOpen,
16417
- onOpenChange: setIsBetdexAccountModalOpen
17517
+ onOpenChange: (open) => {
17518
+ setIsBetdexAccountModalOpen(open);
17519
+ if (!open) void smartRoute.refetch();
17520
+ }
16418
17521
  }
16419
17522
  )
16420
17523
  ] });
@@ -16422,33 +17525,33 @@ var PlaceOrder = ({
16422
17525
  PlaceOrder.displayName = "PlaceOrder";
16423
17526
 
16424
17527
  // src/trading/trading-context/index.tsx
16425
- var import_hooks47 = require("@agg-build/hooks");
17528
+ var import_hooks52 = require("@agg-build/hooks");
16426
17529
 
16427
17530
  // src/trading/use-claim-winnings.ts
16428
- var import_hooks48 = require("@agg-build/hooks");
16429
- var import_react24 = require("react");
17531
+ var import_hooks53 = require("@agg-build/hooks");
17532
+ var import_react27 = require("react");
16430
17533
  var toClaimError = (err) => {
16431
17534
  if (err instanceof Error) return err;
16432
17535
  return new Error(String(err));
16433
17536
  };
16434
17537
  function useClaimWinnings(options = {}) {
16435
17538
  const { onClaim, onClaimResult, onClaimSubmitError, externalClaimingKeys } = options;
16436
- const labels = (0, import_hooks48.useLabels)();
17539
+ const labels = (0, import_hooks53.useLabels)();
16437
17540
  const claimNotificationLabels = labels.notifications.claim;
16438
17541
  const toastCtx = useOptionalToast();
16439
- const queryClient = (0, import_hooks48.useQueryClient)();
16440
- const redeemMutation = (0, import_hooks48.useRedeem)();
16441
- const [activeRedeems, setActiveRedeems] = (0, import_react24.useState)({});
16442
- const activeClaimKeysRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
16443
- const pendingClaimToastIdsRef = (0, import_react24.useRef)({});
16444
- const submittedClaimToastKeysRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
16445
- const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react24.useState)({});
16446
- const lifecycleInputs = (0, import_react24.useMemo)(
17542
+ const queryClient = (0, import_hooks53.useQueryClient)();
17543
+ const redeemMutation = (0, import_hooks53.useRedeem)();
17544
+ const [activeRedeems, setActiveRedeems] = (0, import_react27.useState)({});
17545
+ const activeClaimKeysRef = (0, import_react27.useRef)(/* @__PURE__ */ new Set());
17546
+ const pendingClaimToastIdsRef = (0, import_react27.useRef)({});
17547
+ const submittedClaimToastKeysRef = (0, import_react27.useRef)(/* @__PURE__ */ new Set());
17548
+ const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react27.useState)({});
17549
+ const lifecycleInputs = (0, import_react27.useMemo)(
16447
17550
  () => Object.values(activeRedeems),
16448
17551
  [activeRedeems]
16449
17552
  );
16450
- const lifecycleStates = (0, import_hooks48.useRedeemLifecycles)(lifecycleInputs);
16451
- const internalClaimingIds = (0, import_react24.useMemo)(() => {
17553
+ const lifecycleStates = (0, import_hooks53.useRedeemLifecycles)(lifecycleInputs);
17554
+ const internalClaimingIds = (0, import_react27.useMemo)(() => {
16452
17555
  const out = __spreadValues({}, submittingClaimKeys);
16453
17556
  for (const [claimKey, active] of Object.entries(activeRedeems)) {
16454
17557
  const state = lifecycleStates[active.redeemId];
@@ -16457,20 +17560,20 @@ function useClaimWinnings(options = {}) {
16457
17560
  return out;
16458
17561
  }, [activeRedeems, lifecycleStates, submittingClaimKeys]);
16459
17562
  const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
16460
- const isClaiming = (0, import_react24.useCallback)(
17563
+ const isClaiming = (0, import_react27.useCallback)(
16461
17564
  (claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
16462
17565
  [externalClaimingKeys, internalClaimingIds]
16463
17566
  );
16464
- const invalidateClaimUiState = (0, import_react24.useCallback)(() => {
16465
- (0, import_hooks48.invalidateBalanceQueries)(queryClient);
16466
- (0, import_hooks48.invalidatePositionQueries)(queryClient);
17567
+ const invalidateClaimUiState = (0, import_react27.useCallback)(() => {
17568
+ (0, import_hooks53.invalidateBalanceQueries)(queryClient);
17569
+ (0, import_hooks53.invalidatePositionQueries)(queryClient);
16467
17570
  queryClient.invalidateQueries({
16468
- queryKey: import_hooks48.executionKeys.claimablePositionsCount(),
17571
+ queryKey: import_hooks53.executionKeys.claimablePositionsCount(),
16469
17572
  refetchType: "active"
16470
17573
  });
16471
- (0, import_hooks48.invalidateUserActivityQueries)(queryClient);
17574
+ (0, import_hooks53.invalidateUserActivityQueries)(queryClient);
16472
17575
  }, [queryClient]);
16473
- const claim = (0, import_react24.useCallback)(
17576
+ const claim = (0, import_react27.useCallback)(
16474
17577
  (_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
16475
17578
  if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
16476
17579
  return;
@@ -16608,8 +17711,8 @@ function useClaimWinnings(options = {}) {
16608
17711
  toastCtx
16609
17712
  ]
16610
17713
  );
16611
- const firedTerminalRef = (0, import_react24.useRef)({});
16612
- (0, import_react24.useEffect)(() => {
17714
+ const firedTerminalRef = (0, import_react27.useRef)({});
17715
+ (0, import_react27.useEffect)(() => {
16613
17716
  var _a, _b;
16614
17717
  for (const [claimKey, active] of Object.entries(activeRedeems)) {
16615
17718
  const state = lifecycleStates[active.redeemId];
@@ -16665,8 +17768,8 @@ function useClaimWinnings(options = {}) {
16665
17768
  }
16666
17769
 
16667
17770
  // src/trading/use-resolved-market-claim.ts
16668
- var import_hooks49 = require("@agg-build/hooks");
16669
- var import_react25 = require("react");
17771
+ var import_hooks54 = require("@agg-build/hooks");
17772
+ var import_react28 = require("react");
16670
17773
  var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
16671
17774
  var dateFormatter = new Intl.DateTimeFormat("en-US", {
16672
17775
  month: "short",
@@ -16682,18 +17785,18 @@ var formatResolutionDate = (value) => {
16682
17785
  function useResolvedMarketClaim(options = {}) {
16683
17786
  var _a;
16684
17787
  const { market, enabled = true, executionMode } = options;
16685
- const { isAuthenticated } = (0, import_hooks49.useAggAuthState)();
16686
- const tradingState = (0, import_react25.useMemo)(() => (0, import_hooks49.resolveMarketTradingState)(market), [market]);
17788
+ const { isAuthenticated } = (0, import_hooks54.useAggAuthState)();
17789
+ const tradingState = (0, import_react28.useMemo)(() => (0, import_hooks54.resolveMarketTradingState)(market), [market]);
16687
17790
  const isResolved = tradingState.kind === "resolved";
16688
17791
  const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
16689
17792
  const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
16690
- const { positions } = (0, import_hooks49.useExecutionPositions)(__spreadValues({
17793
+ const { positions } = (0, import_hooks54.useExecutionPositions)(__spreadValues({
16691
17794
  enabled: shouldFetch,
16692
17795
  status: "active",
16693
17796
  limit: 50
16694
17797
  }, executionMode === "paper" ? { mode: "paper" } : {}));
16695
17798
  const claimWinnings = useClaimWinnings();
16696
- return (0, import_react25.useMemo)(() => {
17799
+ return (0, import_react28.useMemo)(() => {
16697
17800
  var _a2;
16698
17801
  if (!shouldFetch || !marketId) return void 0;
16699
17802
  const group = positions.find(
@@ -16704,7 +17807,7 @@ function useResolvedMarketClaim(options = {}) {
16704
17807
  (outcome) => outcome.winner === true && outcome.totalSize > 0
16705
17808
  );
16706
17809
  if (winningOutcomes.length === 0) return void 0;
16707
- const totals = (0, import_hooks49.computeClosedPositionTotals)(group);
17810
+ const totals = (0, import_hooks54.computeClosedPositionTotals)(group);
16708
17811
  const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
16709
17812
  const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
16710
17813
  market: market != null ? market : group.venueMarket,