@nexus-cross/crossx-sdk-core 2.2.0-beta.9 → 2.2.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -657,18 +657,18 @@ const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user
657
657
  try {
658
658
  const I = this.crypto.decodeJWT(e);
659
659
  d.log("[CROSSx] Firebase JWT 필드:", Object.keys(I).join(", ")), x = (i = I.firebase) == null ? void 0 : i.sign_in_provider;
660
- const N = ((o = I.firebase) == null ? void 0 : o.identities) ?? {};
661
- w = I.email ?? ((a = N.email) == null ? void 0 : a[0]), x === "google.com" ? _ = (c = N["google.com"]) == null ? void 0 : c[0] : x === "apple.com" && (_ = (l = N["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", x, "hasProviderSub:", !!_, "email:", w ?? "(없음)");
660
+ const C = ((o = I.firebase) == null ? void 0 : o.identities) ?? {};
661
+ w = I.email ?? ((a = C.email) == null ? void 0 : a[0]), x === "google.com" ? _ = (c = C["google.com"]) == null ? void 0 : c[0] : x === "apple.com" && (_ = (l = C["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", x, "hasProviderSub:", !!_, "email:", w ?? "(없음)");
662
662
  } catch {
663
663
  d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
664
664
  }
665
665
  if (p) {
666
666
  const I = this.crypto.decodeJWT(p);
667
667
  d.log("[CROSSx] access_token 디코딩 — sub:", I.sub, "exp:", I.exp, "필드:", Object.keys(I).join(", "));
668
- const N = await this.crypto.verifyJWT(p);
669
- if (n = N.signatureVerified ?? !1, !N.valid)
668
+ const C = await this.crypto.verifyJWT(p);
669
+ if (n = C.signatureVerified ?? !1, !C.valid)
670
670
  throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
671
- const R = N.payload, L = R.email ?? w ?? r;
671
+ const R = C.payload, L = R.email ?? w ?? r;
672
672
  d.log(
673
673
  "[CROSSx] email 소스 — CROSSx JWT:",
674
674
  R.email ?? "(없음)",
@@ -1243,13 +1243,15 @@ class fe {
1243
1243
  h.AUTH_FAILED,
1244
1244
  "Bridge handshake rejected by native"
1245
1245
  );
1246
+ const i = typeof n.walletName == "string" ? n.walletName.trim() : "", o = i.length > 0 && i.length <= 64 ? i : void 0;
1246
1247
  return {
1247
1248
  isActivated: !0,
1248
1249
  absoluteTtlMs: n.absoluteTtlMs,
1249
1250
  idleTtlMs: n.idleTtlMs,
1250
1251
  protocolVersion: n.protocolVersion,
1251
1252
  activatedAt: Date.now(),
1252
- walletAddress: n.walletAddress
1253
+ walletAddress: n.walletAddress,
1254
+ walletName: o
1253
1255
  };
1254
1256
  } catch (n) {
1255
1257
  throw d.error("[RNBridge] Handshake failed", n), new f(
@@ -1376,13 +1378,13 @@ function fr() {
1376
1378
  }
1377
1379
  return Pe.production;
1378
1380
  }
1379
- const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130, Et = 6, Gt = 18, qt = 3e4, Ts = 5 * 60 * 1e3, ks = 30 * 1e3, gt = 100, Rs = "crossx-sdk-js/2.2.0";
1381
+ const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130, Et = 6, Gt = 18, qt = 3e4, Ts = 5 * 60 * 1e3, ks = 30 * 1e3, gt = 100, Rs = "crossx-sdk-js/2.2.1";
1380
1382
  function gr(s) {
1381
1383
  let e = s.length;
1382
1384
  for (; e > 0 && s.charCodeAt(e - 1) === 48; ) e--;
1383
1385
  return s.slice(0, e);
1384
1386
  }
1385
- function Os(s, e = Et) {
1387
+ function Ns(s, e = Et) {
1386
1388
  if (!s || s === "0x0" || s === "0x") return "0";
1387
1389
  try {
1388
1390
  const r = BigInt(s);
@@ -1404,7 +1406,7 @@ function Ge(s, e, r, t = Et) {
1404
1406
  return;
1405
1407
  }
1406
1408
  }
1407
- function Ns(s) {
1409
+ function Cs(s) {
1408
1410
  const e = s.startsWith("0x") ? s.slice(2) : s;
1409
1411
  if (!/^[0-9a-fA-F]+$/.test(e))
1410
1412
  throw new f(
@@ -1417,7 +1419,7 @@ function Ns(s) {
1417
1419
  `서명 길이가 유효하지 않습니다: ${Wt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
1418
1420
  );
1419
1421
  }
1420
- function Cs(s) {
1422
+ function Os(s) {
1421
1423
  const e = s.startsWith("0x") ? s.slice(2) : s;
1422
1424
  if (!/^[0-9a-fA-F]+$/.test(e))
1423
1425
  throw new f(
@@ -1464,7 +1466,7 @@ function Ls(s) {
1464
1466
  const t = Number(r);
1465
1467
  return Number.isFinite(t) ? t : void 0;
1466
1468
  }
1467
- class Ce {
1469
+ class Oe {
1468
1470
  constructor(e) {
1469
1471
  this.deps = e, this.verifyPinMutex = null;
1470
1472
  }
@@ -1537,7 +1539,7 @@ class Ce {
1537
1539
  if (u.code === h.PIN_INVALID)
1538
1540
  return { ok: !1, error: u.message };
1539
1541
  if (u.code === h.PIN_LOCKED)
1540
- return Ce.buildPinLockedResult(u, a);
1542
+ return Oe.buildPinLockedResult(u, a);
1541
1543
  }
1542
1544
  throw u;
1543
1545
  }
@@ -1571,7 +1573,7 @@ class Ce {
1571
1573
  return await e();
1572
1574
  } catch (n) {
1573
1575
  if (n instanceof f) {
1574
- if (t = Ce.parsePinError(n, r), !t) throw n;
1576
+ if (t = Oe.parsePinError(n, r), !t) throw n;
1575
1577
  } else
1576
1578
  throw n;
1577
1579
  }
@@ -1585,7 +1587,7 @@ class Ce {
1585
1587
  try {
1586
1588
  return await e();
1587
1589
  } catch (n) {
1588
- if (n instanceof f && (t = Ce.parsePinError(n, r), t))
1590
+ if (n instanceof f && (t = Oe.parsePinError(n, r), t))
1589
1591
  continue;
1590
1592
  throw n;
1591
1593
  }
@@ -1610,7 +1612,7 @@ class Ce {
1610
1612
  return null;
1611
1613
  }
1612
1614
  static buildPinLockedResult(e, r) {
1613
- const t = Ce.parsePinError(e, r);
1615
+ const t = Oe.parsePinError(e, r);
1614
1616
  if (!t) return { ok: !1, error: e.message };
1615
1617
  const { errorMessage: n, ...i } = t;
1616
1618
  return { ok: !1, error: n, ...i };
@@ -1744,25 +1746,38 @@ class Ms {
1744
1746
  }
1745
1747
  return null;
1746
1748
  }
1747
- async loadWalletAfterAuth(e, r) {
1748
- const t = this.deps.getUserId();
1749
- if (!t) return;
1750
- const n = await this.fetchWalletStatus();
1751
- if (d.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", n), n !== "exists") return;
1752
- const i = await this.deps.walletProvider.getAddresses(t);
1753
- if (i.length > 0) {
1754
- const a = r ? i.find(
1755
- (u) => u.address.toLowerCase() === r.toLowerCase()
1756
- ) : void 0, c = e !== void 0 ? i.find((u) => u.index === e) : void 0, l = a ?? c ?? i[0];
1757
- d.log(
1749
+ async loadWalletAfterAuth(e, r, t) {
1750
+ const n = this.deps.getUserId();
1751
+ if (!n) return;
1752
+ const i = await this.fetchWalletStatus();
1753
+ if (d.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", i), i !== "exists") return;
1754
+ const o = await this.deps.walletProvider.getAddresses(n);
1755
+ if (o.length > 0) {
1756
+ let c, l = !1;
1757
+ if (r) {
1758
+ const p = o.find(
1759
+ (g) => g.address.toLowerCase() === r.toLowerCase()
1760
+ );
1761
+ p ? c = p : (c = { address: r, index: 0 }, l = !0);
1762
+ } else e !== void 0 ? c = o.find((p) => p.index === e) ?? o[0] : c = o[0];
1763
+ l ? d.log(
1764
+ "[CROSSx] preferredWalletAddress 가 서버 캐시에 없음 — raw address 채택:",
1765
+ c.address
1766
+ ) : d.log(
1758
1767
  "[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):",
1759
- l.address
1760
- ), this.deps.setActiveWallet(l.address, l.index);
1768
+ c.address
1769
+ );
1770
+ const u = !!r && !!t && c.address.toLowerCase() === r.toLowerCase();
1771
+ this.deps.setActiveWallet(
1772
+ c.address,
1773
+ c.index,
1774
+ u ? { walletName: t } : void 0
1775
+ );
1761
1776
  return;
1762
1777
  }
1763
1778
  d.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.deps.pinOrchestrator.ensureVerifiedPin();
1764
- const o = await this.deps.walletProvider.getAddress(t, 0);
1765
- d.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", o.address), this.deps.setActiveWallet(o.address, 0);
1779
+ const a = await this.deps.walletProvider.getAddress(n, 0);
1780
+ d.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", a.address), this.deps.setActiveWallet(a.address, 0);
1766
1781
  }
1767
1782
  }
1768
1783
  class Fs {
@@ -2307,7 +2322,7 @@ const Te = class Te extends ys {
2307
2322
  walletPreferenceKey: Te.WALLET_PREF_KEY,
2308
2323
  storage: this.storage,
2309
2324
  pinStore: this.pinStore
2310
- }), this.pinOrchestrator = new Ce({
2325
+ }), this.pinOrchestrator = new Oe({
2311
2326
  confirmation: this.confirmation,
2312
2327
  walletProvider: this.walletProvider,
2313
2328
  pinStore: this.pinStore,
@@ -2326,7 +2341,7 @@ const Te = class Te extends ys {
2326
2341
  walletProvider: this.walletProvider,
2327
2342
  pinOrchestrator: this.pinOrchestrator,
2328
2343
  getUserId: () => this.userId,
2329
- setActiveWallet: (x, w) => this.setActiveWallet(x, w)
2344
+ setActiveWallet: (x, w, S) => this.setActiveWallet(x, w, S)
2330
2345
  }), this.migrationOrchestrator = new Fs({
2331
2346
  confirmation: this.confirmation,
2332
2347
  walletProvider: this.walletProvider,
@@ -2432,7 +2447,7 @@ const Te = class Te extends ys {
2432
2447
  }
2433
2448
  async _doInitialize(e) {
2434
2449
  var r, t;
2435
- d.log("[CROSSx SDK] v2.2.0 초기화 중..."), this.confirmation.setMessages(xe(this._config.locale));
2450
+ d.log("[CROSSx SDK] v2.2.1 초기화 중..."), this.confirmation.setMessages(xe(this._config.locale));
2436
2451
  try {
2437
2452
  const n = fr();
2438
2453
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (r = this.crypto).setJWKSEndpoint) == null || t.call(r, `${n.authApiUrl}/.well-known/jwks.json`);
@@ -2440,17 +2455,28 @@ const Te = class Te extends ys {
2440
2455
  Te.WALLET_PREF_KEY
2441
2456
  ).catch(() => null) : null, o = (e == null ? void 0 : e.preferredWalletIndex) ?? (i == null ? void 0 : i.index);
2442
2457
  let a = (e == null ? void 0 : e.preferredWalletAddress) ?? (i == null ? void 0 : i.address), c = await this.tryRNBridgeBootstrap();
2443
- if (!(e != null && e.preferredWalletAddress) && this._rnBridgeWalletAddress && ((a == null ? void 0 : a.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && d.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), a = this._rnBridgeWalletAddress), c || (c = await this.signInUseCase.restoreSession()), c != null && c.success)
2444
- if (this.applyAuthResult(c), this.address && (!a || this.address.toLowerCase() === a.toLowerCase()))
2445
- this.address && this.setActiveWallet(this.address, o ?? this.activeWalletIndex);
2458
+ if (this._rnBridgeWalletAddress && ((a == null ? void 0 : a.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && d.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), a = this._rnBridgeWalletAddress), c || (c = await this.signInUseCase.restoreSession()), c != null && c.success) {
2459
+ this.applyAuthResult(c);
2460
+ const l = this.address && (!a || this.address.toLowerCase() === a.toLowerCase()), u = this._rnBridgeWalletName && a && this._rnBridgeWalletAddress && a.toLowerCase() === this._rnBridgeWalletAddress.toLowerCase() ? this._rnBridgeWalletName : void 0;
2461
+ if (l)
2462
+ this.address && this.setActiveWallet(
2463
+ this.address,
2464
+ o ?? this.activeWalletIndex,
2465
+ u ? { walletName: u } : void 0
2466
+ );
2446
2467
  else try {
2447
- await this.loadWalletAfterAuth(o, a);
2448
- } catch (u) {
2449
- if (!(u instanceof f && u.code === h.PIN_CANCELLED))
2450
- throw u;
2468
+ await this.loadWalletAfterAuth(
2469
+ o,
2470
+ a,
2471
+ u
2472
+ );
2473
+ } catch (p) {
2474
+ if (!(p instanceof f && p.code === h.PIN_CANCELLED))
2475
+ throw p;
2451
2476
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
2452
2477
  }
2453
- return this.initialized = !0, d.info("[CROSSx SDK] v2.2.0 초기화 완료"), this.emit("initialized", { restored: !!(c != null && c.success) }), c ?? null;
2478
+ }
2479
+ return this.initialized = !0, d.info("[CROSSx SDK] v2.2.1 초기화 완료"), this.emit("initialized", { restored: !!(c != null && c.success) }), c ?? null;
2454
2480
  } catch (n) {
2455
2481
  throw new f(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
2456
2482
  }
@@ -2471,13 +2497,14 @@ const Te = class Te extends ys {
2471
2497
  const e = new fe({
2472
2498
  appId: this._config.projectId,
2473
2499
  appVersion: "1.0.0",
2474
- sdkVersion: "2.2.0",
2500
+ sdkVersion: "2.2.1",
2475
2501
  keyId: "key-id-1",
2476
2502
  userIdHash: "user-hash-placeholder",
2477
2503
  projectId: this._config.projectId
2478
2504
  }), r = await e.initialize();
2479
- return this._rnBridgeService = e, this._rnBridgeWalletAddress = r.walletAddress, this.subscribeBridgeWalletChanged(), d.log("[CROSSx] RN Bridge Handshake 성공", {
2480
- walletAddress: r.walletAddress ?? "(없음)"
2505
+ return this._rnBridgeService = e, this._rnBridgeWalletAddress = r.walletAddress, this._rnBridgeWalletName = r.walletName, this.subscribeBridgeWalletChanged(), d.info("[CROSSx] RN Bridge Handshake 성공", {
2506
+ walletAddress: r.walletAddress ?? "(없음)",
2507
+ walletName: r.walletName ?? "(없음)"
2481
2508
  }), await this.signInUseCase.hasValidStoredAccessToken() ? (await this.signInUseCase.hasStoredRNBridgeSession() && (this._isAuthenticatedViaRNBridge = !0, d.log("[CROSSx] 저장된 RN Bridge 세션 — native sign delegation 활성")), null) : (d.log("[CROSSx] RN Bridge 준비 완료 — 사용자 로그인 대기"), null);
2482
2509
  } catch (e) {
2483
2510
  return d.warn("[CROSSx] RN Bridge handshake 실패", e), null;
@@ -2500,7 +2527,11 @@ const Te = class Te extends ys {
2500
2527
  const r = await this._rnBridgeService.requestFirebaseIdToken();
2501
2528
  d.log("[CROSSx] Bridge 로그인 — Firebase token 수신");
2502
2529
  const t = await this.signInUseCase.executeWithNativeFirebaseIdToken(r);
2503
- return t.success ? (this._isAuthenticatedViaRNBridge = !0, this.applyAuthResult(t), await this.loadWalletAfterAuth(void 0, this._rnBridgeWalletAddress), d.log("[CROSSx] Bridge 로그인 성공", { userId: (e = t.user) == null ? void 0 : e.id }), t) : null;
2530
+ return t.success ? (this._isAuthenticatedViaRNBridge = !0, this.applyAuthResult(t), await this.loadWalletAfterAuth(
2531
+ void 0,
2532
+ this._rnBridgeWalletAddress,
2533
+ this._rnBridgeWalletName
2534
+ ), d.log("[CROSSx] Bridge 로그인 성공", { userId: (e = t.user) == null ? void 0 : e.id }), t) : null;
2504
2535
  } catch (r) {
2505
2536
  return r instanceof f && r.code === h.USER_REJECTED ? (d.log("[CROSSx] Bridge 로그인 거부 — bridge 비활성화, OAuth fallback"), this._rnBridgeService = null, null) : (d.warn("[CROSSx] Bridge 로그인 타임아웃/실패 — OAuth fallback 차단", r), !1);
2506
2537
  }
@@ -2703,6 +2734,20 @@ const Te = class Te extends ys {
2703
2734
  get currentUserId() {
2704
2735
  return this.userId;
2705
2736
  }
2737
+ /**
2738
+ * RN Native Bridge 가 handshake 또는 walletChanged push 로 알린 현재 active wallet
2739
+ * 정보(주소 + 사용자 라벨)를 동기적으로 반환한다.
2740
+ *
2741
+ * - dapp 측 hook 이 `addressChanged` 이벤트 구독 전에 SDK 가 이미 emit 을 끝낸
2742
+ * 경우에도 walletName 을 놓치지 않도록 polling/seed 용으로 노출한다.
2743
+ * - bridge 미사용 또는 미수신 시 `null`.
2744
+ */
2745
+ getRNBridgeActiveWallet() {
2746
+ return this._rnBridgeWalletAddress ? {
2747
+ address: this._rnBridgeWalletAddress,
2748
+ walletName: this._rnBridgeWalletName
2749
+ } : null;
2750
+ }
2706
2751
  /**
2707
2752
  * 현재 로그인 상태 확인 (isAuthenticated() 별칭)
2708
2753
  * Android SDK의 isLoggedIn()과 동일합니다.
@@ -3093,7 +3138,7 @@ const Te = class Te extends ys {
3093
3138
  n.address
3094
3139
  )
3095
3140
  });
3096
- return Ns(i.signature), {
3141
+ return Cs(i.signature), {
3097
3142
  chainId: e,
3098
3143
  signature: i.signature,
3099
3144
  address: n.address
@@ -3171,7 +3216,7 @@ const Te = class Te extends ys {
3171
3216
  a
3172
3217
  )
3173
3218
  });
3174
- return Cs(o.signature), {
3219
+ return Os(o.signature), {
3175
3220
  chainId: e,
3176
3221
  signedTx: o.signature,
3177
3222
  txHash: o.txHash ?? ""
@@ -3310,7 +3355,7 @@ const Te = class Te extends ys {
3310
3355
  let g, _;
3311
3356
  const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
3312
3357
  g = I;
3313
- const N = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), R = r.value ? BigInt(r.value) : 0n, L = Ge(r.value, u.symbol, u.decimals, this._config.displayDecimals), M = Ge("0x" + N.toString(16), u.symbol, u.decimals, this._config.displayDecimals), q = Ge("0x" + (R + N).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
3358
+ const C = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), R = r.value ? BigInt(r.value) : 0n, L = Ge(r.value, u.symbol, u.decimals, this._config.displayDecimals), M = Ge("0x" + C.toString(16), u.symbol, u.decimals, this._config.displayDecimals), q = Ge("0x" + (R + C).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
3314
3359
  return {
3315
3360
  chainId: e,
3316
3361
  txHash: a,
@@ -3547,7 +3592,7 @@ const Te = class Te extends ys {
3547
3592
  return { wei: "0x0", formatted: "0", chainId: e };
3548
3593
  try {
3549
3594
  const n = await this.jsonRpc.call("eth_getBalance", [r, "latest"], e) ?? "0x0";
3550
- return { wei: n, formatted: Os(n, this._config.displayDecimals), chainId: e };
3595
+ return { wei: n, formatted: Ns(n, this._config.displayDecimals), chainId: e };
3551
3596
  } catch (t) {
3552
3597
  if (t instanceof f) throw t;
3553
3598
  const n = t instanceof Error ? t.message : String(t);
@@ -3710,10 +3755,11 @@ const Te = class Te extends ys {
3710
3755
  * 2. GET /mnemonic/addresses (비밀번호 불필요) → 캐시된 주소가 있으면 바로 사용
3711
3756
  * 3. 빈 배열인 경우 → 비밀번호 확인(메모리 없으면 모달) → POST /mnemonic/address(0)
3712
3757
  */
3713
- async loadWalletAfterAuth(e, r) {
3758
+ async loadWalletAfterAuth(e, r, t) {
3714
3759
  return this.walletLifecycleService.loadWalletAfterAuth(
3715
3760
  e,
3716
- r
3761
+ r,
3762
+ t
3717
3763
  );
3718
3764
  }
3719
3765
  /**
@@ -4394,17 +4440,17 @@ function bn(s, e, r) {
4394
4440
  const I = [];
4395
4441
  for (; S < e; ) {
4396
4442
  c = g();
4397
- const N = c.slice();
4398
- I.push(N), S += c.length;
4443
+ const C = c.slice();
4444
+ I.push(C), S += c.length;
4399
4445
  }
4400
4446
  return Se(...I);
4401
4447
  };
4402
4448
  return (S, I) => {
4403
4449
  p(), _(S);
4404
- let N;
4405
- for (; !(N = I(x())); )
4450
+ let C;
4451
+ for (; !(C = I(x())); )
4406
4452
  _();
4407
- return p(), N;
4453
+ return p(), C;
4408
4454
  };
4409
4455
  }
4410
4456
  function Rt(s, e = {}, r = {}) {
@@ -4432,7 +4478,7 @@ function Xt(s) {
4432
4478
  };
4433
4479
  }
4434
4480
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4435
- const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2), Ir = /* @__PURE__ */ BigInt(3), Tr = /* @__PURE__ */ BigInt(4), kr = /* @__PURE__ */ BigInt(5), vn = /* @__PURE__ */ BigInt(7), Rr = /* @__PURE__ */ BigInt(8), Sn = /* @__PURE__ */ BigInt(9), Or = /* @__PURE__ */ BigInt(16);
4481
+ const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2), Ir = /* @__PURE__ */ BigInt(3), Tr = /* @__PURE__ */ BigInt(4), kr = /* @__PURE__ */ BigInt(5), vn = /* @__PURE__ */ BigInt(7), Rr = /* @__PURE__ */ BigInt(8), Sn = /* @__PURE__ */ BigInt(9), Nr = /* @__PURE__ */ BigInt(16);
4436
4482
  function le(s, e) {
4437
4483
  const r = s % e;
4438
4484
  return r >= re ? r : e + r;
@@ -4457,29 +4503,29 @@ function Jt(s, e) {
4457
4503
  throw new Error("invert: does not exist");
4458
4504
  return le(n, e);
4459
4505
  }
4460
- function Ot(s, e, r) {
4506
+ function Nt(s, e, r) {
4461
4507
  if (!s.eql(s.sqr(e), r))
4462
4508
  throw new Error("Cannot find square root");
4463
4509
  }
4464
- function Nr(s, e) {
4510
+ function Cr(s, e) {
4465
4511
  const r = (s.ORDER + te) / Tr, t = s.pow(e, r);
4466
- return Ot(s, t, e), t;
4512
+ return Nt(s, t, e), t;
4467
4513
  }
4468
4514
  function En(s, e) {
4469
4515
  const r = (s.ORDER - kr) / Rr, t = s.mul(e, ke), n = s.pow(t, r), i = s.mul(e, n), o = s.mul(s.mul(i, ke), n), a = s.mul(i, s.sub(o, s.ONE));
4470
- return Ot(s, a, e), a;
4516
+ return Nt(s, a, e), a;
4471
4517
  }
4472
4518
  function An(s) {
4473
- const e = rt(s), r = Cr(s), t = r(e, e.neg(e.ONE)), n = r(e, t), i = r(e, e.neg(t)), o = (s + vn) / Or;
4519
+ const e = rt(s), r = Or(s), t = r(e, e.neg(e.ONE)), n = r(e, t), i = r(e, e.neg(t)), o = (s + vn) / Nr;
4474
4520
  return (a, c) => {
4475
4521
  let l = a.pow(c, o), u = a.mul(l, t);
4476
4522
  const p = a.mul(l, n), g = a.mul(l, i), _ = a.eql(a.sqr(u), c), x = a.eql(a.sqr(p), c);
4477
4523
  l = a.cmov(l, u, _), u = a.cmov(g, p, x);
4478
4524
  const w = a.eql(a.sqr(u), c), S = a.cmov(l, u, w);
4479
- return Ot(a, S, c), S;
4525
+ return Nt(a, S, c), S;
4480
4526
  };
4481
4527
  }
4482
- function Cr(s) {
4528
+ function Or(s) {
4483
4529
  if (s < Ir)
4484
4530
  throw new Error("sqrt is not defined for small field");
4485
4531
  let e = s - te, r = 0;
@@ -4491,7 +4537,7 @@ function Cr(s) {
4491
4537
  if (t++ > 1e3)
4492
4538
  throw new Error("Cannot find square root: probably non-prime P");
4493
4539
  if (r === 1)
4494
- return Nr;
4540
+ return Cr;
4495
4541
  let i = n.pow(t, e);
4496
4542
  const o = (e + te) / ke;
4497
4543
  return function(c, l) {
@@ -4514,7 +4560,7 @@ function Cr(s) {
4514
4560
  };
4515
4561
  }
4516
4562
  function In(s) {
4517
- return s % Tr === Ir ? Nr : s % Rr === kr ? En : s % Or === Sn ? An(s) : Cr(s);
4563
+ return s % Tr === Ir ? Cr : s % Rr === kr ? En : s % Nr === Sn ? An(s) : Or(s);
4518
4564
  }
4519
4565
  const Tn = [
4520
4566
  "create",
@@ -4565,12 +4611,12 @@ function Zt(s, e) {
4565
4611
  throw new Error("invalid Legendre symbol result");
4566
4612
  return n ? 1 : i ? 0 : -1;
4567
4613
  }
4568
- function On(s, e) {
4614
+ function Nn(s, e) {
4569
4615
  e !== void 0 && me(e);
4570
4616
  const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
4571
4617
  return { nBitLength: r, nByteLength: t };
4572
4618
  }
4573
- class Nn {
4619
+ class Cn {
4574
4620
  constructor(e, r = {}) {
4575
4621
  P(this, "ORDER");
4576
4622
  P(this, "BITS");
@@ -4587,7 +4633,7 @@ class Nn {
4587
4633
  throw new Error("invalid field: expected ORDER > 0, got " + e);
4588
4634
  let t;
4589
4635
  this.isLE = !1, r != null && typeof r == "object" && (typeof r.BITS == "number" && (t = r.BITS), typeof r.sqrt == "function" && (this.sqrt = r.sqrt), typeof r.isLE == "boolean" && (this.isLE = r.isLE), r.allowedLengths && (this._lengths = (o = r.allowedLengths) == null ? void 0 : o.slice()), typeof r.modFromBytes == "boolean" && (this._mod = r.modFromBytes));
4590
- const { nBitLength: n, nByteLength: i } = On(e, t);
4636
+ const { nBitLength: n, nByteLength: i } = Nn(e, t);
4591
4637
  if (i > 2048)
4592
4638
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
4593
4639
  this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
@@ -4683,7 +4729,7 @@ class Nn {
4683
4729
  }
4684
4730
  }
4685
4731
  function rt(s, e = {}) {
4686
- return new Nn(s, e);
4732
+ return new Cn(s, e);
4687
4733
  }
4688
4734
  function Lr(s) {
4689
4735
  if (typeof s != "bigint")
@@ -4695,7 +4741,7 @@ function Dr(s) {
4695
4741
  const e = Lr(s);
4696
4742
  return e + Math.ceil(e / 2);
4697
4743
  }
4698
- function Cn(s, e, r = !1) {
4744
+ function On(s, e, r = !1) {
4699
4745
  V(s);
4700
4746
  const t = s.length, n = Lr(e), i = Dr(e);
4701
4747
  if (t < 16 || t < i || t > 1024)
@@ -5046,18 +5092,18 @@ function Un(s, e = {}) {
5046
5092
  throw new Error("compression is not supported: Field does not have .isOdd()");
5047
5093
  }
5048
5094
  function p(F, m, y) {
5049
- const { x: k, y: C } = m.toAffine(), B = t.toBytes(k);
5095
+ const { x: k, y: O } = m.toAffine(), B = t.toBytes(k);
5050
5096
  if (Xe(y, "isCompressed"), y) {
5051
5097
  u();
5052
- const b = !t.isOdd(C);
5098
+ const b = !t.isOdd(O);
5053
5099
  return Se(Hr(b), B);
5054
5100
  } else
5055
- return Se(Uint8Array.of(4), B, t.toBytes(C));
5101
+ return Se(Uint8Array.of(4), B, t.toBytes(O));
5056
5102
  }
5057
5103
  function g(F) {
5058
5104
  V(F, void 0, "Point");
5059
- const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length, C = F[0], B = F.subarray(1);
5060
- if (k === m && (C === 2 || C === 3)) {
5105
+ const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length, O = F[0], B = F.subarray(1);
5106
+ if (k === m && (O === 2 || O === 3)) {
5061
5107
  const b = t.fromBytes(B);
5062
5108
  if (!t.isValid(b))
5063
5109
  throw new Error("bad point: is not on curve, wrong x");
@@ -5071,8 +5117,8 @@ function Un(s, e = {}) {
5071
5117
  }
5072
5118
  u();
5073
5119
  const T = t.isOdd(E);
5074
- return (C & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
5075
- } else if (k === y && C === 4) {
5120
+ return (O & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
5121
+ } else if (k === y && O === 4) {
5076
5122
  const b = t.BYTES, v = t.fromBytes(B.subarray(0, b)), E = t.fromBytes(B.subarray(b, b * 2));
5077
5123
  if (!S(v, E))
5078
5124
  throw new Error("bad point: is not on curve");
@@ -5091,8 +5137,8 @@ function Un(s, e = {}) {
5091
5137
  }
5092
5138
  if (!S(i.Gx, i.Gy))
5093
5139
  throw new Error("bad curve params: generator point");
5094
- const I = t.mul(t.pow(i.a, ze), Fn), N = t.mul(t.sqr(i.b), BigInt(27));
5095
- if (t.is0(t.add(I, N)))
5140
+ const I = t.mul(t.pow(i.a, ze), Fn), C = t.mul(t.sqr(i.b), BigInt(27));
5141
+ if (t.is0(t.add(I, C)))
5096
5142
  throw new Error("bad curve params: a or b");
5097
5143
  function R(F, m, y = !1) {
5098
5144
  if (!t.isValid(m) || y && t.is0(m))
@@ -5109,12 +5155,12 @@ function Un(s, e = {}) {
5109
5155
  return Bn(F, c.basises, n.ORDER);
5110
5156
  }
5111
5157
  const q = Xt((F, m) => {
5112
- const { X: y, Y: k, Z: C } = F;
5113
- if (t.eql(C, t.ONE))
5158
+ const { X: y, Y: k, Z: O } = F;
5159
+ if (t.eql(O, t.ONE))
5114
5160
  return { x: y, y: k };
5115
5161
  const B = F.is0();
5116
- m == null && (m = B ? t.ONE : t.inv(C));
5117
- const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(C, m);
5162
+ m == null && (m = B ? t.ONE : t.inv(O));
5163
+ const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(O, m);
5118
5164
  if (B)
5119
5165
  return { x: t.ZERO, y: t.ZERO };
5120
5166
  if (!t.eql(E, t.ONE))
@@ -5135,8 +5181,8 @@ function Un(s, e = {}) {
5135
5181
  throw new Error("bad point: not in prime-order subgroup");
5136
5182
  return !0;
5137
5183
  });
5138
- function G(F, m, y, k, C) {
5139
- return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(C, y), m.add(y);
5184
+ function G(F, m, y, k, O) {
5185
+ return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(O, y), m.add(y);
5140
5186
  }
5141
5187
  const D = class D {
5142
5188
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
@@ -5194,7 +5240,7 @@ function Un(s, e = {}) {
5194
5240
  /** Compare one point to another. */
5195
5241
  equals(m) {
5196
5242
  L(m);
5197
- const { X: y, Y: k, Z: C } = this, { X: B, Y: b, Z: v } = m, E = t.eql(t.mul(y, v), t.mul(B, C)), T = t.eql(t.mul(k, v), t.mul(b, C));
5243
+ const { X: y, Y: k, Z: O } = this, { X: B, Y: b, Z: v } = m, E = t.eql(t.mul(y, v), t.mul(B, O)), T = t.eql(t.mul(k, v), t.mul(b, O));
5198
5244
  return E && T;
5199
5245
  }
5200
5246
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -5206,9 +5252,9 @@ function Un(s, e = {}) {
5206
5252
  // https://eprint.iacr.org/2015/1060, algorithm 3
5207
5253
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
5208
5254
  double() {
5209
- const { a: m, b: y } = i, k = t.mul(y, ze), { X: C, Y: B, Z: b } = this;
5210
- let v = t.ZERO, E = t.ZERO, T = t.ZERO, O = t.mul(C, C), W = t.mul(B, B), U = t.mul(b, b), $ = t.mul(C, B);
5211
- return $ = t.add($, $), T = t.mul(C, b), T = t.add(T, T), v = t.mul(m, T), E = t.mul(k, U), E = t.add(v, E), v = t.sub(W, E), E = t.add(W, E), E = t.mul(v, E), v = t.mul($, v), T = t.mul(k, T), U = t.mul(m, U), $ = t.sub(O, U), $ = t.mul(m, $), $ = t.add($, T), T = t.add(O, O), O = t.add(T, O), O = t.add(O, U), O = t.mul(O, $), E = t.add(E, O), U = t.mul(B, b), U = t.add(U, U), O = t.mul(U, $), v = t.sub(v, O), T = t.mul(U, W), T = t.add(T, T), T = t.add(T, T), new D(v, E, T);
5255
+ const { a: m, b: y } = i, k = t.mul(y, ze), { X: O, Y: B, Z: b } = this;
5256
+ let v = t.ZERO, E = t.ZERO, T = t.ZERO, N = t.mul(O, O), W = t.mul(B, B), U = t.mul(b, b), $ = t.mul(O, B);
5257
+ return $ = t.add($, $), T = t.mul(O, b), T = t.add(T, T), v = t.mul(m, T), E = t.mul(k, U), E = t.add(v, E), v = t.sub(W, E), E = t.add(W, E), E = t.mul(v, E), v = t.mul($, v), T = t.mul(k, T), U = t.mul(m, U), $ = t.sub(N, U), $ = t.mul(m, $), $ = t.add($, T), T = t.add(N, N), N = t.add(T, N), N = t.add(N, U), N = t.mul(N, $), E = t.add(E, N), U = t.mul(B, b), U = t.add(U, U), N = t.mul(U, $), v = t.sub(v, N), T = t.mul(U, W), T = t.add(T, T), T = t.add(T, T), new D(v, E, T);
5212
5258
  }
5213
5259
  // Renes-Costello-Batina exception-free addition formula.
5214
5260
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -5216,13 +5262,13 @@ function Un(s, e = {}) {
5216
5262
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
5217
5263
  add(m) {
5218
5264
  L(m);
5219
- const { X: y, Y: k, Z: C } = this, { X: B, Y: b, Z: v } = m;
5220
- let E = t.ZERO, T = t.ZERO, O = t.ZERO;
5265
+ const { X: y, Y: k, Z: O } = this, { X: B, Y: b, Z: v } = m;
5266
+ let E = t.ZERO, T = t.ZERO, N = t.ZERO;
5221
5267
  const W = i.a, U = t.mul(i.b, ze);
5222
- let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(C, v), ne = t.add(y, k), z = t.add(B, b);
5223
- ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y, C);
5268
+ let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(O, v), ne = t.add(y, k), z = t.add(B, b);
5269
+ ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y, O);
5224
5270
  let ee = t.add(B, v);
5225
- return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k, C), E = t.add(b, v), ee = t.mul(ee, E), E = t.add(K, Y), ee = t.sub(ee, E), O = t.mul(W, z), E = t.mul(U, Y), O = t.add(E, O), E = t.sub(K, O), O = t.add(K, O), T = t.mul(E, O), K = t.add($, $), K = t.add(K, $), Y = t.mul(W, Y), z = t.mul(U, z), K = t.add(K, Y), Y = t.sub($, Y), Y = t.mul(W, Y), z = t.add(z, Y), $ = t.mul(K, z), T = t.add(T, $), $ = t.mul(ee, z), E = t.mul(ne, E), E = t.sub(E, $), $ = t.mul(ne, K), O = t.mul(ee, O), O = t.add(O, $), new D(E, T, O);
5271
+ return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k, O), E = t.add(b, v), ee = t.mul(ee, E), E = t.add(K, Y), ee = t.sub(ee, E), N = t.mul(W, z), E = t.mul(U, Y), N = t.add(E, N), E = t.sub(K, N), N = t.add(K, N), T = t.mul(E, N), K = t.add($, $), K = t.add(K, $), Y = t.mul(W, Y), z = t.mul(U, z), K = t.add(K, Y), Y = t.sub($, Y), Y = t.mul(W, Y), z = t.add(z, Y), $ = t.mul(K, z), T = t.add(T, $), $ = t.mul(ee, z), E = t.mul(ne, E), E = t.sub(E, $), $ = t.mul(ne, K), N = t.mul(ee, N), N = t.add(N, $), new D(E, T, N);
5226
5272
  }
5227
5273
  subtract(m) {
5228
5274
  return this.add(m.negate());
@@ -5243,16 +5289,16 @@ function Un(s, e = {}) {
5243
5289
  const { endo: y } = e;
5244
5290
  if (!n.isValidNot0(m))
5245
5291
  throw new Error("invalid scalar: out of range");
5246
- let k, C;
5292
+ let k, O;
5247
5293
  const B = (b) => H.cached(this, b, (v) => Qt(D, v));
5248
5294
  if (y) {
5249
- const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: O, f: W } = B(v), { p: U, f: $ } = B(T);
5250
- C = W.add($), k = G(y.beta, O, U, b, E);
5295
+ const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: N, f: W } = B(v), { p: U, f: $ } = B(T);
5296
+ O = W.add($), k = G(y.beta, N, U, b, E);
5251
5297
  } else {
5252
5298
  const { p: b, f: v } = B(m);
5253
- k = b, C = v;
5299
+ k = b, O = v;
5254
5300
  }
5255
- return Qt(D, [k, C])[0];
5301
+ return Qt(D, [k, O])[0];
5256
5302
  }
5257
5303
  /**
5258
5304
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -5270,8 +5316,8 @@ function Un(s, e = {}) {
5270
5316
  if (H.hasCache(this))
5271
5317
  return this.multiply(m);
5272
5318
  if (y) {
5273
- const { k1neg: C, k1: B, k2neg: b, k2: v } = M(m), { p1: E, p2: T } = Ln(D, k, B, v);
5274
- return G(y.beta, E, T, C, b);
5319
+ const { k1neg: O, k1: B, k2neg: b, k2: v } = M(m), { p1: E, p2: T } = Ln(D, k, B, v);
5320
+ return G(y.beta, E, T, O, b);
5275
5321
  } else
5276
5322
  return H.unsafe(k, m);
5277
5323
  }
@@ -5349,7 +5395,7 @@ function Hn(s, e = {}) {
5349
5395
  }
5350
5396
  }
5351
5397
  function a(_ = t(n.seed)) {
5352
- return Cn(V(_, n.seed, "seed"), r.ORDER);
5398
+ return On(V(_, n.seed, "seed"), r.ORDER);
5353
5399
  }
5354
5400
  function c(_, x = !0) {
5355
5401
  return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
@@ -5399,37 +5445,37 @@ function Wn(s, e, r = {}) {
5399
5445
  throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);
5400
5446
  return y;
5401
5447
  }
5402
- function N() {
5448
+ function C() {
5403
5449
  if (w)
5404
5450
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
5405
5451
  }
5406
5452
  function R(m, y) {
5407
5453
  mt(y);
5408
- const k = _.signature, C = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
5409
- return V(m, C);
5454
+ const k = _.signature, O = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
5455
+ return V(m, O);
5410
5456
  }
5411
5457
  class L {
5412
- constructor(y, k, C) {
5458
+ constructor(y, k, O) {
5413
5459
  P(this, "r");
5414
5460
  P(this, "s");
5415
5461
  P(this, "recovery");
5416
- if (this.r = I("r", y), this.s = I("s", k), C != null) {
5417
- if (N(), ![0, 1, 2, 3].includes(C))
5462
+ if (this.r = I("r", y), this.s = I("s", k), O != null) {
5463
+ if (C(), ![0, 1, 2, 3].includes(O))
5418
5464
  throw new Error("invalid recovery id");
5419
- this.recovery = C;
5465
+ this.recovery = O;
5420
5466
  }
5421
5467
  Object.freeze(this);
5422
5468
  }
5423
5469
  static fromBytes(y, k = x.format) {
5424
5470
  R(y, k);
5425
- let C;
5471
+ let O;
5426
5472
  if (k === "der") {
5427
5473
  const { r: E, s: T } = ve.toSig(V(y));
5428
5474
  return new L(E, T);
5429
5475
  }
5430
- k === "recovered" && (C = y[0], k = "compact", y = y.subarray(1));
5476
+ k === "recovered" && (O = y[0], k = "compact", y = y.subarray(1));
5431
5477
  const B = _.signature / 2, b = y.subarray(0, B), v = y.subarray(B, B * 2);
5432
- return new L(o.fromBytes(b), o.fromBytes(v), C);
5478
+ return new L(o.fromBytes(b), o.fromBytes(v), O);
5433
5479
  }
5434
5480
  static fromHex(y, k) {
5435
5481
  return this.fromBytes(Ye(y), k);
@@ -5444,10 +5490,10 @@ function Wn(s, e, r = {}) {
5444
5490
  return new L(this.r, this.s, y);
5445
5491
  }
5446
5492
  recoverPublicKey(y) {
5447
- const { r: k, s: C } = this, B = this.assertRecovery(), b = B === 2 || B === 3 ? k + a : k;
5493
+ const { r: k, s: O } = this, B = this.assertRecovery(), b = B === 2 || B === 3 ? k + a : k;
5448
5494
  if (!i.isValid(b))
5449
5495
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
5450
- const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), O = q(V(y, void 0, "msgHash")), W = o.create(-O * T), U = o.create(C * T), $ = s.BASE.multiplyUnsafe(W).add(E.multiplyUnsafe(U));
5496
+ const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), N = q(V(y, void 0, "msgHash")), W = o.create(-N * T), U = o.create(O * T), $ = s.BASE.multiplyUnsafe(W).add(E.multiplyUnsafe(U));
5451
5497
  if ($.is0())
5452
5498
  throw new Error("invalid recovery: point at infinify");
5453
5499
  return $.assertValidity(), $;
@@ -5459,8 +5505,8 @@ function Wn(s, e, r = {}) {
5459
5505
  toBytes(y = x.format) {
5460
5506
  if (mt(y), y === "der")
5461
5507
  return Ye(ve.hexFromSig(this));
5462
- const { r: k, s: C } = this, B = o.toBytes(k), b = o.toBytes(C);
5463
- return y === "recovered" ? (N(), Se(Uint8Array.of(this.assertRecovery()), B, b)) : Se(B, b);
5508
+ const { r: k, s: O } = this, B = o.toBytes(k), b = o.toBytes(O);
5509
+ return y === "recovered" ? (C(), Se(Uint8Array.of(this.assertRecovery()), B, b)) : Se(B, b);
5464
5510
  }
5465
5511
  toHex(y) {
5466
5512
  return We(this.toBytes(y));
@@ -5469,8 +5515,8 @@ function Wn(s, e, r = {}) {
5469
5515
  const M = r.bits2int || function(y) {
5470
5516
  if (y.length > 8192)
5471
5517
  throw new Error("input is too large");
5472
- const k = tt(y), C = y.length * 8 - c;
5473
- return C > 0 ? k >> BigInt(C) : k;
5518
+ const k = tt(y), O = y.length * 8 - c;
5519
+ return O > 0 ? k >> BigInt(O) : k;
5474
5520
  }, q = r.bits2int_modN || function(y) {
5475
5521
  return o.create(M(y));
5476
5522
  }, J = kt(c);
@@ -5481,7 +5527,7 @@ function Wn(s, e, r = {}) {
5481
5527
  return V(m, void 0, "message"), y ? V(e(m), void 0, "prehashed message") : m;
5482
5528
  }
5483
5529
  function Q(m, y, k) {
5484
- const { lowS: C, prehash: B, extraEntropy: b } = ut(k, x);
5530
+ const { lowS: O, prehash: B, extraEntropy: b } = ut(k, x);
5485
5531
  m = X(m, B);
5486
5532
  const v = q(m), E = o.fromBytes(y);
5487
5533
  if (!o.isValidNot0(E))
@@ -5491,7 +5537,7 @@ function Wn(s, e, r = {}) {
5491
5537
  const $ = b === !0 ? t(_.secretKey) : b;
5492
5538
  T.push(V($, void 0, "extraEntropy"));
5493
5539
  }
5494
- const O = Se(...T), W = v;
5540
+ const N = Se(...T), W = v;
5495
5541
  function U($) {
5496
5542
  const K = M($);
5497
5543
  if (!o.isValidNot0(K))
@@ -5503,16 +5549,16 @@ function Wn(s, e, r = {}) {
5503
5549
  if (ee === ge)
5504
5550
  return;
5505
5551
  let Lt = (ne.x === z ? 0 : 2) | Number(ne.y & Le), Dt = ee;
5506
- return C && S(ee) && (Dt = o.neg(ee), Lt ^= 1), new L(z, Dt, w ? void 0 : Lt);
5552
+ return O && S(ee) && (Dt = o.neg(ee), Lt ^= 1), new L(z, Dt, w ? void 0 : Lt);
5507
5553
  }
5508
- return { seed: O, k2sig: U };
5554
+ return { seed: N, k2sig: U };
5509
5555
  }
5510
5556
  function H(m, y, k = {}) {
5511
- const { seed: C, k2sig: B } = Q(m, y, k);
5512
- return bn(e.outputLen, o.BYTES, n)(C, B).toBytes(k.format);
5557
+ const { seed: O, k2sig: B } = Q(m, y, k);
5558
+ return bn(e.outputLen, o.BYTES, n)(O, B).toBytes(k.format);
5513
5559
  }
5514
- function D(m, y, k, C = {}) {
5515
- const { lowS: B, prehash: b, format: v } = ut(C, x);
5560
+ function D(m, y, k, O = {}) {
5561
+ const { lowS: B, prehash: b, format: v } = ut(O, x);
5516
5562
  if (k = V(k, void 0, "publicKey"), y = X(y, b), !At(m)) {
5517
5563
  const E = m instanceof L ? ", use sig.toBytes()" : "";
5518
5564
  throw new Error("verify expects Uint8Array signature" + E);
@@ -5522,15 +5568,15 @@ function Wn(s, e, r = {}) {
5522
5568
  const E = L.fromBytes(m, v), T = s.fromBytes(k);
5523
5569
  if (B && E.hasHighS())
5524
5570
  return !1;
5525
- const { r: O, s: W } = E, U = q(y), $ = o.inv(W), K = o.create(U * $), Y = o.create(O * $), ne = s.BASE.multiplyUnsafe(K).add(T.multiplyUnsafe(Y));
5526
- return ne.is0() ? !1 : o.create(ne.x) === O;
5571
+ const { r: N, s: W } = E, U = q(y), $ = o.inv(W), K = o.create(U * $), Y = o.create(N * $), ne = s.BASE.multiplyUnsafe(K).add(T.multiplyUnsafe(Y));
5572
+ return ne.is0() ? !1 : o.create(ne.x) === N;
5527
5573
  } catch {
5528
5574
  return !1;
5529
5575
  }
5530
5576
  }
5531
5577
  function F(m, y, k = {}) {
5532
- const { prehash: C } = ut(k, x);
5533
- return y = X(y, C), L.fromBytes(m, "recovered").recoverPublicKey(y).toBytes();
5578
+ const { prehash: O } = ut(k, x);
5579
+ return y = X(y, O), L.fromBytes(m, "recovered").recoverPublicKey(y).toBytes();
5534
5580
  }
5535
5581
  return Object.freeze({
5536
5582
  keygen: l,
@@ -5547,7 +5593,7 @@ function Wn(s, e, r = {}) {
5547
5593
  });
5548
5594
  }
5549
5595
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5550
- const Nt = {
5596
+ const Ct = {
5551
5597
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
5552
5598
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
5553
5599
  h: BigInt(1),
@@ -5563,12 +5609,12 @@ const Nt = {
5563
5609
  ]
5564
5610
  }, nr = /* @__PURE__ */ BigInt(2);
5565
5611
  function qn(s) {
5566
- const e = Nt.p, r = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = s * s * s % e, u = l * l * s % e, p = oe(u, r, e) * u % e, g = oe(p, r, e) * u % e, _ = oe(g, nr, e) * l % e, x = oe(_, n, e) * _ % e, w = oe(x, i, e) * x % e, S = oe(w, a, e) * w % e, I = oe(S, c, e) * S % e, N = oe(I, a, e) * w % e, R = oe(N, r, e) * u % e, L = oe(R, o, e) * x % e, M = oe(L, t, e) * l % e, q = oe(M, nr, e);
5612
+ const e = Ct.p, r = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = s * s * s % e, u = l * l * s % e, p = oe(u, r, e) * u % e, g = oe(p, r, e) * u % e, _ = oe(g, nr, e) * l % e, x = oe(_, n, e) * _ % e, w = oe(x, i, e) * x % e, S = oe(w, a, e) * w % e, I = oe(S, c, e) * S % e, C = oe(I, a, e) * w % e, R = oe(C, r, e) * u % e, L = oe(R, o, e) * x % e, M = oe(L, t, e) * l % e, q = oe(M, nr, e);
5567
5613
  if (!yt.eql(yt.sqr(q), s))
5568
5614
  throw new Error("Cannot find square root");
5569
5615
  return q;
5570
5616
  }
5571
- const yt = rt(Nt.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Nt, {
5617
+ const yt = rt(Ct.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ct, {
5572
5618
  Fp: yt,
5573
5619
  endo: Gn
5574
5620
  }), Vn = /* @__PURE__ */ Wn(Kn, gn), zn = BigInt(0), Me = BigInt(1), jn = BigInt(2), Yn = BigInt(7), Xn = BigInt(256), Jn = BigInt(113), Gr = [], qr = [], Kr = [];
@@ -5605,7 +5651,7 @@ function ei(s, e = 24) {
5605
5651
  }
5606
5652
  $e(r);
5607
5653
  }
5608
- class Ct {
5654
+ class Ot {
5609
5655
  // NOTE: we accept arguments in bytes instead of bits here.
5610
5656
  constructor(e, r, t, n = !1, i = 24) {
5611
5657
  P(this, "state");
@@ -5678,10 +5724,10 @@ class Ct {
5678
5724
  }
5679
5725
  _cloneInto(e) {
5680
5726
  const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
5681
- return e || (e = new Ct(r, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
5727
+ return e || (e = new Ot(r, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
5682
5728
  }
5683
5729
  }
5684
- const ti = (s, e, r, t = {}) => yr(() => new Ct(e, s, r), t), ar = /* @__PURE__ */ ti(1, 136, 32), ri = 60;
5730
+ const ti = (s, e, r, t = {}) => yr(() => new Ot(e, s, r), t), ar = /* @__PURE__ */ ti(1, 136, 32), ri = 60;
5685
5731
  class si {
5686
5732
  constructor() {
5687
5733
  this.jwks = null;
@@ -5901,7 +5947,7 @@ class Ae {
5901
5947
  d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
5902
5948
  }, 5 * 60 * 1e3), x = 10, w = 30;
5903
5949
  let S = 0, I = null;
5904
- const N = () => {
5950
+ const C = () => {
5905
5951
  clearInterval(R), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + w + "초간 대기합니다"), I = setTimeout(() => {
5906
5952
  L(), t(new Error(
5907
5953
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
@@ -5910,9 +5956,9 @@ class Ae {
5910
5956
  }, R = setInterval(() => {
5911
5957
  S++;
5912
5958
  try {
5913
- g.closed && (S <= x ? N() : (L(), t(new Error("로그인이 취소되었습니다"))));
5959
+ g.closed && (S <= x ? C() : (L(), t(new Error("로그인이 취소되었습니다"))));
5914
5960
  } catch {
5915
- N();
5961
+ C();
5916
5962
  }
5917
5963
  }, 1e3), L = () => {
5918
5964
  clearTimeout(_), clearInterval(R), I && clearTimeout(I), window.removeEventListener("message", M);
@@ -5951,8 +5997,8 @@ class Ae {
5951
5997
  return;
5952
5998
  }
5953
5999
  const m = { token: D, email: F }, y = (k) => {
5954
- Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((C) => {
5955
- d.error("[CROSSx] nonce 검증 실패:", C), t(C instanceof Error ? C : new Error("nonce verification failed"));
6000
+ Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((O) => {
6001
+ d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
5956
6002
  });
5957
6003
  };
5958
6004
  H ? H.split(".").length === 3 ? y(H) : Q ? y(Q) : (d.warn(
@@ -5964,7 +6010,7 @@ class Ae {
5964
6010
  });
5965
6011
  }
5966
6012
  }
5967
- const Fe = "crossx_wallet_data", Oe = "crossx_mock_pin_hash";
6013
+ const Fe = "crossx_wallet_data", Ne = "crossx_mock_pin_hash";
5968
6014
  class li {
5969
6015
  constructor(e, r) {
5970
6016
  this.storage = e, this.pinStore = r ?? null;
@@ -5994,7 +6040,7 @@ class li {
5994
6040
  };
5995
6041
  await this.storage.set(Fe, n);
5996
6042
  const i = (r = this.pinStore) == null ? void 0 : r.get();
5997
- return i && (await this.storage.set(Oe, i), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
6043
+ return i && (await this.storage.set(Ne, i), d.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
5998
6044
  } catch (t) {
5999
6045
  throw new f(h.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
6000
6046
  }
@@ -6036,8 +6082,8 @@ class li {
6036
6082
  var t;
6037
6083
  if (d.log("[Mock] verifyPin"), this.pinScenario === "wrong")
6038
6084
  return !1;
6039
- const r = await this.storage.get(Oe);
6040
- return r && r !== e ? !1 : (r || await this.storage.set(Oe, e), (t = this.pinStore) == null || t.set(e), d.log("[Mock] verifyPin → 성공"), !0);
6085
+ const r = await this.storage.get(Ne);
6086
+ return r && r !== e ? !1 : (r || await this.storage.set(Ne, e), (t = this.pinStore) == null || t.set(e), d.log("[Mock] verifyPin → 성공"), !0);
6041
6087
  }
6042
6088
  /**
6043
6089
  * POST /mnemonic/change-password 모킹
@@ -6047,10 +6093,10 @@ class li {
6047
6093
  var i;
6048
6094
  if (d.log("[Mock] changePin"), this.pinScenario === "wrong")
6049
6095
  throw new f(h.PIN_WRONG, "Incorrect PIN.");
6050
- const t = (i = this.pinStore) == null ? void 0 : i.get(), n = await this.storage.get(Oe);
6096
+ const t = (i = this.pinStore) == null ? void 0 : i.get(), n = await this.storage.get(Ne);
6051
6097
  if (n && t && n !== t)
6052
6098
  throw new f(h.PIN_WRONG, "Incorrect PIN.");
6053
- await this.storage.set(Oe, r), d.log("[Mock] changePin 완료");
6099
+ await this.storage.set(Ne, r), d.log("[Mock] changePin 완료");
6054
6100
  }
6055
6101
  async migrateWallet(e, r) {
6056
6102
  var i;
@@ -6083,7 +6129,7 @@ class li {
6083
6129
  };
6084
6130
  await this.storage.set(Fe, t);
6085
6131
  const n = (i = this.pinStore) == null ? void 0 : i.get();
6086
- return n && (await this.storage.set(Oe, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
6132
+ return n && (await this.storage.set(Ne, n), d.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
6087
6133
  }
6088
6134
  /**
6089
6135
  * POST /mnemonic/share-c 모킹
@@ -6198,9 +6244,9 @@ class Ie {
6198
6244
  h.USER_NOT_FOUND,
6199
6245
  Ie.getGatewayErrorMessage(_.code, x)
6200
6246
  );
6201
- const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x), N = _.data;
6247
+ const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x), C = _.data;
6202
6248
  let R;
6203
- throw w === h.PIN_LOCKED ? R = Ie.extractLockDetails(N) : w === h.ADDRESS_LIMIT_EXCEEDED ? R = { limit: gt, raw: N } : R = N ?? void 0, new f(S, I, R);
6249
+ throw w === h.PIN_LOCKED ? R = Ie.extractLockDetails(C) : w === h.ADDRESS_LIMIT_EXCEEDED ? R = { limit: gt, raw: C } : R = C ?? void 0, new f(S, I, R);
6204
6250
  }
6205
6251
  return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
6206
6252
  }
@@ -9083,7 +9129,7 @@ function _i(s) {
9083
9129
  }, { passive: !0 });
9084
9130
  }
9085
9131
  const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
9086
- function Ne() {
9132
+ function Ce() {
9087
9133
  if (fi()) {
9088
9134
  const e = window.scrollY;
9089
9135
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
@@ -9358,22 +9404,22 @@ function ki(s) {
9358
9404
  function Ri(s) {
9359
9405
  return s.includes(":") ? s.split(":")[1] ?? s : s;
9360
9406
  }
9361
- function Oi(s) {
9407
+ function Ni(s) {
9362
9408
  return `https://www.crossscan.io/address/${s}?tab=txs`;
9363
9409
  }
9364
- function Ni(s, e) {
9410
+ function Ci(s, e) {
9365
9411
  return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
9366
9412
  }
9367
9413
  function Jr(s, e) {
9368
9414
  return `<a class="__crossx-addr-text __crossx-row-link" href="${A(e)}" target="_blank" rel="noopener noreferrer">${A(s)}</a>`;
9369
9415
  }
9370
9416
  function Ze(s) {
9371
- return Jr(de(s), Oi(s));
9417
+ return Jr(de(s), Ni(s));
9372
9418
  }
9373
9419
  function Zr(s, e) {
9374
- return Jr(de(e), Ni(s, e));
9420
+ return Jr(de(e), Ci(s, e));
9375
9421
  }
9376
- function Ci(s, e, r) {
9422
+ function Oi(s, e, r) {
9377
9423
  const t = j(
9378
9424
  (r == null ? void 0 : r.label_from) ?? "From",
9379
9425
  `${Ze(s.from)}
@@ -9453,10 +9499,10 @@ function Li(s, e, r, t) {
9453
9499
  <button class="__crossx-approve-btn" id="__crossx-done-btn">${A((t == null ? void 0 : t.tx_complete_done_button) ?? (n ? "All Done" : "Done"))}</button>
9454
9500
  `, c.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
9455
9501
  w.addEventListener("click", (S) => {
9456
- var N;
9502
+ var C;
9457
9503
  S.stopPropagation();
9458
9504
  const I = w.dataset.copy;
9459
- I && ((N = navigator.clipboard) == null || N.writeText(I).catch(() => {
9505
+ I && ((C = navigator.clipboard) == null || C.writeText(I).catch(() => {
9460
9506
  }));
9461
9507
  });
9462
9508
  });
@@ -9895,19 +9941,19 @@ function to(s) {
9895
9941
  return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
9896
9942
  }
9897
9943
  function _t(s, e, r, t, n, i, o) {
9898
- var C, B;
9944
+ var O, B;
9899
9945
  let a = !!(i && i > Date.now()), c = !1;
9900
9946
  const l = () => Array.from(s.querySelectorAll(".__crossx-pin6-box")), u = () => s.querySelector("#__crossx-pin6-boxes"), p = () => s.querySelector("#__crossx-pin6-error"), g = () => s.querySelector("#__crossx-pin6-lock-msg"), _ = () => s.querySelector("#__crossx-pin6-lock-countdown"), x = () => s.querySelector(".__crossx-pin6-body"), w = () => l().map((b) => b.value).join(""), S = () => Array.from(s.querySelectorAll(".__crossx-pin6-dot")), I = () => {
9901
9947
  var E;
9902
9948
  const b = l(), v = S();
9903
- if (v.length && (v.forEach((T, O) => {
9904
- const W = !!(b[O] && b[O].value);
9949
+ if (v.length && (v.forEach((T, N) => {
9950
+ const W = !!(b[N] && b[N].value);
9905
9951
  T.classList.toggle("--filled", W), T.classList.toggle("--active", !1);
9906
9952
  }), !a && !c)) {
9907
9953
  const T = b.findIndex((W) => !W.value);
9908
9954
  (E = v[T === -1 ? 5 : T]) == null || E.classList.add("--active");
9909
9955
  }
9910
- }, N = () => {
9956
+ }, C = () => {
9911
9957
  s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), S().forEach((v) => v.classList.toggle("--locked", a)), I();
9912
9958
  }, R = (b) => {
9913
9959
  a = b, l().forEach((v) => {
@@ -9933,8 +9979,8 @@ function _t(s, e, r, t, n, i, o) {
9933
9979
  let E = L();
9934
9980
  if (!E) {
9935
9981
  E = document.createElement("p"), E.className = "__crossx-pin6-attempt", E.id = "__crossx-pin6-attempt";
9936
- const O = J() ?? p();
9937
- O ? O.insertAdjacentElement("afterend", E) : (T = x()) == null || T.appendChild(E);
9982
+ const N = J() ?? p();
9983
+ N ? N.insertAdjacentElement("afterend", E) : (T = x()) == null || T.appendChild(E);
9938
9984
  }
9939
9985
  E.textContent = `${b}/${v}`;
9940
9986
  }, H = () => {
@@ -9954,7 +10000,7 @@ function _t(s, e, r, t, n, i, o) {
9954
10000
  var W;
9955
10001
  R(!0), l().forEach((U) => {
9956
10002
  U.value = "";
9957
- }), N();
10003
+ }), C();
9958
10004
  const v = p();
9959
10005
  if (v && (v.textContent = "Too many failed attempts. Please wait."), !g()) {
9960
10006
  const U = document.createElement("p");
@@ -9965,16 +10011,16 @@ function _t(s, e, r, t, n, i, o) {
9965
10011
  const E = () => {
9966
10012
  var K;
9967
10013
  const U = b - Date.now(), $ = _();
9968
- U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""), N(), setTimeout(() => {
10014
+ U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""), C(), setTimeout(() => {
9969
10015
  var Y;
9970
10016
  return (Y = l()[0]) == null ? void 0 : Y.focus();
9971
10017
  }, 50)) : $ && ($.textContent = ` ${to(U)}`);
9972
10018
  }, T = setInterval(E, 1e3);
9973
10019
  E();
9974
- const O = new MutationObserver(() => {
9975
- document.contains(s) || (clearInterval(T), O.disconnect());
10020
+ const N = new MutationObserver(() => {
10021
+ document.contains(s) || (clearInterval(T), N.disconnect());
9976
10022
  });
9977
- O.observe(document.body, { childList: !0, subtree: !1 });
10023
+ N.observe(document.body, { childList: !0, subtree: !1 });
9978
10024
  }, m = async () => {
9979
10025
  if (a || c) return;
9980
10026
  const b = w();
@@ -10006,7 +10052,7 @@ function _t(s, e, r, t, n, i, o) {
10006
10052
  const b = l(), v = b.find((E) => !E.value) ?? b[b.length - 1];
10007
10053
  v == null || v.focus();
10008
10054
  };
10009
- (C = u()) == null || C.addEventListener("click", (b) => {
10055
+ (O = u()) == null || O.addEventListener("click", (b) => {
10010
10056
  b.target.classList.contains("__crossx-pin6-box") || y();
10011
10057
  }), (B = x()) == null || B.addEventListener("click", (b) => {
10012
10058
  const v = b.target;
@@ -10017,7 +10063,7 @@ function _t(s, e, r, t, n, i, o) {
10017
10063
  const E = b.value.replace(/\D/g, "").slice(-1);
10018
10064
  b.value = E, M(), E && v < 5 && ((T = l()[v + 1]) == null || T.focus()), I(), w().length === 6 && setTimeout(m, 80);
10019
10065
  }), b.addEventListener("keydown", (E) => {
10020
- var T, O;
10066
+ var T, N;
10021
10067
  if (E.key === "Backspace") {
10022
10068
  if (E.preventDefault(), b.value)
10023
10069
  b.value = "";
@@ -10026,16 +10072,16 @@ function _t(s, e, r, t, n, i, o) {
10026
10072
  W.value = "", W.focus();
10027
10073
  }
10028
10074
  I();
10029
- } else E.key === "ArrowLeft" && v > 0 ? (E.preventDefault(), (T = l()[v - 1]) == null || T.focus()) : E.key === "ArrowRight" && v < 5 ? (E.preventDefault(), (O = l()[v + 1]) == null || O.focus()) : E.key === "Escape" && r();
10075
+ } else E.key === "ArrowLeft" && v > 0 ? (E.preventDefault(), (T = l()[v - 1]) == null || T.focus()) : E.key === "ArrowRight" && v < 5 ? (E.preventDefault(), (N = l()[v + 1]) == null || N.focus()) : E.key === "Escape" && r();
10030
10076
  }), b.addEventListener("paste", (E) => {
10031
10077
  var W, U;
10032
10078
  E.preventDefault();
10033
10079
  const T = (((W = E.clipboardData) == null ? void 0 : W.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
10034
10080
  if (!T) return;
10035
- const O = l();
10081
+ const N = l();
10036
10082
  T.split("").forEach(($, K) => {
10037
- O[K] && (O[K].value = $);
10038
- }), (U = O[Math.min(T.length - 1, 5)]) == null || U.focus(), M(), I(), w().length === 6 && setTimeout(m, 80);
10083
+ N[K] && (N[K].value = $);
10084
+ }), (U = N[Math.min(T.length - 1, 5)]) == null || U.focus(), M(), I(), w().length === 6 && setTimeout(m, 80);
10039
10085
  }), b.addEventListener("focus", () => b.select());
10040
10086
  });
10041
10087
  const k = s.querySelector("#__crossx-pin6-numpad");
@@ -10045,28 +10091,28 @@ function _t(s, e, r, t, n, i, o) {
10045
10091
  b && (b.classList.remove("--pressed"), b = null);
10046
10092
  };
10047
10093
  k.addEventListener("pointerdown", (T) => {
10048
- const O = T.target.closest(".__crossx-pin6-numpad-key");
10049
- !O || a || c || (v(), b = O, O.classList.add("--pressed"), O.setPointerCapture(T.pointerId));
10094
+ const N = T.target.closest(".__crossx-pin6-numpad-key");
10095
+ !N || a || c || (v(), b = N, N.classList.add("--pressed"), N.setPointerCapture(T.pointerId));
10050
10096
  });
10051
10097
  const E = (T) => {
10052
- const O = T.dataset.key;
10053
- if (!O) return;
10054
- if (O === "backspace") {
10098
+ const N = T.dataset.key;
10099
+ if (!N) return;
10100
+ if (N === "backspace") {
10055
10101
  const K = [...l()].reverse().find((Y) => Y.value);
10056
10102
  K && (K.value = "", M()), I();
10057
10103
  return;
10058
10104
  }
10059
- if (!/^\d$/.test(O)) return;
10105
+ if (!/^\d$/.test(N)) return;
10060
10106
  const U = l().find(($) => !$.value);
10061
- U && (U.value = O, M(), I(), w().length === 6 && setTimeout(m, 80));
10107
+ U && (U.value = N, M(), I(), w().length === 6 && setTimeout(m, 80));
10062
10108
  };
10063
10109
  k.addEventListener("pointerup", (T) => {
10064
10110
  if (!b) return;
10065
- const O = b;
10111
+ const N = b;
10066
10112
  v();
10067
- const W = O.getBoundingClientRect();
10068
- T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(O);
10069
- }), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() && N();
10113
+ const W = N.getBoundingClientRect();
10114
+ T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(N);
10115
+ }), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() && C();
10070
10116
  }
10071
10117
  }
10072
10118
  const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -10139,9 +10185,9 @@ class oo {
10139
10185
  */
10140
10186
  showWalletSelector(e, r, t) {
10141
10187
  return new Promise((n, i) => {
10142
- var N;
10188
+ var C;
10143
10189
  ae();
10144
- const o = [...e], a = Wi(o, this.tokens, t, this.messages), c = Ne();
10190
+ const o = [...e], a = Wi(o, this.tokens, t, this.messages), c = Ce();
10145
10191
  ce(a);
10146
10192
  let l = !1;
10147
10193
  const u = () => {
@@ -10181,7 +10227,7 @@ class oo {
10181
10227
  const L = R instanceof f && R.code === h.ADDRESS_LIMIT_EXCEEDED, M = this.resolveAddWalletErrorMessage(R);
10182
10228
  w && (w.textContent = M, w.hidden = !1), L ? (S.disabled = !0, S.setAttribute("aria-disabled", "true")) : S.disabled = !1, p = R;
10183
10229
  }
10184
- }), (N = a.querySelector("#__crossx-close-btn")) == null || N.addEventListener("click", _), a.addEventListener("click", (R) => {
10230
+ }), (C = a.querySelector("#__crossx-close-btn")) == null || C.addEventListener("click", _), a.addEventListener("click", (R) => {
10185
10231
  R.target === a && _();
10186
10232
  });
10187
10233
  const I = (R) => {
@@ -10218,7 +10264,7 @@ class oo {
10218
10264
  return new Promise((n) => {
10219
10265
  var g, _, x, w;
10220
10266
  ae();
10221
- const i = zi(this.tokens, r, this.messages), o = Ne();
10267
+ const i = zi(this.tokens, r, this.messages), o = Ce();
10222
10268
  ce(i);
10223
10269
  const a = () => {
10224
10270
  i.remove(), o();
@@ -10230,8 +10276,8 @@ class oo {
10230
10276
  a(), n(null);
10231
10277
  };
10232
10278
  (g = i.querySelector("#__crossx-apple-btn")) == null || g.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (x = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || x.addEventListener("click", (S) => {
10233
- const N = S.currentTarget.dataset.walletId ?? "";
10234
- N && l(N);
10279
+ const C = S.currentTarget.dataset.walletId ?? "";
10280
+ C && l(C);
10235
10281
  }), (w = i.querySelector("#__crossx-close-btn")) == null || w.addEventListener("click", u), i.addEventListener("click", (S) => {
10236
10282
  S.target === i && u();
10237
10283
  }), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
@@ -10254,7 +10300,7 @@ class oo {
10254
10300
  accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
10255
10301
  signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
10256
10302
  signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
10257
- }), i = Ne();
10303
+ }), i = Ce();
10258
10304
  ce(n);
10259
10305
  let o = !1;
10260
10306
  const a = () => {
@@ -10323,13 +10369,13 @@ class oo {
10323
10369
  }, o = {
10324
10370
  title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
10325
10371
  headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
10326
- }, a = hr(this.tokens, Qi(n)), c = Ne();
10372
+ }, a = hr(this.tokens, Qi(n)), c = Ce();
10327
10373
  ce(a);
10328
10374
  let l = !1;
10329
10375
  const u = () => {
10330
10376
  l || (l = !0, a.remove(), c());
10331
- }, p = (N) => {
10332
- u(), r(N);
10377
+ }, p = (C) => {
10378
+ u(), r(C);
10333
10379
  }, g = () => {
10334
10380
  u(), r(null);
10335
10381
  }, _ = a.querySelector(".__crossx-card"), x = {
@@ -10338,21 +10384,21 @@ class oo {
10338
10384
  repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
10339
10385
  sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
10340
10386
  alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
10341
- }, w = (N) => {
10387
+ }, w = (C) => {
10342
10388
  var R;
10343
10389
  _.innerHTML = pt({
10344
10390
  title: o.title,
10345
10391
  headerSubtitle: o.headerSubtitle
10346
10392
  }), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
10347
- L === N ? p(N) : S(i.mismatchError);
10393
+ L === C ? p(C) : S(i.mismatchError);
10348
10394
  }, g);
10349
- }, S = (N) => {
10395
+ }, S = (C) => {
10350
10396
  var R;
10351
10397
  _.innerHTML = pt({
10352
10398
  title: i.title,
10353
10399
  headerSubtitle: i.headerSubtitle,
10354
10400
  subtitle: i.subtitle,
10355
- errorMessage: N
10401
+ errorMessage: C
10356
10402
  }), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
10357
10403
  const M = eo(L, x);
10358
10404
  M ? S(M) : w(L);
@@ -10360,10 +10406,10 @@ class oo {
10360
10406
  };
10361
10407
  (() => {
10362
10408
  var Q;
10363
- const N = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), R = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
10409
+ const C = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), R = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
10364
10410
  R.removeAttribute("disabled");
10365
10411
  const M = R.dataset.nextLabel ?? "Next", q = R.dataset.submitLabel ?? "I Understand", J = () => {
10366
- const H = L.size === N.length;
10412
+ const H = L.size === C.length;
10367
10413
  R.classList.toggle("--disabled", !H), R.textContent = H ? q : M;
10368
10414
  }, G = (H, D) => {
10369
10415
  if (L.has(D)) return;
@@ -10374,7 +10420,7 @@ class oo {
10374
10420
  const F = H.querySelector(`#__crossx-notice-check-${D}`);
10375
10421
  L.delete(D), F.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), J();
10376
10422
  };
10377
- N.forEach((H) => {
10423
+ C.forEach((H) => {
10378
10424
  const D = parseInt(H.dataset.checkIndex ?? "0", 10);
10379
10425
  H.addEventListener("click", () => {
10380
10426
  L.has(D) ? X(H, D) : G(H, D);
@@ -10382,11 +10428,11 @@ class oo {
10382
10428
  (F.key === " " || F.key === "Enter") && (F.preventDefault(), L.has(D) ? X(H, D) : G(H, D));
10383
10429
  });
10384
10430
  }), R.addEventListener("click", () => {
10385
- if (L.size === N.length) {
10431
+ if (L.size === C.length) {
10386
10432
  S(e == null ? void 0 : e.errorMessage);
10387
10433
  return;
10388
10434
  }
10389
- const H = N.find((F) => {
10435
+ const H = C.find((F) => {
10390
10436
  const m = parseInt(F.dataset.checkIndex ?? "0", 10);
10391
10437
  return !L.has(m);
10392
10438
  });
@@ -10396,8 +10442,8 @@ class oo {
10396
10442
  H.classList.remove("--highlight"), G(H, D);
10397
10443
  }, 400);
10398
10444
  }), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", g);
10399
- })(), a.addEventListener("click", (N) => {
10400
- N.target === a && g();
10445
+ })(), a.addEventListener("click", (C) => {
10446
+ C.target === a && g();
10401
10447
  });
10402
10448
  });
10403
10449
  }
@@ -10421,20 +10467,20 @@ class oo {
10421
10467
  attemptCount: e == null ? void 0 : e.attemptCount,
10422
10468
  maxAttempts: e == null ? void 0 : e.maxAttempts
10423
10469
  })
10424
- ), u = Ne();
10470
+ ), u = Ce();
10425
10471
  ce(l);
10426
10472
  let p = !1;
10427
10473
  const g = () => {
10428
10474
  p || (p = !0, l.remove(), u());
10429
- }, _ = (N) => {
10430
- g(), r(N);
10475
+ }, _ = (C) => {
10476
+ g(), r(C);
10431
10477
  }, x = () => {
10432
10478
  g(), r(null);
10433
- }, w = (N) => {
10434
- g(), t(N);
10479
+ }, w = (C) => {
10480
+ g(), t(C);
10435
10481
  }, S = l.querySelector(".__crossx-card");
10436
- (I = S.querySelector("#__crossx-close-btn")) == null || I.addEventListener("click", x), _t(S, _, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (N) => {
10437
- N.target === l && x();
10482
+ (I = S.querySelector("#__crossx-close-btn")) == null || I.addEventListener("click", x), _t(S, _, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (C) => {
10483
+ C.target === l && x();
10438
10484
  });
10439
10485
  });
10440
10486
  }
@@ -10491,7 +10537,7 @@ class oo {
10491
10537
  return new Promise((r) => {
10492
10538
  var a, c;
10493
10539
  ae();
10494
- const t = Ci(e, this.tokens, this.messages);
10540
+ const t = Oi(e, this.tokens, this.messages);
10495
10541
  ce(t);
10496
10542
  const n = () => t.remove(), i = () => {
10497
10543
  n(), r();
@@ -10547,7 +10593,7 @@ class oo {
10547
10593
  ae();
10548
10594
  let t;
10549
10595
  e.type === "sign-message" ? t = Di(e, this.tokens, this.messages) : e.type === "sign-typed-data" ? t = $i(e, this.tokens, this.messages) : e.type === "sign" ? t = Ai(e, this.tokens, this.displayDecimals, this.messages) : t = Ii(e, this.tokens, this.displayDecimals, this.messages);
10550
- const n = Ne();
10596
+ const n = Ce();
10551
10597
  ce(t);
10552
10598
  const i = () => {
10553
10599
  t.remove(), n();
@@ -10819,7 +10865,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
10819
10865
  },
10820
10866
  () => typeof window < "u" ? window.location.origin : "http://localhost",
10821
10867
  x
10822
- ), N = e != null && e.wrapConfirmation ? e.wrapConfirmation(I) : I, R = new xt(
10868
+ ), C = e != null && e.wrapConfirmation ? e.wrapConfirmation(I) : I, R = new xt(
10823
10869
  t,
10824
10870
  n,
10825
10871
  o,
@@ -10828,7 +10874,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
10828
10874
  l,
10829
10875
  g,
10830
10876
  u,
10831
- N,
10877
+ C,
10832
10878
  w,
10833
10879
  p
10834
10880
  );