@nexus-cross/crossx-sdk-core 2.2.0 → 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
@@ -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);
@@ -1417,7 +1419,7 @@ function Cs(s) {
1417
1419
  `서명 길이가 유효하지 않습니다: ${Wt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
1418
1420
  );
1419
1421
  }
1420
- function Ns(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 Ne {
1469
+ class Oe {
1468
1470
  constructor(e) {
1469
1471
  this.deps = e, this.verifyPinMutex = null;
1470
1472
  }
@@ -1537,7 +1539,7 @@ class Ne {
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 Ne.buildPinLockedResult(u, a);
1542
+ return Oe.buildPinLockedResult(u, a);
1541
1543
  }
1542
1544
  throw u;
1543
1545
  }
@@ -1571,7 +1573,7 @@ class Ne {
1571
1573
  return await e();
1572
1574
  } catch (n) {
1573
1575
  if (n instanceof f) {
1574
- if (t = Ne.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 Ne {
1585
1587
  try {
1586
1588
  return await e();
1587
1589
  } catch (n) {
1588
- if (n instanceof f && (t = Ne.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 Ne {
1610
1612
  return null;
1611
1613
  }
1612
1614
  static buildPinLockedResult(e, r) {
1613
- const t = Ne.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,32 +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
- let a, c = !1;
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;
1755
1757
  if (r) {
1756
- const l = i.find(
1757
- (u) => u.address.toLowerCase() === r.toLowerCase()
1758
+ const p = o.find(
1759
+ (g) => g.address.toLowerCase() === r.toLowerCase()
1758
1760
  );
1759
- l ? a = l : (a = { address: r, index: 0 }, c = !0);
1760
- } else e !== void 0 ? a = i.find((l) => l.index === e) ?? i[0] : a = i[0];
1761
- c ? d.log(
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(
1762
1764
  "[CROSSx] preferredWalletAddress 가 서버 캐시에 없음 — raw address 채택:",
1763
- a.address
1765
+ c.address
1764
1766
  ) : d.log(
1765
1767
  "[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):",
1766
- a.address
1767
- ), this.deps.setActiveWallet(a.address, a.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
+ );
1768
1776
  return;
1769
1777
  }
1770
1778
  d.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.deps.pinOrchestrator.ensureVerifiedPin();
1771
- const o = await this.deps.walletProvider.getAddress(t, 0);
1772
- 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);
1773
1781
  }
1774
1782
  }
1775
1783
  class Fs {
@@ -2314,7 +2322,7 @@ const Te = class Te extends ys {
2314
2322
  walletPreferenceKey: Te.WALLET_PREF_KEY,
2315
2323
  storage: this.storage,
2316
2324
  pinStore: this.pinStore
2317
- }), this.pinOrchestrator = new Ne({
2325
+ }), this.pinOrchestrator = new Oe({
2318
2326
  confirmation: this.confirmation,
2319
2327
  walletProvider: this.walletProvider,
2320
2328
  pinStore: this.pinStore,
@@ -2333,7 +2341,7 @@ const Te = class Te extends ys {
2333
2341
  walletProvider: this.walletProvider,
2334
2342
  pinOrchestrator: this.pinOrchestrator,
2335
2343
  getUserId: () => this.userId,
2336
- setActiveWallet: (x, w) => this.setActiveWallet(x, w)
2344
+ setActiveWallet: (x, w, S) => this.setActiveWallet(x, w, S)
2337
2345
  }), this.migrationOrchestrator = new Fs({
2338
2346
  confirmation: this.confirmation,
2339
2347
  walletProvider: this.walletProvider,
@@ -2439,7 +2447,7 @@ const Te = class Te extends ys {
2439
2447
  }
2440
2448
  async _doInitialize(e) {
2441
2449
  var r, t;
2442
- 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));
2443
2451
  try {
2444
2452
  const n = fr();
2445
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`);
@@ -2447,17 +2455,28 @@ const Te = class Te extends ys {
2447
2455
  Te.WALLET_PREF_KEY
2448
2456
  ).catch(() => null) : null, o = (e == null ? void 0 : e.preferredWalletIndex) ?? (i == null ? void 0 : i.index);
2449
2457
  let a = (e == null ? void 0 : e.preferredWalletAddress) ?? (i == null ? void 0 : i.address), c = await this.tryRNBridgeBootstrap();
2450
- 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)
2451
- if (this.applyAuthResult(c), this.address && (!a || this.address.toLowerCase() === a.toLowerCase()))
2452
- 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
+ );
2453
2467
  else try {
2454
- await this.loadWalletAfterAuth(o, a);
2455
- } catch (u) {
2456
- if (!(u instanceof f && u.code === h.PIN_CANCELLED))
2457
- 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;
2458
2476
  d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
2459
2477
  }
