@glacislabs/stablegenie-zerodelta 4.19.0 → 4.20.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.
@@ -1,4 +1,4 @@
1
- import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, isSellableRwa, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, zdHeavyExpected, preflightZdHeavyPlan, allowanceCovers, validatePlannedTransaction, priceCompareOptions, parity, pickForWait, cornerTags, extraVsFastest, proposedWait, visibleOptions, promotionFor, estimateBonus, pairPromotionsInto, promotedAssets, TRACKING, mergeHistory, hasValidChecksum, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-NLXQVXZ5.js';
1
+ import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, isSellableRwa, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, zdHeavyExpected, preflightZdHeavyPlan, allowanceCovers, validatePlannedTransaction, priceCompareOptions, parity, pickForWait, cornerTags, extraVsFastest, proposedWait, visibleOptions, promotionFor, estimateBonus, pairPromotionsInto, promotedAssets, TRACKING, mergeHistory, hasValidChecksum, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, clampWait, waitScaleFor, waitFraction, waitLabel, WAIT_POSITIONS, snapWait, WAIT_STEP_SEC, waitFromFraction, compareDuration, compareAmount, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-RUHREVDT.js';
2
2
  import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, useLayoutEffect, createElement, useContext, useSyncExternalStore, useReducer } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -838,6 +838,11 @@ function useFlow(args) {
838
838
  };
839
839
  }
840
840
  var RETRY_DELAYS_MS = [800, 2400, 6e3];
