@nexus-cross/crossx-sdk-core 1.2.5 → 1.2.7

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
@@ -1,8 +1,8 @@
1
- var Os = Object.defineProperty;
2
- var Ls = (r, e, s) => e in r ? Os(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
- var T = (r, e, s) => Ls(r, typeof e != "symbol" ? e + "" : e, s);
4
- import { createRemoteJWKSet as Ds, jwtVerify as Ms, decodeJwt as $s } from "jose";
5
- var p = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_CANCELLED = "PIN_CANCELLED", r.PIN_LOCKED = "PIN_LOCKED", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(p || {});
1
+ var Ls = Object.defineProperty;
2
+ var Ds = (r, e, s) => e in r ? Ls(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var A = (r, e, s) => Ds(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import { createRemoteJWKSet as Ms, jwtVerify as $s, decodeJwt as Bs } from "jose";
5
+ var p = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(p || {});
6
6
  class g extends Error {
7
7
  constructor(e, s, t) {
8
8
  super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, g.prototype);
@@ -16,7 +16,7 @@ class g extends Error {
16
16
  };
17
17
  }
18
18
  }
19
- const Ke = {
19
+ const Ve = {
20
20
  // ─── CROSS ────────────────────────────────────────────
21
21
  CROSS_MAINNET: {
22
22
  caipId: "eip155:612055",
@@ -65,20 +65,20 @@ const Ke = {
65
65
  rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
66
66
  testnet: !0
67
67
  }
68
- }, eo = Object.fromEntries(
69
- Object.entries(Ke).map(([r, e]) => [r, e.caipId])
70
- ), Bs = new Map(
71
- Object.values(Ke).map((r) => [r.caipId, r])
68
+ }, to = Object.fromEntries(
69
+ Object.entries(Ve).map(([r, e]) => [r, e.caipId])
70
+ ), Us = new Map(
71
+ Object.values(Ve).map((r) => [r.caipId, r])
72
72
  );
73
73
  new Map(
74
- Object.values(Ke).map((r) => [r.chainId, r])
74
+ Object.values(Ve).map((r) => [r.chainId, r])
75
75
  );
76
- const Us = { symbol: "", decimals: 18 };
77
- function Ye(r) {
76
+ const Hs = { symbol: "", decimals: 18 };
77
+ function Je(r) {
78
78
  var e;
79
- return ((e = Bs.get(r)) == null ? void 0 : e.nativeCurrency) ?? Us;
79
+ return ((e = Us.get(r)) == null ? void 0 : e.nativeCurrency) ?? Hs;
80
80
  }
81
- class Hs {
81
+ class Fs {
82
82
  constructor(e, s) {
83
83
  this.sdk = e, this.chainId = s, this._listeners = /* @__PURE__ */ new Map();
84
84
  }
@@ -167,30 +167,30 @@ class Hs {
167
167
  };
168
168
  }
169
169
  }
170
- let Se = null;
171
- function bt(r) {
172
- Se = r;
170
+ let Ee = null;
171
+ function vt(r) {
172
+ Ee = r;
173
173
  }
174
174
  const u = {
175
175
  log(...r) {
176
- if (Se) {
177
- Se.log(...r);
176
+ if (Ee) {
177
+ Ee.log(...r);
178
178
  return;
179
179
  }
180
180
  },
181
181
  warn(...r) {
182
- if (Se) {
183
- Se.warn(...r);
182
+ if (Ee) {
183
+ Ee.warn(...r);
184
184
  return;
185
185
  }
186
186
  },
187
187
  error(...r) {
188
- if (Se) {
189
- Se.error(...r);
188
+ if (Ee) {
189
+ Ee.error(...r);
190
190
  return;
191
191
  }
192
192
  }
193
- }, Fs = {
193
+ }, Gs = {
194
194
  // ── 공통 버튼 ────────────────────────────────────────────────
195
195
  confirm: "확인",
196
196
  cancel: "취소",
@@ -255,7 +255,7 @@ const u = {
255
255
  // ── PIN 잠금 안내 ─────────────────────────────────────────────
256
256
  pinLocked_message: "잠금이 해제된 후 다시 시도해 주세요.",
257
257
  pinLocked_availableFrom: "이용 가능 시간"
258
- }, Xt = {
258
+ }, Qt = {
259
259
  // ── Common buttons ───────────────────────────────────────────
260
260
  confirm: "Confirm",
261
261
  cancel: "Cancel",
@@ -320,15 +320,15 @@ const u = {
320
320
  // ── PIN lock message ─────────────────────────────────────────
321
321
  pinLocked_message: "Please try again after the lock expires.",
322
322
  pinLocked_availableFrom: "Available from"
323
- }, Gs = {
324
- ko: Fs,
325
- en: Xt
323
+ }, Ws = {
324
+ ko: Gs,
325
+ en: Qt
326
326
  };
327
- function vt(r = "en", e) {
328
- return Gs[r] ?? Xt;
327
+ function St(r = "en", e) {
328
+ return Ws[r] ?? Qt;
329
329
  }
330
- const St = "crossx_access_token", Et = "crossx_refresh_token", It = "crossx_user_info";
331
- class Ws {
330
+ const Et = "crossx_access_token", It = "crossx_refresh_token", At = "crossx_user_info";
331
+ class qs {
332
332
  constructor(e, s, t, n, o, i, a) {
333
333
  this.config = e, this.storage = s, this.crypto = t, this.oauth = n, this.transport = o, this.walletProvider = i, this.tokenStore = a, this._refreshPromise = null, this._migrated = !1;
334
334
  const c = e.projectId;
@@ -405,8 +405,8 @@ class Ws {
405
405
  }, u.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
406
406
  }
407
407
  u.log("[CROSSx] 사용자 정보 — id:", s.id);
408
- const O = this.useCookieAuth ? { id: s.id, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
409
- await this.storage.set(this.STORAGE_KEY_USER, O), u.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
408
+ const C = this.useCookieAuth ? { id: s.id, signInProvider: s.signInProvider, providerSub: s.providerSub } : s;
409
+ await this.storage.set(this.STORAGE_KEY_USER, C), u.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
410
410
  } catch (c) {
411
411
  return u.error("[CROSSx] SignIn 에러 (OAuth/토큰 교환 단계):", c), {
412
412
  success: !1,
@@ -618,13 +618,13 @@ class Ws {
618
618
  if (!this._migrated) {
619
619
  this._migrated = !0;
620
620
  try {
621
- const e = await this.storage.get(It);
621
+ const e = await this.storage.get(At);
622
622
  if (!e || await this.storage.get(this.STORAGE_KEY_USER)) return;
623
623
  await this.storage.set(this.STORAGE_KEY_USER, e);
624
- const t = await this.storage.get(St);
624
+ const t = await this.storage.get(Et);
625
625
  t && await this.storage.set(this.STORAGE_KEY_ACCESS_TOKEN, t);
626
- const n = await this.storage.get(Et);
627
- n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(It), await this.storage.remove(St), await this.storage.remove(Et), u.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
626
+ const n = await this.storage.get(It);
627
+ n && await this.storage.set(this.STORAGE_KEY_REFRESH_TOKEN, n), await this.storage.remove(At), await this.storage.remove(Et), await this.storage.remove(It), u.log("[CROSSx] 스토리지 키 마이그레이션 완료 (projectId 스코프)");
628
628
  } catch (e) {
629
629
  u.warn("[CROSSx] 스토리지 키 마이그레이션 실패:", e);
630
630
  }
@@ -659,7 +659,7 @@ class Ws {
659
659
  return u.log("[CROSSx] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
660
660
  }
661
661
  }
662
- class qs {
662
+ class Ks {
663
663
  constructor(e, s, t) {
664
664
  this.config = e, this.storage = s, this.tokenStore = t;
665
665
  const n = e.projectId;
@@ -669,7 +669,7 @@ class qs {
669
669
  this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(this.STORAGE_KEY_ACCESS_TOKEN), await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)), await this.storage.remove(this.STORAGE_KEY_USER), await this.storage.clear();
670
670
  }
671
671
  }
672
- class Ks {
672
+ class Vs {
673
673
  constructor(e, s) {
674
674
  this.storage = e, this.walletProvider = s;
675
675
  }
@@ -686,7 +686,7 @@ class Ks {
686
686
  };
687
687
  }
688
688
  }
689
- class Qt {
689
+ class es {
690
690
  constructor() {
691
691
  this.encryptedBytes = null, this.xorKey = null;
692
692
  }
@@ -727,7 +727,7 @@ class Qt {
727
727
  return this.encryptedBytes !== null;
728
728
  }
729
729
  }
730
- class Vs {
730
+ class zs {
731
731
  constructor(e, s) {
732
732
  this.chainRegistry = e, this.transport = s, this._nextId = 1;
733
733
  }
@@ -759,7 +759,7 @@ class Vs {
759
759
  return a == null ? void 0 : a.result;
760
760
  }
761
761
  }
762
- class zs {
762
+ class js {
763
763
  constructor() {
764
764
  this.listeners = /* @__PURE__ */ new Map();
765
765
  }
@@ -782,7 +782,7 @@ class zs {
782
782
  this.listeners.clear();
783
783
  }
784
784
  }
785
- const Fe = {
785
+ const Ge = {
786
786
  // TODO(v2.0.0-BEFORE-RELEASE): 아래 블록으로 교체
787
787
  // production: {
788
788
  // oauthServiceUrl: 'https://cross-wallet-oauth.crosstoken.io',
@@ -805,24 +805,24 @@ const Fe = {
805
805
  walletGatewayUrl: "https://dev-embedded-wallet-gateway.crosstoken.io/api/v1"
806
806
  }
807
807
  };
808
- function js(r) {
808
+ function Ys(r) {
809
809
  const e = r.environment;
810
- return e && e in Fe ? Fe[e] : null;
810
+ return e && e in Ge ? Ge[e] : null;
811
811
  }
812
- function Ys() {
812
+ function Js() {
813
813
  try {
814
814
  if (typeof __CROSSX_CONFIG__ < "u") {
815
- const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = js(r);
815
+ const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Ys(r);
816
816
  if (e) return e;
817
817
  }
818
818
  } catch {
819
819
  }
820
- return Fe.production;
820
+ return Ge.production;
821
821
  }
822
- const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA00", Rt = 130, kt = 6, Pt = 18, er = 5 * 60 * 1e3, tr = 30 * 1e3, re = class re extends zs {
822
+ const Xs = 2e3, Tt = 6e4, Zs = 1e3, Qs = 1e4, er = "0x77359400", Rt = "0x3B9ACA00", kt = 130, Pt = 6, Nt = 18, tr = 5 * 60 * 1e3, sr = 30 * 1e3, re = class re extends js {
823
823
  constructor(e, s, t, n, o, i, a, c, l, d, h) {
824
824
  var m;
825
- super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && bt(e.logger), this.confirmation = l, this.pinStore = h ?? new Qt(), this.chainRegistry = d, this.jsonRpc = new Vs(d, o), this.signInUseCase = new Ws(
825
+ super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._verifyPinMutex = null, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && vt(e.logger), this.confirmation = l, this.pinStore = h ?? new es(), this.chainRegistry = d, this.jsonRpc = new zs(d, o), this.signInUseCase = new qs(
826
826
  this.internalConfig,
827
827
  t,
828
828
  n,
@@ -830,7 +830,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
830
830
  o,
831
831
  a,
832
832
  c
833
- ), this.signOutUseCase = new qs(this.internalConfig, t, c), this.migrateWalletUseCase = new Ks(t, a), (m = a.setOnUnauthorized) == null || m.call(a, () => this.forceLogout());
833
+ ), this.signOutUseCase = new Ks(this.internalConfig, t, c), this.migrateWalletUseCase = new Vs(t, a), (m = a.setOnUnauthorized) == null || m.call(a, () => this.forceLogout());
834
834
  }
835
835
  get config() {
836
836
  return this._config;
@@ -856,9 +856,9 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
856
856
  }
857
857
  async _doInitialize(e) {
858
858
  var s, t;
859
- u.log("[CROSSx SDK] v1.2.5 초기화 중..."), this.confirmation.setMessages(vt(this._config.locale));
859
+ u.log("[CROSSx SDK] v1.2.7 초기화 중..."), this.confirmation.setMessages(St(this._config.locale));
860
860
  try {
861
- const n = Ys();
861
+ const n = Js();
862
862
  this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
863
863
  const o = await this.signInUseCase.restoreSession();
864
864
  if (o != null && o.success) {
@@ -1228,7 +1228,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1228
1228
  * sdk.applyLocale('ko');
1229
1229
  */
1230
1230
  applyLocale(e = this._config.locale ?? "en") {
1231
- this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(vt(e));
1231
+ this._config = Object.freeze({ ...this._config, locale: e }), this.confirmation.setMessages(St(e));
1232
1232
  }
1233
1233
  /**
1234
1234
  * 지갑 생성/로드 (로그인 후 address가 없는 경우)
@@ -1325,7 +1325,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1325
1325
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1326
1326
  accountName: t == null ? void 0 : t.accountName
1327
1327
  }))
1328
- throw new g(p.USER_REJECTED, "사용자가 메시지 서명을 거부했습니다");
1328
+ throw new g(p.USER_REJECTED, "User rejected the message signing request");
1329
1329
  try {
1330
1330
  const i = await this.withPinRetry(async () => {
1331
1331
  let a;
@@ -1384,7 +1384,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1384
1384
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1385
1385
  accountName: t == null ? void 0 : t.accountName
1386
1386
  }))
1387
- throw new g(p.USER_REJECTED, "사용자가 타입 데이터 서명을 거부했습니다");
1387
+ throw new g(p.USER_REJECTED, "User rejected the typed data signing request");
1388
1388
  try {
1389
1389
  const i = await this.withPinRetry(async () => {
1390
1390
  let a;
@@ -1442,7 +1442,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1442
1442
  throw new g(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1443
1443
  const n = await this.withResolvedGasAndFee(s, e);
1444
1444
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1445
- const o = Ye(e);
1445
+ const o = Je(e);
1446
1446
  if (!await this.confirmation.requestConfirmation({
1447
1447
  type: "sign",
1448
1448
  chainId: e,
@@ -1459,7 +1459,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1459
1459
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1460
1460
  accountName: t == null ? void 0 : t.accountName
1461
1461
  }))
1462
- throw new g(p.USER_REJECTED, "사용자가 트랜잭션 서명을 거부했습니다");
1462
+ throw new g(p.USER_REJECTED, "User rejected the transaction signing request");
1463
1463
  try {
1464
1464
  const a = await this.withPinRetry(async () => {
1465
1465
  let c;
@@ -1497,7 +1497,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1497
1497
  throw new g(p.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
1498
1498
  const n = await this.withResolvedGasAndFee(s, e);
1499
1499
  n.from || (n.from = (await this.resolveAddress(t == null ? void 0 : t.index)).address);
1500
- const o = Ye(e);
1500
+ const o = Je(e);
1501
1501
  if (!await this.confirmation.requestConfirmation({
1502
1502
  type: "send",
1503
1503
  chainId: e,
@@ -1514,7 +1514,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1514
1514
  dappName: (t == null ? void 0 : t.dappName) ?? this._config.appName,
1515
1515
  accountName: t == null ? void 0 : t.accountName
1516
1516
  }))
1517
- throw new g(p.USER_REJECTED, "사용자가 트랜잭션을 거부했습니다");
1517
+ throw new g(p.USER_REJECTED, "User rejected the transaction request");
1518
1518
  try {
1519
1519
  const a = await this.withPinRetry(async () => {
1520
1520
  let c;
@@ -1564,7 +1564,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1564
1564
  * @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
1565
1565
  */
1566
1566
  async waitForTxAndGetReceipt(e, s, t = {}) {
1567
- const n = t.intervalMs ?? Zs, o = Xs, i = t.timeoutMs ?? Tt, a = Date.now() + i;
1567
+ const n = t.intervalMs ?? Zs, o = Qs, i = t.timeoutMs ?? Tt, a = Date.now() + i;
1568
1568
  let c = n;
1569
1569
  for (; Date.now() < a; ) {
1570
1570
  const l = await this.getTransactionReceipt(e, s);
@@ -1593,11 +1593,11 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1593
1593
  */
1594
1594
  async sendTransactionWithWaitForReceipt(e, s, t = {}) {
1595
1595
  var E, y;
1596
- const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((E = this._config.receiptPolling) == null ? void 0 : E.intervalMs) ?? Js, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Tt, d = Ye(e), h = s.from ?? "";
1596
+ const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((E = this._config.receiptPolling) == null ? void 0 : E.intervalMs) ?? Xs, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? Tt, d = Je(e), h = s.from ?? "";
1597
1597
  let m, x;
1598
1598
  const w = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((S) => {
1599
1599
  m = S;
1600
- const O = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, b = re.formatTxAmount(s.value, d.symbol, d.decimals), k = re.formatTxAmount("0x" + O.toString(16), d.symbol, d.decimals), P = re.formatTxAmount("0x" + (B + O).toString(16), d.symbol, d.decimals);
1600
+ const C = BigInt(S.gasUsed) * BigInt(S.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, b = re.formatTxAmount(s.value, d.symbol, d.decimals), k = re.formatTxAmount("0x" + C.toString(16), d.symbol, d.decimals), P = re.formatTxAmount("0x" + (B + C).toString(16), d.symbol, d.decimals);
1601
1601
  return {
1602
1602
  chainId: e,
1603
1603
  txHash: a,
@@ -1804,7 +1804,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1804
1804
  try {
1805
1805
  const s = BigInt(e);
1806
1806
  if (s === 0n) return "0";
1807
- const t = 10n ** BigInt(Pt), n = s / t, i = (s % t).toString().padStart(Pt, "0").replace(/0+$/, "").slice(0, kt);
1807
+ const t = 10n ** BigInt(Nt), n = s / t, i = (s % t).toString().padStart(Nt, "0").replace(/0+$/, "").slice(0, Pt);
1808
1808
  return i ? `${n}.${i}` : `${n}`;
1809
1809
  } catch {
1810
1810
  return "?";
@@ -1829,7 +1829,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1829
1829
  * const client = createWalletClient({ transport: custom(provider) });
1830
1830
  */
1831
1831
  getProvider(e) {
1832
- return this.ensureAuthenticated(), new Hs(this, e);
1832
+ return this.ensureAuthenticated(), new Fs(this, e);
1833
1833
  }
1834
1834
  /**
1835
1835
  * 범용 JSON-RPC 요청 — 노드에 직접 연결.
@@ -1863,7 +1863,7 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1863
1863
  try {
1864
1864
  const n = BigInt(e);
1865
1865
  if (n === 0n) return;
1866
- const o = 10n ** BigInt(t), i = n / o, c = (n % o).toString().padStart(t, "0").slice(0, kt).replace(/0+$/, "");
1866
+ const o = 10n ** BigInt(t), i = n / o, c = (n % o).toString().padStart(t, "0").slice(0, Pt).replace(/0+$/, "");
1867
1867
  return `${c ? `${i}.${c}` : `${i}`} ${s}`;
1868
1868
  } catch {
1869
1869
  return;
@@ -1963,12 +1963,12 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
1963
1963
  u.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
1964
1964
  const l = await this.getBaseFeePerGas(s);
1965
1965
  if (l) {
1966
- const d = At;
1966
+ const d = Rt;
1967
1967
  c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, u.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
1968
1968
  } else
1969
- c.gasPrice = Qs, u.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1969
+ c.gasPrice = er, u.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
1970
1970
  }
1971
- return !i && a && (c.maxPriorityFeePerGas = At, u.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1971
+ return !i && a && (c.maxPriorityFeePerGas = Rt, u.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
1972
1972
  }
1973
1973
  /**
1974
1974
  * EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
@@ -2015,10 +2015,10 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
2015
2015
  const s = e.startsWith("0x") ? e.slice(2) : e;
2016
2016
  if (!/^[0-9a-fA-F]+$/.test(s))
2017
2017
  throw new g(p.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
2018
- if (s.length !== Rt)
2018
+ if (s.length !== kt)
2019
2019
  throw new g(
2020
2020
  p.SIGNATURE_FAILED,
2021
- `서명 길이가 유효하지 않습니다: ${Rt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2021
+ `서명 길이가 유효하지 않습니다: ${kt} hex 문자(65 바이트) 예상, 현재 ${s.length}`
2022
2022
  );
2023
2023
  }
2024
2024
  /** RLP-encoded signed transaction 형식 검증 */
@@ -2290,12 +2290,29 @@ const Js = 2e3, Tt = 6e4, Zs = 1e3, Xs = 1e4, Qs = "0x77359400", At = "0x3B9ACA0
2290
2290
  * dispose 후 SDK 인스턴스는 더 이상 사용할 수 없습니다.
2291
2291
  */
2292
2292
  dispose() {
2293
- this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), bt(null);
2293
+ this.clearAuthState(), this.tokenStore.clear(), this.pinStore.clear(), this.initialized = !1, this.removeAllListeners(), vt(null);
2294
+ }
2295
+ /**
2296
+ * @internal internal 패키지 전용 — 공개 문서에 기재하지 않음
2297
+ *
2298
+ * Internal/Private SDK가 Core의 내부 인프라에 접근하기 위한 컨텍스트를 반환합니다.
2299
+ * iOS SDK의 makePrivateContext()에 대응합니다.
2300
+ */
2301
+ _getInternalContext() {
2302
+ return {
2303
+ transport: this.transport,
2304
+ storage: this.storage,
2305
+ walletProvider: this.walletProvider,
2306
+ confirmation: this.confirmation,
2307
+ tokenStore: this.tokenStore,
2308
+ pinStore: this.pinStore,
2309
+ adapterConfig: this.adapterConfig
2310
+ };
2294
2311
  }
2295
2312
  };
2296
2313
  re.OFFCHAIN_CHAIN_ID = "0";
2297
- let ot = re;
2298
- class sr {
2314
+ let it = re;
2315
+ class rr {
2299
2316
  constructor() {
2300
2317
  this.prefix = "crossx_";
2301
2318
  }
@@ -2332,8 +2349,8 @@ class sr {
2332
2349
  }
2333
2350
  }
2334
2351
  }
2335
- const Je = "crossx-sdk", rr = 1, de = "data", ve = "keys", Me = "aes-primary", nr = 12;
2336
- class Ct {
2352
+ const Xe = "crossx-sdk", nr = 1, de = "data", Se = "keys", $e = "aes-primary", or = 12;
2353
+ class Ot {
2337
2354
  constructor(e) {
2338
2355
  this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
2339
2356
  }
@@ -2342,10 +2359,10 @@ class Ct {
2342
2359
  }
2343
2360
  openDB(e = this.dbName) {
2344
2361
  return new Promise((s, t) => {
2345
- const n = indexedDB.open(e, rr);
2362
+ const n = indexedDB.open(e, nr);
2346
2363
  n.onupgradeneeded = () => {
2347
2364
  const o = n.result;
2348
- o.objectStoreNames.contains(de) || o.createObjectStore(de), o.objectStoreNames.contains(ve) || o.createObjectStore(ve);
2365
+ o.objectStoreNames.contains(de) || o.createObjectStore(de), o.objectStoreNames.contains(Se) || o.createObjectStore(Se);
2349
2366
  }, n.onsuccess = () => s(n.result), n.onerror = () => t(n.error);
2350
2367
  });
2351
2368
  }
@@ -2375,7 +2392,7 @@ class Ct {
2375
2392
  }
2376
2393
  async init() {
2377
2394
  this.db = await this.openDB();
2378
- const e = await this.idbGet(ve, Me);
2395
+ const e = await this.idbGet(Se, $e);
2379
2396
  if (e) {
2380
2397
  this.cryptoKey = e;
2381
2398
  return;
@@ -2389,16 +2406,16 @@ class Ct {
2389
2406
  { name: "AES-GCM", length: 256 },
2390
2407
  !1,
2391
2408
  ["encrypt", "decrypt"]
2392
- ), await this.idbPut(ve, Me, this.cryptoKey);
2409
+ ), await this.idbPut(Se, $e, this.cryptoKey);
2393
2410
  }
2394
2411
  /**
2395
2412
  * 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
2396
2413
  * 마이그레이션 성공 시 레거시 DB 삭제.
2397
2414
  */
2398
2415
  async migrateFromLegacyDB() {
2399
- if (this.dbName === Je) return null;
2416
+ if (this.dbName === Xe) return null;
2400
2417
  try {
2401
- const e = await this.openDB(Je), s = e.transaction([ve, de], "readonly"), t = s.objectStore(ve).get(Me), n = await new Promise((l, d) => {
2418
+ const e = await this.openDB(Xe), s = e.transaction([Se, de], "readonly"), t = s.objectStore(Se).get($e), n = await new Promise((l, d) => {
2402
2419
  t.onsuccess = () => l(t.result), t.onerror = () => d(t.error);
2403
2420
  });
2404
2421
  if (!n)
@@ -2411,16 +2428,16 @@ class Ct {
2411
2428
  i.onsuccess = () => l(i.result), i.onerror = () => d(i.error);
2412
2429
  })
2413
2430
  ]);
2414
- e.close(), await this.idbPut(ve, Me, n);
2431
+ e.close(), await this.idbPut(Se, $e, n);
2415
2432
  for (let l = 0; l < c.length; l++)
2416
2433
  await this.idbPut(de, String(c[l]), a[l]);
2417
- return indexedDB.deleteDatabase(Je), u.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2434
+ return indexedDB.deleteDatabase(Xe), u.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
2418
2435
  } catch (e) {
2419
2436
  return u.warn("[CROSSx] IndexedDB 레거시 DB 마이그레이션 실패:", e), null;
2420
2437
  }
2421
2438
  }
2422
2439
  async encrypt(e) {
2423
- const s = new Uint8Array(nr);
2440
+ const s = new Uint8Array(or);
2424
2441
  crypto.getRandomValues(s);
2425
2442
  const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
2426
2443
  { name: "AES-GCM", iv: s },
@@ -2479,44 +2496,44 @@ class Ct {
2479
2496
  }
2480
2497
  }
2481
2498
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2482
- function dt(r) {
2499
+ function ut(r) {
2483
2500
  return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
2484
2501
  }
2485
- function xe(r, e = "") {
2502
+ function ge(r, e = "") {
2486
2503
  if (!Number.isSafeInteger(r) || r < 0) {
2487
2504
  const s = e && `"${e}" `;
2488
2505
  throw new Error(`${s}expected integer >= 0, got ${r}`);
2489
2506
  }
2490
2507
  }
2491
2508
  function V(r, e, s = "") {
2492
- const t = dt(r), n = r == null ? void 0 : r.length, o = e !== void 0;
2509
+ const t = ut(r), n = r == null ? void 0 : r.length, o = e !== void 0;
2493
2510
  if (!t || o && n !== e) {
2494
2511
  const i = s && `"${s}" `, a = o ? ` of length ${e}` : "", c = t ? `length=${n}` : `type=${typeof r}`;
2495
2512
  throw new Error(i + "expected Uint8Array" + a + ", got " + c);
2496
2513
  }
2497
2514
  return r;
2498
2515
  }
2499
- function es(r) {
2516
+ function ts(r) {
2500
2517
  if (typeof r != "function" || typeof r.create != "function")
2501
2518
  throw new Error("Hash must wrapped by utils.createHasher");
2502
- xe(r.outputLen), xe(r.blockLen);
2519
+ ge(r.outputLen), ge(r.blockLen);
2503
2520
  }
2504
- function Re(r, e = !0) {
2521
+ function ke(r, e = !0) {
2505
2522
  if (r.destroyed)
2506
2523
  throw new Error("Hash instance has been destroyed");
2507
2524
  if (e && r.finished)
2508
2525
  throw new Error("Hash#digest() has already been called");
2509
2526
  }
2510
- function ts(r, e) {
2527
+ function ss(r, e) {
2511
2528
  V(r, void 0, "digestInto() output");
2512
2529
  const s = e.outputLen;
2513
2530
  if (r.length < s)
2514
2531
  throw new Error('"digestInto() output" expected to be of length >=' + s);
2515
2532
  }
2516
- function or(r) {
2533
+ function ir(r) {
2517
2534
  return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
2518
2535
  }
2519
- function ke(...r) {
2536
+ function Pe(...r) {
2520
2537
  for (let e = 0; e < r.length; e++)
2521
2538
  r[e].fill(0);
2522
2539
  }
@@ -2526,44 +2543,44 @@ function Ze(r) {
2526
2543
  function ue(r, e) {
2527
2544
  return r << 32 - e | r >>> e;
2528
2545
  }
2529
- const ir = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2530
- function ar(r) {
2546
+ const ar = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
2547
+ function cr(r) {
2531
2548
  return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
2532
2549
  }
2533
- function cr(r) {
2550
+ function lr(r) {
2534
2551
  for (let e = 0; e < r.length; e++)
2535
- r[e] = ar(r[e]);
2552
+ r[e] = cr(r[e]);
2536
2553
  return r;
2537
2554
  }
2538
- const Nt = ir ? (r) => r : cr, ss = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", lr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2539
- function De(r) {
2540
- if (V(r), ss)
2555
+ const Ct = ar ? (r) => r : lr, rs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", dr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
2556
+ function Me(r) {
2557
+ if (V(r), rs)
2541
2558
  return r.toHex();
2542
2559
  let e = "";
2543
2560
  for (let s = 0; s < r.length; s++)
2544
- e += lr[r[s]];
2561
+ e += dr[r[s]];
2545
2562
  return e;
2546
2563
  }
2547
- const pe = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
2548
- function Ot(r) {
2549
- if (r >= pe._0 && r <= pe._9)
2550
- return r - pe._0;
2551
- if (r >= pe.A && r <= pe.F)
2552
- return r - (pe.A - 10);
2553
- if (r >= pe.a && r <= pe.f)
2554
- return r - (pe.a - 10);
2564
+ const fe = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
2565
+ function Lt(r) {
2566
+ if (r >= fe._0 && r <= fe._9)
2567
+ return r - fe._0;
2568
+ if (r >= fe.A && r <= fe.F)
2569
+ return r - (fe.A - 10);
2570
+ if (r >= fe.a && r <= fe.f)
2571
+ return r - (fe.a - 10);
2555
2572
  }
2556
- function Ge(r) {
2573
+ function We(r) {
2557
2574
  if (typeof r != "string")
2558
2575
  throw new Error("hex string expected, got " + typeof r);
2559
- if (ss)
2576
+ if (rs)
2560
2577
  return Uint8Array.fromHex(r);
2561
2578
  const e = r.length, s = e / 2;
2562
2579
  if (e % 2)
2563
2580
  throw new Error("hex string expected, got unpadded hex of length " + e);
2564
2581
  const t = new Uint8Array(s);
2565
2582
  for (let n = 0, o = 0; n < s; n++, o += 2) {
2566
- const i = Ot(r.charCodeAt(o)), a = Ot(r.charCodeAt(o + 1));
2583
+ const i = Lt(r.charCodeAt(o)), a = Lt(r.charCodeAt(o + 1));
2567
2584
  if (i === void 0 || a === void 0) {
2568
2585
  const c = r[o] + r[o + 1];
2569
2586
  throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + o);
@@ -2572,7 +2589,7 @@ function Ge(r) {
2572
2589
  }
2573
2590
  return t;
2574
2591
  }
2575
- function be(...r) {
2592
+ function ve(...r) {
2576
2593
  let e = 0;
2577
2594
  for (let t = 0; t < r.length; t++) {
2578
2595
  const n = r[t];
@@ -2585,42 +2602,42 @@ function be(...r) {
2585
2602
  }
2586
2603
  return s;
2587
2604
  }
2588
- function rs(r, e = {}) {
2605
+ function ns(r, e = {}) {
2589
2606
  const s = (n, o) => r(o).update(n).digest(), t = r(void 0);
2590
2607
  return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
2591
2608
  }
2592
- function ns(r = 32) {
2609
+ function os(r = 32) {
2593
2610
  const e = typeof globalThis == "object" ? globalThis.crypto : null;
2594
2611
  if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
2595
2612
  throw new Error("crypto.getRandomValues must be defined");
2596
2613
  return e.getRandomValues(new Uint8Array(r));
2597
2614
  }
2598
- const dr = (r) => ({
2615
+ const ur = (r) => ({
2599
2616
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
2600
2617
  });
2601
- function ur(r, e, s) {
2618
+ function hr(r, e, s) {
2602
2619
  return r & e ^ ~r & s;
2603
2620
  }
2604
- function hr(r, e, s) {
2621
+ function pr(r, e, s) {
2605
2622
  return r & e ^ r & s ^ e & s;
2606
2623
  }
2607
- class pr {
2624
+ class fr {
2608
2625
  constructor(e, s, t, n) {
2609
- T(this, "blockLen");
2610
- T(this, "outputLen");
2611
- T(this, "padOffset");
2612
- T(this, "isLE");
2626
+ A(this, "blockLen");
2627
+ A(this, "outputLen");
2628
+ A(this, "padOffset");
2629
+ A(this, "isLE");
2613
2630
  // For partial updates less than block size
2614
- T(this, "buffer");
2615
- T(this, "view");
2616
- T(this, "finished", !1);
2617
- T(this, "length", 0);
2618
- T(this, "pos", 0);
2619
- T(this, "destroyed", !1);
2631
+ A(this, "buffer");
2632
+ A(this, "view");
2633
+ A(this, "finished", !1);
2634
+ A(this, "length", 0);
2635
+ A(this, "pos", 0);
2636
+ A(this, "destroyed", !1);
2620
2637
  this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
2621
2638
  }
2622
2639
  update(e) {
2623
- Re(this), V(e);
2640
+ ke(this), V(e);
2624
2641
  const { view: s, buffer: t, blockLen: n } = this, o = e.length;
2625
2642
  for (let i = 0; i < o; ) {
2626
2643
  const a = Math.min(n - this.pos, o - i);
@@ -2635,10 +2652,10 @@ class pr {
2635
2652
  return this.length += e.length, this.roundClean(), this;
2636
2653
  }
2637
2654
  digestInto(e) {
2638
- Re(this), ts(e, this), this.finished = !0;
2655
+ ke(this), ss(e, this), this.finished = !0;
2639
2656
  const { buffer: s, view: t, blockLen: n, isLE: o } = this;
2640
2657
  let { pos: i } = this;
2641
- s[i++] = 128, ke(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
2658
+ s[i++] = 128, Pe(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
2642
2659
  for (let h = i; h < n; h++)
2643
2660
  s[h] = 0;
2644
2661
  t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
@@ -2666,7 +2683,7 @@ class pr {
2666
2683
  return this._cloneInto();
2667
2684
  }
2668
2685
  }
2669
- const ge = /* @__PURE__ */ Uint32Array.from([
2686
+ const me = /* @__PURE__ */ Uint32Array.from([
2670
2687
  1779033703,
2671
2688
  3144134277,
2672
2689
  1013904242,
@@ -2675,20 +2692,20 @@ const ge = /* @__PURE__ */ Uint32Array.from([
2675
2692
  2600822924,
2676
2693
  528734635,
2677
2694
  1541459225
2678
- ]), $e = /* @__PURE__ */ BigInt(2 ** 32 - 1), Lt = /* @__PURE__ */ BigInt(32);
2679
- function fr(r, e = !1) {
2680
- return e ? { h: Number(r & $e), l: Number(r >> Lt & $e) } : { h: Number(r >> Lt & $e) | 0, l: Number(r & $e) | 0 };
2681
- }
2695
+ ]), Be = /* @__PURE__ */ BigInt(2 ** 32 - 1), Dt = /* @__PURE__ */ BigInt(32);
2682
2696
  function _r(r, e = !1) {
2697
+ return e ? { h: Number(r & Be), l: Number(r >> Dt & Be) } : { h: Number(r >> Dt & Be) | 0, l: Number(r & Be) | 0 };
2698
+ }
2699
+ function xr(r, e = !1) {
2683
2700
  const s = r.length;
2684
2701
  let t = new Uint32Array(s), n = new Uint32Array(s);
2685
2702
  for (let o = 0; o < s; o++) {
2686
- const { h: i, l: a } = fr(r[o], e);
2703
+ const { h: i, l: a } = _r(r[o], e);
2687
2704
  [t[o], n[o]] = [i, a];
2688
2705
  }
2689
2706
  return [t, n];
2690
2707
  }
2691
- const xr = (r, e, s) => r << s | e >>> 32 - s, gr = (r, e, s) => e << s | r >>> 32 - s, mr = (r, e, s) => e << s - 32 | r >>> 64 - s, wr = (r, e, s) => r << s - 32 | e >>> 64 - s, yr = /* @__PURE__ */ Uint32Array.from([
2708
+ const gr = (r, e, s) => r << s | e >>> 32 - s, mr = (r, e, s) => e << s | r >>> 32 - s, wr = (r, e, s) => e << s - 32 | r >>> 64 - s, yr = (r, e, s) => r << s - 32 | e >>> 64 - s, br = /* @__PURE__ */ Uint32Array.from([
2692
2709
  1116352408,
2693
2710
  1899447441,
2694
2711
  3049323471,
@@ -2753,8 +2770,8 @@ const xr = (r, e, s) => r << s | e >>> 32 - s, gr = (r, e, s) => e << s | r >>>
2753
2770
  2756734187,
2754
2771
  3204031479,
2755
2772
  3329325298
2756
- ]), me = /* @__PURE__ */ new Uint32Array(64);
2757
- class br extends pr {
2773
+ ]), we = /* @__PURE__ */ new Uint32Array(64);
2774
+ class vr extends fr {
2758
2775
  constructor(e) {
2759
2776
  super(64, e, 8, !1);
2760
2777
  }
@@ -2768,112 +2785,112 @@ class br extends pr {
2768
2785
  }
2769
2786
  process(e, s) {
2770
2787
  for (let h = 0; h < 16; h++, s += 4)
2771
- me[h] = e.getUint32(s, !1);
2788
+ we[h] = e.getUint32(s, !1);
2772
2789
  for (let h = 16; h < 64; h++) {
2773
- const m = me[h - 15], x = me[h - 2], w = ue(m, 7) ^ ue(m, 18) ^ m >>> 3, E = ue(x, 17) ^ ue(x, 19) ^ x >>> 10;
2774
- me[h] = E + me[h - 7] + w + me[h - 16] | 0;
2790
+ const m = we[h - 15], x = we[h - 2], w = ue(m, 7) ^ ue(m, 18) ^ m >>> 3, E = ue(x, 17) ^ ue(x, 19) ^ x >>> 10;
2791
+ we[h] = E + we[h - 7] + w + we[h - 16] | 0;
2775
2792
  }
2776
2793
  let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
2777
2794
  for (let h = 0; h < 64; h++) {
2778
- const m = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), x = d + m + ur(a, c, l) + yr[h] + me[h] | 0, E = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + hr(t, n, o) | 0;
2795
+ const m = ue(a, 6) ^ ue(a, 11) ^ ue(a, 25), x = d + m + hr(a, c, l) + br[h] + we[h] | 0, E = (ue(t, 2) ^ ue(t, 13) ^ ue(t, 22)) + pr(t, n, o) | 0;
2779
2796
  d = l, l = c, c = a, a = i + x | 0, i = o, o = n, n = t, t = x + E | 0;
2780
2797
  }
2781
2798
  t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(t, n, o, i, a, c, l, d);
2782
2799
  }
2783
2800
  roundClean() {
2784
- ke(me);
2801
+ Pe(we);
2785
2802
  }
2786
2803
  destroy() {
2787
- this.set(0, 0, 0, 0, 0, 0, 0, 0), ke(this.buffer);
2804
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), Pe(this.buffer);
2788
2805
  }
2789
2806
  }
2790
- class vr extends br {
2807
+ class Sr extends vr {
2791
2808
  constructor() {
2792
2809
  super(32);
2793
2810
  // We cannot use array here since array allows indexing by variable
2794
2811
  // which means optimizer/compiler cannot use registers.
2795
- T(this, "A", ge[0] | 0);
2796
- T(this, "B", ge[1] | 0);
2797
- T(this, "C", ge[2] | 0);
2798
- T(this, "D", ge[3] | 0);
2799
- T(this, "E", ge[4] | 0);
2800
- T(this, "F", ge[5] | 0);
2801
- T(this, "G", ge[6] | 0);
2802
- T(this, "H", ge[7] | 0);
2803
- }
2804
- }
2805
- const Sr = /* @__PURE__ */ rs(
2806
- () => new vr(),
2807
- /* @__PURE__ */ dr(1)
2812
+ A(this, "A", me[0] | 0);
2813
+ A(this, "B", me[1] | 0);
2814
+ A(this, "C", me[2] | 0);
2815
+ A(this, "D", me[3] | 0);
2816
+ A(this, "E", me[4] | 0);
2817
+ A(this, "F", me[5] | 0);
2818
+ A(this, "G", me[6] | 0);
2819
+ A(this, "H", me[7] | 0);
2820
+ }
2821
+ }
2822
+ const Er = /* @__PURE__ */ ns(
2823
+ () => new Sr(),
2824
+ /* @__PURE__ */ ur(1)
2808
2825
  );
2809
2826
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2810
- const ut = /* @__PURE__ */ BigInt(0), it = /* @__PURE__ */ BigInt(1);
2811
- function We(r, e = "") {
2827
+ const ht = /* @__PURE__ */ BigInt(0), at = /* @__PURE__ */ BigInt(1);
2828
+ function qe(r, e = "") {
2812
2829
  if (typeof r != "boolean") {
2813
2830
  const s = e && `"${e}" `;
2814
2831
  throw new Error(s + "expected boolean, got type=" + typeof r);
2815
2832
  }
2816
2833
  return r;
2817
2834
  }
2818
- function os(r) {
2835
+ function is(r) {
2819
2836
  if (typeof r == "bigint") {
2820
- if (!He(r))
2837
+ if (!Fe(r))
2821
2838
  throw new Error("positive bigint expected, got " + r);
2822
2839
  } else
2823
- xe(r);
2840
+ ge(r);
2824
2841
  return r;
2825
2842
  }
2826
- function Be(r) {
2827
- const e = os(r).toString(16);
2843
+ function Ue(r) {
2844
+ const e = is(r).toString(16);
2828
2845
  return e.length & 1 ? "0" + e : e;
2829
2846
  }
2830
- function is(r) {
2847
+ function as(r) {
2831
2848
  if (typeof r != "string")
2832
2849
  throw new Error("hex string expected, got " + typeof r);
2833
- return r === "" ? ut : BigInt("0x" + r);
2850
+ return r === "" ? ht : BigInt("0x" + r);
2834
2851
  }
2835
- function Ve(r) {
2836
- return is(De(r));
2852
+ function ze(r) {
2853
+ return as(Me(r));
2837
2854
  }
2838
- function as(r) {
2839
- return is(De(Er(V(r)).reverse()));
2855
+ function cs(r) {
2856
+ return as(Me(Ir(V(r)).reverse()));
2840
2857
  }
2841
- function ht(r, e) {
2842
- xe(e), r = os(r);
2843
- const s = Ge(r.toString(16).padStart(e * 2, "0"));
2858
+ function pt(r, e) {
2859
+ ge(e), r = is(r);
2860
+ const s = We(r.toString(16).padStart(e * 2, "0"));
2844
2861
  if (s.length !== e)
2845
2862
  throw new Error("number too large");
2846
2863
  return s;
2847
2864
  }
2848
- function cs(r, e) {
2849
- return ht(r, e).reverse();
2865
+ function ls(r, e) {
2866
+ return pt(r, e).reverse();
2850
2867
  }
2851
- function Er(r) {
2868
+ function Ir(r) {
2852
2869
  return Uint8Array.from(r);
2853
2870
  }
2854
- const He = (r) => typeof r == "bigint" && ut <= r;
2855
- function Ir(r, e, s) {
2856
- return He(r) && He(e) && He(s) && e <= r && r < s;
2871
+ const Fe = (r) => typeof r == "bigint" && ht <= r;
2872
+ function Ar(r, e, s) {
2873
+ return Fe(r) && Fe(e) && Fe(s) && e <= r && r < s;
2857
2874
  }
2858
2875
  function Tr(r, e, s, t) {
2859
- if (!Ir(e, s, t))
2876
+ if (!Ar(e, s, t))
2860
2877
  throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
2861
2878
  }
2862
- function Ar(r) {
2879
+ function Rr(r) {
2863
2880
  let e;
2864
- for (e = 0; r > ut; r >>= it, e += 1)
2881
+ for (e = 0; r > ht; r >>= at, e += 1)
2865
2882
  ;
2866
2883
  return e;
2867
2884
  }
2868
- const pt = (r) => (it << BigInt(r)) - it;
2869
- function Rr(r, e, s) {
2870
- if (xe(r, "hashLen"), xe(e, "qByteLen"), typeof s != "function")
2885
+ const ft = (r) => (at << BigInt(r)) - at;
2886
+ function kr(r, e, s) {
2887
+ if (ge(r, "hashLen"), ge(e, "qByteLen"), typeof s != "function")
2871
2888
  throw new Error("hmacFn must be a function");
2872
2889
  const t = (y) => new Uint8Array(y), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
2873
2890
  let c = t(r), l = t(r), d = 0;
2874
2891
  const h = () => {
2875
2892
  c.fill(1), l.fill(0), d = 0;
2876
- }, m = (...y) => s(l, be(c, ...y)), x = (y = n) => {
2893
+ }, m = (...y) => s(l, ve(c, ...y)), x = (y = n) => {
2877
2894
  l = m(o, y), c = m(), y.length !== 0 && (l = m(i, y), c = m());
2878
2895
  }, w = () => {
2879
2896
  if (d++ >= a)
@@ -2882,20 +2899,20 @@ function Rr(r, e, s) {
2882
2899
  const S = [];
2883
2900
  for (; y < e; ) {
2884
2901
  c = m();
2885
- const O = c.slice();
2886
- S.push(O), y += c.length;
2902
+ const C = c.slice();
2903
+ S.push(C), y += c.length;
2887
2904
  }
2888
- return be(...S);
2905
+ return ve(...S);
2889
2906
  };
2890
2907
  return (y, S) => {
2891
2908
  h(), x(y);
2892
- let O;
2893
- for (; !(O = S(w())); )
2909
+ let C;
2910
+ for (; !(C = S(w())); )
2894
2911
  x();
2895
- return h(), O;
2912
+ return h(), C;
2896
2913
  };
2897
2914
  }
2898
- function ft(r, e = {}, s = {}) {
2915
+ function _t(r, e = {}, s = {}) {
2899
2916
  if (!r || typeof r != "object")
2900
2917
  throw new Error("expected valid options object");
2901
2918
  function t(o, i, a) {
@@ -2909,7 +2926,7 @@ function ft(r, e = {}, s = {}) {
2909
2926
  const n = (o, i) => Object.entries(o).forEach(([a, c]) => t(a, c, i));
2910
2927
  n(e, !1), n(s, !0);
2911
2928
  }
2912
- function Dt(r) {
2929
+ function Mt(r) {
2913
2930
  const e = /* @__PURE__ */ new WeakMap();
2914
2931
  return (s, ...t) => {
2915
2932
  const n = e.get(s);
@@ -2920,7 +2937,7 @@ function Dt(r) {
2920
2937
  };
2921
2938
  }
2922
2939
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2923
- const ne = /* @__PURE__ */ BigInt(0), ee = /* @__PURE__ */ BigInt(1), Ee = /* @__PURE__ */ BigInt(2), ls = /* @__PURE__ */ BigInt(3), ds = /* @__PURE__ */ BigInt(4), us = /* @__PURE__ */ BigInt(5), kr = /* @__PURE__ */ BigInt(7), hs = /* @__PURE__ */ BigInt(8), Pr = /* @__PURE__ */ BigInt(9), ps = /* @__PURE__ */ BigInt(16);
2940
+ const ne = /* @__PURE__ */ BigInt(0), ee = /* @__PURE__ */ BigInt(1), Ie = /* @__PURE__ */ BigInt(2), ds = /* @__PURE__ */ BigInt(3), us = /* @__PURE__ */ BigInt(4), hs = /* @__PURE__ */ BigInt(5), Pr = /* @__PURE__ */ BigInt(7), ps = /* @__PURE__ */ BigInt(8), Nr = /* @__PURE__ */ BigInt(9), fs = /* @__PURE__ */ BigInt(16);
2924
2941
  function le(r, e) {
2925
2942
  const s = r % e;
2926
2943
  return s >= ne ? s : e + s;
@@ -2931,7 +2948,7 @@ function ae(r, e, s) {
2931
2948
  t *= t, t %= s;
2932
2949
  return t;
2933
2950
  }
2934
- function Mt(r, e) {
2951
+ function $t(r, e) {
2935
2952
  if (r === ne)
2936
2953
  throw new Error("invert: expected non-zero number");
2937
2954
  if (e <= ne)
@@ -2945,47 +2962,47 @@ function Mt(r, e) {
2945
2962
  throw new Error("invert: does not exist");
2946
2963
  return le(n, e);
2947
2964
  }
2948
- function _t(r, e, s) {
2965
+ function xt(r, e, s) {
2949
2966
  if (!r.eql(r.sqr(e), s))
2950
2967
  throw new Error("Cannot find square root");
2951
2968
  }
2952
- function fs(r, e) {
2953
- const s = (r.ORDER + ee) / ds, t = r.pow(e, s);
2954
- return _t(r, t, e), t;
2969
+ function _s(r, e) {
2970
+ const s = (r.ORDER + ee) / us, t = r.pow(e, s);
2971
+ return xt(r, t, e), t;
2955
2972
  }
2956
- function Cr(r, e) {
2957
- const s = (r.ORDER - us) / hs, t = r.mul(e, Ee), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, Ee), n), a = r.mul(o, r.sub(i, r.ONE));
2958
- return _t(r, a, e), a;
2973
+ function Or(r, e) {
2974
+ const s = (r.ORDER - hs) / ps, t = r.mul(e, Ie), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, Ie), n), a = r.mul(o, r.sub(i, r.ONE));
2975
+ return xt(r, a, e), a;
2959
2976
  }
2960
- function Nr(r) {
2961
- const e = ze(r), s = _s(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + kr) / ps;
2977
+ function Cr(r) {
2978
+ const e = je(r), s = xs(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Pr) / fs;
2962
2979
  return (a, c) => {
2963
2980
  let l = a.pow(c, i), d = a.mul(l, t);
2964
2981
  const h = a.mul(l, n), m = a.mul(l, o), x = a.eql(a.sqr(d), c), w = a.eql(a.sqr(h), c);
2965
2982
  l = a.cmov(l, d, x), d = a.cmov(m, h, w);
2966
2983
  const E = a.eql(a.sqr(d), c), y = a.cmov(l, d, E);
2967
- return _t(a, y, c), y;
2984
+ return xt(a, y, c), y;
2968
2985
  };
2969
2986
  }
2970
- function _s(r) {
2971
- if (r < ls)
2987
+ function xs(r) {
2988
+ if (r < ds)
2972
2989
  throw new Error("sqrt is not defined for small field");
2973
2990
  let e = r - ee, s = 0;
2974
- for (; e % Ee === ne; )
2975
- e /= Ee, s++;
2976
- let t = Ee;
2977
- const n = ze(r);
2978
- for (; $t(n, t) === 1; )
2991
+ for (; e % Ie === ne; )
2992
+ e /= Ie, s++;
2993
+ let t = Ie;
2994
+ const n = je(r);
2995
+ for (; Bt(n, t) === 1; )
2979
2996
  if (t++ > 1e3)
2980
2997
  throw new Error("Cannot find square root: probably non-prime P");
2981
2998
  if (s === 1)
2982
- return fs;
2999
+ return _s;
2983
3000
  let o = n.pow(t, e);
2984
- const i = (e + ee) / Ee;
3001
+ const i = (e + ee) / Ie;
2985
3002
  return function(c, l) {
2986
3003
  if (c.is0(l))
2987
3004
  return l;
2988
- if ($t(c, l) !== 1)
3005
+ if (Bt(c, l) !== 1)
2989
3006
  throw new Error("Cannot find square root");
2990
3007
  let d = s, h = c.mul(c.ONE, o), m = c.pow(l, e), x = c.pow(l, i);
2991
3008
  for (; !c.eql(m, c.ONE); ) {
@@ -3001,10 +3018,10 @@ function _s(r) {
3001
3018
  return x;
3002
3019
  };
3003
3020
  }
3004
- function Or(r) {
3005
- return r % ds === ls ? fs : r % hs === us ? Cr : r % ps === Pr ? Nr(r) : _s(r);
3021
+ function Lr(r) {
3022
+ return r % us === ds ? _s : r % ps === hs ? Or : r % fs === Nr ? Cr(r) : xs(r);
3006
3023
  }
3007
- const Lr = [
3024
+ const Dr = [
3008
3025
  "create",
3009
3026
  "isValid",
3010
3027
  "is0",
@@ -3023,15 +3040,15 @@ const Lr = [
3023
3040
  "mulN",
3024
3041
  "sqrN"
3025
3042
  ];
3026
- function Dr(r) {
3043
+ function Mr(r) {
3027
3044
  const e = {
3028
3045
  ORDER: "bigint",
3029
3046
  BYTES: "number",
3030
3047
  BITS: "number"
3031
- }, s = Lr.reduce((t, n) => (t[n] = "function", t), e);
3032
- return ft(r, s), r;
3048
+ }, s = Dr.reduce((t, n) => (t[n] = "function", t), e);
3049
+ return _t(r, s), r;
3033
3050
  }
3034
- function Mr(r, e, s) {
3051
+ function $r(r, e, s) {
3035
3052
  if (s < ne)
3036
3053
  throw new Error("invalid exponent, negatives unsupported");
3037
3054
  if (s === ne)
@@ -3043,39 +3060,39 @@ function Mr(r, e, s) {
3043
3060
  s & ee && (t = r.mul(t, n)), n = r.sqr(n), s >>= ee;
3044
3061
  return t;
3045
3062
  }
3046
- function xs(r, e, s = !1) {
3063
+ function gs(r, e, s = !1) {
3047
3064
  const t = new Array(e.length).fill(s ? r.ZERO : void 0), n = e.reduce((i, a, c) => r.is0(a) ? i : (t[c] = i, r.mul(i, a)), r.ONE), o = r.inv(n);
3048
3065
  return e.reduceRight((i, a, c) => r.is0(a) ? i : (t[c] = r.mul(i, t[c]), r.mul(i, a)), o), t;
3049
3066
  }
3050
- function $t(r, e) {
3051
- const s = (r.ORDER - ee) / Ee, t = r.pow(e, s), n = r.eql(t, r.ONE), o = r.eql(t, r.ZERO), i = r.eql(t, r.neg(r.ONE));
3067
+ function Bt(r, e) {
3068
+ const s = (r.ORDER - ee) / Ie, t = r.pow(e, s), n = r.eql(t, r.ONE), o = r.eql(t, r.ZERO), i = r.eql(t, r.neg(r.ONE));
3052
3069
  if (!n && !o && !i)
3053
3070
  throw new Error("invalid Legendre symbol result");
3054
3071
  return n ? 1 : o ? 0 : -1;
3055
3072
  }
3056
- function $r(r, e) {
3057
- e !== void 0 && xe(e);
3073
+ function Br(r, e) {
3074
+ e !== void 0 && ge(e);
3058
3075
  const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
3059
3076
  return { nBitLength: s, nByteLength: t };
3060
3077
  }
3061
- class Br {
3078
+ class Ur {
3062
3079
  constructor(e, s = {}) {
3063
- T(this, "ORDER");
3064
- T(this, "BITS");
3065
- T(this, "BYTES");
3066
- T(this, "isLE");
3067
- T(this, "ZERO", ne);
3068
- T(this, "ONE", ee);
3069
- T(this, "_lengths");
3070
- T(this, "_sqrt");
3080
+ A(this, "ORDER");
3081
+ A(this, "BITS");
3082
+ A(this, "BYTES");
3083
+ A(this, "isLE");
3084
+ A(this, "ZERO", ne);
3085
+ A(this, "ONE", ee);
3086
+ A(this, "_lengths");
3087
+ A(this, "_sqrt");
3071
3088
  // cached sqrt
3072
- T(this, "_mod");
3089
+ A(this, "_mod");
3073
3090
  var i;
3074
3091
  if (e <= ne)
3075
3092
  throw new Error("invalid field: expected ORDER > 0, got " + e);
3076
3093
  let t;
3077
3094
  this.isLE = !1, s != null && typeof s == "object" && (typeof s.BITS == "number" && (t = s.BITS), typeof s.sqrt == "function" && (this.sqrt = s.sqrt), typeof s.isLE == "boolean" && (this.isLE = s.isLE), s.allowedLengths && (this._lengths = (i = s.allowedLengths) == null ? void 0 : i.slice()), typeof s.modFromBytes == "boolean" && (this._mod = s.modFromBytes));
3078
- const { nBitLength: n, nByteLength: o } = $r(e, t);
3095
+ const { nBitLength: n, nByteLength: o } = Br(e, t);
3079
3096
  if (o > 2048)
3080
3097
  throw new Error("invalid field: expected ORDER of <= 2048 bytes");
3081
3098
  this.ORDER = e, this.BITS = n, this.BYTES = o, this._sqrt = void 0, Object.preventExtensions(this);
@@ -3117,10 +3134,10 @@ class Br {
3117
3134
  return le(e * s, this.ORDER);
3118
3135
  }
3119
3136
  pow(e, s) {
3120
- return Mr(this, e, s);
3137
+ return $r(this, e, s);
3121
3138
  }
3122
3139
  div(e, s) {
3123
- return le(e * Mt(s, this.ORDER), this.ORDER);
3140
+ return le(e * $t(s, this.ORDER), this.ORDER);
3124
3141
  }
3125
3142
  // Same as above, but doesn't normalize
3126
3143
  sqrN(e) {
@@ -3136,13 +3153,13 @@ class Br {
3136
3153
  return e * s;
3137
3154
  }
3138
3155
  inv(e) {
3139
- return Mt(e, this.ORDER);
3156
+ return $t(e, this.ORDER);
3140
3157
  }
3141
3158
  sqrt(e) {
3142
- return this._sqrt || (this._sqrt = Or(this.ORDER)), this._sqrt(this, e);
3159
+ return this._sqrt || (this._sqrt = Lr(this.ORDER)), this._sqrt(this, e);
3143
3160
  }
3144
3161
  toBytes(e) {
3145
- return this.isLE ? cs(e, this.BYTES) : ht(e, this.BYTES);
3162
+ return this.isLE ? ls(e, this.BYTES) : pt(e, this.BYTES);
3146
3163
  }
3147
3164
  fromBytes(e, s = !1) {
3148
3165
  V(e);
@@ -3155,14 +3172,14 @@ class Br {
3155
3172
  }
3156
3173
  if (e.length !== n)
3157
3174
  throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
3158
- let c = o ? as(e) : Ve(e);
3175
+ let c = o ? cs(e) : ze(e);
3159
3176
  if (a && (c = le(c, i)), !s && !this.isValid(c))
3160
3177
  throw new Error("invalid field element: outside of range 0..ORDER");
3161
3178
  return c;
3162
3179
  }
3163
3180
  // TODO: we don't need it here, move out to separate fn
3164
3181
  invertBatch(e) {
3165
- return xs(this, e);
3182
+ return gs(this, e);
3166
3183
  }
3167
3184
  // We can't move this out because Fp6, Fp12 implement it
3168
3185
  // and it's unclear what to return in there.
@@ -3170,75 +3187,75 @@ class Br {
3170
3187
  return t ? s : e;
3171
3188
  }
3172
3189
  }
3173
- function ze(r, e = {}) {
3174
- return new Br(r, e);
3190
+ function je(r, e = {}) {
3191
+ return new Ur(r, e);
3175
3192
  }
3176
- function gs(r) {
3193
+ function ms(r) {
3177
3194
  if (typeof r != "bigint")
3178
3195
  throw new Error("field order must be bigint");
3179
3196
  const e = r.toString(2).length;
3180
3197
  return Math.ceil(e / 8);
3181
3198
  }
3182
- function ms(r) {
3183
- const e = gs(r);
3199
+ function ws(r) {
3200
+ const e = ms(r);
3184
3201
  return e + Math.ceil(e / 2);
3185
3202
  }
3186
- function Ur(r, e, s = !1) {
3203
+ function Hr(r, e, s = !1) {
3187
3204
  V(r);
3188
- const t = r.length, n = gs(e), o = ms(e);
3205
+ const t = r.length, n = ms(e), o = ws(e);
3189
3206
  if (t < 16 || t < o || t > 1024)
3190
3207
  throw new Error("expected " + o + "-1024 bytes of input, got " + t);
3191
- const i = s ? as(r) : Ve(r), a = le(i, e - ee) + ee;
3192
- return s ? cs(a, n) : ht(a, n);
3208
+ const i = s ? cs(r) : ze(r), a = le(i, e - ee) + ee;
3209
+ return s ? ls(a, n) : pt(a, n);
3193
3210
  }
3194
3211
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3195
- const Pe = /* @__PURE__ */ BigInt(0), Ie = /* @__PURE__ */ BigInt(1);
3196
- function qe(r, e) {
3212
+ const Ne = /* @__PURE__ */ BigInt(0), Ae = /* @__PURE__ */ BigInt(1);
3213
+ function Ke(r, e) {
3197
3214
  const s = e.negate();
3198
3215
  return r ? s : e;
3199
3216
  }
3200
- function Bt(r, e) {
3201
- const s = xs(r.Fp, e.map((t) => t.Z));
3217
+ function Ut(r, e) {
3218
+ const s = gs(r.Fp, e.map((t) => t.Z));
3202
3219
  return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
3203
3220
  }
3204
- function ws(r, e) {
3221
+ function ys(r, e) {
3205
3222
  if (!Number.isSafeInteger(r) || r <= 0 || r > e)
3206
3223
  throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
3207
3224
  }
3208
- function Xe(r, e) {
3209
- ws(r, e);
3210
- const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = pt(r), i = BigInt(r);
3225
+ function Qe(r, e) {
3226
+ ys(r, e);
3227
+ const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = ft(r), i = BigInt(r);
3211
3228
  return { windows: s, windowSize: t, mask: o, maxNumber: n, shiftBy: i };
3212
3229
  }
3213
- function Ut(r, e, s) {
3230
+ function Ht(r, e, s) {
3214
3231
  const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
3215
3232
  let a = Number(r & n), c = r >> i;
3216
- a > t && (a -= o, c += Ie);
3233
+ a > t && (a -= o, c += Ae);
3217
3234
  const l = e * t, d = l + Math.abs(a) - 1, h = a === 0, m = a < 0, x = e % 2 !== 0;
3218
3235
  return { nextN: c, offset: d, isZero: h, isNeg: m, isNegF: x, offsetF: l };
3219
3236
  }
3220
- const Qe = /* @__PURE__ */ new WeakMap(), ys = /* @__PURE__ */ new WeakMap();
3221
- function et(r) {
3222
- return ys.get(r) || 1;
3237
+ const et = /* @__PURE__ */ new WeakMap(), bs = /* @__PURE__ */ new WeakMap();
3238
+ function tt(r) {
3239
+ return bs.get(r) || 1;
3223
3240
  }
3224
- function Ht(r) {
3225
- if (r !== Pe)
3241
+ function Ft(r) {
3242
+ if (r !== Ne)
3226
3243
  throw new Error("invalid wNAF");
3227
3244
  }
3228
- class Hr {
3245
+ class Fr {
3229
3246
  // Parametrized with a given Point class (not individual point)
3230
3247
  constructor(e, s) {
3231
- T(this, "BASE");
3232
- T(this, "ZERO");
3233
- T(this, "Fn");
3234
- T(this, "bits");
3248
+ A(this, "BASE");
3249
+ A(this, "ZERO");
3250
+ A(this, "Fn");
3251
+ A(this, "bits");
3235
3252
  this.BASE = e.BASE, this.ZERO = e.ZERO, this.Fn = e.Fn, this.bits = s;
3236
3253
  }
3237
3254
  // non-const time multiplication ladder
3238
3255
  _unsafeLadder(e, s, t = this.ZERO) {
3239
3256
  let n = e;
3240
- for (; s > Pe; )
3241
- s & Ie && (t = t.add(n)), n = n.double(), s >>= Ie;
3257
+ for (; s > Ne; )
3258
+ s & Ae && (t = t.add(n)), n = n.double(), s >>= Ae;
3242
3259
  return t;
3243
3260
  }
3244
3261
  /**
@@ -3254,7 +3271,7 @@ class Hr {
3254
3271
  * @returns precomputed point tables flattened to a single array
3255
3272
  */
3256
3273
  precomputeWindow(e, s) {
3257
- const { windows: t, windowSize: n } = Xe(s, this.bits), o = [];
3274
+ const { windows: t, windowSize: n } = Qe(s, this.bits), o = [];
3258
3275
  let i = e, a = i;
3259
3276
  for (let c = 0; c < t; c++) {
3260
3277
  a = i, o.push(a);
@@ -3274,12 +3291,12 @@ class Hr {
3274
3291
  if (!this.Fn.isValid(t))
3275
3292
  throw new Error("invalid scalar");
3276
3293
  let n = this.ZERO, o = this.BASE;
3277
- const i = Xe(e, this.bits);
3294
+ const i = Qe(e, this.bits);
3278
3295
  for (let a = 0; a < i.windows; a++) {
3279
- const { nextN: c, offset: l, isZero: d, isNeg: h, isNegF: m, offsetF: x } = Ut(t, a, i);
3280
- t = c, d ? o = o.add(qe(m, s[x])) : n = n.add(qe(h, s[l]));
3296
+ const { nextN: c, offset: l, isZero: d, isNeg: h, isNegF: m, offsetF: x } = Ht(t, a, i);
3297
+ t = c, d ? o = o.add(Ke(m, s[x])) : n = n.add(Ke(h, s[l]));
3281
3298
  }
3282
- return Ht(t), { p: n, f: o };
3299
+ return Ft(t), { p: n, f: o };
3283
3300
  }
3284
3301
  /**
3285
3302
  * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
@@ -3287,81 +3304,81 @@ class Hr {
3287
3304
  * @returns point
3288
3305
  */
3289
3306
  wNAFUnsafe(e, s, t, n = this.ZERO) {
3290
- const o = Xe(e, this.bits);
3291
- for (let i = 0; i < o.windows && t !== Pe; i++) {
3292
- const { nextN: a, offset: c, isZero: l, isNeg: d } = Ut(t, i, o);
3307
+ const o = Qe(e, this.bits);
3308
+ for (let i = 0; i < o.windows && t !== Ne; i++) {
3309
+ const { nextN: a, offset: c, isZero: l, isNeg: d } = Ht(t, i, o);
3293
3310
  if (t = a, !l) {
3294
3311
  const h = s[c];
3295
3312
  n = n.add(d ? h.negate() : h);
3296
3313
  }
3297
3314
  }
3298
- return Ht(t), n;
3315
+ return Ft(t), n;
3299
3316
  }
3300
3317
  getPrecomputes(e, s, t) {
3301
- let n = Qe.get(s);
3302
- return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), Qe.set(s, n))), n;
3318
+ let n = et.get(s);
3319
+ return n || (n = this.precomputeWindow(s, e), e !== 1 && (typeof t == "function" && (n = t(n)), et.set(s, n))), n;
3303
3320
  }
3304
3321
  cached(e, s, t) {
3305
- const n = et(e);
3322
+ const n = tt(e);
3306
3323
  return this.wNAF(n, this.getPrecomputes(n, e, t), s);
3307
3324
  }
3308
3325
  unsafe(e, s, t, n) {
3309
- const o = et(e);
3326
+ const o = tt(e);
3310
3327
  return o === 1 ? this._unsafeLadder(e, s, n) : this.wNAFUnsafe(o, this.getPrecomputes(o, e, t), s, n);
3311
3328
  }
3312
3329
  // We calculate precomputes for elliptic curve point multiplication
3313
3330
  // using windowed method. This specifies window size and
3314
3331
  // stores precomputed values. Usually only base point would be precomputed.
3315
3332
  createCache(e, s) {
3316
- ws(s, this.bits), ys.set(e, s), Qe.delete(e);
3333
+ ys(s, this.bits), bs.set(e, s), et.delete(e);
3317
3334
  }
3318
3335
  hasCache(e) {
3319
- return et(e) !== 1;
3336
+ return tt(e) !== 1;
3320
3337
  }
3321
3338
  }
3322
- function Fr(r, e, s, t) {
3339
+ function Gr(r, e, s, t) {
3323
3340
  let n = e, o = r.ZERO, i = r.ZERO;
3324
- for (; s > Pe || t > Pe; )
3325
- s & Ie && (o = o.add(n)), t & Ie && (i = i.add(n)), n = n.double(), s >>= Ie, t >>= Ie;
3341
+ for (; s > Ne || t > Ne; )
3342
+ s & Ae && (o = o.add(n)), t & Ae && (i = i.add(n)), n = n.double(), s >>= Ae, t >>= Ae;
3326
3343
  return { p1: o, p2: i };
3327
3344
  }
3328
- function Ft(r, e, s) {
3345
+ function Gt(r, e, s) {
3329
3346
  if (e) {
3330
3347
  if (e.ORDER !== r)
3331
3348
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
3332
- return Dr(e), e;
3349
+ return Mr(e), e;
3333
3350
  } else
3334
- return ze(r, { isLE: s });
3351
+ return je(r, { isLE: s });
3335
3352
  }
3336
- function Gr(r, e, s = {}, t) {
3353
+ function Wr(r, e, s = {}, t) {
3337
3354
  if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
3338
3355
  throw new Error(`expected valid ${r} CURVE object`);
3339
3356
  for (const c of ["p", "n", "h"]) {
3340
3357
  const l = e[c];
3341
- if (!(typeof l == "bigint" && l > Pe))
3358
+ if (!(typeof l == "bigint" && l > Ne))
3342
3359
  throw new Error(`CURVE.${c} must be positive bigint`);
3343
3360
  }
3344
- const n = Ft(e.p, s.Fp, t), o = Ft(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3361
+ const n = Gt(e.p, s.Fp, t), o = Gt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
3345
3362
  for (const c of a)
3346
3363
  if (!n.isValid(e[c]))
3347
3364
  throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
3348
3365
  return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: o };
3349
3366
  }
3350
- function Wr(r, e) {
3367
+ function qr(r, e) {
3351
3368
  return function(t) {
3352
3369
  const n = r(t);
3353
3370
  return { secretKey: n, publicKey: e(n) };
3354
3371
  };
3355
3372
  }
3356
- class bs {
3373
+ class vs {
3357
3374
  constructor(e, s) {
3358
- T(this, "oHash");
3359
- T(this, "iHash");
3360
- T(this, "blockLen");
3361
- T(this, "outputLen");
3362
- T(this, "finished", !1);
3363
- T(this, "destroyed", !1);
3364
- if (es(e), V(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3375
+ A(this, "oHash");
3376
+ A(this, "iHash");
3377
+ A(this, "blockLen");
3378
+ A(this, "outputLen");
3379
+ A(this, "finished", !1);
3380
+ A(this, "destroyed", !1);
3381
+ if (ts(e), V(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
3365
3382
  throw new Error("Expected instance of class which extends utils.Hash");
3366
3383
  this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
3367
3384
  const t = this.blockLen, n = new Uint8Array(t);
@@ -3371,13 +3388,13 @@ class bs {
3371
3388
  this.iHash.update(n), this.oHash = e.create();
3372
3389
  for (let o = 0; o < n.length; o++)
3373
3390
  n[o] ^= 106;
3374
- this.oHash.update(n), ke(n);
3391
+ this.oHash.update(n), Pe(n);
3375
3392
  }
3376
3393
  update(e) {
3377
- return Re(this), this.iHash.update(e), this;
3394
+ return ke(this), this.iHash.update(e), this;
3378
3395
  }
3379
3396
  digestInto(e) {
3380
- Re(this), V(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3397
+ ke(this), V(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
3381
3398
  }
3382
3399
  digest() {
3383
3400
  const e = new Uint8Array(this.oHash.outputLen);
@@ -3395,56 +3412,56 @@ class bs {
3395
3412
  this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
3396
3413
  }
3397
3414
  }
3398
- const vs = (r, e, s) => new bs(r, e).update(s).digest();
3399
- vs.create = (r, e) => new bs(r, e);
3415
+ const Ss = (r, e, s) => new vs(r, e).update(s).digest();
3416
+ Ss.create = (r, e) => new vs(r, e);
3400
3417
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3401
- const Gt = (r, e) => (r + (r >= 0 ? e : -e) / Ss) / e;
3402
- function qr(r, e, s) {
3403
- const [[t, n], [o, i]] = e, a = Gt(i * r, s), c = Gt(-n * r, s);
3418
+ const Wt = (r, e) => (r + (r >= 0 ? e : -e) / Es) / e;
3419
+ function Kr(r, e, s) {
3420
+ const [[t, n], [o, i]] = e, a = Wt(i * r, s), c = Wt(-n * r, s);
3404
3421
  let l = r - a * t - c * o, d = -a * n - c * i;
3405
- const h = l < fe, m = d < fe;
3422
+ const h = l < _e, m = d < _e;
3406
3423
  h && (l = -l), m && (d = -d);
3407
- const x = pt(Math.ceil(Ar(s) / 2)) + Ae;
3408
- if (l < fe || l >= x || d < fe || d >= x)
3424
+ const x = ft(Math.ceil(Rr(s) / 2)) + Re;
3425
+ if (l < _e || l >= x || d < _e || d >= x)
3409
3426
  throw new Error("splitScalar (endomorphism): failed, k=" + r);
3410
3427
  return { k1neg: h, k1: l, k2neg: m, k2: d };
3411
3428
  }
3412
- function at(r) {
3429
+ function ct(r) {
3413
3430
  if (!["compact", "recovered", "der"].includes(r))
3414
3431
  throw new Error('Signature format must be "compact", "recovered", or "der"');
3415
3432
  return r;
3416
3433
  }
3417
- function tt(r, e) {
3434
+ function st(r, e) {
3418
3435
  const s = {};
3419
3436
  for (let t of Object.keys(e))
3420
3437
  s[t] = r[t] === void 0 ? e[t] : r[t];
3421
- return We(s.lowS, "lowS"), We(s.prehash, "prehash"), s.format !== void 0 && at(s.format), s;
3438
+ return qe(s.lowS, "lowS"), qe(s.prehash, "prehash"), s.format !== void 0 && ct(s.format), s;
3422
3439
  }
3423
- class Kr extends Error {
3440
+ class Vr extends Error {
3424
3441
  constructor(e = "") {
3425
3442
  super(e);
3426
3443
  }
3427
3444
  }
3428
- const we = {
3445
+ const ye = {
3429
3446
  // asn.1 DER encoding utils
3430
- Err: Kr,
3447
+ Err: Vr,
3431
3448
  // Basic building block is TLV (Tag-Length-Value)
3432
3449
  _tlv: {
3433
3450
  encode: (r, e) => {
3434
- const { Err: s } = we;
3451
+ const { Err: s } = ye;
3435
3452
  if (r < 0 || r > 256)
3436
3453
  throw new s("tlv.encode: wrong tag");
3437
3454
  if (e.length & 1)
3438
3455
  throw new s("tlv.encode: unpadded data");
3439
- const t = e.length / 2, n = Be(t);
3456
+ const t = e.length / 2, n = Ue(t);
3440
3457
  if (n.length / 2 & 128)
3441
3458
  throw new s("tlv.encode: long form length too big");
3442
- const o = t > 127 ? Be(n.length / 2 | 128) : "";
3443
- return Be(r) + o + n + e;
3459
+ const o = t > 127 ? Ue(n.length / 2 | 128) : "";
3460
+ return Ue(r) + o + n + e;
3444
3461
  },
3445
3462
  // v - value, l - left bytes (unparsed)
3446
3463
  decode(r, e) {
3447
- const { Err: s } = we;
3464
+ const { Err: s } = ye;
3448
3465
  let t = 0;
3449
3466
  if (r < 0 || r > 256)
3450
3467
  throw new s("tlv.encode: wrong tag");
@@ -3482,25 +3499,25 @@ const we = {
3482
3499
  // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
3483
3500
  _int: {
3484
3501
  encode(r) {
3485
- const { Err: e } = we;
3486
- if (r < fe)
3502
+ const { Err: e } = ye;
3503
+ if (r < _e)
3487
3504
  throw new e("integer: negative integers are not allowed");
3488
- let s = Be(r);
3505
+ let s = Ue(r);
3489
3506
  if (Number.parseInt(s[0], 16) & 8 && (s = "00" + s), s.length & 1)
3490
3507
  throw new e("unexpected DER parsing assertion: unpadded hex");
3491
3508
  return s;
3492
3509
  },
3493
3510
  decode(r) {
3494
- const { Err: e } = we;
3511
+ const { Err: e } = ye;
3495
3512
  if (r[0] & 128)
3496
3513
  throw new e("invalid signature integer: negative");
3497
3514
  if (r[0] === 0 && !(r[1] & 128))
3498
3515
  throw new e("invalid signature integer: unnecessary leading zero");
3499
- return Ve(r);
3516
+ return ze(r);
3500
3517
  }
3501
3518
  },
3502
3519
  toSig(r) {
3503
- const { Err: e, _int: s, _tlv: t } = we, n = V(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
3520
+ const { Err: e, _int: s, _tlv: t } = ye, n = V(r, void 0, "signature"), { v: o, l: i } = t.decode(48, n);
3504
3521
  if (i.length)
3505
3522
  throw new e("invalid signature: left bytes after parsing");
3506
3523
  const { v: a, l: c } = t.decode(2, o), { v: l, l: d } = t.decode(2, c);
@@ -3509,15 +3526,15 @@ const we = {
3509
3526
  return { r: s.decode(a), s: s.decode(l) };
3510
3527
  },
3511
3528
  hexFromSig(r) {
3512
- const { _tlv: e, _int: s } = we, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
3529
+ const { _tlv: e, _int: s } = ye, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
3513
3530
  return e.encode(48, o);
3514
3531
  }
3515
- }, fe = BigInt(0), Ae = BigInt(1), Ss = BigInt(2), Ue = BigInt(3), Vr = BigInt(4);
3516
- function zr(r, e = {}) {
3517
- const s = Gr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3532
+ }, _e = BigInt(0), Re = BigInt(1), Es = BigInt(2), He = BigInt(3), zr = BigInt(4);
3533
+ function jr(r, e = {}) {
3534
+ const s = Wr("weierstrass", r, e), { Fp: t, Fn: n } = s;
3518
3535
  let o = s.CURVE;
3519
3536
  const { h: i, n: a } = o;
3520
- ft(e, {}, {
3537
+ _t(e, {}, {
3521
3538
  allowInfinityPoint: "boolean",
3522
3539
  clearCofactor: "function",
3523
3540
  isTorsionFree: "function",
@@ -3528,110 +3545,110 @@ function zr(r, e = {}) {
3528
3545
  const { endo: c } = e;
3529
3546
  if (c && (!t.is0(o.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
3530
3547
  throw new Error('invalid endo: expected "beta": bigint and "basises": array');
3531
- const l = Is(t, n);
3548
+ const l = As(t, n);
3532
3549
  function d() {
3533
3550
  if (!t.isOdd)
3534
3551
  throw new Error("compression is not supported: Field does not have .isOdd()");
3535
3552
  }
3536
- function h(C, f, _) {
3553
+ function h(N, f, _) {
3537
3554
  const { x: v, y: I } = f.toAffine(), L = t.toBytes(v);
3538
- if (We(_, "isCompressed"), _) {
3555
+ if (qe(_, "isCompressed"), _) {
3539
3556
  d();
3540
- const N = !t.isOdd(I);
3541
- return be(Es(N), L);
3557
+ const O = !t.isOdd(I);
3558
+ return ve(Is(O), L);
3542
3559
  } else
3543
- return be(Uint8Array.of(4), L, t.toBytes(I));
3560
+ return ve(Uint8Array.of(4), L, t.toBytes(I));
3544
3561
  }
3545
- function m(C) {
3546
- V(C, void 0, "Point");
3547
- const { publicKey: f, publicKeyUncompressed: _ } = l, v = C.length, I = C[0], L = C.subarray(1);
3562
+ function m(N) {
3563
+ V(N, void 0, "Point");
3564
+ const { publicKey: f, publicKeyUncompressed: _ } = l, v = N.length, I = N[0], L = N.subarray(1);
3548
3565
  if (v === f && (I === 2 || I === 3)) {
3549
- const N = t.fromBytes(L);
3550
- if (!t.isValid(N))
3566
+ const O = t.fromBytes(L);
3567
+ if (!t.isValid(O))
3551
3568
  throw new Error("bad point: is not on curve, wrong x");
3552
- const M = E(N);
3553
- let A;
3569
+ const M = E(O);
3570
+ let T;
3554
3571
  try {
3555
- A = t.sqrt(M);
3572
+ T = t.sqrt(M);
3556
3573
  } catch (J) {
3557
3574
  const K = J instanceof Error ? ": " + J.message : "";
3558
3575
  throw new Error("bad point: is not on curve, sqrt error" + K);
3559
3576
  }
3560
3577
  d();
3561
- const $ = t.isOdd(A);
3562
- return (I & 1) === 1 !== $ && (A = t.neg(A)), { x: N, y: A };
3578
+ const $ = t.isOdd(T);
3579
+ return (I & 1) === 1 !== $ && (T = t.neg(T)), { x: O, y: T };
3563
3580
  } else if (v === _ && I === 4) {
3564
- const N = t.BYTES, M = t.fromBytes(L.subarray(0, N)), A = t.fromBytes(L.subarray(N, N * 2));
3565
- if (!y(M, A))
3581
+ const O = t.BYTES, M = t.fromBytes(L.subarray(0, O)), T = t.fromBytes(L.subarray(O, O * 2));
3582
+ if (!y(M, T))
3566
3583
  throw new Error("bad point: is not on curve");
3567
- return { x: M, y: A };
3584
+ return { x: M, y: T };
3568
3585
  } else
3569
3586
  throw new Error(`bad point: got length ${v}, expected compressed=${f} or uncompressed=${_}`);
3570
3587
  }
3571
3588
  const x = e.toBytes || h, w = e.fromBytes || m;
3572
- function E(C) {
3573
- const f = t.sqr(C), _ = t.mul(f, C);
3574
- return t.add(t.add(_, t.mul(C, o.a)), o.b);
3589
+ function E(N) {
3590
+ const f = t.sqr(N), _ = t.mul(f, N);
3591
+ return t.add(t.add(_, t.mul(N, o.a)), o.b);
3575
3592
  }
3576
- function y(C, f) {
3577
- const _ = t.sqr(f), v = E(C);
3593
+ function y(N, f) {
3594
+ const _ = t.sqr(f), v = E(N);
3578
3595
  return t.eql(_, v);
3579
3596
  }
3580
3597
  if (!y(o.Gx, o.Gy))
3581
3598
  throw new Error("bad curve params: generator point");
3582
- const S = t.mul(t.pow(o.a, Ue), Vr), O = t.mul(t.sqr(o.b), BigInt(27));
3583
- if (t.is0(t.add(S, O)))
3599
+ const S = t.mul(t.pow(o.a, He), zr), C = t.mul(t.sqr(o.b), BigInt(27));
3600
+ if (t.is0(t.add(S, C)))
3584
3601
  throw new Error("bad curve params: a or b");
3585
- function B(C, f, _ = !1) {
3602
+ function B(N, f, _ = !1) {
3586
3603
  if (!t.isValid(f) || _ && t.is0(f))
3587
- throw new Error(`bad point coordinate ${C}`);
3604
+ throw new Error(`bad point coordinate ${N}`);
3588
3605
  return f;
3589
3606
  }
3590
- function b(C) {
3591
- if (!(C instanceof W))
3607
+ function b(N) {
3608
+ if (!(N instanceof W))
3592
3609
  throw new Error("Weierstrass Point expected");
3593
3610
  }
3594
- function k(C) {
3611
+ function k(N) {
3595
3612
  if (!c || !c.basises)
3596
3613
  throw new Error("no endo");
3597
- return qr(C, c.basises, n.ORDER);
3614
+ return Kr(N, c.basises, n.ORDER);
3598
3615
  }
3599
- const P = Dt((C, f) => {
3600
- const { X: _, Y: v, Z: I } = C;
3616
+ const P = Mt((N, f) => {
3617
+ const { X: _, Y: v, Z: I } = N;
3601
3618
  if (t.eql(I, t.ONE))
3602
3619
  return { x: _, y: v };
3603
- const L = C.is0();
3620
+ const L = N.is0();
3604
3621
  f == null && (f = L ? t.ONE : t.inv(I));
3605
- const N = t.mul(_, f), M = t.mul(v, f), A = t.mul(I, f);
3622
+ const O = t.mul(_, f), M = t.mul(v, f), T = t.mul(I, f);
3606
3623
  if (L)
3607
3624
  return { x: t.ZERO, y: t.ZERO };
3608
- if (!t.eql(A, t.ONE))
3625
+ if (!t.eql(T, t.ONE))
3609
3626
  throw new Error("invZ was invalid");
3610
- return { x: N, y: M };
3611
- }), G = Dt((C) => {
3612
- if (C.is0()) {
3613
- if (e.allowInfinityPoint && !t.is0(C.Y))
3627
+ return { x: O, y: M };
3628
+ }), G = Mt((N) => {
3629
+ if (N.is0()) {
3630
+ if (e.allowInfinityPoint && !t.is0(N.Y))
3614
3631
  return;
3615
3632
  throw new Error("bad point: ZERO");
3616
3633
  }
3617
- const { x: f, y: _ } = C.toAffine();
3634
+ const { x: f, y: _ } = N.toAffine();
3618
3635
  if (!t.isValid(f) || !t.isValid(_))
3619
3636
  throw new Error("bad point: x or y not field elements");
3620
3637
  if (!y(f, _))
3621
3638
  throw new Error("bad point: equation left != right");
3622
- if (!C.isTorsionFree())
3639
+ if (!N.isTorsionFree())
3623
3640
  throw new Error("bad point: not in prime-order subgroup");
3624
3641
  return !0;
3625
3642
  });
3626
- function z(C, f, _, v, I) {
3627
- return _ = new W(t.mul(_.X, C), _.Y, _.Z), f = qe(v, f), _ = qe(I, _), f.add(_);
3643
+ function z(N, f, _, v, I) {
3644
+ return _ = new W(t.mul(_.X, N), _.Y, _.Z), f = Ke(v, f), _ = Ke(I, _), f.add(_);
3628
3645
  }
3629
3646
  const R = class R {
3630
3647
  /** Does NOT validate if the point is valid. Use `.assertValidity()`. */
3631
3648
  constructor(f, _, v) {
3632
- T(this, "X");
3633
- T(this, "Y");
3634
- T(this, "Z");
3649
+ A(this, "X");
3650
+ A(this, "Y");
3651
+ A(this, "Z");
3635
3652
  this.X = B("x", f), this.Y = B("y", _, !0), this.Z = B("z", v), Object.freeze(this);
3636
3653
  }
3637
3654
  static CURVE() {
@@ -3651,7 +3668,7 @@ function zr(r, e = {}) {
3651
3668
  return _.assertValidity(), _;
3652
3669
  }
3653
3670
  static fromHex(f) {
3654
- return R.fromBytes(Ge(f));
3671
+ return R.fromBytes(We(f));
3655
3672
  }
3656
3673
  get x() {
3657
3674
  return this.toAffine().x;
@@ -3666,7 +3683,7 @@ function zr(r, e = {}) {
3666
3683
  * @returns
3667
3684
  */
3668
3685
  precompute(f = 8, _ = !0) {
3669
- return D.createCache(this, f), _ || this.multiply(Ue), this;
3686
+ return D.createCache(this, f), _ || this.multiply(He), this;
3670
3687
  }
3671
3688
  // TODO: return `this`
3672
3689
  /** A point on curve is valid if it conforms to equation. */
@@ -3682,8 +3699,8 @@ function zr(r, e = {}) {
3682
3699
  /** Compare one point to another. */
3683
3700
  equals(f) {
3684
3701
  b(f);
3685
- const { X: _, Y: v, Z: I } = this, { X: L, Y: N, Z: M } = f, A = t.eql(t.mul(_, M), t.mul(L, I)), $ = t.eql(t.mul(v, M), t.mul(N, I));
3686
- return A && $;
3702
+ const { X: _, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f, T = t.eql(t.mul(_, M), t.mul(L, I)), $ = t.eql(t.mul(v, M), t.mul(O, I));
3703
+ return T && $;
3687
3704
  }
3688
3705
  /** Flips point to one corresponding to (x, -y) in Affine coordinates. */
3689
3706
  negate() {
@@ -3694,9 +3711,9 @@ function zr(r, e = {}) {
3694
3711
  // https://eprint.iacr.org/2015/1060, algorithm 3
3695
3712
  // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
3696
3713
  double() {
3697
- const { a: f, b: _ } = o, v = t.mul(_, Ue), { X: I, Y: L, Z: N } = this;
3698
- let M = t.ZERO, A = t.ZERO, $ = t.ZERO, F = t.mul(I, I), J = t.mul(L, L), K = t.mul(N, N), H = t.mul(I, L);
3699
- return H = t.add(H, H), $ = t.mul(I, N), $ = t.add($, $), M = t.mul(f, $), A = t.mul(v, K), A = t.add(M, A), M = t.sub(J, A), A = t.add(J, A), A = t.mul(M, A), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(f, K), H = t.sub(F, K), H = t.mul(f, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), A = t.add(A, F), K = t.mul(L, N), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new R(M, A, $);
3714
+ const { a: f, b: _ } = o, v = t.mul(_, He), { X: I, Y: L, Z: O } = this;
3715
+ let M = t.ZERO, T = t.ZERO, $ = t.ZERO, F = t.mul(I, I), J = t.mul(L, L), K = t.mul(O, O), H = t.mul(I, L);
3716
+ return H = t.add(H, H), $ = t.mul(I, O), $ = t.add($, $), M = t.mul(f, $), T = t.mul(v, K), T = t.add(M, T), M = t.sub(J, T), T = t.add(J, T), T = t.mul(M, T), M = t.mul(H, M), $ = t.mul(v, $), K = t.mul(f, K), H = t.sub(F, K), H = t.mul(f, H), H = t.add(H, $), $ = t.add(F, F), F = t.add($, F), F = t.add(F, K), F = t.mul(F, H), T = t.add(T, F), K = t.mul(L, O), K = t.add(K, K), F = t.mul(K, H), M = t.sub(M, F), $ = t.mul(K, J), $ = t.add($, $), $ = t.add($, $), new R(M, T, $);
3700
3717
  }
3701
3718
  // Renes-Costello-Batina exception-free addition formula.
3702
3719
  // There is 30% faster Jacobian formula, but it is not complete.
@@ -3704,13 +3721,13 @@ function zr(r, e = {}) {
3704
3721
  // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
3705
3722
  add(f) {
3706
3723
  b(f);
3707
- const { X: _, Y: v, Z: I } = this, { X: L, Y: N, Z: M } = f;
3708
- let A = t.ZERO, $ = t.ZERO, F = t.ZERO;
3709
- const J = o.a, K = t.mul(o.b, Ue);
3710
- let H = t.mul(_, L), Z = t.mul(v, N), X = t.mul(I, M), oe = t.add(_, v), j = t.add(L, N);
3711
- oe = t.mul(oe, j), j = t.add(H, Z), oe = t.sub(oe, j), j = t.add(_, I);
3724
+ const { X: _, Y: v, Z: I } = this, { X: L, Y: O, Z: M } = f;
3725
+ let T = t.ZERO, $ = t.ZERO, F = t.ZERO;
3726
+ const J = o.a, K = t.mul(o.b, He);
3727
+ let H = t.mul(_, L), X = t.mul(v, O), Z = t.mul(I, M), oe = t.add(_, v), j = t.add(L, O);
3728
+ oe = t.mul(oe, j), j = t.add(H, X), oe = t.sub(oe, j), j = t.add(_, I);
3712
3729
  let Q = t.add(L, M);
3713
- return j = t.mul(j, Q), Q = t.add(H, X), j = t.sub(j, Q), Q = t.add(v, I), A = t.add(N, M), Q = t.mul(Q, A), A = t.add(Z, X), Q = t.sub(Q, A), F = t.mul(J, j), A = t.mul(K, X), F = t.add(A, F), A = t.sub(Z, F), F = t.add(Z, F), $ = t.mul(A, F), Z = t.add(H, H), Z = t.add(Z, H), X = t.mul(J, X), j = t.mul(K, j), Z = t.add(Z, X), X = t.sub(H, X), X = t.mul(J, X), j = t.add(j, X), H = t.mul(Z, j), $ = t.add($, H), H = t.mul(Q, j), A = t.mul(oe, A), A = t.sub(A, H), H = t.mul(oe, Z), F = t.mul(Q, F), F = t.add(F, H), new R(A, $, F);
3730
+ return j = t.mul(j, Q), Q = t.add(H, Z), j = t.sub(j, Q), Q = t.add(v, I), T = t.add(O, M), Q = t.mul(Q, T), T = t.add(X, Z), Q = t.sub(Q, T), F = t.mul(J, j), T = t.mul(K, Z), F = t.add(T, F), T = t.sub(X, F), F = t.add(X, F), $ = t.mul(T, F), X = t.add(H, H), X = t.add(X, H), Z = t.mul(J, Z), j = t.mul(K, j), X = t.add(X, Z), Z = t.sub(H, Z), Z = t.mul(J, Z), j = t.add(j, Z), H = t.mul(X, j), $ = t.add($, H), H = t.mul(Q, j), T = t.mul(oe, T), T = t.sub(T, H), H = t.mul(oe, X), F = t.mul(Q, F), F = t.add(F, H), new R(T, $, F);
3714
3731
  }
3715
3732
  subtract(f) {
3716
3733
  return this.add(f.negate());
@@ -3732,15 +3749,15 @@ function zr(r, e = {}) {
3732
3749
  if (!n.isValidNot0(f))
3733
3750
  throw new Error("invalid scalar: out of range");
3734
3751
  let v, I;
3735
- const L = (N) => D.cached(this, N, (M) => Bt(R, M));
3752
+ const L = (O) => D.cached(this, O, (M) => Ut(R, M));
3736
3753
  if (_) {
3737
- const { k1neg: N, k1: M, k2neg: A, k2: $ } = k(f), { p: F, f: J } = L(M), { p: K, f: H } = L($);
3738
- I = J.add(H), v = z(_.beta, F, K, N, A);
3754
+ const { k1neg: O, k1: M, k2neg: T, k2: $ } = k(f), { p: F, f: J } = L(M), { p: K, f: H } = L($);
3755
+ I = J.add(H), v = z(_.beta, F, K, O, T);
3739
3756
  } else {
3740
- const { p: N, f: M } = L(f);
3741
- v = N, I = M;
3757
+ const { p: O, f: M } = L(f);
3758
+ v = O, I = M;
3742
3759
  }
3743
- return Bt(R, [v, I])[0];
3760
+ return Ut(R, [v, I])[0];
3744
3761
  }
3745
3762
  /**
3746
3763
  * Non-constant-time multiplication. Uses double-and-add algorithm.
@@ -3751,15 +3768,15 @@ function zr(r, e = {}) {
3751
3768
  const { endo: _ } = e, v = this;
3752
3769
  if (!n.isValid(f))
3753
3770
  throw new Error("invalid scalar: out of range");
3754
- if (f === fe || v.is0())
3771
+ if (f === _e || v.is0())
3755
3772
  return R.ZERO;
3756
- if (f === Ae)
3773
+ if (f === Re)
3757
3774
  return v;
3758
3775
  if (D.hasCache(this))
3759
3776
  return this.multiply(f);
3760
3777
  if (_) {
3761
- const { k1neg: I, k1: L, k2neg: N, k2: M } = k(f), { p1: A, p2: $ } = Fr(R, v, L, M);
3762
- return z(_.beta, A, $, I, N);
3778
+ const { k1neg: I, k1: L, k2neg: O, k2: M } = k(f), { p1: T, p2: $ } = Gr(R, v, L, M);
3779
+ return z(_.beta, T, $, I, O);
3763
3780
  } else
3764
3781
  return D.unsafe(v, f);
3765
3782
  }
@@ -3776,39 +3793,39 @@ function zr(r, e = {}) {
3776
3793
  */
3777
3794
  isTorsionFree() {
3778
3795
  const { isTorsionFree: f } = e;
3779
- return i === Ae ? !0 : f ? f(R, this) : D.unsafe(this, a).is0();
3796
+ return i === Re ? !0 : f ? f(R, this) : D.unsafe(this, a).is0();
3780
3797
  }
3781
3798
  clearCofactor() {
3782
3799
  const { clearCofactor: f } = e;
3783
- return i === Ae ? this : f ? f(R, this) : this.multiplyUnsafe(i);
3800
+ return i === Re ? this : f ? f(R, this) : this.multiplyUnsafe(i);
3784
3801
  }
3785
3802
  isSmallOrder() {
3786
3803
  return this.multiplyUnsafe(i).is0();
3787
3804
  }
3788
3805
  toBytes(f = !0) {
3789
- return We(f, "isCompressed"), this.assertValidity(), x(R, this, f);
3806
+ return qe(f, "isCompressed"), this.assertValidity(), x(R, this, f);
3790
3807
  }
3791
3808
  toHex(f = !0) {
3792
- return De(this.toBytes(f));
3809
+ return Me(this.toBytes(f));
3793
3810
  }
3794
3811
  toString() {
3795
3812
  return `<Point ${this.is0() ? "ZERO" : this.toHex()}>`;
3796
3813
  }
3797
3814
  };
3798
3815
  // base / generator point
3799
- T(R, "BASE", new R(o.Gx, o.Gy, t.ONE)), // zero / infinity / identity point
3800
- T(R, "ZERO", new R(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
3816
+ A(R, "BASE", new R(o.Gx, o.Gy, t.ONE)), // zero / infinity / identity point
3817
+ A(R, "ZERO", new R(t.ZERO, t.ONE, t.ZERO)), // 0, 1, 0
3801
3818
  // math field
3802
- T(R, "Fp", t), // scalar field
3803
- T(R, "Fn", n);
3819
+ A(R, "Fp", t), // scalar field
3820
+ A(R, "Fn", n);
3804
3821
  let W = R;
3805
- const q = n.BITS, D = new Hr(W, e.endo ? Math.ceil(q / 2) : q);
3822
+ const q = n.BITS, D = new Fr(W, e.endo ? Math.ceil(q / 2) : q);
3806
3823
  return W.BASE.precompute(8), W;
3807
3824
  }
3808
- function Es(r) {
3825
+ function Is(r) {
3809
3826
  return Uint8Array.of(r ? 2 : 3);
3810
3827
  }
3811
- function Is(r, e) {
3828
+ function As(r, e) {
3812
3829
  return {
3813
3830
  secretKey: e.BYTES,
3814
3831
  publicKey: 1 + r.BYTES,
@@ -3817,8 +3834,8 @@ function Is(r, e) {
3817
3834
  signature: 2 * e.BYTES
3818
3835
  };
3819
3836
  }
3820
- function jr(r, e = {}) {
3821
- const { Fn: s } = r, t = e.randomBytes || ns, n = Object.assign(Is(r.Fp, s), { seed: ms(s.ORDER) });
3837
+ function Yr(r, e = {}) {
3838
+ const { Fn: s } = r, t = e.randomBytes || os, n = Object.assign(As(r.Fp, s), { seed: ws(s.ORDER) });
3822
3839
  function o(x) {
3823
3840
  try {
3824
3841
  const w = s.fromBytes(x);
@@ -3837,14 +3854,14 @@ function jr(r, e = {}) {
3837
3854
  }
3838
3855
  }
3839
3856
  function a(x = t(n.seed)) {
3840
- return Ur(V(x, n.seed, "seed"), s.ORDER);
3857
+ return Hr(V(x, n.seed, "seed"), s.ORDER);
3841
3858
  }
3842
3859
  function c(x, w = !0) {
3843
3860
  return r.BASE.multiply(s.fromBytes(x)).toBytes(w);
3844
3861
  }
3845
3862
  function l(x) {
3846
3863
  const { secretKey: w, publicKey: E, publicKeyUncompressed: y } = n;
3847
- if (!dt(x) || "_lengths" in s && s._lengths || w === E)
3864
+ if (!ut(x) || "_lengths" in s && s._lengths || w === E)
3848
3865
  return;
3849
3866
  const S = V(x, void 0, "key").length;
3850
3867
  return S === E || S === y;
@@ -3861,25 +3878,25 @@ function jr(r, e = {}) {
3861
3878
  isValidSecretKey: o,
3862
3879
  isValidPublicKey: i,
3863
3880
  randomSecretKey: a
3864
- }, m = Wr(a, c);
3881
+ }, m = qr(a, c);
3865
3882
  return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: m, Point: r, utils: h, lengths: n });
3866
3883
  }
3867
- function Yr(r, e, s = {}) {
3868
- es(e), ft(s, {}, {
3884
+ function Jr(r, e, s = {}) {
3885
+ ts(e), _t(s, {}, {
3869
3886
  hmac: "function",
3870
3887
  lowS: "boolean",
3871
3888
  randomBytes: "function",
3872
3889
  bits2int: "function",
3873
3890
  bits2int_modN: "function"
3874
3891
  }), s = Object.assign({}, s);
3875
- const t = s.randomBytes || ns, n = s.hmac || ((f, _) => vs(e, f, _)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: h, utils: m, lengths: x } = jr(r, s), w = {
3892
+ const t = s.randomBytes || os, n = s.hmac || ((f, _) => Ss(e, f, _)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: h, utils: m, lengths: x } = Yr(r, s), w = {
3876
3893
  prehash: !0,
3877
3894
  lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
3878
3895
  format: "compact",
3879
3896
  extraEntropy: !1
3880
- }, E = a * Ss < o.ORDER;
3897
+ }, E = a * Es < o.ORDER;
3881
3898
  function y(f) {
3882
- const _ = a >> Ae;
3899
+ const _ = a >> Re;
3883
3900
  return f > _;
3884
3901
  }
3885
3902
  function S(f, _) {
@@ -3887,22 +3904,22 @@ function Yr(r, e, s = {}) {
3887
3904
  throw new Error(`invalid signature ${f}: out of range 1..Point.Fn.ORDER`);
3888
3905
  return _;
3889
3906
  }
3890
- function O() {
3907
+ function C() {
3891
3908
  if (E)
3892
3909
  throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
3893
3910
  }
3894
3911
  function B(f, _) {
3895
- at(_);
3912
+ ct(_);
3896
3913
  const v = x.signature, I = _ === "compact" ? v : _ === "recovered" ? v + 1 : void 0;
3897
3914
  return V(f, I);
3898
3915
  }
3899
3916
  class b {
3900
3917
  constructor(_, v, I) {
3901
- T(this, "r");
3902
- T(this, "s");
3903
- T(this, "recovery");
3918
+ A(this, "r");
3919
+ A(this, "s");
3920
+ A(this, "recovery");
3904
3921
  if (this.r = S("r", _), this.s = S("s", v), I != null) {
3905
- if (O(), ![0, 1, 2, 3].includes(I))
3922
+ if (C(), ![0, 1, 2, 3].includes(I))
3906
3923
  throw new Error("invalid recovery id");
3907
3924
  this.recovery = I;
3908
3925
  }
@@ -3912,15 +3929,15 @@ function Yr(r, e, s = {}) {
3912
3929
  B(_, v);
3913
3930
  let I;
3914
3931
  if (v === "der") {
3915
- const { r: A, s: $ } = we.toSig(V(_));
3916
- return new b(A, $);
3932
+ const { r: T, s: $ } = ye.toSig(V(_));
3933
+ return new b(T, $);
3917
3934
  }
3918
3935
  v === "recovered" && (I = _[0], v = "compact", _ = _.subarray(1));
3919
- const L = x.signature / 2, N = _.subarray(0, L), M = _.subarray(L, L * 2);
3920
- return new b(i.fromBytes(N), i.fromBytes(M), I);
3936
+ const L = x.signature / 2, O = _.subarray(0, L), M = _.subarray(L, L * 2);
3937
+ return new b(i.fromBytes(O), i.fromBytes(M), I);
3921
3938
  }
3922
3939
  static fromHex(_, v) {
3923
- return this.fromBytes(Ge(_), v);
3940
+ return this.fromBytes(We(_), v);
3924
3941
  }
3925
3942
  assertRecovery() {
3926
3943
  const { recovery: _ } = this;
@@ -3932,10 +3949,10 @@ function Yr(r, e, s = {}) {
3932
3949
  return new b(this.r, this.s, _);
3933
3950
  }
3934
3951
  recoverPublicKey(_) {
3935
- const { r: v, s: I } = this, L = this.assertRecovery(), N = L === 2 || L === 3 ? v + a : v;
3936
- if (!o.isValid(N))
3952
+ const { r: v, s: I } = this, L = this.assertRecovery(), O = L === 2 || L === 3 ? v + a : v;
3953
+ if (!o.isValid(O))
3937
3954
  throw new Error("invalid recovery id: sig.r+curve.n != R.x");
3938
- const M = o.toBytes(N), A = r.fromBytes(be(Es((L & 1) === 0), M)), $ = i.inv(N), F = P(V(_, void 0, "msgHash")), J = i.create(-F * $), K = i.create(I * $), H = r.BASE.multiplyUnsafe(J).add(A.multiplyUnsafe(K));
3955
+ const M = o.toBytes(O), T = r.fromBytes(ve(Is((L & 1) === 0), M)), $ = i.inv(O), F = P(V(_, void 0, "msgHash")), J = i.create(-F * $), K = i.create(I * $), H = r.BASE.multiplyUnsafe(J).add(T.multiplyUnsafe(K));
3939
3956
  if (H.is0())
3940
3957
  throw new Error("invalid recovery: point at infinify");
3941
3958
  return H.assertValidity(), H;
@@ -3945,79 +3962,79 @@ function Yr(r, e, s = {}) {
3945
3962
  return y(this.s);
3946
3963
  }
3947
3964
  toBytes(_ = w.format) {
3948
- if (at(_), _ === "der")
3949
- return Ge(we.hexFromSig(this));
3950
- const { r: v, s: I } = this, L = i.toBytes(v), N = i.toBytes(I);
3951
- return _ === "recovered" ? (O(), be(Uint8Array.of(this.assertRecovery()), L, N)) : be(L, N);
3965
+ if (ct(_), _ === "der")
3966
+ return We(ye.hexFromSig(this));
3967
+ const { r: v, s: I } = this, L = i.toBytes(v), O = i.toBytes(I);
3968
+ return _ === "recovered" ? (C(), ve(Uint8Array.of(this.assertRecovery()), L, O)) : ve(L, O);
3952
3969
  }
3953
3970
  toHex(_) {
3954
- return De(this.toBytes(_));
3971
+ return Me(this.toBytes(_));
3955
3972
  }
3956
3973
  }
3957
3974
  const k = s.bits2int || function(_) {
3958
3975
  if (_.length > 8192)
3959
3976
  throw new Error("input is too large");
3960
- const v = Ve(_), I = _.length * 8 - c;
3977
+ const v = ze(_), I = _.length * 8 - c;
3961
3978
  return I > 0 ? v >> BigInt(I) : v;
3962
3979
  }, P = s.bits2int_modN || function(_) {
3963
3980
  return i.create(k(_));
3964
- }, G = pt(c);
3981
+ }, G = ft(c);
3965
3982
  function z(f) {
3966
- return Tr("num < 2^" + c, f, fe, G), i.toBytes(f);
3983
+ return Tr("num < 2^" + c, f, _e, G), i.toBytes(f);
3967
3984
  }
3968
3985
  function W(f, _) {
3969
3986
  return V(f, void 0, "message"), _ ? V(e(f), void 0, "prehashed message") : f;
3970
3987
  }
3971
3988
  function q(f, _, v) {
3972
- const { lowS: I, prehash: L, extraEntropy: N } = tt(v, w);
3989
+ const { lowS: I, prehash: L, extraEntropy: O } = st(v, w);
3973
3990
  f = W(f, L);
3974
- const M = P(f), A = i.fromBytes(_);
3975
- if (!i.isValidNot0(A))
3991
+ const M = P(f), T = i.fromBytes(_);
3992
+ if (!i.isValidNot0(T))
3976
3993
  throw new Error("invalid private key");
3977
- const $ = [z(A), z(M)];
3978
- if (N != null && N !== !1) {
3979
- const H = N === !0 ? t(x.secretKey) : N;
3994
+ const $ = [z(T), z(M)];
3995
+ if (O != null && O !== !1) {
3996
+ const H = O === !0 ? t(x.secretKey) : O;
3980
3997
  $.push(V(H, void 0, "extraEntropy"));
3981
3998
  }
3982
- const F = be(...$), J = M;
3999
+ const F = ve(...$), J = M;
3983
4000
  function K(H) {
3984
- const Z = k(H);
3985
- if (!i.isValidNot0(Z))
4001
+ const X = k(H);
4002
+ if (!i.isValidNot0(X))
3986
4003
  return;
3987
- const X = i.inv(Z), oe = r.BASE.multiply(Z).toAffine(), j = i.create(oe.x);
3988
- if (j === fe)
4004
+ const Z = i.inv(X), oe = r.BASE.multiply(X).toAffine(), j = i.create(oe.x);
4005
+ if (j === _e)
3989
4006
  return;
3990
- const Q = i.create(X * i.create(J + j * A));
3991
- if (Q === fe)
4007
+ const Q = i.create(Z * i.create(J + j * T));
4008
+ if (Q === _e)
3992
4009
  return;
3993
- let wt = (oe.x === j ? 0 : 2) | Number(oe.y & Ae), yt = Q;
3994
- return I && y(Q) && (yt = i.neg(Q), wt ^= 1), new b(j, yt, E ? void 0 : wt);
4010
+ let yt = (oe.x === j ? 0 : 2) | Number(oe.y & Re), bt = Q;
4011
+ return I && y(Q) && (bt = i.neg(Q), yt ^= 1), new b(j, bt, E ? void 0 : yt);
3995
4012
  }
3996
4013
  return { seed: F, k2sig: K };
3997
4014
  }
3998
4015
  function D(f, _, v = {}) {
3999
4016
  const { seed: I, k2sig: L } = q(f, _, v);
4000
- return Rr(e.outputLen, i.BYTES, n)(I, L).toBytes(v.format);
4017
+ return kr(e.outputLen, i.BYTES, n)(I, L).toBytes(v.format);
4001
4018
  }
4002
4019
  function R(f, _, v, I = {}) {
4003
- const { lowS: L, prehash: N, format: M } = tt(I, w);
4004
- if (v = V(v, void 0, "publicKey"), _ = W(_, N), !dt(f)) {
4005
- const A = f instanceof b ? ", use sig.toBytes()" : "";
4006
- throw new Error("verify expects Uint8Array signature" + A);
4020
+ const { lowS: L, prehash: O, format: M } = st(I, w);
4021
+ if (v = V(v, void 0, "publicKey"), _ = W(_, O), !ut(f)) {
4022
+ const T = f instanceof b ? ", use sig.toBytes()" : "";
4023
+ throw new Error("verify expects Uint8Array signature" + T);
4007
4024
  }
4008
4025
  B(f, M);
4009
4026
  try {
4010
- const A = b.fromBytes(f, M), $ = r.fromBytes(v);
4011
- if (L && A.hasHighS())
4027
+ const T = b.fromBytes(f, M), $ = r.fromBytes(v);
4028
+ if (L && T.hasHighS())
4012
4029
  return !1;
4013
- const { r: F, s: J } = A, K = P(_), H = i.inv(J), Z = i.create(K * H), X = i.create(F * H), oe = r.BASE.multiplyUnsafe(Z).add($.multiplyUnsafe(X));
4030
+ const { r: F, s: J } = T, K = P(_), H = i.inv(J), X = i.create(K * H), Z = i.create(F * H), oe = r.BASE.multiplyUnsafe(X).add($.multiplyUnsafe(Z));
4014
4031
  return oe.is0() ? !1 : i.create(oe.x) === F;
4015
4032
  } catch {
4016
4033
  return !1;
4017
4034
  }
4018
4035
  }
4019
- function C(f, _, v = {}) {
4020
- const { prehash: I } = tt(v, w);
4036
+ function N(f, _, v = {}) {
4037
+ const { prehash: I } = st(v, w);
4021
4038
  return _ = W(_, I), b.fromBytes(f, "recovered").recoverPublicKey(_).toBytes();
4022
4039
  }
4023
4040
  return Object.freeze({
@@ -4029,13 +4046,13 @@ function Yr(r, e, s = {}) {
4029
4046
  Point: r,
4030
4047
  sign: D,
4031
4048
  verify: R,
4032
- recoverPublicKey: C,
4049
+ recoverPublicKey: N,
4033
4050
  Signature: b,
4034
4051
  hash: e
4035
4052
  });
4036
4053
  }
4037
4054
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4038
- const xt = {
4055
+ const gt = {
4039
4056
  p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
4040
4057
  n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
4041
4058
  h: BigInt(1),
@@ -4043,44 +4060,44 @@ const xt = {
4043
4060
  b: BigInt(7),
4044
4061
  Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
4045
4062
  Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
4046
- }, Jr = {
4063
+ }, Xr = {
4047
4064
  beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
4048
4065
  basises: [
4049
4066
  [BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
4050
4067
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
4051
4068
  ]
4052
- }, Wt = /* @__PURE__ */ BigInt(2);
4069
+ }, qt = /* @__PURE__ */ BigInt(2);
4053
4070
  function Zr(r) {
4054
- const e = xt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, h = ae(d, s, e) * d % e, m = ae(h, s, e) * d % e, x = ae(m, Wt, e) * l % e, w = ae(x, n, e) * x % e, E = ae(w, o, e) * w % e, y = ae(E, a, e) * E % e, S = ae(y, c, e) * y % e, O = ae(S, a, e) * E % e, B = ae(O, s, e) * d % e, b = ae(B, i, e) * w % e, k = ae(b, t, e) * l % e, P = ae(k, Wt, e);
4055
- if (!ct.eql(ct.sqr(P), r))
4071
+ const e = gt.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, h = ae(d, s, e) * d % e, m = ae(h, s, e) * d % e, x = ae(m, qt, e) * l % e, w = ae(x, n, e) * x % e, E = ae(w, o, e) * w % e, y = ae(E, a, e) * E % e, S = ae(y, c, e) * y % e, C = ae(S, a, e) * E % e, B = ae(C, s, e) * d % e, b = ae(B, i, e) * w % e, k = ae(b, t, e) * l % e, P = ae(k, qt, e);
4072
+ if (!lt.eql(lt.sqr(P), r))
4056
4073
  throw new Error("Cannot find square root");
4057
4074
  return P;
4058
4075
  }
4059
- const ct = ze(xt.p, { sqrt: Zr }), Xr = /* @__PURE__ */ zr(xt, {
4060
- Fp: ct,
4061
- endo: Jr
4062
- }), Qr = /* @__PURE__ */ Yr(Xr, Sr), en = BigInt(0), Ce = BigInt(1), tn = BigInt(2), sn = BigInt(7), rn = BigInt(256), nn = BigInt(113), Ts = [], As = [], Rs = [];
4063
- for (let r = 0, e = Ce, s = 1, t = 0; r < 24; r++) {
4064
- [s, t] = [t, (2 * s + 3 * t) % 5], Ts.push(2 * (5 * t + s)), As.push((r + 1) * (r + 2) / 2 % 64);
4065
- let n = en;
4076
+ const lt = je(gt.p, { sqrt: Zr }), Qr = /* @__PURE__ */ jr(gt, {
4077
+ Fp: lt,
4078
+ endo: Xr
4079
+ }), en = /* @__PURE__ */ Jr(Qr, Er), tn = BigInt(0), Oe = BigInt(1), sn = BigInt(2), rn = BigInt(7), nn = BigInt(256), on = BigInt(113), Ts = [], Rs = [], ks = [];
4080
+ for (let r = 0, e = Oe, s = 1, t = 0; r < 24; r++) {
4081
+ [s, t] = [t, (2 * s + 3 * t) % 5], Ts.push(2 * (5 * t + s)), Rs.push((r + 1) * (r + 2) / 2 % 64);
4082
+ let n = tn;
4066
4083
  for (let o = 0; o < 7; o++)
4067
- e = (e << Ce ^ (e >> sn) * nn) % rn, e & tn && (n ^= Ce << (Ce << BigInt(o)) - Ce);
4068
- Rs.push(n);
4084
+ e = (e << Oe ^ (e >> rn) * on) % nn, e & sn && (n ^= Oe << (Oe << BigInt(o)) - Oe);
4085
+ ks.push(n);
4069
4086
  }
4070
- const ks = _r(Rs, !0), on = ks[0], an = ks[1], qt = (r, e, s) => s > 32 ? mr(r, e, s) : xr(r, e, s), Kt = (r, e, s) => s > 32 ? wr(r, e, s) : gr(r, e, s);
4071
- function cn(r, e = 24) {
4087
+ const Ps = xr(ks, !0), an = Ps[0], cn = Ps[1], Kt = (r, e, s) => s > 32 ? wr(r, e, s) : gr(r, e, s), Vt = (r, e, s) => s > 32 ? yr(r, e, s) : mr(r, e, s);
4088
+ function ln(r, e = 24) {
4072
4089
  const s = new Uint32Array(10);
4073
4090
  for (let t = 24 - e; t < 24; t++) {
4074
4091
  for (let i = 0; i < 10; i++)
4075
4092
  s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
4076
4093
  for (let i = 0; i < 10; i += 2) {
4077
- const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], h = qt(l, d, 1) ^ s[a], m = Kt(l, d, 1) ^ s[a + 1];
4094
+ const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], h = Kt(l, d, 1) ^ s[a], m = Vt(l, d, 1) ^ s[a + 1];
4078
4095
  for (let x = 0; x < 50; x += 10)
4079
4096
  r[i + x] ^= h, r[i + x + 1] ^= m;
4080
4097
  }
4081
4098
  let n = r[2], o = r[3];
4082
4099
  for (let i = 0; i < 24; i++) {
4083
- const a = As[i], c = qt(n, o, a), l = Kt(n, o, a), d = Ts[i];
4100
+ const a = Rs[i], c = Kt(n, o, a), l = Vt(n, o, a), d = Ts[i];
4084
4101
  n = r[d], o = r[d + 1], r[d] = c, r[d + 1] = l;
4085
4102
  }
4086
4103
  for (let i = 0; i < 50; i += 10) {
@@ -4089,36 +4106,36 @@ function cn(r, e = 24) {
4089
4106
  for (let a = 0; a < 10; a++)
4090
4107
  r[i + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
4091
4108
  }
4092
- r[0] ^= on[t], r[1] ^= an[t];
4109
+ r[0] ^= an[t], r[1] ^= cn[t];
4093
4110
  }
4094
- ke(s);
4111
+ Pe(s);
4095
4112
  }
4096
- class gt {
4113
+ class mt {
4097
4114
  // NOTE: we accept arguments in bytes instead of bits here.
4098
4115
  constructor(e, s, t, n = !1, o = 24) {
4099
- T(this, "state");
4100
- T(this, "pos", 0);
4101
- T(this, "posOut", 0);
4102
- T(this, "finished", !1);
4103
- T(this, "state32");
4104
- T(this, "destroyed", !1);
4105
- T(this, "blockLen");
4106
- T(this, "suffix");
4107
- T(this, "outputLen");
4108
- T(this, "enableXOF", !1);
4109
- T(this, "rounds");
4110
- if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, xe(t, "outputLen"), !(0 < e && e < 200))
4116
+ A(this, "state");
4117
+ A(this, "pos", 0);
4118
+ A(this, "posOut", 0);
4119
+ A(this, "finished", !1);
4120
+ A(this, "state32");
4121
+ A(this, "destroyed", !1);
4122
+ A(this, "blockLen");
4123
+ A(this, "suffix");
4124
+ A(this, "outputLen");
4125
+ A(this, "enableXOF", !1);
4126
+ A(this, "rounds");
4127
+ if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, ge(t, "outputLen"), !(0 < e && e < 200))
4111
4128
  throw new Error("only keccak-f1600 function is supported");
4112
- this.state = new Uint8Array(200), this.state32 = or(this.state);
4129
+ this.state = new Uint8Array(200), this.state32 = ir(this.state);
4113
4130
  }
4114
4131
  clone() {
4115
4132
  return this._cloneInto();
4116
4133
  }
4117
4134
  keccak() {
4118
- Nt(this.state32), cn(this.state32, this.rounds), Nt(this.state32), this.posOut = 0, this.pos = 0;
4135
+ Ct(this.state32), ln(this.state32, this.rounds), Ct(this.state32), this.posOut = 0, this.pos = 0;
4119
4136
  }
4120
4137
  update(e) {
4121
- Re(this), V(e);
4138
+ ke(this), V(e);
4122
4139
  const { blockLen: s, state: t } = this, n = e.length;
4123
4140
  for (let o = 0; o < n; ) {
4124
4141
  const i = Math.min(s - this.pos, n - o);
@@ -4136,7 +4153,7 @@ class gt {
4136
4153
  e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
4137
4154
  }
4138
4155
  writeInto(e) {
4139
- Re(this, !1), V(e), this.finish();
4156
+ ke(this, !1), V(e), this.finish();
4140
4157
  const s = this.state, { blockLen: t } = this;
4141
4158
  for (let n = 0, o = e.length; n < o; ) {
4142
4159
  this.posOut >= t && this.keccak();
@@ -4151,10 +4168,10 @@ class gt {
4151
4168
  return this.writeInto(e);
4152
4169
  }
4153
4170
  xof(e) {
4154
- return xe(e), this.xofInto(new Uint8Array(e));
4171
+ return ge(e), this.xofInto(new Uint8Array(e));
4155
4172
  }
4156
4173
  digestInto(e) {
4157
- if (ts(e, this), this.finished)
4174
+ if (ss(e, this), this.finished)
4158
4175
  throw new Error("digest() was already called");
4159
4176
  return this.writeInto(e), this.destroy(), e;
4160
4177
  }
@@ -4162,21 +4179,21 @@ class gt {
4162
4179
  return this.digestInto(new Uint8Array(this.outputLen));
4163
4180
  }
4164
4181
  destroy() {
4165
- this.destroyed = !0, ke(this.state);
4182
+ this.destroyed = !0, Pe(this.state);
4166
4183
  }
4167
4184
  _cloneInto(e) {
4168
4185
  const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
4169
- return e || (e = new gt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
4186
+ return e || (e = new mt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
4170
4187
  }
4171
4188
  }
4172
- const ln = (r, e, s, t = {}) => rs(() => new gt(e, r, s), t), Vt = /* @__PURE__ */ ln(1, 136, 32), dn = 60;
4173
- class un {
4189
+ const dn = (r, e, s, t = {}) => ns(() => new mt(e, r, s), t), zt = /* @__PURE__ */ dn(1, 136, 32), un = 60;
4190
+ class hn {
4174
4191
  constructor() {
4175
4192
  this.jwks = null;
4176
4193
  }
4177
4194
  setJWKSEndpoint(e) {
4178
4195
  try {
4179
- this.jwks = Ds(new URL(e)), u.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4196
+ this.jwks = Ms(new URL(e)), u.log("[CROSSx] JWKS 엔드포인트 설정:", e);
4180
4197
  } catch (s) {
4181
4198
  u.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
4182
4199
  }
@@ -4190,7 +4207,7 @@ class un {
4190
4207
  iat: t.iat
4191
4208
  });
4192
4209
  const n = Math.floor(Date.now() / 1e3);
4193
- if (t.exp && t.exp + dn < n)
4210
+ if (t.exp && t.exp + un < n)
4194
4211
  return u.warn("[CROSSx] 토큰 만료:", {
4195
4212
  exp: t.exp,
4196
4213
  now: n,
@@ -4200,7 +4217,7 @@ class un {
4200
4217
  return u.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
4201
4218
  if (this.jwks)
4202
4219
  try {
4203
- const { payload: o } = await Ms(e, this.jwks, {
4220
+ const { payload: o } = await $s(e, this.jwks, {
4204
4221
  algorithms: ["RS256", "ES256"]
4205
4222
  });
4206
4223
  return u.log("[CROSSx] JWT 서명 검증 성공"), {
@@ -4219,7 +4236,7 @@ class un {
4219
4236
  }
4220
4237
  }
4221
4238
  decodeJWT(e) {
4222
- return $s(e);
4239
+ return Bs(e);
4223
4240
  }
4224
4241
  /**
4225
4242
  * EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
@@ -4234,29 +4251,29 @@ class un {
4234
4251
  ${t.length}`
4235
4252
  ), o = new Uint8Array(n.length + t.length);
4236
4253
  o.set(n, 0), o.set(t, n.length);
4237
- const i = Vt(o), a = s.startsWith("0x") ? s.slice(2) : s;
4254
+ const i = zt(o), a = s.startsWith("0x") ? s.slice(2) : s;
4238
4255
  if (a.length !== 130)
4239
4256
  throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
4240
- const c = hn(a), l = c.slice(0, 32), d = c.slice(32, 64), h = c[64], m = h >= 27 ? h - 27 : h, E = new Qr.Signature(
4241
- zt(l),
4242
- zt(d)
4243
- ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), y = Vt(E);
4244
- return "0x" + De(y.slice(12));
4257
+ const c = pn(a), l = c.slice(0, 32), d = c.slice(32, 64), h = c[64], m = h >= 27 ? h - 27 : h, E = new en.Signature(
4258
+ jt(l),
4259
+ jt(d)
4260
+ ).addRecoveryBit(m).recoverPublicKey(i).toBytes(!1).slice(1), y = zt(E);
4261
+ return "0x" + Me(y.slice(12));
4245
4262
  }
4246
4263
  }
4247
- function hn(r) {
4264
+ function pn(r) {
4248
4265
  const e = new Uint8Array(r.length / 2);
4249
4266
  for (let s = 0; s < e.length; s++)
4250
4267
  e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
4251
4268
  return e;
4252
4269
  }
4253
- function zt(r) {
4270
+ function jt(r) {
4254
4271
  let e = "0x";
4255
4272
  for (const s of r) e += s.toString(16).padStart(2, "0");
4256
4273
  return BigInt(e);
4257
4274
  }
4258
- const pn = 3e4, fn = 1e3;
4259
- class _n {
4275
+ const fn = 3e4, _n = 1e3;
4276
+ class xn {
4260
4277
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4261
4278
  async request(e) {
4262
4279
  const s = e.retries ?? 0;
@@ -4267,7 +4284,7 @@ class _n {
4267
4284
  } catch (n) {
4268
4285
  if (t === s) throw n;
4269
4286
  }
4270
- await new Promise((n) => setTimeout(n, fn * 2 ** t));
4287
+ await new Promise((n) => setTimeout(n, _n * 2 ** t));
4271
4288
  }
4272
4289
  throw new Error("Unexpected: retry loop exited without result");
4273
4290
  }
@@ -4275,7 +4292,7 @@ class _n {
4275
4292
  async _doRequest(e) {
4276
4293
  const s = new AbortController(), t = setTimeout(
4277
4294
  () => s.abort(),
4278
- e.timeoutMs ?? pn
4295
+ e.timeoutMs ?? fn
4279
4296
  );
4280
4297
  try {
4281
4298
  const n = await fetch(e.url, {
@@ -4302,12 +4319,12 @@ class _n {
4302
4319
  }
4303
4320
  }
4304
4321
  }
4305
- const xn = /* @__PURE__ */ new Set([
4322
+ const gn = /* @__PURE__ */ new Set([
4306
4323
  "https://cross-wallet-oauth.crosstoken.io",
4307
4324
  "https://stg-cross-wallet-oauth.crosstoken.io",
4308
4325
  "https://dev-cross-wallet-oauth.crosstoken.io"
4309
4326
  ]);
4310
- class ye {
4327
+ class be {
4311
4328
  static generateRandom16Hex() {
4312
4329
  const e = new Uint8Array(16);
4313
4330
  return crypto.getRandomValues(e), Array.from(e, (s) => s.toString(16).padStart(2, "0")).join("");
@@ -4331,7 +4348,7 @@ class ye {
4331
4348
  * - Google 및 기타: originalNonce === jwt.nonce
4332
4349
  */
4333
4350
  static async verifyIdTokenNonce(e, s) {
4334
- const t = ye.parseJwtPayload(e), n = t.nonce, o = typeof t.iss == "string" ? t.iss : "(unknown)";
4351
+ const t = be.parseJwtPayload(e), n = t.nonce, o = typeof t.iss == "string" ? t.iss : "(unknown)";
4335
4352
  if (u.log("[CROSSx] nonce 검증 시작 —", {
4336
4353
  iss: o,
4337
4354
  nonceClaimType: typeof n,
@@ -4353,7 +4370,7 @@ class ye {
4353
4370
  "ID Token에 nonce claim이 없습니다 — OAuth 서버 설정을 확인해 주세요"
4354
4371
  );
4355
4372
  if (o.includes("appleid.apple.com")) {
4356
- const i = await ye.sha256Hex(s);
4373
+ const i = await be.sha256Hex(s);
4357
4374
  if (u.log("[CROSSx] Apple nonce 검증 —", {
4358
4375
  expectedHashLength: i.length,
4359
4376
  receivedHashLength: n.length,
@@ -4370,7 +4387,7 @@ class ye {
4370
4387
  }
4371
4388
  openAuth(e) {
4372
4389
  return new Promise((s, t) => {
4373
- const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = ye.generateRandom16Hex(), l = ye.generateRandom16Hex(), d = e.authUrl.includes("?") ? "&" : "?", h = `${e.authUrl}${d}state=${c}&nonce=${l}`;
4390
+ const n = Math.max(e.width ?? 500, 500), o = Math.max(e.height ?? 700, 700), i = window.screenX + (window.outerWidth - n) / 2, a = window.screenY + (window.outerHeight - o) / 2, c = be.generateRandom16Hex(), l = be.generateRandom16Hex(), d = e.authUrl.includes("?") ? "&" : "?", h = `${e.authUrl}${d}state=${c}&nonce=${l}`;
4374
4391
  u.log("[CROSSx] OAuth 팝업 열기 — state, nonce 생성 완료:", {
4375
4392
  stateLength: c.length,
4376
4393
  nonceLength: l.length,
@@ -4389,7 +4406,7 @@ class ye {
4389
4406
  u.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), b(), t(new Error("Authentication timeout"));
4390
4407
  }, 5 * 60 * 1e3), w = 10, E = 30;
4391
4408
  let y = 0, S = null;
4392
- const O = () => {
4409
+ const C = () => {
4393
4410
  clearInterval(B), u.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + E + "초간 대기합니다"), S = setTimeout(() => {
4394
4411
  b(), t(new Error(
4395
4412
  "OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
@@ -4398,16 +4415,16 @@ class ye {
4398
4415
  }, B = setInterval(() => {
4399
4416
  y++;
4400
4417
  try {
4401
- m.closed && (y <= w ? O() : (b(), t(new Error("로그인이 취소되었습니다"))));
4418
+ m.closed && (y <= w ? C() : (b(), t(new Error("로그인이 취소되었습니다"))));
4402
4419
  } catch {
4403
- O();
4420
+ C();
4404
4421
  }
4405
4422
  }, 1e3), b = () => {
4406
4423
  clearTimeout(x), clearInterval(B), S && clearTimeout(S), window.removeEventListener("message", k);
4407
4424
  }, k = (P) => {
4408
4425
  var z, W, q, D, R;
4409
4426
  if (P.origin !== e.expectedOrigin) return;
4410
- if (!xn.has(P.origin)) {
4427
+ if (!gn.has(P.origin)) {
4411
4428
  u.error("[CROSSx] postMessage origin이 허용 목록에 없음:", P.origin), b(), t(new Error("Unauthorized OAuth origin"));
4412
4429
  return;
4413
4430
  }
@@ -4418,17 +4435,17 @@ class ye {
4418
4435
  return;
4419
4436
  }
4420
4437
  if (P.data.status === "success") {
4421
- const C = (W = P.data.data) == null ? void 0 : W.idToken, f = (q = P.data.data) == null ? void 0 : q.accessToken, _ = f ?? C;
4438
+ const N = (W = P.data.data) == null ? void 0 : W.idToken, f = (q = P.data.data) == null ? void 0 : q.accessToken, _ = f ?? N;
4422
4439
  if (u.log("[CROSSx] OAuth 토큰 수신:", {
4423
4440
  hasAccessToken: !!f,
4424
- hasIdToken: !!C
4441
+ hasIdToken: !!N
4425
4442
  }), !_) {
4426
4443
  u.error("[CROSSx] 토큰을 찾을 수 없음:", P.data), t(new Error("Token not found in response"));
4427
4444
  return;
4428
4445
  }
4429
- C ? ye.verifyIdTokenNonce(C, l).then(() => s(_)).catch((v) => {
4446
+ N ? be.verifyIdTokenNonce(N, l).then(() => s(_)).catch((v) => {
4430
4447
  u.error("[CROSSx] nonce 검증 실패:", v), t(v instanceof Error ? v : new Error("nonce verification failed"));
4431
- }) : f ? f.split(".").length === 3 ? ye.verifyIdTokenNonce(f, l).then(() => s(_)).catch((I) => {
4448
+ }) : f ? f.split(".").length === 3 ? be.verifyIdTokenNonce(f, l).then(() => s(_)).catch((I) => {
4432
4449
  u.error("[CROSSx] accessToken nonce 검증 실패:", I), t(I instanceof Error ? I : new Error("nonce verification failed"));
4433
4450
  }) : (u.warn(
4434
4451
  "[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
@@ -4441,8 +4458,8 @@ class ye {
4441
4458
  });
4442
4459
  }
4443
4460
  }
4444
- const Ne = "crossx_wallet_data", Te = "crossx_mock_pin_hash";
4445
- class gn {
4461
+ const Ce = "crossx_wallet_data", Te = "crossx_mock_pin_hash";
4462
+ class mn {
4446
4463
  constructor(e, s) {
4447
4464
  this.storage = e, this.pinStore = s ?? null;
4448
4465
  }
@@ -4455,13 +4472,13 @@ class gn {
4455
4472
  async checkWallet() {
4456
4473
  if (this.migrateScenario !== void 0)
4457
4474
  return u.log("[Mock] checkWallet → migration_required"), "migration_required";
4458
- const s = await this.storage.get(Ne) ? "exists" : "not_found";
4475
+ const s = await this.storage.get(Ce) ? "exists" : "not_found";
4459
4476
  return u.log(`[Mock] checkWallet → ${s}`), s;
4460
4477
  }
4461
4478
  async getOrCreateWallet(e) {
4462
4479
  var s;
4463
4480
  try {
4464
- const t = await this.storage.get(Ne);
4481
+ const t = await this.storage.get(Ce);
4465
4482
  if (t) return t;
4466
4483
  const n = {
4467
4484
  id: e,
@@ -4469,7 +4486,7 @@ class gn {
4469
4486
  derivationPath: "m/44'/60'/0'/0/0",
4470
4487
  createdAt: Date.now()
4471
4488
  };
4472
- await this.storage.set(Ne, n);
4489
+ await this.storage.set(Ce, n);
4473
4490
  const o = (s = this.pinStore) == null ? void 0 : s.get();
4474
4491
  return o && (await this.storage.set(Te, o), u.log("[Mock] 지갑 생성 — PIN 저장됨")), n;
4475
4492
  } catch (t) {
@@ -4478,7 +4495,7 @@ class gn {
4478
4495
  }
4479
4496
  /** GET /mnemonic/addresses 모킹 — PIN 불필요, 캐시된 주소 반환 */
4480
4497
  async getAddresses(e) {
4481
- const s = await this.storage.get(Ne);
4498
+ const s = await this.storage.get(Ce);
4482
4499
  return s ? [{ address: s.address, index: 0 }] : [];
4483
4500
  }
4484
4501
  async getAddress(e, s) {
@@ -4558,7 +4575,7 @@ class gn {
4558
4575
  derivationPath: "m/44'/60'/0'/0/0",
4559
4576
  createdAt: Date.now()
4560
4577
  };
4561
- await this.storage.set(Ne, t);
4578
+ await this.storage.set(Ce, t);
4562
4579
  const n = (o = this.pinStore) == null ? void 0 : o.get();
4563
4580
  return n && (await this.storage.set(Te, n), u.log("[Mock] 마이그레이션 — PIN 저장됨")), t;
4564
4581
  }
@@ -4587,7 +4604,7 @@ class gn {
4587
4604
  ).join("");
4588
4605
  }
4589
4606
  }
4590
- class Oe {
4607
+ class Le {
4591
4608
  constructor(e, s, t, n, o) {
4592
4609
  this._walletStatusCache = null, this.adapterConfig = e, this.projectId = e.projectId, this.storage = s, this.transport = t, this.tokenStore = n, this.pinStore = o ?? null;
4593
4610
  }
@@ -4633,7 +4650,7 @@ class Oe {
4633
4650
  url: o,
4634
4651
  method: e
4635
4652
  });
4636
- const m = Oe.mapGatewayError(d.code, d.data), x = Oe.getGatewayErrorMessage(d.code, h), w = d.data, E = m === p.PIN_LOCKED ? Oe.extractLockDetails(w) : w ?? void 0, y = new g(m, x, E);
4653
+ const m = Le.mapGatewayError(d.code, d.data), x = Le.getGatewayErrorMessage(d.code, h), w = d.data, E = m === p.PIN_LOCKED ? Le.extractLockDetails(w) : w ?? void 0, y = new g(m, x, E);
4637
4654
  throw m === p.AUTH_NOT_AUTHENTICATED && this._onUnauthorized && (u.warn("[CROSSx] Gateway -10002 감지 — 강제 로그아웃 실행"), this._onUnauthorized()), y;
4638
4655
  }
4639
4656
  return u.log("[CROSSx] Wallet Gateway API 성공:", { code: d.code, url: o, method: e }), d.data ?? d;
@@ -4865,16 +4882,27 @@ class Oe {
4865
4882
  case -10002:
4866
4883
  return p.AUTH_NOT_AUTHENTICATED;
4867
4884
  case -10001:
4868
- case -10009:
4869
4885
  return p.UNKNOWN_ERROR;
4870
4886
  case -10006:
4871
4887
  return p.GATEWAY_INTERNAL_ERROR;
4888
+ case -10007:
4889
+ return p.BROADCAST_FAILED;
4872
4890
  case -10008:
4873
4891
  return p.GATEWAY_LOCK_CONFLICT;
4892
+ case -10004:
4893
+ return p.WALLET_ALREADY_EXISTS;
4894
+ case -10005:
4895
+ return p.WALLET_NOT_FOUND;
4896
+ case -10011:
4897
+ return p.WALLET_NOT_FOUND;
4898
+ case -10030:
4899
+ return p.WALLET_INCONSISTENT_STATE;
4874
4900
  case -10010:
4875
4901
  return p.MIGRATION_FAILED;
4876
4902
  case -10012:
4877
4903
  return p.MIGRATION_BACKUP_EXISTS;
4904
+ case -10013:
4905
+ return p.WITHDRAW_FAILED;
4878
4906
  case -10027:
4879
4907
  return p.MIGRATION_PIN_LOCKED;
4880
4908
  case -10022:
@@ -4883,14 +4911,16 @@ class Oe {
4883
4911
  return p.PROJECT_ID_MISSING;
4884
4912
  case -10024:
4885
4913
  return p.ORIGIN_NOT_ALLOWED;
4914
+ case -10025:
4915
+ return p.INVALID_APP_TYPE;
4886
4916
  case -10028:
4887
4917
  return p.PIN_WRONG;
4888
4918
  case -10029:
4889
4919
  return p.PIN_INVALID;
4890
4920
  case -10031:
4891
4921
  return p.PIN_LOCKED;
4892
- case -10030:
4893
- return p.WALLET_INCONSISTENT_STATE;
4922
+ case -10032:
4923
+ return p.PIN_REPEATED_PATTERN;
4894
4924
  case -10026:
4895
4925
  return p.TYPED_DATA_CHAIN_ID_MISMATCH;
4896
4926
  case -10014:
@@ -4902,6 +4932,14 @@ class Oe {
4902
4932
  case -10017:
4903
4933
  case -10018:
4904
4934
  return p.PREPARE_MISMATCH;
4935
+ case -10020:
4936
+ return p.CHAIN_NOT_SUPPORTED;
4937
+ case -10021:
4938
+ return p.INVALID_CHAIN;
4939
+ case -10040:
4940
+ return p.HMAC_REQUIRED;
4941
+ case -10041:
4942
+ return p.HMAC_VERIFICATION_FAILED;
4905
4943
  default:
4906
4944
  return p.UNKNOWN_ERROR;
4907
4945
  }
@@ -4910,34 +4948,50 @@ class Oe {
4910
4948
  switch (e) {
4911
4949
  case -10002:
4912
4950
  return "Session expired. Please sign in again.";
4951
+ case -10004:
4952
+ return "Wallet already exists for this user.";
4953
+ case -10005:
4954
+ return "User wallet not found.";
4913
4955
  case -10006:
4914
4956
  return "Internal server error. Please try again later.";
4957
+ case -10007:
4958
+ return "Transaction broadcast failed. Please try again.";
4915
4959
  case -10008:
4916
4960
  return "Another operation is in progress. Please try again later.";
4961
+ case -10013:
4962
+ return "Withdraw failed. Please try again.";
4917
4963
  case -10022:
4918
4964
  return "Project is not whitelisted. Verify your projectId and register the current origin in the management console.";
4919
4965
  case -10023:
4920
4966
  return "Project ID is required. Set the projectId field in SDKConfig.";
4921
4967
  case -10024:
4922
- return "Origin is not in the allowed list. Register the current domain in the management console.";
4968
+ return "Origin or App ID is required. Register the current domain or set X-App-Id header.";
4969
+ case -10025:
4970
+ return "Invalid app type. X-App-Type must be android, ios, or windows.";
4923
4971
  case -10026:
4924
4972
  return "Domain chainId mismatch: the chainId in typedData.domain does not match the request chainId.";
4973
+ case -10027:
4974
+ return "Too many incorrect PIN attempts. Your account has been temporarily locked.";
4925
4975
  case -10028:
4926
4976
  return "Incorrect PIN. Please try again.";
4927
4977
  case -10029:
4928
- return "Invalid PIN format. Please enter a 6-digit numeric PIN.";
4929
- case -10031:
4930
- return "Too many failed PIN attempts. Your account is temporarily locked.";
4931
- case -10027:
4932
- return "Too many incorrect PIN attempts. Your account has been temporarily locked.";
4978
+ return "Sequential PIN is not allowed. Please choose a different PIN.";
4933
4979
  case -10030:
4934
4980
  return "Wallet is in an inconsistent state. Please contact support.";
4981
+ case -10031:
4982
+ return "Too many failed PIN attempts. Your account is temporarily locked.";
4983
+ case -10032:
4984
+ return "Repeated digit pattern is not allowed. Please choose a different PIN.";
4985
+ case -10040:
4986
+ return "HMAC signature header is required.";
4987
+ case -10041:
4988
+ return "HMAC signature verification failed.";
4935
4989
  default:
4936
4990
  return `Request failed (${e}): ${s}`;
4937
4991
  }
4938
4992
  }
4939
4993
  }
4940
- class Le {
4994
+ class De {
4941
4995
  constructor(e, s) {
4942
4996
  this.cache = /* @__PURE__ */ new Map(), this.loadedAt = 0, this.usingFallback = !1, this.adapterConfig = e, this.projectId = e.projectId, this.transport = s;
4943
4997
  }
@@ -4955,7 +5009,7 @@ class Le {
4955
5009
  const s = e.data.chains;
4956
5010
  return this.populateCache(s, !1), s;
4957
5011
  } catch {
4958
- const e = Le.fallbackChains();
5012
+ const e = De.fallbackChains();
4959
5013
  return this.populateCache(e, !0), e;
4960
5014
  }
4961
5015
  }
@@ -4969,7 +5023,7 @@ class Le {
4969
5023
  }
4970
5024
  isCacheValid() {
4971
5025
  if (this.loadedAt === 0) return !1;
4972
- const e = this.usingFallback ? tr : er;
5026
+ const e = this.usingFallback ? sr : tr;
4973
5027
  return e === 0 ? !0 : Date.now() - this.loadedAt < e;
4974
5028
  }
4975
5029
  populateCache(e, s) {
@@ -4991,13 +5045,13 @@ class Le {
4991
5045
  if (e.code < 0) {
4992
5046
  const s = typeof e.data == "string" ? e.data : e.message ?? "체인 레지스트리 요청에 실패했습니다";
4993
5047
  throw new g(
4994
- Le.mapErrorCode(e.code),
5048
+ De.mapErrorCode(e.code),
4995
5049
  s
4996
5050
  );
4997
5051
  }
4998
5052
  }
4999
5053
  fallbackOrThrow(e) {
5000
- const s = Le.fallbackChains().find(
5054
+ const s = De.fallbackChains().find(
5001
5055
  (t) => t.chainId === e
5002
5056
  );
5003
5057
  if (s) return s;
@@ -5007,7 +5061,7 @@ class Le {
5007
5061
  );
5008
5062
  }
5009
5063
  static fallbackChains() {
5010
- return Object.values(Ke).map((e) => ({
5064
+ return Object.values(Ve).map((e) => ({
5011
5065
  chainId: e.caipId,
5012
5066
  rpcUrl: e.rpcUrl
5013
5067
  }));
@@ -5031,7 +5085,7 @@ class Le {
5031
5085
  }
5032
5086
  }
5033
5087
  }
5034
- const jt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", mn = {
5088
+ const Yt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", wn = {
5035
5089
  light: {
5036
5090
  bg: "#FFFFFF",
5037
5091
  border: "rgba(18,18,18,0.05)",
@@ -5087,8 +5141,8 @@ const jt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", mn = {
5087
5141
  onPrimary: "#FFFFFF"
5088
5142
  }
5089
5143
  };
5090
- function Yt(r, e) {
5091
- const s = mn[r], t = e == null ? void 0 : e[r];
5144
+ function Jt(r, e) {
5145
+ const s = wn[r], t = e == null ? void 0 : e[r];
5092
5146
  return t ? {
5093
5147
  ...s,
5094
5148
  // ── Brand
@@ -5120,7 +5174,7 @@ function Yt(r, e) {
5120
5174
  ...t.error !== void 0 && { errorColor: t.error }
5121
5175
  } : s;
5122
5176
  }
5123
- const wn = `
5177
+ const yn = `
5124
5178
  @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
5125
5179
 
5126
5180
  #${te} {
@@ -5133,6 +5187,7 @@ const wn = `
5133
5187
  background: rgba(0,0,0,0.55);
5134
5188
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
5135
5189
  animation: __crossx-fade-in 0.15s ease;
5190
+ pointer-events: auto;
5136
5191
  }
5137
5192
  @keyframes __crossx-fade-in {
5138
5193
  from { opacity: 0; }
@@ -6773,24 +6828,30 @@ const wn = `
6773
6828
  }
6774
6829
  `;
6775
6830
  function he() {
6776
- let r = document.getElementById(jt);
6777
- r || (r = document.createElement("style"), r.id = jt, document.head.appendChild(r)), r.textContent = wn;
6831
+ let r = document.getElementById(Yt);
6832
+ r || (r = document.createElement("style"), r.id = Yt, document.head.appendChild(r)), r.textContent = yn;
6833
+ }
6834
+ function pe(r) {
6835
+ const e = (s) => s.stopPropagation();
6836
+ for (const s of ["pointerdown", "pointerup", "mousedown", "mouseup", "click", "touchstart", "touchend"])
6837
+ r.addEventListener(s, e);
6838
+ document.body.appendChild(r);
6778
6839
  }
6779
6840
  function se(r) {
6780
6841
  return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
6781
6842
  }
6782
- function yn(r, e = "CROSS", s = 18) {
6843
+ function bn(r, e = "CROSS", s = 18) {
6783
6844
  if (!r || r === "0x" || r === "0x0") return null;
6784
6845
  try {
6785
6846
  const t = BigInt(r);
6786
6847
  if (t === 0n) return null;
6787
- const n = lt(t, s);
6848
+ const n = dt(t, s);
6788
6849
  return n === "0" ? null : `${n} ${e}`;
6789
6850
  } catch {
6790
6851
  return null;
6791
6852
  }
6792
6853
  }
6793
- const Jt = {
6854
+ const Xt = {
6794
6855
  1: "Ethereum Mainnet",
6795
6856
  5: "Goerli Testnet",
6796
6857
  11155111: "Ethereum Sepolia",
@@ -6813,16 +6874,16 @@ const Jt = {
6813
6874
  612044: "CROSS Testnet",
6814
6875
  612055: "CROSS Mainnet"
6815
6876
  };
6816
- function Ps(r) {
6877
+ function Ns(r) {
6817
6878
  const e = parseInt(r.split(":")[1] ?? "", 10);
6818
- return !isNaN(e) && Jt[e] ? Jt[e] : r;
6879
+ return !isNaN(e) && Xt[e] ? Xt[e] : r;
6819
6880
  }
6820
- function lt(r, e) {
6881
+ function dt(r, e) {
6821
6882
  if (r === 0n) return "0";
6822
6883
  const s = 10n ** BigInt(e), t = r / s, i = (r % s).toString().padStart(e, "0").slice(0, 6).replace(/0+$/, "");
6823
6884
  return i ? `${t}.${i}` : `${t}`;
6824
6885
  }
6825
- function st(r) {
6886
+ function rt(r) {
6826
6887
  try {
6827
6888
  const e = BigInt(r), s = e / 1000000000n, n = (e % 1000000000n).toString().padStart(9, "0").slice(0, 2).replace(/0+$/, "");
6828
6889
  return n ? `${s}.${n}` : `${s}`;
@@ -6830,25 +6891,25 @@ function st(r) {
6830
6891
  return r;
6831
6892
  }
6832
6893
  }
6833
- function bn(r) {
6894
+ function vn(r) {
6834
6895
  try {
6835
6896
  return BigInt(r).toLocaleString();
6836
6897
  } catch {
6837
6898
  return r;
6838
6899
  }
6839
6900
  }
6840
- function vn(r) {
6901
+ function Sn(r) {
6841
6902
  const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: o = "ETH", nativeDecimals: i = 18 } = r;
6842
6903
  if (!e) return null;
6843
6904
  try {
6844
- const a = BigInt(e), c = bn(e);
6905
+ const a = BigInt(e), c = vn(e);
6845
6906
  if (t) {
6846
6907
  const l = a * BigInt(t);
6847
6908
  return {
6848
6909
  isDynamic: !0,
6849
- estTxFee: `${lt(l, i)} ${o}`,
6850
- maxFeeGwei: st(t),
6851
- maxPriorityFeeGwei: n ? st(n) : void 0,
6910
+ estTxFee: `${dt(l, i)} ${o}`,
6911
+ maxFeeGwei: rt(t),
6912
+ maxPriorityFeeGwei: n ? rt(n) : void 0,
6852
6913
  gasLimitFormatted: c
6853
6914
  };
6854
6915
  }
@@ -6856,8 +6917,8 @@ function vn(r) {
6856
6917
  const l = a * BigInt(s);
6857
6918
  return {
6858
6919
  isDynamic: !1,
6859
- estTxFee: `${lt(l, i)} ${o}`,
6860
- gasPriceGwei: st(s),
6920
+ estTxFee: `${dt(l, i)} ${o}`,
6921
+ gasPriceGwei: rt(s),
6861
6922
  gasLimitFormatted: c
6862
6923
  };
6863
6924
  }
@@ -6866,28 +6927,28 @@ function vn(r) {
6866
6927
  return null;
6867
6928
  }
6868
6929
  }
6869
- function Cs(r) {
6870
- const e = vn(r);
6930
+ function Os(r) {
6931
+ const e = Sn(r);
6871
6932
  if (!e) return Y("Estimated fee", "<span>—</span>");
6872
6933
  let s = Y("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
6873
6934
  return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += Y("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += Y("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += Y("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += Y("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
6874
6935
  }
6875
- const _e = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6936
+ const xe = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
6876
6937
  <rect x="9" y="9" width="13" height="13" rx="2"/>
6877
6938
  <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
6878
6939
  </svg>`, ie = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
6879
6940
  <line x1="18" y1="6" x2="6" y2="18"/>
6880
6941
  <line x1="6" y1="6" x2="18" y2="18"/>
6881
- </svg>`, Sn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
6942
+ </svg>`, En = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
6882
6943
  <circle cx="20" cy="20" r="20" fill="#00D5AA"/>
6883
6944
  <path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/>
6884
- </svg>`, mt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
6945
+ </svg>`, wt = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
6885
6946
  <rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
6886
6947
  <path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
6887
6948
  <rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
6888
- </svg>`, En = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6889
- <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
6890
6949
  </svg>`, In = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6950
+ <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
6951
+ </svg>`, An = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
6891
6952
  <circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
6892
6953
  <circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
6893
6954
  <path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
@@ -6926,8 +6987,8 @@ function Y(r, e) {
6926
6987
  </div>`;
6927
6988
  }
6928
6989
  function Tn(r, e) {
6929
- const s = e, t = je(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
6930
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${_e}</button>` : "<span>—</span>", o = Cs(r), i = r.data ?? "0x", a = document.createElement("div");
6990
+ const s = e, t = Ye(r.dappName), n = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
6991
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", o = Os(r), i = r.data ?? "0x", a = document.createElement("div");
6931
6992
  return a.id = te, a.innerHTML = `
6932
6993
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
6933
6994
  <div class="__crossx-header">
@@ -6942,7 +7003,7 @@ function Tn(r, e) {
6942
7003
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
6943
7004
  </p>
6944
7005
  <div class="__crossx-addr-pill">
6945
- ${mt}
7006
+ ${wt}
6946
7007
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
6947
7008
  </div>
6948
7009
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -6951,7 +7012,7 @@ function Tn(r, e) {
6951
7012
  <div class="__crossx-col-right-sign">
6952
7013
  <div class="__crossx-rows">
6953
7014
  ${Y("To", n)}
6954
- ${Y("Network", `<span>${Ps(r.chainId)}</span>`)}
7015
+ ${Y("Network", `<span>${Ns(r.chainId)}</span>`)}
6955
7016
  ${o}
6956
7017
  </div>
6957
7018
  <pre class="__crossx-raw-tx">${U(i)}</pre>
@@ -6965,9 +7026,9 @@ function Tn(r, e) {
6965
7026
  </div>
6966
7027
  `, a;
6967
7028
  }
6968
- function An(r, e) {
6969
- const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = je(r.dappName), i = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
6970
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${_e}</button>` : "<span>—</span>", a = Cs(r), l = yn(r.value, t, n) ?? "—", d = document.createElement("div");
7029
+ function Rn(r, e) {
7030
+ const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Ye(r.dappName), i = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
7031
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>` : "<span>—</span>", a = Os(r), l = bn(r.value, t, n) ?? "—", d = document.createElement("div");
6971
7032
  return d.id = te, d.innerHTML = `
6972
7033
  <div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
6973
7034
  <div class="__crossx-header">
@@ -6982,7 +7043,7 @@ function An(r, e) {
6982
7043
  <div class="__crossx-body-cols">
6983
7044
  <div class="__crossx-rows">
6984
7045
  ${Y("To", i)}
6985
- ${Y("Network", `<span>${Ps(r.chainId)}</span>`)}
7046
+ ${Y("Network", `<span>${Ns(r.chainId)}</span>`)}
6986
7047
  ${a}
6987
7048
  </div>
6988
7049
  <div class="__crossx-pill">
@@ -6995,7 +7056,7 @@ function An(r, e) {
6995
7056
  </div>
6996
7057
  `, d;
6997
7058
  }
6998
- function je(r) {
7059
+ function Ye(r) {
6999
7060
  var e;
7000
7061
  if (r) return r;
7001
7062
  try {
@@ -7007,10 +7068,10 @@ function je(r) {
7007
7068
  function U(r) {
7008
7069
  return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7009
7070
  }
7010
- function Rn(r) {
7071
+ function kn(r) {
7011
7072
  return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
7012
7073
  }
7013
- function kn(r) {
7074
+ function Pn(r) {
7014
7075
  if (typeof r == "string") return U(r);
7015
7076
  if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
7016
7077
  try {
@@ -7019,14 +7080,14 @@ function kn(r) {
7019
7080
  return String(r);
7020
7081
  }
7021
7082
  }
7022
- function Pn(r, e) {
7083
+ function Nn(r, e) {
7023
7084
  const s = Y(
7024
7085
  "From",
7025
7086
  `<span class="__crossx-addr-text">${se(r.from)}</span>
7026
- <button class="__crossx-copy-btn" data-copy="${U(r.from)}" title="Copy address">${_e}</button>`
7087
+ <button class="__crossx-copy-btn" data-copy="${U(r.from)}" title="Copy address">${xe}</button>`
7027
7088
  ), t = r.to ? Y("To", `<span class="__crossx-addr-text">${se(r.to)}</span>
7028
- <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${_e}</button>`) : "", n = r.amount ? Y("Transfer", `<span>${U(r.amount)}</span>`) : "", o = r.fees ? Y("Tx Fee", `<span>${U(r.fees)}</span>`) : "", i = r.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(r.txHash)}</span>
7029
- <button class="__crossx-copy-btn" data-copy="${U(r.txHash)}" title="Copy hash">${_e}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7089
+ <button class="__crossx-copy-btn" data-copy="${U(r.to)}" title="Copy address">${xe}</button>`) : "", n = r.amount ? Y("Transfer", `<span>${U(r.amount)}</span>`) : "", o = r.fees ? Y("Tx Fee", `<span>${U(r.fees)}</span>`) : "", i = r.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(r.txHash)}</span>
7090
+ <button class="__crossx-copy-btn" data-copy="${U(r.txHash)}" title="Copy hash">${xe}</button>`) : "", a = r.total ? `<div class="__crossx-total-pill">
7030
7091
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7031
7092
  <span class="__crossx-total-amount">${U(r.total)}</span>
7032
7093
  </div>` : "", c = document.createElement("div");
@@ -7051,7 +7112,7 @@ function Pn(r, e) {
7051
7112
  </div>
7052
7113
  `, c;
7053
7114
  }
7054
- function Cn(r, e) {
7115
+ function On(r, e) {
7055
7116
  const s = document.createElement("div");
7056
7117
  return s.id = te, s.innerHTML = `
7057
7118
  <div class="__crossx-card __crossx-card--migration" style="${ce(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7068,10 +7129,10 @@ function Cn(r, e) {
7068
7129
  </div>
7069
7130
  `, s;
7070
7131
  }
7071
- function Nn(r, e, s) {
7132
+ function Cn(r, e, s) {
7072
7133
  const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
7073
7134
  if (o) {
7074
- const w = n ? In : t ? "" : En, E = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7135
+ const w = n ? An : t ? "" : In, E = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
7075
7136
  w ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${w}<span>${E}</span>`) : o.textContent = E;
7076
7137
  }
7077
7138
  if (i && !r.querySelector("#__crossx-close-btn")) {
@@ -7081,9 +7142,9 @@ function Nn(r, e, s) {
7081
7142
  const a = r.querySelector("#__crossx-progress-body");
7082
7143
  if (!a) return;
7083
7144
  const c = e.from ? Y("From", `<span class="__crossx-addr-text">${se(e.from)}</span>
7084
- <button class="__crossx-copy-btn" data-copy="${U(e.from)}" title="Copy address">${_e}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7085
- <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${_e}</button>`) : "", d = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", m = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7086
- <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${_e}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
7145
+ <button class="__crossx-copy-btn" data-copy="${U(e.from)}" title="Copy address">${xe}</button>`) : "", l = e.to ? Y("To", `<span class="__crossx-addr-text">${se(e.to)}</span>
7146
+ <button class="__crossx-copy-btn" data-copy="${U(e.to)}" title="Copy address">${xe}</button>`) : "", d = e.amount ? Y("Transfer", `<span>${U(e.amount)}</span>`) : "", h = e.fees ? Y("Tx Fee", `<span>${U(e.fees)}</span>`) : "", m = e.txHash ? Y("Tx Hash", `<span class="__crossx-addr-text">${se(e.txHash)}</span>
7147
+ <button class="__crossx-copy-btn" data-copy="${U(e.txHash)}" title="Copy hash">${xe}</button>`) : "", x = e.total ? `<div class="__crossx-total-pill">
7087
7148
  <span class="__crossx-total-label">Total<br>(including fees)</span>
7088
7149
  <span class="__crossx-total-amount">${U(e.total)}</span>
7089
7150
  </div>` : "";
@@ -7107,8 +7168,8 @@ function Nn(r, e, s) {
7107
7168
  });
7108
7169
  });
7109
7170
  }
7110
- function On(r, e) {
7111
- const s = e, t = je(r.dappName), n = U(r.message), o = document.createElement("div");
7171
+ function Ln(r, e) {
7172
+ const s = e, t = Ye(r.dappName), n = U(r.message), o = document.createElement("div");
7112
7173
  return o.id = te, o.innerHTML = `
7113
7174
  <div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7114
7175
  <div class="__crossx-header">
@@ -7123,7 +7184,7 @@ function On(r, e) {
7123
7184
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
7124
7185
  </p>
7125
7186
  <div class="__crossx-addr-pill">
7126
- ${mt}
7187
+ ${wt}
7127
7188
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7128
7189
  </div>
7129
7190
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7139,8 +7200,8 @@ function On(r, e) {
7139
7200
  </div>
7140
7201
  `, o;
7141
7202
  }
7142
- function Ln(r, e) {
7143
- const s = e, t = je(r.dappName);
7203
+ function Dn(r, e) {
7204
+ const s = e, t = Ye(r.dappName);
7144
7205
  let n = {};
7145
7206
  if (typeof r.typedData == "string")
7146
7207
  try {
@@ -7155,8 +7216,8 @@ function Ln(r, e) {
7155
7216
  <span class="__crossx-td-value">${U(o)}</span>
7156
7217
  </div>`;
7157
7218
  for (const [l, d] of Object.entries(i)) {
7158
- const h = kn(d), x = Rn(d) ? `<span class="__crossx-addr-text">${se(d)}</span>
7159
- <button class="__crossx-copy-btn" data-copy="${U(String(d))}" title="Copy">${_e}</button>` : `<span>${h}</span>`;
7219
+ const h = Pn(d), x = kn(d) ? `<span class="__crossx-addr-text">${se(d)}</span>
7220
+ <button class="__crossx-copy-btn" data-copy="${U(String(d))}" title="Copy">${xe}</button>` : `<span>${h}</span>`;
7160
7221
  a += `
7161
7222
  <div class="__crossx-td-row">
7162
7223
  <span class="__crossx-td-label">${U(l)}</span>
@@ -7178,7 +7239,7 @@ function Ln(r, e) {
7178
7239
  <span class="__crossx-sig-origin">${U(t)} </span>is requesting a Signature
7179
7240
  </p>
7180
7241
  <div class="__crossx-addr-pill">
7181
- ${mt}
7242
+ ${wt}
7182
7243
  <span class="__crossx-addr-pill-text">${se(r.from)}</span>
7183
7244
  </div>
7184
7245
  <p class="__crossx-warning">After you sign, changes or cancellations are not possible.</p>
@@ -7194,11 +7255,11 @@ function Ln(r, e) {
7194
7255
  </div>
7195
7256
  `, c;
7196
7257
  }
7197
- const Dn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7258
+ const Mn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
7198
7259
  <line x1="12" y1="5" x2="12" y2="19"/>
7199
7260
  <line x1="5" y1="12" x2="19" y2="12"/>
7200
7261
  </svg>`;
7201
- function Mn(r, e, s) {
7262
+ function $n(r, e, s) {
7202
7263
  const t = s == null ? void 0 : s.toLowerCase(), n = r.map((i) => {
7203
7264
  const a = t && i.address.toLowerCase() === t;
7204
7265
  return `<button class="__crossx-wallet-item" data-wallet-index="${i.index}" data-wallet-address="${U(i.address)}">
@@ -7229,7 +7290,7 @@ function Mn(r, e, s) {
7229
7290
  ${n}
7230
7291
  </div>
7231
7292
  <button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
7232
- <span class="__crossx-wallet-add-icon">${Dn}</span>
7293
+ <span class="__crossx-wallet-add-icon">${Mn}</span>
7233
7294
  <span class="__crossx-wallet-add-label">add a wallet</span>
7234
7295
  </button>
7235
7296
  </div>
@@ -7238,16 +7299,16 @@ function Mn(r, e, s) {
7238
7299
  </div>
7239
7300
  `, o;
7240
7301
  }
7241
- const $n = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7302
+ const Bn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7242
7303
  <path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
7243
7304
  <path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
7244
- </svg>`, Bn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7305
+ </svg>`, Un = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
7245
7306
  <path d="M38.06 20.44c0-1.34-.12-2.63-.34-3.87H20.5v7.32h9.84c-.42 2.28-1.71 4.21-3.65 5.51v4.57h5.91c3.46-3.19 5.46-7.88 5.46-13.53z" fill="#4285F4"/>
7246
7307
  <path d="M20.5 38.5c4.94 0 9.09-1.64 12.12-4.44l-5.91-4.57c-1.64 1.1-3.73 1.75-6.21 1.75-4.77 0-8.82-3.22-10.26-7.55H4.16v4.72A18.49 18.49 0 0 0 20.5 38.5z" fill="#34A853"/>
7247
7308
  <path d="M10.24 23.69A11.16 11.16 0 0 1 9.66 20c0-1.28.22-2.52.58-3.69v-4.72H4.16A18.49 18.49 0 0 0 2 20c0 2.97.71 5.78 1.97 8.28l6.27-4.59z" fill="#FBBC05"/>
7248
7309
  <path d="M20.5 8.76c2.69 0 5.1.92 7 2.73l5.24-5.24C29.58 3.36 25.43 1.5 20.5 1.5A18.49 18.49 0 0 0 4.16 11.59l6.08 4.72C11.68 11.98 15.73 8.76 20.5 8.76z" fill="#EA4335"/>
7249
7310
  </svg>`;
7250
- function Un(r) {
7311
+ function Hn(r) {
7251
7312
  const e = r, s = document.createElement("div");
7252
7313
  return s.id = te, s.innerHTML = `
7253
7314
  <div class="__crossx-card __crossx-card--migration" style="${ce(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7262,11 +7323,11 @@ function Un(r) {
7262
7323
  <div class="__crossx-body">
7263
7324
  <div class="__crossx-login-btn-row">
7264
7325
  <button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
7265
- <span class="__crossx-login-icon" style="color:var(--cx-value);">${$n}</span>
7326
+ <span class="__crossx-login-icon" style="color:var(--cx-value);">${Bn}</span>
7266
7327
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Apple</span>
7267
7328
  </button>
7268
7329
  <button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
7269
- <span class="__crossx-login-icon">${Bn}</span>
7330
+ <span class="__crossx-login-icon">${Un}</span>
7270
7331
  <span class="__crossx-login-btn-label">Sign in with&nbsp;&nbsp;Google</span>
7271
7332
  </button>
7272
7333
  </div>
@@ -7278,7 +7339,7 @@ function Un(r) {
7278
7339
  </div>
7279
7340
  `, s;
7280
7341
  }
7281
- function Hn(r) {
7342
+ function Fn(r) {
7282
7343
  const e = r, s = document.createElement("div");
7283
7344
  return s.id = te, s.innerHTML = `
7284
7345
  <div class="__crossx-card __crossx-card--migration" style="${ce(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7294,7 +7355,7 @@ function Hn(r) {
7294
7355
  <p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
7295
7356
  </div>
7296
7357
  <button class="__crossx-recover-btn" id="__crossx-recover-btn">
7297
- <span class="__crossx-recover-icon">${Sn}</span>
7358
+ <span class="__crossx-recover-icon">${En}</span>
7298
7359
  <span class="__crossx-recover-label">Import from Social Backup</span>
7299
7360
  </button>
7300
7361
  <button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>
@@ -7302,7 +7363,7 @@ function Hn(r) {
7302
7363
  </div>
7303
7364
  `, s;
7304
7365
  }
7305
- function Fn(r, e) {
7366
+ function Gn(r, e) {
7306
7367
  const s = r, { errorMessage: t, attemptCount: n, maxAttempts: o = 5 } = e ?? {}, i = !!t, a = i ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${o}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", d = i ? `<p class="__crossx-pin-error-text">${t}</p>` : "", h = document.createElement("div");
7307
7368
  return h.id = te, h.innerHTML = `
7308
7369
  <div class="__crossx-card __crossx-card--migration" style="${ce(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
@@ -7326,12 +7387,12 @@ function Fn(r, e) {
7326
7387
  </div>
7327
7388
  `, h;
7328
7389
  }
7329
- function Gn(r) {
7390
+ function Wn(r) {
7330
7391
  const e = new Date(r), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], n = s[e.getDay()], o = t[e.getMonth()], i = e.getDate(), a = String(e.getHours()).padStart(2, "0"), c = String(e.getMinutes()).padStart(2, "0");
7331
7392
  return `${n}, ${o} ${i} ${a}:${c}`;
7332
7393
  }
7333
- function Wn(r, e, s) {
7334
- const t = r, n = e <= 0, o = n ? null : Date.now() + e * 1e3, i = o ? Gn(o) : null, a = document.createElement("div");
7394
+ function qn(r, e, s) {
7395
+ const t = r, n = e <= 0, o = n ? null : Date.now() + e * 1e3, i = o ? Wn(o) : null, a = document.createElement("div");
7335
7396
  return a.id = te, a.innerHTML = `
7336
7397
  <div class="__crossx-card __crossx-card--migration" style="${ce(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
7337
7398
  <div class="__crossx-header">
@@ -7361,10 +7422,10 @@ function Wn(r, e, s) {
7361
7422
  return () => clearInterval(h);
7362
7423
  } };
7363
7424
  }
7364
- function qn(r) {
7425
+ function Kn(r) {
7365
7426
  const s = [r.check1, r.check2].map((t, n) => `
7366
7427
  <div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
7367
- <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${zn}</div>
7428
+ <div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${jn}</div>
7368
7429
  <span class="__crossx-pw-notice-item-text">${U(t)}</span>
7369
7430
  </div>
7370
7431
  `).join("");
@@ -7379,7 +7440,7 @@ function qn(r) {
7379
7440
  <div class="__crossx-pw-fields __crossx-pw-fields--notice">
7380
7441
  <div class="__crossx-pw-notice-header">
7381
7442
  <div class="__crossx-pw-notice-title-row">
7382
- <span class="__crossx-pw-notice-icon">${jn}</span>
7443
+ <span class="__crossx-pw-notice-icon">${Yn}</span>
7383
7444
  <p class="__crossx-pw-notice-title">${U(r.noticeTitle)}</p>
7384
7445
  </div>
7385
7446
  <p class="__crossx-pw-notice-desc">${U(r.noticeDesc)}</p>
@@ -7397,9 +7458,9 @@ function qn(r) {
7397
7458
  <div class="__crossx-home-indicator"></div>
7398
7459
  `;
7399
7460
  }
7400
- function rt(r) {
7461
+ function nt(r) {
7401
7462
  const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${U(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${U(r.subtitle)}</p>` : "", o = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${U(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', i = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
7402
- ${Ns}
7463
+ ${Cs}
7403
7464
  <span id="__crossx-pin6-lock-countdown"></span>
7404
7465
  </p>` : "", a = e ? " --locked" : "", c = Array.from(
7405
7466
  { length: 6 },
@@ -7431,18 +7492,18 @@ function Zt(r, e) {
7431
7492
  </div>
7432
7493
  `, s;
7433
7494
  }
7434
- function Kn(r, e) {
7495
+ function Vn(r, e) {
7435
7496
  if (r.length !== 6) return e.tooShort;
7436
7497
  if (!/^\d+$/.test(r)) return e.numbersOnly;
7437
7498
  if (/(.)\1{2}/.test(r)) return e.repeatingDigit;
7438
7499
  const s = r.split("").map(Number), t = s.every((o, i) => i === 0 || o === (s[i - 1] + 1) % 10), n = s.every((o, i) => i === 0 || o === (s[i - 1] + 9) % 10);
7439
7500
  return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
7440
7501
  }
7441
- function Vn(r) {
7502
+ function zn(r) {
7442
7503
  const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
7443
7504
  return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
7444
7505
  }
7445
- function nt(r, e, s, t, n, o) {
7506
+ function ot(r, e, s, t, n, o) {
7446
7507
  let i = !!(o && o > Date.now()), a = !1;
7447
7508
  const c = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), l = () => r.querySelector("#__crossx-pin6-boxes"), d = () => r.querySelector("#__crossx-pin6-error"), h = () => r.querySelector("#__crossx-pin6-lock-msg"), m = () => r.querySelector("#__crossx-pin6-lock-countdown"), x = () => r.querySelector(".__crossx-pin6-body"), w = () => c().map((b) => b.value).join(""), E = (b) => {
7448
7509
  i = b, c().forEach((k) => {
@@ -7461,7 +7522,7 @@ function nt(r, e, s, t, n, o) {
7461
7522
  var G;
7462
7523
  return (G = c()[0]) == null ? void 0 : G.focus();
7463
7524
  }, 50);
7464
- }, O = (b) => {
7525
+ }, C = (b) => {
7465
7526
  var W;
7466
7527
  E(!0), c().forEach((q) => {
7467
7528
  q.value = "";
@@ -7469,7 +7530,7 @@ function nt(r, e, s, t, n, o) {
7469
7530
  const k = d();
7470
7531
  if (k && (k.textContent = "Too many failed attempts. Please wait."), !h()) {
7471
7532
  const q = document.createElement("p");
7472
- q.className = "__crossx-pin6-lock-msg", q.id = "__crossx-pin6-lock-msg", q.innerHTML = `${Ns}<span id="__crossx-pin6-lock-countdown"></span>`;
7533
+ q.className = "__crossx-pin6-lock-msg", q.id = "__crossx-pin6-lock-msg", q.innerHTML = `${Cs}<span id="__crossx-pin6-lock-countdown"></span>`;
7473
7534
  const D = d();
7474
7535
  D ? D.insertAdjacentElement("afterend", q) : (W = x()) == null || W.appendChild(q);
7475
7536
  }
@@ -7477,9 +7538,9 @@ function nt(r, e, s, t, n, o) {
7477
7538
  var R;
7478
7539
  const q = b - Date.now(), D = m();
7479
7540
  q <= 0 ? (clearInterval(G), E(!1), (R = h()) == null || R.remove(), k && (k.textContent = ""), setTimeout(() => {
7480
- var C;
7481
- return (C = c()[0]) == null ? void 0 : C.focus();
7482
- }, 50)) : D && (D.textContent = ` ${Vn(q)}`);
7541
+ var N;
7542
+ return (N = c()[0]) == null ? void 0 : N.focus();
7543
+ }, 50)) : D && (D.textContent = ` ${zn(q)}`);
7483
7544
  }, G = setInterval(P, 1e3);
7484
7545
  P();
7485
7546
  const z = new MutationObserver(() => {
@@ -7496,7 +7557,7 @@ function nt(r, e, s, t, n, o) {
7496
7557
  try {
7497
7558
  if (n) {
7498
7559
  const k = await n(b);
7499
- k.ok ? e(b) : k.lockExpiresAt ? O(k.lockExpiresAt) : S(k.error ?? "Incorrect PIN. Please try again.");
7560
+ k.ok ? e(b) : k.lockExpiresAt ? C(k.lockExpiresAt) : S(k.error ?? "Incorrect PIN. Please try again.");
7500
7561
  } else
7501
7562
  e(b);
7502
7563
  } catch (k) {
@@ -7508,7 +7569,7 @@ function nt(r, e, s, t, n, o) {
7508
7569
  }
7509
7570
  }
7510
7571
  };
7511
- o && o > Date.now() ? O(o) : setTimeout(() => {
7572
+ o && o > Date.now() ? C(o) : setTimeout(() => {
7512
7573
  var b;
7513
7574
  return (b = c()[0]) == null ? void 0 : b.focus();
7514
7575
  }, 100), c().forEach((b, k) => {
@@ -7538,14 +7599,14 @@ function nt(r, e, s, t, n, o) {
7538
7599
  }), b.addEventListener("focus", () => b.select());
7539
7600
  });
7540
7601
  }
7541
- const Ns = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
7602
+ const Cs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
7542
7603
  <path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
7543
- </svg>`, zn = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
7604
+ </svg>`, jn = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
7544
7605
  <path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
7545
- </svg>`, jn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
7606
+ </svg>`, Yn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
7546
7607
  <path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="currentColor"/>
7547
7608
  </svg>`;
7548
- function Yn(r, e, s) {
7609
+ function Jn(r, e, s) {
7549
7610
  var n;
7550
7611
  const t = r.querySelectorAll(".__crossx-pin-input");
7551
7612
  t.forEach((o, i) => {
@@ -7571,12 +7632,12 @@ function Yn(r, e, s) {
7571
7632
  });
7572
7633
  }), (n = t[0]) == null || n.focus();
7573
7634
  }
7574
- class Jn {
7635
+ class Xn {
7575
7636
  constructor(e = "light", s) {
7576
- this.theme = e, this.overrides = s, this.tokens = Yt(e, s);
7637
+ this.theme = e, this.overrides = s, this.tokens = Jt(e, s);
7577
7638
  }
7578
7639
  setTheme(e, s) {
7579
- this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = Yt(e, this.overrides);
7640
+ this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = Jt(e, this.overrides);
7580
7641
  }
7581
7642
  setMessages(e) {
7582
7643
  this.messages = e;
@@ -7593,8 +7654,8 @@ class Jn {
7593
7654
  return new Promise((n) => {
7594
7655
  var E;
7595
7656
  he();
7596
- const o = [...e], i = Mn(o, this.tokens, t), a = document.body.style.overflow;
7597
- document.body.style.overflow = "hidden", document.body.appendChild(i);
7657
+ const o = [...e], i = $n(o, this.tokens, t), a = document.body.style.overflow;
7658
+ document.body.style.overflow = "hidden", pe(i);
7598
7659
  let c = !1;
7599
7660
  const l = () => {
7600
7661
  c || (c = !0, i.remove(), document.body.style.overflow = a);
@@ -7606,8 +7667,8 @@ class Jn {
7606
7667
  (() => {
7607
7668
  i.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
7608
7669
  y.addEventListener("click", () => {
7609
- const S = y.dataset.walletAddress ?? "", O = parseInt(y.dataset.walletIndex ?? "0", 10);
7610
- d({ address: S, index: O });
7670
+ const S = y.dataset.walletAddress ?? "", C = parseInt(y.dataset.walletIndex ?? "0", 10);
7671
+ d({ address: S, index: C });
7611
7672
  });
7612
7673
  });
7613
7674
  })();
@@ -7619,8 +7680,8 @@ class Jn {
7619
7680
  o.push(y);
7620
7681
  const S = i.querySelector("#__crossx-wallet-list");
7621
7682
  if (S) {
7622
- const O = document.createElement("button");
7623
- O.className = "__crossx-wallet-item", O.dataset.walletIndex = String(y.index), O.dataset.walletAddress = y.address, O.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, O.addEventListener("click", () => d(y)), S.appendChild(O), O.scrollIntoView({ behavior: "smooth", block: "nearest" });
7683
+ const C = document.createElement("button");
7684
+ C.className = "__crossx-wallet-item", C.dataset.walletIndex = String(y.index), C.dataset.walletAddress = y.address, C.innerHTML = `<span class="__crossx-wallet-addr">${se(y.address)}</span>`, C.addEventListener("click", () => d(y)), S.appendChild(C), C.scrollIntoView({ behavior: "smooth", block: "nearest" });
7624
7685
  }
7625
7686
  } catch {
7626
7687
  } finally {
@@ -7644,8 +7705,8 @@ class Jn {
7644
7705
  return new Promise((e) => {
7645
7706
  var a, c, l;
7646
7707
  he();
7647
- const s = Un(this.tokens);
7648
- document.body.appendChild(s);
7708
+ const s = Hn(this.tokens);
7709
+ pe(s);
7649
7710
  const t = () => s.remove(), n = (d) => {
7650
7711
  t(), e(d);
7651
7712
  }, o = () => {
@@ -7670,8 +7731,8 @@ class Jn {
7670
7731
  return new Promise((e) => {
7671
7732
  var a, c, l;
7672
7733
  he();
7673
- const s = Hn(this.tokens);
7674
- document.body.appendChild(s);
7734
+ const s = Fn(this.tokens);
7735
+ pe(s);
7675
7736
  const t = () => s.remove(), n = () => {
7676
7737
  t(), e("recover");
7677
7738
  }, o = () => {
@@ -7713,13 +7774,13 @@ class Jn {
7713
7774
  }, i = {
7714
7775
  title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
7715
7776
  headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
7716
- }, a = Zt(this.tokens, qn(n)), c = document.body.style.overflow;
7717
- document.body.style.overflow = "hidden", document.body.appendChild(a);
7777
+ }, a = Zt(this.tokens, Kn(n)), c = document.body.style.overflow;
7778
+ document.body.style.overflow = "hidden", pe(a);
7718
7779
  let l = !1;
7719
7780
  const d = () => {
7720
7781
  l || (l = !0, a.remove(), document.body.style.overflow = c);
7721
- }, h = (O) => {
7722
- d(), s(O);
7782
+ }, h = (C) => {
7783
+ d(), s(C);
7723
7784
  }, m = () => {
7724
7785
  d(), s(null);
7725
7786
  }, x = a.querySelector(".__crossx-card"), w = {
@@ -7728,56 +7789,56 @@ class Jn {
7728
7789
  repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
7729
7790
  sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
7730
7791
  alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
7731
- }, E = (O) => {
7792
+ }, E = (C) => {
7732
7793
  var B;
7733
- x.innerHTML = rt({
7794
+ x.innerHTML = nt({
7734
7795
  title: i.title,
7735
7796
  headerSubtitle: i.headerSubtitle
7736
- }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), nt(x, (b) => {
7737
- b === O ? h(O) : y(o.mismatchError);
7797
+ }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
7798
+ b === C ? h(C) : y(o.mismatchError);
7738
7799
  }, m);
7739
- }, y = (O) => {
7800
+ }, y = (C) => {
7740
7801
  var B;
7741
- x.innerHTML = rt({
7802
+ x.innerHTML = nt({
7742
7803
  title: o.title,
7743
7804
  headerSubtitle: o.headerSubtitle,
7744
7805
  subtitle: o.subtitle,
7745
- errorMessage: O
7746
- }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), nt(x, (b) => {
7747
- const k = Kn(b, w);
7806
+ errorMessage: C
7807
+ }), (B = x.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", m), ot(x, (b) => {
7808
+ const k = Vn(b, w);
7748
7809
  k ? y(k) : E(b);
7749
7810
  }, m);
7750
7811
  };
7751
7812
  (() => {
7752
7813
  var q;
7753
- const O = Array.from(x.querySelectorAll(".__crossx-pw-notice-item")), B = x.querySelector("#__crossx-pin-notice-next"), b = /* @__PURE__ */ new Set();
7814
+ const C = Array.from(x.querySelectorAll(".__crossx-pw-notice-item")), B = x.querySelector("#__crossx-pin-notice-next"), b = /* @__PURE__ */ new Set();
7754
7815
  B.removeAttribute("disabled");
7755
7816
  const k = B.dataset.nextLabel ?? "Next", P = B.dataset.submitLabel ?? "I Understand", G = () => {
7756
- const D = b.size === O.length;
7817
+ const D = b.size === C.length;
7757
7818
  B.classList.toggle("--disabled", !D), B.textContent = D ? P : k;
7758
7819
  }, z = (D, R) => {
7759
7820
  if (b.has(R)) return;
7760
- const C = D.querySelector(`#__crossx-notice-check-${R}`);
7761
- b.add(R), C.classList.add("--checked"), D.setAttribute("aria-checked", "true"), G();
7821
+ const N = D.querySelector(`#__crossx-notice-check-${R}`);
7822
+ b.add(R), N.classList.add("--checked"), D.setAttribute("aria-checked", "true"), G();
7762
7823
  }, W = (D, R) => {
7763
7824
  if (!b.has(R)) return;
7764
- const C = D.querySelector(`#__crossx-notice-check-${R}`);
7765
- b.delete(R), C.classList.remove("--checked"), D.setAttribute("aria-checked", "false"), G();
7825
+ const N = D.querySelector(`#__crossx-notice-check-${R}`);
7826
+ b.delete(R), N.classList.remove("--checked"), D.setAttribute("aria-checked", "false"), G();
7766
7827
  };
7767
- O.forEach((D) => {
7828
+ C.forEach((D) => {
7768
7829
  const R = parseInt(D.dataset.checkIndex ?? "0", 10);
7769
7830
  D.addEventListener("click", () => {
7770
7831
  b.has(R) ? W(D, R) : z(D, R);
7771
- }), D.addEventListener("keydown", (C) => {
7772
- (C.key === " " || C.key === "Enter") && (C.preventDefault(), b.has(R) ? W(D, R) : z(D, R));
7832
+ }), D.addEventListener("keydown", (N) => {
7833
+ (N.key === " " || N.key === "Enter") && (N.preventDefault(), b.has(R) ? W(D, R) : z(D, R));
7773
7834
  });
7774
7835
  }), B.addEventListener("click", () => {
7775
- if (b.size === O.length) {
7836
+ if (b.size === C.length) {
7776
7837
  y(e == null ? void 0 : e.errorMessage);
7777
7838
  return;
7778
7839
  }
7779
- const D = O.find((C) => {
7780
- const f = parseInt(C.dataset.checkIndex ?? "0", 10);
7840
+ const D = C.find((N) => {
7841
+ const f = parseInt(N.dataset.checkIndex ?? "0", 10);
7781
7842
  return !b.has(f);
7782
7843
  });
7783
7844
  if (!D) return;
@@ -7786,8 +7847,8 @@ class Jn {
7786
7847
  D.classList.remove("--highlight"), z(D, R);
7787
7848
  }, 400);
7788
7849
  }), (q = x.querySelector("#__crossx-close-btn")) == null || q.addEventListener("click", m);
7789
- })(), a.addEventListener("click", (O) => {
7790
- O.target === a && m();
7850
+ })(), a.addEventListener("click", (C) => {
7851
+ C.target === a && m();
7791
7852
  });
7792
7853
  });
7793
7854
  }
@@ -7802,14 +7863,14 @@ class Jn {
7802
7863
  he();
7803
7864
  const n = this.messages, o = (e == null ? void 0 : e.verifyMode) === !0, i = o ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = o ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = Zt(
7804
7865
  this.tokens,
7805
- rt({
7866
+ nt({
7806
7867
  title: i,
7807
7868
  headerSubtitle: a,
7808
7869
  errorMessage: e == null ? void 0 : e.errorMessage,
7809
7870
  lockExpiresAt: e == null ? void 0 : e.lockExpiresAt
7810
7871
  })
7811
7872
  ), l = document.body.style.overflow;
7812
- document.body.style.overflow = "hidden", document.body.appendChild(c);
7873
+ document.body.style.overflow = "hidden", pe(c);
7813
7874
  let d = !1;
7814
7875
  const h = () => {
7815
7876
  d || (d = !0, c.remove(), document.body.style.overflow = l);
@@ -7820,7 +7881,7 @@ class Jn {
7820
7881
  }, w = (S) => {
7821
7882
  h(), t(S);
7822
7883
  }, E = c.querySelector(".__crossx-card");
7823
- (y = E.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", x), nt(E, m, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (S) => {
7884
+ (y = E.querySelector("#__crossx-close-btn")) == null || y.addEventListener("click", x), ot(E, m, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt), c.addEventListener("click", (S) => {
7824
7885
  S.target === c && x();
7825
7886
  });
7826
7887
  });
@@ -7836,14 +7897,14 @@ class Jn {
7836
7897
  return new Promise((s) => {
7837
7898
  var a;
7838
7899
  he();
7839
- const t = Fn(this.tokens, e);
7840
- document.body.appendChild(t);
7900
+ const t = Gn(this.tokens, e);
7901
+ pe(t);
7841
7902
  const n = () => t.remove(), o = (c) => {
7842
7903
  n(), s(c);
7843
7904
  }, i = () => {
7844
7905
  n(), s(null);
7845
7906
  };
7846
- Yn(t, o, i), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", i), t.addEventListener("click", (c) => {
7907
+ Jn(t, o, i), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", i), t.addEventListener("click", (c) => {
7847
7908
  c.target === t && i();
7848
7909
  });
7849
7910
  });
@@ -7858,8 +7919,8 @@ class Jn {
7858
7919
  return new Promise((t) => {
7859
7920
  var l;
7860
7921
  he();
7861
- const { overlay: n, startCountdown: o } = Wn(this.tokens, e, s);
7862
- document.body.appendChild(n);
7922
+ const { overlay: n, startCountdown: o } = qn(this.tokens, e, s);
7923
+ pe(n);
7863
7924
  const i = () => {
7864
7925
  c(), n.remove();
7865
7926
  }, a = () => {
@@ -7878,8 +7939,8 @@ class Jn {
7878
7939
  return new Promise((s) => {
7879
7940
  var a, c;
7880
7941
  he();
7881
- const t = Pn(e, this.tokens);
7882
- document.body.appendChild(t);
7942
+ const t = Nn(e, this.tokens);
7943
+ pe(t);
7883
7944
  const n = () => t.remove(), o = () => {
7884
7945
  n(), s();
7885
7946
  };
@@ -7907,8 +7968,8 @@ class Jn {
7907
7968
  showTransactionProgress(e, s) {
7908
7969
  return new Promise((t) => {
7909
7970
  he();
7910
- const n = Cn(e, this.tokens);
7911
- document.body.appendChild(n);
7971
+ const n = On(e, this.tokens);
7972
+ pe(n);
7912
7973
  const o = () => n.remove();
7913
7974
  let i = !1;
7914
7975
  const a = () => {
@@ -7924,7 +7985,7 @@ class Jn {
7924
7985
  document.addEventListener("keydown", l);
7925
7986
  };
7926
7987
  s.then((l) => {
7927
- i || (Nn(n, l, this.tokens), c());
7988
+ i || (Cn(n, l, this.tokens), c());
7928
7989
  });
7929
7990
  });
7930
7991
  }
@@ -7933,7 +7994,7 @@ class Jn {
7933
7994
  var c, l, d;
7934
7995
  he();
7935
7996
  let t;
7936
- e.type === "sign-message" ? t = On(e, this.tokens) : e.type === "sign-typed-data" ? t = Ln(e, this.tokens) : e.type === "sign" ? t = Tn(e, this.tokens) : t = An(e, this.tokens), document.body.appendChild(t);
7997
+ e.type === "sign-message" ? t = Ln(e, this.tokens) : e.type === "sign-typed-data" ? t = Dn(e, this.tokens) : e.type === "sign" ? t = Tn(e, this.tokens) : t = Rn(e, this.tokens), pe(t);
7937
7998
  const n = () => t.remove(), o = () => {
7938
7999
  n(), s(!0);
7939
8000
  }, i = () => {
@@ -7980,9 +8041,9 @@ class Zn {
7980
8041
  return this.get() !== null;
7981
8042
  }
7982
8043
  }
7983
- function to(r, e) {
8044
+ function so(r, e) {
7984
8045
  r.debug;
7985
- const s = Fe.production, t = {
8046
+ const s = Ge.production, t = {
7986
8047
  ...r,
7987
8048
  oauthServiceUrl: s.oauthServiceUrl,
7988
8049
  authApiUrl: s.authApiUrl,
@@ -7990,23 +8051,23 @@ function to(r, e) {
7990
8051
  }, n = {
7991
8052
  gatewayUrl: s.walletGatewayUrl,
7992
8053
  projectId: r.projectId
7993
- }, o = t.authMode !== "cookie" && Ct.isAvailable();
8054
+ }, o = t.authMode !== "cookie" && Ot.isAvailable();
7994
8055
  !o && t.authMode !== "cookie" && u.warn(
7995
8056
  "[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
7996
8057
  "refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
7997
8058
  "IndexedDB를 지원하는 브라우저 사용을 권장합니다."
7998
8059
  ), t.secureStorageAvailable = o;
7999
- const i = o ? new Ct(r.projectId) : new sr(), a = new un(), c = new _n(), l = new ye(), d = new Zn(), h = new Qt();
8060
+ const i = o ? new Ot(r.projectId) : new rr(), a = new hn(), c = new xn(), l = new be(), d = new Zn(), h = new es();
8000
8061
  let m;
8001
- r.useMockWallet ? (u.log("[CROSSx] Mock Wallet Provider 사용"), m = new gn(i, h)) : (u.log("[CROSSx] Remote Wallet Provider 사용"), m = new Oe(
8062
+ r.useMockWallet ? (u.log("[CROSSx] Mock Wallet Provider 사용"), m = new mn(i, h)) : (u.log("[CROSSx] Remote Wallet Provider 사용"), m = new Le(
8002
8063
  n,
8003
8064
  i,
8004
8065
  c,
8005
8066
  d,
8006
8067
  h
8007
8068
  ));
8008
- const x = new Le(n, c), w = new Jn(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8009
- return new ot(
8069
+ const x = new De(n, c), w = new Xn(r.theme ?? "light", r.themeTokens), E = e != null && e.wrapConfirmation ? e.wrapConfirmation(w) : w;
8070
+ return new it(
8010
8071
  t,
8011
8072
  n,
8012
8073
  i,
@@ -8022,9 +8083,11 @@ function to(r, e) {
8022
8083
  }
8023
8084
  export {
8024
8085
  g as CROSSxError,
8025
- Hs as CROSSxEthereumProvider,
8026
- ot as CROSSxSDK,
8027
- eo as ChainId,
8086
+ Fs as CROSSxEthereumProvider,
8087
+ it as CROSSxSDK,
8088
+ to as ChainId,
8028
8089
  p as ErrorCode,
8029
- to as createCROSSxSDK
8090
+ es as PinMemoryStore,
8091
+ Zn as TokenMemoryStore,
8092
+ so as createCROSSxSDK
8030
8093
  };