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