coinley-checkout 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coinley-checkout.es.js +1505 -2548
- package/dist/coinley-checkout.es.js.map +1 -1
- package/dist/coinley-checkout.umd.js +18 -0
- package/dist/coinley-checkout.umd.js.map +1 -0
- package/dist/style.css +1 -1259
- package/package.json +24 -12
@@ -1,178 +1,441 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
var Ke = Object.defineProperty, Ve = Object.defineProperties;
|
2
|
+
var qe = Object.getOwnPropertyDescriptors;
|
3
|
+
var fe = Object.getOwnPropertySymbols;
|
4
|
+
var $e = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable;
|
5
|
+
var ge = (s, r, t) => r in s ? Ke(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, z = (s, r) => {
|
6
|
+
for (var t in r || (r = {}))
|
7
|
+
$e.call(r, t) && ge(s, t, r[t]);
|
8
|
+
if (fe)
|
9
|
+
for (var t of fe(r))
|
10
|
+
_e.call(r, t) && ge(s, t, r[t]);
|
11
|
+
return s;
|
12
|
+
}, we = (s, r) => Ve(s, qe(r));
|
13
|
+
var R = (s, r, t) => new Promise((c, u) => {
|
14
|
+
var h = (e) => {
|
15
|
+
try {
|
16
|
+
w(t.next(e));
|
17
|
+
} catch (n) {
|
18
|
+
u(n);
|
19
|
+
}
|
20
|
+
}, y = (e) => {
|
21
|
+
try {
|
22
|
+
w(t.throw(e));
|
23
|
+
} catch (n) {
|
24
|
+
u(n);
|
25
|
+
}
|
26
|
+
}, w = (e) => e.done ? c(e.value) : Promise.resolve(e.value).then(h, y);
|
27
|
+
w((t = t.apply(s, r)).next());
|
28
|
+
});
|
29
|
+
import S, { createContext as ye, useContext as xe, useState as U, useEffect as Z, forwardRef as Ye, useImperativeHandle as Je } from "react";
|
30
|
+
const A = {
|
31
|
+
ETHEREUM: "ethereum",
|
32
|
+
BSC: "bsc",
|
33
|
+
TRON: "tron",
|
34
|
+
ALGORAND: "algorand"
|
35
|
+
}, N = {
|
36
|
+
METAMASK: "metamask",
|
37
|
+
TRONLINK: "tronlink",
|
38
|
+
TRUST_WALLET: "trust_wallet",
|
39
|
+
LUTE: "lute"
|
40
|
+
}, de = {
|
41
|
+
[A.ETHEREUM]: {
|
42
|
+
chainId: "0x1",
|
43
|
+
chainName: "Ethereum Mainnet",
|
44
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
45
|
+
rpcUrls: ["https://mainnet.infura.io/v3/"],
|
46
|
+
blockExplorerUrls: ["https://etherscan.io/"],
|
47
|
+
supportedWallets: [N.METAMASK, N.TRUST_WALLET]
|
48
|
+
},
|
49
|
+
[A.BSC]: {
|
50
|
+
chainId: "0x38",
|
51
|
+
chainName: "BNB Smart Chain",
|
52
|
+
nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
|
53
|
+
rpcUrls: ["https://bsc-dataseed.binance.org/"],
|
54
|
+
blockExplorerUrls: ["https://bscscan.com/"],
|
55
|
+
supportedWallets: [N.METAMASK, N.TRUST_WALLET]
|
56
|
+
},
|
57
|
+
[A.TRON]: {
|
58
|
+
fullHost: "https://api.trongrid.io",
|
59
|
+
explorerUrl: "https://tronscan.org",
|
60
|
+
supportedWallets: [N.TRONLINK]
|
61
|
+
},
|
62
|
+
[A.ALGORAND]: {
|
63
|
+
network: "mainnet",
|
64
|
+
explorerUrl: "https://algoexplorer.io",
|
65
|
+
supportedWallets: [N.LUTE]
|
66
|
+
}
|
67
|
+
}, Xe = {
|
68
|
+
USDT: {
|
69
|
+
[A.ETHEREUM]: {
|
70
|
+
address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
71
|
+
decimals: 6
|
72
|
+
},
|
73
|
+
[A.BSC]: {
|
74
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
75
|
+
decimals: 18
|
76
|
+
},
|
77
|
+
[A.TRON]: {
|
78
|
+
address: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
79
|
+
decimals: 6
|
80
|
+
}
|
81
|
+
},
|
82
|
+
USDC: {
|
83
|
+
[A.ETHEREUM]: {
|
84
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
85
|
+
decimals: 6
|
86
|
+
},
|
87
|
+
[A.BSC]: {
|
88
|
+
address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
89
|
+
decimals: 18
|
90
|
+
},
|
91
|
+
[A.TRON]: {
|
92
|
+
address: "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8",
|
93
|
+
decimals: 6
|
94
|
+
}
|
95
|
+
},
|
96
|
+
ALGO: {
|
97
|
+
[A.ALGORAND]: {
|
98
|
+
address: "native",
|
99
|
+
decimals: 6
|
100
|
+
}
|
101
|
+
}
|
18
102
|
};
|
19
|
-
|
103
|
+
let _ = null;
|
104
|
+
const Ze = () => R(void 0, null, function* () {
|
105
|
+
if (_)
|
106
|
+
return _;
|
107
|
+
try {
|
108
|
+
if (typeof window != "undefined" && window.Web3)
|
109
|
+
return _ = window.Web3, _;
|
110
|
+
const s = yield import("web3");
|
111
|
+
return _ = s.default || s.Web3 || s, _;
|
112
|
+
} catch (s) {
|
113
|
+
throw console.error("Failed to load Web3:", s), new Error("Web3 is required for blockchain transactions. Please ensure web3 is installed: npm install web3");
|
114
|
+
}
|
115
|
+
}), ue = () => {
|
116
|
+
const s = {
|
117
|
+
[N.METAMASK]: !1,
|
118
|
+
[N.TRUST_WALLET]: !1,
|
119
|
+
[N.TRONLINK]: !1,
|
120
|
+
[N.LUTE]: !1
|
121
|
+
};
|
122
|
+
if (typeof window == "undefined")
|
123
|
+
return s;
|
124
|
+
try {
|
125
|
+
s[N.METAMASK] = !!(window.ethereum && window.ethereum.isMetaMask), s[N.TRONLINK] = !!window.tronWeb, s[N.TRUST_WALLET] = !!(window.ethereum && window.ethereum.isTrust), s[N.LUTE] = !!(window.algorand && window.algorand.isLute);
|
126
|
+
} catch (r) {
|
127
|
+
console.warn("Error detecting wallets:", r);
|
128
|
+
}
|
129
|
+
return s;
|
130
|
+
}, Ne = (s) => {
|
131
|
+
const r = de[s];
|
132
|
+
if (!r)
|
133
|
+
return [];
|
134
|
+
const t = ue();
|
135
|
+
return r.supportedWallets.filter((c) => t[c]);
|
136
|
+
}, et = (s, r) => R(void 0, null, function* () {
|
137
|
+
switch (s) {
|
138
|
+
case N.METAMASK:
|
139
|
+
return yield tt(r);
|
140
|
+
case N.TRONLINK:
|
141
|
+
return yield rt();
|
142
|
+
case N.TRUST_WALLET:
|
143
|
+
return yield st(r);
|
144
|
+
case N.LUTE:
|
145
|
+
return yield nt();
|
146
|
+
default:
|
147
|
+
throw new Error(`Unsupported wallet type: ${s}`);
|
148
|
+
}
|
149
|
+
}), tt = (s) => R(void 0, null, function* () {
|
150
|
+
if (typeof window == "undefined" || !window.ethereum || !window.ethereum.isMetaMask)
|
151
|
+
throw new Error("MetaMask is not installed. Please install MetaMask extension.");
|
152
|
+
try {
|
153
|
+
const r = yield window.ethereum.request({
|
154
|
+
method: "eth_requestAccounts"
|
155
|
+
});
|
156
|
+
if (!r || r.length === 0)
|
157
|
+
throw new Error("No accounts found. Please unlock MetaMask.");
|
158
|
+
const t = de[s];
|
159
|
+
return t && t.chainId && (yield Ee(t)), {
|
160
|
+
address: r[0],
|
161
|
+
network: s,
|
162
|
+
walletType: N.METAMASK
|
163
|
+
};
|
164
|
+
} catch (r) {
|
165
|
+
throw r.code === 4001 ? new Error("User rejected the connection request") : new Error(`Failed to connect MetaMask: ${r.message}`);
|
166
|
+
}
|
167
|
+
}), rt = () => R(void 0, null, function* () {
|
168
|
+
var c;
|
169
|
+
if (typeof window == "undefined" || !window.tronWeb)
|
170
|
+
throw new Error("TronLink is not installed. Please install TronLink extension.");
|
171
|
+
let s = 0;
|
172
|
+
const r = 10;
|
173
|
+
for (; !window.tronWeb.ready && s < r; )
|
174
|
+
yield new Promise((u) => setTimeout(u, 1e3)), s++;
|
175
|
+
if (!window.tronWeb.ready)
|
176
|
+
throw new Error("TronLink is not ready. Please unlock your TronLink wallet and try again.");
|
177
|
+
const t = (c = window.tronWeb.defaultAddress) == null ? void 0 : c.base58;
|
178
|
+
if (!t)
|
179
|
+
throw new Error("No account found in TronLink. Please make sure you have an account set up.");
|
20
180
|
return {
|
21
|
-
|
22
|
-
|
23
|
-
|
181
|
+
address: t,
|
182
|
+
network: A.TRON,
|
183
|
+
walletType: N.TRONLINK
|
24
184
|
};
|
25
|
-
}
|
26
|
-
|
185
|
+
}), st = (s) => R(void 0, null, function* () {
|
186
|
+
if (typeof window == "undefined" || !window.ethereum || !window.ethereum.isTrust)
|
187
|
+
throw new Error("Trust Wallet is not installed. Please install Trust Wallet extension.");
|
27
188
|
try {
|
28
|
-
|
29
|
-
|
30
|
-
const enhancedPaymentData = { ...paymentData };
|
31
|
-
if (apiConfig.merchantWalletAddress && !enhancedPaymentData.walletAddress) {
|
32
|
-
enhancedPaymentData.walletAddress = apiConfig.merchantWalletAddress;
|
33
|
-
}
|
34
|
-
if (apiConfig.merchantSolWalletAddress && !enhancedPaymentData.solWalletAddress) {
|
35
|
-
enhancedPaymentData.solWalletAddress = apiConfig.merchantSolWalletAddress;
|
36
|
-
}
|
37
|
-
const response = await fetch(`${apiConfig.apiUrl}/api/payments/create`, {
|
38
|
-
method: "POST",
|
39
|
-
headers: getHeaders(),
|
40
|
-
body: JSON.stringify(enhancedPaymentData)
|
189
|
+
const r = yield window.ethereum.request({
|
190
|
+
method: "eth_requestAccounts"
|
41
191
|
});
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
data.payment.walletAddress = apiConfig.merchantWalletAddress;
|
53
|
-
}
|
54
|
-
if (!data.payment.solWalletAddress && apiConfig.merchantSolWalletAddress) {
|
55
|
-
data.payment.solWalletAddress = apiConfig.merchantSolWalletAddress;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
return data;
|
59
|
-
} catch (error) {
|
60
|
-
console.error("Create payment error:", error);
|
61
|
-
throw error;
|
192
|
+
if (!r || r.length === 0)
|
193
|
+
throw new Error("No accounts found. Please unlock Trust Wallet.");
|
194
|
+
const t = de[s];
|
195
|
+
return t && t.chainId && (yield Ee(t)), {
|
196
|
+
address: r[0],
|
197
|
+
network: s,
|
198
|
+
walletType: N.TRUST_WALLET
|
199
|
+
};
|
200
|
+
} catch (r) {
|
201
|
+
throw r.code === 4001 ? new Error("User rejected the connection request") : new Error(`Failed to connect Trust Wallet: ${r.message}`);
|
62
202
|
}
|
63
|
-
}
|
64
|
-
|
203
|
+
}), nt = () => R(void 0, null, function* () {
|
204
|
+
if (typeof window == "undefined" || !window.algorand || !window.algorand.isLute)
|
205
|
+
throw new Error("Lute wallet is not installed. Please install Lute wallet extension.");
|
65
206
|
try {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
207
|
+
const s = yield window.algorand.connect();
|
208
|
+
if (!s || s.length === 0)
|
209
|
+
throw new Error("No accounts found. Please unlock Lute wallet.");
|
210
|
+
return {
|
211
|
+
address: s[0],
|
212
|
+
network: A.ALGORAND,
|
213
|
+
walletType: N.LUTE
|
214
|
+
};
|
215
|
+
} catch (s) {
|
216
|
+
throw new Error(`Failed to connect Lute wallet: ${s.message}`);
|
217
|
+
}
|
218
|
+
}), Ee = (s) => R(void 0, null, function* () {
|
219
|
+
if (typeof window == "undefined" || !window.ethereum)
|
220
|
+
throw new Error("Ethereum provider not found");
|
221
|
+
try {
|
222
|
+
yield window.ethereum.request({
|
223
|
+
method: "wallet_switchEthereumChain",
|
224
|
+
params: [{ chainId: s.chainId }]
|
70
225
|
});
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
data.payment.walletAddress = apiConfig.merchantWalletAddress;
|
81
|
-
}
|
82
|
-
if (!data.payment.solWalletAddress && apiConfig.merchantSolWalletAddress) {
|
83
|
-
data.payment.solWalletAddress = apiConfig.merchantSolWalletAddress;
|
226
|
+
} catch (r) {
|
227
|
+
if (r.code === 4902)
|
228
|
+
try {
|
229
|
+
yield window.ethereum.request({
|
230
|
+
method: "wallet_addEthereumChain",
|
231
|
+
params: [s]
|
232
|
+
});
|
233
|
+
} catch (t) {
|
234
|
+
throw new Error(`Failed to add ${s.chainName} to wallet: ${t.message}`);
|
84
235
|
}
|
85
|
-
|
86
|
-
|
87
|
-
} catch (error) {
|
88
|
-
console.error("Get payment error:", error);
|
89
|
-
throw error;
|
236
|
+
else
|
237
|
+
throw r.code === 4001 ? new Error("User rejected network switch request") : new Error(`Failed to switch to ${s.chainName}: ${r.message}`);
|
90
238
|
}
|
239
|
+
}), ot = (s, r) => R(void 0, null, function* () {
|
240
|
+
const { walletType: t, network: c, address: u } = s, { to: h, amount: y, tokenAddress: w, tokenDecimals: e } = r;
|
241
|
+
switch (t) {
|
242
|
+
case N.METAMASK:
|
243
|
+
case N.TRUST_WALLET:
|
244
|
+
return yield at(u, h, y, w, e);
|
245
|
+
case N.TRONLINK:
|
246
|
+
return yield lt(h, y, w, e);
|
247
|
+
case N.LUTE:
|
248
|
+
return yield it(u, h, y);
|
249
|
+
default:
|
250
|
+
throw new Error(`Unsupported wallet type: ${t}`);
|
251
|
+
}
|
252
|
+
}), at = (s, r, t, c, u) => R(void 0, null, function* () {
|
253
|
+
if (typeof window == "undefined" || !window.ethereum)
|
254
|
+
throw new Error("Ethereum provider not found");
|
255
|
+
try {
|
256
|
+
const h = yield Ze(), y = new h(window.ethereum), w = y.utils.toBN(
|
257
|
+
Math.floor(parseFloat(t) * Math.pow(10, u || 18))
|
258
|
+
);
|
259
|
+
if (c && c !== "native") {
|
260
|
+
const e = [
|
261
|
+
{
|
262
|
+
constant: !1,
|
263
|
+
inputs: [
|
264
|
+
{ name: "_to", type: "address" },
|
265
|
+
{ name: "_value", type: "uint256" }
|
266
|
+
],
|
267
|
+
name: "transfer",
|
268
|
+
outputs: [{ name: "", type: "bool" }],
|
269
|
+
payable: !1,
|
270
|
+
stateMutability: "nonpayable",
|
271
|
+
type: "function"
|
272
|
+
}
|
273
|
+
];
|
274
|
+
return (yield new y.eth.Contract(e, c).methods.transfer(r, w).send({ from: s })).transactionHash;
|
275
|
+
} else
|
276
|
+
return (yield y.eth.sendTransaction({
|
277
|
+
from: s,
|
278
|
+
to: r,
|
279
|
+
value: w
|
280
|
+
})).transactionHash;
|
281
|
+
} catch (h) {
|
282
|
+
throw h.code === 4001 ? new Error("Transaction was rejected by user") : new Error(`Transaction failed: ${h.message}`);
|
283
|
+
}
|
284
|
+
}), lt = (s, r, t, c) => R(void 0, null, function* () {
|
285
|
+
if (typeof window == "undefined" || !window.tronWeb || !window.tronWeb.ready)
|
286
|
+
throw new Error("TronLink is not ready");
|
287
|
+
try {
|
288
|
+
const u = Math.floor(parseFloat(r) * Math.pow(10, c || 6));
|
289
|
+
return t && t !== "native" ? yield (yield window.tronWeb.contract().at(t)).transfer(s, u).send({
|
290
|
+
feeLimit: 1e8,
|
291
|
+
callValue: 0
|
292
|
+
}) : (yield window.tronWeb.trx.sendTransaction(s, u)).txid;
|
293
|
+
} catch (u) {
|
294
|
+
throw new Error(`TRON transaction failed: ${u.message}`);
|
295
|
+
}
|
296
|
+
}), it = (s, r, t) => R(void 0, null, function* () {
|
297
|
+
if (typeof window == "undefined" || !window.algorand)
|
298
|
+
throw new Error("Algorand wallet is not available");
|
299
|
+
try {
|
300
|
+
const c = Math.floor(parseFloat(t) * 1e6), u = {
|
301
|
+
from: s,
|
302
|
+
to: r,
|
303
|
+
amount: c,
|
304
|
+
type: "pay"
|
305
|
+
}, h = yield window.algorand.signTransaction(u);
|
306
|
+
return (yield window.algorand.sendTransaction(h)).txId;
|
307
|
+
} catch (c) {
|
308
|
+
throw new Error(`Algorand transaction failed: ${c.message}`);
|
309
|
+
}
|
310
|
+
}), ct = (s) => ({
|
311
|
+
[N.METAMASK]: "https://metamask.io/",
|
312
|
+
[N.TRONLINK]: "https://www.tronlink.org/",
|
313
|
+
[N.TRUST_WALLET]: "https://trustwallet.com/",
|
314
|
+
[N.LUTE]: "https://lute.app/"
|
315
|
+
})[s] || "";
|
316
|
+
let P = {
|
317
|
+
apiKey: null,
|
318
|
+
apiSecret: null,
|
319
|
+
apiUrl: "http://localhost:9000",
|
320
|
+
merchantWalletAddresses: {}
|
321
|
+
// Changed to object for multi-network support
|
91
322
|
};
|
92
|
-
const
|
323
|
+
const dt = (s) => {
|
324
|
+
P = z(z({}, P), s), console.log("API initialized with:", {
|
325
|
+
apiUrl: P.apiUrl,
|
326
|
+
apiKey: P.apiKey ? `${P.apiKey.substring(0, 6)}...` : null,
|
327
|
+
hasWalletAddresses: Object.keys(P.merchantWalletAddresses || {}).length > 0
|
328
|
+
});
|
329
|
+
}, J = () => ({
|
330
|
+
"Content-Type": "application/json",
|
331
|
+
"x-api-key": P.apiKey,
|
332
|
+
"x-api-secret": P.apiSecret
|
333
|
+
}), ut = (s) => R(void 0, null, function* () {
|
93
334
|
try {
|
94
|
-
console.log("
|
95
|
-
|
96
|
-
|
335
|
+
console.log("Creating payment with data:", s), console.log("API URL:", `${P.apiUrl}/api/payments/create`);
|
336
|
+
const r = we(z({}, s), {
|
337
|
+
merchantWalletAddresses: z(z({}, P.merchantWalletAddresses), s.merchantWalletAddresses)
|
338
|
+
}), t = yield fetch(`${P.apiUrl}/api/payments/create`, {
|
97
339
|
method: "POST",
|
98
|
-
headers:
|
99
|
-
body: JSON.stringify(
|
340
|
+
headers: J(),
|
341
|
+
body: JSON.stringify(r)
|
100
342
|
});
|
101
|
-
console.log("
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
console.
|
109
|
-
return data;
|
110
|
-
} catch (error) {
|
111
|
-
console.error("Process payment error:", error);
|
112
|
-
throw error;
|
343
|
+
if (console.log("Create payment response status:", t.status), !t.ok) {
|
344
|
+
const u = yield t.json();
|
345
|
+
throw console.error("Error creating payment:", u), new Error(u.error || `Failed to create payment: ${t.status}`);
|
346
|
+
}
|
347
|
+
const c = yield t.json();
|
348
|
+
return console.log("Create payment response data:", c), c;
|
349
|
+
} catch (r) {
|
350
|
+
throw console.error("Create payment error:", r), r;
|
113
351
|
}
|
114
|
-
}
|
115
|
-
const getMerchantWalletAddresses = async () => {
|
116
|
-
var _a, _b;
|
352
|
+
}), It = (s) => R(void 0, null, function* () {
|
117
353
|
try {
|
118
|
-
|
354
|
+
console.log("Getting payment:", s);
|
355
|
+
const r = yield fetch(`${P.apiUrl}/api/payments/${s}`, {
|
119
356
|
method: "GET",
|
120
|
-
headers:
|
357
|
+
headers: J()
|
121
358
|
});
|
122
|
-
if (!
|
123
|
-
const
|
124
|
-
throw new Error(
|
125
|
-
}
|
126
|
-
const
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
}
|
131
|
-
if (data.merchant.solWalletAddress) {
|
132
|
-
apiConfig.merchantSolWalletAddress = data.merchant.solWalletAddress;
|
133
|
-
}
|
134
|
-
}
|
135
|
-
return {
|
136
|
-
walletAddress: ((_a = data.merchant) == null ? void 0 : _a.walletAddress) || null,
|
137
|
-
solWalletAddress: ((_b = data.merchant) == null ? void 0 : _b.solWalletAddress) || null
|
138
|
-
};
|
139
|
-
} catch (error) {
|
140
|
-
console.error("Get merchant wallet addresses error:", error);
|
141
|
-
throw error;
|
359
|
+
if (!r.ok) {
|
360
|
+
const c = yield r.json();
|
361
|
+
throw console.error("Error getting payment:", c), new Error(c.error || `Failed to get payment: ${r.status}`);
|
362
|
+
}
|
363
|
+
const t = yield r.json();
|
364
|
+
return console.log("Get payment response:", t), t;
|
365
|
+
} catch (r) {
|
366
|
+
throw console.error("Get payment error:", r), r;
|
142
367
|
}
|
143
|
-
}
|
144
|
-
|
145
|
-
|
146
|
-
}
|
147
|
-
|
148
|
-
|
149
|
-
|
368
|
+
}), ht = (s) => R(void 0, null, function* () {
|
369
|
+
try {
|
370
|
+
console.log("Processing payment with data:", s), console.log("API URL:", `${P.apiUrl}/api/payments/process`);
|
371
|
+
const r = yield fetch(`${P.apiUrl}/api/payments/process`, {
|
372
|
+
method: "POST",
|
373
|
+
headers: J(),
|
374
|
+
body: JSON.stringify(s)
|
375
|
+
});
|
376
|
+
if (console.log("Process payment response status:", r.status), !r.ok) {
|
377
|
+
const c = yield r.json();
|
378
|
+
throw console.error("Error processing payment:", c), new Error(c.error || `Failed to process payment: ${r.status}`);
|
379
|
+
}
|
380
|
+
const t = yield r.json();
|
381
|
+
return console.log("Process payment response data:", t), t;
|
382
|
+
} catch (r) {
|
383
|
+
throw console.error("Process payment error:", r), r;
|
150
384
|
}
|
385
|
+
}), Ft = () => R(void 0, null, function* () {
|
151
386
|
try {
|
152
|
-
const
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
387
|
+
const s = yield fetch(`${P.apiUrl}/api/networks`, {
|
388
|
+
method: "GET",
|
389
|
+
headers: J()
|
390
|
+
});
|
391
|
+
if (!s.ok) {
|
392
|
+
const t = yield s.json();
|
393
|
+
throw new Error(t.error || `Failed to get networks: ${s.status}`);
|
394
|
+
}
|
395
|
+
return yield s.json();
|
396
|
+
} catch (s) {
|
397
|
+
throw console.error("Get supported networks error:", s), s;
|
157
398
|
}
|
158
|
-
}
|
159
|
-
|
160
|
-
|
161
|
-
|
399
|
+
}), Bt = () => R(void 0, null, function* () {
|
400
|
+
try {
|
401
|
+
const s = yield fetch(`${P.apiUrl}/api/merchants/profile`, {
|
402
|
+
method: "GET",
|
403
|
+
headers: J()
|
404
|
+
});
|
405
|
+
if (!s.ok) {
|
406
|
+
const t = yield s.json();
|
407
|
+
throw new Error(t.error || `Failed to get merchant profile: ${s.status}`);
|
408
|
+
}
|
409
|
+
const r = yield s.json();
|
410
|
+
return r.merchant && r.merchant.walletAddresses && (P.merchantWalletAddresses = z(z({}, P.merchantWalletAddresses), r.merchant.walletAddresses)), r;
|
411
|
+
} catch (s) {
|
412
|
+
throw console.error("Get merchant profile error:", s), s;
|
162
413
|
}
|
414
|
+
}), Wt = (s, r) => R(void 0, null, function* () {
|
163
415
|
try {
|
164
|
-
const
|
165
|
-
method: "
|
166
|
-
|
416
|
+
const t = yield fetch(`${P.apiUrl}/api/wallets/validate`, {
|
417
|
+
method: "POST",
|
418
|
+
headers: J(),
|
419
|
+
body: JSON.stringify({ address: s, network: r })
|
167
420
|
});
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
421
|
+
if (!t.ok) {
|
422
|
+
const u = yield t.json();
|
423
|
+
throw new Error(u.error || `Failed to validate address: ${t.status}`);
|
424
|
+
}
|
425
|
+
return yield t.json();
|
426
|
+
} catch (t) {
|
427
|
+
throw console.error("Validate wallet address error:", t), t;
|
172
428
|
}
|
429
|
+
}), Qt = (s = "ethereum") => {
|
430
|
+
const t = {
|
431
|
+
ethereum: "0x",
|
432
|
+
bsc: "0x",
|
433
|
+
tron: "",
|
434
|
+
algorand: ""
|
435
|
+
}[s] || "0x", c = Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
|
436
|
+
return `${t}${c}`;
|
173
437
|
};
|
174
|
-
var
|
175
|
-
var reactJsxRuntime_production_min = {};
|
438
|
+
var be = { exports: {} }, ne = {};
|
176
439
|
/**
|
177
440
|
* @license React
|
178
441
|
* react-jsx-runtime.production.min.js
|
@@ -182,1093 +445,129 @@ var reactJsxRuntime_production_min = {};
|
|
182
445
|
* This source code is licensed under the MIT license found in the
|
183
446
|
* LICENSE file in the root directory of this source tree.
|
184
447
|
*/
|
185
|
-
var
|
186
|
-
function
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
void 0 !== a.ref && (h = a.ref);
|
196
|
-
for (b in a)
|
197
|
-
m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
198
|
-
if (c && c.defaultProps)
|
199
|
-
for (b in a = c.defaultProps, a)
|
200
|
-
void 0 === d[b] && (d[b] = a[b]);
|
201
|
-
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
202
|
-
}
|
203
|
-
reactJsxRuntime_production_min.Fragment = l;
|
204
|
-
reactJsxRuntime_production_min.jsx = q;
|
205
|
-
reactJsxRuntime_production_min.jsxs = q;
|
206
|
-
return reactJsxRuntime_production_min;
|
448
|
+
var mt = S, ft = Symbol.for("react.element"), gt = Symbol.for("react.fragment"), wt = Object.prototype.hasOwnProperty, pt = mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, yt = { key: !0, ref: !0, __self: !0, __source: !0 };
|
449
|
+
function Ae(s, r, t) {
|
450
|
+
var c, u = {}, h = null, y = null;
|
451
|
+
t !== void 0 && (h = "" + t), r.key !== void 0 && (h = "" + r.key), r.ref !== void 0 && (y = r.ref);
|
452
|
+
for (c in r)
|
453
|
+
wt.call(r, c) && !yt.hasOwnProperty(c) && (u[c] = r[c]);
|
454
|
+
if (s && s.defaultProps)
|
455
|
+
for (c in r = s.defaultProps, r)
|
456
|
+
u[c] === void 0 && (u[c] = r[c]);
|
457
|
+
return { $$typeof: ft, type: s, key: h, ref: y, props: u, _owner: pt.current };
|
207
458
|
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
* LICENSE file in the root directory of this source tree.
|
217
|
-
*/
|
218
|
-
var hasRequiredReactJsxRuntime_development;
|
219
|
-
function requireReactJsxRuntime_development() {
|
220
|
-
if (hasRequiredReactJsxRuntime_development)
|
221
|
-
return reactJsxRuntime_development;
|
222
|
-
hasRequiredReactJsxRuntime_development = 1;
|
223
|
-
if (process.env.NODE_ENV !== "production") {
|
224
|
-
(function() {
|
225
|
-
var React$1 = React;
|
226
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
227
|
-
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
228
|
-
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
229
|
-
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
230
|
-
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
231
|
-
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
232
|
-
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
233
|
-
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
234
|
-
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
235
|
-
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
236
|
-
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
237
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
238
|
-
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
239
|
-
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
240
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
241
|
-
function getIteratorFn(maybeIterable) {
|
242
|
-
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
243
|
-
return null;
|
244
|
-
}
|
245
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
246
|
-
if (typeof maybeIterator === "function") {
|
247
|
-
return maybeIterator;
|
248
|
-
}
|
249
|
-
return null;
|
250
|
-
}
|
251
|
-
var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
252
|
-
function error(format) {
|
253
|
-
{
|
254
|
-
{
|
255
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
256
|
-
args[_key2 - 1] = arguments[_key2];
|
257
|
-
}
|
258
|
-
printWarning("error", format, args);
|
259
|
-
}
|
260
|
-
}
|
261
|
-
}
|
262
|
-
function printWarning(level, format, args) {
|
263
|
-
{
|
264
|
-
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
265
|
-
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
266
|
-
if (stack !== "") {
|
267
|
-
format += "%s";
|
268
|
-
args = args.concat([stack]);
|
269
|
-
}
|
270
|
-
var argsWithFormat = args.map(function(item) {
|
271
|
-
return String(item);
|
272
|
-
});
|
273
|
-
argsWithFormat.unshift("Warning: " + format);
|
274
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
275
|
-
}
|
276
|
-
}
|
277
|
-
var enableScopeAPI = false;
|
278
|
-
var enableCacheElement = false;
|
279
|
-
var enableTransitionTracing = false;
|
280
|
-
var enableLegacyHidden = false;
|
281
|
-
var enableDebugTracing = false;
|
282
|
-
var REACT_MODULE_REFERENCE;
|
283
|
-
{
|
284
|
-
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
285
|
-
}
|
286
|
-
function isValidElementType(type) {
|
287
|
-
if (typeof type === "string" || typeof type === "function") {
|
288
|
-
return true;
|
289
|
-
}
|
290
|
-
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
291
|
-
return true;
|
292
|
-
}
|
293
|
-
if (typeof type === "object" && type !== null) {
|
294
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
295
|
-
// types supported by any Flight configuration anywhere since
|
296
|
-
// we don't know which Flight build this will end up being used
|
297
|
-
// with.
|
298
|
-
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
299
|
-
return true;
|
300
|
-
}
|
301
|
-
}
|
302
|
-
return false;
|
303
|
-
}
|
304
|
-
function getWrappedName(outerType, innerType, wrapperName) {
|
305
|
-
var displayName = outerType.displayName;
|
306
|
-
if (displayName) {
|
307
|
-
return displayName;
|
308
|
-
}
|
309
|
-
var functionName = innerType.displayName || innerType.name || "";
|
310
|
-
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
311
|
-
}
|
312
|
-
function getContextName(type) {
|
313
|
-
return type.displayName || "Context";
|
314
|
-
}
|
315
|
-
function getComponentNameFromType(type) {
|
316
|
-
if (type == null) {
|
317
|
-
return null;
|
318
|
-
}
|
319
|
-
{
|
320
|
-
if (typeof type.tag === "number") {
|
321
|
-
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
322
|
-
}
|
323
|
-
}
|
324
|
-
if (typeof type === "function") {
|
325
|
-
return type.displayName || type.name || null;
|
326
|
-
}
|
327
|
-
if (typeof type === "string") {
|
328
|
-
return type;
|
329
|
-
}
|
330
|
-
switch (type) {
|
331
|
-
case REACT_FRAGMENT_TYPE:
|
332
|
-
return "Fragment";
|
333
|
-
case REACT_PORTAL_TYPE:
|
334
|
-
return "Portal";
|
335
|
-
case REACT_PROFILER_TYPE:
|
336
|
-
return "Profiler";
|
337
|
-
case REACT_STRICT_MODE_TYPE:
|
338
|
-
return "StrictMode";
|
339
|
-
case REACT_SUSPENSE_TYPE:
|
340
|
-
return "Suspense";
|
341
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
342
|
-
return "SuspenseList";
|
343
|
-
}
|
344
|
-
if (typeof type === "object") {
|
345
|
-
switch (type.$$typeof) {
|
346
|
-
case REACT_CONTEXT_TYPE:
|
347
|
-
var context = type;
|
348
|
-
return getContextName(context) + ".Consumer";
|
349
|
-
case REACT_PROVIDER_TYPE:
|
350
|
-
var provider = type;
|
351
|
-
return getContextName(provider._context) + ".Provider";
|
352
|
-
case REACT_FORWARD_REF_TYPE:
|
353
|
-
return getWrappedName(type, type.render, "ForwardRef");
|
354
|
-
case REACT_MEMO_TYPE:
|
355
|
-
var outerName = type.displayName || null;
|
356
|
-
if (outerName !== null) {
|
357
|
-
return outerName;
|
358
|
-
}
|
359
|
-
return getComponentNameFromType(type.type) || "Memo";
|
360
|
-
case REACT_LAZY_TYPE: {
|
361
|
-
var lazyComponent = type;
|
362
|
-
var payload = lazyComponent._payload;
|
363
|
-
var init = lazyComponent._init;
|
364
|
-
try {
|
365
|
-
return getComponentNameFromType(init(payload));
|
366
|
-
} catch (x) {
|
367
|
-
return null;
|
368
|
-
}
|
369
|
-
}
|
370
|
-
}
|
371
|
-
}
|
372
|
-
return null;
|
373
|
-
}
|
374
|
-
var assign = Object.assign;
|
375
|
-
var disabledDepth = 0;
|
376
|
-
var prevLog;
|
377
|
-
var prevInfo;
|
378
|
-
var prevWarn;
|
379
|
-
var prevError;
|
380
|
-
var prevGroup;
|
381
|
-
var prevGroupCollapsed;
|
382
|
-
var prevGroupEnd;
|
383
|
-
function disabledLog() {
|
384
|
-
}
|
385
|
-
disabledLog.__reactDisabledLog = true;
|
386
|
-
function disableLogs() {
|
387
|
-
{
|
388
|
-
if (disabledDepth === 0) {
|
389
|
-
prevLog = console.log;
|
390
|
-
prevInfo = console.info;
|
391
|
-
prevWarn = console.warn;
|
392
|
-
prevError = console.error;
|
393
|
-
prevGroup = console.group;
|
394
|
-
prevGroupCollapsed = console.groupCollapsed;
|
395
|
-
prevGroupEnd = console.groupEnd;
|
396
|
-
var props = {
|
397
|
-
configurable: true,
|
398
|
-
enumerable: true,
|
399
|
-
value: disabledLog,
|
400
|
-
writable: true
|
401
|
-
};
|
402
|
-
Object.defineProperties(console, {
|
403
|
-
info: props,
|
404
|
-
log: props,
|
405
|
-
warn: props,
|
406
|
-
error: props,
|
407
|
-
group: props,
|
408
|
-
groupCollapsed: props,
|
409
|
-
groupEnd: props
|
410
|
-
});
|
411
|
-
}
|
412
|
-
disabledDepth++;
|
413
|
-
}
|
414
|
-
}
|
415
|
-
function reenableLogs() {
|
416
|
-
{
|
417
|
-
disabledDepth--;
|
418
|
-
if (disabledDepth === 0) {
|
419
|
-
var props = {
|
420
|
-
configurable: true,
|
421
|
-
enumerable: true,
|
422
|
-
writable: true
|
423
|
-
};
|
424
|
-
Object.defineProperties(console, {
|
425
|
-
log: assign({}, props, {
|
426
|
-
value: prevLog
|
427
|
-
}),
|
428
|
-
info: assign({}, props, {
|
429
|
-
value: prevInfo
|
430
|
-
}),
|
431
|
-
warn: assign({}, props, {
|
432
|
-
value: prevWarn
|
433
|
-
}),
|
434
|
-
error: assign({}, props, {
|
435
|
-
value: prevError
|
436
|
-
}),
|
437
|
-
group: assign({}, props, {
|
438
|
-
value: prevGroup
|
439
|
-
}),
|
440
|
-
groupCollapsed: assign({}, props, {
|
441
|
-
value: prevGroupCollapsed
|
442
|
-
}),
|
443
|
-
groupEnd: assign({}, props, {
|
444
|
-
value: prevGroupEnd
|
445
|
-
})
|
446
|
-
});
|
447
|
-
}
|
448
|
-
if (disabledDepth < 0) {
|
449
|
-
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
450
|
-
}
|
451
|
-
}
|
452
|
-
}
|
453
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
454
|
-
var prefix;
|
455
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
456
|
-
{
|
457
|
-
if (prefix === void 0) {
|
458
|
-
try {
|
459
|
-
throw Error();
|
460
|
-
} catch (x) {
|
461
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
462
|
-
prefix = match && match[1] || "";
|
463
|
-
}
|
464
|
-
}
|
465
|
-
return "\n" + prefix + name;
|
466
|
-
}
|
467
|
-
}
|
468
|
-
var reentry = false;
|
469
|
-
var componentFrameCache;
|
470
|
-
{
|
471
|
-
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
472
|
-
componentFrameCache = new PossiblyWeakMap();
|
473
|
-
}
|
474
|
-
function describeNativeComponentFrame(fn, construct) {
|
475
|
-
if (!fn || reentry) {
|
476
|
-
return "";
|
477
|
-
}
|
478
|
-
{
|
479
|
-
var frame = componentFrameCache.get(fn);
|
480
|
-
if (frame !== void 0) {
|
481
|
-
return frame;
|
482
|
-
}
|
483
|
-
}
|
484
|
-
var control;
|
485
|
-
reentry = true;
|
486
|
-
var previousPrepareStackTrace = Error.prepareStackTrace;
|
487
|
-
Error.prepareStackTrace = void 0;
|
488
|
-
var previousDispatcher;
|
489
|
-
{
|
490
|
-
previousDispatcher = ReactCurrentDispatcher.current;
|
491
|
-
ReactCurrentDispatcher.current = null;
|
492
|
-
disableLogs();
|
493
|
-
}
|
494
|
-
try {
|
495
|
-
if (construct) {
|
496
|
-
var Fake = function() {
|
497
|
-
throw Error();
|
498
|
-
};
|
499
|
-
Object.defineProperty(Fake.prototype, "props", {
|
500
|
-
set: function() {
|
501
|
-
throw Error();
|
502
|
-
}
|
503
|
-
});
|
504
|
-
if (typeof Reflect === "object" && Reflect.construct) {
|
505
|
-
try {
|
506
|
-
Reflect.construct(Fake, []);
|
507
|
-
} catch (x) {
|
508
|
-
control = x;
|
509
|
-
}
|
510
|
-
Reflect.construct(fn, [], Fake);
|
511
|
-
} else {
|
512
|
-
try {
|
513
|
-
Fake.call();
|
514
|
-
} catch (x) {
|
515
|
-
control = x;
|
516
|
-
}
|
517
|
-
fn.call(Fake.prototype);
|
518
|
-
}
|
519
|
-
} else {
|
520
|
-
try {
|
521
|
-
throw Error();
|
522
|
-
} catch (x) {
|
523
|
-
control = x;
|
524
|
-
}
|
525
|
-
fn();
|
526
|
-
}
|
527
|
-
} catch (sample) {
|
528
|
-
if (sample && control && typeof sample.stack === "string") {
|
529
|
-
var sampleLines = sample.stack.split("\n");
|
530
|
-
var controlLines = control.stack.split("\n");
|
531
|
-
var s = sampleLines.length - 1;
|
532
|
-
var c = controlLines.length - 1;
|
533
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
534
|
-
c--;
|
535
|
-
}
|
536
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
537
|
-
if (sampleLines[s] !== controlLines[c]) {
|
538
|
-
if (s !== 1 || c !== 1) {
|
539
|
-
do {
|
540
|
-
s--;
|
541
|
-
c--;
|
542
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
543
|
-
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
544
|
-
if (fn.displayName && _frame.includes("<anonymous>")) {
|
545
|
-
_frame = _frame.replace("<anonymous>", fn.displayName);
|
546
|
-
}
|
547
|
-
{
|
548
|
-
if (typeof fn === "function") {
|
549
|
-
componentFrameCache.set(fn, _frame);
|
550
|
-
}
|
551
|
-
}
|
552
|
-
return _frame;
|
553
|
-
}
|
554
|
-
} while (s >= 1 && c >= 0);
|
555
|
-
}
|
556
|
-
break;
|
557
|
-
}
|
558
|
-
}
|
559
|
-
}
|
560
|
-
} finally {
|
561
|
-
reentry = false;
|
562
|
-
{
|
563
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
564
|
-
reenableLogs();
|
565
|
-
}
|
566
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
567
|
-
}
|
568
|
-
var name = fn ? fn.displayName || fn.name : "";
|
569
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
570
|
-
{
|
571
|
-
if (typeof fn === "function") {
|
572
|
-
componentFrameCache.set(fn, syntheticFrame);
|
573
|
-
}
|
574
|
-
}
|
575
|
-
return syntheticFrame;
|
576
|
-
}
|
577
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
578
|
-
{
|
579
|
-
return describeNativeComponentFrame(fn, false);
|
580
|
-
}
|
581
|
-
}
|
582
|
-
function shouldConstruct(Component) {
|
583
|
-
var prototype = Component.prototype;
|
584
|
-
return !!(prototype && prototype.isReactComponent);
|
585
|
-
}
|
586
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
587
|
-
if (type == null) {
|
588
|
-
return "";
|
589
|
-
}
|
590
|
-
if (typeof type === "function") {
|
591
|
-
{
|
592
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
593
|
-
}
|
594
|
-
}
|
595
|
-
if (typeof type === "string") {
|
596
|
-
return describeBuiltInComponentFrame(type);
|
597
|
-
}
|
598
|
-
switch (type) {
|
599
|
-
case REACT_SUSPENSE_TYPE:
|
600
|
-
return describeBuiltInComponentFrame("Suspense");
|
601
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
602
|
-
return describeBuiltInComponentFrame("SuspenseList");
|
603
|
-
}
|
604
|
-
if (typeof type === "object") {
|
605
|
-
switch (type.$$typeof) {
|
606
|
-
case REACT_FORWARD_REF_TYPE:
|
607
|
-
return describeFunctionComponentFrame(type.render);
|
608
|
-
case REACT_MEMO_TYPE:
|
609
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
610
|
-
case REACT_LAZY_TYPE: {
|
611
|
-
var lazyComponent = type;
|
612
|
-
var payload = lazyComponent._payload;
|
613
|
-
var init = lazyComponent._init;
|
614
|
-
try {
|
615
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
616
|
-
} catch (x) {
|
617
|
-
}
|
618
|
-
}
|
619
|
-
}
|
620
|
-
}
|
621
|
-
return "";
|
622
|
-
}
|
623
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
624
|
-
var loggedTypeFailures = {};
|
625
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
626
|
-
function setCurrentlyValidatingElement(element) {
|
627
|
-
{
|
628
|
-
if (element) {
|
629
|
-
var owner = element._owner;
|
630
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
631
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
632
|
-
} else {
|
633
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
634
|
-
}
|
635
|
-
}
|
636
|
-
}
|
637
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
638
|
-
{
|
639
|
-
var has = Function.call.bind(hasOwnProperty);
|
640
|
-
for (var typeSpecName in typeSpecs) {
|
641
|
-
if (has(typeSpecs, typeSpecName)) {
|
642
|
-
var error$1 = void 0;
|
643
|
-
try {
|
644
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
645
|
-
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
646
|
-
err.name = "Invariant Violation";
|
647
|
-
throw err;
|
648
|
-
}
|
649
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
650
|
-
} catch (ex) {
|
651
|
-
error$1 = ex;
|
652
|
-
}
|
653
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
654
|
-
setCurrentlyValidatingElement(element);
|
655
|
-
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
656
|
-
setCurrentlyValidatingElement(null);
|
657
|
-
}
|
658
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
659
|
-
loggedTypeFailures[error$1.message] = true;
|
660
|
-
setCurrentlyValidatingElement(element);
|
661
|
-
error("Failed %s type: %s", location, error$1.message);
|
662
|
-
setCurrentlyValidatingElement(null);
|
663
|
-
}
|
664
|
-
}
|
665
|
-
}
|
666
|
-
}
|
667
|
-
}
|
668
|
-
var isArrayImpl = Array.isArray;
|
669
|
-
function isArray(a) {
|
670
|
-
return isArrayImpl(a);
|
671
|
-
}
|
672
|
-
function typeName(value) {
|
673
|
-
{
|
674
|
-
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
675
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
676
|
-
return type;
|
677
|
-
}
|
678
|
-
}
|
679
|
-
function willCoercionThrow(value) {
|
680
|
-
{
|
681
|
-
try {
|
682
|
-
testStringCoercion(value);
|
683
|
-
return false;
|
684
|
-
} catch (e) {
|
685
|
-
return true;
|
686
|
-
}
|
687
|
-
}
|
688
|
-
}
|
689
|
-
function testStringCoercion(value) {
|
690
|
-
return "" + value;
|
691
|
-
}
|
692
|
-
function checkKeyStringCoercion(value) {
|
693
|
-
{
|
694
|
-
if (willCoercionThrow(value)) {
|
695
|
-
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
696
|
-
return testStringCoercion(value);
|
697
|
-
}
|
698
|
-
}
|
699
|
-
}
|
700
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
701
|
-
var RESERVED_PROPS = {
|
702
|
-
key: true,
|
703
|
-
ref: true,
|
704
|
-
__self: true,
|
705
|
-
__source: true
|
706
|
-
};
|
707
|
-
var specialPropKeyWarningShown;
|
708
|
-
var specialPropRefWarningShown;
|
709
|
-
var didWarnAboutStringRefs;
|
710
|
-
{
|
711
|
-
didWarnAboutStringRefs = {};
|
712
|
-
}
|
713
|
-
function hasValidRef(config) {
|
714
|
-
{
|
715
|
-
if (hasOwnProperty.call(config, "ref")) {
|
716
|
-
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
717
|
-
if (getter && getter.isReactWarning) {
|
718
|
-
return false;
|
719
|
-
}
|
720
|
-
}
|
721
|
-
}
|
722
|
-
return config.ref !== void 0;
|
723
|
-
}
|
724
|
-
function hasValidKey(config) {
|
725
|
-
{
|
726
|
-
if (hasOwnProperty.call(config, "key")) {
|
727
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
728
|
-
if (getter && getter.isReactWarning) {
|
729
|
-
return false;
|
730
|
-
}
|
731
|
-
}
|
732
|
-
}
|
733
|
-
return config.key !== void 0;
|
734
|
-
}
|
735
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
736
|
-
{
|
737
|
-
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
738
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
739
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
740
|
-
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
741
|
-
didWarnAboutStringRefs[componentName] = true;
|
742
|
-
}
|
743
|
-
}
|
744
|
-
}
|
745
|
-
}
|
746
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
747
|
-
{
|
748
|
-
var warnAboutAccessingKey = function() {
|
749
|
-
if (!specialPropKeyWarningShown) {
|
750
|
-
specialPropKeyWarningShown = true;
|
751
|
-
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
752
|
-
}
|
753
|
-
};
|
754
|
-
warnAboutAccessingKey.isReactWarning = true;
|
755
|
-
Object.defineProperty(props, "key", {
|
756
|
-
get: warnAboutAccessingKey,
|
757
|
-
configurable: true
|
758
|
-
});
|
759
|
-
}
|
760
|
-
}
|
761
|
-
function defineRefPropWarningGetter(props, displayName) {
|
762
|
-
{
|
763
|
-
var warnAboutAccessingRef = function() {
|
764
|
-
if (!specialPropRefWarningShown) {
|
765
|
-
specialPropRefWarningShown = true;
|
766
|
-
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
767
|
-
}
|
768
|
-
};
|
769
|
-
warnAboutAccessingRef.isReactWarning = true;
|
770
|
-
Object.defineProperty(props, "ref", {
|
771
|
-
get: warnAboutAccessingRef,
|
772
|
-
configurable: true
|
773
|
-
});
|
774
|
-
}
|
775
|
-
}
|
776
|
-
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
777
|
-
var element = {
|
778
|
-
// This tag allows us to uniquely identify this as a React Element
|
779
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
780
|
-
// Built-in properties that belong on the element
|
781
|
-
type,
|
782
|
-
key,
|
783
|
-
ref,
|
784
|
-
props,
|
785
|
-
// Record the component responsible for creating this element.
|
786
|
-
_owner: owner
|
787
|
-
};
|
788
|
-
{
|
789
|
-
element._store = {};
|
790
|
-
Object.defineProperty(element._store, "validated", {
|
791
|
-
configurable: false,
|
792
|
-
enumerable: false,
|
793
|
-
writable: true,
|
794
|
-
value: false
|
795
|
-
});
|
796
|
-
Object.defineProperty(element, "_self", {
|
797
|
-
configurable: false,
|
798
|
-
enumerable: false,
|
799
|
-
writable: false,
|
800
|
-
value: self
|
801
|
-
});
|
802
|
-
Object.defineProperty(element, "_source", {
|
803
|
-
configurable: false,
|
804
|
-
enumerable: false,
|
805
|
-
writable: false,
|
806
|
-
value: source
|
807
|
-
});
|
808
|
-
if (Object.freeze) {
|
809
|
-
Object.freeze(element.props);
|
810
|
-
Object.freeze(element);
|
811
|
-
}
|
812
|
-
}
|
813
|
-
return element;
|
814
|
-
};
|
815
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
816
|
-
{
|
817
|
-
var propName;
|
818
|
-
var props = {};
|
819
|
-
var key = null;
|
820
|
-
var ref = null;
|
821
|
-
if (maybeKey !== void 0) {
|
822
|
-
{
|
823
|
-
checkKeyStringCoercion(maybeKey);
|
824
|
-
}
|
825
|
-
key = "" + maybeKey;
|
826
|
-
}
|
827
|
-
if (hasValidKey(config)) {
|
828
|
-
{
|
829
|
-
checkKeyStringCoercion(config.key);
|
830
|
-
}
|
831
|
-
key = "" + config.key;
|
832
|
-
}
|
833
|
-
if (hasValidRef(config)) {
|
834
|
-
ref = config.ref;
|
835
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
836
|
-
}
|
837
|
-
for (propName in config) {
|
838
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
839
|
-
props[propName] = config[propName];
|
840
|
-
}
|
841
|
-
}
|
842
|
-
if (type && type.defaultProps) {
|
843
|
-
var defaultProps = type.defaultProps;
|
844
|
-
for (propName in defaultProps) {
|
845
|
-
if (props[propName] === void 0) {
|
846
|
-
props[propName] = defaultProps[propName];
|
847
|
-
}
|
848
|
-
}
|
849
|
-
}
|
850
|
-
if (key || ref) {
|
851
|
-
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
852
|
-
if (key) {
|
853
|
-
defineKeyPropWarningGetter(props, displayName);
|
854
|
-
}
|
855
|
-
if (ref) {
|
856
|
-
defineRefPropWarningGetter(props, displayName);
|
857
|
-
}
|
858
|
-
}
|
859
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
860
|
-
}
|
861
|
-
}
|
862
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
863
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
864
|
-
function setCurrentlyValidatingElement$1(element) {
|
865
|
-
{
|
866
|
-
if (element) {
|
867
|
-
var owner = element._owner;
|
868
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
869
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
870
|
-
} else {
|
871
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
872
|
-
}
|
873
|
-
}
|
874
|
-
}
|
875
|
-
var propTypesMisspellWarningShown;
|
876
|
-
{
|
877
|
-
propTypesMisspellWarningShown = false;
|
878
|
-
}
|
879
|
-
function isValidElement(object) {
|
880
|
-
{
|
881
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
882
|
-
}
|
883
|
-
}
|
884
|
-
function getDeclarationErrorAddendum() {
|
885
|
-
{
|
886
|
-
if (ReactCurrentOwner$1.current) {
|
887
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
888
|
-
if (name) {
|
889
|
-
return "\n\nCheck the render method of `" + name + "`.";
|
890
|
-
}
|
891
|
-
}
|
892
|
-
return "";
|
893
|
-
}
|
894
|
-
}
|
895
|
-
function getSourceInfoErrorAddendum(source) {
|
896
|
-
{
|
897
|
-
if (source !== void 0) {
|
898
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
899
|
-
var lineNumber = source.lineNumber;
|
900
|
-
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
901
|
-
}
|
902
|
-
return "";
|
903
|
-
}
|
904
|
-
}
|
905
|
-
var ownerHasKeyUseWarning = {};
|
906
|
-
function getCurrentComponentErrorInfo(parentType) {
|
907
|
-
{
|
908
|
-
var info = getDeclarationErrorAddendum();
|
909
|
-
if (!info) {
|
910
|
-
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
911
|
-
if (parentName) {
|
912
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
913
|
-
}
|
914
|
-
}
|
915
|
-
return info;
|
916
|
-
}
|
917
|
-
}
|
918
|
-
function validateExplicitKey(element, parentType) {
|
919
|
-
{
|
920
|
-
if (!element._store || element._store.validated || element.key != null) {
|
921
|
-
return;
|
922
|
-
}
|
923
|
-
element._store.validated = true;
|
924
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
925
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
926
|
-
return;
|
927
|
-
}
|
928
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
929
|
-
var childOwner = "";
|
930
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
931
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
932
|
-
}
|
933
|
-
setCurrentlyValidatingElement$1(element);
|
934
|
-
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
935
|
-
setCurrentlyValidatingElement$1(null);
|
936
|
-
}
|
937
|
-
}
|
938
|
-
function validateChildKeys(node, parentType) {
|
939
|
-
{
|
940
|
-
if (typeof node !== "object") {
|
941
|
-
return;
|
942
|
-
}
|
943
|
-
if (isArray(node)) {
|
944
|
-
for (var i = 0; i < node.length; i++) {
|
945
|
-
var child = node[i];
|
946
|
-
if (isValidElement(child)) {
|
947
|
-
validateExplicitKey(child, parentType);
|
948
|
-
}
|
949
|
-
}
|
950
|
-
} else if (isValidElement(node)) {
|
951
|
-
if (node._store) {
|
952
|
-
node._store.validated = true;
|
953
|
-
}
|
954
|
-
} else if (node) {
|
955
|
-
var iteratorFn = getIteratorFn(node);
|
956
|
-
if (typeof iteratorFn === "function") {
|
957
|
-
if (iteratorFn !== node.entries) {
|
958
|
-
var iterator = iteratorFn.call(node);
|
959
|
-
var step;
|
960
|
-
while (!(step = iterator.next()).done) {
|
961
|
-
if (isValidElement(step.value)) {
|
962
|
-
validateExplicitKey(step.value, parentType);
|
963
|
-
}
|
964
|
-
}
|
965
|
-
}
|
966
|
-
}
|
967
|
-
}
|
968
|
-
}
|
969
|
-
}
|
970
|
-
function validatePropTypes(element) {
|
971
|
-
{
|
972
|
-
var type = element.type;
|
973
|
-
if (type === null || type === void 0 || typeof type === "string") {
|
974
|
-
return;
|
975
|
-
}
|
976
|
-
var propTypes;
|
977
|
-
if (typeof type === "function") {
|
978
|
-
propTypes = type.propTypes;
|
979
|
-
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
980
|
-
// Inner props are checked in the reconciler.
|
981
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
982
|
-
propTypes = type.propTypes;
|
983
|
-
} else {
|
984
|
-
return;
|
985
|
-
}
|
986
|
-
if (propTypes) {
|
987
|
-
var name = getComponentNameFromType(type);
|
988
|
-
checkPropTypes(propTypes, element.props, "prop", name, element);
|
989
|
-
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
990
|
-
propTypesMisspellWarningShown = true;
|
991
|
-
var _name = getComponentNameFromType(type);
|
992
|
-
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
993
|
-
}
|
994
|
-
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
995
|
-
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
996
|
-
}
|
997
|
-
}
|
998
|
-
}
|
999
|
-
function validateFragmentProps(fragment) {
|
1000
|
-
{
|
1001
|
-
var keys = Object.keys(fragment.props);
|
1002
|
-
for (var i = 0; i < keys.length; i++) {
|
1003
|
-
var key = keys[i];
|
1004
|
-
if (key !== "children" && key !== "key") {
|
1005
|
-
setCurrentlyValidatingElement$1(fragment);
|
1006
|
-
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
1007
|
-
setCurrentlyValidatingElement$1(null);
|
1008
|
-
break;
|
1009
|
-
}
|
1010
|
-
}
|
1011
|
-
if (fragment.ref !== null) {
|
1012
|
-
setCurrentlyValidatingElement$1(fragment);
|
1013
|
-
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
1014
|
-
setCurrentlyValidatingElement$1(null);
|
1015
|
-
}
|
1016
|
-
}
|
1017
|
-
}
|
1018
|
-
var didWarnAboutKeySpread = {};
|
1019
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
1020
|
-
{
|
1021
|
-
var validType = isValidElementType(type);
|
1022
|
-
if (!validType) {
|
1023
|
-
var info = "";
|
1024
|
-
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
1025
|
-
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
1026
|
-
}
|
1027
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
1028
|
-
if (sourceInfo) {
|
1029
|
-
info += sourceInfo;
|
1030
|
-
} else {
|
1031
|
-
info += getDeclarationErrorAddendum();
|
1032
|
-
}
|
1033
|
-
var typeString;
|
1034
|
-
if (type === null) {
|
1035
|
-
typeString = "null";
|
1036
|
-
} else if (isArray(type)) {
|
1037
|
-
typeString = "array";
|
1038
|
-
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
1039
|
-
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
1040
|
-
info = " Did you accidentally export a JSX literal instead of a component?";
|
1041
|
-
} else {
|
1042
|
-
typeString = typeof type;
|
1043
|
-
}
|
1044
|
-
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
1045
|
-
}
|
1046
|
-
var element = jsxDEV(type, props, key, source, self);
|
1047
|
-
if (element == null) {
|
1048
|
-
return element;
|
1049
|
-
}
|
1050
|
-
if (validType) {
|
1051
|
-
var children = props.children;
|
1052
|
-
if (children !== void 0) {
|
1053
|
-
if (isStaticChildren) {
|
1054
|
-
if (isArray(children)) {
|
1055
|
-
for (var i = 0; i < children.length; i++) {
|
1056
|
-
validateChildKeys(children[i], type);
|
1057
|
-
}
|
1058
|
-
if (Object.freeze) {
|
1059
|
-
Object.freeze(children);
|
1060
|
-
}
|
1061
|
-
} else {
|
1062
|
-
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
1063
|
-
}
|
1064
|
-
} else {
|
1065
|
-
validateChildKeys(children, type);
|
1066
|
-
}
|
1067
|
-
}
|
1068
|
-
}
|
1069
|
-
{
|
1070
|
-
if (hasOwnProperty.call(props, "key")) {
|
1071
|
-
var componentName = getComponentNameFromType(type);
|
1072
|
-
var keys = Object.keys(props).filter(function(k) {
|
1073
|
-
return k !== "key";
|
1074
|
-
});
|
1075
|
-
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
1076
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
1077
|
-
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
1078
|
-
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
1079
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
1080
|
-
}
|
1081
|
-
}
|
1082
|
-
}
|
1083
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
1084
|
-
validateFragmentProps(element);
|
1085
|
-
} else {
|
1086
|
-
validatePropTypes(element);
|
1087
|
-
}
|
1088
|
-
return element;
|
1089
|
-
}
|
1090
|
-
}
|
1091
|
-
function jsxWithValidationStatic(type, props, key) {
|
1092
|
-
{
|
1093
|
-
return jsxWithValidation(type, props, key, true);
|
1094
|
-
}
|
1095
|
-
}
|
1096
|
-
function jsxWithValidationDynamic(type, props, key) {
|
1097
|
-
{
|
1098
|
-
return jsxWithValidation(type, props, key, false);
|
1099
|
-
}
|
1100
|
-
}
|
1101
|
-
var jsx = jsxWithValidationDynamic;
|
1102
|
-
var jsxs = jsxWithValidationStatic;
|
1103
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
1104
|
-
reactJsxRuntime_development.jsx = jsx;
|
1105
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
1106
|
-
})();
|
1107
|
-
}
|
1108
|
-
return reactJsxRuntime_development;
|
1109
|
-
}
|
1110
|
-
if (process.env.NODE_ENV === "production") {
|
1111
|
-
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
1112
|
-
} else {
|
1113
|
-
jsxRuntime.exports = requireReactJsxRuntime_development();
|
1114
|
-
}
|
1115
|
-
var jsxRuntimeExports = jsxRuntime.exports;
|
1116
|
-
const ThemeContext = createContext();
|
1117
|
-
const useTheme = () => useContext(ThemeContext);
|
1118
|
-
const ThemeProvider = ({ initialTheme = "light", children }) => {
|
1119
|
-
const [theme, setTheme] = useState(initialTheme);
|
1120
|
-
const toggleTheme = () => {
|
1121
|
-
setTheme((prevTheme) => prevTheme === "light" ? "dark" : "light");
|
459
|
+
ne.Fragment = gt;
|
460
|
+
ne.jsx = Ae;
|
461
|
+
ne.jsxs = Ae;
|
462
|
+
be.exports = ne;
|
463
|
+
var a = be.exports;
|
464
|
+
const ve = ye(), xt = () => xe(ve), zt = ({ initialTheme: s = "light", children: r }) => {
|
465
|
+
const [t, c] = U(s), u = () => {
|
466
|
+
c((h) => h === "light" ? "dark" : "light");
|
1122
467
|
};
|
1123
|
-
|
1124
|
-
document.documentElement.classList.remove("light", "dark");
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
const CoinleyProvider = ({
|
1132
|
-
apiKey,
|
1133
|
-
apiSecret,
|
1134
|
-
apiUrl = "https://coinleyserver-production.up.railway.app",
|
1135
|
-
merchantWalletAddress = null,
|
468
|
+
return Z(() => {
|
469
|
+
document.documentElement.classList.remove("light", "dark"), document.documentElement.classList.add(t);
|
470
|
+
}, [t]), /* @__PURE__ */ a.jsx(ve.Provider, { value: { theme: t, setTheme: c, toggleTheme: u }, children: r });
|
471
|
+
}, Te = ye(), Nt = () => xe(Te), Gt = ({
|
472
|
+
apiKey: s,
|
473
|
+
apiSecret: r,
|
474
|
+
apiUrl: t = "http://localhost:9000",
|
475
|
+
merchantWalletAddress: c = null,
|
1136
476
|
// New prop for merchant wallet address
|
1137
|
-
merchantSolWalletAddress = null,
|
477
|
+
merchantSolWalletAddress: u = null,
|
1138
478
|
// New prop for Solana wallet address
|
1139
|
-
debug =
|
1140
|
-
children
|
479
|
+
debug: h = !1,
|
480
|
+
children: y
|
1141
481
|
}) => {
|
1142
|
-
const [
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
if (!apiKey || !apiSecret) {
|
1147
|
-
setError("API key and secret are required");
|
482
|
+
const [w, e] = U(!1), [n, o] = U(null), [i, l] = U(null);
|
483
|
+
Z(() => {
|
484
|
+
if (!s || !r) {
|
485
|
+
o("API key and secret are required");
|
1148
486
|
return;
|
1149
487
|
}
|
1150
488
|
try {
|
1151
|
-
|
1152
|
-
apiKey,
|
1153
|
-
apiSecret,
|
1154
|
-
apiUrl,
|
1155
|
-
merchantWalletAddress,
|
489
|
+
dt({
|
490
|
+
apiKey: s,
|
491
|
+
apiSecret: r,
|
492
|
+
apiUrl: t,
|
493
|
+
merchantWalletAddress: c,
|
1156
494
|
// Pass wallet address to API service
|
1157
|
-
merchantSolWalletAddress
|
495
|
+
merchantSolWalletAddress: u
|
496
|
+
}), e(!0), h && console.log("Coinley SDK initialized with:", {
|
497
|
+
apiKey: s,
|
498
|
+
apiUrl: t,
|
499
|
+
merchantWalletAddress: c ? `${c.substring(0, 6)}...${c.substring(c.length - 4)}` : "Not provided",
|
500
|
+
merchantSolWalletAddress: u ? `${u.substring(0, 6)}...${u.substring(u.length - 4)}` : "Not provided"
|
1158
501
|
});
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
}, [apiKey, apiSecret, apiUrl, merchantWalletAddress, merchantSolWalletAddress, debug]);
|
1175
|
-
const storePaymentData = (data) => {
|
1176
|
-
setPaymentData(data);
|
1177
|
-
return data;
|
502
|
+
} catch (m) {
|
503
|
+
o(m.message), h && console.error("Coinley SDK initialization error:", m);
|
504
|
+
}
|
505
|
+
}, [s, r, t, c, u, h]);
|
506
|
+
const d = {
|
507
|
+
apiKey: s,
|
508
|
+
apiSecret: r,
|
509
|
+
apiUrl: t,
|
510
|
+
merchantWalletAddress: c,
|
511
|
+
merchantSolWalletAddress: u,
|
512
|
+
isInitialized: w,
|
513
|
+
error: n,
|
514
|
+
debug: h,
|
515
|
+
paymentData: i,
|
516
|
+
storePaymentData: (m) => (l(m), m)
|
1178
517
|
};
|
1179
|
-
|
1180
|
-
apiKey,
|
1181
|
-
apiSecret,
|
1182
|
-
apiUrl,
|
1183
|
-
merchantWalletAddress,
|
1184
|
-
merchantSolWalletAddress,
|
1185
|
-
isInitialized,
|
1186
|
-
error,
|
1187
|
-
debug,
|
1188
|
-
paymentData,
|
1189
|
-
storePaymentData
|
1190
|
-
};
|
1191
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(CoinleyContext.Provider, { value, children });
|
1192
|
-
};
|
1193
|
-
var __defProp = Object.defineProperty;
|
1194
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
1195
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
1196
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
1197
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
1198
|
-
var __spreadValues = (a, b) => {
|
1199
|
-
for (var prop in b || (b = {}))
|
1200
|
-
if (__hasOwnProp.call(b, prop))
|
1201
|
-
__defNormalProp(a, prop, b[prop]);
|
1202
|
-
if (__getOwnPropSymbols)
|
1203
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
1204
|
-
if (__propIsEnum.call(b, prop))
|
1205
|
-
__defNormalProp(a, prop, b[prop]);
|
1206
|
-
}
|
1207
|
-
return a;
|
518
|
+
return /* @__PURE__ */ a.jsx(Te.Provider, { value: d, children: y });
|
1208
519
|
};
|
1209
|
-
var
|
1210
|
-
var
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
520
|
+
var Et = Object.defineProperty, se = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, je = Object.prototype.propertyIsEnumerable, pe = (s, r, t) => r in s ? Et(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, ie = (s, r) => {
|
521
|
+
for (var t in r || (r = {}))
|
522
|
+
Ce.call(r, t) && pe(s, t, r[t]);
|
523
|
+
if (se)
|
524
|
+
for (var t of se(r))
|
525
|
+
je.call(r, t) && pe(s, t, r[t]);
|
526
|
+
return s;
|
527
|
+
}, ce = (s, r) => {
|
528
|
+
var t = {};
|
529
|
+
for (var c in s)
|
530
|
+
Ce.call(s, c) && r.indexOf(c) < 0 && (t[c] = s[c]);
|
531
|
+
if (s != null && se)
|
532
|
+
for (var c of se(s))
|
533
|
+
r.indexOf(c) < 0 && je.call(s, c) && (t[c] = s[c]);
|
534
|
+
return t;
|
1220
535
|
};
|
1221
536
|
/**
|
1222
537
|
* @license QR Code generator library (TypeScript)
|
1223
538
|
* Copyright (c) Project Nayuki.
|
1224
539
|
* SPDX-License-Identifier: MIT
|
1225
540
|
*/
|
1226
|
-
var
|
1227
|
-
((
|
1228
|
-
const
|
541
|
+
var K;
|
542
|
+
((s) => {
|
543
|
+
const r = class E {
|
1229
544
|
/*-- Constructor (low level) and fields --*/
|
1230
545
|
// Creates a new QR Code with the given version number,
|
1231
546
|
// error correction level, data codeword bytes, and mask number.
|
1232
547
|
// This is a low-level API that most users should not use directly.
|
1233
548
|
// A mid-level API is the encodeSegments() function.
|
1234
|
-
constructor(
|
1235
|
-
this.version =
|
1236
|
-
this.errorCorrectionLevel = errorCorrectionLevel;
|
1237
|
-
this.modules = [];
|
1238
|
-
this.isFunction = [];
|
1239
|
-
if (version < _QrCode2.MIN_VERSION || version > _QrCode2.MAX_VERSION)
|
549
|
+
constructor(e, n, o, i) {
|
550
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < E.MIN_VERSION || e > E.MAX_VERSION)
|
1240
551
|
throw new RangeError("Version value out of range");
|
1241
|
-
if (
|
552
|
+
if (i < -1 || i > 7)
|
1242
553
|
throw new RangeError("Mask value out of range");
|
1243
|
-
this.size =
|
1244
|
-
let
|
1245
|
-
for (let
|
1246
|
-
|
1247
|
-
for (let
|
1248
|
-
this.modules.push(
|
1249
|
-
this.isFunction.push(row.slice());
|
1250
|
-
}
|
554
|
+
this.size = e * 4 + 17;
|
555
|
+
let l = [];
|
556
|
+
for (let d = 0; d < this.size; d++)
|
557
|
+
l.push(!1);
|
558
|
+
for (let d = 0; d < this.size; d++)
|
559
|
+
this.modules.push(l.slice()), this.isFunction.push(l.slice());
|
1251
560
|
this.drawFunctionPatterns();
|
1252
|
-
const
|
1253
|
-
this.drawCodewords(
|
1254
|
-
|
1255
|
-
let
|
1256
|
-
|
1257
|
-
this.
|
1258
|
-
this.
|
1259
|
-
const penalty = this.getPenaltyScore();
|
1260
|
-
if (penalty < minPenalty) {
|
1261
|
-
msk = i;
|
1262
|
-
minPenalty = penalty;
|
1263
|
-
}
|
1264
|
-
this.applyMask(i);
|
561
|
+
const f = this.addEccAndInterleave(o);
|
562
|
+
if (this.drawCodewords(f), i == -1) {
|
563
|
+
let d = 1e9;
|
564
|
+
for (let m = 0; m < 8; m++) {
|
565
|
+
this.applyMask(m), this.drawFormatBits(m);
|
566
|
+
const g = this.getPenaltyScore();
|
567
|
+
g < d && (i = m, d = g), this.applyMask(m);
|
1265
568
|
}
|
1266
569
|
}
|
1267
|
-
|
1268
|
-
this.mask = msk;
|
1269
|
-
this.applyMask(msk);
|
1270
|
-
this.drawFormatBits(msk);
|
1271
|
-
this.isFunction = [];
|
570
|
+
u(0 <= i && i <= 7), this.mask = i, this.applyMask(i), this.drawFormatBits(i), this.isFunction = [];
|
1272
571
|
}
|
1273
572
|
/*-- Static factory functions (high level) --*/
|
1274
573
|
// Returns a QR Code representing the given Unicode text string at the given error correction level.
|
@@ -1276,17 +575,17 @@ var qrcodegen;
|
|
1276
575
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
1277
576
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
1278
577
|
// ecl argument if it can be done without increasing the version.
|
1279
|
-
static encodeText(
|
1280
|
-
const
|
1281
|
-
return
|
578
|
+
static encodeText(e, n) {
|
579
|
+
const o = s.QrSegment.makeSegments(e);
|
580
|
+
return E.encodeSegments(o, n);
|
1282
581
|
}
|
1283
582
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
1284
583
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
1285
584
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
1286
585
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
1287
|
-
static encodeBinary(
|
1288
|
-
const
|
1289
|
-
return
|
586
|
+
static encodeBinary(e, n) {
|
587
|
+
const o = s.QrSegment.makeBytes(e);
|
588
|
+
return E.encodeSegments([o], n);
|
1290
589
|
}
|
1291
590
|
/*-- Static factory functions (mid level) --*/
|
1292
591
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
@@ -1298,52 +597,43 @@ var qrcodegen;
|
|
1298
597
|
// This function allows the user to create a custom sequence of segments that switches
|
1299
598
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
1300
599
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
1301
|
-
static encodeSegments(
|
1302
|
-
if (!(
|
600
|
+
static encodeSegments(e, n, o = 1, i = 40, l = -1, f = !0) {
|
601
|
+
if (!(E.MIN_VERSION <= o && o <= i && i <= E.MAX_VERSION) || l < -1 || l > 7)
|
1303
602
|
throw new RangeError("Invalid value");
|
1304
|
-
let
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
if (usedBits <= dataCapacityBits2) {
|
1310
|
-
dataUsedBits = usedBits;
|
603
|
+
let d, m;
|
604
|
+
for (d = o; ; d++) {
|
605
|
+
const p = E.getNumDataCodewords(d, n) * 8, j = y.getTotalBits(e, d);
|
606
|
+
if (j <= p) {
|
607
|
+
m = j;
|
1311
608
|
break;
|
1312
609
|
}
|
1313
|
-
if (
|
610
|
+
if (d >= i)
|
1314
611
|
throw new RangeError("Data too long");
|
1315
612
|
}
|
1316
|
-
for (const
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)
|
1334
|
-
appendBits(padByte, 8, bb);
|
1335
|
-
let dataCodewords = [];
|
1336
|
-
while (dataCodewords.length * 8 < bb.length)
|
1337
|
-
dataCodewords.push(0);
|
1338
|
-
bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));
|
1339
|
-
return new _QrCode2(version, ecl, dataCodewords, mask);
|
613
|
+
for (const p of [E.Ecc.MEDIUM, E.Ecc.QUARTILE, E.Ecc.HIGH])
|
614
|
+
f && m <= E.getNumDataCodewords(d, p) * 8 && (n = p);
|
615
|
+
let g = [];
|
616
|
+
for (const p of e) {
|
617
|
+
t(p.mode.modeBits, 4, g), t(p.numChars, p.mode.numCharCountBits(d), g);
|
618
|
+
for (const j of p.getData())
|
619
|
+
g.push(j);
|
620
|
+
}
|
621
|
+
u(g.length == m);
|
622
|
+
const b = E.getNumDataCodewords(d, n) * 8;
|
623
|
+
u(g.length <= b), t(0, Math.min(4, b - g.length), g), t(0, (8 - g.length % 8) % 8, g), u(g.length % 8 == 0);
|
624
|
+
for (let p = 236; g.length < b; p ^= 253)
|
625
|
+
t(p, 8, g);
|
626
|
+
let v = [];
|
627
|
+
for (; v.length * 8 < g.length; )
|
628
|
+
v.push(0);
|
629
|
+
return g.forEach((p, j) => v[j >>> 3] |= p << 7 - (j & 7)), new E(d, n, v, l);
|
1340
630
|
}
|
1341
631
|
/*-- Accessor methods --*/
|
1342
632
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
1343
633
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
1344
634
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
1345
|
-
getModule(
|
1346
|
-
return 0 <=
|
635
|
+
getModule(e, n) {
|
636
|
+
return 0 <= e && e < this.size && 0 <= n && n < this.size && this.modules[n][e];
|
1347
637
|
}
|
1348
638
|
// Modified to expose modules for easy access
|
1349
639
|
getModules() {
|
@@ -1352,253 +642,178 @@ var qrcodegen;
|
|
1352
642
|
/*-- Private helper methods for constructor: Drawing function modules --*/
|
1353
643
|
// Reads this object's version field, and draws and marks all function modules.
|
1354
644
|
drawFunctionPatterns() {
|
1355
|
-
for (let
|
1356
|
-
this.setFunctionModule(6,
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
const numAlign = alignPatPos.length;
|
1364
|
-
for (let i = 0; i < numAlign; i++) {
|
1365
|
-
for (let j = 0; j < numAlign; j++) {
|
1366
|
-
if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
|
1367
|
-
this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
|
1368
|
-
}
|
1369
|
-
}
|
1370
|
-
this.drawFormatBits(0);
|
1371
|
-
this.drawVersion();
|
645
|
+
for (let o = 0; o < this.size; o++)
|
646
|
+
this.setFunctionModule(6, o, o % 2 == 0), this.setFunctionModule(o, 6, o % 2 == 0);
|
647
|
+
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
648
|
+
const e = this.getAlignmentPatternPositions(), n = e.length;
|
649
|
+
for (let o = 0; o < n; o++)
|
650
|
+
for (let i = 0; i < n; i++)
|
651
|
+
o == 0 && i == 0 || o == 0 && i == n - 1 || o == n - 1 && i == 0 || this.drawAlignmentPattern(e[o], e[i]);
|
652
|
+
this.drawFormatBits(0), this.drawVersion();
|
1372
653
|
}
|
1373
654
|
// Draws two copies of the format bits (with its own error correction code)
|
1374
655
|
// based on the given mask and this object's error correction level field.
|
1375
|
-
drawFormatBits(
|
1376
|
-
const
|
1377
|
-
let
|
1378
|
-
for (let
|
1379
|
-
|
1380
|
-
const
|
1381
|
-
|
1382
|
-
for (let
|
1383
|
-
this.setFunctionModule(8,
|
1384
|
-
this.setFunctionModule(8, 7,
|
1385
|
-
|
1386
|
-
|
1387
|
-
for (let
|
1388
|
-
this.setFunctionModule(
|
1389
|
-
for (let
|
1390
|
-
this.setFunctionModule(this.size -
|
1391
|
-
|
1392
|
-
this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
|
1393
|
-
this.setFunctionModule(8, this.size - 8, true);
|
656
|
+
drawFormatBits(e) {
|
657
|
+
const n = this.errorCorrectionLevel.formatBits << 3 | e;
|
658
|
+
let o = n;
|
659
|
+
for (let l = 0; l < 10; l++)
|
660
|
+
o = o << 1 ^ (o >>> 9) * 1335;
|
661
|
+
const i = (n << 10 | o) ^ 21522;
|
662
|
+
u(i >>> 15 == 0);
|
663
|
+
for (let l = 0; l <= 5; l++)
|
664
|
+
this.setFunctionModule(8, l, c(i, l));
|
665
|
+
this.setFunctionModule(8, 7, c(i, 6)), this.setFunctionModule(8, 8, c(i, 7)), this.setFunctionModule(7, 8, c(i, 8));
|
666
|
+
for (let l = 9; l < 15; l++)
|
667
|
+
this.setFunctionModule(14 - l, 8, c(i, l));
|
668
|
+
for (let l = 0; l < 8; l++)
|
669
|
+
this.setFunctionModule(this.size - 1 - l, 8, c(i, l));
|
670
|
+
for (let l = 8; l < 15; l++)
|
671
|
+
this.setFunctionModule(8, this.size - 15 + l, c(i, l));
|
672
|
+
this.setFunctionModule(8, this.size - 8, !0);
|
1394
673
|
}
|
1395
674
|
// Draws two copies of the version bits (with its own error correction code),
|
1396
675
|
// based on this object's version field, iff 7 <= version <= 40.
|
1397
676
|
drawVersion() {
|
1398
677
|
if (this.version < 7)
|
1399
678
|
return;
|
1400
|
-
let
|
1401
|
-
for (let
|
1402
|
-
|
1403
|
-
const
|
1404
|
-
|
1405
|
-
for (let
|
1406
|
-
const
|
1407
|
-
|
1408
|
-
const b = Math.floor(i / 3);
|
1409
|
-
this.setFunctionModule(a, b, color);
|
1410
|
-
this.setFunctionModule(b, a, color);
|
679
|
+
let e = this.version;
|
680
|
+
for (let o = 0; o < 12; o++)
|
681
|
+
e = e << 1 ^ (e >>> 11) * 7973;
|
682
|
+
const n = this.version << 12 | e;
|
683
|
+
u(n >>> 18 == 0);
|
684
|
+
for (let o = 0; o < 18; o++) {
|
685
|
+
const i = c(n, o), l = this.size - 11 + o % 3, f = Math.floor(o / 3);
|
686
|
+
this.setFunctionModule(l, f, i), this.setFunctionModule(f, l, i);
|
1411
687
|
}
|
1412
688
|
}
|
1413
689
|
// Draws a 9*9 finder pattern including the border separator,
|
1414
690
|
// with the center module at (x, y). Modules can be out of bounds.
|
1415
|
-
drawFinderPattern(
|
1416
|
-
for (let
|
1417
|
-
for (let
|
1418
|
-
const
|
1419
|
-
|
1420
|
-
const yy = y + dy;
|
1421
|
-
if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
|
1422
|
-
this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
691
|
+
drawFinderPattern(e, n) {
|
692
|
+
for (let o = -4; o <= 4; o++)
|
693
|
+
for (let i = -4; i <= 4; i++) {
|
694
|
+
const l = Math.max(Math.abs(i), Math.abs(o)), f = e + i, d = n + o;
|
695
|
+
0 <= f && f < this.size && 0 <= d && d < this.size && this.setFunctionModule(f, d, l != 2 && l != 4);
|
1423
696
|
}
|
1424
|
-
}
|
1425
697
|
}
|
1426
698
|
// Draws a 5*5 alignment pattern, with the center module
|
1427
699
|
// at (x, y). All modules must be in bounds.
|
1428
|
-
drawAlignmentPattern(
|
1429
|
-
for (let
|
1430
|
-
for (let
|
1431
|
-
this.setFunctionModule(
|
1432
|
-
}
|
700
|
+
drawAlignmentPattern(e, n) {
|
701
|
+
for (let o = -2; o <= 2; o++)
|
702
|
+
for (let i = -2; i <= 2; i++)
|
703
|
+
this.setFunctionModule(e + i, n + o, Math.max(Math.abs(i), Math.abs(o)) != 1);
|
1433
704
|
}
|
1434
705
|
// Sets the color of a module and marks it as a function module.
|
1435
706
|
// Only used by the constructor. Coordinates must be in bounds.
|
1436
|
-
setFunctionModule(
|
1437
|
-
this.modules[
|
1438
|
-
this.isFunction[y][x] = true;
|
707
|
+
setFunctionModule(e, n, o) {
|
708
|
+
this.modules[n][e] = o, this.isFunction[n][e] = !0;
|
1439
709
|
}
|
1440
710
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
1441
711
|
// Returns a new byte string representing the given data with the appropriate error correction
|
1442
712
|
// codewords appended to it, based on this object's version and error correction level.
|
1443
|
-
addEccAndInterleave(
|
1444
|
-
const
|
1445
|
-
|
1446
|
-
if (data.length != _QrCode2.getNumDataCodewords(ver, ecl))
|
713
|
+
addEccAndInterleave(e) {
|
714
|
+
const n = this.version, o = this.errorCorrectionLevel;
|
715
|
+
if (e.length != E.getNumDataCodewords(n, o))
|
1447
716
|
throw new RangeError("Invalid argument");
|
1448
|
-
const
|
1449
|
-
|
1450
|
-
const
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
blocks.push(dat.concat(ecc));
|
1462
|
-
}
|
1463
|
-
let result = [];
|
1464
|
-
for (let i = 0; i < blocks[0].length; i++) {
|
1465
|
-
blocks.forEach((block, j) => {
|
1466
|
-
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)
|
1467
|
-
result.push(block[i]);
|
717
|
+
const i = E.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][n], l = E.ECC_CODEWORDS_PER_BLOCK[o.ordinal][n], f = Math.floor(E.getNumRawDataModules(n) / 8), d = i - f % i, m = Math.floor(f / i);
|
718
|
+
let g = [];
|
719
|
+
const b = E.reedSolomonComputeDivisor(l);
|
720
|
+
for (let p = 0, j = 0; p < i; p++) {
|
721
|
+
let M = e.slice(j, j + m - l + (p < d ? 0 : 1));
|
722
|
+
j += M.length;
|
723
|
+
const F = E.reedSolomonComputeRemainder(M, b);
|
724
|
+
p < d && M.push(0), g.push(M.concat(F));
|
725
|
+
}
|
726
|
+
let v = [];
|
727
|
+
for (let p = 0; p < g[0].length; p++)
|
728
|
+
g.forEach((j, M) => {
|
729
|
+
(p != m - l || M >= d) && v.push(j[p]);
|
1468
730
|
});
|
1469
|
-
|
1470
|
-
assert(result.length == rawCodewords);
|
1471
|
-
return result;
|
731
|
+
return u(v.length == f), v;
|
1472
732
|
}
|
1473
733
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
1474
734
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
1475
|
-
drawCodewords(
|
1476
|
-
if (
|
735
|
+
drawCodewords(e) {
|
736
|
+
if (e.length != Math.floor(E.getNumRawDataModules(this.version) / 8))
|
1477
737
|
throw new RangeError("Invalid argument");
|
1478
|
-
let
|
1479
|
-
for (let
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
const upward = (right + 1 & 2) == 0;
|
1486
|
-
const y = upward ? this.size - 1 - vert : vert;
|
1487
|
-
if (!this.isFunction[y][x] && i < data.length * 8) {
|
1488
|
-
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
|
1489
|
-
i++;
|
1490
|
-
}
|
738
|
+
let n = 0;
|
739
|
+
for (let o = this.size - 1; o >= 1; o -= 2) {
|
740
|
+
o == 6 && (o = 5);
|
741
|
+
for (let i = 0; i < this.size; i++)
|
742
|
+
for (let l = 0; l < 2; l++) {
|
743
|
+
const f = o - l, m = (o + 1 & 2) == 0 ? this.size - 1 - i : i;
|
744
|
+
!this.isFunction[m][f] && n < e.length * 8 && (this.modules[m][f] = c(e[n >>> 3], 7 - (n & 7)), n++);
|
1491
745
|
}
|
1492
|
-
}
|
1493
746
|
}
|
1494
|
-
|
747
|
+
u(n == e.length * 8);
|
1495
748
|
}
|
1496
749
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
1497
750
|
// The function modules must be marked and the codeword bits must be drawn
|
1498
751
|
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
1499
752
|
// the same mask value a second time will undo the mask. A final well-formed
|
1500
753
|
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
1501
|
-
applyMask(
|
1502
|
-
if (
|
754
|
+
applyMask(e) {
|
755
|
+
if (e < 0 || e > 7)
|
1503
756
|
throw new RangeError("Mask value out of range");
|
1504
|
-
for (let
|
1505
|
-
for (let
|
1506
|
-
let
|
1507
|
-
switch (
|
757
|
+
for (let n = 0; n < this.size; n++)
|
758
|
+
for (let o = 0; o < this.size; o++) {
|
759
|
+
let i;
|
760
|
+
switch (e) {
|
1508
761
|
case 0:
|
1509
|
-
|
762
|
+
i = (o + n) % 2 == 0;
|
1510
763
|
break;
|
1511
764
|
case 1:
|
1512
|
-
|
765
|
+
i = n % 2 == 0;
|
1513
766
|
break;
|
1514
767
|
case 2:
|
1515
|
-
|
768
|
+
i = o % 3 == 0;
|
1516
769
|
break;
|
1517
770
|
case 3:
|
1518
|
-
|
771
|
+
i = (o + n) % 3 == 0;
|
1519
772
|
break;
|
1520
773
|
case 4:
|
1521
|
-
|
774
|
+
i = (Math.floor(o / 3) + Math.floor(n / 2)) % 2 == 0;
|
1522
775
|
break;
|
1523
776
|
case 5:
|
1524
|
-
|
777
|
+
i = o * n % 2 + o * n % 3 == 0;
|
1525
778
|
break;
|
1526
779
|
case 6:
|
1527
|
-
|
780
|
+
i = (o * n % 2 + o * n % 3) % 2 == 0;
|
1528
781
|
break;
|
1529
782
|
case 7:
|
1530
|
-
|
783
|
+
i = ((o + n) % 2 + o * n % 3) % 2 == 0;
|
1531
784
|
break;
|
1532
785
|
default:
|
1533
786
|
throw new Error("Unreachable");
|
1534
787
|
}
|
1535
|
-
|
1536
|
-
this.modules[y][x] = !this.modules[y][x];
|
788
|
+
!this.isFunction[n][o] && i && (this.modules[n][o] = !this.modules[n][o]);
|
1537
789
|
}
|
1538
|
-
}
|
1539
790
|
}
|
1540
791
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
1541
792
|
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
1542
793
|
getPenaltyScore() {
|
1543
|
-
let
|
1544
|
-
for (let
|
1545
|
-
let
|
1546
|
-
let
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
let runColor = false;
|
1567
|
-
let runY = 0;
|
1568
|
-
let runHistory = [0, 0, 0, 0, 0, 0, 0];
|
1569
|
-
for (let y = 0; y < this.size; y++) {
|
1570
|
-
if (this.modules[y][x] == runColor) {
|
1571
|
-
runY++;
|
1572
|
-
if (runY == 5)
|
1573
|
-
result += _QrCode2.PENALTY_N1;
|
1574
|
-
else if (runY > 5)
|
1575
|
-
result++;
|
1576
|
-
} else {
|
1577
|
-
this.finderPenaltyAddHistory(runY, runHistory);
|
1578
|
-
if (!runColor)
|
1579
|
-
result += this.finderPenaltyCountPatterns(runHistory) * _QrCode2.PENALTY_N3;
|
1580
|
-
runColor = this.modules[y][x];
|
1581
|
-
runY = 1;
|
1582
|
-
}
|
1583
|
-
}
|
1584
|
-
result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode2.PENALTY_N3;
|
1585
|
-
}
|
1586
|
-
for (let y = 0; y < this.size - 1; y++) {
|
1587
|
-
for (let x = 0; x < this.size - 1; x++) {
|
1588
|
-
const color = this.modules[y][x];
|
1589
|
-
if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])
|
1590
|
-
result += _QrCode2.PENALTY_N2;
|
1591
|
-
}
|
1592
|
-
}
|
1593
|
-
let dark = 0;
|
1594
|
-
for (const row of this.modules)
|
1595
|
-
dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
|
1596
|
-
const total = this.size * this.size;
|
1597
|
-
const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
|
1598
|
-
assert(0 <= k && k <= 9);
|
1599
|
-
result += k * _QrCode2.PENALTY_N4;
|
1600
|
-
assert(0 <= result && result <= 2568888);
|
1601
|
-
return result;
|
794
|
+
let e = 0;
|
795
|
+
for (let l = 0; l < this.size; l++) {
|
796
|
+
let f = !1, d = 0, m = [0, 0, 0, 0, 0, 0, 0];
|
797
|
+
for (let g = 0; g < this.size; g++)
|
798
|
+
this.modules[l][g] == f ? (d++, d == 5 ? e += E.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, m), f || (e += this.finderPenaltyCountPatterns(m) * E.PENALTY_N3), f = this.modules[l][g], d = 1);
|
799
|
+
e += this.finderPenaltyTerminateAndCount(f, d, m) * E.PENALTY_N3;
|
800
|
+
}
|
801
|
+
for (let l = 0; l < this.size; l++) {
|
802
|
+
let f = !1, d = 0, m = [0, 0, 0, 0, 0, 0, 0];
|
803
|
+
for (let g = 0; g < this.size; g++)
|
804
|
+
this.modules[g][l] == f ? (d++, d == 5 ? e += E.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, m), f || (e += this.finderPenaltyCountPatterns(m) * E.PENALTY_N3), f = this.modules[g][l], d = 1);
|
805
|
+
e += this.finderPenaltyTerminateAndCount(f, d, m) * E.PENALTY_N3;
|
806
|
+
}
|
807
|
+
for (let l = 0; l < this.size - 1; l++)
|
808
|
+
for (let f = 0; f < this.size - 1; f++) {
|
809
|
+
const d = this.modules[l][f];
|
810
|
+
d == this.modules[l][f + 1] && d == this.modules[l + 1][f] && d == this.modules[l + 1][f + 1] && (e += E.PENALTY_N2);
|
811
|
+
}
|
812
|
+
let n = 0;
|
813
|
+
for (const l of this.modules)
|
814
|
+
n = l.reduce((f, d) => f + (d ? 1 : 0), n);
|
815
|
+
const o = this.size * this.size, i = Math.ceil(Math.abs(n * 20 - o * 10) / o) - 1;
|
816
|
+
return u(0 <= i && i <= 9), e += i * E.PENALTY_N4, u(0 <= e && e <= 2568888), e;
|
1602
817
|
}
|
1603
818
|
/*-- Private helper functions --*/
|
1604
819
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
@@ -1607,113 +822,87 @@ var qrcodegen;
|
|
1607
822
|
getAlignmentPatternPositions() {
|
1608
823
|
if (this.version == 1)
|
1609
824
|
return [];
|
1610
|
-
|
1611
|
-
const
|
1612
|
-
|
1613
|
-
let
|
1614
|
-
|
1615
|
-
|
1616
|
-
return result;
|
825
|
+
{
|
826
|
+
const e = Math.floor(this.version / 7) + 2, n = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2;
|
827
|
+
let o = [6];
|
828
|
+
for (let i = this.size - 7; o.length < e; i -= n)
|
829
|
+
o.splice(1, 0, i);
|
830
|
+
return o;
|
1617
831
|
}
|
1618
832
|
}
|
1619
833
|
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
1620
834
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
1621
835
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
1622
|
-
static getNumRawDataModules(
|
1623
|
-
if (
|
836
|
+
static getNumRawDataModules(e) {
|
837
|
+
if (e < E.MIN_VERSION || e > E.MAX_VERSION)
|
1624
838
|
throw new RangeError("Version number out of range");
|
1625
|
-
let
|
1626
|
-
if (
|
1627
|
-
const
|
1628
|
-
|
1629
|
-
if (ver >= 7)
|
1630
|
-
result -= 36;
|
839
|
+
let n = (16 * e + 128) * e + 64;
|
840
|
+
if (e >= 2) {
|
841
|
+
const o = Math.floor(e / 7) + 2;
|
842
|
+
n -= (25 * o - 10) * o - 55, e >= 7 && (n -= 36);
|
1631
843
|
}
|
1632
|
-
|
1633
|
-
return result;
|
844
|
+
return u(208 <= n && n <= 29648), n;
|
1634
845
|
}
|
1635
846
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
1636
847
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
1637
848
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
1638
|
-
static getNumDataCodewords(
|
1639
|
-
return Math.floor(
|
849
|
+
static getNumDataCodewords(e, n) {
|
850
|
+
return Math.floor(E.getNumRawDataModules(e) / 8) - E.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * E.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
1640
851
|
}
|
1641
852
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
1642
853
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
1643
|
-
static reedSolomonComputeDivisor(
|
1644
|
-
if (
|
854
|
+
static reedSolomonComputeDivisor(e) {
|
855
|
+
if (e < 1 || e > 255)
|
1645
856
|
throw new RangeError("Degree out of range");
|
1646
|
-
let
|
1647
|
-
for (let i = 0; i <
|
1648
|
-
|
1649
|
-
|
1650
|
-
let
|
1651
|
-
for (let i = 0; i <
|
1652
|
-
for (let
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
root = _QrCode2.reedSolomonMultiply(root, 2);
|
1658
|
-
}
|
1659
|
-
return result;
|
857
|
+
let n = [];
|
858
|
+
for (let i = 0; i < e - 1; i++)
|
859
|
+
n.push(0);
|
860
|
+
n.push(1);
|
861
|
+
let o = 1;
|
862
|
+
for (let i = 0; i < e; i++) {
|
863
|
+
for (let l = 0; l < n.length; l++)
|
864
|
+
n[l] = E.reedSolomonMultiply(n[l], o), l + 1 < n.length && (n[l] ^= n[l + 1]);
|
865
|
+
o = E.reedSolomonMultiply(o, 2);
|
866
|
+
}
|
867
|
+
return n;
|
1660
868
|
}
|
1661
869
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
1662
|
-
static reedSolomonComputeRemainder(
|
1663
|
-
let
|
1664
|
-
for (const
|
1665
|
-
const
|
1666
|
-
|
1667
|
-
divisor.forEach((coef, i) => result[i] ^= _QrCode2.reedSolomonMultiply(coef, factor));
|
870
|
+
static reedSolomonComputeRemainder(e, n) {
|
871
|
+
let o = n.map((i) => 0);
|
872
|
+
for (const i of e) {
|
873
|
+
const l = i ^ o.shift();
|
874
|
+
o.push(0), n.forEach((f, d) => o[d] ^= E.reedSolomonMultiply(f, l));
|
1668
875
|
}
|
1669
|
-
return
|
876
|
+
return o;
|
1670
877
|
}
|
1671
878
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
1672
879
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
1673
|
-
static reedSolomonMultiply(
|
1674
|
-
if (
|
880
|
+
static reedSolomonMultiply(e, n) {
|
881
|
+
if (e >>> 8 || n >>> 8)
|
1675
882
|
throw new RangeError("Byte out of range");
|
1676
|
-
let
|
1677
|
-
for (let i = 7; i >= 0; i--)
|
1678
|
-
|
1679
|
-
|
1680
|
-
}
|
1681
|
-
assert(z >>> 8 == 0);
|
1682
|
-
return z;
|
883
|
+
let o = 0;
|
884
|
+
for (let i = 7; i >= 0; i--)
|
885
|
+
o = o << 1 ^ (o >>> 7) * 285, o ^= (n >>> i & 1) * e;
|
886
|
+
return u(o >>> 8 == 0), o;
|
1683
887
|
}
|
1684
888
|
// Can only be called immediately after a light run is added, and
|
1685
889
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
1686
|
-
finderPenaltyCountPatterns(
|
1687
|
-
const n =
|
1688
|
-
|
1689
|
-
const
|
1690
|
-
return (
|
890
|
+
finderPenaltyCountPatterns(e) {
|
891
|
+
const n = e[1];
|
892
|
+
u(n <= this.size * 3);
|
893
|
+
const o = n > 0 && e[2] == n && e[3] == n * 3 && e[4] == n && e[5] == n;
|
894
|
+
return (o && e[0] >= n * 4 && e[6] >= n ? 1 : 0) + (o && e[6] >= n * 4 && e[0] >= n ? 1 : 0);
|
1691
895
|
}
|
1692
896
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
1693
|
-
finderPenaltyTerminateAndCount(
|
1694
|
-
|
1695
|
-
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
1696
|
-
currentRunLength = 0;
|
1697
|
-
}
|
1698
|
-
currentRunLength += this.size;
|
1699
|
-
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
1700
|
-
return this.finderPenaltyCountPatterns(runHistory);
|
897
|
+
finderPenaltyTerminateAndCount(e, n, o) {
|
898
|
+
return e && (this.finderPenaltyAddHistory(n, o), n = 0), n += this.size, this.finderPenaltyAddHistory(n, o), this.finderPenaltyCountPatterns(o);
|
1701
899
|
}
|
1702
900
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
1703
|
-
finderPenaltyAddHistory(
|
1704
|
-
|
1705
|
-
currentRunLength += this.size;
|
1706
|
-
runHistory.pop();
|
1707
|
-
runHistory.unshift(currentRunLength);
|
901
|
+
finderPenaltyAddHistory(e, n) {
|
902
|
+
n[0] == 0 && (e += this.size), n.pop(), n.unshift(e);
|
1708
903
|
}
|
1709
904
|
};
|
1710
|
-
|
1711
|
-
_QrCode.MAX_VERSION = 40;
|
1712
|
-
_QrCode.PENALTY_N1 = 3;
|
1713
|
-
_QrCode.PENALTY_N2 = 3;
|
1714
|
-
_QrCode.PENALTY_N3 = 40;
|
1715
|
-
_QrCode.PENALTY_N4 = 10;
|
1716
|
-
_QrCode.ECC_CODEWORDS_PER_BLOCK = [
|
905
|
+
r.MIN_VERSION = 1, r.MAX_VERSION = 40, r.PENALTY_N1 = 3, r.PENALTY_N2 = 3, r.PENALTY_N3 = 40, r.PENALTY_N4 = 10, r.ECC_CODEWORDS_PER_BLOCK = [
|
1717
906
|
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
1718
907
|
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
1719
908
|
[-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
|
@@ -1724,8 +913,7 @@ var qrcodegen;
|
|
1724
913
|
// Quartile
|
1725
914
|
[-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
|
1726
915
|
// High
|
1727
|
-
]
|
1728
|
-
_QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
|
916
|
+
], r.NUM_ERROR_CORRECTION_BLOCKS = [
|
1729
917
|
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
1730
918
|
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
1731
919
|
[-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
|
@@ -1736,113 +924,95 @@ var qrcodegen;
|
|
1736
924
|
// Quartile
|
1737
925
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
1738
926
|
// High
|
1739
|
-
];
|
1740
|
-
|
1741
|
-
|
1742
|
-
if (len < 0 || len > 31 || val >>> len != 0)
|
927
|
+
], s.QrCode = r;
|
928
|
+
function t(w, e, n) {
|
929
|
+
if (e < 0 || e > 31 || w >>> e)
|
1743
930
|
throw new RangeError("Value out of range");
|
1744
|
-
for (let
|
1745
|
-
|
931
|
+
for (let o = e - 1; o >= 0; o--)
|
932
|
+
n.push(w >>> o & 1);
|
1746
933
|
}
|
1747
|
-
function
|
1748
|
-
return (
|
934
|
+
function c(w, e) {
|
935
|
+
return (w >>> e & 1) != 0;
|
1749
936
|
}
|
1750
|
-
function
|
1751
|
-
if (!
|
937
|
+
function u(w) {
|
938
|
+
if (!w)
|
1752
939
|
throw new Error("Assertion error");
|
1753
940
|
}
|
1754
|
-
const
|
941
|
+
const h = class k {
|
1755
942
|
/*-- Constructor (low level) and fields --*/
|
1756
943
|
// Creates a new QR Code segment with the given attributes and data.
|
1757
944
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
1758
945
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
1759
|
-
constructor(
|
1760
|
-
this.mode =
|
1761
|
-
this.numChars = numChars;
|
1762
|
-
this.bitData = bitData;
|
1763
|
-
if (numChars < 0)
|
946
|
+
constructor(e, n, o) {
|
947
|
+
if (this.mode = e, this.numChars = n, this.bitData = o, n < 0)
|
1764
948
|
throw new RangeError("Invalid argument");
|
1765
|
-
this.bitData =
|
949
|
+
this.bitData = o.slice();
|
1766
950
|
}
|
1767
951
|
/*-- Static factory functions (mid level) --*/
|
1768
952
|
// Returns a segment representing the given binary data encoded in
|
1769
953
|
// byte mode. All input byte arrays are acceptable. Any text string
|
1770
954
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
1771
|
-
static makeBytes(
|
1772
|
-
let
|
1773
|
-
for (const
|
1774
|
-
|
1775
|
-
return new
|
955
|
+
static makeBytes(e) {
|
956
|
+
let n = [];
|
957
|
+
for (const o of e)
|
958
|
+
t(o, 8, n);
|
959
|
+
return new k(k.Mode.BYTE, e.length, n);
|
1776
960
|
}
|
1777
961
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
1778
|
-
static makeNumeric(
|
1779
|
-
if (!
|
962
|
+
static makeNumeric(e) {
|
963
|
+
if (!k.isNumeric(e))
|
1780
964
|
throw new RangeError("String contains non-numeric characters");
|
1781
|
-
let
|
1782
|
-
for (let
|
1783
|
-
const
|
1784
|
-
|
1785
|
-
i += n;
|
965
|
+
let n = [];
|
966
|
+
for (let o = 0; o < e.length; ) {
|
967
|
+
const i = Math.min(e.length - o, 3);
|
968
|
+
t(parseInt(e.substring(o, o + i), 10), i * 3 + 1, n), o += i;
|
1786
969
|
}
|
1787
|
-
return new
|
970
|
+
return new k(k.Mode.NUMERIC, e.length, n);
|
1788
971
|
}
|
1789
972
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
1790
973
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
1791
974
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
1792
|
-
static makeAlphanumeric(
|
1793
|
-
if (!
|
975
|
+
static makeAlphanumeric(e) {
|
976
|
+
if (!k.isAlphanumeric(e))
|
1794
977
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
1795
|
-
let
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
temp += _QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
|
1800
|
-
appendBits(temp, 11, bb);
|
978
|
+
let n = [], o;
|
979
|
+
for (o = 0; o + 2 <= e.length; o += 2) {
|
980
|
+
let i = k.ALPHANUMERIC_CHARSET.indexOf(e.charAt(o)) * 45;
|
981
|
+
i += k.ALPHANUMERIC_CHARSET.indexOf(e.charAt(o + 1)), t(i, 11, n);
|
1801
982
|
}
|
1802
|
-
|
1803
|
-
appendBits(_QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
|
1804
|
-
return new _QrSegment2(_QrSegment2.Mode.ALPHANUMERIC, text.length, bb);
|
983
|
+
return o < e.length && t(k.ALPHANUMERIC_CHARSET.indexOf(e.charAt(o)), 6, n), new k(k.Mode.ALPHANUMERIC, e.length, n);
|
1805
984
|
}
|
1806
985
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
1807
986
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
1808
|
-
static makeSegments(
|
1809
|
-
|
1810
|
-
return [];
|
1811
|
-
else if (_QrSegment2.isNumeric(text))
|
1812
|
-
return [_QrSegment2.makeNumeric(text)];
|
1813
|
-
else if (_QrSegment2.isAlphanumeric(text))
|
1814
|
-
return [_QrSegment2.makeAlphanumeric(text)];
|
1815
|
-
else
|
1816
|
-
return [_QrSegment2.makeBytes(_QrSegment2.toUtf8ByteArray(text))];
|
987
|
+
static makeSegments(e) {
|
988
|
+
return e == "" ? [] : k.isNumeric(e) ? [k.makeNumeric(e)] : k.isAlphanumeric(e) ? [k.makeAlphanumeric(e)] : [k.makeBytes(k.toUtf8ByteArray(e))];
|
1817
989
|
}
|
1818
990
|
// Returns a segment representing an Extended Channel Interpretation
|
1819
991
|
// (ECI) designator with the given assignment value.
|
1820
|
-
static makeEci(
|
1821
|
-
let
|
1822
|
-
if (
|
992
|
+
static makeEci(e) {
|
993
|
+
let n = [];
|
994
|
+
if (e < 0)
|
1823
995
|
throw new RangeError("ECI assignment value out of range");
|
1824
|
-
|
1825
|
-
|
1826
|
-
else if (
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
appendBits(assignVal, 21, bb);
|
1832
|
-
} else
|
996
|
+
if (e < 128)
|
997
|
+
t(e, 8, n);
|
998
|
+
else if (e < 16384)
|
999
|
+
t(2, 2, n), t(e, 14, n);
|
1000
|
+
else if (e < 1e6)
|
1001
|
+
t(6, 3, n), t(e, 21, n);
|
1002
|
+
else
|
1833
1003
|
throw new RangeError("ECI assignment value out of range");
|
1834
|
-
return new
|
1004
|
+
return new k(k.Mode.ECI, 0, n);
|
1835
1005
|
}
|
1836
1006
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
1837
1007
|
// A string is encodable iff each character is in the range 0 to 9.
|
1838
|
-
static isNumeric(
|
1839
|
-
return
|
1008
|
+
static isNumeric(e) {
|
1009
|
+
return k.NUMERIC_REGEX.test(e);
|
1840
1010
|
}
|
1841
1011
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
1842
1012
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
1843
1013
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
1844
|
-
static isAlphanumeric(
|
1845
|
-
return
|
1014
|
+
static isAlphanumeric(e) {
|
1015
|
+
return k.ALPHANUMERIC_REGEX.test(e);
|
1846
1016
|
}
|
1847
1017
|
/*-- Methods --*/
|
1848
1018
|
// Returns a new copy of the data bits of this segment.
|
@@ -1851,244 +1021,176 @@ var qrcodegen;
|
|
1851
1021
|
}
|
1852
1022
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
1853
1023
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
1854
|
-
static getTotalBits(
|
1855
|
-
let
|
1856
|
-
for (const
|
1857
|
-
const
|
1858
|
-
if (
|
1859
|
-
return
|
1860
|
-
|
1024
|
+
static getTotalBits(e, n) {
|
1025
|
+
let o = 0;
|
1026
|
+
for (const i of e) {
|
1027
|
+
const l = i.mode.numCharCountBits(n);
|
1028
|
+
if (i.numChars >= 1 << l)
|
1029
|
+
return 1 / 0;
|
1030
|
+
o += 4 + l + i.bitData.length;
|
1861
1031
|
}
|
1862
|
-
return
|
1032
|
+
return o;
|
1863
1033
|
}
|
1864
1034
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
1865
|
-
static toUtf8ByteArray(
|
1866
|
-
|
1867
|
-
let
|
1868
|
-
for (let
|
1869
|
-
|
1870
|
-
|
1871
|
-
else {
|
1872
|
-
result.push(parseInt(str.substring(i + 1, i + 3), 16));
|
1873
|
-
i += 2;
|
1874
|
-
}
|
1875
|
-
}
|
1876
|
-
return result;
|
1035
|
+
static toUtf8ByteArray(e) {
|
1036
|
+
e = encodeURI(e);
|
1037
|
+
let n = [];
|
1038
|
+
for (let o = 0; o < e.length; o++)
|
1039
|
+
e.charAt(o) != "%" ? n.push(e.charCodeAt(o)) : (n.push(parseInt(e.substring(o + 1, o + 3), 16)), o += 2);
|
1040
|
+
return n;
|
1877
1041
|
}
|
1878
1042
|
};
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
((QrCode2) => {
|
1887
|
-
const _Ecc = class _Ecc {
|
1043
|
+
h.NUMERIC_REGEX = /^[0-9]*$/, h.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, h.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
1044
|
+
let y = h;
|
1045
|
+
s.QrSegment = h;
|
1046
|
+
})(K || (K = {}));
|
1047
|
+
((s) => {
|
1048
|
+
((r) => {
|
1049
|
+
const t = class {
|
1888
1050
|
// The QR Code can tolerate about 30% erroneous codewords
|
1889
1051
|
/*-- Constructor and fields --*/
|
1890
|
-
constructor(
|
1891
|
-
this.ordinal =
|
1892
|
-
this.formatBits = formatBits;
|
1052
|
+
constructor(u, h) {
|
1053
|
+
this.ordinal = u, this.formatBits = h;
|
1893
1054
|
}
|
1894
1055
|
};
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
})(qrcodegen || (qrcodegen = {}));
|
1902
|
-
((qrcodegen2) => {
|
1903
|
-
((QrSegment2) => {
|
1904
|
-
const _Mode = class _Mode {
|
1056
|
+
t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), r.Ecc = t;
|
1057
|
+
})(s.QrCode || (s.QrCode = {}));
|
1058
|
+
})(K || (K = {}));
|
1059
|
+
((s) => {
|
1060
|
+
((r) => {
|
1061
|
+
const t = class {
|
1905
1062
|
/*-- Constructor and fields --*/
|
1906
|
-
constructor(
|
1907
|
-
this.modeBits =
|
1908
|
-
this.numBitsCharCount = numBitsCharCount;
|
1063
|
+
constructor(u, h) {
|
1064
|
+
this.modeBits = u, this.numBitsCharCount = h;
|
1909
1065
|
}
|
1910
1066
|
/*-- Method --*/
|
1911
1067
|
// (Package-private) Returns the bit width of the character count field for a segment in
|
1912
1068
|
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
1913
|
-
numCharCountBits(
|
1914
|
-
return this.numBitsCharCount[Math.floor((
|
1069
|
+
numCharCountBits(u) {
|
1070
|
+
return this.numBitsCharCount[Math.floor((u + 7) / 17)];
|
1915
1071
|
}
|
1916
1072
|
};
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
_Mode.ECI = new _Mode(7, [0, 0, 0]);
|
1922
|
-
QrSegment2.Mode = _Mode;
|
1923
|
-
})(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
|
1924
|
-
})(qrcodegen || (qrcodegen = {}));
|
1925
|
-
var qrcodegen_default = qrcodegen;
|
1073
|
+
t.NUMERIC = new t(1, [10, 12, 14]), t.ALPHANUMERIC = new t(2, [9, 11, 13]), t.BYTE = new t(4, [8, 16, 16]), t.KANJI = new t(8, [8, 10, 12]), t.ECI = new t(7, [0, 0, 0]), r.Mode = t;
|
1074
|
+
})(s.QrSegment || (s.QrSegment = {}));
|
1075
|
+
})(K || (K = {}));
|
1076
|
+
var Y = K;
|
1926
1077
|
/**
|
1927
1078
|
* @license qrcode.react
|
1928
1079
|
* Copyright (c) Paul O'Shannessy
|
1929
1080
|
* SPDX-License-Identifier: ISC
|
1930
1081
|
*/
|
1931
|
-
var
|
1932
|
-
L:
|
1933
|
-
M:
|
1934
|
-
Q:
|
1935
|
-
H:
|
1936
|
-
};
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
function generatePath(modules, margin = 0) {
|
1947
|
-
const ops = [];
|
1948
|
-
modules.forEach(function(row, y) {
|
1949
|
-
let start = null;
|
1950
|
-
row.forEach(function(cell, x) {
|
1951
|
-
if (!cell && start !== null) {
|
1952
|
-
ops.push(
|
1953
|
-
`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`
|
1954
|
-
);
|
1955
|
-
start = null;
|
1082
|
+
var bt = {
|
1083
|
+
L: Y.QrCode.Ecc.LOW,
|
1084
|
+
M: Y.QrCode.Ecc.MEDIUM,
|
1085
|
+
Q: Y.QrCode.Ecc.QUARTILE,
|
1086
|
+
H: Y.QrCode.Ecc.HIGH
|
1087
|
+
}, Me = 128, ke = "L", Re = "#FFFFFF", Se = "#000000", Le = !1, Pe = 1, At = 4, vt = 0, Tt = 0.1;
|
1088
|
+
function Oe(s, r = 0) {
|
1089
|
+
const t = [];
|
1090
|
+
return s.forEach(function(c, u) {
|
1091
|
+
let h = null;
|
1092
|
+
c.forEach(function(y, w) {
|
1093
|
+
if (!y && h !== null) {
|
1094
|
+
t.push(
|
1095
|
+
`M${h + r} ${u + r}h${w - h}v1H${h + r}z`
|
1096
|
+
), h = null;
|
1956
1097
|
return;
|
1957
1098
|
}
|
1958
|
-
if (
|
1959
|
-
if (!
|
1099
|
+
if (w === c.length - 1) {
|
1100
|
+
if (!y)
|
1960
1101
|
return;
|
1961
|
-
}
|
1962
|
-
|
1963
|
-
|
1964
|
-
} else {
|
1965
|
-
ops.push(
|
1966
|
-
`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`
|
1967
|
-
);
|
1968
|
-
}
|
1102
|
+
h === null ? t.push(`M${w + r},${u + r} h1v1H${w + r}z`) : t.push(
|
1103
|
+
`M${h + r},${u + r} h${w + 1 - h}v1H${h + r}z`
|
1104
|
+
);
|
1969
1105
|
return;
|
1970
1106
|
}
|
1971
|
-
|
1972
|
-
start = x;
|
1973
|
-
}
|
1107
|
+
y && h === null && (h = w);
|
1974
1108
|
});
|
1975
|
-
});
|
1976
|
-
return ops.join("");
|
1109
|
+
}), t.join("");
|
1977
1110
|
}
|
1978
|
-
function
|
1979
|
-
return
|
1980
|
-
if (y < excavation.y || y >= excavation.y + excavation.h) {
|
1981
|
-
return row;
|
1982
|
-
}
|
1983
|
-
return row.map((cell, x) => {
|
1984
|
-
if (x < excavation.x || x >= excavation.x + excavation.w) {
|
1985
|
-
return cell;
|
1986
|
-
}
|
1987
|
-
return false;
|
1988
|
-
});
|
1989
|
-
});
|
1111
|
+
function De(s, r) {
|
1112
|
+
return s.slice().map((t, c) => c < r.y || c >= r.y + r.h ? t : t.map((u, h) => h < r.x || h >= r.x + r.w ? u : !1));
|
1990
1113
|
}
|
1991
|
-
function
|
1992
|
-
if (
|
1114
|
+
function Ct(s, r, t, c) {
|
1115
|
+
if (c == null)
|
1993
1116
|
return null;
|
1117
|
+
const u = s.length + t * 2, h = Math.floor(r * Tt), y = u / r, w = (c.width || h) * y, e = (c.height || h) * y, n = c.x == null ? s.length / 2 - w / 2 : c.x * y, o = c.y == null ? s.length / 2 - e / 2 : c.y * y, i = c.opacity == null ? 1 : c.opacity;
|
1118
|
+
let l = null;
|
1119
|
+
if (c.excavate) {
|
1120
|
+
let d = Math.floor(n), m = Math.floor(o), g = Math.ceil(w + n - d), b = Math.ceil(e + o - m);
|
1121
|
+
l = { x: d, y: m, w: g, h: b };
|
1994
1122
|
}
|
1995
|
-
const
|
1996
|
-
|
1997
|
-
const scale = numCells / size;
|
1998
|
-
const w = (imageSettings.width || defaultSize) * scale;
|
1999
|
-
const h = (imageSettings.height || defaultSize) * scale;
|
2000
|
-
const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
|
2001
|
-
const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
|
2002
|
-
const opacity = imageSettings.opacity == null ? 1 : imageSettings.opacity;
|
2003
|
-
let excavation = null;
|
2004
|
-
if (imageSettings.excavate) {
|
2005
|
-
let floorX = Math.floor(x);
|
2006
|
-
let floorY = Math.floor(y);
|
2007
|
-
let ceilW = Math.ceil(w + x - floorX);
|
2008
|
-
let ceilH = Math.ceil(h + y - floorY);
|
2009
|
-
excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
|
2010
|
-
}
|
2011
|
-
const crossOrigin = imageSettings.crossOrigin;
|
2012
|
-
return { x, y, h, w, excavation, opacity, crossOrigin };
|
1123
|
+
const f = c.crossOrigin;
|
1124
|
+
return { x: n, y: o, h: e, w, excavation: l, opacity: i, crossOrigin: f };
|
2013
1125
|
}
|
2014
|
-
function
|
2015
|
-
|
2016
|
-
return Math.max(Math.floor(marginSize), 0);
|
2017
|
-
}
|
2018
|
-
return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
|
1126
|
+
function jt(s, r) {
|
1127
|
+
return r != null ? Math.max(Math.floor(r), 0) : s ? At : vt;
|
2019
1128
|
}
|
2020
|
-
function
|
2021
|
-
value,
|
2022
|
-
level,
|
2023
|
-
minVersion,
|
2024
|
-
includeMargin,
|
2025
|
-
marginSize,
|
2026
|
-
imageSettings,
|
2027
|
-
size,
|
2028
|
-
boostLevel
|
1129
|
+
function Ue({
|
1130
|
+
value: s,
|
1131
|
+
level: r,
|
1132
|
+
minVersion: t,
|
1133
|
+
includeMargin: c,
|
1134
|
+
marginSize: u,
|
1135
|
+
imageSettings: h,
|
1136
|
+
size: y,
|
1137
|
+
boostLevel: w
|
2029
1138
|
}) {
|
2030
|
-
let
|
2031
|
-
const
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
return qrcodegen_default.QrCode.encodeSegments(
|
2037
|
-
segments,
|
2038
|
-
ERROR_LEVEL_MAP[level],
|
2039
|
-
minVersion,
|
1139
|
+
let e = S.useMemo(() => {
|
1140
|
+
const d = (Array.isArray(s) ? s : [s]).reduce((m, g) => (m.push(...Y.QrSegment.makeSegments(g)), m), []);
|
1141
|
+
return Y.QrCode.encodeSegments(
|
1142
|
+
d,
|
1143
|
+
bt[r],
|
1144
|
+
t,
|
2040
1145
|
void 0,
|
2041
1146
|
void 0,
|
2042
|
-
|
1147
|
+
w
|
2043
1148
|
);
|
2044
|
-
}, [
|
2045
|
-
const { cells, margin, numCells, calculatedImageSettings } =
|
2046
|
-
let
|
2047
|
-
const
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
margin2,
|
2053
|
-
imageSettings
|
1149
|
+
}, [s, r, t, w]);
|
1150
|
+
const { cells: n, margin: o, numCells: i, calculatedImageSettings: l } = S.useMemo(() => {
|
1151
|
+
let f = e.getModules();
|
1152
|
+
const d = jt(c, u), m = f.length + d * 2, g = Ct(
|
1153
|
+
f,
|
1154
|
+
y,
|
1155
|
+
d,
|
1156
|
+
h
|
2054
1157
|
);
|
2055
1158
|
return {
|
2056
|
-
cells:
|
2057
|
-
margin:
|
2058
|
-
numCells:
|
2059
|
-
calculatedImageSettings:
|
1159
|
+
cells: f,
|
1160
|
+
margin: d,
|
1161
|
+
numCells: m,
|
1162
|
+
calculatedImageSettings: g
|
2060
1163
|
};
|
2061
|
-
}, [
|
1164
|
+
}, [e, y, h, c, u]);
|
2062
1165
|
return {
|
2063
|
-
qrcode,
|
2064
|
-
margin,
|
2065
|
-
cells,
|
2066
|
-
numCells,
|
2067
|
-
calculatedImageSettings
|
1166
|
+
qrcode: e,
|
1167
|
+
margin: o,
|
1168
|
+
cells: n,
|
1169
|
+
numCells: i,
|
1170
|
+
calculatedImageSettings: l
|
2068
1171
|
};
|
2069
1172
|
}
|
2070
|
-
var
|
1173
|
+
var Mt = function() {
|
2071
1174
|
try {
|
2072
1175
|
new Path2D().addPath(new Path2D());
|
2073
|
-
} catch (
|
2074
|
-
return
|
1176
|
+
} catch (s) {
|
1177
|
+
return !1;
|
2075
1178
|
}
|
2076
|
-
return
|
2077
|
-
}()
|
2078
|
-
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
2090
|
-
|
2091
|
-
} = _a, extraProps = __objRest(_a, [
|
1179
|
+
return !0;
|
1180
|
+
}(), kt = S.forwardRef(
|
1181
|
+
function(r, t) {
|
1182
|
+
const c = r, {
|
1183
|
+
value: u,
|
1184
|
+
size: h = Me,
|
1185
|
+
level: y = ke,
|
1186
|
+
bgColor: w = Re,
|
1187
|
+
fgColor: e = Se,
|
1188
|
+
includeMargin: n = Le,
|
1189
|
+
minVersion: o = Pe,
|
1190
|
+
boostLevel: i,
|
1191
|
+
marginSize: l,
|
1192
|
+
imageSettings: f
|
1193
|
+
} = c, m = ce(c, [
|
2092
1194
|
"value",
|
2093
1195
|
"size",
|
2094
1196
|
"level",
|
@@ -2099,131 +1201,92 @@ var QRCodeCanvas = React.forwardRef(
|
|
2099
1201
|
"boostLevel",
|
2100
1202
|
"marginSize",
|
2101
1203
|
"imageSettings"
|
2102
|
-
])
|
2103
|
-
|
2104
|
-
|
2105
|
-
const _canvas = React.useRef(null);
|
2106
|
-
const _image = React.useRef(null);
|
2107
|
-
const setCanvasRef = React.useCallback(
|
2108
|
-
(node) => {
|
2109
|
-
_canvas.current = node;
|
2110
|
-
if (typeof forwardedRef === "function") {
|
2111
|
-
forwardedRef(node);
|
2112
|
-
} else if (forwardedRef) {
|
2113
|
-
forwardedRef.current = node;
|
2114
|
-
}
|
1204
|
+
]), { style: g } = m, b = ce(m, ["style"]), v = f == null ? void 0 : f.src, p = S.useRef(null), j = S.useRef(null), M = S.useCallback(
|
1205
|
+
(W) => {
|
1206
|
+
p.current = W, typeof t == "function" ? t(W) : t && (t.current = W);
|
2115
1207
|
},
|
2116
|
-
[
|
2117
|
-
)
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
imageSettings,
|
2127
|
-
size
|
1208
|
+
[t]
|
1209
|
+
), [F, V] = S.useState(!1), { margin: x, cells: T, numCells: q, calculatedImageSettings: I } = Ue({
|
1210
|
+
value: u,
|
1211
|
+
level: y,
|
1212
|
+
minVersion: o,
|
1213
|
+
boostLevel: i,
|
1214
|
+
includeMargin: n,
|
1215
|
+
marginSize: l,
|
1216
|
+
imageSettings: f,
|
1217
|
+
size: h
|
2128
1218
|
});
|
2129
|
-
|
2130
|
-
if (
|
2131
|
-
const
|
2132
|
-
|
2133
|
-
if (!ctx) {
|
1219
|
+
S.useEffect(() => {
|
1220
|
+
if (p.current != null) {
|
1221
|
+
const W = p.current, O = W.getContext("2d");
|
1222
|
+
if (!O)
|
2134
1223
|
return;
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
const pixelRatio = window.devicePixelRatio || 1;
|
2148
|
-
canvas.height = canvas.width = size * pixelRatio;
|
2149
|
-
const scale = size / numCells * pixelRatio;
|
2150
|
-
ctx.scale(scale, scale);
|
2151
|
-
ctx.fillStyle = bgColor;
|
2152
|
-
ctx.fillRect(0, 0, numCells, numCells);
|
2153
|
-
ctx.fillStyle = fgColor;
|
2154
|
-
if (SUPPORTS_PATH2D) {
|
2155
|
-
ctx.fill(new Path2D(generatePath(cellsToDraw, margin)));
|
2156
|
-
} else {
|
2157
|
-
cells.forEach(function(row, rdx) {
|
2158
|
-
row.forEach(function(cell, cdx) {
|
2159
|
-
if (cell) {
|
2160
|
-
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
|
2161
|
-
}
|
2162
|
-
});
|
1224
|
+
let $ = T;
|
1225
|
+
const H = j.current, te = I != null && H !== null && H.complete && H.naturalHeight !== 0 && H.naturalWidth !== 0;
|
1226
|
+
te && I.excavation != null && ($ = De(
|
1227
|
+
T,
|
1228
|
+
I.excavation
|
1229
|
+
));
|
1230
|
+
const X = window.devicePixelRatio || 1;
|
1231
|
+
W.height = W.width = h * X;
|
1232
|
+
const G = h / q * X;
|
1233
|
+
O.scale(G, G), O.fillStyle = w, O.fillRect(0, 0, q, q), O.fillStyle = e, Mt ? O.fill(new Path2D(Oe($, x))) : T.forEach(function(oe, re) {
|
1234
|
+
oe.forEach(function(ae, L) {
|
1235
|
+
ae && O.fillRect(L + x, re + x, 1, 1);
|
2163
1236
|
});
|
2164
|
-
}
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
calculatedImageSettings.x + margin,
|
2172
|
-
calculatedImageSettings.y + margin,
|
2173
|
-
calculatedImageSettings.w,
|
2174
|
-
calculatedImageSettings.h
|
2175
|
-
);
|
2176
|
-
}
|
1237
|
+
}), I && (O.globalAlpha = I.opacity), te && O.drawImage(
|
1238
|
+
H,
|
1239
|
+
I.x + x,
|
1240
|
+
I.y + x,
|
1241
|
+
I.w,
|
1242
|
+
I.h
|
1243
|
+
);
|
2177
1244
|
}
|
2178
|
-
})
|
2179
|
-
|
2180
|
-
|
2181
|
-
},
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
}
|
2197
|
-
);
|
2198
|
-
}
|
2199
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
1245
|
+
}), S.useEffect(() => {
|
1246
|
+
V(!1);
|
1247
|
+
}, [v]);
|
1248
|
+
const B = ie({ height: h, width: h }, g);
|
1249
|
+
let ee = null;
|
1250
|
+
return v != null && (ee = /* @__PURE__ */ S.createElement(
|
1251
|
+
"img",
|
1252
|
+
{
|
1253
|
+
src: v,
|
1254
|
+
key: v,
|
1255
|
+
style: { display: "none" },
|
1256
|
+
onLoad: () => {
|
1257
|
+
V(!0);
|
1258
|
+
},
|
1259
|
+
ref: j,
|
1260
|
+
crossOrigin: I == null ? void 0 : I.crossOrigin
|
1261
|
+
}
|
1262
|
+
)), /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement(
|
2200
1263
|
"canvas",
|
2201
|
-
|
2202
|
-
style:
|
2203
|
-
height:
|
2204
|
-
width:
|
2205
|
-
ref:
|
1264
|
+
ie({
|
1265
|
+
style: B,
|
1266
|
+
height: h,
|
1267
|
+
width: h,
|
1268
|
+
ref: M,
|
2206
1269
|
role: "img"
|
2207
|
-
},
|
2208
|
-
),
|
1270
|
+
}, b)
|
1271
|
+
), ee);
|
2209
1272
|
}
|
2210
1273
|
);
|
2211
|
-
|
2212
|
-
var
|
2213
|
-
function
|
2214
|
-
const
|
2215
|
-
value,
|
2216
|
-
size =
|
2217
|
-
level =
|
2218
|
-
bgColor =
|
2219
|
-
fgColor =
|
2220
|
-
includeMargin =
|
2221
|
-
minVersion =
|
2222
|
-
boostLevel,
|
2223
|
-
title,
|
2224
|
-
marginSize,
|
2225
|
-
imageSettings
|
2226
|
-
} =
|
1274
|
+
kt.displayName = "QRCodeCanvas";
|
1275
|
+
var Ie = S.forwardRef(
|
1276
|
+
function(r, t) {
|
1277
|
+
const c = r, {
|
1278
|
+
value: u,
|
1279
|
+
size: h = Me,
|
1280
|
+
level: y = ke,
|
1281
|
+
bgColor: w = Re,
|
1282
|
+
fgColor: e = Se,
|
1283
|
+
includeMargin: n = Le,
|
1284
|
+
minVersion: o = Pe,
|
1285
|
+
boostLevel: i,
|
1286
|
+
title: l,
|
1287
|
+
marginSize: f,
|
1288
|
+
imageSettings: d
|
1289
|
+
} = c, m = ce(c, [
|
2227
1290
|
"value",
|
2228
1291
|
"size",
|
2229
1292
|
"level",
|
@@ -2235,152 +1298,126 @@ var QRCodeSVG = React.forwardRef(
|
|
2235
1298
|
"title",
|
2236
1299
|
"marginSize",
|
2237
1300
|
"imageSettings"
|
2238
|
-
])
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
size
|
1301
|
+
]), { margin: g, cells: b, numCells: v, calculatedImageSettings: p } = Ue({
|
1302
|
+
value: u,
|
1303
|
+
level: y,
|
1304
|
+
minVersion: o,
|
1305
|
+
boostLevel: i,
|
1306
|
+
includeMargin: n,
|
1307
|
+
marginSize: f,
|
1308
|
+
imageSettings: d,
|
1309
|
+
size: h
|
2248
1310
|
});
|
2249
|
-
let
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
crossOrigin: calculatedImageSettings.crossOrigin
|
2269
|
-
}
|
2270
|
-
);
|
2271
|
-
}
|
2272
|
-
const fgPath = generatePath(cellsToDraw, margin);
|
2273
|
-
return /* @__PURE__ */ React.createElement(
|
1311
|
+
let j = b, M = null;
|
1312
|
+
d != null && p != null && (p.excavation != null && (j = De(
|
1313
|
+
b,
|
1314
|
+
p.excavation
|
1315
|
+
)), M = /* @__PURE__ */ S.createElement(
|
1316
|
+
"image",
|
1317
|
+
{
|
1318
|
+
href: d.src,
|
1319
|
+
height: p.h,
|
1320
|
+
width: p.w,
|
1321
|
+
x: p.x + g,
|
1322
|
+
y: p.y + g,
|
1323
|
+
preserveAspectRatio: "none",
|
1324
|
+
opacity: p.opacity,
|
1325
|
+
crossOrigin: p.crossOrigin
|
1326
|
+
}
|
1327
|
+
));
|
1328
|
+
const F = Oe(j, g);
|
1329
|
+
return /* @__PURE__ */ S.createElement(
|
2274
1330
|
"svg",
|
2275
|
-
|
2276
|
-
height:
|
2277
|
-
width:
|
2278
|
-
viewBox: `0 0 ${
|
2279
|
-
ref:
|
1331
|
+
ie({
|
1332
|
+
height: h,
|
1333
|
+
width: h,
|
1334
|
+
viewBox: `0 0 ${v} ${v}`,
|
1335
|
+
ref: t,
|
2280
1336
|
role: "img"
|
2281
|
-
},
|
2282
|
-
!!
|
2283
|
-
/* @__PURE__ */
|
1337
|
+
}, m),
|
1338
|
+
!!l && /* @__PURE__ */ S.createElement("title", null, l),
|
1339
|
+
/* @__PURE__ */ S.createElement(
|
2284
1340
|
"path",
|
2285
1341
|
{
|
2286
|
-
fill:
|
2287
|
-
d: `M0,0 h${
|
1342
|
+
fill: w,
|
1343
|
+
d: `M0,0 h${v}v${v}H0z`,
|
2288
1344
|
shapeRendering: "crispEdges"
|
2289
1345
|
}
|
2290
1346
|
),
|
2291
|
-
/* @__PURE__ */
|
2292
|
-
|
1347
|
+
/* @__PURE__ */ S.createElement("path", { fill: e, d: F, shapeRendering: "crispEdges" }),
|
1348
|
+
M
|
2293
1349
|
);
|
2294
1350
|
}
|
2295
1351
|
);
|
2296
|
-
|
2297
|
-
const
|
2298
|
-
walletAddress,
|
2299
|
-
amount,
|
2300
|
-
currency,
|
2301
|
-
theme = "light",
|
2302
|
-
size = 200
|
1352
|
+
Ie.displayName = "QRCodeSVG";
|
1353
|
+
const Vt = ({
|
1354
|
+
walletAddress: s,
|
1355
|
+
amount: r,
|
1356
|
+
currency: t,
|
1357
|
+
theme: c = "light",
|
1358
|
+
size: u = 200
|
2303
1359
|
}) => {
|
2304
|
-
const [
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
setQrError("No wallet address provided");
|
1360
|
+
const [h, y] = U(""), [w, e] = U(null);
|
1361
|
+
Z(() => {
|
1362
|
+
if (!s) {
|
1363
|
+
e("No wallet address provided");
|
2309
1364
|
return;
|
2310
1365
|
}
|
2311
1366
|
try {
|
2312
|
-
let
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
const tokenAddresses = {
|
2330
|
-
"USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
2331
|
-
"USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
2332
|
-
"BNB": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52"
|
2333
|
-
};
|
2334
|
-
return tokenAddresses[currency2] || "";
|
2335
|
-
};
|
2336
|
-
const convertToSmallestUnit = (amount2, currency2) => {
|
2337
|
-
const decimals = currency2 === "USDT" || currency2 === "USDC" ? 6 : 18;
|
2338
|
-
return Math.floor(parseFloat(amount2) * Math.pow(10, decimals)).toString();
|
2339
|
-
};
|
2340
|
-
const convertToWei = (amount2) => {
|
2341
|
-
return Math.floor(parseFloat(amount2) * 1e18).toString();
|
2342
|
-
};
|
2343
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center", children: [
|
2344
|
-
qrError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-red-100 mb-3 text-red-700", children: qrError }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-white mb-3", children: qrData && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2345
|
-
QRCodeSVG,
|
1367
|
+
let l;
|
1368
|
+
t === "SOL" || t === "USDC_SOL" ? l = `solana:${s}?amount=${r}&spl-token=USDC` : t === "USDT" || t === "USDC" ? l = `ethereum:${n(t)}/transfer?address=${s}&uint256=${o(r, t)}` : l = `ethereum:${s}@1?value=${i(r)}`, y(l), e(null);
|
1369
|
+
} catch (l) {
|
1370
|
+
console.error("Error generating QR code:", l), e("Error generating payment QR code");
|
1371
|
+
}
|
1372
|
+
}, [s, r, t]);
|
1373
|
+
const n = (l) => ({
|
1374
|
+
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
1375
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
1376
|
+
BNB: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52"
|
1377
|
+
})[l] || "", o = (l, f) => {
|
1378
|
+
const d = f === "USDT" || f === "USDC" ? 6 : 18;
|
1379
|
+
return Math.floor(parseFloat(l) * Math.pow(10, d)).toString();
|
1380
|
+
}, i = (l) => Math.floor(parseFloat(l) * 1e18).toString();
|
1381
|
+
return /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col items-center", children: [
|
1382
|
+
w ? /* @__PURE__ */ a.jsx("div", { className: "p-4 rounded-lg bg-red-100 mb-3 text-red-700", children: w }) : /* @__PURE__ */ a.jsx("div", { className: "p-4 rounded-lg bg-white mb-3", children: h && /* @__PURE__ */ a.jsx(
|
1383
|
+
Ie,
|
2346
1384
|
{
|
2347
|
-
value:
|
2348
|
-
size,
|
2349
|
-
bgColor:
|
2350
|
-
fgColor:
|
1385
|
+
value: h,
|
1386
|
+
size: u,
|
1387
|
+
bgColor: c === "dark" ? "#374151" : "#FFFFFF",
|
1388
|
+
fgColor: c === "dark" ? "#FFFFFF" : "#000000",
|
2351
1389
|
level: "H",
|
2352
|
-
includeMargin:
|
1390
|
+
includeMargin: !0
|
2353
1391
|
}
|
2354
1392
|
) }),
|
2355
|
-
/* @__PURE__ */
|
2356
|
-
/* @__PURE__ */
|
1393
|
+
/* @__PURE__ */ a.jsxs("div", { className: "text-center text-sm text-gray-700", children: [
|
1394
|
+
/* @__PURE__ */ a.jsx("p", { className: "font-semibold text-gray-800", children: "Pay with QR Code" }),
|
2357
1395
|
"Scan with your wallet app to pay"
|
2358
1396
|
] }),
|
2359
|
-
/* @__PURE__ */
|
2360
|
-
/* @__PURE__ */
|
2361
|
-
/* @__PURE__ */
|
2362
|
-
/* @__PURE__ */
|
2363
|
-
/* @__PURE__ */
|
2364
|
-
/* @__PURE__ */
|
2365
|
-
/* @__PURE__ */
|
1397
|
+
/* @__PURE__ */ a.jsx("div", { className: "mt-3 w-full" }),
|
1398
|
+
/* @__PURE__ */ a.jsx("div", { className: "mt-4 w-full", children: /* @__PURE__ */ a.jsxs("div", { className: "p-3 rounded bg-gray-100", children: [
|
1399
|
+
/* @__PURE__ */ a.jsx("h4", { className: "text-sm font-medium mb-2 text-gray-800", children: "Payment Instructions" }),
|
1400
|
+
/* @__PURE__ */ a.jsxs("ol", { className: "text-xs space-y-2 text-gray-600", children: [
|
1401
|
+
/* @__PURE__ */ a.jsx("li", { children: "1. Open your crypto wallet app (MetaMask, Trust Wallet, etc.)" }),
|
1402
|
+
/* @__PURE__ */ a.jsx("li", { children: "2. Scan the QR code above" }),
|
1403
|
+
/* @__PURE__ */ a.jsxs("li", { children: [
|
2366
1404
|
"3. Confirm the payment amount (",
|
2367
|
-
|
1405
|
+
r,
|
2368
1406
|
" ",
|
2369
|
-
|
1407
|
+
t,
|
2370
1408
|
")"
|
2371
1409
|
] }),
|
2372
|
-
/* @__PURE__ */
|
1410
|
+
/* @__PURE__ */ a.jsx("li", { children: '4. Click "Pay Now" button below after sending the payment' })
|
2373
1411
|
] })
|
2374
1412
|
] }) })
|
2375
1413
|
] });
|
2376
|
-
}
|
2377
|
-
const
|
2378
|
-
|
2379
|
-
switch (status) {
|
1414
|
+
}, le = ({ status: s, message: r, theme: t = "light" }) => {
|
1415
|
+
const c = () => {
|
1416
|
+
switch (s) {
|
2380
1417
|
case "processing":
|
2381
|
-
return /* @__PURE__ */
|
1418
|
+
return /* @__PURE__ */ a.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
|
2382
1419
|
case "success":
|
2383
|
-
return /* @__PURE__ */
|
1420
|
+
return /* @__PURE__ */ a.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ a.jsx(
|
2384
1421
|
"svg",
|
2385
1422
|
{
|
2386
1423
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -2389,11 +1426,11 @@ const PaymentStatus = ({ status, message, theme = "light" }) => {
|
|
2389
1426
|
viewBox: "0 0 24 24",
|
2390
1427
|
stroke: "currentColor",
|
2391
1428
|
strokeWidth: 2,
|
2392
|
-
children: /* @__PURE__ */
|
1429
|
+
children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
2393
1430
|
}
|
2394
1431
|
) });
|
2395
1432
|
case "error":
|
2396
|
-
return /* @__PURE__ */
|
1433
|
+
return /* @__PURE__ */ a.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ a.jsx(
|
2397
1434
|
"svg",
|
2398
1435
|
{
|
2399
1436
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -2402,15 +1439,14 @@ const PaymentStatus = ({ status, message, theme = "light" }) => {
|
|
2402
1439
|
viewBox: "0 0 24 24",
|
2403
1440
|
stroke: "currentColor",
|
2404
1441
|
strokeWidth: 2,
|
2405
|
-
children: /* @__PURE__ */
|
1442
|
+
children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
2406
1443
|
}
|
2407
1444
|
) });
|
2408
1445
|
default:
|
2409
1446
|
return null;
|
2410
1447
|
}
|
2411
|
-
}
|
2412
|
-
|
2413
|
-
switch (status) {
|
1448
|
+
}, u = () => {
|
1449
|
+
switch (s) {
|
2414
1450
|
case "processing":
|
2415
1451
|
return "Processing Payment";
|
2416
1452
|
case "success":
|
@@ -2420,675 +1456,596 @@ const PaymentStatus = ({ status, message, theme = "light" }) => {
|
|
2420
1456
|
default:
|
2421
1457
|
return "Unknown Status";
|
2422
1458
|
}
|
2423
|
-
}
|
2424
|
-
|
2425
|
-
switch (status) {
|
1459
|
+
}, h = () => {
|
1460
|
+
switch (s) {
|
2426
1461
|
case "processing":
|
2427
|
-
return
|
1462
|
+
return t === "dark" ? "text-blue-300" : "text-blue-600";
|
2428
1463
|
case "success":
|
2429
|
-
return
|
1464
|
+
return t === "dark" ? "text-green-300" : "text-green-600";
|
2430
1465
|
case "error":
|
2431
|
-
return
|
1466
|
+
return t === "dark" ? "text-red-300" : "text-red-600";
|
2432
1467
|
default:
|
2433
|
-
return
|
1468
|
+
return t === "dark" ? "text-gray-300" : "text-gray-600";
|
2434
1469
|
}
|
2435
1470
|
};
|
2436
|
-
return /* @__PURE__ */
|
2437
|
-
/* @__PURE__ */
|
2438
|
-
/* @__PURE__ */
|
2439
|
-
/* @__PURE__ */
|
2440
|
-
|
2441
|
-
|
1471
|
+
return /* @__PURE__ */ a.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
1472
|
+
/* @__PURE__ */ a.jsx("div", { className: "mb-4", children: c() }),
|
1473
|
+
/* @__PURE__ */ a.jsx("h3", { className: `text-xl font-bold mb-2 ${t === "dark" ? "text-white" : "text-gray-900"}`, children: u() }),
|
1474
|
+
/* @__PURE__ */ a.jsx("p", { className: `text-center ${h()}`, children: r }),
|
1475
|
+
s === "processing" && /* @__PURE__ */ a.jsx("div", { className: `mt-4 text-xs ${t === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
|
1476
|
+
s === "success" && /* @__PURE__ */ a.jsx("div", { className: `mt-4 p-2 rounded ${t === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ a.jsx("p", { className: `text-xs ${t === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
|
2442
1477
|
] });
|
2443
|
-
}
|
2444
|
-
const
|
2445
|
-
|
1478
|
+
}, Rt = ({ onSelect: s, selected: r, theme: t = "light", supportedNetworks: c = [] }) => {
|
1479
|
+
const [u, h] = U({}), [y, w] = U(A.ETHEREUM);
|
1480
|
+
Z(() => {
|
1481
|
+
h(ue());
|
1482
|
+
}, []);
|
1483
|
+
const e = [
|
2446
1484
|
{
|
2447
1485
|
id: "USDT",
|
2448
1486
|
name: "USDT",
|
2449
1487
|
description: "Tether USD",
|
2450
|
-
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s"
|
1488
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s",
|
1489
|
+
networks: [A.ETHEREUM, A.BSC, A.TRON]
|
2451
1490
|
},
|
2452
1491
|
{
|
2453
1492
|
id: "USDC",
|
2454
1493
|
name: "USDC",
|
2455
1494
|
description: "USD Coin",
|
2456
|
-
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s"
|
1495
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s",
|
1496
|
+
networks: [A.ETHEREUM, A.BSC, A.TRON]
|
2457
1497
|
},
|
2458
1498
|
{
|
2459
1499
|
id: "BNB",
|
2460
1500
|
name: "BNB",
|
2461
1501
|
description: "Binance Coin",
|
2462
|
-
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRHSjyW2sSnBhwztCwVW97i1BtV40g7heMMxg&s"
|
1502
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRHSjyW2sSnBhwztCwVW97i1BtV40g7heMMxg&s",
|
1503
|
+
networks: [A.BSC]
|
2463
1504
|
},
|
2464
1505
|
{
|
2465
|
-
id: "
|
2466
|
-
name: "
|
2467
|
-
description: "
|
2468
|
-
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
1506
|
+
id: "ETH",
|
1507
|
+
name: "ETH",
|
1508
|
+
description: "Ethereum",
|
1509
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcyJyRKN0dRJWVZqoLzYgkRHdJsxKGq8nHUw&s",
|
1510
|
+
networks: [A.ETHEREUM]
|
1511
|
+
},
|
1512
|
+
{
|
1513
|
+
id: "TRX",
|
1514
|
+
name: "TRX",
|
1515
|
+
description: "Tron",
|
1516
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQKLpLNsGRHbZfCUXAjZLPSp_YFZvX5dMnAoA&s",
|
1517
|
+
networks: [A.TRON]
|
1518
|
+
},
|
1519
|
+
{
|
1520
|
+
id: "ALGO",
|
1521
|
+
name: "ALGO",
|
1522
|
+
description: "Algorand",
|
1523
|
+
logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0Yx1Vp8qPQI5XZoJuKfQS8bj_FNiMZGCHqA&s",
|
1524
|
+
networks: [A.ALGORAND]
|
1525
|
+
}
|
1526
|
+
], n = e.filter((d) => c.length === 0 ? !0 : d.networks.some((m) => c.includes(m))), o = (d) => {
|
1527
|
+
const m = e.find((g) => g.id === d);
|
1528
|
+
return m ? m.networks : [];
|
1529
|
+
}, i = (d) => ({
|
1530
|
+
[A.ETHEREUM]: "Ethereum",
|
1531
|
+
[A.BSC]: "BSC",
|
1532
|
+
[A.TRON]: "Tron",
|
1533
|
+
[A.ALGORAND]: "Algorand"
|
1534
|
+
})[d] || d, l = (d) => Ne(d).length > 0, f = (d, m) => {
|
1535
|
+
var g;
|
1536
|
+
w(m), s({
|
1537
|
+
currency: d,
|
1538
|
+
network: m,
|
1539
|
+
tokenConfig: (g = Xe[d]) == null ? void 0 : g[m]
|
1540
|
+
});
|
2473
1541
|
};
|
2474
|
-
return /* @__PURE__ */
|
2475
|
-
/* @__PURE__ */
|
2476
|
-
/* @__PURE__ */
|
2477
|
-
|
2478
|
-
{
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
"
|
1542
|
+
return /* @__PURE__ */ a.jsxs("div", { children: [
|
1543
|
+
/* @__PURE__ */ a.jsx("h3", { className: `text-lg font-medium mb-3 ${t === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
|
1544
|
+
/* @__PURE__ */ a.jsx("div", { className: "space-y-3", children: n.map((d) => {
|
1545
|
+
const m = o(d.id), g = (r == null ? void 0 : r.currency) === d.id;
|
1546
|
+
return /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
|
1547
|
+
/* @__PURE__ */ a.jsxs("div", { className: `flex items-center p-3 rounded-lg border-2 transition-colors ${g ? t === "dark" ? "bg-blue-900/30 border-[#7042D2]" : "bg-blue-50 border-[#7042D2]" : t === "dark" ? "bg-gray-700 border-gray-700" : "bg-white border-gray-200"}`, children: [
|
1548
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3", children: /* @__PURE__ */ a.jsx("img", { src: d.logo, alt: d.name, className: "h-6 w-6" }) }),
|
1549
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex-1", children: [
|
1550
|
+
/* @__PURE__ */ a.jsx("h4", { className: `font-medium ${t === "dark" ? "text-white" : "text-gray-900"}`, children: d.name }),
|
1551
|
+
/* @__PURE__ */ a.jsx("p", { className: `text-sm ${t === "dark" ? "text-gray-300" : "text-gray-500"}`, children: d.description })
|
1552
|
+
] })
|
1553
|
+
] }),
|
1554
|
+
m.length > 1 && /* @__PURE__ */ a.jsxs("div", { className: "ml-4 space-y-2", children: [
|
1555
|
+
/* @__PURE__ */ a.jsx("p", { className: `text-sm font-medium ${t === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Select Network:" }),
|
1556
|
+
/* @__PURE__ */ a.jsx("div", { className: "grid grid-cols-2 gap-2", children: m.map((b) => {
|
1557
|
+
const v = g && (r == null ? void 0 : r.network) === b, p = l(b);
|
1558
|
+
return /* @__PURE__ */ a.jsx(
|
1559
|
+
"button",
|
1560
|
+
{
|
1561
|
+
onClick: () => f(d.id, b),
|
1562
|
+
disabled: !p,
|
1563
|
+
className: `p-2 rounded-md text-sm font-medium transition-colors ${v ? "bg-[#7042D2] text-white" : p ? t === "dark" ? "bg-gray-600 text-gray-200 hover:bg-gray-500" : "bg-gray-100 text-gray-700 hover:bg-gray-200" : t === "dark" ? "bg-gray-800 text-gray-500 cursor-not-allowed" : "bg-gray-50 text-gray-400 cursor-not-allowed"}`,
|
1564
|
+
children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-center space-x-1", children: [
|
1565
|
+
/* @__PURE__ */ a.jsx("span", { children: i(b) }),
|
1566
|
+
!p && /* @__PURE__ */ a.jsx("span", { className: "text-xs", children: "(No wallet)" })
|
1567
|
+
] })
|
1568
|
+
},
|
1569
|
+
b
|
1570
|
+
);
|
1571
|
+
}) })
|
1572
|
+
] }),
|
1573
|
+
m.length === 1 && /* @__PURE__ */ a.jsx("div", { className: "ml-4", children: /* @__PURE__ */ a.jsx(
|
1574
|
+
"button",
|
1575
|
+
{
|
1576
|
+
onClick: () => f(d.id, m[0]),
|
1577
|
+
disabled: !l(m[0]),
|
1578
|
+
className: `w-full p-2 rounded-md text-sm font-medium transition-colors ${g ? "bg-[#7042D2] text-white" : l(m[0]) ? t === "dark" ? "bg-gray-600 text-gray-200 hover:bg-gray-500" : "bg-gray-100 text-gray-700 hover:bg-gray-200" : t === "dark" ? "bg-gray-800 text-gray-500 cursor-not-allowed" : "bg-gray-50 text-gray-400 cursor-not-allowed"}`,
|
1579
|
+
children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between", children: [
|
1580
|
+
/* @__PURE__ */ a.jsx("span", { children: i(m[0]) }),
|
1581
|
+
!l(m[0]) && /* @__PURE__ */ a.jsx("span", { className: "text-xs", children: "No wallet detected" }),
|
1582
|
+
g && /* @__PURE__ */ a.jsx(
|
1583
|
+
"svg",
|
2496
1584
|
{
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
1585
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1586
|
+
className: "h-4 w-4",
|
1587
|
+
viewBox: "0 0 20 20",
|
1588
|
+
fill: "currentColor",
|
1589
|
+
children: /* @__PURE__ */ a.jsx(
|
1590
|
+
"path",
|
1591
|
+
{
|
1592
|
+
fillRule: "evenodd",
|
1593
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
|
1594
|
+
clipRule: "evenodd"
|
1595
|
+
}
|
1596
|
+
)
|
2500
1597
|
}
|
2501
1598
|
)
|
2502
|
-
}
|
2503
|
-
|
2504
|
-
|
2505
|
-
},
|
2506
|
-
|
2507
|
-
|
1599
|
+
] })
|
1600
|
+
}
|
1601
|
+
) })
|
1602
|
+
] }, d.id);
|
1603
|
+
}) }),
|
1604
|
+
/* @__PURE__ */ a.jsxs("div", { className: "mt-4 p-3 rounded-lg bg-gray-50 dark:bg-gray-800", children: [
|
1605
|
+
/* @__PURE__ */ a.jsx("h4", { className: `text-sm font-medium mb-2 ${t === "dark" ? "text-white" : "text-gray-800"}`, children: "Detected Wallets:" }),
|
1606
|
+
/* @__PURE__ */ a.jsx("div", { className: "space-y-1", children: Object.entries(u).map(([d, m]) => /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
1607
|
+
/* @__PURE__ */ a.jsx("span", { className: `capitalize ${t === "dark" ? "text-gray-300" : "text-gray-600"}`, children: d.replace("_", " ") }),
|
1608
|
+
/* @__PURE__ */ a.jsx("span", { className: `px-2 py-1 rounded-full ${m ? "bg-green-100 text-green-800" : "bg-red-100 text-red-800"}`, children: m ? "Available" : "Not detected" })
|
1609
|
+
] }, d)) })
|
1610
|
+
] })
|
2508
1611
|
] });
|
2509
|
-
};
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
|
2528
|
-
|
2529
|
-
|
2530
|
-
const
|
2531
|
-
|
2532
|
-
|
2533
|
-
|
2534
|
-
|
2535
|
-
},
|
2536
|
-
|
2537
|
-
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
};
|
2551
|
-
const handlePaymentConfirm = () => {
|
2552
|
-
onPayment(paymentMethod === "qrcode");
|
2553
|
-
};
|
2554
|
-
const handleBack = () => {
|
2555
|
-
if (step === "confirm") {
|
2556
|
-
setStep("select-currency");
|
2557
|
-
}
|
2558
|
-
};
|
2559
|
-
const togglePaymentMethod = (method) => {
|
2560
|
-
setPaymentMethod(method);
|
2561
|
-
};
|
2562
|
-
const formatAmount = (amount) => {
|
2563
|
-
return parseFloat(amount).toFixed(2);
|
2564
|
-
};
|
2565
|
-
const formatTransactionHash = (hash) => {
|
2566
|
-
if (!hash)
|
2567
|
-
return "";
|
2568
|
-
if (hash.length <= 14)
|
2569
|
-
return hash;
|
2570
|
-
return `${hash.slice(0, 8)}...${hash.slice(-6)}`;
|
2571
|
-
};
|
2572
|
-
const getWalletAddressForCurrency = () => {
|
2573
|
-
if (!payment)
|
2574
|
-
return null;
|
2575
|
-
const isSolana = selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL";
|
2576
|
-
return isSolana ? payment.solWalletAddress : payment.walletAddress;
|
2577
|
-
};
|
2578
|
-
if (!isOpen)
|
2579
|
-
return null;
|
2580
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto bg-black/50", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl bg-white text-gray-800", children: [
|
2581
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center mb-6 bg-[#F1ECFB] p-3 rounded-xl", children: [
|
2582
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold text-gray-900", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "w-32" }) }) }),
|
2583
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1612
|
+
}, St = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJQAAAAkCAYAAABv9hOhAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAmVSURBVHgB7Vzdcdu4Fv5I+X2VCoK83pkb2xVc2ikgTgVWKog8twDJBexYrsBKBXYKWJtbQWRnZl+NrWC172txcQBQBA8B/kiKV87qm4FFgMAhAX48ODg4dISOGB4/XKsfObl9e+Y9n3wViHt3QHY5ud2fYId1caDSJyc/V+kMW4q4S2VFFurcCR0Oj+/H3kq9vSv1VyDDKX5s0Fh8VSlTifrcx/cByR046QRbjE6EQmnQok9aGzlQ+QRZluDHh1BJaWFNKsJApQvs0JlQc+e4jzgelqX1HNUczfHjQqCqkRLsUCWU0jL94buHE659LGQ5G51SfafAUcfZn572Sv63hKZL1u6lYeYpk9jBo6HieKysgmulbR6VAX7lEmuSHpLWkU5tIoVW+3q6cxEhdbOaqMcPF4gzNVVEI2VsJXi5oHE4d/JSpY/YwUOoRYkwA1qxWWPcIvtSlhDbc/FBWc5i+RbblR8ZsGaKzDIJPKV42Rir9EqlNzZJ7OCzoRZTlG0lTYalBlosbsr1o33zg4JQijBKm6V0WLgRtN1hm+DSaruXDq6x//XY4wX0oJWNo9R5VF61xL1rRY4jIsrw6F4iioQuz7JX5nz8Wh2bulGU0o+2kziZMqSTu7X9UwLGCBZOGWnEFOWXoQk0ZZ945FCS+D4QKN873W8Kv122Kv6Jfmns+QrJITl89+09cwH0LakOkS3OEPWuS42yrHiQiydjX8Q9IqVw6kjVdh1bI1FphPoV1RTGvpFryklVulTpJnD+jrX/aK9NeET5YR7Z+7lC+Jr0sD9gvQeeoF2/PjrXIfI9orxqpfEboxmkGFyn6yzsNnj664MiAH9rBLkKlJa6IU+4LsnyNyu7t7/n6rxUBvgAxj9jizWZSMNJdAd1lgjMH6IPA5gBGgXOX7SUk9hrbsK/JFpcM3eUruq47NIvd3xIEVyyOp/QDu9Z/nJJKL0K4ys6RYAlcZaItAdcabGh0kSHk3R/rIsXi4nO39p8FBU3paa5NclEA9V1oMeokoo0xBDdMLTt1oHZPWhGv0NdLr9rv8YoxmfiuY8E9aDzgpWle+RzUiu7T8pQpgq0V0dkmJmVGL6oPTu1zfJA+ZG2m3I7CZp0M+eYmF5otCyji821xlrPZqI378BTnqr0qz2mAXjv6eBYJdKcNG3R4A1q5Ejb/n+oDia128QemoTRBtLKy/fphFOH+jJEe4JcoNovaa+T2uuIwLXGMH1PbUqccyNbFgLfWpvq6yqyZA3p0U5f2tfU1iG5IcflAGavzE00LYia+o9O3T9smfDIoXpJQI5gcvLk1r9j5wbOOV/bKfz7fX0Ue4LufedIPPft3ie/zgThfUWqfx2Ql3hk1T1D3kc9g8T5iqwGQqWr4fG3Ea3w2i73N+QWGLG8RGHg+jCFMWzz4zf2NyQnDcgJXWeE1SBRaDkOKuMLFXqQr9EMfj8pjGab19yHa5ATBAwZUlTHI6Ql+QpSwi5eYmt8f0YjsvH/j39r08lNgVS0YGX0kJuIStPuIczAUd18t95F0yoQ8Hu/E6wWVdA0vr7l/Bs0Y8Dy5y3a+Izw3Ljm90lTpK+/3BhP84M9q0kGaoqa2s1dv/GrbKqf7/7zO54PguVTtF9Su6tTbn9JFMv7JqQobKscCcKuhDo5TZDoZownLD8PlPswD8iawthkOYly49ztb+7jcrEk8tIPZT3bqbV9DhS5hGKRUAa7uvhilnu+nxGcCPdYDYLlJbrhVyZDYDvQ9+TvsBqEc0zay51KScm4hDph1y5p15IfypBpj8hEKu29dhH04lOVPw1EHzwnNmGTESTWwyYWG5vA97qPCcpjnaCs9U5Z/dL0WfihlNFNEQYmGkAbY8bwyjLSFAO7n/ecg8kJtCn77aBj/Z9YXmI7sKkXjMuiY25L5VOcQHVKTd1MTJpHbbN8JaMb9ax/7jdTsvwJVsOM5QW69SVheYntAO8XEYH2VaMV0ismi9uIpJVye8rFFGw8YqV5RlYLNUBvqWzyrWhCCh4h2t7ZN0BhF8w8ctou/0cok2+Odgb2c0Bi9fFpQopyP/OVMp/uvvCG8TJqIATtMc8o+uD18Ojh7uzdt1b7PMMkGPXZFr6HRw+4ifxU5wrl/Sq+TKaBP22QQ+fHrKzr6u57w7cHJ9AMqtdEvnNPm8TJS3jGg/xQHz3OTao8VcpQOQkjaSIsFUPV9kyWZZNW/qg4O9DBebS1szpoq4O/heRVpvsRrG4Cs8oZO2V0TJ2eoDpVTeHfN6NrXKDqWpBo5+d5TnADOl/pDQL1875N7O9jTd0UPC6uer6CyM2QRsk3cL2BcTkWT+RgnKnzVxSqQnt6tv6Fyp8tZRzdf1VkVRolGk9u/7vqw6A3KbTjL+1vH367iAbk0NZLEF5W59OiQPgNJw+8+0Z2DV9JUQ8uL2+ToHzfEmWnJ72w1x55VC9f0vdR7Of1PfVCTtQxwubBITwxXCW3gUOmfpBMeTSmiXU6QRwnVtSJzke9q6Lu4oOdMsd6Fbka6G0KkVEgbGQTQdztkxThuG8a6ARhMlG7bZvuctB9+cZHwH5DCaOFEvjJdIQwuAbMMUMgINAfD8UD41yo6dHaRgNb0reSzK+aFvNwYU1QIpWJOliHVGNU96DqkML/Bk3RLf6b6h2hvWf9n8IY9XucPhARDxva+FwIhMtQg0rEJiNLGSZI7lyvDMsXhbG1LKLeMvTBTodH9vN0IhVWnP6mNg1gDOaEnc+N+DxsIwQJQ6qBlcOnAZJDRPyMeiJ9QflhSHbuJyazCVze3JE79ZRzpCj6RY7pBH6NRNe5QfvVqgxcy4uIF5hPzCO/JlG2k44pP36g8Ip+qYyM78yZyxdPr1w3g/5yJoqv9apSGfuTX95uYgoRzrHE6hAbkrNtcG3LOVZzhnLbboqaT8aqU17mnermS+KY6Yzv5QBP7LOoOB64WR2MRxGgWsvhakNed+mkbZCzbSACSVR9Vm3BXQWEz3UNqoSquhCmJtTXbg4vjXDQFDjLtZD+pUjPQtA+F0021eRu/40NKz7ADtuMkB8urWtU/Yzq9u1UaQ+pow0WTzdV77hDlGgZgmuQLdT8HBmi1Hjfl3HnO2wbEhT2qWDniAeNIdD+z6jqQlXcuHL6MMHFYpEuDfYo2sSUtsPzQiDs6CQySTQgRldkWU6UKf+KRROxOaR4h5cF0kzk+pm2qdydUJF2D8yXH3NyPP21tf9dbYdOkDAOU3JFtF6R76EraO9PrfJC39hZv5NidG835b085Eb3qi4G/A2inrQKnVgMFAAAAABJRU5ErkJggg==", Lt = ({
|
1613
|
+
isOpen: s,
|
1614
|
+
onClose: r,
|
1615
|
+
payment: t,
|
1616
|
+
paymentStatus: c,
|
1617
|
+
selectedPaymentMethod: u,
|
1618
|
+
onPaymentMethodSelect: h,
|
1619
|
+
onPayment: y,
|
1620
|
+
onBack: w,
|
1621
|
+
error: e,
|
1622
|
+
theme: n = "light",
|
1623
|
+
merchantName: o,
|
1624
|
+
transactionHash: i,
|
1625
|
+
walletConnection: l,
|
1626
|
+
onConnectWallet: f,
|
1627
|
+
testMode: d = !1,
|
1628
|
+
supportedNetworks: m = [],
|
1629
|
+
availableWallets: g = {},
|
1630
|
+
supportedWallets: b = [],
|
1631
|
+
step: v = "select-currency"
|
1632
|
+
}) => {
|
1633
|
+
const p = (x) => parseFloat(x).toFixed(2), j = (x) => x ? x.length <= 14 ? x : `${x.slice(0, 8)}...${x.slice(-6)}` : "", M = (x) => ({
|
1634
|
+
ethereum: "Ethereum",
|
1635
|
+
bsc: "BSC",
|
1636
|
+
tron: "Tron",
|
1637
|
+
algorand: "Algorand"
|
1638
|
+
})[x] || x, F = (x) => ({
|
1639
|
+
[N.METAMASK]: "MetaMask",
|
1640
|
+
[N.TRONLINK]: "TronLink",
|
1641
|
+
[N.TRUST_WALLET]: "Trust Wallet",
|
1642
|
+
[N.LUTE]: "Lute Wallet"
|
1643
|
+
})[x] || x, V = (x) => ({
|
1644
|
+
[N.METAMASK]: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT3ymr3UNKopfI0NmUY95Dr-0589vG-91KuAA&s",
|
1645
|
+
[N.TRONLINK]: "https://www.tronlink.org/images/logo.png",
|
1646
|
+
[N.TRUST_WALLET]: "https://trustwallet.com/assets/images/trust_logotype.svg",
|
1647
|
+
[N.LUTE]: "https://lute.app/logo.png"
|
1648
|
+
})[x] || "";
|
1649
|
+
return s ? /* @__PURE__ */ a.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto bg-black/50", children: /* @__PURE__ */ a.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ a.jsxs("div", { className: "relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl bg-white text-gray-800", children: [
|
1650
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex justify-between items-center mb-6 bg-[#F1ECFB] p-3 rounded-xl", children: [
|
1651
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ a.jsx("h2", { className: "text-xl font-bold text-gray-900", children: /* @__PURE__ */ a.jsx("img", { src: St, className: "w-32", alt: "Coinley Logo" }) }) }),
|
1652
|
+
/* @__PURE__ */ a.jsx(
|
2584
1653
|
"button",
|
2585
1654
|
{
|
2586
|
-
onClick:
|
1655
|
+
onClick: r,
|
2587
1656
|
className: "text-gray-500 hover:text-gray-700 focus:outline-none",
|
2588
|
-
children: /* @__PURE__ */
|
1657
|
+
children: /* @__PURE__ */ a.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
2589
1658
|
}
|
2590
1659
|
)
|
2591
1660
|
] }),
|
2592
|
-
/* @__PURE__ */
|
2593
|
-
|
2594
|
-
/* @__PURE__ */
|
1661
|
+
/* @__PURE__ */ a.jsxs("div", { className: "mb-6 bg-[#F1ECFB] p-3 rounded-xl", children: [
|
1662
|
+
t && /* @__PURE__ */ a.jsxs("div", { className: "mb-6 p-4 rounded-lg", children: [
|
1663
|
+
/* @__PURE__ */ a.jsxs("p", { className: "text-lg text-gray-800 font-semibold", children: [
|
2595
1664
|
"PAY: ",
|
2596
|
-
|
1665
|
+
o
|
2597
1666
|
] }),
|
2598
|
-
/* @__PURE__ */
|
2599
|
-
/* @__PURE__ */
|
2600
|
-
/* @__PURE__ */
|
1667
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex justify-between items-center mt-2 bg-gray-100 px-3 rounded-lg", children: [
|
1668
|
+
/* @__PURE__ */ a.jsx("span", { className: "font-medium text-gray-700", children: "Amount:" }),
|
1669
|
+
/* @__PURE__ */ a.jsxs("span", { className: "font-bold text-xl text-[#7042D2]", children: [
|
2601
1670
|
"$",
|
2602
|
-
|
1671
|
+
p(t.totalAmount || t.amount)
|
2603
1672
|
] })
|
2604
1673
|
] }),
|
2605
|
-
/* @__PURE__ */
|
1674
|
+
/* @__PURE__ */ a.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ a.jsxs("span", { className: "text-gray-500", children: [
|
2606
1675
|
"Payment ID: ",
|
2607
|
-
|
1676
|
+
t.id ? t.id.slice(0, 8) : "",
|
2608
1677
|
"..."
|
2609
1678
|
] }) })
|
2610
1679
|
] }),
|
2611
|
-
|
2612
|
-
|
1680
|
+
v === "select-currency" && /* @__PURE__ */ a.jsx(
|
1681
|
+
Rt,
|
2613
1682
|
{
|
2614
|
-
onSelect:
|
2615
|
-
selected:
|
2616
|
-
theme
|
1683
|
+
onSelect: h,
|
1684
|
+
selected: u,
|
1685
|
+
theme: n,
|
1686
|
+
supportedNetworks: m
|
2617
1687
|
}
|
2618
1688
|
),
|
2619
|
-
|
2620
|
-
/* @__PURE__ */
|
2621
|
-
/* @__PURE__ */
|
2622
|
-
/* @__PURE__ */
|
2623
|
-
/* @__PURE__ */
|
2624
|
-
/* @__PURE__ */
|
2625
|
-
/* @__PURE__ */
|
1689
|
+
v === "confirm" && u && t && /* @__PURE__ */ a.jsxs("div", { children: [
|
1690
|
+
/* @__PURE__ */ a.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
|
1691
|
+
/* @__PURE__ */ a.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
1692
|
+
/* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
|
1693
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex justify-between", children: [
|
1694
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Currency:" }),
|
1695
|
+
/* @__PURE__ */ a.jsx("span", { className: "font-medium", children: u.currency })
|
2626
1696
|
] }),
|
2627
|
-
/* @__PURE__ */
|
2628
|
-
/* @__PURE__ */
|
2629
|
-
/* @__PURE__ */
|
1697
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex justify-between", children: [
|
1698
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Network:" }),
|
1699
|
+
/* @__PURE__ */ a.jsx("span", { className: "font-medium", children: M(u.network) })
|
2630
1700
|
] }),
|
2631
|
-
/* @__PURE__ */
|
2632
|
-
/* @__PURE__ */
|
2633
|
-
/* @__PURE__ */
|
1701
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex justify-between", children: [
|
1702
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Fee:" }),
|
1703
|
+
/* @__PURE__ */ a.jsx("span", { className: "font-medium", children: "1.75%" })
|
2634
1704
|
] })
|
2635
1705
|
] })
|
2636
1706
|
] }),
|
2637
|
-
|
2638
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
2639
|
-
"button",
|
2640
|
-
{
|
2641
|
-
onClick: () => togglePaymentMethod("wallet"),
|
2642
|
-
className: `py-2 px-4 text-sm font-medium ${paymentMethod === "wallet" ? "border-b border-[#7042D2] text-[#7042D2] rounded-t-md" : "text-[#7042D2]"}`,
|
2643
|
-
children: "Connect Wallet"
|
2644
|
-
}
|
2645
|
-
),
|
2646
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
2647
|
-
"button",
|
2648
|
-
{
|
2649
|
-
onClick: () => togglePaymentMethod("qrcode"),
|
2650
|
-
className: `py-2 px-4 text-sm font-medium ${paymentMethod === "qrcode" ? "border-b border-[#7042D2] text-[#7042D2] rounded-t-md" : "text-[#7042D2]"}`,
|
2651
|
-
children: "QR Code"
|
2652
|
-
}
|
2653
|
-
)
|
2654
|
-
] }) }),
|
2655
|
-
testMode ? (
|
1707
|
+
d ? (
|
2656
1708
|
// Test mode payment option
|
2657
|
-
/* @__PURE__ */
|
2658
|
-
/* @__PURE__ */
|
2659
|
-
/* @__PURE__ */
|
2660
|
-
/* @__PURE__ */
|
2661
|
-
/* @__PURE__ */
|
1709
|
+
/* @__PURE__ */ a.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
|
1710
|
+
/* @__PURE__ */ a.jsx("div", { className: "bg-[#7042D2] rounded-full p-2 mr-3", children: /* @__PURE__ */ a.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
1711
|
+
/* @__PURE__ */ a.jsxs("div", { children: [
|
1712
|
+
/* @__PURE__ */ a.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
|
1713
|
+
/* @__PURE__ */ a.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
|
2662
1714
|
] })
|
2663
1715
|
] }) })
|
2664
|
-
) : paymentMethod === "qrcode" ? (
|
2665
|
-
// QR Code payment option
|
2666
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2667
|
-
QRCode,
|
2668
|
-
{
|
2669
|
-
walletAddress: getWalletAddressForCurrency(),
|
2670
|
-
amount: payment.totalAmount || payment.amount,
|
2671
|
-
currency: selectedCurrency,
|
2672
|
-
theme
|
2673
|
-
}
|
2674
|
-
) })
|
2675
|
-
) : isMetaMaskAvailable ? (
|
2676
|
-
// MetaMask available option
|
2677
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: [
|
2678
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
2679
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
2680
|
-
"img",
|
2681
|
-
{
|
2682
|
-
src: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT3ymr3UNKopfI0NmUY95Dr-0589vG-91KuAA&s",
|
2683
|
-
alt: "MetaMask",
|
2684
|
-
className: "w-8 h-8 mr-2"
|
2685
|
-
}
|
2686
|
-
),
|
2687
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
2688
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "Pay with MetaMask" }),
|
2689
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: walletConnected ? "Your wallet is connected. Click 'Pay Now' to proceed." : "Click 'Connect Wallet' to proceed with payment." })
|
2690
|
-
] })
|
2691
|
-
] }),
|
2692
|
-
!walletConnected && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2693
|
-
"button",
|
2694
|
-
{
|
2695
|
-
onClick: onConnectWallet,
|
2696
|
-
className: "mt-3 w-full py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md",
|
2697
|
-
children: "Connect Wallet"
|
2698
|
-
}
|
2699
|
-
)
|
2700
|
-
] })
|
2701
1716
|
) : (
|
2702
|
-
//
|
2703
|
-
/* @__PURE__ */
|
2704
|
-
/* @__PURE__ */
|
2705
|
-
|
2706
|
-
/* @__PURE__ */
|
2707
|
-
|
2708
|
-
/* @__PURE__ */
|
1717
|
+
// Real wallet connection
|
1718
|
+
/* @__PURE__ */ a.jsxs("div", { className: "space-y-3", children: [
|
1719
|
+
/* @__PURE__ */ a.jsx("h4", { className: "font-medium text-gray-800", children: "Select Wallet:" }),
|
1720
|
+
b.length === 0 ? /* @__PURE__ */ a.jsx("div", { className: "p-4 rounded-lg bg-yellow-50", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
|
1721
|
+
/* @__PURE__ */ a.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
1722
|
+
/* @__PURE__ */ a.jsxs("div", { children: [
|
1723
|
+
/* @__PURE__ */ a.jsx("h3", { className: "font-medium text-gray-800", children: "No Compatible Wallets" }),
|
1724
|
+
/* @__PURE__ */ a.jsxs("p", { className: "text-sm text-gray-600", children: [
|
1725
|
+
"No wallets detected for ",
|
1726
|
+
M(u.network),
|
1727
|
+
" network"
|
1728
|
+
] })
|
2709
1729
|
] })
|
2710
|
-
] }),
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
1730
|
+
] }) }) : b.map((x) => /* @__PURE__ */ a.jsx("div", { className: "p-4 rounded-lg bg-blue-50", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between", children: [
|
1731
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center", children: [
|
1732
|
+
/* @__PURE__ */ a.jsx(
|
1733
|
+
"img",
|
1734
|
+
{
|
1735
|
+
src: V(x),
|
1736
|
+
alt: F(x),
|
1737
|
+
className: "w-8 h-8 mr-2",
|
1738
|
+
onError: (T) => {
|
1739
|
+
T.target.style.display = "none";
|
1740
|
+
}
|
1741
|
+
}
|
1742
|
+
),
|
1743
|
+
/* @__PURE__ */ a.jsxs("div", { children: [
|
1744
|
+
/* @__PURE__ */ a.jsx("h3", { className: "font-medium text-gray-800", children: F(x) }),
|
1745
|
+
/* @__PURE__ */ a.jsxs("p", { className: "text-sm text-gray-600", children: [
|
1746
|
+
"Pay with ",
|
1747
|
+
F(x)
|
1748
|
+
] })
|
1749
|
+
] })
|
1750
|
+
] }),
|
1751
|
+
(l == null ? void 0 : l.walletType) === x ? /* @__PURE__ */ a.jsxs("div", { className: "flex items-center space-x-2", children: [
|
1752
|
+
/* @__PURE__ */ a.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }),
|
1753
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-sm text-green-600", children: "Connected" })
|
1754
|
+
] }) : /* @__PURE__ */ a.jsx(
|
1755
|
+
"button",
|
1756
|
+
{
|
1757
|
+
onClick: () => f(x),
|
1758
|
+
className: "py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md",
|
1759
|
+
children: "Connect"
|
1760
|
+
}
|
1761
|
+
)
|
1762
|
+
] }) }, x)),
|
1763
|
+
/* @__PURE__ */ a.jsx("div", { className: "space-y-2", children: Object.entries(g).filter(([x, T]) => !T).map(([x]) => /* @__PURE__ */ a.jsx("div", { className: "p-3 rounded-lg bg-gray-50", children: /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between", children: [
|
1764
|
+
/* @__PURE__ */ a.jsxs("span", { className: "text-sm text-gray-600", children: [
|
1765
|
+
F(x),
|
1766
|
+
" not detected"
|
1767
|
+
] }),
|
1768
|
+
/* @__PURE__ */ a.jsx(
|
1769
|
+
"a",
|
1770
|
+
{
|
1771
|
+
href: ct(x),
|
1772
|
+
target: "_blank",
|
1773
|
+
rel: "noopener noreferrer",
|
1774
|
+
className: "text-sm text-[#7042D2] hover:underline",
|
1775
|
+
children: "Install"
|
1776
|
+
}
|
1777
|
+
)
|
1778
|
+
] }) }, x)) })
|
2721
1779
|
] })
|
2722
1780
|
),
|
2723
|
-
/* @__PURE__ */
|
2724
|
-
/* @__PURE__ */
|
1781
|
+
/* @__PURE__ */ a.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
|
1782
|
+
/* @__PURE__ */ a.jsx(
|
2725
1783
|
"button",
|
2726
1784
|
{
|
2727
1785
|
type: "button",
|
2728
|
-
onClick:
|
1786
|
+
onClick: w,
|
2729
1787
|
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-[#7042D2] font-medium rounded-md",
|
2730
1788
|
children: "Back"
|
2731
1789
|
}
|
2732
1790
|
),
|
2733
|
-
/* @__PURE__ */
|
1791
|
+
/* @__PURE__ */ a.jsx(
|
2734
1792
|
"button",
|
2735
1793
|
{
|
2736
1794
|
type: "button",
|
2737
|
-
onClick:
|
1795
|
+
onClick: y,
|
2738
1796
|
className: "w-full py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md",
|
2739
|
-
disabled: !
|
2740
|
-
children: "
|
1797
|
+
disabled: !d && !l,
|
1798
|
+
children: "Pay Now"
|
2741
1799
|
}
|
2742
1800
|
)
|
2743
1801
|
] })
|
2744
1802
|
] }),
|
2745
|
-
|
2746
|
-
|
1803
|
+
v === "processing" && /* @__PURE__ */ a.jsx(
|
1804
|
+
le,
|
2747
1805
|
{
|
2748
1806
|
status: "processing",
|
2749
|
-
theme,
|
1807
|
+
theme: n,
|
2750
1808
|
message: "Processing your payment..."
|
2751
1809
|
}
|
2752
1810
|
),
|
2753
|
-
|
2754
|
-
/* @__PURE__ */
|
2755
|
-
|
1811
|
+
v === "success" && /* @__PURE__ */ a.jsxs("div", { children: [
|
1812
|
+
/* @__PURE__ */ a.jsx(
|
1813
|
+
le,
|
2756
1814
|
{
|
2757
1815
|
status: "success",
|
2758
|
-
theme,
|
1816
|
+
theme: n,
|
2759
1817
|
message: "Payment successful!"
|
2760
1818
|
}
|
2761
1819
|
),
|
2762
|
-
|
2763
|
-
/* @__PURE__ */
|
2764
|
-
/* @__PURE__ */
|
2765
|
-
/* @__PURE__ */
|
1820
|
+
i && /* @__PURE__ */ a.jsxs("div", { className: "mt-4 p-3 rounded-lg bg-gray-100", children: [
|
1821
|
+
/* @__PURE__ */ a.jsx("p", { className: "text-xs text-gray-600 mb-1", children: "Transaction Hash:" }),
|
1822
|
+
/* @__PURE__ */ a.jsx("p", { className: "text-sm font-mono break-all text-gray-800", children: j(i) }),
|
1823
|
+
u && /* @__PURE__ */ a.jsx(
|
2766
1824
|
"a",
|
2767
1825
|
{
|
2768
|
-
href:
|
1826
|
+
href: `${Pt(u.network)}/tx/${i}`,
|
2769
1827
|
target: "_blank",
|
2770
1828
|
rel: "noopener noreferrer",
|
2771
1829
|
className: "text-xs text-[#7042D2] mt-2 inline-block",
|
2772
|
-
children: "View on
|
1830
|
+
children: "View on Explorer →"
|
2773
1831
|
}
|
2774
1832
|
)
|
2775
1833
|
] })
|
2776
1834
|
] }),
|
2777
|
-
|
2778
|
-
/* @__PURE__ */
|
2779
|
-
|
1835
|
+
v === "error" && /* @__PURE__ */ a.jsxs("div", { children: [
|
1836
|
+
/* @__PURE__ */ a.jsx(
|
1837
|
+
le,
|
2780
1838
|
{
|
2781
1839
|
status: "error",
|
2782
|
-
theme,
|
2783
|
-
message:
|
1840
|
+
theme: n,
|
1841
|
+
message: e || "An error occurred while processing your payment."
|
2784
1842
|
}
|
2785
1843
|
),
|
2786
|
-
/* @__PURE__ */
|
1844
|
+
/* @__PURE__ */ a.jsx(
|
2787
1845
|
"button",
|
2788
1846
|
{
|
2789
1847
|
type: "button",
|
2790
|
-
onClick:
|
1848
|
+
onClick: w,
|
2791
1849
|
className: "mt-4 w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium rounded-md",
|
2792
1850
|
children: "Try Again"
|
2793
1851
|
}
|
2794
1852
|
)
|
2795
1853
|
] })
|
2796
1854
|
] }),
|
2797
|
-
/* @__PURE__ */
|
1855
|
+
/* @__PURE__ */ a.jsx("div", { className: "text-center text-xs text-gray-500", children: /* @__PURE__ */ a.jsxs("p", { children: [
|
2798
1856
|
"Powered by ",
|
2799
|
-
/* @__PURE__ */
|
1857
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-[#7042D2]", children: "Coinley" }),
|
2800
1858
|
" - Secure Cryptocurrency Payments"
|
2801
1859
|
] }) })
|
2802
|
-
] }) }) });
|
2803
|
-
}
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
2827
|
-
|
2828
|
-
const [
|
2829
|
-
|
2830
|
-
const
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
ethereum: null,
|
2835
|
-
solana: null
|
2836
|
-
});
|
2837
|
-
apiKey || (coinleyContext == null ? void 0 : coinleyContext.apiKey);
|
2838
|
-
apiSecret || (coinleyContext == null ? void 0 : coinleyContext.apiSecret);
|
2839
|
-
apiUrl || (coinleyContext == null ? void 0 : coinleyContext.apiUrl);
|
2840
|
-
const effectiveTheme = theme || contextTheme;
|
2841
|
-
const effectiveDebug = debug || (coinleyContext == null ? void 0 : coinleyContext.debug);
|
2842
|
-
const effectiveWalletAddress = merchantWalletAddress || (coinleyContext == null ? void 0 : coinleyContext.merchantWalletAddress) || walletAddresses.ethereum;
|
2843
|
-
const effectiveSolWalletAddress = merchantSolWalletAddress || (coinleyContext == null ? void 0 : coinleyContext.merchantSolWalletAddress) || walletAddresses.solana;
|
2844
|
-
useImperativeHandle(ref, () => ({
|
2845
|
-
open: (paymentDetails) => {
|
2846
|
-
handleOpen(paymentDetails);
|
1860
|
+
] }) }) }) : null;
|
1861
|
+
}, Pt = (s) => ({
|
1862
|
+
ethereum: "https://etherscan.io",
|
1863
|
+
bsc: "https://bscscan.com",
|
1864
|
+
tron: "https://tronscan.org",
|
1865
|
+
algorand: "https://algoexplorer.io"
|
1866
|
+
})[s] || "https://etherscan.io", Ot = Ye(({
|
1867
|
+
apiKey: s,
|
1868
|
+
apiSecret: r,
|
1869
|
+
apiUrl: t,
|
1870
|
+
customerEmail: c,
|
1871
|
+
merchantName: u = "Merchant",
|
1872
|
+
merchantWalletAddresses: h = {},
|
1873
|
+
// Object with network-specific addresses
|
1874
|
+
onSuccess: y,
|
1875
|
+
onError: w,
|
1876
|
+
onClose: e,
|
1877
|
+
theme: n,
|
1878
|
+
autoOpen: o = !1,
|
1879
|
+
debug: i = !1,
|
1880
|
+
testMode: l = !1,
|
1881
|
+
supportedNetworks: f = [],
|
1882
|
+
// Array of supported networks
|
1883
|
+
preferredNetwork: d = A.ETHEREUM,
|
1884
|
+
preferredWallet: m = N.METAMASK
|
1885
|
+
}, g) => {
|
1886
|
+
const b = Nt(), { theme: v } = xt(), [p, j] = U(o), [M, F] = U(null), [V, x] = U("idle"), [T, q] = U(null), [I, B] = U(null), [ee, W] = U(null), [O, $] = U(null), [H, te] = U({}), [X, G] = U("select-currency");
|
1887
|
+
s || (b == null || b.apiKey), r || (b == null || b.apiSecret), t || (b == null || b.apiUrl);
|
1888
|
+
const oe = n || v, re = i || (b == null ? void 0 : b.debug), ae = f.length > 0 ? f : [A.ETHEREUM, A.BSC, A.TRON, A.ALGORAND];
|
1889
|
+
Je(g, () => ({
|
1890
|
+
open: (C) => {
|
1891
|
+
Fe(C);
|
2847
1892
|
},
|
2848
1893
|
close: () => {
|
2849
|
-
|
1894
|
+
he();
|
2850
1895
|
},
|
2851
|
-
getPayment: () =>
|
1896
|
+
getPayment: () => M,
|
1897
|
+
getWalletConnection: () => O
|
2852
1898
|
}));
|
2853
|
-
const
|
2854
|
-
|
2855
|
-
console.log(`[Coinley SDK] ${message}`, data);
|
2856
|
-
}
|
2857
|
-
};
|
2858
|
-
useEffect(() => {
|
2859
|
-
if (typeof window !== "undefined") {
|
2860
|
-
const checkWalletConnection = async () => {
|
2861
|
-
if (isMetaMaskInstalled()) {
|
2862
|
-
try {
|
2863
|
-
const accounts = await window.ethereum.request({ method: "eth_accounts" });
|
2864
|
-
setWalletConnected(accounts && accounts.length > 0);
|
2865
|
-
} catch (err) {
|
2866
|
-
log("Error checking wallet connection:", err);
|
2867
|
-
setWalletConnected(false);
|
2868
|
-
}
|
2869
|
-
} else {
|
2870
|
-
setWalletConnected(false);
|
2871
|
-
}
|
2872
|
-
};
|
2873
|
-
checkWalletConnection();
|
2874
|
-
if (!effectiveWalletAddress || !effectiveSolWalletAddress) {
|
2875
|
-
fetchMerchantWalletAddresses();
|
2876
|
-
}
|
2877
|
-
}
|
2878
|
-
}, [effectiveDebug]);
|
2879
|
-
const fetchMerchantWalletAddresses = async () => {
|
2880
|
-
try {
|
2881
|
-
log("Fetching merchant wallet addresses...");
|
2882
|
-
const addresses = await getMerchantWalletAddresses();
|
2883
|
-
log("Received merchant wallet addresses:", addresses);
|
2884
|
-
setWalletAddresses({
|
2885
|
-
ethereum: addresses.walletAddress,
|
2886
|
-
solana: addresses.solWalletAddress
|
2887
|
-
});
|
2888
|
-
} catch (err) {
|
2889
|
-
log("Error fetching merchant wallet addresses:", err);
|
2890
|
-
}
|
1899
|
+
const L = (C, D) => {
|
1900
|
+
re && console.log(`[Coinley SDK] ${C}`, D);
|
2891
1901
|
};
|
2892
|
-
|
2893
|
-
if (typeof window
|
2894
|
-
const
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
}
|
2902
|
-
return () => {
|
2903
|
-
};
|
2904
|
-
}, []);
|
2905
|
-
const handleOpen = async (paymentDetails) => {
|
2906
|
-
if (!paymentDetails || !paymentDetails.amount) {
|
2907
|
-
setError("Payment amount is required");
|
2908
|
-
if (onError)
|
2909
|
-
onError(new Error("Payment amount is required"));
|
1902
|
+
Z(() => {
|
1903
|
+
if (typeof window != "undefined") {
|
1904
|
+
const C = ue();
|
1905
|
+
te(C), L("Available wallets detected:", C);
|
1906
|
+
}
|
1907
|
+
}, [re]);
|
1908
|
+
const Fe = (C) => R(void 0, null, function* () {
|
1909
|
+
if (!C || !C.amount) {
|
1910
|
+
B("Payment amount is required"), w && w(new Error("Payment amount is required"));
|
2910
1911
|
return;
|
2911
1912
|
}
|
2912
|
-
|
2913
|
-
setIsOpen(true);
|
1913
|
+
x("loading"), j(!0), G("select-currency");
|
2914
1914
|
try {
|
2915
|
-
|
2916
|
-
const
|
2917
|
-
amount:
|
2918
|
-
currency:
|
2919
|
-
|
2920
|
-
|
2921
|
-
|
2922
|
-
|
2923
|
-
|
2924
|
-
solWalletAddress: effectiveSolWalletAddress
|
2925
|
-
});
|
2926
|
-
log("Payment created:", paymentResponse);
|
2927
|
-
const enhancedPayment = {
|
2928
|
-
...paymentResponse.payment,
|
2929
|
-
walletAddress: paymentResponse.payment.walletAddress || effectiveWalletAddress,
|
2930
|
-
solWalletAddress: paymentResponse.payment.solWalletAddress || effectiveSolWalletAddress
|
2931
|
-
};
|
2932
|
-
setPayment(enhancedPayment);
|
2933
|
-
setPaymentStatus("idle");
|
2934
|
-
setError(null);
|
2935
|
-
if (preferredNetwork === "solana") {
|
2936
|
-
setSelectedCurrency("SOL");
|
2937
|
-
}
|
2938
|
-
log("Payment created and state updated:", {
|
2939
|
-
payment: enhancedPayment,
|
2940
|
-
status: "idle"
|
1915
|
+
L("Creating payment with details:", C);
|
1916
|
+
const D = yield ut({
|
1917
|
+
amount: C.amount,
|
1918
|
+
currency: C.currency || "USDT",
|
1919
|
+
network: C.network || d,
|
1920
|
+
customerEmail: C.customerEmail || c,
|
1921
|
+
callbackUrl: C.callbackUrl,
|
1922
|
+
metadata: C.metadata || {},
|
1923
|
+
merchantWalletAddresses: z(z({}, h), C.merchantWalletAddresses)
|
2941
1924
|
});
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
if (
|
2954
|
-
|
2955
|
-
|
2956
|
-
const handlePaymentMethodSelect = (currency) => {
|
2957
|
-
log("Currency selected:", currency);
|
2958
|
-
setSelectedCurrency(currency);
|
2959
|
-
};
|
2960
|
-
const connectToWallet = async () => {
|
2961
|
-
if (!isMetaMaskInstalled()) {
|
2962
|
-
setError("MetaMask is not installed. Please install MetaMask to make payments.");
|
2963
|
-
return false;
|
1925
|
+
L("Payment created:", D), F(D.payment), x("idle"), B(null), L("Payment created and state updated");
|
1926
|
+
} catch (D) {
|
1927
|
+
L("Error creating payment:", D), B(D.message || "Failed to create payment"), x("error"), w && w(D);
|
1928
|
+
}
|
1929
|
+
}), he = () => {
|
1930
|
+
j(!1), W(null), $(null), q(null), G("select-currency"), e && e();
|
1931
|
+
}, Be = (C) => {
|
1932
|
+
L("Payment method selected:", C), q(C), G("confirm");
|
1933
|
+
}, We = () => {
|
1934
|
+
X === "confirm" && (G("select-currency"), $(null));
|
1935
|
+
}, Qe = (C) => R(void 0, null, function* () {
|
1936
|
+
if (!T) {
|
1937
|
+
B("Please select a payment method first");
|
1938
|
+
return;
|
2964
1939
|
}
|
2965
1940
|
try {
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
} catch (
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
1941
|
+
L("Connecting wallet:", { walletType: C, network: T.network });
|
1942
|
+
const D = yield et(C, T.network);
|
1943
|
+
$(D), B(null), L("Wallet connected successfully:", D);
|
1944
|
+
} catch (D) {
|
1945
|
+
L("Wallet connection error:", D), B(D.message || "Failed to connect wallet");
|
1946
|
+
}
|
1947
|
+
}), ze = () => R(void 0, null, function* () {
|
1948
|
+
var C, D;
|
1949
|
+
if (!M || !T) {
|
1950
|
+
B("Missing payment information");
|
1951
|
+
return;
|
2973
1952
|
}
|
2974
|
-
|
2975
|
-
|
2976
|
-
if (!payment) {
|
2977
|
-
setError("No active payment to process");
|
1953
|
+
if (!O && !l) {
|
1954
|
+
B("Please connect your wallet first");
|
2978
1955
|
return;
|
2979
1956
|
}
|
2980
|
-
|
2981
|
-
setPaymentStatus("loading");
|
2982
|
-
setTransactionHash(null);
|
1957
|
+
L("Starting payment process..."), x("loading"), W(null);
|
2983
1958
|
try {
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
txHash = `qrcode_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
|
2998
|
-
} else {
|
2999
|
-
if (!walletConnected) {
|
3000
|
-
const connected = await connectToWallet();
|
3001
|
-
if (!connected) {
|
3002
|
-
throw new Error("Please connect your wallet to proceed with payment");
|
3003
|
-
}
|
3004
|
-
}
|
3005
|
-
const isSolana = selectedCurrency === "SOL" || selectedCurrency === "USDC_SOL";
|
3006
|
-
const merchantAddress = isSolana ? payment.solWalletAddress || effectiveSolWalletAddress : payment.walletAddress || effectiveWalletAddress;
|
3007
|
-
if (!merchantAddress) {
|
3008
|
-
throw new Error(`No ${isSolana ? "Solana" : "Ethereum"} wallet address is configured for the merchant. Please contact support.`);
|
3009
|
-
}
|
3010
|
-
const txParams = {
|
3011
|
-
from: await window.ethereum.request({ method: "eth_requestAccounts" }).then((accounts) => accounts[0]),
|
3012
|
-
to: merchantAddress,
|
3013
|
-
value: "0x0",
|
3014
|
-
// For ERC-20 tokens, value is 0
|
3015
|
-
data: "0x"
|
3016
|
-
// Would include token transfer data for ERC-20
|
3017
|
-
};
|
3018
|
-
log("Sending transaction to wallet for approval...");
|
3019
|
-
txHash = await sendTransaction(txParams);
|
1959
|
+
let Q;
|
1960
|
+
if (l)
|
1961
|
+
L("Test mode: Generating mock transaction..."), Q = `test_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
|
1962
|
+
else {
|
1963
|
+
const me = h[T.network];
|
1964
|
+
if (!me)
|
1965
|
+
throw new Error(`No merchant wallet address configured for ${T.network}`);
|
1966
|
+
L("Sending transaction through wallet..."), Q = yield ot(O, {
|
1967
|
+
to: me,
|
1968
|
+
amount: M.amount,
|
1969
|
+
tokenAddress: (C = T.tokenConfig) == null ? void 0 : C.address,
|
1970
|
+
tokenDecimals: (D = T.tokenConfig) == null ? void 0 : D.decimals
|
1971
|
+
});
|
3020
1972
|
}
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
|
3026
|
-
|
3027
|
-
|
1973
|
+
L("Transaction hash:", Q), W(Q), L("Processing payment with backend...");
|
1974
|
+
const He = yield ht({
|
1975
|
+
paymentId: M.id,
|
1976
|
+
transactionHash: Q,
|
1977
|
+
network: T.network,
|
1978
|
+
currency: T.currency,
|
1979
|
+
senderAddress: O == null ? void 0 : O.address
|
3028
1980
|
});
|
3029
|
-
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3033
|
-
|
3034
|
-
|
3035
|
-
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
|
3040
|
-
onError(err);
|
3041
|
-
}
|
3042
|
-
};
|
3043
|
-
useEffect(() => {
|
3044
|
-
if (autoOpen && payment) {
|
3045
|
-
setIsOpen(true);
|
3046
|
-
}
|
3047
|
-
}, [autoOpen, payment]);
|
3048
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
3049
|
-
CoinleyModal,
|
1981
|
+
L("Payment processed successfully:", He), x("success"), G("success"), y && (L("Calling onSuccess callback..."), y(M.id, Q, {
|
1982
|
+
network: T.network,
|
1983
|
+
currency: T.currency,
|
1984
|
+
amount: M.amount
|
1985
|
+
}));
|
1986
|
+
} catch (Q) {
|
1987
|
+
L("Payment error:", Q), B(Q.message || "Failed to process payment"), x("error"), G("error"), w && w(Q);
|
1988
|
+
}
|
1989
|
+
}), Ge = () => T ? Ne(T.network) : [];
|
1990
|
+
return /* @__PURE__ */ a.jsx(a.Fragment, { children: p && /* @__PURE__ */ a.jsx(
|
1991
|
+
Lt,
|
3050
1992
|
{
|
3051
|
-
isOpen,
|
3052
|
-
onClose:
|
3053
|
-
payment,
|
3054
|
-
paymentStatus,
|
3055
|
-
|
3056
|
-
|
3057
|
-
onPayment:
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
1993
|
+
isOpen: p,
|
1994
|
+
onClose: he,
|
1995
|
+
payment: M,
|
1996
|
+
paymentStatus: V,
|
1997
|
+
selectedPaymentMethod: T,
|
1998
|
+
onPaymentMethodSelect: Be,
|
1999
|
+
onPayment: ze,
|
2000
|
+
onBack: We,
|
2001
|
+
error: I,
|
2002
|
+
theme: oe,
|
2003
|
+
merchantName: u,
|
2004
|
+
transactionHash: ee,
|
2005
|
+
walletConnection: O,
|
2006
|
+
onConnectWallet: Qe,
|
2007
|
+
testMode: l,
|
2008
|
+
supportedNetworks: ae,
|
2009
|
+
availableWallets: H,
|
2010
|
+
supportedWallets: Ge(),
|
2011
|
+
step: X
|
3067
2012
|
}
|
3068
2013
|
) });
|
3069
2014
|
});
|
3070
|
-
|
3071
|
-
const
|
3072
|
-
apiUrl: "
|
3073
|
-
debug:
|
3074
|
-
testMode:
|
3075
|
-
theme: "light"
|
3076
|
-
|
3077
|
-
|
2015
|
+
Ot.displayName = "CoinleyCheckout";
|
2016
|
+
const qt = {
|
2017
|
+
apiUrl: "http://localhost:9000",
|
2018
|
+
debug: !1,
|
2019
|
+
testMode: !1,
|
2020
|
+
theme: "light",
|
2021
|
+
supportedNetworks: ["ethereum", "bsc", "tron", "algorand"]
|
2022
|
+
}, $t = "0.3.1";
|
3078
2023
|
export {
|
3079
|
-
CoinleyCheckout,
|
3080
|
-
CoinleyModal,
|
3081
|
-
CoinleyProvider,
|
3082
|
-
DEFAULT_CONFIG,
|
3083
|
-
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
2024
|
+
Ot as CoinleyCheckout,
|
2025
|
+
Lt as CoinleyModal,
|
2026
|
+
Gt as CoinleyProvider,
|
2027
|
+
qt as DEFAULT_CONFIG,
|
2028
|
+
de as NETWORK_CONFIG,
|
2029
|
+
A as NETWORK_TYPES,
|
2030
|
+
Rt as PaymentMethods,
|
2031
|
+
le as PaymentStatus,
|
2032
|
+
Vt as QRCode,
|
2033
|
+
Xe as TOKEN_CONFIG,
|
2034
|
+
zt as ThemeProvider,
|
2035
|
+
$t as VERSION,
|
2036
|
+
N as WALLET_TYPES,
|
2037
|
+
et as connectWallet,
|
2038
|
+
ut as createPayment,
|
2039
|
+
ue as detectWallets,
|
2040
|
+
Qt as generateMockTransactionHash,
|
2041
|
+
Bt as getMerchantProfile,
|
2042
|
+
It as getPayment,
|
2043
|
+
Ft as getSupportedNetworks,
|
2044
|
+
Ne as getSupportedWalletsForNetwork,
|
2045
|
+
ct as getWalletInstallUrl,
|
2046
|
+
ht as processPayment,
|
2047
|
+
ot as sendTransaction,
|
2048
|
+
Nt as useCoinley,
|
2049
|
+
Wt as validateWalletAddress
|
3093
2050
|
};
|
3094
2051
|
//# sourceMappingURL=coinley-checkout.es.js.map
|