@zerodev/wallet-react-ui 0.0.12 → 0.0.13

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.
Files changed (42) hide show
  1. package/dist/_types/auth/authStoreSlice.d.ts +31 -0
  2. package/dist/_types/auth/authStoreSlice.d.ts.map +1 -1
  3. package/dist/_types/auth/components/WalletSheet/index.d.ts.map +1 -1
  4. package/dist/_types/auth/hooks/useAuth.d.ts +5 -0
  5. package/dist/_types/auth/hooks/useAuth.d.ts.map +1 -1
  6. package/dist/_types/auth/index.d.ts.map +1 -1
  7. package/dist/_types/auth/pages/SignUp/InstalledWallets.d.ts.map +1 -1
  8. package/dist/_types/auth/pages/SignUp/MoreWallets.d.ts.map +1 -1
  9. package/dist/_types/auth/pages/SignUp/Wallet.d.ts.map +1 -1
  10. package/dist/_types/auth/pages/Verifying.d.ts.map +1 -1
  11. package/dist/_types/auth/pages/WalletConnecting.d.ts +11 -0
  12. package/dist/_types/auth/pages/WalletConnecting.d.ts.map +1 -0
  13. package/dist/_types/auth/types.d.ts +1 -1
  14. package/dist/_types/auth/types.d.ts.map +1 -1
  15. package/dist/_types/auth/utils/isCancellationError.d.ts +4 -0
  16. package/dist/_types/auth/utils/isCancellationError.d.ts.map +1 -1
  17. package/dist/_types/auth/utils/isResourceUnavailableError.d.ts +12 -0
  18. package/dist/_types/auth/utils/isResourceUnavailableError.d.ts.map +1 -0
  19. package/dist/_types/connector.d.ts.map +1 -1
  20. package/dist/index.cjs +2 -2
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.mjs +872 -723
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/styles.css +1 -1
  25. package/package.json +4 -4
  26. package/src/auth/authStoreSlice.ts +72 -3
  27. package/src/auth/components/WalletSheet/index.tsx +9 -18
  28. package/src/auth/hooks/useAuth.ts +7 -0
  29. package/src/auth/index.tsx +3 -0
  30. package/src/auth/pages/SignUp/InstalledWallets.tsx +18 -28
  31. package/src/auth/pages/SignUp/MoreWallets.tsx +14 -26
  32. package/src/auth/pages/SignUp/Wallet.tsx +11 -27
  33. package/src/auth/pages/Verifying.tsx +28 -8
  34. package/src/auth/pages/WalletConnecting.tsx +237 -0
  35. package/src/auth/types.ts +1 -0
  36. package/src/auth/utils/isCancellationError.ts +20 -1
  37. package/src/auth/utils/isResourceUnavailableError.ts +29 -0
  38. package/src/connector.ts +13 -4
  39. package/src/shared/components/StatusScreen/index.tsx +1 -1
  40. package/dist/_types/shared/components/TokenSummary/index.d.ts +0 -18
  41. package/dist/_types/shared/components/TokenSummary/index.d.ts.map +0 -1
  42. package/src/shared/components/TokenSummary/index.tsx +0 -50
