@unifold/ui-web 0.1.41 → 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.mjs CHANGED
@@ -34394,7 +34394,7 @@ var require_jsx_runtime = __commonJS({
34394
34394
  });
34395
34395
 
34396
34396
  // src/unifold.tsx
34397
- var import_react27 = __toESM(require_react());
34397
+ var import_react32 = __toESM(require_react());
34398
34398
  var import_client = __toESM(require_client());
34399
34399
 
34400
34400
  // ../connect-react/dist/index.mjs
@@ -37213,7 +37213,18 @@ var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
37213
37213
  var React272 = __toESM(require_react(), 1);
37214
37214
  var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
37215
37215
  var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
37216
+ var import_react27 = __toESM(require_react(), 1);
37217
+ var import_react28 = __toESM(require_react(), 1);
37216
37218
  var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
37219
+ var import_react29 = __toESM(require_react(), 1);
37220
+ var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
37221
+ var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
37222
+ var import_react30 = __toESM(require_react(), 1);
37223
+ var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
37224
+ var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
37225
+ var import_react31 = __toESM(require_react(), 1);
37226
+ var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
37227
+ var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
37217
37228
  var __create2 = Object.create;
37218
37229
  var __defProp2 = Object.defineProperty;
37219
37230
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -37242,69 +37253,69 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__
37242
37253
  var require_qr_code_styling = __commonJS2({
37243
37254
  "../../node_modules/.pnpm/qr-code-styling@1.9.2/node_modules/qr-code-styling/lib/qr-code-styling.js"(exports, module) {
37244
37255
  "use strict";
37245
- !(function(t7, e) {
37246
- "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() : t7.QRCodeStyling = e();
37256
+ !(function(t11, e) {
37257
+ "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.QRCodeStyling = e() : t11.QRCodeStyling = e();
37247
37258
  })(exports, (() => (() => {
37248
- var t7 = { 873: (t8, e2) => {
37259
+ var t11 = { 873: (t12, e2) => {
37249
37260
  var i2, r3, n = (function() {
37250
- var t9 = function(t10, e4) {
37251
- var i4 = t10, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t11, e5) {
37252
- n3 = (function(t12) {
37253
- for (var e6 = new Array(t12), i5 = 0; i5 < t12; i5 += 1) {
37254
- e6[i5] = new Array(t12);
37255
- for (var r6 = 0; r6 < t12; r6 += 1) e6[i5][r6] = null;
37261
+ var t13 = function(t14, e4) {
37262
+ var i4 = t14, r5 = s[e4], n3 = null, o2 = 0, h2 = null, p2 = [], v2 = {}, m = function(t15, e5) {
37263
+ n3 = (function(t16) {
37264
+ for (var e6 = new Array(t16), i5 = 0; i5 < t16; i5 += 1) {
37265
+ e6[i5] = new Array(t16);
37266
+ for (var r6 = 0; r6 < t16; r6 += 1) e6[i5][r6] = null;
37256
37267
  }
37257
37268
  return e6;
37258
- })(o2 = 4 * i4 + 17), b(0, 0), b(o2 - 7, 0), b(0, o2 - 7), x(), y(), C(t11, e5), i4 >= 7 && S(t11), null == h2 && (h2 = M(i4, r5, p2)), A(h2, e5);
37259
- }, b = function(t11, e5) {
37260
- for (var i5 = -1; i5 <= 7; i5 += 1) if (!(t11 + i5 <= -1 || o2 <= t11 + i5)) for (var r6 = -1; r6 <= 7; r6 += 1) e5 + r6 <= -1 || o2 <= e5 + r6 || (n3[t11 + 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);
37269
+ })(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);
37270
+ }, b = function(t15, e5) {
37271
+ 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);
37261
37272
  }, y = function() {
37262
- for (var t11 = 8; t11 < o2 - 8; t11 += 1) null == n3[t11][6] && (n3[t11][6] = t11 % 2 == 0);
37273
+ for (var t15 = 8; t15 < o2 - 8; t15 += 1) null == n3[t15][6] && (n3[t15][6] = t15 % 2 == 0);
37263
37274
  for (var e5 = 8; e5 < o2 - 8; e5 += 1) null == n3[6][e5] && (n3[6][e5] = e5 % 2 == 0);
37264
37275
  }, x = function() {
37265
- for (var t11 = a.getPatternPosition(i4), e5 = 0; e5 < t11.length; e5 += 1) for (var r6 = 0; r6 < t11.length; r6 += 1) {
37266
- var o3 = t11[e5], s2 = t11[r6];
37276
+ for (var t15 = a.getPatternPosition(i4), e5 = 0; e5 < t15.length; e5 += 1) for (var r6 = 0; r6 < t15.length; r6 += 1) {
37277
+ var o3 = t15[e5], s2 = t15[r6];
37267
37278
  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;
37268
37279
  }
37269
- }, S = function(t11) {
37280
+ }, S = function(t15) {
37270
37281
  for (var e5 = a.getBCHTypeNumber(i4), r6 = 0; r6 < 18; r6 += 1) {
37271
- var s2 = !t11 && 1 == (e5 >> r6 & 1);
37282
+ var s2 = !t15 && 1 == (e5 >> r6 & 1);
37272
37283
  n3[Math.floor(r6 / 3)][r6 % 3 + o2 - 8 - 3] = s2;
37273
37284
  }
37274
- for (r6 = 0; r6 < 18; r6 += 1) s2 = !t11 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
37275
- }, C = function(t11, e5) {
37285
+ for (r6 = 0; r6 < 18; r6 += 1) s2 = !t15 && 1 == (e5 >> r6 & 1), n3[r6 % 3 + o2 - 8 - 3][Math.floor(r6 / 3)] = s2;
37286
+ }, C = function(t15, e5) {
37276
37287
  for (var i5 = r5 << 3 | e5, s2 = a.getBCHTypeInfo(i5), h3 = 0; h3 < 15; h3 += 1) {
37277
- var d2 = !t11 && 1 == (s2 >> h3 & 1);
37288
+ var d2 = !t15 && 1 == (s2 >> h3 & 1);
37278
37289
  h3 < 6 ? n3[h3][8] = d2 : h3 < 8 ? n3[h3 + 1][8] = d2 : n3[o2 - 15 + h3][8] = d2;
37279
37290
  }
37280
- for (h3 = 0; h3 < 15; h3 += 1) d2 = !t11 && 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;
37281
- n3[o2 - 8][8] = !t11;
37282
- }, A = function(t11, e5) {
37291
+ 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;
37292
+ n3[o2 - 8][8] = !t15;
37293
+ }, A = function(t15, e5) {
37283
37294
  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); ; ) {
37284
37295
  for (var c2 = 0; c2 < 2; c2 += 1) if (null == n3[r6][u2 - c2]) {
37285
37296
  var l2 = false;
37286
- h3 < t11.length && (l2 = 1 == (t11[h3] >>> s2 & 1)), d2(r6, u2 - c2) && (l2 = !l2), n3[r6][u2 - c2] = l2, -1 == (s2 -= 1) && (h3 += 1, s2 = 7);
37297
+ 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);
37287
37298
  }
37288
37299
  if ((r6 += i5) < 0 || o2 <= r6) {
37289
37300
  r6 -= i5, i5 = -i5;
37290
37301
  break;
37291
37302
  }
37292
37303
  }
37293
- }, M = function(t11, e5, i5) {
37294
- for (var r6 = u.getRSBlocks(t11, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
37304
+ }, M = function(t15, e5, i5) {
37305
+ for (var r6 = u.getRSBlocks(t15, e5), n4 = c(), o3 = 0; o3 < i5.length; o3 += 1) {
37295
37306
  var s2 = i5[o3];
37296
- n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t11)), s2.write(n4);
37307
+ n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
37297
37308
  }
37298
37309
  var h3 = 0;
37299
37310
  for (o3 = 0; o3 < r6.length; o3 += 1) h3 += r6[o3].dataCount;
37300
37311
  if (n4.getLengthInBits() > 8 * h3) throw "code length overflow. (" + n4.getLengthInBits() + ">" + 8 * h3 + ")";
37301
37312
  for (n4.getLengthInBits() + 4 <= 8 * h3 && n4.put(0, 4); n4.getLengthInBits() % 8 != 0; ) n4.putBit(false);
37302
37313
  for (; !(n4.getLengthInBits() >= 8 * h3 || (n4.put(236, 8), n4.getLengthInBits() >= 8 * h3)); ) n4.put(17, 8);
37303
- return (function(t12, e6) {
37314
+ return (function(t16, e6) {
37304
37315
  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) {
37305
37316
  var u2 = e6[h4].dataCount, c2 = e6[h4].totalCount - u2;
37306
37317
  r7 = Math.max(r7, u2), n5 = Math.max(n5, c2), o4[h4] = new Array(u2);
37307
- for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t12.getBuffer()[l2 + i6];
37318
+ for (var l2 = 0; l2 < o4[h4].length; l2 += 1) o4[h4][l2] = 255 & t16.getBuffer()[l2 + i6];
37308
37319
  i6 += u2;
37309
37320
  var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h4], g2.getLength() - 1).mod(g2);
37310
37321
  for (s3[h4] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h4].length; l2 += 1) {
@@ -37320,85 +37331,85 @@ var require_qr_code_styling = __commonJS2({
37320
37331
  return v3;
37321
37332
  })(n4, r6);
37322
37333
  };
37323
- v2.addData = function(t11, e5) {
37334
+ v2.addData = function(t15, e5) {
37324
37335
  var i5 = null;
37325
37336
  switch (e5 = e5 || "Byte") {
37326
37337
  case "Numeric":
37327
- i5 = l(t11);
37338
+ i5 = l(t15);
37328
37339
  break;
37329
37340
  case "Alphanumeric":
37330
- i5 = g(t11);
37341
+ i5 = g(t15);
37331
37342
  break;
37332
37343
  case "Byte":
37333
- i5 = f(t11);
37344
+ i5 = f(t15);
37334
37345
  break;
37335
37346
  case "Kanji":
37336
- i5 = w(t11);
37347
+ i5 = w(t15);
37337
37348
  break;
37338
37349
  default:
37339
37350
  throw "mode:" + e5;
37340
37351
  }
37341
37352
  p2.push(i5), h2 = null;
37342
- }, v2.isDark = function(t11, e5) {
37343
- if (t11 < 0 || o2 <= t11 || e5 < 0 || o2 <= e5) throw t11 + "," + e5;
37344
- return n3[t11][e5];
37353
+ }, v2.isDark = function(t15, e5) {
37354
+ if (t15 < 0 || o2 <= t15 || e5 < 0 || o2 <= e5) throw t15 + "," + e5;
37355
+ return n3[t15][e5];
37345
37356
  }, v2.getModuleCount = function() {
37346
37357
  return o2;
37347
37358
  }, v2.make = function() {
37348
37359
  if (i4 < 1) {
37349
- for (var t11 = 1; t11 < 40; t11++) {
37350
- for (var e5 = u.getRSBlocks(t11, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
37360
+ for (var t15 = 1; t15 < 40; t15++) {
37361
+ for (var e5 = u.getRSBlocks(t15, r5), n4 = c(), o3 = 0; o3 < p2.length; o3++) {
37351
37362
  var s2 = p2[o3];
37352
- n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t11)), s2.write(n4);
37363
+ n4.put(s2.getMode(), 4), n4.put(s2.getLength(), a.getLengthInBits(s2.getMode(), t15)), s2.write(n4);
37353
37364
  }
37354
37365
  var h3 = 0;
37355
37366
  for (o3 = 0; o3 < e5.length; o3++) h3 += e5[o3].dataCount;
37356
37367
  if (n4.getLengthInBits() <= 8 * h3) break;
37357
37368
  }
37358
- i4 = t11;
37369
+ i4 = t15;
37359
37370
  }
37360
37371
  m(false, (function() {
37361
- for (var t12 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
37372
+ for (var t16 = 0, e6 = 0, i5 = 0; i5 < 8; i5 += 1) {
37362
37373
  m(true, i5);
37363
37374
  var r6 = a.getLostPoint(v2);
37364
- (0 == i5 || t12 > r6) && (t12 = r6, e6 = i5);
37375
+ (0 == i5 || t16 > r6) && (t16 = r6, e6 = i5);
37365
37376
  }
37366
37377
  return e6;
37367
37378
  })());
37368
- }, v2.createTableTag = function(t11, e5) {
37369
- t11 = t11 || 2;
37379
+ }, v2.createTableTag = function(t15, e5) {
37380
+ t15 = t15 || 2;
37370
37381
  var i5 = "";
37371
- i5 += '<table style="', i5 += " border-width: 0px; border-style: none;", i5 += " border-collapse: collapse;", i5 += " padding: 0px; margin: " + (e5 = void 0 === e5 ? 4 * t11 : e5) + "px;", i5 += '">', i5 += "<tbody>";
37382
+ 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>";
37372
37383
  for (var r6 = 0; r6 < v2.getModuleCount(); r6 += 1) {
37373
37384
  i5 += "<tr>";
37374
- 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: " + t11 + "px;", i5 += " height: " + t11 + "px;", i5 += " background-color: ", i5 += v2.isDark(r6, n4) ? "#000000" : "#ffffff", i5 += ";", i5 += '"/>';
37385
+ 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 += '"/>';
37375
37386
  i5 += "</tr>";
37376
37387
  }
37377
37388
  return (i5 += "</tbody>") + "</table>";
37378
- }, v2.createSvgTag = function(t11, e5, i5, r6) {
37389
+ }, v2.createSvgTag = function(t15, e5, i5, r6) {
37379
37390
  var n4 = {};
37380
- "object" == typeof arguments[0] && (t11 = (n4 = arguments[0]).cellSize, e5 = n4.margin, i5 = n4.alt, r6 = n4.title), t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : 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;
37381
- var o3, s2, a2, h3, d2 = v2.getModuleCount() * t11 + 2 * e5, u2 = "";
37382
- for (h3 = "l" + t11 + ",0 0," + t11 + " -" + t11 + ",0 0,-" + t11 + "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 * t11 + e5, o3 = 0; o3 < v2.getModuleCount(); o3 += 1) v2.isDark(s2, o3) && (u2 += "M" + (o3 * t11 + e5) + "," + a2 + h3);
37391
+ "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;
37392
+ var o3, s2, a2, h3, d2 = v2.getModuleCount() * t15 + 2 * e5, u2 = "";
37393
+ 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);
37383
37394
  return (u2 += '" stroke="transparent" fill="black"/>') + "</svg>";
37384
- }, v2.createDataURL = function(t11, e5) {
37385
- t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : e5;
37386
- var i5 = v2.getModuleCount() * t11 + 2 * e5, r6 = e5, n4 = i5 - e5;
37395
+ }, v2.createDataURL = function(t15, e5) {
37396
+ t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
37397
+ var i5 = v2.getModuleCount() * t15 + 2 * e5, r6 = e5, n4 = i5 - e5;
37387
37398
  return _(i5, i5, (function(e6, i6) {
37388
37399
  if (r6 <= e6 && e6 < n4 && r6 <= i6 && i6 < n4) {
37389
- var o3 = Math.floor((e6 - r6) / t11), s2 = Math.floor((i6 - r6) / t11);
37400
+ var o3 = Math.floor((e6 - r6) / t15), s2 = Math.floor((i6 - r6) / t15);
37390
37401
  return v2.isDark(s2, o3) ? 0 : 1;
37391
37402
  }
37392
37403
  return 1;
37393
37404
  }));
37394
- }, v2.createImgTag = function(t11, e5, i5) {
37395
- t11 = t11 || 2, e5 = void 0 === e5 ? 4 * t11 : e5;
37396
- var r6 = v2.getModuleCount() * t11 + 2 * e5, n4 = "";
37397
- return n4 += "<img", n4 += ' src="', n4 += v2.createDataURL(t11, e5), n4 += '"', n4 += ' width="', n4 += r6, n4 += '"', n4 += ' height="', n4 += r6, n4 += '"', i5 && (n4 += ' alt="', n4 += $(i5), n4 += '"'), n4 + "/>";
37405
+ }, v2.createImgTag = function(t15, e5, i5) {
37406
+ t15 = t15 || 2, e5 = void 0 === e5 ? 4 * t15 : e5;
37407
+ var r6 = v2.getModuleCount() * t15 + 2 * e5, n4 = "";
37408
+ 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 + "/>";
37398
37409
  };
37399
- var $ = function(t11) {
37400
- for (var e5 = "", i5 = 0; i5 < t11.length; i5 += 1) {
37401
- var r6 = t11.charAt(i5);
37410
+ var $ = function(t15) {
37411
+ for (var e5 = "", i5 = 0; i5 < t15.length; i5 += 1) {
37412
+ var r6 = t15.charAt(i5);
37402
37413
  switch (r6) {
37403
37414
  case "<":
37404
37415
  e5 += "&lt;";
@@ -37418,40 +37429,40 @@ var require_qr_code_styling = __commonJS2({
37418
37429
  }
37419
37430
  return e5;
37420
37431
  };
37421
- return v2.createASCII = function(t11, e5) {
37422
- if ((t11 = t11 || 1) < 2) return (function(t12) {
37423
- t12 = void 0 === t12 ? 2 : t12;
37424
- var e6, i6, r7, n5, o4, s3 = 1 * v2.getModuleCount() + 2 * t12, a3 = t12, h4 = s3 - t12, d3 = { "\u2588\u2588": "\u2588", "\u2588 ": "\u2580", " \u2588": "\u2584", " ": " " }, u3 = { "\u2588\u2588": "\u2580", "\u2588 ": "\u2580", " \u2588": " ", " ": " " }, c3 = "";
37432
+ return v2.createASCII = function(t15, e5) {
37433
+ if ((t15 = t15 || 1) < 2) return (function(t16) {
37434
+ t16 = void 0 === t16 ? 2 : t16;
37435
+ 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 = "";
37425
37436
  for (e6 = 0; e6 < s3; e6 += 2) {
37426
- 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 += t12 < 1 && e6 + 1 >= h4 ? u3[o4] : d3[o4];
37437
+ 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];
37427
37438
  c3 += "\n";
37428
37439
  }
37429
- return s3 % 2 && t12 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
37440
+ return s3 % 2 && t16 > 0 ? c3.substring(0, c3.length - s3 - 1) + Array(s3 + 1).join("\u2580") : c3.substring(0, c3.length - 1);
37430
37441
  })(e5);
37431
- t11 -= 1, e5 = void 0 === e5 ? 2 * t11 : e5;
37432
- var i5, r6, n4, o3, s2 = v2.getModuleCount() * t11 + 2 * e5, a2 = e5, h3 = s2 - e5, d2 = Array(t11 + 1).join("\u2588\u2588"), u2 = Array(t11 + 1).join(" "), c2 = "", l2 = "";
37442
+ t15 -= 1, e5 = void 0 === e5 ? 2 * t15 : e5;
37443
+ 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 = "";
37433
37444
  for (i5 = 0; i5 < s2; i5 += 1) {
37434
- for (n4 = Math.floor((i5 - a2) / t11), l2 = "", r6 = 0; r6 < s2; r6 += 1) o3 = 1, a2 <= r6 && r6 < h3 && a2 <= i5 && i5 < h3 && v2.isDark(n4, Math.floor((r6 - a2) / t11)) && (o3 = 0), l2 += o3 ? d2 : u2;
37435
- for (n4 = 0; n4 < t11; n4 += 1) c2 += l2 + "\n";
37445
+ 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;
37446
+ for (n4 = 0; n4 < t15; n4 += 1) c2 += l2 + "\n";
37436
37447
  }
37437
37448
  return c2.substring(0, c2.length - 1);
37438
- }, v2.renderTo2dContext = function(t11, e5) {
37449
+ }, v2.renderTo2dContext = function(t15, e5) {
37439
37450
  e5 = e5 || 2;
37440
- for (var i5 = v2.getModuleCount(), r6 = 0; r6 < i5; r6++) for (var n4 = 0; n4 < i5; n4++) t11.fillStyle = v2.isDark(r6, n4) ? "black" : "white", t11.fillRect(r6 * e5, n4 * e5, e5, e5);
37451
+ 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);
37441
37452
  }, v2;
37442
37453
  };
37443
- t9.stringToBytes = (t9.stringToBytesFuncs = { default: function(t10) {
37444
- for (var e4 = [], i4 = 0; i4 < t10.length; i4 += 1) {
37445
- var r5 = t10.charCodeAt(i4);
37454
+ t13.stringToBytes = (t13.stringToBytesFuncs = { default: function(t14) {
37455
+ for (var e4 = [], i4 = 0; i4 < t14.length; i4 += 1) {
37456
+ var r5 = t14.charCodeAt(i4);
37446
37457
  e4.push(255 & r5);
37447
37458
  }
37448
37459
  return e4;
37449
- } }).default, t9.createStringToBytes = function(t10, e4) {
37460
+ } }).default, t13.createStringToBytes = function(t14, e4) {
37450
37461
  var i4 = (function() {
37451
- for (var i5 = v(t10), r6 = function() {
37452
- var t11 = i5.read();
37453
- if (-1 == t11) throw "eof";
37454
- return t11;
37462
+ for (var i5 = v(t14), r6 = function() {
37463
+ var t15 = i5.read();
37464
+ if (-1 == t15) throw "eof";
37465
+ return t15;
37455
37466
  }, n3 = 0, o2 = {}; ; ) {
37456
37467
  var s2 = i5.read();
37457
37468
  if (-1 == s2) break;
@@ -37461,71 +37472,71 @@ var require_qr_code_styling = __commonJS2({
37461
37472
  if (n3 != e4) throw n3 + " != " + e4;
37462
37473
  return o2;
37463
37474
  })(), r5 = "?".charCodeAt(0);
37464
- return function(t11) {
37465
- for (var e5 = [], n3 = 0; n3 < t11.length; n3 += 1) {
37466
- var o2 = t11.charCodeAt(n3);
37475
+ return function(t15) {
37476
+ for (var e5 = [], n3 = 0; n3 < t15.length; n3 += 1) {
37477
+ var o2 = t15.charCodeAt(n3);
37467
37478
  if (o2 < 128) e5.push(o2);
37468
37479
  else {
37469
- var s2 = i4[t11.charAt(n3)];
37480
+ var s2 = i4[t15.charAt(n3)];
37470
37481
  "number" == typeof s2 ? (255 & s2) == s2 ? e5.push(s2) : (e5.push(s2 >>> 8), e5.push(255 & s2)) : e5.push(r5);
37471
37482
  }
37472
37483
  }
37473
37484
  return e5;
37474
37485
  };
37475
37486
  };
37476
- 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(t10) {
37477
- for (var e4 = 0; 0 != t10; ) e4 += 1, t10 >>>= 1;
37487
+ 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) {
37488
+ for (var e4 = 0; 0 != t14; ) e4 += 1, t14 >>>= 1;
37478
37489
  return e4;
37479
- }, (n2 = {}).getBCHTypeInfo = function(t10) {
37480
- for (var e4 = t10 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
37481
- return 21522 ^ (t10 << 10 | e4);
37482
- }, n2.getBCHTypeNumber = function(t10) {
37483
- for (var e4 = t10 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
37484
- return t10 << 12 | e4;
37485
- }, n2.getPatternPosition = function(t10) {
37486
- return e3[t10 - 1];
37487
- }, n2.getMaskFunction = function(t10) {
37488
- switch (t10) {
37490
+ }, (n2 = {}).getBCHTypeInfo = function(t14) {
37491
+ for (var e4 = t14 << 10; o(e4) - o(i3) >= 0; ) e4 ^= i3 << o(e4) - o(i3);
37492
+ return 21522 ^ (t14 << 10 | e4);
37493
+ }, n2.getBCHTypeNumber = function(t14) {
37494
+ for (var e4 = t14 << 12; o(e4) - o(r4) >= 0; ) e4 ^= r4 << o(e4) - o(r4);
37495
+ return t14 << 12 | e4;
37496
+ }, n2.getPatternPosition = function(t14) {
37497
+ return e3[t14 - 1];
37498
+ }, n2.getMaskFunction = function(t14) {
37499
+ switch (t14) {
37489
37500
  case 0:
37490
- return function(t11, e4) {
37491
- return (t11 + e4) % 2 == 0;
37501
+ return function(t15, e4) {
37502
+ return (t15 + e4) % 2 == 0;
37492
37503
  };
37493
37504
  case 1:
37494
- return function(t11, e4) {
37495
- return t11 % 2 == 0;
37505
+ return function(t15, e4) {
37506
+ return t15 % 2 == 0;
37496
37507
  };
37497
37508
  case 2:
37498
- return function(t11, e4) {
37509
+ return function(t15, e4) {
37499
37510
  return e4 % 3 == 0;
37500
37511
  };
37501
37512
  case 3:
37502
- return function(t11, e4) {
37503
- return (t11 + e4) % 3 == 0;
37513
+ return function(t15, e4) {
37514
+ return (t15 + e4) % 3 == 0;
37504
37515
  };
37505
37516
  case 4:
37506
- return function(t11, e4) {
37507
- return (Math.floor(t11 / 2) + Math.floor(e4 / 3)) % 2 == 0;
37517
+ return function(t15, e4) {
37518
+ return (Math.floor(t15 / 2) + Math.floor(e4 / 3)) % 2 == 0;
37508
37519
  };
37509
37520
  case 5:
37510
- return function(t11, e4) {
37511
- return t11 * e4 % 2 + t11 * e4 % 3 == 0;
37521
+ return function(t15, e4) {
37522
+ return t15 * e4 % 2 + t15 * e4 % 3 == 0;
37512
37523
  };
37513
37524
  case 6:
37514
- return function(t11, e4) {
37515
- return (t11 * e4 % 2 + t11 * e4 % 3) % 2 == 0;
37525
+ return function(t15, e4) {
37526
+ return (t15 * e4 % 2 + t15 * e4 % 3) % 2 == 0;
37516
37527
  };
37517
37528
  case 7:
37518
- return function(t11, e4) {
37519
- return (t11 * e4 % 3 + (t11 + e4) % 2) % 2 == 0;
37529
+ return function(t15, e4) {
37530
+ return (t15 * e4 % 3 + (t15 + e4) % 2) % 2 == 0;
37520
37531
  };
37521
37532
  default:
37522
- throw "bad maskPattern:" + t10;
37533
+ throw "bad maskPattern:" + t14;
37523
37534
  }
37524
- }, n2.getErrorCorrectPolynomial = function(t10) {
37525
- for (var e4 = d([1], 0), i4 = 0; i4 < t10; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
37535
+ }, n2.getErrorCorrectPolynomial = function(t14) {
37536
+ for (var e4 = d([1], 0), i4 = 0; i4 < t14; i4 += 1) e4 = e4.multiply(d([1, h.gexp(i4)], 0));
37526
37537
  return e4;
37527
- }, n2.getLengthInBits = function(t10, e4) {
37528
- if (1 <= e4 && e4 < 10) switch (t10) {
37538
+ }, n2.getLengthInBits = function(t14, e4) {
37539
+ if (1 <= e4 && e4 < 10) switch (t14) {
37529
37540
  case 1:
37530
37541
  return 10;
37531
37542
  case 2:
@@ -37534,9 +37545,9 @@ var require_qr_code_styling = __commonJS2({
37534
37545
  case 8:
37535
37546
  return 8;
37536
37547
  default:
37537
- throw "mode:" + t10;
37548
+ throw "mode:" + t14;
37538
37549
  }
37539
- else if (e4 < 27) switch (t10) {
37550
+ else if (e4 < 27) switch (t14) {
37540
37551
  case 1:
37541
37552
  return 12;
37542
37553
  case 2:
@@ -37546,11 +37557,11 @@ var require_qr_code_styling = __commonJS2({
37546
37557
  case 8:
37547
37558
  return 10;
37548
37559
  default:
37549
- throw "mode:" + t10;
37560
+ throw "mode:" + t14;
37550
37561
  }
37551
37562
  else {
37552
37563
  if (!(e4 < 41)) throw "type:" + e4;
37553
- switch (t10) {
37564
+ switch (t14) {
37554
37565
  case 1:
37555
37566
  return 14;
37556
37567
  case 2:
@@ -37560,72 +37571,72 @@ var require_qr_code_styling = __commonJS2({
37560
37571
  case 8:
37561
37572
  return 12;
37562
37573
  default:
37563
- throw "mode:" + t10;
37574
+ throw "mode:" + t14;
37564
37575
  }
37565
37576
  }
37566
- }, n2.getLostPoint = function(t10) {
37567
- for (var e4 = t10.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
37568
- for (var o2 = 0, s2 = t10.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 == t10.isDark(r5 + a2, n3 + h2) && (o2 += 1);
37577
+ }, n2.getLostPoint = function(t14) {
37578
+ for (var e4 = t14.getModuleCount(), i4 = 0, r5 = 0; r5 < e4; r5 += 1) for (var n3 = 0; n3 < e4; n3 += 1) {
37579
+ 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);
37569
37580
  o2 > 5 && (i4 += 3 + o2 - 5);
37570
37581
  }
37571
37582
  for (r5 = 0; r5 < e4 - 1; r5 += 1) for (n3 = 0; n3 < e4 - 1; n3 += 1) {
37572
37583
  var d2 = 0;
37573
- t10.isDark(r5, n3) && (d2 += 1), t10.isDark(r5 + 1, n3) && (d2 += 1), t10.isDark(r5, n3 + 1) && (d2 += 1), t10.isDark(r5 + 1, n3 + 1) && (d2 += 1), 0 != d2 && 4 != d2 || (i4 += 3);
37584
+ 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);
37574
37585
  }
37575
- for (r5 = 0; r5 < e4; r5 += 1) for (n3 = 0; n3 < e4 - 6; n3 += 1) t10.isDark(r5, n3) && !t10.isDark(r5, n3 + 1) && t10.isDark(r5, n3 + 2) && t10.isDark(r5, n3 + 3) && t10.isDark(r5, n3 + 4) && !t10.isDark(r5, n3 + 5) && t10.isDark(r5, n3 + 6) && (i4 += 40);
37576
- for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4 - 6; r5 += 1) t10.isDark(r5, n3) && !t10.isDark(r5 + 1, n3) && t10.isDark(r5 + 2, n3) && t10.isDark(r5 + 3, n3) && t10.isDark(r5 + 4, n3) && !t10.isDark(r5 + 5, n3) && t10.isDark(r5 + 6, n3) && (i4 += 40);
37586
+ 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);
37587
+ 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);
37577
37588
  var u2 = 0;
37578
- for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t10.isDark(r5, n3) && (u2 += 1);
37589
+ for (n3 = 0; n3 < e4; n3 += 1) for (r5 = 0; r5 < e4; r5 += 1) t14.isDark(r5, n3) && (u2 += 1);
37579
37590
  return i4 + Math.abs(100 * u2 / e4 / e4 - 50) / 5 * 10;
37580
37591
  }, n2), h = (function() {
37581
- for (var t10 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t10[i4] = 1 << i4;
37582
- for (i4 = 8; i4 < 256; i4 += 1) t10[i4] = t10[i4 - 4] ^ t10[i4 - 5] ^ t10[i4 - 6] ^ t10[i4 - 8];
37583
- for (i4 = 0; i4 < 255; i4 += 1) e4[t10[i4]] = i4;
37584
- return { glog: function(t11) {
37585
- if (t11 < 1) throw "glog(" + t11 + ")";
37586
- return e4[t11];
37592
+ for (var t14 = new Array(256), e4 = new Array(256), i4 = 0; i4 < 8; i4 += 1) t14[i4] = 1 << i4;
37593
+ for (i4 = 8; i4 < 256; i4 += 1) t14[i4] = t14[i4 - 4] ^ t14[i4 - 5] ^ t14[i4 - 6] ^ t14[i4 - 8];
37594
+ for (i4 = 0; i4 < 255; i4 += 1) e4[t14[i4]] = i4;
37595
+ return { glog: function(t15) {
37596
+ if (t15 < 1) throw "glog(" + t15 + ")";
37597
+ return e4[t15];
37587
37598
  }, gexp: function(e5) {
37588
37599
  for (; e5 < 0; ) e5 += 255;
37589
37600
  for (; e5 >= 256; ) e5 -= 255;
37590
- return t10[e5];
37601
+ return t14[e5];
37591
37602
  } };
37592
37603
  })();
37593
- function d(t10, e4) {
37594
- if (void 0 === t10.length) throw t10.length + "/" + e4;
37604
+ function d(t14, e4) {
37605
+ if (void 0 === t14.length) throw t14.length + "/" + e4;
37595
37606
  var i4 = (function() {
37596
- for (var i5 = 0; i5 < t10.length && 0 == t10[i5]; ) i5 += 1;
37597
- for (var r6 = new Array(t10.length - i5 + e4), n3 = 0; n3 < t10.length - i5; n3 += 1) r6[n3] = t10[n3 + i5];
37607
+ for (var i5 = 0; i5 < t14.length && 0 == t14[i5]; ) i5 += 1;
37608
+ for (var r6 = new Array(t14.length - i5 + e4), n3 = 0; n3 < t14.length - i5; n3 += 1) r6[n3] = t14[n3 + i5];
37598
37609
  return r6;
37599
- })(), r5 = { getAt: function(t11) {
37600
- return i4[t11];
37610
+ })(), r5 = { getAt: function(t15) {
37611
+ return i4[t15];
37601
37612
  }, getLength: function() {
37602
37613
  return i4.length;
37603
- }, multiply: function(t11) {
37604
- for (var e5 = new Array(r5.getLength() + t11.getLength() - 1), i5 = 0; i5 < r5.getLength(); i5 += 1) for (var n3 = 0; n3 < t11.getLength(); n3 += 1) e5[i5 + n3] ^= h.gexp(h.glog(r5.getAt(i5)) + h.glog(t11.getAt(n3)));
37614
+ }, multiply: function(t15) {
37615
+ 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)));
37605
37616
  return d(e5, 0);
37606
- }, mod: function(t11) {
37607
- if (r5.getLength() - t11.getLength() < 0) return r5;
37608
- for (var e5 = h.glog(r5.getAt(0)) - h.glog(t11.getAt(0)), i5 = new Array(r5.getLength()), n3 = 0; n3 < r5.getLength(); n3 += 1) i5[n3] = r5.getAt(n3);
37609
- for (n3 = 0; n3 < t11.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t11.getAt(n3)) + e5);
37610
- return d(i5, 0).mod(t11);
37617
+ }, mod: function(t15) {
37618
+ if (r5.getLength() - t15.getLength() < 0) return r5;
37619
+ 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);
37620
+ for (n3 = 0; n3 < t15.getLength(); n3 += 1) i5[n3] ^= h.gexp(h.glog(t15.getAt(n3)) + e5);
37621
+ return d(i5, 0).mod(t15);
37611
37622
  } };
37612
37623
  return r5;
37613
37624
  }
37614
37625
  var u = /* @__PURE__ */ (function() {
37615
- var t10 = [[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(t11, e5) {
37626
+ 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) {
37616
37627
  var i5 = {};
37617
- return i5.totalCount = t11, i5.dataCount = e5, i5;
37628
+ return i5.totalCount = t15, i5.dataCount = e5, i5;
37618
37629
  }, i4 = { getRSBlocks: function(i5, r5) {
37619
37630
  var n3 = (function(e5, i6) {
37620
37631
  switch (i6) {
37621
37632
  case s.L:
37622
- return t10[4 * (e5 - 1) + 0];
37633
+ return t14[4 * (e5 - 1) + 0];
37623
37634
  case s.M:
37624
- return t10[4 * (e5 - 1) + 1];
37635
+ return t14[4 * (e5 - 1) + 1];
37625
37636
  case s.Q:
37626
- return t10[4 * (e5 - 1) + 2];
37637
+ return t14[4 * (e5 - 1) + 2];
37627
37638
  case s.H:
37628
- return t10[4 * (e5 - 1) + 3];
37639
+ return t14[4 * (e5 - 1) + 3];
37629
37640
  default:
37630
37641
  return;
37631
37642
  }
@@ -37636,48 +37647,48 @@ var require_qr_code_styling = __commonJS2({
37636
37647
  } };
37637
37648
  return i4;
37638
37649
  })(), c = function() {
37639
- var t10 = [], e4 = 0, i4 = { getBuffer: function() {
37640
- return t10;
37650
+ var t14 = [], e4 = 0, i4 = { getBuffer: function() {
37651
+ return t14;
37641
37652
  }, getAt: function(e5) {
37642
37653
  var i5 = Math.floor(e5 / 8);
37643
- return 1 == (t10[i5] >>> 7 - e5 % 8 & 1);
37644
- }, put: function(t11, e5) {
37645
- for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t11 >>> e5 - r5 - 1 & 1));
37654
+ return 1 == (t14[i5] >>> 7 - e5 % 8 & 1);
37655
+ }, put: function(t15, e5) {
37656
+ for (var r5 = 0; r5 < e5; r5 += 1) i4.putBit(1 == (t15 >>> e5 - r5 - 1 & 1));
37646
37657
  }, getLengthInBits: function() {
37647
37658
  return e4;
37648
37659
  }, putBit: function(i5) {
37649
37660
  var r5 = Math.floor(e4 / 8);
37650
- t10.length <= r5 && t10.push(0), i5 && (t10[r5] |= 128 >>> e4 % 8), e4 += 1;
37661
+ t14.length <= r5 && t14.push(0), i5 && (t14[r5] |= 128 >>> e4 % 8), e4 += 1;
37651
37662
  } };
37652
37663
  return i4;
37653
- }, l = function(t10) {
37654
- var e4 = t10, i4 = { getMode: function() {
37664
+ }, l = function(t14) {
37665
+ var e4 = t14, i4 = { getMode: function() {
37655
37666
  return 1;
37656
- }, getLength: function(t11) {
37667
+ }, getLength: function(t15) {
37657
37668
  return e4.length;
37658
- }, write: function(t11) {
37659
- for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t11.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
37660
- n4 < i5.length && (i5.length - n4 == 1 ? t11.put(r5(i5.substring(n4, n4 + 1)), 4) : i5.length - n4 == 2 && t11.put(r5(i5.substring(n4, n4 + 2)), 7));
37661
- } }, r5 = function(t11) {
37662
- for (var e5 = 0, i5 = 0; i5 < t11.length; i5 += 1) e5 = 10 * e5 + n3(t11.charAt(i5));
37669
+ }, write: function(t15) {
37670
+ for (var i5 = e4, n4 = 0; n4 + 2 < i5.length; ) t15.put(r5(i5.substring(n4, n4 + 3)), 10), n4 += 3;
37671
+ 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));
37672
+ } }, r5 = function(t15) {
37673
+ for (var e5 = 0, i5 = 0; i5 < t15.length; i5 += 1) e5 = 10 * e5 + n3(t15.charAt(i5));
37663
37674
  return e5;
37664
- }, n3 = function(t11) {
37665
- if ("0" <= t11 && t11 <= "9") return t11.charCodeAt(0) - "0".charCodeAt(0);
37666
- throw "illegal char :" + t11;
37675
+ }, n3 = function(t15) {
37676
+ if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
37677
+ throw "illegal char :" + t15;
37667
37678
  };
37668
37679
  return i4;
37669
- }, g = function(t10) {
37670
- var e4 = t10, i4 = { getMode: function() {
37680
+ }, g = function(t14) {
37681
+ var e4 = t14, i4 = { getMode: function() {
37671
37682
  return 2;
37672
- }, getLength: function(t11) {
37683
+ }, getLength: function(t15) {
37673
37684
  return e4.length;
37674
- }, write: function(t11) {
37675
- for (var i5 = e4, n3 = 0; n3 + 1 < i5.length; ) t11.put(45 * r5(i5.charAt(n3)) + r5(i5.charAt(n3 + 1)), 11), n3 += 2;
37676
- n3 < i5.length && t11.put(r5(i5.charAt(n3)), 6);
37677
- } }, r5 = function(t11) {
37678
- if ("0" <= t11 && t11 <= "9") return t11.charCodeAt(0) - "0".charCodeAt(0);
37679
- if ("A" <= t11 && t11 <= "Z") return t11.charCodeAt(0) - "A".charCodeAt(0) + 10;
37680
- switch (t11) {
37685
+ }, write: function(t15) {
37686
+ 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;
37687
+ n3 < i5.length && t15.put(r5(i5.charAt(n3)), 6);
37688
+ } }, r5 = function(t15) {
37689
+ if ("0" <= t15 && t15 <= "9") return t15.charCodeAt(0) - "0".charCodeAt(0);
37690
+ if ("A" <= t15 && t15 <= "Z") return t15.charCodeAt(0) - "A".charCodeAt(0) + 10;
37691
+ switch (t15) {
37681
37692
  case " ":
37682
37693
  return 36;
37683
37694
  case "$":
@@ -37697,31 +37708,31 @@ var require_qr_code_styling = __commonJS2({
37697
37708
  case ":":
37698
37709
  return 44;
37699
37710
  default:
37700
- throw "illegal char :" + t11;
37711
+ throw "illegal char :" + t15;
37701
37712
  }
37702
37713
  };
37703
37714
  return i4;
37704
37715
  }, f = function(e4) {
37705
- var i4 = t9.stringToBytes(e4);
37716
+ var i4 = t13.stringToBytes(e4);
37706
37717
  return { getMode: function() {
37707
37718
  return 4;
37708
- }, getLength: function(t10) {
37719
+ }, getLength: function(t14) {
37709
37720
  return i4.length;
37710
- }, write: function(t10) {
37711
- for (var e5 = 0; e5 < i4.length; e5 += 1) t10.put(i4[e5], 8);
37721
+ }, write: function(t14) {
37722
+ for (var e5 = 0; e5 < i4.length; e5 += 1) t14.put(i4[e5], 8);
37712
37723
  } };
37713
37724
  }, w = function(e4) {
37714
- var i4 = t9.stringToBytesFuncs.SJIS;
37725
+ var i4 = t13.stringToBytesFuncs.SJIS;
37715
37726
  if (!i4) throw "sjis not supported.";
37716
37727
  !(function() {
37717
- var t10 = i4("\u53CB");
37718
- if (2 != t10.length || 38726 != (t10[0] << 8 | t10[1])) throw "sjis not supported.";
37728
+ var t14 = i4("\u53CB");
37729
+ if (2 != t14.length || 38726 != (t14[0] << 8 | t14[1])) throw "sjis not supported.";
37719
37730
  })();
37720
37731
  var r5 = i4(e4), n3 = { getMode: function() {
37721
37732
  return 8;
37722
- }, getLength: function(t10) {
37733
+ }, getLength: function(t14) {
37723
37734
  return ~~(r5.length / 2);
37724
- }, write: function(t10) {
37735
+ }, write: function(t14) {
37725
37736
  for (var e5 = r5, i5 = 0; i5 + 1 < e5.length; ) {
37726
37737
  var n4 = (255 & e5[i5]) << 8 | 255 & e5[i5 + 1];
37727
37738
  if (33088 <= n4 && n4 <= 40956) n4 -= 33088;
@@ -37729,69 +37740,69 @@ var require_qr_code_styling = __commonJS2({
37729
37740
  if (!(57408 <= n4 && n4 <= 60351)) throw "illegal char at " + (i5 + 1) + "/" + n4;
37730
37741
  n4 -= 49472;
37731
37742
  }
37732
- n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t10.put(n4, 13), i5 += 2;
37743
+ n4 = 192 * (n4 >>> 8 & 255) + (255 & n4), t14.put(n4, 13), i5 += 2;
37733
37744
  }
37734
37745
  if (i5 < e5.length) throw "illegal char at " + (i5 + 1);
37735
37746
  } };
37736
37747
  return n3;
37737
37748
  }, p = function() {
37738
- var t10 = [], e4 = { writeByte: function(e5) {
37739
- t10.push(255 & e5);
37740
- }, writeShort: function(t11) {
37741
- e4.writeByte(t11), e4.writeByte(t11 >>> 8);
37742
- }, writeBytes: function(t11, i4, r5) {
37743
- i4 = i4 || 0, r5 = r5 || t11.length;
37744
- for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t11[n3 + i4]);
37745
- }, writeString: function(t11) {
37746
- for (var i4 = 0; i4 < t11.length; i4 += 1) e4.writeByte(t11.charCodeAt(i4));
37749
+ var t14 = [], e4 = { writeByte: function(e5) {
37750
+ t14.push(255 & e5);
37751
+ }, writeShort: function(t15) {
37752
+ e4.writeByte(t15), e4.writeByte(t15 >>> 8);
37753
+ }, writeBytes: function(t15, i4, r5) {
37754
+ i4 = i4 || 0, r5 = r5 || t15.length;
37755
+ for (var n3 = 0; n3 < r5; n3 += 1) e4.writeByte(t15[n3 + i4]);
37756
+ }, writeString: function(t15) {
37757
+ for (var i4 = 0; i4 < t15.length; i4 += 1) e4.writeByte(t15.charCodeAt(i4));
37747
37758
  }, toByteArray: function() {
37748
- return t10;
37759
+ return t14;
37749
37760
  }, toString: function() {
37750
37761
  var e5 = "";
37751
37762
  e5 += "[";
37752
- for (var i4 = 0; i4 < t10.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t10[i4];
37763
+ for (var i4 = 0; i4 < t14.length; i4 += 1) i4 > 0 && (e5 += ","), e5 += t14[i4];
37753
37764
  return e5 + "]";
37754
37765
  } };
37755
37766
  return e4;
37756
- }, v = function(t10) {
37757
- var e4 = t10, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
37767
+ }, v = function(t14) {
37768
+ var e4 = t14, i4 = 0, r5 = 0, n3 = 0, o2 = { read: function() {
37758
37769
  for (; n3 < 8; ) {
37759
37770
  if (i4 >= e4.length) {
37760
37771
  if (0 == n3) return -1;
37761
37772
  throw "unexpected end of file./" + n3;
37762
37773
  }
37763
- var t11 = e4.charAt(i4);
37764
- if (i4 += 1, "=" == t11) return n3 = 0, -1;
37765
- t11.match(/^\s$/) || (r5 = r5 << 6 | s2(t11.charCodeAt(0)), n3 += 6);
37774
+ var t15 = e4.charAt(i4);
37775
+ if (i4 += 1, "=" == t15) return n3 = 0, -1;
37776
+ t15.match(/^\s$/) || (r5 = r5 << 6 | s2(t15.charCodeAt(0)), n3 += 6);
37766
37777
  }
37767
37778
  var o3 = r5 >>> n3 - 8 & 255;
37768
37779
  return n3 -= 8, o3;
37769
- } }, s2 = function(t11) {
37770
- if (65 <= t11 && t11 <= 90) return t11 - 65;
37771
- if (97 <= t11 && t11 <= 122) return t11 - 97 + 26;
37772
- if (48 <= t11 && t11 <= 57) return t11 - 48 + 52;
37773
- if (43 == t11) return 62;
37774
- if (47 == t11) return 63;
37775
- throw "c:" + t11;
37780
+ } }, s2 = function(t15) {
37781
+ if (65 <= t15 && t15 <= 90) return t15 - 65;
37782
+ if (97 <= t15 && t15 <= 122) return t15 - 97 + 26;
37783
+ if (48 <= t15 && t15 <= 57) return t15 - 48 + 52;
37784
+ if (43 == t15) return 62;
37785
+ if (47 == t15) return 63;
37786
+ throw "c:" + t15;
37776
37787
  };
37777
37788
  return o2;
37778
- }, _ = function(t10, e4, i4) {
37779
- for (var r5 = (function(t11, e5) {
37780
- var i5 = t11, r6 = e5, n4 = new Array(t11 * e5), o3 = { setPixel: function(t12, e6, r7) {
37781
- n4[e6 * i5 + t12] = r7;
37782
- }, write: function(t12) {
37783
- t12.writeString("GIF87a"), t12.writeShort(i5), t12.writeShort(r6), t12.writeByte(128), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(0), t12.writeByte(255), t12.writeByte(255), t12.writeByte(255), t12.writeString(","), t12.writeShort(0), t12.writeShort(0), t12.writeShort(i5), t12.writeShort(r6), t12.writeByte(0);
37789
+ }, _ = function(t14, e4, i4) {
37790
+ for (var r5 = (function(t15, e5) {
37791
+ var i5 = t15, r6 = e5, n4 = new Array(t15 * e5), o3 = { setPixel: function(t16, e6, r7) {
37792
+ n4[e6 * i5 + t16] = r7;
37793
+ }, write: function(t16) {
37794
+ 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);
37784
37795
  var e6 = s3(2);
37785
- t12.writeByte(2);
37786
- for (var n5 = 0; e6.length - n5 > 255; ) t12.writeByte(255), t12.writeBytes(e6, n5, 255), n5 += 255;
37787
- t12.writeByte(e6.length - n5), t12.writeBytes(e6, n5, e6.length - n5), t12.writeByte(0), t12.writeString(";");
37788
- } }, s3 = function(t12) {
37789
- for (var e6 = 1 << t12, i6 = 1 + (1 << t12), r7 = t12 + 1, o4 = a3(), s4 = 0; s4 < e6; s4 += 1) o4.add(String.fromCharCode(s4));
37796
+ t16.writeByte(2);
37797
+ for (var n5 = 0; e6.length - n5 > 255; ) t16.writeByte(255), t16.writeBytes(e6, n5, 255), n5 += 255;
37798
+ t16.writeByte(e6.length - n5), t16.writeBytes(e6, n5, e6.length - n5), t16.writeByte(0), t16.writeString(";");
37799
+ } }, s3 = function(t16) {
37800
+ 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));
37790
37801
  o4.add(String.fromCharCode(e6)), o4.add(String.fromCharCode(i6));
37791
- var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t13, e7) {
37792
- if (t13 >>> e7 != 0) throw "length over";
37793
- for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t13 << d3 | u2)), e7 -= 8 - d3, t13 >>>= 8 - d3, u2 = 0, d3 = 0;
37794
- u2 |= t13 << d3, d3 += e7;
37802
+ var h3, d3, u2, c2 = p(), l2 = (h3 = c2, d3 = 0, u2 = 0, { write: function(t17, e7) {
37803
+ if (t17 >>> e7 != 0) throw "length over";
37804
+ for (; d3 + e7 >= 8; ) h3.writeByte(255 & (t17 << d3 | u2)), e7 -= 8 - d3, t17 >>>= 8 - d3, u2 = 0, d3 = 0;
37805
+ u2 |= t17 << d3, d3 += e7;
37795
37806
  }, flush: function() {
37796
37807
  d3 > 0 && h3.writeByte(u2);
37797
37808
  } });
@@ -37803,95 +37814,95 @@ var require_qr_code_styling = __commonJS2({
37803
37814
  }
37804
37815
  return l2.write(o4.indexOf(f2), r7), l2.write(i6, r7), l2.flush(), c2.toByteArray();
37805
37816
  }, a3 = function() {
37806
- var t12 = {}, e6 = 0, i6 = { add: function(r7) {
37817
+ var t16 = {}, e6 = 0, i6 = { add: function(r7) {
37807
37818
  if (i6.contains(r7)) throw "dup key:" + r7;
37808
- t12[r7] = e6, e6 += 1;
37819
+ t16[r7] = e6, e6 += 1;
37809
37820
  }, size: function() {
37810
37821
  return e6;
37811
37822
  }, indexOf: function(e7) {
37812
- return t12[e7];
37823
+ return t16[e7];
37813
37824
  }, contains: function(e7) {
37814
- return void 0 !== t12[e7];
37825
+ return void 0 !== t16[e7];
37815
37826
  } };
37816
37827
  return i6;
37817
37828
  };
37818
37829
  return o3;
37819
- })(t10, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t10; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
37830
+ })(t14, e4), n3 = 0; n3 < e4; n3 += 1) for (var o2 = 0; o2 < t14; o2 += 1) r5.setPixel(o2, n3, i4(o2, n3));
37820
37831
  var s2 = p();
37821
37832
  r5.write(s2);
37822
37833
  for (var a2 = (function() {
37823
- var t11 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t12) {
37824
- r6 += String.fromCharCode(s3(63 & t12));
37825
- }, s3 = function(t12) {
37826
- if (t12 < 0) ;
37834
+ var t15 = 0, e5 = 0, i5 = 0, r6 = "", n4 = {}, o3 = function(t16) {
37835
+ r6 += String.fromCharCode(s3(63 & t16));
37836
+ }, s3 = function(t16) {
37837
+ if (t16 < 0) ;
37827
37838
  else {
37828
- if (t12 < 26) return 65 + t12;
37829
- if (t12 < 52) return t12 - 26 + 97;
37830
- if (t12 < 62) return t12 - 52 + 48;
37831
- if (62 == t12) return 43;
37832
- if (63 == t12) return 47;
37839
+ if (t16 < 26) return 65 + t16;
37840
+ if (t16 < 52) return t16 - 26 + 97;
37841
+ if (t16 < 62) return t16 - 52 + 48;
37842
+ if (62 == t16) return 43;
37843
+ if (63 == t16) return 47;
37833
37844
  }
37834
- throw "n:" + t12;
37845
+ throw "n:" + t16;
37835
37846
  };
37836
37847
  return n4.writeByte = function(r7) {
37837
- for (t11 = t11 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t11 >>> e5 - 6), e5 -= 6;
37848
+ for (t15 = t15 << 8 | 255 & r7, e5 += 8, i5 += 1; e5 >= 6; ) o3(t15 >>> e5 - 6), e5 -= 6;
37838
37849
  }, n4.flush = function() {
37839
- if (e5 > 0 && (o3(t11 << 6 - e5), t11 = 0, e5 = 0), i5 % 3 != 0) for (var n5 = 3 - i5 % 3, s4 = 0; s4 < n5; s4 += 1) r6 += "=";
37850
+ 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 += "=";
37840
37851
  }, n4.toString = function() {
37841
37852
  return r6;
37842
37853
  }, n4;
37843
37854
  })(), h2 = s2.toByteArray(), d2 = 0; d2 < h2.length; d2 += 1) a2.writeByte(h2[d2]);
37844
37855
  return a2.flush(), "data:image/gif;base64," + a2;
37845
37856
  };
37846
- return t9;
37857
+ return t13;
37847
37858
  })();
37848
- n.stringToBytesFuncs["UTF-8"] = function(t9) {
37849
- return (function(t10) {
37850
- for (var e3 = [], i3 = 0; i3 < t10.length; i3++) {
37851
- var r4 = t10.charCodeAt(i3);
37852
- 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 & t10.charCodeAt(i3)), e3.push(240 | r4 >> 18, 128 | r4 >> 12 & 63, 128 | r4 >> 6 & 63, 128 | 63 & r4));
37859
+ n.stringToBytesFuncs["UTF-8"] = function(t13) {
37860
+ return (function(t14) {
37861
+ for (var e3 = [], i3 = 0; i3 < t14.length; i3++) {
37862
+ var r4 = t14.charCodeAt(i3);
37863
+ 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));
37853
37864
  }
37854
37865
  return e3;
37855
- })(t9);
37866
+ })(t13);
37856
37867
  }, void 0 === (r3 = "function" == typeof (i2 = function() {
37857
37868
  return n;
37858
- }) ? i2.apply(e2, []) : i2) || (t8.exports = r3);
37869
+ }) ? i2.apply(e2, []) : i2) || (t12.exports = r3);
37859
37870
  } }, e = {};
37860
37871
  function i(r3) {
37861
37872
  var n = e[r3];
37862
37873
  if (void 0 !== n) return n.exports;
37863
37874
  var o = e[r3] = { exports: {} };
37864
- return t7[r3](o, o.exports, i), o.exports;
37875
+ return t11[r3](o, o.exports, i), o.exports;
37865
37876
  }
37866
- i.n = (t8) => {
37867
- var e2 = t8 && t8.__esModule ? () => t8.default : () => t8;
37877
+ i.n = (t12) => {
37878
+ var e2 = t12 && t12.__esModule ? () => t12.default : () => t12;
37868
37879
  return i.d(e2, { a: e2 }), e2;
37869
- }, i.d = (t8, e2) => {
37870
- for (var r3 in e2) i.o(e2, r3) && !i.o(t8, r3) && Object.defineProperty(t8, r3, { enumerable: true, get: e2[r3] });
37871
- }, i.o = (t8, e2) => Object.prototype.hasOwnProperty.call(t8, e2);
37880
+ }, i.d = (t12, e2) => {
37881
+ for (var r3 in e2) i.o(e2, r3) && !i.o(t12, r3) && Object.defineProperty(t12, r3, { enumerable: true, get: e2[r3] });
37882
+ }, i.o = (t12, e2) => Object.prototype.hasOwnProperty.call(t12, e2);
37872
37883
  var r2 = {};
37873
37884
  return (() => {
37874
37885
  "use strict";
37875
37886
  i.d(r2, { default: () => $ });
37876
- const t8 = (t9) => !!t9 && "object" == typeof t9 && !Array.isArray(t9);
37887
+ const t12 = (t13) => !!t13 && "object" == typeof t13 && !Array.isArray(t13);
37877
37888
  function e2(i2, ...r3) {
37878
37889
  if (!r3.length) return i2;
37879
37890
  const n2 = r3.shift();
37880
- return void 0 !== n2 && t8(i2) && t8(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
37891
+ return void 0 !== n2 && t12(i2) && t12(n2) ? (i2 = Object.assign({}, i2), Object.keys(n2).forEach(((r4) => {
37881
37892
  const o2 = i2[r4], s2 = n2[r4];
37882
- Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t8(o2) && t8(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
37893
+ Array.isArray(o2) && Array.isArray(s2) ? i2[r4] = s2 : t12(o2) && t12(s2) ? i2[r4] = e2(Object.assign({}, o2), s2) : i2[r4] = s2;
37883
37894
  })), e2(i2, ...r3)) : i2;
37884
37895
  }
37885
- function n(t9, e3) {
37896
+ function n(t13, e3) {
37886
37897
  const i2 = document.createElement("a");
37887
- i2.download = e3, i2.href = t9, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
37898
+ i2.download = e3, i2.href = t13, document.body.appendChild(i2), i2.click(), document.body.removeChild(i2);
37888
37899
  }
37889
37900
  const o = { L: 0.07, M: 0.15, Q: 0.25, H: 0.3 };
37890
37901
  class s {
37891
- constructor({ svg: t9, type: e3, window: i2 }) {
37892
- this._svg = t9, this._type = e3, this._window = i2;
37902
+ constructor({ svg: t13, type: e3, window: i2 }) {
37903
+ this._svg = t13, this._type = e3, this._window = i2;
37893
37904
  }
37894
- draw(t9, e3, i2, r3) {
37905
+ draw(t13, e3, i2, r3) {
37895
37906
  let n2;
37896
37907
  switch (this._type) {
37897
37908
  case "dots":
@@ -37912,100 +37923,100 @@ var require_qr_code_styling = __commonJS2({
37912
37923
  default:
37913
37924
  n2 = this._drawSquare;
37914
37925
  }
37915
- n2.call(this, { x: t9, y: e3, size: i2, getNeighbor: r3 });
37926
+ n2.call(this, { x: t13, y: e3, size: i2, getNeighbor: r3 });
37916
37927
  }
37917
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
37928
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
37918
37929
  var o2;
37919
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
37930
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
37920
37931
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
37921
37932
  }
37922
- _basicDot(t9) {
37923
- const { size: e3, x: i2, y: r3 } = t9;
37924
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37933
+ _basicDot(t13) {
37934
+ const { size: e3, x: i2, y: r3 } = t13;
37935
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37925
37936
  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));
37926
37937
  } }));
37927
37938
  }
37928
- _basicSquare(t9) {
37929
- const { size: e3, x: i2, y: r3 } = t9;
37930
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37939
+ _basicSquare(t13) {
37940
+ const { size: e3, x: i2, y: r3 } = t13;
37941
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37931
37942
  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));
37932
37943
  } }));
37933
37944
  }
37934
- _basicSideRounded(t9) {
37935
- const { size: e3, x: i2, y: r3 } = t9;
37936
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37945
+ _basicSideRounded(t13) {
37946
+ const { size: e3, x: i2, y: r3 } = t13;
37947
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37937
37948
  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}`);
37938
37949
  } }));
37939
37950
  }
37940
- _basicCornerRounded(t9) {
37941
- const { size: e3, x: i2, y: r3 } = t9;
37942
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37951
+ _basicCornerRounded(t13) {
37952
+ const { size: e3, x: i2, y: r3 } = t13;
37953
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37943
37954
  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}`);
37944
37955
  } }));
37945
37956
  }
37946
- _basicCornerExtraRounded(t9) {
37947
- const { size: e3, x: i2, y: r3 } = t9;
37948
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37957
+ _basicCornerExtraRounded(t13) {
37958
+ const { size: e3, x: i2, y: r3 } = t13;
37959
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37949
37960
  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}`);
37950
37961
  } }));
37951
37962
  }
37952
- _basicCornersRounded(t9) {
37953
- const { size: e3, x: i2, y: r3 } = t9;
37954
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
37963
+ _basicCornersRounded(t13) {
37964
+ const { size: e3, x: i2, y: r3 } = t13;
37965
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
37955
37966
  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}`);
37956
37967
  } }));
37957
37968
  }
37958
- _drawDot({ x: t9, y: e3, size: i2 }) {
37959
- this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
37969
+ _drawDot({ x: t13, y: e3, size: i2 }) {
37970
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
37960
37971
  }
37961
- _drawSquare({ x: t9, y: e3, size: i2 }) {
37962
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
37972
+ _drawSquare({ x: t13, y: e3, size: i2 }) {
37973
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
37963
37974
  }
37964
- _drawRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
37975
+ _drawRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
37965
37976
  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;
37966
- if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
37977
+ if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
37967
37978
  else {
37968
37979
  if (2 === h2) {
37969
37980
  let r4 = 0;
37970
- return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: r4 });
37981
+ 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 });
37971
37982
  }
37972
37983
  if (1 === h2) {
37973
37984
  let r4 = 0;
37974
- return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t9, y: e3, size: i2, rotation: r4 });
37985
+ 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 });
37975
37986
  }
37976
37987
  }
37977
- else this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
37988
+ else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
37978
37989
  }
37979
- _drawExtraRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
37990
+ _drawExtraRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
37980
37991
  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;
37981
- if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 });
37992
+ if (0 !== h2) if (h2 > 2 || n2 && o2 || s2 && a2) this._basicSquare({ x: t13, y: e3, size: i2, rotation: 0 });
37982
37993
  else {
37983
37994
  if (2 === h2) {
37984
37995
  let r4 = 0;
37985
- return n2 && s2 ? r4 = Math.PI / 2 : s2 && o2 ? r4 = Math.PI : o2 && a2 && (r4 = -Math.PI / 2), void this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: r4 });
37996
+ 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 });
37986
37997
  }
37987
37998
  if (1 === h2) {
37988
37999
  let r4 = 0;
37989
- return s2 ? r4 = Math.PI / 2 : o2 ? r4 = Math.PI : a2 && (r4 = -Math.PI / 2), void this._basicSideRounded({ x: t9, y: e3, size: i2, rotation: r4 });
38000
+ 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 });
37990
38001
  }
37991
38002
  }
37992
- else this._basicDot({ x: t9, y: e3, size: i2, rotation: 0 });
38003
+ else this._basicDot({ x: t13, y: e3, size: i2, rotation: 0 });
37993
38004
  }
37994
- _drawClassy({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
38005
+ _drawClassy({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
37995
38006
  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;
37996
- 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 }) : this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerRounded({ x: t9, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 });
38007
+ 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 });
37997
38008
  }
37998
- _drawClassyRounded({ x: t9, y: e3, size: i2, getNeighbor: r3 }) {
38009
+ _drawClassyRounded({ x: t13, y: e3, size: i2, getNeighbor: r3 }) {
37999
38010
  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;
38000
- 0 !== n2 + o2 + s2 + a2 ? n2 || s2 ? o2 || a2 ? this._basicSquare({ x: t9, y: e3, size: i2, rotation: 0 }) : this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 }) : this._basicCornerExtraRounded({ x: t9, y: e3, size: i2, rotation: -Math.PI / 2 }) : this._basicCornersRounded({ x: t9, y: e3, size: i2, rotation: Math.PI / 2 });
38011
+ 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 });
38001
38012
  }
38002
38013
  }
38003
38014
  const a = { dot: "dot", square: "square", extraRounded: "extra-rounded" }, h = Object.values(a);
38004
38015
  class d {
38005
- constructor({ svg: t9, type: e3, window: i2 }) {
38006
- this._svg = t9, this._type = e3, this._window = i2;
38016
+ constructor({ svg: t13, type: e3, window: i2 }) {
38017
+ this._svg = t13, this._type = e3, this._window = i2;
38007
38018
  }
38008
- draw(t9, e3, i2, r3) {
38019
+ draw(t13, e3, i2, r3) {
38009
38020
  let n2;
38010
38021
  switch (this._type) {
38011
38022
  case a.square:
@@ -38017,78 +38028,78 @@ var require_qr_code_styling = __commonJS2({
38017
38028
  default:
38018
38029
  n2 = this._drawDot;
38019
38030
  }
38020
- n2.call(this, { x: t9, y: e3, size: i2, rotation: r3 });
38031
+ n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
38021
38032
  }
38022
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
38033
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
38023
38034
  var o2;
38024
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
38035
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
38025
38036
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
38026
38037
  }
38027
- _basicDot(t9) {
38028
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
38029
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
38038
+ _basicDot(t13) {
38039
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
38040
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
38030
38041
  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`);
38031
38042
  } }));
38032
38043
  }
38033
- _basicSquare(t9) {
38034
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
38035
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
38044
+ _basicSquare(t13) {
38045
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
38046
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
38036
38047
  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");
38037
38048
  } }));
38038
38049
  }
38039
- _basicExtraRounded(t9) {
38040
- const { size: e3, x: i2, y: r3 } = t9, n2 = e3 / 7;
38041
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
38050
+ _basicExtraRounded(t13) {
38051
+ const { size: e3, x: i2, y: r3 } = t13, n2 = e3 / 7;
38052
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
38042
38053
  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}`);
38043
38054
  } }));
38044
38055
  }
38045
- _drawDot({ x: t9, y: e3, size: i2, rotation: r3 }) {
38046
- this._basicDot({ x: t9, y: e3, size: i2, rotation: r3 });
38056
+ _drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
38057
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
38047
38058
  }
38048
- _drawSquare({ x: t9, y: e3, size: i2, rotation: r3 }) {
38049
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: r3 });
38059
+ _drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
38060
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
38050
38061
  }
38051
- _drawExtraRounded({ x: t9, y: e3, size: i2, rotation: r3 }) {
38052
- this._basicExtraRounded({ x: t9, y: e3, size: i2, rotation: r3 });
38062
+ _drawExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 }) {
38063
+ this._basicExtraRounded({ x: t13, y: e3, size: i2, rotation: r3 });
38053
38064
  }
38054
38065
  }
38055
38066
  const u = { dot: "dot", square: "square" }, c = Object.values(u);
38056
38067
  class l {
38057
- constructor({ svg: t9, type: e3, window: i2 }) {
38058
- this._svg = t9, this._type = e3, this._window = i2;
38068
+ constructor({ svg: t13, type: e3, window: i2 }) {
38069
+ this._svg = t13, this._type = e3, this._window = i2;
38059
38070
  }
38060
- draw(t9, e3, i2, r3) {
38071
+ draw(t13, e3, i2, r3) {
38061
38072
  let n2;
38062
- n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t9, y: e3, size: i2, rotation: r3 });
38073
+ n2 = this._type === u.square ? this._drawSquare : this._drawDot, n2.call(this, { x: t13, y: e3, size: i2, rotation: r3 });
38063
38074
  }
38064
- _rotateFigure({ x: t9, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
38075
+ _rotateFigure({ x: t13, y: e3, size: i2, rotation: r3 = 0, draw: n2 }) {
38065
38076
  var o2;
38066
- const s2 = t9 + i2 / 2, a2 = e3 + i2 / 2;
38077
+ const s2 = t13 + i2 / 2, a2 = e3 + i2 / 2;
38067
38078
  n2(), null === (o2 = this._element) || void 0 === o2 || o2.setAttribute("transform", `rotate(${180 * r3 / Math.PI},${s2},${a2})`);
38068
38079
  }
38069
- _basicDot(t9) {
38070
- const { size: e3, x: i2, y: r3 } = t9;
38071
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
38080
+ _basicDot(t13) {
38081
+ const { size: e3, x: i2, y: r3 } = t13;
38082
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
38072
38083
  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));
38073
38084
  } }));
38074
38085
  }
38075
- _basicSquare(t9) {
38076
- const { size: e3, x: i2, y: r3 } = t9;
38077
- this._rotateFigure(Object.assign(Object.assign({}, t9), { draw: () => {
38086
+ _basicSquare(t13) {
38087
+ const { size: e3, x: i2, y: r3 } = t13;
38088
+ this._rotateFigure(Object.assign(Object.assign({}, t13), { draw: () => {
38078
38089
  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));
38079
38090
  } }));
38080
38091
  }
38081
- _drawDot({ x: t9, y: e3, size: i2, rotation: r3 }) {
38082
- this._basicDot({ x: t9, y: e3, size: i2, rotation: r3 });
38092
+ _drawDot({ x: t13, y: e3, size: i2, rotation: r3 }) {
38093
+ this._basicDot({ x: t13, y: e3, size: i2, rotation: r3 });
38083
38094
  }
38084
- _drawSquare({ x: t9, y: e3, size: i2, rotation: r3 }) {
38085
- this._basicSquare({ x: t9, y: e3, size: i2, rotation: r3 });
38095
+ _drawSquare({ x: t13, y: e3, size: i2, rotation: r3 }) {
38096
+ this._basicSquare({ x: t13, y: e3, size: i2, rotation: r3 });
38086
38097
  }
38087
38098
  }
38088
38099
  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]];
38089
38100
  class p {
38090
- constructor(t9, e3) {
38091
- this._roundSize = (t10) => this._options.dotsOptions.roundSize ? Math.floor(t10) : t10, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t9.width)), this._element.setAttribute("height", String(t9.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t9.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t9.width} ${t9.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t9.image, this._instanceId = p.instanceCount++, this._options = t9;
38101
+ constructor(t13, e3) {
38102
+ 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;
38092
38103
  }
38093
38104
  get width() {
38094
38105
  return this._options.width;
@@ -38099,135 +38110,135 @@ var require_qr_code_styling = __commonJS2({
38099
38110
  getElement() {
38100
38111
  return this._element;
38101
38112
  }
38102
- async drawQR(t9) {
38103
- const e3 = t9.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);
38113
+ async drawQR(t13) {
38114
+ 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);
38104
38115
  let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
38105
- if (this._qr = t9, this._options.image) {
38116
+ if (this._qr = t13, this._options.image) {
38106
38117
  if (await this.loadImage(), !this._image) return;
38107
- const { imageOptions: t10, qrOptions: i3 } = this._options, r4 = t10.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
38108
- s2 = (function({ originalHeight: t11, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
38118
+ const { imageOptions: t14, qrOptions: i3 } = this._options, r4 = t14.imageSize * o[i3.errorCorrectionLevel], a2 = Math.floor(r4 * e3 * e3);
38119
+ s2 = (function({ originalHeight: t15, originalWidth: e4, maxHiddenDots: i4, maxHiddenAxisDots: r5, dotSize: n3 }) {
38109
38120
  const o2 = { x: 0, y: 0 }, s3 = { x: 0, y: 0 };
38110
- if (t11 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
38111
- const a3 = t11 / e4;
38121
+ if (t15 <= 0 || e4 <= 0 || i4 <= 0 || n3 <= 0) return { height: 0, width: 0, hideYDots: 0, hideXDots: 0 };
38122
+ const a3 = t15 / e4;
38112
38123
  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 };
38113
38124
  })({ originalWidth: this._image.width, originalHeight: this._image.height, maxHiddenDots: a2, maxHiddenAxisDots: e3 - 14, dotSize: n2 });
38114
38125
  }
38115
- this.drawBackground(), this.drawDots(((t10, i3) => {
38126
+ this.drawBackground(), this.drawDots(((t14, i3) => {
38116
38127
  var r4, n3, o2, a2, h2, d2;
38117
- return !(this._options.imageOptions.hideBackgroundDots && t10 >= (e3 - s2.hideYDots) / 2 && t10 < (e3 + s2.hideYDots) / 2 && i3 >= (e3 - s2.hideXDots) / 2 && i3 < (e3 + s2.hideXDots) / 2 || (null === (r4 = f[t10]) || void 0 === r4 ? void 0 : r4[i3]) || (null === (n3 = f[t10 - e3 + 7]) || void 0 === n3 ? void 0 : n3[i3]) || (null === (o2 = f[t10]) || void 0 === o2 ? void 0 : o2[i3 - e3 + 7]) || (null === (a2 = w[t10]) || void 0 === a2 ? void 0 : a2[i3]) || (null === (h2 = w[t10 - e3 + 7]) || void 0 === h2 ? void 0 : h2[i3]) || (null === (d2 = w[t10]) || void 0 === d2 ? void 0 : d2[i3 - e3 + 7]));
38128
+ 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]));
38118
38129
  })), this.drawCorners(), this._options.image && await this.drawImage({ width: s2.width, height: s2.height, count: e3, dotSize: n2 });
38119
38130
  }
38120
38131
  drawBackground() {
38121
- var t9, e3, i2;
38132
+ var t13, e3, i2;
38122
38133
  const r3 = this._element, n2 = this._options;
38123
38134
  if (r3) {
38124
- const r4 = null === (t9 = n2.backgroundOptions) || void 0 === t9 ? void 0 : t9.gradient, o2 = null === (e3 = n2.backgroundOptions) || void 0 === e3 ? void 0 : e3.color;
38135
+ 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;
38125
38136
  let s2 = n2.height, a2 = n2.width;
38126
38137
  if (r4 || o2) {
38127
- const t10 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
38128
- 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), t10.setAttribute("rx", String(s2 / 2 * n2.backgroundOptions.round))), t10.setAttribute("x", String(this._roundSize((n2.width - a2) / 2))), t10.setAttribute("y", String(this._roundSize((n2.height - s2) / 2))), t10.setAttribute("width", String(a2)), t10.setAttribute("height", String(s2)), this._backgroundClipPath.appendChild(t10), this._createColor({ options: r4, color: o2, additionalRotation: 0, x: 0, y: 0, height: n2.height, width: n2.width, name: `background-color-${this._instanceId}` });
38138
+ const t14 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
38139
+ 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}` });
38129
38140
  }
38130
38141
  }
38131
38142
  }
38132
- drawDots(t9) {
38143
+ drawDots(t13) {
38133
38144
  var e3, i2;
38134
38145
  if (!this._qr) throw "QR code is not defined";
38135
38146
  const r3 = this._options, n2 = this._qr.getModuleCount();
38136
38147
  if (n2 > r3.width || n2 > r3.height) throw "The canvas is too small.";
38137
38148
  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 });
38138
38149
  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}` });
38139
- for (let e4 = 0; e4 < n2; e4++) for (let r4 = 0; r4 < n2; r4++) t9 && !t9(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) && !(t9 && !t9(e4 + o3, r4 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r4 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
38150
+ 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));
38140
38151
  if (r3.shape === g) {
38141
- const t10 = this._roundSize((o2 / h2 - n2) / 2), e4 = n2 + 2 * t10, i3 = d2 - t10 * h2, r4 = u2 - t10 * h2, s2 = [], a3 = this._roundSize(e4 / 2);
38152
+ 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);
38142
38153
  for (let i4 = 0; i4 < e4; i4++) {
38143
38154
  s2[i4] = [];
38144
- for (let r5 = 0; r5 < e4; r5++) i4 >= t10 - 1 && i4 <= e4 - t10 && r5 >= t10 - 1 && r5 <= e4 - t10 || Math.sqrt((i4 - a3) * (i4 - a3) + (r5 - a3) * (r5 - a3)) > a3 ? s2[i4][r5] = 0 : s2[i4][r5] = this._qr.isDark(r5 - 2 * t10 < 0 ? r5 : r5 >= n2 ? r5 - 2 * t10 : r5 - t10, i4 - 2 * t10 < 0 ? i4 : i4 >= n2 ? i4 - 2 * t10 : i4 - t10) ? 1 : 0;
38155
+ 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;
38145
38156
  }
38146
- for (let t11 = 0; t11 < e4; t11++) for (let n3 = 0; n3 < e4; n3++) s2[t11][n3] && (c2.draw(i3 + n3 * h2, r4 + t11 * h2, h2, ((e5, i4) => {
38157
+ 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) => {
38147
38158
  var r5;
38148
- return !!(null === (r5 = s2[t11 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
38159
+ return !!(null === (r5 = s2[t15 + i4]) || void 0 === r5 ? void 0 : r5[n3 + e5]);
38149
38160
  })), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
38150
38161
  }
38151
38162
  }
38152
38163
  drawCorners() {
38153
38164
  if (!this._qr) throw "QR code is not defined";
38154
- const t9 = this._element, e3 = this._options;
38155
- if (!t9) throw "Element code is not defined";
38165
+ const t13 = this._element, e3 = this._options;
38166
+ if (!t13) throw "Element code is not defined";
38156
38167
  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);
38157
- [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t10, r4, n3]) => {
38168
+ [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t14, r4, n3]) => {
38158
38169
  var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
38159
- const z = p2 + t10 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
38170
+ const z = p2 + t14 * o2 * (i2 - 7), B = v2 + r4 * o2 * (i2 - 7);
38160
38171
  let P = this._dotsClipPath, I = this._dotsClipPath;
38161
- 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-${t10}-${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-${t10}-${r4}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h.includes(e3.cornersSquareOptions.type)) {
38162
- const t11 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
38163
- t11.draw(z, B, a2, n3), t11._element && P && P.appendChild(t11._element);
38172
+ 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)) {
38173
+ const t15 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
38174
+ t15.draw(z, B, a2, n3), t15._element && P && P.appendChild(t15._element);
38164
38175
  } else {
38165
- const t11 = new s({ svg: this._element, type: (null === (x2 = e3.cornersSquareOptions) || void 0 === x2 ? void 0 : x2.type) || e3.dotsOptions.type, window: this._window });
38166
- 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]) && (t11.draw(z + i3 * o2, B + e4 * o2, o2, ((t12, r5) => {
38176
+ 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 });
38177
+ 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) => {
38167
38178
  var n4;
38168
- return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t12]);
38169
- })), t11._element && P && P.appendChild(t11._element));
38179
+ return !!(null === (n4 = f[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
38180
+ })), t15._element && P && P.appendChild(t15._element));
38170
38181
  }
38171
- 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-${t10}-${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-${t10}-${r4}-${this._instanceId}` })), (null === (O = e3.cornersDotOptions) || void 0 === O ? void 0 : O.type) && c.includes(e3.cornersDotOptions.type)) {
38172
- const t11 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
38173
- t11.draw(z + 2 * o2, B + 2 * o2, u2, n3), t11._element && I && I.appendChild(t11._element);
38182
+ 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)) {
38183
+ const t15 = new l({ svg: this._element, type: e3.cornersDotOptions.type, window: this._window });
38184
+ t15.draw(z + 2 * o2, B + 2 * o2, u2, n3), t15._element && I && I.appendChild(t15._element);
38174
38185
  } else {
38175
- const t11 = new s({ svg: this._element, type: (null === (D = e3.cornersDotOptions) || void 0 === D ? void 0 : D.type) || e3.dotsOptions.type, window: this._window });
38176
- 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]) && (t11.draw(z + i3 * o2, B + e4 * o2, o2, ((t12, r5) => {
38186
+ 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 });
38187
+ 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) => {
38177
38188
  var n4;
38178
- return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t12]);
38179
- })), t11._element && I && I.appendChild(t11._element));
38189
+ return !!(null === (n4 = w[e4 + r5]) || void 0 === n4 ? void 0 : n4[i3 + t16]);
38190
+ })), t15._element && I && I.appendChild(t15._element));
38180
38191
  }
38181
38192
  }));
38182
38193
  }
38183
38194
  loadImage() {
38184
- return new Promise(((t9, e3) => {
38195
+ return new Promise(((t13, e3) => {
38185
38196
  var i2;
38186
38197
  const r3 = this._options;
38187
38198
  if (!r3.image) return e3("Image is not defined");
38188
38199
  if (null === (i2 = r3.nodeCanvas) || void 0 === i2 ? void 0 : i2.loadImage) r3.nodeCanvas.loadImage(r3.image).then(((e4) => {
38189
38200
  var i3, n2;
38190
38201
  if (this._image = e4, this._options.imageOptions.saveAsBlob) {
38191
- const t10 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
38192
- null === (n2 = null == t10 ? void 0 : t10.getContext("2d")) || void 0 === n2 || n2.drawImage(e4, 0, 0), this._imageUri = null == t10 ? void 0 : t10.toDataURL();
38202
+ const t14 = null === (i3 = r3.nodeCanvas) || void 0 === i3 ? void 0 : i3.createCanvas(this._image.width, this._image.height);
38203
+ 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();
38193
38204
  }
38194
- t9();
38205
+ t13();
38195
38206
  })).catch(e3);
38196
38207
  else {
38197
38208
  const e4 = new this._window.Image();
38198
38209
  "string" == typeof r3.imageOptions.crossOrigin && (e4.crossOrigin = r3.imageOptions.crossOrigin), this._image = e4, e4.onload = async () => {
38199
- this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t10, e5) {
38210
+ this._options.imageOptions.saveAsBlob && (this._imageUri = await (async function(t14, e5) {
38200
38211
  return new Promise(((i3) => {
38201
38212
  const r4 = new e5.XMLHttpRequest();
38202
38213
  r4.onload = function() {
38203
- const t11 = new e5.FileReader();
38204
- t11.onloadend = function() {
38205
- i3(t11.result);
38206
- }, t11.readAsDataURL(r4.response);
38207
- }, r4.open("GET", t10), r4.responseType = "blob", r4.send();
38214
+ const t15 = new e5.FileReader();
38215
+ t15.onloadend = function() {
38216
+ i3(t15.result);
38217
+ }, t15.readAsDataURL(r4.response);
38218
+ }, r4.open("GET", t14), r4.responseType = "blob", r4.send();
38208
38219
  }));
38209
- })(r3.image || "", this._window)), t9();
38220
+ })(r3.image || "", this._window)), t13();
38210
38221
  }, e4.src = r3.image;
38211
38222
  }
38212
38223
  }));
38213
38224
  }
38214
- async drawImage({ width: t9, height: e3, count: i2, dotSize: r3 }) {
38215
- 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 - t9) / 2), h2 = s2 + this._roundSize(n2.imageOptions.margin + (i2 * r3 - e3) / 2), d2 = t9 - 2 * n2.imageOptions.margin, u2 = e3 - 2 * n2.imageOptions.margin, c2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "image");
38225
+ async drawImage({ width: t13, height: e3, count: i2, dotSize: r3 }) {
38226
+ 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");
38216
38227
  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);
38217
38228
  }
38218
- _createColor({ options: t9, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
38229
+ _createColor({ options: t13, color: e3, additionalRotation: i2, x: r3, y: n2, height: o2, width: s2, name: a2 }) {
38219
38230
  const h2 = s2 > o2 ? s2 : o2, d2 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "rect");
38220
- 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}')`), t9) {
38231
+ 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) {
38221
38232
  let e4;
38222
- if ("radial" === t9.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));
38233
+ 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));
38223
38234
  else {
38224
- const h3 = ((t9.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
38235
+ const h3 = ((t13.rotation || 0) + i2) % (2 * Math.PI), d3 = (h3 + 2 * Math.PI) % (2 * Math.PI);
38225
38236
  let u2 = r3 + s2 / 2, c2 = n2 + o2 / 2, l2 = r3 + s2 / 2, g2 = n2 + o2 / 2;
38226
38237
  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)));
38227
38238
  }
38228
- t9.colorStops.forEach((({ offset: t10, color: i3 }) => {
38239
+ t13.colorStops.forEach((({ offset: t14, color: i3 }) => {
38229
38240
  const r4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
38230
- r4.setAttribute("offset", 100 * t10 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
38241
+ r4.setAttribute("offset", 100 * t14 + "%"), r4.setAttribute("stop-color", i3), e4.appendChild(r4);
38231
38242
  })), d2.setAttribute("fill", `url('#${a2}')`), this._defs.appendChild(e4);
38232
38243
  } else e3 && d2.setAttribute("fill", e3);
38233
38244
  this._element.appendChild(d2);
@@ -38235,119 +38246,119 @@ var require_qr_code_styling = __commonJS2({
38235
38246
  }
38236
38247
  p.instanceCount = 0;
38237
38248
  const v = p, _ = "canvas", m = {};
38238
- for (let t9 = 0; t9 <= 40; t9++) m[t9] = t9;
38249
+ for (let t13 = 0; t13 <= 40; t13++) m[t13] = t13;
38239
38250
  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" } };
38240
- function y(t9) {
38241
- const e3 = Object.assign({}, t9);
38251
+ function y(t13) {
38252
+ const e3 = Object.assign({}, t13);
38242
38253
  if (!e3.colorStops || !e3.colorStops.length) throw "Field 'colorStops' is required in gradient";
38243
- return e3.rotation ? e3.rotation = Number(e3.rotation) : e3.rotation = 0, e3.colorStops = e3.colorStops.map(((t10) => Object.assign(Object.assign({}, t10), { offset: Number(t10.offset) }))), e3;
38254
+ 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;
38244
38255
  }
38245
- function x(t9) {
38246
- const e3 = Object.assign({}, t9);
38256
+ function x(t13) {
38257
+ const e3 = Object.assign({}, t13);
38247
38258
  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;
38248
38259
  }
38249
38260
  var S = i(873), C = i.n(S);
38250
- function A(t9) {
38251
- if (!t9) throw new Error("Extension must be defined");
38252
- "." === t9[0] && (t9 = t9.substring(1));
38253
- 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" }[t9.toLowerCase()];
38254
- if (!e3) throw new Error(`Extension "${t9}" is not supported`);
38261
+ function A(t13) {
38262
+ if (!t13) throw new Error("Extension must be defined");
38263
+ "." === t13[0] && (t13 = t13.substring(1));
38264
+ 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()];
38265
+ if (!e3) throw new Error(`Extension "${t13}" is not supported`);
38255
38266
  return e3;
38256
38267
  }
38257
38268
  class M {
38258
- constructor(t9) {
38259
- (null == t9 ? void 0 : t9.jsdom) ? this._window = new t9.jsdom("", { resources: "usable" }).window : this._window = window, this._options = t9 ? x(e2(b, t9)) : b, this.update();
38269
+ constructor(t13) {
38270
+ (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();
38260
38271
  }
38261
- static _clearContainer(t9) {
38262
- t9 && (t9.innerHTML = "");
38272
+ static _clearContainer(t13) {
38273
+ t13 && (t13.innerHTML = "");
38263
38274
  }
38264
38275
  _setupSvg() {
38265
38276
  if (!this._qr) return;
38266
- const t9 = new v(this._options, this._window);
38267
- this._svg = t9.getElement(), this._svgDrawingPromise = t9.drawQR(this._qr).then((() => {
38277
+ const t13 = new v(this._options, this._window);
38278
+ this._svg = t13.getElement(), this._svgDrawingPromise = t13.drawQR(this._qr).then((() => {
38268
38279
  var e3;
38269
- this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t9.getElement(), this._options));
38280
+ this._svg && (null === (e3 = this._extension) || void 0 === e3 || e3.call(this, t13.getElement(), this._options));
38270
38281
  }));
38271
38282
  }
38272
38283
  _setupCanvas() {
38273
- var t9, e3;
38274
- this._qr && ((null === (t9 = this._options.nodeCanvas) || void 0 === t9 ? void 0 : t9.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((() => {
38275
- var t10;
38284
+ var t13, e3;
38285
+ 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((() => {
38286
+ var t14;
38276
38287
  if (!this._svg) return;
38277
38288
  const e4 = this._svg, i2 = new this._window.XMLSerializer().serializeToString(e4), r3 = btoa(i2), n2 = `data:${A("svg")};base64,${r3}`;
38278
- if (null === (t10 = this._options.nodeCanvas) || void 0 === t10 ? void 0 : t10.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t11) => {
38289
+ if (null === (t14 = this._options.nodeCanvas) || void 0 === t14 ? void 0 : t14.loadImage) return this._options.nodeCanvas.loadImage(n2).then(((t15) => {
38279
38290
  var e5, i3;
38280
- t11.width = this._options.width, t11.height = this._options.height, null === (i3 = null === (e5 = this._nodeCanvas) || void 0 === e5 ? void 0 : e5.getContext("2d")) || void 0 === i3 || i3.drawImage(t11, 0, 0);
38291
+ 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);
38281
38292
  }));
38282
38293
  {
38283
- const t11 = new this._window.Image();
38294
+ const t15 = new this._window.Image();
38284
38295
  return new Promise(((e5) => {
38285
- t11.onload = () => {
38296
+ t15.onload = () => {
38286
38297
  var i3, r4;
38287
- null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t11, 0, 0), e5();
38288
- }, t11.src = n2;
38298
+ null === (r4 = null === (i3 = this._domCanvas) || void 0 === i3 ? void 0 : i3.getContext("2d")) || void 0 === r4 || r4.drawImage(t15, 0, 0), e5();
38299
+ }, t15.src = n2;
38289
38300
  }));
38290
38301
  }
38291
38302
  })));
38292
38303
  }
38293
- async _getElement(t9 = "png") {
38304
+ async _getElement(t13 = "png") {
38294
38305
  if (!this._qr) throw "QR code is empty";
38295
- return "svg" === t9.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);
38306
+ 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);
38296
38307
  }
38297
- update(t9) {
38298
- M._clearContainer(this._container), this._options = t9 ? x(e2(this._options, t9)) : 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(t10) {
38308
+ update(t13) {
38309
+ 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) {
38299
38310
  switch (true) {
38300
- case /^[0-9]*$/.test(t10):
38311
+ case /^[0-9]*$/.test(t14):
38301
38312
  return "Numeric";
38302
- case /^[0-9A-Z $%*+\-./:]*$/.test(t10):
38313
+ case /^[0-9A-Z $%*+\-./:]*$/.test(t14):
38303
38314
  return "Alphanumeric";
38304
38315
  default:
38305
38316
  return "Byte";
38306
38317
  }
38307
38318
  })(this._options.data)), this._qr.make(), this._options.type === _ ? this._setupCanvas() : this._setupSvg(), this.append(this._container));
38308
38319
  }
38309
- append(t9) {
38310
- if (t9) {
38311
- if ("function" != typeof t9.appendChild) throw "Container should be a single DOM node";
38312
- this._options.type === _ ? this._domCanvas && t9.appendChild(this._domCanvas) : this._svg && t9.appendChild(this._svg), this._container = t9;
38320
+ append(t13) {
38321
+ if (t13) {
38322
+ if ("function" != typeof t13.appendChild) throw "Container should be a single DOM node";
38323
+ this._options.type === _ ? this._domCanvas && t13.appendChild(this._domCanvas) : this._svg && t13.appendChild(this._svg), this._container = t13;
38313
38324
  }
38314
38325
  }
38315
- applyExtension(t9) {
38316
- if (!t9) throw "Extension function should be defined.";
38317
- this._extension = t9, this.update();
38326
+ applyExtension(t13) {
38327
+ if (!t13) throw "Extension function should be defined.";
38328
+ this._extension = t13, this.update();
38318
38329
  }
38319
38330
  deleteExtension() {
38320
38331
  this._extension = void 0, this.update();
38321
38332
  }
38322
- async getRawData(t9 = "png") {
38333
+ async getRawData(t13 = "png") {
38323
38334
  if (!this._qr) throw "QR code is empty";
38324
- const e3 = await this._getElement(t9), i2 = A(t9);
38335
+ const e3 = await this._getElement(t13), i2 = A(t13);
38325
38336
  if (!e3) return null;
38326
- if ("svg" === t9.toLowerCase()) {
38327
- const t10 = `<?xml version="1.0" standalone="no"?>\r
38337
+ if ("svg" === t13.toLowerCase()) {
38338
+ const t14 = `<?xml version="1.0" standalone="no"?>\r
38328
38339
  ${new this._window.XMLSerializer().serializeToString(e3)}`;
38329
- return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t10) : new Blob([t10], { type: i2 });
38340
+ return "undefined" == typeof Blob || this._options.jsdom ? Buffer.from(t14) : new Blob([t14], { type: i2 });
38330
38341
  }
38331
- return new Promise(((t10) => {
38342
+ return new Promise(((t14) => {
38332
38343
  const r3 = e3;
38333
- if ("toBuffer" in r3) if ("image/png" === i2) t10(r3.toBuffer(i2));
38334
- else if ("image/jpeg" === i2) t10(r3.toBuffer(i2));
38344
+ if ("toBuffer" in r3) if ("image/png" === i2) t14(r3.toBuffer(i2));
38345
+ else if ("image/jpeg" === i2) t14(r3.toBuffer(i2));
38335
38346
  else {
38336
38347
  if ("application/pdf" !== i2) throw Error("Unsupported extension");
38337
- t10(r3.toBuffer(i2));
38348
+ t14(r3.toBuffer(i2));
38338
38349
  }
38339
- else "toBlob" in r3 && r3.toBlob(t10, i2, 1);
38350
+ else "toBlob" in r3 && r3.toBlob(t14, i2, 1);
38340
38351
  }));
38341
38352
  }
38342
- async download(t9) {
38353
+ async download(t13) {
38343
38354
  if (!this._qr) throw "QR code is empty";
38344
38355
  if ("undefined" == typeof Blob) throw "Cannot download in Node.js, call getRawData instead.";
38345
38356
  let e3 = "png", i2 = "qr";
38346
- "string" == typeof t9 ? (e3 = t9, console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")) : "object" == typeof t9 && null !== t9 && (t9.name && (i2 = t9.name), t9.extension && (e3 = t9.extension));
38357
+ "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));
38347
38358
  const r3 = await this._getElement(e3);
38348
38359
  if (r3) if ("svg" === e3.toLowerCase()) {
38349
- let t10 = new XMLSerializer().serializeToString(r3);
38350
- t10 = '<?xml version="1.0" standalone="no"?>\r\n' + t10, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t10)}`, `${i2}.svg`);
38360
+ let t14 = new XMLSerializer().serializeToString(r3);
38361
+ t14 = '<?xml version="1.0" standalone="no"?>\r\n' + t14, n(`data:${A(e3)};charset=utf-8,${encodeURIComponent(t14)}`, `${i2}.svg`);
38351
38362
  } else n(r3.toDataURL(A(e3)), `${i2}.${e3}`);
38352
38363
  }
38353
38364
  }
@@ -38477,6 +38488,12 @@ var ArrowLeft = createLucideIcon("ArrowLeft", [
38477
38488
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
38478
38489
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
38479
38490
  ]);
38491
+ var ArrowUpDown = createLucideIcon("ArrowUpDown", [
38492
+ ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
38493
+ ["path", { d: "M17 20V4", key: "1ejh1v" }],
38494
+ ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
38495
+ ["path", { d: "M7 4v16", key: "1glfcx" }]
38496
+ ]);
38480
38497
  var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
38481
38498
  var ChevronDown = createLucideIcon("ChevronDown", [
38482
38499
  ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
@@ -38489,6 +38506,20 @@ var CircleCheck = createLucideIcon("CircleCheck", [
38489
38506
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
38490
38507
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
38491
38508
  ]);
38509
+ var ClipboardPaste = createLucideIcon("ClipboardPaste", [
38510
+ [
38511
+ "path",
38512
+ { 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" }
38513
+ ],
38514
+ [
38515
+ "path",
38516
+ {
38517
+ 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",
38518
+ key: "2ik1ml"
38519
+ }
38520
+ ],
38521
+ ["path", { d: "m17 10 4 4-4 4", key: "vp2hj1" }]
38522
+ ]);
38492
38523
  var Clock = createLucideIcon("Clock", [
38493
38524
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
38494
38525
  ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
@@ -39480,25 +39511,25 @@ function createFocusGuard() {
39480
39511
  return element;
39481
39512
  }
39482
39513
  var __assign = function() {
39483
- __assign = Object.assign || function __assign2(t7) {
39514
+ __assign = Object.assign || function __assign2(t11) {
39484
39515
  for (var s, i = 1, n = arguments.length; i < n; i++) {
39485
39516
  s = arguments[i];
39486
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t7[p] = s[p];
39517
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t11[p] = s[p];
39487
39518
  }
39488
- return t7;
39519
+ return t11;
39489
39520
  };
39490
39521
  return __assign.apply(this, arguments);
39491
39522
  };
39492
39523
  function __rest(s, e) {
39493
- var t7 = {};
39524
+ var t11 = {};
39494
39525
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39495
- t7[p] = s[p];
39526
+ t11[p] = s[p];
39496
39527
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
39497
39528
  for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
39498
39529
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
39499
- t7[p[i]] = s[p[i]];
39530
+ t11[p[i]] = s[p[i]];
39500
39531
  }
39501
- return t7;
39532
+ return t11;
39502
39533
  }
39503
39534
  function __spreadArray(to, from, pack) {
39504
39535
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
@@ -40562,16 +40593,16 @@ var Title = DialogTitle;
40562
40593
  var Description = DialogDescription;
40563
40594
  var Close = DialogClose;
40564
40595
  function r(e) {
40565
- var t7, f, n = "";
40596
+ var t11, f, n = "";
40566
40597
  if ("string" == typeof e || "number" == typeof e) n += e;
40567
40598
  else if ("object" == typeof e) if (Array.isArray(e)) {
40568
40599
  var o = e.length;
40569
- for (t7 = 0; t7 < o; t7++) e[t7] && (f = r(e[t7])) && (n && (n += " "), n += f);
40600
+ for (t11 = 0; t11 < o; t11++) e[t11] && (f = r(e[t11])) && (n && (n += " "), n += f);
40570
40601
  } else for (f in e) e[f] && (n && (n += " "), n += f);
40571
40602
  return n;
40572
40603
  }
40573
40604
  function clsx() {
40574
- for (var e, t7, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t7 = r(e)) && (n && (n += " "), n += t7);
40605
+ for (var e, t11, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t11 = r(e)) && (n && (n += " "), n += t11);
40575
40606
  return n;
40576
40607
  }
40577
40608
  var CLASS_PART_SEPARATOR = "-";
@@ -43081,6 +43112,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
43081
43112
  const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
43082
43113
  return `${baseUrl}/api/public${normalizedPath}`;
43083
43114
  }
43115
+ var ActionType = /* @__PURE__ */ ((ActionType2) => {
43116
+ ActionType2["Deposit"] = "deposit";
43117
+ ActionType2["Withdraw"] = "withdraw";
43118
+ return ActionType2;
43119
+ })(ActionType || {});
43084
43120
  async function createDepositAddress(overrides, publishableKey) {
43085
43121
  if (!overrides?.external_user_id) {
43086
43122
  throw new Error("external_user_id is required");
@@ -43091,6 +43127,7 @@ async function createDepositAddress(overrides, publishableKey) {
43091
43127
  destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
43092
43128
  destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
43093
43129
  recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
43130
+ ...overrides?.action_type ? { action_type: overrides.action_type } : {},
43094
43131
  client_metadata: overrides?.client_metadata || {}
43095
43132
  };
43096
43133
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
@@ -43121,9 +43158,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
43121
43158
  ExecutionStatus2["WAITING"] = "waiting";
43122
43159
  return ExecutionStatus2;
43123
43160
  })(ExecutionStatus || {});
43124
- async function queryExecutions(externalUserId, publishableKey) {
43161
+ async function queryExecutions(externalUserId, publishableKey, actionType) {
43125
43162
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43126
43163
  validatePublishableKey(pk);
43164
+ const body = {
43165
+ external_user_id: externalUserId,
43166
+ ...actionType ? { action_type: actionType } : {}
43167
+ };
43127
43168
  const response = await fetch(
43128
43169
  `${API_BASE_URL}/v1/public/direct_executions/query`,
43129
43170
  {
@@ -43133,9 +43174,7 @@ async function queryExecutions(externalUserId, publishableKey) {
43133
43174
  "x-publishable-key": pk,
43134
43175
  "Content-Type": "application/json"
43135
43176
  },
43136
- body: JSON.stringify({
43137
- external_user_id: externalUserId
43138
- })
43177
+ body: JSON.stringify(body)
43139
43178
  }
43140
43179
  );
43141
43180
  if (!response.ok) {
@@ -43163,6 +43202,26 @@ async function pollDirectExecutions(request, publishableKey) {
43163
43202
  }
43164
43203
  return response.json();
43165
43204
  }
43205
+ async function getSupportedDestinationTokens(publishableKey) {
43206
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43207
+ validatePublishableKey(pk);
43208
+ const response = await fetch(
43209
+ `${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
43210
+ {
43211
+ method: "GET",
43212
+ headers: {
43213
+ accept: "application/json",
43214
+ "x-publishable-key": pk
43215
+ }
43216
+ }
43217
+ );
43218
+ if (!response.ok) {
43219
+ throw new Error(
43220
+ `Failed to fetch supported destination tokens: ${response.statusText}`
43221
+ );
43222
+ }
43223
+ return response.json();
43224
+ }
43166
43225
  async function getSupportedDepositTokens(publishableKey, options2) {
43167
43226
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43168
43227
  validatePublishableKey(pk);
@@ -48118,6 +48177,7 @@ function useDepositAddress(params) {
48118
48177
  destinationChainType,
48119
48178
  destinationChainId,
48120
48179
  destinationTokenAddress,
48180
+ actionType,
48121
48181
  enabled = true
48122
48182
  } = params;
48123
48183
  return useQuery({
@@ -48129,6 +48189,7 @@ function useDepositAddress(params) {
48129
48189
  destinationChainType ?? null,
48130
48190
  destinationChainId ?? null,
48131
48191
  destinationTokenAddress ?? null,
48192
+ actionType ?? null,
48132
48193
  publishableKey
48133
48194
  ],
48134
48195
  queryFn: () => createDepositAddress(
@@ -48137,7 +48198,8 @@ function useDepositAddress(params) {
48137
48198
  recipient_address: recipientAddress,
48138
48199
  destination_chain_type: destinationChainType,
48139
48200
  destination_chain_id: destinationChainId,
48140
- destination_token_address: destinationTokenAddress
48201
+ destination_token_address: destinationTokenAddress,
48202
+ action_type: actionType
48141
48203
  },
48142
48204
  publishableKey
48143
48205
  ),
@@ -48819,6 +48881,30 @@ var en_default2 = {
48819
48881
  youReceive: "You receive",
48820
48882
  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."
48821
48883
  }
48884
+ },
48885
+ withdrawModal: {
48886
+ title: "Withdraw",
48887
+ withdrawCrypto: {
48888
+ title: "Withdraw with Crypto",
48889
+ subtitle: "Send to any wallet address"
48890
+ },
48891
+ selectToken: "Select withdrawal token",
48892
+ receiveToken: "Receive token",
48893
+ receiveChain: "Receive chain",
48894
+ recipientAddress: "Recipient address",
48895
+ recipientAddressPlaceholder: "Enter wallet address",
48896
+ amount: "Amount",
48897
+ amountPlaceholder: "0.00",
48898
+ balance: "Balance",
48899
+ minimum: "min",
48900
+ withdraw: "Withdraw",
48901
+ invalidAddress: "Please enter a valid address",
48902
+ invalidAmount: "Please enter a valid amount",
48903
+ verifyingAddress: "Verifying address...",
48904
+ loading: "Loading...",
48905
+ noTokensAvailable: "No tokens available",
48906
+ review: "Review Withdrawal",
48907
+ back: "Back"
48822
48908
  }
48823
48909
  };
48824
48910
  var i18n2 = en_default2;
@@ -48897,7 +48983,7 @@ function useDepositPolling({
48897
48983
  const modalOpenedAt = modalOpenedAtRef.current;
48898
48984
  const poll = async () => {
48899
48985
  try {
48900
- const response = await queryExecutions(userId, publishableKey);
48986
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
48901
48987
  const cutoff = new Date(modalOpenedAt.getTime() - CUTOFF_BUFFER_MS);
48902
48988
  const sortedExecutions = [...response.data].sort((a, b) => {
48903
48989
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
@@ -49019,7 +49105,8 @@ function formatCurrency(currency) {
49019
49105
  }
49020
49106
  function DepositDetailContent({
49021
49107
  execution,
49022
- className
49108
+ className,
49109
+ variant = "deposit"
49023
49110
  }) {
49024
49111
  const { colors: colors2, fonts, components } = useTheme();
49025
49112
  const [chains, setChains] = (0, import_react13.useState)([]);
@@ -49425,7 +49512,7 @@ function DepositDetailContent({
49425
49512
  color: components.card.rowLeftLabel,
49426
49513
  fontFamily: fonts.regular
49427
49514
  },
49428
- children: "Deposit Tx"
49515
+ children: variant === "withdraw" ? "Withdrawal Tx" : "Deposit Tx"
49429
49516
  }
49430
49517
  ),
49431
49518
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -54551,7 +54638,7 @@ function DepositsModal({
54551
54638
  if (!open || !userId) return;
54552
54639
  const fetchExecutions = async () => {
54553
54640
  try {
54554
- const response = await queryExecutions(userId, publishableKey);
54641
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
54555
54642
  const sorted = [...response.data].sort((a, b) => {
54556
54643
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
54557
54644
  const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
@@ -54668,7 +54755,7 @@ function saveRecentToken(token) {
54668
54755
  try {
54669
54756
  const recent = getRecentTokens();
54670
54757
  const filtered = recent.filter(
54671
- (t7) => !(t7.symbol === token.symbol && t7.chainType === token.chainType && t7.chainId === token.chainId)
54758
+ (t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
54672
54759
  );
54673
54760
  filtered.unshift(token);
54674
54761
  const trimmed = filtered.slice(0, MAX_RECENT_TOKENS);
@@ -54681,7 +54768,7 @@ function removeRecentToken(token) {
54681
54768
  try {
54682
54769
  const recent = getRecentTokens();
54683
54770
  const filtered = recent.filter(
54684
- (t7) => !(t7.symbol === token.symbol && t7.chainType === token.chainType && t7.chainId === token.chainId)
54771
+ (t11) => !(t11.symbol === token.symbol && t11.chainType === token.chainType && t11.chainId === token.chainId)
54685
54772
  );
54686
54773
  localStorage.setItem(STORAGE_KEY, JSON.stringify(filtered));
54687
54774
  return filtered;
@@ -54720,7 +54807,7 @@ function TokenSelectorSheet({
54720
54807
  const addOption = (symbol, chainType, chainId, isRecent) => {
54721
54808
  const key = `${symbol}-${chainType}:${chainId}`;
54722
54809
  if (seen.has(key)) return;
54723
- const tokenData = tokens.find((t7) => t7.symbol === symbol);
54810
+ const tokenData = tokens.find((t11) => t11.symbol === symbol);
54724
54811
  if (!tokenData) return;
54725
54812
  const chainData = tokenData.chains.find(
54726
54813
  (c) => c.chain_type === chainType && c.chain_id === chainId
@@ -55185,35 +55272,35 @@ function resolveSourceToken(supportedTokens, defaultSourceChainType, defaultSour
55185
55272
  let selectedChainData;
55186
55273
  const hasChainDefaults = defaultSourceChainType && defaultSourceChainId;
55187
55274
  if (defaultSourceTokenAddress && hasChainDefaults) {
55188
- for (const t7 of supportedTokens) {
55189
- const matchingChain = t7.chains.find(
55275
+ for (const t11 of supportedTokens) {
55276
+ const matchingChain = t11.chains.find(
55190
55277
  (c) => c.token_address.toLowerCase() === defaultSourceTokenAddress.toLowerCase() && c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
55191
55278
  );
55192
55279
  if (matchingChain) {
55193
- selectedTokenData = t7;
55280
+ selectedTokenData = t11;
55194
55281
  selectedChainData = matchingChain;
55195
55282
  break;
55196
55283
  }
55197
55284
  }
55198
55285
  }
55199
55286
  if (!selectedTokenData && defaultSourceSymbol && hasChainDefaults) {
55200
- for (const t7 of supportedTokens) {
55201
- if (t7.symbol !== defaultSourceSymbol) continue;
55202
- const matchedChain = t7.chains.find(
55287
+ for (const t11 of supportedTokens) {
55288
+ if (t11.symbol !== defaultSourceSymbol) continue;
55289
+ const matchedChain = t11.chains.find(
55203
55290
  (c) => c.chain_type === defaultSourceChainType && c.chain_id === defaultSourceChainId
55204
55291
  );
55205
55292
  if (matchedChain) {
55206
- selectedTokenData = t7;
55293
+ selectedTokenData = t11;
55207
55294
  selectedChainData = matchedChain;
55208
55295
  break;
55209
55296
  }
55210
55297
  }
55211
55298
  }
55212
55299
  if (!selectedTokenData) {
55213
- for (const t7 of supportedTokens) {
55214
- if (t7.chains.length > 0) {
55215
- selectedTokenData = t7;
55216
- selectedChainData = t7.chains[0];
55300
+ for (const t11 of supportedTokens) {
55301
+ if (t11.chains.length > 0) {
55302
+ selectedTokenData = t11;
55303
+ selectedChainData = t11.chains[0];
55217
55304
  break;
55218
55305
  }
55219
55306
  }
@@ -55262,7 +55349,7 @@ function useDefaultSourceToken({
55262
55349
  ]);
55263
55350
  (0, import_react20.useEffect)(() => {
55264
55351
  if (!supportedTokens.length || !token) return;
55265
- const currentToken = supportedTokens.find((t7) => t7.symbol === token);
55352
+ const currentToken = supportedTokens.find((t11) => t11.symbol === token);
55266
55353
  if (!currentToken || currentToken.chains.length === 0) return;
55267
55354
  const isChainAvailable = chain && currentToken.chains.some((c) => {
55268
55355
  return getChainKey(c.chain_id, c.chain_type) === chain;
@@ -55543,8 +55630,8 @@ function TransferCryptoSingleInput({
55543
55630
  const error = walletsError?.message ?? null;
55544
55631
  const allAvailableChains = (0, import_react16.useMemo)(() => {
55545
55632
  const chainsMap = /* @__PURE__ */ new Map();
55546
- supportedTokens.forEach((t7) => {
55547
- t7.chains.forEach((c) => {
55633
+ supportedTokens.forEach((t11) => {
55634
+ t11.chains.forEach((c) => {
55548
55635
  const comboKey = `${c.chain_type}:${c.chain_id}`;
55549
55636
  if (!chainsMap.has(comboKey)) {
55550
55637
  chainsMap.set(comboKey, c);
@@ -55579,7 +55666,7 @@ function TransferCryptoSingleInput({
55579
55666
  onExecutionsChange(depositExecutions);
55580
55667
  }
55581
55668
  }, [depositExecutions, onExecutionsChange]);
55582
- const selectedToken = token ? supportedTokens.find((t7) => t7.symbol === token) : void 0;
55669
+ const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
55583
55670
  const availableChainsForToken = selectedToken?.chains || [];
55584
55671
  const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
55585
55672
  const key = getChainKey2(c.chain_id, c.chain_type);
@@ -55593,7 +55680,7 @@ function TransferCryptoSingleInput({
55593
55680
  setCopied(true);
55594
55681
  setTimeout(() => setCopied(false), 2e3);
55595
55682
  };
55596
- const formatProcessingTime2 = (seconds) => {
55683
+ const formatProcessingTime3 = (seconds) => {
55597
55684
  if (seconds === null) {
55598
55685
  return t4.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
55599
55686
  }
@@ -55802,7 +55889,7 @@ function TransferCryptoSingleInput({
55802
55889
  t4.processingTime.label,
55803
55890
  ":",
55804
55891
  " ",
55805
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(processingTime) })
55892
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
55806
55893
  ] })
55807
55894
  ] }),
55808
55895
  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 } })
@@ -56101,8 +56188,8 @@ function TransferCryptoDoubleInput({
56101
56188
  const error = walletsError?.message ?? null;
56102
56189
  const allAvailableChains = (0, import_react23.useMemo)(() => {
56103
56190
  const chainsMap = /* @__PURE__ */ new Map();
56104
- supportedTokens.forEach((t7) => {
56105
- t7.chains.forEach((c) => {
56191
+ supportedTokens.forEach((t11) => {
56192
+ t11.chains.forEach((c) => {
56106
56193
  const comboKey = `${c.chain_type}:${c.chain_id}`;
56107
56194
  if (!chainsMap.has(comboKey)) {
56108
56195
  chainsMap.set(comboKey, c);
@@ -56137,7 +56224,7 @@ function TransferCryptoDoubleInput({
56137
56224
  onExecutionsChange(depositExecutions);
56138
56225
  }
56139
56226
  }, [depositExecutions, onExecutionsChange]);
56140
- const selectedToken = token ? supportedTokens.find((t7) => t7.symbol === token) : void 0;
56227
+ const selectedToken = token ? supportedTokens.find((t11) => t11.symbol === token) : void 0;
56141
56228
  const availableChainsForToken = selectedToken?.chains || [];
56142
56229
  const currentChainFromBackend = chain ? availableChainsForToken.find((c) => {
56143
56230
  const key = getChainKey3(c.chain_id, c.chain_type);
@@ -56151,7 +56238,7 @@ function TransferCryptoDoubleInput({
56151
56238
  setCopied(true);
56152
56239
  setTimeout(() => setCopied(false), 2e3);
56153
56240
  };
56154
- const formatProcessingTime2 = (seconds) => {
56241
+ const formatProcessingTime3 = (seconds) => {
56155
56242
  if (seconds === null) {
56156
56243
  return t5.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
56157
56244
  }
@@ -56378,7 +56465,7 @@ function TransferCryptoDoubleInput({
56378
56465
  t5.processingTime.label,
56379
56466
  ":",
56380
56467
  " ",
56381
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(processingTime) })
56468
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime3(processingTime) })
56382
56469
  ] })
56383
56470
  ] }),
56384
56471
  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 } })
@@ -57422,7 +57509,7 @@ function BrowserWalletModal({
57422
57509
  );
57423
57510
  if (cancelled) return;
57424
57511
  const supportedToken = response.data.find(
57425
- (t7) => t7.symbol.toLowerCase() === token.symbol.toLowerCase()
57512
+ (t11) => t11.symbol.toLowerCase() === token.symbol.toLowerCase()
57426
57513
  );
57427
57514
  if (supportedToken) {
57428
57515
  const chainDetail = supportedToken.chains.find(
@@ -58730,7 +58817,7 @@ function DepositModal({
58730
58817
  if (view !== "tracker" || !userId) return;
58731
58818
  const fetchExecutions = async () => {
58732
58819
  try {
58733
- const response = await queryExecutions(userId, publishableKey);
58820
+ const response = await queryExecutions(userId, publishableKey, ActionType.Deposit);
58734
58821
  const sorted = [...response.data].sort((a, b) => {
58735
58822
  const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
58736
58823
  const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
@@ -59249,175 +59336,1989 @@ function DepositModal({
59249
59336
  }
59250
59337
  ) });
59251
59338
  }
59252
- function UnifoldProvider2({
59253
- children,
59339
+ function useSupportedDestinationTokens(publishableKey, enabled = true) {
59340
+ return useQuery({
59341
+ queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
59342
+ queryFn: () => getSupportedDestinationTokens(publishableKey),
59343
+ staleTime: 1e3 * 60 * 5,
59344
+ gcTime: 1e3 * 60 * 30,
59345
+ refetchOnMount: false,
59346
+ refetchOnWindowFocus: false,
59347
+ enabled
59348
+ });
59349
+ }
59350
+ function useSourceTokenValidation(params) {
59351
+ const {
59352
+ sourceChainType,
59353
+ sourceChainId,
59354
+ sourceTokenAddress,
59355
+ sourceTokenSymbol,
59356
+ publishableKey,
59357
+ enabled = true
59358
+ } = params;
59359
+ const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
59360
+ return useQuery({
59361
+ queryKey: [
59362
+ "unifold",
59363
+ "sourceTokenValidation",
59364
+ sourceChainType ?? null,
59365
+ sourceChainId ?? null,
59366
+ sourceTokenAddress ?? null,
59367
+ publishableKey
59368
+ ],
59369
+ queryFn: async () => {
59370
+ const res = await getSupportedDepositTokens(publishableKey);
59371
+ let matchedMinUsd = null;
59372
+ let matchedProcessingTime = null;
59373
+ let matchedSlippage = null;
59374
+ let matchedPriceImpact = null;
59375
+ const found = res.data.some(
59376
+ (token) => token.chains.some((chain) => {
59377
+ const match = chain.chain_type === sourceChainType && chain.chain_id === sourceChainId && chain.token_address.toLowerCase() === sourceTokenAddress.toLowerCase();
59378
+ if (match) {
59379
+ matchedMinUsd = chain.minimum_deposit_amount_usd;
59380
+ matchedProcessingTime = chain.estimated_processing_time;
59381
+ matchedSlippage = chain.max_slippage_percent;
59382
+ matchedPriceImpact = chain.estimated_price_impact_percent;
59383
+ }
59384
+ return match;
59385
+ })
59386
+ );
59387
+ return {
59388
+ isSupported: found,
59389
+ minimumAmountUsd: matchedMinUsd,
59390
+ estimatedProcessingTime: matchedProcessingTime,
59391
+ maxSlippagePercent: matchedSlippage,
59392
+ priceImpactPercent: matchedPriceImpact,
59393
+ errorMessage: found ? null : `${sourceTokenSymbol || "Source token"} is not a supported withdrawal token. Supported tokens include USDC, USDT, and other stablecoins.`
59394
+ };
59395
+ },
59396
+ enabled: enabled && hasParams,
59397
+ staleTime: 1e3 * 60 * 5,
59398
+ gcTime: 1e3 * 60 * 30,
59399
+ refetchOnMount: false,
59400
+ refetchOnWindowFocus: false
59401
+ });
59402
+ }
59403
+ function useAddressBalance(params) {
59404
+ const {
59405
+ address,
59406
+ chainType,
59407
+ chainId,
59408
+ tokenAddress,
59409
+ publishableKey,
59410
+ enabled = true
59411
+ } = params;
59412
+ const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
59413
+ return useQuery({
59414
+ queryKey: [
59415
+ "unifold",
59416
+ "addressBalance",
59417
+ address ?? null,
59418
+ chainType ?? null,
59419
+ chainId ?? null,
59420
+ tokenAddress ?? null,
59421
+ publishableKey
59422
+ ],
59423
+ queryFn: async () => {
59424
+ const res = await getAddressBalance(
59425
+ address,
59426
+ chainType,
59427
+ chainId,
59428
+ tokenAddress,
59429
+ publishableKey
59430
+ );
59431
+ if (res.balance) {
59432
+ const decimals = res.balance.token?.decimals ?? 6;
59433
+ const symbol = res.balance.token?.symbol ?? "";
59434
+ const baseUnit = res.balance.amount;
59435
+ const raw = BigInt(baseUnit);
59436
+ const divisor = BigInt(10 ** decimals);
59437
+ const whole = raw / divisor;
59438
+ const frac = raw % divisor;
59439
+ const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
59440
+ const balanceHuman = fracStr ? `${whole}.${fracStr}` : whole.toString();
59441
+ return {
59442
+ balanceBaseUnit: baseUnit,
59443
+ balanceHuman,
59444
+ balanceUsd: res.balance.amount_usd,
59445
+ exchangeRate: res.balance.exchange_rate,
59446
+ decimals,
59447
+ symbol
59448
+ };
59449
+ }
59450
+ return { balanceBaseUnit: "0", balanceHuman: "0", balanceUsd: "0", exchangeRate: null, decimals: 6, symbol: "" };
59451
+ },
59452
+ enabled: enabled && hasParams,
59453
+ staleTime: 1e3 * 30,
59454
+ gcTime: 1e3 * 60 * 5,
59455
+ refetchInterval: 1e3 * 30,
59456
+ refetchOnMount: "always",
59457
+ refetchOnWindowFocus: false
59458
+ });
59459
+ }
59460
+ function useExecutions(userId, publishableKey, options2) {
59461
+ const actionType = options2?.actionType ?? ActionType.Deposit;
59462
+ return useQuery({
59463
+ queryKey: ["unifold", "executions", actionType, userId, publishableKey],
59464
+ queryFn: () => queryExecutions(userId, publishableKey, actionType),
59465
+ enabled: (options2?.enabled ?? true) && !!userId,
59466
+ refetchInterval: options2?.refetchInterval ?? 3e3,
59467
+ staleTime: 0,
59468
+ gcTime: 1e3 * 60 * 5,
59469
+ refetchOnWindowFocus: false
59470
+ });
59471
+ }
59472
+ var POLL_INTERVAL_MS2 = 2500;
59473
+ var POLL_ENDPOINT_INTERVAL_MS2 = 3e3;
59474
+ var CUTOFF_BUFFER_MS2 = 6e4;
59475
+ function useWithdrawPolling({
59476
+ userId,
59254
59477
  publishableKey,
59255
- config
59478
+ depositWalletId,
59479
+ enabled = false,
59480
+ onWithdrawSuccess,
59481
+ onWithdrawError
59256
59482
  }) {
59257
- const [isOpen, setIsOpen] = (0, import_react.useState)(false);
59258
- const [depositConfig, setDepositConfig] = (0, import_react.useState)(
59259
- null
59260
- );
59261
- const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
59262
- (0, import_react.useEffect)(() => {
59263
- if (publishableKey) {
59264
- setApiConfig({ publishableKey });
59265
- }
59266
- }, [publishableKey]);
59267
- import_react.default.useEffect(() => {
59268
- const appearance = config?.appearance || "dark";
59269
- if (appearance === "auto") {
59270
- const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
59271
- setResolvedTheme(prefersDark ? "dark" : "light");
59272
- const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
59273
- const handler = (e) => {
59274
- setResolvedTheme(e.matches ? "dark" : "light");
59275
- };
59276
- mediaQuery.addEventListener("change", handler);
59277
- return () => mediaQuery.removeEventListener("change", handler);
59278
- } else {
59279
- setResolvedTheme(appearance);
59280
- }
59281
- }, [config?.appearance]);
59282
- const depositPromiseRef = import_react.default.useRef(null);
59283
- const depositConfigRef = import_react.default.useRef(null);
59284
- depositConfigRef.current = depositConfig;
59285
- const closeTimeoutRef = import_react.default.useRef(null);
59286
- const closeGuardRef = import_react.default.useRef(false);
59287
- const beginDeposit = (0, import_react.useCallback)((config2) => {
59288
- if (closeTimeoutRef.current) {
59289
- clearTimeout(closeTimeoutRef.current);
59290
- closeTimeoutRef.current = null;
59291
- }
59292
- closeGuardRef.current = false;
59293
- if (depositPromiseRef.current) {
59294
- console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
59295
- depositPromiseRef.current.reject({
59296
- message: "Deposit cancelled - new deposit started",
59297
- code: "DEPOSIT_SUPERSEDED"
59298
- });
59299
- depositPromiseRef.current = null;
59300
- }
59301
- const promise = new Promise((resolve, reject) => {
59302
- depositPromiseRef.current = { resolve, reject };
59303
- });
59304
- promise.catch(() => {
59305
- });
59306
- setDepositConfig(config2);
59307
- setIsOpen(true);
59308
- return promise;
59309
- }, []);
59310
- const closeDeposit = (0, import_react.useCallback)(() => {
59311
- if (closeGuardRef.current) {
59312
- return;
59313
- }
59314
- closeGuardRef.current = true;
59315
- const promiseToReject = depositPromiseRef.current;
59316
- depositPromiseRef.current = null;
59317
- if (depositConfigRef.current?.onClose) {
59318
- depositConfigRef.current.onClose();
59319
- }
59320
- if (promiseToReject) {
59321
- promiseToReject.reject({
59322
- message: "Deposit cancelled by user",
59323
- code: "DEPOSIT_CANCELLED"
59324
- });
59325
- }
59326
- setIsOpen(false);
59327
- closeTimeoutRef.current = setTimeout(() => {
59328
- setDepositConfig(null);
59329
- closeTimeoutRef.current = null;
59330
- }, 200);
59331
- }, []);
59332
- const handleDepositSuccess = (0, import_react.useCallback)((data) => {
59333
- if (depositConfig?.onSuccess) {
59334
- depositConfig.onSuccess(data);
59335
- }
59336
- if (depositPromiseRef.current) {
59337
- depositPromiseRef.current.resolve(data);
59338
- depositPromiseRef.current = null;
59339
- }
59340
- }, [depositConfig]);
59341
- const handleDepositError = (0, import_react.useCallback)((error) => {
59342
- console.error("[UnifoldProvider] Deposit error:", error);
59343
- if (depositConfig?.onError) {
59344
- depositConfig.onError(error);
59483
+ const [executions, setExecutions] = (0, import_react28.useState)([]);
59484
+ const [isPolling, setIsPolling] = (0, import_react28.useState)(false);
59485
+ const enabledAtRef = (0, import_react28.useRef)(/* @__PURE__ */ new Date());
59486
+ const trackedRef = (0, import_react28.useRef)(/* @__PURE__ */ new Map());
59487
+ const prevEnabledRef = (0, import_react28.useRef)(false);
59488
+ const onSuccessRef = (0, import_react28.useRef)(onWithdrawSuccess);
59489
+ const onErrorRef = (0, import_react28.useRef)(onWithdrawError);
59490
+ (0, import_react28.useEffect)(() => {
59491
+ onSuccessRef.current = onWithdrawSuccess;
59492
+ }, [onWithdrawSuccess]);
59493
+ (0, import_react28.useEffect)(() => {
59494
+ onErrorRef.current = onWithdrawError;
59495
+ }, [onWithdrawError]);
59496
+ (0, import_react28.useEffect)(() => {
59497
+ if (enabled && !prevEnabledRef.current) {
59498
+ enabledAtRef.current = /* @__PURE__ */ new Date();
59499
+ trackedRef.current.clear();
59345
59500
  }
59346
- if (depositPromiseRef.current) {
59347
- depositPromiseRef.current.reject(error);
59348
- depositPromiseRef.current = null;
59501
+ if (!enabled) {
59502
+ trackedRef.current.clear();
59349
59503
  }
59350
- }, [depositConfig]);
59351
- const contextValue = (0, import_react.useMemo)(
59352
- () => ({
59353
- beginDeposit,
59354
- closeDeposit,
59355
- handleDepositSuccess,
59356
- handleDepositError
59357
- }),
59358
- [beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError]
59359
- );
59360
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(UnifoldProvider, { publishableKey, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ConnectContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
59361
- ThemeProvider,
59362
- {
59363
- mode: resolvedTheme,
59364
- accentColor: config?.accentColor,
59365
- theme: config?.theme,
59366
- fontFamily: config?.fontFamily,
59367
- fonts: config?.fonts,
59368
- components: config?.components,
59369
- children: [
59370
- children,
59371
- depositConfig && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59372
- DepositModal,
59373
- {
59374
- open: isOpen,
59375
- onOpenChange: closeDeposit,
59376
- userId: depositConfig.externalUserId,
59377
- publishableKey,
59378
- modalTitle: config?.modalTitle,
59379
- destinationTokenSymbol: depositConfig.destinationTokenSymbol,
59380
- recipientAddress: depositConfig.recipientAddress,
59381
- destinationChainType: depositConfig.destinationChainType,
59382
- destinationChainId: depositConfig.destinationChainId,
59383
- destinationTokenAddress: depositConfig.destinationTokenAddress,
59384
- defaultSourceChainType: depositConfig.defaultSourceChainType,
59385
- defaultSourceChainId: depositConfig.defaultSourceChainId,
59386
- defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
59387
- defaultSourceSymbol: depositConfig.defaultSourceSymbol,
59388
- depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
59389
- hideDepositTracker: config?.hideDepositTracker,
59390
- showBalanceHeader: config?.showBalanceHeader,
59391
- transferInputVariant: config?.transferInputVariant,
59392
- enableConnectWallet: config?.enableConnectWallet,
59393
- enablePayWithExchange: config?.enablePayWithExchange,
59394
- onDepositSuccess: handleDepositSuccess,
59395
- onDepositError: handleDepositError,
59396
- theme: resolvedTheme,
59397
- initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen,
59398
- transferCryptoTitle: config?.transferCryptoTitle,
59399
- depositWithCardTitle: config?.depositWithCardTitle,
59400
- payWithExchangeTitle: config?.payWithExchangeTitle,
59401
- depositTrackerTitle: config?.depositTrackerTitle,
59402
- depositTrackerSubTitle: config?.depositTrackerSubTitle,
59403
- hideDepositFlowInfo: config?.hideDepositFlowInfo,
59404
- hideDisplayDescription: config?.hideDisplayDescription,
59405
- browserWalletAmountQuickSelect: config?.browserWalletAmountQuickSelect
59504
+ prevEnabledRef.current = enabled;
59505
+ }, [enabled]);
59506
+ (0, import_react28.useEffect)(() => {
59507
+ if (!userId || !enabled) return;
59508
+ const enabledAt = enabledAtRef.current;
59509
+ const poll = async () => {
59510
+ try {
59511
+ const response = await queryExecutions(userId, publishableKey, ActionType.Withdraw);
59512
+ const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
59513
+ const sorted = [...response.data].sort((a, b) => {
59514
+ const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
59515
+ const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
59516
+ return tB - tA;
59517
+ });
59518
+ const inProgress = [ExecutionStatus.PENDING, ExecutionStatus.WAITING, ExecutionStatus.DELAYED];
59519
+ const terminal = [ExecutionStatus.SUCCEEDED, ExecutionStatus.FAILED];
59520
+ let target = null;
59521
+ for (const ex of sorted) {
59522
+ const t11 = ex.created_at ? new Date(ex.created_at) : null;
59523
+ if (!t11 || t11 < cutoff) continue;
59524
+ const prev = trackedRef.current.get(ex.id);
59525
+ if (!prev) {
59526
+ target = ex;
59527
+ break;
59406
59528
  }
59407
- )
59408
- ]
59409
- }
59410
- ) }) });
59411
- }
59412
- var ConnectContext = import_react.default.createContext(null);
59413
- function useUnifold2() {
59414
- const baseContext = useUnifold();
59415
- const connectContext = import_react.default.useContext(ConnectContext);
59416
- if (typeof window === "undefined") {
59417
- return {
59418
- publishableKey: "",
59419
- beginDeposit: () => Promise.reject(new Error("SSR not supported")),
59529
+ if (inProgress.includes(prev) && terminal.includes(ex.status)) {
59530
+ target = ex;
59531
+ break;
59532
+ }
59533
+ }
59534
+ if (target) {
59535
+ const ex = target;
59536
+ const exTime = ex.created_at ? new Date(ex.created_at) : null;
59537
+ if (!exTime || exTime < enabledAtRef.current) return;
59538
+ const prev = trackedRef.current.get(ex.id);
59539
+ trackedRef.current.set(ex.id, ex.status);
59540
+ setExecutions((list) => {
59541
+ const idx = list.findIndex((e) => e.id === ex.id);
59542
+ if (idx >= 0) {
59543
+ const u = [...list];
59544
+ u[idx] = ex;
59545
+ return u;
59546
+ }
59547
+ return [...list, ex];
59548
+ });
59549
+ if (ex.status === ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
59550
+ onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
59551
+ } else if (ex.status === ExecutionStatus.FAILED && prev !== ExecutionStatus.FAILED) {
59552
+ onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
59553
+ }
59554
+ }
59555
+ } catch (error) {
59556
+ console.error("Failed to fetch withdraw executions:", error);
59557
+ onErrorRef.current?.({ message: "Failed to fetch withdrawal status", code: "POLLING_ERROR", error });
59558
+ }
59559
+ };
59560
+ void poll();
59561
+ const interval = setInterval(poll, POLL_INTERVAL_MS2);
59562
+ setIsPolling(true);
59563
+ return () => {
59564
+ clearInterval(interval);
59565
+ setIsPolling(false);
59566
+ };
59567
+ }, [userId, publishableKey, enabled]);
59568
+ (0, import_react28.useEffect)(() => {
59569
+ if (!enabled || !depositWalletId) return;
59570
+ const trigger = async () => {
59571
+ try {
59572
+ await pollDirectExecutions({ deposit_wallet_id: depositWalletId }, publishableKey);
59573
+ } catch {
59574
+ }
59575
+ };
59576
+ trigger();
59577
+ const interval = setInterval(trigger, POLL_ENDPOINT_INTERVAL_MS2);
59578
+ return () => clearInterval(interval);
59579
+ }, [enabled, depositWalletId, publishableKey]);
59580
+ return { executions, isPolling };
59581
+ }
59582
+ var t7 = i18n2.withdrawModal;
59583
+ var getChainKey4 = (chainId, chainType) => `${chainType}:${chainId}`;
59584
+ function WithdrawDoubleInput({
59585
+ tokens,
59586
+ selectedTokenSymbol,
59587
+ selectedChainKey,
59588
+ onTokenChange,
59589
+ onChainChange,
59590
+ isLoading = false
59591
+ }) {
59592
+ const { fonts, components } = useTheme();
59593
+ const isDarkMode = useTheme().themeClass.includes("uf-dark");
59594
+ const selectedToken = selectedTokenSymbol ? tokens.find((t11) => t11.symbol === selectedTokenSymbol) : void 0;
59595
+ const availableChainsForToken = selectedToken?.chains || [];
59596
+ const renderTokenItem = (tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
59597
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59598
+ "img",
59599
+ {
59600
+ src: tokenData.icon_url,
59601
+ alt: tokenData.symbol,
59602
+ width: 20,
59603
+ height: 20,
59604
+ loading: "lazy",
59605
+ className: "uf-rounded-full uf-flex-shrink-0"
59606
+ }
59607
+ ),
59608
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: tokenData.symbol })
59609
+ ] });
59610
+ const renderChainItem = (chainData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
59611
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59612
+ "img",
59613
+ {
59614
+ src: chainData.icon_url,
59615
+ alt: chainData.chain_name,
59616
+ width: 20,
59617
+ height: 20,
59618
+ loading: "lazy",
59619
+ className: "uf-rounded-full uf-flex-shrink-0"
59620
+ }
59621
+ ),
59622
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chainData.chain_name })
59623
+ ] });
59624
+ const currentChainData = selectedChainKey ? availableChainsForToken.find(
59625
+ (c) => getChainKey4(c.chain_id, c.chain_type) === selectedChainKey
59626
+ ) : void 0;
59627
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-grid uf-grid-cols-2 uf-gap-2.5", children: [
59628
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
59629
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59630
+ "div",
59631
+ {
59632
+ className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
59633
+ style: { color: components.card.labelColor },
59634
+ children: t7.receiveToken
59635
+ }
59636
+ ),
59637
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
59638
+ Select2,
59639
+ {
59640
+ value: selectedTokenSymbol ?? "",
59641
+ onValueChange: onTokenChange,
59642
+ disabled: isLoading || tokens.length === 0,
59643
+ children: [
59644
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59645
+ SelectTrigger2,
59646
+ {
59647
+ className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
59648
+ style: {
59649
+ backgroundColor: components.card.backgroundColor,
59650
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
59651
+ },
59652
+ 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 }) })
59653
+ }
59654
+ ),
59655
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59656
+ SelectContent2,
59657
+ {
59658
+ className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px]",
59659
+ style: {
59660
+ border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
59661
+ ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
59662
+ },
59663
+ children: tokens.map((tokenData) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59664
+ SelectItem2,
59665
+ {
59666
+ value: tokenData.symbol,
59667
+ className: "focus:uf-bg-accent focus:uf-text-foreground",
59668
+ children: renderTokenItem(tokenData)
59669
+ },
59670
+ tokenData.symbol
59671
+ ))
59672
+ }
59673
+ )
59674
+ ]
59675
+ }
59676
+ )
59677
+ ] }),
59678
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { children: [
59679
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59680
+ "div",
59681
+ {
59682
+ className: "uf-text-xs uf-mb-2 uf-flex uf-items-center uf-gap-1",
59683
+ style: { color: components.card.labelColor },
59684
+ children: t7.receiveChain
59685
+ }
59686
+ ),
59687
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
59688
+ Select2,
59689
+ {
59690
+ value: selectedChainKey ?? "",
59691
+ onValueChange: onChainChange,
59692
+ disabled: isLoading || availableChainsForToken.length === 0,
59693
+ children: [
59694
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59695
+ SelectTrigger2,
59696
+ {
59697
+ className: "uf-h-10 hover:uf-opacity-90 uf-text-foreground disabled:uf-opacity-50",
59698
+ style: {
59699
+ backgroundColor: components.card.backgroundColor,
59700
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
59701
+ },
59702
+ 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 }) })
59703
+ }
59704
+ ),
59705
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59706
+ SelectContent2,
59707
+ {
59708
+ align: "end",
59709
+ className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
59710
+ style: {
59711
+ border: `1px solid ${isDarkMode ? "rgba(255,255,255,0.15)" : "rgba(0,0,0,0.15)"}`,
59712
+ ...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
59713
+ },
59714
+ 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) => {
59715
+ const chainKey = getChainKey4(chainData.chain_id, chainData.chain_type);
59716
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
59717
+ SelectItem2,
59718
+ {
59719
+ value: chainKey,
59720
+ className: "focus:uf-bg-accent focus:uf-text-foreground",
59721
+ children: renderChainItem(chainData)
59722
+ },
59723
+ chainKey
59724
+ );
59725
+ })
59726
+ }
59727
+ )
59728
+ ]
59729
+ }
59730
+ )
59731
+ ] })
59732
+ ] });
59733
+ }
59734
+ function useVerifyRecipientAddress(params) {
59735
+ const {
59736
+ chainType,
59737
+ chainId,
59738
+ tokenAddress,
59739
+ recipientAddress,
59740
+ publishableKey,
59741
+ enabled = true
59742
+ } = params;
59743
+ const trimmedAddress = recipientAddress?.trim() || "";
59744
+ const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
59745
+ return useQuery({
59746
+ queryKey: [
59747
+ "unifold",
59748
+ "verifyRecipientAddress",
59749
+ chainType ?? null,
59750
+ chainId ?? null,
59751
+ tokenAddress ?? null,
59752
+ trimmedAddress,
59753
+ publishableKey
59754
+ ],
59755
+ queryFn: () => verifyRecipientAddress(
59756
+ {
59757
+ chain_type: chainType,
59758
+ chain_id: chainId,
59759
+ token_address: tokenAddress,
59760
+ recipient_address: trimmedAddress
59761
+ },
59762
+ publishableKey
59763
+ ),
59764
+ enabled: enabled && hasAllParams,
59765
+ staleTime: 1e3 * 60 * 5,
59766
+ gcTime: 1e3 * 60 * 30,
59767
+ retry: 1,
59768
+ refetchOnMount: false,
59769
+ refetchOnWindowFocus: false
59770
+ });
59771
+ }
59772
+ async function sendEvmWithdraw(params) {
59773
+ const {
59774
+ provider,
59775
+ fromAddress,
59776
+ depositWalletAddress,
59777
+ sourceTokenAddress,
59778
+ sourceChainId,
59779
+ amountBaseUnit
59780
+ } = params;
59781
+ const currentChainIdHex = await provider.request({
59782
+ method: "eth_chainId",
59783
+ params: []
59784
+ });
59785
+ const currentChainId = parseInt(currentChainIdHex, 16).toString();
59786
+ if (currentChainId !== sourceChainId) {
59787
+ const requiredHex = "0x" + parseInt(sourceChainId).toString(16);
59788
+ try {
59789
+ await provider.request({
59790
+ method: "wallet_switchEthereumChain",
59791
+ params: [{ chainId: requiredHex }]
59792
+ });
59793
+ const newHex = await provider.request({ method: "eth_chainId", params: [] });
59794
+ if (parseInt(newHex, 16).toString() !== sourceChainId) {
59795
+ throw new Error(`Failed to switch to chain ${sourceChainId}. Please switch manually.`);
59796
+ }
59797
+ } catch (err) {
59798
+ if (err && typeof err === "object" && "code" in err) {
59799
+ const e = err;
59800
+ if (e.code === 4902) throw new Error(`Chain ${sourceChainId} is not configured in your wallet.`);
59801
+ if (e.code === 4001) throw new Error("You must approve the network switch to withdraw.");
59802
+ }
59803
+ throw err;
59804
+ }
59805
+ }
59806
+ const isNative = sourceTokenAddress === "native" || sourceTokenAddress === "0x0000000000000000000000000000000000000000" || sourceTokenAddress === "";
59807
+ const amountBig = BigInt(amountBaseUnit);
59808
+ const txParams = isNative ? { from: fromAddress, to: depositWalletAddress, value: "0x" + amountBig.toString(16) } : {
59809
+ from: fromAddress,
59810
+ to: sourceTokenAddress,
59811
+ data: "0xa9059cbb" + depositWalletAddress.slice(2).padStart(64, "0") + amountBig.toString(16).padStart(64, "0")
59812
+ };
59813
+ let gasEstimate;
59814
+ try {
59815
+ const hex = await provider.request({ method: "eth_estimateGas", params: [txParams] });
59816
+ gasEstimate = BigInt(hex);
59817
+ } catch {
59818
+ gasEstimate = isNative ? BigInt(21e3) : BigInt(65e3);
59819
+ }
59820
+ const gasPrice = BigInt(await provider.request({ method: "eth_gasPrice", params: [] }));
59821
+ const gasWithBuffer = gasEstimate * BigInt(120) / BigInt(100);
59822
+ const gasCost = gasWithBuffer * gasPrice;
59823
+ const ethBalance = BigInt(
59824
+ await provider.request({ method: "eth_getBalance", params: [fromAddress, "latest"] })
59825
+ );
59826
+ const totalRequired = isNative ? gasCost + amountBig : gasCost;
59827
+ if (ethBalance < totalRequired) {
59828
+ const gasFmt = (Number(gasCost) / 1e18).toFixed(6);
59829
+ if (isNative) {
59830
+ throw new Error(`Insufficient balance. Need ${(Number(totalRequired) / 1e18).toFixed(6)} ETH (amount + ~${gasFmt} gas).`);
59831
+ }
59832
+ throw new Error(`Insufficient ETH for gas. Need ~${gasFmt} ETH for fees.`);
59833
+ }
59834
+ const txHash = await provider.request({ method: "eth_sendTransaction", params: [txParams] });
59835
+ return txHash;
59836
+ }
59837
+ async function sendSolanaWithdraw(params) {
59838
+ const {
59839
+ provider,
59840
+ fromAddress,
59841
+ depositWalletAddress,
59842
+ sourceTokenAddress,
59843
+ amountBaseUnit,
59844
+ publishableKey
59845
+ } = params;
59846
+ if (!provider.publicKey) {
59847
+ await provider.connect();
59848
+ }
59849
+ const buildResponse = await buildSolanaTransaction(
59850
+ {
59851
+ chain_id: "mainnet",
59852
+ token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
59853
+ source_address: fromAddress,
59854
+ destination_address: depositWalletAddress,
59855
+ amount: amountBaseUnit
59856
+ },
59857
+ publishableKey
59858
+ );
59859
+ const { VersionedTransaction } = await import(
59860
+ /* @vite-ignore */
59861
+ "@solana/web3.js"
59862
+ );
59863
+ const binaryString = atob(buildResponse.transaction);
59864
+ const bytes = new Uint8Array(binaryString.length);
59865
+ for (let i = 0; i < binaryString.length; i++) {
59866
+ bytes[i] = binaryString.charCodeAt(i);
59867
+ }
59868
+ const transaction = VersionedTransaction.deserialize(bytes);
59869
+ const signedTransaction = await provider.signTransaction(transaction);
59870
+ const serialized = signedTransaction.serialize();
59871
+ let binaryStr = "";
59872
+ for (let i = 0; i < serialized.length; i++) {
59873
+ binaryStr += String.fromCharCode(serialized[i]);
59874
+ }
59875
+ const sendResponse = await sendSolanaTransaction(
59876
+ { chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
59877
+ publishableKey
59878
+ );
59879
+ return sendResponse.signature;
59880
+ }
59881
+ async function detectBrowserWallet(chainType, senderAddress) {
59882
+ const win = typeof window !== "undefined" ? window : null;
59883
+ if (!win || !senderAddress) return null;
59884
+ const anyWin = win;
59885
+ if (chainType === "solana") {
59886
+ const solProviders = [];
59887
+ if (win.phantom?.solana) solProviders.push({ provider: win.phantom.solana, name: "Phantom" });
59888
+ if (anyWin.solflare) solProviders.push({ provider: anyWin.solflare, name: "Solflare" });
59889
+ if (anyWin.backpack) solProviders.push({ provider: anyWin.backpack, name: "Backpack" });
59890
+ if (anyWin.trustwallet?.solana) solProviders.push({ provider: anyWin.trustwallet.solana, name: "Trust Wallet" });
59891
+ for (const { provider, name } of solProviders) {
59892
+ if (!provider) continue;
59893
+ try {
59894
+ let addr;
59895
+ if (provider.isConnected && provider.publicKey) {
59896
+ addr = provider.publicKey.toString();
59897
+ } else {
59898
+ const resp = await provider.connect({ onlyIfTrusted: true });
59899
+ if (resp?.publicKey) addr = resp.publicKey.toString();
59900
+ }
59901
+ if (addr && addr === senderAddress) {
59902
+ return { chainFamily: "solana", provider, name, address: addr };
59903
+ }
59904
+ } catch {
59905
+ }
59906
+ }
59907
+ }
59908
+ if (chainType === "ethereum") {
59909
+ const evmProviders = [];
59910
+ const seen = /* @__PURE__ */ new Set();
59911
+ const add = (p, name) => {
59912
+ if (p && typeof p.request === "function" && !seen.has(p)) {
59913
+ seen.add(p);
59914
+ evmProviders.push({ provider: p, name });
59915
+ }
59916
+ };
59917
+ add(anyWin.phantom?.ethereum, "Phantom");
59918
+ add(anyWin.coinbaseWalletExtension, "Coinbase");
59919
+ add(anyWin.trustwallet?.ethereum, "Trust Wallet");
59920
+ add(anyWin.okxwallet, "OKX Wallet");
59921
+ if (anyWin.__eip6963Providers) {
59922
+ for (const detail of anyWin.__eip6963Providers) {
59923
+ const rdns = detail.info?.rdns || "";
59924
+ let name = detail.info?.name || "Wallet";
59925
+ if (rdns.includes("metamask")) name = "MetaMask";
59926
+ else if (rdns.includes("rabby")) name = "Rabby";
59927
+ else if (rdns.includes("rainbow")) name = "Rainbow";
59928
+ add(detail.provider, name);
59929
+ }
59930
+ }
59931
+ if (win.ethereum) {
59932
+ const eth = win.ethereum;
59933
+ let name = "Wallet";
59934
+ if (eth.isMetaMask && !eth.isPhantom && !eth.isRabby) name = "MetaMask";
59935
+ else if (eth.isRabby) name = "Rabby";
59936
+ else if (eth.isRainbow) name = "Rainbow";
59937
+ else if (eth.isCoinbaseWallet) name = "Coinbase";
59938
+ add(eth, name);
59939
+ }
59940
+ for (const { provider, name } of evmProviders) {
59941
+ try {
59942
+ const accounts = await provider.request({ method: "eth_accounts" });
59943
+ if (accounts?.length > 0 && accounts[0].toLowerCase() === senderAddress.toLowerCase()) {
59944
+ return { chainFamily: "evm", provider, name, address: accounts[0] };
59945
+ }
59946
+ } catch {
59947
+ }
59948
+ }
59949
+ }
59950
+ return null;
59951
+ }
59952
+ var t8 = i18n2.withdrawModal;
59953
+ var tCrypto = i18n2.transferCrypto;
59954
+ function formatProcessingTime2(seconds) {
59955
+ if (seconds === null) {
59956
+ return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", "1");
59957
+ }
59958
+ const minutes = Math.ceil(seconds / 60);
59959
+ if (minutes < 60) {
59960
+ return tCrypto.processingTime.lessThanMinutes.replace("{{minutes}}", String(minutes));
59961
+ }
59962
+ const hours = Math.ceil(minutes / 60);
59963
+ return tCrypto.processingTime.lessThanHours.replace("{{hours}}", String(hours));
59964
+ }
59965
+ function computeBaseUnit(balanceBaseUnit, inputAmount, balanceAmount) {
59966
+ if (balanceAmount <= 0 || inputAmount <= 0) return "0";
59967
+ if (inputAmount >= balanceAmount) return balanceBaseUnit;
59968
+ const PRECISION = 10n ** 18n;
59969
+ const ratioScaled = BigInt(Math.round(inputAmount / balanceAmount * Number(PRECISION)));
59970
+ const result = BigInt(balanceBaseUnit) * ratioScaled / PRECISION;
59971
+ return result.toString();
59972
+ }
59973
+ function toSafeDecimalString(n, maxDecimals) {
59974
+ if (n === 0) return "0";
59975
+ return n.toFixed(maxDecimals).replace(/\.?0+$/, "");
59976
+ }
59977
+ function WithdrawForm({
59978
+ publishableKey,
59979
+ externalUserId,
59980
+ sourceChainType,
59981
+ selectedToken,
59982
+ selectedChain,
59983
+ sourceTokenSymbol,
59984
+ recipientAddressProp,
59985
+ balanceData,
59986
+ isLoadingBalance,
59987
+ minimumWithdrawAmountUsd,
59988
+ estimatedProcessingTime,
59989
+ maxSlippagePercent,
59990
+ priceImpactPercent,
59991
+ detectedWallet,
59992
+ sourceChainId,
59993
+ sourceTokenAddress,
59994
+ isWalletMatch,
59995
+ connectedWalletName,
59996
+ canWithdraw,
59997
+ onWithdraw,
59998
+ onWithdrawError,
59999
+ onDepositWalletCreation,
60000
+ onWithdrawSubmitted,
60001
+ footerLeft
60002
+ }) {
60003
+ const { colors: colors2, fonts, components } = useTheme();
60004
+ const [recipientAddress, setRecipientAddress] = (0, import_react29.useState)(recipientAddressProp || "");
60005
+ const [amount, setAmount] = (0, import_react29.useState)("");
60006
+ const [inputUnit, setInputUnit] = (0, import_react29.useState)("crypto");
60007
+ const [isSubmitting, setIsSubmitting] = (0, import_react29.useState)(false);
60008
+ const [submitError, setSubmitError] = (0, import_react29.useState)(null);
60009
+ const [detailsExpanded, setDetailsExpanded] = (0, import_react29.useState)(false);
60010
+ const [glossaryOpen, setGlossaryOpen] = (0, import_react29.useState)(false);
60011
+ (0, import_react29.useEffect)(() => {
60012
+ setRecipientAddress(recipientAddressProp || "");
60013
+ setAmount("");
60014
+ setInputUnit("crypto");
60015
+ setSubmitError(null);
60016
+ }, [recipientAddressProp]);
60017
+ const trimmedAddress = recipientAddress.trim();
60018
+ const [debouncedAddress, setDebouncedAddress] = (0, import_react29.useState)(trimmedAddress);
60019
+ (0, import_react29.useEffect)(() => {
60020
+ const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
60021
+ return () => clearTimeout(id);
60022
+ }, [trimmedAddress]);
60023
+ const {
60024
+ data: addressVerification,
60025
+ isLoading: isVerifyingAddress,
60026
+ error: verifyError
60027
+ } = useVerifyRecipientAddress({
60028
+ chainType: selectedChain?.chain_type,
60029
+ chainId: selectedChain?.chain_id,
60030
+ tokenAddress: selectedChain?.token_address,
60031
+ recipientAddress: debouncedAddress,
60032
+ publishableKey,
60033
+ enabled: debouncedAddress.length > 5 && !!selectedChain
60034
+ });
60035
+ const isDebouncing = trimmedAddress !== debouncedAddress;
60036
+ const addressError = (0, import_react29.useMemo)(() => {
60037
+ if (!trimmedAddress || trimmedAddress.length <= 5) return null;
60038
+ if (isDebouncing || isVerifyingAddress) return null;
60039
+ if (verifyError) return t8.invalidAddress;
60040
+ if (addressVerification && !addressVerification.valid) {
60041
+ if (addressVerification.failure_code === "account_not_found")
60042
+ return `Account not found on ${selectedChain?.chain_name}`;
60043
+ if (addressVerification.failure_code === "not_opted_in")
60044
+ return `Recipient has not opted in to ${selectedToken?.symbol} on ${selectedChain?.chain_name}`;
60045
+ return t8.invalidAddress;
60046
+ }
60047
+ return null;
60048
+ }, [trimmedAddress, isDebouncing, isVerifyingAddress, verifyError, addressVerification, selectedChain, selectedToken]);
60049
+ const isAddressValid = !isDebouncing && !!addressVerification?.valid && !addressError;
60050
+ const exchangeRate = (0, import_react29.useMemo)(() => {
60051
+ if (!balanceData?.exchangeRate) return 0;
60052
+ return parseFloat(balanceData.exchangeRate);
60053
+ }, [balanceData]);
60054
+ const balanceCrypto = (0, import_react29.useMemo)(() => {
60055
+ if (!balanceData?.balanceHuman) return 0;
60056
+ return parseFloat(balanceData.balanceHuman);
60057
+ }, [balanceData]);
60058
+ const balanceUsdNum = (0, import_react29.useMemo)(() => {
60059
+ if (!balanceData?.balanceUsd) return 0;
60060
+ return parseFloat(balanceData.balanceUsd);
60061
+ }, [balanceData]);
60062
+ const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
60063
+ const sourceDecimals = balanceData?.decimals ?? 6;
60064
+ const cryptoAmountFromInput = (0, import_react29.useMemo)(() => {
60065
+ const val = parseFloat(amount);
60066
+ if (!val || val <= 0) return 0;
60067
+ if (inputUnit === "crypto") return val;
60068
+ return exchangeRate > 0 ? val / exchangeRate : 0;
60069
+ }, [amount, inputUnit, exchangeRate]);
60070
+ const fiatAmountFromInput = (0, import_react29.useMemo)(() => {
60071
+ const val = parseFloat(amount);
60072
+ if (!val || val <= 0) return 0;
60073
+ if (inputUnit === "fiat") return val;
60074
+ return val * exchangeRate;
60075
+ }, [amount, inputUnit, exchangeRate]);
60076
+ const convertedDisplay = (0, import_react29.useMemo)(() => {
60077
+ if (!amount || parseFloat(amount) <= 0) return null;
60078
+ if (inputUnit === "crypto") {
60079
+ return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
60080
+ }
60081
+ return `${cryptoAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 6 })} ${tokenSymbol}`;
60082
+ }, [amount, inputUnit, fiatAmountFromInput, cryptoAmountFromInput, tokenSymbol]);
60083
+ const balanceDisplay = (0, import_react29.useMemo)(() => {
60084
+ if (isLoadingBalance || !balanceData) return null;
60085
+ if (inputUnit === "crypto") {
60086
+ return `${balanceCrypto.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${tokenSymbol}`;
60087
+ }
60088
+ return `$${balanceUsdNum.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
60089
+ }, [isLoadingBalance, balanceData, inputUnit, balanceCrypto, balanceUsdNum, tokenSymbol]);
60090
+ const handleSwitchUnit = (0, import_react29.useCallback)(() => {
60091
+ const val = parseFloat(amount);
60092
+ if (!val || val <= 0 || exchangeRate <= 0) {
60093
+ setInputUnit((u) => u === "crypto" ? "fiat" : "crypto");
60094
+ setAmount("");
60095
+ return;
60096
+ }
60097
+ if (inputUnit === "crypto") {
60098
+ const fiat = val * exchangeRate;
60099
+ setAmount(fiat.toFixed(2));
60100
+ setInputUnit("fiat");
60101
+ } else {
60102
+ const crypto = val / exchangeRate;
60103
+ setAmount(crypto.toFixed(sourceDecimals > 6 ? 6 : sourceDecimals));
60104
+ setInputUnit("crypto");
60105
+ }
60106
+ }, [amount, inputUnit, exchangeRate, sourceDecimals]);
60107
+ const handleMaxClick = (0, import_react29.useCallback)(() => {
60108
+ if (inputUnit === "crypto") {
60109
+ if (balanceCrypto <= 0) return;
60110
+ setAmount(balanceData?.balanceHuman ?? "0");
60111
+ } else {
60112
+ if (balanceUsdNum <= 0) return;
60113
+ setAmount((Math.floor(balanceUsdNum * 100) / 100).toFixed(2));
60114
+ }
60115
+ }, [inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
60116
+ const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && fiatAmountFromInput < minimumWithdrawAmountUsd;
60117
+ const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && fiatAmountFromInput > balanceUsdNum;
60118
+ const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !!balanceData;
60119
+ const handleWithdraw = (0, import_react29.useCallback)(async () => {
60120
+ if (!selectedToken || !selectedChain) return;
60121
+ if (!isFormValid) return;
60122
+ setIsSubmitting(true);
60123
+ setSubmitError(null);
60124
+ try {
60125
+ const depositWallet = await onDepositWalletCreation({
60126
+ destinationChainType: selectedChain.chain_type,
60127
+ destinationChainId: selectedChain.chain_id,
60128
+ destinationTokenAddress: selectedChain.token_address,
60129
+ recipientAddress: trimmedAddress
60130
+ });
60131
+ const amountBaseUnit = computeBaseUnit(
60132
+ balanceData.balanceBaseUnit,
60133
+ parseFloat(amount),
60134
+ inputUnit === "crypto" ? balanceCrypto : balanceUsdNum
60135
+ );
60136
+ const humanAmount = toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
60137
+ const txInfo = {
60138
+ sourceChainType,
60139
+ sourceChainId,
60140
+ sourceTokenAddress,
60141
+ sourceTokenSymbol: tokenSymbol,
60142
+ destinationChainType: selectedChain.chain_type,
60143
+ destinationChainId: selectedChain.chain_id,
60144
+ destinationTokenAddress: selectedChain.token_address,
60145
+ destinationTokenSymbol: selectedToken.symbol,
60146
+ amount: humanAmount,
60147
+ amountBaseUnit,
60148
+ withdrawIntentAddress: depositWallet.address,
60149
+ recipientAddress: trimmedAddress
60150
+ };
60151
+ if (detectedWallet) {
60152
+ if (detectedWallet.chainFamily === "evm") {
60153
+ await sendEvmWithdraw({
60154
+ provider: detectedWallet.provider,
60155
+ fromAddress: detectedWallet.address,
60156
+ depositWalletAddress: depositWallet.address,
60157
+ sourceTokenAddress,
60158
+ sourceChainId,
60159
+ amountBaseUnit
60160
+ });
60161
+ } else if (detectedWallet.chainFamily === "solana") {
60162
+ await sendSolanaWithdraw({
60163
+ provider: detectedWallet.provider,
60164
+ fromAddress: detectedWallet.address,
60165
+ depositWalletAddress: depositWallet.address,
60166
+ sourceTokenAddress,
60167
+ amountBaseUnit,
60168
+ publishableKey
60169
+ });
60170
+ }
60171
+ } else if (onWithdraw) {
60172
+ await onWithdraw(txInfo);
60173
+ } else {
60174
+ throw new Error("No withdrawal method available. Please connect a wallet.");
60175
+ }
60176
+ onWithdrawSubmitted?.(txInfo);
60177
+ } catch (err) {
60178
+ const raw = err instanceof Error ? err.message : "Withdrawal failed. Please try again.";
60179
+ setSubmitError(raw.length > 120 ? "Withdrawal failed. Please try again." : raw);
60180
+ onWithdrawError?.({
60181
+ message: raw,
60182
+ error: err,
60183
+ code: "WITHDRAW_FAILED"
60184
+ });
60185
+ } finally {
60186
+ setIsSubmitting(false);
60187
+ }
60188
+ }, [selectedToken, selectedChain, isFormValid, cryptoAmountFromInput, sourceDecimals, trimmedAddress, publishableKey, onWithdraw, detectedWallet, sourceTokenAddress, sourceChainId, onWithdrawError, onDepositWalletCreation, onWithdrawSubmitted, amount, inputUnit, balanceCrypto, balanceUsdNum, balanceData]);
60189
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
60190
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
60191
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60192
+ "div",
60193
+ {
60194
+ className: "uf-text-xs uf-mb-1.5",
60195
+ style: { color: components.card.labelColor, fontFamily: fonts.medium },
60196
+ children: t8.recipientAddress
60197
+ }
60198
+ ),
60199
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60200
+ "style",
60201
+ {
60202
+ dangerouslySetInnerHTML: {
60203
+ __html: `.uf-withdraw-addr::placeholder { color: ${components.search.placeholderColor}; }`
60204
+ }
60205
+ }
60206
+ ),
60207
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
60208
+ "div",
60209
+ {
60210
+ className: "uf-flex uf-items-center uf-gap-1 uf-pr-2",
60211
+ style: {
60212
+ backgroundColor: components.search.backgroundColor,
60213
+ borderRadius: components.input.borderRadius,
60214
+ border: `${components.input.borderWidth}px solid ${addressError ? colors2.error : components.input.borderColor}`
60215
+ },
60216
+ children: [
60217
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60218
+ "input",
60219
+ {
60220
+ type: "text",
60221
+ placeholder: t8.recipientAddressPlaceholder,
60222
+ value: recipientAddress,
60223
+ onChange: (e) => {
60224
+ setRecipientAddress(e.target.value);
60225
+ setSubmitError(null);
60226
+ },
60227
+ 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",
60228
+ style: {
60229
+ color: components.search.inputColor,
60230
+ fontFamily: fonts.regular
60231
+ }
60232
+ }
60233
+ ),
60234
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60235
+ "button",
60236
+ {
60237
+ type: "button",
60238
+ onClick: async () => {
60239
+ try {
60240
+ const text = await navigator.clipboard.readText();
60241
+ if (text) {
60242
+ setRecipientAddress(text.trim());
60243
+ setSubmitError(null);
60244
+ }
60245
+ } catch {
60246
+ }
60247
+ },
60248
+ className: "uf-flex-shrink-0 uf-p-1 uf-rounded uf-transition-colors hover:uf-opacity-70",
60249
+ style: { color: colors2.foregroundMuted },
60250
+ title: "Paste from clipboard",
60251
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ClipboardPaste, { className: "uf-w-4 uf-h-4" })
60252
+ }
60253
+ )
60254
+ ]
60255
+ }
60256
+ ),
60257
+ (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: [
60258
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-3 uf-h-3 uf-animate-spin", style: { color: colors2.foregroundMuted } }),
60259
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: t8.verifyingAddress })
60260
+ ] }),
60261
+ addressError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-1.5", children: [
60262
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TriangleAlert, { className: "uf-w-3 uf-h-3", style: { color: colors2.error } }),
60263
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "uf-text-xs", style: { color: colors2.error, fontFamily: fonts.regular }, children: addressError })
60264
+ ] })
60265
+ ] }),
60266
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
60267
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-text-xs uf-mb-1.5", style: { color: components.card.labelColor, fontFamily: fonts.medium }, children: [
60268
+ t8.amount,
60269
+ minimumWithdrawAmountUsd != null && minimumWithdrawAmountUsd > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: colors2.warning, fontFamily: fonts.regular }, children: ` ($${minimumWithdrawAmountUsd.toFixed(2)} min)` })
60270
+ ] }),
60271
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60272
+ "style",
60273
+ {
60274
+ dangerouslySetInnerHTML: {
60275
+ __html: `.uf-withdraw-amt::placeholder { color: ${components.search.placeholderColor}; }`
60276
+ }
60277
+ }
60278
+ ),
60279
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
60280
+ "div",
60281
+ {
60282
+ className: "uf-flex uf-items-center uf-gap-2 uf-px-3 uf-py-2.5",
60283
+ style: {
60284
+ backgroundColor: components.search.backgroundColor,
60285
+ borderRadius: components.input.borderRadius,
60286
+ border: `${components.input.borderWidth}px solid ${components.input.borderColor}`
60287
+ },
60288
+ children: [
60289
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60290
+ "input",
60291
+ {
60292
+ type: "text",
60293
+ inputMode: "decimal",
60294
+ placeholder: "0.00",
60295
+ value: amount,
60296
+ onChange: (e) => {
60297
+ const val = e.target.value;
60298
+ if (val === "" || /^\d*\.?\d*$/.test(val)) {
60299
+ setAmount(val);
60300
+ setSubmitError(null);
60301
+ }
60302
+ },
60303
+ className: "uf-withdraw-amt uf-flex-1 uf-min-w-0 uf-bg-transparent uf-text-sm uf-outline-none",
60304
+ style: {
60305
+ color: components.search.inputColor,
60306
+ fontFamily: fonts.regular
60307
+ }
60308
+ }
60309
+ ),
60310
+ /* @__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" }),
60311
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60312
+ "button",
60313
+ {
60314
+ type: "button",
60315
+ onClick: handleMaxClick,
60316
+ 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",
60317
+ style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium },
60318
+ children: "Max"
60319
+ }
60320
+ )
60321
+ ]
60322
+ }
60323
+ ),
60324
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-mt-1.5 uf-px-3", children: [
60325
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
60326
+ /* @__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}`) }),
60327
+ exchangeRate > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60328
+ "button",
60329
+ {
60330
+ type: "button",
60331
+ onClick: handleSwitchUnit,
60332
+ className: "uf-p-0.5 uf-rounded uf-transition-colors hover:uf-opacity-70",
60333
+ style: { color: colors2.foregroundMuted },
60334
+ title: "Switch unit",
60335
+ children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ArrowUpDown, { className: "uf-w-3 uf-h-3" })
60336
+ }
60337
+ )
60338
+ ] }),
60339
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
60340
+ balanceDisplay && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: [
60341
+ t8.balance,
60342
+ ": ",
60343
+ balanceDisplay
60344
+ ] }),
60345
+ isLoadingBalance && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3 uf-w-16 uf-bg-muted uf-rounded uf-animate-pulse" })
60346
+ ] })
60347
+ ] })
60348
+ ] }),
60349
+ /* @__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: [
60350
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
60351
+ "button",
60352
+ {
60353
+ type: "button",
60354
+ onClick: () => setDetailsExpanded(!detailsExpanded),
60355
+ className: "uf-w-full uf-flex uf-items-center uf-justify-between uf-py-2.5",
60356
+ children: [
60357
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
60358
+ /* @__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 } }) }),
60359
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
60360
+ tCrypto.processingTime.label,
60361
+ ":",
60362
+ " ",
60363
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: formatProcessingTime2(estimatedProcessingTime) })
60364
+ ] })
60365
+ ] }),
60366
+ 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 } })
60367
+ ]
60368
+ }
60369
+ ),
60370
+ detailsExpanded && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-pb-3 uf-space-y-2.5", children: [
60371
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
60372
+ /* @__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 } }) }),
60373
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
60374
+ tCrypto.slippage.label,
60375
+ ":",
60376
+ " ",
60377
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
60378
+ tCrypto.slippage.auto,
60379
+ " \u2022 ",
60380
+ (maxSlippagePercent ?? 0.25).toFixed(2),
60381
+ "%"
60382
+ ] })
60383
+ ] })
60384
+ ] }),
60385
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
60386
+ /* @__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 } }) }),
60387
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-text-xs", style: { color: components.card.labelColor, fontFamily: fonts.regular }, children: [
60388
+ tCrypto.priceImpact.label,
60389
+ ":",
60390
+ " ",
60391
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: [
60392
+ (priceImpactPercent ?? 0).toFixed(2),
60393
+ "%"
60394
+ ] })
60395
+ ] })
60396
+ ] })
60397
+ ] })
60398
+ ] }),
60399
+ !canWithdraw && !submitError && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
60400
+ "div",
60401
+ {
60402
+ className: "uf-flex uf-items-start uf-gap-2.5 uf-p-3 uf-rounded-xl",
60403
+ style: { backgroundColor: colors2.card, border: `1px solid ${colors2.border}` },
60404
+ children: [
60405
+ /* @__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 } }),
60406
+ /* @__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." })
60407
+ ]
60408
+ }
60409
+ ),
60410
+ isWalletMatch && connectedWalletName ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60411
+ "button",
60412
+ {
60413
+ type: "button",
60414
+ onClick: handleWithdraw,
60415
+ disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
60416
+ 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",
60417
+ style: {
60418
+ backgroundColor: colors2.primary,
60419
+ color: colors2.primaryForeground,
60420
+ fontFamily: fonts.medium,
60421
+ borderRadius: components.button.borderRadius,
60422
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
60423
+ },
60424
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
60425
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
60426
+ "Processing..."
60427
+ ] }) : 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: [
60428
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Wallet, { className: "uf-w-4 uf-h-4" }),
60429
+ "Withdraw from ",
60430
+ connectedWalletName
60431
+ ] })
60432
+ }
60433
+ ) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60434
+ "button",
60435
+ {
60436
+ type: "button",
60437
+ onClick: handleWithdraw,
60438
+ disabled: !isFormValid || !canWithdraw || isSubmitting || !selectedToken || !selectedChain,
60439
+ 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",
60440
+ style: {
60441
+ backgroundColor: colors2.primary,
60442
+ color: colors2.primaryForeground,
60443
+ fontFamily: fonts.medium,
60444
+ borderRadius: components.button.borderRadius,
60445
+ border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
60446
+ },
60447
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2", children: [
60448
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }),
60449
+ "Processing..."
60450
+ ] }) : isOverBalance ? "Insufficient balance" : isBelowMinimum ? "Minimum amount not met" : submitError ? "Withdrawal failed. Try again" : t8.withdraw
60451
+ }
60452
+ ),
60453
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-text-xs uf-pt-1", children: [
60454
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { children: footerLeft }),
60455
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositFooterLinks, { onGlossaryClick: () => setGlossaryOpen(true) })
60456
+ ] }),
60457
+ /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
60458
+ GlossaryModal,
60459
+ {
60460
+ open: glossaryOpen,
60461
+ onOpenChange: setGlossaryOpen
60462
+ }
60463
+ )
60464
+ ] });
60465
+ }
60466
+ function WithdrawExecutionItem({
60467
+ execution,
60468
+ onClick
60469
+ }) {
60470
+ const { colors: colors2, fonts, components } = useTheme();
60471
+ const isPending = execution.status === ExecutionStatus.PENDING || execution.status === ExecutionStatus.WAITING || execution.status === ExecutionStatus.DELAYED;
60472
+ const formatDateTime = (timestamp) => {
60473
+ try {
60474
+ const date = new Date(timestamp);
60475
+ const monthDay = date.toLocaleDateString("en-US", {
60476
+ month: "short",
60477
+ day: "numeric",
60478
+ year: "numeric"
60479
+ });
60480
+ const time = date.toLocaleTimeString("en-US", {
60481
+ hour: "numeric",
60482
+ minute: "2-digit",
60483
+ hour12: true
60484
+ }).toLowerCase();
60485
+ return `${monthDay} at ${time}`;
60486
+ } catch {
60487
+ return timestamp;
60488
+ }
60489
+ };
60490
+ const formatUsdAmount2 = (sourceAmountUsd) => {
60491
+ try {
60492
+ const amount = Number(sourceAmountUsd);
60493
+ return new Intl.NumberFormat("en-US", {
60494
+ style: "currency",
60495
+ currency: "USD",
60496
+ minimumFractionDigits: 2,
60497
+ maximumFractionDigits: 2
60498
+ }).format(amount);
60499
+ } catch {
60500
+ return "$0.00";
60501
+ }
60502
+ };
60503
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
60504
+ "button",
60505
+ {
60506
+ onClick,
60507
+ 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",
60508
+ style: {
60509
+ backgroundColor: components.card.backgroundColor,
60510
+ borderRadius: components.list.rowBorderRadius,
60511
+ border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
60512
+ },
60513
+ children: [
60514
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-relative uf-flex-shrink-0 uf-w-9 uf-h-9", children: [
60515
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60516
+ "img",
60517
+ {
60518
+ src: execution.destination_token_metadata?.icon_url || getIconUrl("/icons/tokens/svg/usdc.svg"),
60519
+ alt: "Token",
60520
+ width: 36,
60521
+ height: 36,
60522
+ loading: "lazy",
60523
+ className: "uf-rounded-full uf-w-9 uf-h-9"
60524
+ }
60525
+ ),
60526
+ isPending ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60527
+ "div",
60528
+ {
60529
+ className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
60530
+ style: { backgroundColor: colors2.warning },
60531
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60532
+ "svg",
60533
+ {
60534
+ width: "10",
60535
+ height: "10",
60536
+ viewBox: "0 0 12 12",
60537
+ fill: "none",
60538
+ className: "uf-animate-spin uf-block",
60539
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60540
+ "path",
60541
+ {
60542
+ d: "M6 1V3M6 9V11M1 6H3M9 6H11M2.5 2.5L4 4M8 8L9.5 9.5M2.5 9.5L4 8M8 4L9.5 2.5",
60543
+ stroke: "white",
60544
+ strokeWidth: "2",
60545
+ strokeLinecap: "round"
60546
+ }
60547
+ )
60548
+ }
60549
+ )
60550
+ }
60551
+ ) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60552
+ "div",
60553
+ {
60554
+ className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full uf-p-0.5",
60555
+ style: { backgroundColor: colors2.success },
60556
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60557
+ "svg",
60558
+ {
60559
+ width: "10",
60560
+ height: "10",
60561
+ viewBox: "0 0 12 12",
60562
+ fill: "none",
60563
+ className: "uf-block",
60564
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60565
+ "path",
60566
+ {
60567
+ d: "M10 3L4.5 8.5L2 6",
60568
+ stroke: "white",
60569
+ strokeWidth: "2",
60570
+ strokeLinecap: "round",
60571
+ strokeLinejoin: "round"
60572
+ }
60573
+ )
60574
+ }
60575
+ )
60576
+ }
60577
+ )
60578
+ ] }),
60579
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uf-flex-1 uf-min-w-0", children: [
60580
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60581
+ "h3",
60582
+ {
60583
+ className: "uf-font-medium uf-text-sm uf-leading-tight",
60584
+ style: {
60585
+ color: components.card.titleColor,
60586
+ fontFamily: fonts.medium
60587
+ },
60588
+ children: isPending ? "Withdrawal processing" : "Withdrawal completed"
60589
+ }
60590
+ ),
60591
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60592
+ "p",
60593
+ {
60594
+ className: "uf-text-xs uf-leading-tight",
60595
+ style: {
60596
+ color: components.card.subtitleColor,
60597
+ fontFamily: fonts.regular
60598
+ },
60599
+ children: formatDateTime(execution.created_at || (/* @__PURE__ */ new Date()).toISOString())
60600
+ }
60601
+ )
60602
+ ] }),
60603
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60604
+ "span",
60605
+ {
60606
+ className: "uf-font-medium uf-text-sm uf-flex-shrink-0",
60607
+ style: {
60608
+ color: components.card.textRightColor,
60609
+ fontFamily: fonts.medium
60610
+ },
60611
+ children: formatUsdAmount2(execution.source_amount_usd || "0")
60612
+ }
60613
+ ),
60614
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
60615
+ ChevronRight,
60616
+ {
60617
+ className: "uf-w-4 uf-h-4 uf-flex-shrink-0",
60618
+ style: { color: components.card.actionColor }
60619
+ }
60620
+ )
60621
+ ]
60622
+ }
60623
+ );
60624
+ }
60625
+ function truncateAddress4(addr) {
60626
+ if (addr.length <= 12) return addr;
60627
+ return `${addr.slice(0, 6)}...${addr.slice(-4)}`;
60628
+ }
60629
+ var SHOW_BUTTON_DELAY_MS = 5e3;
60630
+ function WithdrawConfirmingView({
60631
+ txInfo,
60632
+ executions,
60633
+ onClose,
60634
+ onViewTracker
60635
+ }) {
60636
+ const { colors: colors2, fonts, components } = useTheme();
60637
+ const [showButton, setShowButton] = (0, import_react30.useState)(false);
60638
+ const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
60639
+ (0, import_react30.useEffect)(() => {
60640
+ if (latestExecution) return;
60641
+ const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
60642
+ return () => clearTimeout(timer);
60643
+ }, [latestExecution]);
60644
+ const btnRadius = components.button.borderRadius;
60645
+ const btnBorder = `${components.button.borderWidth}px solid ${components.button.borderColor}`;
60646
+ if (latestExecution) {
60647
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
60648
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Details", showClose: true, onClose }),
60649
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositDetailContent, { execution: latestExecution, variant: "withdraw" }),
60650
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-2", children: [
60651
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60652
+ "button",
60653
+ {
60654
+ type: "button",
60655
+ onClick: onViewTracker,
60656
+ className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
60657
+ style: {
60658
+ backgroundColor: components.button.secondaryBackground,
60659
+ color: components.button.secondaryText,
60660
+ fontFamily: fonts.medium,
60661
+ borderRadius: btnRadius,
60662
+ border: btnBorder
60663
+ },
60664
+ children: "Withdrawal History"
60665
+ }
60666
+ ),
60667
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60668
+ "button",
60669
+ {
60670
+ type: "button",
60671
+ onClick: onClose,
60672
+ className: "uf-flex-1 uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
60673
+ style: {
60674
+ backgroundColor: components.button.primaryBackground,
60675
+ color: components.button.primaryText,
60676
+ fontFamily: fonts.medium,
60677
+ borderRadius: btnRadius,
60678
+ border: btnBorder
60679
+ },
60680
+ children: "Close"
60681
+ }
60682
+ )
60683
+ ] }),
60684
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60685
+ PoweredByUnifold,
60686
+ {
60687
+ color: colors2.foregroundMuted,
60688
+ className: "uf-flex uf-justify-center uf-shrink-0"
60689
+ }
60690
+ ) })
60691
+ ] });
60692
+ }
60693
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
60694
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DepositHeader, { title: "Withdrawal Status", showClose: true, onClose }),
60695
+ /* @__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: [
60696
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60697
+ "div",
60698
+ {
60699
+ className: "uf-w-20 uf-h-20 uf-rounded-full uf-flex uf-items-center uf-justify-center uf-mb-6",
60700
+ style: { backgroundColor: `${colors2.primary}20` },
60701
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60702
+ "svg",
60703
+ {
60704
+ width: "40",
60705
+ height: "40",
60706
+ viewBox: "0 0 24 24",
60707
+ fill: "none",
60708
+ className: "uf-animate-spin",
60709
+ children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60710
+ "path",
60711
+ {
60712
+ d: "M21 12a9 9 0 1 1-6.22-8.56",
60713
+ stroke: colors2.primary,
60714
+ strokeWidth: "2.5",
60715
+ strokeLinecap: "round"
60716
+ }
60717
+ )
60718
+ }
60719
+ )
60720
+ }
60721
+ ),
60722
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60723
+ "h3",
60724
+ {
60725
+ className: "uf-text-xl uf-mb-2",
60726
+ style: { color: colors2.foreground, fontFamily: fonts.medium },
60727
+ children: "Checking Withdrawal"
60728
+ }
60729
+ ),
60730
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
60731
+ "p",
60732
+ {
60733
+ className: "uf-text-sm uf-text-center",
60734
+ style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
60735
+ children: [
60736
+ txInfo.amount,
60737
+ " ",
60738
+ txInfo.sourceTokenSymbol,
60739
+ " to",
60740
+ " ",
60741
+ truncateAddress4(txInfo.recipientAddress)
60742
+ ]
60743
+ }
60744
+ )
60745
+ ] }),
60746
+ showButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-px-1 uf-pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60747
+ "button",
60748
+ {
60749
+ type: "button",
60750
+ onClick: onViewTracker,
60751
+ className: "uf-w-full uf-py-2.5 uf-text-sm uf-transition-colors hover:uf-opacity-90",
60752
+ style: {
60753
+ backgroundColor: components.button.secondaryBackground,
60754
+ color: components.button.secondaryText,
60755
+ fontFamily: fonts.medium,
60756
+ borderRadius: btnRadius,
60757
+ border: btnBorder
60758
+ },
60759
+ children: "Withdrawal History"
60760
+ }
60761
+ ) }),
60762
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
60763
+ PoweredByUnifold,
60764
+ {
60765
+ color: colors2.foregroundMuted,
60766
+ className: "uf-flex uf-justify-center uf-shrink-0"
60767
+ }
60768
+ ) })
60769
+ ] });
60770
+ }
60771
+ var t9 = i18n2.withdrawModal;
60772
+ var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
60773
+ function WithdrawModal({
60774
+ open,
60775
+ onOpenChange,
60776
+ publishableKey,
60777
+ modalTitle,
60778
+ externalUserId,
60779
+ sourceChainType,
60780
+ sourceChainId,
60781
+ sourceTokenAddress,
60782
+ sourceTokenSymbol,
60783
+ recipientAddress: recipientAddressProp,
60784
+ senderAddress,
60785
+ onWithdraw,
60786
+ onWithdrawSuccess,
60787
+ onWithdrawError,
60788
+ theme = "dark",
60789
+ hideOverlay = false
60790
+ }) {
60791
+ const { colors: colors2, fonts, components } = useTheme();
60792
+ const [containerEl, setContainerEl] = (0, import_react27.useState)(null);
60793
+ const containerCallbackRef = (0, import_react27.useCallback)((el) => {
60794
+ setContainerEl(el);
60795
+ }, []);
60796
+ const [resolvedTheme, setResolvedTheme] = (0, import_react27.useState)(
60797
+ theme === "auto" ? "dark" : theme
60798
+ );
60799
+ (0, import_react27.useEffect)(() => {
60800
+ if (theme === "auto") {
60801
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
60802
+ setResolvedTheme(mq.matches ? "dark" : "light");
60803
+ const h = (e) => setResolvedTheme(e.matches ? "dark" : "light");
60804
+ mq.addEventListener("change", h);
60805
+ return () => mq.removeEventListener("change", h);
60806
+ }
60807
+ setResolvedTheme(theme);
60808
+ }, [theme]);
60809
+ const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
60810
+ const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDestinationTokens(publishableKey, open);
60811
+ const destinationTokens = tokensResponse?.data ?? [];
60812
+ const { data: sourceValidation, isLoading: isCheckingSourceToken } = useSourceTokenValidation({
60813
+ sourceChainType,
60814
+ sourceChainId,
60815
+ sourceTokenAddress,
60816
+ sourceTokenSymbol,
60817
+ publishableKey,
60818
+ enabled: open
60819
+ });
60820
+ const { data: balanceData, isLoading: isLoadingBalance } = useAddressBalance({
60821
+ address: senderAddress,
60822
+ chainType: sourceChainType,
60823
+ chainId: sourceChainId,
60824
+ tokenAddress: sourceTokenAddress,
60825
+ publishableKey,
60826
+ enabled: open
60827
+ });
60828
+ const [selectedToken, setSelectedToken] = (0, import_react27.useState)(null);
60829
+ const [selectedChain, setSelectedChain] = (0, import_react27.useState)(null);
60830
+ const [detectedWallet, setDetectedWallet] = (0, import_react27.useState)(null);
60831
+ const connectedWalletName = detectedWallet?.name ?? null;
60832
+ const isWalletMatch = !!detectedWallet;
60833
+ (0, import_react27.useEffect)(() => {
60834
+ if (!senderAddress || !open) {
60835
+ setDetectedWallet(null);
60836
+ return;
60837
+ }
60838
+ let cancelled = false;
60839
+ detectBrowserWallet(sourceChainType, senderAddress).then((wallet) => {
60840
+ if (!cancelled) setDetectedWallet(wallet);
60841
+ });
60842
+ return () => {
60843
+ cancelled = true;
60844
+ };
60845
+ }, [senderAddress, sourceChainType, open]);
60846
+ const [view, setView] = (0, import_react27.useState)("form");
60847
+ const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react27.useState)();
60848
+ const [selectedExecution, setSelectedExecution] = (0, import_react27.useState)(null);
60849
+ const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react27.useState)(null);
60850
+ const { executions: realtimeExecutions } = useWithdrawPolling({
60851
+ userId: externalUserId,
60852
+ publishableKey,
60853
+ depositWalletId: withdrawDepositWalletId,
60854
+ enabled: !!withdrawDepositWalletId && open,
60855
+ onWithdrawSuccess: onWithdrawSuccess ? (d) => onWithdrawSuccess({ message: d.message, transaction: d.transaction }) : void 0,
60856
+ onWithdrawError
60857
+ });
60858
+ const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
60859
+ actionType: ActionType.Withdraw,
60860
+ enabled: open,
60861
+ refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
60862
+ });
60863
+ const allWithdrawals = allWithdrawalsData?.data ?? [];
60864
+ const handleDepositWalletCreation = (0, import_react27.useCallback)(async (params) => {
60865
+ const { data: wallets } = await createDepositAddress(
60866
+ {
60867
+ external_user_id: externalUserId,
60868
+ destination_chain_type: params.destinationChainType,
60869
+ destination_chain_id: params.destinationChainId,
60870
+ destination_token_address: params.destinationTokenAddress,
60871
+ recipient_address: params.recipientAddress,
60872
+ action_type: ActionType.Withdraw
60873
+ },
60874
+ publishableKey
60875
+ );
60876
+ const depositWallet = getWalletByChainType(wallets, sourceChainType);
60877
+ if (!depositWallet) {
60878
+ throw new Error(`No deposit wallet available for ${sourceChainType}`);
60879
+ }
60880
+ setWithdrawDepositWalletId(depositWallet.id);
60881
+ return depositWallet;
60882
+ }, [externalUserId, publishableKey, sourceChainType]);
60883
+ const handleWithdrawSubmitted = (0, import_react27.useCallback)((txInfo) => {
60884
+ setSubmittedTxInfo(txInfo);
60885
+ setView("confirming");
60886
+ }, []);
60887
+ (0, import_react27.useEffect)(() => {
60888
+ if (!destinationTokens.length || selectedToken) return;
60889
+ const first = destinationTokens[0];
60890
+ if (first?.chains.length > 0) {
60891
+ setSelectedToken(first);
60892
+ setSelectedChain(first.chains[0]);
60893
+ }
60894
+ }, [destinationTokens, selectedToken]);
60895
+ const resetViewTimeoutRef = (0, import_react27.useRef)(null);
60896
+ const handleClose = (0, import_react27.useCallback)(() => {
60897
+ onOpenChange(false);
60898
+ if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
60899
+ resetViewTimeoutRef.current = setTimeout(() => {
60900
+ setSelectedToken(null);
60901
+ setSelectedChain(null);
60902
+ setView("form");
60903
+ setSelectedExecution(null);
60904
+ setSubmittedTxInfo(null);
60905
+ setWithdrawDepositWalletId(void 0);
60906
+ resetViewTimeoutRef.current = null;
60907
+ }, 200);
60908
+ }, [onOpenChange]);
60909
+ (0, import_react27.useLayoutEffect)(() => {
60910
+ if (!open) return;
60911
+ if (resetViewTimeoutRef.current) {
60912
+ clearTimeout(resetViewTimeoutRef.current);
60913
+ resetViewTimeoutRef.current = null;
60914
+ }
60915
+ setSelectedToken(null);
60916
+ setSelectedChain(null);
60917
+ setView("form");
60918
+ setSelectedExecution(null);
60919
+ setSubmittedTxInfo(null);
60920
+ setWithdrawDepositWalletId(void 0);
60921
+ }, [open]);
60922
+ (0, import_react27.useEffect)(() => () => {
60923
+ if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
60924
+ }, []);
60925
+ const handleTokenSymbolChange = (0, import_react27.useCallback)((symbol) => {
60926
+ const tok = destinationTokens.find((t11) => t11.symbol === symbol);
60927
+ if (tok) {
60928
+ setSelectedToken(tok);
60929
+ if (tok.chains.length > 0) setSelectedChain(tok.chains[0]);
60930
+ }
60931
+ }, [destinationTokens]);
60932
+ const handleChainKeyChange = (0, import_react27.useCallback)((chainKey) => {
60933
+ if (!selectedToken) return;
60934
+ const chain = selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === chainKey);
60935
+ if (chain) setSelectedChain(chain);
60936
+ }, [selectedToken]);
60937
+ const isSourceSupported = sourceValidation?.isSupported ?? null;
60938
+ const canWithdraw = !!onWithdraw || isWalletMatch;
60939
+ const isAnyLoading = tokensLoading || isCheckingSourceToken;
60940
+ 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" }) });
60941
+ 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)(
60942
+ DialogContent2,
60943
+ {
60944
+ ref: hideOverlay ? containerCallbackRef : void 0,
60945
+ hideOverlay,
60946
+ 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}`}`,
60947
+ style: { backgroundColor: colors2.background },
60948
+ onPointerDownOutside: (e) => e.preventDefault(),
60949
+ onInteractOutside: (e) => e.preventDefault(),
60950
+ children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ThemeStyleInjector, { children: view === "confirming" && submittedTxInfo ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
60951
+ WithdrawConfirmingView,
60952
+ {
60953
+ txInfo: submittedTxInfo,
60954
+ executions: realtimeExecutions,
60955
+ onClose: handleClose,
60956
+ onViewTracker: () => setView("tracker")
60957
+ }
60958
+ ) : view === "detail" && selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
60959
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal Details", showBack: true, showClose: !hideOverlay, onBack: () => {
60960
+ setSelectedExecution(null);
60961
+ setView("tracker");
60962
+ }, onClose: handleClose }),
60963
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositDetailContent, { execution: selectedExecution, variant: "withdraw" }),
60964
+ withdrawPoweredByFooter
60965
+ ] }) : view === "tracker" ? (
60966
+ /* ---------- Tracker view: execution list ---------- */
60967
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
60968
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: "Withdrawal History", showBack: true, showClose: !hideOverlay, onBack: () => setView("form"), onClose: handleClose }),
60969
+ /* @__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)(
60970
+ WithdrawExecutionItem,
60971
+ {
60972
+ execution: ex,
60973
+ onClick: () => {
60974
+ setSelectedExecution(ex);
60975
+ setView("detail");
60976
+ }
60977
+ },
60978
+ ex.id
60979
+ )) }),
60980
+ withdrawPoweredByFooter
60981
+ ] })
60982
+ ) : (
60983
+ /* ---------- Form view (default) ---------- */
60984
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
60985
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DepositHeader, { title: modalTitle || t9.title, showClose: !hideOverlay, onClose: handleClose }),
60986
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-3", children: [
60987
+ 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: [
60988
+ /* @__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" }) }),
60989
+ /* @__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" }),
60990
+ /* @__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 })
60991
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
60992
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
60993
+ WithdrawDoubleInput,
60994
+ {
60995
+ tokens: destinationTokens,
60996
+ selectedTokenSymbol: selectedToken?.symbol ?? null,
60997
+ selectedChainKey: selectedChain ? getChainKey5(selectedChain.chain_id, selectedChain.chain_type) : null,
60998
+ onTokenChange: handleTokenSymbolChange,
60999
+ onChainChange: handleChainKeyChange,
61000
+ isLoading: tokensLoading
61001
+ }
61002
+ ),
61003
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
61004
+ WithdrawForm,
61005
+ {
61006
+ publishableKey,
61007
+ externalUserId,
61008
+ sourceChainType,
61009
+ selectedToken,
61010
+ selectedChain,
61011
+ sourceTokenSymbol,
61012
+ recipientAddressProp,
61013
+ balanceData: balanceData ?? null,
61014
+ isLoadingBalance,
61015
+ minimumWithdrawAmountUsd: sourceValidation?.minimumAmountUsd ?? null,
61016
+ estimatedProcessingTime: sourceValidation?.estimatedProcessingTime ?? null,
61017
+ maxSlippagePercent: sourceValidation?.maxSlippagePercent ?? null,
61018
+ priceImpactPercent: sourceValidation?.priceImpactPercent ?? null,
61019
+ detectedWallet,
61020
+ sourceChainId,
61021
+ sourceTokenAddress,
61022
+ isWalletMatch,
61023
+ connectedWalletName,
61024
+ canWithdraw,
61025
+ onWithdraw,
61026
+ onWithdrawError,
61027
+ onDepositWalletCreation: handleDepositWalletCreation,
61028
+ onWithdrawSubmitted: handleWithdrawSubmitted,
61029
+ footerLeft: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
61030
+ "button",
61031
+ {
61032
+ onClick: () => setView("tracker"),
61033
+ className: "uf-flex uf-items-center uf-gap-1 uf-transition-colors hover:uf-opacity-70",
61034
+ style: { color: colors2.foregroundMuted },
61035
+ children: [
61036
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Clock, { className: "uf-w-3.5 uf-h-3.5" }),
61037
+ "Withdrawal History",
61038
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ChevronRight, { className: "uf-w-3 uf-h-3" })
61039
+ ]
61040
+ }
61041
+ )
61042
+ }
61043
+ )
61044
+ ] }),
61045
+ withdrawPoweredByFooter
61046
+ ] })
61047
+ ] })
61048
+ ) })
61049
+ }
61050
+ ) }) });
61051
+ }
61052
+ var t10 = i18n2.withdrawModal;
61053
+ function UnifoldProvider2({
61054
+ children,
61055
+ publishableKey,
61056
+ config
61057
+ }) {
61058
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
61059
+ const [depositConfig, setDepositConfig] = (0, import_react.useState)(
61060
+ null
61061
+ );
61062
+ const [isWithdrawOpen, setIsWithdrawOpen] = (0, import_react.useState)(false);
61063
+ const [withdrawConfig, setWithdrawConfig] = (0, import_react.useState)(
61064
+ null
61065
+ );
61066
+ const [resolvedTheme, setResolvedTheme] = import_react.default.useState("dark");
61067
+ (0, import_react.useEffect)(() => {
61068
+ if (publishableKey) {
61069
+ setApiConfig({ publishableKey });
61070
+ }
61071
+ }, [publishableKey]);
61072
+ import_react.default.useEffect(() => {
61073
+ const appearance = config?.appearance || "dark";
61074
+ if (appearance === "auto") {
61075
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
61076
+ setResolvedTheme(prefersDark ? "dark" : "light");
61077
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
61078
+ const handler = (e) => {
61079
+ setResolvedTheme(e.matches ? "dark" : "light");
61080
+ };
61081
+ mediaQuery.addEventListener("change", handler);
61082
+ return () => mediaQuery.removeEventListener("change", handler);
61083
+ } else {
61084
+ setResolvedTheme(appearance);
61085
+ }
61086
+ }, [config?.appearance]);
61087
+ const depositPromiseRef = import_react.default.useRef(null);
61088
+ const depositConfigRef = import_react.default.useRef(null);
61089
+ depositConfigRef.current = depositConfig;
61090
+ const closeTimeoutRef = import_react.default.useRef(null);
61091
+ const closeGuardRef = import_react.default.useRef(false);
61092
+ const withdrawPromiseRef = import_react.default.useRef(null);
61093
+ const withdrawConfigRef = import_react.default.useRef(null);
61094
+ withdrawConfigRef.current = withdrawConfig;
61095
+ const withdrawCloseTimeoutRef = import_react.default.useRef(null);
61096
+ const withdrawCloseGuardRef = import_react.default.useRef(false);
61097
+ const beginDeposit = (0, import_react.useCallback)((config2) => {
61098
+ if (closeTimeoutRef.current) {
61099
+ clearTimeout(closeTimeoutRef.current);
61100
+ closeTimeoutRef.current = null;
61101
+ }
61102
+ closeGuardRef.current = false;
61103
+ if (depositPromiseRef.current) {
61104
+ console.warn("[UnifoldProvider] A deposit is already in progress. Cancelling previous deposit.");
61105
+ depositPromiseRef.current.reject({
61106
+ message: "Deposit cancelled - new deposit started",
61107
+ code: "DEPOSIT_SUPERSEDED"
61108
+ });
61109
+ depositPromiseRef.current = null;
61110
+ }
61111
+ const promise = new Promise((resolve, reject) => {
61112
+ depositPromiseRef.current = { resolve, reject };
61113
+ });
61114
+ promise.catch(() => {
61115
+ });
61116
+ setDepositConfig(config2);
61117
+ setIsOpen(true);
61118
+ return promise;
61119
+ }, []);
61120
+ const closeDeposit = (0, import_react.useCallback)(() => {
61121
+ if (closeGuardRef.current) {
61122
+ return;
61123
+ }
61124
+ closeGuardRef.current = true;
61125
+ const promiseToReject = depositPromiseRef.current;
61126
+ depositPromiseRef.current = null;
61127
+ if (depositConfigRef.current?.onClose) {
61128
+ depositConfigRef.current.onClose();
61129
+ }
61130
+ if (promiseToReject) {
61131
+ promiseToReject.reject({
61132
+ message: "Deposit cancelled by user",
61133
+ code: "DEPOSIT_CANCELLED"
61134
+ });
61135
+ }
61136
+ setIsOpen(false);
61137
+ closeTimeoutRef.current = setTimeout(() => {
61138
+ setDepositConfig(null);
61139
+ closeTimeoutRef.current = null;
61140
+ }, 200);
61141
+ }, []);
61142
+ const handleDepositSuccess = (0, import_react.useCallback)((data) => {
61143
+ if (depositConfig?.onSuccess) {
61144
+ depositConfig.onSuccess(data);
61145
+ }
61146
+ if (depositPromiseRef.current) {
61147
+ depositPromiseRef.current.resolve(data);
61148
+ depositPromiseRef.current = null;
61149
+ }
61150
+ }, [depositConfig]);
61151
+ const handleDepositError = (0, import_react.useCallback)((error) => {
61152
+ console.error("[UnifoldProvider] Deposit error:", error);
61153
+ if (depositConfig?.onError) {
61154
+ depositConfig.onError(error);
61155
+ }
61156
+ if (depositPromiseRef.current) {
61157
+ depositPromiseRef.current.reject(error);
61158
+ depositPromiseRef.current = null;
61159
+ }
61160
+ }, [depositConfig]);
61161
+ const beginWithdraw = (0, import_react.useCallback)((config2) => {
61162
+ if (withdrawCloseTimeoutRef.current) {
61163
+ clearTimeout(withdrawCloseTimeoutRef.current);
61164
+ withdrawCloseTimeoutRef.current = null;
61165
+ }
61166
+ withdrawCloseGuardRef.current = false;
61167
+ if (withdrawPromiseRef.current) {
61168
+ console.warn("[UnifoldProvider] A withdraw is already in progress. Cancelling previous withdraw.");
61169
+ withdrawPromiseRef.current.reject({
61170
+ message: "Withdraw cancelled - new withdraw started",
61171
+ code: "WITHDRAW_SUPERSEDED"
61172
+ });
61173
+ withdrawPromiseRef.current = null;
61174
+ }
61175
+ const promise = new Promise((resolve, reject) => {
61176
+ withdrawPromiseRef.current = { resolve, reject };
61177
+ });
61178
+ promise.catch(() => {
61179
+ });
61180
+ setWithdrawConfig(config2);
61181
+ setIsWithdrawOpen(true);
61182
+ return promise;
61183
+ }, []);
61184
+ const closeWithdraw = (0, import_react.useCallback)(() => {
61185
+ if (withdrawCloseGuardRef.current) {
61186
+ return;
61187
+ }
61188
+ withdrawCloseGuardRef.current = true;
61189
+ const promiseToReject = withdrawPromiseRef.current;
61190
+ withdrawPromiseRef.current = null;
61191
+ if (withdrawConfigRef.current?.onClose) {
61192
+ withdrawConfigRef.current.onClose();
61193
+ }
61194
+ if (promiseToReject) {
61195
+ promiseToReject.reject({
61196
+ message: "Withdraw cancelled by user",
61197
+ code: "WITHDRAW_CANCELLED"
61198
+ });
61199
+ }
61200
+ setIsWithdrawOpen(false);
61201
+ withdrawCloseTimeoutRef.current = setTimeout(() => {
61202
+ setWithdrawConfig(null);
61203
+ withdrawCloseTimeoutRef.current = null;
61204
+ }, 200);
61205
+ }, []);
61206
+ const handleWithdrawSuccess = (0, import_react.useCallback)((data) => {
61207
+ if (withdrawConfigRef.current?.onSuccess) {
61208
+ withdrawConfigRef.current.onSuccess(data);
61209
+ }
61210
+ if (withdrawPromiseRef.current) {
61211
+ withdrawPromiseRef.current.resolve(data);
61212
+ withdrawPromiseRef.current = null;
61213
+ }
61214
+ }, []);
61215
+ const handleWithdrawError = (0, import_react.useCallback)((error) => {
61216
+ console.error("[UnifoldProvider] Withdraw error:", error);
61217
+ if (withdrawConfigRef.current?.onError) {
61218
+ withdrawConfigRef.current.onError(error);
61219
+ }
61220
+ if (withdrawPromiseRef.current) {
61221
+ withdrawPromiseRef.current.reject(error);
61222
+ withdrawPromiseRef.current = null;
61223
+ }
61224
+ }, []);
61225
+ const contextValue = (0, import_react.useMemo)(
61226
+ () => ({
61227
+ beginDeposit,
61228
+ closeDeposit,
61229
+ handleDepositSuccess,
61230
+ handleDepositError,
61231
+ beginWithdraw,
61232
+ closeWithdraw,
61233
+ handleWithdrawSuccess,
61234
+ handleWithdrawError
61235
+ }),
61236
+ [beginDeposit, closeDeposit, handleDepositSuccess, handleDepositError, beginWithdraw, closeWithdraw, handleWithdrawSuccess, handleWithdrawError]
61237
+ );
61238
+ 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)(
61239
+ ThemeProvider,
61240
+ {
61241
+ mode: resolvedTheme,
61242
+ accentColor: config?.accentColor,
61243
+ theme: config?.theme,
61244
+ fontFamily: config?.fontFamily,
61245
+ fonts: config?.fonts,
61246
+ components: config?.components,
61247
+ children: [
61248
+ children,
61249
+ withdrawConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
61250
+ WithdrawModal,
61251
+ {
61252
+ open: isWithdrawOpen,
61253
+ onOpenChange: closeWithdraw,
61254
+ publishableKey,
61255
+ modalTitle: config?.withdrawModalTitle,
61256
+ externalUserId: withdrawConfig.externalUserId,
61257
+ sourceChainType: withdrawConfig.sourceChainType,
61258
+ sourceChainId: withdrawConfig.sourceChainId,
61259
+ sourceTokenAddress: withdrawConfig.sourceTokenAddress,
61260
+ sourceTokenSymbol: withdrawConfig.sourceTokenSymbol,
61261
+ recipientAddress: withdrawConfig.recipientAddress,
61262
+ senderAddress: withdrawConfig.senderAddress,
61263
+ onWithdraw: withdrawConfig.withdraw,
61264
+ onWithdrawSuccess: handleWithdrawSuccess,
61265
+ onWithdrawError: handleWithdrawError,
61266
+ theme: resolvedTheme
61267
+ }
61268
+ ),
61269
+ depositConfig && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
61270
+ DepositModal,
61271
+ {
61272
+ open: isOpen,
61273
+ onOpenChange: closeDeposit,
61274
+ userId: depositConfig.externalUserId,
61275
+ publishableKey,
61276
+ modalTitle: config?.modalTitle,
61277
+ destinationTokenSymbol: depositConfig.destinationTokenSymbol,
61278
+ recipientAddress: depositConfig.recipientAddress,
61279
+ destinationChainType: depositConfig.destinationChainType,
61280
+ destinationChainId: depositConfig.destinationChainId,
61281
+ destinationTokenAddress: depositConfig.destinationTokenAddress,
61282
+ defaultSourceChainType: depositConfig.defaultSourceChainType,
61283
+ defaultSourceChainId: depositConfig.defaultSourceChainId,
61284
+ defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
61285
+ defaultSourceSymbol: depositConfig.defaultSourceSymbol,
61286
+ depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
61287
+ hideDepositTracker: config?.hideDepositTracker,
61288
+ showBalanceHeader: config?.showBalanceHeader,
61289
+ transferInputVariant: config?.transferInputVariant,
61290
+ enableConnectWallet: config?.enableConnectWallet,
61291
+ enablePayWithExchange: config?.enablePayWithExchange,
61292
+ onDepositSuccess: handleDepositSuccess,
61293
+ onDepositError: handleDepositError,
61294
+ theme: resolvedTheme,
61295
+ initialScreen: depositConfig.initialScreen ?? config?.defaultInitialScreen,
61296
+ transferCryptoTitle: config?.transferCryptoTitle,
61297
+ depositWithCardTitle: config?.depositWithCardTitle,
61298
+ payWithExchangeTitle: config?.payWithExchangeTitle,
61299
+ depositTrackerTitle: config?.depositTrackerTitle,
61300
+ depositTrackerSubTitle: config?.depositTrackerSubTitle,
61301
+ hideDepositFlowInfo: config?.hideDepositFlowInfo,
61302
+ hideDisplayDescription: config?.hideDisplayDescription,
61303
+ browserWalletAmountQuickSelect: config?.browserWalletAmountQuickSelect
61304
+ }
61305
+ )
61306
+ ]
61307
+ }
61308
+ ) }) });
61309
+ }
61310
+ var ConnectContext = import_react.default.createContext(null);
61311
+ function useUnifold2() {
61312
+ const baseContext = useUnifold();
61313
+ const connectContext = import_react.default.useContext(ConnectContext);
61314
+ if (typeof window === "undefined") {
61315
+ return {
61316
+ publishableKey: "",
61317
+ beginDeposit: () => Promise.reject(new Error("SSR not supported")),
59420
61318
  closeDeposit: () => {
61319
+ },
61320
+ beginWithdraw: () => Promise.reject(new Error("SSR not supported")),
61321
+ closeWithdraw: () => {
59421
61322
  }
59422
61323
  };
59423
61324
  }
@@ -59427,21 +61328,25 @@ function useUnifold2() {
59427
61328
  return {
59428
61329
  publishableKey: baseContext.publishableKey,
59429
61330
  beginDeposit: connectContext.beginDeposit,
59430
- closeDeposit: connectContext.closeDeposit
61331
+ closeDeposit: connectContext.closeDeposit,
61332
+ beginWithdraw: connectContext.beginWithdraw,
61333
+ closeWithdraw: connectContext.closeWithdraw
59431
61334
  };
59432
61335
  }
59433
61336
 
59434
61337
  // src/unifold.tsx
59435
- var UnifoldBridge = (0, import_react27.forwardRef)((_, ref) => {
59436
- const { beginDeposit, closeDeposit } = useUnifold2();
59437
- (0, import_react27.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit }), [
61338
+ var UnifoldBridge = (0, import_react32.forwardRef)((_, ref) => {
61339
+ const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
61340
+ (0, import_react32.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
59438
61341
  beginDeposit,
59439
- closeDeposit
61342
+ closeDeposit,
61343
+ beginWithdraw,
61344
+ closeWithdraw
59440
61345
  ]);
59441
61346
  return null;
59442
61347
  });
59443
61348
  UnifoldBridge.displayName = "UnifoldBridge";
59444
- var RenderErrorBoundary = class extends import_react27.Component {
61349
+ var RenderErrorBoundary = class extends import_react32.Component {
59445
61350
  constructor() {
59446
61351
  super(...arguments);
59447
61352
  this.state = { hasError: false };
@@ -59486,6 +61391,15 @@ function createUnifold(publishableKey, config) {
59486
61391
  return resolvedHandle.beginDeposit(depositConfig);
59487
61392
  },
59488
61393
  closeDeposit: () => resolvedHandle?.closeDeposit(),
61394
+ beginWithdraw: (withdrawConfig) => {
61395
+ if (!resolvedHandle) {
61396
+ return Promise.reject(
61397
+ new Error("Unifold instance has been destroyed")
61398
+ );
61399
+ }
61400
+ return resolvedHandle.beginWithdraw(withdrawConfig);
61401
+ },
61402
+ closeWithdraw: () => resolvedHandle?.closeWithdraw(),
59489
61403
  destroy: cleanup
59490
61404
  };
59491
61405
  const refCallback = (handle) => {
@@ -59506,13 +61420,13 @@ function createUnifold(publishableKey, config) {
59506
61420
  };
59507
61421
  try {
59508
61422
  root.render(
59509
- import_react27.default.createElement(
61423
+ import_react32.default.createElement(
59510
61424
  RenderErrorBoundary,
59511
61425
  { onError: handleRenderError },
59512
- import_react27.default.createElement(
61426
+ import_react32.default.createElement(
59513
61427
  UnifoldProvider2,
59514
61428
  { publishableKey, config },
59515
- import_react27.default.createElement(UnifoldBridge, { ref: refCallback })
61429
+ import_react32.default.createElement(UnifoldBridge, { ref: refCallback })
59516
61430
  )
59517
61431
  )
59518
61432
  );
@@ -59536,11 +61450,13 @@ lucide-react/dist/esm/Icon.js:
59536
61450
  lucide-react/dist/esm/createLucideIcon.js:
59537
61451
  lucide-react/dist/esm/icons/arrow-left-right.js:
59538
61452
  lucide-react/dist/esm/icons/arrow-left.js:
61453
+ lucide-react/dist/esm/icons/arrow-up-down.js:
59539
61454
  lucide-react/dist/esm/icons/check.js:
59540
61455
  lucide-react/dist/esm/icons/chevron-down.js:
59541
61456
  lucide-react/dist/esm/icons/chevron-right.js:
59542
61457
  lucide-react/dist/esm/icons/chevron-up.js:
59543
61458
  lucide-react/dist/esm/icons/circle-check.js:
61459
+ lucide-react/dist/esm/icons/clipboard-paste.js:
59544
61460
  lucide-react/dist/esm/icons/clock.js:
59545
61461
  lucide-react/dist/esm/icons/copy.js:
59546
61462
  lucide-react/dist/esm/icons/credit-card.js: