@chainrails/react 0.3.2 → 0.3.3
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaymentModal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAqIpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -936,7 +936,7 @@ function ct(t, e) {
|
|
|
936
936
|
const i = `0x${o.join("")}`;
|
|
937
937
|
return ee.set(`${t}.${e}`, i), i;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function w(t, e) {
|
|
940
940
|
if (!Ps(t, { strict: !1 }))
|
|
941
941
|
throw new ks({ address: t });
|
|
942
942
|
return ct(t, e);
|
|
@@ -965,7 +965,7 @@ c.USDC;
|
|
|
965
965
|
const ut = {
|
|
966
966
|
[b.ARBITRUM]: {
|
|
967
967
|
[c.DAI]: {
|
|
968
|
-
address:
|
|
968
|
+
address: w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
969
969
|
symbol: c.DAI,
|
|
970
970
|
name: "Dai Stablecoin",
|
|
971
971
|
decimals: 18,
|
|
@@ -981,7 +981,7 @@ const ut = {
|
|
|
981
981
|
nativeToken: !0
|
|
982
982
|
},
|
|
983
983
|
[c.USDC]: {
|
|
984
|
-
address:
|
|
984
|
+
address: w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
985
985
|
symbol: c.USDC,
|
|
986
986
|
name: "USD Coin",
|
|
987
987
|
decimals: 6,
|
|
@@ -989,7 +989,7 @@ const ut = {
|
|
|
989
989
|
nativeToken: !1
|
|
990
990
|
},
|
|
991
991
|
[c.USDT]: {
|
|
992
|
-
address:
|
|
992
|
+
address: w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
993
993
|
symbol: c.USDT,
|
|
994
994
|
name: "Tether USD",
|
|
995
995
|
decimals: 6,
|
|
@@ -997,7 +997,7 @@ const ut = {
|
|
|
997
997
|
nativeToken: !1
|
|
998
998
|
},
|
|
999
999
|
[c.WETH]: {
|
|
1000
|
-
address:
|
|
1000
|
+
address: w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
1001
1001
|
symbol: c.WETH,
|
|
1002
1002
|
name: "Wrapped Ether",
|
|
1003
1003
|
decimals: 18,
|
|
@@ -1007,7 +1007,7 @@ const ut = {
|
|
|
1007
1007
|
},
|
|
1008
1008
|
[b.ARBITRUM_TESTNET]: {
|
|
1009
1009
|
[c.USDC]: {
|
|
1010
|
-
address:
|
|
1010
|
+
address: w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
1011
1011
|
symbol: c.USDC,
|
|
1012
1012
|
name: "USD Coin",
|
|
1013
1013
|
fiatISO: "USD",
|
|
@@ -1027,7 +1027,7 @@ const ut = {
|
|
|
1027
1027
|
nativeToken: !1
|
|
1028
1028
|
},
|
|
1029
1029
|
[c.USDC]: {
|
|
1030
|
-
address:
|
|
1030
|
+
address: w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1031
1031
|
symbol: c.USDC,
|
|
1032
1032
|
name: "USD Coin",
|
|
1033
1033
|
fiatISO: "USD",
|
|
@@ -1055,7 +1055,7 @@ const ut = {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
[b.AVALANCHE_TESTNET]: {
|
|
1057
1057
|
[c.USDC]: {
|
|
1058
|
-
address:
|
|
1058
|
+
address: w("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
1059
1059
|
symbol: c.USDC,
|
|
1060
1060
|
name: "USD Coin",
|
|
1061
1061
|
fiatISO: "USD",
|
|
@@ -1091,7 +1091,7 @@ const ut = {
|
|
|
1091
1091
|
nativeToken: !1
|
|
1092
1092
|
},
|
|
1093
1093
|
[c.USDC]: {
|
|
1094
|
-
address:
|
|
1094
|
+
address: w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1095
1095
|
symbol: c.USDC,
|
|
1096
1096
|
name: "USD Coin",
|
|
1097
1097
|
fiatISO: "USD",
|
|
@@ -1101,7 +1101,7 @@ const ut = {
|
|
|
1101
1101
|
nativeToken: !1
|
|
1102
1102
|
},
|
|
1103
1103
|
[c.WETH]: {
|
|
1104
|
-
address:
|
|
1104
|
+
address: w("0x4200000000000000000000000000000000000006"),
|
|
1105
1105
|
symbol: c.WETH,
|
|
1106
1106
|
name: "Wrapped Ether",
|
|
1107
1107
|
decimals: 18,
|
|
@@ -1111,7 +1111,7 @@ const ut = {
|
|
|
1111
1111
|
},
|
|
1112
1112
|
[b.BASE_TESTNET]: {
|
|
1113
1113
|
[c.USDC]: {
|
|
1114
|
-
address:
|
|
1114
|
+
address: w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1115
1115
|
symbol: c.USDC,
|
|
1116
1116
|
name: "USD Coin",
|
|
1117
1117
|
fiatISO: "USD",
|
|
@@ -1155,7 +1155,7 @@ const ut = {
|
|
|
1155
1155
|
nativeToken: !1
|
|
1156
1156
|
},
|
|
1157
1157
|
[c.USDC]: {
|
|
1158
|
-
address:
|
|
1158
|
+
address: w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1159
1159
|
symbol: c.USDC,
|
|
1160
1160
|
decimals: 18,
|
|
1161
1161
|
name: "USD Coin",
|
|
@@ -1182,7 +1182,7 @@ const ut = {
|
|
|
1182
1182
|
nativeToken: !1
|
|
1183
1183
|
},
|
|
1184
1184
|
[c.DAI]: {
|
|
1185
|
-
address:
|
|
1185
|
+
address: w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
1186
1186
|
symbol: c.DAI,
|
|
1187
1187
|
name: "Dai Stablecoin",
|
|
1188
1188
|
decimals: 18,
|
|
@@ -1214,7 +1214,7 @@ const ut = {
|
|
|
1214
1214
|
nativeToken: !1
|
|
1215
1215
|
},
|
|
1216
1216
|
[c.USDC]: {
|
|
1217
|
-
address:
|
|
1217
|
+
address: w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1218
1218
|
symbol: c.USDC,
|
|
1219
1219
|
name: "USD Coin",
|
|
1220
1220
|
decimals: 6,
|
|
@@ -1223,7 +1223,7 @@ const ut = {
|
|
|
1223
1223
|
nativeToken: !1
|
|
1224
1224
|
},
|
|
1225
1225
|
[c.USDT]: {
|
|
1226
|
-
address:
|
|
1226
|
+
address: w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
1227
1227
|
symbol: c.USDT,
|
|
1228
1228
|
name: "Tether USD",
|
|
1229
1229
|
decimals: 6,
|
|
@@ -1231,7 +1231,7 @@ const ut = {
|
|
|
1231
1231
|
nativeToken: !1
|
|
1232
1232
|
},
|
|
1233
1233
|
[c.WETH]: {
|
|
1234
|
-
address:
|
|
1234
|
+
address: w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
1235
1235
|
symbol: c.WETH,
|
|
1236
1236
|
name: "Wrapped Ether",
|
|
1237
1237
|
decimals: 18,
|
|
@@ -1241,7 +1241,7 @@ const ut = {
|
|
|
1241
1241
|
},
|
|
1242
1242
|
[b.ETHEREUM_TESTNET]: {
|
|
1243
1243
|
[c.USDC]: {
|
|
1244
|
-
address:
|
|
1244
|
+
address: w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1245
1245
|
symbol: c.USDC,
|
|
1246
1246
|
decimals: 6,
|
|
1247
1247
|
name: "USD Coin",
|
|
@@ -1438,7 +1438,7 @@ const ut = {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
}, xs = new Set(Object.values(b));
|
|
1441
|
-
function
|
|
1441
|
+
function R(t) {
|
|
1442
1442
|
if (Ns(t))
|
|
1443
1443
|
return t;
|
|
1444
1444
|
const e = b[t];
|
|
@@ -1578,7 +1578,7 @@ class Ls {
|
|
|
1578
1578
|
return await p().get("intents", { searchParams: e }).json();
|
|
1579
1579
|
}
|
|
1580
1580
|
async create(e) {
|
|
1581
|
-
const s =
|
|
1581
|
+
const s = R(e.source_chain), n = R(e.destination_chain);
|
|
1582
1582
|
return await p().post("intents", {
|
|
1583
1583
|
json: {
|
|
1584
1584
|
...e,
|
|
@@ -1588,7 +1588,7 @@ class Ls {
|
|
|
1588
1588
|
}).json();
|
|
1589
1589
|
}
|
|
1590
1590
|
async createForSession(e) {
|
|
1591
|
-
const s =
|
|
1591
|
+
const s = R(e.sourceChain);
|
|
1592
1592
|
return await p().post("modal/sessions/intents", {
|
|
1593
1593
|
json: { ...e, sourceChain: s }
|
|
1594
1594
|
}).json();
|
|
@@ -1605,9 +1605,9 @@ class Ls {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
class _s {
|
|
1607
1607
|
async getFromSpecificBridge(e) {
|
|
1608
|
-
const s =
|
|
1608
|
+
const s = R(e.sourceChain);
|
|
1609
1609
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1610
|
-
const n =
|
|
1610
|
+
const n = R(e.destinationChain);
|
|
1611
1611
|
return await p().get("quotes/single", {
|
|
1612
1612
|
searchParams: {
|
|
1613
1613
|
...e,
|
|
@@ -1617,9 +1617,9 @@ class _s {
|
|
|
1617
1617
|
}).json();
|
|
1618
1618
|
}
|
|
1619
1619
|
async getFromAllBridges(e) {
|
|
1620
|
-
const s =
|
|
1620
|
+
const s = R(e.sourceChain);
|
|
1621
1621
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1622
|
-
const n =
|
|
1622
|
+
const n = R(e.destinationChain);
|
|
1623
1623
|
return await p().get("quotes/multiple", {
|
|
1624
1624
|
searchParams: {
|
|
1625
1625
|
...e,
|
|
@@ -1629,9 +1629,9 @@ class _s {
|
|
|
1629
1629
|
}).json();
|
|
1630
1630
|
}
|
|
1631
1631
|
async getBestAcrossBridges(e) {
|
|
1632
|
-
const s =
|
|
1632
|
+
const s = R(e.sourceChain);
|
|
1633
1633
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1634
|
-
const n =
|
|
1634
|
+
const n = R(e.destinationChain);
|
|
1635
1635
|
return await p().get("quotes/best", { searchParams: {
|
|
1636
1636
|
...e,
|
|
1637
1637
|
sourceChain: s,
|
|
@@ -1639,7 +1639,7 @@ class _s {
|
|
|
1639
1639
|
} }).json();
|
|
1640
1640
|
}
|
|
1641
1641
|
async getAll(e) {
|
|
1642
|
-
const s =
|
|
1642
|
+
const s = R(e.destinationChain);
|
|
1643
1643
|
return await p().get("quotes/multi-source", { searchParams: {
|
|
1644
1644
|
...e,
|
|
1645
1645
|
destinationChain: s
|
|
@@ -1651,7 +1651,7 @@ class _s {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
class Fs {
|
|
1653
1653
|
async getOptimalRoutes(e) {
|
|
1654
|
-
const s =
|
|
1654
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1655
1655
|
return await p().get("router/optimal-route", {
|
|
1656
1656
|
searchParams: {
|
|
1657
1657
|
...e,
|
|
@@ -1664,7 +1664,7 @@ class Fs {
|
|
|
1664
1664
|
return await p().get("router/supported-bridges/all").json();
|
|
1665
1665
|
}
|
|
1666
1666
|
async getSupportedBridges(e) {
|
|
1667
|
-
const s =
|
|
1667
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1668
1668
|
return await p().get("router/supported-bridges/route", { searchParams: {
|
|
1669
1669
|
...e,
|
|
1670
1670
|
sourceChain: s,
|
|
@@ -1693,7 +1693,7 @@ class $s {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
class js {
|
|
1695
1695
|
async getSessionToken(e) {
|
|
1696
|
-
const s =
|
|
1696
|
+
const s = R(e.destinationChain);
|
|
1697
1697
|
let n = Me(s, e.token);
|
|
1698
1698
|
n || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), n = Me(s, "USDC"));
|
|
1699
1699
|
const o = {
|
|
@@ -1740,7 +1740,7 @@ function pn(t) {
|
|
|
1740
1740
|
onSuccess: l,
|
|
1741
1741
|
session_url: f,
|
|
1742
1742
|
sessionToken: E
|
|
1743
|
-
} = t, [h, y] = k(0), [
|
|
1743
|
+
} = t, [h, y] = k(0), [C, V] = k(""), [m, T] = k(null), g = le(null);
|
|
1744
1744
|
d.config({
|
|
1745
1745
|
api_key: "",
|
|
1746
1746
|
// @ts-expect-error
|
|
@@ -1748,36 +1748,46 @@ function pn(t) {
|
|
|
1748
1748
|
}), x(() => {
|
|
1749
1749
|
V(d.getPayModalUrl(e));
|
|
1750
1750
|
}, [e]), x(() => {
|
|
1751
|
-
const
|
|
1752
|
-
if (
|
|
1751
|
+
const S = s?.theme;
|
|
1752
|
+
if (console.log({
|
|
1753
|
+
themeValue: S
|
|
1754
|
+
}), !S || qs.includes(S)) {
|
|
1753
1755
|
T(null);
|
|
1754
1756
|
return;
|
|
1755
1757
|
}
|
|
1756
1758
|
let D = !1;
|
|
1757
1759
|
return (async () => {
|
|
1758
1760
|
try {
|
|
1759
|
-
const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${
|
|
1761
|
+
const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${S}`);
|
|
1760
1762
|
if (!Re.ok) return;
|
|
1761
1763
|
const X = await Re.json();
|
|
1762
1764
|
!D && X.status === "approved" && X.css_content && T(X.css_content);
|
|
1763
1765
|
} catch (G) {
|
|
1764
1766
|
console.error("Failed to fetch theme:", G);
|
|
1767
|
+
} finally {
|
|
1768
|
+
console.log({
|
|
1769
|
+
themeCss: m
|
|
1770
|
+
});
|
|
1765
1771
|
}
|
|
1766
1772
|
})(), () => {
|
|
1767
1773
|
D = !0;
|
|
1768
1774
|
};
|
|
1769
1775
|
}, [s?.theme]), x(() => {
|
|
1770
|
-
const
|
|
1771
|
-
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1776
|
+
const S = document.body.style.overflow;
|
|
1777
|
+
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = S || "";
|
|
1772
1778
|
const D = (Y) => {
|
|
1773
1779
|
Y.data === "closed" && (a(), u?.()), Y.data === "completed" && (window.setTimeout(a, 2e3), l?.());
|
|
1774
1780
|
};
|
|
1775
1781
|
return window.addEventListener("message", D), () => {
|
|
1776
|
-
document.body.style.overflow =
|
|
1782
|
+
document.body.style.overflow = S || "", window.removeEventListener("message", D);
|
|
1777
1783
|
};
|
|
1778
1784
|
}, [o, u, l]), x(() => {
|
|
1779
1785
|
if (!E) return;
|
|
1780
|
-
const
|
|
1786
|
+
const S = t.css || m || void 0;
|
|
1787
|
+
console.log({
|
|
1788
|
+
cssToSend: S
|
|
1789
|
+
});
|
|
1790
|
+
const D = {
|
|
1781
1791
|
type: "session",
|
|
1782
1792
|
session_token: E,
|
|
1783
1793
|
environment: d.getEnv() || ge.PRODUCTION,
|
|
@@ -1785,14 +1795,14 @@ function pn(t) {
|
|
|
1785
1795
|
props: {
|
|
1786
1796
|
excludeChains: n?.join(",")
|
|
1787
1797
|
},
|
|
1788
|
-
...
|
|
1789
|
-
css:
|
|
1798
|
+
...S ? {
|
|
1799
|
+
css: S
|
|
1790
1800
|
} : {}
|
|
1791
1801
|
};
|
|
1792
|
-
|
|
1793
|
-
|
|
1802
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1803
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1794
1804
|
}, 1e3);
|
|
1795
|
-
}, [E, h, o, s,
|
|
1805
|
+
}, [E, h, o, s, m]);
|
|
1796
1806
|
function A() {
|
|
1797
1807
|
y(Math.random());
|
|
1798
1808
|
}
|
|
@@ -1817,11 +1827,11 @@ function pn(t) {
|
|
|
1817
1827
|
})
|
|
1818
1828
|
}), /* @__PURE__ */ _("iframe", {
|
|
1819
1829
|
allow: "clipboard-read *; clipboard-write *",
|
|
1820
|
-
src:
|
|
1830
|
+
src: C || void 0,
|
|
1821
1831
|
onLoad: A,
|
|
1822
1832
|
className: `payment-modal ${h === 0 || i ? "invisible" : "visible"}`,
|
|
1823
1833
|
"data-id": e,
|
|
1824
|
-
ref:
|
|
1834
|
+
ref: g
|
|
1825
1835
|
}, e)]
|
|
1826
1836
|
});
|
|
1827
1837
|
}
|
|
@@ -1995,39 +2005,39 @@ function Tt(t = {}) {
|
|
|
1995
2005
|
if (e)
|
|
1996
2006
|
return e;
|
|
1997
2007
|
let s = ne[0];
|
|
1998
|
-
const n = /* @__PURE__ */ new Set(), o = (
|
|
1999
|
-
s !== T && (i = s = T, n.forEach((
|
|
2008
|
+
const n = /* @__PURE__ */ new Set(), o = (m, T = ++ne[0]) => {
|
|
2009
|
+
s !== T && (i = s = T, n.forEach((g) => g(m, T)));
|
|
2000
2010
|
};
|
|
2001
2011
|
let i = s;
|
|
2002
|
-
const r = (
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2005
|
-
})), s), a = (
|
|
2012
|
+
const r = (m = ne[0]) => (i !== m && (i = m, u.forEach(([T]) => {
|
|
2013
|
+
const g = T[1](m);
|
|
2014
|
+
g > s && (s = g);
|
|
2015
|
+
})), s), a = (m) => (T, g) => {
|
|
2006
2016
|
const A = [...T];
|
|
2007
|
-
A[1] = [
|
|
2008
|
-
}, u = /* @__PURE__ */ new Map(), l = (
|
|
2009
|
-
const
|
|
2010
|
-
if (
|
|
2011
|
-
if ((q ? "production" : void 0) !== "production" && u.has(
|
|
2017
|
+
A[1] = [m, ...A[1]], o(A, g);
|
|
2018
|
+
}, u = /* @__PURE__ */ new Map(), l = (m, T) => {
|
|
2019
|
+
const g = !we.has(T) && N.get(T);
|
|
2020
|
+
if (g) {
|
|
2021
|
+
if ((q ? "production" : void 0) !== "production" && u.has(m))
|
|
2012
2022
|
throw new Error("prop listener already exists");
|
|
2013
2023
|
if (n.size) {
|
|
2014
|
-
const A =
|
|
2015
|
-
u.set(
|
|
2024
|
+
const A = g[2](a(m));
|
|
2025
|
+
u.set(m, [g, A]);
|
|
2016
2026
|
} else
|
|
2017
|
-
u.set(
|
|
2027
|
+
u.set(m, [g]);
|
|
2018
2028
|
}
|
|
2019
|
-
}, f = (
|
|
2029
|
+
}, f = (m) => {
|
|
2020
2030
|
var T;
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
}, E = (
|
|
2031
|
+
const g = u.get(m);
|
|
2032
|
+
g && (u.delete(m), (T = g[1]) == null || T.call(g));
|
|
2033
|
+
}, E = (m) => (n.add(m), n.size === 1 && u.forEach(([g, A], S) => {
|
|
2024
2034
|
if ((q ? "production" : void 0) !== "production" && A)
|
|
2025
2035
|
throw new Error("remove already exists");
|
|
2026
|
-
const D =
|
|
2027
|
-
u.set(
|
|
2036
|
+
const D = g[2](a(S));
|
|
2037
|
+
u.set(S, [g, D]);
|
|
2028
2038
|
}), () => {
|
|
2029
|
-
n.delete(
|
|
2030
|
-
A && (A(), u.set(
|
|
2039
|
+
n.delete(m), n.size === 0 && u.forEach(([g, A], S) => {
|
|
2040
|
+
A && (A(), u.set(S, [g]));
|
|
2031
2041
|
});
|
|
2032
2042
|
});
|
|
2033
2043
|
let h = !0;
|
|
@@ -2036,16 +2046,16 @@ function Tt(t = {}) {
|
|
|
2036
2046
|
l,
|
|
2037
2047
|
f,
|
|
2038
2048
|
o
|
|
2039
|
-
),
|
|
2040
|
-
K.set(t,
|
|
2049
|
+
), C = tn(t, y);
|
|
2050
|
+
K.set(t, C);
|
|
2041
2051
|
const V = [t, r, E];
|
|
2042
|
-
return N.set(
|
|
2052
|
+
return N.set(C, V), Reflect.ownKeys(t).forEach((m) => {
|
|
2043
2053
|
const T = Object.getOwnPropertyDescriptor(
|
|
2044
2054
|
t,
|
|
2045
|
-
|
|
2055
|
+
m
|
|
2046
2056
|
);
|
|
2047
|
-
"value" in T && T.writable && (
|
|
2048
|
-
}), h = !1,
|
|
2057
|
+
"value" in T && T.writable && (C[m] = t[m]);
|
|
2058
|
+
}), h = !1, C;
|
|
2049
2059
|
}
|
|
2050
2060
|
function rn(t, e, s) {
|
|
2051
2061
|
const n = N.get(t);
|
|
@@ -2135,10 +2145,10 @@ function yn({
|
|
|
2135
2145
|
headers: {
|
|
2136
2146
|
"Content-Type": "application/json"
|
|
2137
2147
|
}
|
|
2138
|
-
}).then((
|
|
2139
|
-
y < r || (v.data =
|
|
2140
|
-
}).catch((
|
|
2141
|
-
y < r || (v.error =
|
|
2148
|
+
}).then((C) => C.json()).then((C) => {
|
|
2149
|
+
y < r || (v.data = C, v.isPending = !1, a(y));
|
|
2150
|
+
}).catch((C) => {
|
|
2151
|
+
y < r || (v.error = C?.toString(), v.isPending = !1, a(y), setInterval(h, 5e3));
|
|
2142
2152
|
});
|
|
2143
2153
|
};
|
|
2144
2154
|
return x(() => {
|
|
@@ -2166,9 +2176,9 @@ function Tn({
|
|
|
2166
2176
|
const [o, i] = k(!1), [r, a] = k(t), [u, l] = k(e);
|
|
2167
2177
|
function f({
|
|
2168
2178
|
sessionToken: y,
|
|
2169
|
-
amount:
|
|
2179
|
+
amount: C
|
|
2170
2180
|
}) {
|
|
2171
|
-
a(y), l(
|
|
2181
|
+
a(y), l(C);
|
|
2172
2182
|
}
|
|
2173
2183
|
x(() => {
|
|
2174
2184
|
a(t);
|
|
@@ -936,7 +936,7 @@ function ct(t, e) {
|
|
|
936
936
|
const i = `0x${o.join("")}`;
|
|
937
937
|
return ee.set(`${t}.${e}`, i), i;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function w(t, e) {
|
|
940
940
|
if (!Ps(t, { strict: !1 }))
|
|
941
941
|
throw new ks({ address: t });
|
|
942
942
|
return ct(t, e);
|
|
@@ -965,7 +965,7 @@ c.USDC;
|
|
|
965
965
|
const ut = {
|
|
966
966
|
[b.ARBITRUM]: {
|
|
967
967
|
[c.DAI]: {
|
|
968
|
-
address:
|
|
968
|
+
address: w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
969
969
|
symbol: c.DAI,
|
|
970
970
|
name: "Dai Stablecoin",
|
|
971
971
|
decimals: 18,
|
|
@@ -981,7 +981,7 @@ const ut = {
|
|
|
981
981
|
nativeToken: !0
|
|
982
982
|
},
|
|
983
983
|
[c.USDC]: {
|
|
984
|
-
address:
|
|
984
|
+
address: w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
985
985
|
symbol: c.USDC,
|
|
986
986
|
name: "USD Coin",
|
|
987
987
|
decimals: 6,
|
|
@@ -989,7 +989,7 @@ const ut = {
|
|
|
989
989
|
nativeToken: !1
|
|
990
990
|
},
|
|
991
991
|
[c.USDT]: {
|
|
992
|
-
address:
|
|
992
|
+
address: w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
993
993
|
symbol: c.USDT,
|
|
994
994
|
name: "Tether USD",
|
|
995
995
|
decimals: 6,
|
|
@@ -997,7 +997,7 @@ const ut = {
|
|
|
997
997
|
nativeToken: !1
|
|
998
998
|
},
|
|
999
999
|
[c.WETH]: {
|
|
1000
|
-
address:
|
|
1000
|
+
address: w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
1001
1001
|
symbol: c.WETH,
|
|
1002
1002
|
name: "Wrapped Ether",
|
|
1003
1003
|
decimals: 18,
|
|
@@ -1007,7 +1007,7 @@ const ut = {
|
|
|
1007
1007
|
},
|
|
1008
1008
|
[b.ARBITRUM_TESTNET]: {
|
|
1009
1009
|
[c.USDC]: {
|
|
1010
|
-
address:
|
|
1010
|
+
address: w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
1011
1011
|
symbol: c.USDC,
|
|
1012
1012
|
name: "USD Coin",
|
|
1013
1013
|
fiatISO: "USD",
|
|
@@ -1027,7 +1027,7 @@ const ut = {
|
|
|
1027
1027
|
nativeToken: !1
|
|
1028
1028
|
},
|
|
1029
1029
|
[c.USDC]: {
|
|
1030
|
-
address:
|
|
1030
|
+
address: w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
1031
1031
|
symbol: c.USDC,
|
|
1032
1032
|
name: "USD Coin",
|
|
1033
1033
|
fiatISO: "USD",
|
|
@@ -1055,7 +1055,7 @@ const ut = {
|
|
|
1055
1055
|
},
|
|
1056
1056
|
[b.AVALANCHE_TESTNET]: {
|
|
1057
1057
|
[c.USDC]: {
|
|
1058
|
-
address:
|
|
1058
|
+
address: w("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
1059
1059
|
symbol: c.USDC,
|
|
1060
1060
|
name: "USD Coin",
|
|
1061
1061
|
fiatISO: "USD",
|
|
@@ -1091,7 +1091,7 @@ const ut = {
|
|
|
1091
1091
|
nativeToken: !1
|
|
1092
1092
|
},
|
|
1093
1093
|
[c.USDC]: {
|
|
1094
|
-
address:
|
|
1094
|
+
address: w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
1095
1095
|
symbol: c.USDC,
|
|
1096
1096
|
name: "USD Coin",
|
|
1097
1097
|
fiatISO: "USD",
|
|
@@ -1101,7 +1101,7 @@ const ut = {
|
|
|
1101
1101
|
nativeToken: !1
|
|
1102
1102
|
},
|
|
1103
1103
|
[c.WETH]: {
|
|
1104
|
-
address:
|
|
1104
|
+
address: w("0x4200000000000000000000000000000000000006"),
|
|
1105
1105
|
symbol: c.WETH,
|
|
1106
1106
|
name: "Wrapped Ether",
|
|
1107
1107
|
decimals: 18,
|
|
@@ -1111,7 +1111,7 @@ const ut = {
|
|
|
1111
1111
|
},
|
|
1112
1112
|
[b.BASE_TESTNET]: {
|
|
1113
1113
|
[c.USDC]: {
|
|
1114
|
-
address:
|
|
1114
|
+
address: w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
1115
1115
|
symbol: c.USDC,
|
|
1116
1116
|
name: "USD Coin",
|
|
1117
1117
|
fiatISO: "USD",
|
|
@@ -1155,7 +1155,7 @@ const ut = {
|
|
|
1155
1155
|
nativeToken: !1
|
|
1156
1156
|
},
|
|
1157
1157
|
[c.USDC]: {
|
|
1158
|
-
address:
|
|
1158
|
+
address: w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
1159
1159
|
symbol: c.USDC,
|
|
1160
1160
|
decimals: 18,
|
|
1161
1161
|
name: "USD Coin",
|
|
@@ -1182,7 +1182,7 @@ const ut = {
|
|
|
1182
1182
|
nativeToken: !1
|
|
1183
1183
|
},
|
|
1184
1184
|
[c.DAI]: {
|
|
1185
|
-
address:
|
|
1185
|
+
address: w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
1186
1186
|
symbol: c.DAI,
|
|
1187
1187
|
name: "Dai Stablecoin",
|
|
1188
1188
|
decimals: 18,
|
|
@@ -1214,7 +1214,7 @@ const ut = {
|
|
|
1214
1214
|
nativeToken: !1
|
|
1215
1215
|
},
|
|
1216
1216
|
[c.USDC]: {
|
|
1217
|
-
address:
|
|
1217
|
+
address: w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
1218
1218
|
symbol: c.USDC,
|
|
1219
1219
|
name: "USD Coin",
|
|
1220
1220
|
decimals: 6,
|
|
@@ -1223,7 +1223,7 @@ const ut = {
|
|
|
1223
1223
|
nativeToken: !1
|
|
1224
1224
|
},
|
|
1225
1225
|
[c.USDT]: {
|
|
1226
|
-
address:
|
|
1226
|
+
address: w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
1227
1227
|
symbol: c.USDT,
|
|
1228
1228
|
name: "Tether USD",
|
|
1229
1229
|
decimals: 6,
|
|
@@ -1231,7 +1231,7 @@ const ut = {
|
|
|
1231
1231
|
nativeToken: !1
|
|
1232
1232
|
},
|
|
1233
1233
|
[c.WETH]: {
|
|
1234
|
-
address:
|
|
1234
|
+
address: w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
1235
1235
|
symbol: c.WETH,
|
|
1236
1236
|
name: "Wrapped Ether",
|
|
1237
1237
|
decimals: 18,
|
|
@@ -1241,7 +1241,7 @@ const ut = {
|
|
|
1241
1241
|
},
|
|
1242
1242
|
[b.ETHEREUM_TESTNET]: {
|
|
1243
1243
|
[c.USDC]: {
|
|
1244
|
-
address:
|
|
1244
|
+
address: w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
1245
1245
|
symbol: c.USDC,
|
|
1246
1246
|
decimals: 6,
|
|
1247
1247
|
name: "USD Coin",
|
|
@@ -1438,7 +1438,7 @@ const ut = {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
}, xs = new Set(Object.values(b));
|
|
1441
|
-
function
|
|
1441
|
+
function R(t) {
|
|
1442
1442
|
if (Ns(t))
|
|
1443
1443
|
return t;
|
|
1444
1444
|
const e = b[t];
|
|
@@ -1578,7 +1578,7 @@ class Ls {
|
|
|
1578
1578
|
return await p().get("intents", { searchParams: e }).json();
|
|
1579
1579
|
}
|
|
1580
1580
|
async create(e) {
|
|
1581
|
-
const s =
|
|
1581
|
+
const s = R(e.source_chain), n = R(e.destination_chain);
|
|
1582
1582
|
return await p().post("intents", {
|
|
1583
1583
|
json: {
|
|
1584
1584
|
...e,
|
|
@@ -1588,7 +1588,7 @@ class Ls {
|
|
|
1588
1588
|
}).json();
|
|
1589
1589
|
}
|
|
1590
1590
|
async createForSession(e) {
|
|
1591
|
-
const s =
|
|
1591
|
+
const s = R(e.sourceChain);
|
|
1592
1592
|
return await p().post("modal/sessions/intents", {
|
|
1593
1593
|
json: { ...e, sourceChain: s }
|
|
1594
1594
|
}).json();
|
|
@@ -1605,9 +1605,9 @@ class Ls {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
class _s {
|
|
1607
1607
|
async getFromSpecificBridge(e) {
|
|
1608
|
-
const s =
|
|
1608
|
+
const s = R(e.sourceChain);
|
|
1609
1609
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1610
|
-
const n =
|
|
1610
|
+
const n = R(e.destinationChain);
|
|
1611
1611
|
return await p().get("quotes/single", {
|
|
1612
1612
|
searchParams: {
|
|
1613
1613
|
...e,
|
|
@@ -1617,9 +1617,9 @@ class _s {
|
|
|
1617
1617
|
}).json();
|
|
1618
1618
|
}
|
|
1619
1619
|
async getFromAllBridges(e) {
|
|
1620
|
-
const s =
|
|
1620
|
+
const s = R(e.sourceChain);
|
|
1621
1621
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1622
|
-
const n =
|
|
1622
|
+
const n = R(e.destinationChain);
|
|
1623
1623
|
return await p().get("quotes/multiple", {
|
|
1624
1624
|
searchParams: {
|
|
1625
1625
|
...e,
|
|
@@ -1629,9 +1629,9 @@ class _s {
|
|
|
1629
1629
|
}).json();
|
|
1630
1630
|
}
|
|
1631
1631
|
async getBestAcrossBridges(e) {
|
|
1632
|
-
const s =
|
|
1632
|
+
const s = R(e.sourceChain);
|
|
1633
1633
|
se(s, e.tokenIn, e.amountSymbol);
|
|
1634
|
-
const n =
|
|
1634
|
+
const n = R(e.destinationChain);
|
|
1635
1635
|
return await p().get("quotes/best", { searchParams: {
|
|
1636
1636
|
...e,
|
|
1637
1637
|
sourceChain: s,
|
|
@@ -1639,7 +1639,7 @@ class _s {
|
|
|
1639
1639
|
} }).json();
|
|
1640
1640
|
}
|
|
1641
1641
|
async getAll(e) {
|
|
1642
|
-
const s =
|
|
1642
|
+
const s = R(e.destinationChain);
|
|
1643
1643
|
return await p().get("quotes/multi-source", { searchParams: {
|
|
1644
1644
|
...e,
|
|
1645
1645
|
destinationChain: s
|
|
@@ -1651,7 +1651,7 @@ class _s {
|
|
|
1651
1651
|
}
|
|
1652
1652
|
class Fs {
|
|
1653
1653
|
async getOptimalRoutes(e) {
|
|
1654
|
-
const s =
|
|
1654
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1655
1655
|
return await p().get("router/optimal-route", {
|
|
1656
1656
|
searchParams: {
|
|
1657
1657
|
...e,
|
|
@@ -1664,7 +1664,7 @@ class Fs {
|
|
|
1664
1664
|
return await p().get("router/supported-bridges/all").json();
|
|
1665
1665
|
}
|
|
1666
1666
|
async getSupportedBridges(e) {
|
|
1667
|
-
const s =
|
|
1667
|
+
const s = R(e.sourceChain), n = R(e.destinationChain);
|
|
1668
1668
|
return await p().get("router/supported-bridges/route", { searchParams: {
|
|
1669
1669
|
...e,
|
|
1670
1670
|
sourceChain: s,
|
|
@@ -1693,7 +1693,7 @@ class $s {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
class js {
|
|
1695
1695
|
async getSessionToken(e) {
|
|
1696
|
-
const s =
|
|
1696
|
+
const s = R(e.destinationChain);
|
|
1697
1697
|
let n = Me(s, e.token);
|
|
1698
1698
|
n || (console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`), n = Me(s, "USDC"));
|
|
1699
1699
|
const o = {
|
|
@@ -1740,7 +1740,7 @@ function pn(t) {
|
|
|
1740
1740
|
onSuccess: l,
|
|
1741
1741
|
session_url: f,
|
|
1742
1742
|
sessionToken: E
|
|
1743
|
-
} = t, [h, y] = k(0), [
|
|
1743
|
+
} = t, [h, y] = k(0), [C, V] = k(""), [m, T] = k(null), g = le(null);
|
|
1744
1744
|
d.config({
|
|
1745
1745
|
api_key: "",
|
|
1746
1746
|
// @ts-expect-error
|
|
@@ -1748,36 +1748,46 @@ function pn(t) {
|
|
|
1748
1748
|
}), x(() => {
|
|
1749
1749
|
V(d.getPayModalUrl(e));
|
|
1750
1750
|
}, [e]), x(() => {
|
|
1751
|
-
const
|
|
1752
|
-
if (
|
|
1751
|
+
const S = s?.theme;
|
|
1752
|
+
if (console.log({
|
|
1753
|
+
themeValue: S
|
|
1754
|
+
}), !S || qs.includes(S)) {
|
|
1753
1755
|
T(null);
|
|
1754
1756
|
return;
|
|
1755
1757
|
}
|
|
1756
1758
|
let D = !1;
|
|
1757
1759
|
return (async () => {
|
|
1758
1760
|
try {
|
|
1759
|
-
const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${
|
|
1761
|
+
const G = d.getBaseUrl(), Re = await fetch(`${G}/themes/${S}`);
|
|
1760
1762
|
if (!Re.ok) return;
|
|
1761
1763
|
const X = await Re.json();
|
|
1762
1764
|
!D && X.status === "approved" && X.css_content && T(X.css_content);
|
|
1763
1765
|
} catch (G) {
|
|
1764
1766
|
console.error("Failed to fetch theme:", G);
|
|
1767
|
+
} finally {
|
|
1768
|
+
console.log({
|
|
1769
|
+
themeCss: m
|
|
1770
|
+
});
|
|
1765
1771
|
}
|
|
1766
1772
|
})(), () => {
|
|
1767
1773
|
D = !0;
|
|
1768
1774
|
};
|
|
1769
1775
|
}, [s?.theme]), x(() => {
|
|
1770
|
-
const
|
|
1771
|
-
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow =
|
|
1776
|
+
const S = document.body.style.overflow;
|
|
1777
|
+
o ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = S || "";
|
|
1772
1778
|
const D = (Y) => {
|
|
1773
1779
|
Y.data === "closed" && (a(), u?.()), Y.data === "completed" && (window.setTimeout(a, 2e3), l?.());
|
|
1774
1780
|
};
|
|
1775
1781
|
return window.addEventListener("message", D), () => {
|
|
1776
|
-
document.body.style.overflow =
|
|
1782
|
+
document.body.style.overflow = S || "", window.removeEventListener("message", D);
|
|
1777
1783
|
};
|
|
1778
1784
|
}, [o, u, l]), x(() => {
|
|
1779
1785
|
if (!E) return;
|
|
1780
|
-
const
|
|
1786
|
+
const S = t.css || m || void 0;
|
|
1787
|
+
console.log({
|
|
1788
|
+
cssToSend: S
|
|
1789
|
+
});
|
|
1790
|
+
const D = {
|
|
1781
1791
|
type: "session",
|
|
1782
1792
|
session_token: E,
|
|
1783
1793
|
environment: d.getEnv() || ge.PRODUCTION,
|
|
@@ -1785,14 +1795,14 @@ function pn(t) {
|
|
|
1785
1795
|
props: {
|
|
1786
1796
|
excludeChains: n?.join(",")
|
|
1787
1797
|
},
|
|
1788
|
-
...
|
|
1789
|
-
css:
|
|
1798
|
+
...S ? {
|
|
1799
|
+
css: S
|
|
1790
1800
|
} : {}
|
|
1791
1801
|
};
|
|
1792
|
-
|
|
1793
|
-
|
|
1802
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app"), window.setTimeout(() => {
|
|
1803
|
+
g.current?.contentWindow?.postMessage(D, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(D, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
|
|
1794
1804
|
}, 1e3);
|
|
1795
|
-
}, [E, h, o, s,
|
|
1805
|
+
}, [E, h, o, s, m]);
|
|
1796
1806
|
function A() {
|
|
1797
1807
|
y(Math.random());
|
|
1798
1808
|
}
|
|
@@ -1817,11 +1827,11 @@ function pn(t) {
|
|
|
1817
1827
|
})
|
|
1818
1828
|
}), /* @__PURE__ */ _("iframe", {
|
|
1819
1829
|
allow: "clipboard-read *; clipboard-write *",
|
|
1820
|
-
src:
|
|
1830
|
+
src: C || void 0,
|
|
1821
1831
|
onLoad: A,
|
|
1822
1832
|
className: `payment-modal ${h === 0 || i ? "invisible" : "visible"}`,
|
|
1823
1833
|
"data-id": e,
|
|
1824
|
-
ref:
|
|
1834
|
+
ref: g
|
|
1825
1835
|
}, e)]
|
|
1826
1836
|
});
|
|
1827
1837
|
}
|
|
@@ -1995,39 +2005,39 @@ function Tt(t = {}) {
|
|
|
1995
2005
|
if (e)
|
|
1996
2006
|
return e;
|
|
1997
2007
|
let s = ne[0];
|
|
1998
|
-
const n = /* @__PURE__ */ new Set(), o = (
|
|
1999
|
-
s !== T && (i = s = T, n.forEach((
|
|
2008
|
+
const n = /* @__PURE__ */ new Set(), o = (m, T = ++ne[0]) => {
|
|
2009
|
+
s !== T && (i = s = T, n.forEach((g) => g(m, T)));
|
|
2000
2010
|
};
|
|
2001
2011
|
let i = s;
|
|
2002
|
-
const r = (
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2005
|
-
})), s), a = (
|
|
2012
|
+
const r = (m = ne[0]) => (i !== m && (i = m, u.forEach(([T]) => {
|
|
2013
|
+
const g = T[1](m);
|
|
2014
|
+
g > s && (s = g);
|
|
2015
|
+
})), s), a = (m) => (T, g) => {
|
|
2006
2016
|
const A = [...T];
|
|
2007
|
-
A[1] = [
|
|
2008
|
-
}, u = /* @__PURE__ */ new Map(), l = (
|
|
2009
|
-
const
|
|
2010
|
-
if (
|
|
2011
|
-
if ((q ? "production" : void 0) !== "production" && u.has(
|
|
2017
|
+
A[1] = [m, ...A[1]], o(A, g);
|
|
2018
|
+
}, u = /* @__PURE__ */ new Map(), l = (m, T) => {
|
|
2019
|
+
const g = !we.has(T) && N.get(T);
|
|
2020
|
+
if (g) {
|
|
2021
|
+
if ((q ? "production" : void 0) !== "production" && u.has(m))
|
|
2012
2022
|
throw new Error("prop listener already exists");
|
|
2013
2023
|
if (n.size) {
|
|
2014
|
-
const A =
|
|
2015
|
-
u.set(
|
|
2024
|
+
const A = g[2](a(m));
|
|
2025
|
+
u.set(m, [g, A]);
|
|
2016
2026
|
} else
|
|
2017
|
-
u.set(
|
|
2027
|
+
u.set(m, [g]);
|
|
2018
2028
|
}
|
|
2019
|
-
}, f = (
|
|
2029
|
+
}, f = (m) => {
|
|
2020
2030
|
var T;
|
|
2021
|
-
const
|
|
2022
|
-
|
|
2023
|
-
}, E = (
|
|
2031
|
+
const g = u.get(m);
|
|
2032
|
+
g && (u.delete(m), (T = g[1]) == null || T.call(g));
|
|
2033
|
+
}, E = (m) => (n.add(m), n.size === 1 && u.forEach(([g, A], S) => {
|
|
2024
2034
|
if ((q ? "production" : void 0) !== "production" && A)
|
|
2025
2035
|
throw new Error("remove already exists");
|
|
2026
|
-
const D =
|
|
2027
|
-
u.set(
|
|
2036
|
+
const D = g[2](a(S));
|
|
2037
|
+
u.set(S, [g, D]);
|
|
2028
2038
|
}), () => {
|
|
2029
|
-
n.delete(
|
|
2030
|
-
A && (A(), u.set(
|
|
2039
|
+
n.delete(m), n.size === 0 && u.forEach(([g, A], S) => {
|
|
2040
|
+
A && (A(), u.set(S, [g]));
|
|
2031
2041
|
});
|
|
2032
2042
|
});
|
|
2033
2043
|
let h = !0;
|
|
@@ -2036,16 +2046,16 @@ function Tt(t = {}) {
|
|
|
2036
2046
|
l,
|
|
2037
2047
|
f,
|
|
2038
2048
|
o
|
|
2039
|
-
),
|
|
2040
|
-
K.set(t,
|
|
2049
|
+
), C = tn(t, y);
|
|
2050
|
+
K.set(t, C);
|
|
2041
2051
|
const V = [t, r, E];
|
|
2042
|
-
return N.set(
|
|
2052
|
+
return N.set(C, V), Reflect.ownKeys(t).forEach((m) => {
|
|
2043
2053
|
const T = Object.getOwnPropertyDescriptor(
|
|
2044
2054
|
t,
|
|
2045
|
-
|
|
2055
|
+
m
|
|
2046
2056
|
);
|
|
2047
|
-
"value" in T && T.writable && (
|
|
2048
|
-
}), h = !1,
|
|
2057
|
+
"value" in T && T.writable && (C[m] = t[m]);
|
|
2058
|
+
}), h = !1, C;
|
|
2049
2059
|
}
|
|
2050
2060
|
function rn(t, e, s) {
|
|
2051
2061
|
const n = N.get(t);
|
|
@@ -2135,10 +2145,10 @@ function yn({
|
|
|
2135
2145
|
headers: {
|
|
2136
2146
|
"Content-Type": "application/json"
|
|
2137
2147
|
}
|
|
2138
|
-
}).then((
|
|
2139
|
-
y < r || (v.data =
|
|
2140
|
-
}).catch((
|
|
2141
|
-
y < r || (v.error =
|
|
2148
|
+
}).then((C) => C.json()).then((C) => {
|
|
2149
|
+
y < r || (v.data = C, v.isPending = !1, a(y));
|
|
2150
|
+
}).catch((C) => {
|
|
2151
|
+
y < r || (v.error = C?.toString(), v.isPending = !1, a(y), setInterval(h, 5e3));
|
|
2142
2152
|
});
|
|
2143
2153
|
};
|
|
2144
2154
|
return x(() => {
|
|
@@ -2166,9 +2176,9 @@ function Tn({
|
|
|
2166
2176
|
const [o, i] = k(!1), [r, a] = k(t), [u, l] = k(e);
|
|
2167
2177
|
function f({
|
|
2168
2178
|
sessionToken: y,
|
|
2169
|
-
amount:
|
|
2179
|
+
amount: C
|
|
2170
2180
|
}) {
|
|
2171
|
-
a(y), l(
|
|
2181
|
+
a(y), l(C);
|
|
2172
2182
|
}
|
|
2173
2183
|
x(() => {
|
|
2174
2184
|
a(t);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","react","react/jsx-runtime"],f):(A=typeof globalThis<"u"?globalThis:A||self,f(A.Chainrails={},A.React,A.jsxRuntime))})(this,(function(A,f,O){"use strict";var we=document.createElement("style");we.textContent=`.payment-modal-wrapper{position:fixed;inset:0;z-index:10000;height:100dvh;width:100vw;transition:all .1s ease-in-out}.payment-modal-wrapper.loading{background-color:#0003;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.payment-modal-wrapper.not-loading{background-color:#0008;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}.payment-modal-wrapper.open{visibility:visible}.payment-modal-wrapper.closed{visibility:hidden;opacity:0;pointer-events:none}.payment-modal-wrapper.closed *{pointer-events:none!important}.payment-modal-wrapper.open iframe{transform:translateY(0);transform:scale(1)}.payment-modal-wrapper.closed iframe{transform:translateY(50vh);transform:scale(1)}.payment-modal-loader{position:absolute;inset:0;z-index:10000;display:grid;height:100%;width:100%;place-content:center}.payment-modal-loader .icon{height:48px;width:48px;animation:cr-spin 1s linear infinite;fill:#2563eb;color:#475569}.payment-modal{position:absolute;inset:0;z-index:10000;height:100%;width:100%;transition:all .3s cubic-bezier(.25,1,.5,1)}.payment-modal.visible{opacity:1}.payment-modal.invisible{opacity:0}@keyframes cr-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(we);class V extends Error{response;request;options;constructor(e,s,n){const o=e.status||e.status===0?e.status:"",i=e.statusText??"",r=`${o} ${i}`.trim(),a=r?`status code ${r}`:"an unknown error";super(`Request failed with ${a}: ${s.method} ${s.url}`),this.name="HTTPError",this.response=e,this.request=s,this.options=n}}class Ce extends Error{name="NonError";value;constructor(e){let s="Non-error value was thrown";try{typeof e=="string"?s=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(s=e.message)}catch{}super(s),this.value=e}}class Y extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const s=e?.cause?e.cause instanceof Error?e.cause:new Ce(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",s?{cause:s}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const Re=(()=>{let t=!1,e=!1;const s=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(s&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(o){if(o instanceof Error&&o.message==="unsupported BodyInit type")return!1;throw o}return t&&!e})(),yt=typeof globalThis.AbortController=="function",Ae=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",Tt=typeof globalThis.ReadableStream=="function",bt=typeof globalThis.FormData=="function",De=["get","post","put","patch","head","delete"],Et={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},G=2147483647,St=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Ue=Symbol("stop");class ve{options;constructor(e){this.options=e}}const wt=t=>new ve(t),Ct={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Rt={next:!0},At={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Dt=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[s,n]of t)e+=St,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${s}"`).length,e+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},ke=(t,e,s)=>{let n,o=0;return t.pipeThrough(new TransformStream({transform(i,r){if(r.enqueue(i),n){o+=n.byteLength;let a=e===0?0:o/e;a>=1&&(a=1-Number.EPSILON),s?.({percent:a,totalBytes:Math.max(e,o),transferredBytes:o},n)}n=i},flush(){n&&(o+=n.byteLength,s?.({percent:1,totalBytes:Math.max(e,o),transferredBytes:o},n))}}))},Ut=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const s=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(ke(t.body,s,e),{status:t.status,statusText:t.statusText,headers:t.headers})},vt=(t,e,s)=>{if(!t.body)return t;const n=Dt(s??t.body);return new Request(t,{duplex:"half",body:ke(t.body,n,e)})},x=t=>t!==null&&typeof t=="object",F=(...t)=>{for(const e of t)if((!x(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return X({},...t)},Ie=(t={},e={})=>{const s=new globalThis.Headers(t),n=e instanceof globalThis.Headers,o=new globalThis.Headers(e);for(const[i,r]of o.entries())n&&r==="undefined"||r===void 0?s.delete(i):s.set(i,r);return s};function $(t,e,s){return Object.hasOwn(e,s)&&e[s]===void 0?[]:X(t[s]??[],e[s]??[])}const Pe=(t={},e={})=>({beforeRequest:$(t,e,"beforeRequest"),beforeRetry:$(t,e,"beforeRetry"),afterResponse:$(t,e,"afterResponse"),beforeError:$(t,e,"beforeError")}),kt=(t,e)=>{const s=new URLSearchParams;for(const n of[t,e])if(n!==void 0)if(n instanceof URLSearchParams)for(const[o,i]of n.entries())s.append(o,i);else if(Array.isArray(n))for(const o of n){if(!Array.isArray(o)||o.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");s.append(String(o[0]),String(o[1]))}else if(x(n))for(const[o,i]of Object.entries(n))i!==void 0&&s.append(o,String(i));else{const o=new URLSearchParams(n);for(const[i,r]of o.entries())s.append(i,r)}return s},X=(...t)=>{let e={},s={},n={},o;const i=[];for(const r of t)if(Array.isArray(r))Array.isArray(e)||(e=[]),e=[...e,...r];else if(x(r)){for(let[a,l]of Object.entries(r)){if(a==="signal"&&l instanceof globalThis.AbortSignal){i.push(l);continue}if(a==="context"){if(l!=null&&(!x(l)||Array.isArray(l)))throw new TypeError("The `context` option must be an object");e={...e,context:l==null?{}:{...e.context,...l}};continue}if(a==="searchParams"){l==null?o=void 0:o=o===void 0?l:kt(o,l);continue}x(l)&&a in e&&(l=X(e[a],l)),e={...e,[a]:l}}x(r.hooks)&&(n=Pe(n,r.hooks),e.hooks=n),x(r.headers)&&(s=Ie(s,r.headers),e.headers=s)}return o!==void 0&&(e.searchParams=o),i.length>0&&(i.length===1?e.signal=i[0]:Ae?e.signal=AbortSignal.any(i):e.signal=i.at(-1)),e.context===void 0&&(e.context={}),e},It=t=>De.includes(t)?t.toUpperCase():t,xe={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},Pt=(t={})=>{if(typeof t=="number")return{...xe,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...xe,...t}};class J extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function xt(t,e,s,n){return new Promise((o,i)=>{const r=setTimeout(()=>{s&&s.abort(),i(new J(t))},n.timeout);n.fetch(t,e).then(o).catch(i).then(()=>{clearTimeout(r)})})}async function Nt(t,{signal:e}){return new Promise((s,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",o,{once:!0}));function o(){clearTimeout(i),n(e.reason)}const i=setTimeout(()=>{e?.removeEventListener("abort",o),s()},t)})}const Ot=(t,e)=>{const s={};for(const n in e)Object.hasOwn(e,n)&&!(n in At)&&!(n in Ct)&&(!(n in t)||n in Rt)&&(s[n]=e[n]);return s},Bt=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function Mt(t){return t instanceof V||t?.name===V.name}function _t(t){return t instanceof J||t?.name===J.name}class B{static create(e,s){const n=new B(e,s),o=async()=>{if(typeof n.#e.timeout=="number"&&n.#e.timeout>G)throw new RangeError(`The \`timeout\` option cannot be greater than ${G}`);await Promise.resolve();let r=await n.#g();for(const a of n.#e.hooks.afterResponse){const l=n.#u(r.clone()),u=await a(n.request,n.#a(),l,{retryCount:n.#s});if(u instanceof globalThis.Response&&(r=u),u instanceof ve)throw await Promise.all([l.body?.cancel(),r.body?.cancel()]),new Y(u.options)}if(n.#u(r),!r.ok&&(typeof n.#e.throwHttpErrors=="function"?n.#e.throwHttpErrors(r.status):n.#e.throwHttpErrors)){let a=new V(r,n.request,n.#a());for(const l of n.#e.hooks.beforeError)a=await l(a,{retryCount:n.#s});throw a}if(n.#e.onDownloadProgress){if(typeof n.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Tt)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return Ut(r.clone(),n.#e.onDownloadProgress)}return r},i=n.#d(o).finally(async()=>{const r=n.#r,a=[];r&&!r.bodyUsed&&a.push(r.body?.cancel()),n.request.bodyUsed||a.push(n.request.body?.cancel()),await Promise.all(a)});for(const[r,a]of Object.entries(Et))r==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(i[r]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);const l=await i;if(r==="json"){if(l.status===204)return"";const u=await l.text();return u===""?"":s.parseJson?s.parseJson(u):JSON.parse(u)}return l[r]()});return i}static#h(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0)):e}request;#n;#s=0;#t;#e;#r;#o;#i;constructor(e,s={}){if(this.#t=e,this.#e={...s,headers:Ie(this.#t.headers,s.headers),hooks:Pe({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},s.hooks),method:It(s.method??this.#t.method??"GET"),prefixUrl:String(s.prefixUrl||""),retry:Pt(s.retry),throwHttpErrors:s.throwHttpErrors??!0,timeout:s.timeout??1e4,fetch:s.fetch??globalThis.fetch.bind(globalThis),context:s.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}yt&&Ae&&(this.#o=this.#e.signal??this.#t.signal,this.#n=new globalThis.AbortController,this.#e.signal=this.#o?AbortSignal.any([this.#o,this.#n.signal]):this.#n.signal),Re&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const n=s.headers&&new globalThis.Headers(s.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(bt&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!n&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),Bt(this.#e.searchParams)){const i="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(B.#h(this.#e.searchParams)).toString()),r=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);this.request=new globalThis.Request(r,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Re)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#f(this.request,this.#e.body??void 0)}}#c(){const e=this.#e.retry.delay(this.#s);let s=e;return this.#e.retry.jitter===!0?s=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(s=this.#e.retry.jitter(e),(!Number.isFinite(s)||s<0)&&(s=e)),Math.min(this.#e.retry.backoffLimit,s)}async#m(e){if(this.#s++,this.#s>this.#e.retry.limit)throw e;const s=e instanceof Error?e:new Ce(e);if(s instanceof Y)return s.customDelay??this.#c();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const n=await this.#e.retry.shouldRetry({error:s,retryCount:this.#s});if(n===!1)throw e;if(n===!0)return this.#c()}if(_t(e)&&!this.#e.retry.retryOnTimeout)throw e;if(Mt(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let o=Number(n)*1e3;Number.isNaN(o)?o=Date.parse(n)-Date.now():o>=Date.parse("2024-01-01")&&(o-=Date.now());const i=this.#e.retry.maxRetryAfter??o;return o<i?o:i}if(e.response.status===413)throw e}return this.#c()}#u(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}async#d(e){try{return await e()}catch(s){const n=Math.min(await this.#m(s),G);if(this.#s<1)throw s;if(await Nt(n,this.#o?{signal:this.#o}:{}),s instanceof Y&&s.customRequest){const o=this.#e.signal?new globalThis.Request(s.customRequest,{signal:this.#e.signal}):new globalThis.Request(s.customRequest);this.#l(o)}for(const o of this.#e.hooks.beforeRetry){const i=await o({request:this.request,options:this.#a(),error:s,retryCount:this.#s});if(i instanceof globalThis.Request){this.#l(i);break}if(i instanceof globalThis.Response)return i;if(i===Ue)return}return this.#d(e)}}async#g(){this.#n?.signal.aborted&&(this.#n=new globalThis.AbortController,this.#e.signal=this.#o?AbortSignal.any([this.#o,this.#n.signal]):this.#n.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const s of this.#e.hooks.beforeRequest){const n=await s(this.request,this.#a(),{retryCount:this.#s});if(n instanceof Response)return n;if(n instanceof globalThis.Request){this.#l(n);break}}const e=Ot(this.request,this.#e);return this.#r=this.request,this.request=this.#r.clone(),this.#e.timeout===!1?this.#e.fetch(this.#r,e):xt(this.#r,e,this.#n,this.#e)}#a(){if(!this.#i){const{hooks:e,...s}=this.#e;this.#i=Object.freeze(s)}return this.#i}#l(e){this.#i=void 0,this.request=this.#f(e)}#f(e,s){return!this.#e.onUploadProgress||!e.body?e:vt(e,this.#e.onUploadProgress,s??this.#e.body??void 0)}}/*! MIT License © Sindre Sorhus */const Z=t=>{const e=(s,n)=>B.create(s,F(t,n));for(const s of De)e[s]=(n,o)=>B.create(n,F(t,o,{method:s}));return e.create=s=>Z(F(s)),e.extend=s=>(typeof s=="function"&&(s=s(t??{})),Z(F(t,s))),e.stop=Ue,e.retry=wt,e},Lt=Z(),b={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},Ft={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"};function Q(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function Ne(t){return Q(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const Oe="2.43.4";let ee={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:s})=>e?`${t??"https://viem.sh"}${e}${s?`#${s}`:""}`:void 0,version:`viem@${Oe}`};class I extends Error{constructor(e,s={}){const n=s.cause instanceof I?s.cause.details:s.cause?.message?s.cause.message:s.details,o=s.cause instanceof I&&s.cause.docsPath||s.docsPath,i=ee.getDocsUrl?.({...s,docsPath:o}),r=[e||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...ee.version?[`Version: ${ee.version}`]:[]].join(`
|
|
3
|
-
`);super(r,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=o,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=Oe}walk(e){return Be(this,e)}}function Be(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Be(t.cause,e):e?null:t}class Me extends I{constructor({size:e,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function H(t,{dir:e,size:s=32}={}){return typeof t=="string"?$t(t,{dir:e,size:s}):Ht(t,{dir:e,size:s})}function $t(t,{dir:e,size:s=32}={}){if(s===null)return t;const n=t.replace("0x","");if(n.length>s*2)throw new Me({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function Ht(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Me({size:t.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let o=0;o<s;o++){const i=e==="right";n[i?o:s-o-1]=t[i?o:t.length-o-1]}return n}class jt extends I{constructor({max:e,min:s,signed:n,size:o,value:i}){super(`Number "${i}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class zt extends I{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function te(t,{size:e}){if(Ne(t)>e)throw new zt({givenSize:Ne(t),maxSize:e})}function qt(t,e={}){const{signed:s,size:n}=e,o=BigInt(t);let i;n?s?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const r=typeof i=="bigint"&&s?-i-1n:0;if(i&&o>i||o<r){const l=typeof t=="bigint"?"n":"";throw new jt({max:i?`${i}${l}`:void 0,min:`${r}${l}`,signed:s,size:n,value:`${t}${l}`})}const a=`0x${(s&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?H(a,{size:n}):a}const Kt=new TextEncoder;function Wt(t,e={}){return typeof t=="number"||typeof t=="bigint"?Yt(t,e):typeof t=="boolean"?Vt(t,e):Q(t)?Le(t,e):Fe(t,e)}function Vt(t,e={}){const s=new Uint8Array(1);return s[0]=Number(t),typeof e.size=="number"?(te(s,{size:e.size}),H(s,{size:e.size})):s}const k={zero:48,nine:57,A:65,F:70,a:97,f:102};function _e(t){if(t>=k.zero&&t<=k.nine)return t-k.zero;if(t>=k.A&&t<=k.F)return t-(k.A-10);if(t>=k.a&&t<=k.f)return t-(k.a-10)}function Le(t,e={}){let s=t;e.size&&(te(s,{size:e.size}),s=H(s,{dir:"right",size:e.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const o=n.length/2,i=new Uint8Array(o);for(let r=0,a=0;r<o;r++){const l=_e(n.charCodeAt(a++)),u=_e(n.charCodeAt(a++));if(l===void 0||u===void 0)throw new I(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[r]=l*16+u}return i}function Yt(t,e){const s=qt(t,e);return Le(s)}function Fe(t,e={}){const s=Kt.encode(t);return typeof e.size=="number"?(te(s,{size:e.size}),H(s,{dir:"right",size:e.size})):s}const j=BigInt(2**32-1),$e=BigInt(32);function Gt(t,e=!1){return e?{h:Number(t&j),l:Number(t>>$e&j)}:{h:Number(t>>$e&j)|0,l:Number(t&j)|0}}function Xt(t,e=!1){const s=t.length;let n=new Uint32Array(s),o=new Uint32Array(s);for(let i=0;i<s;i++){const{h:r,l:a}=Gt(t[i],e);[n[i],o[i]]=[r,a]}return[n,o]}const Jt=(t,e,s)=>t<<s|e>>>32-s,Zt=(t,e,s)=>e<<s|t>>>32-s,Qt=(t,e,s)=>e<<s-32|t>>>64-s,es=(t,e,s)=>t<<s-32|e>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ts(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function He(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function z(t,...e){if(!ts(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function je(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ss(t,e){z(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function ns(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ze(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const os=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function rs(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function is(t){for(let e=0;e<t.length;e++)t[e]=rs(t[e]);return t}const qe=os?t=>t:is;function as(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Ke(t){return typeof t=="string"&&(t=as(t)),z(t),t}class cs{}function ls(t){const e=n=>t().update(Ke(n)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}const us=BigInt(0),M=BigInt(1),ds=BigInt(2),fs=BigInt(7),hs=BigInt(256),ms=BigInt(113),We=[],Ve=[],Ye=[];for(let t=0,e=M,s=1,n=0;t<24;t++){[s,n]=[n,(2*s+3*n)%5],We.push(2*(5*n+s)),Ve.push((t+1)*(t+2)/2%64);let o=us;for(let i=0;i<7;i++)e=(e<<M^(e>>fs)*ms)%hs,e&ds&&(o^=M<<(M<<BigInt(i))-M);Ye.push(o)}const Ge=Xt(Ye,!0),gs=Ge[0],ps=Ge[1],Xe=(t,e,s)=>s>32?Qt(t,e,s):Jt(t,e,s),Je=(t,e,s)=>s>32?es(t,e,s):Zt(t,e,s);function ys(t,e=24){const s=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let r=0;r<10;r++)s[r]=t[r]^t[r+10]^t[r+20]^t[r+30]^t[r+40];for(let r=0;r<10;r+=2){const a=(r+8)%10,l=(r+2)%10,u=s[l],h=s[l+1],S=Xe(u,h,1)^s[a],m=Je(u,h,1)^s[a+1];for(let T=0;T<50;T+=10)t[r+T]^=S,t[r+T+1]^=m}let o=t[2],i=t[3];for(let r=0;r<24;r++){const a=Ve[r],l=Xe(o,i,a),u=Je(o,i,a),h=We[r];o=t[h],i=t[h+1],t[h]=l,t[h+1]=u}for(let r=0;r<50;r+=10){for(let a=0;a<10;a++)s[a]=t[r+a];for(let a=0;a<10;a++)t[r+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=gs[n],t[1]^=ps[n]}ze(s)}class se extends cs{constructor(e,s,n,o=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=i,He(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ns(this.state)}clone(){return this._cloneInto()}keccak(){qe(this.state32),ys(this.state32,this.rounds),qe(this.state32),this.posOut=0,this.pos=0}update(e){je(this),e=Ke(e),z(e);const{blockLen:s,state:n}=this,o=e.length;for(let i=0;i<o;){const r=Math.min(s-this.pos,o-i);for(let a=0;a<r;a++)n[this.pos++]^=e[i++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:n,blockLen:o}=this;e[n]^=s,(s&128)!==0&&n===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){je(this,!1),z(e),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,i=e.length;o<i;){this.posOut>=n&&this.keccak();const r=Math.min(n-this.posOut,i-o);e.set(s.subarray(this.posOut,this.posOut+r),o),this.posOut+=r,o+=r}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return He(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ss(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ze(this.state)}_cloneInto(e){const{blockLen:s,suffix:n,outputLen:o,rounds:i,enableXOF:r}=this;return e||(e=new se(s,n,o,r,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=o,e.enableXOF=r,e.destroyed=this.destroyed,e}}const Ts=(t,e,s)=>ls(()=>new se(e,t,s)),bs=Ts(1,136,256/8);function Es(t,e){return bs(Q(t,{strict:!1})?Wt(t):t)}class Ss extends I{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Ze extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const s=super.get(e);return super.has(e)&&s!==void 0&&(this.delete(e),super.set(e,s)),s}set(e,s){if(super.set(e,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const ne=new Ze(8192);function Qe(t,e){if(ne.has(`${t}.${e}`))return ne.get(`${t}.${e}`);const s=t.substring(2).toLowerCase(),n=Es(Fe(s)),o=s.split("");for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&o[r]&&(o[r]=o[r].toUpperCase()),(n[r>>1]&15)>=8&&o[r+1]&&(o[r+1]=o[r+1].toUpperCase());const i=`0x${o.join("")}`;return ne.set(`${t}.${e}`,i),i}function w(t,e){if(!Cs(t,{strict:!1}))throw new Ss({address:t});return Qe(t,e)}const ws=/^0x[a-fA-F0-9]{40}$/,oe=new Ze(8192);function Cs(t,e){const{strict:s=!0}=e??{},n=`${t}.${s}`;if(oe.has(n))return oe.get(n);const o=ws.test(t)?t.toLowerCase()===t?!0:s?Qe(t)===t:!0:!1;return oe.set(n,o),o}const c={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};c.USDC;const et={[b.ARBITRUM]:{[c.DAI]:{address:w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.USDC]:{address:w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.ARBITRUM_TESTNET]:{[c.USDC]:{address:w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.AVALANCHE]:{[c.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.USDC]:{address:w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.AVALANCHE_TESTNET]:{[c.USDC]:{address:w("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.BASE]:{[c.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:c.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[c.USDC]:{address:w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.WETH]:{address:w("0x4200000000000000000000000000000000000006"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.BASE_TESTNET]:{[c.USDC]:{address:w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.BSC]:{[c.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:c.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[c.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:c.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[c.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[c.USDC]:{address:w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:c.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:c.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[b.ETHEREUM]:{[c.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:c.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[c.DAI]:{address:w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:c.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[c.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:c.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[c.USDC]:{address:w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.ETHEREUM_TESTNET]:{[c.USDC]:{address:w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:c.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.HYPEREVM]:{[c.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.LISK]:{[c.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.MONAD]:{[c.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.MONAD_TESTNET]:{[c.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.OPTIMISM]:{[c.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.OPTIMISM_TESTNET]:{[c.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.POLYGON]:{[c.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.STARKNET]:{[c.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[c.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:c.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[c.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:c.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[c.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[b.STARKNET_TESTNET]:{[c.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},Rs=new Set(Object.values(b));function C(t){if(As(t))return t;const e=b[t];if(!e)throw new Error(`Invalid chain: ${t}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function As(t){return Rs.has(t)}function Ds(t,e){const s=e.toLowerCase().trim(),n=et[t];if(!n)throw new Error(`Chain not found: ${t}. The chain key must be a valid chain identifier.`);let o;for(const i in n){const r=n[i];if(r&&r.address.toLowerCase()===s.toLowerCase()){o=r;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${t}. The token address must be a valid token address on the specified chain.`);return o}function re(t,e,s){const n=Ds(t,e);if(n.symbol!==s)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${t} corresponds to token "${n.symbol}", but expected "${s}". The token address must correspond to a token with the expected symbol on the specified chain.`);return n}function Us(t,e){return et[t]?.[e]}function tt(t,e){return Us(t,e)?.address}var ie=(t=>(t.PRODUCTION="production",t.STAGING="staging",t))(ie||{});class d{constructor({api_key:e,env:s,seesion_token:n,props:o}){this.api_key=e||"",this.sessionToken=n||"",this.env=s??ie.PRODUCTION,this.props=o}static async config(e){if(!d.app){if(!e)throw new Error("Please provide an api_key");d.app=new d(e)}return e&&(e.api_key!==void 0&&(d.app.api_key=e.api_key),e.seesion_token!==void 0&&(d.app.sessionToken=e.seesion_token),e.env!==void 0&&(d.app.env=e.env),e.props!==void 0&&(d.app.props=e.props)),d.app}static getApiKey(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.api_key}static getSessionToken(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.sessionToken}static getProps(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.props}static getEnv(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.env==="internal"?"staging":d.app.env}static getBaseUrl(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(d.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const s=d.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",n=Number(e),o=e&&!isNaN(Number(e))&&n>0?"/pay/":"/deposit/",i=`${e&&!isNaN(Number(e))&&n>0?n*100:""}`;return s+o+i}}let ae=null;function vs(){ae=Lt.create({prefixUrl:d.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[t=>{const e=d.getSessionToken()||d.getApiKey();t.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(t,e,s)=>s]},retry:{limit:2}})}function y(){return ae||vs(),ae}class ks{async getById(e){return await y().get("intents/"+e).json()}async getForSender(e){return await y().get("intents/user/"+e).json()}async getForAddress(e){return await y().get("intents/address/"+e).json()}async getForSession(e){return await y().get("modal/sessions/intents/"+e).json()}async getAll(e){return await y().get("intents",{searchParams:e}).json()}async create(e){const s=C(e.source_chain),n=C(e.destination_chain);return await y().post("intents",{json:{...e,source_chain:s,destination_chain:n}}).json()}async createForSession(e){const s=C(e.sourceChain);return await y().post("modal/sessions/intents",{json:{...e,sourceChain:s}}).json()}async update(e,s){return await y().post("intents",{json:s}).json()}async triggerProcessing(e){return await y().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await y().post(`modal/sessions/intents/${e}/process`).json()}}class Is{async getFromSpecificBridge(e){const s=C(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=C(e.destinationChain);return await y().get("quotes/single",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getFromAllBridges(e){const s=C(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=C(e.destinationChain);return await y().get("quotes/multiple",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getBestAcrossBridges(e){const s=C(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=C(e.destinationChain);return await y().get("quotes/best",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getAll(e){const s=C(e.destinationChain);return await y().get("quotes/multi-source",{searchParams:{...e,destinationChain:s}}).json()}async getAllForSession(e){return await y().get("modal/sessions/quotes",{searchParams:e}).json()}}class Ps{async getOptimalRoutes(e){const s=C(e.sourceChain),n=C(e.destinationChain);return await y().get("router/optimal-route",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getAllSupportedBridges(){return await y().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const s=C(e.sourceChain),n=C(e.destinationChain);return await y().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getSupportedRoutes(e){return await y().get("router/supported-routes/bridge/"+e).json()}}class xs{async getSupported(e){return await y().get("chains",{searchParams:e}).json()}async getBalance(e){return await y().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ns{async getClientInfo(){return await y().get("client/auth/client-info").json()}async getClientInfoForSession(){return await y().get("modal/sessions/client").json()}}class Os{async getSessionToken(e){const s=C(e.destinationChain);let n=tt(s,e.token);n||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),n=tt(s,"USDC"));const o={recipient:e.recipient,tokenOut:n,destinationChain:s,amount:e.amount};return y().post("modal/sessions",{json:o}).json().then(i=>({...i,amount:o.amount}))}}const Bs={router:new Ps,quotes:new Is,intents:new ks,chains:new xs,client:new Ns,auth:new Os};function st(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(s=st(t[e]))&&(n&&(n+=" "),n+=s)}else for(s in t)t[s]&&(n&&(n+=" "),n+=s);return n}function Ms(){for(var t,e,s=0,n="",o=arguments.length;s<o;s++)(t=arguments[s])&&(e=st(t))&&(n&&(n+=" "),n+=e);return n}const _s=["light","dark","system"];function Ls(t){const{amount:e,styles:s,excludeChains:n,isOpen:o,isPending:i,open:r,close:a,onCancel:l,onSuccess:u,session_url:h,sessionToken:S}=t,[m,T]=f.useState(0),[A,Te]=f.useState(""),[p,E]=f.useState(null),g=f.useRef(null);d.config({api_key:"",env:t.env==="internal"?"internal":"production"}),f.useEffect(()=>{Te(d.getPayModalUrl(e))},[e]),f.useEffect(()=>{const D=s?.theme;if(!D||_s.includes(D)){E(null);return}let v=!1;return(async()=>{try{const Ee=d.getBaseUrl(),pt=await fetch(`${Ee}/themes/${D}`);if(!pt.ok)return;const Se=await pt.json();!v&&Se.status==="approved"&&Se.css_content&&E(Se.css_content)}catch(Ee){console.error("Failed to fetch theme:",Ee)}})(),()=>{v=!0}},[s?.theme]),f.useEffect(()=>{const D=document.body.style.overflow;o?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=D||"";const v=be=>{be.data==="closed"&&(a(),l?.()),be.data==="completed"&&(window.setTimeout(a,2e3),u?.())};return window.addEventListener("message",v),()=>{document.body.style.overflow=D||"",window.removeEventListener("message",v)}},[o,l,u]),f.useEffect(()=>{if(!S)return;const D=t.css||p||void 0,v={type:"session",session_token:S,environment:d.getEnv()||ie.PRODUCTION,styles:s,props:{excludeChains:n?.join(",")},...D?{css:D}:{}};g.current?.contentWindow?.postMessage(v,"https://app.chainrails.io"),g.current?.contentWindow?.postMessage(v,"https://chainrails-frontend-git-staging-horus-labs.vercel.app"),window.setTimeout(()=>{g.current?.contentWindow?.postMessage(v,"https://app.chainrails.io"),g.current?.contentWindow?.postMessage(v,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")},1e3)},[S,m,o,s,p]);function U(){T(Math.random())}return O.jsxs("div",{className:Ms("payment-modal-wrapper",m===0||i?"loading":"not-loading",o?"open":"closed"),children:[(m===0||i)&&O.jsx("div",{role:"status",className:"payment-modal-loader",children:O.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[O.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),O.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]})}),O.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:A||void 0,onLoad:U,className:`payment-modal ${m===0||i?"invisible":"visible"}`,"data-id":e,ref:g},e)]})}const Fs=Symbol(),ce=Symbol(),_="a",nt="f",ot="p",rt="c",it="t",le="h",L="w",ue="o",de="k";let $s=(t,e)=>new Proxy(t,e);const fe=Object.getPrototypeOf,he=new WeakMap,at=t=>t&&(he.has(t)?he.get(t):fe(t)===Object.prototype||fe(t)===Array.prototype),q=t=>typeof t=="object"&&t!==null,Hs=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable),js=t=>{if(Array.isArray(t))return Array.from(t);const e=Object.getOwnPropertyDescriptors(t);return Object.values(e).forEach(s=>{s.configurable=!0}),Object.create(fe(t),e)},zs=(t,e)=>{const s={[nt]:e};let n=!1;const o=(a,l)=>{if(!n){let u=s[_].get(t);if(u||(u={},s[_].set(t,u)),a===L)u[L]=!0;else{let h=u[a];h||(h=new Set,u[a]=h),h.add(l)}}},i=()=>{n=!0,s[_].delete(t)},r={get(a,l){return l===ce?t:(o(de,l),ct(Reflect.get(a,l),s[_],s[rt],s[it]))},has(a,l){return l===Fs?(i(),!0):(o(le,l),Reflect.has(a,l))},getOwnPropertyDescriptor(a,l){return o(ue,l),Reflect.getOwnPropertyDescriptor(a,l)},ownKeys(a){return o(L),Reflect.ownKeys(a)}};return e&&(r.set=r.deleteProperty=()=>!1),[r,s]},me=t=>t[ce]||t,ct=(t,e,s,n)=>{if(!at(t))return t;let o=n&&n.get(t);if(!o){const l=me(t);Hs(l)?o=[l,js(l)]:o=[l],n?.set(t,o)}const[i,r]=o;let a=s&&s.get(i);return(!a||a[1][nt]!==!!r)&&(a=zs(i,!!r),a[1][ot]=$s(r||i,a[0]),s&&s.set(i,a)),a[1][_]=e,a[1][rt]=s,a[1][it]=n,a[1][ot]},qs=(t,e)=>{const s=Reflect.ownKeys(t),n=Reflect.ownKeys(e);return s.length!==n.length||s.some((o,i)=>o!==n[i])},lt=(t,e,s,n,o=Object.is)=>{if(o(t,e))return!1;if(!q(t)||!q(e))return!0;const i=s.get(me(t));if(!i)return!0;if(n){if(n.get(t)===e)return!1;n.set(t,e)}let r=null;for(const a of i[le]||[])if(r=Reflect.has(t,a)!==Reflect.has(e,a),r)return r;if(i[L]===!0){if(r=qs(t,e),r)return r}else for(const a of i[ue]||[]){const l=!!Reflect.getOwnPropertyDescriptor(t,a),u=!!Reflect.getOwnPropertyDescriptor(e,a);if(r=l!==u,r)return r}for(const a of i[de]||[])if(r=lt(t[a],e[a],s,n,o),r)return r;if(r===null)throw new Error("invalid used");return r},Ks=t=>at(t)&&t[ce]||null,ut=(t,e=!0)=>{he.set(t,e)},Ws=(t,e,s)=>{const n=[],o=new WeakSet,i=(r,a)=>{var l,u,h;if(o.has(r))return;q(r)&&o.add(r);const S=q(r)&&e.get(me(r));if(S){if((l=S[le])===null||l===void 0||l.forEach(m=>{const T=`:has(${String(m)})`;n.push(a?[...a,T]:[T])}),S[L]===!0){const m=":ownKeys";n.push(a?[...a,m]:[m])}else(u=S[ue])===null||u===void 0||u.forEach(m=>{const T=`:hasOwn(${String(m)})`;n.push(a?[...a,T]:[T])});(h=S[de])===null||h===void 0||h.forEach(m=>{"value"in(Object.getOwnPropertyDescriptor(r,m)||{})&&i(r[m],a?[...a,m]:[m])})}else a&&n.push(a)};return i(t),n},K={},ge=t=>typeof t=="object"&&t!==null,Vs=t=>ge(t)&&!pe.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),dt=(t,e)=>{const s=ft.get(t);if(s?.[0]===e)return s[1];const n=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return ut(n,!0),ft.set(t,[e,n]),Reflect.ownKeys(t).forEach(o=>{if(Object.getOwnPropertyDescriptor(n,o))return;const i=Reflect.get(t,o),{enumerable:r}=Reflect.getOwnPropertyDescriptor(t,o),a={value:i,enumerable:r,configurable:!0};if(pe.has(i))ut(i,!1);else if(N.has(i)){const[l,u]=N.get(i);a.value=dt(l,u())}Object.defineProperty(n,o,a)}),Object.preventExtensions(n)},Ys=(t,e,s,n)=>({deleteProperty(o,i){const r=Reflect.get(o,i);s(i);const a=Reflect.deleteProperty(o,i);return a&&n(["delete",[i],r]),a},set(o,i,r,a){const l=!t()&&Reflect.has(o,i),u=Reflect.get(o,i,a);if(l&&(ht(u,r)||W.has(r)&&ht(u,W.get(r))))return!0;s(i),ge(r)&&(r=Ks(r)||r);const h=!N.has(r)&&Xs(r)?mt(r):r;return e(i,h),Reflect.set(o,i,h,a),n(["set",[i],r,u]),!0}}),N=new WeakMap,pe=new WeakSet,ft=new WeakMap,ye=[1],W=new WeakMap;let ht=Object.is,Gs=(t,e)=>new Proxy(t,e),Xs=Vs,Js=dt,Zs=Ys;function mt(t={}){if(!ge(t))throw new Error("object required");const e=W.get(t);if(e)return e;let s=ye[0];const n=new Set,o=(p,E=++ye[0])=>{s!==E&&(i=s=E,n.forEach(g=>g(p,E)))};let i=s;const r=(p=ye[0])=>(i!==p&&(i=p,l.forEach(([E])=>{const g=E[1](p);g>s&&(s=g)})),s),a=p=>(E,g)=>{const U=[...E];U[1]=[p,...U[1]],o(U,g)},l=new Map,u=(p,E)=>{const g=!pe.has(E)&&N.get(E);if(g){if((K?"production":void 0)!=="production"&&l.has(p))throw new Error("prop listener already exists");if(n.size){const U=g[2](a(p));l.set(p,[g,U])}else l.set(p,[g])}},h=p=>{var E;const g=l.get(p);g&&(l.delete(p),(E=g[1])==null||E.call(g))},S=p=>(n.add(p),n.size===1&&l.forEach(([g,U],D)=>{if((K?"production":void 0)!=="production"&&U)throw new Error("remove already exists");const v=g[2](a(D));l.set(D,[g,v])}),()=>{n.delete(p),n.size===0&&l.forEach(([g,U],D)=>{U&&(U(),l.set(D,[g]))})});let m=!0;const T=Zs(()=>m,u,h,o),A=Gs(t,T);W.set(t,A);const Te=[t,r,S];return N.set(A,Te),Reflect.ownKeys(t).forEach(p=>{const E=Object.getOwnPropertyDescriptor(t,p);"value"in E&&E.writable&&(A[p]=t[p])}),m=!1,A}function Qs(t,e,s){const n=N.get(t);(K?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let o;const i=[],r=n[2];let a=!1;const u=r(h=>{i.push(h),o||(o=Promise.resolve().then(()=>{o=void 0,a&&e(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function gt(t){const e=N.get(t);(K?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[s,n]=e;return Js(s,n())}const en={},tn=(t,e)=>{const s=f.useRef(void 0);f.useEffect(()=>{s.current=Ws(t,e)}),f.useDebugValue(s.current)},sn=new WeakMap;function nn(t,e){const n=f.useMemo(()=>t&&new WeakMap,[t]),o=f.useRef(void 0);let i=!0;const r=f.useSyncExternalStore(f.useCallback(l=>{const u=Qs(t,l);return l(),u},[t,void 0]),()=>{const l=gt(t);try{if(!i&&o.current&&!lt(o.current,l,n,new WeakMap))return o.current}catch{}return l},()=>gt(t));i=!1,f.useLayoutEffect(()=>{o.current=r}),(en?"production":void 0)!=="production"&&tn(r,n);const a=f.useMemo(()=>new WeakMap,[]);return ct(r,n,a,sn)}const P=mt({data:null,isPending:!1,error:null});function on({session_url:t,onCancel:e,onSuccess:s}){const n=nn(P),[o,i]=f.useState(!1),[r,a]=f.useState(Date.now()),l=n?.data?.sessionToken,u=n?.data?.amount;function h(){l||window.setTimeout(()=>{l&&i(!0)},200),i(!0)}function S(){i(!1)}const m=()=>{const T=Date.now();P.isPending=!0,P.error=null,P.data=null,fetch(t,{headers:{"Content-Type":"application/json"}}).then(A=>A.json()).then(A=>{T<r||(P.data=A,P.isPending=!1,a(T))}).catch(A=>{T<r||(P.error=A?.toString(),P.isPending=!1,a(T),setInterval(m,5e3))})};return f.useEffect(()=>{m()},[t]),{sessionToken:l,amount:u,isOpen:o,session_url:t,open:h,close:S,isPending:n.isPending,error:n.error,refetch:m,onSuccess:s,onCancel:e}}function rn({sessionToken:t,amount:e,onCancel:s,onSuccess:n}){const[o,i]=f.useState(!1),[r,a]=f.useState(t),[l,u]=f.useState(e);function h({sessionToken:T,amount:A}){a(T),u(A)}f.useEffect(()=>{a(t)},[t]);function S(){r||window.setTimeout(()=>{r&&i(!0)},200),i(!0)}function m(){i(!1)}return{sessionToken:r,updateSession:h,amount:l,isOpen:o,open:S,close:m,onSuccess:n,onCancel:s}}R.AmountSymbols=c,R.Chainrails=d,R.Chains=Ft,R.PaymentModal=Ls,R.crapi=Bs,R.usePaymentModal=rn,R.usePaymentSession=on,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
|
3
|
+
`);super(r,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=o,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=e,this.version=Oe}walk(e){return Be(this,e)}}function Be(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Be(t.cause,e):e?null:t}class Me extends I{constructor({size:e,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function H(t,{dir:e,size:s=32}={}){return typeof t=="string"?$t(t,{dir:e,size:s}):Ht(t,{dir:e,size:s})}function $t(t,{dir:e,size:s=32}={}){if(s===null)return t;const n=t.replace("0x","");if(n.length>s*2)throw new Me({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](s*2,"0")}`}function Ht(t,{dir:e,size:s=32}={}){if(s===null)return t;if(t.length>s)throw new Me({size:t.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let o=0;o<s;o++){const i=e==="right";n[i?o:s-o-1]=t[i?o:t.length-o-1]}return n}class jt extends I{constructor({max:e,min:s,signed:n,size:o,value:i}){super(`Number "${i}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${s} to ${e})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class zt extends I{constructor({givenSize:e,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function te(t,{size:e}){if(Ne(t)>e)throw new zt({givenSize:Ne(t),maxSize:e})}function qt(t,e={}){const{signed:s,size:n}=e,o=BigInt(t);let i;n?s?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const r=typeof i=="bigint"&&s?-i-1n:0;if(i&&o>i||o<r){const l=typeof t=="bigint"?"n":"";throw new jt({max:i?`${i}${l}`:void 0,min:`${r}${l}`,signed:s,size:n,value:`${t}${l}`})}const a=`0x${(s&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?H(a,{size:n}):a}const Kt=new TextEncoder;function Wt(t,e={}){return typeof t=="number"||typeof t=="bigint"?Yt(t,e):typeof t=="boolean"?Vt(t,e):Q(t)?Le(t,e):Fe(t,e)}function Vt(t,e={}){const s=new Uint8Array(1);return s[0]=Number(t),typeof e.size=="number"?(te(s,{size:e.size}),H(s,{size:e.size})):s}const k={zero:48,nine:57,A:65,F:70,a:97,f:102};function _e(t){if(t>=k.zero&&t<=k.nine)return t-k.zero;if(t>=k.A&&t<=k.F)return t-(k.A-10);if(t>=k.a&&t<=k.f)return t-(k.a-10)}function Le(t,e={}){let s=t;e.size&&(te(s,{size:e.size}),s=H(s,{dir:"right",size:e.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const o=n.length/2,i=new Uint8Array(o);for(let r=0,a=0;r<o;r++){const l=_e(n.charCodeAt(a++)),u=_e(n.charCodeAt(a++));if(l===void 0||u===void 0)throw new I(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);i[r]=l*16+u}return i}function Yt(t,e){const s=qt(t,e);return Le(s)}function Fe(t,e={}){const s=Kt.encode(t);return typeof e.size=="number"?(te(s,{size:e.size}),H(s,{dir:"right",size:e.size})):s}const j=BigInt(2**32-1),$e=BigInt(32);function Gt(t,e=!1){return e?{h:Number(t&j),l:Number(t>>$e&j)}:{h:Number(t>>$e&j)|0,l:Number(t&j)|0}}function Xt(t,e=!1){const s=t.length;let n=new Uint32Array(s),o=new Uint32Array(s);for(let i=0;i<s;i++){const{h:r,l:a}=Gt(t[i],e);[n[i],o[i]]=[r,a]}return[n,o]}const Jt=(t,e,s)=>t<<s|e>>>32-s,Zt=(t,e,s)=>e<<s|t>>>32-s,Qt=(t,e,s)=>e<<s-32|t>>>64-s,es=(t,e,s)=>t<<s-32|e>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ts(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function He(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function z(t,...e){if(!ts(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function je(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ss(t,e){z(t);const s=e.outputLen;if(t.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function ns(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ze(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const os=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function rs(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function is(t){for(let e=0;e<t.length;e++)t[e]=rs(t[e]);return t}const qe=os?t=>t:is;function as(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Ke(t){return typeof t=="string"&&(t=as(t)),z(t),t}class cs{}function ls(t){const e=n=>t().update(Ke(n)).digest(),s=t();return e.outputLen=s.outputLen,e.blockLen=s.blockLen,e.create=()=>t(),e}const us=BigInt(0),M=BigInt(1),ds=BigInt(2),fs=BigInt(7),hs=BigInt(256),ms=BigInt(113),We=[],Ve=[],Ye=[];for(let t=0,e=M,s=1,n=0;t<24;t++){[s,n]=[n,(2*s+3*n)%5],We.push(2*(5*n+s)),Ve.push((t+1)*(t+2)/2%64);let o=us;for(let i=0;i<7;i++)e=(e<<M^(e>>fs)*ms)%hs,e&ds&&(o^=M<<(M<<BigInt(i))-M);Ye.push(o)}const Ge=Xt(Ye,!0),gs=Ge[0],ps=Ge[1],Xe=(t,e,s)=>s>32?Qt(t,e,s):Jt(t,e,s),Je=(t,e,s)=>s>32?es(t,e,s):Zt(t,e,s);function ys(t,e=24){const s=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let r=0;r<10;r++)s[r]=t[r]^t[r+10]^t[r+20]^t[r+30]^t[r+40];for(let r=0;r<10;r+=2){const a=(r+8)%10,l=(r+2)%10,u=s[l],h=s[l+1],S=Xe(u,h,1)^s[a],m=Je(u,h,1)^s[a+1];for(let T=0;T<50;T+=10)t[r+T]^=S,t[r+T+1]^=m}let o=t[2],i=t[3];for(let r=0;r<24;r++){const a=Ve[r],l=Xe(o,i,a),u=Je(o,i,a),h=We[r];o=t[h],i=t[h+1],t[h]=l,t[h+1]=u}for(let r=0;r<50;r+=10){for(let a=0;a<10;a++)s[a]=t[r+a];for(let a=0;a<10;a++)t[r+a]^=~s[(a+2)%10]&s[(a+4)%10]}t[0]^=gs[n],t[1]^=ps[n]}ze(s)}class se extends cs{constructor(e,s,n,o=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=i,He(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ns(this.state)}clone(){return this._cloneInto()}keccak(){qe(this.state32),ys(this.state32,this.rounds),qe(this.state32),this.posOut=0,this.pos=0}update(e){je(this),e=Ke(e),z(e);const{blockLen:s,state:n}=this,o=e.length;for(let i=0;i<o;){const r=Math.min(s-this.pos,o-i);for(let a=0;a<r;a++)n[this.pos++]^=e[i++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:s,pos:n,blockLen:o}=this;e[n]^=s,(s&128)!==0&&n===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){je(this,!1),z(e),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,i=e.length;o<i;){this.posOut>=n&&this.keccak();const r=Math.min(n-this.posOut,i-o);e.set(s.subarray(this.posOut,this.posOut+r),o),this.posOut+=r,o+=r}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return He(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ss(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ze(this.state)}_cloneInto(e){const{blockLen:s,suffix:n,outputLen:o,rounds:i,enableXOF:r}=this;return e||(e=new se(s,n,o,r,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=o,e.enableXOF=r,e.destroyed=this.destroyed,e}}const Ts=(t,e,s)=>ls(()=>new se(e,t,s)),bs=Ts(1,136,256/8);function Es(t,e){return bs(Q(t,{strict:!1})?Wt(t):t)}class Ss extends I{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Ze extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const s=super.get(e);return super.has(e)&&s!==void 0&&(this.delete(e),super.set(e,s)),s}set(e,s){if(super.set(e,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const ne=new Ze(8192);function Qe(t,e){if(ne.has(`${t}.${e}`))return ne.get(`${t}.${e}`);const s=t.substring(2).toLowerCase(),n=Es(Fe(s)),o=s.split("");for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&o[r]&&(o[r]=o[r].toUpperCase()),(n[r>>1]&15)>=8&&o[r+1]&&(o[r+1]=o[r+1].toUpperCase());const i=`0x${o.join("")}`;return ne.set(`${t}.${e}`,i),i}function w(t,e){if(!Cs(t,{strict:!1}))throw new Ss({address:t});return Qe(t,e)}const ws=/^0x[a-fA-F0-9]{40}$/,oe=new Ze(8192);function Cs(t,e){const{strict:s=!0}=e??{},n=`${t}.${s}`;if(oe.has(n))return oe.get(n);const o=ws.test(t)?t.toLowerCase()===t?!0:s?Qe(t)===t:!0:!1;return oe.set(n,o),o}const c={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};c.USDC;const et={[b.ARBITRUM]:{[c.DAI]:{address:w("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.USDC]:{address:w("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:w("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:w("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.ARBITRUM_TESTNET]:{[c.USDC]:{address:w("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.AVALANCHE]:{[c.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.USDC]:{address:w("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.AVALANCHE_TESTNET]:{[c.USDC]:{address:w("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.BASE]:{[c.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:c.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[c.USDC]:{address:w("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.WETH]:{address:w("0x4200000000000000000000000000000000000006"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.BASE_TESTNET]:{[c.USDC]:{address:w("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:c.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.BSC]:{[c.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:c.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[c.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:c.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[c.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[c.USDC]:{address:w("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:c.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:c.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[b.ETHEREUM]:{[c.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:c.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[c.DAI]:{address:w("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:c.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[c.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:c.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[c.USDC]:{address:w("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:w("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:w("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.ETHEREUM_TESTNET]:{[c.USDC]:{address:w("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:c.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[b.HYPEREVM]:{[c.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.LISK]:{[c.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.MONAD]:{[c.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.MONAD_TESTNET]:{[c.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.OPTIMISM]:{[c.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[c.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.OPTIMISM_TESTNET]:{[c.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[b.POLYGON]:{[c.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[c.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[c.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:c.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[b.STARKNET]:{[c.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:c.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[c.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:c.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[c.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:c.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[c.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:c.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[c.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[c.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:c.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[b.STARKNET_TESTNET]:{[c.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:c.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},Rs=new Set(Object.values(b));function R(t){if(As(t))return t;const e=b[t];if(!e)throw new Error(`Invalid chain: ${t}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function As(t){return Rs.has(t)}function Ds(t,e){const s=e.toLowerCase().trim(),n=et[t];if(!n)throw new Error(`Chain not found: ${t}. The chain key must be a valid chain identifier.`);let o;for(const i in n){const r=n[i];if(r&&r.address.toLowerCase()===s.toLowerCase()){o=r;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${t}. The token address must be a valid token address on the specified chain.`);return o}function re(t,e,s){const n=Ds(t,e);if(n.symbol!==s)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${t} corresponds to token "${n.symbol}", but expected "${s}". The token address must correspond to a token with the expected symbol on the specified chain.`);return n}function Us(t,e){return et[t]?.[e]}function tt(t,e){return Us(t,e)?.address}var ie=(t=>(t.PRODUCTION="production",t.STAGING="staging",t))(ie||{});class d{constructor({api_key:e,env:s,seesion_token:n,props:o}){this.api_key=e||"",this.sessionToken=n||"",this.env=s??ie.PRODUCTION,this.props=o}static async config(e){if(!d.app){if(!e)throw new Error("Please provide an api_key");d.app=new d(e)}return e&&(e.api_key!==void 0&&(d.app.api_key=e.api_key),e.seesion_token!==void 0&&(d.app.sessionToken=e.seesion_token),e.env!==void 0&&(d.app.env=e.env),e.props!==void 0&&(d.app.props=e.props)),d.app}static getApiKey(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.api_key}static getSessionToken(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.sessionToken}static getProps(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.props}static getEnv(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return d.app.env==="internal"?"staging":d.app.env}static getBaseUrl(){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(d.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!d.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const s=d.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",n=Number(e),o=e&&!isNaN(Number(e))&&n>0?"/pay/":"/deposit/",i=`${e&&!isNaN(Number(e))&&n>0?n*100:""}`;return s+o+i}}let ae=null;function vs(){ae=Lt.create({prefixUrl:d.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[t=>{const e=d.getSessionToken()||d.getApiKey();t.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(t,e,s)=>s]},retry:{limit:2}})}function y(){return ae||vs(),ae}class ks{async getById(e){return await y().get("intents/"+e).json()}async getForSender(e){return await y().get("intents/user/"+e).json()}async getForAddress(e){return await y().get("intents/address/"+e).json()}async getForSession(e){return await y().get("modal/sessions/intents/"+e).json()}async getAll(e){return await y().get("intents",{searchParams:e}).json()}async create(e){const s=R(e.source_chain),n=R(e.destination_chain);return await y().post("intents",{json:{...e,source_chain:s,destination_chain:n}}).json()}async createForSession(e){const s=R(e.sourceChain);return await y().post("modal/sessions/intents",{json:{...e,sourceChain:s}}).json()}async update(e,s){return await y().post("intents",{json:s}).json()}async triggerProcessing(e){return await y().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await y().post(`modal/sessions/intents/${e}/process`).json()}}class Is{async getFromSpecificBridge(e){const s=R(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=R(e.destinationChain);return await y().get("quotes/single",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getFromAllBridges(e){const s=R(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=R(e.destinationChain);return await y().get("quotes/multiple",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getBestAcrossBridges(e){const s=R(e.sourceChain);re(s,e.tokenIn,e.amountSymbol);const n=R(e.destinationChain);return await y().get("quotes/best",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getAll(e){const s=R(e.destinationChain);return await y().get("quotes/multi-source",{searchParams:{...e,destinationChain:s}}).json()}async getAllForSession(e){return await y().get("modal/sessions/quotes",{searchParams:e}).json()}}class Ps{async getOptimalRoutes(e){const s=R(e.sourceChain),n=R(e.destinationChain);return await y().get("router/optimal-route",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getAllSupportedBridges(){return await y().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const s=R(e.sourceChain),n=R(e.destinationChain);return await y().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:s,destinationChain:n}}).json()}async getSupportedRoutes(e){return await y().get("router/supported-routes/bridge/"+e).json()}}class xs{async getSupported(e){return await y().get("chains",{searchParams:e}).json()}async getBalance(e){return await y().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ns{async getClientInfo(){return await y().get("client/auth/client-info").json()}async getClientInfoForSession(){return await y().get("modal/sessions/client").json()}}class Os{async getSessionToken(e){const s=R(e.destinationChain);let n=tt(s,e.token);n||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),n=tt(s,"USDC"));const o={recipient:e.recipient,tokenOut:n,destinationChain:s,amount:e.amount};return y().post("modal/sessions",{json:o}).json().then(i=>({...i,amount:o.amount}))}}const Bs={router:new Ps,quotes:new Is,intents:new ks,chains:new xs,client:new Ns,auth:new Os};function st(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(s=st(t[e]))&&(n&&(n+=" "),n+=s)}else for(s in t)t[s]&&(n&&(n+=" "),n+=s);return n}function Ms(){for(var t,e,s=0,n="",o=arguments.length;s<o;s++)(t=arguments[s])&&(e=st(t))&&(n&&(n+=" "),n+=e);return n}const _s=["light","dark","system"];function Ls(t){const{amount:e,styles:s,excludeChains:n,isOpen:o,isPending:i,open:r,close:a,onCancel:l,onSuccess:u,session_url:h,sessionToken:S}=t,[m,T]=f.useState(0),[D,Te]=f.useState(""),[g,E]=f.useState(null),p=f.useRef(null);d.config({api_key:"",env:t.env==="internal"?"internal":"production"}),f.useEffect(()=>{Te(d.getPayModalUrl(e))},[e]),f.useEffect(()=>{const C=s?.theme;if(console.log({themeValue:C}),!C||_s.includes(C)){E(null);return}let v=!1;return(async()=>{try{const Ee=d.getBaseUrl(),pt=await fetch(`${Ee}/themes/${C}`);if(!pt.ok)return;const Se=await pt.json();!v&&Se.status==="approved"&&Se.css_content&&E(Se.css_content)}catch(Ee){console.error("Failed to fetch theme:",Ee)}finally{console.log({themeCss:g})}})(),()=>{v=!0}},[s?.theme]),f.useEffect(()=>{const C=document.body.style.overflow;o?(document.body.style.overflow="hidden",document.body.style.overflow="hidden"):document.body.style.overflow=C||"";const v=be=>{be.data==="closed"&&(a(),l?.()),be.data==="completed"&&(window.setTimeout(a,2e3),u?.())};return window.addEventListener("message",v),()=>{document.body.style.overflow=C||"",window.removeEventListener("message",v)}},[o,l,u]),f.useEffect(()=>{if(!S)return;const C=t.css||g||void 0;console.log({cssToSend:C});const v={type:"session",session_token:S,environment:d.getEnv()||ie.PRODUCTION,styles:s,props:{excludeChains:n?.join(",")},...C?{css:C}:{}};p.current?.contentWindow?.postMessage(v,"https://app.chainrails.io"),p.current?.contentWindow?.postMessage(v,"https://chainrails-frontend-git-staging-horus-labs.vercel.app"),window.setTimeout(()=>{p.current?.contentWindow?.postMessage(v,"https://app.chainrails.io"),p.current?.contentWindow?.postMessage(v,"https://chainrails-frontend-git-staging-horus-labs.vercel.app")},1e3)},[S,m,o,s,g]);function U(){T(Math.random())}return O.jsxs("div",{className:Ms("payment-modal-wrapper",m===0||i?"loading":"not-loading",o?"open":"closed"),children:[(m===0||i)&&O.jsx("div",{role:"status",className:"payment-modal-loader",children:O.jsxs("svg",{"aria-hidden":"true",className:"icon",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[O.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),O.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]})}),O.jsx("iframe",{allow:"clipboard-read *; clipboard-write *",src:D||void 0,onLoad:U,className:`payment-modal ${m===0||i?"invisible":"visible"}`,"data-id":e,ref:p},e)]})}const Fs=Symbol(),ce=Symbol(),_="a",nt="f",ot="p",rt="c",it="t",le="h",L="w",ue="o",de="k";let $s=(t,e)=>new Proxy(t,e);const fe=Object.getPrototypeOf,he=new WeakMap,at=t=>t&&(he.has(t)?he.get(t):fe(t)===Object.prototype||fe(t)===Array.prototype),q=t=>typeof t=="object"&&t!==null,Hs=t=>Object.values(Object.getOwnPropertyDescriptors(t)).some(e=>!e.configurable&&!e.writable),js=t=>{if(Array.isArray(t))return Array.from(t);const e=Object.getOwnPropertyDescriptors(t);return Object.values(e).forEach(s=>{s.configurable=!0}),Object.create(fe(t),e)},zs=(t,e)=>{const s={[nt]:e};let n=!1;const o=(a,l)=>{if(!n){let u=s[_].get(t);if(u||(u={},s[_].set(t,u)),a===L)u[L]=!0;else{let h=u[a];h||(h=new Set,u[a]=h),h.add(l)}}},i=()=>{n=!0,s[_].delete(t)},r={get(a,l){return l===ce?t:(o(de,l),ct(Reflect.get(a,l),s[_],s[rt],s[it]))},has(a,l){return l===Fs?(i(),!0):(o(le,l),Reflect.has(a,l))},getOwnPropertyDescriptor(a,l){return o(ue,l),Reflect.getOwnPropertyDescriptor(a,l)},ownKeys(a){return o(L),Reflect.ownKeys(a)}};return e&&(r.set=r.deleteProperty=()=>!1),[r,s]},me=t=>t[ce]||t,ct=(t,e,s,n)=>{if(!at(t))return t;let o=n&&n.get(t);if(!o){const l=me(t);Hs(l)?o=[l,js(l)]:o=[l],n?.set(t,o)}const[i,r]=o;let a=s&&s.get(i);return(!a||a[1][nt]!==!!r)&&(a=zs(i,!!r),a[1][ot]=$s(r||i,a[0]),s&&s.set(i,a)),a[1][_]=e,a[1][rt]=s,a[1][it]=n,a[1][ot]},qs=(t,e)=>{const s=Reflect.ownKeys(t),n=Reflect.ownKeys(e);return s.length!==n.length||s.some((o,i)=>o!==n[i])},lt=(t,e,s,n,o=Object.is)=>{if(o(t,e))return!1;if(!q(t)||!q(e))return!0;const i=s.get(me(t));if(!i)return!0;if(n){if(n.get(t)===e)return!1;n.set(t,e)}let r=null;for(const a of i[le]||[])if(r=Reflect.has(t,a)!==Reflect.has(e,a),r)return r;if(i[L]===!0){if(r=qs(t,e),r)return r}else for(const a of i[ue]||[]){const l=!!Reflect.getOwnPropertyDescriptor(t,a),u=!!Reflect.getOwnPropertyDescriptor(e,a);if(r=l!==u,r)return r}for(const a of i[de]||[])if(r=lt(t[a],e[a],s,n,o),r)return r;if(r===null)throw new Error("invalid used");return r},Ks=t=>at(t)&&t[ce]||null,ut=(t,e=!0)=>{he.set(t,e)},Ws=(t,e,s)=>{const n=[],o=new WeakSet,i=(r,a)=>{var l,u,h;if(o.has(r))return;q(r)&&o.add(r);const S=q(r)&&e.get(me(r));if(S){if((l=S[le])===null||l===void 0||l.forEach(m=>{const T=`:has(${String(m)})`;n.push(a?[...a,T]:[T])}),S[L]===!0){const m=":ownKeys";n.push(a?[...a,m]:[m])}else(u=S[ue])===null||u===void 0||u.forEach(m=>{const T=`:hasOwn(${String(m)})`;n.push(a?[...a,T]:[T])});(h=S[de])===null||h===void 0||h.forEach(m=>{"value"in(Object.getOwnPropertyDescriptor(r,m)||{})&&i(r[m],a?[...a,m]:[m])})}else a&&n.push(a)};return i(t),n},K={},ge=t=>typeof t=="object"&&t!==null,Vs=t=>ge(t)&&!pe.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer)&&!(t instanceof Promise),dt=(t,e)=>{const s=ft.get(t);if(s?.[0]===e)return s[1];const n=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));return ut(n,!0),ft.set(t,[e,n]),Reflect.ownKeys(t).forEach(o=>{if(Object.getOwnPropertyDescriptor(n,o))return;const i=Reflect.get(t,o),{enumerable:r}=Reflect.getOwnPropertyDescriptor(t,o),a={value:i,enumerable:r,configurable:!0};if(pe.has(i))ut(i,!1);else if(N.has(i)){const[l,u]=N.get(i);a.value=dt(l,u())}Object.defineProperty(n,o,a)}),Object.preventExtensions(n)},Ys=(t,e,s,n)=>({deleteProperty(o,i){const r=Reflect.get(o,i);s(i);const a=Reflect.deleteProperty(o,i);return a&&n(["delete",[i],r]),a},set(o,i,r,a){const l=!t()&&Reflect.has(o,i),u=Reflect.get(o,i,a);if(l&&(ht(u,r)||W.has(r)&&ht(u,W.get(r))))return!0;s(i),ge(r)&&(r=Ks(r)||r);const h=!N.has(r)&&Xs(r)?mt(r):r;return e(i,h),Reflect.set(o,i,h,a),n(["set",[i],r,u]),!0}}),N=new WeakMap,pe=new WeakSet,ft=new WeakMap,ye=[1],W=new WeakMap;let ht=Object.is,Gs=(t,e)=>new Proxy(t,e),Xs=Vs,Js=dt,Zs=Ys;function mt(t={}){if(!ge(t))throw new Error("object required");const e=W.get(t);if(e)return e;let s=ye[0];const n=new Set,o=(g,E=++ye[0])=>{s!==E&&(i=s=E,n.forEach(p=>p(g,E)))};let i=s;const r=(g=ye[0])=>(i!==g&&(i=g,l.forEach(([E])=>{const p=E[1](g);p>s&&(s=p)})),s),a=g=>(E,p)=>{const U=[...E];U[1]=[g,...U[1]],o(U,p)},l=new Map,u=(g,E)=>{const p=!pe.has(E)&&N.get(E);if(p){if((K?"production":void 0)!=="production"&&l.has(g))throw new Error("prop listener already exists");if(n.size){const U=p[2](a(g));l.set(g,[p,U])}else l.set(g,[p])}},h=g=>{var E;const p=l.get(g);p&&(l.delete(g),(E=p[1])==null||E.call(p))},S=g=>(n.add(g),n.size===1&&l.forEach(([p,U],C)=>{if((K?"production":void 0)!=="production"&&U)throw new Error("remove already exists");const v=p[2](a(C));l.set(C,[p,v])}),()=>{n.delete(g),n.size===0&&l.forEach(([p,U],C)=>{U&&(U(),l.set(C,[p]))})});let m=!0;const T=Zs(()=>m,u,h,o),D=Gs(t,T);W.set(t,D);const Te=[t,r,S];return N.set(D,Te),Reflect.ownKeys(t).forEach(g=>{const E=Object.getOwnPropertyDescriptor(t,g);"value"in E&&E.writable&&(D[g]=t[g])}),m=!1,D}function Qs(t,e,s){const n=N.get(t);(K?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let o;const i=[],r=n[2];let a=!1;const u=r(h=>{i.push(h),o||(o=Promise.resolve().then(()=>{o=void 0,a&&e(i.splice(0))}))});return a=!0,()=>{a=!1,u()}}function gt(t){const e=N.get(t);(K?"production":void 0)!=="production"&&!e&&console.warn("Please use proxy object");const[s,n]=e;return Js(s,n())}const en={},tn=(t,e)=>{const s=f.useRef(void 0);f.useEffect(()=>{s.current=Ws(t,e)}),f.useDebugValue(s.current)},sn=new WeakMap;function nn(t,e){const n=f.useMemo(()=>t&&new WeakMap,[t]),o=f.useRef(void 0);let i=!0;const r=f.useSyncExternalStore(f.useCallback(l=>{const u=Qs(t,l);return l(),u},[t,void 0]),()=>{const l=gt(t);try{if(!i&&o.current&&!lt(o.current,l,n,new WeakMap))return o.current}catch{}return l},()=>gt(t));i=!1,f.useLayoutEffect(()=>{o.current=r}),(en?"production":void 0)!=="production"&&tn(r,n);const a=f.useMemo(()=>new WeakMap,[]);return ct(r,n,a,sn)}const P=mt({data:null,isPending:!1,error:null});function on({session_url:t,onCancel:e,onSuccess:s}){const n=nn(P),[o,i]=f.useState(!1),[r,a]=f.useState(Date.now()),l=n?.data?.sessionToken,u=n?.data?.amount;function h(){l||window.setTimeout(()=>{l&&i(!0)},200),i(!0)}function S(){i(!1)}const m=()=>{const T=Date.now();P.isPending=!0,P.error=null,P.data=null,fetch(t,{headers:{"Content-Type":"application/json"}}).then(D=>D.json()).then(D=>{T<r||(P.data=D,P.isPending=!1,a(T))}).catch(D=>{T<r||(P.error=D?.toString(),P.isPending=!1,a(T),setInterval(m,5e3))})};return f.useEffect(()=>{m()},[t]),{sessionToken:l,amount:u,isOpen:o,session_url:t,open:h,close:S,isPending:n.isPending,error:n.error,refetch:m,onSuccess:s,onCancel:e}}function rn({sessionToken:t,amount:e,onCancel:s,onSuccess:n}){const[o,i]=f.useState(!1),[r,a]=f.useState(t),[l,u]=f.useState(e);function h({sessionToken:T,amount:D}){a(T),u(D)}f.useEffect(()=>{a(t)},[t]);function S(){r||window.setTimeout(()=>{r&&i(!0)},200),i(!0)}function m(){i(!1)}return{sessionToken:r,updateSession:h,amount:l,isOpen:o,open:S,close:m,onSuccess:n,onCancel:s}}A.AmountSymbols=c,A.Chainrails=d,A.Chains=Ft,A.PaymentModal=Ls,A.crapi=Bs,A.usePaymentModal=rn,A.usePaymentSession=on,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|