package/dist/index.mjs CHANGED
@@ -1,82 +1,88 @@
1
- import { jsxs as c, jsx as n, Fragment as b } from "react/jsx-runtime";
2
- import { Text as w, cn as q, PoweredBy as Z, Button as A, Wrapper as c2, BottomSheet as u2, BottomSheetContent as f2, BottomSheetTitle as p2, BottomSheetClose as m2, QrCode as N2, Input as U2, Icon as K, ListItem as T, ListItemChevron as G, ListItemIcon as h2, Badge as X, Screen as g2, TopNav as z2 } from "@zerodev/react-ui";
3
- import { useState as E, useEffect as N, useMemo as $, useRef as e2, createContext as I2, useContext as T2, useLayoutEffect as L2, useCallback as O2, Fragment as M2 } from "react";
4
- import { useStore as W, create as B2 } from "zustand";
5
- import { useConfig as H2, useConnectors as H, useConnect as V, useConnections as R2, useAccount as D2 } from "wagmi";
6
- import { useSendMagicLink as C2, useSendOTP as w2, useVerifyOTP as P2, useAuthenticateOAuth as W2, useRegisterPasskey as _2, useLoginPasskey as Z2, useVerifyMagicLink as G2, zeroDevWallet as V2, NotAuthenticatedError as j2 } from "@zerodev/wallet-react";
7
- import { subscribeWithSelector as q2 } from "zustand/middleware";
8
- import { walletConnect as K2 } from "wagmi/connectors";
9
- const J2 = "" + new URL("error.webp", import.meta.url).href, Q2 = "" + new URL("loading.webp", import.meta.url).href, Y2 = "" + new URL("send.webp", import.meta.url).href, X2 = "" + new URL("success.webp", import.meta.url).href, $2 = {
10
- error: J2,
11
- loading: Q2,
12
- send: Y2,
13
- success: X2
1
+ import { jsxs as f, jsx as n, Fragment as A } from "react/jsx-runtime";
2
+ import { Text as D, cn as G, PoweredBy as H, Button as v, Wrapper as u2, BottomSheet as f2, BottomSheetContent as p2, BottomSheetTitle as h2, BottomSheetClose as m2, QrCode as T2, Input as L2, Icon as V, ListItem as O, ListItemChevron as _, ListItemIcon as g2, Badge as Q, Screen as z2, TopNav as C2 } from "@zerodev/react-ui";
3
+ import { useState as x, useEffect as k, useMemo as Y, useRef as j, createContext as O2, useContext as M2, useLayoutEffect as W2, useCallback as B2, Fragment as R2 } from "react";
4
+ import { useStore as T, create as H2 } from "zustand";
5
+ import { useConfig as D2, useConnectors as W, useConnect as P2, useConnections as _2, useAccount as w2 } from "wagmi";
6
+ import { useSendMagicLink as x2, useSendOTP as E2, useVerifyOTP as Z2, useAuthenticateOAuth as G2, useRegisterPasskey as V2, useLoginPasskey as j2, useVerifyMagicLink as q2, zeroDevWallet as K2, NotAuthenticatedError as J2 } from "@zerodev/wallet-react";
7
+ import { connect as Q2 } from "@wagmi/core";
8
+ import { subscribeWithSelector as Y2 } from "zustand/middleware";
9
+ import { walletConnect as X2 } from "wagmi/connectors";
10
+ const $2 = "" + new URL("error.webp", import.meta.url).href, ee = "" + new URL("loading.webp", import.meta.url).href, te = "" + new URL("send.webp", import.meta.url).href, ne = "" + new URL("success.webp", import.meta.url).href, ie = {
11
+ error: $2,
12
+ loading: ee,
13
+ send: te,
14
+ success: ne
14
15
  };
15
- function L({
16
+ function N({
16
17
  imageName: e,
17
18
  title: t,
18
- children: r,
19
+ children: o,
19
20
  className: i
20
21
  }) {
21
- return /* @__PURE__ */ c(
22
+ return /* @__PURE__ */ f(
22
23
  "div",
23
24
  {
24
- className: q("zd:flex zd:flex-col zd:gap-8 zd:items-center", i),
25
+ className: G("zd:flex zd:flex-col zd:gap-8 zd:items-center", i),
25
26
  children: [
26
27
  /* @__PURE__ */ n(
27
28
  "img",
28
29
  {
29
- src: $2[e],
30
+ src: ie[e],
30
31
  alt: e,
31
- className: "zd:w-[118px] zd:h-[118px] zd:bg-transparent"
32
+ className: "zd:w-[118px] zd:h-[118px] zd:object-contain zd:bg-transparent"
32
33
  }
33
34
  ),
34
- /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:items-center", children: [
35
- /* @__PURE__ */ n(w, { className: "zd:text-h2 zd:text-center zd:whitespace-pre-wrap", children: t }),
36
- /* @__PURE__ */ n(w, { className: "zd:text-center zd:whitespace-pre-wrap", children: r })
35
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:items-center", children: [
36
+ /* @__PURE__ */ n(D, { className: "zd:text-h2 zd:text-center zd:whitespace-pre-wrap", children: t }),
37
+ /* @__PURE__ */ n(D, { className: "zd:text-center zd:whitespace-pre-wrap", children: o })
37
38
  ] })
38
39
  ]
39
40
  }
40
41
  );
41
42
  }
42
- function ee() {
43
- const t = H2().connectors.find((r) => r.id === "zerodev-wallet");
43
+ function y2() {
44
+ const t = D2().connectors.find((o) => o.id === "zerodev-wallet");
44
45
  if (!t || !("getKitStore" in t))
45
46
  throw new Error("useKitStore must be used with the zeroDevWallet connector");
46
47
  return t.getKitStore();
47
48
  }
48
- function S() {
49
- const e = ee(), t = W(e, (s) => s.auth.step), r = W(e, (s) => s.auth.stepHistory), i = W(e, (s) => s.auth.email), o = W(e, (s) => s.auth.otpId), a = W(
49
+ function b() {
50
+ const e = y2(), t = T(e, (s) => s.auth.step), o = T(e, (s) => s.auth.stepHistory), i = T(e, (s) => s.auth.email), r = T(e, (s) => s.auth.otpId), a = T(
50
51
  e,
51
52
  (s) => s.auth.otpEncryptionTargetBundle
52
- );
53
+ ), c = T(e, (s) => s.auth.pendingWallet), l = T(e, (s) => s.auth.connectError);
53
54
  return {
54
55
  step: t,
55
56
  email: i,
56
- otpId: o,
57
+ otpId: r,
57
58
  otpEncryptionTargetBundle: a,
59
+ pendingWallet: c,
60
+ connectError: l,
61
+ startWalletConnection: e.getState().auth.startWalletConnection,
62
+ setConnectError: e.getState().auth.setConnectError,
63
+ clearPendingWallet: e.getState().auth.clearPendingWallet,
58
64
  goToStep: e.getState().auth.goToStep,
59
- goBack: r.length > 0 ? e.getState().auth.goBack : null,
65
+ goBack: o.length > 0 ? e.getState().auth.goBack : null,
60
66
  reset: e.getState().auth.reset,
61
67
  setEmail: e.getState().auth.setEmail,
62
68
  setOtpSession: e.getState().auth.setOtpSession,
63
69
  clearOtpSession: e.getState().auth.clearOtpSession
64
70
  };
65
71
  }
66
- function te() {
67
- const { email: e, setOtpSession: t } = S(), { mutateAsync: r, isPending: i } = C2(), [o, a] = E(60), s = o <= 0 && !i;
68
- return N(() => {
69
- if (o <= 0) return;
70
- const u = setInterval(() => {
71
- a((g) => Math.max(0, g - 1));
72
+ function re() {
73
+ const { email: e, setOtpSession: t } = b(), { mutateAsync: o, isPending: i } = x2(), [r, a] = x(60), c = r <= 0 && !i;
74
+ return k(() => {
75
+ if (r <= 0) return;
76
+ const s = setInterval(() => {
77
+ a((d) => Math.max(0, d - 1));
72
78
  }, 1e3);
73
79
  return () => {
74
- clearInterval(u);
80
+ clearInterval(s);
75
81
  };
76
- }, [o]), /* @__PURE__ */ c(b, { children: [
77
- /* @__PURE__ */ c("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center", children: [
78
- /* @__PURE__ */ c(
79
- L,
82
+ }, [r]), /* @__PURE__ */ f(A, { children: [
83
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center", children: [
84
+ /* @__PURE__ */ f(
85
+ N,
80
86
  {
81
87
  imageName: "send",
82
88
  title: `Check your email!
@@ -84,278 +90,278 @@ function te() {
84
90
  children: [
85
91
  "We've sent a magic link to",
86
92
  " ",
87
- /* @__PURE__ */ n(w, { as: "span", className: "zd:text-solarOrange", children: e }),
93
+ /* @__PURE__ */ n(D, { as: "span", className: "zd:text-solarOrange", children: e }),
88
94
  `
89
95
  `,
90
96
  "Please open the email and click the link to log in."
91
97
  ]
92
98
  }
93
99
  ),
94
- /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ c(w, { className: "zd:text-center", children: [
100
+ /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ f(D, { className: "zd:text-center", children: [
95
101
  "Did not get an email?",
96
102
  " ",
97
103
  /* @__PURE__ */ n(
98
104
  "button",
99
105
  {
100
106
  type: "button",
101
- disabled: !s,
107
+ disabled: !c,
102
108
  onClick: async () => {
103
- if (!(!e || !s))
109
+ if (!(!e || !c))
104
110
  try {
105
- const { otpId: u, otpEncryptionTargetBundle: g } = await r({
111
+ const { otpId: s, otpEncryptionTargetBundle: d } = await o({
106
112
  email: e
107
113
  });
108
- t({ otpId: u, otpEncryptionTargetBundle: g }), a(60);
114
+ t({ otpId: s, otpEncryptionTargetBundle: d }), a(60);
109
115
  } catch {
110
116
  }
111
117
  },
112
118
  className: "zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",
113
- children: s ? "Resend" : `Resend in ${o} ${o === 1 ? "second" : "seconds"}`
119
+ children: c ? "Resend" : `Resend in ${r} ${r === 1 ? "second" : "seconds"}`
114
120
  }
115
121
  )
116
122
  ] }) })
117
123
  ] }),
118
- /* @__PURE__ */ n(Z, { className: "zd:self-center zd:pt-4 zd:pb-6" })
124
+ /* @__PURE__ */ n(H, { className: "zd:self-center zd:pt-4 zd:pb-6" })
119
125
  ] });
120
126
  }
121
- function ne() {
127
+ function oe() {
122
128
  return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).has("code");
123
129
  }
124
- function _() {
130
+ function P() {
125
131
  if (typeof window > "u") return;
126
132
  const e = new URL(window.location.href);
127
133
  e.searchParams.has("code") && (e.searchParams.delete("code"), window.history.replaceState(null, "", e.toString()));
128
134
  }
129
- function ie({
135
+ function ae({
130
136
  title: e = "Oops, something went wrong",
131
137
  message: t = "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request.",
132
- showRetry: r = !1,
138
+ showRetry: o = !1,
133
139
  showChooseAnother: i = !0
134
140
  }) {
135
- const { goToStep: o, goBack: a, reset: s } = S();
136
- return /* @__PURE__ */ c(b, { children: [
137
- /* @__PURE__ */ c("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
138
- /* @__PURE__ */ n(L, { imageName: "error", title: e, children: t }),
139
- /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-1", children: [
140
- r && /* @__PURE__ */ n(A, { action: "primary", text: "Try again", onClick: a ?? (() => o("sign-up")) }),
141
+ const { goToStep: r, goBack: a, reset: c } = b();
142
+ return /* @__PURE__ */ f(A, { children: [
143
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
144
+ /* @__PURE__ */ n(N, { imageName: "error", title: e, children: t }),
145
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-1", children: [
146
+ o && /* @__PURE__ */ n(v, { action: "primary", text: "Try again", onClick: a ?? (() => r("sign-up")) }),
141
147
  i && /* @__PURE__ */ n(
142
- A,
148
+ v,
143
149
  {
144
- action: r ? "secondary" : "primary",
150
+ action: o ? "secondary" : "primary",
145
151
  onClick: () => {
146
- _(), o("sign-up");
152
+ P(), r("sign-up");
147
153
  },
148
154
  text: "Choose another sign-in method"
149
155
  }
150
156
  ),
151
- !r && !i && /* @__PURE__ */ n(A, { action: "primary", text: "Start over", onClick: s })
157
+ !o && !i && /* @__PURE__ */ n(v, { action: "primary", text: "Start over", onClick: c })
152
158
  ] })
153
159
  ] }),
154
- /* @__PURE__ */ n(Z, { className: "zd:self-center zd:pt-4 zd:pb-6" })
160
+ /* @__PURE__ */ n(H, { className: "zd:self-center zd:pt-4 zd:pb-6" })
155
161
  ] });
156
162
  }
157
- const re = 4, oe = 8, ae = 6;
158
- function se(e) {
159
- return Math.max(re, Math.min(oe, e));
163
+ const se = 4, le = 8, ce = 6;
164
+ function de(e) {
165
+ return Math.max(se, Math.min(le, e));
160
166
  }
161
- function le({ char: e, isFocused: t }) {
167
+ function ue({ char: e, isFocused: t }) {
162
168
  return /* @__PURE__ */ n(
163
- c2,
169
+ u2,
164
170
  {
165
171
  "data-testid": "code-input-box",
166
172
  "data-active": t || void 0,
167
- className: q(
173
+ className: G(
168
174
  "zd:h-16 zd:w-14 zd:rounded-lg zd:flex zd:items-center zd:justify-center",
169
175
  t && "zd:border-[1.5px] zd:border-greyScale"
170
176
  ),
171
- children: /* @__PURE__ */ n(w, { className: "zd:text-h2", children: e })
177
+ children: /* @__PURE__ */ n(D, { className: "zd:text-h2", children: e })
172
178
  }
173
179
  );
174
180
  }
175
- function de({
181
+ function fe({
176
182
  onChange: e,
177
183
  onComplete: t,
178
- disabled: r = !1,
184
+ disabled: o = !1,
179
185
  error: i = !1,
180
- autoFocus: o = !1,
181
- length: a = ae,
182
- "data-testid": s
186
+ autoFocus: r = !1,
187
+ length: a = ce,
188
+ "data-testid": c
183
189
  }) {
184
- const l = se(a), u = $(
185
- () => Array.from({ length: l }, (f, C) => ({
186
- id: `char-${C}`,
187
- index: C
190
+ const l = de(a), s = Y(
191
+ () => Array.from({ length: l }, (u, h) => ({
192
+ id: `char-${h}`,
193
+ index: h
188
194
  })),
189
195
  [l]
190
- ), [g, z] = E(""), [F, p] = E(!1), d = e2(null);
191
- N(() => {
192
- var f;
193
- o && !r && ((f = d.current) == null || f.focus());
194
- }, [o, r]), N(() => {
195
- z((f) => f.slice(0, l));
196
+ ), [d, p] = x(""), [w, z] = x(!1), C = j(null);
197
+ k(() => {
198
+ var u;
199
+ r && !o && ((u = C.current) == null || u.focus());
200
+ }, [r, o]), k(() => {
201
+ p((u) => u.slice(0, l));
196
202
  }, [l]);
197
- const D = (f) => {
198
- const C = f.slice(0, l).toUpperCase();
199
- z(C), e == null || e(C), C.length === l && setTimeout(() => {
200
- var x;
201
- t == null || t(C), (x = d.current) == null || x.blur();
203
+ const m = (u) => {
204
+ const h = u.slice(0, l).toUpperCase();
205
+ p(h), e == null || e(h), h.length === l && setTimeout(() => {
206
+ var g;
207
+ t == null || t(h), (g = C.current) == null || g.blur();
202
208
  }, 0);
203
209
  };
204
- return /* @__PURE__ */ c(
210
+ return /* @__PURE__ */ f(
205
211
  "button",
206
212
  {
207
213
  type: "button",
208
214
  className: "zd:flex zd:flex-row zd:items-center zd:justify-between zd:gap-2 zd:w-full zd:cursor-text",
209
215
  onClick: () => {
210
- var f;
211
- return (f = d.current) == null ? void 0 : f.focus();
216
+ var u;
217
+ return (u = C.current) == null ? void 0 : u.focus();
212
218
  },
213
- disabled: r,
214
- "data-testid": s,
219
+ disabled: o,
220
+ "data-testid": c,
215
221
  children: [
216
222
  /* @__PURE__ */ n(
217
223
  "input",
218
224
  {
219
- ref: d,
220
- value: g,
221
- onChange: (f) => D(f.target.value),
222
- onFocus: () => p(!0),
223
- onBlur: () => p(!1),
225
+ ref: C,
226
+ value: d,
227
+ onChange: (u) => m(u.target.value),
228
+ onFocus: () => z(!0),
229
+ onBlur: () => z(!1),
224
230
  maxLength: l,
225
- disabled: r,
231
+ disabled: o,
226
232
  className: "zd:absolute zd:opacity-0 zd:pointer-events-none",
227
233
  style: { position: "absolute", opacity: 0 },
228
234
  "aria-label": "Verification code"
229
235
  }
230
236
  ),
231
- u.map((f) => /* @__PURE__ */ n(
232
- le,
237
+ s.map((u) => /* @__PURE__ */ n(
238
+ ue,
233
239
  {
234
- char: g[f.index] ?? "",
235
- isFocused: !i && F && f.index === g.length
240
+ char: d[u.index] ?? "",
241
+ isFocused: !i && w && u.index === d.length
236
242
  },
237
- f.id
243
+ u.id
238
244
  ))
239
245
  ]
240
246
  }
241
247
  );
242
248
  }
243
- function ce() {
249
+ function pe() {
244
250
  const {
245
251
  email: e,
246
252
  otpId: t,
247
- otpEncryptionTargetBundle: r,
253
+ otpEncryptionTargetBundle: o,
248
254
  setOtpSession: i,
249
- clearOtpSession: o,
255
+ clearOtpSession: r,
250
256
  goToStep: a
251
- } = S(), { mutateAsync: s, isPending: l } = w2(), { mutateAsync: u, isPending: g } = P2(), [z, F] = E(""), [p, d] = E(!1), [D, f] = E(60);
252
- N(() => {
253
- if (D <= 0) return;
254
- const v = setInterval(() => {
255
- f((y) => Math.max(0, y - 1));
257
+ } = b(), { mutateAsync: c, isPending: l } = E2(), { mutateAsync: s, isPending: d } = Z2(), [p, w] = x(""), [z, C] = x(!1), [m, u] = x(60);
258
+ k(() => {
259
+ if (m <= 0) return;
260
+ const S = setInterval(() => {
261
+ u((y) => Math.max(0, y - 1));
256
262
  }, 1e3);
257
- return () => clearInterval(v);
258
- }, [D]);
259
- const C = async () => {
260
- if (!(!z.trim() || !t || !r)) {
261
- d(!1);
263
+ return () => clearInterval(S);
264
+ }, [m]);
265
+ const h = async () => {
266
+ if (!(!p.trim() || !t || !o)) {
267
+ C(!1);
262
268
  try {
263
- await u({
269
+ await s({
264
270
  otpId: t,
265
- code: z.trim(),
266
- otpEncryptionTargetBundle: r
267
- }), o(), a("authenticated");
271
+ code: p.trim(),
272
+ otpEncryptionTargetBundle: o
273
+ }), r(), a("authenticated");
268
274
  } catch {
269
- d(!0);
275
+ C(!0);
270
276
  }
271
277
  }
272
- }, x = (v) => {
273
- F(v);
274
- }, m = async () => {
275
- if (!(!e || D > 0 || l))
278
+ }, g = (S) => {
279
+ w(S);
280
+ }, E = async () => {
281
+ if (!(!e || m > 0 || l))
276
282
  try {
277
- const { otpId: v, otpEncryptionTargetBundle: y } = await s({ email: e });
283
+ const { otpId: S, otpEncryptionTargetBundle: y } = await c({ email: e });
278
284
  i({
279
- otpId: v,
285
+ otpId: S,
280
286
  otpEncryptionTargetBundle: y
281
- }), f(60), d(!1);
287
+ }), u(60), C(!1);
282
288
  } catch {
283
- d(!0);
289
+ C(!0);
284
290
  }
285
- }, h = D <= 0 && !l;
286
- return /* @__PURE__ */ c(b, { children: [
287
- /* @__PURE__ */ c("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center zd:items-center", children: [
288
- /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-4", children: [
289
- /* @__PURE__ */ n(w, { className: "zd:text-h2 zd:text-center", children: "Enter verification code" }),
290
- /* @__PURE__ */ c(w, { className: "zd:text-center", children: [
291
+ }, F = m <= 0 && !l;
292
+ return /* @__PURE__ */ f(A, { children: [
293
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center zd:items-center", children: [
294
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-4", children: [
295
+ /* @__PURE__ */ n(D, { className: "zd:text-h2 zd:text-center", children: "Enter verification code" }),
296
+ /* @__PURE__ */ f(D, { className: "zd:text-center", children: [
291
297
  "Enter the code from the email we sent to",
292
298
  " ",
293
- /* @__PURE__ */ n(w, { className: "zd:text-solarOrange", children: e })
299
+ /* @__PURE__ */ n(D, { className: "zd:text-solarOrange", children: e })
294
300
  ] })
295
301
  ] }),
296
302
  /* @__PURE__ */ n(
297
- de,
303
+ fe,
298
304
  {
299
- onComplete: x,
300
- onChange: () => d(!1),
301
- disabled: g,
302
- error: p,
305
+ onComplete: g,
306
+ onChange: () => C(!1),
307
+ disabled: d,
308
+ error: z,
303
309
  autoFocus: !0
304
310
  }
305
311
  ),
306
312
  /* @__PURE__ */ n(
307
- A,
313
+ v,
308
314
  {
309
315
  text: "Confirm code",
310
- onClick: C,
311
- disabled: !z.trim() || g
316
+ onClick: h,
317
+ disabled: !p.trim() || d
312
318
  }
313
319
  ),
314
- /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ c(w, { className: "zd:text-center", children: [
320
+ /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-col zd:gap-1", children: /* @__PURE__ */ f(D, { className: "zd:text-center", children: [
315
321
  "Did not get an email?",
316
322
  " ",
317
323
  /* @__PURE__ */ n(
318
324
  "button",
319
325
  {
320
326
  type: "button",
321
- disabled: !h,
322
- onClick: m,
327
+ disabled: !F,
328
+ onClick: E,
323
329
  className: "zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",
324
- children: h ? "Resend" : `Resend in ${D} ${D === 1 ? "second" : "seconds"}`
330
+ children: F ? "Resend" : `Resend in ${m} ${m === 1 ? "second" : "seconds"}`
325
331
  }
326
332
  )
327
333
  ] }) })
328
334
  ] }),
329
- /* @__PURE__ */ n(Z, { className: "zd:self-center zd:pt-4 zd:pb-6" })
335
+ /* @__PURE__ */ n(H, { className: "zd:self-center zd:pt-4 zd:pb-6" })
330
336
  ] });
331
337
  }
332
- function ue({
338
+ function he({
333
339
  termsAndConditionsUrl: e,
334
340
  privacyPolicyUrl: t,
335
- agreedToTerms: r,
341
+ agreedToTerms: o,
336
342
  setAgreedToTerms: i,
337
- highlight: o = !1
343
+ highlight: r = !1
338
344
  }) {
339
- return /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:items-center zd:gap-5", children: [
340
- !!(e || t) && /* @__PURE__ */ c(
345
+ return /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:items-center zd:gap-5", children: [
346
+ !!(e || t) && /* @__PURE__ */ f(
341
347
  "div",
342
348
  {
343
- className: `zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${o ? "zd:border zd:border-negative" : "zd:border zd:border-transparent"}`,
349
+ className: `zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${r ? "zd:border zd:border-negative" : "zd:border zd:border-transparent"}`,
344
350
  children: [
345
351
  /* @__PURE__ */ n(
346
352
  "input",
347
353
  {
348
354
  type: "checkbox",
349
- checked: r,
350
- onChange: (s) => i(s.target.checked),
355
+ checked: o,
356
+ onChange: (c) => i(c.target.checked),
351
357
  className: "zd:cursor-pointer zd:[color-scheme:light]"
352
358
  }
353
359
  ),
354
- /* @__PURE__ */ c(w, { className: "zd:flex-1", children: [
360
+ /* @__PURE__ */ f(D, { className: "zd:flex-1", children: [
355
361
  "I agree to the",
356
362
  " ",
357
363
  e && /* @__PURE__ */ n(
358
- w,
364
+ D,
359
365
  {
360
366
  as: "a",
361
367
  href: e,
@@ -367,7 +373,7 @@ function ue({
367
373
  ),
368
374
  e && t && " and ",
369
375
  t && /* @__PURE__ */ n(
370
- w,
376
+ D,
371
377
  {
372
378
  as: "a",
373
379
  href: t,
@@ -381,17 +387,17 @@ function ue({
381
387
  ]
382
388
  }
383
389
  ),
384
- /* @__PURE__ */ n(Z, {})
390
+ /* @__PURE__ */ n(H, {})
385
391
  ] });
386
392
  }
387
- const fe = "" + new URL("blob.webm", import.meta.url).href;
388
- function pe({ className: e }) {
393
+ const me = "" + new URL("blob.webm", import.meta.url).href;
394
+ function ge({ className: e }) {
389
395
  return /* @__PURE__ */ n(
390
396
  "video",
391
397
  {
392
398
  className: e,
393
399
  style: { aspectRatio: "1 / 1" },
394
- src: fe,
400
+ src: me,
395
401
  autoPlay: !0,
396
402
  loop: !0,
397
403
  muted: !0,
@@ -401,17 +407,14 @@ function pe({ className: e }) {
401
407
  }
402
408
  );
403
409
  }
404
- const me = "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='24'%20height='24'%20fill='url(%23pattern0_19361_9946)'/%3e%3cdefs%3e%3cpattern%20id='pattern0_19361_9946'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_19361_9946'%20transform='scale(0.0136986)'/%3e%3c/pattern%3e%3cimage%20id='image0_19361_9946'%20width='73'%20height='73'%20preserveAspectRatio='none'%20xlink:href='data:image/png;base64,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'/%3e%3c/defs%3e%3c/svg%3e", t2 = me;
405
- function R(e) {
406
- return e instanceof Error ? e.name === "AbortError" || e.name === "NotAllowedError" || e.name === "UserRejectedRequestError" ? !0 : e.message.toLowerCase().includes("oauth popup was closed") : !1;
407
- }
408
- function n2(e, t) {
410
+ const ze = "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='24'%20height='24'%20fill='url(%23pattern0_19361_9946)'/%3e%3cdefs%3e%3cpattern%20id='pattern0_19361_9946'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_19361_9946'%20transform='scale(0.0136986)'/%3e%3c/pattern%3e%3cimage%20id='image0_19361_9946'%20width='73'%20height='73'%20preserveAspectRatio='none'%20xlink:href='data:image/png;base64,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'/%3e%3c/defs%3e%3c/svg%3e", X = ze;
411
+ function $(e, t) {
409
412
  return t.rdns && e.id === t.rdns ? !0 : !!t.rdns && e.type === "injected" && e.id !== "injected" && e.id !== "zerodev-wallet" && e.name === t.name;
410
413
  }
411
- function O(e, t) {
412
- return n2(e, t) ? !0 : !!t.rdns && (Array.isArray(e.rdns) ? e.rdns.includes(t.rdns) : e.rdns === t.rdns);
414
+ function M(e, t) {
415
+ return $(e, t) ? !0 : !!t.rdns && (Array.isArray(e.rdns) ? e.rdns.includes(t.rdns) : e.rdns === t.rdns);
413
416
  }
414
- const he = [
417
+ const Ce = [
415
418
  {
416
419
  id: "metamask",
417
420
  name: "MetaMask",
@@ -490,52 +493,48 @@ const he = [
490
493
  mobileLink: "bnc://app.binance.com/cedefi/wc?uri=",
491
494
  downloadUrl: "https://www.binance.com/en/download"
492
495
  }
493
- ], k = he;
494
- function ge({
496
+ ], U = Ce;
497
+ function De({
495
498
  open: e,
496
499
  onOpenChange: t,
497
- wallet: r,
500
+ wallet: o,
498
501
  pairing: i
499
502
  }) {
500
- return /* @__PURE__ */ n(u2, { open: e, onOpenChange: t, children: /* @__PURE__ */ c(f2, { className: "zd:p-4", children: [
501
- /* @__PURE__ */ n(p2, { children: r ? `Connect ${r.name}` : "WalletConnect" }),
502
- /* @__PURE__ */ n(ze, { wallet: r, pairing: i })
503
+ return /* @__PURE__ */ n(f2, { open: e, onOpenChange: t, children: /* @__PURE__ */ f(p2, { className: "zd:p-4", children: [
504
+ /* @__PURE__ */ n(h2, { children: o ? `Connect ${o.name}` : "WalletConnect" }),
505
+ /* @__PURE__ */ n(we, { wallet: o, pairing: i })
503
506
  ] }) });
504
507
  }
505
- function ze({
508
+ function we({
506
509
  wallet: e,
507
510
  pairing: t
508
511
  }) {
509
- const { goToStep: r } = S(), { uri: i, error: o, retry: a } = t, s = H(), { connect: l } = V(), u = e ? s.find((h) => O(h, e)) : void 0, [g, z] = E(
510
- u ? "browser" : "mobile"
511
- ), [F, p] = E(null), [d, D] = E(!1), f = i && (e != null && e.mobileLink) ? `${e.mobileLink}${encodeURIComponent(i)}` : i, C = async () => {
512
+ const { startWalletConnection: o } = b(), { uri: i, error: r, retry: a } = t, c = W(), l = e ? c.find((h) => M(h, e)) : void 0, [s, d] = x(
513
+ l ? "browser" : "mobile"
514
+ ), [p, w] = x(!1), z = i && (e != null && e.mobileLink) ? `${e.mobileLink}${encodeURIComponent(i)}` : i, C = async () => {
512
515
  if (i)
513
516
  try {
514
- await navigator.clipboard.writeText(i), D(!0), setTimeout(() => D(!1), 2e3);
517
+ await navigator.clipboard.writeText(i), w(!0), setTimeout(() => w(!1), 2e3);
515
518
  } catch {
516
519
  }
517
- }, x = () => {
518
- u && (p(null), l(
519
- { connector: u },
520
- {
521
- onSuccess: () => r(null),
522
- onError: (h) => {
523
- R(h) || p(h instanceof Error ? h.message : String(h));
524
- }
525
- }
526
- ));
527
- }, m = o ?? F;
528
- return /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:items-center zd:gap-3", children: [
529
- /* @__PURE__ */ c("div", { className: "zd:flex zd:w-full zd:items-center zd:gap-2", children: [
520
+ }, m = () => {
521
+ l && o({
522
+ connectorUid: l.uid,
523
+ name: (e == null ? void 0 : e.name) ?? l.name,
524
+ icon: (e == null ? void 0 : e.icon) ?? l.icon
525
+ });
526
+ }, u = r;
527
+ return /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:items-center zd:gap-3", children: [
528
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:w-full zd:items-center zd:gap-2", children: [
530
529
  /* @__PURE__ */ n(
531
530
  "img",
532
531
  {
533
- src: e ? e.icon : t2,
532
+ src: e ? e.icon : X,
534
533
  alt: "",
535
534
  className: "zd:w-8 zd:h-8 zd:rounded-xl"
536
535
  }
537
536
  ),
538
- /* @__PURE__ */ n(w, { className: "zd:text-h3 zd:flex-1", children: e ? e.name : "WalletConnect" }),
537
+ /* @__PURE__ */ n(D, { className: "zd:text-h3 zd:flex-1", children: e ? e.name : "WalletConnect" }),
539
538
  /* @__PURE__ */ n(m2, { asChild: !0, children: /* @__PURE__ */ n(
540
539
  "button",
541
540
  {
@@ -550,21 +549,21 @@ function ze({
550
549
  "button",
551
550
  {
552
551
  type: "button",
553
- onClick: () => z(h),
554
- className: `zd:flex-1 zd:rounded-2xl zd:py-1.5 zd:text-body3 zd:cursor-pointer ${g === h ? "zd:bg-greyScale/10 zd:font-semibold" : "zd:text-greyScale/60"}`,
552
+ onClick: () => d(h),
553
+ className: `zd:flex-1 zd:rounded-2xl zd:py-1.5 zd:text-body3 zd:cursor-pointer ${s === h ? "zd:bg-greyScale/10 zd:font-semibold" : "zd:text-greyScale/60"}`,
555
554
  children: h === "mobile" ? "Mobile" : "Browser"
556
555
  },
557
556
  h
558
557
  )) }),
559
- !e || g === "mobile" ? m ? /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-2 zd:items-center", children: [
560
- /* @__PURE__ */ n(w, { className: "zd:text-center zd:text-red-500", children: m }),
561
- /* @__PURE__ */ n(A, { action: "secondary", text: "Try again", onClick: a })
562
- ] }) : /* @__PURE__ */ c(b, { children: [
563
- /* @__PURE__ */ n("div", { className: "zd:bg-white zd:rounded-2xl zd:p-2 zd:border zd:border-greyScale/10", children: f ? /* @__PURE__ */ n(N2, { value: f, size: 176 }) : /* @__PURE__ */ n("div", { className: "zd:w-[176px] zd:h-[176px] zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ n("div", { className: "zd:w-8 zd:h-8 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) }),
564
- f && (e == null ? void 0 : e.mobileLink) && /* @__PURE__ */ c(
558
+ !e || s === "mobile" ? u ? /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-2 zd:items-center", children: [
559
+ /* @__PURE__ */ n(D, { className: "zd:text-center zd:text-red-500", children: u }),
560
+ /* @__PURE__ */ n(v, { action: "secondary", text: "Try again", onClick: a })
561
+ ] }) : /* @__PURE__ */ f(A, { children: [
562
+ /* @__PURE__ */ n("div", { className: "zd:bg-white zd:rounded-2xl zd:p-2 zd:border zd:border-greyScale/10", children: z ? /* @__PURE__ */ n(T2, { value: z, size: 176 }) : /* @__PURE__ */ n("div", { className: "zd:w-[176px] zd:h-[176px] zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ n("div", { className: "zd:w-8 zd:h-8 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) }),
563
+ z && (e == null ? void 0 : e.mobileLink) && /* @__PURE__ */ f(
565
564
  "a",
566
565
  {
567
- href: f,
566
+ href: z,
568
567
  className: "zd:w-full zd:rounded-2xl zd:bg-greyScale/10 zd:py-2 zd:text-center zd:text-body2 zd:font-semibold",
569
568
  children: [
570
569
  "Open in ",
@@ -573,36 +572,36 @@ function ze({
573
572
  }
574
573
  ),
575
574
  /* @__PURE__ */ n(
576
- A,
575
+ v,
577
576
  {
578
577
  action: "secondary",
579
- text: d ? "Copied" : "Copy link",
578
+ text: p ? "Copied" : "Copy link",
580
579
  onClick: C,
581
- disabled: !f
580
+ disabled: !z
582
581
  }
583
582
  )
584
- ] }) : m ? /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-2 zd:items-center", children: [
585
- /* @__PURE__ */ n(w, { className: "zd:text-center zd:text-red-500", children: m }),
583
+ ] }) : u ? /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-2 zd:items-center", children: [
584
+ /* @__PURE__ */ n(D, { className: "zd:text-center zd:text-red-500", children: u }),
586
585
  /* @__PURE__ */ n(
587
- A,
586
+ v,
588
587
  {
589
588
  action: "secondary",
590
589
  text: "Try again",
591
- onClick: u ? x : a
590
+ onClick: l ? m : a
592
591
  }
593
592
  )
594
- ] }) : u && e ? /* @__PURE__ */ c(
593
+ ] }) : l && e ? /* @__PURE__ */ f(
595
594
  "button",
596
595
  {
597
596
  type: "button",
598
- onClick: x,
597
+ onClick: m,
599
598
  className: "zd:w-full zd:cursor-pointer zd:rounded-2xl zd:bg-greyScale/10 zd:py-2 zd:text-center zd:text-body2 zd:font-semibold",
600
599
  children: [
601
600
  "Open in ",
602
601
  e.name
603
602
  ]
604
603
  }
605
- ) : e && /* @__PURE__ */ c(
604
+ ) : e && /* @__PURE__ */ f(
606
605
  "a",
607
606
  {
608
607
  href: e.downloadUrl,
@@ -617,199 +616,202 @@ function ze({
617
616
  )
618
617
  ] });
619
618
  }
620
- function x2() {
619
+ function F2() {
621
620
  var e, t;
622
621
  return typeof window > "u" ? !1 : ((t = (e = window.matchMedia) == null ? void 0 : e.call(window, "(pointer: coarse)")) == null ? void 0 : t.matches) || /Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(
623
622
  navigator.userAgent
624
623
  );
625
624
  }
626
- function J(e) {
625
+ function q(e) {
627
626
  return e.type === "walletConnect" && "zdWalletConnect" in e;
628
627
  }
629
- function De(e) {
630
- const { wallet: t, connectors: r, uri: i, mobile: o } = e;
631
- return !t.mobileLink || !o || !i || r.some((a) => O(a, t)) ? null : `${t.mobileLink}${encodeURIComponent(i)}`;
628
+ function xe(e) {
629
+ const { wallet: t, connectors: o, uri: i, mobile: r } = e;
630
+ return !t.mobileLink || !r || !i || o.some((a) => M(a, t)) ? null : `${t.mobileLink}${encodeURIComponent(i)}`;
632
631
  }
633
- function Ce() {
634
- const { goToStep: e } = S(), t = H(), r = t.find(J), { connect: i } = V(), a = R2().some(
635
- (d) => d.connector.uid === (r == null ? void 0 : r.uid)
636
- ), { isReconnecting: s } = D2(), [l, u] = E(null), [g, z] = E(null), F = e2(!1), p = (d) => {
637
- z(null), u(null), i({ connector: d }, { onError: (D) => z(D.message) });
632
+ function Ee() {
633
+ const { goToStep: e } = b(), t = W(), o = t.find(q), { connect: i } = P2(), a = _2().some(
634
+ (C) => C.connector.uid === (o == null ? void 0 : o.uid)
635
+ ), { isReconnecting: c } = w2(), [l, s] = x(null), [d, p] = x(null), w = j(!1), z = (C) => {
636
+ p(null), s(null), i({ connector: C }, { onError: (m) => p(m.message) });
638
637
  };
639
- return N(() => {
640
- if (!r || a) return;
641
- const d = ({ type: m, data: h }) => {
642
- m === "display_uri" && typeof h == "string" && u(h);
638
+ return k(() => {
639
+ if (!o || a) return;
640
+ const C = ({ type: E, data: F }) => {
641
+ E === "display_uri" && typeof F == "string" && s(F);
643
642
  };
644
- r.emitter.on("message", d);
645
- const D = () => z("Proposal expired"), f = () => e(null);
646
- let C, x = !1;
647
- return r.getProvider().then((m) => {
648
- var h, v, y;
649
- x || (C = m, (y = (v = (h = C.signer) == null ? void 0 : h.client) == null ? void 0 : v.events) == null || y.on("proposal_expire", D), C.on("connect", f));
650
- }).catch((m) => {
651
- x || z(m instanceof Error ? m.message : String(m));
652
- }), !F.current && !s && (F.current = !0, p(r)), () => {
653
- var m, h, v;
654
- x = !0, (v = (h = (m = C == null ? void 0 : C.signer) == null ? void 0 : m.client) == null ? void 0 : h.events) == null || v.off("proposal_expire", D), C == null || C.off("connect", f), r.emitter.off("message", d);
643
+ o.emitter.on("message", C);
644
+ const m = () => p("Proposal expired"), u = () => e(null);
645
+ let h, g = !1;
646
+ return o.getProvider().then((E) => {
647
+ var F, S, y;
648
+ g || (h = E, (y = (S = (F = h.signer) == null ? void 0 : F.client) == null ? void 0 : S.events) == null || y.on("proposal_expire", m), h.on("connect", u));
649
+ }).catch((E) => {
650
+ g || p(E instanceof Error ? E.message : String(E));
651
+ }), !w.current && !c && (w.current = !0, z(o)), () => {
652
+ var E, F, S;
653
+ g = !0, (S = (F = (E = h == null ? void 0 : h.signer) == null ? void 0 : E.client) == null ? void 0 : F.events) == null || S.off("proposal_expire", m), h == null || h.off("connect", u), o.emitter.off("message", C);
655
654
  };
656
- }, [r, a, s]), {
655
+ }, [o, a, c]), {
657
656
  uri: l,
658
- error: g,
657
+ error: d,
659
658
  retry: () => {
660
- r && p(r);
659
+ o && z(o);
661
660
  },
662
- deepLinkFor: (d) => De({
663
- wallet: d,
661
+ deepLinkFor: (C) => xe({
662
+ wallet: C,
664
663
  connectors: t,
665
- uri: g ? null : l,
666
- mobile: x2()
664
+ uri: d ? null : l,
665
+ mobile: F2()
667
666
  })
668
667
  };
669
668
  }
670
- const E2 = I2(null);
671
- function U() {
672
- const e = T2(E2);
669
+ const v2 = O2(null);
670
+ function I() {
671
+ const e = M2(v2);
673
672
  if (!e)
674
673
  throw new Error("SignUp.* components must be rendered inside <SignUp>");
675
674
  return e;
676
675
  }
677
- function P(e) {
678
- const { setAuthPending: t } = U();
679
- N(() => (t(e), () => t(!1)), [e, t]);
676
+ function e2(e) {
677
+ const { setAuthPending: t } = I();
678
+ k(() => (t(e), () => t(!1)), [e, t]);
680
679
  }
681
- const we = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
682
- function Y(e) {
683
- return we.test(e.trim());
680
+ const ye = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
681
+ function J(e) {
682
+ return ye.test(e.trim());
684
683
  }
685
- function F2() {
686
- const { goToStep: e, setEmail: t, setOtpSession: r } = S(), {
684
+ function b2() {
685
+ const { goToStep: e, setEmail: t, setOtpSession: o } = b(), {
687
686
  authPending: i,
688
- emailAuthMethod: o,
687
+ emailAuthMethod: r,
689
688
  needsAgreement: a,
690
- guardAgreement: s,
689
+ guardAgreement: c,
691
690
  setError: l
692
- } = U(), [u, g] = E(""), z = o === "otp", { mutateAsync: F, isPending: p } = w2(), { mutateAsync: d, isPending: D } = C2(), f = p || D;
693
- P(f);
694
- const C = async () => {
695
- if (!(!u || i) && Y(u) && s()) {
691
+ } = I(), [s, d] = x(""), p = r === "otp", { mutateAsync: w, isPending: z } = E2(), { mutateAsync: C, isPending: m } = x2(), u = z || m;
692
+ e2(u);
693
+ const h = async () => {
694
+ if (!(!s || i) && J(s) && c()) {
696
695
  l(null);
697
696
  try {
698
- const x = z ? F : d, { otpId: m, otpEncryptionTargetBundle: h } = await x({
699
- email: u
697
+ const g = p ? w : C, { otpId: E, otpEncryptionTargetBundle: F } = await g({
698
+ email: s
700
699
  });
701
- t(u), r({ otpId: m, otpEncryptionTargetBundle: h }), e(z ? "otp-input" : "email-verification");
702
- } catch (x) {
700
+ t(s), o({ otpId: E, otpEncryptionTargetBundle: F }), e(p ? "otp-input" : "email-verification");
701
+ } catch (g) {
703
702
  l(
704
- x instanceof Error ? x.message : "Failed to send verification code"
703
+ g instanceof Error ? g.message : "Failed to send verification code"
705
704
  );
706
705
  }
707
706
  }
708
707
  };
709
708
  return /* @__PURE__ */ n(
710
- U2,
709
+ L2,
711
710
  {
712
711
  iconName: "email",
713
712
  placeholder: "Enter your email",
714
- value: u,
715
- onChange: (x) => g(x.target.value),
713
+ value: s,
714
+ onChange: (g) => d(g.target.value),
716
715
  type: "email",
717
716
  autoCapitalize: "none",
718
717
  autoComplete: "email",
719
718
  disabled: i,
720
719
  variant: "listItemStyle",
721
- onKeyDown: (x) => {
722
- x.key === "Enter" && u && !i && C();
720
+ onKeyDown: (g) => {
721
+ g.key === "Enter" && s && !i && h();
723
722
  },
724
- children: f ? /* @__PURE__ */ n("div", { className: "zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ n("div", { className: "zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) : /* @__PURE__ */ n(
723
+ children: u ? /* @__PURE__ */ n("div", { className: "zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center", children: /* @__PURE__ */ n("div", { className: "zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin" }) }) : /* @__PURE__ */ n(
725
724
  "button",
726
725
  {
727
726
  type: "button",
728
- disabled: !Y(u) || a,
729
- className: `zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${Y(u) && !a ? "zd:cursor-pointer" : "zd:cursor-not-allowed zd:opacity-50"}`,
730
- onClick: () => C(),
731
- children: /* @__PURE__ */ n(K, { name: "chevronRight", className: "zd:text-greyScale" })
727
+ disabled: !J(s) || a,
728
+ className: `zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${J(s) && !a ? "zd:cursor-pointer" : "zd:cursor-not-allowed zd:opacity-50"}`,
729
+ onClick: () => h(),
730
+ children: /* @__PURE__ */ n(V, { name: "chevronRight", className: "zd:text-greyScale" })
732
731
  }
733
732
  )
734
733
  }
735
734
  );
736
735
  }
737
- function y2() {
738
- const { goToStep: e } = S(), { authPending: t, guardAgreement: r, setError: i } = U(), { mutateAsync: o, isPending: a } = W2({
736
+ function t2(e) {
737
+ let t = e;
738
+ for (let i = 0; i < 5 && Fe(t); i++) {
739
+ if (t.code === 4001) return !0;
740
+ t = t.cause;
741
+ }
742
+ return e instanceof Error ? e.name === "AbortError" || e.name === "NotAllowedError" || e.name === "UserRejectedRequestError" ? !0 : e.message.toLowerCase().includes("oauth popup was closed") : !1;
743
+ }
744
+ function Fe(e) {
745
+ return typeof e == "object" && e !== null;
746
+ }
747
+ function S2() {
748
+ const { goToStep: e } = b(), { authPending: t, guardAgreement: o, setError: i } = I(), { mutateAsync: r, isPending: a } = G2({
739
749
  mutation: {
740
750
  onSuccess: () => {
741
751
  e("authenticated");
742
752
  }
743
753
  }
744
754
  });
745
- return P(a), /* @__PURE__ */ n(
746
- T,
755
+ return e2(a), /* @__PURE__ */ n(
756
+ O,
747
757
  {
748
- icon: /* @__PURE__ */ n(h2, { name: "google" }),
758
+ icon: /* @__PURE__ */ n(g2, { name: "google" }),
749
759
  title: "Google",
750
- trailing: /* @__PURE__ */ n(G, {}),
760
+ trailing: /* @__PURE__ */ n(_, {}),
751
761
  disabled: t,
752
762
  onClick: async () => {
753
- if (!t && r()) {
763
+ if (!t && o()) {
754
764
  i(null);
755
765
  try {
756
- await o({ provider: "google" });
766
+ await r({ provider: "google" });
757
767
  } catch (l) {
758
- R(l) || i(l instanceof Error ? l.message : String(l));
768
+ t2(l) || i(l instanceof Error ? l.message : String(l));
759
769
  }
760
770
  }
761
771
  }
762
772
  }
763
773
  );
764
774
  }
765
- function xe({
775
+ function ve({
766
776
  excludeWalletIds: e = [],
767
777
  maxWallets: t = 4
768
778
  }) {
769
- const { goToStep: r } = S(), { authPending: i, guardAgreement: o, setError: a, registeredWallets: s } = U(), l = H(), { connect: u, isPending: g } = V();
770
- P(g);
771
- const z = l.filter(
772
- (p) => p.type === "injected" && p.id !== "injected" && p.id !== "zerodev-wallet"
773
- ).map((p) => {
774
- const d = k.find((D) => O(p, D));
779
+ const { startWalletConnection: o } = b(), { authPending: i, guardAgreement: r, registeredWallets: a } = I(), l = W().filter(
780
+ (d) => d.type === "injected" && d.id !== "injected" && d.id !== "zerodev-wallet"
781
+ ).map((d) => {
782
+ const p = U.find((w) => M(d, w));
775
783
  return {
776
- connector: p,
777
- walletId: d == null ? void 0 : d.id,
778
- name: (d == null ? void 0 : d.name) ?? p.name,
779
- icon: (d == null ? void 0 : d.icon) ?? p.icon,
780
- ids: d ? [d.id, p.id] : [p.id],
781
- rank: d ? k.indexOf(d) : k.length
784
+ connector: d,
785
+ walletId: p == null ? void 0 : p.id,
786
+ name: (p == null ? void 0 : p.name) ?? d.name,
787
+ icon: (p == null ? void 0 : p.icon) ?? d.icon,
788
+ ids: p ? [p.id, d.id] : [d.id],
789
+ rank: p ? U.indexOf(p) : U.length
782
790
  };
783
791
  }).filter(
784
- (p) => !(p.walletId && s.includes(p.walletId))
785
- ).filter((p) => !p.ids.some((d) => e.includes(d))).sort((p, d) => p.rank - d.rank).slice(0, t), F = (p) => {
786
- i || o() && (a(null), u(
787
- { connector: p },
788
- {
789
- // The external wallet is now the active wagmi connection — the
790
- // embedded-wallet flow is done, so close it (mirrors SignUp.Wallet).
791
- onSuccess: () => r(null),
792
- onError: (d) => {
793
- R(d) || a(d instanceof Error ? d.message : String(d));
794
- }
795
- }
796
- ));
792
+ (d) => !(d.walletId && a.includes(d.walletId))
793
+ ).filter((d) => !d.ids.some((p) => e.includes(p))).sort((d, p) => d.rank - p.rank).slice(0, t), s = (d) => {
794
+ i || r() && o({
795
+ connectorUid: d.connector.uid,
796
+ name: d.name,
797
+ icon: d.icon
798
+ });
797
799
  };
798
- return /* @__PURE__ */ n(b, { children: z.map(({ connector: p, name: d, icon: D }) => /* @__PURE__ */ n(
799
- T,
800
+ return /* @__PURE__ */ n(A, { children: l.map((d) => /* @__PURE__ */ n(
801
+ O,
800
802
  {
801
- title: d,
802
- icon: D ? /* @__PURE__ */ n("img", { src: D, alt: "", className: "zd:w-6 zd:h-6" }) : null,
803
- subtitle: /* @__PURE__ */ n(X, { text: "INSTALLED" }),
804
- trailing: /* @__PURE__ */ n(G, {}),
803
+ title: d.name,
804
+ icon: d.icon ? /* @__PURE__ */ n("img", { src: d.icon, alt: "", className: "zd:w-6 zd:h-6" }) : null,
805
+ subtitle: /* @__PURE__ */ n(Q, { text: "INSTALLED" }),
806
+ trailing: /* @__PURE__ */ n(_, {}),
805
807
  disabled: i,
806
- onClick: () => F(p)
808
+ onClick: () => s(d)
807
809
  },
808
- p.uid
810
+ d.connector.uid
809
811
  )) });
810
812
  }
811
- function Ee({ tile: e }) {
812
- return /* @__PURE__ */ c(
813
+ function be({ tile: e }) {
814
+ return /* @__PURE__ */ f(
813
815
  "button",
814
816
  {
815
817
  type: "button",
@@ -817,26 +819,26 @@ function Ee({ tile: e }) {
817
819
  className: "zd:flex zd:flex-col zd:items-center zd:gap-1.5 zd:cursor-pointer",
818
820
  children: [
819
821
  /* @__PURE__ */ n("div", { className: "zd:w-16 zd:h-16 zd:rounded-2xl zd:bg-greyScale/5 zd:flex zd:items-center zd:justify-center", children: e.icon ? /* @__PURE__ */ n("img", { src: e.icon, alt: "", className: "zd:w-8 zd:h-8" }) : /* @__PURE__ */ n(
820
- K,
822
+ V,
821
823
  {
822
824
  name: "walletOutline",
823
825
  className: "zd:w-8 zd:h-8 zd:text-greyScale"
824
826
  }
825
827
  ) }),
826
- /* @__PURE__ */ n(w, { className: "zd:text-body3 zd:max-w-full zd:truncate", children: e.name })
828
+ /* @__PURE__ */ n(D, { className: "zd:text-body3 zd:max-w-full zd:truncate", children: e.name })
827
829
  ]
828
830
  }
829
831
  );
830
832
  }
831
- function Fe({
833
+ function Se({
832
834
  open: e,
833
835
  onOpenChange: t,
834
- tiles: r
836
+ tiles: o
835
837
  }) {
836
- return /* @__PURE__ */ n(u2, { open: e, onOpenChange: t, children: /* @__PURE__ */ c(f2, { className: "zd:p-4", children: [
837
- /* @__PURE__ */ n(p2, { children: "All wallets" }),
838
- /* @__PURE__ */ c("div", { className: "zd:mb-3 zd:flex zd:items-center zd:gap-2", children: [
839
- /* @__PURE__ */ n(w, { className: "zd:text-h3 zd:flex-1", children: "All wallets" }),
838
+ return /* @__PURE__ */ n(f2, { open: e, onOpenChange: t, children: /* @__PURE__ */ f(p2, { className: "zd:p-4", children: [
839
+ /* @__PURE__ */ n(h2, { children: "All wallets" }),
840
+ /* @__PURE__ */ f("div", { className: "zd:mb-3 zd:flex zd:items-center zd:gap-2", children: [
841
+ /* @__PURE__ */ n(D, { className: "zd:text-h3 zd:flex-1", children: "All wallets" }),
840
842
  /* @__PURE__ */ n(m2, { asChild: !0, children: /* @__PURE__ */ n(
841
843
  "button",
842
844
  {
@@ -847,182 +849,158 @@ function Fe({
847
849
  }
848
850
  ) })
849
851
  ] }),
850
- /* @__PURE__ */ n("div", { className: "zd:grid zd:grid-cols-3 zd:gap-3 zd:max-h-80 zd:overflow-y-auto", children: r.map((i) => /* @__PURE__ */ n(Ee, { tile: i }, i.key)) })
852
+ /* @__PURE__ */ n("div", { className: "zd:grid zd:grid-cols-3 zd:gap-3 zd:max-h-80 zd:overflow-y-auto", children: o.map((i) => /* @__PURE__ */ n(be, { tile: i }, i.key)) })
851
853
  ] }) });
852
854
  }
853
- function ye({
855
+ function Ae({
854
856
  title: e = "More wallets"
855
857
  }) {
856
- const { goToStep: t } = S(), { authPending: r, guardAgreement: i, setError: o, openWalletSheet: a } = U(), [s, l] = E(!1), u = H(), { connect: g, isPending: z } = V();
857
- P(z);
858
- const F = u.filter(
859
- (m) => m.id !== "zerodev-wallet" && m.type !== "walletConnect"
860
- ), p = (m) => {
861
- r || i() && (l(!1), o(null), g(
862
- { connector: m },
863
- {
864
- // The external wallet is now the active wagmi connection — the
865
- // embedded-wallet flow is done, so close it.
866
- onSuccess: () => t(null),
867
- onError: (h) => {
868
- R(h) || o(h instanceof Error ? h.message : String(h));
869
- }
870
- }
871
- ));
872
- }, d = u.some(J), D = k.map((m) => {
873
- const h = F.find((v) => n2(v, m));
858
+ const { startWalletConnection: t } = b(), { authPending: o, guardAgreement: i, openWalletSheet: r } = I(), [a, c] = x(!1), l = W(), s = l.filter(
859
+ (u) => u.id !== "zerodev-wallet" && u.type !== "walletConnect"
860
+ ), d = (u, h, g) => {
861
+ o || i() && (c(!1), t({ connectorUid: u.uid, name: h, icon: g }));
862
+ }, p = l.some(q), w = U.map((u) => {
863
+ const h = s.find((g) => $(g, u));
874
864
  return {
875
- key: m.id,
876
- name: m.name,
877
- icon: m.icon,
865
+ key: u.id,
866
+ name: u.name,
867
+ icon: u.icon,
878
868
  onSelect: () => {
879
869
  if (h) {
880
- p(h);
870
+ d(h, u.name, u.icon);
881
871
  return;
882
872
  }
883
- if (d) {
884
- if (r || !i()) return;
885
- l(!1), a(m);
873
+ if (p) {
874
+ if (o || !i()) return;
875
+ c(!1), r(u);
886
876
  return;
887
877
  }
888
- const v = F.find((y) => O(y, m));
889
- if (v) {
890
- p(v);
878
+ const g = s.find((E) => M(E, u));
879
+ if (g) {
880
+ d(g, u.name, u.icon);
891
881
  return;
892
882
  }
893
- l(!1), window.open(m.downloadUrl, "_blank", "noopener,noreferrer");
883
+ c(!1), window.open(u.downloadUrl, "_blank", "noopener,noreferrer");
894
884
  }
895
885
  };
896
- }), f = F.filter((m) => !k.some((h) => O(m, h))).map((m) => ({
897
- key: m.uid,
898
- name: m.name,
899
- icon: m.icon,
900
- onSelect: () => p(m)
886
+ }), z = s.filter((u) => !U.some((h) => M(u, h))).map((u) => ({
887
+ key: u.uid,
888
+ name: u.name,
889
+ icon: u.icon,
890
+ onSelect: () => d(u, u.name, u.icon)
901
891
  }));
902
- return /* @__PURE__ */ c(b, { children: [
892
+ return /* @__PURE__ */ f(A, { children: [
903
893
  /* @__PURE__ */ n(
904
- T,
894
+ O,
905
895
  {
906
- icon: /* @__PURE__ */ n(h2, { name: "walletOutline", className: "zd:w-5 zd:h-5" }),
896
+ icon: /* @__PURE__ */ n(g2, { name: "walletOutline", className: "zd:w-5 zd:h-5" }),
907
897
  title: e,
908
- trailing: /* @__PURE__ */ n(G, {}),
909
- disabled: r,
898
+ trailing: /* @__PURE__ */ n(_, {}),
899
+ disabled: o,
910
900
  onClick: () => {
911
- r || i() && l(!0);
901
+ o || i() && c(!0);
912
902
  }
913
903
  }
914
904
  ),
915
905
  /* @__PURE__ */ n(
916
- Fe,
906
+ Se,
917
907
  {
918
- open: s,
919
- onOpenChange: l,
920
- tiles: [...d ? [
908
+ open: a,
909
+ onOpenChange: c,
910
+ tiles: [...p ? [
921
911
  {
922
912
  key: "walletconnect",
923
913
  name: "WalletConnect",
924
- icon: t2,
914
+ icon: X,
925
915
  onSelect: () => {
926
- r || i() && (l(!1), a());
916
+ o || i() && (c(!1), r());
927
917
  }
928
918
  }
929
- ] : [], ...D, ...f]
919
+ ] : [], ...w, ...z]
930
920
  }
931
921
  )
932
922
  ] });
933
923
  }
934
- function v2() {
935
- const { goToStep: e } = S(), { authPending: t, guardAgreement: r, setError: i } = U(), o = {
924
+ function A2() {
925
+ const { goToStep: e } = b(), { authPending: t, guardAgreement: o, setError: i } = I(), r = {
936
926
  onSuccess: () => {
937
927
  e("authenticated");
938
928
  },
939
- onError: (z) => {
940
- R(z) || i(z instanceof Error ? z.message : String(z));
929
+ onError: (p) => {
930
+ t2(p) || i(p instanceof Error ? p.message : String(p));
941
931
  }
942
- }, { mutate: a, isPending: s } = _2({ mutation: o }), { mutate: l, isPending: u } = Z2({
943
- mutation: o
932
+ }, { mutate: a, isPending: c } = V2({ mutation: r }), { mutate: l, isPending: s } = j2({
933
+ mutation: r
944
934
  });
945
- P(s || u);
946
- const g = (z) => () => {
947
- t || r() && (i(null), z());
935
+ e2(c || s);
936
+ const d = (p) => () => {
937
+ t || o() && (i(null), p());
948
938
  };
949
- return /* @__PURE__ */ c(b, { children: [
939
+ return /* @__PURE__ */ f(A, { children: [
950
940
  /* @__PURE__ */ n(
951
- A,
941
+ v,
952
942
  {
953
943
  action: "secondary",
954
944
  text: "Create a passkey",
955
945
  iconName: "key",
956
946
  trailIcon: !0,
957
947
  disabled: t,
958
- onClick: g(() => a())
948
+ onClick: d(() => a())
959
949
  }
960
950
  ),
961
951
  /* @__PURE__ */ n(
962
- A,
952
+ v,
963
953
  {
964
954
  action: "secondary",
965
955
  text: "Log in with passkey",
966
956
  iconName: "key",
967
957
  trailIcon: !0,
968
958
  disabled: t,
969
- onClick: g(() => l())
959
+ onClick: d(() => l())
970
960
  }
971
961
  )
972
962
  ] });
973
963
  }
974
- function ve({ walletId: e }) {
975
- const t = k.find((f) => f.id === e);
964
+ function ke({ walletId: e }) {
965
+ const t = U.find((z) => z.id === e);
976
966
  if (!t)
977
967
  throw new Error(
978
- `Unknown walletId "${e}". Valid ids: ${k.map((f) => f.id).join(", ")}`
968
+ `Unknown walletId "${e}". Valid ids: ${U.map((z) => z.id).join(", ")}`
979
969
  );
980
- const { goToStep: r } = S(), {
981
- authPending: i,
982
- guardAgreement: o,
983
- setError: a,
984
- registerWallet: s,
985
- openWalletSheet: l
986
- } = U(), u = H(), { connect: g, isPending: z } = V();
987
- P(z), L2(() => s(t.id), [s, t.id]);
988
- const F = u.find((f) => n2(f, t)), p = {
970
+ const { startWalletConnection: o } = b(), { authPending: i, guardAgreement: r, registerWallet: a, openWalletSheet: c } = I(), l = W();
971
+ W2(() => a(t.id), [a, t.id]);
972
+ const s = l.find((z) => $(z, t)), d = {
989
973
  title: t.name,
990
974
  icon: /* @__PURE__ */ n("img", { src: t.icon, alt: "", className: "zd:w-6 zd:h-6" }),
991
- trailing: /* @__PURE__ */ n(G, {})
975
+ trailing: /* @__PURE__ */ n(_, {})
992
976
  };
993
- if (!F && u.some(J))
977
+ if (!s && l.some(q))
994
978
  return /* @__PURE__ */ n(
995
- T,
979
+ O,
996
980
  {
997
- ...p,
981
+ ...d,
998
982
  disabled: i,
999
983
  onClick: () => {
1000
- i || o() && l(t);
984
+ i || r() && c(t);
1001
985
  }
1002
986
  }
1003
987
  );
1004
- const d = F ?? u.find((f) => O(f, t));
1005
- return d ? /* @__PURE__ */ n(
1006
- T,
988
+ const p = s ?? l.find((z) => M(z, t));
989
+ return p ? /* @__PURE__ */ n(
990
+ O,
1007
991
  {
1008
- ...p,
1009
- ...!!F && { subtitle: /* @__PURE__ */ n(X, { text: "INSTALLED" }) },
992
+ ...d,
993
+ ...!!s && { subtitle: /* @__PURE__ */ n(Q, { text: "INSTALLED" }) },
1010
994
  disabled: i,
1011
995
  onClick: () => {
1012
- i || o() && (a(null), g(
1013
- { connector: d },
1014
- {
1015
- // The external wallet is now the active wagmi connection — the
1016
- // embedded-wallet flow is done, so close it (mirrors SignUp.MoreWallets).
1017
- onSuccess: () => r(null),
1018
- onError: (f) => {
1019
- R(f) || a(f instanceof Error ? f.message : String(f));
1020
- }
1021
- }
1022
- ));
996
+ i || r() && o({
997
+ connectorUid: p.uid,
998
+ name: t.name,
999
+ icon: t.icon
1000
+ });
1023
1001
  }
1024
1002
  }
1025
- ) : /* @__PURE__ */ n(T, { ...p, asChild: !0, children: /* @__PURE__ */ n(
1003
+ ) : /* @__PURE__ */ n(O, { ...d, asChild: !0, children: /* @__PURE__ */ n(
1026
1004
  "a",
1027
1005
  {
1028
1006
  href: t.downloadUrl,
@@ -1031,282 +1009,426 @@ function ve({ walletId: e }) {
1031
1009
  }
1032
1010
  ) });
1033
1011
  }
1034
- function Se() {
1035
- const { authPending: e, guardAgreement: t, openWalletSheet: r } = U();
1036
- return H().some(J) ? /* @__PURE__ */ n(
1037
- T,
1012
+ function Ne() {
1013
+ const { authPending: e, guardAgreement: t, openWalletSheet: o } = I();
1014
+ return W().some(q) ? /* @__PURE__ */ n(
1015
+ O,
1038
1016
  {
1039
1017
  title: "WalletConnect",
1040
- icon: /* @__PURE__ */ n("img", { src: t2, alt: "", className: "zd:w-6 zd:h-6" }),
1041
- subtitle: /* @__PURE__ */ n(X, { text: "QR CODE" }),
1042
- trailing: /* @__PURE__ */ n(G, {}),
1018
+ icon: /* @__PURE__ */ n("img", { src: X, alt: "", className: "zd:w-6 zd:h-6" }),
1019
+ subtitle: /* @__PURE__ */ n(Q, { text: "QR CODE" }),
1020
+ trailing: /* @__PURE__ */ n(_, {}),
1043
1021
  disabled: e,
1044
1022
  onClick: () => {
1045
- e || t() && r();
1023
+ e || t() && o();
1046
1024
  }
1047
1025
  }
1048
1026
  ) : null;
1049
1027
  }
1050
- function S2({
1028
+ function k2({
1051
1029
  children: e,
1052
1030
  termsAndConditionsUrl: t,
1053
- privacyPolicyUrl: r,
1031
+ privacyPolicyUrl: o,
1054
1032
  emailAuthMethod: i = "magicLink"
1055
1033
  }) {
1056
- const [o, a] = E(!1), [s, l] = E(!1), [u, g] = E(null), [z, F] = E(!1), [p, d] = E(
1034
+ const [r, a] = x(!1), [c, l] = x(!1), [s, d] = x(null), [p, w] = x(!1), [z, C] = x(
1057
1035
  []
1058
- ), D = O2((y) => (d((M) => [...M, y]), () => {
1059
- d((M) => {
1060
- const Q = [...M];
1061
- return Q.splice(Q.indexOf(y), 1), Q;
1036
+ ), m = B2((y) => (C((B) => [...B, y]), () => {
1037
+ C((B) => {
1038
+ const K = [...B];
1039
+ return K.splice(K.indexOf(y), 1), K;
1062
1040
  });
1063
- }), []), [f, C] = E(null), x = Ce(), h = !!(t || r) && !o, v = () => h ? (l(!0), !1) : !0;
1064
- return /* @__PURE__ */ c(
1065
- E2.Provider,
1041
+ }), []), [u, h] = x(null), g = Ee(), F = !!(t || o) && !r, S = () => F ? (l(!0), !1) : !0;
1042
+ return /* @__PURE__ */ f(
1043
+ v2.Provider,
1066
1044
  {
1067
1045
  value: {
1068
- authPending: z,
1046
+ authPending: p,
1069
1047
  emailAuthMethod: i,
1070
- setAuthPending: F,
1071
- needsAgreement: h,
1072
- guardAgreement: v,
1073
- setError: g,
1074
- registeredWallets: p,
1075
- registerWallet: D,
1048
+ setAuthPending: w,
1049
+ needsAgreement: F,
1050
+ guardAgreement: S,
1051
+ setError: d,
1052
+ registeredWallets: z,
1053
+ registerWallet: m,
1076
1054
  openWalletSheet: (y) => {
1077
- const M = y && x.deepLinkFor(y);
1078
- M && (window.location.href = M), C({ wallet: y });
1055
+ const B = y && g.deepLinkFor(y);
1056
+ B && (window.location.href = B), h({ wallet: y });
1079
1057
  }
1080
1058
  },
1081
1059
  children: [
1082
- u !== null && /* @__PURE__ */ n("div", { className: "zd:flex zd:items-center zd:justify-center zd:h-full zd:min-h-100", children: /* @__PURE__ */ c("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:max-w-md", children: [
1083
- /* @__PURE__ */ n(w, { className: "zd:text-h2 zd:text-center", children: "Error occurred" }),
1084
- /* @__PURE__ */ n(w, { className: "zd:text-center zd:text-red-500", children: u }),
1060
+ s !== null && /* @__PURE__ */ n("div", { className: "zd:flex zd:items-center zd:justify-center zd:h-full zd:min-h-100", children: /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-4 zd:max-w-md", children: [
1061
+ /* @__PURE__ */ n(D, { className: "zd:text-h2 zd:text-center", children: "Error occurred" }),
1062
+ /* @__PURE__ */ n(D, { className: "zd:text-center zd:text-red-500", children: s }),
1085
1063
  /* @__PURE__ */ n(
1086
- A,
1064
+ v,
1087
1065
  {
1088
1066
  action: "primary",
1089
1067
  text: "Try again",
1090
- onClick: () => g(null)
1068
+ onClick: () => d(null)
1091
1069
  }
1092
1070
  )
1093
1071
  ] }) }),
1094
- /* @__PURE__ */ c(
1072
+ /* @__PURE__ */ f(
1095
1073
  "div",
1096
1074
  {
1097
- className: `zd:-mx-4 zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden${u !== null ? " zd:hidden" : ""}`,
1075
+ className: `zd:-mx-4 zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden${s !== null ? " zd:hidden" : ""}`,
1098
1076
  children: [
1099
- /* @__PURE__ */ c("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:justify-center", children: [
1100
- /* @__PURE__ */ c("div", { className: "zd:px-4 zd:flex zd:flex-col zd:items-center", children: [
1101
- /* @__PURE__ */ n("div", { className: "zd:w-full zd:px-16 zd:py-4", children: /* @__PURE__ */ n(pe, { className: "zd:w-full zd:pointer-events-none zd:select-none" }) }),
1102
- /* @__PURE__ */ n(w, { className: "zd:text-h2 zd:text-center", children: "Continue to your wallet" }),
1103
- /* @__PURE__ */ n(w, { className: "zd:mt-2 zd:text-center zd:text-greyScale/50", children: "Choose a sign-in method to proceed" })
1077
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:justify-center", children: [
1078
+ /* @__PURE__ */ f("div", { className: "zd:px-4 zd:flex zd:flex-col zd:items-center", children: [
1079
+ /* @__PURE__ */ n("div", { className: "zd:w-full zd:px-16 zd:py-4", children: /* @__PURE__ */ n(ge, { className: "zd:w-full zd:pointer-events-none zd:select-none" }) }),
1080
+ /* @__PURE__ */ n(D, { className: "zd:text-h2 zd:text-center", children: "Continue to your wallet" }),
1081
+ /* @__PURE__ */ n(D, { className: "zd:mt-2 zd:text-center zd:text-greyScale/50", children: "Choose a sign-in method to proceed" })
1104
1082
  ] }),
1105
1083
  /* @__PURE__ */ n("div", { className: "zd:mt-6 zd:mb-4 zd:px-4 zd:flex zd:flex-col zd:gap-2", children: e })
1106
1084
  ] }),
1107
1085
  /* @__PURE__ */ n("div", { className: "zd:px-4", children: /* @__PURE__ */ n(
1108
- ue,
1086
+ he,
1109
1087
  {
1110
1088
  termsAndConditionsUrl: t,
1111
- privacyPolicyUrl: r,
1112
- agreedToTerms: o,
1089
+ privacyPolicyUrl: o,
1090
+ agreedToTerms: r,
1113
1091
  setAgreedToTerms: (y) => {
1114
1092
  a(y), y && l(!1);
1115
1093
  },
1116
- highlight: s
1094
+ highlight: c
1117
1095
  }
1118
1096
  ) })
1119
1097
  ]
1120
1098
  }
1121
1099
  ),
1122
1100
  /* @__PURE__ */ n(
1123
- ge,
1101
+ De,
1124
1102
  {
1125
- pairing: x,
1126
- open: f !== null,
1103
+ pairing: g,
1104
+ open: u !== null,
1127
1105
  onOpenChange: (y) => {
1128
- y || C(null);
1106
+ y || h(null);
1129
1107
  },
1130
- wallet: f == null ? void 0 : f.wallet
1108
+ wallet: u == null ? void 0 : u.wallet
1131
1109
  }
1132
1110
  )
1133
1111
  ]
1134
1112
  }
1135
1113
  );
1136
1114
  }
1137
- function A2({ label: e = "or" }) {
1138
- return /* @__PURE__ */ c("div", { className: "zd:-mx-4 zd:my-2 zd:flex zd:items-center zd:gap-3", children: [
1115
+ function N2({ label: e = "or" }) {
1116
+ return /* @__PURE__ */ f("div", { className: "zd:-mx-4 zd:my-2 zd:flex zd:items-center zd:gap-3", children: [
1139
1117
  /* @__PURE__ */ n("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" }),
1140
- /* @__PURE__ */ n(w, { className: "zd:text-body3", children: e }),
1118
+ /* @__PURE__ */ n(D, { className: "zd:text-body3", children: e }),
1141
1119
  /* @__PURE__ */ n("div", { className: "zd:h-px zd:flex-1 zd:bg-greyScale/30" })
1142
1120
  ] });
1143
1121
  }
1144
- function Ae(e) {
1145
- return /* @__PURE__ */ c(S2, { ...e, children: [
1146
- /* @__PURE__ */ n(v2, {}),
1122
+ function Ue(e) {
1123
+ return /* @__PURE__ */ f(k2, { ...e, children: [
1147
1124
  /* @__PURE__ */ n(A2, {}),
1148
- /* @__PURE__ */ n(y2, {}),
1149
- /* @__PURE__ */ n(F2, {})
1125
+ /* @__PURE__ */ n(N2, {}),
1126
+ /* @__PURE__ */ n(S2, {}),
1127
+ /* @__PURE__ */ n(b2, {})
1150
1128
  ] });
1151
1129
  }
1152
- const be = Object.assign(S2, {
1153
- Default: Ae,
1154
- Passkey: v2,
1155
- Google: y2,
1156
- Email: F2,
1157
- Wallet: ve,
1158
- WalletConnect: Se,
1159
- InstalledWallets: xe,
1160
- MoreWallets: ye,
1161
- Divider: A2
1130
+ const Ie = Object.assign(k2, {
1131
+ Default: Ue,
1132
+ Passkey: A2,
1133
+ Google: S2,
1134
+ Email: b2,
1135
+ Wallet: ke,
1136
+ WalletConnect: Ne,
1137
+ InstalledWallets: ve,
1138
+ MoreWallets: Ae,
1139
+ Divider: N2
1162
1140
  });
1163
- function ke() {
1141
+ function Te() {
1164
1142
  return typeof window > "u" ? null : new URLSearchParams(window.location.search).get("code");
1165
1143
  }
1166
- function Ne() {
1167
- const { otpId: e, otpEncryptionTargetBundle: t, goToStep: r, clearOtpSession: i } = S(), [o] = E(ke), [a, s] = E(null), l = e2(!1), { mutate: u, isPending: g } = G2({
1144
+ function Le() {
1145
+ const { otpId: e, otpEncryptionTargetBundle: t, goToStep: o, clearOtpSession: i } = b(), [r] = x(Te), [a, c] = x(null), [l, s] = x(!1), d = j(!1), { mutate: p, isPending: w } = q2({
1168
1146
  mutation: {
1169
1147
  onSuccess: () => {
1170
- i(), r("authenticated");
1148
+ i(), o("authenticated");
1171
1149
  },
1172
1150
  onError: (z) => {
1173
- s(z);
1151
+ c(z);
1174
1152
  }
1175
1153
  }
1176
1154
  });
1177
- return N(() => {
1178
- if (!(l.current || !o)) {
1179
- if (l.current = !0, !e || !t) {
1180
- _(), r(null);
1155
+ return k(() => {
1156
+ if (!(d.current || !r)) {
1157
+ if (d.current = !0, !e || !t) {
1158
+ s(!0);
1181
1159
  return;
1182
1160
  }
1183
- u({ otpId: e, code: o, otpEncryptionTargetBundle: t });
1161
+ p({ otpId: e, code: r, otpEncryptionTargetBundle: t });
1184
1162
  }
1185
- }, [e, t, o, u, r]), /* @__PURE__ */ c(b, { children: [
1186
- /* @__PURE__ */ c("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
1187
- !a && g && /* @__PURE__ */ n(L, { imageName: "loading", title: "Verifying Your Email", children: "Please wait while we securely connect your wallet." }),
1188
- !a && !o && !g && /* @__PURE__ */ c(b, { children: [
1189
- /* @__PURE__ */ c(L, { imageName: "error", title: "Invalid Link", children: [
1163
+ }, [e, t, r, p, o]), /* @__PURE__ */ f(A, { children: [
1164
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
1165
+ !a && w && /* @__PURE__ */ n(N, { imageName: "loading", title: "Verifying Your Email", children: "Please wait while we securely connect your wallet." }),
1166
+ !a && l && /* @__PURE__ */ f(A, { children: [
1167
+ /* @__PURE__ */ f(N, { imageName: "error", title: "Link Expired", children: [
1168
+ "This verification link has expired or was already used.",
1169
+ /* @__PURE__ */ n("br", {}),
1170
+ "Please sign in again to request a new one."
1171
+ ] }),
1172
+ /* @__PURE__ */ n(
1173
+ v,
1174
+ {
1175
+ action: "primary",
1176
+ onClick: () => {
1177
+ P(), o("sign-up");
1178
+ },
1179
+ text: "Choose another sign-in method"
1180
+ }
1181
+ )
1182
+ ] }),
1183
+ !a && !l && !r && !w && /* @__PURE__ */ f(A, { children: [
1184
+ /* @__PURE__ */ f(N, { imageName: "error", title: "Invalid Link", children: [
1190
1185
  "This verification link is invalid or incomplete.",
1191
1186
  /* @__PURE__ */ n("br", {}),
1192
1187
  "Please check your email and try again with the correct link."
1193
1188
  ] }),
1194
1189
  /* @__PURE__ */ n(
1195
- A,
1190
+ v,
1196
1191
  {
1197
1192
  action: "primary",
1198
1193
  onClick: () => {
1199
- _(), r("sign-up");
1194
+ P(), o("sign-up");
1200
1195
  },
1201
1196
  text: "Choose another sign-in method"
1202
1197
  }
1203
1198
  )
1204
1199
  ] }),
1205
- a != null && /* @__PURE__ */ c(b, { children: [
1206
- /* @__PURE__ */ n(L, { imageName: "error", title: "Oops, something went wrong", children: "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request." }),
1200
+ a != null && /* @__PURE__ */ f(A, { children: [
1201
+ /* @__PURE__ */ n(N, { imageName: "error", title: "Oops, something went wrong", children: "We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request." }),
1207
1202
  /* @__PURE__ */ n(
1208
- A,
1203
+ v,
1209
1204
  {
1210
1205
  action: "primary",
1211
1206
  onClick: () => {
1212
- _(), r("sign-up");
1207
+ P(), o("sign-up");
1213
1208
  },
1214
1209
  text: "Choose another sign-in method"
1215
1210
  }
1216
1211
  )
1217
1212
  ] })
1218
1213
  ] }),
1219
- /* @__PURE__ */ n(Z, { className: "zd:self-center zd:pt-4 zd:pb-6" })
1214
+ /* @__PURE__ */ n(H, { className: "zd:self-center zd:pt-4 zd:pb-6" })
1215
+ ] });
1216
+ }
1217
+ function Oe(e) {
1218
+ let t = e;
1219
+ for (let o = 0; o < 5 && Me(t); o++) {
1220
+ if (t.code === -32002 || t.name === "ResourceUnavailableRpcError")
1221
+ return !0;
1222
+ t = t.cause;
1223
+ }
1224
+ return !1;
1225
+ }
1226
+ function Me(e) {
1227
+ return typeof e == "object" && e !== null;
1228
+ }
1229
+ const i2 = /* @__PURE__ */ new WeakMap();
1230
+ function r2(e) {
1231
+ let t = i2.get(e);
1232
+ return t || (t = /* @__PURE__ */ new Set(), i2.set(e, t)), t;
1233
+ }
1234
+ function We(e, t) {
1235
+ if (t2(e))
1236
+ return {
1237
+ title: "Request declined",
1238
+ message: `You declined the connection request in ${t}.`,
1239
+ pending: !1
1240
+ };
1241
+ if (Oe(e))
1242
+ return {
1243
+ title: `Check ${t}`,
1244
+ message: `Open ${t} and check for an outstanding request. If one is waiting, approve or dismiss it, then try again.`,
1245
+ pending: !0
1246
+ };
1247
+ let o, i;
1248
+ if (typeof e == "string" && e.length > 0)
1249
+ o = e;
1250
+ else if (typeof e == "object" && e !== null) {
1251
+ const r = e, a = r.shortMessage ?? r.message;
1252
+ typeof a == "string" && a.length > 0 && (o = a), typeof r.code == "number" && (i = r.code);
1253
+ }
1254
+ return {
1255
+ title: "Couldn’t connect",
1256
+ message: o ?? `Something went wrong while connecting to ${t}. Please try again.` + (i !== void 0 ? ` (code ${i})` : ""),
1257
+ pending: !1
1258
+ };
1259
+ }
1260
+ function Be() {
1261
+ const {
1262
+ pendingWallet: e,
1263
+ connectError: t,
1264
+ setConnectError: o,
1265
+ clearPendingWallet: i,
1266
+ goToStep: r
1267
+ } = b(), a = W(), c = D2(), l = y2(), s = e ? a.find((m) => m.uid === e.connectorUid) : void 0, d = (e == null ? void 0 : e.name) ?? "your wallet", p = () => {
1268
+ const m = l.getState().auth;
1269
+ m.stepHistory.length > 0 ? m.goBack() : m.goToStep("sign-up");
1270
+ }, w = () => {
1271
+ i(), r(null);
1272
+ }, z = () => {
1273
+ if (o(null), s && r2(c).has(s.uid)) return;
1274
+ if (!s) {
1275
+ i(), p();
1276
+ return;
1277
+ }
1278
+ if (c.state.current === s.uid) {
1279
+ w();
1280
+ return;
1281
+ }
1282
+ const m = r2(c);
1283
+ m.add(s.uid), Q2(c, { connector: s }).then(
1284
+ () => {
1285
+ m.delete(s.uid), w();
1286
+ },
1287
+ (u) => {
1288
+ var g;
1289
+ m.delete(s.uid);
1290
+ const h = l.getState().auth;
1291
+ h.step !== "wallet-connecting" || ((g = h.pendingWallet) == null ? void 0 : g.connectorUid) !== s.uid || o(We(u, d));
1292
+ }
1293
+ );
1294
+ };
1295
+ k(() => {
1296
+ if (!s) return;
1297
+ const m = s.uid;
1298
+ return c.subscribe(
1299
+ (u) => u.status === "connected" ? u.current : null,
1300
+ (u) => {
1301
+ var E;
1302
+ if (!u) return;
1303
+ const h = (E = c.state.connections.get(u)) == null ? void 0 : E.connector;
1304
+ if ((h == null ? void 0 : h.uid) !== m) return;
1305
+ const g = l.getState().auth;
1306
+ g.clearPendingWallet(), g.goToStep(null);
1307
+ }
1308
+ );
1309
+ }, [s, c, l]);
1310
+ const C = j(!1);
1311
+ return k(() => {
1312
+ C.current || (C.current = !0, z());
1313
+ }, []), /* @__PURE__ */ f(A, { children: [
1314
+ /* @__PURE__ */ f("div", { className: "zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center", children: [
1315
+ t === null ? /* @__PURE__ */ f(N, { imageName: "loading", title: `Waiting for ${d}`, children: [
1316
+ "Approve or reject the request in your wallet.",
1317
+ /* @__PURE__ */ n("br", {}),
1318
+ "Nothing showing? Open the wallet, the request may be waiting behind its unlock screen."
1319
+ ] }) : /* @__PURE__ */ n(
1320
+ N,
1321
+ {
1322
+ imageName: t.pending ? "loading" : "error",
1323
+ title: t.title,
1324
+ children: t.message
1325
+ }
1326
+ ),
1327
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:flex-col zd:gap-1", children: [
1328
+ t !== null && /* @__PURE__ */ n(v, { action: "primary", text: "Try again", onClick: z }),
1329
+ /* @__PURE__ */ n(
1330
+ v,
1331
+ {
1332
+ action: "secondary",
1333
+ text: "Choose another sign-in method",
1334
+ onClick: p
1335
+ }
1336
+ )
1337
+ ] })
1338
+ ] }),
1339
+ /* @__PURE__ */ n(H, { className: "zd:self-center zd:pt-4 zd:pb-6" })
1220
1340
  ] });
1221
1341
  }
1222
- function Ue() {
1223
- return /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ n(L, { imageName: "loading", title: "Authenticating...", children: "Please wait while we complete the OAuth authentication." }) });
1342
+ function Re() {
1343
+ return /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ n(N, { imageName: "loading", title: "Authenticating...", children: "Please wait while we complete the OAuth authentication." }) });
1224
1344
  }
1225
- function Ie() {
1226
- return /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ n(L, { imageName: "loading", title: "Passkey authentication", children: "Please authenticate with your passkey." }) });
1345
+ function He() {
1346
+ return /* @__PURE__ */ n("div", { className: "zd:flex zd:flex-1 zd:items-center zd:justify-center", children: /* @__PURE__ */ n(N, { imageName: "loading", title: "Passkey authentication", children: "Please authenticate with your passkey." }) });
1227
1347
  }
1228
- function Te(e, t) {
1348
+ function Pe(e, t) {
1229
1349
  switch (e) {
1230
1350
  case "sign-up":
1231
- return t ? t() : /* @__PURE__ */ n(be.Default, {});
1351
+ return t ? t() : /* @__PURE__ */ n(Ie.Default, {});
1232
1352
  case "email-verification":
1233
- return /* @__PURE__ */ n(te, {});
1353
+ return /* @__PURE__ */ n(re, {});
1234
1354
  case "otp-input":
1235
- return /* @__PURE__ */ n(ce, {});
1355
+ return /* @__PURE__ */ n(pe, {});
1236
1356
  case "verifying-otp":
1237
- return /* @__PURE__ */ n(Ne, {});
1357
+ return /* @__PURE__ */ n(Le, {});
1238
1358
  case "oauth-in-progress":
1239
- return /* @__PURE__ */ n(Ue, {});
1359
+ return /* @__PURE__ */ n(Re, {});
1240
1360
  case "passkey-prompt":
1241
- return /* @__PURE__ */ n(Ie, {});
1361
+ return /* @__PURE__ */ n(He, {});
1362
+ case "wallet-connecting":
1363
+ return /* @__PURE__ */ n(Be, {});
1242
1364
  case "error":
1243
- return /* @__PURE__ */ n(ie, {});
1365
+ return /* @__PURE__ */ n(ae, {});
1244
1366
  default:
1245
1367
  return null;
1246
1368
  }
1247
1369
  }
1248
- function rt({
1370
+ function pt({
1249
1371
  onClose: e,
1250
1372
  size: t,
1251
- renderSignUp: r,
1373
+ renderSignUp: o,
1252
1374
  logo: i
1253
1375
  } = {}) {
1254
- const { step: o, goToStep: a, goBack: s, reset: l } = S();
1255
- N(() => {
1256
- o === null && ne() && a("verifying-otp");
1257
- }, [o, a]);
1258
- const u = Te(o, r);
1259
- return u ? /* @__PURE__ */ n(
1260
- g2,
1376
+ const { step: r, goToStep: a, goBack: c, reset: l } = b();
1377
+ k(() => {
1378
+ r === null && oe() && a("verifying-otp");
1379
+ }, [r, a]);
1380
+ const s = Pe(r, o);
1381
+ return s ? /* @__PURE__ */ n(
1382
+ z2,
1261
1383
  {
1262
1384
  ...t && { size: t },
1263
- className: o === "sign-up" ? "zd:h-auto zd:max-h-202.5" : void 0,
1385
+ className: r === "sign-up" ? "zd:h-auto zd:max-h-202.5" : void 0,
1264
1386
  topNav: /* @__PURE__ */ n(
1265
- z2,
1387
+ C2,
1266
1388
  {
1267
- ...s !== null && { onLeftButtonClick: s },
1389
+ ...c !== null && { onLeftButtonClick: c },
1268
1390
  onRightButtonClick: () => {
1269
- _(), l(), e == null || e();
1391
+ P(), l(), e == null || e();
1270
1392
  },
1271
- ...o === "sign-up" && {
1393
+ ...r === "sign-up" && {
1272
1394
  ...i && { logo: i },
1273
1395
  className: "zd:px-4"
1274
1396
  }
1275
1397
  }
1276
1398
  ),
1277
- children: u
1399
+ children: s
1278
1400
  }
1279
1401
  ) : null;
1280
1402
  }
1281
- function Le(e) {
1403
+ function _e(e) {
1282
1404
  const t = e.toLowerCase();
1283
- return k.find((r) => {
1284
- const i = r.name.toLowerCase();
1405
+ return U.find((o) => {
1406
+ const i = o.name.toLowerCase();
1285
1407
  return t.includes(i) || i.includes(t);
1286
1408
  });
1287
1409
  }
1288
- function Oe(e) {
1289
- return k.find((t) => O(e, t));
1410
+ function Ze(e) {
1411
+ return U.find((t) => M(e, t));
1290
1412
  }
1291
- function Me() {
1292
- const { connector: e, isConnected: t } = D2(), [r, i] = E(void 0), o = !!e && e.type === "walletConnect";
1293
- return N(() => {
1294
- if (!e || !o) {
1413
+ function Ge() {
1414
+ const { connector: e, isConnected: t } = w2(), [o, i] = x(void 0), r = !!e && e.type === "walletConnect";
1415
+ return k(() => {
1416
+ if (!e || !r) {
1295
1417
  i(void 0);
1296
1418
  return;
1297
1419
  }
1298
1420
  let a = !1;
1299
- return e.getProvider().then((s) => {
1300
- var u, g;
1421
+ return e.getProvider().then((c) => {
1422
+ var s, d;
1301
1423
  if (a) return;
1302
- const l = (g = (u = s.session) == null ? void 0 : u.peer) == null ? void 0 : g.metadata;
1424
+ const l = (d = (s = c.session) == null ? void 0 : s.peer) == null ? void 0 : d.metadata;
1303
1425
  i(l);
1304
1426
  }).catch(() => {
1305
1427
  }), () => {
1306
1428
  a = !0;
1307
1429
  };
1308
- }, [e, o]), $(() => {
1309
- var s;
1430
+ }, [e, r]), Y(() => {
1431
+ var c;
1310
1432
  if (!t || !e) return;
1311
1433
  if (e.id === "zerodev-wallet")
1312
1434
  return {
@@ -1314,35 +1436,35 @@ function Me() {
1314
1436
  icon: e.icon,
1315
1437
  source: "embedded"
1316
1438
  };
1317
- if (o) {
1318
- const l = r != null && r.name ? Le(r.name) : void 0;
1439
+ if (r) {
1440
+ const l = o != null && o.name ? _e(o.name) : void 0;
1319
1441
  return {
1320
- name: (r == null ? void 0 : r.name) ?? void 0,
1321
- icon: ((s = r == null ? void 0 : r.icons) == null ? void 0 : s[0]) ?? (l == null ? void 0 : l.icon),
1442
+ name: (o == null ? void 0 : o.name) ?? void 0,
1443
+ icon: ((c = o == null ? void 0 : o.icons) == null ? void 0 : c[0]) ?? (l == null ? void 0 : l.icon),
1322
1444
  walletId: l == null ? void 0 : l.id,
1323
1445
  // Identity is about the session, so a raw walletConnect() connector
1324
1446
  // resolves here too — unlike pairing, which is kit-connector-only.
1325
1447
  source: "walletconnect"
1326
1448
  };
1327
1449
  }
1328
- const a = Oe(e);
1450
+ const a = Ze(e);
1329
1451
  return {
1330
1452
  name: e.name,
1331
1453
  icon: e.icon ?? (a == null ? void 0 : a.icon),
1332
1454
  walletId: a == null ? void 0 : a.id,
1333
1455
  source: e.type === "injected" ? "injected" : "other"
1334
1456
  };
1335
- }, [e, t, o, r]);
1457
+ }, [e, t, r, o]);
1336
1458
  }
1337
- function ot(e) {
1338
- const t = Me();
1339
- return $(() => ({ walletInfo: t }), [t]);
1459
+ function ht(e) {
1460
+ const t = Ge();
1461
+ return Y(() => ({ walletInfo: t }), [t]);
1340
1462
  }
1341
- const i2 = "zerodev:auth:otpSession";
1342
- function Be() {
1463
+ const n2 = "zerodev:auth:otpSession";
1464
+ function Ve() {
1343
1465
  if (typeof window > "u") return null;
1344
1466
  try {
1345
- const e = window.localStorage.getItem(i2);
1467
+ const e = window.localStorage.getItem(n2);
1346
1468
  if (!e) return null;
1347
1469
  const t = JSON.parse(e);
1348
1470
  return !(t != null && t.otpId) || !(t != null && t.otpEncryptionTargetBundle) ? null : t;
@@ -1350,24 +1472,24 @@ function Be() {
1350
1472
  return null;
1351
1473
  }
1352
1474
  }
1353
- function He(e) {
1475
+ function je(e) {
1354
1476
  if (!(typeof window > "u"))
1355
1477
  try {
1356
1478
  window.localStorage.setItem(
1357
- i2,
1479
+ n2,
1358
1480
  JSON.stringify(e)
1359
1481
  );
1360
1482
  } catch {
1361
1483
  }
1362
1484
  }
1363
- function r2() {
1485
+ function o2() {
1364
1486
  if (!(typeof window > "u"))
1365
1487
  try {
1366
- window.localStorage.removeItem(i2);
1488
+ window.localStorage.removeItem(n2);
1367
1489
  } catch {
1368
1490
  }
1369
1491
  }
1370
- const Re = (e, t, r) => ({
1492
+ const qe = (e, t, o) => ({
1371
1493
  auth: {
1372
1494
  // Initial state
1373
1495
  step: null,
@@ -1375,69 +1497,96 @@ const Re = (e, t, r) => ({
1375
1497
  email: null,
1376
1498
  otpId: null,
1377
1499
  otpEncryptionTargetBundle: null,
1500
+ pendingWallet: null,
1501
+ connectError: null,
1378
1502
  // Actions
1379
1503
  initialize: () => {
1380
- const i = Be();
1381
- i && e((o) => ({
1504
+ const i = Ve();
1505
+ i && e((r) => ({
1382
1506
  auth: {
1383
- ...o.auth,
1507
+ ...r.auth,
1384
1508
  otpId: i.otpId,
1385
1509
  otpEncryptionTargetBundle: i.otpEncryptionTargetBundle
1386
1510
  }
1387
1511
  }));
1388
1512
  },
1389
1513
  goToStep: (i) => {
1390
- e((o) => ({
1514
+ e((r) => ({
1391
1515
  auth: {
1392
- ...o.auth,
1516
+ ...r.auth,
1393
1517
  step: i,
1394
- stepHistory: o.auth.step === null ? o.auth.stepHistory : [...o.auth.stepHistory, o.auth.step]
1518
+ // `null` ends the flow: clear the history so the next open has no
1519
+ // stale back arrow.
1520
+ stepHistory: i === null ? [] : r.auth.step === null ? r.auth.stepHistory : [...r.auth.stepHistory, r.auth.step]
1395
1521
  }
1396
1522
  }));
1397
1523
  },
1398
1524
  goBack: () => {
1399
1525
  const { auth: i } = t();
1400
1526
  if (i.stepHistory.length === 0) return;
1401
- const o = [...i.stepHistory], a = o.pop();
1402
- e((s) => ({
1527
+ const r = [...i.stepHistory], a = r.pop();
1528
+ e((c) => ({
1403
1529
  auth: {
1404
- ...s.auth,
1530
+ ...c.auth,
1405
1531
  step: a,
1406
- stepHistory: o
1532
+ stepHistory: r
1407
1533
  }
1408
1534
  }));
1409
1535
  },
1410
1536
  reset: () => {
1411
- r2(), e((i) => ({
1537
+ o2(), e((i) => ({
1412
1538
  auth: {
1413
1539
  ...i.auth,
1414
1540
  step: null,
1415
1541
  stepHistory: [],
1416
1542
  email: null,
1417
1543
  otpId: null,
1418
- otpEncryptionTargetBundle: null
1544
+ otpEncryptionTargetBundle: null,
1545
+ pendingWallet: null,
1546
+ connectError: null
1419
1547
  }
1420
1548
  }));
1421
1549
  },
1550
+ startWalletConnection: (i) => {
1551
+ e((r) => ({
1552
+ auth: {
1553
+ ...r.auth,
1554
+ pendingWallet: i,
1555
+ connectError: null,
1556
+ step: "wallet-connecting",
1557
+ stepHistory: r.auth.step === null ? r.auth.stepHistory : [...r.auth.stepHistory, r.auth.step]
1558
+ }
1559
+ }));
1560
+ },
1561
+ setConnectError: (i) => {
1562
+ e((r) => ({
1563
+ auth: { ...r.auth, connectError: i }
1564
+ }));
1565
+ },
1566
+ clearPendingWallet: () => {
1567
+ e((i) => ({
1568
+ auth: { ...i.auth, pendingWallet: null, connectError: null }
1569
+ }));
1570
+ },
1422
1571
  setEmail: (i) => {
1423
- e((o) => ({
1572
+ e((r) => ({
1424
1573
  auth: {
1425
- ...o.auth,
1574
+ ...r.auth,
1426
1575
  email: i
1427
1576
  }
1428
1577
  }));
1429
1578
  },
1430
- setOtpSession: ({ otpId: i, otpEncryptionTargetBundle: o }) => {
1431
- He({ otpId: i, otpEncryptionTargetBundle: o }), e((a) => ({
1579
+ setOtpSession: ({ otpId: i, otpEncryptionTargetBundle: r }) => {
1580
+ je({ otpId: i, otpEncryptionTargetBundle: r }), e((a) => ({
1432
1581
  auth: {
1433
1582
  ...a.auth,
1434
1583
  otpId: i,
1435
- otpEncryptionTargetBundle: o
1584
+ otpEncryptionTargetBundle: r
1436
1585
  }
1437
1586
  }));
1438
1587
  },
1439
1588
  clearOtpSession: () => {
1440
- r2(), e((i) => ({
1589
+ o2(), e((i) => ({
1441
1590
  auth: {
1442
1591
  ...i.auth,
1443
1592
  otpId: null,
@@ -1446,104 +1595,104 @@ const Re = (e, t, r) => ({
1446
1595
  }));
1447
1596
  }
1448
1597
  }
1449
- }), Pe = () => B2()(
1450
- q2((e, t, r) => ({
1598
+ }), Ke = () => H2()(
1599
+ Y2((e, t, o) => ({
1451
1600
  pendingRequests: [],
1452
1601
  userConfirmationListenerActive: !1,
1453
- addPendingRequest: (i) => e((o) => ({
1454
- pendingRequests: [...o.pendingRequests, i]
1602
+ addPendingRequest: (i) => e((r) => ({
1603
+ pendingRequests: [...r.pendingRequests, i]
1455
1604
  })),
1456
- removePendingRequest: (i) => e((o) => ({
1457
- pendingRequests: o.pendingRequests.filter((a) => a.id !== i)
1605
+ removePendingRequest: (i) => e((r) => ({
1606
+ pendingRequests: r.pendingRequests.filter((a) => a.id !== i)
1458
1607
  })),
1459
1608
  clearPendingRequests: () => e({ pendingRequests: [] }),
1460
1609
  setUserConfirmationListenerActive: (i) => e({ userConfirmationListenerActive: i }),
1461
- ...Re(e, t)
1610
+ ...qe(e, t)
1462
1611
  }))
1463
1612
  );
1464
- function We(e) {
1465
- return new Promise((t, r) => {
1613
+ function Je(e) {
1614
+ return new Promise((t, o) => {
1466
1615
  const i = e.subscribe(
1467
- (o) => o.auth.step,
1468
- (o) => {
1469
- o === "authenticated" ? (i(), t()) : o === null && (i(), r(new Error("Auth flow dismissed")));
1616
+ (r) => r.auth.step,
1617
+ (r) => {
1618
+ r === "authenticated" ? (i(), t()) : r === null && (i(), o(new Error("Auth flow dismissed")));
1470
1619
  }
1471
1620
  );
1472
1621
  });
1473
1622
  }
1474
- function at(e) {
1475
- const t = V2(e), r = Pe();
1623
+ function mt(e) {
1624
+ const t = K2(e), o = Ke();
1476
1625
  return (i) => {
1477
- const o = t(i);
1626
+ const r = t(i);
1478
1627
  return {
1479
- ...o,
1628
+ ...r,
1480
1629
  async connect(a) {
1481
1630
  try {
1482
- return await o.connect(a);
1483
- } catch (s) {
1484
- if (a != null && a.isReconnecting || !(s instanceof j2))
1485
- throw s;
1486
- if (r.getState().auth.step !== null)
1631
+ return await r.connect(a);
1632
+ } catch (c) {
1633
+ if (a != null && a.isReconnecting || !(c instanceof J2))
1634
+ throw c;
1635
+ if (o.getState().auth.step !== null)
1487
1636
  throw new Error("Auth flow already in progress");
1488
- return r.getState().auth.goToStep("sign-up"), await We(r), o.connect(a);
1637
+ return o.getState().auth.goToStep("sign-up"), await Je(o), r.connect(a);
1489
1638
  }
1490
1639
  },
1491
1640
  async disconnect() {
1492
1641
  var a;
1493
- await ((a = o.disconnect) == null ? void 0 : a.call(o)), r.getState().auth.reset();
1642
+ await ((a = r.disconnect) == null ? void 0 : a.call(r)), o.getState().auth.reset();
1494
1643
  },
1495
1644
  async setup() {
1496
1645
  var a;
1497
- await ((a = o.setup) == null ? void 0 : a.call(o)), !(typeof window > "u") && r.getState().auth.initialize();
1646
+ typeof window < "u" && o.getState().auth.initialize(), await ((a = r.setup) == null ? void 0 : a.call(r)), typeof window > "u";
1498
1647
  },
1499
1648
  getKitStore() {
1500
- return r;
1649
+ return o;
1501
1650
  }
1502
1651
  };
1503
1652
  };
1504
1653
  }
1505
- const _e = {
1654
+ const Qe = {
1506
1655
  Pending: "zd:text-solarOrange",
1507
1656
  Success: "zd:text-positive",
1508
1657
  Failed: "zd:text-negative"
1509
1658
  };
1510
- function Ze({
1659
+ function Ye({
1511
1660
  icon: e,
1512
1661
  title: t,
1513
- value: r,
1662
+ value: o,
1514
1663
  chainName: i,
1515
- chainIconUrl: o,
1664
+ chainIconUrl: r,
1516
1665
  destChainName: a,
1517
- destChainIconUrl: s,
1666
+ destChainIconUrl: c,
1518
1667
  status: l,
1519
- className: u
1668
+ className: s
1520
1669
  }) {
1521
- return /* @__PURE__ */ c(
1670
+ return /* @__PURE__ */ f(
1522
1671
  "div",
1523
1672
  {
1524
- className: q(
1673
+ className: G(
1525
1674
  "zd:flex zd:w-full zd:items-center zd:gap-2 zd:p-2",
1526
- u
1675
+ s
1527
1676
  ),
1528
1677
  children: [
1529
- /* @__PURE__ */ n("div", { className: "zd:flex zd:size-11 zd:shrink-0 zd:items-center zd:justify-center zd:rounded-xl zd:bg-white", children: /* @__PURE__ */ n(K, { name: e, className: "zd:size-5" }) }),
1530
- /* @__PURE__ */ c("div", { className: "zd:flex zd:min-w-0 zd:flex-1 zd:flex-col zd:gap-2", children: [
1531
- /* @__PURE__ */ c("div", { className: "zd:flex zd:w-full zd:items-center zd:justify-between zd:gap-2", children: [
1532
- /* @__PURE__ */ n(w, { className: "zd:shrink-0 zd:whitespace-nowrap zd:text-body1", children: t }),
1533
- /* @__PURE__ */ n(w, { className: "zd:min-w-0 zd:truncate zd:text-right zd:text-body1", children: r })
1678
+ /* @__PURE__ */ n("div", { className: "zd:flex zd:size-11 zd:shrink-0 zd:items-center zd:justify-center zd:rounded-xl zd:bg-white", children: /* @__PURE__ */ n(V, { name: e, className: "zd:size-5" }) }),
1679
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:min-w-0 zd:flex-1 zd:flex-col zd:gap-2", children: [
1680
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:w-full zd:items-center zd:justify-between zd:gap-2", children: [
1681
+ /* @__PURE__ */ n(D, { className: "zd:shrink-0 zd:whitespace-nowrap zd:text-body1", children: t }),
1682
+ /* @__PURE__ */ n(D, { className: "zd:min-w-0 zd:truncate zd:text-right zd:text-body1", children: o })
1534
1683
  ] }),
1535
- /* @__PURE__ */ c("div", { className: "zd:flex zd:w-full zd:items-center zd:justify-between zd:gap-2", children: [
1536
- /* @__PURE__ */ c("div", { className: "zd:flex zd:min-w-0 zd:items-center zd:gap-2", children: [
1684
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:w-full zd:items-center zd:justify-between zd:gap-2", children: [
1685
+ /* @__PURE__ */ f("div", { className: "zd:flex zd:min-w-0 zd:items-center zd:gap-2", children: [
1537
1686
  /* @__PURE__ */ n(
1538
- o2,
1687
+ a2,
1539
1688
  {
1540
1689
  name: i,
1541
- ...o && { iconUrl: o }
1690
+ ...r && { iconUrl: r }
1542
1691
  }
1543
1692
  ),
1544
- a && /* @__PURE__ */ c(b, { children: [
1693
+ a && /* @__PURE__ */ f(A, { children: [
1545
1694
  /* @__PURE__ */ n(
1546
- K,
1695
+ V,
1547
1696
  {
1548
1697
  name: "arrowRightFill",
1549
1698
  "aria-hidden": !0,
@@ -1551,18 +1700,18 @@ function Ze({
1551
1700
  }
1552
1701
  ),
1553
1702
  /* @__PURE__ */ n(
1554
- o2,
1703
+ a2,
1555
1704
  {
1556
1705
  name: a,
1557
- ...s && { iconUrl: s }
1706
+ ...c && { iconUrl: c }
1558
1707
  }
1559
1708
  )
1560
1709
  ] })
1561
1710
  ] }),
1562
1711
  /* @__PURE__ */ n(
1563
- w,
1712
+ D,
1564
1713
  {
1565
- className: q("zd:shrink-0 zd:text-body3", _e[l]),
1714
+ className: G("zd:shrink-0 zd:text-body3", Qe[l]),
1566
1715
  children: l
1567
1716
  }
1568
1717
  )
@@ -1572,8 +1721,8 @@ function Ze({
1572
1721
  }
1573
1722
  );
1574
1723
  }
1575
- function o2({ name: e, iconUrl: t }) {
1576
- return /* @__PURE__ */ c("div", { className: "zd:flex zd:min-w-0 zd:items-center zd:gap-[5px]", children: [
1724
+ function a2({ name: e, iconUrl: t }) {
1725
+ return /* @__PURE__ */ f("div", { className: "zd:flex zd:min-w-0 zd:items-center zd:gap-[5px]", children: [
1577
1726
  t && /* @__PURE__ */ n("span", { className: "zd:size-3 zd:shrink-0 zd:overflow-hidden zd:rounded-full zd:bg-white", children: /* @__PURE__ */ n(
1578
1727
  "img",
1579
1728
  {
@@ -1583,21 +1732,21 @@ function o2({ name: e, iconUrl: t }) {
1583
1732
  className: "zd:size-full zd:object-cover"
1584
1733
  }
1585
1734
  ) }),
1586
- /* @__PURE__ */ n(w, { className: "zd:truncate zd:text-body3", children: e })
1735
+ /* @__PURE__ */ n(D, { className: "zd:truncate zd:text-body3", children: e })
1587
1736
  ] });
1588
1737
  }
1589
- const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png", a2 = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png", I = 3600 * 1e3, Ge = [
1738
+ const R = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png", s2 = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png", L = 3600 * 1e3, Xe = [
1590
1739
  {
1591
1740
  id: "mock-1",
1592
1741
  icon: "arrowSwapHorizontalOutline",
1593
1742
  title: "Swapped ETH → USD₮0",
1594
1743
  value: "2,343 ETH",
1595
1744
  chainName: "Arbitrum One",
1596
- chainIconUrl: B,
1745
+ chainIconUrl: R,
1597
1746
  destChainName: "Base",
1598
- destChainIconUrl: a2,
1747
+ destChainIconUrl: s2,
1599
1748
  status: "Pending",
1600
- timestamp: Date.now() - 1 * I
1749
+ timestamp: Date.now() - 1 * L
1601
1750
  },
1602
1751
  {
1603
1752
  id: "mock-2",
@@ -1605,11 +1754,11 @@ const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchai
1605
1754
  title: "Swapped ETH → USD₮0",
1606
1755
  value: "2,343 ETH",
1607
1756
  chainName: "Arbitrum One",
1608
- chainIconUrl: B,
1757
+ chainIconUrl: R,
1609
1758
  destChainName: "Base",
1610
- destChainIconUrl: a2,
1759
+ destChainIconUrl: s2,
1611
1760
  status: "Pending",
1612
- timestamp: Date.now() - 2 * I
1761
+ timestamp: Date.now() - 2 * L
1613
1762
  },
1614
1763
  {
1615
1764
  id: "mock-3",
@@ -1617,9 +1766,9 @@ const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchai
1617
1766
  title: "Fixed Yield",
1618
1767
  value: "2,323 PT wstETH (25 Jan 2026)",
1619
1768
  chainName: "Arbitrum One",
1620
- chainIconUrl: B,
1769
+ chainIconUrl: R,
1621
1770
  status: "Success",
1622
- timestamp: Date.now() - 3 * I
1771
+ timestamp: Date.now() - 3 * L
1623
1772
  },
1624
1773
  {
1625
1774
  id: "mock-4",
@@ -1627,9 +1776,9 @@ const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchai
1627
1776
  title: "Received NFT",
1628
1777
  value: "Bored Ape Yacht Club",
1629
1778
  chainName: "Arbitrum One",
1630
- chainIconUrl: B,
1779
+ chainIconUrl: R,
1631
1780
  status: "Success",
1632
- timestamp: Date.now() - 4 * I
1781
+ timestamp: Date.now() - 4 * L
1633
1782
  },
1634
1783
  {
1635
1784
  id: "mock-5",
@@ -1637,9 +1786,9 @@ const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchai
1637
1786
  title: "Collateral Used",
1638
1787
  value: "Collateralization enabled for USD₮0",
1639
1788
  chainName: "Arbitrum One",
1640
- chainIconUrl: B,
1789
+ chainIconUrl: R,
1641
1790
  status: "Success",
1642
- timestamp: Date.now() - 336 * I
1791
+ timestamp: Date.now() - 336 * L
1643
1792
  },
1644
1793
  {
1645
1794
  id: "mock-6",
@@ -1647,64 +1796,64 @@ const B = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchai
1647
1796
  title: "Liquid Staked ETH",
1648
1797
  value: "2,323 PT wstETH (25 Jan 2026)",
1649
1798
  chainName: "Arbitrum One",
1650
- chainIconUrl: B,
1799
+ chainIconUrl: R,
1651
1800
  status: "Success",
1652
- timestamp: Date.now() - 336 * I - 1 * I
1801
+ timestamp: Date.now() - 336 * L - 1 * L
1653
1802
  }
1654
1803
  ];
1655
- function j(e) {
1804
+ function Z(e) {
1656
1805
  const t = new Date(e);
1657
1806
  return `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`;
1658
1807
  }
1659
- function Ve(e, t) {
1660
- const r = j(e);
1661
- return r === j(t) ? "Today" : r === j(t - 1440 * 60 * 1e3) ? "Yesterday" : new Intl.DateTimeFormat("en-US", {
1808
+ function $e(e, t) {
1809
+ const o = Z(e);
1810
+ return o === Z(t) ? "Today" : o === Z(t - 1440 * 60 * 1e3) ? "Yesterday" : new Intl.DateTimeFormat("en-US", {
1662
1811
  month: "long",
1663
1812
  day: "numeric",
1664
1813
  year: "numeric"
1665
1814
  }).format(new Date(e));
1666
1815
  }
1667
- function je(e, t = Date.now()) {
1816
+ function et(e, t = Date.now()) {
1668
1817
  var a;
1669
- const r = [...e].sort((s, l) => l.timestamp - s.timestamp), i = [];
1670
- let o = null;
1671
- for (const s of r) {
1672
- const l = j(s.timestamp);
1673
- l !== o && (o = l, i.push({ label: Ve(s.timestamp, t), entries: [] })), (a = i[i.length - 1]) == null || a.entries.push(s);
1818
+ const o = [...e].sort((c, l) => l.timestamp - c.timestamp), i = [];
1819
+ let r = null;
1820
+ for (const c of o) {
1821
+ const l = Z(c.timestamp);
1822
+ l !== r && (r = l, i.push({ label: $e(c.timestamp, t), entries: [] })), (a = i[i.length - 1]) == null || a.entries.push(c);
1674
1823
  }
1675
1824
  return i;
1676
1825
  }
1677
- function qe({
1678
- entries: e = Ge,
1826
+ function tt({
1827
+ entries: e = Xe,
1679
1828
  onSelectEntry: t
1680
1829
  }) {
1681
- const r = je(e);
1830
+ const o = et(e);
1682
1831
  return /* @__PURE__ */ n("div", { className: "zd:flex zd:h-full zd:w-full zd:flex-col zd:gap-1 zd:pt-2 zd:pb-4", children: /* @__PURE__ */ n(
1683
- c2,
1832
+ u2,
1684
1833
  {
1685
1834
  variant: "ghost",
1686
1835
  className: "zd:flex zd:w-full zd:flex-1 zd:flex-col zd:gap-1 zd:overflow-y-auto zd:rounded-2xl zd:p-2",
1687
- children: r.map((i) => /* @__PURE__ */ c(M2, { children: [
1688
- /* @__PURE__ */ n("div", { className: "zd:flex zd:w-full zd:items-center zd:py-2 zd:pr-2", children: /* @__PURE__ */ n(w, { className: "zd:text-body3", children: i.label }) }),
1836
+ children: o.map((i) => /* @__PURE__ */ f(R2, { children: [
1837
+ /* @__PURE__ */ n("div", { className: "zd:flex zd:w-full zd:items-center zd:py-2 zd:pr-2", children: /* @__PURE__ */ n(D, { className: "zd:text-body3", children: i.label }) }),
1689
1838
  i.entries.map(
1690
- (o) => t ? /* @__PURE__ */ n(
1839
+ (r) => t ? /* @__PURE__ */ n(
1691
1840
  "button",
1692
1841
  {
1693
1842
  type: "button",
1694
- onClick: () => t(o),
1843
+ onClick: () => t(r),
1695
1844
  className: "zd:w-full zd:cursor-pointer zd:text-left",
1696
- children: /* @__PURE__ */ n(s2, { entry: o })
1845
+ children: /* @__PURE__ */ n(l2, { entry: r })
1697
1846
  },
1698
- o.id
1699
- ) : /* @__PURE__ */ n(s2, { entry: o }, o.id)
1847
+ r.id
1848
+ ) : /* @__PURE__ */ n(l2, { entry: r }, r.id)
1700
1849
  )
1701
1850
  ] }, i.label))
1702
1851
  }
1703
1852
  ) });
1704
1853
  }
1705
- function s2({ entry: e }) {
1854
+ function l2({ entry: e }) {
1706
1855
  return /* @__PURE__ */ n(
1707
- Ze,
1856
+ Ye,
1708
1857
  {
1709
1858
  icon: e.icon,
1710
1859
  title: e.title,
@@ -1719,82 +1868,82 @@ function s2({ entry: e }) {
1719
1868
  }
1720
1869
  );
1721
1870
  }
1722
- const Ke = {
1871
+ const nt = {
1723
1872
  history: "History"
1724
1873
  };
1725
- function st({
1874
+ function gt({
1726
1875
  onClose: e,
1727
1876
  entries: t,
1728
- onSelectEntry: r,
1877
+ onSelectEntry: o,
1729
1878
  className: i,
1730
- size: o
1879
+ size: r
1731
1880
  }) {
1732
- const [a] = E("history"), s = () => {
1881
+ const [a] = x("history"), c = () => {
1733
1882
  switch (a) {
1734
1883
  case "history":
1735
1884
  return /* @__PURE__ */ n(
1736
- qe,
1885
+ tt,
1737
1886
  {
1738
1887
  ...t && { entries: t },
1739
- ...r && { onSelectEntry: r }
1888
+ ...o && { onSelectEntry: o }
1740
1889
  }
1741
1890
  );
1742
1891
  }
1743
1892
  };
1744
1893
  return /* @__PURE__ */ n(
1745
- g2,
1894
+ z2,
1746
1895
  {
1747
1896
  ...i && { className: i },
1748
- ...o && { size: o },
1749
- topNav: /* @__PURE__ */ n(z2, { title: Ke[a], onRightButtonClick: e }),
1750
- children: s()
1897
+ ...r && { size: r },
1898
+ topNav: /* @__PURE__ */ n(C2, { title: nt[a], onRightButtonClick: e }),
1899
+ children: c()
1751
1900
  }
1752
1901
  );
1753
1902
  }
1754
- const b2 = "WALLETCONNECT_DEEPLINK_CHOICE", l2 = /* @__PURE__ */ new WeakSet();
1903
+ const U2 = "WALLETCONNECT_DEEPLINK_CHOICE", c2 = /* @__PURE__ */ new WeakSet();
1755
1904
  function d2(e) {
1756
- var i, o, a;
1757
- const t = (o = (i = e.session) == null ? void 0 : i.peer) == null ? void 0 : o.metadata, r = (a = t == null ? void 0 : t.redirect) == null ? void 0 : a.native;
1758
- if (!r || !x2()) {
1759
- k2();
1905
+ var i, r, a;
1906
+ const t = (r = (i = e.session) == null ? void 0 : i.peer) == null ? void 0 : r.metadata, o = (a = t == null ? void 0 : t.redirect) == null ? void 0 : a.native;
1907
+ if (!o || !F2()) {
1908
+ I2();
1760
1909
  return;
1761
1910
  }
1762
1911
  try {
1763
1912
  localStorage.setItem(
1764
- b2,
1765
- JSON.stringify({ href: r, name: (t == null ? void 0 : t.name) ?? "" })
1913
+ U2,
1914
+ JSON.stringify({ href: o, name: (t == null ? void 0 : t.name) ?? "" })
1766
1915
  );
1767
1916
  } catch {
1768
1917
  }
1769
1918
  }
1770
- function k2() {
1919
+ function I2() {
1771
1920
  try {
1772
- localStorage.removeItem(b2);
1921
+ localStorage.removeItem(U2);
1773
1922
  } catch {
1774
1923
  }
1775
1924
  }
1776
- function Je(e) {
1777
- l2.has(e) || (l2.add(e), e.on("connect", () => d2(e)), e.on("disconnect", k2), e.session && d2(e));
1925
+ function it(e) {
1926
+ c2.has(e) || (c2.add(e), e.on("connect", () => d2(e)), e.on("disconnect", I2), e.session && d2(e));
1778
1927
  }
1779
- function lt(e) {
1928
+ function zt(e) {
1780
1929
  if (!e.projectId)
1781
1930
  throw new Error("zeroDevWalletConnect requires a WalletConnect projectId");
1782
- const t = K2({ ...e, showQrModal: !1 });
1783
- return (r) => {
1784
- const i = Object.assign(t(r), { zdWalletConnect: !0 }), o = i.getProvider.bind(i);
1931
+ const t = X2({ ...e, showQrModal: !1 });
1932
+ return (o) => {
1933
+ const i = Object.assign(t(o), { zdWalletConnect: !0 }), r = i.getProvider.bind(i);
1785
1934
  return i.getProvider = async (...a) => {
1786
- const s = await o(...a);
1787
- return Je(s), s;
1935
+ const c = await r(...a);
1936
+ return it(c), c;
1788
1937
  }, i;
1789
1938
  };
1790
1939
  }
1791
1940
  export {
1792
- rt as ConnectWallet,
1793
- be as SignUp,
1794
- st as TxHistory,
1795
- S as useAuth,
1796
- ot as useWalletInfo,
1797
- at as zeroDevWallet,
1798
- lt as zeroDevWalletConnect
1941
+ pt as ConnectWallet,
1942
+ Ie as SignUp,
1943
+ gt as TxHistory,
1944
+ b as useAuth,
1945
+ ht as useWalletInfo,
1946
+ mt as zeroDevWallet,
1947
+ zt as zeroDevWalletConnect
1799
1948
  };
1800
1949
  //# sourceMappingURL=index.mjs.map