841
+ var CATALOGUE_REFRESH_MS = 6e4 + 250;
842
+ function catalogueSignature(c) {
843
+ const ids = (list) => list.map((t) => `${Number(t.chainId)}:${String(t.address).toLowerCase()}`).join(",");
844
+ return [ids(c.tokens), ids(c.sources), [...c.source].sort().join(","), [...c.destination].sort().join(","), [...c.lanes ?? []].sort().join(","), [...c.brokenLanes?.keys() ?? []].sort().join(","), [...c.limitedLanes.keys()].sort().join(",")].join("|");
845
+ }
841
846
  function useCatalogue(engine, options = {}) {
842
847
  const { allowedAssets, product, solanaSources } = options;
843
848
  const enabled = options.enabled !== false;
@@ -854,7 +859,10 @@ function useCatalogue(engine, options = {}) {
854
859
  engine.fetchCatalogue(allowedAssets, product, solanaSources ? { solanaSources: true } : void 0).then((next) => {
855
860
  if (!alive) return;
856
861
  setCatalogue(next);
857
- if (next.ready) return;
862
+ if (next.ready) {
863
+ timer2 = setTimeout(refresh, CATALOGUE_REFRESH_MS);
864
+ return;
865
+ }
858
866
  if (attempt >= RETRY_DELAYS_MS.length) {
859
867
  setFailed(true);
860
868
  return;
@@ -862,6 +870,23 @@ function useCatalogue(engine, options = {}) {
862
870
  timer2 = setTimeout(read, RETRY_DELAYS_MS[attempt++]);
863
871
  });
864
872
  };
873
+ const refresh = () => {
874
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
875
+ timer2 = setTimeout(refresh, CATALOGUE_REFRESH_MS);
876
+ return;
877
+ }
878
+ if (isUserIdle()) {
879
+ timer2 = setTimeout(refresh, CATALOGUE_REFRESH_MS);
880
+ return;
881
+ }
882
+ engine.fetchCatalogue(allowedAssets, product, solanaSources ? { solanaSources: true } : void 0).then((next) => {
883
+ if (!alive) return;
884
+ if (next.ready) setCatalogue((prev) => prev?.ready && catalogueSignature(prev) === catalogueSignature(next) ? prev : next);
885
+ }).catch(() => {
886
+ }).finally(() => {
887
+ if (alive) timer2 = setTimeout(refresh, CATALOGUE_REFRESH_MS);
888
+ });
889
+ };
865
890
  read();
866
891
  return () => {
867
892
  alive = false;
@@ -1849,6 +1874,217 @@ button.sg-rcp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offse
1849
1874
  .sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
1850
1875
  .sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
1851
1876
  @media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
1877
+ /* \u2500\u2500 Compliance details screen (ComplianceDetails) \u2014 Figma Widget Playground 3238:16033 / 16419 / 16879 / 17276 / 17894 \u2500\u2500 */
1878
+ .sg-cd{--sg-cd-r:min(var(--sg-radius-control),20px);--sg-t50:color-mix(in srgb,var(--sg-text) 50%,transparent);--sg-t25:color-mix(in srgb,var(--sg-text) 25%,transparent);display:flex;flex-direction:column;gap:12px;width:100%;box-sizing:border-box;animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
1879
+ .sg-cd:focus{outline:none}
1880
+ .sg-cd-back{position:relative;align-self:flex-start;display:inline-flex;align-items:center;gap:10px;margin:0 0 12px;padding:0;border:0;background:transparent;color:var(--sg-t50);font:inherit;font-size:14px;font-weight:500;line-height:1.2;cursor:pointer;transition:color 120ms ease}
1881
+ .sg-cd-back::after{content:"";position:absolute;inset:-12px -10px}
1882
+ .sg-cd-back:hover{color:var(--sg-text)}
1883
+ .sg-cd-back:focus-visible{outline:2px solid var(--sg-accent);outline-offset:4px;border-radius:6px}
1884
+ .sg-cd-title{margin:0;font-family:var(--sg-font-display);font-size:16px;font-weight:600;line-height:19.2px;letter-spacing:.32px;color:var(--sg-t90)}
1885
+ .sg-cd-tabs{display:flex;align-items:stretch;gap:0;padding:4px;border:1px solid var(--sg-border);border-radius:calc(var(--sg-cd-r) - 4px)}
1886
+ .sg-cd-tab{flex:1 0 0;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:0;padding:13px 8px;border:0;border-radius:calc(var(--sg-cd-r) - 4px);background:transparent;color:var(--sg-t50);font:inherit;font-size:10px;font-weight:700;line-height:14px;text-transform:uppercase;letter-spacing:.2px;white-space:nowrap;cursor:pointer;transition:background 120ms ease,color 120ms ease}
1887
+ .sg-cd-tab:hover{color:var(--sg-text)}
1888
+ .sg-cd-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 8%,transparent);color:var(--sg-accent)}
1889
+ .sg-cd-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
1890
+ .sg-cd-tab-count{font-weight:700;color:var(--sg-t25)}
1891
+ .sg-cd-tab[data-active="true"] .sg-cd-tab-count{color:color-mix(in srgb,var(--sg-accent) 50%,transparent)}
1892
+ .sg-cd-panel{display:flex;flex-direction:column;gap:6px;margin-top:-4px}
1893
+ .sg-cd-card{display:flex;flex-direction:column;gap:20px;padding:16px;border:1px solid var(--sg-border);border-radius:var(--sg-cd-r)}
1894
+ .sg-cd-card-head{display:flex;align-items:center;gap:8px}
1895
+ .sg-cd-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
1896
+ .sg-cd-card-title{margin:0;font-size:15px;font-weight:500;line-height:1.2;color:var(--sg-t90)}
1897
+ .sg-cd-summary{display:flex;flex-direction:column;gap:4px}
1898
+ .sg-cd-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-ok-ink)}
1899
+ .sg-cd-summary-head[data-tone="neutral"]{color:var(--sg-t60)}
1900
+ .sg-cd-summary-head[data-tone="blocked"],.sg-cd-summary-head[data-tone="warn"]{color:var(--sg-danger)}
1901
+ .sg-cd-summary-title{font-size:14px;font-weight:500;line-height:1.2;color:var(--sg-t90)}
1902
+ .sg-cd-summary-head[data-tone="blocked"] .sg-cd-summary-title,.sg-cd-summary-head[data-tone="warn"] .sg-cd-summary-title{color:var(--sg-danger)}
1903
+ .sg-cd-summary-sub{margin:0;padding-left:24px;font-size:13px;line-height:1.2;color:var(--sg-t50)}
1904
+ .sg-cd-checks{list-style:none;margin:2px 0 -1px;padding:0;display:flex;flex-direction:column;gap:12px}
1905
+ .sg-cd-card:has(.sg-cd-facts){gap:16px}
1906
+ .sg-cd-check-line{display:flex;align-items:center;gap:8px;min-width:0}
1907
+ .sg-cd-check-mark{display:flex;flex:0 0 auto;width:12px;justify-content:center;color:var(--sg-ok-ink)}
1908
+ .sg-cd-check-mark[data-ok="false"]{color:var(--sg-danger)}
1909
+ .sg-cd-check-label{font-size:14px;line-height:17px;color:var(--sg-t90)}
1910
+ .sg-cd-check[data-ok="false"] .sg-cd-check-label{color:var(--sg-danger)}
1911
+ .sg-cd-check-note,.sg-cd-check-reason{display:block;padding-left:26px;margin-top:3px;font-size:12px;line-height:1.4;color:var(--sg-t60);overflow-wrap:anywhere}
1912
+ .sg-cd-check-reason{color:var(--sg-danger)}
1913
+ .sg-cd-orphans{list-style:none;margin:0;padding:0 0 0 26px;display:flex;flex-direction:column;gap:3px;font-size:12px;line-height:1.4;color:var(--sg-danger)}
1914
+ .sg-cd-scope{margin:0;font-size:12px;line-height:1.45;color:var(--sg-t60)}
1915
+ .sg-cd-flags{margin:0;font-size:14px;color:var(--sg-t90)}
1916
+ .sg-cd-facts{margin:0;display:flex;flex-direction:column;gap:10px;padding-left:24px}
1917
+ .sg-cd-fact{display:grid;grid-template-columns:94px minmax(0,1fr);align-items:baseline;gap:0}
1918
+ .sg-cd-fact dt{font-size:13px;line-height:17px;color:var(--sg-t50)}
1919
+ .sg-cd-fact dd{margin:0;min-width:0;font-size:14px;line-height:17px;color:var(--sg-t90);overflow-wrap:anywhere}
1920
+ .sg-cd-policies{gap:6px}
1921
+ .sg-cd-policy{display:flex;flex-direction:column}
1922
+ .sg-cd-policy-head{position:relative;z-index:1;display:flex;align-items:center;gap:12px;width:100%;box-sizing:border-box;padding:21px 17px;border:1px solid var(--sg-border);border-radius:var(--sg-cd-r);background:var(--sg-bg);color:inherit;font:inherit;text-align:left}
1923
+ button.sg-cd-policy-head{cursor:pointer;transition:border-color 120ms ease}
1924
+ button.sg-cd-policy-head:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
1925
+ button.sg-cd-policy-head:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
1926
+ .sg-cd-policy-mark{display:flex;flex:0 0 auto;color:color-mix(in srgb,var(--sg-text) 45%,transparent)}
1927
+ .sg-cd-policy-text{display:flex;flex:1 1 auto;min-width:0;flex-direction:column;gap:6px}
1928
+ .sg-cd-policy-name{font-size:16px;font-weight:500;line-height:1.2;color:var(--sg-t90);overflow-wrap:anywhere}
1929
+ .sg-cd-policy-sub{font-size:14px;line-height:18px;color:var(--sg-t60)}
1930
+ .sg-cd-policy-chev{display:flex;flex:0 0 auto;color:var(--sg-t90)}
1931
+ .sg-cd-policy-body{display:flex;flex-direction:column;gap:6px;margin-top:-24px;padding:40px 16px 16px;border-radius:var(--sg-cd-r);background:color-mix(in srgb,var(--sg-accent) 8%,transparent);animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
1932
+ .sg-cd-bucket{position:relative;display:flex;flex-direction:column;gap:12px;padding:12px 16px;border-radius:var(--sg-cd-r);background:var(--sg-bg)}
1933
+ .sg-cd-bucket-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:4px 8px}
1934
+ .sg-cd-bucket[data-outcome] .sg-cd-bucket-head:has(.sg-cd-hint){justify-content:flex-start;align-items:center;gap:8px}
1935
+ .sg-cd-bucket-title{font-size:14px;font-weight:500;line-height:16px;color:var(--sg-t90)}
1936
+ .sg-cd-bucket-detail{font-size:12px;line-height:14px;color:var(--sg-t50)}
1937
+ .sg-cd-cats{list-style:none;margin:0;padding:0 0 0 8px;display:flex;flex-direction:column;gap:4px}
1938
+ .sg-cd-cats li{display:flex;align-items:center;gap:12px;font-size:13px;line-height:18px;color:var(--sg-t90)}
1939
+ .sg-cd-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-t90)}
1940
+ .sg-cd-bucket[data-outcome="flagged"] .sg-cd-dot{background:var(--sg-accent);opacity:.8}
1941
+ .sg-cd-cats li .sg-cd-hint{margin-left:-6px}
1942
+ .sg-cd-hint{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:20px;height:20px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--sg-t60);cursor:pointer;transition:color 120ms ease}
1943
+ .sg-cd-hint{position:relative}
1944
+ .sg-cd-hint::after{content:"";position:absolute;inset:-12px}
1945
+ .sg-cd-hint:hover,.sg-cd-hint[aria-expanded="true"]{color:var(--sg-accent)}
1946
+ .sg-cd-hint:focus-visible{outline:2px solid var(--sg-accent);outline-offset:1px}
1947
+ .sg-cd-tip{position:absolute;z-index:3;left:0;right:0;top:100%;margin-top:2px;padding:10px 12px;border-radius:12px;background:var(--sg-text);color:var(--sg-bg);font-size:12px;font-weight:400;line-height:1.4;text-align:left;pointer-events:none;box-shadow:0 6px 20px rgba(0,0,0,.18)}
1948
+ .sg-cd-cats li,.sg-cd-bucket-head{position:relative}
1949
+ .sg-cd-policy-version{margin:0;padding:4px 4px 0;font-size:12px;line-height:14px;color:var(--sg-t60);overflow-wrap:anywhere}
1950
+ /* Wide's second panel (layout="side", 280px): the same screen on a denser scale \u2014 Figma 3238:16419 / 18187 / 18446 */
1951
+ .sg-cd[data-layout="side"] .sg-cd-back{font-size:12px;font-weight:400;line-height:16px;margin-bottom:4px}
1952
+ .sg-cd[data-layout="side"] .sg-cd-title{margin-bottom:4px;font-family:inherit;font-size:16px;font-weight:500;line-height:1.2;letter-spacing:0}
1953
+ .sg-cd[data-layout="side"] .sg-cd-panel{margin-top:-8px}
1954
+ .sg-cd[data-layout="side"] .sg-cd-card{padding:16px 12px;gap:16px}
1955
+ .sg-cd[data-layout="side"] .sg-cd-card:has(.sg-cd-facts){gap:16px}
1956
+ .sg-cd[data-layout="side"] .sg-cd-card-title{font-size:14px}
1957
+ .sg-cd[data-layout="side"] .sg-cd-summary-head,.sg-cd[data-layout="side"] .sg-cd-card-head{gap:8px}
1958
+ .sg-cd[data-layout="side"] .sg-cd-summary-sub{padding-left:0;font-size:13px;line-height:16px}
1959
+ .sg-cd[data-layout="side"] .sg-cd-checks{gap:12px}
1960
+ .sg-cd[data-layout="side"] .sg-cd-check-label,.sg-cd[data-layout="side"] .sg-cd-fact dt,.sg-cd[data-layout="side"] .sg-cd-fact dd{font-size:13px;line-height:16px}
1961
+ .sg-cd[data-layout="side"] .sg-cd-facts{padding-left:24px;gap:10px}
1962
+ .sg-cd[data-layout="side"] .sg-cd-policy-head{gap:6px;padding:21px 13px}
1963
+ .sg-cd[data-layout="side"] .sg-cd-policy-text{gap:2px}
1964
+ .sg-cd[data-layout="side"] .sg-cd-policy-name{font-size:14px;line-height:1.2}
1965
+ .sg-cd[data-layout="side"] .sg-cd-policy-sub{font-size:13px;line-height:1.4}
1966
+ .sg-cd[data-layout="side"] .sg-cd-policy-mark svg{width:16px;height:16px}
1967
+ .sg-cd[data-layout="side"] .sg-cd-policy-body{padding:32px 8px 16px}
1968
+ .sg-cd[data-layout="side"] .sg-cd-bucket{gap:8px;padding:12px 16px;border-radius:16px}
1969
+ @media (prefers-reduced-motion:reduce){.sg-cd,.sg-cd-policy-body{animation:none}}
1970
+ /* \u2500\u2500 Compare quotes \u2014 Figma Widget Playground 3237:13270 / 3237:13581 / 3237:13897 / 3237:14224 (2026-11-13) \u2500\u2500 */
1971
+ .sg-widget{--sg-a5:color-mix(in srgb,var(--sg-accent) 5%,transparent);--sg-a8:color-mix(in srgb,var(--sg-accent) 8%,transparent);--sg-a50:color-mix(in srgb,var(--sg-accent) 50%,transparent);--sg-purple:#4f24b4;--sg-green-12:color-mix(in srgb,var(--sg-ok-ink) 12%,transparent);--sg-cq-dot:#8fb8b4}
1972
+ .sg-widget[data-sg-mode="dark"]{--sg-purple:#b79cff;--sg-cq-dot:color-mix(in srgb,var(--sg-text) 50%,transparent)}
1973
+ .sg-ws-titlerow{display:flex;align-items:center;gap:12px}
1974
+ .sg-cq-refresh{display:flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--sg-accent);cursor:pointer}
1975
+ .sg-cq-refresh:focus-visible,.sg-cq-main:focus-visible,.sg-cq-route-toggle:focus-visible,.sg-cq-info:focus-visible,.sg-cq-gap:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
1976
+ .sg-cq-spin{animation:sg-spin 900ms linear infinite}
1977
+ .sg-cq{display:flex;flex-direction:column;gap:16px}
1978
+ .sg-cq-wait{display:flex;flex-direction:column;gap:20px;padding:16px 12px 20px;border-radius:24px;background:var(--sg-a5)}
1979
+ .sg-cq-wait-top{display:flex;flex-direction:column;gap:8px}
1980
+ .sg-cq-wait-row{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;font-size:13px;line-height:1.4;color:var(--sg-t80)}
1981
+ .sg-cq-wait-scale{display:flex;flex-direction:column;gap:12px}
1982
+ .sg-cq-track{position:relative;width:100%;height:20px}
1983
+ .sg-cq-range{position:absolute;inset:0;z-index:1;width:100%;height:100%;margin:0;padding:0;border-radius:10px;opacity:0;cursor:pointer;appearance:none;-webkit-appearance:none}
1984
+ .sg-cq-rail{position:absolute;inset:0;overflow:hidden;border-radius:10px;border:1px solid color-mix(in srgb,var(--sg-bg) 80%,transparent);background:var(--sg-a8) repeating-linear-gradient(120deg,transparent 0 5.06px,color-mix(in srgb,var(--sg-bg) 30%,transparent) 5.06px 9.06px)}
1985
+ .sg-cq-range:focus-visible~.sg-cq-rail{outline:2px solid var(--sg-accent);outline-offset:2px}
1986
+ .sg-cq-thumb{position:absolute;left:2px;top:2px;bottom:2px;display:flex;align-items:center;justify-content:flex-end;border-radius:8px;border:1px solid var(--sg-bg);background:var(--sg-accent)}
1987
+ .sg-cq-thumb svg{flex:0 0 auto;margin-right:1px}
1988
+ .sg-cq-ends{position:relative;display:flex;align-items:center;justify-content:space-between;font-size:12px;font-weight:500;line-height:1.2;color:var(--sg-t50)}
1989
+ .sg-cq-parity{position:absolute;top:calc(50% + 2px);transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;padding:4px 8px;border-radius:8px;background:var(--sg-a8);font-size:11px;line-height:1.3;text-align:center;color:color-mix(in srgb,var(--sg-accent) 80%,var(--sg-text))}
1990
+ .sg-cq-parity-none{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);white-space:nowrap;font-size:11px;font-weight:400;color:var(--sg-t50)}
1991
+ .sg-cq-rule{height:1px;margin-top:-1px;background:var(--sg-a12)}
1992
+ .sg-cq-extra{display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:8px}
1993
+ .sg-cq-extra-icon{flex:0 0 auto;align-self:center;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:999px;background:var(--sg-green-12);color:var(--sg-ok-ink)}
1994
+ .sg-cq-extra-icon svg{width:16px;height:16px}
1995
+ .sg-cq-extra-text{display:flex;flex:0 1 auto;min-width:0;flex-direction:column;justify-content:center;gap:0;margin-right:auto}
1996
+ .sg-cq-parity{white-space:nowrap}
1997
+ .sg-ws:has(.sg-cq) .sg-ws-top{gap:24px}
1998
+ .sg-cq-info,.sg-cq-gap{padding:0;border:0;background:transparent;font:inherit}
1999
+ .sg-cq-extra-label{display:flex;align-items:center;gap:6px;white-space:nowrap;font-size:12px;line-height:1.2;color:var(--sg-t50)}
2000
+ .sg-cq-extra-amt{white-space:nowrap;font-size:16px;font-weight:500;line-height:1.2;color:var(--sg-t90)}
2001
+ .sg-cq-extra-note{align-self:center;flex:0 0 auto;margin-left:auto;min-width:0;white-space:nowrap;text-align:right;font-size:9px;line-height:1.2;color:var(--sg-t50)}
2002
+ .sg-cq-info{display:inline-flex;border-radius:4px;color:var(--sg-t50);cursor:help}
2003
+ .sg-cq-list{display:flex;flex-direction:column;gap:8px}
2004
+ .sg-cq-empty{margin:0;padding:24px 0;text-align:center;font-size:13px;line-height:1.4;color:var(--sg-t50)}
2005
+ .sg-cq-card{position:relative;display:flex;flex-direction:column;gap:16px;overflow:clip;padding:16px 12px;border-radius:20px;border:1px solid var(--sg-a12);background:var(--sg-bg)}
2006
+ .sg-cq-card[data-selected]{border-color:color-mix(in srgb,var(--sg-accent) 80%,transparent)}
2007
+ .sg-cq-card[data-unavailable]{background:var(--sg-a4);opacity:.6;filter:grayscale(1)}
2008
+ .sg-cq-main{display:flex;flex-direction:column;align-items:flex-start;gap:20px;width:100%;padding:0;border:0;border-radius:20px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
2009
+ .sg-cq-main:disabled{cursor:not-allowed}
2010
+ .sg-cq-head{display:flex;align-items:flex-start;gap:8px;width:100%;padding-right:min(150px,42%)}
2011
+ .sg-cq-radio{flex:0 0 auto;display:grid;place-items:center;width:16px;height:16px;margin-top:1.6px;border-radius:999px;border:1px solid var(--sg-a50)}
2012
+ .sg-cq-radio[data-on]{border-color:var(--sg-accent)}
2013
+ .sg-cq-radio[data-on]::after{content:"";width:8px;height:8px;border-radius:999px;background:var(--sg-accent)}
2014
+ .sg-cq-amount{min-width:0;font-size:16px;font-weight:500;line-height:1.2;color:var(--sg-t90)}
2015
+ .sg-cq-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
2016
+ .sg-cq-tag{position:absolute;top:-2px;right:-2px;display:flex;align-items:center;gap:8px;padding:10px 32px 12px;border-radius:0 0 0 40px;background:var(--sg-a8);font-size:12px;font-weight:500;line-height:1.4;letter-spacing:.12px}
2017
+ .sg-cq-tag[data-kind="netting"]{background:var(--sg-green-12)}
2018
+ .sg-cq-tag[data-kind="purple"]{background:color-mix(in srgb,var(--sg-purple) 8%,transparent)}
2019
+ .sg-cq-tag-item{display:flex;align-items:center;gap:8px;white-space:nowrap}
2020
+ .sg-cq-tag-dot{width:4px;height:4px;border-radius:999px;background:var(--sg-cq-dot)}
2021
+ .sg-overlay[data-sg-overlay="drawer"] .sg-cq[data-layout="card"] .sg-cq-tag{padding:10px 20px 12px;border-radius:0 0 0 32px;font-size:11px;letter-spacing:.11px;gap:6px}
2022
+ .sg-cq-tag [data-tone="brand"]{color:var(--sg-accent)}
2023
+ .sg-cq-tag [data-tone="green"]{color:var(--sg-ok-ink)}
2024
+ .sg-cq-tag [data-tone="purple"]{color:var(--sg-purple)}
2025
+ .sg-widget[data-sg-mode="dark"] .sg-cq-tag [data-tone="brand"]{color:var(--sg-info)}
2026
+ .sg-cq-stats{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:0 12px 0 24px}
2027
+ .sg-cq-cols{display:flex;align-items:center;gap:32px;white-space:nowrap}
2028
+ .sg-cq-col{display:flex;flex-direction:column;justify-content:center;gap:6px}
2029
+ .sg-cq-col-label{font-size:10px;font-weight:500;line-height:1.2;text-transform:uppercase;color:var(--sg-t50)}
2030
+ .sg-cq-col-value{font-size:14px;line-height:1.2;color:var(--sg-text)}
2031
+ .sg-cq-note{width:125px;text-align:right;font-size:12px;line-height:1.2;color:var(--sg-t50)}
2032
+ .sg-cq-why{padding-left:24px;font-size:13px;line-height:1.3;color:var(--sg-t50)}
2033
+ .sg-cq-route{display:flex;flex-direction:column;gap:10px;padding-left:24px}
2034
+ .sg-cq-route-toggle{display:flex;align-items:center;gap:4px;width:fit-content;padding:0;border:0;border-radius:4px;background:transparent;font:inherit;font-size:10px;font-weight:500;line-height:1.2;text-transform:uppercase;color:var(--sg-t50);cursor:pointer}
2035
+ .sg-cq-route-toggle svg{color:var(--sg-text)}
2036
+ .sg-cq-hops{display:flex;flex-wrap:wrap;align-items:flex-start;gap:4px}
2037
+ .sg-cq-hop{display:flex;align-items:flex-start;gap:4px}
2038
+ .sg-cq-arrow{flex:0 0 auto;color:var(--sg-accent)}
2039
+ .sg-cq-hop-body{display:flex;flex-direction:column;gap:4px}
2040
+ .sg-cq-hop-name{display:flex;align-items:center;gap:4px;font-size:14px;line-height:1.2;color:var(--sg-text)}
2041
+ .sg-cq-hop-chain{white-space:nowrap;font-size:12px;line-height:1.2;color:var(--sg-t50)}
2042
+ .sg-cq .sg-tok[data-size="xxs"] .sg-tok-badge{min-width:8px;width:8px;height:8px;right:-1px;bottom:-1px;border-width:1px;border-color:var(--sg-bg);font-size:4px;padding:0}
2043
+ .sg-cq .sg-tok[data-size="xs"] .sg-tok-badge{min-width:11px;width:11px;height:11px;right:-3px;bottom:-3px;border-width:1px;border-color:var(--sg-bg);font-size:4px;padding:0}
2044
+ /* Back-link and gap scoped to Compare quotes (Figma: 14px t50 compact, 12px t50 wide, 24px/16px to the title). */
2045
+ .sg-ws:has(.sg-cq) .sg-ws-back{font-size:14px;font-weight:500;color:var(--sg-t50)}
2046
+ .sg-dialog .sg-ws:has(.sg-cq):not([data-wide]) .sg-ws-top{gap:16px}
2047
+ /* Wide: compact cards, the tag a centred band across the card's top, the route as inline marks */
2048
+ .sg-cq[data-layout="side"] .sg-cq-card{gap:12px;padding:0 0 16px;border-radius:20px}
2049
+ .sg-cq[data-layout="side"] .sg-cq-tag{position:static;justify-content:center;width:100%;padding:2px 20px 4px;border-radius:0;font-size:11px;line-height:1.4;letter-spacing:.11px;gap:6px}
2050
+ .sg-ws[data-wide]:has(.sg-cq) .sg-ws-top{gap:16px}
2051
+ .sg-ws[data-wide]:has(.sg-cq) .sg-ws-title{font-size:16px}
2052
+ .sg-ws[data-wide]:has(.sg-cq) .sg-ws-back{font-size:12px;font-weight:400;color:var(--sg-t50)}
2053
+ .sg-cq[data-layout="side"]{gap:12px}
2054
+ .sg-cq[data-layout="side"] .sg-cq-wait{padding:16px 12px 20px;gap:20px}
2055
+ .sg-cq[data-layout="side"] .sg-cq-rule{margin-bottom:-8px}
2056
+ .sg-cq[data-layout="side"] .sg-cq-card:not(:has(.sg-cq-tag)){padding-top:12px}
2057
+ .sg-cq[data-layout="side"] .sg-cq-main{gap:20px;padding:0 12px;border-radius:0}
2058
+ .sg-cq[data-layout="side"] .sg-cq-head{padding-right:0!important}
2059
+ .sg-cq[data-layout="side"] .sg-cq-amount{font-size:15px}
2060
+ .sg-cq[data-layout="side"] .sg-cq-stats{padding:0}
2061
+ .sg-cq[data-layout="side"] .sg-cq-cols{gap:20px}
2062
+ .sg-cq[data-layout="side"] .sg-cq-col{gap:4px}
2063
+ .sg-cq[data-layout="side"] .sg-cq-col-label{font-size:9px}
2064
+ .sg-cq[data-layout="side"] .sg-cq-col-value{font-size:13px}
2065
+ .sg-cq[data-layout="side"] .sg-cq-card[data-selected]{border-color:color-mix(in srgb,var(--sg-accent) 50%,transparent)}
2066
+ .sg-cq[data-layout="side"] .sg-cq-extra-amt{font-size:15px}
2067
+ .sg-cq[data-layout="side"] .sg-cq-extra-label{gap:4px}
2068
+ .sg-cq[data-layout="side"] .sg-cq-info svg{width:12px;height:12px}
2069
+ .sg-cq[data-layout="side"] .sg-cq-card:not(:has(.sg-cq-tag)) .sg-cq-main{padding-top:0}
2070
+ .sg-cq-route-icons{display:flex;align-items:center;gap:2px}
2071
+ .sg-cq-route-icons .sg-cq-arrow{width:10px;height:10px}
2072
+ .sg-cq-hop-inline{display:flex;align-items:center;gap:2px}
2073
+ .sg-cq-hop-inline>span{display:flex}
2074
+ .sg-cq-gap{display:inline-flex;padding:0 2px;border-radius:4px;color:var(--sg-accent);text-decoration:underline;cursor:help}
2075
+ .sg-cq[data-layout="side"] .sg-cq-wait-scale .sg-cq-parity{flex-direction:row;gap:4px}
2076
+ /* Below Figma's widths the cards must shrink, not clip (narrow page; container = the sheet). */
2077
+ .sg-ws:has(.sg-cq){container-type:inline-size}
2078
+ @container (max-width:300px){
2079
+ .sg-cq-head{padding-right:0!important}
2080
+ .sg-cq-stats{flex-wrap:wrap;gap:8px;padding-left:0}
2081
+ .sg-cq-cols{flex-wrap:wrap;gap:12px;white-space:normal}
2082
+ .sg-cq-note{width:auto;max-width:100%;text-align:left}
2083
+ .sg-cq-route-icons{flex-wrap:wrap}
2084
+ .sg-cq-extra{flex-wrap:wrap}
2085
+ .sg-cq-extra-note{margin-left:0;text-align:left}
2086
+ }
2087
+ @media (prefers-reduced-motion:reduce){.sg-cq-spin{animation:none}}
1852
2088
  `;
1853
2089
  var injected = false;
1854
2090
  function injectStyles() {
@@ -4151,34 +4387,64 @@ function SheetFrame(props) {
4151
4387
  document.addEventListener("keydown", onKey, true);
4152
4388
  return () => document.removeEventListener("keydown", onKey, true);
4153
4389
  }, []);
4154
- return /* @__PURE__ */ jsxs(
4155
- "div",
4156
- {
4157
- className: "sg-ws",
4158
- "data-wide": props.wide || void 0,
4159
- role: "dialog",
4160
- "aria-modal": "true",
4161
- "aria-label": props.label,
4162
- ref: sheetRef,
4163
- tabIndex: -1,
4164
- style: props.minHeight ? { minHeight: props.minHeight } : void 0,
4165
- children: [
4166
- /* @__PURE__ */ jsxs("div", { className: "sg-ws-top", children: [
4167
- /* @__PURE__ */ jsxs("div", { className: "sg-ws-head", children: [
4168
- /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
4169
- /* @__PURE__ */ jsx(ArrowLeft, {}),
4170
- props.backLabel ?? "Back to Exchange"
4390
+ return (
4391
+ // biome-ignore lint/a11y/noStaticElementInteractions: role is "region" or "dialog" — both carry semantics; the Tab trap only runs for the modal (dialog) case.
4392
+ // biome-ignore lint/a11y/useAriaPropsSupportedByRole: aria-modal is set only when role is "dialog" (asRegion is false); a region never receives it.
4393
+ /* @__PURE__ */ jsxs(
4394
+ "div",
4395
+ {
4396
+ className: "sg-ws",
4397
+ "data-wide": props.wide || void 0,
4398
+ role: props.asRegion ? "region" : "dialog",
4399
+ "aria-modal": props.asRegion ? void 0 : "true",
4400
+ "aria-label": props.label,
4401
+ ref: sheetRef,
4402
+ tabIndex: -1,
4403
+ onKeyDown: props.trapFocus ? (event) => {
4404
+ if (event.key !== "Tab") return;
4405
+ const root = sheetRef.current;
4406
+ if (!root) return;
4407
+ const focusable = Array.from(
4408
+ root.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')
4409
+ ).filter((el) => el.offsetParent !== null || el === document.activeElement);
4410
+ if (focusable.length === 0) {
4411
+ event.preventDefault();
4412
+ root.focus();
4413
+ return;
4414
+ }
4415
+ const first = focusable[0];
4416
+ const last = focusable[focusable.length - 1];
4417
+ const active = document.activeElement;
4418
+ if (event.shiftKey && (active === first || active === root)) {
4419
+ event.preventDefault();
4420
+ last.focus();
4421
+ } else if (!event.shiftKey && active === last) {
4422
+ event.preventDefault();
4423
+ first.focus();
4424
+ }
4425
+ } : void 0,
4426
+ style: props.minHeight ? { minHeight: props.minHeight } : void 0,
4427
+ children: [
4428
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-top", children: [
4429
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-head", children: [
4430
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
4431
+ /* @__PURE__ */ jsx(ArrowLeft, {}),
4432
+ props.backLabel ?? "Back to Exchange"
4433
+ ] }),
4434
+ props.wide || props.hideClose ? null : /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsx(CloseX, {}) })
4171
4435
  ] }),
4172
- props.wide ? null : /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsx(CloseX, {}) })
4436
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-main", children: [
4437
+ props.titleAddon ? /* @__PURE__ */ jsxs("div", { className: "sg-ws-titlerow", children: [
4438
+ /* @__PURE__ */ jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
4439
+ props.titleAddon
4440
+ ] }) : /* @__PURE__ */ jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
4441
+ props.children
4442
+ ] })
4173
4443
  ] }),
4174
- /* @__PURE__ */ jsxs("div", { className: "sg-ws-main", children: [
4175
- /* @__PURE__ */ jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
4176
- props.children
4177
- ] })
4178
- ] }),
4179
- props.footer ? /* @__PURE__ */ jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
4180
- ]
4181
- }
4444
+ props.footer ? /* @__PURE__ */ jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
4445
+ ]
4446
+ }
4447
+ )
4182
4448
  );
4183
4449
  }
4184
4450
  function WalletChip(props) {
@@ -5480,6 +5746,7 @@ function PillLauncher(props) {
5480
5746
  const openAs = props.openAs === "drawer" ? "drawer" : "modal";
5481
5747
  const [open, setOpen] = useState(!!props.defaultOpen);
5482
5748
  const buttonRef = useRef(null);
5749
+ const dialogRef = useRef(null);
5483
5750
  const close = () => {
5484
5751
  setOpen(false);
5485
5752
  requestAnimationFrame(() => buttonRef.current?.focus());
@@ -5487,7 +5754,32 @@ function PillLauncher(props) {
5487
5754
  useEffect(() => {
5488
5755
  if (!open) return;
5489
5756
  const onKey = (e) => {
5490
- if (e.key === "Escape") close();
5757
+ if (e.key === "Escape") {
5758
+ close();
5759
+ return;
5760
+ }
5761
+ if (e.key !== "Tab") return;
5762
+ const root = dialogRef.current;
5763
+ if (!root) return;
5764
+ const list = Array.from(root.querySelectorAll("a[href],button,input,select,textarea,[tabindex]")).filter(
5765
+ (el) => el.tabIndex >= 0 && !el.hasAttribute("disabled") && el.getClientRects().length > 0
5766
+ );
5767
+ if (list.length === 0) {
5768
+ e.preventDefault();
5769
+ return;
5770
+ }
5771
+ const first = list[0];
5772
+ const last = list[list.length - 1];
5773
+ const idx = list.indexOf(document.activeElement);
5774
+ if (e.shiftKey) {
5775
+ if (idx <= 0) {
5776
+ e.preventDefault();
5777
+ last.focus();
5778
+ }
5779
+ } else if (idx === -1 || idx === list.length - 1) {
5780
+ e.preventDefault();
5781
+ first.focus();
5782
+ }
5491
5783
  };
5492
5784
  document.addEventListener("keydown", onKey);
5493
5785
  return () => document.removeEventListener("keydown", onKey);
@@ -5502,7 +5794,7 @@ function PillLauncher(props) {
5502
5794
  ] }),
5503
5795
  open ? /* @__PURE__ */ jsxs("div", { className: "sg-overlay", "data-sg-overlay": openAs, children: [
5504
5796
  /* @__PURE__ */ jsx("button", { type: "button", className: "sg-overlay-scrim", tabIndex: -1, "aria-label": "Close", onClick: close }),
5505
- /* @__PURE__ */ jsx("div", { className: "sg-dialog", role: "dialog", "aria-modal": "true", "aria-label": props.verb, children: props.children(close, openAs) })
5797
+ /* @__PURE__ */ jsx("div", { ref: dialogRef, className: "sg-dialog", role: "dialog", "aria-modal": "true", "aria-label": props.verb, children: props.children(close, openAs) })
5506
5798
  ] }) : null
5507
5799
  ] });
5508
5800
  }
@@ -6175,6 +6467,658 @@ function useSolanaSourceFlow(args) {
6175
6467
  }, []);
6176
6468
  return { status, preview, plan, error, balanceRaw, cost, progress, signature, lastTxEntry, sent, addressed, needsPreparation, insufficient, solShort, run, reset };
6177
6469
  }
6470
+ function BackArrow() {
6471
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5m6-6-6 6 6 6", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) });
6472
+ }
6473
+ function ChevronDown2({ up = false }) {
6474
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", style: up ? { transform: "rotate(180deg)" } : void 0, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) });
6475
+ }
6476
+ function PolicyShield() {
6477
+ return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
6478
+ /* @__PURE__ */ jsx(
6479
+ "path",
6480
+ {
6481
+ d: "M17.0089 5.8002V7.3252C17.0089 7.85853 16.7589 8.35853 16.3255 8.66686L7.15885 15.3835C6.56719 15.8169 5.75885 15.8169 5.17552 15.3752L3.97552 14.4752C3.43385 14.0669 2.99219 13.1835 2.99219 12.5085V5.8002C2.99219 4.86686 3.70885 3.83353 4.58385 3.50853L9.14219 1.8002C9.61719 1.6252 10.3839 1.6252 10.8589 1.8002L15.4172 3.50853C16.2922 3.83353 17.0089 4.86686 17.0089 5.8002Z",
6482
+ fill: "currentColor"
6483
+ }
6484
+ ),
6485
+ /* @__PURE__ */ jsx(
6486
+ "path",
6487
+ {
6488
+ d: "M15.682 10.2829C16.232 9.88287 17.007 10.2745 17.007 10.9579V12.5245C17.007 13.1995 16.5654 14.0745 16.0237 14.4829L11.4654 17.8912C11.0654 18.1829 10.532 18.3329 9.9987 18.3329C9.46537 18.3329 8.93204 18.1829 8.53204 17.8829L7.84037 17.3662C7.39037 17.0329 7.39037 16.3579 7.84871 16.0245L15.682 10.2829Z",
6489
+ fill: "currentColor"
6490
+ }
6491
+ )
6492
+ ] });
6493
+ }
6494
+ function InfoSquare() {
6495
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
6496
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2", width: "20", height: "20", rx: "6", fill: "currentColor" }),
6497
+ /* @__PURE__ */ jsx("path", { d: "M12 10.8v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
6498
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7.7", r: "1.25", fill: "var(--sg-bg)" })
6499
+ ] });
6500
+ }
6501
+ function InfoOutline() {
6502
+ return /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
6503
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.7" }),
6504
+ /* @__PURE__ */ jsx("path", { d: "M12 11v5.4", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round" }),
6505
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7.8", r: "1.15", fill: "currentColor" })
6506
+ ] });
6507
+ }
6508
+ var FLAGGED_CATEGORY_HINTS = {
6509
+ "High-risk entity": "An entity associated with elevated financial-crime risk based on available screening data.",
6510
+ "Politically exposed person (PEP)": "A person who holds or has held a prominent public function, including close associates and family members.",
6511
+ "Unknown / unclassified": "The screening provider could not confidently assign the entity to a known risk category.",
6512
+ "Unclassified risk": "The screening provider could not confidently assign the entity to a known risk category."
6513
+ };
6514
+ var POLICY_DETAILS = {
6515
+ "always-blocked": "Cannot be changed or disabled",
6516
+ blocked: "Stops the order",
6517
+ flagged: "Does not automatically block"
6518
+ };
6519
+ function Hint({ id, label: label2, text, hint }) {
6520
+ const tipId = useId();
6521
+ const open = hint.open === id;
6522
+ const ptr = useRef("");
6523
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6524
+ /* @__PURE__ */ jsx(
6525
+ "button",
6526
+ {
6527
+ type: "button",
6528
+ className: "sg-cd-hint",
6529
+ "data-sg-hint": "",
6530
+ "aria-label": `About ${label2}`,
6531
+ "aria-expanded": open,
6532
+ "aria-describedby": open ? tipId : void 0,
6533
+ onPointerEnter: (e) => {
6534
+ ptr.current = e.pointerType;
6535
+ if (e.pointerType === "mouse") hint.setOpen(id);
6536
+ },
6537
+ onPointerLeave: (e) => {
6538
+ if (e.pointerType === "mouse") hint.setOpen(null);
6539
+ },
6540
+ onClick: () => {
6541
+ hint.setOpen(ptr.current === "mouse" ? id : open ? null : id);
6542
+ ptr.current = "";
6543
+ },
6544
+ onBlur: () => {
6545
+ ptr.current = "";
6546
+ },
6547
+ children: /* @__PURE__ */ jsx(InfoOutline, {})
6548
+ }
6549
+ ),
6550
+ open ? /* @__PURE__ */ jsx("span", { role: "tooltip", id: tipId, className: "sg-cd-tip", children: text }) : null
6551
+ ] });
6552
+ }
6553
+ function CheckRow2({ check: check2, hideNote }) {
6554
+ const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
6555
+ return /* @__PURE__ */ jsxs("li", { className: "sg-cd-check", "data-ok": check2.ok, children: [
6556
+ /* @__PURE__ */ jsxs("span", { className: "sg-cd-check-line", children: [
6557
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsx(Tick, { size: 12 }) : /* @__PURE__ */ jsx(Cross, { size: 12 }) }),
6558
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-check-label", children: label2 }),
6559
+ /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
6560
+ ] }),
6561
+ check2.note && !hideNote ? /* @__PURE__ */ jsx("span", { className: "sg-cd-check-note", children: check2.note }) : null,
6562
+ check2.reasons.map((reason) => /* @__PURE__ */ jsx("span", { className: "sg-cd-check-reason", children: humanizeComplianceReason(reason) }, reason))
6563
+ ] });
6564
+ }
6565
+ function Fact2({ label: label2, value, title, mono = false }) {
6566
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cd-fact", children: [
6567
+ /* @__PURE__ */ jsx("dt", { children: label2 }),
6568
+ /* @__PURE__ */ jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
6569
+ ] });
6570
+ }
6571
+ function QuoteChecks2(props) {
6572
+ const { compliance, cv, checks } = props;
6573
+ const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
6574
+ const summary = allPassed ? "All checks passed" : cv.label;
6575
+ const orphans = unattributedComplianceReasons(compliance, cv);
6576
+ const wallets = distinctScreenedWallets(compliance);
6577
+ const jurisdiction = formatJurisdiction(compliance?.sourceJurisdiction, compliance?.sourceCountry);
6578
+ const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
6579
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cd-panel", children: [
6580
+ /* @__PURE__ */ jsxs("section", { className: "sg-cd-card", children: [
6581
+ /* @__PURE__ */ jsxs("div", { className: "sg-cd-summary", children: [
6582
+ /* @__PURE__ */ jsxs("span", { className: "sg-cd-summary-head", "data-tone": cv.tone, children: [
6583
+ cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsx(PendingCircle, {}) : /* @__PURE__ */ jsx(TickCircle, {}),
6584
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-summary-title", children: summary })
6585
+ ] }),
6586
+ checks.length > 0 ? /* @__PURE__ */ jsxs("p", { className: "sg-cd-summary-sub", children: [
6587
+ checks.length,
6588
+ " check",
6589
+ checks.length === 1 ? " was" : "s were",
6590
+ " completed for this quote"
6591
+ ] }) : (
6592
+ // No decision was issued. Listing the controls here would be ticks for a verdict nobody gave,
6593
+ // and an unconfigured gate is not a set of passed checks.
6594
+ /* @__PURE__ */ jsx("p", { className: "sg-cd-summary-sub", children: "The gateway returned no compliance decision for this quote, so there is nothing to show. It is not a failed check." })
6595
+ )
6596
+ ] }),
6597
+ checks.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cd-checks", children: checks.map((check2) => (
6598
+ // The Figma row carries no sub-line: with ONE screened wallet the note would repeat the
6599
+ // address Quote details names two cards down. Any other note (a count of wallets) stays.
6600
+ /* @__PURE__ */ jsx(CheckRow2, { check: check2, hideNote: check2.id === "screening" && wallets.length === 1 && hasDetails }, check2.id)
6601
+ )) }) : null,
6602
+ orphans.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cd-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
6603
+ props.direct && checks.length > 0 ? /* @__PURE__ */ jsx("p", { className: "sg-cd-scope", children: DIRECT_SCOPE_NOTE }) : null
6604
+ ] }),
6605
+ compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxs("section", { className: "sg-cd-card", children: [
6606
+ /* @__PURE__ */ jsx("h4", { className: "sg-cd-card-title", children: "Flagged, not blocking" }),
6607
+ /* @__PURE__ */ jsx("p", { className: "sg-cd-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
6608
+ /* @__PURE__ */ jsx("p", { className: "sg-cd-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
6609
+ ] }) : null,
6610
+ hasDetails ? /* @__PURE__ */ jsxs("section", { className: "sg-cd-card", children: [
6611
+ /* @__PURE__ */ jsxs("div", { className: "sg-cd-card-head", children: [
6612
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-card-glyph", children: /* @__PURE__ */ jsx(InfoSquare, {}) }),
6613
+ /* @__PURE__ */ jsx("h4", { className: "sg-cd-card-title", children: "Quote details" })
6614
+ ] }),
6615
+ /* @__PURE__ */ jsxs("dl", { className: "sg-cd-facts", children: [
6616
+ jurisdiction ? /* @__PURE__ */ jsx(Fact2, { label: "Jurisdiction", value: jurisdiction }) : null,
6617
+ wallets.map((w, i) => /* @__PURE__ */ jsx(Fact2, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: false }, w)),
6618
+ compliance?.checkId ? /* @__PURE__ */ jsx(Fact2, { label: "Check ID", value: compliance.checkId, mono: true }) : null
6619
+ ] })
6620
+ ] }) : null
6621
+ ] });
6622
+ }
6623
+ function riskRuleCount() {
6624
+ return SCREENING_BUCKETS.reduce((total, bucket) => total + bucket.categories.length, 0);
6625
+ }
6626
+ function appliedPolicies(compliance) {
6627
+ const names = compliance?.appliedPolicyNames ?? [];
6628
+ const legislation = compliance?.appliedLegislation ?? [];
6629
+ const applied = Boolean(compliance?.decision || compliance?.policyVersion?.trim()) || names.length > 0;
6630
+ if (!applied) return [];
6631
+ const ids = compliance?.appliedPolicyIds ?? [];
6632
+ const summary = `${riskRuleCount()} risk rules`;
6633
+ const statements = legislation.map((name, i) => ({ id: `legislation-${i}-${name}`, name, summary: null, buckets: null }));
6634
+ if (names.length === 0) return [{ id: "zd-screening-matrix", name: "Transaction screening", summary, buckets: SCREENING_BUCKETS }, ...statements];
6635
+ if (names.length === 1) return [{ id: ids[0] ?? names[0], name: names[0], summary, buckets: SCREENING_BUCKETS }, ...statements];
6636
+ return [
6637
+ ...names.map((name, i) => ({ id: ids[i] ?? `${name}-${i}`, name, summary: null, buckets: null })),
6638
+ ...statements,
6639
+ { id: "zd-screening-matrix", name: "Transaction screening", summary, buckets: SCREENING_BUCKETS }
6640
+ ];
6641
+ }
6642
+ function PolicyBuckets({ policyId, layout, hint }) {
6643
+ return /* @__PURE__ */ jsx(Fragment, { children: SCREENING_BUCKETS.map((bucket) => {
6644
+ const detail = POLICY_DETAILS[bucket.outcome];
6645
+ const bucketHint = `${policyId}:${bucket.outcome}`;
6646
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cd-bucket", "data-outcome": bucket.outcome, children: [
6647
+ /* @__PURE__ */ jsxs("div", { className: "sg-cd-bucket-head", children: [
6648
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-bucket-title", children: bucket.title }),
6649
+ layout === "side" ? /* @__PURE__ */ jsx(Hint, { id: bucketHint, label: bucket.title, text: detail, hint }) : /* @__PURE__ */ jsx("span", { className: "sg-cd-bucket-detail", children: detail })
6650
+ ] }),
6651
+ /* @__PURE__ */ jsx("ul", { className: "sg-cd-cats", children: bucket.categories.map((category) => {
6652
+ const text = bucket.outcome === "flagged" ? FLAGGED_CATEGORY_HINTS[category] : void 0;
6653
+ return /* @__PURE__ */ jsxs("li", { children: [
6654
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-dot", "aria-hidden": "true" }),
6655
+ /* @__PURE__ */ jsx("span", { children: category }),
6656
+ text ? /* @__PURE__ */ jsx(Hint, { id: `${policyId}:${category}`, label: category, text, hint }) : null
6657
+ ] }, category);
6658
+ }) })
6659
+ ] }, bucket.outcome);
6660
+ }) });
6661
+ }
6662
+ function PolicyRow({
6663
+ policy,
6664
+ open,
6665
+ onToggle,
6666
+ layout,
6667
+ hint,
6668
+ policyVersion
6669
+ }) {
6670
+ const bodyId = useId();
6671
+ const head = /* @__PURE__ */ jsxs(Fragment, { children: [
6672
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-policy-mark", children: /* @__PURE__ */ jsx(PolicyShield, {}) }),
6673
+ /* @__PURE__ */ jsxs("span", { className: "sg-cd-policy-text", children: [
6674
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-policy-name", children: policy.name }),
6675
+ policy.summary ? /* @__PURE__ */ jsx("span", { className: "sg-cd-policy-sub", children: policy.summary }) : null
6676
+ ] }),
6677
+ policy.buckets ? /* @__PURE__ */ jsx("span", { className: "sg-cd-policy-chev", children: /* @__PURE__ */ jsx(ChevronDown2, { up: open }) }) : null
6678
+ ] });
6679
+ if (!policy.buckets) return /* @__PURE__ */ jsx("div", { className: "sg-cd-policy", children: /* @__PURE__ */ jsx("div", { className: "sg-cd-policy-head", "data-static": "", children: head }) });
6680
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cd-policy", "data-open": open, children: [
6681
+ /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cd-policy-head", "aria-expanded": open, "aria-controls": bodyId, onClick: onToggle, children: head }),
6682
+ open ? /* @__PURE__ */ jsxs("div", { id: bodyId, className: "sg-cd-policy-body", children: [
6683
+ /* @__PURE__ */ jsx(PolicyBuckets, { policyId: policy.id, layout, hint }),
6684
+ policyVersion ? /* @__PURE__ */ jsxs("p", { className: "sg-cd-policy-version sg-mono", children: [
6685
+ "Policy version ",
6686
+ policyVersion
6687
+ ] }) : null
6688
+ ] }) : null
6689
+ ] });
6690
+ }
6691
+ function AppliedPolicies({ policies, layout, hint, policyVersion }) {
6692
+ const [openId, setOpenId] = useState(() => policies.find((p) => p.buckets)?.id ?? null);
6693
+ if (policies.length === 0) {
6694
+ return /* @__PURE__ */ jsx("div", { className: "sg-cd-panel", children: /* @__PURE__ */ jsx("section", { className: "sg-cd-card", children: /* @__PURE__ */ jsxs("div", { className: "sg-cd-summary", children: [
6695
+ /* @__PURE__ */ jsxs("span", { className: "sg-cd-summary-head", "data-tone": "neutral", children: [
6696
+ /* @__PURE__ */ jsx(PendingCircle, {}),
6697
+ /* @__PURE__ */ jsx("span", { className: "sg-cd-summary-title", children: "No policy decision was returned" })
6698
+ ] }),
6699
+ /* @__PURE__ */ jsx("p", { className: "sg-cd-summary-sub", children: "There is no applied policy to show for this quote. It is not a failed check." })
6700
+ ] }) }) });
6701
+ }
6702
+ return /* @__PURE__ */ jsx("div", { className: "sg-cd-panel sg-cd-policies", children: policies.map((policy) => /* @__PURE__ */ jsx(
6703
+ PolicyRow,
6704
+ {
6705
+ policy,
6706
+ open: openId === policy.id,
6707
+ onToggle: () => setOpenId(openId === policy.id ? null : policy.id),
6708
+ layout,
6709
+ hint,
6710
+ policyVersion: openId === policy.id ? policyVersion : void 0
6711
+ },
6712
+ policy.id
6713
+ )) });
6714
+ }
6715
+ function ComplianceDetails(props) {
6716
+ const [tab, setTab] = useState("checks");
6717
+ const [hintOpen, setHintOpen] = useState(null);
6718
+ const rootRef = useRef(null);
6719
+ const ids = useId();
6720
+ const compliance = props.compliance ?? null;
6721
+ const cv = complianceView(compliance, props.hasQuote ?? true);
6722
+ const allChecks = complianceChecks(compliance, cv);
6723
+ const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
6724
+ const policies = appliedPolicies(compliance);
6725
+ const policyVersion = compliance?.policyVersion?.trim() || void 0;
6726
+ const onBackRef = useRef(props.onBack);
6727
+ onBackRef.current = props.onBack;
6728
+ const hintRef = useRef(hintOpen);
6729
+ hintRef.current = hintOpen;
6730
+ useEffect(() => {
6731
+ rootRef.current?.focus({ preventScroll: true });
6732
+ const onKey = (e) => {
6733
+ if (e.key !== "Escape") return;
6734
+ e.stopPropagation();
6735
+ if (hintRef.current) setHintOpen(null);
6736
+ else onBackRef.current();
6737
+ };
6738
+ const onPointer = (e) => {
6739
+ if (hintRef.current && !e.target?.closest?.("[data-sg-hint]")) setHintOpen(null);
6740
+ };
6741
+ document.addEventListener("keydown", onKey, true);
6742
+ document.addEventListener("pointerdown", onPointer, true);
6743
+ return () => {
6744
+ document.removeEventListener("keydown", onKey, true);
6745
+ document.removeEventListener("pointerdown", onPointer, true);
6746
+ };
6747
+ }, []);
6748
+ const tabKeys = (e) => {
6749
+ const order = ["checks", "policy"];
6750
+ let next = null;
6751
+ if (e.key === "Home") next = order[0];
6752
+ else if (e.key === "End") next = order[order.length - 1];
6753
+ else if (e.key === "ArrowRight") next = order[(order.indexOf(tab) + 1) % order.length];
6754
+ else if (e.key === "ArrowLeft") next = order[(order.indexOf(tab) - 1 + order.length) % order.length];
6755
+ if (next === null) return;
6756
+ e.preventDefault();
6757
+ setTab(next);
6758
+ document.getElementById(`${ids}-tab-${next}`)?.focus();
6759
+ };
6760
+ const hint = { open: hintOpen, setOpen: setHintOpen };
6761
+ return /* @__PURE__ */ jsxs("section", { className: "sg-cd", "data-layout": props.layout, "aria-label": "Compliance details", ref: rootRef, tabIndex: -1, children: [
6762
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cd-back", onClick: props.onBack, children: [
6763
+ /* @__PURE__ */ jsx(BackArrow, {}),
6764
+ /* @__PURE__ */ jsx("span", { children: "Back to Exchange" })
6765
+ ] }),
6766
+ /* @__PURE__ */ jsx("h3", { className: "sg-cd-title", children: "Compliance details" }),
6767
+ /* @__PURE__ */ jsxs("div", { className: "sg-cd-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
6768
+ /* @__PURE__ */ jsx(
6769
+ "button",
6770
+ {
6771
+ type: "button",
6772
+ role: "tab",
6773
+ id: `${ids}-tab-checks`,
6774
+ "aria-selected": tab === "checks",
6775
+ "aria-controls": `${ids}-panel`,
6776
+ tabIndex: tab === "checks" ? 0 : -1,
6777
+ "data-active": tab === "checks",
6778
+ className: "sg-cd-tab",
6779
+ onClick: () => setTab("checks"),
6780
+ onKeyDown: tabKeys,
6781
+ children: "Quote checks"
6782
+ }
6783
+ ),
6784
+ /* @__PURE__ */ jsxs(
6785
+ "button",
6786
+ {
6787
+ type: "button",
6788
+ role: "tab",
6789
+ id: `${ids}-tab-policy`,
6790
+ "aria-selected": tab === "policy",
6791
+ "aria-controls": `${ids}-panel`,
6792
+ tabIndex: tab === "policy" ? 0 : -1,
6793
+ "data-active": tab === "policy",
6794
+ className: "sg-cd-tab",
6795
+ onClick: () => setTab("policy"),
6796
+ onKeyDown: tabKeys,
6797
+ children: [
6798
+ "Applied policies",
6799
+ policies.length > 0 ? /* @__PURE__ */ jsx("span", { className: "sg-cd-tab-count", children: policies.length }) : null
6800
+ ]
6801
+ }
6802
+ )
6803
+ ] }),
6804
+ /* @__PURE__ */ jsx("div", { id: `${ids}-panel`, role: "tabpanel", "aria-labelledby": `${ids}-tab-${tab}`, children: tab === "checks" ? /* @__PURE__ */ jsx(QuoteChecks2, { compliance, cv, checks, direct: !!props.direct }) : /* @__PURE__ */ jsx(AppliedPolicies, { policies, layout: props.layout, hint, policyVersion }) })
6805
+ ] });
6806
+ }
6807
+ function RefreshGlyph({ spinning }) {
6808
+ return /* @__PURE__ */ jsx("svg", { className: spinning ? "sg-cq-spin" : void 0, width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4.22639 4.22667C4.71306 3.74 5.28639 3.35333 5.91972 3.08667C6.57972 2.80667 7.27306 2.66667 7.99306 2.66667V1.33333C7.09306 1.33333 6.21972 1.50667 5.39972 1.86C4.60639 2.19333 3.89306 2.68 3.27972 3.28667C2.66639 3.9 2.18639 4.61333 1.85306 5.40667C1.50639 6.22667 1.32639 7.1 1.32639 8C1.32639 8.9 1.49972 9.77333 1.85306 10.5933C2.18639 11.3867 2.66639 12.1 3.27972 12.7133C3.39306 12.8267 3.51306 12.9267 3.62639 13.0333L1.99306 14.6667H5.99306V10.6667L4.57306 12.0867C4.45306 11.9867 4.33306 11.88 4.22639 11.7667C3.7398 11.2804 3.3506 10.7057 3.07972 10.0733C2.79972 9.41333 2.65972 8.72 2.65972 8C2.65972 7.28 2.79972 6.58 3.07972 5.92667C3.34639 5.29333 3.73306 4.72 4.22639 4.23333V4.22667ZM12.7131 3.28667C12.5997 3.17333 12.4797 3.07333 12.3664 2.96667L13.9997 1.33333H9.99972V5.33333L11.4197 3.91333C11.5397 4.01333 11.6597 4.12 11.7664 4.23333C12.2597 4.72667 12.6397 5.29333 12.9131 5.92667C13.1931 6.58667 13.3331 7.28 13.3331 8C13.3331 8.72 13.1931 9.42 12.9131 10.0733C12.6464 10.7067 12.2597 11.28 11.7664 11.7667C11.2797 12.2533 10.7064 12.64 10.0731 12.9067C9.41306 13.1867 8.71972 13.3267 7.99972 13.3267V14.66C8.89972 14.66 9.77306 14.4867 10.5931 14.1333C11.3864 13.8 12.0997 13.3133 12.7131 12.7067C13.3264 12.0933 13.8064 11.38 14.1397 10.5867C14.4864 9.76667 14.6664 8.89333 14.6664 7.99333C14.6664 7.09333 14.4931 6.22 14.1397 5.4C13.8068 4.60714 13.3222 3.88698 12.7131 3.28V3.28667Z" }) });
6809
+ }
6810
+ function SliderGrip() {
6811
+ return /* @__PURE__ */ jsxs("svg", { width: "28", height: "12", viewBox: "0 0 28 12", fill: "none", "aria-hidden": "true", children: [
6812
+ /* @__PURE__ */ jsx("rect", { x: "0.5", y: "0.5", width: "27", height: "11", rx: "5.5", fill: "rgba(255,255,255,0.3)" }),
6813
+ /* @__PURE__ */ jsx("path", { d: "M11 3l3 3-3 3M15 3l3 3-3 3", stroke: "#fff", strokeWidth: "1.1", strokeLinecap: "round", strokeLinejoin: "round" })
6814
+ ] });
6815
+ }
6816
+ function WalletAddGlyph() {
6817
+ return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
6818
+ /* @__PURE__ */ jsx("path", { d: "M9.95 1.84167L7.94167 6.51667H5.93333C5.6 6.51667 5.275 6.54167 4.95833 6.60833L5.79167 4.60833L5.825 4.53333L5.875 4.4C5.9 4.34167 5.91667 4.29167 5.94167 4.25C6.90833 2.00833 7.99167 1.30833 9.95 1.84167Z" }),
6819
+ /* @__PURE__ */ jsx("path", { d: "M15.6083 6.74167L15.5917 6.73333C15.0917 6.59167 14.5833 6.51667 14.0667 6.51667H8.85L10.725 2.15833L10.75 2.1C10.8667 2.14167 10.9917 2.2 11.1167 2.24167L12.9583 3.01667C13.9833 3.44167 14.7 3.88333 15.1417 4.41667C15.2167 4.51667 15.2833 4.60833 15.35 4.71667C15.425 4.83333 15.4833 4.95 15.5167 5.075C15.55 5.15 15.575 5.21667 15.5917 5.29167C15.7167 5.71667 15.725 6.2 15.6083 6.74167Z" }),
6820
+ /* @__PURE__ */ jsx("path", { d: "M15.2417 7.93333C14.8667 7.825 14.475 7.76667 14.0667 7.76667H5.93333C5.36667 7.76667 4.83333 7.875 4.33333 8.09167C2.88333 8.71667 1.86667 10.1583 1.86667 11.8333V13.4583C1.86667 13.6583 1.88333 13.85 1.90833 14.05C2.09167 16.7 3.50833 18.1167 6.15833 18.2917C6.35 18.3167 6.54167 18.3333 6.75 18.3333H13.25C16.3333 18.3333 17.9583 16.8667 18.1167 13.95C18.125 13.7917 18.1333 13.625 18.1333 13.4583V11.8333C18.1333 9.99167 16.9083 8.44167 15.2417 7.93333ZM12.0833 13.4917H10.625V15C10.625 15.3417 10.3417 15.625 10 15.625C9.65833 15.625 9.375 15.3417 9.375 15V13.4917H7.91667C7.575 13.4917 7.29167 13.2167 7.29167 12.8667C7.29167 12.525 7.575 12.2417 7.91667 12.2417H9.375V10.8333C9.375 10.4917 9.65833 10.2083 10 10.2083C10.3417 10.2083 10.625 10.4917 10.625 10.8333V12.2417H12.0833C12.425 12.2417 12.7083 12.525 12.7083 12.8667C12.7083 13.2167 12.425 13.4917 12.0833 13.4917Z" })
6821
+ ] });
6822
+ }
6823
+ function ChevronGlyph2({ up }) {
6824
+ return /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", style: up ? { transform: "scaleY(-1)" } : void 0, children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.5 6 8l3.5-3.5", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
6825
+ }
6826
+ function ArrowGlyph2() {
6827
+ return /* @__PURE__ */ jsx("svg", { className: "sg-cq-arrow", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8h9M9 4.5 12.5 8 9 11.5", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
6828
+ }
6829
+ function InfoGlyph() {
6830
+ return /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: [
6831
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "5.6", stroke: "currentColor", strokeWidth: "1" }),
6832
+ /* @__PURE__ */ jsx("path", { d: "M7 6.2v3.4", stroke: "currentColor", strokeWidth: "1.1", strokeLinecap: "round" }),
6833
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "4.5", r: ".7", fill: "currentColor" })
6834
+ ] });
6835
+ }
6836
+ function unavailableCopy(status) {
6837
+ return status === "unsigned-cross-chain-off" ? "Cross-chain orders are not enabled yet" : status === "router-unresolved" || status === "escrow-unresolved" ? "Not available on this network yet" : "Not available right now";
6838
+ }
6839
+ function compareFeeLabel(usd) {
6840
+ if (usd === null) return "--";
6841
+ if (!Number.isFinite(usd) || usd <= 0) return "$0.00";
6842
+ if (usd >= 0.01) return `$${usd.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
6843
+ if (usd < 1e-6) return "<$0.000001";
6844
+ return `$${usd.toLocaleString("en-US", { maximumSignificantDigits: 2 })}`;
6845
+ }
6846
+ function logoOf(tokens, hop) {
6847
+ const wanted = hop.address.toLowerCase();
6848
+ return tokens.find((t) => Number(t.chainId) === hop.chainId && String(t.address).toLowerCase() === wanted)?.logoUrl;
6849
+ }
6850
+ var WIDE_SCALE_TRAVEL_PX = 189 * 228 / 130;
6851
+ function thumbWidth(fraction) {
6852
+ return `max(32px, calc((100% - 4px) * ${fraction}))`;
6853
+ }
6854
+ function CompareQuotes(props) {
6855
+ const side = props.layout === "side";
6856
+ const sliderId = useId();
6857
+ const options = props.compare?.options ?? [];
6858
+ const selectedId = props.compare?.selectedId ?? null;
6859
+ const selected = options.find((o) => o.id === selectedId && !o.unavailable)?.id ?? options.find((o) => !o.unavailable)?.id ?? null;
6860
+ const picked = options.find((o) => o.id === selectedId && !o.unavailable);
6861
+ const [movedWait, setMovedWait] = useState(null);
6862
+ const wait = movedWait ?? (picked ? clampWait(picked.estimatedDuration) : proposedWait(options));
6863
+ const [openRoutes, setOpenRoutes] = useState(() => /* @__PURE__ */ new Set());
6864
+ const parityState = props.compare?.parity ?? { kind: "unknown" };
6865
+ const extra = props.compare ? extraVsFastest(options, selected) : null;
6866
+ const selectedOption = options.find((o) => o.id === selected);
6867
+ const anySelectable = options.some((o) => !o.unavailable);
6868
+ const moveWait = (sec) => {
6869
+ setMovedWait(sec);
6870
+ const pick = pickForWait(options, sec);
6871
+ if (pick && pick.id !== selected) props.onSelect(pick.id);
6872
+ };
6873
+ const pickCard = (option) => {
6874
+ if (props.onSelect(option.id)) setMovedWait(clampWait(option.estimatedDuration));
6875
+ };
6876
+ const toggleRoute = (id) => setOpenRoutes((prev) => {
6877
+ const next = new Set(prev);
6878
+ if (next.has(id)) next.delete(id);
6879
+ else next.add(id);
6880
+ return next;
6881
+ });
6882
+ const trackRef = useRef(null);
6883
+ const listRef = useRef(null);
6884
+ const [travel, setTravel] = useState(400);
6885
+ useLayoutEffect(() => {
6886
+ const el = trackRef.current;
6887
+ if (!el) return;
6888
+ const measure = () => setTravel(el.offsetWidth - 4);
6889
+ measure();
6890
+ if (typeof ResizeObserver === "undefined") return;
6891
+ const ro = new ResizeObserver(measure);
6892
+ ro.observe(el);
6893
+ return () => ro.disconnect();
6894
+ }, [anySelectable]);
6895
+ const scale = useMemo(() => waitScaleFor(side ? WIDE_SCALE_TRAVEL_PX : travel), [side, travel]);
6896
+ const pct = waitFraction(wait, scale) * 100;
6897
+ const shown = useMemo(() => visibleOptions(options, wait, selected), [options, wait, selected]);
6898
+ const rovingId = shown.find((o) => o.id === selected && !o.unavailable)?.id ?? shown.find((o) => !o.unavailable)?.id ?? null;
6899
+ const refresh = props.onRefresh ? /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cq-refresh", onClick: props.onRefresh, "aria-label": "Refresh quotes", "aria-busy": props.refreshing || void 0, children: /* @__PURE__ */ jsx(RefreshGlyph, { spinning: !!props.refreshing }) }) : void 0;
6900
+ return /* @__PURE__ */ jsx(SheetFrame, { label: "Compare quotes", title: "Compare quotes", titleAddon: refresh, hideClose: true, wide: side, asRegion: !props.modal, trapFocus: props.modal, onClose: props.onBack, children: /* @__PURE__ */ jsxs("div", { className: "sg-cq", "data-layout": props.layout, children: [
6901
+ anySelectable ? /* @__PURE__ */ jsxs("div", { className: "sg-cq-wait", "data-testid": "compare-wait", children: [
6902
+ /* @__PURE__ */ jsxs("div", { className: "sg-cq-wait-top", children: [
6903
+ /* @__PURE__ */ jsxs("div", { className: "sg-cq-wait-row", children: [
6904
+ /* @__PURE__ */ jsx("label", { htmlFor: sliderId, children: "I'm willing to wait" }),
6905
+ /* @__PURE__ */ jsx("span", { "data-testid": "compare-wait-label", children: waitLabel(wait) })
6906
+ ] }),
6907
+ /* @__PURE__ */ jsxs("div", { className: "sg-cq-wait-scale", children: [
6908
+ /* @__PURE__ */ jsxs("div", { ref: trackRef, className: "sg-cq-track", children: [
6909
+ /* @__PURE__ */ jsx(
6910
+ "input",
6911
+ {
6912
+ id: sliderId,
6913
+ className: "sg-cq-range",
6914
+ type: "range",
6915
+ min: 0,
6916
+ max: WAIT_POSITIONS,
6917
+ step: 1,
6918
+ value: Math.round(pct * WAIT_POSITIONS / 100),
6919
+ "aria-valuetext": waitLabel(wait),
6920
+ onChange: (e) => moveWait(snapWait(waitFromFraction(Number(e.target.value) / WAIT_POSITIONS, scale))),
6921
+ onKeyDown: (e) => {
6922
+ const dir = e.key === "ArrowRight" || e.key === "ArrowUp" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowDown" ? -1 : 0;
6923
+ if (dir === 0) return;
6924
+ e.preventDefault();
6925
+ moveWait(snapWait(wait + dir * WAIT_STEP_SEC));
6926
+ }
6927
+ }
6928
+ ),
6929
+ /* @__PURE__ */ jsx("div", { className: "sg-cq-rail", "aria-hidden": "true" }),
6930
+ /* @__PURE__ */ jsx("div", { className: "sg-cq-thumb", "aria-hidden": "true", style: { width: thumbWidth(pct / 100) }, children: /* @__PURE__ */ jsx(SliderGrip, {}) })
6931
+ ] }),
6932
+ /* @__PURE__ */ jsxs("div", { className: "sg-cq-ends", children: [
6933
+ /* @__PURE__ */ jsx("span", { children: "3 min" }),
6934
+ /* @__PURE__ */ jsx("span", { children: "2 h" }),
6935
+ parityState.kind === "at" ? /* @__PURE__ */ jsxs(
6936
+ "span",
6937
+ {
6938
+ className: "sg-cq-parity",
6939
+ "data-testid": "compare-parity",
6940
+ style: { left: `clamp(${side ? 60 : 44}px, calc(${thumbWidth(waitFraction(parityState.timeSec, scale))} - 13px), calc(100% - ${side ? 60 : 44}px))` },
6941
+ children: [
6942
+ /* @__PURE__ */ jsx("span", { children: "1:1" }),
6943
+ " ",
6944
+ /* @__PURE__ */ jsx("span", { children: compareDuration(parityState.timeSec) })
6945
+ ]
6946
+ }
6947
+ ) : null,
6948
+ parityState.kind === "unavailable" ? /* @__PURE__ */ jsx("span", { className: "sg-cq-parity-none", "data-testid": "compare-parity", children: "1:1 currently unavailable" }) : null
6949
+ ] })
6950
+ ] })
6951
+ ] }),
6952
+ extra !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
6953
+ /* @__PURE__ */ jsx("div", { className: "sg-cq-rule", "aria-hidden": "true" }),
6954
+ /* @__PURE__ */ jsxs("div", { className: "sg-cq-extra", "data-testid": "compare-extra", children: [
6955
+ /* @__PURE__ */ jsx("span", { className: "sg-cq-extra-icon", children: /* @__PURE__ */ jsx(WalletAddGlyph, {}) }),
6956
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-extra-text", children: [
6957
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-extra-label", children: [
6958
+ "Potential extra received",
6959
+ side ? /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cq-info", "aria-label": `Compared with fastest${selectedOption?.entersNetting ? ". Depends on a matching order" : ""}`, title: `Compared with fastest${selectedOption?.entersNetting ? "\nDepends on a matching order" : ""}`, children: /* @__PURE__ */ jsx(InfoGlyph, {}) }) : null
6960
+ ] }),
6961
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-extra-amt", children: [
6962
+ "+",
6963
+ compareAmount(extra),
6964
+ " ",
6965
+ props.toSymbol
6966
+ ] })
6967
+ ] }),
6968
+ side ? null : /* @__PURE__ */ jsxs("span", { className: "sg-cq-extra-note", children: [
6969
+ "Compared with fastest",
6970
+ selectedOption?.entersNetting ? /* @__PURE__ */ jsxs(Fragment, { children: [
6971
+ /* @__PURE__ */ jsx("br", {}),
6972
+ "Depends on a matching order"
6973
+ ] }) : null
6974
+ ] })
6975
+ ] })
6976
+ ] }) : null
6977
+ ] }) : null,
6978
+ /* @__PURE__ */ jsxs(
6979
+ "div",
6980
+ {
6981
+ role: "radiogroup",
6982
+ "aria-label": "Quotes",
6983
+ className: "sg-cq-list",
6984
+ ref: listRef,
6985
+ onKeyDown: (e) => {
6986
+ const dir = e.key === "ArrowDown" || e.key === "ArrowRight" ? 1 : e.key === "ArrowUp" || e.key === "ArrowLeft" ? -1 : 0;
6987
+ if (dir === 0) return;
6988
+ const pickable = shown.filter((o) => !o.unavailable);
6989
+ if (pickable.length === 0) return;
6990
+ e.preventDefault();
6991
+ const cur = Math.max(0, pickable.findIndex((o) => o.id === rovingId));
6992
+ const next = pickable[(cur + dir + pickable.length) % pickable.length];
6993
+ pickCard(next);
6994
+ requestAnimationFrame(() => listRef.current?.querySelector(`[data-oid="${CSS.escape(next.id)}"]`)?.focus());
6995
+ },
6996
+ children: [
6997
+ shown.map((option) => /* @__PURE__ */ jsx(
6998
+ QuoteCard,
6999
+ {
7000
+ option,
7001
+ isSelected: option.id === selected,
7002
+ tabIndex: option.id === rovingId ? 0 : -1,
7003
+ tags: cornerTags(options, option, parityState),
7004
+ toSymbol: props.toSymbol,
7005
+ side,
7006
+ routeOpen: openRoutes.has(option.id),
7007
+ tokens: props.tokens,
7008
+ chainName: props.chainName,
7009
+ onPick: () => pickCard(option),
7010
+ onToggleRoute: () => toggleRoute(option.id)
7011
+ },
7012
+ option.id
7013
+ )),
7014
+ options.length === 0 ? /* @__PURE__ */ jsx("p", { role: "status", className: "sg-cq-empty", children: props.emptyMessage ?? "No quote yet \u2014 enter an amount to get one." }) : null
7015
+ ]
7016
+ }
7017
+ )
7018
+ ] }) });
7019
+ }
7020
+ function Column({ label: label2, value }) {
7021
+ return /* @__PURE__ */ jsxs("span", { className: "sg-cq-col", children: [
7022
+ /* @__PURE__ */ jsx("span", { className: "sg-cq-col-label", children: label2 }),
7023
+ /* @__PURE__ */ jsx("span", { className: "sg-cq-col-value", children: value })
7024
+ ] });
7025
+ }
7026
+ function HopMark({ hop, tokens, size }) {
7027
+ return /* @__PURE__ */ jsx(TokenGlyph, { symbol: hop.ticker, logoUrl: logoOf(tokens, hop), chainId: hop.chainId, size });
7028
+ }
7029
+ function QuoteCard(props) {
7030
+ const { option, tags, side } = props;
7031
+ const routeId = useId();
7032
+ const headRef = useRef(null);
7033
+ const tagRef = useRef(null);
7034
+ const [tagInset, setTagInset] = useState(null);
7035
+ useLayoutEffect(() => {
7036
+ const head = headRef.current;
7037
+ const tag = tagRef.current;
7038
+ if (side || !head || !tag) return setTagInset(null);
7039
+ const measure = () => setTagInset(Math.max(0, Math.ceil(head.getBoundingClientRect().right - tag.getBoundingClientRect().left) + 8));
7040
+ measure();
7041
+ if (typeof ResizeObserver === "undefined") return;
7042
+ const observer = new ResizeObserver(measure);
7043
+ observer.observe(tag);
7044
+ observer.observe(head);
7045
+ return () => observer.disconnect();
7046
+ }, [tags.length, side]);
7047
+ const netting = !!option.entersNetting;
7048
+ const gasless = !!option.gasSponsored;
7049
+ const note = netting ? "Matches your swap with an opposite order" : gasless ? "No native token needed for gas" : null;
7050
+ const nettingTag = tags.some((t) => t.tone === "green");
7051
+ const purple = tags[0]?.tone === "purple" && !nettingTag;
7052
+ const hops = option.hops;
7053
+ const collapsed = side && hops.length > 3;
7054
+ const inline = collapsed ? [hops[0], hops[1], "gap", hops[hops.length - 1]] : hops;
7055
+ const hidden3 = collapsed ? hops.slice(2, -1) : [];
7056
+ const routeIcons = /* @__PURE__ */ jsx("span", { className: "sg-cq-route-icons", "data-testid": "compare-route-inline", children: inline.map((hop, i) => /* @__PURE__ */ jsxs("span", { className: "sg-cq-hop-inline", children: [
7057
+ i > 0 ? /* @__PURE__ */ jsx(ArrowGlyph2, {}) : null,
7058
+ hop === "gap" ? /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cq-gap", title: hidden3.map((h) => `${h.ticker} on ${props.chainName(h.chainId)}`).join(" \u2192 "), "aria-label": `Also via ${hidden3.map((h) => `${h.ticker} on ${props.chainName(h.chainId)}`).join(", ")}`, children: "\u2026" }) : /* @__PURE__ */ jsx("span", { title: `${hop.ticker} on ${props.chainName(hop.chainId)}`, children: /* @__PURE__ */ jsx(HopMark, { hop, tokens: props.tokens, size: "xxs" }) })
7059
+ ] }, hop === "gap" ? "gap" : `${hop.chainId}-${hop.address}-${i}`)) });
7060
+ const fee = compareFeeLabel(option.feeUsd);
7061
+ const tagEl = tags.length > 0 ? /* @__PURE__ */ jsx("span", { ref: tagRef, className: "sg-cq-tag", "data-kind": nettingTag ? "netting" : purple ? "purple" : "brand", children: tags.map((tag, i) => /* @__PURE__ */ jsxs("span", { className: "sg-cq-tag-item", children: [
7062
+ i > 0 ? /* @__PURE__ */ jsx("span", { className: "sg-cq-tag-dot", "aria-hidden": "true" }) : null,
7063
+ /* @__PURE__ */ jsx("span", { "data-tone": tag.tone, children: tag.text })
7064
+ ] }, tag.text)) }) : null;
7065
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
7066
+ /* @__PURE__ */ jsxs("span", { ref: headRef, className: "sg-cq-head", style: tagInset === null ? void 0 : { paddingRight: tagInset }, children: [
7067
+ /* @__PURE__ */ jsx("span", { className: "sg-cq-radio", "data-on": props.isSelected || void 0, "aria-hidden": "true" }),
7068
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-amount", children: [
7069
+ tags.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "sg-cq-sr", children: [
7070
+ tags.map((t) => t.text).join(", "),
7071
+ " "
7072
+ ] }) : option.label ? /* @__PURE__ */ jsxs("span", { className: "sg-cq-sr", children: [
7073
+ option.label.toLowerCase().replace(/^./, (c) => c.toUpperCase()),
7074
+ " "
7075
+ ] }) : null,
7076
+ netting ? "~" : "",
7077
+ compareAmount(option.amount),
7078
+ " ",
7079
+ props.toSymbol
7080
+ ] })
7081
+ ] }),
7082
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-stats", children: [
7083
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-cols", children: [
7084
+ /* @__PURE__ */ jsx(Column, { label: "Est. time", value: netting ? compareDuration(option.estimatedDuration).replace(/^~/, "") : compareDuration(option.estimatedDuration) }),
7085
+ gasless ? /* @__PURE__ */ jsx(Column, { label: "Gas fee", value: "Sponsored" }) : /* @__PURE__ */ jsx(Column, { label: netting ? "Est. fee" : "Fee", value: fee }),
7086
+ side && hops.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "sg-cq-col", children: [
7087
+ /* @__PURE__ */ jsx("span", { className: "sg-cq-col-label", children: "Route" }),
7088
+ routeIcons
7089
+ ] }) : null
7090
+ ] }),
7091
+ !side && note ? /* @__PURE__ */ jsx("span", { className: "sg-cq-note", children: note }) : null
7092
+ ] }),
7093
+ option.unavailable ? /* @__PURE__ */ jsx("span", { className: "sg-cq-why", children: unavailableCopy(option.unavailable) }) : null
7094
+ ] });
7095
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cq-card", "data-testid": "compare-quote", "data-selected": props.isSelected || void 0, "data-unavailable": option.unavailable ? true : void 0, children: [
7096
+ tagEl,
7097
+ /* @__PURE__ */ jsx("button", { type: "button", role: "radio", "aria-checked": props.isSelected, disabled: !!option.unavailable, tabIndex: props.tabIndex, "data-oid": option.id, onClick: props.onPick, className: "sg-cq-main", children: body }),
7098
+ !side && hops.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "sg-cq-route", children: [
7099
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cq-route-toggle", onClick: props.onToggleRoute, "aria-expanded": props.routeOpen, "aria-controls": routeId, children: [
7100
+ "Route",
7101
+ /* @__PURE__ */ jsx(ChevronGlyph2, { up: props.routeOpen })
7102
+ ] }),
7103
+ props.routeOpen ? /* @__PURE__ */ jsx("div", { id: routeId, className: "sg-cq-hops", "data-testid": "compare-route", children: hops.map((hop, i) => (
7104
+ // biome-ignore lint/suspicious/noArrayIndexKey: a route is a fixed sequence, and a token can appear twice on it.
7105
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-hop", children: [
7106
+ i > 0 ? /* @__PURE__ */ jsx(ArrowGlyph2, {}) : null,
7107
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-hop-body", children: [
7108
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-hop-name", children: [
7109
+ /* @__PURE__ */ jsx(HopMark, { hop, tokens: props.tokens, size: "xxs" }),
7110
+ hop.ticker
7111
+ ] }),
7112
+ /* @__PURE__ */ jsxs("span", { className: "sg-cq-hop-chain", children: [
7113
+ "On ",
7114
+ props.chainName(hop.chainId)
7115
+ ] })
7116
+ ] })
7117
+ ] }, `${hop.chainId}-${hop.address}-${i}`)
7118
+ )) }) : null
7119
+ ] }) : null
7120
+ ] });
7121
+ }
6178
7122
  function QuoteSheet(props) {
6179
7123
  const sheetRef = useRef(null);
6180
7124
  const onCloseRef = useRef(props.onClose);
@@ -6465,6 +7409,14 @@ function ExchangeCard(props) {
6465
7409
  () => destinationStates ? toPickerTokens.filter((t) => !destinationStates[`${Number(t.chainId)}:${String(t.address || "").toLowerCase()}`]?.disabled) : toPickerTokens,
6466
7410
  [toPickerTokens, destinationStates]
6467
7411
  );
7412
+ const seenReadyCatalogue = useRef(null);
7413
+ useEffect(() => {
7414
+ if (!catalogue?.ready) return;
7415
+ const first = seenReadyCatalogue.current === null;
7416
+ seenReadyCatalogue.current = catalogue;
7417
+ if (first || !to) return;
7418
+ if (destinationStates?.[`${Number(to.chainId)}:${String(findToken(tokens, to.chainId, to.symbol)?.address || "").toLowerCase()}`]?.disabled || !findToken(tokens, to.chainId, to.symbol)) setTo(null);
7419
+ }, [catalogue]);
6468
7420
  const normalizedAmount = normalizeDecimalText(amount);
6469
7421
  const amountValid = /^\d+(\.\d+)?$/.test(normalizedAmount) && Number(normalizedAmount) > 0 && Number(normalizedAmount) <= 1e9;
6470
7422
  const rampMode = mode !== "exchange";
@@ -6642,6 +7594,7 @@ function ExchangeCard(props) {
6642
7594
  const recipientLocked = wide && recipientState.open && recipientPending;
6643
7595
  const ctaLabel = rampMode ? soonLabel : submitting ? "Exchanging\u2026" : connected2 && flow.quoteStale ? flow.quotePaused ? "Refresh quote" : "Refreshing quote\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall || "Exchange";
6644
7596
  const selected = addressed ? flow.selected : null;
7597
+ const compare = addressed && !solActive ? flow.compare : null;
6645
7598
  const hasQuote = Boolean(quotable && !quoting && !quoteError && receive);
6646
7599
  const nativeWei = (() => {
6647
7600
  try {
@@ -6698,10 +7651,14 @@ function ExchangeCard(props) {
6698
7651
  setView("main");
6699
7652
  requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
6700
7653
  };
7654
+ const openPicker = (v) => () => {
7655
+ setSheet(null);
7656
+ setView(v);
7657
+ };
6701
7658
  const closeSheet = () => {
6702
7659
  const was = sheet;
6703
7660
  setSheet(null);
6704
- requestAnimationFrame(() => (was === "quote" ? quoteBtnRef : complianceBtnRef).current?.focus());
7661
+ requestAnimationFrame(() => (was === "quote" || was === "compare" ? quoteBtnRef : complianceBtnRef).current?.focus());
6705
7662
  };
6706
7663
  const pctChips = mode !== "onramp" ? (
6707
7664
  // a11y note: <fieldset> carries UA styling that would have to be reset on every host page;
@@ -6731,7 +7688,7 @@ function ExchangeCard(props) {
6731
7688
  icon: /* @__PURE__ */ jsx(QuoteGlyph, {}),
6732
7689
  label: "Quote",
6733
7690
  badge: lg && hasQuote ? { text: "Best return", tone: "info" } : null,
6734
- onClick: () => setSheet("quote"),
7691
+ onClick: () => setSheet(compare ? "compare" : "quote"),
6735
7692
  disabled: !hasQuote
6736
7693
  }
6737
7694
  );
@@ -6748,7 +7705,27 @@ function ExchangeCard(props) {
6748
7705
  connect: !wallet.account ? { family: "evm", onClick: () => void wallet.connect(), busy: wallet.connecting } : !solanaWallet.address ? { family: "solana", onClick: (name) => void solanaWallet.connect(name), busy: solanaWallet.status === "connecting", choices: solanaWallet.wallets.map((w) => w.name) } : void 0,
6749
7706
  error: solanaWallet.error || wallet.error
6750
7707
  }
6751
- ) : recipientState.open ? /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, wide, onPending: wide ? setRecipientPending : void 0 }) : sheet === "compliance" ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsx(
7708
+ ) : recipientState.open ? /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, wide, onPending: wide ? setRecipientPending : void 0 }) : sheet === "compliance" ? /* @__PURE__ */ jsx(ComplianceDetails, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onBack: closeSheet, layout: wide ? "side" : "card" }) : sheet === "compare" ? (
7709
+ // Stays mounted even when `compare` is momentarily null (a refresh that is loading or failed), mirroring the
7710
+ // dapp's CompareQuotesDialog: it shows the empty/error notice in place of the cards instead of popping the
7711
+ // screen and dropping focus (zd-dapp src/components/CompareQuotesDialog.tsx uses `emptyMessage` the same way).
7712
+ /* @__PURE__ */ jsx(
7713
+ CompareQuotes,
7714
+ {
7715
+ compare,
7716
+ toSymbol: toTicker,
7717
+ tokens,
7718
+ chainName: (id) => nameOf(id) ?? `Chain ${id}`,
7719
+ onSelect: flow.selectOption,
7720
+ onBack: closeSheet,
7721
+ onRefresh: flow.reload,
7722
+ refreshing: flow.status === "loading",
7723
+ emptyMessage: flow.status === "loading" ? "Fetching quote\u2026" : quoteError || void 0,
7724
+ modal: !!props.inDialog,
7725
+ layout: wide ? "side" : "card"
7726
+ }
7727
+ )
7728
+ ) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsx(
6752
7729
  QuoteSheet,
6753
7730
  {
6754
7731
  onClose: closeSheet,
@@ -6827,7 +7804,7 @@ function ExchangeCard(props) {
6827
7804
  }
6828
7805
  );
6829
7806
  } else if (sheetBody && !wide) {
6830
- takeover = walletsOpen && !walletDetails || recipientState.open;
7807
+ takeover = walletsOpen && !walletDetails || recipientState.open || !walletsOpen && (sheet === "compare" || sheet === "compliance");
6831
7808
  body = sheetBody;
6832
7809
  } else if (solActive && solFlow.status === "sent") {
6833
7810
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6893,9 +7870,9 @@ function ExchangeCard(props) {
6893
7870
  body = wide ? /* @__PURE__ */ jsxs(Fragment, { children: [
6894
7871
  /* @__PURE__ */ jsxs("div", { className: "sg-stack", children: [
6895
7872
  /* @__PURE__ */ jsxs("div", { className: "sg-ft", children: [
6896
- mode === "onramp" ? /* @__PURE__ */ jsx(FiatTile, { label: "From", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsx(TokenTile, { label: "From", pick: from, chainName: nameOf(from?.chainId), token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: () => setView("from") }),
7873
+ mode === "onramp" ? /* @__PURE__ */ jsx(FiatTile, { label: "From", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsx(TokenTile, { label: "From", pick: from, chainName: nameOf(from?.chainId), token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: openPicker("from") }),
6897
7874
  /* @__PURE__ */ jsx(FlipButton, { small: true, onClick: flip, disabled: !flippable }),
6898
- mode === "offramp" ? /* @__PURE__ */ jsx(FiatTile, { label: "To", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsx(TokenTile, { label: "To", pick: to, chainName: nameOf(to?.chainId), token: toToken, disabled: submitting, btnRef: toTileRef, onClick: () => setView("to") })
7875
+ mode === "offramp" ? /* @__PURE__ */ jsx(FiatTile, { label: "To", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsx(TokenTile, { label: "To", pick: to, chainName: nameOf(to?.chainId), token: toToken, disabled: submitting, btnRef: toTileRef, onClick: openPicker("to") })
6899
7876
  ] }),
6900
7877
  /* @__PURE__ */ jsxs("div", { className: "sg-pane", "data-kind": "send", children: [
6901
7878
  /* @__PURE__ */ jsxs("div", { className: "sg-pane-top", children: [