coinley-checkout 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,33 @@
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]);
1
+ var qe = Object.defineProperty, He = Object.defineProperties;
2
+ var $e = Object.getOwnPropertyDescriptors;
3
+ var ge = Object.getOwnPropertySymbols;
4
+ var Ke = Object.prototype.hasOwnProperty, Ve = Object.prototype.propertyIsEnumerable;
5
+ var fe = (s, t, e) => t in s ? qe(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, z = (s, t) => {
6
+ for (var e in t || (t = {}))
7
+ Ke.call(t, e) && fe(s, e, t[e]);
8
+ if (ge)
9
+ for (var e of ge(t))
10
+ Ve.call(t, e) && fe(s, e, t[e]);
11
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) => {
12
+ }, we = (s, t) => He(s, $e(t));
13
+ var R = (s, t, e) => new Promise((i, c) => {
14
+ var u = (r) => {
15
15
  try {
16
- w(t.next(e));
16
+ x(e.next(r));
17
17
  } catch (n) {
18
- u(n);
18
+ c(n);
19
19
  }
20
- }, y = (e) => {
20
+ }, y = (r) => {
21
21
  try {
22
- w(t.throw(e));
22
+ x(e.throw(r));
23
23
  } catch (n) {
24
- u(n);
24
+ c(n);
25
25
  }
26
- }, w = (e) => e.done ? c(e.value) : Promise.resolve(e.value).then(h, y);
27
- w((t = t.apply(s, r)).next());
26
+ }, x = (r) => r.done ? i(r.value) : Promise.resolve(r.value).then(u, y);
27
+ x((e = e.apply(s, t)).next());
28
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 = {
29
+ import L, { createContext as xe, useContext as ye, useState as D, useEffect as Z, forwardRef as _e, useImperativeHandle as Je } from "react";
30
+ const b = {
31
31
  ETHEREUM: "ethereum",
32
32
  BSC: "bsc",
33
33
  TRON: "tron",
@@ -38,7 +38,7 @@ const A = {
38
38
  TRUST_WALLET: "trust_wallet",
39
39
  LUTE: "lute"
40
40
  }, de = {
41
- [A.ETHEREUM]: {
41
+ [b.ETHEREUM]: {
42
42
  chainId: "0x1",
43
43
  chainName: "Ethereum Mainnet",
44
44
  nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
@@ -46,7 +46,7 @@ const A = {
46
46
  blockExplorerUrls: ["https://etherscan.io/"],
47
47
  supportedWallets: [N.METAMASK, N.TRUST_WALLET]
48
48
  },
49
- [A.BSC]: {
49
+ [b.BSC]: {
50
50
  chainId: "0x38",
51
51
  chainName: "BNB Smart Chain",
52
52
  nativeCurrency: { name: "BNB", symbol: "BNB", decimals: 18 },
@@ -54,54 +54,54 @@ const A = {
54
54
  blockExplorerUrls: ["https://bscscan.com/"],
55
55
  supportedWallets: [N.METAMASK, N.TRUST_WALLET]
56
56
  },
57
- [A.TRON]: {
57
+ [b.TRON]: {
58
58
  fullHost: "https://api.trongrid.io",
59
59
  explorerUrl: "https://tronscan.org",
60
60
  supportedWallets: [N.TRONLINK]
61
61
  },
62
- [A.ALGORAND]: {
62
+ [b.ALGORAND]: {
63
63
  network: "mainnet",
64
64
  explorerUrl: "https://algoexplorer.io",
65
65
  supportedWallets: [N.LUTE]
66
66
  }
67
- }, Xe = {
67
+ }, Ye = {
68
68
  USDT: {
69
- [A.ETHEREUM]: {
69
+ [b.ETHEREUM]: {
70
70
  address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
71
71
  decimals: 6
72
72
  },
73
- [A.BSC]: {
73
+ [b.BSC]: {
74
74
  address: "0x55d398326f99059fF775485246999027B3197955",
75
75
  decimals: 18
76
76
  },
77
- [A.TRON]: {
77
+ [b.TRON]: {
78
78
  address: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
79
79
  decimals: 6
80
80
  }
81
81
  },
82
82
  USDC: {
83
- [A.ETHEREUM]: {
83
+ [b.ETHEREUM]: {
84
84
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
85
85
  decimals: 6
86
86
  },
87
- [A.BSC]: {
87
+ [b.BSC]: {
88
88
  address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
89
89
  decimals: 18
90
90
  },
91
- [A.TRON]: {
91
+ [b.TRON]: {
92
92
  address: "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8",
93
93
  decimals: 6
94
94
  }
95
95
  },
96
96
  ALGO: {
97
- [A.ALGORAND]: {
97
+ [b.ALGORAND]: {
98
98
  address: "native",
99
99
  decimals: 6
100
100
  }
101
101
  }
102
102
  };
103
103
  let _ = null;
104
- const Ze = () => R(void 0, null, function* () {
104
+ const Xe = () => R(void 0, null, function* () {
105
105
  if (_)
106
106
  return _;
107
107
  try {
@@ -123,24 +123,24 @@ const Ze = () => R(void 0, null, function* () {
123
123
  return s;
124
124
  try {
125
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);
126
+ } catch (t) {
127
+ console.warn("Error detecting wallets:", t);
128
128
  }
129
129
  return s;
130
- }, Ne = (s) => {
131
- const r = de[s];
132
- if (!r)
130
+ }, Ze = (s) => {
131
+ const t = de[s];
132
+ if (!t)
133
133
  return [];
134
- const t = ue();
135
- return r.supportedWallets.filter((c) => t[c]);
136
- }, et = (s, r) => R(void 0, null, function* () {
134
+ const e = ue();
135
+ return t.supportedWallets.filter((i) => e[i]);
136
+ }, et = (s, t) => R(void 0, null, function* () {
137
137
  switch (s) {
138
138
  case N.METAMASK:
139
- return yield tt(r);
139
+ return yield tt(t);
140
140
  case N.TRONLINK:
141
141
  return yield rt();
142
142
  case N.TRUST_WALLET:
143
- return yield st(r);
143
+ return yield st(t);
144
144
  case N.LUTE:
145
145
  return yield nt();
146
146
  default:
@@ -150,55 +150,55 @@ const Ze = () => R(void 0, null, function* () {
150
150
  if (typeof window == "undefined" || !window.ethereum || !window.ethereum.isMetaMask)
151
151
  throw new Error("MetaMask is not installed. Please install MetaMask extension.");
152
152
  try {
153
- const r = yield window.ethereum.request({
153
+ const t = yield window.ethereum.request({
154
154
  method: "eth_requestAccounts"
155
155
  });
156
- if (!r || r.length === 0)
156
+ if (!t || t.length === 0)
157
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],
158
+ const e = de[s];
159
+ return e && e.chainId && (yield be(e)), {
160
+ address: t[0],
161
161
  network: s,
162
162
  walletType: N.METAMASK
163
163
  };
164
- } catch (r) {
165
- throw r.code === 4001 ? new Error("User rejected the connection request") : new Error(`Failed to connect MetaMask: ${r.message}`);
164
+ } catch (t) {
165
+ throw t.code === 4001 ? new Error("User rejected the connection request") : new Error(`Failed to connect MetaMask: ${t.message}`);
166
166
  }
167
167
  }), rt = () => R(void 0, null, function* () {
168
- var c;
168
+ var i;
169
169
  if (typeof window == "undefined" || !window.tronWeb)
170
170
  throw new Error("TronLink is not installed. Please install TronLink extension.");
171
171
  let s = 0;
172
- const r = 10;
173
- for (; !window.tronWeb.ready && s < r; )
174
- yield new Promise((u) => setTimeout(u, 1e3)), s++;
172
+ const t = 10;
173
+ for (; !window.tronWeb.ready && s < t; )
174
+ yield new Promise((c) => setTimeout(c, 1e3)), s++;
175
175
  if (!window.tronWeb.ready)
176
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)
177
+ const e = (i = window.tronWeb.defaultAddress) == null ? void 0 : i.base58;
178
+ if (!e)
179
179
  throw new Error("No account found in TronLink. Please make sure you have an account set up.");
180
180
  return {
181
- address: t,
182
- network: A.TRON,
181
+ address: e,
182
+ network: b.TRON,
183
183
  walletType: N.TRONLINK
184
184
  };
185
185
  }), st = (s) => R(void 0, null, function* () {
186
186
  if (typeof window == "undefined" || !window.ethereum || !window.ethereum.isTrust)
187
187
  throw new Error("Trust Wallet is not installed. Please install Trust Wallet extension.");
188
188
  try {
189
- const r = yield window.ethereum.request({
189
+ const t = yield window.ethereum.request({
190
190
  method: "eth_requestAccounts"
191
191
  });
192
- if (!r || r.length === 0)
192
+ if (!t || t.length === 0)
193
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],
194
+ const e = de[s];
195
+ return e && e.chainId && (yield be(e)), {
196
+ address: t[0],
197
197
  network: s,
198
198
  walletType: N.TRUST_WALLET
199
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}`);
200
+ } catch (t) {
201
+ throw t.code === 4001 ? new Error("User rejected the connection request") : new Error(`Failed to connect Trust Wallet: ${t.message}`);
202
202
  }
203
203
  }), nt = () => R(void 0, null, function* () {
204
204
  if (typeof window == "undefined" || !window.algorand || !window.algorand.isLute)
@@ -209,13 +209,13 @@ const Ze = () => R(void 0, null, function* () {
209
209
  throw new Error("No accounts found. Please unlock Lute wallet.");
210
210
  return {
211
211
  address: s[0],
212
- network: A.ALGORAND,
212
+ network: b.ALGORAND,
213
213
  walletType: N.LUTE
214
214
  };
215
215
  } catch (s) {
216
216
  throw new Error(`Failed to connect Lute wallet: ${s.message}`);
217
217
  }
218
- }), Ee = (s) => R(void 0, null, function* () {
218
+ }), be = (s) => R(void 0, null, function* () {
219
219
  if (typeof window == "undefined" || !window.ethereum)
220
220
  throw new Error("Ethereum provider not found");
221
221
  try {
@@ -223,41 +223,41 @@ const Ze = () => R(void 0, null, function* () {
223
223
  method: "wallet_switchEthereumChain",
224
224
  params: [{ chainId: s.chainId }]
225
225
  });
226
- } catch (r) {
227
- if (r.code === 4902)
226
+ } catch (t) {
227
+ if (t.code === 4902)
228
228
  try {
229
229
  yield window.ethereum.request({
230
230
  method: "wallet_addEthereumChain",
231
231
  params: [s]
232
232
  });
233
- } catch (t) {
234
- throw new Error(`Failed to add ${s.chainName} to wallet: ${t.message}`);
233
+ } catch (e) {
234
+ throw new Error(`Failed to add ${s.chainName} to wallet: ${e.message}`);
235
235
  }
236
236
  else
237
- throw r.code === 4001 ? new Error("User rejected network switch request") : new Error(`Failed to switch to ${s.chainName}: ${r.message}`);
237
+ throw t.code === 4001 ? new Error("User rejected network switch request") : new Error(`Failed to switch to ${s.chainName}: ${t.message}`);
238
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) {
239
+ }), ot = (s, t) => R(void 0, null, function* () {
240
+ const { walletType: e, network: i, address: c } = s, { to: u, amount: y, tokenAddress: x, tokenDecimals: r } = t;
241
+ switch (e) {
242
242
  case N.METAMASK:
243
243
  case N.TRUST_WALLET:
244
- return yield at(u, h, y, w, e);
244
+ return yield at(c, u, y, x, r);
245
245
  case N.TRONLINK:
246
- return yield lt(h, y, w, e);
246
+ return yield it(u, y, x, r);
247
247
  case N.LUTE:
248
- return yield it(u, h, y);
248
+ return yield lt(c, u, y);
249
249
  default:
250
- throw new Error(`Unsupported wallet type: ${t}`);
250
+ throw new Error(`Unsupported wallet type: ${e}`);
251
251
  }
252
- }), at = (s, r, t, c, u) => R(void 0, null, function* () {
252
+ }), at = (s, t, e, i, c) => R(void 0, null, function* () {
253
253
  if (typeof window == "undefined" || !window.ethereum)
254
254
  throw new Error("Ethereum provider not found");
255
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))
256
+ const u = yield Xe(), y = new u(window.ethereum), x = y.utils.toBN(
257
+ Math.floor(parseFloat(e) * Math.pow(10, c || 18))
258
258
  );
259
- if (c && c !== "native") {
260
- const e = [
259
+ if (i && i !== "native") {
260
+ const r = [
261
261
  {
262
262
  constant: !1,
263
263
  inputs: [
@@ -271,41 +271,41 @@ const Ze = () => R(void 0, null, function* () {
271
271
  type: "function"
272
272
  }
273
273
  ];
274
- return (yield new y.eth.Contract(e, c).methods.transfer(r, w).send({ from: s })).transactionHash;
274
+ return (yield new y.eth.Contract(r, i).methods.transfer(t, x).send({ from: s })).transactionHash;
275
275
  } else
276
276
  return (yield y.eth.sendTransaction({
277
277
  from: s,
278
- to: r,
279
- value: w
278
+ to: t,
279
+ value: x
280
280
  })).transactionHash;
281
- } catch (h) {
282
- throw h.code === 4001 ? new Error("Transaction was rejected by user") : new Error(`Transaction failed: ${h.message}`);
281
+ } catch (u) {
282
+ throw u.code === 4001 ? new Error("Transaction was rejected by user") : new Error(`Transaction failed: ${u.message}`);
283
283
  }
284
- }), lt = (s, r, t, c) => R(void 0, null, function* () {
284
+ }), it = (s, t, e, i) => R(void 0, null, function* () {
285
285
  if (typeof window == "undefined" || !window.tronWeb || !window.tronWeb.ready)
286
286
  throw new Error("TronLink is not ready");
287
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({
288
+ const c = Math.floor(parseFloat(t) * Math.pow(10, i || 6));
289
+ return e && e !== "native" ? yield (yield window.tronWeb.contract().at(e)).transfer(s, c).send({
290
290
  feeLimit: 1e8,
291
291
  callValue: 0
292
- }) : (yield window.tronWeb.trx.sendTransaction(s, u)).txid;
293
- } catch (u) {
294
- throw new Error(`TRON transaction failed: ${u.message}`);
292
+ }) : (yield window.tronWeb.trx.sendTransaction(s, c)).txid;
293
+ } catch (c) {
294
+ throw new Error(`TRON transaction failed: ${c.message}`);
295
295
  }
296
- }), it = (s, r, t) => R(void 0, null, function* () {
296
+ }), lt = (s, t, e) => R(void 0, null, function* () {
297
297
  if (typeof window == "undefined" || !window.algorand)
298
298
  throw new Error("Algorand wallet is not available");
299
299
  try {
300
- const c = Math.floor(parseFloat(t) * 1e6), u = {
300
+ const i = Math.floor(parseFloat(e) * 1e6), c = {
301
301
  from: s,
302
- to: r,
303
- amount: c,
302
+ to: t,
303
+ amount: i,
304
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}`);
305
+ }, u = yield window.algorand.signTransaction(c);
306
+ return (yield window.algorand.sendTransaction(u)).txId;
307
+ } catch (i) {
308
+ throw new Error(`Algorand transaction failed: ${i.message}`);
309
309
  }
310
310
  }), ct = (s) => ({
311
311
  [N.METAMASK]: "https://metamask.io/",
@@ -313,7 +313,7 @@ const Ze = () => R(void 0, null, function* () {
313
313
  [N.TRUST_WALLET]: "https://trustwallet.com/",
314
314
  [N.LUTE]: "https://lute.app/"
315
315
  })[s] || "";
316
- let P = {
316
+ let U = {
317
317
  apiKey: null,
318
318
  apiSecret: null,
319
319
  apiUrl: "http://localhost:9000",
@@ -321,121 +321,121 @@ let P = {
321
321
  // Changed to object for multi-network support
322
322
  };
323
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
324
+ U = z(z({}, U), s), console.log("API initialized with:", {
325
+ apiUrl: U.apiUrl,
326
+ apiKey: U.apiKey ? `${U.apiKey.substring(0, 6)}...` : null,
327
+ hasWalletAddresses: Object.keys(U.merchantWalletAddresses || {}).length > 0
328
328
  });
329
- }, J = () => ({
329
+ }, Y = () => ({
330
330
  "Content-Type": "application/json",
331
- "x-api-key": P.apiKey,
332
- "x-api-secret": P.apiSecret
331
+ "x-api-key": U.apiKey,
332
+ "x-api-secret": U.apiSecret
333
333
  }), ut = (s) => R(void 0, null, function* () {
334
334
  try {
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`, {
335
+ console.log("Creating payment with data:", s), console.log("API URL:", `${U.apiUrl}/api/payments/create`);
336
+ const t = we(z({}, s), {
337
+ merchantWalletAddresses: z(z({}, U.merchantWalletAddresses), s.merchantWalletAddresses)
338
+ }), e = yield fetch(`${U.apiUrl}/api/payments/create`, {
339
339
  method: "POST",
340
- headers: J(),
341
- body: JSON.stringify(r)
340
+ headers: Y(),
341
+ body: JSON.stringify(t)
342
342
  });
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;
343
+ if (console.log("Create payment response status:", e.status), !e.ok) {
344
+ const c = yield e.json();
345
+ throw console.error("Error creating payment:", c), new Error(c.error || `Failed to create payment: ${e.status}`);
346
+ }
347
+ const i = yield e.json();
348
+ return console.log("Create payment response data:", i), i;
349
+ } catch (t) {
350
+ throw console.error("Create payment error:", t), t;
351
351
  }
352
- }), It = (s) => R(void 0, null, function* () {
352
+ }), Bt = (s) => R(void 0, null, function* () {
353
353
  try {
354
354
  console.log("Getting payment:", s);
355
- const r = yield fetch(`${P.apiUrl}/api/payments/${s}`, {
355
+ const t = yield fetch(`${U.apiUrl}/api/payments/${s}`, {
356
356
  method: "GET",
357
- headers: J()
357
+ headers: Y()
358
358
  });
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;
359
+ if (!t.ok) {
360
+ const i = yield t.json();
361
+ throw console.error("Error getting payment:", i), new Error(i.error || `Failed to get payment: ${t.status}`);
362
+ }
363
+ const e = yield t.json();
364
+ return console.log("Get payment response:", e), e;
365
+ } catch (t) {
366
+ throw console.error("Get payment error:", t), t;
367
367
  }
368
368
  }), ht = (s) => R(void 0, null, function* () {
369
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`, {
370
+ console.log("Processing payment with data:", s), console.log("API URL:", `${U.apiUrl}/api/payments/process`);
371
+ const t = yield fetch(`${U.apiUrl}/api/payments/process`, {
372
372
  method: "POST",
373
- headers: J(),
373
+ headers: Y(),
374
374
  body: JSON.stringify(s)
375
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;
376
+ if (console.log("Process payment response status:", t.status), !t.ok) {
377
+ const i = yield t.json();
378
+ throw console.error("Error processing payment:", i), new Error(i.error || `Failed to process payment: ${t.status}`);
379
+ }
380
+ const e = yield t.json();
381
+ return console.log("Process payment response data:", e), e;
382
+ } catch (t) {
383
+ throw console.error("Process payment error:", t), t;
384
384
  }
385
- }), Ft = () => R(void 0, null, function* () {
385
+ }), Wt = () => R(void 0, null, function* () {
386
386
  try {
387
- const s = yield fetch(`${P.apiUrl}/api/networks`, {
387
+ const s = yield fetch(`${U.apiUrl}/api/networks`, {
388
388
  method: "GET",
389
- headers: J()
389
+ headers: Y()
390
390
  });
391
391
  if (!s.ok) {
392
- const t = yield s.json();
393
- throw new Error(t.error || `Failed to get networks: ${s.status}`);
392
+ const e = yield s.json();
393
+ throw new Error(e.error || `Failed to get networks: ${s.status}`);
394
394
  }
395
395
  return yield s.json();
396
396
  } catch (s) {
397
397
  throw console.error("Get supported networks error:", s), s;
398
398
  }
399
- }), Bt = () => R(void 0, null, function* () {
399
+ }), Qt = () => R(void 0, null, function* () {
400
400
  try {
401
- const s = yield fetch(`${P.apiUrl}/api/merchants/profile`, {
401
+ const s = yield fetch(`${U.apiUrl}/api/merchants/profile`, {
402
402
  method: "GET",
403
- headers: J()
403
+ headers: Y()
404
404
  });
405
405
  if (!s.ok) {
406
- const t = yield s.json();
407
- throw new Error(t.error || `Failed to get merchant profile: ${s.status}`);
406
+ const e = yield s.json();
407
+ throw new Error(e.error || `Failed to get merchant profile: ${s.status}`);
408
408
  }
409
- const r = yield s.json();
410
- return r.merchant && r.merchant.walletAddresses && (P.merchantWalletAddresses = z(z({}, P.merchantWalletAddresses), r.merchant.walletAddresses)), r;
409
+ const t = yield s.json();
410
+ return t.merchant && t.merchant.walletAddresses && (U.merchantWalletAddresses = z(z({}, U.merchantWalletAddresses), t.merchant.walletAddresses)), t;
411
411
  } catch (s) {
412
412
  throw console.error("Get merchant profile error:", s), s;
413
413
  }
414
- }), Wt = (s, r) => R(void 0, null, function* () {
414
+ }), zt = (s, t) => R(void 0, null, function* () {
415
415
  try {
416
- const t = yield fetch(`${P.apiUrl}/api/wallets/validate`, {
416
+ const e = yield fetch(`${U.apiUrl}/api/wallets/validate`, {
417
417
  method: "POST",
418
- headers: J(),
419
- body: JSON.stringify({ address: s, network: r })
418
+ headers: Y(),
419
+ body: JSON.stringify({ address: s, network: t })
420
420
  });
421
- if (!t.ok) {
422
- const u = yield t.json();
423
- throw new Error(u.error || `Failed to validate address: ${t.status}`);
421
+ if (!e.ok) {
422
+ const c = yield e.json();
423
+ throw new Error(c.error || `Failed to validate address: ${e.status}`);
424
424
  }
425
- return yield t.json();
426
- } catch (t) {
427
- throw console.error("Validate wallet address error:", t), t;
425
+ return yield e.json();
426
+ } catch (e) {
427
+ throw console.error("Validate wallet address error:", e), e;
428
428
  }
429
- }), Qt = (s = "ethereum") => {
430
- const t = {
429
+ }), Gt = (s = "ethereum") => {
430
+ const e = {
431
431
  ethereum: "0x",
432
432
  bsc: "0x",
433
433
  tron: "",
434
434
  algorand: ""
435
- }[s] || "0x", c = Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
436
- return `${t}${c}`;
435
+ }[s] || "0x", i = Array.from({ length: 64 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
436
+ return `${e}${i}`;
437
437
  };
438
- var be = { exports: {} }, ne = {};
438
+ var Ne = { exports: {} }, ne = {};
439
439
  /**
440
440
  * @license React
441
441
  * react-jsx-runtime.production.min.js
@@ -445,93 +445,93 @@ var be = { exports: {} }, ne = {};
445
445
  * This source code is licensed under the MIT license found in the
446
446
  * LICENSE file in the root directory of this source tree.
447
447
  */
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]);
448
+ var mt = L, gt = Symbol.for("react.element"), ft = Symbol.for("react.fragment"), wt = Object.prototype.hasOwnProperty, pt = mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, xt = { key: !0, ref: !0, __self: !0, __source: !0 };
449
+ function Ee(s, t, e) {
450
+ var i, c = {}, u = null, y = null;
451
+ e !== void 0 && (u = "" + e), t.key !== void 0 && (u = "" + t.key), t.ref !== void 0 && (y = t.ref);
452
+ for (i in t)
453
+ wt.call(t, i) && !xt.hasOwnProperty(i) && (c[i] = t[i]);
454
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 };
455
+ for (i in t = s.defaultProps, t)
456
+ c[i] === void 0 && (c[i] = t[i]);
457
+ return { $$typeof: gt, type: s, key: u, ref: y, props: c, _owner: pt.current };
458
458
  }
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");
459
+ ne.Fragment = ft;
460
+ ne.jsx = Ee;
461
+ ne.jsxs = Ee;
462
+ Ne.exports = ne;
463
+ var o = Ne.exports;
464
+ const ve = xe(), yt = () => ye(ve), qt = ({ initialTheme: s = "light", children: t }) => {
465
+ const [e, i] = D(s), c = () => {
466
+ i((u) => u === "light" ? "dark" : "light");
467
467
  };
468
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 = ({
469
+ document.documentElement.classList.remove("light", "dark"), document.documentElement.classList.add(e);
470
+ }, [e]), /* @__PURE__ */ o.jsx(ve.Provider, { value: { theme: e, setTheme: i, toggleTheme: c }, children: t });
471
+ }, ke = xe(), bt = () => ye(ke), Ht = ({
472
472
  apiKey: s,
473
- apiSecret: r,
474
- apiUrl: t = "http://localhost:9000",
475
- merchantWalletAddress: c = null,
473
+ apiSecret: t,
474
+ apiUrl: e = "http://localhost:9000",
475
+ merchantWalletAddress: i = null,
476
476
  // New prop for merchant wallet address
477
- merchantSolWalletAddress: u = null,
477
+ merchantSolWalletAddress: c = null,
478
478
  // New prop for Solana wallet address
479
- debug: h = !1,
479
+ debug: u = !1,
480
480
  children: y
481
481
  }) => {
482
- const [w, e] = U(!1), [n, o] = U(null), [i, l] = U(null);
482
+ const [x, r] = D(!1), [n, a] = D(null), [l, d] = D(null);
483
483
  Z(() => {
484
- if (!s || !r) {
485
- o("API key and secret are required");
484
+ if (!s || !t) {
485
+ a("API key and secret are required");
486
486
  return;
487
487
  }
488
488
  try {
489
489
  dt({
490
490
  apiKey: s,
491
- apiSecret: r,
492
- apiUrl: t,
493
- merchantWalletAddress: c,
491
+ apiSecret: t,
492
+ apiUrl: e,
493
+ merchantWalletAddress: i,
494
494
  // Pass wallet address to API service
495
- merchantSolWalletAddress: u
496
- }), e(!0), h && console.log("Coinley SDK initialized with:", {
495
+ merchantSolWalletAddress: c
496
+ }), r(!0), u && console.log("Coinley SDK initialized with:", {
497
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"
498
+ apiUrl: e,
499
+ merchantWalletAddress: i ? `${i.substring(0, 6)}...${i.substring(i.length - 4)}` : "Not provided",
500
+ merchantSolWalletAddress: c ? `${c.substring(0, 6)}...${c.substring(c.length - 4)}` : "Not provided"
501
501
  });
502
502
  } catch (m) {
503
- o(m.message), h && console.error("Coinley SDK initialization error:", m);
503
+ a(m.message), u && console.error("Coinley SDK initialization error:", m);
504
504
  }
505
- }, [s, r, t, c, u, h]);
506
- const d = {
505
+ }, [s, t, e, i, c, u]);
506
+ const h = {
507
507
  apiKey: s,
508
- apiSecret: r,
509
- apiUrl: t,
510
- merchantWalletAddress: c,
511
- merchantSolWalletAddress: u,
512
- isInitialized: w,
508
+ apiSecret: t,
509
+ apiUrl: e,
510
+ merchantWalletAddress: i,
511
+ merchantSolWalletAddress: c,
512
+ isInitialized: x,
513
513
  error: n,
514
- debug: h,
515
- paymentData: i,
516
- storePaymentData: (m) => (l(m), m)
514
+ debug: u,
515
+ paymentData: l,
516
+ storePaymentData: (m) => (d(m), m)
517
517
  };
518
- return /* @__PURE__ */ a.jsx(Te.Provider, { value: d, children: y });
518
+ return /* @__PURE__ */ o.jsx(ke.Provider, { value: h, children: y });
519
519
  };
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]);
520
+ var Nt = Object.defineProperty, se = Object.getOwnPropertySymbols, Te = Object.prototype.hasOwnProperty, Ae = Object.prototype.propertyIsEnumerable, pe = (s, t, e) => t in s ? Nt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, le = (s, t) => {
521
+ for (var e in t || (t = {}))
522
+ Te.call(t, e) && pe(s, e, t[e]);
523
523
  if (se)
524
- for (var t of se(r))
525
- je.call(r, t) && pe(s, t, r[t]);
524
+ for (var e of se(t))
525
+ Ae.call(t, e) && pe(s, e, t[e]);
526
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]);
527
+ }, ce = (s, t) => {
528
+ var e = {};
529
+ for (var i in s)
530
+ Te.call(s, i) && t.indexOf(i) < 0 && (e[i] = s[i]);
531
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;
532
+ for (var i of se(s))
533
+ t.indexOf(i) < 0 && Ae.call(s, i) && (e[i] = s[i]);
534
+ return e;
535
535
  };
536
536
  /**
537
537
  * @license QR Code generator library (TypeScript)
@@ -540,34 +540,34 @@ var Et = Object.defineProperty, se = Object.getOwnPropertySymbols, Ce = Object.p
540
540
  */
541
541
  var K;
542
542
  ((s) => {
543
- const r = class E {
543
+ const t = class E {
544
544
  /*-- Constructor (low level) and fields --*/
545
545
  // Creates a new QR Code with the given version number,
546
546
  // error correction level, data codeword bytes, and mask number.
547
547
  // This is a low-level API that most users should not use directly.
548
548
  // A mid-level API is the encodeSegments() function.
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)
549
+ constructor(r, n, a, l) {
550
+ if (this.version = r, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], r < E.MIN_VERSION || r > E.MAX_VERSION)
551
551
  throw new RangeError("Version value out of range");
552
- if (i < -1 || i > 7)
552
+ if (l < -1 || l > 7)
553
553
  throw new RangeError("Mask value out of range");
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());
554
+ this.size = r * 4 + 17;
555
+ let d = [];
556
+ for (let h = 0; h < this.size; h++)
557
+ d.push(!1);
558
+ for (let h = 0; h < this.size; h++)
559
+ this.modules.push(d.slice()), this.isFunction.push(d.slice());
560
560
  this.drawFunctionPatterns();
561
- const f = this.addEccAndInterleave(o);
562
- if (this.drawCodewords(f), i == -1) {
563
- let d = 1e9;
561
+ const g = this.addEccAndInterleave(a);
562
+ if (this.drawCodewords(g), l == -1) {
563
+ let h = 1e9;
564
564
  for (let m = 0; m < 8; m++) {
565
565
  this.applyMask(m), this.drawFormatBits(m);
566
- const g = this.getPenaltyScore();
567
- g < d && (i = m, d = g), this.applyMask(m);
566
+ const f = this.getPenaltyScore();
567
+ f < h && (l = m, h = f), this.applyMask(m);
568
568
  }
569
569
  }
570
- u(0 <= i && i <= 7), this.mask = i, this.applyMask(i), this.drawFormatBits(i), this.isFunction = [];
570
+ c(0 <= l && l <= 7), this.mask = l, this.applyMask(l), this.drawFormatBits(l), this.isFunction = [];
571
571
  }
572
572
  /*-- Static factory functions (high level) --*/
573
573
  // Returns a QR Code representing the given Unicode text string at the given error correction level.
@@ -575,17 +575,17 @@ var K;
575
575
  // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
576
576
  // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
577
577
  // ecl argument if it can be done without increasing the version.
578
- static encodeText(e, n) {
579
- const o = s.QrSegment.makeSegments(e);
580
- return E.encodeSegments(o, n);
578
+ static encodeText(r, n) {
579
+ const a = s.QrSegment.makeSegments(r);
580
+ return E.encodeSegments(a, n);
581
581
  }
582
582
  // Returns a QR Code representing the given binary data at the given error correction level.
583
583
  // This function always encodes using the binary segment mode, not any text mode. The maximum number of
584
584
  // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
585
585
  // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
586
- static encodeBinary(e, n) {
587
- const o = s.QrSegment.makeBytes(e);
588
- return E.encodeSegments([o], n);
586
+ static encodeBinary(r, n) {
587
+ const a = s.QrSegment.makeBytes(r);
588
+ return E.encodeSegments([a], n);
589
589
  }
590
590
  /*-- Static factory functions (mid level) --*/
591
591
  // Returns a QR Code representing the given segments with the given encoding parameters.
@@ -597,43 +597,43 @@ var K;
597
597
  // This function allows the user to create a custom sequence of segments that switches
598
598
  // between modes (such as alphanumeric and byte) to encode text in less space.
599
599
  // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
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)
600
+ static encodeSegments(r, n, a = 1, l = 40, d = -1, g = !0) {
601
+ if (!(E.MIN_VERSION <= a && a <= l && l <= E.MAX_VERSION) || d < -1 || d > 7)
602
602
  throw new RangeError("Invalid value");
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;
603
+ let h, m;
604
+ for (h = a; ; h++) {
605
+ const p = E.getNumDataCodewords(h, n) * 8, T = y.getTotalBits(r, h);
606
+ if (T <= p) {
607
+ m = T;
608
608
  break;
609
609
  }
610
- if (d >= i)
610
+ if (h >= l)
611
611
  throw new RangeError("Data too long");
612
612
  }
613
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);
614
+ g && m <= E.getNumDataCodewords(h, p) * 8 && (n = p);
615
+ let f = [];
616
+ for (const p of r) {
617
+ e(p.mode.modeBits, 4, f), e(p.numChars, p.mode.numCharCountBits(h), f);
618
+ for (const T of p.getData())
619
+ f.push(T);
620
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);
621
+ c(f.length == m);
622
+ const k = E.getNumDataCodewords(h, n) * 8;
623
+ c(f.length <= k), e(0, Math.min(4, k - f.length), f), e(0, (8 - f.length % 8) % 8, f), c(f.length % 8 == 0);
624
+ for (let p = 236; f.length < k; p ^= 253)
625
+ e(p, 8, f);
626
+ let w = [];
627
+ for (; w.length * 8 < f.length; )
628
+ w.push(0);
629
+ return f.forEach((p, T) => w[T >>> 3] |= p << 7 - (T & 7)), new E(h, n, w, d);
630
630
  }
631
631
  /*-- Accessor methods --*/
632
632
  // Returns the color of the module (pixel) at the given coordinates, which is false
633
633
  // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
634
634
  // If the given coordinates are out of bounds, then false (light) is returned.
635
- getModule(e, n) {
636
- return 0 <= e && e < this.size && 0 <= n && n < this.size && this.modules[n][e];
635
+ getModule(r, n) {
636
+ return 0 <= r && r < this.size && 0 <= n && n < this.size && this.modules[n][r];
637
637
  }
638
638
  // Modified to expose modules for easy access
639
639
  getModules() {
@@ -642,33 +642,33 @@ var K;
642
642
  /*-- Private helper methods for constructor: Drawing function modules --*/
643
643
  // Reads this object's version field, and draws and marks all function modules.
644
644
  drawFunctionPatterns() {
645
- for (let o = 0; o < this.size; o++)
646
- this.setFunctionModule(6, o, o % 2 == 0), this.setFunctionModule(o, 6, o % 2 == 0);
645
+ for (let a = 0; a < this.size; a++)
646
+ this.setFunctionModule(6, a, a % 2 == 0), this.setFunctionModule(a, 6, a % 2 == 0);
647
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]);
648
+ const r = this.getAlignmentPatternPositions(), n = r.length;
649
+ for (let a = 0; a < n; a++)
650
+ for (let l = 0; l < n; l++)
651
+ a == 0 && l == 0 || a == 0 && l == n - 1 || a == n - 1 && l == 0 || this.drawAlignmentPattern(r[a], r[l]);
652
652
  this.drawFormatBits(0), this.drawVersion();
653
653
  }
654
654
  // Draws two copies of the format bits (with its own error correction code)
655
655
  // based on the given mask and this object's error correction level field.
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));
656
+ drawFormatBits(r) {
657
+ const n = this.errorCorrectionLevel.formatBits << 3 | r;
658
+ let a = n;
659
+ for (let d = 0; d < 10; d++)
660
+ a = a << 1 ^ (a >>> 9) * 1335;
661
+ const l = (n << 10 | a) ^ 21522;
662
+ c(l >>> 15 == 0);
663
+ for (let d = 0; d <= 5; d++)
664
+ this.setFunctionModule(8, d, i(l, d));
665
+ this.setFunctionModule(8, 7, i(l, 6)), this.setFunctionModule(8, 8, i(l, 7)), this.setFunctionModule(7, 8, i(l, 8));
666
+ for (let d = 9; d < 15; d++)
667
+ this.setFunctionModule(14 - d, 8, i(l, d));
668
+ for (let d = 0; d < 8; d++)
669
+ this.setFunctionModule(this.size - 1 - d, 8, i(l, d));
670
+ for (let d = 8; d < 15; d++)
671
+ this.setFunctionModule(8, this.size - 15 + d, i(l, d));
672
672
  this.setFunctionModule(8, this.size - 8, !0);
673
673
  }
674
674
  // Draws two copies of the version bits (with its own error correction code),
@@ -676,144 +676,144 @@ var K;
676
676
  drawVersion() {
677
677
  if (this.version < 7)
678
678
  return;
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);
679
+ let r = this.version;
680
+ for (let a = 0; a < 12; a++)
681
+ r = r << 1 ^ (r >>> 11) * 7973;
682
+ const n = this.version << 12 | r;
683
+ c(n >>> 18 == 0);
684
+ for (let a = 0; a < 18; a++) {
685
+ const l = i(n, a), d = this.size - 11 + a % 3, g = Math.floor(a / 3);
686
+ this.setFunctionModule(d, g, l), this.setFunctionModule(g, d, l);
687
687
  }
688
688
  }
689
689
  // Draws a 9*9 finder pattern including the border separator,
690
690
  // with the center module at (x, y). Modules can be out of bounds.
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);
691
+ drawFinderPattern(r, n) {
692
+ for (let a = -4; a <= 4; a++)
693
+ for (let l = -4; l <= 4; l++) {
694
+ const d = Math.max(Math.abs(l), Math.abs(a)), g = r + l, h = n + a;
695
+ 0 <= g && g < this.size && 0 <= h && h < this.size && this.setFunctionModule(g, h, d != 2 && d != 4);
696
696
  }
697
697
  }
698
698
  // Draws a 5*5 alignment pattern, with the center module
699
699
  // at (x, y). All modules must be in bounds.
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);
700
+ drawAlignmentPattern(r, n) {
701
+ for (let a = -2; a <= 2; a++)
702
+ for (let l = -2; l <= 2; l++)
703
+ this.setFunctionModule(r + l, n + a, Math.max(Math.abs(l), Math.abs(a)) != 1);
704
704
  }
705
705
  // Sets the color of a module and marks it as a function module.
706
706
  // Only used by the constructor. Coordinates must be in bounds.
707
- setFunctionModule(e, n, o) {
708
- this.modules[n][e] = o, this.isFunction[n][e] = !0;
707
+ setFunctionModule(r, n, a) {
708
+ this.modules[n][r] = a, this.isFunction[n][r] = !0;
709
709
  }
710
710
  /*-- Private helper methods for constructor: Codewords and masking --*/
711
711
  // Returns a new byte string representing the given data with the appropriate error correction
712
712
  // codewords appended to it, based on this object's version and error correction level.
713
- addEccAndInterleave(e) {
714
- const n = this.version, o = this.errorCorrectionLevel;
715
- if (e.length != E.getNumDataCodewords(n, o))
713
+ addEccAndInterleave(r) {
714
+ const n = this.version, a = this.errorCorrectionLevel;
715
+ if (r.length != E.getNumDataCodewords(n, a))
716
716
  throw new RangeError("Invalid argument");
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));
717
+ const l = E.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][n], d = E.ECC_CODEWORDS_PER_BLOCK[a.ordinal][n], g = Math.floor(E.getNumRawDataModules(n) / 8), h = l - g % l, m = Math.floor(g / l);
718
+ let f = [];
719
+ const k = E.reedSolomonComputeDivisor(d);
720
+ for (let p = 0, T = 0; p < l; p++) {
721
+ let C = r.slice(T, T + m - d + (p < h ? 0 : 1));
722
+ T += C.length;
723
+ const q = E.reedSolomonComputeRemainder(C, k);
724
+ p < h && C.push(0), f.push(C.concat(q));
725
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]);
726
+ let w = [];
727
+ for (let p = 0; p < f[0].length; p++)
728
+ f.forEach((T, C) => {
729
+ (p != m - d || C >= h) && w.push(T[p]);
730
730
  });
731
- return u(v.length == f), v;
731
+ return c(w.length == g), w;
732
732
  }
733
733
  // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
734
734
  // data area of this QR Code. Function modules need to be marked off before this is called.
735
- drawCodewords(e) {
736
- if (e.length != Math.floor(E.getNumRawDataModules(this.version) / 8))
735
+ drawCodewords(r) {
736
+ if (r.length != Math.floor(E.getNumRawDataModules(this.version) / 8))
737
737
  throw new RangeError("Invalid argument");
738
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++);
739
+ for (let a = this.size - 1; a >= 1; a -= 2) {
740
+ a == 6 && (a = 5);
741
+ for (let l = 0; l < this.size; l++)
742
+ for (let d = 0; d < 2; d++) {
743
+ const g = a - d, m = (a + 1 & 2) == 0 ? this.size - 1 - l : l;
744
+ !this.isFunction[m][g] && n < r.length * 8 && (this.modules[m][g] = i(r[n >>> 3], 7 - (n & 7)), n++);
745
745
  }
746
746
  }
747
- u(n == e.length * 8);
747
+ c(n == r.length * 8);
748
748
  }
749
749
  // XORs the codeword modules in this QR Code with the given mask pattern.
750
750
  // The function modules must be marked and the codeword bits must be drawn
751
751
  // before masking. Due to the arithmetic of XOR, calling applyMask() with
752
752
  // the same mask value a second time will undo the mask. A final well-formed
753
753
  // QR Code needs exactly one (not zero, two, etc.) mask applied.
754
- applyMask(e) {
755
- if (e < 0 || e > 7)
754
+ applyMask(r) {
755
+ if (r < 0 || r > 7)
756
756
  throw new RangeError("Mask value out of range");
757
757
  for (let n = 0; n < this.size; n++)
758
- for (let o = 0; o < this.size; o++) {
759
- let i;
760
- switch (e) {
758
+ for (let a = 0; a < this.size; a++) {
759
+ let l;
760
+ switch (r) {
761
761
  case 0:
762
- i = (o + n) % 2 == 0;
762
+ l = (a + n) % 2 == 0;
763
763
  break;
764
764
  case 1:
765
- i = n % 2 == 0;
765
+ l = n % 2 == 0;
766
766
  break;
767
767
  case 2:
768
- i = o % 3 == 0;
768
+ l = a % 3 == 0;
769
769
  break;
770
770
  case 3:
771
- i = (o + n) % 3 == 0;
771
+ l = (a + n) % 3 == 0;
772
772
  break;
773
773
  case 4:
774
- i = (Math.floor(o / 3) + Math.floor(n / 2)) % 2 == 0;
774
+ l = (Math.floor(a / 3) + Math.floor(n / 2)) % 2 == 0;
775
775
  break;
776
776
  case 5:
777
- i = o * n % 2 + o * n % 3 == 0;
777
+ l = a * n % 2 + a * n % 3 == 0;
778
778
  break;
779
779
  case 6:
780
- i = (o * n % 2 + o * n % 3) % 2 == 0;
780
+ l = (a * n % 2 + a * n % 3) % 2 == 0;
781
781
  break;
782
782
  case 7:
783
- i = ((o + n) % 2 + o * n % 3) % 2 == 0;
783
+ l = ((a + n) % 2 + a * n % 3) % 2 == 0;
784
784
  break;
785
785
  default:
786
786
  throw new Error("Unreachable");
787
787
  }
788
- !this.isFunction[n][o] && i && (this.modules[n][o] = !this.modules[n][o]);
788
+ !this.isFunction[n][a] && l && (this.modules[n][a] = !this.modules[n][a]);
789
789
  }
790
790
  }
791
791
  // Calculates and returns the penalty score based on state of this QR Code's current modules.
792
792
  // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
793
793
  getPenaltyScore() {
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;
794
+ let r = 0;
795
+ for (let d = 0; d < this.size; d++) {
796
+ let g = !1, h = 0, m = [0, 0, 0, 0, 0, 0, 0];
797
+ for (let f = 0; f < this.size; f++)
798
+ this.modules[d][f] == g ? (h++, h == 5 ? r += E.PENALTY_N1 : h > 5 && r++) : (this.finderPenaltyAddHistory(h, m), g || (r += this.finderPenaltyCountPatterns(m) * E.PENALTY_N3), g = this.modules[d][f], h = 1);
799
+ r += this.finderPenaltyTerminateAndCount(g, h, m) * E.PENALTY_N3;
800
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;
801
+ for (let d = 0; d < this.size; d++) {
802
+ let g = !1, h = 0, m = [0, 0, 0, 0, 0, 0, 0];
803
+ for (let f = 0; f < this.size; f++)
804
+ this.modules[f][d] == g ? (h++, h == 5 ? r += E.PENALTY_N1 : h > 5 && r++) : (this.finderPenaltyAddHistory(h, m), g || (r += this.finderPenaltyCountPatterns(m) * E.PENALTY_N3), g = this.modules[f][d], h = 1);
805
+ r += this.finderPenaltyTerminateAndCount(g, h, m) * E.PENALTY_N3;
806
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);
807
+ for (let d = 0; d < this.size - 1; d++)
808
+ for (let g = 0; g < this.size - 1; g++) {
809
+ const h = this.modules[d][g];
810
+ h == this.modules[d][g + 1] && h == this.modules[d + 1][g] && h == this.modules[d + 1][g + 1] && (r += E.PENALTY_N2);
811
811
  }
812
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;
813
+ for (const d of this.modules)
814
+ n = d.reduce((g, h) => g + (h ? 1 : 0), n);
815
+ const a = this.size * this.size, l = Math.ceil(Math.abs(n * 20 - a * 10) / a) - 1;
816
+ return c(0 <= l && l <= 9), r += l * E.PENALTY_N4, c(0 <= r && r <= 2568888), r;
817
817
  }
818
818
  /*-- Private helper functions --*/
819
819
  // Returns an ascending list of positions of alignment patterns for this version number.
@@ -823,86 +823,86 @@ var K;
823
823
  if (this.version == 1)
824
824
  return [];
825
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;
826
+ const r = Math.floor(this.version / 7) + 2, n = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (r * 2 - 2)) * 2;
827
+ let a = [6];
828
+ for (let l = this.size - 7; a.length < r; l -= n)
829
+ a.splice(1, 0, l);
830
+ return a;
831
831
  }
832
832
  }
833
833
  // Returns the number of data bits that can be stored in a QR Code of the given version number, after
834
834
  // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
835
835
  // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
836
- static getNumRawDataModules(e) {
837
- if (e < E.MIN_VERSION || e > E.MAX_VERSION)
836
+ static getNumRawDataModules(r) {
837
+ if (r < E.MIN_VERSION || r > E.MAX_VERSION)
838
838
  throw new RangeError("Version number out of range");
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);
839
+ let n = (16 * r + 128) * r + 64;
840
+ if (r >= 2) {
841
+ const a = Math.floor(r / 7) + 2;
842
+ n -= (25 * a - 10) * a - 55, r >= 7 && (n -= 36);
843
843
  }
844
- return u(208 <= n && n <= 29648), n;
844
+ return c(208 <= n && n <= 29648), n;
845
845
  }
846
846
  // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
847
847
  // QR Code of the given version number and error correction level, with remainder bits discarded.
848
848
  // This stateless pure function could be implemented as a (40*4)-cell lookup table.
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];
849
+ static getNumDataCodewords(r, n) {
850
+ return Math.floor(E.getNumRawDataModules(r) / 8) - E.ECC_CODEWORDS_PER_BLOCK[n.ordinal][r] * E.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][r];
851
851
  }
852
852
  // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
853
853
  // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
854
- static reedSolomonComputeDivisor(e) {
855
- if (e < 1 || e > 255)
854
+ static reedSolomonComputeDivisor(r) {
855
+ if (r < 1 || r > 255)
856
856
  throw new RangeError("Degree out of range");
857
857
  let n = [];
858
- for (let i = 0; i < e - 1; i++)
858
+ for (let l = 0; l < r - 1; l++)
859
859
  n.push(0);
860
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);
861
+ let a = 1;
862
+ for (let l = 0; l < r; l++) {
863
+ for (let d = 0; d < n.length; d++)
864
+ n[d] = E.reedSolomonMultiply(n[d], a), d + 1 < n.length && (n[d] ^= n[d + 1]);
865
+ a = E.reedSolomonMultiply(a, 2);
866
866
  }
867
867
  return n;
868
868
  }
869
869
  // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
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));
870
+ static reedSolomonComputeRemainder(r, n) {
871
+ let a = n.map((l) => 0);
872
+ for (const l of r) {
873
+ const d = l ^ a.shift();
874
+ a.push(0), n.forEach((g, h) => a[h] ^= E.reedSolomonMultiply(g, d));
875
875
  }
876
- return o;
876
+ return a;
877
877
  }
878
878
  // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
879
879
  // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
880
- static reedSolomonMultiply(e, n) {
881
- if (e >>> 8 || n >>> 8)
880
+ static reedSolomonMultiply(r, n) {
881
+ if (r >>> 8 || n >>> 8)
882
882
  throw new RangeError("Byte out of range");
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;
883
+ let a = 0;
884
+ for (let l = 7; l >= 0; l--)
885
+ a = a << 1 ^ (a >>> 7) * 285, a ^= (n >>> l & 1) * r;
886
+ return c(a >>> 8 == 0), a;
887
887
  }
888
888
  // Can only be called immediately after a light run is added, and
889
889
  // returns either 0, 1, or 2. A helper function for getPenaltyScore().
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);
890
+ finderPenaltyCountPatterns(r) {
891
+ const n = r[1];
892
+ c(n <= this.size * 3);
893
+ const a = n > 0 && r[2] == n && r[3] == n * 3 && r[4] == n && r[5] == n;
894
+ return (a && r[0] >= n * 4 && r[6] >= n ? 1 : 0) + (a && r[6] >= n * 4 && r[0] >= n ? 1 : 0);
895
895
  }
896
896
  // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
897
- finderPenaltyTerminateAndCount(e, n, o) {
898
- return e && (this.finderPenaltyAddHistory(n, o), n = 0), n += this.size, this.finderPenaltyAddHistory(n, o), this.finderPenaltyCountPatterns(o);
897
+ finderPenaltyTerminateAndCount(r, n, a) {
898
+ return r && (this.finderPenaltyAddHistory(n, a), n = 0), n += this.size, this.finderPenaltyAddHistory(n, a), this.finderPenaltyCountPatterns(a);
899
899
  }
900
900
  // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
901
- finderPenaltyAddHistory(e, n) {
902
- n[0] == 0 && (e += this.size), n.pop(), n.unshift(e);
901
+ finderPenaltyAddHistory(r, n) {
902
+ n[0] == 0 && (r += this.size), n.pop(), n.unshift(r);
903
903
  }
904
904
  };
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 = [
905
+ t.MIN_VERSION = 1, t.MAX_VERSION = 40, t.PENALTY_N1 = 3, t.PENALTY_N2 = 3, t.PENALTY_N3 = 40, t.PENALTY_N4 = 10, t.ECC_CODEWORDS_PER_BLOCK = [
906
906
  // Version: (note that index 0 is for padding, and is set to an illegal value)
907
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
908
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],
@@ -913,7 +913,7 @@ var K;
913
913
  // Quartile
914
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]
915
915
  // High
916
- ], r.NUM_ERROR_CORRECTION_BLOCKS = [
916
+ ], t.NUM_ERROR_CORRECTION_BLOCKS = [
917
917
  // Version: (note that index 0 is for padding, and is set to an illegal value)
918
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
919
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],
@@ -924,95 +924,95 @@ var K;
924
924
  // Quartile
925
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]
926
926
  // High
927
- ], s.QrCode = r;
928
- function t(w, e, n) {
929
- if (e < 0 || e > 31 || w >>> e)
927
+ ], s.QrCode = t;
928
+ function e(x, r, n) {
929
+ if (r < 0 || r > 31 || x >>> r)
930
930
  throw new RangeError("Value out of range");
931
- for (let o = e - 1; o >= 0; o--)
932
- n.push(w >>> o & 1);
931
+ for (let a = r - 1; a >= 0; a--)
932
+ n.push(x >>> a & 1);
933
933
  }
934
- function c(w, e) {
935
- return (w >>> e & 1) != 0;
934
+ function i(x, r) {
935
+ return (x >>> r & 1) != 0;
936
936
  }
937
- function u(w) {
938
- if (!w)
937
+ function c(x) {
938
+ if (!x)
939
939
  throw new Error("Assertion error");
940
940
  }
941
- const h = class k {
941
+ const u = class j {
942
942
  /*-- Constructor (low level) and fields --*/
943
943
  // Creates a new QR Code segment with the given attributes and data.
944
944
  // The character count (numChars) must agree with the mode and the bit buffer length,
945
945
  // but the constraint isn't checked. The given bit buffer is cloned and stored.
946
- constructor(e, n, o) {
947
- if (this.mode = e, this.numChars = n, this.bitData = o, n < 0)
946
+ constructor(r, n, a) {
947
+ if (this.mode = r, this.numChars = n, this.bitData = a, n < 0)
948
948
  throw new RangeError("Invalid argument");
949
- this.bitData = o.slice();
949
+ this.bitData = a.slice();
950
950
  }
951
951
  /*-- Static factory functions (mid level) --*/
952
952
  // Returns a segment representing the given binary data encoded in
953
953
  // byte mode. All input byte arrays are acceptable. Any text string
954
954
  // can be converted to UTF-8 bytes and encoded as a byte mode segment.
955
- static makeBytes(e) {
955
+ static makeBytes(r) {
956
956
  let n = [];
957
- for (const o of e)
958
- t(o, 8, n);
959
- return new k(k.Mode.BYTE, e.length, n);
957
+ for (const a of r)
958
+ e(a, 8, n);
959
+ return new j(j.Mode.BYTE, r.length, n);
960
960
  }
961
961
  // Returns a segment representing the given string of decimal digits encoded in numeric mode.
962
- static makeNumeric(e) {
963
- if (!k.isNumeric(e))
962
+ static makeNumeric(r) {
963
+ if (!j.isNumeric(r))
964
964
  throw new RangeError("String contains non-numeric characters");
965
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;
966
+ for (let a = 0; a < r.length; ) {
967
+ const l = Math.min(r.length - a, 3);
968
+ e(parseInt(r.substring(a, a + l), 10), l * 3 + 1, n), a += l;
969
969
  }
970
- return new k(k.Mode.NUMERIC, e.length, n);
970
+ return new j(j.Mode.NUMERIC, r.length, n);
971
971
  }
972
972
  // Returns a segment representing the given text string encoded in alphanumeric mode.
973
973
  // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
974
974
  // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
975
- static makeAlphanumeric(e) {
976
- if (!k.isAlphanumeric(e))
975
+ static makeAlphanumeric(r) {
976
+ if (!j.isAlphanumeric(r))
977
977
  throw new RangeError("String contains unencodable characters in alphanumeric mode");
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);
978
+ let n = [], a;
979
+ for (a = 0; a + 2 <= r.length; a += 2) {
980
+ let l = j.ALPHANUMERIC_CHARSET.indexOf(r.charAt(a)) * 45;
981
+ l += j.ALPHANUMERIC_CHARSET.indexOf(r.charAt(a + 1)), e(l, 11, n);
982
982
  }
983
- return o < e.length && t(k.ALPHANUMERIC_CHARSET.indexOf(e.charAt(o)), 6, n), new k(k.Mode.ALPHANUMERIC, e.length, n);
983
+ return a < r.length && e(j.ALPHANUMERIC_CHARSET.indexOf(r.charAt(a)), 6, n), new j(j.Mode.ALPHANUMERIC, r.length, n);
984
984
  }
985
985
  // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
986
986
  // The result may use various segment modes and switch modes to optimize the length of the bit stream.
987
- static makeSegments(e) {
988
- return e == "" ? [] : k.isNumeric(e) ? [k.makeNumeric(e)] : k.isAlphanumeric(e) ? [k.makeAlphanumeric(e)] : [k.makeBytes(k.toUtf8ByteArray(e))];
987
+ static makeSegments(r) {
988
+ return r == "" ? [] : j.isNumeric(r) ? [j.makeNumeric(r)] : j.isAlphanumeric(r) ? [j.makeAlphanumeric(r)] : [j.makeBytes(j.toUtf8ByteArray(r))];
989
989
  }
990
990
  // Returns a segment representing an Extended Channel Interpretation
991
991
  // (ECI) designator with the given assignment value.
992
- static makeEci(e) {
992
+ static makeEci(r) {
993
993
  let n = [];
994
- if (e < 0)
994
+ if (r < 0)
995
995
  throw new RangeError("ECI assignment value out of range");
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);
996
+ if (r < 128)
997
+ e(r, 8, n);
998
+ else if (r < 16384)
999
+ e(2, 2, n), e(r, 14, n);
1000
+ else if (r < 1e6)
1001
+ e(6, 3, n), e(r, 21, n);
1002
1002
  else
1003
1003
  throw new RangeError("ECI assignment value out of range");
1004
- return new k(k.Mode.ECI, 0, n);
1004
+ return new j(j.Mode.ECI, 0, n);
1005
1005
  }
1006
1006
  // Tests whether the given string can be encoded as a segment in numeric mode.
1007
1007
  // A string is encodable iff each character is in the range 0 to 9.
1008
- static isNumeric(e) {
1009
- return k.NUMERIC_REGEX.test(e);
1008
+ static isNumeric(r) {
1009
+ return j.NUMERIC_REGEX.test(r);
1010
1010
  }
1011
1011
  // Tests whether the given string can be encoded as a segment in alphanumeric mode.
1012
1012
  // A string is encodable iff each character is in the following set: 0 to 9, A to Z
1013
1013
  // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
1014
- static isAlphanumeric(e) {
1015
- return k.ALPHANUMERIC_REGEX.test(e);
1014
+ static isAlphanumeric(r) {
1015
+ return j.ALPHANUMERIC_REGEX.test(r);
1016
1016
  }
1017
1017
  /*-- Methods --*/
1018
1018
  // Returns a new copy of the data bits of this segment.
@@ -1021,176 +1021,176 @@ var K;
1021
1021
  }
1022
1022
  // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
1023
1023
  // the given version. The result is infinity if a segment has too many characters to fit its length field.
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)
1024
+ static getTotalBits(r, n) {
1025
+ let a = 0;
1026
+ for (const l of r) {
1027
+ const d = l.mode.numCharCountBits(n);
1028
+ if (l.numChars >= 1 << d)
1029
1029
  return 1 / 0;
1030
- o += 4 + l + i.bitData.length;
1030
+ a += 4 + d + l.bitData.length;
1031
1031
  }
1032
- return o;
1032
+ return a;
1033
1033
  }
1034
1034
  // Returns a new array of bytes representing the given string encoded in UTF-8.
1035
- static toUtf8ByteArray(e) {
1036
- e = encodeURI(e);
1035
+ static toUtf8ByteArray(r) {
1036
+ r = encodeURI(r);
1037
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);
1038
+ for (let a = 0; a < r.length; a++)
1039
+ r.charAt(a) != "%" ? n.push(r.charCodeAt(a)) : (n.push(parseInt(r.substring(a + 1, a + 3), 16)), a += 2);
1040
1040
  return n;
1041
1041
  }
1042
1042
  };
1043
- h.NUMERIC_REGEX = /^[0-9]*$/, h.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, h.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
1044
- let y = h;
1045
- s.QrSegment = h;
1043
+ u.NUMERIC_REGEX = /^[0-9]*$/, u.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, u.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
1044
+ let y = u;
1045
+ s.QrSegment = u;
1046
1046
  })(K || (K = {}));
1047
1047
  ((s) => {
1048
- ((r) => {
1049
- const t = class {
1048
+ ((t) => {
1049
+ const e = class {
1050
1050
  // The QR Code can tolerate about 30% erroneous codewords
1051
1051
  /*-- Constructor and fields --*/
1052
- constructor(u, h) {
1053
- this.ordinal = u, this.formatBits = h;
1052
+ constructor(c, u) {
1053
+ this.ordinal = c, this.formatBits = u;
1054
1054
  }
1055
1055
  };
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;
1056
+ e.LOW = new e(0, 1), e.MEDIUM = new e(1, 0), e.QUARTILE = new e(2, 3), e.HIGH = new e(3, 2), t.Ecc = e;
1057
1057
  })(s.QrCode || (s.QrCode = {}));
1058
1058
  })(K || (K = {}));
1059
1059
  ((s) => {
1060
- ((r) => {
1061
- const t = class {
1060
+ ((t) => {
1061
+ const e = class {
1062
1062
  /*-- Constructor and fields --*/
1063
- constructor(u, h) {
1064
- this.modeBits = u, this.numBitsCharCount = h;
1063
+ constructor(c, u) {
1064
+ this.modeBits = c, this.numBitsCharCount = u;
1065
1065
  }
1066
1066
  /*-- Method --*/
1067
1067
  // (Package-private) Returns the bit width of the character count field for a segment in
1068
1068
  // this mode in a QR Code at the given version number. The result is in the range [0, 16].
1069
- numCharCountBits(u) {
1070
- return this.numBitsCharCount[Math.floor((u + 7) / 17)];
1069
+ numCharCountBits(c) {
1070
+ return this.numBitsCharCount[Math.floor((c + 7) / 17)];
1071
1071
  }
1072
1072
  };
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;
1073
+ e.NUMERIC = new e(1, [10, 12, 14]), e.ALPHANUMERIC = new e(2, [9, 11, 13]), e.BYTE = new e(4, [8, 16, 16]), e.KANJI = new e(8, [8, 10, 12]), e.ECI = new e(7, [0, 0, 0]), t.Mode = e;
1074
1074
  })(s.QrSegment || (s.QrSegment = {}));
1075
1075
  })(K || (K = {}));
1076
- var Y = K;
1076
+ var J = K;
1077
1077
  /**
1078
1078
  * @license qrcode.react
1079
1079
  * Copyright (c) Paul O'Shannessy
1080
1080
  * SPDX-License-Identifier: ISC
1081
1081
  */
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;
1082
+ var Et = {
1083
+ L: J.QrCode.Ecc.LOW,
1084
+ M: J.QrCode.Ecc.MEDIUM,
1085
+ Q: J.QrCode.Ecc.QUARTILE,
1086
+ H: J.QrCode.Ecc.HIGH
1087
+ }, Ce = 128, je = "L", Me = "#FFFFFF", Re = "#000000", Se = !1, Le = 1, vt = 4, kt = 0, Tt = 0.1;
1088
+ function Pe(s, t = 0) {
1089
+ const e = [];
1090
+ return s.forEach(function(i, c) {
1091
+ let u = null;
1092
+ i.forEach(function(y, x) {
1093
+ if (!y && u !== null) {
1094
+ e.push(
1095
+ `M${u + t} ${c + t}h${x - u}v1H${u + t}z`
1096
+ ), u = null;
1097
1097
  return;
1098
1098
  }
1099
- if (w === c.length - 1) {
1099
+ if (x === i.length - 1) {
1100
1100
  if (!y)
1101
1101
  return;
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`
1102
+ u === null ? e.push(`M${x + t},${c + t} h1v1H${x + t}z`) : e.push(
1103
+ `M${u + t},${c + t} h${x + 1 - u}v1H${u + t}z`
1104
1104
  );
1105
1105
  return;
1106
1106
  }
1107
- y && h === null && (h = w);
1107
+ y && u === null && (u = x);
1108
1108
  });
1109
- }), t.join("");
1109
+ }), e.join("");
1110
1110
  }
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));
1111
+ function De(s, t) {
1112
+ return s.slice().map((e, i) => i < t.y || i >= t.y + t.h ? e : e.map((c, u) => u < t.x || u >= t.x + t.w ? c : !1));
1113
1113
  }
1114
- function Ct(s, r, t, c) {
1115
- if (c == null)
1114
+ function At(s, t, e, i) {
1115
+ if (i == null)
1116
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 };
1117
+ const c = s.length + e * 2, u = Math.floor(t * Tt), y = c / t, x = (i.width || u) * y, r = (i.height || u) * y, n = i.x == null ? s.length / 2 - x / 2 : i.x * y, a = i.y == null ? s.length / 2 - r / 2 : i.y * y, l = i.opacity == null ? 1 : i.opacity;
1118
+ let d = null;
1119
+ if (i.excavate) {
1120
+ let h = Math.floor(n), m = Math.floor(a), f = Math.ceil(x + n - h), k = Math.ceil(r + a - m);
1121
+ d = { x: h, y: m, w: f, h: k };
1122
1122
  }
1123
- const f = c.crossOrigin;
1124
- return { x: n, y: o, h: e, w, excavation: l, opacity: i, crossOrigin: f };
1123
+ const g = i.crossOrigin;
1124
+ return { x: n, y: a, h: r, w: x, excavation: d, opacity: l, crossOrigin: g };
1125
1125
  }
1126
- function jt(s, r) {
1127
- return r != null ? Math.max(Math.floor(r), 0) : s ? At : vt;
1126
+ function Ct(s, t) {
1127
+ return t != null ? Math.max(Math.floor(t), 0) : s ? vt : kt;
1128
1128
  }
1129
1129
  function Ue({
1130
1130
  value: s,
1131
- level: r,
1132
- minVersion: t,
1133
- includeMargin: c,
1134
- marginSize: u,
1135
- imageSettings: h,
1131
+ level: t,
1132
+ minVersion: e,
1133
+ includeMargin: i,
1134
+ marginSize: c,
1135
+ imageSettings: u,
1136
1136
  size: y,
1137
- boostLevel: w
1137
+ boostLevel: x
1138
1138
  }) {
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,
1139
+ let r = L.useMemo(() => {
1140
+ const h = (Array.isArray(s) ? s : [s]).reduce((m, f) => (m.push(...J.QrSegment.makeSegments(f)), m), []);
1141
+ return J.QrCode.encodeSegments(
1142
+ h,
1143
+ Et[t],
1144
+ e,
1145
1145
  void 0,
1146
1146
  void 0,
1147
- w
1147
+ x
1148
1148
  );
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,
1149
+ }, [s, t, e, x]);
1150
+ const { cells: n, margin: a, numCells: l, calculatedImageSettings: d } = L.useMemo(() => {
1151
+ let g = r.getModules();
1152
+ const h = Ct(i, c), m = g.length + h * 2, f = At(
1153
+ g,
1154
1154
  y,
1155
- d,
1156
- h
1155
+ h,
1156
+ u
1157
1157
  );
1158
1158
  return {
1159
- cells: f,
1160
- margin: d,
1159
+ cells: g,
1160
+ margin: h,
1161
1161
  numCells: m,
1162
- calculatedImageSettings: g
1162
+ calculatedImageSettings: f
1163
1163
  };
1164
- }, [e, y, h, c, u]);
1164
+ }, [r, y, u, i, c]);
1165
1165
  return {
1166
- qrcode: e,
1167
- margin: o,
1166
+ qrcode: r,
1167
+ margin: a,
1168
1168
  cells: n,
1169
- numCells: i,
1170
- calculatedImageSettings: l
1169
+ numCells: l,
1170
+ calculatedImageSettings: d
1171
1171
  };
1172
1172
  }
1173
- var Mt = function() {
1173
+ var jt = function() {
1174
1174
  try {
1175
1175
  new Path2D().addPath(new Path2D());
1176
1176
  } catch (s) {
1177
1177
  return !1;
1178
1178
  }
1179
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, [
1180
+ }(), Mt = L.forwardRef(
1181
+ function(t, e) {
1182
+ const i = t, {
1183
+ value: c,
1184
+ size: u = Ce,
1185
+ level: y = je,
1186
+ bgColor: x = Me,
1187
+ fgColor: r = Re,
1188
+ includeMargin: n = Se,
1189
+ minVersion: a = Le,
1190
+ boostLevel: l,
1191
+ marginSize: d,
1192
+ imageSettings: g
1193
+ } = i, m = ce(i, [
1194
1194
  "value",
1195
1195
  "size",
1196
1196
  "level",
@@ -1201,92 +1201,92 @@ var Mt = function() {
1201
1201
  "boostLevel",
1202
1202
  "marginSize",
1203
1203
  "imageSettings"
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(
1204
+ ]), { style: f } = m, k = ce(m, ["style"]), w = g == null ? void 0 : g.src, p = L.useRef(null), T = L.useRef(null), C = L.useCallback(
1205
1205
  (W) => {
1206
- p.current = W, typeof t == "function" ? t(W) : t && (t.current = W);
1206
+ p.current = W, typeof e == "function" ? e(W) : e && (e.current = W);
1207
1207
  },
1208
- [t]
1209
- ), [F, V] = S.useState(!1), { margin: x, cells: T, numCells: q, calculatedImageSettings: I } = Ue({
1210
- value: u,
1208
+ [e]
1209
+ ), [q, H] = L.useState(!1), { margin: O, cells: M, numCells: v, calculatedImageSettings: S } = Ue({
1210
+ value: c,
1211
1211
  level: y,
1212
- minVersion: o,
1213
- boostLevel: i,
1212
+ minVersion: a,
1213
+ boostLevel: l,
1214
1214
  includeMargin: n,
1215
- marginSize: l,
1216
- imageSettings: f,
1217
- size: h
1215
+ marginSize: d,
1216
+ imageSettings: g,
1217
+ size: u
1218
1218
  });
1219
- S.useEffect(() => {
1219
+ L.useEffect(() => {
1220
1220
  if (p.current != null) {
1221
- const W = p.current, O = W.getContext("2d");
1222
- if (!O)
1221
+ const W = p.current, I = W.getContext("2d");
1222
+ if (!I)
1223
1223
  return;
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
1224
+ let V = M;
1225
+ const $ = T.current, te = S != null && $ !== null && $.complete && $.naturalHeight !== 0 && $.naturalWidth !== 0;
1226
+ te && S.excavation != null && (V = De(
1227
+ M,
1228
+ S.excavation
1229
1229
  ));
1230
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);
1231
+ W.height = W.width = u * X;
1232
+ const G = u / v * X;
1233
+ I.scale(G, G), I.fillStyle = x, I.fillRect(0, 0, v, v), I.fillStyle = r, jt ? I.fill(new Path2D(Pe(V, O))) : M.forEach(function(oe, re) {
1234
+ oe.forEach(function(ae, P) {
1235
+ ae && I.fillRect(P + O, re + O, 1, 1);
1236
1236
  });
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
1237
+ }), S && (I.globalAlpha = S.opacity), te && I.drawImage(
1238
+ $,
1239
+ S.x + O,
1240
+ S.y + O,
1241
+ S.w,
1242
+ S.h
1243
1243
  );
1244
1244
  }
1245
- }), S.useEffect(() => {
1246
- V(!1);
1247
- }, [v]);
1248
- const B = ie({ height: h, width: h }, g);
1245
+ }), L.useEffect(() => {
1246
+ H(!1);
1247
+ }, [w]);
1248
+ const B = le({ height: u, width: u }, f);
1249
1249
  let ee = null;
1250
- return v != null && (ee = /* @__PURE__ */ S.createElement(
1250
+ return w != null && (ee = /* @__PURE__ */ L.createElement(
1251
1251
  "img",
1252
1252
  {
1253
- src: v,
1254
- key: v,
1253
+ src: w,
1254
+ key: w,
1255
1255
  style: { display: "none" },
1256
1256
  onLoad: () => {
1257
- V(!0);
1257
+ H(!0);
1258
1258
  },
1259
- ref: j,
1260
- crossOrigin: I == null ? void 0 : I.crossOrigin
1259
+ ref: T,
1260
+ crossOrigin: S == null ? void 0 : S.crossOrigin
1261
1261
  }
1262
- )), /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement(
1262
+ )), /* @__PURE__ */ L.createElement(L.Fragment, null, /* @__PURE__ */ L.createElement(
1263
1263
  "canvas",
1264
- ie({
1264
+ le({
1265
1265
  style: B,
1266
- height: h,
1267
- width: h,
1268
- ref: M,
1266
+ height: u,
1267
+ width: u,
1268
+ ref: C,
1269
1269
  role: "img"
1270
- }, b)
1270
+ }, k)
1271
1271
  ), ee);
1272
1272
  }
1273
1273
  );
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, [
1274
+ Mt.displayName = "QRCodeCanvas";
1275
+ var Oe = L.forwardRef(
1276
+ function(t, e) {
1277
+ const i = t, {
1278
+ value: c,
1279
+ size: u = Ce,
1280
+ level: y = je,
1281
+ bgColor: x = Me,
1282
+ fgColor: r = Re,
1283
+ includeMargin: n = Se,
1284
+ minVersion: a = Le,
1285
+ boostLevel: l,
1286
+ title: d,
1287
+ marginSize: g,
1288
+ imageSettings: h
1289
+ } = i, m = ce(i, [
1290
1290
  "value",
1291
1291
  "size",
1292
1292
  "level",
@@ -1298,91 +1298,142 @@ var Ie = S.forwardRef(
1298
1298
  "title",
1299
1299
  "marginSize",
1300
1300
  "imageSettings"
1301
- ]), { margin: g, cells: b, numCells: v, calculatedImageSettings: p } = Ue({
1302
- value: u,
1301
+ ]), { margin: f, cells: k, numCells: w, calculatedImageSettings: p } = Ue({
1302
+ value: c,
1303
1303
  level: y,
1304
- minVersion: o,
1305
- boostLevel: i,
1304
+ minVersion: a,
1305
+ boostLevel: l,
1306
1306
  includeMargin: n,
1307
- marginSize: f,
1308
- imageSettings: d,
1309
- size: h
1307
+ marginSize: g,
1308
+ imageSettings: h,
1309
+ size: u
1310
1310
  });
1311
- let j = b, M = null;
1312
- d != null && p != null && (p.excavation != null && (j = De(
1313
- b,
1311
+ let T = k, C = null;
1312
+ h != null && p != null && (p.excavation != null && (T = De(
1313
+ k,
1314
1314
  p.excavation
1315
- )), M = /* @__PURE__ */ S.createElement(
1315
+ )), C = /* @__PURE__ */ L.createElement(
1316
1316
  "image",
1317
1317
  {
1318
- href: d.src,
1318
+ href: h.src,
1319
1319
  height: p.h,
1320
1320
  width: p.w,
1321
- x: p.x + g,
1322
- y: p.y + g,
1321
+ x: p.x + f,
1322
+ y: p.y + f,
1323
1323
  preserveAspectRatio: "none",
1324
1324
  opacity: p.opacity,
1325
1325
  crossOrigin: p.crossOrigin
1326
1326
  }
1327
1327
  ));
1328
- const F = Oe(j, g);
1329
- return /* @__PURE__ */ S.createElement(
1328
+ const q = Pe(T, f);
1329
+ return /* @__PURE__ */ L.createElement(
1330
1330
  "svg",
1331
- ie({
1332
- height: h,
1333
- width: h,
1334
- viewBox: `0 0 ${v} ${v}`,
1335
- ref: t,
1331
+ le({
1332
+ height: u,
1333
+ width: u,
1334
+ viewBox: `0 0 ${w} ${w}`,
1335
+ ref: e,
1336
1336
  role: "img"
1337
1337
  }, m),
1338
- !!l && /* @__PURE__ */ S.createElement("title", null, l),
1339
- /* @__PURE__ */ S.createElement(
1338
+ !!d && /* @__PURE__ */ L.createElement("title", null, d),
1339
+ /* @__PURE__ */ L.createElement(
1340
1340
  "path",
1341
1341
  {
1342
- fill: w,
1343
- d: `M0,0 h${v}v${v}H0z`,
1342
+ fill: x,
1343
+ d: `M0,0 h${w}v${w}H0z`,
1344
1344
  shapeRendering: "crispEdges"
1345
1345
  }
1346
1346
  ),
1347
- /* @__PURE__ */ S.createElement("path", { fill: e, d: F, shapeRendering: "crispEdges" }),
1348
- M
1347
+ /* @__PURE__ */ L.createElement("path", { fill: r, d: q, shapeRendering: "crispEdges" }),
1348
+ C
1349
1349
  );
1350
1350
  }
1351
1351
  );
1352
- Ie.displayName = "QRCodeSVG";
1353
- const Vt = ({
1352
+ Oe.displayName = "QRCodeSVG";
1353
+ const Rt = ({
1354
1354
  walletAddress: s,
1355
- amount: r,
1356
- currency: t,
1355
+ amount: t,
1356
+ currency: e,
1357
+ network: i,
1357
1358
  theme: c = "light",
1358
1359
  size: u = 200
1359
1360
  }) => {
1360
- const [h, y] = U(""), [w, e] = U(null);
1361
+ const [y, x] = D(""), [r, n] = D(null);
1361
1362
  Z(() => {
1362
- if (!s) {
1363
- e("No wallet address provided");
1363
+ if (!s || s === "No address configured") {
1364
+ n("No wallet address configured for this network");
1364
1365
  return;
1365
1366
  }
1366
1367
  try {
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,
1368
+ let m;
1369
+ switch (i) {
1370
+ case "tron":
1371
+ e === "TRX" ? m = `tronlink://transfer?to=${s}&amount=${t}` : m = s;
1372
+ break;
1373
+ case "algorand":
1374
+ m = `algorand://${s}?amount=${Math.floor(parseFloat(t) * 1e6)}`;
1375
+ break;
1376
+ case "bsc":
1377
+ if (e === "BNB")
1378
+ m = `ethereum:${s}@56?value=${d(t)}`;
1379
+ else {
1380
+ const f = a(e, "bsc");
1381
+ f ? m = `ethereum:${f}/transfer?address=${s}&uint256=${l(t, e)}@56` : m = s;
1382
+ }
1383
+ break;
1384
+ case "ethereum":
1385
+ default:
1386
+ if (e === "ETH")
1387
+ m = `ethereum:${s}@1?value=${d(t)}`;
1388
+ else {
1389
+ const f = a(e, "ethereum");
1390
+ f ? m = `ethereum:${f}/transfer?address=${s}&uint256=${l(t, e)}` : m = s;
1391
+ }
1392
+ break;
1393
+ }
1394
+ x(m), n(null);
1395
+ } catch (m) {
1396
+ console.error("Error generating QR code:", m), n("Error generating payment QR code");
1397
+ }
1398
+ }, [s, t, e, i]);
1399
+ const a = (m, f) => {
1400
+ var w;
1401
+ return ((w = {
1402
+ ethereum: {
1403
+ USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1404
+ USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
1405
+ },
1406
+ bsc: {
1407
+ USDT: "0x55d398326f99059fF775485246999027B3197955",
1408
+ USDC: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"
1409
+ },
1410
+ tron: {
1411
+ USDT: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
1412
+ USDC: "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8"
1413
+ }
1414
+ }[f]) == null ? void 0 : w[m]) || "";
1415
+ }, l = (m, f) => {
1416
+ const k = f === "USDT" || f === "USDC" ? 6 : 18;
1417
+ return Math.floor(parseFloat(m) * Math.pow(10, k)).toString();
1418
+ }, d = (m) => Math.floor(parseFloat(m) * 1e18).toString(), g = (m) => ({
1419
+ ethereum: "Ethereum",
1420
+ bsc: "BSC",
1421
+ tron: "Tron",
1422
+ algorand: "Algorand"
1423
+ })[m] || m, h = (m) => ({
1424
+ ethereum: ["MetaMask", "Trust Wallet", "Coinbase Wallet"],
1425
+ bsc: ["MetaMask", "Trust Wallet", "SafePal"],
1426
+ tron: ["TronLink", "Trust Wallet"],
1427
+ algorand: ["Pera Wallet", "MyAlgo Wallet"]
1428
+ })[m] || ["MetaMask", "Trust Wallet"];
1429
+ return /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col items-center", children: [
1430
+ r ? /* @__PURE__ */ o.jsxs("div", { className: "p-4 rounded-lg bg-red-100 mb-3 text-red-700 text-center", children: [
1431
+ /* @__PURE__ */ o.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-8 w-8 mx-auto mb-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ o.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" }) }),
1432
+ /* @__PURE__ */ o.jsx("p", { className: "font-medium", children: r })
1433
+ ] }) : /* @__PURE__ */ o.jsx("div", { className: "p-4 rounded-lg bg-white mb-3 shadow-sm border", children: y && /* @__PURE__ */ o.jsx(
1434
+ Oe,
1384
1435
  {
1385
- value: h,
1436
+ value: y,
1386
1437
  size: u,
1387
1438
  bgColor: c === "dark" ? "#374151" : "#FFFFFF",
1388
1439
  fgColor: c === "dark" ? "#FFFFFF" : "#000000",
@@ -1390,34 +1441,87 @@ const Vt = ({
1390
1441
  includeMargin: !0
1391
1442
  }
1392
1443
  ) }),
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" }),
1395
- "Scan with your wallet app to pay"
1444
+ /* @__PURE__ */ o.jsxs("div", { className: "text-center text-sm text-gray-700 mb-4", children: [
1445
+ /* @__PURE__ */ o.jsxs("p", { className: "font-semibold text-gray-800 flex items-center justify-center", children: [
1446
+ /* @__PURE__ */ o.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 mr-1", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M12 12h-4.01M12 12V8.01" }) }),
1447
+ "Scan to Pay with ",
1448
+ e
1449
+ ] }),
1450
+ /* @__PURE__ */ o.jsxs("p", { className: "text-xs text-gray-500 mt-1", children: [
1451
+ "Scan with your ",
1452
+ g(i),
1453
+ " wallet app"
1454
+ ] })
1396
1455
  ] }),
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: [
1404
- "3. Confirm the payment amount (",
1405
- r,
1406
- " ",
1456
+ /* @__PURE__ */ o.jsxs("div", { className: "w-full mb-4 p-3 bg-gray-50 rounded-lg", children: [
1457
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between items-center", children: [
1458
+ /* @__PURE__ */ o.jsx("span", { className: "text-sm font-medium text-gray-700", children: "Amount to Pay:" }),
1459
+ /* @__PURE__ */ o.jsxs("span", { className: "text-lg font-bold text-[#7042D2]", children: [
1407
1460
  t,
1461
+ " ",
1462
+ e
1463
+ ] })
1464
+ ] }),
1465
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between items-center mt-1", children: [
1466
+ /* @__PURE__ */ o.jsx("span", { className: "text-xs text-gray-500", children: "Network:" }),
1467
+ /* @__PURE__ */ o.jsx("span", { className: "text-xs font-medium text-gray-700", children: g(i) })
1468
+ ] })
1469
+ ] }),
1470
+ !r && /* @__PURE__ */ o.jsxs("div", { className: "w-full mb-4", children: [
1471
+ /* @__PURE__ */ o.jsx("p", { className: "text-xs text-gray-500 mb-1 text-center", children: "Or copy wallet address:" }),
1472
+ /* @__PURE__ */ o.jsx(
1473
+ "div",
1474
+ {
1475
+ className: "text-xs font-mono p-2 rounded bg-gray-100 text-gray-700 break-all text-center select-all cursor-pointer border",
1476
+ onClick: () => {
1477
+ var m;
1478
+ return (m = navigator.clipboard) == null ? void 0 : m.writeText(s);
1479
+ },
1480
+ title: "Click to copy",
1481
+ children: s
1482
+ }
1483
+ )
1484
+ ] }),
1485
+ /* @__PURE__ */ o.jsx("div", { className: "w-full", children: /* @__PURE__ */ o.jsxs("div", { className: "p-3 rounded bg-blue-50 border border-blue-200", children: [
1486
+ /* @__PURE__ */ o.jsxs("h4", { className: "text-sm font-medium mb-2 text-blue-800 flex items-center", children: [
1487
+ /* @__PURE__ */ o.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-4 w-4 mr-1", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
1488
+ "Payment Instructions"
1489
+ ] }),
1490
+ /* @__PURE__ */ o.jsxs("ol", { className: "text-xs space-y-1 text-blue-700", children: [
1491
+ /* @__PURE__ */ o.jsxs("li", { children: [
1492
+ "1. Open your crypto wallet app (",
1493
+ h(i).join(", "),
1408
1494
  ")"
1409
1495
  ] }),
1410
- /* @__PURE__ */ a.jsx("li", { children: '4. Click "Pay Now" button below after sending the payment' })
1411
- ] })
1496
+ /* @__PURE__ */ o.jsx("li", { children: "2. Scan the QR code above or copy the wallet address" }),
1497
+ /* @__PURE__ */ o.jsxs("li", { children: [
1498
+ "3. Send exactly ",
1499
+ /* @__PURE__ */ o.jsxs("strong", { children: [
1500
+ t,
1501
+ " ",
1502
+ e
1503
+ ] }),
1504
+ " on ",
1505
+ g(i),
1506
+ " network"
1507
+ ] }),
1508
+ /* @__PURE__ */ o.jsx("li", { children: '4. Click "I have sent the payment" button below after sending' })
1509
+ ] }),
1510
+ /* @__PURE__ */ o.jsx("div", { className: "mt-3 p-2 bg-yellow-50 border border-yellow-200 rounded", children: /* @__PURE__ */ o.jsxs("p", { className: "text-xs text-yellow-800", children: [
1511
+ /* @__PURE__ */ o.jsx("strong", { children: "Important:" }),
1512
+ " Make sure you're sending on the correct network (",
1513
+ g(i),
1514
+ ") and using the exact amount shown above."
1515
+ ] }) })
1412
1516
  ] }) })
1413
1517
  ] });
1414
- }, le = ({ status: s, message: r, theme: t = "light" }) => {
1415
- const c = () => {
1518
+ }, ie = ({ status: s, message: t, theme: e = "light" }) => {
1519
+ const i = () => {
1416
1520
  switch (s) {
1417
1521
  case "processing":
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" });
1522
+ return /* @__PURE__ */ o.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
1419
1523
  case "success":
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(
1524
+ return /* @__PURE__ */ o.jsx("div", { className: "rounded-full h-12 w-12 bg-green-100 flex items-center justify-center", children: /* @__PURE__ */ o.jsx(
1421
1525
  "svg",
1422
1526
  {
1423
1527
  xmlns: "http://www.w3.org/2000/svg",
@@ -1426,11 +1530,11 @@ const Vt = ({
1426
1530
  viewBox: "0 0 24 24",
1427
1531
  stroke: "currentColor",
1428
1532
  strokeWidth: 2,
1429
- children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
1533
+ children: /* @__PURE__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
1430
1534
  }
1431
1535
  ) });
1432
1536
  case "error":
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(
1537
+ return /* @__PURE__ */ o.jsx("div", { className: "rounded-full h-12 w-12 bg-red-100 flex items-center justify-center", children: /* @__PURE__ */ o.jsx(
1434
1538
  "svg",
1435
1539
  {
1436
1540
  xmlns: "http://www.w3.org/2000/svg",
@@ -1439,13 +1543,13 @@ const Vt = ({
1439
1543
  viewBox: "0 0 24 24",
1440
1544
  stroke: "currentColor",
1441
1545
  strokeWidth: 2,
1442
- children: /* @__PURE__ */ a.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1546
+ children: /* @__PURE__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
1443
1547
  }
1444
1548
  ) });
1445
1549
  default:
1446
1550
  return null;
1447
1551
  }
1448
- }, u = () => {
1552
+ }, c = () => {
1449
1553
  switch (s) {
1450
1554
  case "processing":
1451
1555
  return "Processing Payment";
@@ -1456,374 +1560,499 @@ const Vt = ({
1456
1560
  default:
1457
1561
  return "Unknown Status";
1458
1562
  }
1459
- }, h = () => {
1563
+ }, u = () => {
1460
1564
  switch (s) {
1461
1565
  case "processing":
1462
- return t === "dark" ? "text-blue-300" : "text-blue-600";
1566
+ return e === "dark" ? "text-blue-300" : "text-blue-600";
1463
1567
  case "success":
1464
- return t === "dark" ? "text-green-300" : "text-green-600";
1568
+ return e === "dark" ? "text-green-300" : "text-green-600";
1465
1569
  case "error":
1466
- return t === "dark" ? "text-red-300" : "text-red-600";
1570
+ return e === "dark" ? "text-red-300" : "text-red-600";
1467
1571
  default:
1468
- return t === "dark" ? "text-gray-300" : "text-gray-600";
1572
+ return e === "dark" ? "text-gray-300" : "text-gray-600";
1469
1573
  }
1470
1574
  };
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." }) })
1575
+ return /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
1576
+ /* @__PURE__ */ o.jsx("div", { className: "mb-4", children: i() }),
1577
+ /* @__PURE__ */ o.jsx("h3", { className: `text-xl font-bold mb-2 ${e === "dark" ? "text-white" : "text-gray-900"}`, children: c() }),
1578
+ /* @__PURE__ */ o.jsx("p", { className: `text-center ${u()}`, children: t }),
1579
+ s === "processing" && /* @__PURE__ */ o.jsx("div", { className: `mt-4 text-xs ${e === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
1580
+ s === "success" && /* @__PURE__ */ o.jsx("div", { className: `mt-4 p-2 rounded ${e === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ o.jsx("p", { className: `text-xs ${e === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Your payment has been successfully processed. You will receive a confirmation shortly." }) })
1477
1581
  ] });
1478
- }, Rt = ({ onSelect: s, selected: r, theme: t = "light", supportedNetworks: c = [] }) => {
1479
- const [u, h] = U({}), [y, w] = U(A.ETHEREUM);
1582
+ }, St = ({ onSelect: s, selected: t, theme: e = "light", supportedNetworks: i = [] }) => {
1583
+ const [c, u] = D(b.ETHEREUM), [y, x] = D({}), [r, n] = D(!1);
1480
1584
  Z(() => {
1481
- h(ue());
1585
+ x(ue());
1482
1586
  }, []);
1483
- const e = [
1587
+ const a = [
1484
1588
  {
1485
- id: "USDT",
1486
- name: "USDT",
1487
- description: "Tether USD",
1488
- logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s",
1489
- networks: [A.ETHEREUM, A.BSC, A.TRON]
1589
+ id: b.ETHEREUM,
1590
+ name: "Ethereum",
1591
+ description: "ERC-20 tokens"
1490
1592
  },
1491
1593
  {
1492
- id: "USDC",
1493
- name: "USDC",
1494
- description: "USD Coin",
1495
- logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s",
1496
- networks: [A.ETHEREUM, A.BSC, A.TRON]
1594
+ id: b.BSC,
1595
+ name: "BSC (Binance Smart Chain)",
1596
+ description: "BEP-20 tokens"
1497
1597
  },
1498
1598
  {
1499
- id: "BNB",
1500
- name: "BNB",
1501
- description: "Binance Coin",
1502
- logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRHSjyW2sSnBhwztCwVW97i1BtV40g7heMMxg&s",
1503
- networks: [A.BSC]
1599
+ id: b.TRON,
1600
+ name: "Tron",
1601
+ description: "TRC-20 tokens"
1504
1602
  },
1505
1603
  {
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
- });
1541
- };
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",
1604
+ id: b.ALGORAND,
1605
+ name: "Algorand",
1606
+ description: "ASA tokens"
1607
+ }
1608
+ ], l = (w) => {
1609
+ const p = [];
1610
+ switch (w) {
1611
+ case b.ETHEREUM:
1612
+ p.push(
1575
1613
  {
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",
1584
- {
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
- )
1597
- }
1598
- )
1599
- ] })
1614
+ id: "USDT",
1615
+ name: "USDT",
1616
+ description: "Tether USD",
1617
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s",
1618
+ network: b.ETHEREUM
1619
+ },
1620
+ {
1621
+ id: "USDC",
1622
+ name: "USDC",
1623
+ description: "USD Coin",
1624
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s",
1625
+ network: b.ETHEREUM
1626
+ },
1627
+ {
1628
+ id: "ETH",
1629
+ name: "ETH",
1630
+ description: "Ethereum",
1631
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcyJyRKN0dRJWVZqoLzYgkRHdJsxKGq8nHUw&s",
1632
+ network: b.ETHEREUM
1600
1633
  }
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
- ] })
1634
+ );
1635
+ break;
1636
+ case b.BSC:
1637
+ p.push(
1638
+ {
1639
+ id: "USDT",
1640
+ name: "USDT",
1641
+ description: "Tether USD",
1642
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s",
1643
+ network: b.BSC
1644
+ },
1645
+ {
1646
+ id: "USDC",
1647
+ name: "USDC",
1648
+ description: "USD Coin",
1649
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s",
1650
+ network: b.BSC
1651
+ },
1652
+ {
1653
+ id: "BNB",
1654
+ name: "BNB",
1655
+ description: "Binance Coin",
1656
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRHSjyW2sSnBhwztCwVW97i1BtV40g7heMMxg&s",
1657
+ network: b.BSC
1658
+ }
1659
+ );
1660
+ break;
1661
+ case b.TRON:
1662
+ p.push(
1663
+ {
1664
+ id: "USDT",
1665
+ name: "USDT",
1666
+ description: "Tether USD",
1667
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSj0euZAOXsLTJFQxgiKzlX7z8xbfBk-7kmJA&s",
1668
+ network: b.TRON
1669
+ },
1670
+ {
1671
+ id: "USDC",
1672
+ name: "USDC",
1673
+ description: "USD Coin",
1674
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ43MuDqq54iD1ZCRL_uthAPkfwSSL-J5qI_Q&s",
1675
+ network: b.TRON
1676
+ },
1677
+ {
1678
+ id: "TRX",
1679
+ name: "TRX",
1680
+ description: "Tron",
1681
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQKLpLNsGRHbZfCUXAjZLPSp_YFZvX5dMnAoA&s",
1682
+ network: b.TRON
1683
+ }
1684
+ );
1685
+ break;
1686
+ case b.ALGORAND:
1687
+ p.push(
1688
+ {
1689
+ id: "ALGO",
1690
+ name: "ALGO",
1691
+ description: "Algorand",
1692
+ logo: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR0Yx1Vp8qPQI5XZoJuKfQS8bj_FNiMZGCHqA&s",
1693
+ network: b.ALGORAND
1694
+ }
1695
+ );
1696
+ break;
1697
+ }
1698
+ return p;
1699
+ }, d = (w) => {
1700
+ u(w), n(!1), (t == null ? void 0 : t.network) !== w && s(null);
1701
+ }, g = (w) => {
1702
+ var p;
1703
+ s({
1704
+ currency: w.id,
1705
+ network: c,
1706
+ tokenConfig: (p = Ye[w.id]) == null ? void 0 : p[c],
1707
+ method: w
1708
+ });
1709
+ }, h = l(c), m = r ? h : h.slice(0, 4);
1710
+ return /* @__PURE__ */ o.jsxs("div", { children: [
1711
+ /* @__PURE__ */ o.jsx("h3", { className: `text-lg font-medium mb-4 ${e === "dark" ? "text-white" : "text-gray-800"}`, children: "Select Payment Method" }),
1712
+ /* @__PURE__ */ o.jsxs("div", { className: "mb-6", children: [
1713
+ /* @__PURE__ */ o.jsx("label", { className: `block text-sm font-medium mb-2 ${e === "dark" ? "text-white" : "text-gray-700"}`, children: "Blockchain Network" }),
1714
+ /* @__PURE__ */ o.jsx(
1715
+ "select",
1716
+ {
1717
+ value: c,
1718
+ onChange: (w) => d(w.target.value),
1719
+ className: `w-full p-3 rounded-lg border transition-colors ${e === "dark" ? "bg-gray-700 border-gray-600 text-white focus:border-[#7042D2]" : "bg-white border-gray-300 text-gray-900 focus:border-[#7042D2]"} focus:outline-none focus:ring-2 focus:ring-[#7042D2] focus:ring-opacity-50`,
1720
+ children: a.filter((w) => i.length === 0 || i.includes(w.id)).map((w) => /* @__PURE__ */ o.jsxs("option", { value: w.id, children: [
1721
+ w.name,
1722
+ " - ",
1723
+ w.description
1724
+ ] }, w.id))
1725
+ }
1726
+ )
1727
+ ] }),
1728
+ /* @__PURE__ */ o.jsxs("div", { className: "mb-4", children: [
1729
+ /* @__PURE__ */ o.jsx("label", { className: `block text-sm font-medium mb-3 ${e === "dark" ? "text-white" : "text-gray-700"}`, children: "Choose Cryptocurrency" }),
1730
+ /* @__PURE__ */ o.jsx("div", { className: "grid grid-cols-2 gap-3 mb-4", children: m.map((w) => /* @__PURE__ */ o.jsx(
1731
+ "button",
1732
+ {
1733
+ onClick: () => g(w),
1734
+ className: `p-4 rounded-lg transition-all duration-200 border-2 ${(t == null ? void 0 : t.currency) === w.id && (t == null ? void 0 : t.network) === c ? e === "dark" ? "bg-blue-900/30 border-[#7042D2] ring-2 ring-[#7042D2] ring-opacity-50" : "bg-blue-50 border-[#7042D2] ring-2 ring-[#7042D2] ring-opacity-50" : e === "dark" ? "bg-gray-700 hover:bg-gray-600 border-gray-600 hover:border-gray-500" : "bg-white hover:bg-gray-50 border-gray-200 hover:border-gray-300"}`,
1735
+ children: /* @__PURE__ */ o.jsxs("div", { className: "flex flex-col items-center text-center", children: [
1736
+ /* @__PURE__ */ o.jsx("div", { className: "flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mb-2 shadow-sm", children: /* @__PURE__ */ o.jsx("img", { src: w.logo, alt: w.name, className: "h-6 w-6" }) }),
1737
+ /* @__PURE__ */ o.jsxs("div", { children: [
1738
+ /* @__PURE__ */ o.jsx("h4", { className: `font-medium text-sm ${e === "dark" ? "text-white" : "text-gray-900"}`, children: w.name }),
1739
+ /* @__PURE__ */ o.jsx("p", { className: `text-xs ${e === "dark" ? "text-gray-300" : "text-gray-500"}`, children: w.description })
1740
+ ] }),
1741
+ (t == null ? void 0 : t.currency) === w.id && (t == null ? void 0 : t.network) === c && /* @__PURE__ */ o.jsx("div", { className: "mt-2", children: /* @__PURE__ */ o.jsx(
1742
+ "svg",
1743
+ {
1744
+ xmlns: "http://www.w3.org/2000/svg",
1745
+ className: "h-4 w-4 text-[#7042D2]",
1746
+ viewBox: "0 0 20 20",
1747
+ fill: "currentColor",
1748
+ children: /* @__PURE__ */ o.jsx(
1749
+ "path",
1750
+ {
1751
+ fillRule: "evenodd",
1752
+ 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",
1753
+ clipRule: "evenodd"
1754
+ }
1755
+ )
1756
+ }
1757
+ ) })
1758
+ ] })
1759
+ },
1760
+ `${w.id}-${w.network}`
1761
+ )) }),
1762
+ h.length > 4 && /* @__PURE__ */ o.jsx(
1763
+ "button",
1764
+ {
1765
+ onClick: () => n(!r),
1766
+ className: `w-full py-2 px-4 rounded-lg text-sm font-medium transition-colors ${e === "dark" ? "bg-gray-700 text-gray-300 hover:bg-gray-600" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`,
1767
+ children: r ? "Show Less" : `Show More (${h.length - 4} more)`
1768
+ }
1769
+ )
1770
+ ] }),
1771
+ /* @__PURE__ */ o.jsx("div", { className: `p-3 rounded-lg text-sm ${e === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-50 text-gray-600"}`, children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
1772
+ /* @__PURE__ */ o.jsx("div", { className: `w-2 h-2 rounded-full mr-2 ${y[f(c)] ? "bg-green-500" : "bg-red-500"}` }),
1773
+ /* @__PURE__ */ o.jsx("span", { className: "text-xs", children: k(c) })
1774
+ ] }) })
1611
1775
  ] });
1612
- }, St = "data:image/png;base64,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", Lt = ({
1776
+ function f(w) {
1777
+ switch (w) {
1778
+ case b.ETHEREUM:
1779
+ case b.BSC:
1780
+ return "metamask";
1781
+ case b.TRON:
1782
+ return "tronlink";
1783
+ case b.ALGORAND:
1784
+ return "lute";
1785
+ default:
1786
+ return "metamask";
1787
+ }
1788
+ }
1789
+ function k(w) {
1790
+ const p = f(w), T = y[p], C = {
1791
+ metamask: "MetaMask",
1792
+ tronlink: "TronLink",
1793
+ lute: "Lute Wallet"
1794
+ };
1795
+ return T ? `${C[p]} detected - Ready to pay` : `${C[p]} required - Please install to continue`;
1796
+ }
1797
+ }, Lt = "data:image/png;base64,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", Pt = ({
1613
1798
  isOpen: s,
1614
- onClose: r,
1615
- payment: t,
1616
- paymentStatus: c,
1617
- selectedPaymentMethod: u,
1618
- onPaymentMethodSelect: h,
1799
+ onClose: t,
1800
+ payment: e,
1801
+ paymentStatus: i,
1802
+ selectedPaymentMethod: c,
1803
+ onPaymentMethodSelect: u,
1619
1804
  onPayment: y,
1620
- onBack: w,
1621
- error: e,
1805
+ onBack: x,
1806
+ error: r,
1622
1807
  theme: n = "light",
1623
- merchantName: o,
1624
- transactionHash: i,
1625
- walletConnection: l,
1626
- onConnectWallet: f,
1627
- testMode: d = !1,
1808
+ merchantName: a,
1809
+ transactionHash: l,
1810
+ walletConnection: d,
1811
+ onConnectWallet: g,
1812
+ testMode: h = !1,
1628
1813
  supportedNetworks: m = [],
1629
- availableWallets: g = {},
1630
- supportedWallets: b = [],
1631
- step: v = "select-currency"
1814
+ availableWallets: f = {},
1815
+ supportedWallets: k = [],
1816
+ step: w = "select-currency"
1632
1817
  }) => {
1633
- const p = (x) => parseFloat(x).toFixed(2), j = (x) => x ? x.length <= 14 ? x : `${x.slice(0, 8)}...${x.slice(-6)}` : "", M = (x) => ({
1818
+ const [p, T] = D("wallet"), C = (v) => parseFloat(v).toFixed(2), q = (v) => v ? v.length <= 14 ? v : `${v.slice(0, 8)}...${v.slice(-6)}` : "", H = (v) => ({
1634
1819
  ethereum: "Ethereum",
1635
1820
  bsc: "BSC",
1636
1821
  tron: "Tron",
1637
1822
  algorand: "Algorand"
1638
- })[x] || x, F = (x) => ({
1823
+ })[v] || v, O = (v) => ({
1639
1824
  [N.METAMASK]: "MetaMask",
1640
1825
  [N.TRONLINK]: "TronLink",
1641
1826
  [N.TRUST_WALLET]: "Trust Wallet",
1642
1827
  [N.LUTE]: "Lute Wallet"
1643
- })[x] || x, V = (x) => ({
1828
+ })[v] || v, M = (v) => ({
1644
1829
  [N.METAMASK]: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT3ymr3UNKopfI0NmUY95Dr-0589vG-91KuAA&s",
1645
1830
  [N.TRONLINK]: "https://www.tronlink.org/images/logo.png",
1646
1831
  [N.TRUST_WALLET]: "https://trustwallet.com/assets/images/trust_logotype.svg",
1647
1832
  [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(
1833
+ })[v] || "";
1834
+ return s ? /* @__PURE__ */ o.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto bg-black/50", children: /* @__PURE__ */ o.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ o.jsxs("div", { className: "relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl bg-white text-gray-800", children: [
1835
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between items-center mb-6 bg-[#F1ECFB] p-3 rounded-xl", children: [
1836
+ /* @__PURE__ */ o.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ o.jsx("h2", { className: "text-xl font-bold text-gray-900", children: /* @__PURE__ */ o.jsx("img", { src: Lt, className: "w-32", alt: "Coinley Logo" }) }) }),
1837
+ /* @__PURE__ */ o.jsx(
1653
1838
  "button",
1654
1839
  {
1655
- onClick: r,
1840
+ onClick: t,
1656
1841
  className: "text-gray-500 hover:text-gray-700 focus:outline-none",
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" }) })
1842
+ children: /* @__PURE__ */ o.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__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
1658
1843
  }
1659
1844
  )
1660
1845
  ] }),
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: [
1846
+ /* @__PURE__ */ o.jsxs("div", { className: "mb-6 bg-[#F1ECFB] p-3 rounded-xl", children: [
1847
+ e && /* @__PURE__ */ o.jsxs("div", { className: "mb-6 p-4 rounded-lg", children: [
1848
+ /* @__PURE__ */ o.jsxs("p", { className: "text-lg text-gray-800 font-semibold", children: [
1664
1849
  "PAY: ",
1665
- o
1850
+ a
1666
1851
  ] }),
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: [
1852
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between items-center mt-2 bg-gray-100 px-3 rounded-lg", children: [
1853
+ /* @__PURE__ */ o.jsx("span", { className: "font-medium text-gray-700", children: "Amount:" }),
1854
+ /* @__PURE__ */ o.jsxs("span", { className: "font-bold text-xl text-[#7042D2]", children: [
1670
1855
  "$",
1671
- p(t.totalAmount || t.amount)
1856
+ C(e.totalAmount || e.amount)
1672
1857
  ] })
1673
1858
  ] }),
1674
- /* @__PURE__ */ a.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ a.jsxs("span", { className: "text-gray-500", children: [
1859
+ /* @__PURE__ */ o.jsx("div", { className: "text-xs mt-1 text-right", children: /* @__PURE__ */ o.jsxs("span", { className: "text-gray-500", children: [
1675
1860
  "Payment ID: ",
1676
- t.id ? t.id.slice(0, 8) : "",
1861
+ e.id ? e.id.slice(0, 8) : "",
1677
1862
  "..."
1678
1863
  ] }) })
1679
1864
  ] }),
1680
- v === "select-currency" && /* @__PURE__ */ a.jsx(
1681
- Rt,
1682
- {
1683
- onSelect: h,
1684
- selected: u,
1685
- theme: n,
1686
- supportedNetworks: m
1687
- }
1688
- ),
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 })
1865
+ w === "select-currency" && /* @__PURE__ */ o.jsxs("div", { children: [
1866
+ /* @__PURE__ */ o.jsx(
1867
+ St,
1868
+ {
1869
+ onSelect: u,
1870
+ selected: c,
1871
+ theme: n,
1872
+ supportedNetworks: m
1873
+ }
1874
+ ),
1875
+ c && /* @__PURE__ */ o.jsx("div", { className: "mt-6", children: /* @__PURE__ */ o.jsxs(
1876
+ "button",
1877
+ {
1878
+ onClick: () => u(c),
1879
+ className: "w-full py-3 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-lg transition-colors",
1880
+ children: [
1881
+ "Proceed with ",
1882
+ c.currency,
1883
+ " on ",
1884
+ H(c.network)
1885
+ ]
1886
+ }
1887
+ ) })
1888
+ ] }),
1889
+ w === "confirm" && c && e && /* @__PURE__ */ o.jsxs("div", { children: [
1890
+ /* @__PURE__ */ o.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
1891
+ /* @__PURE__ */ o.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
1892
+ /* @__PURE__ */ o.jsxs("div", { className: "space-y-2", children: [
1893
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between", children: [
1894
+ /* @__PURE__ */ o.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Currency:" }),
1895
+ /* @__PURE__ */ o.jsx("span", { className: "font-medium", children: c.currency })
1696
1896
  ] }),
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) })
1897
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between", children: [
1898
+ /* @__PURE__ */ o.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Network:" }),
1899
+ /* @__PURE__ */ o.jsx("span", { className: "font-medium", children: H(c.network) })
1700
1900
  ] }),
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%" })
1901
+ /* @__PURE__ */ o.jsxs("div", { className: "flex justify-between", children: [
1902
+ /* @__PURE__ */ o.jsx("span", { className: "text-[#7042D2] font-semibold", children: "Fee:" }),
1903
+ /* @__PURE__ */ o.jsx("span", { className: "font-medium", children: "1.75%" })
1704
1904
  ] })
1705
1905
  ] })
1706
1906
  ] }),
1707
- d ? (
1907
+ /* @__PURE__ */ o.jsx("div", { className: "mb-4", children: /* @__PURE__ */ o.jsxs("div", { className: "flex border-b border-gray-200", children: [
1908
+ /* @__PURE__ */ o.jsx(
1909
+ "button",
1910
+ {
1911
+ onClick: () => T("wallet"),
1912
+ className: `py-2 px-4 text-sm font-medium ${p === "wallet" ? "border-b-2 border-[#7042D2] text-[#7042D2]" : "text-gray-500 hover:text-gray-700"}`,
1913
+ children: "Connect Wallet"
1914
+ }
1915
+ ),
1916
+ /* @__PURE__ */ o.jsx(
1917
+ "button",
1918
+ {
1919
+ onClick: () => T("qrcode"),
1920
+ className: `py-2 px-4 text-sm font-medium ${p === "qrcode" ? "border-b-2 border-[#7042D2] text-[#7042D2]" : "text-gray-500 hover:text-gray-700"}`,
1921
+ children: "QR Code"
1922
+ }
1923
+ )
1924
+ ] }) }),
1925
+ h ? (
1708
1926
  // Test mode payment option
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' })
1927
+ /* @__PURE__ */ o.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
1928
+ /* @__PURE__ */ o.jsx("div", { className: "bg-[#7042D2] rounded-full p-2 mr-3", children: /* @__PURE__ */ o.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__ */ o.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
1929
+ /* @__PURE__ */ o.jsxs("div", { children: [
1930
+ /* @__PURE__ */ o.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
1931
+ /* @__PURE__ */ o.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
1714
1932
  ] })
1715
1933
  ] }) })
1934
+ ) : p === "qrcode" ? (
1935
+ // QR Code payment option
1936
+ /* @__PURE__ */ o.jsx("div", { className: "mb-4", children: /* @__PURE__ */ o.jsx(
1937
+ Rt,
1938
+ {
1939
+ walletAddress: e.recipientWallet || "No address configured",
1940
+ amount: e.totalAmount || e.amount,
1941
+ currency: c.currency,
1942
+ network: c.network,
1943
+ theme: n
1944
+ }
1945
+ ) })
1716
1946
  ) : (
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: [
1947
+ // Wallet connection option
1948
+ /* @__PURE__ */ o.jsxs("div", { className: "space-y-3 mb-4", children: [
1949
+ k.length === 0 ? /* @__PURE__ */ o.jsx("div", { className: "p-4 rounded-lg bg-yellow-50", children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
1950
+ /* @__PURE__ */ o.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__ */ o.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" }) }),
1951
+ /* @__PURE__ */ o.jsxs("div", { children: [
1952
+ /* @__PURE__ */ o.jsx("h3", { className: "font-medium text-gray-800", children: "No Compatible Wallets" }),
1953
+ /* @__PURE__ */ o.jsxs("p", { className: "text-sm text-gray-600", children: [
1725
1954
  "No wallets detected for ",
1726
- M(u.network),
1955
+ H(c.network),
1727
1956
  " network"
1728
1957
  ] })
1729
1958
  ] })
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(
1959
+ ] }) }) : k.map((v) => /* @__PURE__ */ o.jsx("div", { className: "p-4 rounded-lg bg-blue-50", children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-between", children: [
1960
+ /* @__PURE__ */ o.jsxs("div", { className: "flex items-center", children: [
1961
+ /* @__PURE__ */ o.jsx(
1733
1962
  "img",
1734
1963
  {
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";
1964
+ src: M(v),
1965
+ alt: O(v),
1966
+ className: "w-8 h-8 mr-3",
1967
+ onError: (S) => {
1968
+ S.target.style.display = "none";
1740
1969
  }
1741
1970
  }
1742
1971
  ),
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: [
1972
+ /* @__PURE__ */ o.jsxs("div", { children: [
1973
+ /* @__PURE__ */ o.jsx("h3", { className: "font-medium text-gray-800", children: O(v) }),
1974
+ /* @__PURE__ */ o.jsxs("p", { className: "text-sm text-gray-600", children: [
1746
1975
  "Pay with ",
1747
- F(x)
1976
+ O(v)
1748
1977
  ] })
1749
1978
  ] })
1750
1979
  ] }),
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(
1980
+ (d == null ? void 0 : d.walletType) === v ? /* @__PURE__ */ o.jsxs("div", { className: "flex items-center space-x-2", children: [
1981
+ /* @__PURE__ */ o.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }),
1982
+ /* @__PURE__ */ o.jsx("span", { className: "text-sm text-green-600", children: "Connected" })
1983
+ ] }) : /* @__PURE__ */ o.jsx(
1755
1984
  "button",
1756
1985
  {
1757
- onClick: () => f(x),
1758
- className: "py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md",
1986
+ onClick: () => g(v),
1987
+ className: "py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md text-sm",
1759
1988
  children: "Connect"
1760
1989
  }
1761
1990
  )
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),
1991
+ ] }) }, v)),
1992
+ /* @__PURE__ */ o.jsx("div", { className: "space-y-2", children: Object.entries(f).filter(([v, S]) => !S).map(([v]) => /* @__PURE__ */ o.jsx("div", { className: "p-3 rounded-lg bg-gray-50", children: /* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-between", children: [
1993
+ /* @__PURE__ */ o.jsxs("span", { className: "text-sm text-gray-600", children: [
1994
+ O(v),
1766
1995
  " not detected"
1767
1996
  ] }),
1768
- /* @__PURE__ */ a.jsx(
1997
+ /* @__PURE__ */ o.jsx(
1769
1998
  "a",
1770
1999
  {
1771
- href: ct(x),
2000
+ href: ct(v),
1772
2001
  target: "_blank",
1773
2002
  rel: "noopener noreferrer",
1774
2003
  className: "text-sm text-[#7042D2] hover:underline",
1775
2004
  children: "Install"
1776
2005
  }
1777
2006
  )
1778
- ] }) }, x)) })
2007
+ ] }) }, v)) })
1779
2008
  ] })
1780
2009
  ),
1781
- /* @__PURE__ */ a.jsxs("div", { className: "mt-6 grid grid-cols-2 gap-3", children: [
1782
- /* @__PURE__ */ a.jsx(
2010
+ /* @__PURE__ */ o.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
2011
+ /* @__PURE__ */ o.jsx(
1783
2012
  "button",
1784
2013
  {
1785
2014
  type: "button",
1786
- onClick: w,
2015
+ onClick: x,
1787
2016
  className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-[#7042D2] font-medium rounded-md",
1788
2017
  children: "Back"
1789
2018
  }
1790
2019
  ),
1791
- /* @__PURE__ */ a.jsx(
2020
+ /* @__PURE__ */ o.jsx(
1792
2021
  "button",
1793
2022
  {
1794
2023
  type: "button",
1795
- onClick: y,
2024
+ onClick: () => y(p === "qrcode"),
1796
2025
  className: "w-full py-2 px-4 bg-[#7042D2] hover:bg-[#7042D2] text-white font-medium rounded-md",
1797
- disabled: !d && !l,
1798
- children: "Pay Now"
2026
+ disabled: !h && p === "wallet" && !d,
2027
+ children: p === "qrcode" ? "I have sent the payment" : "Pay Now"
1799
2028
  }
1800
2029
  )
1801
2030
  ] })
1802
2031
  ] }),
1803
- v === "processing" && /* @__PURE__ */ a.jsx(
1804
- le,
2032
+ w === "processing" && /* @__PURE__ */ o.jsx(
2033
+ ie,
1805
2034
  {
1806
2035
  status: "processing",
1807
2036
  theme: n,
1808
2037
  message: "Processing your payment..."
1809
2038
  }
1810
2039
  ),
1811
- v === "success" && /* @__PURE__ */ a.jsxs("div", { children: [
1812
- /* @__PURE__ */ a.jsx(
1813
- le,
2040
+ w === "success" && /* @__PURE__ */ o.jsxs("div", { children: [
2041
+ /* @__PURE__ */ o.jsx(
2042
+ ie,
1814
2043
  {
1815
2044
  status: "success",
1816
2045
  theme: n,
1817
2046
  message: "Payment successful!"
1818
2047
  }
1819
2048
  ),
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(
2049
+ l && /* @__PURE__ */ o.jsxs("div", { className: "mt-4 p-3 rounded-lg bg-gray-100", children: [
2050
+ /* @__PURE__ */ o.jsx("p", { className: "text-xs text-gray-600 mb-1", children: "Transaction Hash:" }),
2051
+ /* @__PURE__ */ o.jsx("p", { className: "text-sm font-mono break-all text-gray-800", children: q(l) }),
2052
+ c && /* @__PURE__ */ o.jsx(
1824
2053
  "a",
1825
2054
  {
1826
- href: `${Pt(u.network)}/tx/${i}`,
2055
+ href: `${Dt(c.network)}/${Ut(c.network)}/${l}`,
1827
2056
  target: "_blank",
1828
2057
  rel: "noopener noreferrer",
1829
2058
  className: "text-xs text-[#7042D2] mt-2 inline-block",
@@ -1832,220 +2061,225 @@ const Vt = ({
1832
2061
  )
1833
2062
  ] })
1834
2063
  ] }),
1835
- v === "error" && /* @__PURE__ */ a.jsxs("div", { children: [
1836
- /* @__PURE__ */ a.jsx(
1837
- le,
2064
+ w === "error" && /* @__PURE__ */ o.jsxs("div", { children: [
2065
+ /* @__PURE__ */ o.jsx(
2066
+ ie,
1838
2067
  {
1839
2068
  status: "error",
1840
2069
  theme: n,
1841
- message: e || "An error occurred while processing your payment."
2070
+ message: r || "An error occurred while processing your payment."
1842
2071
  }
1843
2072
  ),
1844
- /* @__PURE__ */ a.jsx(
2073
+ /* @__PURE__ */ o.jsx(
1845
2074
  "button",
1846
2075
  {
1847
2076
  type: "button",
1848
- onClick: w,
2077
+ onClick: x,
1849
2078
  className: "mt-4 w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium rounded-md",
1850
2079
  children: "Try Again"
1851
2080
  }
1852
2081
  )
1853
2082
  ] })
1854
2083
  ] }),
1855
- /* @__PURE__ */ a.jsx("div", { className: "text-center text-xs text-gray-500", children: /* @__PURE__ */ a.jsxs("p", { children: [
2084
+ /* @__PURE__ */ o.jsx("div", { className: "text-center text-xs text-gray-500", children: /* @__PURE__ */ o.jsxs("p", { children: [
1856
2085
  "Powered by ",
1857
- /* @__PURE__ */ a.jsx("span", { className: "text-[#7042D2]", children: "Coinley" }),
2086
+ /* @__PURE__ */ o.jsx("span", { className: "text-[#7042D2]", children: "Coinley" }),
1858
2087
  " - Secure Cryptocurrency Payments"
1859
2088
  ] }) })
1860
2089
  ] }) }) }) : null;
1861
- }, Pt = (s) => ({
2090
+ }, Dt = (s) => ({
1862
2091
  ethereum: "https://etherscan.io",
1863
2092
  bsc: "https://bscscan.com",
1864
2093
  tron: "https://tronscan.org",
1865
2094
  algorand: "https://algoexplorer.io"
1866
- })[s] || "https://etherscan.io", Ot = Ye(({
2095
+ })[s] || "https://etherscan.io", Ut = (s) => ({
2096
+ ethereum: "tx",
2097
+ bsc: "tx",
2098
+ tron: "transaction",
2099
+ algorand: "tx"
2100
+ })[s] || "tx", Ot = _e(({
1867
2101
  apiKey: s,
1868
- apiSecret: r,
1869
- apiUrl: t,
1870
- customerEmail: c,
1871
- merchantName: u = "Merchant",
1872
- merchantWalletAddresses: h = {},
2102
+ apiSecret: t,
2103
+ apiUrl: e,
2104
+ customerEmail: i,
2105
+ merchantName: c = "Merchant",
2106
+ merchantWalletAddresses: u = {},
1873
2107
  // Object with network-specific addresses
1874
2108
  onSuccess: y,
1875
- onError: w,
1876
- onClose: e,
2109
+ onError: x,
2110
+ onClose: r,
1877
2111
  theme: n,
1878
- autoOpen: o = !1,
1879
- debug: i = !1,
1880
- testMode: l = !1,
1881
- supportedNetworks: f = [],
2112
+ autoOpen: a = !1,
2113
+ debug: l = !1,
2114
+ testMode: d = !1,
2115
+ supportedNetworks: g = [],
1882
2116
  // Array of supported networks
1883
- preferredNetwork: d = A.ETHEREUM,
2117
+ preferredNetwork: h = b.ETHEREUM,
1884
2118
  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);
2119
+ }, f) => {
2120
+ const k = bt(), { theme: w } = yt(), [p, T] = D(a), [C, q] = D(null), [H, O] = D("idle"), [M, v] = D(null), [S, B] = D(null), [ee, W] = D(null), [I, V] = D(null), [$, te] = D({}), [X, G] = D("select-currency");
2121
+ s || (k == null || k.apiKey), t || (k == null || k.apiSecret), e || (k == null || k.apiUrl);
2122
+ const oe = n || w, re = l || (k == null ? void 0 : k.debug), ae = g.length > 0 ? g : [b.ETHEREUM, b.BSC, b.TRON, b.ALGORAND];
2123
+ Je(f, () => ({
2124
+ open: (A) => {
2125
+ Ie(A);
1892
2126
  },
1893
2127
  close: () => {
1894
2128
  he();
1895
2129
  },
1896
- getPayment: () => M,
1897
- getWalletConnection: () => O
2130
+ getPayment: () => C,
2131
+ getWalletConnection: () => I
1898
2132
  }));
1899
- const L = (C, D) => {
1900
- re && console.log(`[Coinley SDK] ${C}`, D);
2133
+ const P = (A, F) => {
2134
+ re && console.log(`[Coinley SDK] ${A}`, F);
1901
2135
  };
1902
2136
  Z(() => {
1903
2137
  if (typeof window != "undefined") {
1904
- const C = ue();
1905
- te(C), L("Available wallets detected:", C);
2138
+ const A = ue();
2139
+ te(A), P("Available wallets detected:", A);
1906
2140
  }
1907
2141
  }, [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"));
2142
+ const Ie = (A) => R(void 0, null, function* () {
2143
+ if (!A || !A.amount) {
2144
+ B("Payment amount is required"), x && x(new Error("Payment amount is required"));
1911
2145
  return;
1912
2146
  }
1913
- x("loading"), j(!0), G("select-currency");
2147
+ O("loading"), T(!0), G("select-currency");
1914
2148
  try {
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)
2149
+ P("Creating payment with details:", A);
2150
+ const F = yield ut({
2151
+ amount: A.amount,
2152
+ currency: A.currency || "USDT",
2153
+ network: A.network || h,
2154
+ customerEmail: A.customerEmail || i,
2155
+ callbackUrl: A.callbackUrl,
2156
+ metadata: A.metadata || {},
2157
+ merchantWalletAddresses: z(z({}, u), A.merchantWalletAddresses)
1924
2158
  });
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);
2159
+ P("Payment created:", F), q(F.payment), O("idle"), B(null), P("Payment created and state updated");
2160
+ } catch (F) {
2161
+ P("Error creating payment:", F), B(F.message || "Failed to create payment"), O("error"), x && x(F);
1928
2162
  }
1929
2163
  }), 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) {
2164
+ T(!1), W(null), V(null), v(null), G("select-currency"), r && r();
2165
+ }, Fe = (A) => {
2166
+ P("Payment method selected:", A), v(A), G("confirm");
2167
+ }, Be = () => {
2168
+ X === "confirm" && (G("select-currency"), V(null));
2169
+ }, We = (A) => R(void 0, null, function* () {
2170
+ if (!M) {
1937
2171
  B("Please select a payment method first");
1938
2172
  return;
1939
2173
  }
1940
2174
  try {
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) {
2175
+ P("Connecting wallet:", { walletType: A, network: M.network });
2176
+ const F = yield et(A, M.network);
2177
+ V(F), B(null), P("Wallet connected successfully:", F);
2178
+ } catch (F) {
2179
+ P("Wallet connection error:", F), B(F.message || "Failed to connect wallet");
2180
+ }
2181
+ }), Qe = () => R(void 0, null, function* () {
2182
+ var A, F;
2183
+ if (!C || !M) {
1950
2184
  B("Missing payment information");
1951
2185
  return;
1952
2186
  }
1953
- if (!O && !l) {
2187
+ if (!I && !d) {
1954
2188
  B("Please connect your wallet first");
1955
2189
  return;
1956
2190
  }
1957
- L("Starting payment process..."), x("loading"), W(null);
2191
+ P("Starting payment process..."), O("loading"), W(null);
1958
2192
  try {
1959
2193
  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)}`;
2194
+ if (d)
2195
+ P("Test mode: Generating mock transaction..."), Q = `test_${Date.now().toString(16)}_${Math.random().toString(16).substring(2, 10)}`;
1962
2196
  else {
1963
- const me = h[T.network];
2197
+ const me = u[M.network];
1964
2198
  if (!me)
1965
- throw new Error(`No merchant wallet address configured for ${T.network}`);
1966
- L("Sending transaction through wallet..."), Q = yield ot(O, {
2199
+ throw new Error(`No merchant wallet address configured for ${M.network}`);
2200
+ P("Sending transaction through wallet..."), Q = yield ot(I, {
1967
2201
  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
2202
+ amount: C.amount,
2203
+ tokenAddress: (A = M.tokenConfig) == null ? void 0 : A.address,
2204
+ tokenDecimals: (F = M.tokenConfig) == null ? void 0 : F.decimals
1971
2205
  });
1972
2206
  }
1973
- L("Transaction hash:", Q), W(Q), L("Processing payment with backend...");
1974
- const He = yield ht({
1975
- paymentId: M.id,
2207
+ P("Transaction hash:", Q), W(Q), P("Processing payment with backend...");
2208
+ const Ge = yield ht({
2209
+ paymentId: C.id,
1976
2210
  transactionHash: Q,
1977
- network: T.network,
1978
- currency: T.currency,
1979
- senderAddress: O == null ? void 0 : O.address
2211
+ network: M.network,
2212
+ currency: M.currency,
2213
+ senderAddress: I == null ? void 0 : I.address
1980
2214
  });
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
2215
+ P("Payment processed successfully:", Ge), O("success"), G("success"), y && (P("Calling onSuccess callback..."), y(C.id, Q, {
2216
+ network: M.network,
2217
+ currency: M.currency,
2218
+ amount: C.amount
1985
2219
  }));
1986
2220
  } catch (Q) {
1987
- L("Payment error:", Q), B(Q.message || "Failed to process payment"), x("error"), G("error"), w && w(Q);
2221
+ P("Payment error:", Q), B(Q.message || "Failed to process payment"), O("error"), G("error"), x && x(Q);
1988
2222
  }
1989
- }), Ge = () => T ? Ne(T.network) : [];
1990
- return /* @__PURE__ */ a.jsx(a.Fragment, { children: p && /* @__PURE__ */ a.jsx(
1991
- Lt,
2223
+ }), ze = () => M ? Ze(M.network) : [];
2224
+ return /* @__PURE__ */ o.jsx(o.Fragment, { children: p && /* @__PURE__ */ o.jsx(
2225
+ Pt,
1992
2226
  {
1993
2227
  isOpen: p,
1994
2228
  onClose: he,
1995
- payment: M,
1996
- paymentStatus: V,
1997
- selectedPaymentMethod: T,
1998
- onPaymentMethodSelect: Be,
1999
- onPayment: ze,
2000
- onBack: We,
2001
- error: I,
2229
+ payment: C,
2230
+ paymentStatus: H,
2231
+ selectedPaymentMethod: M,
2232
+ onPaymentMethodSelect: Fe,
2233
+ onPayment: Qe,
2234
+ onBack: Be,
2235
+ error: S,
2002
2236
  theme: oe,
2003
- merchantName: u,
2237
+ merchantName: c,
2004
2238
  transactionHash: ee,
2005
- walletConnection: O,
2006
- onConnectWallet: Qe,
2007
- testMode: l,
2239
+ walletConnection: I,
2240
+ onConnectWallet: We,
2241
+ testMode: d,
2008
2242
  supportedNetworks: ae,
2009
- availableWallets: H,
2010
- supportedWallets: Ge(),
2243
+ availableWallets: $,
2244
+ supportedWallets: ze(),
2011
2245
  step: X
2012
2246
  }
2013
2247
  ) });
2014
2248
  });
2015
2249
  Ot.displayName = "CoinleyCheckout";
2016
- const qt = {
2250
+ const Vt = {
2017
2251
  apiUrl: "http://localhost:9000",
2018
2252
  debug: !1,
2019
2253
  testMode: !1,
2020
2254
  theme: "light",
2021
2255
  supportedNetworks: ["ethereum", "bsc", "tron", "algorand"]
2022
- }, $t = "0.3.1";
2256
+ }, _t = "0.3.2";
2023
2257
  export {
2024
2258
  Ot as CoinleyCheckout,
2025
- Lt as CoinleyModal,
2026
- Gt as CoinleyProvider,
2027
- qt as DEFAULT_CONFIG,
2259
+ Pt as CoinleyModal,
2260
+ Ht as CoinleyProvider,
2261
+ Vt as DEFAULT_CONFIG,
2028
2262
  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,
2263
+ b as NETWORK_TYPES,
2264
+ St as PaymentMethods,
2265
+ ie as PaymentStatus,
2266
+ Rt as QRCode,
2267
+ Ye as TOKEN_CONFIG,
2268
+ qt as ThemeProvider,
2269
+ _t as VERSION,
2036
2270
  N as WALLET_TYPES,
2037
2271
  et as connectWallet,
2038
2272
  ut as createPayment,
2039
2273
  ue as detectWallets,
2040
- Qt as generateMockTransactionHash,
2041
- Bt as getMerchantProfile,
2042
- It as getPayment,
2043
- Ft as getSupportedNetworks,
2044
- Ne as getSupportedWalletsForNetwork,
2274
+ Gt as generateMockTransactionHash,
2275
+ Qt as getMerchantProfile,
2276
+ Bt as getPayment,
2277
+ Wt as getSupportedNetworks,
2278
+ Ze as getSupportedWalletsForNetwork,
2045
2279
  ct as getWalletInstallUrl,
2046
2280
  ht as processPayment,
2047
2281
  ot as sendTransaction,
2048
- Nt as useCoinley,
2049
- Wt as validateWalletAddress
2282
+ bt as useCoinley,
2283
+ zt as validateWalletAddress
2050
2284
  };
2051
2285
  //# sourceMappingURL=coinley-checkout.es.js.map