2460
- 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;
2461
2480
  } catch (n) {
2462
2481
  throw new f(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
2463
2482
  }
@@ -2478,13 +2497,14 @@ const Te = class Te extends ys {
2478
2497
  const e = new fe({
2479
2498
  appId: this._config.projectId,
2480
2499
  appVersion: "1.0.0",
2481
- sdkVersion: "2.2.0",
2500
+ sdkVersion: "2.2.1",
2482
2501
  keyId: "key-id-1",
2483
2502
  userIdHash: "user-hash-placeholder",
2484
2503
  projectId: this._config.projectId
2485
2504
  }), r = await e.initialize();
2486
- return this._rnBridgeService = e, this._rnBridgeWalletAddress = r.walletAddress, this.subscribeBridgeWalletChanged(), d.log("[CROSSx] RN Bridge Handshake 성공", {
2487
- 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 ?? "(없음)"
2488
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);
2489
2509
  } catch (e) {
2490
2510
  return d.warn("[CROSSx] RN Bridge handshake 실패", e), null;
@@ -2507,7 +2527,11 @@ const Te = class Te extends ys {
2507
2527
  const r = await this._rnBridgeService.requestFirebaseIdToken();
2508
2528
  d.log("[CROSSx] Bridge 로그인 — Firebase token 수신");
2509
2529
  const t = await this.signInUseCase.executeWithNativeFirebaseIdToken(r);
2510
- 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;
2511
2535
  } catch (r) {
2512
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);
2513
2537
  }
@@ -2710,6 +2734,20 @@ const Te = class Te extends ys {
2710
2734
  get currentUserId() {
2711
2735
  return this.userId;
2712
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
+ }
2713
2751
  /**
2714
2752
  * 현재 로그인 상태 확인 (isAuthenticated() 별칭)
2715
2753
  * Android SDK의 isLoggedIn()과 동일합니다.
@@ -3178,7 +3216,7 @@ const Te = class Te extends ys {
3178
3216
  a
3179
3217
  )
3180
3218
  });
3181
- return Ns(o.signature), {
3219
+ return Os(o.signature), {
3182
3220
  chainId: e,
3183
3221
  signedTx: o.signature,
3184
3222
  txHash: o.txHash ?? ""
@@ -3554,7 +3592,7 @@ const Te = class Te extends ys {
3554
3592
  return { wei: "0x0", formatted: "0", chainId: e };
3555
3593
  try {
3556
3594
  const n = await this.jsonRpc.call("eth_getBalance", [r, "latest"], e) ?? "0x0";
3557
- return { wei: n, formatted: Os(n, this._config.displayDecimals), chainId: e };
3595
+ return { wei: n, formatted: Ns(n, this._config.displayDecimals), chainId: e };
3558
3596
  } catch (t) {
3559
3597
  if (t instanceof f) throw t;
3560
3598
  const n = t instanceof Error ? t.message : String(t);
@@ -3717,10 +3755,11 @@ const Te = class Te extends ys {
3717
3755
  * 2. GET /mnemonic/addresses (비밀번호 불필요) → 캐시된 주소가 있으면 바로 사용
3718
3756
  * 3. 빈 배열인 경우 → 비밀번호 확인(메모리 없으면 모달) → POST /mnemonic/address(0)
3719
3757
  */
3720
- async loadWalletAfterAuth(e, r) {
3758
+ async loadWalletAfterAuth(e, r, t) {
3721
3759
  return this.walletLifecycleService.loadWalletAfterAuth(
3722
3760
  e,
3723
- r
3761
+ r,
3762
+ t
3724
3763
  );
3725
3764
  }
3726
3765
  /**
@@ -4439,7 +4478,7 @@ function Xt(s) {
4439
4478
  };
4440
4479
  }
4441
4480
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4442
- 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);
4443
4482
  function le(s, e) {
4444
4483
  const r = s % e;
4445
4484
  return r >= re ? r : e + r;
@@ -4464,29 +4503,29 @@ function Jt(s, e) {
4464
4503
  throw new Error("invert: does not exist");
4465
4504
  return le(n, e);
4466
4505
  }
4467
- function Ot(s, e, r) {
4506
+ function Nt(s, e, r) {
4468
4507
  if (!s.eql(s.sqr(e), r))
4469
4508
  throw new Error("Cannot find square root");
4470
4509
  }
4471
4510
  function Cr(s, e) {
4472
4511
  const r = (s.ORDER + te) / Tr, t = s.pow(e, r);
4473
- return Ot(s, t, e), t;
4512
+ return Nt(s, t, e), t;
4474
4513
  }
4475
4514
  function En(s, e) {
4476
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));
4477
- return Ot(s, a, e), a;
4516
+ return Nt(s, a, e), a;
4478
4517
  }
4479
4518
  function An(s) {
4480
- const e = rt(s), r = Nr(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;
4481
4520
  return (a, c) => {
4482
4521
  let l = a.pow(c, o), u = a.mul(l, t);
4483
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);
4484
4523
  l = a.cmov(l, u, _), u = a.cmov(g, p, x);
4485
4524
  const w = a.eql(a.sqr(u), c), S = a.cmov(l, u, w);
4486
- return Ot(a, S, c), S;
4525
+ return Nt(a, S, c), S;
4487
4526
  };
4488
4527
  }
4489
- function Nr(s) {
4528
+ function Or(s) {
4490
4529
  if (s < Ir)
4491
4530
  throw new Error("sqrt is not defined for small field");
4492
4531
  let e = s - te, r = 0;
@@ -4521,7 +4560,7 @@ function Nr(s) {
4521
4560
  };
4522
4561
  }
4523
4562
  function In(s) {
4524
- return s % Tr === Ir ? Cr : s % Rr === kr ? En : s % Or === Sn ? An(s) : Nr(s);
4563
+ return s % Tr === Ir ? Cr : s % Rr === kr ? En : s % Nr === Sn ? An(s) : Or(s);
4525
4564
  }
4526
4565
  const Tn = [
4527
4566
  "create",
@@ -4572,7 +4611,7 @@ function Zt(s, e) {
4572
4611
  throw new Error("invalid Legendre symbol result");
4573
4612
  return n ? 1 : i ? 0 : -1;
4574
4613
  }
4575
- function On(s, e) {
4614
+ function Nn(s, e) {
4576
4615
  e !== void 0 && me(e);
4577
4616
  const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
4578
4617
  return { nBitLength: r, nByteLength: t };
@@ -4594,7 +4633,7 @@ class Cn {
4594
4633
  throw new Error("invalid field: expected ORDER > 0, got " + e);
4595
4634
  let t;
4596
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));
4597
- const { nBitLength: n, nByteLength: i } = On(e, t);
4636
+ const { nBitLength: n, nByteLength: i } = Nn(e, t);
4598
4637
  if (i > 2048)
4599
4638
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
4600
4639
  this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
@@ -4702,7 +4741,7 @@ function Dr(s) {
4702
4741
  const e = Lr(s);
4703
4742
  return e + Math.ceil(e / 2);
4704
4743
  }
4705
- function Nn(s, e, r = !1) {
4744
+ function On(s, e, r = !1) {
4706
4745
  V(s);
4707
4746
  const t = s.length, n = Lr(e), i = Dr(e);
4708
4747
  if (t < 16 || t < i || t > 1024)
@@ -5053,18 +5092,18 @@ function Un(s, e = {}) {
5053
5092
  throw new Error("compression is not supported: Field does not have .isOdd()");
5054
5093
  }
5055
5094
  function p(F, m, y) {
5056
- const { x: k, y: N } = m.toAffine(), B = t.toBytes(k);
5095
+ const { x: k, y: O } = m.toAffine(), B = t.toBytes(k);
5057
5096
  if (Xe(y, "isCompressed"), y) {
5058
5097
  u();
5059
- const b = !t.isOdd(N);
5098
+ const b = !t.isOdd(O);
5060
5099
  return Se(Hr(b), B);
5061
5100
  } else
5062
- return Se(Uint8Array.of(4), B, t.toBytes(N));
5101
+ return Se(Uint8Array.of(4), B, t.toBytes(O));
5063
5102
  }
5064
5103
  function g(F) {
5065
5104
  V(F, void 0, "Point");
5066
- const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length, N = F[0], B = F.subarray(1);
5067
- if (k === m && (N === 2 || N === 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)) {
5068
5107
  const b = t.fromBytes(B);
5069
5108
  if (!t.isValid(b))
5070
5109
  throw new Error("bad point: is not on curve, wrong x");
@@ -5078,8 +5117,8 @@ function Un(s, e = {}) {
5078
5117
  }
5079
5118
  u();
5080
5119
  const T = t.isOdd(E);
5081
- return (N & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
5082
- } else if (k === y && N === 4) {
5120
+ return (O & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
5121
+ } else if (k === y && O === 4) {
5083
5122
  const b = t.BYTES, v = t.fromBytes(B.subarray(0, b)), E = t.fromBytes(B.subarray(b, b * 2));
5084
5123
  if (!S(v, E))
5085
5124
  throw new Error("bad point: is not on curve");
@@ -5116,12 +5155,12 @@ function Un(s, e = {}) {
5116
5155
  return Bn(F, c.basises, n.ORDER);
5117
5156
  }
5118
5157
  const q = Xt((F, m) => {
5119
- const { X: y, Y: k, Z: N } = F;
5120
- if (t.eql(N, t.ONE))
5158
+ const { X: y, Y: k, Z: O } = F;
5159
+ if (t.eql(O, t.ONE))
5121
5160
  return { x: y, y: k };
5122
5161
  const B = F.is0();
5123
- m == null && (m = B ? t.ONE : t.inv(N));
5124
- const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(N, 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);
5125
5164
  if (B)
5126
5165
  return { x: t.ZERO, y: t.ZERO };
5127
5166
  if (!t.eql(E, t.ONE))
@@ -5142,8 +5181,8 @@ function Un(s, e = {}) {
5142
5181
  throw new Error("bad point: not in prime-order subgroup");
5143
5182
  return !0;
5144
5183
  });
5145
- function G(F, m, y, k, N) {
5146
- return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(N, 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);
5147
5186
  }
5148
5187
  const D = class D {
5149
5188
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
@@ -5201,7 +5240,7 @@ function Un(s, e = {}) {
5201
5240
  /** Compare one point to another. */
5202
5241
  equals(m) {
5203
5242
  L(m);
5204
- const { X: y, Y: k, Z: N } = this, { X: B, Y: b, Z: v } = m, E = t.eql(t.mul(y, v), t.mul(B, N)), T = t.eql(t.mul(k, v), t.mul(b, N));
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));
5205
5244
  return E && T;
5206
5245
  }
5207
5246
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
@@ -5213,9 +5252,9 @@ function Un(s, e = {}) {
5213
5252
  // https://eprint.iacr.org/2015/1060, algorithm 3
5214
5253
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
5215
5254
  double() {
5216
- const { a: m, b: y } = i, k = t.mul(y, ze), { X: N, Y: B, Z: b } = this;
5217
- let v = t.ZERO, E = t.ZERO, T = t.ZERO, O = t.mul(N, N), W = t.mul(B, B), U = t.mul(b, b), $ = t.mul(N, B);
5218
- return $ = t.add($, $), T = t.mul(N, 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);
5219
5258
  }
5220
5259
  // Renes-Costello-Batina exception-free addition formula.
5221
5260
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -5223,13 +5262,13 @@ function Un(s, e = {}) {
5223
5262
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
5224
5263
  add(m) {
5225
5264
  L(m);
5226
- const { X: y, Y: k, Z: N } = this, { X: B, Y: b, Z: v } = m;
5227
- 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;
5228
5267
  const W = i.a, U = t.mul(i.b, ze);
5229
- let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(N, v), ne = t.add(y, k), z = t.add(B, b);
5230
- ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y, N);
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);
5231
5270
  let ee = t.add(B, v);
5232
- return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k, N), 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);
5233
5272
  }
