@unifold/ui-web 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +2683 -725
- package/dist/index.mjs +2683 -725
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -34407,7 +34407,7 @@ __export(index_exports, {
|
|
|
34407
34407
|
module.exports = __toCommonJS(index_exports);
|
|
34408
34408
|
|
|
34409
34409
|
// src/unifold.tsx
|
|
34410
|
-
var
|
|
34410
|
+
var import_react32 = __toESM(require_react());
|
|
34411
34411
|
var import_client = __toESM(require_client());
|
|
34412
34412
|
|
|
34413
34413
|
// ../connect-react/dist/index.mjs
|
|
@@ -37182,14 +37182,15 @@ var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
|
|
|
37182
37182
|
var import_react19 = __toESM(require_react(), 1);
|
|
37183
37183
|
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
|
|
37184
37184
|
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
|
|
37185
|
+
var import_react20 = __toESM(require_react(), 1);
|
|
37185
37186
|
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
|
|
37186
37187
|
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
|
|
37187
|
-
var
|
|
37188
|
+
var import_react21 = __toESM(require_react(), 1);
|
|
37188
37189
|
var React242 = __toESM(require_react(), 1);
|
|
37189
37190
|
var React31 = __toESM(require_react(), 1);
|
|
37190
37191
|
var React29 = __toESM(require_react(), 1);
|
|
37191
37192
|
var React26 = __toESM(require_react(), 1);
|
|
37192
|
-
var
|
|
37193
|
+
var import_react22 = __toESM(require_react(), 1);
|
|
37193
37194
|
var ReactDOM3 = __toESM(require_react_dom(), 1);
|
|
37194
37195
|
var React27 = __toESM(require_react(), 1);
|
|
37195
37196
|
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37200,13 +37201,13 @@ var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
|
|
|
37200
37201
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
|
|
37201
37202
|
var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
|
|
37202
37203
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
37203
|
-
var
|
|
37204
|
+
var import_react23 = __toESM(require_react(), 1);
|
|
37204
37205
|
var React252 = __toESM(require_react(), 1);
|
|
37205
37206
|
var React35 = __toESM(require_react(), 1);
|
|
37206
37207
|
var ReactDOM4 = __toESM(require_react_dom(), 1);
|
|
37207
|
-
var import_react23 = __toESM(require_react(), 1);
|
|
37208
|
-
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37209
37208
|
var import_react24 = __toESM(require_react(), 1);
|
|
37209
|
+
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
37210
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
37210
37211
|
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
37211
37212
|
var React33 = __toESM(require_react(), 1);
|
|
37212
37213
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -37219,13 +37220,24 @@ var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
|
|
|
37219
37220
|
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
|
|
37220
37221
|
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
|
|
37221
37222
|
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
|
|
37222
|
-
var
|
|
37223
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
37223
37224
|
var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
|
|
37224
37225
|
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
|
|
37225
37226
|
var React272 = __toESM(require_react(), 1);
|
|
37226
37227
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
37227
37228
|
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
|
|
37229
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
37230
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
37228
37231
|
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
|
|
37232
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
37233
|
+
var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
|
|
37234
|
+
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
37235
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
37236
|
+
var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
|
|
37237
|
+
var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
|
|
37238
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
37239
|
+
var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
|
|
37240
|
+
var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
|
|
37229
37241
|
var __create2 = Object.create;
|
|
37230
37242
|
var __defProp2 = Object.defineProperty;
|
|
37231
37243
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -37254,69 +37266,69 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
|
|
|
37254
37266
|
var require_qr_code_styling = __commonJS2({
|
|
37255
37267
|
"../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports2, module2) {
|
|
37256
37268
|
"use strict";
|
|
37257
|
-
!(function(
|
|
37258
|
-
"object" == typeof exports2 && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports2 ? exports2.QRCodeStyling = e() :
|
|
37269
|
+
!(function(t11, e) {
|
|
37270
|
+
"object" == typeof exports2 && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports2 ? exports2.QRCodeStyling = e() : t11.QRCodeStyling = e();
|
|
37259
37271
|
})(exports2, (() => (() => {
|
|
37260
|
-
var
|
|
37272
|
+
var t11 = { 873: (t12, e2) => {
|
|
37261
37273
|
var i2, r3, n = (function() {
|
|
37262
|
-
var
|
|
37263
|
-
var i4 =
|
|
37264
|
-
n3 = (function(
|
|
37265
|
-
for (var e6 = new Array(
|
|
37266
|
-
e6[i5] = new Array(
|
|
37267
|
-
for (var r6 = 0; r6 <
|
|
37274
|
+
var t13 = function(t14, e4) {
|
|
37275
|
+
var i4 = t14, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t15, e5) {
|
|
37276
|
+
n3 = (function(t16) {
|
|
37277
|
+
for (var e6 = new Array(t16), i5 = 0; i5 < t16; i5 += 1) {
|
|
37278
|
+
e6[i5] = new Array(t16);
|
|
37279
|
+
for (var r6 = 0; r6 < t16; r6 += 1) e6[i5][r6] = null;
|
|
37268
37280
|
}
|
|
37269
37281
|
return e6;
|
|
37270
|
-
})(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(
|
|
37271
|
-
}, b = function(
|
|
37272
|
-
for (var i5 = -1; i5 <= 7; i5 += 1) if (!(
|
|
37282
|
+
})(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(t15, e5), i4 >= 7 && S(t15), null == h2 && (h2 = M(i4, r5, p2)), A(h2, e5);
|
|
37283
|
+
}, b = function(t15, e5) {
|
|
37284
|
+
for (var i5 = -1; i5 <= 7; i5 += 1) if (!(t15 + i5 <= -1 || o2 <= t15 + i5)) for (var r6 = -1; r6 <= 7; r6 += 1) e5 + r6 <= -1 || o2 <= e5 + r6 || (n3[t15 + i5][e5 + r6] = 0 <= i5 && i5 <= 6 && (0 == r6 || 6 == r6) || 0 <= r6 && r6 <= 6 && (0 == i5 || 6 == i5) || 2 <= i5 && i5 <= 4 && 2 <= r6 && r6 <= 4);
|
|
37273
37285
|
}, y = function() {
|
|
37274
|
-
for (var
|
|
37286
|
+
for (var t15 = 8; t15 < o2 - 8; t15 += 1) null == n3[t15][6] && (n3[t15][6] = t15 % 2 == 0);
|
|
37275
37287
|
for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
|
|
37276
37288
|
}, x = function() {
|
|
37277
|
-
for (var
|
|
37278
|
-
var o3 =
|
|
37289
|
+
for (var t15 = a.getPatternPosition(i4), e5 = 0; e5 < t15.length; e5 += 1) for (var r6 = 0; r6 < t15.length; r6 += 1) {
|
|
37290
|
+
var o3 = t15[e5], s2 = t15[r6];
|
|
37279
37291
|
if (null == n3[o3][s2]) for (var h3 = -2; h3 <= 2; h3 += 1) for (var d2 = -2; d2 <= 2; d2 += 1) n3[o3 + h3][s2 + d2] = -2 == h3 || 2 == h3 || -2 == d2 || 2 == d2 || 0 == h3 && 0 == d2;
|
|
37280
37292
|
}
|
|
37281
|
-
}, S = function(
|
|
37293
|
+
}, S = function(t15) {
|
|
37282
37294
|
for (var e5 = a.getBCHTypeNumber(i4), r6 = 0; r6 < 18; r6 += 1) {
|
|
37283
|
-
var s2 = !
|
|
37295
|
+
var s2 = !t15 && 1 == (e5 >> r6 & 1);
|
|
37284
37296
|
n3[Math.floor(r6 / 3)][r6 % 3 + o2 - 8 - 3] = s2;
|
|
37285
37297
|
}
|
|
37286
|
-
for (r6 = 0; r6 < 18; r6 += 1) s2 = !
|
|
37287
|
-
}, C = function(
|
|
37298
|
+
for (r6 = 0; r6 < 18; r6 += 1) s2 = !t15 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
|
|
37299
|
+
}, C = function(t15, e5) {
|
|
37288
37300
|
for (var i5 = r5 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
|
|
37289
|
-
var d2 = !
|
|
37301
|
+
var d2 = !t15 && 1 == (s2 >> h3 & 1);
|
|
37290
37302
|
h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
|
|
37291
37303
|
}
|
|
37292
|
-
for (h3 = 0; h3 < 15; h3 += 1) d2 = !
|
|
37293
|
-
n3[o2 - 8][8] = !
|
|
37294
|
-
}, A = function(
|
|
37304
|
+
for (h3 = 0; h3 < 15; h3 += 1) d2 = !t15 && 1 == (s2 >> h3 & 1), h3 < 8 ? n3[8][o2 - h3 - 1] = d2 : h3 < 9 ? n3[8][15 - h3 - 1 + 1] = d2 : n3[8][15 - h3 - 1] = d2;
|
|
37305
|
+
n3[o2 - 8][8] = !t15;
|
|
37306
|
+
}, A = function(t15, e5) {
|
|
37295
37307
|
for (var i5 = -1, r6 = o2 - 1, s2 = 7, h3 = 0, d2 = a.getMaskFunction(e5), u2 = o2 - 1; u2 > 0; u2 -= 2) for (6 == u2 && (u2 -= 1); ; ) {
|
|
37296
37308
|
for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r6][u2 - c2]) {
|
|
37297
37309
|
var l2 = false;
|
|
37298
|
-
h3 <
|
|
37310
|
+
h3 < t15.length && (l2 = 1 == (t15[h3] >>> s2 & 1)), d2(r6, u2 - c2) && (l2 = !l2), n3[r6][u2 - c2] = l2, -1 == (s2 -= 1) && (h3 += 1, s2 = 7);
|
|
37299
37311
|
}
|
|
37300
37312
|
if ((r6 += i5) < 0 || o2 <= r6) {
|
|
37301
37313
|
r6 -= i5, i5 = -i5;
|
|
37302
37314
|
break;
|
|
37303
37315
|
}
|
|
37304
37316
|
}
|
|
37305
|
-
}, M = function(
|
|
37306
|
-
for (var r6 = u.getRSBlocks(
|
|
37317
|
+
}, M = function(t15, e5, i5) {
|
|
37318
|
+
for (var r6 = u.getRSBlocks(t15, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
|
|
37307
37319
|
var s2 = i5[o3];
|
|
37308
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37320
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37309
37321
|
}
|
|
37310
37322
|
var h3 = 0;
|
|
37311
37323
|
for (o3 = 0; o3 < r6.length; o3 += 1) h3 += r6[o3].dataCount;
|
|
37312
37324
|
if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
|
|
37313
37325
|
for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
|
|
37314
37326
|
for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
|
|
37315
|
-
return (function(
|
|
37327
|
+
return (function(t16, e6) {
|
|
37316
37328
|
for (var i6 = 0, r7 = 0, n5 = 0, o4 = new Array(e6.length), s3 = new Array(e6.length), h4 = 0; h4 < e6.length; h4 += 1) {
|
|
37317
37329
|
var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
|
|
37318
37330
|
r7 = Math.max(r7, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
|
|
37319
|
-
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 &
|
|
37331
|
+
for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t16.getBuffer()[l2 + i6];
|
|
37320
37332
|
i6 += u2;
|
|
37321
37333
|
var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
|
|
37322
37334
|
for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
|
|
@@ -37332,85 +37344,85 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37332
37344
|
return v3;
|
|
37333
37345
|
})(n4, r6);
|
|
37334
37346
|
};
|
|
37335
|
-
v2.addData = function(
|
|
37347
|
+
v2.addData = function(t15, e5) {
|
|
37336
37348
|
var i5 = null;
|
|
37337
37349
|
switch (e5 = e5 || "Byte") {
|
|
37338
37350
|
case "Numeric":
|
|
37339
|
-
i5 = l(
|
|
37351
|
+
i5 = l(t15);
|
|
37340
37352
|
break;
|
|
37341
37353
|
case "Alphanumeric":
|
|
37342
|
-
i5 = g(
|
|
37354
|
+
i5 = g(t15);
|
|
37343
37355
|
break;
|
|
37344
37356
|
case "Byte":
|
|
37345
|
-
i5 = f(
|
|
37357
|
+
i5 = f(t15);
|
|
37346
37358
|
break;
|
|
37347
37359
|
case "Kanji":
|
|
37348
|
-
i5 = w(
|
|
37360
|
+
i5 = w(t15);
|
|
37349
37361
|
break;
|
|
37350
37362
|
default:
|
|
37351
37363
|
throw "mode:" + e5;
|
|
37352
37364
|
}
|
|
37353
37365
|
p2.push(i5), h2 = null;
|
|
37354
|
-
}, v2.isDark = function(
|
|
37355
|
-
if (
|
|
37356
|
-
return n3[
|
|
37366
|
+
}, v2.isDark = function(t15, e5) {
|
|
37367
|
+
if (t15 < 0 || o2 <= t15 || e5 < 0 || o2 <= e5) throw t15 + "," + e5;
|
|
37368
|
+
return n3[t15][e5];
|
|
37357
37369
|
}, v2.getModuleCount = function() {
|
|
37358
37370
|
return o2;
|
|
37359
37371
|
}, v2.make = function() {
|
|
37360
37372
|
if (i4 < 1) {
|
|
37361
|
-
for (var
|
|
37362
|
-
for (var e5 = u.getRSBlocks(
|
|
37373
|
+
for (var t15 = 1; t15 < 40; t15++) {
|
|
37374
|
+
for (var e5 = u.getRSBlocks(t15, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
|
|
37363
37375
|
var s2 = p2[o3];
|
|
37364
|
-
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(),
|
|
37376
|
+
n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
|
|
37365
37377
|
}
|
|
37366
37378
|
var h3 = 0;
|
|
37367
37379
|
for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
|
|
37368
37380
|
if (n4.getLengthInBits() <= 8 * h3) break;
|
|
37369
37381
|
}
|
|
37370
|
-
i4 =
|
|
37382
|
+
i4 = t15;
|
|
37371
37383
|
}
|
|
37372
37384
|
m(false, (function() {
|
|
37373
|
-
for (var
|
|
37385
|
+
for (var t16 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
|
|
37374
37386
|
m(true, i5);
|
|
37375
37387
|
var r6 = a.getLostPoint(v2);
|
|
37376
|
-
(0 == i5 ||
|
|
37388
|
+
(0 == i5 || t16 > r6) && (t16 = r6, e6 = i5);
|
|
37377
37389
|
}
|
|
37378
37390
|
return e6;
|
|
37379
37391
|
})());
|
|
37380
|
-
}, v2.createTableTag = function(
|
|
37381
|
-
|
|
37392
|
+
}, v2.createTableTag = function(t15, e5) {
|
|
37393
|
+
t15 = t15 || 2;
|
|
37382
37394
|
var i5 = "";
|
|
37383
|
-
i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 *
|
|
37395
|
+
i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 * t15 : e5) + "px;", i5 += '">', i5 += "<tbody>";
|
|
37384
37396
|
for (var r6 = 0; r6 < v2.getModuleCount(); r6 += 1) {
|
|
37385
37397
|
i5 += "<tr>";
|
|
37386
|
-
for (var n4 = 0; n4 < v2.getModuleCount(); n4 += 1) i5 += '<td style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: 0px;", i5 += " width: " +
|
|
37398
|
+
for (var n4 = 0; n4 < v2.getModuleCount(); n4 += 1) i5 += '<td style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: 0px;", i5 += " width: " + t15 + "px;", i5 += " height: " + t15 + "px;", i5 += " background-color: ", i5 += v2.isDark(r6, n4) ? "#000000" : "#ffffff", i5 += ";", i5 += '"/>';
|
|
37387
37399
|
i5 += "</tr>";
|
|
37388
37400
|
}
|
|
37389
37401
|
return (i5 += "</tbody>") + "</table>";
|
|
37390
|
-
}, v2.createSvgTag = function(
|
|
37402
|
+
}, v2.createSvgTag = function(t15, e5, i5, r6) {
|
|
37391
37403
|
var n4 = {};
|
|
37392
|
-
"object" == typeof arguments[0] && (
|
|
37393
|
-
var o3, s2, a2, h3, d2 = v2.getModuleCount() *
|
|
37394
|
-
for (h3 = "l" +
|
|
37404
|
+
"object" == typeof arguments[0] && (t15 = (n4 = arguments[0]).cellSize, e5 = n4.margin, i5 = n4.alt, r6 = n4.title), t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5, (i5 = "string" == typeof i5 ? { text: i5 } : i5 || {}).text = i5.text || null, i5.id = i5.text ? i5.id || "qrcode-description" : null, (r6 = "string" == typeof r6 ? { text: r6 } : r6 || {}).text = r6.text || null, r6.id = r6.text ? r6.id || "qrcode-title" : null;
|
|
37405
|
+
var o3, s2, a2, h3, d2 = v2.getModuleCount() * t15 + 2 * e5, u2 = "";
|
|
37406
|
+
for (h3 = "l" + t15 + ",0 0," + t15 + " -" + t15 + ",0 0,-" + t15 + "z ", u2 += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"', u2 += n4.scalable ? "" : ' width="' + d2 + 'px" height="' + d2 + 'px"', u2 += ' viewBox="0 0 ' + d2 + " " + d2 + '" ', u2 += ' preserveAspectRatio="xMinYMin meet"', u2 += r6.text || i5.text ? ' role="img" aria-labelledby="' + $([r6.id, i5.id].join(" ").trim()) + '"' : "", u2 += ">", u2 += r6.text ? '<title id="' + $(r6.id) + '">' + $(r6.text) + "</title>" : "", u2 += i5.text ? '<description id="' + $(i5.id) + '">' + $(i5.text) + "</description>" : "", u2 += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>', u2 += '<path d="', s2 = 0; s2 < v2.getModuleCount(); s2 += 1) for (a2 = s2 * t15 + e5, o3 = 0; o3 < v2.getModuleCount(); o3 += 1) v2.isDark(s2, o3) && (u2 += "M" + (o3 * t15 + e5) + "," + a2 + h3);
|
|
37395
37407
|
return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
|
|
37396
|
-
}, v2.createDataURL = function(
|
|
37397
|
-
|
|
37398
|
-
var i5 = v2.getModuleCount() *
|
|
37408
|
+
}, v2.createDataURL = function(t15, e5) {
|
|
37409
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37410
|
+
var i5 = v2.getModuleCount() * t15 + 2 * e5, r6 = e5, n4 = i5 - e5;
|
|
37399
37411
|
return _(i5, i5, (function(e6, i6) {
|
|
37400
37412
|
if (r6 <= e6 && e6 < n4 && r6 <= i6 && i6 < n4) {
|
|
37401
|
-
var o3 = Math.floor((e6 - r6) /
|
|
37413
|
+
var o3 = Math.floor((e6 - r6) / t15), s2 = Math.floor((i6 - r6) / t15);
|
|
37402
37414
|
return v2.isDark(s2, o3) ? 0 : 1;
|
|
37403
37415
|
}
|
|
37404
37416
|
return 1;
|
|
37405
37417
|
}));
|
|
37406
|
-
}, v2.createImgTag = function(
|
|
37407
|
-
|
|
37408
|
-
var r6 = v2.getModuleCount() *
|
|
37409
|
-
return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(
|
|
37418
|
+
}, v2.createImgTag = function(t15, e5, i5) {
|
|
37419
|
+
t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
|
|
37420
|
+
var r6 = v2.getModuleCount() * t15 + 2 * e5, n4 = "";
|
|
37421
|
+
return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(t15, e5), n4 += '"', n4 += ' width="', n4 += r6, n4 += '"', n4 += ' height="', n4 += r6, n4 += '"', i5 && (n4 += ' alt="', n4 += $(i5), n4 += '"'), n4 + "/>";
|
|
37410
37422
|
};
|
|
37411
|
-
var $ = function(
|
|
37412
|
-
for (var e5 = "", i5 = 0; i5 <
|
|
37413
|
-
var r6 =
|
|
37423
|
+
var $ = function(t15) {
|
|
37424
|
+
for (var e5 = "", i5 = 0; i5 < t15.length; i5 += 1) {
|
|
37425
|
+
var r6 = t15.charAt(i5);
|
|
37414
37426
|
switch (r6) {
|
|
37415
37427
|
case "<":
|
|
37416
37428
|
e5 += "<";
|
|
@@ -37430,40 +37442,40 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37430
37442
|
}
|
|
37431
37443
|
return e5;
|
|
37432
37444
|
};
|
|
37433
|
-
return v2.createASCII = function(
|
|
37434
|
-
if ((
|
|
37435
|
-
|
|
37436
|
-
var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 *
|
|
37445
|
+
return v2.createASCII = function(t15, e5) {
|
|
37446
|
+
if ((t15 = t15 || 1) < 2) return (function(t16) {
|
|
37447
|
+
t16 = void 0 === t16 ? 2 : t16;
|
|
37448
|
+
var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 * t16, a3 = t16, h4 = s3 - t16, d3 = { "\u2588\u2588": "\u2588", "\u2588 ": "\u2580", " \u2588": "\u2584", " ": " " }, u3 = { "\u2588\u2588": "\u2580", "\u2588 ": "\u2580", " \u2588": " ", " ": " " }, c3 = "";
|
|
37437
37449
|
for (e6 = 0; e6 < s3; e6 += 2) {
|
|
37438
|
-
for (r7 = Math.floor((e6 - a3) / 1), n5 = Math.floor((e6 + 1 - a3) / 1), i6 = 0; i6 < s3; i6 += 1) o4 = "\u2588", a3 <= i6 && i6 < h4 && a3 <= e6 && e6 < h4 && v2.isDark(r7, Math.floor((i6 - a3) / 1)) && (o4 = " "), a3 <= i6 && i6 < h4 && a3 <= e6 + 1 && e6 + 1 < h4 && v2.isDark(n5, Math.floor((i6 - a3) / 1)) ? o4 += " " : o4 += "\u2588", c3 +=
|
|
37450
|
+
for (r7 = Math.floor((e6 - a3) / 1), n5 = Math.floor((e6 + 1 - a3) / 1), i6 = 0; i6 < s3; i6 += 1) o4 = "\u2588", a3 <= i6 && i6 < h4 && a3 <= e6 && e6 < h4 && v2.isDark(r7, Math.floor((i6 - a3) / 1)) && (o4 = " "), a3 <= i6 && i6 < h4 && a3 <= e6 + 1 && e6 + 1 < h4 && v2.isDark(n5, Math.floor((i6 - a3) / 1)) ? o4 += " " : o4 += "\u2588", c3 += t16 < 1 && e6 + 1 >= h4 ? u3[o4] : d3[o4];
|
|
37439
37451
|
c3 += "\n";
|
|
37440
37452
|
}
|
|
37441
|
-
return s3 % 2 &&
|
|
37453
|
+
return s3 % 2 && t16 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
|
|
37442
37454
|
})(e5);
|
|
37443
|
-
|
|
37444
|
-
var i5, r6, n4, o3, s2 = v2.getModuleCount() *
|
|
37455
|
+
t15 -= 1, e5 = void 0 === e5 ? 2 * t15 : e5;
|
|
37456
|
+
var i5, r6, n4, o3, s2 = v2.getModuleCount() * t15 + 2 * e5, a2 = e5, h3 = s2 - e5, d2 = Array(t15 + 1).join("\u2588\u2588"), u2 = Array(t15 + 1).join(" "), c2 = "", l2 = "";
|
|
37445
37457
|
for (i5 = 0; i5 < s2; i5 += 1) {
|
|
37446
|
-
for (n4 = Math.floor((i5 - a2) /
|
|
37447
|
-
for (n4 = 0; n4 <
|
|
37458
|
+
for (n4 = Math.floor((i5 - a2) / t15), l2 = "", r6 = 0; r6 < s2; r6 += 1) o3 = 1, a2 <= r6 && r6 < h3 && a2 <= i5 && i5 < h3 && v2.isDark(n4, Math.floor((r6 - a2) / t15)) && (o3 = 0), l2 += o3 ? d2 : u2;
|
|
37459
|
+
for (n4 = 0; n4 < t15; n4 += 1) c2 += l2 + "\n";
|
|
37448
37460
|
}
|
|
37449
37461
|
return c2.substring(0, c2.length - 1);
|
|
37450
|
-
}, v2.renderTo2dContext = function(
|
|
37462
|
+
}, v2.renderTo2dContext = function(t15, e5) {
|
|
37451
37463
|
e5 = e5 || 2;
|
|
37452
|
-
for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++)
|
|
37464
|
+
for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++) t15.fillStyle = v2.isDark(r6, n4) ? "black" : "white", t15.fillRect(r6 * e5, n4 * e5, e5, e5);
|
|
37453
37465
|
}, v2;
|
|
37454
37466
|
};
|
|
37455
|
-
|
|
37456
|
-
for (var e4 = [], i4 = 0; i4 <
|
|
37457
|
-
var r5 =
|
|
37467
|
+
t13.stringToBytes = (t13.stringToBytesFuncs = { default: function(t14) {
|
|
37468
|
+
for (var e4 = [], i4 = 0; i4 < t14.length; i4 += 1) {
|
|
37469
|
+
var r5 = t14.charCodeAt(i4);
|
|
37458
37470
|
e4.push(255 & r5);
|
|
37459
37471
|
}
|
|
37460
37472
|
return e4;
|
|
37461
|
-
} }).default,
|
|
37473
|
+
} }).default, t13.createStringToBytes = function(t14, e4) {
|
|
37462
37474
|
var i4 = (function() {
|
|
37463
|
-
for (var i5 = v(
|
|
37464
|
-
var
|
|
37465
|
-
if (-1 ==
|
|
37466
|
-
return
|
|
37475
|
+
for (var i5 = v(t14), r6 = function() {
|
|
37476
|
+
var t15 = i5.read();
|
|
37477
|
+
if (-1 == t15) throw "eof";
|
|
37478
|
+
return t15;
|
|
37467
37479
|
}, n3 = 0, o2 = {}; ; ) {
|
|
37468
37480
|
var s2 = i5.read();
|
|
37469
37481
|
if (-1 == s2) break;
|
|
@@ -37473,71 +37485,71 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37473
37485
|
if (n3 != e4) throw n3 + " != " + e4;
|
|
37474
37486
|
return o2;
|
|
37475
37487
|
})(), r5 = "?".charCodeAt(0);
|
|
37476
|
-
return function(
|
|
37477
|
-
for (var e5 = [], n3 = 0; n3 <
|
|
37478
|
-
var o2 =
|
|
37488
|
+
return function(t15) {
|
|
37489
|
+
for (var e5 = [], n3 = 0; n3 < t15.length; n3 += 1) {
|
|
37490
|
+
var o2 = t15.charCodeAt(n3);
|
|
37479
37491
|
if (o2 < 128) e5.push(o2);
|
|
37480
37492
|
else {
|
|
37481
|
-
var s2 = i4[
|
|
37493
|
+
var s2 = i4[t15.charAt(n3)];
|
|
37482
37494
|
"number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r5);
|
|
37483
37495
|
}
|
|
37484
37496
|
}
|
|
37485
37497
|
return e5;
|
|
37486
37498
|
};
|
|
37487
37499
|
};
|
|
37488
|
-
var e3, i3, r4, n2, o, s = { L: 1, M: 0, Q: 3, H: 2 }, a = (e3 = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], i3 = 1335, r4 = 7973, o = function(
|
|
37489
|
-
for (var e4 = 0; 0 !=
|
|
37500
|
+
var e3, i3, r4, n2, o, s = { L: 1, M: 0, Q: 3, H: 2 }, a = (e3 = [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]], i3 = 1335, r4 = 7973, o = function(t14) {
|
|
37501
|
+
for (var e4 = 0; 0 != t14; ) e4 += 1, t14 >>>= 1;
|
|
37490
37502
|
return e4;
|
|
37491
|
-
}, (n2 = {}).getBCHTypeInfo = function(
|
|
37492
|
-
for (var e4 =
|
|
37493
|
-
return 21522 ^ (
|
|
37494
|
-
}, n2.getBCHTypeNumber = function(
|
|
37495
|
-
for (var e4 =
|
|
37496
|
-
return
|
|
37497
|
-
}, n2.getPatternPosition = function(
|
|
37498
|
-
return e3[
|
|
37499
|
-
}, n2.getMaskFunction = function(
|
|
37500
|
-
switch (
|
|
37503
|
+
}, (n2 = {}).getBCHTypeInfo = function(t14) {
|
|
37504
|
+
for (var e4 = t14 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
|
|
37505
|
+
return 21522 ^ (t14 << 10 | e4);
|
|
37506
|
+
}, n2.getBCHTypeNumber = function(t14) {
|
|
37507
|
+
for (var e4 = t14 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
|
|
37508
|
+
return t14 << 12 | e4;
|
|
37509
|
+
}, n2.getPatternPosition = function(t14) {
|
|
37510
|
+
return e3[t14 - 1];
|
|
37511
|
+
}, n2.getMaskFunction = function(t14) {
|
|
37512
|
+
switch (t14) {
|
|
37501
37513
|
case 0:
|
|
37502
|
-
return function(
|
|
37503
|
-
return (
|
|
37514
|
+
return function(t15, e4) {
|
|
37515
|
+
return (t15 + e4) % 2 == 0;
|
|
37504
37516
|
};
|
|
37505
37517
|
case 1:
|
|
37506
|
-
return function(
|
|
37507
|
-
return
|
|
37518
|
+
return function(t15, e4) {
|
|
37519
|
+
return t15 % 2 == 0;
|
|
37508
37520
|
};
|
|
37509
37521
|
case 2:
|
|
37510
|
-
return function(
|
|
37522
|
+
return function(t15, e4) {
|
|
37511
37523
|
return e4 % 3 == 0;
|
|
37512
37524
|
};
|
|
37513
37525
|
case 3:
|
|
37514
|
-
return function(
|
|
37515
|
-
return (
|
|
37526
|
+
return function(t15, e4) {
|
|
37527
|
+
return (t15 + e4) % 3 == 0;
|
|
37516
37528
|
};
|
|
37517
37529
|
case 4:
|
|
37518
|
-
return function(
|
|
37519
|
-
return (Math.floor(
|
|
37530
|
+
return function(t15, e4) {
|
|
37531
|
+
return (Math.floor(t15 / 2) + Math.floor(e4 / 3)) % 2 == 0;
|
|
37520
37532
|
};
|
|
37521
37533
|
case 5:
|
|
37522
|
-
return function(
|
|
37523
|
-
return
|
|
37534
|
+
return function(t15, e4) {
|
|
37535
|
+
return t15 * e4 % 2 + t15 * e4 % 3 == 0;
|
|
37524
37536
|
};
|
|
37525
37537
|
case 6:
|
|
37526
|
-
return function(
|
|
37527
|
-
return (
|
|
37538
|
+
return function(t15, e4) {
|
|
37539
|
+
return (t15 * e4 % 2 + t15 * e4 % 3) % 2 == 0;
|
|
37528
37540
|
};
|
|
37529
37541
|
case 7:
|
|
37530
|
-
return function(
|
|
37531
|
-
return (
|
|
37542
|
+
return function(t15, e4) {
|
|
37543
|
+
return (t15 * e4 % 3 + (t15 + e4) % 2) % 2 == 0;
|
|
37532
37544
|
};
|
|
37533
37545
|
default:
|
|
37534
|
-
throw "bad maskPattern:" +
|
|
37546
|
+
throw "bad maskPattern:" + t14;
|
|
37535
37547
|
}
|
|
37536
|
-
}, n2.getErrorCorrectPolynomial = function(
|
|
37537
|
-
for (var e4 = d([1], 0), i4 = 0; i4 <
|
|
37548
|
+
}, n2.getErrorCorrectPolynomial = function(t14) {
|
|
37549
|
+
for (var e4 = d([1], 0), i4 = 0; i4 < t14; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
|
|
37538
37550
|
return e4;
|
|
37539
|
-
}, n2.getLengthInBits = function(
|
|
37540
|
-
if (1 <= e4 && e4 < 10) switch (
|
|
37551
|
+
}, n2.getLengthInBits = function(t14, e4) {
|
|
37552
|
+
if (1 <= e4 && e4 < 10) switch (t14) {
|
|
37541
37553
|
case 1:
|
|
37542
37554
|
return 10;
|
|
37543
37555
|
case 2:
|
|
@@ -37546,9 +37558,9 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37546
37558
|
case 8:
|
|
37547
37559
|
return 8;
|
|
37548
37560
|
default:
|
|
37549
|
-
throw "mode:" +
|
|
37561
|
+
throw "mode:" + t14;
|
|
37550
37562
|
}
|
|
37551
|
-
else if (e4 < 27) switch (
|
|
37563
|
+
else if (e4 < 27) switch (t14) {
|
|
37552
37564
|
case 1:
|
|
37553
37565
|
return 12;
|
|
37554
37566
|
case 2:
|
|
@@ -37558,11 +37570,11 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37558
37570
|
case 8:
|
|
37559
37571
|
return 10;
|
|
37560
37572
|
default:
|
|
37561
|
-
throw "mode:" +
|
|
37573
|
+
throw "mode:" + t14;
|
|
37562
37574
|
}
|
|
37563
37575
|
else {
|
|
37564
37576
|
if (!(e4 < 41)) throw "type:" + e4;
|
|
37565
|
-
switch (
|
|
37577
|
+
switch (t14) {
|
|
37566
37578
|
case 1:
|
|
37567
37579
|
return 14;
|
|
37568
37580
|
case 2:
|
|
@@ -37572,72 +37584,72 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37572
37584
|
case 8:
|
|
37573
37585
|
return 12;
|
|
37574
37586
|
default:
|
|
37575
|
-
throw "mode:" +
|
|
37587
|
+
throw "mode:" + t14;
|
|
37576
37588
|
}
|
|
37577
37589
|
}
|
|
37578
|
-
}, n2.getLostPoint = function(
|
|
37579
|
-
for (var e4 =
|
|
37580
|
-
for (var o2 = 0, s2 =
|
|
37590
|
+
}, n2.getLostPoint = function(t14) {
|
|
37591
|
+
for (var e4 = t14.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
|
|
37592
|
+
for (var o2 = 0, s2 = t14.isDark(r5, n3), a2 = -1; a2 <= 1; a2 += 1) if (!(r5 + a2 < 0 || e4 <= r5 + a2)) for (var h2 = -1; h2 <= 1; h2 += 1) n3 + h2 < 0 || e4 <= n3 + h2 || 0 == a2 && 0 == h2 || s2 == t14.isDark(r5 + a2, n3 + h2) && (o2 += 1);
|
|
37581
37593
|
o2 > 5 && (i4 += 3 + o2 - 5);
|
|
37582
37594
|
}
|
|
37583
37595
|
for (r5 = 0; r5 < e4 - 1; r5 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
|
|
37584
37596
|
var d2 = 0;
|
|
37585
|
-
|
|
37597
|
+
t14.isDark(r5, n3) && (d2 += 1), t14.isDark(r5 + 1, n3) && (d2 += 1), t14.isDark(r5, n3 + 1) && (d2 += 1), t14.isDark(r5 + 1, n3 + 1) && (d2 += 1), 0 != d2 && 4 != d2 || (i4 += 3);
|
|
37586
37598
|
}
|
|
37587
|
-
for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1)
|
|
37588
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1)
|
|
37599
|
+
for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1) t14.isDark(r5, n3) && !t14.isDark(r5, n3 + 1) && t14.isDark(r5, n3 + 2) && t14.isDark(r5, n3 + 3) && t14.isDark(r5, n3 + 4) && !t14.isDark(r5, n3 + 5) && t14.isDark(r5, n3 + 6) && (i4 += 40);
|
|
37600
|
+
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1) t14.isDark(r5, n3) && !t14.isDark(r5 + 1, n3) && t14.isDark(r5 + 2, n3) && t14.isDark(r5 + 3, n3) && t14.isDark(r5 + 4, n3) && !t14.isDark(r5 + 5, n3) && t14.isDark(r5 + 6, n3) && (i4 += 40);
|
|
37589
37601
|
var u2 = 0;
|
|
37590
|
-
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1)
|
|
37602
|
+
for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t14.isDark(r5, n3) && (u2 += 1);
|
|
37591
37603
|
return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
|
|
37592
37604
|
}, n2), h = (function() {
|
|
37593
|
-
for (var
|
|
37594
|
-
for (i4 = 8; i4 < 256; i4 += 1)
|
|
37595
|
-
for (i4 = 0; i4 < 255; i4 += 1) e4[
|
|
37596
|
-
return { glog: function(
|
|
37597
|
-
if (
|
|
37598
|
-
return e4[
|
|
37605
|
+
for (var t14 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t14[i4] = 1 << i4;
|
|
37606
|
+
for (i4 = 8; i4 < 256; i4 += 1) t14[i4] = t14[i4 - 4] ^ t14[i4 - 5] ^ t14[i4 - 6] ^ t14[i4 - 8];
|
|
37607
|
+
for (i4 = 0; i4 < 255; i4 += 1) e4[t14[i4]] = i4;
|
|
37608
|
+
return { glog: function(t15) {
|
|
37609
|
+
if (t15 < 1) throw "glog(" + t15 + ")";
|
|
37610
|
+
return e4[t15];
|
|
37599
37611
|
}, gexp: function(e5) {
|
|
37600
37612
|
for (; e5 < 0; ) e5 += 255;
|
|
37601
37613
|
for (; e5 >= 256; ) e5 -= 255;
|
|
37602
|
-
return
|
|
37614
|
+
return t14[e5];
|
|
37603
37615
|
} };
|
|
37604
37616
|
})();
|
|
37605
|
-
function d(
|
|
37606
|
-
if (void 0 ===
|
|
37617
|
+
function d(t14, e4) {
|
|
37618
|
+
if (void 0 === t14.length) throw t14.length + "/" + e4;
|
|
37607
37619
|
var i4 = (function() {
|
|
37608
|
-
for (var i5 = 0; i5 <
|
|
37609
|
-
for (var r6 = new Array(
|
|
37620
|
+
for (var i5 = 0; i5 < t14.length && 0 == t14[i5]; ) i5 += 1;
|
|
37621
|
+
for (var r6 = new Array(t14.length - i5 + e4), n3 = 0; n3 < t14.length - i5; n3 += 1) r6[n3] = t14[n3 + i5];
|
|
37610
37622
|
return r6;
|
|
37611
|
-
})(), r5 = { getAt: function(
|
|
37612
|
-
return i4[
|
|
37623
|
+
})(), r5 = { getAt: function(t15) {
|
|
37624
|
+
return i4[t15];
|
|
37613
37625
|
}, getLength: function() {
|
|
37614
37626
|
return i4.length;
|
|
37615
|
-
}, multiply: function(
|
|
37616
|
-
for (var e5 = new Array(r5.getLength() +
|
|
37627
|
+
}, multiply: function(t15) {
|
|
37628
|
+
for (var e5 = new Array(r5.getLength() + t15.getLength() - 1), i5 = 0; i5 < r5.getLength(); i5 += 1) for (var n3 = 0; n3 < t15.getLength(); n3 += 1) e5[i5 + n3] ^= h.gexp(h.glog(r5.getAt(i5)) + h.glog(t15.getAt(n3)));
|
|
37617
37629
|
return d(e5, 0);
|
|
37618
|
-
}, mod: function(
|
|
37619
|
-
if (r5.getLength() -
|
|
37620
|
-
for (var e5 = h.glog(r5.getAt(0)) - h.glog(
|
|
37621
|
-
for (n3 = 0; n3 <
|
|
37622
|
-
return d(i5, 0).mod(
|
|
37630
|
+
}, mod: function(t15) {
|
|
37631
|
+
if (r5.getLength() - t15.getLength() < 0) return r5;
|
|
37632
|
+
for (var e5 = h.glog(r5.getAt(0)) - h.glog(t15.getAt(0)), i5 = new Array(r5.getLength()), n3 = 0; n3 < r5.getLength(); n3 += 1) i5[n3] = r5.getAt(n3);
|
|
37633
|
+
for (n3 = 0; n3 < t15.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t15.getAt(n3)) + e5);
|
|
37634
|
+
return d(i5, 0).mod(t15);
|
|
37623
37635
|
} };
|
|
37624
37636
|
return r5;
|
|
37625
37637
|
}
|
|
37626
37638
|
var u = /* @__PURE__ */ (function() {
|
|
37627
|
-
var
|
|
37639
|
+
var t14 = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12, 7, 37, 13], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]], e4 = function(t15, e5) {
|
|
37628
37640
|
var i5 = {};
|
|
37629
|
-
return i5.totalCount =
|
|
37641
|
+
return i5.totalCount = t15, i5.dataCount = e5, i5;
|
|
37630
37642
|
}, i4 = { getRSBlocks: function(i5, r5) {
|
|
37631
37643
|
var n3 = (function(e5, i6) {
|
|
37632
37644
|
switch (i6) {
|
|
37633
37645
|
case s.L:
|
|
37634
|
-
return
|
|
37646
|
+
return t14[4 * (e5 - 1) + 0];
|
|
37635
37647
|
case s.M:
|
|
37636
|
-
return
|
|
37648
|
+
return t14[4 * (e5 - 1) + 1];
|
|
37637
37649
|
case s.Q:
|
|
37638
|
-
return
|
|
37650
|
+
return t14[4 * (e5 - 1) + 2];
|
|
37639
37651
|
case s.H:
|
|
37640
|
-
return
|
|
37652
|
+
return t14[4 * (e5 - 1) + 3];
|
|
37641
37653
|
default:
|
|
37642
37654
|
return;
|
|
37643
37655
|
}
|
|
@@ -37648,48 +37660,48 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37648
37660
|
} };
|
|
37649
37661
|
return i4;
|
|
37650
37662
|
})(), c = function() {
|
|
37651
|
-
var
|
|
37652
|
-
return
|
|
37663
|
+
var t14 = [], e4 = 0, i4 = { getBuffer: function() {
|
|
37664
|
+
return t14;
|
|
37653
37665
|
}, getAt: function(e5) {
|
|
37654
37666
|
var i5 = Math.floor(e5 / 8);
|
|
37655
|
-
return 1 == (
|
|
37656
|
-
}, put: function(
|
|
37657
|
-
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (
|
|
37667
|
+
return 1 == (t14[i5] >>> 7 - e5 % 8 & 1);
|
|
37668
|
+
}, put: function(t15, e5) {
|
|
37669
|
+
for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t15 >>> e5 - r5 - 1 & 1));
|
|
37658
37670
|
}, getLengthInBits: function() {
|
|
37659
37671
|
return e4;
|
|
37660
37672
|
}, putBit: function(i5) {
|
|
37661
37673
|
var r5 = Math.floor(e4 / 8);
|
|
37662
|
-
|
|
37674
|
+
t14.length <= r5 && t14.push(0), i5 && (t14[r5] |= 128 >>> e4 % 8), e4 += 1;
|
|
37663
37675
|
} };
|
|
37664
37676
|
return i4;
|
|
37665
|
-
}, l = function(
|
|
37666
|
-
var e4 =
|
|
37677
|
+
}, l = function(t14) {
|
|
37678
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37667
37679
|
return 1;
|
|
37668
|
-
}, getLength: function(
|
|
37680
|
+
}, getLength: function(t15) {
|
|
37669
37681
|
return e4.length;
|
|
37670
|
-
}, write: function(
|
|
37671
|
-
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; )
|
|
37672
|
-
n4 < i5.length && (i5.length - n4 == 1 ?
|
|
37673
|
-
} }, r5 = function(
|
|
37674
|
-
for (var e5 = 0, i5 = 0; i5 <
|
|
37682
|
+
}, write: function(t15) {
|
|
37683
|
+
for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t15.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
|
|
37684
|
+
n4 < i5.length && (i5.length - n4 == 1 ? t15.put(r5(i5.substring(n4, n4 + 1)), 4) : i5.length - n4 == 2 && t15.put(r5(i5.substring(n4, n4 + 2)), 7));
|
|
37685
|
+
} }, r5 = function(t15) {
|
|
37686
|
+
for (var e5 = 0, i5 = 0; i5 < t15.length; i5 += 1) e5 = 10 * e5 + n3(t15.charAt(i5));
|
|
37675
37687
|
return e5;
|
|
37676
|
-
}, n3 = function(
|
|
37677
|
-
if ("0" <=
|
|
37678
|
-
throw "illegal char :" +
|
|
37688
|
+
}, n3 = function(t15) {
|
|
37689
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37690
|
+
throw "illegal char :" + t15;
|
|
37679
37691
|
};
|
|
37680
37692
|
return i4;
|
|
37681
|
-
}, g = function(
|
|
37682
|
-
var e4 =
|
|
37693
|
+
}, g = function(t14) {
|
|
37694
|
+
var e4 = t14, i4 = { getMode: function() {
|
|
37683
37695
|
return 2;
|
|
37684
|
-
}, getLength: function(
|
|
37696
|
+
}, getLength: function(t15) {
|
|
37685
37697
|
return e4.length;
|
|
37686
|
-
}, write: function(
|
|
37687
|
-
for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; )
|
|
37688
|
-
n3 < i5.length &&
|
|
37689
|
-
} }, r5 = function(
|
|
37690
|
-
if ("0" <=
|
|
37691
|
-
if ("A" <=
|
|
37692
|
-
switch (
|
|
37698
|
+
}, write: function(t15) {
|
|
37699
|
+
for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; ) t15.put(45 * r5(i5.charAt(n3)) + r5(i5.charAt(n3 + 1)), 11), n3 += 2;
|
|
37700
|
+
n3 < i5.length && t15.put(r5(i5.charAt(n3)), 6);
|
|
37701
|
+
} }, r5 = function(t15) {
|
|
37702
|
+
if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
|
|
37703
|
+
if ("A" <= t15 && t15 <= "Z") return t15.charCodeAt(0) - "A".charCodeAt(0) + 10;
|
|
37704
|
+
switch (t15) {
|
|
37693
37705
|
case " ":
|
|
37694
37706
|
return 36;
|
|
37695
37707
|
case "$":
|
|
@@ -37709,31 +37721,31 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37709
37721
|
case ":":
|
|
37710
37722
|
return 44;
|
|
37711
37723
|
default:
|
|
37712
|
-
throw "illegal char :" +
|
|
37724
|
+
throw "illegal char :" + t15;
|
|
37713
37725
|
}
|
|
37714
37726
|
};
|
|
37715
37727
|
return i4;
|
|
37716
37728
|
}, f = function(e4) {
|
|
37717
|
-
var i4 =
|
|
37729
|
+
var i4 = t13.stringToBytes(e4);
|
|
37718
37730
|
return { getMode: function() {
|
|
37719
37731
|
return 4;
|
|
37720
|
-
}, getLength: function(
|
|
37732
|
+
}, getLength: function(t14) {
|
|
37721
37733
|
return i4.length;
|
|
37722
|
-
}, write: function(
|
|
37723
|
-
for (var e5 = 0; e5 < i4.length; e5 += 1)
|
|
37734
|
+
}, write: function(t14) {
|
|
37735
|
+
for (var e5 = 0; e5 < i4.length; e5 += 1) t14.put(i4[e5], 8);
|
|
37724
37736
|
} };
|
|
37725
37737
|
}, w = function(e4) {
|
|
37726
|
-
var i4 =
|
|
37738
|
+
var i4 = t13.stringToBytesFuncs.SJIS;
|
|
37727
37739
|
if (!i4) throw "sjis not supported.";
|
|
37728
37740
|
!(function() {
|
|
37729
|
-
var
|
|
37730
|
-
if (2 !=
|
|
37741
|
+
var t14 = i4("\u53CB");
|
|
37742
|
+
if (2 != t14.length || 38726 != (t14[0] << 8 | t14[1])) throw "sjis not supported.";
|
|
37731
37743
|
})();
|
|
37732
37744
|
var r5 = i4(e4), n3 = { getMode: function() {
|
|
37733
37745
|
return 8;
|
|
37734
|
-
}, getLength: function(
|
|
37746
|
+
}, getLength: function(t14) {
|
|
37735
37747
|
return ~~(r5.length / 2);
|
|
37736
|
-
}, write: function(
|
|
37748
|
+
}, write: function(t14) {
|
|
37737
37749
|
for (var e5 = r5, i5 = 0; i5 + 1 < e5.length; ) {
|
|
37738
37750
|
var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
|
|
37739
37751
|
if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
|
|
@@ -37741,69 +37753,69 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37741
37753
|
if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
|
|
37742
37754
|
n4 -= 49472;
|
|
37743
37755
|
}
|
|
37744
|
-
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4),
|
|
37756
|
+
n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t14.put(n4, 13), i5 += 2;
|
|
37745
37757
|
}
|
|
37746
37758
|
if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
|
|
37747
37759
|
} };
|
|
37748
37760
|
return n3;
|
|
37749
37761
|
}, p = function() {
|
|
37750
|
-
var
|
|
37751
|
-
|
|
37752
|
-
}, writeShort: function(
|
|
37753
|
-
e4.writeByte(
|
|
37754
|
-
}, writeBytes: function(
|
|
37755
|
-
i4 = i4 || 0, r5 = r5 ||
|
|
37756
|
-
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(
|
|
37757
|
-
}, writeString: function(
|
|
37758
|
-
for (var i4 = 0; i4 <
|
|
37762
|
+
var t14 = [], e4 = { writeByte: function(e5) {
|
|
37763
|
+
t14.push(255 & e5);
|
|
37764
|
+
}, writeShort: function(t15) {
|
|
37765
|
+
e4.writeByte(t15), e4.writeByte(t15 >>> 8);
|
|
37766
|
+
}, writeBytes: function(t15, i4, r5) {
|
|
37767
|
+
i4 = i4 || 0, r5 = r5 || t15.length;
|
|
37768
|
+
for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t15[n3 + i4]);
|
|
37769
|
+
}, writeString: function(t15) {
|
|
37770
|
+
for (var i4 = 0; i4 < t15.length; i4 += 1) e4.writeByte(t15.charCodeAt(i4));
|
|
37759
37771
|
}, toByteArray: function() {
|
|
37760
|
-
return
|
|
37772
|
+
return t14;
|
|
37761
37773
|
}, toString: function() {
|
|
37762
37774
|
var e5 = "";
|
|
37763
37775
|
e5 += "[";
|
|
37764
|
-
for (var i4 = 0; i4 <
|
|
37776
|
+
for (var i4 = 0; i4 < t14.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t14[i4];
|
|
37765
37777
|
return e5 + "]";
|
|
37766
37778
|
} };
|
|
37767
37779
|
return e4;
|
|
37768
|
-
}, v = function(
|
|
37769
|
-
var e4 =
|
|
37780
|
+
}, v = function(t14) {
|
|
37781
|
+
var e4 = t14, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
|
|
37770
37782
|
for (; n3 < 8; ) {
|
|
37771
37783
|
if (i4 >= e4.length) {
|
|
37772
37784
|
if (0 == n3) return -1;
|
|
37773
37785
|
throw "unexpected end of file./" + n3;
|
|
37774
37786
|
}
|
|
37775
|
-
var
|
|
37776
|
-
if (i4 += 1, "=" ==
|
|
37777
|
-
|
|
37787
|
+
var t15 = e4.charAt(i4);
|
|
37788
|
+
if (i4 += 1, "=" == t15) return n3 = 0, -1;
|
|
37789
|
+
t15.match(/^\s$/) || (r5 = r5 << 6 | s2(t15.charCodeAt(0)), n3 += 6);
|
|
37778
37790
|
}
|
|
37779
37791
|
var o3 = r5 >>> n3 - 8 & 255;
|
|
37780
37792
|
return n3 -= 8, o3;
|
|
37781
|
-
} }, s2 = function(
|
|
37782
|
-
if (65 <=
|
|
37783
|
-
if (97 <=
|
|
37784
|
-
if (48 <=
|
|
37785
|
-
if (43 ==
|
|
37786
|
-
if (47 ==
|
|
37787
|
-
throw "c:" +
|
|
37793
|
+
} }, s2 = function(t15) {
|
|
37794
|
+
if (65 <= t15 && t15 <= 90) return t15 - 65;
|
|
37795
|
+
if (97 <= t15 && t15 <= 122) return t15 - 97 + 26;
|
|
37796
|
+
if (48 <= t15 && t15 <= 57) return t15 - 48 + 52;
|
|
37797
|
+
if (43 == t15) return 62;
|
|
37798
|
+
if (47 == t15) return 63;
|
|
37799
|
+
throw "c:" + t15;
|
|
37788
37800
|
};
|
|
37789
37801
|
return o2;
|
|
37790
|
-
}, _ = function(
|
|
37791
|
-
for (var r5 = (function(
|
|
37792
|
-
var i5 =
|
|
37793
|
-
n4[e6 * i5 +
|
|
37794
|
-
}, write: function(
|
|
37795
|
-
|
|
37802
|
+
}, _ = function(t14, e4, i4) {
|
|
37803
|
+
for (var r5 = (function(t15, e5) {
|
|
37804
|
+
var i5 = t15, r6 = e5, n4 = new Array(t15 * e5), o3 = { setPixel: function(t16, e6, r7) {
|
|
37805
|
+
n4[e6 * i5 + t16] = r7;
|
|
37806
|
+
}, write: function(t16) {
|
|
37807
|
+
t16.writeString("GIF87a"), t16.writeShort(i5), t16.writeShort(r6), t16.writeByte(128), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(0), t16.writeByte(255), t16.writeByte(255), t16.writeByte(255), t16.writeString(","), t16.writeShort(0), t16.writeShort(0), t16.writeShort(i5), t16.writeShort(r6), t16.writeByte(0);
|
|
37796
37808
|
var e6 = s3(2);
|
|
37797
|
-
|
|
37798
|
-
for (var n5 = 0; e6.length - n5 > 255; )
|
|
37799
|
-
|
|
37800
|
-
} }, s3 = function(
|
|
37801
|
-
for (var e6 = 1 <<
|
|
37809
|
+
t16.writeByte(2);
|
|
37810
|
+
for (var n5 = 0; e6.length - n5 > 255; ) t16.writeByte(255), t16.writeBytes(e6, n5, 255), n5 += 255;
|
|
37811
|
+
t16.writeByte(e6.length - n5), t16.writeBytes(e6, n5, e6.length - n5), t16.writeByte(0), t16.writeString(";");
|
|
37812
|
+
} }, s3 = function(t16) {
|
|
37813
|
+
for (var e6 = 1 << t16, i6 = 1 + (1 << t16), r7 = t16 + 1, o4 = a3(), s4 = 0; s4 < e6; s4 += 1) o4.add(String.fromCharCode(s4));
|
|
37802
37814
|
o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
|
|
37803
|
-
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(
|
|
37804
|
-
if (
|
|
37805
|
-
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (
|
|
37806
|
-
u2 |=
|
|
37815
|
+
var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t17, e7) {
|
|
37816
|
+
if (t17 >>> e7 != 0) throw "length over";
|
|
37817
|
+
for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t17 << d3 | u2)), e7 -= 8 - d3, t17 >>>= 8 - d3, u2 = 0, d3 = 0;
|
|
37818
|
+
u2 |= t17 << d3, d3 += e7;
|
|
37807
37819
|
}, flush: function() {
|
|
37808
37820
|
d3 > 0 && h3.writeByte(u2);
|
|
37809
37821
|
} });
|
|
@@ -37815,95 +37827,95 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37815
37827
|
}
|
|
37816
37828
|
return l2.write(o4.indexOf(f2), r7), l2.write(i6, r7), l2.flush(), c2.toByteArray();
|
|
37817
37829
|
}, a3 = function() {
|
|
37818
|
-
var
|
|
37830
|
+
var t16 = {}, e6 = 0, i6 = { add: function(r7) {
|
|
37819
37831
|
if (i6.contains(r7)) throw "dup key:" + r7;
|
|
37820
|
-
|
|
37832
|
+
t16[r7] = e6, e6 += 1;
|
|
37821
37833
|
}, size: function() {
|
|
37822
37834
|
return e6;
|
|
37823
37835
|
}, indexOf: function(e7) {
|
|
37824
|
-
return
|
|
37836
|
+
return t16[e7];
|
|
37825
37837
|
}, contains: function(e7) {
|
|
37826
|
-
return void 0 !==
|
|
37838
|
+
return void 0 !== t16[e7];
|
|
37827
37839
|
} };
|
|
37828
37840
|
return i6;
|
|
37829
37841
|
};
|
|
37830
37842
|
return o3;
|
|
37831
|
-
})(
|
|
37843
|
+
})(t14, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t14; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
|
|
37832
37844
|
var s2 = p();
|
|
37833
37845
|
r5.write(s2);
|
|
37834
37846
|
for (var a2 = (function() {
|
|
37835
|
-
var
|
|
37836
|
-
r6 += String.fromCharCode(s3(63 &
|
|
37837
|
-
}, s3 = function(
|
|
37838
|
-
if (
|
|
37847
|
+
var t15 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t16) {
|
|
37848
|
+
r6 += String.fromCharCode(s3(63 & t16));
|
|
37849
|
+
}, s3 = function(t16) {
|
|
37850
|
+
if (t16 < 0) ;
|
|
37839
37851
|
else {
|
|
37840
|
-
if (
|
|
37841
|
-
if (
|
|
37842
|
-
if (
|
|
37843
|
-
if (62 ==
|
|
37844
|
-
if (63 ==
|
|
37852
|
+
if (t16 < 26) return 65 + t16;
|
|
37853
|
+
if (t16 < 52) return t16 - 26 + 97;
|
|
37854
|
+
if (t16 < 62) return t16 - 52 + 48;
|
|
37855
|
+
if (62 == t16) return 43;
|
|
37856
|
+
if (63 == t16) return 47;
|
|
37845
37857
|
}
|
|
37846
|
-
throw "n:" +
|
|
37858
|
+
throw "n:" + t16;
|
|
37847
37859
|
};
|
|
37848
37860
|
return n4.writeByte = function(r7) {
|
|
37849
|
-
for (
|
|
37861
|
+
for (t15 = t15 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t15 >>> e5 - 6), e5 -= 6;
|
|
37850
37862
|
}, n4.flush = function() {
|
|
37851
|
-
if (e5 > 0 && (o3(
|
|
37863
|
+
if (e5 > 0 && (o3(t15 << 6 - e5), t15 = 0, e5 = 0), i5 % 3 != 0) for (var n5 = 3 - i5 % 3, s4 = 0; s4 < n5; s4 += 1) r6 += "=";
|
|
37852
37864
|
}, n4.toString = function() {
|
|
37853
37865
|
return r6;
|
|
37854
37866
|
}, n4;
|
|
37855
37867
|
})(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
|
|
37856
37868
|
return a2.flush(), "data:image/gif;base64," + a2;
|
|
37857
37869
|
};
|
|
37858
|
-
return
|
|
37870
|
+
return t13;
|
|
37859
37871
|
})();
|
|
37860
|
-
n.stringToBytesFuncs["UTF-8"] = function(
|
|
37861
|
-
return (function(
|
|
37862
|
-
for (var e3 = [], i3 = 0; i3 <
|
|
37863
|
-
var r4 =
|
|
37864
|
-
r4 < 128 ? e3.push(r4) : r4 < 2048 ? e3.push(192 | r4 >> 6, 128 | 63 & r4) : r4 < 55296 || r4 >= 57344 ? e3.push(224 | r4 >> 12, 128 | r4 >> 6 & 63, 128 | 63 & r4) : (i3++, r4 = 65536 + ((1023 & r4) << 10 | 1023 &
|
|
37872
|
+
n.stringToBytesFuncs["UTF-8"] = function(t13) {
|
|
37873
|
+
return (function(t14) {
|
|
37874
|
+
for (var e3 = [], i3 = 0; i3 < t14.length; i3++) {
|
|
37875
|
+
var r4 = t14.charCodeAt(i3);
|
|
37876
|
+
r4 < 128 ? e3.push(r4) : r4 < 2048 ? e3.push(192 | r4 >> 6, 128 | 63 & r4) : r4 < 55296 || r4 >= 57344 ? e3.push(224 | r4 >> 12, 128 | r4 >> 6 & 63, 128 | 63 & r4) : (i3++, r4 = 65536 + ((1023 & r4) << 10 | 1023 & t14.charCodeAt(i3)), e3.push(240 | r4 >> 18, 128 | r4 >> 12 & 63, 128 | r4 >> 6 & 63, 128 | 63 & r4));
|
|
37865
37877
|
}
|
|
37866
37878
|
return e3;
|
|
37867
|
-
})(
|
|
37879
|
+
})(t13);
|
|
37868
37880
|
}, void 0 === (r3 = "function" == typeof (i2 = function() {
|
|
37869
37881
|
return n;
|
|
37870
|
-
}) ? i2.apply(e2, []) : i2) || (
|
|
37882
|
+
}) ? i2.apply(e2, []) : i2) || (t12.exports = r3);
|
|
37871
37883
|
} }, e = {};
|
|
37872
37884
|
function i(r3) {
|
|
37873
37885
|
var n = e[r3];
|
|
37874
37886
|
if (void 0 !== n) return n.exports;
|
|
37875
37887
|
var o = e[r3] = { exports: {} };
|
|
37876
|
-
return
|
|
37888
|
+
return t11[r3](o, o.exports, i), o.exports;
|
|
37877
37889
|
}
|
|
37878
|
-
i.n = (
|
|
37879
|
-
var e2 =
|
|
37890
|
+
i.n = (t12) => {
|
|
37891
|
+
var e2 = t12 && t12.__esModule ? () => t12.default : () => t12;
|
|
37880
37892
|
return i.d(e2, { a: e2 }), e2;
|
|
37881
|
-
}, i.d = (
|
|
37882
|
-
for (var r3 in e2) i.o(e2, r3) && !i.o(
|
|
37883
|
-
}, i.o = (
|
|
37893
|
+
}, i.d = (t12, e2) => {
|
|
37894
|
+
for (var r3 in e2) i.o(e2, r3) && !i.o(t12, r3) && Object.defineProperty(t12, r3, { enumerable: true, get: e2[r3] });
|
|
37895
|
+
}, i.o = (t12, e2) => Object.prototype.hasOwnProperty.call(t12, e2);
|
|
37884
37896
|
var r2 = {};
|
|
37885
37897
|
return (() => {
|
|
37886
37898
|
"use strict";
|
|
37887
37899
|
i.d(r2, { default: () => $ });
|
|
37888
|
-
const
|
|
37900
|
+
const t12 = (t13) => !!t13 && "object" == typeof t13 && !Array.isArray(t13);
|
|
37889
37901
|
function e2(i2, ...r3) {
|
|
37890
37902
|
if (!r3.length) return i2;
|
|
37891
37903
|
const n2 = r3.shift();
|
|
37892
|
-
return void 0 !== n2 &&
|
|
37904
|
+
return void 0 !== n2 && t12(i2) && t12(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
|
|
37893
37905
|
const o2 = i2[r4], s2 = n2[r4];
|
|
37894
|
-
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 :
|
|
37906
|
+
Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t12(o2) && t12(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
|
|
37895
37907
|
})), e2(i2, ...r3)) : i2;
|
|
37896
37908
|
}
|
|
37897
|
-
function n(
|
|
37909
|
+
function n(t13, e3) {
|
|
37898
37910
|
const i2 = document.createElement("a");
|
|
37899
|
-
i2.download = e3, i2.href =
|
|
37911
|
+
i2.download = e3, i2.href = t13, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
|
|
37900
37912
|
}
|
|
37901
37913
|
const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
|
|
37902
37914
|
class s {
|
|
37903
|
-
constructor({ svg:
|
|
37904
|
-
this._svg =
|
|
37915
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
37916
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
37905
37917
|
}
|
|
37906
|
-
draw(
|
|
37918
|
+
draw(t13, e3, i2, r3) {
|
|
37907
37919
|
let n2;
|
|
37908
37920
|
switch (this._type) {
|
|
37909
37921
|
case "dots":
|
|
@@ -37924,100 +37936,100 @@ var require_qr_code_styling = __commonJS2({
|
|
|
37924
37936
|
default:
|
|
37925
37937
|
n2 = this._drawSquare;
|
|
37926
37938
|
}
|
|
37927
|
-
n2.call(this, { x:
|
|
37939
|
+
n2.call(this, { x: t13, y: e3, size: i2, getNeighbor: r3 });
|
|
37928
37940
|
}
|
|
37929
|
-
_rotateFigure({ x:
|
|
37941
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
37930
37942
|
var o2;
|
|
37931
|
-
const s2 =
|
|
37943
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
37932
37944
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
37933
37945
|
}
|
|
37934
|
-
_basicDot(
|
|
37935
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37936
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37946
|
+
_basicDot(t13) {
|
|
37947
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37948
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37937
37949
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r3 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
|
|
37938
37950
|
} }));
|
|
37939
37951
|
}
|
|
37940
|
-
_basicSquare(
|
|
37941
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37942
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37952
|
+
_basicSquare(t13) {
|
|
37953
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37954
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37943
37955
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r3)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
|
|
37944
37956
|
} }));
|
|
37945
37957
|
}
|
|
37946
|
-
_basicSideRounded(
|
|
37947
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37948
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37958
|
+
_basicSideRounded(t13) {
|
|
37959
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37960
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37949
37961
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, 0 ${-e3}`);
|
|
37950
37962
|
} }));
|
|
37951
37963
|
}
|
|
37952
|
-
_basicCornerRounded(
|
|
37953
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37954
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37964
|
+
_basicCornerRounded(t13) {
|
|
37965
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37966
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37955
37967
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}v ` + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
|
|
37956
37968
|
} }));
|
|
37957
37969
|
}
|
|
37958
|
-
_basicCornerExtraRounded(
|
|
37959
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37960
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37970
|
+
_basicCornerExtraRounded(t13) {
|
|
37971
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37972
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37961
37973
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}a ${e3} ${e3}, 0, 0, 0, ${-e3} ${-e3}`);
|
|
37962
37974
|
} }));
|
|
37963
37975
|
}
|
|
37964
|
-
_basicCornersRounded(
|
|
37965
|
-
const { size: e3, x: i2, y: r3 } =
|
|
37966
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
37976
|
+
_basicCornersRounded(t13) {
|
|
37977
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
37978
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
37967
37979
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("d", `M ${i2} ${r3}v ` + e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${e3 / 2} ${e3 / 2}h ` + e3 / 2 + "v " + -e3 / 2 + `a ${e3 / 2} ${e3 / 2}, 0, 0, 0, ${-e3 / 2} ${-e3 / 2}`);
|
|
37968
37980
|
} }));
|
|
37969
37981
|
}
|
|
37970
|
-
_drawDot({ x:
|
|
37971
|
-
this._basicDot({ x:
|
|
37982
|
+
_drawDot({ x: t13, y: e3, size: i2 }) {
|
|
37983
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37972
37984
|
}
|
|
37973
|
-
_drawSquare({ x:
|
|
37974
|
-
this._basicSquare({ x:
|
|
37985
|
+
_drawSquare({ x: t13, y: e3, size: i2 }) {
|
|
37986
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37975
37987
|
}
|
|
37976
|
-
_drawRounded({ x:
|
|
37988
|
+
_drawRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37977
37989
|
const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
|
|
37978
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
37990
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37979
37991
|
else {
|
|
37980
37992
|
if (2 === h2) {
|
|
37981
37993
|
let r4 = 0;
|
|
37982
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x:
|
|
37994
|
+
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: r4 });
|
|
37983
37995
|
}
|
|
37984
37996
|
if (1 === h2) {
|
|
37985
37997
|
let r4 = 0;
|
|
37986
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
37998
|
+
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t13, y: e3, size: i2, rotation: r4 });
|
|
37987
37999
|
}
|
|
37988
38000
|
}
|
|
37989
|
-
else this._basicDot({ x:
|
|
38001
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37990
38002
|
}
|
|
37991
|
-
_drawExtraRounded({ x:
|
|
38003
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
37992
38004
|
const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0, h2 = n2 + o2 + s2 + a2;
|
|
37993
|
-
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x:
|
|
38005
|
+
if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
37994
38006
|
else {
|
|
37995
38007
|
if (2 === h2) {
|
|
37996
38008
|
let r4 = 0;
|
|
37997
|
-
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x:
|
|
38009
|
+
return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: r4 });
|
|
37998
38010
|
}
|
|
37999
38011
|
if (1 === h2) {
|
|
38000
38012
|
let r4 = 0;
|
|
38001
|
-
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x:
|
|
38013
|
+
return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t13, y: e3, size: i2, rotation: r4 });
|
|
38002
38014
|
}
|
|
38003
38015
|
}
|
|
38004
|
-
else this._basicDot({ x:
|
|
38016
|
+
else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
|
|
38005
38017
|
}
|
|
38006
|
-
_drawClassy({ x:
|
|
38018
|
+
_drawClassy({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
38007
38019
|
const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0;
|
|
38008
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38020
|
+
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 }) : this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: t13, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 });
|
|
38009
38021
|
}
|
|
38010
|
-
_drawClassyRounded({ x:
|
|
38022
|
+
_drawClassyRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
|
|
38011
38023
|
const n2 = r3 ? +r3(-1, 0) : 0, o2 = r3 ? +r3(1, 0) : 0, s2 = r3 ? +r3(0, -1) : 0, a2 = r3 ? +r3(0, 1) : 0;
|
|
38012
|
-
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x:
|
|
38024
|
+
0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 }) : this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: t13, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t13, y: e3, size: i2, rotation: Math.PI / 2 });
|
|
38013
38025
|
}
|
|
38014
38026
|
}
|
|
38015
38027
|
const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
|
|
38016
38028
|
class d {
|
|
38017
|
-
constructor({ svg:
|
|
38018
|
-
this._svg =
|
|
38029
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38030
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38019
38031
|
}
|
|
38020
|
-
draw(
|
|
38032
|
+
draw(t13, e3, i2, r3) {
|
|
38021
38033
|
let n2;
|
|
38022
38034
|
switch (this._type) {
|
|
38023
38035
|
case a.square:
|
|
@@ -38029,78 +38041,78 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38029
38041
|
default:
|
|
38030
38042
|
n2 = this._drawDot;
|
|
38031
38043
|
}
|
|
38032
|
-
n2.call(this, { x:
|
|
38044
|
+
n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38033
38045
|
}
|
|
38034
|
-
_rotateFigure({ x:
|
|
38046
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38035
38047
|
var o2;
|
|
38036
|
-
const s2 =
|
|
38048
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38037
38049
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38038
38050
|
}
|
|
38039
|
-
_basicDot(
|
|
38040
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38041
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38051
|
+
_basicDot(t13) {
|
|
38052
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38053
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38042
38054
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2 + e3 / 2} ${r3}a ${e3 / 2} ${e3 / 2} 0 1 0 0.1 0zm 0 ${n2}a ${e3 / 2 - n2} ${e3 / 2 - n2} 0 1 1 -0.1 0Z`);
|
|
38043
38055
|
} }));
|
|
38044
38056
|
}
|
|
38045
|
-
_basicSquare(
|
|
38046
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38047
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38057
|
+
_basicSquare(t13) {
|
|
38058
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38059
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38048
38060
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r3}v ${e3}h ${e3}v ` + -e3 + `zM ${i2 + n2} ${r3 + n2}h ` + (e3 - 2 * n2) + "v " + (e3 - 2 * n2) + "h " + (2 * n2 - e3) + "z");
|
|
38049
38061
|
} }));
|
|
38050
38062
|
}
|
|
38051
|
-
_basicExtraRounded(
|
|
38052
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38053
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38063
|
+
_basicExtraRounded(t13) {
|
|
38064
|
+
const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
|
|
38065
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38054
38066
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "path"), this._element.setAttribute("clip-rule", "evenodd"), this._element.setAttribute("d", `M ${i2} ${r3 + 2.5 * n2}v ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * n2}h ` + 2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * n2} ${2.5 * -n2}v ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * -n2}h ` + -2 * n2 + `a ${2.5 * n2} ${2.5 * n2}, 0, 0, 0, ${2.5 * -n2} ${2.5 * n2}M ${i2 + 2.5 * n2} ${r3 + n2}h ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * n2}v ` + 2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * n2}h ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * -n2} ${1.5 * -n2}v ` + -2 * n2 + `a ${1.5 * n2} ${1.5 * n2}, 0, 0, 1, ${1.5 * n2} ${1.5 * -n2}`);
|
|
38055
38067
|
} }));
|
|
38056
38068
|
}
|
|
38057
|
-
_drawDot({ x:
|
|
38058
|
-
this._basicDot({ x:
|
|
38069
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38070
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38059
38071
|
}
|
|
38060
|
-
_drawSquare({ x:
|
|
38061
|
-
this._basicSquare({ x:
|
|
38072
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38073
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38062
38074
|
}
|
|
38063
|
-
_drawExtraRounded({ x:
|
|
38064
|
-
this._basicExtraRounded({ x:
|
|
38075
|
+
_drawExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38076
|
+
this._basicExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38065
38077
|
}
|
|
38066
38078
|
}
|
|
38067
38079
|
const u = { dot: "dot", square: "square" }, c = Object.values(u);
|
|
38068
38080
|
class l {
|
|
38069
|
-
constructor({ svg:
|
|
38070
|
-
this._svg =
|
|
38081
|
+
constructor({ svg: t13, type: e3, window: i2 }) {
|
|
38082
|
+
this._svg = t13, this._type = e3, this._window = i2;
|
|
38071
38083
|
}
|
|
38072
|
-
draw(
|
|
38084
|
+
draw(t13, e3, i2, r3) {
|
|
38073
38085
|
let n2;
|
|
38074
|
-
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x:
|
|
38086
|
+
n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
|
|
38075
38087
|
}
|
|
38076
|
-
_rotateFigure({ x:
|
|
38088
|
+
_rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
|
|
38077
38089
|
var o2;
|
|
38078
|
-
const s2 =
|
|
38090
|
+
const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
|
|
38079
38091
|
n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
|
|
38080
38092
|
}
|
|
38081
|
-
_basicDot(
|
|
38082
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38083
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38093
|
+
_basicDot(t13) {
|
|
38094
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38095
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38084
38096
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "circle"), this._element.setAttribute("cx", String(i2 + e3 / 2)), this._element.setAttribute("cy", String(r3 + e3 / 2)), this._element.setAttribute("r", String(e3 / 2));
|
|
38085
38097
|
} }));
|
|
38086
38098
|
}
|
|
38087
|
-
_basicSquare(
|
|
38088
|
-
const { size: e3, x: i2, y: r3 } =
|
|
38089
|
-
this._rotateFigure(Object.assign(Object.assign({},
|
|
38099
|
+
_basicSquare(t13) {
|
|
38100
|
+
const { size: e3, x: i2, y: r3 } = t13;
|
|
38101
|
+
this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
|
|
38090
38102
|
this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect"), this._element.setAttribute("x", String(i2)), this._element.setAttribute("y", String(r3)), this._element.setAttribute("width", String(e3)), this._element.setAttribute("height", String(e3));
|
|
38091
38103
|
} }));
|
|
38092
38104
|
}
|
|
38093
|
-
_drawDot({ x:
|
|
38094
|
-
this._basicDot({ x:
|
|
38105
|
+
_drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38106
|
+
this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38095
38107
|
}
|
|
38096
|
-
_drawSquare({ x:
|
|
38097
|
-
this._basicSquare({ x:
|
|
38108
|
+
_drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
|
|
38109
|
+
this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
|
|
38098
38110
|
}
|
|
38099
38111
|
}
|
|
38100
38112
|
const g = "circle", f = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], w = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
|
|
38101
38113
|
class p {
|
|
38102
|
-
constructor(
|
|
38103
|
-
this._roundSize = (
|
|
38114
|
+
constructor(t13, e3) {
|
|
38115
|
+
this._roundSize = (t14) => this._options.dotsOptions.roundSize ? Math.floor(t14) : t14, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t13.width)), this._element.setAttribute("height", String(t13.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t13.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t13.width} ${t13.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t13.image, this._instanceId = p.instanceCount++, this._options = t13;
|
|
38104
38116
|
}
|
|
38105
38117
|
get width() {
|
|
38106
38118
|
return this._options.width;
|
|
@@ -38111,135 +38123,135 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38111
38123
|
getElement() {
|
|
38112
38124
|
return this._element;
|
|
38113
38125
|
}
|
|
38114
|
-
async drawQR(
|
|
38115
|
-
const e3 =
|
|
38126
|
+
async drawQR(t13) {
|
|
38127
|
+
const e3 = t13.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r3 = this._options.shape === g ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r3 / e3);
|
|
38116
38128
|
let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
|
|
38117
|
-
if (this._qr =
|
|
38129
|
+
if (this._qr = t13, this._options.image) {
|
|
38118
38130
|
if (await this.loadImage(), !this._image) return;
|
|
38119
|
-
const { imageOptions:
|
|
38120
|
-
s2 = (function({ originalHeight:
|
|
38131
|
+
const { imageOptions: t14, qrOptions: i3 } = this._options, r4 = t14.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
|
|
38132
|
+
s2 = (function({ originalHeight: t15, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
|
|
38121
38133
|
const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
|
|
38122
|
-
if (
|
|
38123
|
-
const a3 =
|
|
38134
|
+
if (t15 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
|
|
38135
|
+
const a3 = t15 / e4;
|
|
38124
38136
|
return o2.x = Math.floor(Math.sqrt(i4 / a3)), o2.x <= 0 && (o2.x = 1), r5 && r5 < o2.x && (o2.x = r5), o2.x % 2 == 0 && o2.x--, s3.x = o2.x * n3, o2.y = 1 + 2 * Math.ceil((o2.x * a3 - 1) / 2), s3.y = Math.round(s3.x * a3), (o2.y * o2.x > i4 || r5 && r5 < o2.y) && (r5 && r5 < o2.y ? (o2.y = r5, o2.y % 2 == 0 && o2.x--) : o2.y -= 2, s3.y = o2.y * n3, o2.x = 1 + 2 * Math.ceil((o2.y / a3 - 1) / 2), s3.x = Math.round(s3.y / a3)), { height: s3.y, width: s3.x, hideYDots: o2.y, hideXDots: o2.x };
|
|
38125
38137
|
})({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
|
|
38126
38138
|
}
|
|
38127
|
-
this.drawBackground(), this.drawDots(((
|
|
38139
|
+
this.drawBackground(), this.drawDots(((t14, i3) => {
|
|
38128
38140
|
var r4, n3, o2, a2, h2, d2;
|
|
38129
|
-
return !(this._options.imageOptions.hideBackgroundDots &&
|
|
38141
|
+
return !(this._options.imageOptions.hideBackgroundDots && t14 >= (e3 - s2.hideYDots) / 2 && t14 < (e3 + s2.hideYDots) / 2 && i3 >= (e3 - s2.hideXDots) / 2 && i3 < (e3 + s2.hideXDots) / 2 || (null === (r4 = f[t14]) || void 0 === r4 ? void 0 : r4[i3]) || (null === (n3 = f[t14 - e3 + 7]) || void 0 === n3 ? void 0 : n3[i3]) || (null === (o2 = f[t14]) || void 0 === o2 ? void 0 : o2[i3 - e3 + 7]) || (null === (a2 = w[t14]) || void 0 === a2 ? void 0 : a2[i3]) || (null === (h2 = w[t14 - e3 + 7]) || void 0 === h2 ? void 0 : h2[i3]) || (null === (d2 = w[t14]) || void 0 === d2 ? void 0 : d2[i3 - e3 + 7]));
|
|
38130
38142
|
})), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
|
|
38131
38143
|
}
|
|
38132
38144
|
drawBackground() {
|
|
38133
|
-
var
|
|
38145
|
+
var t13, e3, i2;
|
|
38134
38146
|
const r3 = this._element, n2 = this._options;
|
|
38135
38147
|
if (r3) {
|
|
38136
|
-
const r4 = null === (
|
|
38148
|
+
const r4 = null === (t13 = n2.backgroundOptions) || void 0 === t13 ? void 0 : t13.gradient, o2 = null === (e3 = n2.backgroundOptions) || void 0 === e3 ? void 0 : e3.color;
|
|
38137
38149
|
let s2 = n2.height, a2 = n2.width;
|
|
38138
38150
|
if (r4 || o2) {
|
|
38139
|
-
const
|
|
38140
|
-
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), (null === (i2 = n2.backgroundOptions) || void 0 === i2 ? void 0 : i2.round) && (s2 = a2 = Math.min(n2.width, n2.height),
|
|
38151
|
+
const t14 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38152
|
+
this._backgroundClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._backgroundClipPath.setAttribute("id", `clip-path-background-color-${this._instanceId}`), this._defs.appendChild(this._backgroundClipPath), (null === (i2 = n2.backgroundOptions) || void 0 === i2 ? void 0 : i2.round) && (s2 = a2 = Math.min(n2.width, n2.height), t14.setAttribute("rx", String(s2 / 2 * n2.backgroundOptions.round))), t14.setAttribute("x", String(this._roundSize((n2.width - a2) / 2))), t14.setAttribute("y", String(this._roundSize((n2.height - s2) / 2))), t14.setAttribute("width", String(a2)), t14.setAttribute("height", String(s2)), this._backgroundClipPath.appendChild(t14), this._createColor({ options: r4, color: o2, additionalRotation: 0, x: 0, y: 0, height: n2.height, width: n2.width, name: `background-color-${this._instanceId}` });
|
|
38141
38153
|
}
|
|
38142
38154
|
}
|
|
38143
38155
|
}
|
|
38144
|
-
drawDots(
|
|
38156
|
+
drawDots(t13) {
|
|
38145
38157
|
var e3, i2;
|
|
38146
38158
|
if (!this._qr) throw "QR code is not defined";
|
|
38147
38159
|
const r3 = this._options, n2 = this._qr.getModuleCount();
|
|
38148
38160
|
if (n2 > r3.width || n2 > r3.height) throw "The canvas is too small.";
|
|
38149
38161
|
const o2 = Math.min(r3.width, r3.height) - 2 * r3.margin, a2 = r3.shape === g ? o2 / Math.sqrt(2) : o2, h2 = this._roundSize(a2 / n2), d2 = this._roundSize((r3.width - n2 * h2) / 2), u2 = this._roundSize((r3.height - n2 * h2) / 2), c2 = new s({ svg: this._element, type: r3.dotsOptions.type, window: this._window });
|
|
38150
38162
|
this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: null === (e3 = r3.dotsOptions) || void 0 === e3 ? void 0 : e3.gradient, color: r3.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: r3.height, width: r3.width, name: `dot-color-${this._instanceId}` });
|
|
38151
|
-
for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++)
|
|
38163
|
+
for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++) t13 && !t13(e4, r4) || (null === (i2 = this._qr) || void 0 === i2 ? void 0 : i2.isDark(e4, r4)) && (c2.draw(d2 + r4 * h2, u2 + e4 * h2, h2, ((i3, o3) => !(r4 + i3 < 0 || e4 + o3 < 0 || r4 + i3 >= n2 || e4 + o3 >= n2) && !(t13 && !t13(e4 + o3, r4 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r4 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
38152
38164
|
if (r3.shape === g) {
|
|
38153
|
-
const
|
|
38165
|
+
const t14 = this._roundSize((o2 / h2 - n2) / 2), e4 = n2 + 2 * t14, i3 = d2 - t14 * h2, r4 = u2 - t14 * h2, s2 = [], a3 = this._roundSize(e4 / 2);
|
|
38154
38166
|
for (let i4 = 0; i4 < e4; i4++) {
|
|
38155
38167
|
s2[i4] = [];
|
|
38156
|
-
for (let r5 = 0; r5 < e4; r5++) i4 >=
|
|
38168
|
+
for (let r5 = 0; r5 < e4; r5++) i4 >= t14 - 1 && i4 <= e4 - t14 && r5 >= t14 - 1 && r5 <= e4 - t14 || Math.sqrt((i4 - a3) * (i4 - a3) + (r5 - a3) * (r5 - a3)) > a3 ? s2[i4][r5] = 0 : s2[i4][r5] = this._qr.isDark(r5 - 2 * t14 < 0 ? r5 : r5 >= n2 ? r5 - 2 * t14 : r5 - t14, i4 - 2 * t14 < 0 ? i4 : i4 >= n2 ? i4 - 2 * t14 : i4 - t14) ? 1 : 0;
|
|
38157
38169
|
}
|
|
38158
|
-
for (let
|
|
38170
|
+
for (let t15 = 0; t15 < e4; t15++) for (let n3 = 0; n3 < e4; n3++) s2[t15][n3] && (c2.draw(i3 + n3 * h2, r4 + t15 * h2, h2, ((e5, i4) => {
|
|
38159
38171
|
var r5;
|
|
38160
|
-
return !!(null === (r5 = s2[
|
|
38172
|
+
return !!(null === (r5 = s2[t15 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
|
|
38161
38173
|
})), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
|
|
38162
38174
|
}
|
|
38163
38175
|
}
|
|
38164
38176
|
drawCorners() {
|
|
38165
38177
|
if (!this._qr) throw "QR code is not defined";
|
|
38166
|
-
const
|
|
38167
|
-
if (!
|
|
38178
|
+
const t13 = this._element, e3 = this._options;
|
|
38179
|
+
if (!t13) throw "Element code is not defined";
|
|
38168
38180
|
const i2 = this._qr.getModuleCount(), r3 = Math.min(e3.width, e3.height) - 2 * e3.margin, n2 = e3.shape === g ? r3 / Math.sqrt(2) : r3, o2 = this._roundSize(n2 / i2), a2 = 7 * o2, u2 = 3 * o2, p2 = this._roundSize((e3.width - i2 * o2) / 2), v2 = this._roundSize((e3.height - i2 * o2) / 2);
|
|
38169
|
-
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([
|
|
38181
|
+
[[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t14, r4, n3]) => {
|
|
38170
38182
|
var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
|
|
38171
|
-
const z = p2 +
|
|
38183
|
+
const z = p2 + t14 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
|
|
38172
38184
|
let P = this._dotsClipPath, I = this._dotsClipPath;
|
|
38173
|
-
if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${
|
|
38174
|
-
const
|
|
38175
|
-
|
|
38185
|
+
if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t14}-${r4}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t14}-${r4}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h.includes(e3.cornersSquareOptions.type)) {
|
|
38186
|
+
const t15 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
|
|
38187
|
+
t15.draw(z, B, a2, n3), t15._element && P && P.appendChild(t15._element);
|
|
38176
38188
|
} else {
|
|
38177
|
-
const
|
|
38178
|
-
for (let e4 = 0; e4 < f.length; e4++) for (let i3 = 0; i3 < f[e4].length; i3++) (null === (S2 = f[e4]) || void 0 === S2 ? void 0 : S2[i3]) && (
|
|
38189
|
+
const t15 = new s({ svg: this._element, type: (null === (x2 = e3.cornersSquareOptions) || void 0 === x2 ? void 0 : x2.type) || e3.dotsOptions.type, window: this._window });
|
|
38190
|
+
for (let e4 = 0; e4 < f.length; e4++) for (let i3 = 0; i3 < f[e4].length; i3++) (null === (S2 = f[e4]) || void 0 === S2 ? void 0 : S2[i3]) && (t15.draw(z + i3 * o2, B + e4 * o2, o2, ((t16, r5) => {
|
|
38179
38191
|
var n4;
|
|
38180
|
-
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38181
|
-
})),
|
|
38192
|
+
return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38193
|
+
})), t15._element && P && P.appendChild(t15._element));
|
|
38182
38194
|
}
|
|
38183
|
-
if (((null === (C2 = e3.cornersDotOptions) || void 0 === C2 ? void 0 : C2.gradient) || (null === (A2 = e3.cornersDotOptions) || void 0 === A2 ? void 0 : A2.color)) && (I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", `clip-path-corners-dot-color-${
|
|
38184
|
-
const
|
|
38185
|
-
|
|
38195
|
+
if (((null === (C2 = e3.cornersDotOptions) || void 0 === C2 ? void 0 : C2.gradient) || (null === (A2 = e3.cornersDotOptions) || void 0 === A2 ? void 0 : A2.color)) && (I = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), I.setAttribute("id", `clip-path-corners-dot-color-${t14}-${r4}-${this._instanceId}`), this._defs.appendChild(I), this._cornersDotClipPath = I, this._createColor({ options: null === (M2 = e3.cornersDotOptions) || void 0 === M2 ? void 0 : M2.gradient, color: null === ($2 = e3.cornersDotOptions) || void 0 === $2 ? void 0 : $2.color, additionalRotation: n3, x: z + 2 * o2, y: B + 2 * o2, height: u2, width: u2, name: `corners-dot-color-${t14}-${r4}-${this._instanceId}` })), (null === (O = e3.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e3.cornersDotOptions.type)) {
|
|
38196
|
+
const t15 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
|
|
38197
|
+
t15.draw(z + 2 * o2, B + 2 * o2, u2, n3), t15._element && I && I.appendChild(t15._element);
|
|
38186
38198
|
} else {
|
|
38187
|
-
const
|
|
38188
|
-
for (let e4 = 0; e4 < w.length; e4++) for (let i3 = 0; i3 < w[e4].length; i3++) (null === (k = w[e4]) || void 0 === k ? void 0 : k[i3]) && (
|
|
38199
|
+
const t15 = new s({ svg: this._element, type: (null === (D = e3.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e3.dotsOptions.type, window: this._window });
|
|
38200
|
+
for (let e4 = 0; e4 < w.length; e4++) for (let i3 = 0; i3 < w[e4].length; i3++) (null === (k = w[e4]) || void 0 === k ? void 0 : k[i3]) && (t15.draw(z + i3 * o2, B + e4 * o2, o2, ((t16, r5) => {
|
|
38189
38201
|
var n4;
|
|
38190
|
-
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 +
|
|
38191
|
-
})),
|
|
38202
|
+
return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
|
|
38203
|
+
})), t15._element && I && I.appendChild(t15._element));
|
|
38192
38204
|
}
|
|
38193
38205
|
}));
|
|
38194
38206
|
}
|
|
38195
38207
|
loadImage() {
|
|
38196
|
-
return new Promise(((
|
|
38208
|
+
return new Promise(((t13, e3) => {
|
|
38197
38209
|
var i2;
|
|
38198
38210
|
const r3 = this._options;
|
|
38199
38211
|
if (!r3.image) return e3("Image is not defined");
|
|
38200
38212
|
if (null === (i2 = r3.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r3.nodeCanvas.loadImage(r3.image).then(((e4) => {
|
|
38201
38213
|
var i3, n2;
|
|
38202
38214
|
if (this._image = e4, this._options.imageOptions.saveAsBlob) {
|
|
38203
|
-
const
|
|
38204
|
-
null === (n2 = null ==
|
|
38215
|
+
const t14 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
|
|
38216
|
+
null === (n2 = null == t14 ? void 0 : t14.getContext("2d")) || void 0 === n2 || n2.drawImage(e4, 0, 0), this._imageUri = null == t14 ? void 0 : t14.toDataURL();
|
|
38205
38217
|
}
|
|
38206
|
-
|
|
38218
|
+
t13();
|
|
38207
38219
|
})).catch(e3);
|
|
38208
38220
|
else {
|
|
38209
38221
|
const e4 = new this._window.Image();
|
|
38210
38222
|
"string" == typeof r3.imageOptions.crossOrigin && (e4.crossOrigin = r3.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
|
|
38211
|
-
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(
|
|
38223
|
+
this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t14, e5) {
|
|
38212
38224
|
return new Promise(((i3) => {
|
|
38213
38225
|
const r4 = new e5.XMLHttpRequest();
|
|
38214
38226
|
r4.onload = function() {
|
|
38215
|
-
const
|
|
38216
|
-
|
|
38217
|
-
i3(
|
|
38218
|
-
},
|
|
38219
|
-
}, r4.open("GET",
|
|
38227
|
+
const t15 = new e5.FileReader();
|
|
38228
|
+
t15.onloadend = function() {
|
|
38229
|
+
i3(t15.result);
|
|
38230
|
+
}, t15.readAsDataURL(r4.response);
|
|
38231
|
+
}, r4.open("GET", t14), r4.responseType = "blob", r4.send();
|
|
38220
38232
|
}));
|
|
38221
|
-
})(r3.image || "", this._window)),
|
|
38233
|
+
})(r3.image || "", this._window)), t13();
|
|
38222
38234
|
}, e4.src = r3.image;
|
|
38223
38235
|
}
|
|
38224
38236
|
}));
|
|
38225
38237
|
}
|
|
38226
|
-
async drawImage({ width:
|
|
38227
|
-
const n2 = this._options, o2 = this._roundSize((n2.width - i2 * r3) / 2), s2 = this._roundSize((n2.height - i2 * r3) / 2), a2 = o2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 -
|
|
38238
|
+
async drawImage({ width: t13, height: e3, count: i2, dotSize: r3 }) {
|
|
38239
|
+
const n2 = this._options, o2 = this._roundSize((n2.width - i2 * r3) / 2), s2 = this._roundSize((n2.height - i2 * r3) / 2), a2 = o2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - t13) / 2), h2 = s2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - e3) / 2), d2 = t13 - 2 * n2.imageOptions.margin, u2 = e3 - 2 * n2.imageOptions.margin, c2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
38228
38240
|
c2.setAttribute("href", this._imageUri || ""), c2.setAttribute("xlink:href", this._imageUri || ""), c2.setAttribute("x", String(a2)), c2.setAttribute("y", String(h2)), c2.setAttribute("width", `${d2}px`), c2.setAttribute("height", `${u2}px`), this._element.appendChild(c2);
|
|
38229
38241
|
}
|
|
38230
|
-
_createColor({ options:
|
|
38242
|
+
_createColor({ options: t13, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
|
|
38231
38243
|
const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
38232
|
-
if (d2.setAttribute("x", String(r3)), d2.setAttribute("y", String(n2)), d2.setAttribute("height", String(o2)), d2.setAttribute("width", String(s2)), d2.setAttribute("clip-path", `url('#clip-path-${a2}')`),
|
|
38244
|
+
if (d2.setAttribute("x", String(r3)), d2.setAttribute("y", String(n2)), d2.setAttribute("height", String(o2)), d2.setAttribute("width", String(s2)), d2.setAttribute("clip-path", `url('#clip-path-${a2}')`), t13) {
|
|
38233
38245
|
let e4;
|
|
38234
|
-
if ("radial" ===
|
|
38246
|
+
if ("radial" === t13.type) e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("fx", String(r3 + s2 / 2)), e4.setAttribute("fy", String(n2 + o2 / 2)), e4.setAttribute("cx", String(r3 + s2 / 2)), e4.setAttribute("cy", String(n2 + o2 / 2)), e4.setAttribute("r", String(h2 / 2));
|
|
38235
38247
|
else {
|
|
38236
|
-
const h3 = ((
|
|
38248
|
+
const h3 = ((t13.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
|
|
38237
38249
|
let u2 = r3 + s2 / 2, c2 = n2 + o2 / 2, l2 = r3 + s2 / 2, g2 = n2 + o2 / 2;
|
|
38238
38250
|
d3 >= 0 && d3 <= 0.25 * Math.PI || d3 > 1.75 * Math.PI && d3 <= 2 * Math.PI ? (u2 -= s2 / 2, c2 -= o2 / 2 * Math.tan(h3), l2 += s2 / 2, g2 += o2 / 2 * Math.tan(h3)) : d3 > 0.25 * Math.PI && d3 <= 0.75 * Math.PI ? (c2 -= o2 / 2, u2 -= s2 / 2 / Math.tan(h3), g2 += o2 / 2, l2 += s2 / 2 / Math.tan(h3)) : d3 > 0.75 * Math.PI && d3 <= 1.25 * Math.PI ? (u2 += s2 / 2, c2 += o2 / 2 * Math.tan(h3), l2 -= s2 / 2, g2 -= o2 / 2 * Math.tan(h3)) : d3 > 1.25 * Math.PI && d3 <= 1.75 * Math.PI && (c2 += o2 / 2, u2 += s2 / 2 / Math.tan(h3), g2 -= o2 / 2, l2 -= s2 / 2 / Math.tan(h3)), e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("x1", String(Math.round(u2))), e4.setAttribute("y1", String(Math.round(c2))), e4.setAttribute("x2", String(Math.round(l2))), e4.setAttribute("y2", String(Math.round(g2)));
|
|
38239
38251
|
}
|
|
38240
|
-
|
|
38252
|
+
t13.colorStops.forEach((({ offset: t14, color: i3 }) => {
|
|
38241
38253
|
const r4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
|
|
38242
|
-
r4.setAttribute("offset", 100 *
|
|
38254
|
+
r4.setAttribute("offset", 100 * t14 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
|
|
38243
38255
|
})), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
|
|
38244
38256
|
} else e3 && d2.setAttribute("fill", e3);
|
|
38245
38257
|
this._element.appendChild(d2);
|
|
@@ -38247,119 +38259,119 @@ var require_qr_code_styling = __commonJS2({
|
|
|
38247
38259
|
}
|
|
38248
38260
|
p.instanceCount = 0;
|
|
38249
38261
|
const v = p, _ = "canvas", m = {};
|
|
38250
|
-
for (let
|
|
38262
|
+
for (let t13 = 0; t13 <= 40; t13++) m[t13] = t13;
|
|
38251
38263
|
const b = { type: _, shape: "square", width: 300, height: 300, data: "", margin: 0, qrOptions: { typeNumber: m[0], mode: void 0, errorCorrectionLevel: "Q" }, imageOptions: { saveAsBlob: true, hideBackgroundDots: true, imageSize: 0.4, crossOrigin: void 0, margin: 0 }, dotsOptions: { type: "square", color: "#000", roundSize: true }, backgroundOptions: { round: 0, color: "#fff" } };
|
|
38252
|
-
function y(
|
|
38253
|
-
const e3 = Object.assign({},
|
|
38264
|
+
function y(t13) {
|
|
38265
|
+
const e3 = Object.assign({}, t13);
|
|
38254
38266
|
if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
|
|
38255
|
-
return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((
|
|
38267
|
+
return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((t14) => Object.assign(Object.assign({}, t14), { offset: Number(t14.offset) }))), e3;
|
|
38256
38268
|
}
|
|
38257
|
-
function x(
|
|
38258
|
-
const e3 = Object.assign({},
|
|
38269
|
+
function x(t13) {
|
|
38270
|
+
const e3 = Object.assign({}, t13);
|
|
38259
38271
|
return e3.width = Number(e3.width), e3.height = Number(e3.height), e3.margin = Number(e3.margin), e3.imageOptions = Object.assign(Object.assign({}, e3.imageOptions), { hideBackgroundDots: Boolean(e3.imageOptions.hideBackgroundDots), imageSize: Number(e3.imageOptions.imageSize), margin: Number(e3.imageOptions.margin) }), e3.margin > Math.min(e3.width, e3.height) && (e3.margin = Math.min(e3.width, e3.height)), e3.dotsOptions = Object.assign({}, e3.dotsOptions), e3.dotsOptions.gradient && (e3.dotsOptions.gradient = y(e3.dotsOptions.gradient)), e3.cornersSquareOptions && (e3.cornersSquareOptions = Object.assign({}, e3.cornersSquareOptions), e3.cornersSquareOptions.gradient && (e3.cornersSquareOptions.gradient = y(e3.cornersSquareOptions.gradient))), e3.cornersDotOptions && (e3.cornersDotOptions = Object.assign({}, e3.cornersDotOptions), e3.cornersDotOptions.gradient && (e3.cornersDotOptions.gradient = y(e3.cornersDotOptions.gradient))), e3.backgroundOptions && (e3.backgroundOptions = Object.assign({}, e3.backgroundOptions), e3.backgroundOptions.gradient && (e3.backgroundOptions.gradient = y(e3.backgroundOptions.gradient))), e3;
|
|
38260
38272
|
}
|
|
38261
38273
|
var S = i(873), C = i.n(S);
|
|
38262
|
-
function A(
|
|
38263
|
-
if (!
|
|
38264
|
-
"." ===
|
|
38265
|
-
const e3 = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[
|
|
38266
|
-
if (!e3) throw new Error(`Extension "${
|
|
38274
|
+
function A(t13) {
|
|
38275
|
+
if (!t13) throw new Error("Extension must be defined");
|
|
38276
|
+
"." === t13[0] && (t13 = t13.substring(1));
|
|
38277
|
+
const e3 = { bmp: "image/bmp", gif: "image/gif", ico: "image/vnd.microsoft.icon", jpeg: "image/jpeg", jpg: "image/jpeg", png: "image/png", svg: "image/svg+xml", tif: "image/tiff", tiff: "image/tiff", webp: "image/webp", pdf: "application/pdf" }[t13.toLowerCase()];
|
|
38278
|
+
if (!e3) throw new Error(`Extension "${t13}" is not supported`);
|
|
38267
38279
|
return e3;
|
|
38268
38280
|
}
|
|
38269
38281
|
class M {
|
|
38270
|
-
constructor(
|
|
38271
|
-
(null ==
|
|
38282
|
+
constructor(t13) {
|
|
38283
|
+
(null == t13 ? void 0 : t13.jsdom) ? this._window = new t13.jsdom("", { resources: "usable" }).window : this._window = window, this._options = t13 ? x(e2(b, t13)) : b, this.update();
|
|
38272
38284
|
}
|
|
38273
|
-
static _clearContainer(
|
|
38274
|
-
|
|
38285
|
+
static _clearContainer(t13) {
|
|
38286
|
+
t13 && (t13.innerHTML = "");
|
|
38275
38287
|
}
|
|
38276
38288
|
_setupSvg() {
|
|
38277
38289
|
if (!this._qr) return;
|
|
38278
|
-
const
|
|
38279
|
-
this._svg =
|
|
38290
|
+
const t13 = new v(this._options, this._window);
|
|
38291
|
+
this._svg = t13.getElement(), this._svgDrawingPromise = t13.drawQR(this._qr).then((() => {
|
|
38280
38292
|
var e3;
|
|
38281
|
-
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this,
|
|
38293
|
+
this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t13.getElement(), this._options));
|
|
38282
38294
|
}));
|
|
38283
38295
|
}
|
|
38284
38296
|
_setupCanvas() {
|
|
38285
|
-
var
|
|
38286
|
-
this._qr && ((null === (
|
|
38287
|
-
var
|
|
38297
|
+
var t13, e3;
|
|
38298
|
+
this._qr && ((null === (t13 = this._options.nodeCanvas) || void 0 === t13 ? void 0 : t13.createCanvas) ? (this._nodeCanvas = this._options.nodeCanvas.createCanvas(this._options.width, this._options.height), this._nodeCanvas.width = this._options.width, this._nodeCanvas.height = this._options.height) : (this._domCanvas = document.createElement("canvas"), this._domCanvas.width = this._options.width, this._domCanvas.height = this._options.height), this._setupSvg(), this._canvasDrawingPromise = null === (e3 = this._svgDrawingPromise) || void 0 === e3 ? void 0 : e3.then((() => {
|
|
38299
|
+
var t14;
|
|
38288
38300
|
if (!this._svg) return;
|
|
38289
38301
|
const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r3 = btoa(i2), n2 = `data:${A("svg")};base64,${r3}`;
|
|
38290
|
-
if (null === (
|
|
38302
|
+
if (null === (t14 = this._options.nodeCanvas) || void 0 === t14 ? void 0 : t14.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t15) => {
|
|
38291
38303
|
var e5, i3;
|
|
38292
|
-
|
|
38304
|
+
t15.width = this._options.width, t15.height = this._options.height, null === (i3 = null === (e5 = this._nodeCanvas) || void 0 === e5 ? void 0 : e5.getContext("2d")) || void 0 === i3 || i3.drawImage(t15, 0, 0);
|
|
38293
38305
|
}));
|
|
38294
38306
|
{
|
|
38295
|
-
const
|
|
38307
|
+
const t15 = new this._window.Image();
|
|
38296
38308
|
return new Promise(((e5) => {
|
|
38297
|
-
|
|
38309
|
+
t15.onload = () => {
|
|
38298
38310
|
var i3, r4;
|
|
38299
|
-
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(
|
|
38300
|
-
},
|
|
38311
|
+
null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t15, 0, 0), e5();
|
|
38312
|
+
}, t15.src = n2;
|
|
38301
38313
|
}));
|
|
38302
38314
|
}
|
|
38303
38315
|
})));
|
|
38304
38316
|
}
|
|
38305
|
-
async _getElement(
|
|
38317
|
+
async _getElement(t13 = "png") {
|
|
38306
38318
|
if (!this._qr) throw "QR code is empty";
|
|
38307
|
-
return "svg" ===
|
|
38319
|
+
return "svg" === t13.toLowerCase() ? (this._svg && this._svgDrawingPromise || this._setupSvg(), await this._svgDrawingPromise, this._svg) : ((this._domCanvas || this._nodeCanvas) && this._canvasDrawingPromise || this._setupCanvas(), await this._canvasDrawingPromise, this._domCanvas || this._nodeCanvas);
|
|
38308
38320
|
}
|
|
38309
|
-
update(
|
|
38310
|
-
M._clearContainer(this._container), this._options =
|
|
38321
|
+
update(t13) {
|
|
38322
|
+
M._clearContainer(this._container), this._options = t13 ? x(e2(this._options, t13)) : this._options, this._options.data && (this._qr = C()(this._options.qrOptions.typeNumber, this._options.qrOptions.errorCorrectionLevel), this._qr.addData(this._options.data, this._options.qrOptions.mode || (function(t14) {
|
|
38311
38323
|
switch (true) {
|
|
38312
|
-
case /^[0-9]*$/.test(
|
|
38324
|
+
case /^[0-9]*$/.test(t14):
|
|
38313
38325
|
return "Numeric";
|
|
38314
|
-
case /^[0-9A-Z $%*+\-./:]*$/.test(
|
|
38326
|
+
case /^[0-9A-Z $%*+\-./:]*$/.test(t14):
|
|
38315
38327
|
return "Alphanumeric";
|
|
38316
38328
|
default:
|
|
38317
38329
|
return "Byte";
|
|
38318
38330
|
}
|
|
38319
38331
|
})(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
|
|
38320
38332
|
}
|
|
38321
|
-
append(
|
|
38322
|
-
if (
|
|
38323
|
-
if ("function" != typeof
|
|
38324
|
-
this._options.type === _ ? this._domCanvas &&
|
|
38333
|
+
append(t13) {
|
|
38334
|
+
if (t13) {
|
|
38335
|
+
if ("function" != typeof t13.appendChild) throw "Container should be a single DOM node";
|
|
38336
|
+
this._options.type === _ ? this._domCanvas && t13.appendChild(this._domCanvas) : this._svg && t13.appendChild(this._svg), this._container = t13;
|
|
38325
38337
|
}
|
|
38326
38338
|
}
|
|
38327
|
-
applyExtension(
|
|
38328
|
-
if (!
|
|
38329
|
-
this._extension =
|
|
38339
|
+
applyExtension(t13) {
|
|
38340
|
+
if (!t13) throw "Extension function should be defined.";
|
|
38341
|
+
this._extension = t13, this.update();
|
|
38330
38342
|
}
|
|
38331
38343
|
deleteExtension() {
|
|
38332
38344
|
this._extension = void 0, this.update();
|
|
38333
38345
|
}
|
|
38334
|
-
async getRawData(
|
|
38346
|
+
async getRawData(t13 = "png") {
|
|
38335
38347
|
if (!this._qr) throw "QR code is empty";
|
|
38336
|
-
const e3 = await this._getElement(
|
|
38348
|
+
const e3 = await this._getElement(t13), i2 = A(t13);
|
|
38337
38349
|
if (!e3) return null;
|
|
38338
|
-
if ("svg" ===
|
|
38339
|
-
const
|
|
38350
|
+
if ("svg" === t13.toLowerCase()) {
|
|
38351
|
+
const t14 = `<?xml version="1.0" standalone="no"?>\r
|
|
38340
38352
|
${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
38341
|
-
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(
|
|
38353
|
+
return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t14) : new Blob([t14], { type: i2 });
|
|
38342
38354
|
}
|
|
38343
|
-
return new Promise(((
|
|
38355
|
+
return new Promise(((t14) => {
|
|
38344
38356
|
const r3 = e3;
|
|
38345
|
-
if ("toBuffer" in r3) if ("image/png" === i2)
|
|
38346
|
-
else if ("image/jpeg" === i2)
|
|
38357
|
+
if ("toBuffer" in r3) if ("image/png" === i2) t14(r3.toBuffer(i2));
|
|
38358
|
+
else if ("image/jpeg" === i2) t14(r3.toBuffer(i2));
|
|
38347
38359
|
else {
|
|
38348
38360
|
if ("application/pdf" !== i2) throw Error("Unsupported extension");
|
|
38349
|
-
|
|
38361
|
+
t14(r3.toBuffer(i2));
|
|
38350
38362
|
}
|
|
38351
|
-
else "toBlob" in r3 && r3.toBlob(
|
|
38363
|
+
else "toBlob" in r3 && r3.toBlob(t14, i2, 1);
|
|
38352
38364
|
}));
|
|
38353
38365
|
}
|
|
38354
|
-
async download(
|
|
38366
|
+
async download(t13) {
|
|
38355
38367
|
if (!this._qr) throw "QR code is empty";
|
|
38356
38368
|
if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
|
|
38357
38369
|
let e3 = "png", i2 = "qr";
|
|
38358
|
-
"string" == typeof
|
|
38370
|
+
"string" == typeof t13 ? (e3 = t13, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == typeof t13 && null !== t13 && (t13.name && (i2 = t13.name), t13.extension && (e3 = t13.extension));
|
|
38359
38371
|
const r3 = await this._getElement(e3);
|
|
38360
38372
|
if (r3) if ("svg" === e3.toLowerCase()) {
|
|
38361
|
-
let
|
|
38362
|
-
|
|
38373
|
+
let t14 = new XMLSerializer().serializeToString(r3);
|
|
38374
|
+
t14 = '<?xml version="1.0" standalone="no"?>\r\n' + t14, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t14)}`, `${i2}.svg`);
|
|
38363
38375
|
} else n(r3.toDataURL(A(e3)), `${i2}.${e3}`);
|
|
38364
38376
|
}
|
|
38365
38377
|
}
|
|
@@ -38489,6 +38501,12 @@ var ArrowLeft = createLucideIcon("ArrowLeft", [
|
|
|
38489
38501
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
38490
38502
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
38491
38503
|
]);
|
|
38504
|
+
var ArrowUpDown = createLucideIcon("ArrowUpDown", [
|
|
38505
|
+
["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
|
|
38506
|
+
["path", { d: "M17 20V4", key: "1ejh1v" }],
|
|
38507
|
+
["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
|
|
38508
|
+
["path", { d: "M7 4v16", key: "1glfcx" }]
|
|
38509
|
+
]);
|
|
38492
38510
|
var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
38493
38511
|
var ChevronDown = createLucideIcon("ChevronDown", [
|
|
38494
38512
|
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
@@ -38501,6 +38519,20 @@ var CircleCheck = createLucideIcon("CircleCheck", [
|
|
|
38501
38519
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38502
38520
|
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
38503
38521
|
]);
|
|
38522
|
+
var ClipboardPaste = createLucideIcon("ClipboardPaste", [
|
|
38523
|
+
[
|
|
38524
|
+
"path",
|
|
38525
|
+
{ d: "M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z", key: "1pp7kr" }
|
|
38526
|
+
],
|
|
38527
|
+
[
|
|
38528
|
+
"path",
|
|
38529
|
+
{
|
|
38530
|
+
d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",
|
|
38531
|
+
key: "2ik1ml"
|
|
38532
|
+
}
|
|
38533
|
+
],
|
|
38534
|
+
["path", { d: "m17 10 4 4-4 4", key: "vp2hj1" }]
|
|
38535
|
+
]);
|
|
38504
38536
|
var Clock = createLucideIcon("Clock", [
|
|
38505
38537
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
38506
38538
|
["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
|
|
@@ -39492,25 +39524,25 @@ function createFocusGuard() {
|
|
|
39492
39524
|
return element;
|
|
39493
39525
|
}
|
|
39494
39526
|
var __assign = function() {
|
|
39495
|
-
__assign = Object.assign || function __assign2(
|
|
39527
|
+
__assign = Object.assign || function __assign2(t11) {
|
|
39496
39528
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39497
39529
|
s = arguments[i];
|
|
39498
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
39530
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t11[p] = s[p];
|
|
39499
39531
|
}
|
|
39500
|
-
return
|
|
39532
|
+
return t11;
|
|
39501
39533
|
};
|
|
39502
39534
|
return __assign.apply(this, arguments);
|
|
39503
39535
|
};
|
|
39504
39536
|
function __rest(s, e) {
|
|
39505
|
-
var
|
|
39537
|
+
var t11 = {};
|
|
39506
39538
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39507
|
-
|
|
39539
|
+
t11[p] = s[p];
|
|
39508
39540
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39509
39541
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
39510
39542
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39511
|
-
|
|
39543
|
+
t11[p[i]] = s[p[i]];
|
|
39512
39544
|
}
|
|
39513
|
-
return
|
|
39545
|
+
return t11;
|
|
39514
39546
|
}
|
|
39515
39547
|
function __spreadArray(to, from, pack) {
|
|
39516
39548
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
@@ -40574,16 +40606,16 @@ var Title = DialogTitle;
|
|
|
40574
40606
|
var Description = DialogDescription;
|
|
40575
40607
|
var Close = DialogClose;
|
|
40576
40608
|
function r(e) {
|
|
40577
|
-
var
|
|
40609
|
+
var t11, f, n = "";
|
|
40578
40610
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
40579
40611
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
40580
40612
|
var o = e.length;
|
|
40581
|
-
for (
|
|
40613
|
+
for (t11 = 0; t11 < o; t11++) e[t11] && (f = r(e[t11])) && (n && (n += " "), n += f);
|
|
40582
40614
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
40583
40615
|
return n;
|
|
40584
40616
|
}
|
|
40585
40617
|
function clsx() {
|
|
40586
|
-
for (var e,
|
|
40618
|
+
for (var e, t11, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t11 = r(e)) && (n && (n += " "), n += t11);
|
|
40587
40619
|
return n;
|
|
40588
40620
|
}
|
|
40589
40621
|
var CLASS_PART_SEPARATOR = "-";
|
|
@@ -43093,6 +43125,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
|
|
|
43093
43125
|
const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
|
|
43094
43126
|
return `${baseUrl}/api/public${normalizedPath}`;
|
|
43095
43127
|
}
|
|
43128
|
+
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
43129
|
+
ActionType2["Deposit"] = "deposit";
|
|
43130
|
+
ActionType2["Withdraw"] = "withdraw";
|
|
43131
|
+
return ActionType2;
|
|
43132
|
+
})(ActionType || {});
|
|
43096
43133
|
async function createDepositAddress(overrides, publishableKey) {
|
|
43097
43134
|
if (!overrides?.external_user_id) {
|
|
43098
43135
|
throw new Error("external_user_id is required");
|
|
@@ -43103,6 +43140,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
43103
43140
|
destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
|
|
43104
43141
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
43105
43142
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
43143
|
+
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
43106
43144
|
client_metadata: overrides?.client_metadata || {}
|
|
43107
43145
|
};
|
|
43108
43146
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -43133,9 +43171,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
|
|
|
43133
43171
|
ExecutionStatus2["WAITING"] = "waiting";
|
|
43134
43172
|
return ExecutionStatus2;
|
|
43135
43173
|
})(ExecutionStatus || {});
|
|
43136
|
-
async function queryExecutions(externalUserId, publishableKey) {
|
|
43174
|
+
async function queryExecutions(externalUserId, publishableKey, actionType) {
|
|
43137
43175
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43138
43176
|
validatePublishableKey(pk);
|
|
43177
|
+
const body = {
|
|
43178
|
+
external_user_id: externalUserId,
|
|
43179
|
+
...actionType ? { action_type: actionType } : {}
|
|
43180
|
+
};
|
|
43139
43181
|
const response = await fetch(
|
|
43140
43182
|
`${API_BASE_URL}/v1/public/direct_executions/query`,
|
|
43141
43183
|
{
|
|
@@ -43145,9 +43187,7 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
43145
43187
|
"x-publishable-key": pk,
|
|
43146
43188
|
"Content-Type": "application/json"
|
|
43147
43189
|
},
|
|
43148
|
-
body: JSON.stringify(
|
|
43149
|
-
external_user_id: externalUserId
|
|
43150
|
-
})
|
|
43190
|
+
body: JSON.stringify(body)
|
|
43151
43191
|
}
|
|
43152
43192
|
);
|
|
43153
43193
|
if (!response.ok) {
|
|
@@ -43175,6 +43215,26 @@ async function pollDirectExecutions(request, publishableKey) {
|
|
|
43175
43215
|
}
|
|
43176
43216
|
return response.json();
|
|
43177
43217
|
}
|
|
43218
|
+
async function getSupportedDestinationTokens(publishableKey) {
|
|
43219
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43220
|
+
validatePublishableKey(pk);
|
|
43221
|
+
const response = await fetch(
|
|
43222
|
+
`${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
|
|
43223
|
+
{
|
|
43224
|
+
method: "GET",
|
|
43225
|
+
headers: {
|
|
43226
|
+
accept: "application/json",
|
|
43227
|
+
"x-publishable-key": pk
|
|
43228
|
+
}
|
|
43229
|
+
}
|
|
43230
|
+
);
|
|
43231
|
+
if (!response.ok) {
|
|
43232
|
+
throw new Error(
|
|
43233
|
+
`Failed to fetch supported destination tokens: ${response.statusText}`
|
|
43234
|
+
);
|
|
43235
|
+
}
|
|
43236
|
+
return response.json();
|
|
43237
|
+
}
|
|
43178
43238
|
async function getSupportedDepositTokens(publishableKey, options2) {
|
|
43179
43239
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
43180
43240
|
validatePublishableKey(pk);
|
|
@@ -45258,7 +45318,7 @@ var computePosition2 = (reference, floating, options2) => {
|
|
|
45258
45318
|
var isClient = typeof document !== "undefined";
|
|
45259
45319
|
var noop2 = function noop22() {
|
|
45260
45320
|
};
|
|
45261
|
-
var index = isClient ?
|
|
45321
|
+
var index = isClient ? import_react22.useLayoutEffect : noop2;
|
|
45262
45322
|
function deepEqual(a, b) {
|
|
45263
45323
|
if (a === b) {
|
|
45264
45324
|
return true;
|
|
@@ -46367,14 +46427,14 @@ function createCollection(name) {
|
|
|
46367
46427
|
);
|
|
46368
46428
|
const CollectionProvider = (props) => {
|
|
46369
46429
|
const { scope, children } = props;
|
|
46370
|
-
const ref =
|
|
46371
|
-
const itemMap =
|
|
46430
|
+
const ref = import_react24.default.useRef(null);
|
|
46431
|
+
const itemMap = import_react24.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
46372
46432
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
46373
46433
|
};
|
|
46374
46434
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
46375
46435
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
46376
46436
|
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
46377
|
-
const CollectionSlot =
|
|
46437
|
+
const CollectionSlot = import_react24.default.forwardRef(
|
|
46378
46438
|
(props, forwardedRef) => {
|
|
46379
46439
|
const { scope, children } = props;
|
|
46380
46440
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
@@ -46386,13 +46446,13 @@ function createCollection(name) {
|
|
|
46386
46446
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
46387
46447
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
46388
46448
|
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
46389
|
-
const CollectionItemSlot =
|
|
46449
|
+
const CollectionItemSlot = import_react24.default.forwardRef(
|
|
46390
46450
|
(props, forwardedRef) => {
|
|
46391
46451
|
const { scope, children, ...itemData } = props;
|
|
46392
|
-
const ref =
|
|
46452
|
+
const ref = import_react24.default.useRef(null);
|
|
46393
46453
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
46394
46454
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
46395
|
-
|
|
46455
|
+
import_react24.default.useEffect(() => {
|
|
46396
46456
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
46397
46457
|
return () => void context.itemMap.delete(ref);
|
|
46398
46458
|
});
|
|
@@ -46402,7 +46462,7 @@ function createCollection(name) {
|
|
|
46402
46462
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
46403
46463
|
function useCollection2(scope) {
|
|
46404
46464
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
46405
|
-
const getItems =
|
|
46465
|
+
const getItems = import_react24.default.useCallback(() => {
|
|
46406
46466
|
const collectionNode = context.collectionRef.current;
|
|
46407
46467
|
if (!collectionNode) return [];
|
|
46408
46468
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
@@ -48130,6 +48190,7 @@ function useDepositAddress(params) {
|
|
|
48130
48190
|
destinationChainType,
|
|
48131
48191
|
destinationChainId,
|
|
48132
48192
|
destinationTokenAddress,
|
|
48193
|
+
actionType,
|
|
48133
48194
|
enabled = true
|
|
48134
48195
|
} = params;
|
|
48135
48196
|
return useQuery({
|
|
@@ -48141,6 +48202,7 @@ function useDepositAddress(params) {
|
|
|
48141
48202
|
destinationChainType ?? null,
|
|
48142
48203
|
destinationChainId ?? null,
|
|
48143
48204
|
destinationTokenAddress ?? null,
|
|
48205
|
+
actionType ?? null,
|
|
48144
48206
|
publishableKey
|
|
48145
48207
|
],
|
|
48146
48208
|
queryFn: () => createDepositAddress(
|
|
@@ -48149,7 +48211,8 @@ function useDepositAddress(params) {
|
|
|
48149
48211
|
recipient_address: recipientAddress,
|
|
48150
48212
|
destination_chain_type: destinationChainType,
|
|
48151
48213
|
destination_chain_id: destinationChainId,
|
|
48152
|
-
destination_token_address: destinationTokenAddress
|
|
48214
|
+
destination_token_address: destinationTokenAddress,
|
|
48215
|
+
action_type: actionType
|
|
48153
48216
|
},
|
|
48154
48217
|
publishableKey
|
|
48155
48218
|
),
|
|
@@ -48831,6 +48894,30 @@ var en_default2 = {
|
|
|
48831
48894
|
youReceive: "You receive",
|
|
48832
48895
|
intentAddressNote: "The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."
|
|
48833
48896
|
}
|
|
48897
|
+
},
|
|
48898
|
+
withdrawModal: {
|
|
48899
|
+
title: "Withdraw",
|
|
48900
|
+
withdrawCrypto: {
|
|
48901
|
+
title: "Withdraw with Crypto",
|
|
48902
|
+
subtitle: "Send to any wallet address"
|
|
48903
|
+
},
|
|
48904
|
+
selectToken: "Select withdrawal token",
|
|
48905
|
+
receiveToken: "Receive token",
|
|
48906
|
+
receiveChain: "Receive chain",
|
|
48907
|
+
recipientAddress: "Recipient address",
|
|
48908
|
+
recipientAddressPlaceholder: "Enter wallet address",
|
|
48909
|
+
amount: "Amount",
|
|
48910
|
+
amountPlaceholder: "0.00",
|
|
48911
|
+
balance: "Balance",
|
|
48912
|
+
minimum: "min",
|
|
48913
|
+
withdraw: "Withdraw",
|
|
48914
|
+
invalidAddress: "Please enter a valid address",
|
|
48915
|
+
invalidAmount: "Please enter a valid amount",
|
|
48916
|
+
verifyingAddress: "Verifying address...",
|
|
48917
|
+
loading: "Loading...",
|
|
48918
|
+
noTokensAvailable: "No tokens available",
|
|
48919
|
+
review: "Review Withdrawal",
|
|
48920
|
+
back: "Back"
|
|
48834
48921
|
}
|
|
48835
48922
|
};
|
|
48836
48923
|
var i18n2 = en_default2;
|
|
@@ -48909,7 +48996,7 @@ function useDepositPolling({
|
|
|
48909
48996
|
const modalOpenedAt = modalOpenedAtRef.current;
|
|
48910
48997
|
const poll = async () => {
|
|
48911
48998
|
try {
|
|
48912
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
48999
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
48913
49000
|
const cutoff = new Date(modalOpenedAt.getTime() - CUTOFF_BUFFER_MS);
|
|
48914
49001
|
const sortedExecutions = [...response.data].sort((a, b) => {
|
|
48915
49002
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -49031,7 +49118,8 @@ function formatCurrency(currency) {
|
|
|
49031
49118
|
}
|
|
49032
49119
|
function DepositDetailContent({
|
|
49033
49120
|
execution,
|
|
49034
|
-
className
|
|
49121
|
+
className,
|
|
49122
|
+
variant = "deposit"
|
|
49035
49123
|
}) {
|
|
49036
49124
|
const { colors: colors2, fonts, components } = useTheme();
|
|
49037
49125
|
const [chains, setChains] = (0, import_react13.useState)([]);
|
|
@@ -49437,7 +49525,7 @@ function DepositDetailContent({
|
|
|
49437
49525
|
color: components.card.rowLeftLabel,
|
|
49438
49526
|
fontFamily: fonts.regular
|
|
49439
49527
|
},
|
|
49440
|
-
children: "Deposit Tx"
|
|
49528
|
+
children: variant === "withdraw" ? "Withdrawal Tx" : "Deposit Tx"
|
|
49441
49529
|
}
|
|
49442
49530
|
),
|
|
49443
49531
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -54563,7 +54651,7 @@ function DepositsModal({
|
|
|
54563
54651
|
if (!open || !userId) return;
|
|
54564
54652
|
const fetchExecutions = async () => {
|
|
54565
54653
|
try {
|
|
54566
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
54654
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
54567
54655
|
const sorted = [...response.data].sort((a, b) => {
|
|
54568
54656
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
54569
54657
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -54680,7 +54768,7 @@ function saveRecentToken(token) {
|
|
|
54680
54768
|
try {
|
|
54681
54769
|
const recent = getRecentTokens();
|
|
54682
54770
|
const filtered = recent.filter(
|
|
54683
|
-
(
|
|
54771
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54684
54772
|
);
|
|
54685
54773
|
filtered.unshift(token);
|
|
54686
54774
|
const trimmed = filtered.slice(0, MAX_RECENT_TOKENS);
|
|
@@ -54693,7 +54781,7 @@ function removeRecentToken(token) {
|
|
|
54693
54781
|
try {
|
|
54694
54782
|
const recent = getRecentTokens();
|
|
54695
54783
|
const filtered = recent.filter(
|
|
54696
|
-
(
|
|
54784
|
+
(t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
|
|
54697
54785
|
);
|
|
54698
54786
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
|
|
54699
54787
|
return filtered;
|
|
@@ -54732,7 +54820,7 @@ function TokenSelectorSheet({
|
|
|
54732
54820
|
const addOption = (symbol, chainType, chainId, isRecent) => {
|
|
54733
54821
|
const key = `${symbol}-${chainType}:${chainId}`;
|
|
54734
54822
|
if (seen.has(key)) return;
|
|
54735
|
-
const tokenData = tokens.find((
|
|
54823
|
+
const tokenData = tokens.find((t11) => t11.symbol === symbol);
|
|
54736
54824
|
if (!tokenData) return;
|
|
54737
54825
|
const chainData = tokenData.chains.find(
|
|
54738
54826
|
(c) => c.chain_type === chainType && c.chain_id === chainId
|
|
@@ -55188,6 +55276,104 @@ function DepositPollingUi({
|
|
|
55188
55276
|
}
|
|
55189
55277
|
return null;
|
|
55190
55278
|
}
|
|
55279
|
+
var getChainKey = (chainId, chainType) => {
|
|
55280
|
+
return `${chainType}:${chainId}`;
|
|
55281
|
+
};
|
|
55282
|
+
function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSourceChainId, defaultSourceTokenAddress, defaultSourceSymbol) {
|
|
55283
|
+
if (!supportedTokens.length) return null;
|
|
55284
|
+
let selectedTokenData;
|
|
55285
|
+
let selectedChainData;
|
|
55286
|
+
const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
|
|
55287
|
+
if (defaultSourceTokenAddress && hasChainDefaults) {
|
|
55288
|
+
for (const t11 of supportedTokens) {
|
|
55289
|
+
const matchingChain = t11.chains.find(
|
|
55290
|
+
(c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55291
|
+
);
|
|
55292
|
+
if (matchingChain) {
|
|
55293
|
+
selectedTokenData = t11;
|
|
55294
|
+
selectedChainData = matchingChain;
|
|
55295
|
+
break;
|
|
55296
|
+
}
|
|
55297
|
+
}
|
|
55298
|
+
}
|
|
55299
|
+
if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
|
|
55300
|
+
for (const t11 of supportedTokens) {
|
|
55301
|
+
if (t11.symbol !== defaultSourceSymbol) continue;
|
|
55302
|
+
const matchedChain = t11.chains.find(
|
|
55303
|
+
(c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
|
|
55304
|
+
);
|
|
55305
|
+
if (matchedChain) {
|
|
55306
|
+
selectedTokenData = t11;
|
|
55307
|
+
selectedChainData = matchedChain;
|
|
55308
|
+
break;
|
|
55309
|
+
}
|
|
55310
|
+
}
|
|
55311
|
+
}
|
|
55312
|
+
if (!selectedTokenData) {
|
|
55313
|
+
for (const t11 of supportedTokens) {
|
|
55314
|
+
if (t11.chains.length > 0) {
|
|
55315
|
+
selectedTokenData = t11;
|
|
55316
|
+
selectedChainData = t11.chains[0];
|
|
55317
|
+
break;
|
|
55318
|
+
}
|
|
55319
|
+
}
|
|
55320
|
+
}
|
|
55321
|
+
if (selectedTokenData && selectedChainData) {
|
|
55322
|
+
return { token: selectedTokenData, chain: selectedChainData };
|
|
55323
|
+
}
|
|
55324
|
+
return null;
|
|
55325
|
+
}
|
|
55326
|
+
function useDefaultSourceToken({
|
|
55327
|
+
supportedTokens,
|
|
55328
|
+
defaultSourceChainType,
|
|
55329
|
+
defaultSourceChainId,
|
|
55330
|
+
defaultSourceTokenAddress,
|
|
55331
|
+
defaultSourceSymbol
|
|
55332
|
+
}) {
|
|
55333
|
+
const [token, setToken] = (0, import_react20.useState)(null);
|
|
55334
|
+
const [chain, setChain] = (0, import_react20.useState)(null);
|
|
55335
|
+
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react20.useState)(false);
|
|
55336
|
+
const appliedDefaultsRef = (0, import_react20.useRef)("");
|
|
55337
|
+
(0, import_react20.useEffect)(() => {
|
|
55338
|
+
if (!supportedTokens.length) return;
|
|
55339
|
+
const defaultsKey = `${defaultSourceTokenAddress ?? ""}|${defaultSourceSymbol ?? ""}|${defaultSourceChainType ?? ""}|${defaultSourceChainId ?? ""}`;
|
|
55340
|
+
const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
|
|
55341
|
+
if (initialSelectionDone && !defaultsChanged) return;
|
|
55342
|
+
const result = resolveSourceToken(
|
|
55343
|
+
supportedTokens,
|
|
55344
|
+
defaultSourceChainType,
|
|
55345
|
+
defaultSourceChainId,
|
|
55346
|
+
defaultSourceTokenAddress,
|
|
55347
|
+
defaultSourceSymbol
|
|
55348
|
+
);
|
|
55349
|
+
if (result) {
|
|
55350
|
+
setToken(result.token.symbol);
|
|
55351
|
+
setChain(getChainKey(result.chain.chain_id, result.chain.chain_type));
|
|
55352
|
+
appliedDefaultsRef.current = defaultsKey;
|
|
55353
|
+
setInitialSelectionDone(true);
|
|
55354
|
+
}
|
|
55355
|
+
}, [
|
|
55356
|
+
supportedTokens,
|
|
55357
|
+
defaultSourceTokenAddress,
|
|
55358
|
+
defaultSourceSymbol,
|
|
55359
|
+
defaultSourceChainType,
|
|
55360
|
+
defaultSourceChainId,
|
|
55361
|
+
initialSelectionDone
|
|
55362
|
+
]);
|
|
55363
|
+
(0, import_react20.useEffect)(() => {
|
|
55364
|
+
if (!supportedTokens.length || !token) return;
|
|
55365
|
+
const currentToken = supportedTokens.find((t11) => t11.symbol === token);
|
|
55366
|
+
if (!currentToken || currentToken.chains.length === 0) return;
|
|
55367
|
+
const isChainAvailable = chain && currentToken.chains.some((c) => {
|
|
55368
|
+
return getChainKey(c.chain_id, c.chain_type) === chain;
|
|
55369
|
+
});
|
|
55370
|
+
if (!isChainAvailable) {
|
|
55371
|
+
const firstChain = currentToken.chains[0];
|
|
55372
|
+
setChain(getChainKey(firstChain.chain_id, firstChain.chain_type));
|
|
55373
|
+
}
|
|
55374
|
+
}, [token, supportedTokens, chain]);
|
|
55375
|
+
return { token, chain, setToken, setChain, initialSelectionDone };
|
|
55376
|
+
}
|
|
55191
55377
|
function DepositFooterLinks({
|
|
55192
55378
|
onGlossaryClick
|
|
55193
55379
|
}) {
|
|
@@ -55347,7 +55533,7 @@ function GlossaryModal({
|
|
|
55347
55533
|
) });
|
|
55348
55534
|
}
|
|
55349
55535
|
function useCopyAddress() {
|
|
55350
|
-
const [copied, setCopied] = (0,
|
|
55536
|
+
const [copied, setCopied] = (0, import_react21.useState)(false);
|
|
55351
55537
|
const handleCopy = (address) => {
|
|
55352
55538
|
if (!address) return;
|
|
55353
55539
|
navigator.clipboard.writeText(address);
|
|
@@ -55393,7 +55579,7 @@ var TooltipContent2 = React242.forwardRef(({ className, sideOffset = 4, ...props
|
|
|
55393
55579
|
});
|
|
55394
55580
|
TooltipContent2.displayName = Content22.displayName;
|
|
55395
55581
|
var t4 = i18n2.transferCrypto;
|
|
55396
|
-
var
|
|
55582
|
+
var getChainKey2 = (chainId, chainType) => {
|
|
55397
55583
|
return `${chainType}:${chainId}`;
|
|
55398
55584
|
};
|
|
55399
55585
|
var parseChainKey = (chainKey) => {
|
|
@@ -55407,6 +55593,10 @@ function TransferCryptoSingleInput({
|
|
|
55407
55593
|
destinationChainType,
|
|
55408
55594
|
destinationChainId,
|
|
55409
55595
|
destinationTokenAddress,
|
|
55596
|
+
defaultSourceChainType,
|
|
55597
|
+
defaultSourceChainId,
|
|
55598
|
+
defaultSourceTokenAddress,
|
|
55599
|
+
defaultSourceSymbol,
|
|
55410
55600
|
depositConfirmationMode = "auto_ui",
|
|
55411
55601
|
onExecutionsChange,
|
|
55412
55602
|
onDepositSuccess,
|
|
@@ -55415,21 +55605,25 @@ function TransferCryptoSingleInput({
|
|
|
55415
55605
|
}) {
|
|
55416
55606
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
55417
55607
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
55418
|
-
const [token, setToken] = (0, import_react16.useState)("USDC");
|
|
55419
|
-
const [chain, setChain] = (0, import_react16.useState)("solana:mainnet");
|
|
55420
55608
|
const [copied, setCopied] = (0, import_react16.useState)(false);
|
|
55421
55609
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
55422
55610
|
const [glossaryOpen, setGlossaryOpen] = (0, import_react16.useState)(false);
|
|
55423
55611
|
const [detailsExpanded, setDetailsExpanded] = (0, import_react16.useState)(false);
|
|
55424
55612
|
const [depositsModalOpen, setDepositsModalOpen] = (0, import_react16.useState)(false);
|
|
55425
55613
|
const [tokenSelectorOpen, setTokenSelectorOpen] = (0, import_react16.useState)(false);
|
|
55426
|
-
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react16.useState)(false);
|
|
55427
55614
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
55428
55615
|
destination_token_address: destinationTokenAddress,
|
|
55429
55616
|
destination_chain_id: destinationChainId,
|
|
55430
55617
|
destination_chain_type: destinationChainType
|
|
55431
55618
|
});
|
|
55432
55619
|
const supportedTokens = tokensResponse?.data ?? [];
|
|
55620
|
+
const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
|
|
55621
|
+
supportedTokens,
|
|
55622
|
+
defaultSourceChainType,
|
|
55623
|
+
defaultSourceChainId,
|
|
55624
|
+
defaultSourceTokenAddress,
|
|
55625
|
+
defaultSourceSymbol
|
|
55626
|
+
});
|
|
55433
55627
|
const {
|
|
55434
55628
|
data: depositAddressResponse,
|
|
55435
55629
|
isLoading: walletsLoading,
|
|
@@ -55449,8 +55643,8 @@ function TransferCryptoSingleInput({
|
|
|
55449
55643
|
const error = walletsError?.message ?? null;
|
|
55450
55644
|
const allAvailableChains = (0, import_react16.useMemo)(() => {
|
|
55451
55645
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
55452
|
-
supportedTokens.forEach((
|
|
55453
|
-
|
|
55646
|
+
supportedTokens.forEach((t11) => {
|
|
55647
|
+
t11.chains.forEach((c) => {
|
|
55454
55648
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
55455
55649
|
if (!chainsMap.has(comboKey)) {
|
|
55456
55650
|
chainsMap.set(comboKey, c);
|
|
@@ -55459,10 +55653,10 @@ function TransferCryptoSingleInput({
|
|
|
55459
55653
|
});
|
|
55460
55654
|
return Array.from(chainsMap.values());
|
|
55461
55655
|
}, [supportedTokens]);
|
|
55462
|
-
const currentChainCombo = parseChainKey(chain);
|
|
55463
|
-
const currentChainData = allAvailableChains.find(
|
|
55656
|
+
const currentChainCombo = chain ? parseChainKey(chain) : null;
|
|
55657
|
+
const currentChainData = currentChainCombo ? allAvailableChains.find(
|
|
55464
55658
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
55465
|
-
);
|
|
55659
|
+
) : void 0;
|
|
55466
55660
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
55467
55661
|
const currentWallet = getWalletByChainType(wallets, currentChainType);
|
|
55468
55662
|
const depositAddress = currentWallet?.address || "";
|
|
@@ -55480,84 +55674,26 @@ function TransferCryptoSingleInput({
|
|
|
55480
55674
|
onDepositSuccess,
|
|
55481
55675
|
onDepositError
|
|
55482
55676
|
});
|
|
55483
|
-
(0, import_react16.useEffect)(() => {
|
|
55484
|
-
if (!supportedTokens.length || initialSelectionDone) return;
|
|
55485
|
-
let selectedTokenData;
|
|
55486
|
-
let selectedChainData;
|
|
55487
|
-
if (destinationTokenAddress) {
|
|
55488
|
-
for (const t7 of supportedTokens) {
|
|
55489
|
-
const matchingChain = t7.chains.find(
|
|
55490
|
-
(c) => c.token_address.toLowerCase() === destinationTokenAddress.toLowerCase()
|
|
55491
|
-
);
|
|
55492
|
-
if (matchingChain) {
|
|
55493
|
-
selectedTokenData = t7;
|
|
55494
|
-
selectedChainData = matchingChain;
|
|
55495
|
-
break;
|
|
55496
|
-
}
|
|
55497
|
-
}
|
|
55498
|
-
}
|
|
55499
|
-
if (!selectedTokenData) {
|
|
55500
|
-
selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDC");
|
|
55501
|
-
if (selectedTokenData && selectedTokenData.chains.length > 0) {
|
|
55502
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55503
|
-
}
|
|
55504
|
-
}
|
|
55505
|
-
if (!selectedTokenData) {
|
|
55506
|
-
selectedTokenData = supportedTokens.find((t7) => t7.symbol === "USDT");
|
|
55507
|
-
if (selectedTokenData && selectedTokenData.chains.length > 0) {
|
|
55508
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55509
|
-
}
|
|
55510
|
-
}
|
|
55511
|
-
if (!selectedTokenData) {
|
|
55512
|
-
selectedTokenData = supportedTokens[0];
|
|
55513
|
-
if (selectedTokenData.chains.length > 0) {
|
|
55514
|
-
selectedChainData = selectedTokenData.chains[0];
|
|
55515
|
-
}
|
|
55516
|
-
}
|
|
55517
|
-
if (selectedTokenData) {
|
|
55518
|
-
setToken(selectedTokenData.symbol);
|
|
55519
|
-
}
|
|
55520
|
-
if (selectedChainData) {
|
|
55521
|
-
setChain(
|
|
55522
|
-
getChainKey(selectedChainData.chain_id, selectedChainData.chain_type)
|
|
55523
|
-
);
|
|
55524
|
-
}
|
|
55525
|
-
setInitialSelectionDone(true);
|
|
55526
|
-
}, [supportedTokens, destinationTokenAddress, initialSelectionDone]);
|
|
55527
55677
|
(0, import_react16.useEffect)(() => {
|
|
55528
55678
|
if (onExecutionsChange) {
|
|
55529
55679
|
onExecutionsChange(depositExecutions);
|
|
55530
55680
|
}
|
|
55531
55681
|
}, [depositExecutions, onExecutionsChange]);
|
|
55532
|
-
|
|
55533
|
-
if (!supportedTokens.length) return;
|
|
55534
|
-
const currentToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
55535
|
-
if (!currentToken || currentToken.chains.length === 0) return;
|
|
55536
|
-
const isChainAvailable = currentToken.chains.some((c) => {
|
|
55537
|
-
const key = getChainKey(c.chain_id, c.chain_type);
|
|
55538
|
-
return key === chain;
|
|
55539
|
-
});
|
|
55540
|
-
if (!isChainAvailable) {
|
|
55541
|
-
const firstChain = currentToken.chains[0];
|
|
55542
|
-
const newChain = getChainKey(firstChain.chain_id, firstChain.chain_type);
|
|
55543
|
-
setChain(newChain);
|
|
55544
|
-
}
|
|
55545
|
-
}, [token, supportedTokens, chain]);
|
|
55546
|
-
const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
55682
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
55547
55683
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
55548
|
-
const currentChainFromBackend = availableChainsForToken.find((c) => {
|
|
55549
|
-
const key =
|
|
55684
|
+
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
55685
|
+
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
55550
55686
|
return key === chain;
|
|
55551
55687
|
}) || allAvailableChains.find((c) => {
|
|
55552
|
-
const key =
|
|
55688
|
+
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
55553
55689
|
return key === chain;
|
|
55554
|
-
});
|
|
55690
|
+
}) : void 0;
|
|
55555
55691
|
const handleCopyAddress = () => {
|
|
55556
55692
|
navigator.clipboard.writeText(depositAddress);
|
|
55557
55693
|
setCopied(true);
|
|
55558
55694
|
setTimeout(() => setCopied(false), 2e3);
|
|
55559
55695
|
};
|
|
55560
|
-
const
|
|
55696
|
+
const formatProcessingTime3 = (seconds) => {
|
|
55561
55697
|
if (seconds === null) {
|
|
55562
55698
|
return t4.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
55563
55699
|
}
|
|
@@ -55586,10 +55722,10 @@ function TransferCryptoSingleInput({
|
|
|
55586
55722
|
"button",
|
|
55587
55723
|
{
|
|
55588
55724
|
onClick: () => setTokenSelectorOpen(true),
|
|
55589
|
-
disabled: tokensLoading || supportedTokens.length === 0,
|
|
55725
|
+
disabled: tokensLoading || !token || supportedTokens.length === 0,
|
|
55590
55726
|
className: "uf-w-full hover:uf-bg-accent uf-p-3 uf-flex uf-items-center uf-gap-3 uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
|
|
55591
55727
|
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
55592
|
-
children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
|
|
55728
|
+
children: tokensLoading || !token ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3 uf-animate-pulse", children: [
|
|
55593
55729
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-full uf-bg-muted" }),
|
|
55594
55730
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "uf-flex-1", children: [
|
|
55595
55731
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "uf-h-4 uf-w-16 uf-bg-muted uf-rounded uf-mb-1" }),
|
|
@@ -55663,8 +55799,8 @@ function TransferCryptoSingleInput({
|
|
|
55663
55799
|
open: tokenSelectorOpen,
|
|
55664
55800
|
onOpenChange: setTokenSelectorOpen,
|
|
55665
55801
|
tokens: supportedTokens,
|
|
55666
|
-
selectedToken: token,
|
|
55667
|
-
selectedChainKey: chain,
|
|
55802
|
+
selectedToken: token ?? "",
|
|
55803
|
+
selectedChainKey: chain ?? "",
|
|
55668
55804
|
onSelect: (newToken, newChain) => {
|
|
55669
55805
|
setToken(newToken);
|
|
55670
55806
|
setChain(newChain);
|
|
@@ -55766,7 +55902,7 @@ function TransferCryptoSingleInput({
|
|
|
55766
55902
|
t4.processingTime.label,
|
|
55767
55903
|
":",
|
|
55768
55904
|
" ",
|
|
55769
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
55905
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
55770
55906
|
] })
|
|
55771
55907
|
] }),
|
|
55772
55908
|
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
@@ -56002,7 +56138,7 @@ var SelectSeparator2 = React252.forwardRef(({ className, ...props }, ref) => /*
|
|
|
56002
56138
|
));
|
|
56003
56139
|
SelectSeparator2.displayName = Separator.displayName;
|
|
56004
56140
|
var t5 = i18n2.transferCrypto;
|
|
56005
|
-
var
|
|
56141
|
+
var getChainKey3 = (chainId, chainType) => {
|
|
56006
56142
|
return `${chainType}:${chainId}`;
|
|
56007
56143
|
};
|
|
56008
56144
|
var parseChainKey2 = (chainKey) => {
|
|
@@ -56016,6 +56152,10 @@ function TransferCryptoDoubleInput({
|
|
|
56016
56152
|
destinationChainType,
|
|
56017
56153
|
destinationChainId,
|
|
56018
56154
|
destinationTokenAddress,
|
|
56155
|
+
defaultSourceChainType,
|
|
56156
|
+
defaultSourceChainId,
|
|
56157
|
+
defaultSourceTokenAddress,
|
|
56158
|
+
defaultSourceSymbol,
|
|
56019
56159
|
depositConfirmationMode = "auto_ui",
|
|
56020
56160
|
onExecutionsChange,
|
|
56021
56161
|
onDepositSuccess,
|
|
@@ -56024,20 +56164,24 @@ function TransferCryptoDoubleInput({
|
|
|
56024
56164
|
}) {
|
|
56025
56165
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
56026
56166
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
56027
|
-
const [
|
|
56028
|
-
const [chain, setChain] = (0, import_react22.useState)("solana:mainnet");
|
|
56029
|
-
const [copied, setCopied] = (0, import_react22.useState)(false);
|
|
56167
|
+
const [copied, setCopied] = (0, import_react23.useState)(false);
|
|
56030
56168
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
56031
|
-
const [glossaryOpen, setGlossaryOpen] = (0,
|
|
56032
|
-
const [detailsExpanded, setDetailsExpanded] = (0,
|
|
56033
|
-
const [depositsModalOpen, setDepositsModalOpen] = (0,
|
|
56034
|
-
const [initialSelectionDone, setInitialSelectionDone] = (0, import_react22.useState)(false);
|
|
56169
|
+
const [glossaryOpen, setGlossaryOpen] = (0, import_react23.useState)(false);
|
|
56170
|
+
const [detailsExpanded, setDetailsExpanded] = (0, import_react23.useState)(false);
|
|
56171
|
+
const [depositsModalOpen, setDepositsModalOpen] = (0, import_react23.useState)(false);
|
|
56035
56172
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
56036
56173
|
destination_token_address: destinationTokenAddress,
|
|
56037
56174
|
destination_chain_id: destinationChainId,
|
|
56038
56175
|
destination_chain_type: destinationChainType
|
|
56039
56176
|
});
|
|
56040
56177
|
const supportedTokens = tokensResponse?.data ?? [];
|
|
56178
|
+
const { token, chain, setToken, setChain, initialSelectionDone } = useDefaultSourceToken({
|
|
56179
|
+
supportedTokens,
|
|
56180
|
+
defaultSourceChainType,
|
|
56181
|
+
defaultSourceChainId,
|
|
56182
|
+
defaultSourceTokenAddress,
|
|
56183
|
+
defaultSourceSymbol
|
|
56184
|
+
});
|
|
56041
56185
|
const {
|
|
56042
56186
|
data: depositAddressResponse,
|
|
56043
56187
|
isLoading: walletsLoading,
|
|
@@ -56055,10 +56199,10 @@ function TransferCryptoDoubleInput({
|
|
|
56055
56199
|
const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
56056
56200
|
const loading = externalWallets?.length ? false : walletsLoading;
|
|
56057
56201
|
const error = walletsError?.message ?? null;
|
|
56058
|
-
const allAvailableChains = (0,
|
|
56202
|
+
const allAvailableChains = (0, import_react23.useMemo)(() => {
|
|
56059
56203
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
56060
|
-
supportedTokens.forEach((
|
|
56061
|
-
|
|
56204
|
+
supportedTokens.forEach((t11) => {
|
|
56205
|
+
t11.chains.forEach((c) => {
|
|
56062
56206
|
const comboKey = `${c.chain_type}:${c.chain_id}`;
|
|
56063
56207
|
if (!chainsMap.has(comboKey)) {
|
|
56064
56208
|
chainsMap.set(comboKey, c);
|
|
@@ -56067,10 +56211,10 @@ function TransferCryptoDoubleInput({
|
|
|
56067
56211
|
});
|
|
56068
56212
|
return Array.from(chainsMap.values());
|
|
56069
56213
|
}, [supportedTokens]);
|
|
56070
|
-
const currentChainCombo = parseChainKey2(chain);
|
|
56071
|
-
const currentChainData = allAvailableChains.find(
|
|
56214
|
+
const currentChainCombo = chain ? parseChainKey2(chain) : null;
|
|
56215
|
+
const currentChainData = currentChainCombo ? allAvailableChains.find(
|
|
56072
56216
|
(c) => c.chain_type === currentChainCombo.chainType && c.chain_id === currentChainCombo.chainId
|
|
56073
|
-
);
|
|
56217
|
+
) : void 0;
|
|
56074
56218
|
const currentChainType = currentChainData?.chain_type || "ethereum";
|
|
56075
56219
|
const currentWallet = getWalletByChainType(wallets, currentChainType);
|
|
56076
56220
|
const depositAddress = currentWallet?.address || "";
|
|
@@ -56088,57 +56232,26 @@ function TransferCryptoDoubleInput({
|
|
|
56088
56232
|
onDepositSuccess,
|
|
56089
56233
|
onDepositError
|
|
56090
56234
|
});
|
|
56091
|
-
(0,
|
|
56092
|
-
if (!supportedTokens.length || initialSelectionDone) return;
|
|
56093
|
-
const allChains = /* @__PURE__ */ new Set();
|
|
56094
|
-
supportedTokens.forEach((t7) => {
|
|
56095
|
-
t7.chains.forEach((c) => {
|
|
56096
|
-
allChains.add(getChainKey2(c.chain_id, c.chain_type));
|
|
56097
|
-
});
|
|
56098
|
-
});
|
|
56099
|
-
if (!allChains.has(chain)) {
|
|
56100
|
-
const firstToken = supportedTokens[0];
|
|
56101
|
-
if (firstToken.chains.length > 0) {
|
|
56102
|
-
const firstChain = firstToken.chains[0];
|
|
56103
|
-
setChain(getChainKey2(firstChain.chain_id, firstChain.chain_type));
|
|
56104
|
-
}
|
|
56105
|
-
}
|
|
56106
|
-
setInitialSelectionDone(true);
|
|
56107
|
-
}, [supportedTokens, chain, initialSelectionDone]);
|
|
56108
|
-
(0, import_react22.useEffect)(() => {
|
|
56235
|
+
(0, import_react23.useEffect)(() => {
|
|
56109
56236
|
if (onExecutionsChange) {
|
|
56110
56237
|
onExecutionsChange(depositExecutions);
|
|
56111
56238
|
}
|
|
56112
56239
|
}, [depositExecutions, onExecutionsChange]);
|
|
56113
|
-
|
|
56114
|
-
if (!supportedTokens.length) return;
|
|
56115
|
-
const currentToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
56116
|
-
if (!currentToken || currentToken.chains.length === 0) return;
|
|
56117
|
-
const isChainAvailable = currentToken.chains.some((c) => {
|
|
56118
|
-
const key = getChainKey2(c.chain_id, c.chain_type);
|
|
56119
|
-
return key === chain;
|
|
56120
|
-
});
|
|
56121
|
-
if (!isChainAvailable) {
|
|
56122
|
-
const firstChain = currentToken.chains[0];
|
|
56123
|
-
const newChain = getChainKey2(firstChain.chain_id, firstChain.chain_type);
|
|
56124
|
-
setChain(newChain);
|
|
56125
|
-
}
|
|
56126
|
-
}, [token, supportedTokens, chain]);
|
|
56127
|
-
const selectedToken = supportedTokens.find((t7) => t7.symbol === token);
|
|
56240
|
+
const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
|
|
56128
56241
|
const availableChainsForToken = selectedToken?.chains || [];
|
|
56129
|
-
const currentChainFromBackend = availableChainsForToken.find((c) => {
|
|
56130
|
-
const key =
|
|
56242
|
+
const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
|
|
56243
|
+
const key = getChainKey3(c.chain_id, c.chain_type);
|
|
56131
56244
|
return key === chain;
|
|
56132
56245
|
}) || allAvailableChains.find((c) => {
|
|
56133
|
-
const key =
|
|
56246
|
+
const key = getChainKey3(c.chain_id, c.chain_type);
|
|
56134
56247
|
return key === chain;
|
|
56135
|
-
});
|
|
56248
|
+
}) : void 0;
|
|
56136
56249
|
const handleCopyAddress = () => {
|
|
56137
56250
|
navigator.clipboard.writeText(depositAddress);
|
|
56138
56251
|
setCopied(true);
|
|
56139
56252
|
setTimeout(() => setCopied(false), 2e3);
|
|
56140
56253
|
};
|
|
56141
|
-
const
|
|
56254
|
+
const formatProcessingTime3 = (seconds) => {
|
|
56142
56255
|
if (seconds === null) {
|
|
56143
56256
|
return t5.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
56144
56257
|
}
|
|
@@ -56206,11 +56319,11 @@ function TransferCryptoDoubleInput({
|
|
|
56206
56319
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
56207
56320
|
Select2,
|
|
56208
56321
|
{
|
|
56209
|
-
value: token,
|
|
56322
|
+
value: token ?? "",
|
|
56210
56323
|
onValueChange: setToken,
|
|
56211
|
-
disabled: tokensLoading || supportedTokens.length === 0,
|
|
56324
|
+
disabled: tokensLoading || !token || supportedTokens.length === 0,
|
|
56212
56325
|
children: [
|
|
56213
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
|
|
56326
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading || !token ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: token }) }) }) }),
|
|
56214
56327
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectContent2, { className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]", style: { border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`, ...fonts.regular ? { "--uf-font-family": fonts.regular } : {} }, children: supportedTokens.map((tokenData) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
56215
56328
|
SelectItem2,
|
|
56216
56329
|
{
|
|
@@ -56237,11 +56350,11 @@ function TransferCryptoDoubleInput({
|
|
|
56237
56350
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
56238
56351
|
Select2,
|
|
56239
56352
|
{
|
|
56240
|
-
value: chain,
|
|
56353
|
+
value: chain ?? "",
|
|
56241
56354
|
onValueChange: setChain,
|
|
56242
|
-
disabled: tokensLoading || availableChainsForToken.length === 0,
|
|
56355
|
+
disabled: tokensLoading || !chain || availableChainsForToken.length === 0,
|
|
56243
56356
|
children: [
|
|
56244
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
56357
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectTrigger2, { className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50", style: { backgroundColor: components.card.backgroundColor, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(SelectValue2, { children: tokensLoading || !chain ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t5.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
56245
56358
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
56246
56359
|
SelectContent2,
|
|
56247
56360
|
{
|
|
@@ -56249,7 +56362,7 @@ function TransferCryptoDoubleInput({
|
|
|
56249
56362
|
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
56250
56363
|
style: { border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`, ...fonts.regular ? { "--uf-font-family": fonts.regular } : {} },
|
|
56251
56364
|
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: t5.noChainsAvailable }) : availableChainsForToken.map((chainData) => {
|
|
56252
|
-
const chainKey =
|
|
56365
|
+
const chainKey = getChainKey3(
|
|
56253
56366
|
chainData.chain_id,
|
|
56254
56367
|
chainData.chain_type
|
|
56255
56368
|
);
|
|
@@ -56365,7 +56478,7 @@ function TransferCryptoDoubleInput({
|
|
|
56365
56478
|
t5.processingTime.label,
|
|
56366
56479
|
":",
|
|
56367
56480
|
" ",
|
|
56368
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children:
|
|
56481
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
|
|
56369
56482
|
] })
|
|
56370
56483
|
] }),
|
|
56371
56484
|
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
@@ -57244,8 +57357,8 @@ function ConfirmingView({
|
|
|
57244
57357
|
isPolling = false
|
|
57245
57358
|
}) {
|
|
57246
57359
|
const { colors: colors2, fonts } = useTheme();
|
|
57247
|
-
const [containerEl, setContainerEl] = (0,
|
|
57248
|
-
const containerCallbackRef = (0,
|
|
57360
|
+
const [containerEl, setContainerEl] = (0, import_react26.useState)(null);
|
|
57361
|
+
const containerCallbackRef = (0, import_react26.useCallback)((el) => {
|
|
57249
57362
|
setContainerEl(el);
|
|
57250
57363
|
}, []);
|
|
57251
57364
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(PortalContainerProvider, { value: containerEl, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
@@ -57409,7 +57522,7 @@ function BrowserWalletModal({
|
|
|
57409
57522
|
);
|
|
57410
57523
|
if (cancelled) return;
|
|
57411
57524
|
const supportedToken = response.data.find(
|
|
57412
|
-
(
|
|
57525
|
+
(t11) => t11.symbol.toLowerCase() === token.symbol.toLowerCase()
|
|
57413
57526
|
);
|
|
57414
57527
|
if (supportedToken) {
|
|
57415
57528
|
const chainDetail = supportedToken.chains.find(
|
|
@@ -58617,6 +58730,10 @@ function DepositModal({
|
|
|
58617
58730
|
destinationChainType,
|
|
58618
58731
|
destinationChainId,
|
|
58619
58732
|
destinationTokenAddress,
|
|
58733
|
+
defaultSourceChainType,
|
|
58734
|
+
defaultSourceChainId,
|
|
58735
|
+
defaultSourceTokenAddress,
|
|
58736
|
+
defaultSourceSymbol,
|
|
58620
58737
|
hideDepositTracker = false,
|
|
58621
58738
|
showBalanceHeader = false,
|
|
58622
58739
|
transferInputVariant = "double_input",
|
|
@@ -58713,7 +58830,7 @@ function DepositModal({
|
|
|
58713
58830
|
if (view !== "tracker" || !userId) return;
|
|
58714
58831
|
const fetchExecutions = async () => {
|
|
58715
58832
|
try {
|
|
58716
|
-
const response = await queryExecutions(userId, publishableKey);
|
|
58833
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
|
|
58717
58834
|
const sorted = [...response.data].sort((a, b) => {
|
|
58718
58835
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
58719
58836
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -59049,6 +59166,10 @@ function DepositModal({
|
|
|
59049
59166
|
destinationChainType,
|
|
59050
59167
|
destinationChainId,
|
|
59051
59168
|
destinationTokenAddress,
|
|
59169
|
+
defaultSourceChainType,
|
|
59170
|
+
defaultSourceChainId,
|
|
59171
|
+
defaultSourceTokenAddress,
|
|
59172
|
+
defaultSourceSymbol,
|
|
59052
59173
|
depositConfirmationMode,
|
|
59053
59174
|
onExecutionsChange: setDepositExecutions,
|
|
59054
59175
|
onDepositSuccess,
|
|
@@ -59064,6 +59185,10 @@ function DepositModal({
|
|
|
59064
59185
|
destinationChainType,
|
|
59065
59186
|
destinationChainId,
|
|
59066
59187
|
destinationTokenAddress,
|
|
59188
|
+
defaultSourceChainType,
|
|
59189
|
+
defaultSourceChainId,
|
|
59190
|
+
defaultSourceTokenAddress,
|
|
59191
|
+
defaultSourceSymbol,
|
|
59067
59192
|
depositConfirmationMode,
|
|
59068
59193
|
onExecutionsChange: setDepositExecutions,
|
|
59069
59194
|
onDepositSuccess,
|
|
@@ -59224,83 +59349,1806 @@ function DepositModal({
|
|
|
59224
59349
|
}
|
|
59225
59350
|
) });
|
|
59226
59351
|
}
|
|
59227
|
-
function
|
|
59228
|
-
|
|
59352
|
+
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
59353
|
+
return useQuery({
|
|
59354
|
+
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
59355
|
+
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
59356
|
+
staleTime: 1e3 * 60 * 5,
|
|
59357
|
+
gcTime: 1e3 * 60 * 30,
|
|
59358
|
+
refetchOnMount: false,
|
|
59359
|
+
refetchOnWindowFocus: false,
|
|
59360
|
+
enabled
|
|
59361
|
+
});
|
|
59362
|
+
}
|
|
59363
|
+
function useSourceTokenValidation(params) {
|
|
59364
|
+
const {
|
|
59365
|
+
sourceChainType,
|
|
59366
|
+
sourceChainId,
|
|
59367
|
+
sourceTokenAddress,
|
|
59368
|
+
sourceTokenSymbol,
|
|
59369
|
+
publishableKey,
|
|
59370
|
+
enabled = true
|
|
59371
|
+
} = params;
|
|
59372
|
+
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
59373
|
+
return useQuery({
|
|
59374
|
+
queryKey: [
|
|
59375
|
+
"unifold",
|
|
59376
|
+
"sourceTokenValidation",
|
|
59377
|
+
sourceChainType ?? null,
|
|
59378
|
+
sourceChainId ?? null,
|
|
59379
|
+
sourceTokenAddress ?? null,
|
|
59380
|
+
publishableKey
|
|
59381
|
+
],
|
|
59382
|
+
queryFn: async () => {
|
|
59383
|
+
const res = await getSupportedDepositTokens(publishableKey);
|
|
59384
|
+
let matchedMinUsd = null;
|
|
59385
|
+
let matchedProcessingTime = null;
|
|
59386
|
+
let matchedSlippage = null;
|
|
59387
|
+
let matchedPriceImpact = null;
|
|
59388
|
+
const found = res.data.some(
|
|
59389
|
+
(token) => token.chains.some((chain) => {
|
|
59390
|
+
const match = chain.chain_type === sourceChainType && chain.chain_id === sourceChainId && chain.token_address.toLowerCase() === sourceTokenAddress.toLowerCase();
|
|
59391
|
+
if (match) {
|
|
59392
|
+
matchedMinUsd = chain.minimum_deposit_amount_usd;
|
|
59393
|
+
matchedProcessingTime = chain.estimated_processing_time;
|
|
59394
|
+
matchedSlippage = chain.max_slippage_percent;
|
|
59395
|
+
matchedPriceImpact = chain.estimated_price_impact_percent;
|
|
59396
|
+
}
|
|
59397
|
+
return match;
|
|
59398
|
+
})
|
|
59399
|
+
);
|
|
59400
|
+
return {
|
|
59401
|
+
isSupported: found,
|
|
59402
|
+
minimumAmountUsd: matchedMinUsd,
|
|
59403
|
+
estimatedProcessingTime: matchedProcessingTime,
|
|
59404
|
+
maxSlippagePercent: matchedSlippage,
|
|
59405
|
+
priceImpactPercent: matchedPriceImpact,
|
|
59406
|
+
errorMessage: found ? null : `${sourceTokenSymbol || "Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`
|
|
59407
|
+
};
|
|
59408
|
+
},
|
|
59409
|
+
enabled: enabled && hasParams,
|
|
59410
|
+
staleTime: 1e3 * 60 * 5,
|
|
59411
|
+
gcTime: 1e3 * 60 * 30,
|
|
59412
|
+
refetchOnMount: false,
|
|
59413
|
+
refetchOnWindowFocus: false
|
|
59414
|
+
});
|
|
59415
|
+
}
|
|
59416
|
+
function useAddressBalance(params) {
|
|
59417
|
+
const {
|
|
59418
|
+
address,
|
|
59419
|
+
chainType,
|
|
59420
|
+
chainId,
|
|
59421
|
+
tokenAddress,
|
|
59422
|
+
publishableKey,
|
|
59423
|
+
enabled = true
|
|
59424
|
+
} = params;
|
|
59425
|
+
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
59426
|
+
return useQuery({
|
|
59427
|
+
queryKey: [
|
|
59428
|
+
"unifold",
|
|
59429
|
+
"addressBalance",
|
|
59430
|
+
address ?? null,
|
|
59431
|
+
chainType ?? null,
|
|
59432
|
+
chainId ?? null,
|
|
59433
|
+
tokenAddress ?? null,
|
|
59434
|
+
publishableKey
|
|
59435
|
+
],
|
|
59436
|
+
queryFn: async () => {
|
|
59437
|
+
const res = await getAddressBalance(
|
|
59438
|
+
address,
|
|
59439
|
+
chainType,
|
|
59440
|
+
chainId,
|
|
59441
|
+
tokenAddress,
|
|
59442
|
+
publishableKey
|
|
59443
|
+
);
|
|
59444
|
+
if (res.balance) {
|
|
59445
|
+
const decimals = res.balance.token?.decimals ?? 6;
|
|
59446
|
+
const symbol = res.balance.token?.symbol ?? "";
|
|
59447
|
+
const baseUnit = res.balance.amount;
|
|
59448
|
+
const raw = BigInt(baseUnit);
|
|
59449
|
+
const divisor = BigInt(10 ** decimals);
|
|
59450
|
+
const whole = raw / divisor;
|
|
59451
|
+
const frac = raw % divisor;
|
|
59452
|
+
const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
|
|
59453
|
+
const balanceHuman = fracStr ? `${whole}.${fracStr}` : whole.toString();
|
|
59454
|
+
return {
|
|
59455
|
+
balanceBaseUnit: baseUnit,
|
|
59456
|
+
balanceHuman,
|
|
59457
|
+
balanceUsd: res.balance.amount_usd,
|
|
59458
|
+
exchangeRate: res.balance.exchange_rate,
|
|
59459
|
+
decimals,
|
|
59460
|
+
symbol
|
|
59461
|
+
};
|
|
59462
|
+
}
|
|
59463
|
+
return { balanceBaseUnit: "0", balanceHuman: "0", balanceUsd: "0", exchangeRate: null, decimals: 6, symbol: "" };
|
|
59464
|
+
},
|
|
59465
|
+
enabled: enabled && hasParams,
|
|
59466
|
+
staleTime: 1e3 * 30,
|
|
59467
|
+
gcTime: 1e3 * 60 * 5,
|
|
59468
|
+
refetchInterval: 1e3 * 30,
|
|
59469
|
+
refetchOnMount: "always",
|
|
59470
|
+
refetchOnWindowFocus: false
|
|
59471
|
+
});
|
|
59472
|
+
}
|
|
59473
|
+
function useExecutions(userId, publishableKey, options2) {
|
|
59474
|
+
const actionType = options2?.actionType ?? ActionType.Deposit;
|
|
59475
|
+
return useQuery({
|
|
59476
|
+
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
59477
|
+
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
59478
|
+
enabled: (options2?.enabled ?? true) && !!userId,
|
|
59479
|
+
refetchInterval: options2?.refetchInterval ?? 3e3,
|
|
59480
|
+
staleTime: 0,
|
|
59481
|
+
gcTime: 1e3 * 60 * 5,
|
|
59482
|
+
refetchOnWindowFocus: false
|
|
59483
|
+
});
|
|
59484
|
+
}
|
|
59485
|
+
var POLL_INTERVAL_MS2 = 2500;
|
|
59486
|
+
var POLL_ENDPOINT_INTERVAL_MS2 = 3e3;
|
|
59487
|
+
var CUTOFF_BUFFER_MS2 = 6e4;
|
|
59488
|
+
function useWithdrawPolling({
|
|
59489
|
+
userId,
|
|
59229
59490
|
publishableKey,
|
|
59230
|
-
|
|
59491
|
+
depositWalletId,
|
|
59492
|
+
enabled = false,
|
|
59493
|
+
onWithdrawSuccess,
|
|
59494
|
+
onWithdrawError
|
|
59231
59495
|
}) {
|
|
59232
|
-
const [
|
|
59233
|
-
const [
|
|
59234
|
-
|
|
59235
|
-
);
|
|
59236
|
-
const
|
|
59237
|
-
(0,
|
|
59238
|
-
|
|
59239
|
-
|
|
59240
|
-
|
|
59241
|
-
}, [
|
|
59242
|
-
|
|
59243
|
-
|
|
59244
|
-
|
|
59245
|
-
|
|
59246
|
-
|
|
59247
|
-
|
|
59248
|
-
|
|
59249
|
-
setResolvedTheme(e.matches ? "dark" : "light");
|
|
59250
|
-
};
|
|
59251
|
-
mediaQuery.addEventListener("change", handler);
|
|
59252
|
-
return () => mediaQuery.removeEventListener("change", handler);
|
|
59253
|
-
} else {
|
|
59254
|
-
setResolvedTheme(appearance);
|
|
59255
|
-
}
|
|
59256
|
-
}, [config?.appearance]);
|
|
59257
|
-
const depositPromiseRef = import_react.default.useRef(null);
|
|
59258
|
-
const depositConfigRef = import_react.default.useRef(null);
|
|
59259
|
-
depositConfigRef.current = depositConfig;
|
|
59260
|
-
const closeTimeoutRef = import_react.default.useRef(null);
|
|
59261
|
-
const closeGuardRef = import_react.default.useRef(false);
|
|
59262
|
-
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
59263
|
-
if (closeTimeoutRef.current) {
|
|
59264
|
-
clearTimeout(closeTimeoutRef.current);
|
|
59265
|
-
closeTimeoutRef.current = null;
|
|
59266
|
-
}
|
|
59267
|
-
closeGuardRef.current = false;
|
|
59268
|
-
if (depositPromiseRef.current) {
|
|
59269
|
-
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
59270
|
-
depositPromiseRef.current.reject({
|
|
59271
|
-
message: "Deposit cancelled - new deposit started",
|
|
59272
|
-
code: "DEPOSIT_SUPERSEDED"
|
|
59273
|
-
});
|
|
59274
|
-
depositPromiseRef.current = null;
|
|
59275
|
-
}
|
|
59276
|
-
const promise = new Promise((resolve, reject) => {
|
|
59277
|
-
depositPromiseRef.current = { resolve, reject };
|
|
59278
|
-
});
|
|
59279
|
-
promise.catch(() => {
|
|
59280
|
-
});
|
|
59281
|
-
setDepositConfig(config2);
|
|
59282
|
-
setIsOpen(true);
|
|
59283
|
-
return promise;
|
|
59284
|
-
}, []);
|
|
59285
|
-
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
59286
|
-
if (closeGuardRef.current) {
|
|
59287
|
-
return;
|
|
59288
|
-
}
|
|
59289
|
-
closeGuardRef.current = true;
|
|
59290
|
-
const promiseToReject = depositPromiseRef.current;
|
|
59291
|
-
depositPromiseRef.current = null;
|
|
59292
|
-
if (depositConfigRef.current?.onClose) {
|
|
59293
|
-
depositConfigRef.current.onClose();
|
|
59496
|
+
const [executions, setExecutions] = (0, import_react28.useState)([]);
|
|
59497
|
+
const [isPolling, setIsPolling] = (0, import_react28.useState)(false);
|
|
59498
|
+
const enabledAtRef = (0, import_react28.useRef)(/* @__PURE__ */ new Date());
|
|
59499
|
+
const trackedRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
|
|
59500
|
+
const prevEnabledRef = (0, import_react28.useRef)(false);
|
|
59501
|
+
const onSuccessRef = (0, import_react28.useRef)(onWithdrawSuccess);
|
|
59502
|
+
const onErrorRef = (0, import_react28.useRef)(onWithdrawError);
|
|
59503
|
+
(0, import_react28.useEffect)(() => {
|
|
59504
|
+
onSuccessRef.current = onWithdrawSuccess;
|
|
59505
|
+
}, [onWithdrawSuccess]);
|
|
59506
|
+
(0, import_react28.useEffect)(() => {
|
|
59507
|
+
onErrorRef.current = onWithdrawError;
|
|
59508
|
+
}, [onWithdrawError]);
|
|
59509
|
+
(0, import_react28.useEffect)(() => {
|
|
59510
|
+
if (enabled && !prevEnabledRef.current) {
|
|
59511
|
+
enabledAtRef.current = /* @__PURE__ */ new Date();
|
|
59512
|
+
trackedRef.current.clear();
|
|
59294
59513
|
}
|
|
59295
|
-
if (
|
|
59296
|
-
|
|
59297
|
-
message: "Deposit cancelled by user",
|
|
59298
|
-
code: "DEPOSIT_CANCELLED"
|
|
59299
|
-
});
|
|
59514
|
+
if (!enabled) {
|
|
59515
|
+
trackedRef.current.clear();
|
|
59300
59516
|
}
|
|
59301
|
-
|
|
59302
|
-
|
|
59303
|
-
|
|
59517
|
+
prevEnabledRef.current = enabled;
|
|
59518
|
+
}, [enabled]);
|
|
59519
|
+
(0, import_react28.useEffect)(() => {
|
|
59520
|
+
if (!userId || !enabled) return;
|
|
59521
|
+
const enabledAt = enabledAtRef.current;
|
|
59522
|
+
const poll = async () => {
|
|
59523
|
+
try {
|
|
59524
|
+
const response = await queryExecutions(userId, publishableKey, ActionType.Withdraw);
|
|
59525
|
+
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
59526
|
+
const sorted = [...response.data].sort((a, b) => {
|
|
59527
|
+
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
59528
|
+
const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
59529
|
+
return tB - tA;
|
|
59530
|
+
});
|
|
59531
|
+
const inProgress = [ExecutionStatus.PENDING, ExecutionStatus.WAITING, ExecutionStatus.DELAYED];
|
|
59532
|
+
const terminal = [ExecutionStatus.SUCCEEDED, ExecutionStatus.FAILED];
|
|
59533
|
+
let target = null;
|
|
59534
|
+
for (const ex of sorted) {
|
|
59535
|
+
const t11 = ex.created_at ? new Date(ex.created_at) : null;
|
|
59536
|
+
if (!t11 || t11 < cutoff) continue;
|
|
59537
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59538
|
+
if (!prev) {
|
|
59539
|
+
target = ex;
|
|
59540
|
+
break;
|
|
59541
|
+
}
|
|
59542
|
+
if (inProgress.includes(prev) && terminal.includes(ex.status)) {
|
|
59543
|
+
target = ex;
|
|
59544
|
+
break;
|
|
59545
|
+
}
|
|
59546
|
+
}
|
|
59547
|
+
if (target) {
|
|
59548
|
+
const ex = target;
|
|
59549
|
+
const exTime = ex.created_at ? new Date(ex.created_at) : null;
|
|
59550
|
+
if (!exTime || exTime < enabledAtRef.current) return;
|
|
59551
|
+
const prev = trackedRef.current.get(ex.id);
|
|
59552
|
+
trackedRef.current.set(ex.id, ex.status);
|
|
59553
|
+
setExecutions((list) => {
|
|
59554
|
+
const idx = list.findIndex((e) => e.id === ex.id);
|
|
59555
|
+
if (idx >= 0) {
|
|
59556
|
+
const u = [...list];
|
|
59557
|
+
u[idx] = ex;
|
|
59558
|
+
return u;
|
|
59559
|
+
}
|
|
59560
|
+
return [...list, ex];
|
|
59561
|
+
});
|
|
59562
|
+
if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
59563
|
+
onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
|
|
59564
|
+
} else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
|
|
59565
|
+
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
59566
|
+
}
|
|
59567
|
+
}
|
|
59568
|
+
} catch (error) {
|
|
59569
|
+
console.error("Failed to fetch withdraw executions:", error);
|
|
59570
|
+
onErrorRef.current?.({ message: "Failed to fetch withdrawal status", code: "POLLING_ERROR", error });
|
|
59571
|
+
}
|
|
59572
|
+
};
|
|
59573
|
+
void poll();
|
|
59574
|
+
const interval = setInterval(poll, POLL_INTERVAL_MS2);
|
|
59575
|
+
setIsPolling(true);
|
|
59576
|
+
return () => {
|
|
59577
|
+
clearInterval(interval);
|
|
59578
|
+
setIsPolling(false);
|
|
59579
|
+
};
|
|
59580
|
+
}, [userId, publishableKey, enabled]);
|
|
59581
|
+
(0, import_react28.useEffect)(() => {
|
|
59582
|
+
if (!enabled || !depositWalletId) return;
|
|
59583
|
+
const trigger = async () => {
|
|
59584
|
+
try {
|
|
59585
|
+
await pollDirectExecutions({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
59586
|
+
} catch {
|
|
59587
|
+
}
|
|
59588
|
+
};
|
|
59589
|
+
trigger();
|
|
59590
|
+
const interval = setInterval(trigger, POLL_ENDPOINT_INTERVAL_MS2);
|
|
59591
|
+
return () => clearInterval(interval);
|
|
59592
|
+
}, [enabled, depositWalletId, publishableKey]);
|
|
59593
|
+
return { executions, isPolling };
|
|
59594
|
+
}
|
|
59595
|
+
var t7 = i18n2.withdrawModal;
|
|
59596
|
+
var getChainKey4 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
59597
|
+
function WithdrawDoubleInput({
|
|
59598
|
+
tokens,
|
|
59599
|
+
selectedTokenSymbol,
|
|
59600
|
+
selectedChainKey,
|
|
59601
|
+
onTokenChange,
|
|
59602
|
+
onChainChange,
|
|
59603
|
+
isLoading = false
|
|
59604
|
+
}) {
|
|
59605
|
+
const { fonts, components } = useTheme();
|
|
59606
|
+
const isDarkMode = useTheme().themeClass.includes("uf-dark");
|
|
59607
|
+
const selectedToken = selectedTokenSymbol ? tokens.find((t11) => t11.symbol === selectedTokenSymbol) : void 0;
|
|
59608
|
+
const availableChainsForToken = selectedToken?.chains || [];
|
|
59609
|
+
const renderTokenItem = (tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59610
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59611
|
+
"img",
|
|
59612
|
+
{
|
|
59613
|
+
src: tokenData.icon_url,
|
|
59614
|
+
alt: tokenData.symbol,
|
|
59615
|
+
width: 20,
|
|
59616
|
+
height: 20,
|
|
59617
|
+
loading: "lazy",
|
|
59618
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59619
|
+
}
|
|
59620
|
+
),
|
|
59621
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: tokenData.symbol })
|
|
59622
|
+
] });
|
|
59623
|
+
const renderChainItem = (chainData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
59624
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59625
|
+
"img",
|
|
59626
|
+
{
|
|
59627
|
+
src: chainData.icon_url,
|
|
59628
|
+
alt: chainData.chain_name,
|
|
59629
|
+
width: 20,
|
|
59630
|
+
height: 20,
|
|
59631
|
+
loading: "lazy",
|
|
59632
|
+
className: "uf-rounded-full uf-flex-shrink-0"
|
|
59633
|
+
}
|
|
59634
|
+
),
|
|
59635
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chainData.chain_name })
|
|
59636
|
+
] });
|
|
59637
|
+
const currentChainData = selectedChainKey ? availableChainsForToken.find(
|
|
59638
|
+
(c) => getChainKey4(c.chain_id, c.chain_type) === selectedChainKey
|
|
59639
|
+
) : void 0;
|
|
59640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-grid uf-grid-cols-2 uf-gap-2.5", children: [
|
|
59641
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59642
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59643
|
+
"div",
|
|
59644
|
+
{
|
|
59645
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59646
|
+
style: { color: components.card.labelColor },
|
|
59647
|
+
children: t7.receiveToken
|
|
59648
|
+
}
|
|
59649
|
+
),
|
|
59650
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59651
|
+
Select2,
|
|
59652
|
+
{
|
|
59653
|
+
value: selectedTokenSymbol ?? "",
|
|
59654
|
+
onValueChange: onTokenChange,
|
|
59655
|
+
disabled: isLoading || tokens.length === 0,
|
|
59656
|
+
children: [
|
|
59657
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59658
|
+
SelectTrigger2,
|
|
59659
|
+
{
|
|
59660
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59661
|
+
style: {
|
|
59662
|
+
backgroundColor: components.card.backgroundColor,
|
|
59663
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59664
|
+
},
|
|
59665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectValue2, { children: isLoading || !selectedTokenSymbol ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : selectedToken ? renderTokenItem(selectedToken) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: selectedTokenSymbol }) })
|
|
59666
|
+
}
|
|
59667
|
+
),
|
|
59668
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59669
|
+
SelectContent2,
|
|
59670
|
+
{
|
|
59671
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]",
|
|
59672
|
+
style: {
|
|
59673
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59674
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59675
|
+
},
|
|
59676
|
+
children: tokens.map((tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59677
|
+
SelectItem2,
|
|
59678
|
+
{
|
|
59679
|
+
value: tokenData.symbol,
|
|
59680
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59681
|
+
children: renderTokenItem(tokenData)
|
|
59682
|
+
},
|
|
59683
|
+
tokenData.symbol
|
|
59684
|
+
))
|
|
59685
|
+
}
|
|
59686
|
+
)
|
|
59687
|
+
]
|
|
59688
|
+
}
|
|
59689
|
+
)
|
|
59690
|
+
] }),
|
|
59691
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
|
|
59692
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59693
|
+
"div",
|
|
59694
|
+
{
|
|
59695
|
+
className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
|
|
59696
|
+
style: { color: components.card.labelColor },
|
|
59697
|
+
children: t7.receiveChain
|
|
59698
|
+
}
|
|
59699
|
+
),
|
|
59700
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
59701
|
+
Select2,
|
|
59702
|
+
{
|
|
59703
|
+
value: selectedChainKey ?? "",
|
|
59704
|
+
onValueChange: onChainChange,
|
|
59705
|
+
disabled: isLoading || availableChainsForToken.length === 0,
|
|
59706
|
+
children: [
|
|
59707
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59708
|
+
SelectTrigger2,
|
|
59709
|
+
{
|
|
59710
|
+
className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
|
|
59711
|
+
style: {
|
|
59712
|
+
backgroundColor: components.card.backgroundColor,
|
|
59713
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
59714
|
+
},
|
|
59715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectValue2, { children: isLoading || !selectedChainKey ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t7.loading }) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: selectedChainKey }) })
|
|
59716
|
+
}
|
|
59717
|
+
),
|
|
59718
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59719
|
+
SelectContent2,
|
|
59720
|
+
{
|
|
59721
|
+
align: "end",
|
|
59722
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
59723
|
+
style: {
|
|
59724
|
+
border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
|
|
59725
|
+
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
59726
|
+
},
|
|
59727
|
+
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: "No chains available" }) : availableChainsForToken.map((chainData) => {
|
|
59728
|
+
const chainKey = getChainKey4(chainData.chain_id, chainData.chain_type);
|
|
59729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
59730
|
+
SelectItem2,
|
|
59731
|
+
{
|
|
59732
|
+
value: chainKey,
|
|
59733
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
59734
|
+
children: renderChainItem(chainData)
|
|
59735
|
+
},
|
|
59736
|
+
chainKey
|
|
59737
|
+
);
|
|
59738
|
+
})
|
|
59739
|
+
}
|
|
59740
|
+
)
|
|
59741
|
+
]
|
|
59742
|
+
}
|
|
59743
|
+
)
|
|
59744
|
+
] })
|
|
59745
|
+
] });
|
|
59746
|
+
}
|
|
59747
|
+
function useVerifyRecipientAddress(params) {
|
|
59748
|
+
const {
|
|
59749
|
+
chainType,
|
|
59750
|
+
chainId,
|
|
59751
|
+
tokenAddress,
|
|
59752
|
+
recipientAddress,
|
|
59753
|
+
publishableKey,
|
|
59754
|
+
enabled = true
|
|
59755
|
+
} = params;
|
|
59756
|
+
const trimmedAddress = recipientAddress?.trim() || "";
|
|
59757
|
+
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
59758
|
+
return useQuery({
|
|
59759
|
+
queryKey: [
|
|
59760
|
+
"unifold",
|
|
59761
|
+
"verifyRecipientAddress",
|
|
59762
|
+
chainType ?? null,
|
|
59763
|
+
chainId ?? null,
|
|
59764
|
+
tokenAddress ?? null,
|
|
59765
|
+
trimmedAddress,
|
|
59766
|
+
publishableKey
|
|
59767
|
+
],
|
|
59768
|
+
queryFn: () => verifyRecipientAddress(
|
|
59769
|
+
{
|
|
59770
|
+
chain_type: chainType,
|
|
59771
|
+
chain_id: chainId,
|
|
59772
|
+
token_address: tokenAddress,
|
|
59773
|
+
recipient_address: trimmedAddress
|
|
59774
|
+
},
|
|
59775
|
+
publishableKey
|
|
59776
|
+
),
|
|
59777
|
+
enabled: enabled && hasAllParams,
|
|
59778
|
+
staleTime: 1e3 * 60 * 5,
|
|
59779
|
+
gcTime: 1e3 * 60 * 30,
|
|
59780
|
+
retry: 1,
|
|
59781
|
+
refetchOnMount: false,
|
|
59782
|
+
refetchOnWindowFocus: false
|
|
59783
|
+
});
|
|
59784
|
+
}
|
|
59785
|
+
async function sendEvmWithdraw(params) {
|
|
59786
|
+
const {
|
|
59787
|
+
provider,
|
|
59788
|
+
fromAddress,
|
|
59789
|
+
depositWalletAddress,
|
|
59790
|
+
sourceTokenAddress,
|
|
59791
|
+
sourceChainId,
|
|
59792
|
+
amountBaseUnit
|
|
59793
|
+
} = params;
|
|
59794
|
+
const currentChainIdHex = await provider.request({
|
|
59795
|
+
method: "eth_chainId",
|
|
59796
|
+
params: []
|
|
59797
|
+
});
|
|
59798
|
+
const currentChainId = parseInt(currentChainIdHex, 16).toString();
|
|
59799
|
+
if (currentChainId !== sourceChainId) {
|
|
59800
|
+
const requiredHex = "0x" + parseInt(sourceChainId).toString(16);
|
|
59801
|
+
try {
|
|
59802
|
+
await provider.request({
|
|
59803
|
+
method: "wallet_switchEthereumChain",
|
|
59804
|
+
params: [{ chainId: requiredHex }]
|
|
59805
|
+
});
|
|
59806
|
+
const newHex = await provider.request({ method: "eth_chainId", params: [] });
|
|
59807
|
+
if (parseInt(newHex, 16).toString() !== sourceChainId) {
|
|
59808
|
+
throw new Error(`Failed to switch to chain ${sourceChainId}. Please switch manually.`);
|
|
59809
|
+
}
|
|
59810
|
+
} catch (err) {
|
|
59811
|
+
if (err && typeof err === "object" && "code" in err) {
|
|
59812
|
+
const e = err;
|
|
59813
|
+
if (e.code === 4902) throw new Error(`Chain ${sourceChainId} is not configured in your wallet.`);
|
|
59814
|
+
if (e.code === 4001) throw new Error("You must approve the network switch to withdraw.");
|
|
59815
|
+
}
|
|
59816
|
+
throw err;
|
|
59817
|
+
}
|
|
59818
|
+
}
|
|
59819
|
+
const isNative = sourceTokenAddress === "native" || sourceTokenAddress === "0x0000000000000000000000000000000000000000" || sourceTokenAddress === "";
|
|
59820
|
+
const amountBig = BigInt(amountBaseUnit);
|
|
59821
|
+
const txParams = isNative ? { from: fromAddress, to: depositWalletAddress, value: "0x" + amountBig.toString(16) } : {
|
|
59822
|
+
from: fromAddress,
|
|
59823
|
+
to: sourceTokenAddress,
|
|
59824
|
+
data: "0xa9059cbb" + depositWalletAddress.slice(2).padStart(64, "0") + amountBig.toString(16).padStart(64, "0")
|
|
59825
|
+
};
|
|
59826
|
+
let gasEstimate;
|
|
59827
|
+
try {
|
|
59828
|
+
const hex = await provider.request({ method: "eth_estimateGas", params: [txParams] });
|
|
59829
|
+
gasEstimate = BigInt(hex);
|
|
59830
|
+
} catch {
|
|
59831
|
+
gasEstimate = isNative ? BigInt(21e3) : BigInt(65e3);
|
|
59832
|
+
}
|
|
59833
|
+
const gasPrice = BigInt(await provider.request({ method: "eth_gasPrice", params: [] }));
|
|
59834
|
+
const gasWithBuffer = gasEstimate * BigInt(120) / BigInt(100);
|
|
59835
|
+
const gasCost = gasWithBuffer * gasPrice;
|
|
59836
|
+
const ethBalance = BigInt(
|
|
59837
|
+
await provider.request({ method: "eth_getBalance", params: [fromAddress, "latest"] })
|
|
59838
|
+
);
|
|
59839
|
+
const totalRequired = isNative ? gasCost + amountBig : gasCost;
|
|
59840
|
+
if (ethBalance < totalRequired) {
|
|
59841
|
+
const gasFmt = (Number(gasCost) / 1e18).toFixed(6);
|
|
59842
|
+
if (isNative) {
|
|
59843
|
+
throw new Error(`Insufficient balance. Need ${(Number(totalRequired) / 1e18).toFixed(6)} ETH (amount + ~${gasFmt} gas).`);
|
|
59844
|
+
}
|
|
59845
|
+
throw new Error(`Insufficient ETH for gas. Need ~${gasFmt} ETH for fees.`);
|
|
59846
|
+
}
|
|
59847
|
+
const txHash = await provider.request({ method: "eth_sendTransaction", params: [txParams] });
|
|
59848
|
+
return txHash;
|
|
59849
|
+
}
|
|
59850
|
+
async function sendSolanaWithdraw(params) {
|
|
59851
|
+
const {
|
|
59852
|
+
provider,
|
|
59853
|
+
fromAddress,
|
|
59854
|
+
depositWalletAddress,
|
|
59855
|
+
sourceTokenAddress,
|
|
59856
|
+
amountBaseUnit,
|
|
59857
|
+
publishableKey
|
|
59858
|
+
} = params;
|
|
59859
|
+
if (!provider.publicKey) {
|
|
59860
|
+
await provider.connect();
|
|
59861
|
+
}
|
|
59862
|
+
const buildResponse = await buildSolanaTransaction(
|
|
59863
|
+
{
|
|
59864
|
+
chain_id: "mainnet",
|
|
59865
|
+
token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
|
|
59866
|
+
source_address: fromAddress,
|
|
59867
|
+
destination_address: depositWalletAddress,
|
|
59868
|
+
amount: amountBaseUnit
|
|
59869
|
+
},
|
|
59870
|
+
publishableKey
|
|
59871
|
+
);
|
|
59872
|
+
const { VersionedTransaction } = await import(
|
|
59873
|
+
/* @vite-ignore */
|
|
59874
|
+
"@solana/web3.js"
|
|
59875
|
+
);
|
|
59876
|
+
const binaryString = atob(buildResponse.transaction);
|
|
59877
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
59878
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
59879
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
59880
|
+
}
|
|
59881
|
+
const transaction = VersionedTransaction.deserialize(bytes);
|
|
59882
|
+
const signedTransaction = await provider.signTransaction(transaction);
|
|
59883
|
+
const serialized = signedTransaction.serialize();
|
|
59884
|
+
let binaryStr = "";
|
|
59885
|
+
for (let i = 0; i < serialized.length; i++) {
|
|
59886
|
+
binaryStr += String.fromCharCode(serialized[i]);
|
|
59887
|
+
}
|
|
59888
|
+
const sendResponse = await sendSolanaTransaction(
|
|
59889
|
+
{ chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
|
|
59890
|
+
publishableKey
|
|
59891
|
+
);
|
|
59892
|
+
return sendResponse.signature;
|
|
59893
|
+
}
|
|
59894
|
+
async function detectBrowserWallet(chainType, senderAddress) {
|
|
59895
|
+
const win = typeof window !== "undefined" ? window : null;
|
|
59896
|
+
if (!win || !senderAddress) return null;
|
|
59897
|
+
const anyWin = win;
|
|
59898
|
+
if (chainType === "solana") {
|
|
59899
|
+
const solProviders = [];
|
|
59900
|
+
if (win.phantom?.solana) solProviders.push({ provider: win.phantom.solana, name: "Phantom" });
|
|
59901
|
+
if (anyWin.solflare) solProviders.push({ provider: anyWin.solflare, name: "Solflare" });
|
|
59902
|
+
if (anyWin.backpack) solProviders.push({ provider: anyWin.backpack, name: "Backpack" });
|
|
59903
|
+
if (anyWin.trustwallet?.solana) solProviders.push({ provider: anyWin.trustwallet.solana, name: "Trust Wallet" });
|
|
59904
|
+
for (const { provider, name } of solProviders) {
|
|
59905
|
+
if (!provider) continue;
|
|
59906
|
+
try {
|
|
59907
|
+
let addr;
|
|
59908
|
+
if (provider.isConnected && provider.publicKey) {
|
|
59909
|
+
addr = provider.publicKey.toString();
|
|
59910
|
+
} else {
|
|
59911
|
+
const resp = await provider.connect({ onlyIfTrusted: true });
|
|
59912
|
+
if (resp?.publicKey) addr = resp.publicKey.toString();
|
|
59913
|
+
}
|
|
59914
|
+
if (addr && addr === senderAddress) {
|
|
59915
|
+
return { chainFamily: "solana", provider, name, address: addr };
|
|
59916
|
+
}
|
|
59917
|
+
} catch {
|
|
59918
|
+
}
|
|
59919
|
+
}
|
|
59920
|
+
}
|
|
59921
|
+
if (chainType === "ethereum") {
|
|
59922
|
+
const evmProviders = [];
|
|
59923
|
+
const seen = /* @__PURE__ */ new Set();
|
|
59924
|
+
const add = (p, name) => {
|
|
59925
|
+
if (p && typeof p.request === "function" && !seen.has(p)) {
|
|
59926
|
+
seen.add(p);
|
|
59927
|
+
evmProviders.push({ provider: p, name });
|
|
59928
|
+
}
|
|
59929
|
+
};
|
|
59930
|
+
add(anyWin.phantom?.ethereum, "Phantom");
|
|
59931
|
+
add(anyWin.coinbaseWalletExtension, "Coinbase");
|
|
59932
|
+
add(anyWin.trustwallet?.ethereum, "Trust Wallet");
|
|
59933
|
+
add(anyWin.okxwallet, "OKX Wallet");
|
|
59934
|
+
if (anyWin.__eip6963Providers) {
|
|
59935
|
+
for (const detail of anyWin.__eip6963Providers) {
|
|
59936
|
+
const rdns = detail.info?.rdns || "";
|
|
59937
|
+
let name = detail.info?.name || "Wallet";
|
|
59938
|
+
if (rdns.includes("metamask")) name = "MetaMask";
|
|
59939
|
+
else if (rdns.includes("rabby")) name = "Rabby";
|
|
59940
|
+
else if (rdns.includes("rainbow")) name = "Rainbow";
|
|
59941
|
+
add(detail.provider, name);
|
|
59942
|
+
}
|
|
59943
|
+
}
|
|
59944
|
+
if (win.ethereum) {
|
|
59945
|
+
const eth = win.ethereum;
|
|
59946
|
+
let name = "Wallet";
|
|
59947
|
+
if (eth.isMetaMask && !eth.isPhantom && !eth.isRabby) name = "MetaMask";
|
|
59948
|
+
else if (eth.isRabby) name = "Rabby";
|
|
59949
|
+
else if (eth.isRainbow) name = "Rainbow";
|
|
59950
|
+
else if (eth.isCoinbaseWallet) name = "Coinbase";
|
|
59951
|
+
add(eth, name);
|
|
59952
|
+
}
|
|
59953
|
+
for (const { provider, name } of evmProviders) {
|
|
59954
|
+
try {
|
|
59955
|
+
const accounts = await provider.request({ method: "eth_accounts" });
|
|
59956
|
+
if (accounts?.length > 0 && accounts[0].toLowerCase() === senderAddress.toLowerCase()) {
|
|
59957
|
+
return { chainFamily: "evm", provider, name, address: accounts[0] };
|
|
59958
|
+
}
|
|
59959
|
+
} catch {
|
|
59960
|
+
}
|
|
59961
|
+
}
|
|
59962
|
+
}
|
|
59963
|
+
return null;
|
|
59964
|
+
}
|
|
59965
|
+
var t8 = i18n2.withdrawModal;
|
|
59966
|
+
var tCrypto = i18n2.transferCrypto;
|
|
59967
|
+
function formatProcessingTime2(seconds) {
|
|
59968
|
+
if (seconds === null) {
|
|
59969
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
|
|
59970
|
+
}
|
|
59971
|
+
const minutes = Math.ceil(seconds / 60);
|
|
59972
|
+
if (minutes < 60) {
|
|
59973
|
+
return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", String(minutes));
|
|
59974
|
+
}
|
|
59975
|
+
const hours = Math.ceil(minutes / 60);
|
|
59976
|
+
return tCrypto.processingTime.lessThanHours.replace("{{hours}}", String(hours));
|
|
59977
|
+
}
|
|
59978
|
+
function computeBaseUnit(balanceBaseUnit, inputAmount, balanceAmount) {
|
|
59979
|
+
if (balanceAmount <= 0 || inputAmount <= 0) return "0";
|
|
59980
|
+
if (inputAmount >= balanceAmount) return balanceBaseUnit;
|
|
59981
|
+
const PRECISION = 10n ** 18n;
|
|
59982
|
+
const ratioScaled = BigInt(Math.round(inputAmount / balanceAmount * Number(PRECISION)));
|
|
59983
|
+
const result = BigInt(balanceBaseUnit) * ratioScaled / PRECISION;
|
|
59984
|
+
return result.toString();
|
|
59985
|
+
}
|
|
59986
|
+
function toSafeDecimalString(n, maxDecimals) {
|
|
59987
|
+
if (n === 0) return "0";
|
|
59988
|
+
return n.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
59989
|
+
}
|
|
59990
|
+
function WithdrawForm({
|
|
59991
|
+
publishableKey,
|
|
59992
|
+
externalUserId,
|
|
59993
|
+
sourceChainType,
|
|
59994
|
+
selectedToken,
|
|
59995
|
+
selectedChain,
|
|
59996
|
+
sourceTokenSymbol,
|
|
59997
|
+
recipientAddressProp,
|
|
59998
|
+
balanceData,
|
|
59999
|
+
isLoadingBalance,
|
|
60000
|
+
minimumWithdrawAmountUsd,
|
|
60001
|
+
estimatedProcessingTime,
|
|
60002
|
+
maxSlippagePercent,
|
|
60003
|
+
priceImpactPercent,
|
|
60004
|
+
detectedWallet,
|
|
60005
|
+
sourceChainId,
|
|
60006
|
+
sourceTokenAddress,
|
|
60007
|
+
isWalletMatch,
|
|
60008
|
+
connectedWalletName,
|
|
60009
|
+
canWithdraw,
|
|
60010
|
+
onWithdraw,
|
|
60011
|
+
onWithdrawError,
|
|
60012
|
+
onDepositWalletCreation,
|
|
60013
|
+
onWithdrawSubmitted,
|
|
60014
|
+
footerLeft
|
|
60015
|
+
}) {
|
|
60016
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60017
|
+
const [recipientAddress, setRecipientAddress] = (0, import_react29.useState)(recipientAddressProp || "");
|
|
60018
|
+
const [amount, setAmount] = (0, import_react29.useState)("");
|
|
60019
|
+
const [inputUnit, setInputUnit] = (0, import_react29.useState)("crypto");
|
|
60020
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
|
|
60021
|
+
const [submitError, setSubmitError] = (0, import_react29.useState)(null);
|
|
60022
|
+
const [detailsExpanded, setDetailsExpanded] = (0, import_react29.useState)(false);
|
|
60023
|
+
const [glossaryOpen, setGlossaryOpen] = (0, import_react29.useState)(false);
|
|
60024
|
+
(0, import_react29.useEffect)(() => {
|
|
60025
|
+
setRecipientAddress(recipientAddressProp || "");
|
|
60026
|
+
setAmount("");
|
|
60027
|
+
setInputUnit("crypto");
|
|
60028
|
+
setSubmitError(null);
|
|
60029
|
+
}, [recipientAddressProp]);
|
|
60030
|
+
const trimmedAddress = recipientAddress.trim();
|
|
60031
|
+
const [debouncedAddress, setDebouncedAddress] = (0, import_react29.useState)(trimmedAddress);
|
|
60032
|
+
(0, import_react29.useEffect)(() => {
|
|
60033
|
+
const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
|
|
60034
|
+
return () => clearTimeout(id);
|
|
60035
|
+
}, [trimmedAddress]);
|
|
60036
|
+
const {
|
|
60037
|
+
data: addressVerification,
|
|
60038
|
+
isLoading: isVerifyingAddress,
|
|
60039
|
+
error: verifyError
|
|
60040
|
+
} = useVerifyRecipientAddress({
|
|
60041
|
+
chainType: selectedChain?.chain_type,
|
|
60042
|
+
chainId: selectedChain?.chain_id,
|
|
60043
|
+
tokenAddress: selectedChain?.token_address,
|
|
60044
|
+
recipientAddress: debouncedAddress,
|
|
60045
|
+
publishableKey,
|
|
60046
|
+
enabled: debouncedAddress.length > 5 && !!selectedChain
|
|
60047
|
+
});
|
|
60048
|
+
const isDebouncing = trimmedAddress !== debouncedAddress;
|
|
60049
|
+
const addressError = (0, import_react29.useMemo)(() => {
|
|
60050
|
+
if (!trimmedAddress || trimmedAddress.length <= 5) return null;
|
|
60051
|
+
if (isDebouncing || isVerifyingAddress) return null;
|
|
60052
|
+
if (verifyError) return t8.invalidAddress;
|
|
60053
|
+
if (addressVerification && !addressVerification.valid) {
|
|
60054
|
+
if (addressVerification.failure_code === "account_not_found")
|
|
60055
|
+
return `Account not found on ${selectedChain?.chain_name}`;
|
|
60056
|
+
if (addressVerification.failure_code === "not_opted_in")
|
|
60057
|
+
return `Recipient has not opted in to ${selectedToken?.symbol} on ${selectedChain?.chain_name}`;
|
|
60058
|
+
return t8.invalidAddress;
|
|
60059
|
+
}
|
|
60060
|
+
return null;
|
|
60061
|
+
}, [trimmedAddress, isDebouncing, isVerifyingAddress, verifyError, addressVerification, selectedChain, selectedToken]);
|
|
60062
|
+
const isAddressValid = !isDebouncing && !!addressVerification?.valid && !addressError;
|
|
60063
|
+
const exchangeRate = (0, import_react29.useMemo)(() => {
|
|
60064
|
+
if (!balanceData?.exchangeRate) return 0;
|
|
60065
|
+
return parseFloat(balanceData.exchangeRate);
|
|
60066
|
+
}, [balanceData]);
|
|
60067
|
+
const balanceCrypto = (0, import_react29.useMemo)(() => {
|
|
60068
|
+
if (!balanceData?.balanceHuman) return 0;
|
|
60069
|
+
return parseFloat(balanceData.balanceHuman);
|
|
60070
|
+
}, [balanceData]);
|
|
60071
|
+
const balanceUsdNum = (0, import_react29.useMemo)(() => {
|
|
60072
|
+
if (!balanceData?.balanceUsd) return 0;
|
|
60073
|
+
return parseFloat(balanceData.balanceUsd);
|
|
60074
|
+
}, [balanceData]);
|
|
60075
|
+
const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
|
|
60076
|
+
const sourceDecimals = balanceData?.decimals ?? 6;
|
|
60077
|
+
const cryptoAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60078
|
+
const val = parseFloat(amount);
|
|
60079
|
+
if (!val || val <= 0) return 0;
|
|
60080
|
+
if (inputUnit === "crypto") return val;
|
|
60081
|
+
return exchangeRate > 0 ? val / exchangeRate : 0;
|
|
60082
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60083
|
+
const fiatAmountFromInput = (0, import_react29.useMemo)(() => {
|
|
60084
|
+
const val = parseFloat(amount);
|
|
60085
|
+
if (!val || val <= 0) return 0;
|
|
60086
|
+
if (inputUnit === "fiat") return val;
|
|
60087
|
+
return val * exchangeRate;
|
|
60088
|
+
}, [amount, inputUnit, exchangeRate]);
|
|
60089
|
+
const convertedDisplay = (0, import_react29.useMemo)(() => {
|
|
60090
|
+
if (!amount || parseFloat(amount) <= 0) return null;
|
|
60091
|
+
if (inputUnit === "crypto") {
|
|
60092
|
+
return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60093
|
+
}
|
|
60094
|
+
return `${cryptoAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 6 })} ${tokenSymbol}`;
|
|
60095
|
+
}, [amount, inputUnit, fiatAmountFromInput, cryptoAmountFromInput, tokenSymbol]);
|
|
60096
|
+
const balanceDisplay = (0, import_react29.useMemo)(() => {
|
|
60097
|
+
if (isLoadingBalance || !balanceData) return null;
|
|
60098
|
+
if (inputUnit === "crypto") {
|
|
60099
|
+
return `${balanceCrypto.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${tokenSymbol}`;
|
|
60100
|
+
}
|
|
60101
|
+
return `$${balanceUsdNum.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
60102
|
+
}, [isLoadingBalance, balanceData, inputUnit, balanceCrypto, balanceUsdNum, tokenSymbol]);
|
|
60103
|
+
const handleSwitchUnit = (0, import_react29.useCallback)(() => {
|
|
60104
|
+
const val = parseFloat(amount);
|
|
60105
|
+
if (!val || val <= 0 || exchangeRate <= 0) {
|
|
60106
|
+
setInputUnit((u) => u === "crypto" ? "fiat" : "crypto");
|
|
60107
|
+
setAmount("");
|
|
60108
|
+
return;
|
|
60109
|
+
}
|
|
60110
|
+
if (inputUnit === "crypto") {
|
|
60111
|
+
const fiat = val * exchangeRate;
|
|
60112
|
+
setAmount(fiat.toFixed(2));
|
|
60113
|
+
setInputUnit("fiat");
|
|
60114
|
+
} else {
|
|
60115
|
+
const crypto = val / exchangeRate;
|
|
60116
|
+
setAmount(crypto.toFixed(sourceDecimals > 6 ? 6 : sourceDecimals));
|
|
60117
|
+
setInputUnit("crypto");
|
|
60118
|
+
}
|
|
60119
|
+
}, [amount, inputUnit, exchangeRate, sourceDecimals]);
|
|
60120
|
+
const handleMaxClick = (0, import_react29.useCallback)(() => {
|
|
60121
|
+
if (inputUnit === "crypto") {
|
|
60122
|
+
if (balanceCrypto <= 0) return;
|
|
60123
|
+
setAmount(balanceData?.balanceHuman ?? "0");
|
|
60124
|
+
} else {
|
|
60125
|
+
if (balanceUsdNum <= 0) return;
|
|
60126
|
+
setAmount((Math.floor(balanceUsdNum * 100) / 100).toFixed(2));
|
|
60127
|
+
}
|
|
60128
|
+
}, [inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60129
|
+
const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && fiatAmountFromInput < minimumWithdrawAmountUsd;
|
|
60130
|
+
const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && fiatAmountFromInput > balanceUsdNum;
|
|
60131
|
+
const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !!balanceData;
|
|
60132
|
+
const handleWithdraw = (0, import_react29.useCallback)(async () => {
|
|
60133
|
+
if (!selectedToken || !selectedChain) return;
|
|
60134
|
+
if (!isFormValid) return;
|
|
60135
|
+
setIsSubmitting(true);
|
|
60136
|
+
setSubmitError(null);
|
|
60137
|
+
try {
|
|
60138
|
+
const depositWallet = await onDepositWalletCreation({
|
|
60139
|
+
destinationChainType: selectedChain.chain_type,
|
|
60140
|
+
destinationChainId: selectedChain.chain_id,
|
|
60141
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60142
|
+
recipientAddress: trimmedAddress
|
|
60143
|
+
});
|
|
60144
|
+
const amountBaseUnit = computeBaseUnit(
|
|
60145
|
+
balanceData.balanceBaseUnit,
|
|
60146
|
+
parseFloat(amount),
|
|
60147
|
+
inputUnit === "crypto" ? balanceCrypto : balanceUsdNum
|
|
60148
|
+
);
|
|
60149
|
+
const humanAmount = toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
60150
|
+
const txInfo = {
|
|
60151
|
+
sourceChainType,
|
|
60152
|
+
sourceChainId,
|
|
60153
|
+
sourceTokenAddress,
|
|
60154
|
+
sourceTokenSymbol: tokenSymbol,
|
|
60155
|
+
destinationChainType: selectedChain.chain_type,
|
|
60156
|
+
destinationChainId: selectedChain.chain_id,
|
|
60157
|
+
destinationTokenAddress: selectedChain.token_address,
|
|
60158
|
+
destinationTokenSymbol: selectedToken.symbol,
|
|
60159
|
+
amount: humanAmount,
|
|
60160
|
+
amountBaseUnit,
|
|
60161
|
+
withdrawIntentAddress: depositWallet.address,
|
|
60162
|
+
recipientAddress: trimmedAddress
|
|
60163
|
+
};
|
|
60164
|
+
if (detectedWallet) {
|
|
60165
|
+
if (detectedWallet.chainFamily === "evm") {
|
|
60166
|
+
await sendEvmWithdraw({
|
|
60167
|
+
provider: detectedWallet.provider,
|
|
60168
|
+
fromAddress: detectedWallet.address,
|
|
60169
|
+
depositWalletAddress: depositWallet.address,
|
|
60170
|
+
sourceTokenAddress,
|
|
60171
|
+
sourceChainId,
|
|
60172
|
+
amountBaseUnit
|
|
60173
|
+
});
|
|
60174
|
+
} else if (detectedWallet.chainFamily === "solana") {
|
|
60175
|
+
await sendSolanaWithdraw({
|
|
60176
|
+
provider: detectedWallet.provider,
|
|
60177
|
+
fromAddress: detectedWallet.address,
|
|
60178
|
+
depositWalletAddress: depositWallet.address,
|
|
60179
|
+
sourceTokenAddress,
|
|
60180
|
+
amountBaseUnit,
|
|
60181
|
+
publishableKey
|
|
60182
|
+
});
|
|
60183
|
+
}
|
|
60184
|
+
} else if (onWithdraw) {
|
|
60185
|
+
await onWithdraw(txInfo);
|
|
60186
|
+
} else {
|
|
60187
|
+
throw new Error("No withdrawal method available. Please connect a wallet.");
|
|
60188
|
+
}
|
|
60189
|
+
onWithdrawSubmitted?.(txInfo);
|
|
60190
|
+
} catch (err) {
|
|
60191
|
+
const raw = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
|
|
60192
|
+
setSubmitError(raw.length > 120 ? "Withdrawal failed. Please try again." : raw);
|
|
60193
|
+
onWithdrawError?.({
|
|
60194
|
+
message: raw,
|
|
60195
|
+
error: err,
|
|
60196
|
+
code: "WITHDRAW_FAILED"
|
|
60197
|
+
});
|
|
60198
|
+
} finally {
|
|
60199
|
+
setIsSubmitting(false);
|
|
60200
|
+
}
|
|
60201
|
+
}, [selectedToken, selectedChain, isFormValid, cryptoAmountFromInput, sourceDecimals, trimmedAddress, publishableKey, onWithdraw, detectedWallet, sourceTokenAddress, sourceChainId, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, amount, inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
|
|
60202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60203
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60204
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60205
|
+
"div",
|
|
60206
|
+
{
|
|
60207
|
+
className: "uf-text-xs uf-mb-1.5",
|
|
60208
|
+
style: { color: components.card.labelColor, fontFamily: fonts.medium },
|
|
60209
|
+
children: t8.recipientAddress
|
|
60210
|
+
}
|
|
60211
|
+
),
|
|
60212
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60213
|
+
"style",
|
|
60214
|
+
{
|
|
60215
|
+
dangerouslySetInnerHTML: {
|
|
60216
|
+
__html: `.uf-withdraw-addr::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60217
|
+
}
|
|
60218
|
+
}
|
|
60219
|
+
),
|
|
60220
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60221
|
+
"div",
|
|
60222
|
+
{
|
|
60223
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-pr-2",
|
|
60224
|
+
style: {
|
|
60225
|
+
backgroundColor: components.search.backgroundColor,
|
|
60226
|
+
borderRadius: components.input.borderRadius,
|
|
60227
|
+
border: `${components.input.borderWidth}px solid ${addressError ? colors2.error : components.input.borderColor}`
|
|
60228
|
+
},
|
|
60229
|
+
children: [
|
|
60230
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60231
|
+
"input",
|
|
60232
|
+
{
|
|
60233
|
+
type: "text",
|
|
60234
|
+
placeholder: t8.recipientAddressPlaceholder,
|
|
60235
|
+
value: recipientAddress,
|
|
60236
|
+
onChange: (e) => {
|
|
60237
|
+
setRecipientAddress(e.target.value);
|
|
60238
|
+
setSubmitError(null);
|
|
60239
|
+
},
|
|
60240
|
+
className: "uf-withdraw-addr uf-flex-1 uf-min-w-0 uf-px-3 uf-py-2.5 uf-text-sm uf-bg-transparent uf-outline-none",
|
|
60241
|
+
style: {
|
|
60242
|
+
color: components.search.inputColor,
|
|
60243
|
+
fontFamily: fonts.regular
|
|
60244
|
+
}
|
|
60245
|
+
}
|
|
60246
|
+
),
|
|
60247
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60248
|
+
"button",
|
|
60249
|
+
{
|
|
60250
|
+
type: "button",
|
|
60251
|
+
onClick: async () => {
|
|
60252
|
+
try {
|
|
60253
|
+
const text = await navigator.clipboard.readText();
|
|
60254
|
+
if (text) {
|
|
60255
|
+
setRecipientAddress(text.trim());
|
|
60256
|
+
setSubmitError(null);
|
|
60257
|
+
}
|
|
60258
|
+
} catch {
|
|
60259
|
+
}
|
|
60260
|
+
},
|
|
60261
|
+
className: "uf-flex-shrink-0 uf-p-1 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60262
|
+
style: { color: colors2.foregroundMuted },
|
|
60263
|
+
title: "Paste from clipboard",
|
|
60264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ClipboardPaste, { className: "uf-w-4 uf-h-4" })
|
|
60265
|
+
}
|
|
60266
|
+
)
|
|
60267
|
+
]
|
|
60268
|
+
}
|
|
60269
|
+
),
|
|
60270
|
+
(isDebouncing || isVerifyingAddress) && trimmedAddress.length > 5 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
|
|
60271
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-3 uf-h-3 uf-animate-spin", style: { color: colors2.foregroundMuted } }),
|
|
60272
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: t8.verifyingAddress })
|
|
60273
|
+
] }),
|
|
60274
|
+
addressError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
|
|
60275
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TriangleAlert, { className: "uf-w-3 uf-h-3", style: { color: colors2.error } }),
|
|
60276
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.error, fontFamily: fonts.regular }, children: addressError })
|
|
60277
|
+
] })
|
|
60278
|
+
] }),
|
|
60279
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60280
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-text-xs uf-mb-1.5", style: { color: components.card.labelColor, fontFamily: fonts.medium }, children: [
|
|
60281
|
+
t8.amount,
|
|
60282
|
+
minimumWithdrawAmountUsd != null && minimumWithdrawAmountUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: colors2.warning, fontFamily: fonts.regular }, children: ` ($${minimumWithdrawAmountUsd.toFixed(2)} min)` })
|
|
60283
|
+
] }),
|
|
60284
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60285
|
+
"style",
|
|
60286
|
+
{
|
|
60287
|
+
dangerouslySetInnerHTML: {
|
|
60288
|
+
__html: `.uf-withdraw-amt::placeholder { color: ${components.search.placeholderColor}; }`
|
|
60289
|
+
}
|
|
60290
|
+
}
|
|
60291
|
+
),
|
|
60292
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60293
|
+
"div",
|
|
60294
|
+
{
|
|
60295
|
+
className: "uf-flex uf-items-center uf-gap-2 uf-px-3 uf-py-2.5",
|
|
60296
|
+
style: {
|
|
60297
|
+
backgroundColor: components.search.backgroundColor,
|
|
60298
|
+
borderRadius: components.input.borderRadius,
|
|
60299
|
+
border: `${components.input.borderWidth}px solid ${components.input.borderColor}`
|
|
60300
|
+
},
|
|
60301
|
+
children: [
|
|
60302
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60303
|
+
"input",
|
|
60304
|
+
{
|
|
60305
|
+
type: "text",
|
|
60306
|
+
inputMode: "decimal",
|
|
60307
|
+
placeholder: "0.00",
|
|
60308
|
+
value: amount,
|
|
60309
|
+
onChange: (e) => {
|
|
60310
|
+
const val = e.target.value;
|
|
60311
|
+
if (val === "" || /^\d*\.?\d*$/.test(val)) {
|
|
60312
|
+
setAmount(val);
|
|
60313
|
+
setSubmitError(null);
|
|
60314
|
+
}
|
|
60315
|
+
},
|
|
60316
|
+
className: "uf-withdraw-amt uf-flex-1 uf-min-w-0 uf-bg-transparent uf-text-sm uf-outline-none",
|
|
60317
|
+
style: {
|
|
60318
|
+
color: components.search.inputColor,
|
|
60319
|
+
fontFamily: fonts.regular
|
|
60320
|
+
}
|
|
60321
|
+
}
|
|
60322
|
+
),
|
|
60323
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-sm uf-shrink-0", style: { color: colors2.foregroundMuted, fontFamily: fonts.medium }, children: inputUnit === "crypto" ? tokenSymbol : "USD" }),
|
|
60324
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60325
|
+
"button",
|
|
60326
|
+
{
|
|
60327
|
+
type: "button",
|
|
60328
|
+
onClick: handleMaxClick,
|
|
60329
|
+
className: "uf-shrink-0 uf-px-2 uf-py-0.5 uf-rounded-md uf-text-xs uf-font-medium uf-transition-colors hover:uf-opacity-80",
|
|
60330
|
+
style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium },
|
|
60331
|
+
children: "Max"
|
|
60332
|
+
}
|
|
60333
|
+
)
|
|
60334
|
+
]
|
|
60335
|
+
}
|
|
60336
|
+
),
|
|
60337
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-mt-1.5 uf-px-3", children: [
|
|
60338
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
60339
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: convertedDisplay || (inputUnit === "crypto" ? "$0.00" : `0.00 ${tokenSymbol}`) }),
|
|
60340
|
+
exchangeRate > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60341
|
+
"button",
|
|
60342
|
+
{
|
|
60343
|
+
type: "button",
|
|
60344
|
+
onClick: handleSwitchUnit,
|
|
60345
|
+
className: "uf-p-0.5 uf-rounded uf-transition-colors hover:uf-opacity-70",
|
|
60346
|
+
style: { color: colors2.foregroundMuted },
|
|
60347
|
+
title: "Switch unit",
|
|
60348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ArrowUpDown, { className: "uf-w-3 uf-h-3" })
|
|
60349
|
+
}
|
|
60350
|
+
)
|
|
60351
|
+
] }),
|
|
60352
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
60353
|
+
balanceDisplay && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: [
|
|
60354
|
+
t8.balance,
|
|
60355
|
+
": ",
|
|
60356
|
+
balanceDisplay
|
|
60357
|
+
] }),
|
|
60358
|
+
isLoadingBalance && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3 uf-w-16 uf-bg-muted uf-rounded uf-animate-pulse" })
|
|
60359
|
+
] })
|
|
60360
|
+
] })
|
|
60361
|
+
] }),
|
|
60362
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-px-2.5", style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` }, children: [
|
|
60363
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60364
|
+
"button",
|
|
60365
|
+
{
|
|
60366
|
+
type: "button",
|
|
60367
|
+
onClick: () => setDetailsExpanded(!detailsExpanded),
|
|
60368
|
+
className: "uf-w-full uf-flex uf-items-center uf-justify-between uf-py-2.5",
|
|
60369
|
+
children: [
|
|
60370
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60371
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Clock, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60372
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60373
|
+
tCrypto.processingTime.label,
|
|
60374
|
+
":",
|
|
60375
|
+
" ",
|
|
60376
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(estimatedProcessingTime) })
|
|
60377
|
+
] })
|
|
60378
|
+
] }),
|
|
60379
|
+
detailsExpanded ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronUp, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronDown, { className: "uf-w-4 uf-h-4", style: { color: components.card.actionColor } })
|
|
60380
|
+
]
|
|
60381
|
+
}
|
|
60382
|
+
),
|
|
60383
|
+
detailsExpanded && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-pb-3 uf-space-y-2.5", children: [
|
|
60384
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60385
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ShieldCheck, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60386
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60387
|
+
tCrypto.slippage.label,
|
|
60388
|
+
":",
|
|
60389
|
+
" ",
|
|
60390
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60391
|
+
tCrypto.slippage.auto,
|
|
60392
|
+
" \u2022 ",
|
|
60393
|
+
(maxSlippagePercent ?? 0.25).toFixed(2),
|
|
60394
|
+
"%"
|
|
60395
|
+
] })
|
|
60396
|
+
] })
|
|
60397
|
+
] }),
|
|
60398
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
60399
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-rounded-full uf-p-1", style: { backgroundColor: components.card.iconBackgroundColor }, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DollarSign, { className: "uf-w-3 uf-h-3", style: { color: components.card.iconColor } }) }),
|
|
60400
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
|
|
60401
|
+
tCrypto.priceImpact.label,
|
|
60402
|
+
":",
|
|
60403
|
+
" ",
|
|
60404
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
|
|
60405
|
+
(priceImpactPercent ?? 0).toFixed(2),
|
|
60406
|
+
"%"
|
|
60407
|
+
] })
|
|
60408
|
+
] })
|
|
60409
|
+
] })
|
|
60410
|
+
] })
|
|
60411
|
+
] }),
|
|
60412
|
+
!canWithdraw && !submitError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
60413
|
+
"div",
|
|
60414
|
+
{
|
|
60415
|
+
className: "uf-flex uf-items-start uf-gap-2.5 uf-p-3 uf-rounded-xl",
|
|
60416
|
+
style: { backgroundColor: colors2.card, border: `1px solid ${colors2.border}` },
|
|
60417
|
+
children: [
|
|
60418
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4 uf-flex-shrink-0 uf-mt-0.5", style: { color: colors2.warning } }),
|
|
60419
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "No connected wallet detected. Please connect a wallet that matches your account to withdraw." })
|
|
60420
|
+
]
|
|
60421
|
+
}
|
|
60422
|
+
),
|
|
60423
|
+
isWalletMatch && connectedWalletName ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60424
|
+
"button",
|
|
60425
|
+
{
|
|
60426
|
+
type: "button",
|
|
60427
|
+
onClick: handleWithdraw,
|
|
60428
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60429
|
+
className: "uf-w-full uf-py-3 uf-text-sm uf-font-medium uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed uf-flex uf-items-center uf-justify-center uf-gap-2",
|
|
60430
|
+
style: {
|
|
60431
|
+
backgroundColor: colors2.primary,
|
|
60432
|
+
color: colors2.primaryForeground,
|
|
60433
|
+
fontFamily: fonts.medium,
|
|
60434
|
+
borderRadius: components.button.borderRadius,
|
|
60435
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60436
|
+
},
|
|
60437
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60438
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60439
|
+
"Processing..."
|
|
60440
|
+
] }) : isOverBalance ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Insufficient balance" }) : isBelowMinimum ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Minimum amount not met" }) : submitError ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_jsx_runtime72.Fragment, { children: "Withdrawal failed. Try again" }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
60441
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4" }),
|
|
60442
|
+
"Withdraw from ",
|
|
60443
|
+
connectedWalletName
|
|
60444
|
+
] })
|
|
60445
|
+
}
|
|
60446
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60447
|
+
"button",
|
|
60448
|
+
{
|
|
60449
|
+
type: "button",
|
|
60450
|
+
onClick: handleWithdraw,
|
|
60451
|
+
disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
|
|
60452
|
+
className: "uf-w-full uf-py-3 uf-text-sm uf-font-medium uf-transition-colors disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
|
|
60453
|
+
style: {
|
|
60454
|
+
backgroundColor: colors2.primary,
|
|
60455
|
+
color: colors2.primaryForeground,
|
|
60456
|
+
fontFamily: fonts.medium,
|
|
60457
|
+
borderRadius: components.button.borderRadius,
|
|
60458
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
60459
|
+
},
|
|
60460
|
+
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2", children: [
|
|
60461
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
|
|
60462
|
+
"Processing..."
|
|
60463
|
+
] }) : isOverBalance ? "Insufficient balance" : isBelowMinimum ? "Minimum amount not met" : submitError ? "Withdrawal failed. Try again" : t8.withdraw
|
|
60464
|
+
}
|
|
60465
|
+
),
|
|
60466
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-text-xs uf-pt-1", children: [
|
|
60467
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { children: footerLeft }),
|
|
60468
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositFooterLinks, { onGlossaryClick: () => setGlossaryOpen(true) })
|
|
60469
|
+
] }),
|
|
60470
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
60471
|
+
GlossaryModal,
|
|
60472
|
+
{
|
|
60473
|
+
open: glossaryOpen,
|
|
60474
|
+
onOpenChange: setGlossaryOpen
|
|
60475
|
+
}
|
|
60476
|
+
)
|
|
60477
|
+
] });
|
|
60478
|
+
}
|
|
60479
|
+
function WithdrawExecutionItem({
|
|
60480
|
+
execution,
|
|
60481
|
+
onClick
|
|
60482
|
+
}) {
|
|
60483
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60484
|
+
const isPending = execution.status === ExecutionStatus.PENDING || execution.status === ExecutionStatus.WAITING || execution.status === ExecutionStatus.DELAYED;
|
|
60485
|
+
const formatDateTime = (timestamp) => {
|
|
60486
|
+
try {
|
|
60487
|
+
const date = new Date(timestamp);
|
|
60488
|
+
const monthDay = date.toLocaleDateString("en-US", {
|
|
60489
|
+
month: "short",
|
|
60490
|
+
day: "numeric",
|
|
60491
|
+
year: "numeric"
|
|
60492
|
+
});
|
|
60493
|
+
const time = date.toLocaleTimeString("en-US", {
|
|
60494
|
+
hour: "numeric",
|
|
60495
|
+
minute: "2-digit",
|
|
60496
|
+
hour12: true
|
|
60497
|
+
}).toLowerCase();
|
|
60498
|
+
return `${monthDay} at ${time}`;
|
|
60499
|
+
} catch {
|
|
60500
|
+
return timestamp;
|
|
60501
|
+
}
|
|
60502
|
+
};
|
|
60503
|
+
const formatUsdAmount2 = (sourceAmountUsd) => {
|
|
60504
|
+
try {
|
|
60505
|
+
const amount = Number(sourceAmountUsd);
|
|
60506
|
+
return new Intl.NumberFormat("en-US", {
|
|
60507
|
+
style: "currency",
|
|
60508
|
+
currency: "USD",
|
|
60509
|
+
minimumFractionDigits: 2,
|
|
60510
|
+
maximumFractionDigits: 2
|
|
60511
|
+
}).format(amount);
|
|
60512
|
+
} catch {
|
|
60513
|
+
return "$0.00";
|
|
60514
|
+
}
|
|
60515
|
+
};
|
|
60516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
60517
|
+
"button",
|
|
60518
|
+
{
|
|
60519
|
+
onClick,
|
|
60520
|
+
className: "uf-w-full uf-p-3 uf-flex uf-items-center uf-gap-3 hover:uf-bg-secondary/80 uf-transition-colors uf-text-left",
|
|
60521
|
+
style: {
|
|
60522
|
+
backgroundColor: components.card.backgroundColor,
|
|
60523
|
+
borderRadius: components.list.rowBorderRadius,
|
|
60524
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
60525
|
+
},
|
|
60526
|
+
children: [
|
|
60527
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-relative uf-flex-shrink-0 uf-w-9 uf-h-9", children: [
|
|
60528
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60529
|
+
"img",
|
|
60530
|
+
{
|
|
60531
|
+
src: execution.destination_token_metadata?.icon_url || getIconUrl("/icons/tokens/svg/usdc.svg"),
|
|
60532
|
+
alt: "Token",
|
|
60533
|
+
width: 36,
|
|
60534
|
+
height: 36,
|
|
60535
|
+
loading: "lazy",
|
|
60536
|
+
className: "uf-rounded-full uf-w-9 uf-h-9"
|
|
60537
|
+
}
|
|
60538
|
+
),
|
|
60539
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60540
|
+
"div",
|
|
60541
|
+
{
|
|
60542
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60543
|
+
style: { backgroundColor: colors2.warning },
|
|
60544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60545
|
+
"svg",
|
|
60546
|
+
{
|
|
60547
|
+
width: "10",
|
|
60548
|
+
height: "10",
|
|
60549
|
+
viewBox: "0 0 12 12",
|
|
60550
|
+
fill: "none",
|
|
60551
|
+
className: "uf-animate-spin uf-block",
|
|
60552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60553
|
+
"path",
|
|
60554
|
+
{
|
|
60555
|
+
d: "M6 1V3M6 9V11M1 6H3M9 6H11M2.5 2.5L4 4M8 8L9.5 9.5M2.5 9.5L4 8M8 4L9.5 2.5",
|
|
60556
|
+
stroke: "white",
|
|
60557
|
+
strokeWidth: "2",
|
|
60558
|
+
strokeLinecap: "round"
|
|
60559
|
+
}
|
|
60560
|
+
)
|
|
60561
|
+
}
|
|
60562
|
+
)
|
|
60563
|
+
}
|
|
60564
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60565
|
+
"div",
|
|
60566
|
+
{
|
|
60567
|
+
className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
|
|
60568
|
+
style: { backgroundColor: colors2.success },
|
|
60569
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60570
|
+
"svg",
|
|
60571
|
+
{
|
|
60572
|
+
width: "10",
|
|
60573
|
+
height: "10",
|
|
60574
|
+
viewBox: "0 0 12 12",
|
|
60575
|
+
fill: "none",
|
|
60576
|
+
className: "uf-block",
|
|
60577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60578
|
+
"path",
|
|
60579
|
+
{
|
|
60580
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
60581
|
+
stroke: "white",
|
|
60582
|
+
strokeWidth: "2",
|
|
60583
|
+
strokeLinecap: "round",
|
|
60584
|
+
strokeLinejoin: "round"
|
|
60585
|
+
}
|
|
60586
|
+
)
|
|
60587
|
+
}
|
|
60588
|
+
)
|
|
60589
|
+
}
|
|
60590
|
+
)
|
|
60591
|
+
] }),
|
|
60592
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex-1 uf-min-w-0", children: [
|
|
60593
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60594
|
+
"h3",
|
|
60595
|
+
{
|
|
60596
|
+
className: "uf-font-medium uf-text-sm uf-leading-tight",
|
|
60597
|
+
style: {
|
|
60598
|
+
color: components.card.titleColor,
|
|
60599
|
+
fontFamily: fonts.medium
|
|
60600
|
+
},
|
|
60601
|
+
children: isPending ? "Withdrawal processing" : "Withdrawal completed"
|
|
60602
|
+
}
|
|
60603
|
+
),
|
|
60604
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60605
|
+
"p",
|
|
60606
|
+
{
|
|
60607
|
+
className: "uf-text-xs uf-leading-tight",
|
|
60608
|
+
style: {
|
|
60609
|
+
color: components.card.subtitleColor,
|
|
60610
|
+
fontFamily: fonts.regular
|
|
60611
|
+
},
|
|
60612
|
+
children: formatDateTime(execution.created_at || (/* @__PURE__ */ new Date()).toISOString())
|
|
60613
|
+
}
|
|
60614
|
+
)
|
|
60615
|
+
] }),
|
|
60616
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60617
|
+
"span",
|
|
60618
|
+
{
|
|
60619
|
+
className: "uf-font-medium uf-text-sm uf-flex-shrink-0",
|
|
60620
|
+
style: {
|
|
60621
|
+
color: components.card.textRightColor,
|
|
60622
|
+
fontFamily: fonts.medium
|
|
60623
|
+
},
|
|
60624
|
+
children: formatUsdAmount2(execution.source_amount_usd || "0")
|
|
60625
|
+
}
|
|
60626
|
+
),
|
|
60627
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
60628
|
+
ChevronRight,
|
|
60629
|
+
{
|
|
60630
|
+
className: "uf-w-4 uf-h-4 uf-flex-shrink-0",
|
|
60631
|
+
style: { color: components.card.actionColor }
|
|
60632
|
+
}
|
|
60633
|
+
)
|
|
60634
|
+
]
|
|
60635
|
+
}
|
|
60636
|
+
);
|
|
60637
|
+
}
|
|
60638
|
+
function truncateAddress4(addr) {
|
|
60639
|
+
if (addr.length <= 12) return addr;
|
|
60640
|
+
return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
|
|
60641
|
+
}
|
|
60642
|
+
var SHOW_BUTTON_DELAY_MS = 5e3;
|
|
60643
|
+
function WithdrawConfirmingView({
|
|
60644
|
+
txInfo,
|
|
60645
|
+
executions,
|
|
60646
|
+
onClose,
|
|
60647
|
+
onViewTracker
|
|
60648
|
+
}) {
|
|
60649
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60650
|
+
const [showButton, setShowButton] = (0, import_react30.useState)(false);
|
|
60651
|
+
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
60652
|
+
(0, import_react30.useEffect)(() => {
|
|
60653
|
+
if (latestExecution) return;
|
|
60654
|
+
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
60655
|
+
return () => clearTimeout(timer);
|
|
60656
|
+
}, [latestExecution]);
|
|
60657
|
+
const btnRadius = components.button.borderRadius;
|
|
60658
|
+
const btnBorder = `${components.button.borderWidth}px solid ${components.button.borderColor}`;
|
|
60659
|
+
if (latestExecution) {
|
|
60660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60661
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Details", showClose: true, onClose }),
|
|
60662
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: latestExecution, variant: "withdraw" }),
|
|
60663
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-2", children: [
|
|
60664
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60665
|
+
"button",
|
|
60666
|
+
{
|
|
60667
|
+
type: "button",
|
|
60668
|
+
onClick: onViewTracker,
|
|
60669
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60670
|
+
style: {
|
|
60671
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60672
|
+
color: components.button.secondaryText,
|
|
60673
|
+
fontFamily: fonts.medium,
|
|
60674
|
+
borderRadius: btnRadius,
|
|
60675
|
+
border: btnBorder
|
|
60676
|
+
},
|
|
60677
|
+
children: "Withdrawal History"
|
|
60678
|
+
}
|
|
60679
|
+
),
|
|
60680
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60681
|
+
"button",
|
|
60682
|
+
{
|
|
60683
|
+
type: "button",
|
|
60684
|
+
onClick: onClose,
|
|
60685
|
+
className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60686
|
+
style: {
|
|
60687
|
+
backgroundColor: components.button.primaryBackground,
|
|
60688
|
+
color: components.button.primaryText,
|
|
60689
|
+
fontFamily: fonts.medium,
|
|
60690
|
+
borderRadius: btnRadius,
|
|
60691
|
+
border: btnBorder
|
|
60692
|
+
},
|
|
60693
|
+
children: "Close"
|
|
60694
|
+
}
|
|
60695
|
+
)
|
|
60696
|
+
] }),
|
|
60697
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60698
|
+
PoweredByUnifold,
|
|
60699
|
+
{
|
|
60700
|
+
color: colors2.foregroundMuted,
|
|
60701
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60702
|
+
}
|
|
60703
|
+
) })
|
|
60704
|
+
] });
|
|
60705
|
+
}
|
|
60706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
60707
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Status", showClose: true, onClose }),
|
|
60708
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16 uf-px-4", children: [
|
|
60709
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60710
|
+
"div",
|
|
60711
|
+
{
|
|
60712
|
+
className: "uf-w-20 uf-h-20 uf-rounded-full uf-flex uf-items-center uf-justify-center uf-mb-6",
|
|
60713
|
+
style: { backgroundColor: `${colors2.primary}20` },
|
|
60714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60715
|
+
"svg",
|
|
60716
|
+
{
|
|
60717
|
+
width: "40",
|
|
60718
|
+
height: "40",
|
|
60719
|
+
viewBox: "0 0 24 24",
|
|
60720
|
+
fill: "none",
|
|
60721
|
+
className: "uf-animate-spin",
|
|
60722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60723
|
+
"path",
|
|
60724
|
+
{
|
|
60725
|
+
d: "M21 12a9 9 0 1 1-6.22-8.56",
|
|
60726
|
+
stroke: colors2.primary,
|
|
60727
|
+
strokeWidth: "2.5",
|
|
60728
|
+
strokeLinecap: "round"
|
|
60729
|
+
}
|
|
60730
|
+
)
|
|
60731
|
+
}
|
|
60732
|
+
)
|
|
60733
|
+
}
|
|
60734
|
+
),
|
|
60735
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60736
|
+
"h3",
|
|
60737
|
+
{
|
|
60738
|
+
className: "uf-text-xl uf-mb-2",
|
|
60739
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
60740
|
+
children: "Checking Withdrawal"
|
|
60741
|
+
}
|
|
60742
|
+
),
|
|
60743
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
60744
|
+
"p",
|
|
60745
|
+
{
|
|
60746
|
+
className: "uf-text-sm uf-text-center",
|
|
60747
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
60748
|
+
children: [
|
|
60749
|
+
txInfo.amount,
|
|
60750
|
+
" ",
|
|
60751
|
+
txInfo.sourceTokenSymbol,
|
|
60752
|
+
" to",
|
|
60753
|
+
" ",
|
|
60754
|
+
truncateAddress4(txInfo.recipientAddress)
|
|
60755
|
+
]
|
|
60756
|
+
}
|
|
60757
|
+
)
|
|
60758
|
+
] }),
|
|
60759
|
+
showButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-px-1 uf-pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60760
|
+
"button",
|
|
60761
|
+
{
|
|
60762
|
+
type: "button",
|
|
60763
|
+
onClick: onViewTracker,
|
|
60764
|
+
className: "uf-w-full uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
|
|
60765
|
+
style: {
|
|
60766
|
+
backgroundColor: components.button.secondaryBackground,
|
|
60767
|
+
color: components.button.secondaryText,
|
|
60768
|
+
fontFamily: fonts.medium,
|
|
60769
|
+
borderRadius: btnRadius,
|
|
60770
|
+
border: btnBorder
|
|
60771
|
+
},
|
|
60772
|
+
children: "Withdrawal History"
|
|
60773
|
+
}
|
|
60774
|
+
) }),
|
|
60775
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
60776
|
+
PoweredByUnifold,
|
|
60777
|
+
{
|
|
60778
|
+
color: colors2.foregroundMuted,
|
|
60779
|
+
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
60780
|
+
}
|
|
60781
|
+
) })
|
|
60782
|
+
] });
|
|
60783
|
+
}
|
|
60784
|
+
var t9 = i18n2.withdrawModal;
|
|
60785
|
+
var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
60786
|
+
function WithdrawModal({
|
|
60787
|
+
open,
|
|
60788
|
+
onOpenChange,
|
|
60789
|
+
publishableKey,
|
|
60790
|
+
modalTitle,
|
|
60791
|
+
externalUserId,
|
|
60792
|
+
sourceChainType,
|
|
60793
|
+
sourceChainId,
|
|
60794
|
+
sourceTokenAddress,
|
|
60795
|
+
sourceTokenSymbol,
|
|
60796
|
+
recipientAddress: recipientAddressProp,
|
|
60797
|
+
senderAddress,
|
|
60798
|
+
onWithdraw,
|
|
60799
|
+
onWithdrawSuccess,
|
|
60800
|
+
onWithdrawError,
|
|
60801
|
+
theme = "dark",
|
|
60802
|
+
hideOverlay = false
|
|
60803
|
+
}) {
|
|
60804
|
+
const { colors: colors2, fonts, components } = useTheme();
|
|
60805
|
+
const [containerEl, setContainerEl] = (0, import_react27.useState)(null);
|
|
60806
|
+
const containerCallbackRef = (0, import_react27.useCallback)((el) => {
|
|
60807
|
+
setContainerEl(el);
|
|
60808
|
+
}, []);
|
|
60809
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react27.useState)(
|
|
60810
|
+
theme === "auto" ? "dark" : theme
|
|
60811
|
+
);
|
|
60812
|
+
(0, import_react27.useEffect)(() => {
|
|
60813
|
+
if (theme === "auto") {
|
|
60814
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
60815
|
+
setResolvedTheme(mq.matches ? "dark" : "light");
|
|
60816
|
+
const h = (e) => setResolvedTheme(e.matches ? "dark" : "light");
|
|
60817
|
+
mq.addEventListener("change", h);
|
|
60818
|
+
return () => mq.removeEventListener("change", h);
|
|
60819
|
+
}
|
|
60820
|
+
setResolvedTheme(theme);
|
|
60821
|
+
}, [theme]);
|
|
60822
|
+
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
60823
|
+
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDestinationTokens(publishableKey, open);
|
|
60824
|
+
const destinationTokens = tokensResponse?.data ?? [];
|
|
60825
|
+
const { data: sourceValidation, isLoading: isCheckingSourceToken } = useSourceTokenValidation({
|
|
60826
|
+
sourceChainType,
|
|
60827
|
+
sourceChainId,
|
|
60828
|
+
sourceTokenAddress,
|
|
60829
|
+
sourceTokenSymbol,
|
|
60830
|
+
publishableKey,
|
|
60831
|
+
enabled: open
|
|
60832
|
+
});
|
|
60833
|
+
const { data: balanceData, isLoading: isLoadingBalance } = useAddressBalance({
|
|
60834
|
+
address: senderAddress,
|
|
60835
|
+
chainType: sourceChainType,
|
|
60836
|
+
chainId: sourceChainId,
|
|
60837
|
+
tokenAddress: sourceTokenAddress,
|
|
60838
|
+
publishableKey,
|
|
60839
|
+
enabled: open
|
|
60840
|
+
});
|
|
60841
|
+
const [selectedToken, setSelectedToken] = (0, import_react27.useState)(null);
|
|
60842
|
+
const [selectedChain, setSelectedChain] = (0, import_react27.useState)(null);
|
|
60843
|
+
const [detectedWallet, setDetectedWallet] = (0, import_react27.useState)(null);
|
|
60844
|
+
const connectedWalletName = detectedWallet?.name ?? null;
|
|
60845
|
+
const isWalletMatch = !!detectedWallet;
|
|
60846
|
+
(0, import_react27.useEffect)(() => {
|
|
60847
|
+
if (!senderAddress || !open) {
|
|
60848
|
+
setDetectedWallet(null);
|
|
60849
|
+
return;
|
|
60850
|
+
}
|
|
60851
|
+
let cancelled = false;
|
|
60852
|
+
detectBrowserWallet(sourceChainType, senderAddress).then((wallet) => {
|
|
60853
|
+
if (!cancelled) setDetectedWallet(wallet);
|
|
60854
|
+
});
|
|
60855
|
+
return () => {
|
|
60856
|
+
cancelled = true;
|
|
60857
|
+
};
|
|
60858
|
+
}, [senderAddress, sourceChainType, open]);
|
|
60859
|
+
const [view, setView] = (0, import_react27.useState)("form");
|
|
60860
|
+
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react27.useState)();
|
|
60861
|
+
const [selectedExecution, setSelectedExecution] = (0, import_react27.useState)(null);
|
|
60862
|
+
const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react27.useState)(null);
|
|
60863
|
+
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
60864
|
+
userId: externalUserId,
|
|
60865
|
+
publishableKey,
|
|
60866
|
+
depositWalletId: withdrawDepositWalletId,
|
|
60867
|
+
enabled: !!withdrawDepositWalletId && open,
|
|
60868
|
+
onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
|
|
60869
|
+
onWithdrawError
|
|
60870
|
+
});
|
|
60871
|
+
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
60872
|
+
actionType: ActionType.Withdraw,
|
|
60873
|
+
enabled: open,
|
|
60874
|
+
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
60875
|
+
});
|
|
60876
|
+
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
60877
|
+
const handleDepositWalletCreation = (0, import_react27.useCallback)(async (params) => {
|
|
60878
|
+
const { data: wallets } = await createDepositAddress(
|
|
60879
|
+
{
|
|
60880
|
+
external_user_id: externalUserId,
|
|
60881
|
+
destination_chain_type: params.destinationChainType,
|
|
60882
|
+
destination_chain_id: params.destinationChainId,
|
|
60883
|
+
destination_token_address: params.destinationTokenAddress,
|
|
60884
|
+
recipient_address: params.recipientAddress,
|
|
60885
|
+
action_type: ActionType.Withdraw
|
|
60886
|
+
},
|
|
60887
|
+
publishableKey
|
|
60888
|
+
);
|
|
60889
|
+
const depositWallet = getWalletByChainType(wallets, sourceChainType);
|
|
60890
|
+
if (!depositWallet) {
|
|
60891
|
+
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
60892
|
+
}
|
|
60893
|
+
setWithdrawDepositWalletId(depositWallet.id);
|
|
60894
|
+
return depositWallet;
|
|
60895
|
+
}, [externalUserId, publishableKey, sourceChainType]);
|
|
60896
|
+
const handleWithdrawSubmitted = (0, import_react27.useCallback)((txInfo) => {
|
|
60897
|
+
setSubmittedTxInfo(txInfo);
|
|
60898
|
+
setView("confirming");
|
|
60899
|
+
}, []);
|
|
60900
|
+
(0, import_react27.useEffect)(() => {
|
|
60901
|
+
if (!destinationTokens.length || selectedToken) return;
|
|
60902
|
+
const first = destinationTokens[0];
|
|
60903
|
+
if (first?.chains.length > 0) {
|
|
60904
|
+
setSelectedToken(first);
|
|
60905
|
+
setSelectedChain(first.chains[0]);
|
|
60906
|
+
}
|
|
60907
|
+
}, [destinationTokens, selectedToken]);
|
|
60908
|
+
const resetViewTimeoutRef = (0, import_react27.useRef)(null);
|
|
60909
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
60910
|
+
onOpenChange(false);
|
|
60911
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60912
|
+
resetViewTimeoutRef.current = setTimeout(() => {
|
|
60913
|
+
setSelectedToken(null);
|
|
60914
|
+
setSelectedChain(null);
|
|
60915
|
+
setView("form");
|
|
60916
|
+
setSelectedExecution(null);
|
|
60917
|
+
setSubmittedTxInfo(null);
|
|
60918
|
+
setWithdrawDepositWalletId(void 0);
|
|
60919
|
+
resetViewTimeoutRef.current = null;
|
|
60920
|
+
}, 200);
|
|
60921
|
+
}, [onOpenChange]);
|
|
60922
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
60923
|
+
if (!open) return;
|
|
60924
|
+
if (resetViewTimeoutRef.current) {
|
|
60925
|
+
clearTimeout(resetViewTimeoutRef.current);
|
|
60926
|
+
resetViewTimeoutRef.current = null;
|
|
60927
|
+
}
|
|
60928
|
+
setSelectedToken(null);
|
|
60929
|
+
setSelectedChain(null);
|
|
60930
|
+
setView("form");
|
|
60931
|
+
setSelectedExecution(null);
|
|
60932
|
+
setSubmittedTxInfo(null);
|
|
60933
|
+
setWithdrawDepositWalletId(void 0);
|
|
60934
|
+
}, [open]);
|
|
60935
|
+
(0, import_react27.useEffect)(() => () => {
|
|
60936
|
+
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
60937
|
+
}, []);
|
|
60938
|
+
const handleTokenSymbolChange = (0, import_react27.useCallback)((symbol) => {
|
|
60939
|
+
const tok = destinationTokens.find((t11) => t11.symbol === symbol);
|
|
60940
|
+
if (tok) {
|
|
60941
|
+
setSelectedToken(tok);
|
|
60942
|
+
if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
|
|
60943
|
+
}
|
|
60944
|
+
}, [destinationTokens]);
|
|
60945
|
+
const handleChainKeyChange = (0, import_react27.useCallback)((chainKey) => {
|
|
60946
|
+
if (!selectedToken) return;
|
|
60947
|
+
const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
|
|
60948
|
+
if (chain) setSelectedChain(chain);
|
|
60949
|
+
}, [selectedToken]);
|
|
60950
|
+
const isSourceSupported = sourceValidation?.isSupported ?? null;
|
|
60951
|
+
const canWithdraw = !!onWithdraw || isWalletMatch;
|
|
60952
|
+
const isAnyLoading = tokensLoading || isCheckingSourceToken;
|
|
60953
|
+
const withdrawPoweredByFooter = /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PoweredByUnifold, { color: colors2.foregroundMuted, className: "uf-flex uf-justify-center uf-shrink-0" }) });
|
|
60954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Dialog2, { open: hideOverlay || open, onOpenChange: hideOverlay ? void 0 : handleClose, modal: !hideOverlay, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60955
|
+
DialogContent2,
|
|
60956
|
+
{
|
|
60957
|
+
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
60958
|
+
hideOverlay,
|
|
60959
|
+
className: `sm:uf-max-w-[400px] uf-border-secondary uf-text-foreground uf-gap-0 [&>button]:uf-hidden ${hideOverlay ? `uf-p-6 uf-overflow-hidden ${themeClass}` : `uf-p-0 uf-overflow-visible !uf-top-auto !uf-h-auto !uf-max-h-[90vh] sm:!uf-max-h-none sm:!uf-top-[50%] ${themeClass}`}`,
|
|
60960
|
+
style: { backgroundColor: colors2.background },
|
|
60961
|
+
onPointerDownOutside: (e) => e.preventDefault(),
|
|
60962
|
+
onInteractOutside: (e) => e.preventDefault(),
|
|
60963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ThemeStyleInjector, { children: view === "confirming" && submittedTxInfo ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60964
|
+
WithdrawConfirmingView,
|
|
60965
|
+
{
|
|
60966
|
+
txInfo: submittedTxInfo,
|
|
60967
|
+
executions: realtimeExecutions,
|
|
60968
|
+
onClose: handleClose,
|
|
60969
|
+
onViewTracker: () => setView("tracker")
|
|
60970
|
+
}
|
|
60971
|
+
) : view === "detail" && selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60972
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal Details", showBack: true, showClose: !hideOverlay, onBack: () => {
|
|
60973
|
+
setSelectedExecution(null);
|
|
60974
|
+
setView("tracker");
|
|
60975
|
+
}, onClose: handleClose }),
|
|
60976
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositDetailContent, { execution: selectedExecution, variant: "withdraw" }),
|
|
60977
|
+
withdrawPoweredByFooter
|
|
60978
|
+
] }) : view === "tracker" ? (
|
|
60979
|
+
/* ---------- Tracker view: execution list ---------- */
|
|
60980
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60981
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal History", showBack: true, showClose: !hideOverlay, onBack: () => setView("form"), onClose: handleClose }),
|
|
60982
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-flex uf-flex-col uf-gap-2", style: { minHeight: 200 }, children: allWithdrawals.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-flex uf-items-center uf-justify-center uf-py-8", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "uf-text-sm", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "No withdrawals to track yet" }) }) : allWithdrawals.map((ex) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
60983
|
+
WithdrawExecutionItem,
|
|
60984
|
+
{
|
|
60985
|
+
execution: ex,
|
|
60986
|
+
onClick: () => {
|
|
60987
|
+
setSelectedExecution(ex);
|
|
60988
|
+
setView("detail");
|
|
60989
|
+
}
|
|
60990
|
+
},
|
|
60991
|
+
ex.id
|
|
60992
|
+
)) }),
|
|
60993
|
+
withdrawPoweredByFooter
|
|
60994
|
+
] })
|
|
60995
|
+
) : (
|
|
60996
|
+
/* ---------- Form view (default) ---------- */
|
|
60997
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
60998
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: modalTitle || t9.title, showClose: !hideOverlay, onClose: handleClose }),
|
|
60999
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-3", children: [
|
|
61000
|
+
isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-space-y-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-animate-pulse", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-bg-muted uf-rounded-lg uf-w-full uf-h-10" }) }, i)) }) : isSourceSupported === false ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-8 uf-px-4 uf-text-center", children: [
|
|
61001
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-full uf-bg-muted uf-flex uf-items-center uf-justify-center uf-mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TriangleAlert, { className: "uf-w-8 uf-h-8 uf-text-muted-foreground" }) }),
|
|
61002
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("h3", { className: "uf-text-lg uf-font-semibold uf-mb-2", style: { color: colors2.foreground, fontFamily: fonts.medium }, children: "Unsupported Source Token" }),
|
|
61003
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "uf-text-sm uf-max-w-[280px]", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: sourceValidation?.errorMessage })
|
|
61004
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
61005
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
61006
|
+
WithdrawDoubleInput,
|
|
61007
|
+
{
|
|
61008
|
+
tokens: destinationTokens,
|
|
61009
|
+
selectedTokenSymbol: selectedToken?.symbol ?? null,
|
|
61010
|
+
selectedChainKey: selectedChain ? getChainKey5(selectedChain.chain_id, selectedChain.chain_type) : null,
|
|
61011
|
+
onTokenChange: handleTokenSymbolChange,
|
|
61012
|
+
onChainChange: handleChainKeyChange,
|
|
61013
|
+
isLoading: tokensLoading
|
|
61014
|
+
}
|
|
61015
|
+
),
|
|
61016
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
61017
|
+
WithdrawForm,
|
|
61018
|
+
{
|
|
61019
|
+
publishableKey,
|
|
61020
|
+
externalUserId,
|
|
61021
|
+
sourceChainType,
|
|
61022
|
+
selectedToken,
|
|
61023
|
+
selectedChain,
|
|
61024
|
+
sourceTokenSymbol,
|
|
61025
|
+
recipientAddressProp,
|
|
61026
|
+
balanceData: balanceData ?? null,
|
|
61027
|
+
isLoadingBalance,
|
|
61028
|
+
minimumWithdrawAmountUsd: sourceValidation?.minimumAmountUsd ?? null,
|
|
61029
|
+
estimatedProcessingTime: sourceValidation?.estimatedProcessingTime ?? null,
|
|
61030
|
+
maxSlippagePercent: sourceValidation?.maxSlippagePercent ?? null,
|
|
61031
|
+
priceImpactPercent: sourceValidation?.priceImpactPercent ?? null,
|
|
61032
|
+
detectedWallet,
|
|
61033
|
+
sourceChainId,
|
|
61034
|
+
sourceTokenAddress,
|
|
61035
|
+
isWalletMatch,
|
|
61036
|
+
connectedWalletName,
|
|
61037
|
+
canWithdraw,
|
|
61038
|
+
onWithdraw,
|
|
61039
|
+
onWithdrawError,
|
|
61040
|
+
onDepositWalletCreation: handleDepositWalletCreation,
|
|
61041
|
+
onWithdrawSubmitted: handleWithdrawSubmitted,
|
|
61042
|
+
footerLeft: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
61043
|
+
"button",
|
|
61044
|
+
{
|
|
61045
|
+
onClick: () => setView("tracker"),
|
|
61046
|
+
className: "uf-flex uf-items-center uf-gap-1 uf-transition-colors hover:uf-opacity-70",
|
|
61047
|
+
style: { color: colors2.foregroundMuted },
|
|
61048
|
+
children: [
|
|
61049
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Clock, { className: "uf-w-3.5 uf-h-3.5" }),
|
|
61050
|
+
"Withdrawal History",
|
|
61051
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ChevronRight, { className: "uf-w-3 uf-h-3" })
|
|
61052
|
+
]
|
|
61053
|
+
}
|
|
61054
|
+
)
|
|
61055
|
+
}
|
|
61056
|
+
)
|
|
61057
|
+
] }),
|
|
61058
|
+
withdrawPoweredByFooter
|
|
61059
|
+
] })
|
|
61060
|
+
] })
|
|
61061
|
+
) })
|
|
61062
|
+
}
|
|
61063
|
+
) }) });
|
|
61064
|
+
}
|
|
61065
|
+
var t10 = i18n2.withdrawModal;
|
|
61066
|
+
function UnifoldProvider2({
|
|
61067
|
+
children,
|
|
61068
|
+
publishableKey,
|
|
61069
|
+
config
|
|
61070
|
+
}) {
|
|
61071
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
61072
|
+
const [depositConfig, setDepositConfig] = (0, import_react.useState)(
|
|
61073
|
+
null
|
|
61074
|
+
);
|
|
61075
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react.useState)(false);
|
|
61076
|
+
const [withdrawConfig, setWithdrawConfig] = (0, import_react.useState)(
|
|
61077
|
+
null
|
|
61078
|
+
);
|
|
61079
|
+
const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
|
|
61080
|
+
(0, import_react.useEffect)(() => {
|
|
61081
|
+
if (publishableKey) {
|
|
61082
|
+
setApiConfig({ publishableKey });
|
|
61083
|
+
}
|
|
61084
|
+
}, [publishableKey]);
|
|
61085
|
+
import_react.default.useEffect(() => {
|
|
61086
|
+
const appearance = config?.appearance || "dark";
|
|
61087
|
+
if (appearance === "auto") {
|
|
61088
|
+
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
61089
|
+
setResolvedTheme(prefersDark ? "dark" : "light");
|
|
61090
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
61091
|
+
const handler = (e) => {
|
|
61092
|
+
setResolvedTheme(e.matches ? "dark" : "light");
|
|
61093
|
+
};
|
|
61094
|
+
mediaQuery.addEventListener("change", handler);
|
|
61095
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
61096
|
+
} else {
|
|
61097
|
+
setResolvedTheme(appearance);
|
|
61098
|
+
}
|
|
61099
|
+
}, [config?.appearance]);
|
|
61100
|
+
const depositPromiseRef = import_react.default.useRef(null);
|
|
61101
|
+
const depositConfigRef = import_react.default.useRef(null);
|
|
61102
|
+
depositConfigRef.current = depositConfig;
|
|
61103
|
+
const closeTimeoutRef = import_react.default.useRef(null);
|
|
61104
|
+
const closeGuardRef = import_react.default.useRef(false);
|
|
61105
|
+
const withdrawPromiseRef = import_react.default.useRef(null);
|
|
61106
|
+
const withdrawConfigRef = import_react.default.useRef(null);
|
|
61107
|
+
withdrawConfigRef.current = withdrawConfig;
|
|
61108
|
+
const withdrawCloseTimeoutRef = import_react.default.useRef(null);
|
|
61109
|
+
const withdrawCloseGuardRef = import_react.default.useRef(false);
|
|
61110
|
+
const beginDeposit = (0, import_react.useCallback)((config2) => {
|
|
61111
|
+
if (closeTimeoutRef.current) {
|
|
61112
|
+
clearTimeout(closeTimeoutRef.current);
|
|
61113
|
+
closeTimeoutRef.current = null;
|
|
61114
|
+
}
|
|
61115
|
+
closeGuardRef.current = false;
|
|
61116
|
+
if (depositPromiseRef.current) {
|
|
61117
|
+
console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
|
|
61118
|
+
depositPromiseRef.current.reject({
|
|
61119
|
+
message: "Deposit cancelled - new deposit started",
|
|
61120
|
+
code: "DEPOSIT_SUPERSEDED"
|
|
61121
|
+
});
|
|
61122
|
+
depositPromiseRef.current = null;
|
|
61123
|
+
}
|
|
61124
|
+
const promise = new Promise((resolve, reject) => {
|
|
61125
|
+
depositPromiseRef.current = { resolve, reject };
|
|
61126
|
+
});
|
|
61127
|
+
promise.catch(() => {
|
|
61128
|
+
});
|
|
61129
|
+
setDepositConfig(config2);
|
|
61130
|
+
setIsOpen(true);
|
|
61131
|
+
return promise;
|
|
61132
|
+
}, []);
|
|
61133
|
+
const closeDeposit = (0, import_react.useCallback)(() => {
|
|
61134
|
+
if (closeGuardRef.current) {
|
|
61135
|
+
return;
|
|
61136
|
+
}
|
|
61137
|
+
closeGuardRef.current = true;
|
|
61138
|
+
const promiseToReject = depositPromiseRef.current;
|
|
61139
|
+
depositPromiseRef.current = null;
|
|
61140
|
+
if (depositConfigRef.current?.onClose) {
|
|
61141
|
+
depositConfigRef.current.onClose();
|
|
61142
|
+
}
|
|
61143
|
+
if (promiseToReject) {
|
|
61144
|
+
promiseToReject.reject({
|
|
61145
|
+
message: "Deposit cancelled by user",
|
|
61146
|
+
code: "DEPOSIT_CANCELLED"
|
|
61147
|
+
});
|
|
61148
|
+
}
|
|
61149
|
+
setIsOpen(false);
|
|
61150
|
+
closeTimeoutRef.current = setTimeout(() => {
|
|
61151
|
+
setDepositConfig(null);
|
|
59304
61152
|
closeTimeoutRef.current = null;
|
|
59305
61153
|
}, 200);
|
|
59306
61154
|
}, []);
|
|
@@ -59323,16 +61171,84 @@ function UnifoldProvider2({
|
|
|
59323
61171
|
depositPromiseRef.current = null;
|
|
59324
61172
|
}
|
|
59325
61173
|
}, [depositConfig]);
|
|
61174
|
+
const beginWithdraw = (0, import_react.useCallback)((config2) => {
|
|
61175
|
+
if (withdrawCloseTimeoutRef.current) {
|
|
61176
|
+
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
61177
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61178
|
+
}
|
|
61179
|
+
withdrawCloseGuardRef.current = false;
|
|
61180
|
+
if (withdrawPromiseRef.current) {
|
|
61181
|
+
console.warn("[UnifoldProvider] A withdraw is already in progress. Cancelling previous withdraw.");
|
|
61182
|
+
withdrawPromiseRef.current.reject({
|
|
61183
|
+
message: "Withdraw cancelled - new withdraw started",
|
|
61184
|
+
code: "WITHDRAW_SUPERSEDED"
|
|
61185
|
+
});
|
|
61186
|
+
withdrawPromiseRef.current = null;
|
|
61187
|
+
}
|
|
61188
|
+
const promise = new Promise((resolve, reject) => {
|
|
61189
|
+
withdrawPromiseRef.current = { resolve, reject };
|
|
61190
|
+
});
|
|
61191
|
+
promise.catch(() => {
|
|
61192
|
+
});
|
|
61193
|
+
setWithdrawConfig(config2);
|
|
61194
|
+
setIsWithdrawOpen(true);
|
|
61195
|
+
return promise;
|
|
61196
|
+
}, []);
|
|
61197
|
+
const closeWithdraw = (0, import_react.useCallback)(() => {
|
|
61198
|
+
if (withdrawCloseGuardRef.current) {
|
|
61199
|
+
return;
|
|
61200
|
+
}
|
|
61201
|
+
withdrawCloseGuardRef.current = true;
|
|
61202
|
+
const promiseToReject = withdrawPromiseRef.current;
|
|
61203
|
+
withdrawPromiseRef.current = null;
|
|
61204
|
+
if (withdrawConfigRef.current?.onClose) {
|
|
61205
|
+
withdrawConfigRef.current.onClose();
|
|
61206
|
+
}
|
|
61207
|
+
if (promiseToReject) {
|
|
61208
|
+
promiseToReject.reject({
|
|
61209
|
+
message: "Withdraw cancelled by user",
|
|
61210
|
+
code: "WITHDRAW_CANCELLED"
|
|
61211
|
+
});
|
|
61212
|
+
}
|
|
61213
|
+
setIsWithdrawOpen(false);
|
|
61214
|
+
withdrawCloseTimeoutRef.current = setTimeout(() => {
|
|
61215
|
+
setWithdrawConfig(null);
|
|
61216
|
+
withdrawCloseTimeoutRef.current = null;
|
|
61217
|
+
}, 200);
|
|
61218
|
+
}, []);
|
|
61219
|
+
const handleWithdrawSuccess = (0, import_react.useCallback)((data) => {
|
|
61220
|
+
if (withdrawConfigRef.current?.onSuccess) {
|
|
61221
|
+
withdrawConfigRef.current.onSuccess(data);
|
|
61222
|
+
}
|
|
61223
|
+
if (withdrawPromiseRef.current) {
|
|
61224
|
+
withdrawPromiseRef.current.resolve(data);
|
|
61225
|
+
withdrawPromiseRef.current = null;
|
|
61226
|
+
}
|
|
61227
|
+
}, []);
|
|
61228
|
+
const handleWithdrawError = (0, import_react.useCallback)((error) => {
|
|
61229
|
+
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
61230
|
+
if (withdrawConfigRef.current?.onError) {
|
|
61231
|
+
withdrawConfigRef.current.onError(error);
|
|
61232
|
+
}
|
|
61233
|
+
if (withdrawPromiseRef.current) {
|
|
61234
|
+
withdrawPromiseRef.current.reject(error);
|
|
61235
|
+
withdrawPromiseRef.current = null;
|
|
61236
|
+
}
|
|
61237
|
+
}, []);
|
|
59326
61238
|
const contextValue = (0, import_react.useMemo)(
|
|
59327
61239
|
() => ({
|
|
59328
61240
|
beginDeposit,
|
|
59329
61241
|
closeDeposit,
|
|
59330
61242
|
handleDepositSuccess,
|
|
59331
|
-
handleDepositError
|
|
61243
|
+
handleDepositError,
|
|
61244
|
+
beginWithdraw,
|
|
61245
|
+
closeWithdraw,
|
|
61246
|
+
handleWithdrawSuccess,
|
|
61247
|
+
handleWithdrawError
|
|
59332
61248
|
}),
|
|
59333
|
-
[beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError]
|
|
61249
|
+
[beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError, beginWithdraw, closeWithdraw, handleWithdrawSuccess, handleWithdrawError]
|
|
59334
61250
|
);
|
|
59335
|
-
return /* @__PURE__ */ (0,
|
|
61251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UnifoldProvider, { publishableKey, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ConnectContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
59336
61252
|
ThemeProvider,
|
|
59337
61253
|
{
|
|
59338
61254
|
mode: resolvedTheme,
|
|
@@ -59343,7 +61259,27 @@ function UnifoldProvider2({
|
|
|
59343
61259
|
components: config?.components,
|
|
59344
61260
|
children: [
|
|
59345
61261
|
children,
|
|
59346
|
-
|
|
61262
|
+
withdrawConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
61263
|
+
WithdrawModal,
|
|
61264
|
+
{
|
|
61265
|
+
open: isWithdrawOpen,
|
|
61266
|
+
onOpenChange: closeWithdraw,
|
|
61267
|
+
publishableKey,
|
|
61268
|
+
modalTitle: config?.withdrawModalTitle,
|
|
61269
|
+
externalUserId: withdrawConfig.externalUserId,
|
|
61270
|
+
sourceChainType: withdrawConfig.sourceChainType,
|
|
61271
|
+
sourceChainId: withdrawConfig.sourceChainId,
|
|
61272
|
+
sourceTokenAddress: withdrawConfig.sourceTokenAddress,
|
|
61273
|
+
sourceTokenSymbol: withdrawConfig.sourceTokenSymbol,
|
|
61274
|
+
recipientAddress: withdrawConfig.recipientAddress,
|
|
61275
|
+
senderAddress: withdrawConfig.senderAddress,
|
|
61276
|
+
onWithdraw: withdrawConfig.withdraw,
|
|
61277
|
+
onWithdrawSuccess: handleWithdrawSuccess,
|
|
61278
|
+
onWithdrawError: handleWithdrawError,
|
|
61279
|
+
theme: resolvedTheme
|
|
61280
|
+
}
|
|
61281
|
+
),
|
|
61282
|
+
depositConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
59347
61283
|
DepositModal,
|
|
59348
61284
|
{
|
|
59349
61285
|
open: isOpen,
|
|
@@ -59356,6 +61292,10 @@ function UnifoldProvider2({
|
|
|
59356
61292
|
destinationChainType: depositConfig.destinationChainType,
|
|
59357
61293
|
destinationChainId: depositConfig.destinationChainId,
|
|
59358
61294
|
destinationTokenAddress: depositConfig.destinationTokenAddress,
|
|
61295
|
+
defaultSourceChainType: depositConfig.defaultSourceChainType,
|
|
61296
|
+
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
61297
|
+
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
61298
|
+
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
59359
61299
|
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
59360
61300
|
hideDepositTracker: config?.hideDepositTracker,
|
|
59361
61301
|
showBalanceHeader: config?.showBalanceHeader,
|
|
@@ -59389,6 +61329,9 @@ function useUnifold2() {
|
|
|
59389
61329
|
publishableKey: "",
|
|
59390
61330
|
beginDeposit: () => Promise.reject(new Error("SSR not supported")),
|
|
59391
61331
|
closeDeposit: () => {
|
|
61332
|
+
},
|
|
61333
|
+
beginWithdraw: () => Promise.reject(new Error("SSR not supported")),
|
|
61334
|
+
closeWithdraw: () => {
|
|
59392
61335
|
}
|
|
59393
61336
|
};
|
|
59394
61337
|
}
|
|
@@ -59398,21 +61341,25 @@ function useUnifold2() {
|
|
|
59398
61341
|
return {
|
|
59399
61342
|
publishableKey: baseContext.publishableKey,
|
|
59400
61343
|
beginDeposit: connectContext.beginDeposit,
|
|
59401
|
-
closeDeposit: connectContext.closeDeposit
|
|
61344
|
+
closeDeposit: connectContext.closeDeposit,
|
|
61345
|
+
beginWithdraw: connectContext.beginWithdraw,
|
|
61346
|
+
closeWithdraw: connectContext.closeWithdraw
|
|
59402
61347
|
};
|
|
59403
61348
|
}
|
|
59404
61349
|
|
|
59405
61350
|
// src/unifold.tsx
|
|
59406
|
-
var UnifoldBridge = (0,
|
|
59407
|
-
const { beginDeposit, closeDeposit } = useUnifold2();
|
|
59408
|
-
(0,
|
|
61351
|
+
var UnifoldBridge = (0, import_react32.forwardRef)((_, ref) => {
|
|
61352
|
+
const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
|
|
61353
|
+
(0, import_react32.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
|
|
59409
61354
|
beginDeposit,
|
|
59410
|
-
closeDeposit
|
|
61355
|
+
closeDeposit,
|
|
61356
|
+
beginWithdraw,
|
|
61357
|
+
closeWithdraw
|
|
59411
61358
|
]);
|
|
59412
61359
|
return null;
|
|
59413
61360
|
});
|
|
59414
61361
|
UnifoldBridge.displayName = "UnifoldBridge";
|
|
59415
|
-
var RenderErrorBoundary = class extends
|
|
61362
|
+
var RenderErrorBoundary = class extends import_react32.Component {
|
|
59416
61363
|
constructor() {
|
|
59417
61364
|
super(...arguments);
|
|
59418
61365
|
this.state = { hasError: false };
|
|
@@ -59457,6 +61404,15 @@ function createUnifold(publishableKey, config) {
|
|
|
59457
61404
|
return resolvedHandle.beginDeposit(depositConfig);
|
|
59458
61405
|
},
|
|
59459
61406
|
closeDeposit: () => resolvedHandle?.closeDeposit(),
|
|
61407
|
+
beginWithdraw: (withdrawConfig) => {
|
|
61408
|
+
if (!resolvedHandle) {
|
|
61409
|
+
return Promise.reject(
|
|
61410
|
+
new Error("Unifold instance has been destroyed")
|
|
61411
|
+
);
|
|
61412
|
+
}
|
|
61413
|
+
return resolvedHandle.beginWithdraw(withdrawConfig);
|
|
61414
|
+
},
|
|
61415
|
+
closeWithdraw: () => resolvedHandle?.closeWithdraw(),
|
|
59460
61416
|
destroy: cleanup
|
|
59461
61417
|
};
|
|
59462
61418
|
const refCallback = (handle) => {
|
|
@@ -59477,13 +61433,13 @@ function createUnifold(publishableKey, config) {
|
|
|
59477
61433
|
};
|
|
59478
61434
|
try {
|
|
59479
61435
|
root.render(
|
|
59480
|
-
|
|
61436
|
+
import_react32.default.createElement(
|
|
59481
61437
|
RenderErrorBoundary,
|
|
59482
61438
|
{ onError: handleRenderError },
|
|
59483
|
-
|
|
61439
|
+
import_react32.default.createElement(
|
|
59484
61440
|
UnifoldProvider2,
|
|
59485
61441
|
{ publishableKey, config },
|
|
59486
|
-
|
|
61442
|
+
import_react32.default.createElement(UnifoldBridge, { ref: refCallback })
|
|
59487
61443
|
)
|
|
59488
61444
|
)
|
|
59489
61445
|
);
|
|
@@ -59508,11 +61464,13 @@ lucide-react/dist/esm/Icon.js:
|
|
|
59508
61464
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
59509
61465
|
lucide-react/dist/esm/icons/arrow-left-right.js:
|
|
59510
61466
|
lucide-react/dist/esm/icons/arrow-left.js:
|
|
61467
|
+
lucide-react/dist/esm/icons/arrow-up-down.js:
|
|
59511
61468
|
lucide-react/dist/esm/icons/check.js:
|
|
59512
61469
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
59513
61470
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
59514
61471
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
59515
61472
|
lucide-react/dist/esm/icons/circle-check.js:
|
|
61473
|
+
lucide-react/dist/esm/icons/clipboard-paste.js:
|
|
59516
61474
|
lucide-react/dist/esm/icons/clock.js:
|
|
59517
61475
|
lucide-react/dist/esm/icons/copy.js:
|
|
59518
61476
|
lucide-react/dist/esm/icons/credit-card.js:
|