5234
5273
  subtract(m) {
5235
5274
  return this.add(m.negate());
@@ -5250,16 +5289,16 @@ function Un(s, e = {}) {
5250
5289
  const { endo: y } = e;
5251
5290
  if (!n.isValidNot0(m))
5252
5291
  throw new Error("invalid scalar: out of range");
5253
- let k, N;
5292
+ let k, O;
5254
5293
  const B = (b) => H.cached(this, b, (v) => Qt(D, v));
5255
5294
  if (y) {
5256
- const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: O, f: W } = B(v), { p: U, f: $ } = B(T);
5257
- N = 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);
5258
5297
  } else {
5259
5298
  const { p: b, f: v } = B(m);
5260
- k = b, N = v;
5299
+ k = b, O = v;
5261
5300
  }
5262
- return Qt(D, [k, N])[0];
5301
+ return Qt(D, [k, O])[0];
5263
5302
  }
5264
5303
  /**
5265
5304
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -5277,8 +5316,8 @@ function Un(s, e = {}) {
5277
5316
  if (H.hasCache(this))
5278
5317
  return this.multiply(m);
5279
5318
  if (y) {
5280
- const { k1neg: N, k1: B, k2neg: b, k2: v } = M(m), { p1: E, p2: T } = Ln(D, k, B, v);
5281
- return G(y.beta, E, T, N, 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);
5282
5321
  } else
5283
5322
  return H.unsafe(k, m);
5284
5323
  }
@@ -5356,7 +5395,7 @@ function Hn(s, e = {}) {
5356
5395
  }
5357
5396
  }
5358
5397
  function a(_ = t(n.seed)) {
5359
- return Nn(V(_, n.seed, "seed"), r.ORDER);
5398
+ return On(V(_, n.seed, "seed"), r.ORDER);
5360
5399
  }
5361
5400
  function c(_, x = !0) {
5362
5401
  return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
@@ -5412,31 +5451,31 @@ function Wn(s, e, r = {}) {
5412
5451
  }
5413
5452
  function R(m, y) {
5414
5453
  mt(y);
5415
- const k = _.signature, N = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
5416
- return V(m, N);
5454
+ const k = _.signature, O = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
5455
+ return V(m, O);
5417
5456
  }
5418
5457
  class L {
5419
- constructor(y, k, N) {
5458
+ constructor(y, k, O) {
5420
5459
  P(this, "r");
5421
5460
  P(this, "s");
5422
5461
  P(this, "recovery");
5423
- if (this.r = I("r", y), this.s = I("s", k), N != null) {
5424
- if (C(), ![0, 1, 2, 3].includes(N))
5462
+ if (this.r = I("r", y), this.s = I("s", k), O != null) {
5463
+ if (C(), ![0, 1, 2, 3].includes(O))
5425
5464
  throw new Error("invalid recovery id");
5426
- this.recovery = N;
5465
+ this.recovery = O;
5427
5466
  }
5428
5467
  Object.freeze(this);
5429
5468
  }
5430
5469
  static fromBytes(y, k = x.format) {
5431
5470
  R(y, k);
5432
- let N;
5471
+ let O;
5433
5472
  if (k === "der") {
5434
5473
  const { r: E, s: T } = ve.toSig(V(y));
5435
5474
  return new L(E, T);
5436
5475
  }
5437
- k === "recovered" && (N = y[0], k = "compact", y = y.subarray(1));
5476
+ k === "recovered" && (O = y[0], k = "compact", y = y.subarray(1));
5438
5477
  const B = _.signature / 2, b = y.subarray(0, B), v = y.subarray(B, B * 2);
5439
- return new L(o.fromBytes(b), o.fromBytes(v), N);
5478
+ return new L(o.fromBytes(b), o.fromBytes(v), O);
5440
5479
  }
5441
5480
  static fromHex(y, k) {
5442
5481
  return this.fromBytes(Ye(y), k);
@@ -5451,10 +5490,10 @@ function Wn(s, e, r = {}) {
5451
5490
  return new L(this.r, this.s, y);
5452
5491
  }
5453
5492
  recoverPublicKey(y) {
5454
- const { r: k, s: N } = 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;
5455
5494
  if (!i.isValid(b))
5456
5495
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
5457
- 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(N * 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));
5458
5497
  if ($.is0())
5459
5498
  throw new Error("invalid recovery: point at infinify");
5460
5499
  return $.assertValidity(), $;
@@ -5466,7 +5505,7 @@ function Wn(s, e, r = {}) {
5466
5505
  toBytes(y = x.format) {
5467
5506
  if (mt(y), y === "der")
5468
5507
  return Ye(ve.hexFromSig(this));
5469
- const { r: k, s: N } = this, B = o.toBytes(k), b = o.toBytes(N);
5508
+ const { r: k, s: O } = this, B = o.toBytes(k), b = o.toBytes(O);
5470
5509
  return y === "recovered" ? (C(), Se(Uint8Array.of(this.assertRecovery()), B, b)) : Se(B, b);
5471
5510
  }
5472
5511
  toHex(y) {
@@ -5476,8 +5515,8 @@ function Wn(s, e, r = {}) {
5476
5515
  const M = r.bits2int || function(y) {
5477
5516
  if (y.length > 8192)
5478
5517
  throw new Error("input is too large");
5479
- const k = tt(y), N = y.length * 8 - c;
5480
- return N > 0 ? k >> BigInt(N) : k;
5518
+ const k = tt(y), O = y.length * 8 - c;
5519
+ return O > 0 ? k >> BigInt(O) : k;
5481
5520
  }, q = r.bits2int_modN || function(y) {
5482
5521
  return o.create(M(y));
5483
5522
  }, J = kt(c);
@@ -5488,7 +5527,7 @@ function Wn(s, e, r = {}) {
5488
5527
  return V(m, void 0, "message"), y ? V(e(m), void 0, "prehashed message") : m;
5489
5528
  }
5490
5529
  function Q(m, y, k) {
5491
- const { lowS: N, prehash: B, extraEntropy: b } = ut(k, x);
5530
+ const { lowS: O, prehash: B, extraEntropy: b } = ut(k, x);
5492
5531
  m = X(m, B);
5493
5532
  const v = q(m), E = o.fromBytes(y);
5494
5533
  if (!o.isValidNot0(E))
@@ -5498,7 +5537,7 @@ function Wn(s, e, r = {}) {
5498
5537
  const $ = b === !0 ? t(_.secretKey) : b;
5499
5538
  T.push(V($, void 0, "extraEntropy"));
5500
5539
  }
5501
- const O = Se(...T), W = v;
5540
+ const N = Se(...T), W = v;
5502
5541
  function U($) {
5503
5542
  const K = M($);
5504
5543
  if (!o.isValidNot0(K))
@@ -5510,16 +5549,16 @@ function Wn(s, e, r = {}) {
5510
5549
  if (ee === ge)
5511
5550
  return;
5512
5551
  let Lt = (ne.x === z ? 0 : 2) | Number(ne.y & Le), Dt = ee;
5513
- return N && 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);
5514
5553
  }
5515
- return { seed: O, k2sig: U };
5554
+ return { seed: N, k2sig: U };
5516
5555
  }
5517
5556
  function H(m, y, k = {}) {
5518
- const { seed: N, k2sig: B } = Q(m, y, k);
5519
- return bn(e.outputLen, o.BYTES, n)(N, 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);
5520
5559
  }
5521
- function D(m, y, k, N = {}) {
5522
- const { lowS: B, prehash: b, format: v } = ut(N, x);
5560
+ function D(m, y, k, O = {}) {
5561
+ const { lowS: B, prehash: b, format: v } = ut(O, x);
5523
5562
  if (k = V(k, void 0, "publicKey"), y = X(y, b), !At(m)) {
5524
5563
  const E = m instanceof L ? ", use sig.toBytes()" : "";
5525
5564
  throw new Error("verify expects Uint8Array signature" + E);
@@ -5529,15 +5568,15 @@ function Wn(s, e, r = {}) {
5529
5568
  const E = L.fromBytes(m, v), T = s.fromBytes(k);
5530
5569
  if (B && E.hasHighS())
5531
5570
  return !1;
5532
- 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));
5533
- 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;
5534
5573
  } catch {
5535
5574
  return !1;
5536
5575
  }
5537
5576
  }
5538
5577
  function F(m, y, k = {}) {
5539
- const { prehash: N } = ut(k, x);
5540
- return y = X(y, N), 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();
5541
5580
  }
5542
5581
  return Object.freeze({
5543
5582
  keygen: l,
@@ -5612,7 +5651,7 @@ function ei(s, e = 24) {
5612
5651
  }
5613
5652
  $e(r);
5614
5653
  }
5615
- class Nt {
5654
+ class Ot {
5616
5655
  // NOTE: we accept arguments in bytes instead of bits here.
5617
5656
  constructor(e, r, t, n = !1, i = 24) {
5618
5657
  P(this, "state");
@@ -5685,10 +5724,10 @@ class Nt {
5685
5724
  }
5686
5725
  _cloneInto(e) {
5687
5726
  const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
5688
- return e || (e = new Nt(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;
5689
5728
  }
5690
5729
  }
5691
- const ti = (s, e, r, t = {}) => yr(() => new Nt(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;
5692
5731
  class si {
5693
5732
  constructor() {
5694
5733
  this.jwks = null;
@@ -5958,8 +5997,8 @@ class Ae {
5958
5997
  return;
5959
5998
  }
5960
5999
  const m = { token: D, email: F }, y = (k) => {
5961
- Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((N) => {
5962
- d.error("[CROSSx] nonce 검증 실패:", N), t(N instanceof Error ? N : 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"));
5963
6002
  });
5964
6003
  };
5965
6004
  H ? H.split(".").length === 3 ? y(H) : Q ? y(Q) : (d.warn(
@@ -5971,7 +6010,7 @@ class Ae {
5971
6010
  });
5972
6011
  }
5973
6012
  }
5974
- const Fe = "crossx_wallet_data", Oe = "crossx_mock_pin_hash";
6013
+ const Fe = "crossx_wallet_data", Ne = "crossx_mock_pin_hash";
5975
6014
  class li {
5976
6015
  constructor(e, r) {
5977
6016
  this.storage = e, this.pinStore = r ?? null;
@@ -6001,7 +6040,7 @@ class li {
6001
6040
  };
6002
6041
  await this.storage.set(Fe, n);
6003
6042
  const i = (r = this.pinStore) == null ? void 0 : r.get();
6004
- 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;
6005
6044
  } catch (t) {
6006
6045
  throw new f(h.WALLET_CREATION_FAILED, "지갑 생성에 실패했습니다", t);
6007
6046
  }
@@ -6043,8 +6082,8 @@ class li {
6043
6082
  var t;
6044
6083
  if (d.log("[Mock] verifyPin"), this.pinScenario === "wrong")
6045
6084
  return !1;
6046
- const r = await this.storage.get(Oe);
6047
- 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);
6048
6087
  }
6049
6088
  /**
6050
6089
  * POST /mnemonic/change-password 모킹
@@ -6054,10 +6093,10 @@ class li {
6054
6093
  var i;
6055
6094
  if (d.log("[Mock] changePin"), this.pinScenario === "wrong")
6056
6095
  throw new f(h.PIN_WRONG, "Incorrect PIN.");
6057
- 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);
6058
6097
  if (n && t && n !== t)
6059
6098
  throw new f(h.PIN_WRONG, "Incorrect PIN.");
6060
- await this.storage.set(Oe, r), d.log("[Mock] changePin 완료");
6099
+ await this.storage.set(Ne, r), d.log("[Mock] changePin 완료");
6061
6100
  }
6062
6101
  async migrateWallet(e, r) {
6063
6102
  var i;
@@ -6090,7 +6129,7 @@ class li {
6090
6129
  };
6091
6130
  await this.storage.set(Fe, t);
6092
6131
  const n = (i = this.pinStore) == null ? void 0 : i.get();
6093
- 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;
6094
6133
  }
6095
6134
  /**
6096
6135
  * POST /mnemonic/share-c 모킹
@@ -9365,7 +9404,7 @@ function ki(s) {
9365
9404
  function Ri(s) {
9366
9405
  return s.includes(":") ? s.split(":")[1] ?? s : s;
9367
9406
  }
9368
- function Oi(s) {
9407
+ function Ni(s) {
9369
9408
  return `https://www.crossscan.io/address/${s}?tab=txs`;
9370
9409
  }
9371
9410
  function Ci(s, e) {
@@ -9375,12 +9414,12 @@ function Jr(s, e) {
9375
9414
  return `<a class="__crossx-addr-text __crossx-row-link" href="${A(e)}" target="_blank" rel="noopener noreferrer">${A(s)}</a>`;
9376
9415
  }
9377
9416
  function Ze(s) {
9378
- return Jr(de(s), Oi(s));
9417
+ return Jr(de(s), Ni(s));
9379
9418
  }
9380
9419
  function Zr(s, e) {
9381
9420
  return Jr(de(e), Ci(s, e));
9382
9421
  }
9383
- function Ni(s, e, r) {
9422
+ function Oi(s, e, r) {
9384
9423
  const t = j(
9385
9424
  (r == null ? void 0 : r.label_from) ?? "From",
9386
9425
  `${Ze(s.from)}
@@ -9902,13 +9941,13 @@ function to(s) {
9902
9941
  return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
9903
9942
  }
9904
9943
  function _t(s, e, r, t, n, i, o) {
9905
- var N, B;
9944
+ var O, B;
9906
9945
  let a = !!(i && i > Date.now()), c = !1;
9907
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 = () => {
9908
9947
  var E;
9909
9948
  const b = l(), v = S();
9910
- if (v.length && (v.forEach((T, O) => {
9911
- const W = !!(b[O] && b[O].value);
9949
+ if (v.length && (v.forEach((T, N) => {
9950
+ const W = !!(b[N] && b[N].value);
9912
9951
  T.classList.toggle("--filled", W), T.classList.toggle("--active", !1);
9913
9952
  }), !a && !c)) {
9914
9953
  const T = b.findIndex((W) => !W.value);
@@ -9940,8 +9979,8 @@ function _t(s, e, r, t, n, i, o) {
9940
9979
  let E = L();
9941
9980
  if (!E) {
9942
9981
  E = document.createElement("p"), E.className = "__crossx-pin6-attempt", E.id = "__crossx-pin6-attempt";
9943
- const O = J() ?? p();
9944
- 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);
9945
9984
  }
9946
9985
  E.textContent = `${b}/${v}`;
9947
9986
  }, H = () => {
@@ -9978,10 +10017,10 @@ function _t(s, e, r, t, n, i, o) {
9978
10017
  }, 50)) : $ && ($.textContent = ` ${to(U)}`);
9979
10018
  }, T = setInterval(E, 1e3);
9980
10019
  E();
9981
- const O = new MutationObserver(() => {
9982
- document.contains(s) || (clearInterval(T), O.disconnect());
10020
+ const N = new MutationObserver(() => {
10021
+ document.contains(s) || (clearInterval(T), N.disconnect());
9983
10022
  });
9984
- O.observe(document.body, { childList: !0, subtree: !1 });
10023
+ N.observe(document.body, { childList: !0, subtree: !1 });
9985
10024
  }, m = async () => {
9986
10025
  if (a || c) return;
9987
10026
  const b = w();
@@ -10013,7 +10052,7 @@ function _t(s, e, r, t, n, i, o) {
10013
10052
  const b = l(), v = b.find((E) => !E.value) ?? b[b.length - 1];
10014
10053
  v == null || v.focus();
10015
10054
  };
10016
- (N = u()) == null || N.addEventListener("click", (b) => {
10055
+ (O = u()) == null || O.addEventListener("click", (b) => {
10017
10056
  b.target.classList.contains("__crossx-pin6-box") || y();
10018
10057
  }), (B = x()) == null || B.addEventListener("click", (b) => {
10019
10058
  const v = b.target;
@@ -10024,7 +10063,7 @@ function _t(s, e, r, t, n, i, o) {
10024
10063
  const E = b.value.replace(/\D/g, "").slice(-1);
10025
10064
  b.value = E, M(), E && v < 5 && ((T = l()[v + 1]) == null || T.focus()), I(), w().length === 6 && setTimeout(m, 80);
10026
10065
  }), b.addEventListener("keydown", (E) => {
10027
- var T, O;
10066
+ var T, N;
10028
10067
  if (E.key === "Backspace") {
10029
10068
  if (E.preventDefault(), b.value)
10030
10069
  b.value = "";
@@ -10033,16 +10072,16 @@ function _t(s, e, r, t, n, i, o) {
10033
10072
  W.value = "", W.focus();
10034
10073
  }
10035
10074
  I();
10036
- } 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();
10037
10076
  }), b.addEventListener("paste", (E) => {
10038
10077
  var W, U;
10039
10078
  E.preventDefault();
10040
10079
  const T = (((W = E.clipboardData) == null ? void 0 : W.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
10041
10080
  if (!T) return;
10042
- const O = l();
10081
+ const N = l();
10043
10082
  T.split("").forEach(($, K) => {
10044
- O[K] && (O[K].value = $);
10045
- }), (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);
10046
10085
  }), b.addEventListener("focus", () => b.select());
10047
10086
  });
10048
10087
  const k = s.querySelector("#__crossx-pin6-numpad");
@@ -10052,27 +10091,27 @@ function _t(s, e, r, t, n, i, o) {
10052
10091
  b && (b.classList.remove("--pressed"), b = null);
10053
10092
  };
10054
10093
  k.addEventListener("pointerdown", (T) => {
10055
- const O = T.target.closest(".__crossx-pin6-numpad-key");
10056
- !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));
10057
10096
  });
10058
10097
  const E = (T) => {
10059
- const O = T.dataset.key;
10060
- if (!O) return;
10061
- if (O === "backspace") {
10098
+ const N = T.dataset.key;
10099
+ if (!N) return;
10100
+ if (N === "backspace") {
10062
10101
  const K = [...l()].reverse().find((Y) => Y.value);
10063
10102
  K && (K.value = "", M()), I();
10064
10103
  return;
10065
10104
  }
10066
- if (!/^\d$/.test(O)) return;
10105
+ if (!/^\d$/.test(N)) return;
10067
10106
  const U = l().find(($) => !$.value);
10068
- 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));
10069
10108
  };
10070
10109
  k.addEventListener("pointerup", (T) => {
10071
10110
  if (!b) return;
10072
- const O = b;
10111
+ const N = b;
10073
10112
  v();
10074
- const W = O.getBoundingClientRect();
10075
- T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(O);
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);
10076
10115
  }), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() && C();
10077
10116
  }
10078
10117
  }
@@ -10498,7 +10537,7 @@ class oo {
10498
10537
  return new Promise((r) => {
10499
10538
  var a, c;
10500
10539
  ae();
10501
- const t = Ni(e, this.tokens, this.messages);
10540
+ const t = Oi(e, this.tokens, this.messages);
10502
10541
  ce(t);
10503
10542
  const n = () => t.remove(), i = () => {
10504
10543
  n(), r();