@zerodev/wallet-react-ui 0.0.3 → 0.0.5

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 (52) hide show
  1. package/README.md +0 -1
  2. package/dist/_types/auth/components/BlobAnimation/index.d.ts +1 -1
  3. package/dist/_types/auth/components/BlobAnimation/index.d.ts.map +1 -1
  4. package/dist/_types/auth/components/CodeInput/index.d.ts +1 -1
  5. package/dist/_types/auth/components/CodeInput/index.d.ts.map +1 -1
  6. package/dist/_types/auth/index.d.ts +1 -1
  7. package/dist/_types/auth/index.d.ts.map +1 -1
  8. package/dist/_types/auth/pages/EmailVerification.d.ts +1 -1
  9. package/dist/_types/auth/pages/EmailVerification.d.ts.map +1 -1
  10. package/dist/_types/auth/pages/ErrorScreen.d.ts +1 -1
  11. package/dist/_types/auth/pages/ErrorScreen.d.ts.map +1 -1
  12. package/dist/_types/auth/pages/OtpInput.d.ts +1 -1
  13. package/dist/_types/auth/pages/OtpInput.d.ts.map +1 -1
  14. package/dist/_types/auth/pages/SignUp.d.ts +1 -1
  15. package/dist/_types/auth/pages/SignUp.d.ts.map +1 -1
  16. package/dist/_types/auth/pages/Verifying.d.ts +1 -1
  17. package/dist/_types/auth/pages/Verifying.d.ts.map +1 -1
  18. package/dist/_types/auth/pages/WalletSelection.d.ts +1 -1
  19. package/dist/_types/auth/pages/WalletSelection.d.ts.map +1 -1
  20. package/dist/_types/shared/components/SignUpFooter/index.d.ts +1 -1
  21. package/dist/_types/shared/components/SignUpFooter/index.d.ts.map +1 -1
  22. package/dist/_types/shared/components/StatusScreen/index.d.ts +1 -1
  23. package/dist/_types/shared/components/StatusScreen/index.d.ts.map +1 -1
  24. package/dist/index.cjs +3 -3
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.mjs +454 -881
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/styles.css +2 -2
  29. package/package.json +11 -13
  30. package/src/auth/index.tsx +3 -4
  31. package/src/auth/pages/EmailVerification.tsx +1 -2
  32. package/src/auth/pages/ErrorScreen.tsx +1 -2
  33. package/src/auth/pages/OtpInput.tsx +1 -2
  34. package/src/auth/pages/SignUp.tsx +12 -4
  35. package/src/auth/pages/Verifying.tsx +1 -2
  36. package/src/auth/pages/WalletSelection.tsx +12 -4
  37. package/src/shared/components/SignUpFooter/index.tsx +1 -2
  38. package/dist/_types/shared/components/PoweredBy/index.d.ts +0 -6
  39. package/dist/_types/shared/components/PoweredBy/index.d.ts.map +0 -1
  40. package/dist/_types/shared/components/Screen/EllipticalRadial.d.ts +0 -23
  41. package/dist/_types/shared/components/Screen/EllipticalRadial.d.ts.map +0 -1
  42. package/dist/_types/shared/components/Screen/MultiRadialBackground.d.ts +0 -4
  43. package/dist/_types/shared/components/Screen/MultiRadialBackground.d.ts.map +0 -1
  44. package/dist/_types/shared/components/Screen/index.d.ts +0 -10
  45. package/dist/_types/shared/components/Screen/index.d.ts.map +0 -1
  46. package/dist/_types/shared/components/TopNav/index.d.ts +0 -10
  47. package/dist/_types/shared/components/TopNav/index.d.ts.map +0 -1
  48. package/src/shared/components/PoweredBy/index.tsx +0 -27
  49. package/src/shared/components/Screen/EllipticalRadial.tsx +0 -65
  50. package/src/shared/components/Screen/MultiRadialBackground.tsx +0 -323
  51. package/src/shared/components/Screen/index.tsx +0 -85
  52. package/src/shared/components/TopNav/index.tsx +0 -48
package/README.md CHANGED
@@ -120,5 +120,4 @@ pnpm dev # watch mode (types)
120
120
  pnpm typecheck
121
121
  pnpm test # vitest
122
122
  pnpm storybook # component catalog
123
- pnpm docs:dev # local docs site (vocs)
124
123
  ```
@@ -1,4 +1,4 @@
1
1
  export declare function BlobAnimation({ className }: {
2
2
  className?: string;
3
- }): import("react/jsx-runtime").JSX.Element;
3
+ }): import("react").JSX.Element;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/components/BlobAnimation/index.tsx"],"names":[],"mappings":"AASA,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAclE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/components/BlobAnimation/index.tsx"],"names":[],"mappings":"AASA,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAclE"}
@@ -7,5 +7,5 @@ export interface CodeInputProps {
7
7
  length?: number;
8
8
  'data-testid'?: string;
9
9
  }
10
- export declare function CodeInput({ onChange, onComplete, disabled, error, autoFocus, length, 'data-testid': testId, }: CodeInputProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CodeInput({ onChange, onComplete, disabled, error, autoFocus, length, 'data-testid': testId, }: CodeInputProps): import("react").JSX.Element;
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/components/CodeInput/index.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,KAAa,EACb,SAAiB,EACjB,MAAuB,EACvB,aAAa,EAAE,MAAM,GACtB,EAAE,cAAc,2CAoEhB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/auth/components/CodeInput/index.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,KAAa,EACb,SAAiB,EACjB,MAAuB,EACvB,aAAa,EAAE,MAAM,GACtB,EAAE,cAAc,+BAoEhB"}
@@ -1,5 +1,5 @@
1
1
  export declare function AuthFlow({ onClose: userOnClose, size, }?: {
2
2
  onClose?: (() => void) | undefined;
3
3
  size?: 'sm' | 'md' | 'lg' | undefined;
4
- }): import("react/jsx-runtime").JSX.Element | null;
4
+ }): import("react").JSX.Element | null;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.tsx"],"names":[],"mappings":"AA+DA,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EAAE,WAAW,EACpB,IAAI,GACL,GAAE;IACD,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAClC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;CACjC,kDAyCL"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.tsx"],"names":[],"mappings":"AA8DA,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EAAE,WAAW,EACpB,IAAI,GACL,GAAE;IACD,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAA;IAClC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAA;CACjC,sCAyCL"}
@@ -1,2 +1,2 @@
1
- export declare function EmailVerification(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function EmailVerification(): import("react").JSX.Element;
2
2
  //# sourceMappingURL=EmailVerification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailVerification.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/EmailVerification.tsx"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,4CAoEhC"}
1
+ {"version":3,"file":"EmailVerification.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/EmailVerification.tsx"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,gCAoEhC"}
@@ -4,6 +4,6 @@ interface ErrorScreenProps {
4
4
  showRetry?: boolean;
5
5
  showChooseAnother?: boolean;
6
6
  }
7
- export declare function ErrorScreen({ title, message, showRetry, showChooseAnother, }: ErrorScreenProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function ErrorScreen({ title, message, showRetry, showChooseAnother, }: ErrorScreenProps): import("react").JSX.Element;
8
8
  export {};
9
9
  //# sourceMappingURL=ErrorScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorScreen.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/ErrorScreen.tsx"],"names":[],"mappings":"AAMA,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAoC,EACpC,OAA4H,EAC5H,SAAiB,EACjB,iBAAwB,GACzB,EAAE,gBAAgB,2CAkClB"}
1
+ {"version":3,"file":"ErrorScreen.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/ErrorScreen.tsx"],"names":[],"mappings":"AAKA,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAoC,EACpC,OAA4H,EAC5H,SAAiB,EACjB,iBAAwB,GACzB,EAAE,gBAAgB,+BAkClB"}
@@ -1,2 +1,2 @@
1
- export declare function OtpInput(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function OtpInput(): import("react").JSX.Element;
2
2
  //# sourceMappingURL=OtpInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OtpInput.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/OtpInput.tsx"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,4CAoHvB"}
1
+ {"version":3,"file":"OtpInput.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/OtpInput.tsx"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,gCAoHvB"}
@@ -1,2 +1,2 @@
1
- export declare function SignUp(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function SignUp(): import("react").JSX.Element;
2
2
  //# sourceMappingURL=SignUp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/SignUp.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,MAAM,4CAuRrB"}
1
+ {"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/SignUp.tsx"],"names":[],"mappings":"AA+BA,wBAAgB,MAAM,gCAuRrB"}
@@ -1,2 +1,2 @@
1
- export declare function Verifying(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function Verifying(): import("react").JSX.Element;
2
2
  //# sourceMappingURL=Verifying.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Verifying.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/Verifying.tsx"],"names":[],"mappings":"AAaA,wBAAgB,SAAS,4CA8FxB"}
1
+ {"version":3,"file":"Verifying.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/Verifying.tsx"],"names":[],"mappings":"AAYA,wBAAgB,SAAS,gCA8FxB"}
@@ -1,2 +1,2 @@
1
- export declare function WalletSelection(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function WalletSelection(): import("react").JSX.Element;
2
2
  //# sourceMappingURL=WalletSelection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WalletSelection.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/WalletSelection.tsx"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,4CA+C9B"}
1
+ {"version":3,"file":"WalletSelection.d.ts","sourceRoot":"","sources":["../../../../src/auth/pages/WalletSelection.tsx"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,gCAwD9B"}
@@ -4,5 +4,5 @@ export declare function SignUpFooter({ termsAndConditionsUrl, privacyPolicyUrl,
4
4
  agreedToTerms: boolean;
5
5
  setAgreedToTerms: (agreed: boolean) => void;
6
6
  highlight?: boolean;
7
- }): import("react/jsx-runtime").JSX.Element;
7
+ }): import("react").JSX.Element;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/components/SignUpFooter/index.tsx"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,SAAiB,GAClB,EAAE;IACD,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,2CAkDA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/components/SignUpFooter/index.tsx"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,SAAiB,GAClB,EAAE;IACD,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1C,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACrC,aAAa,EAAE,OAAO,CAAA;IACtB,gBAAgB,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,+BAkDA"}
@@ -6,5 +6,5 @@ export interface StatusScreenProps {
6
6
  children: ReactNode;
7
7
  className?: string;
8
8
  }
9
- export declare function StatusScreen({ imageName, title, children, className, }: StatusScreenProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function StatusScreen({ imageName, title, children, className, }: StatusScreenProps): import("react").JSX.Element;
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/components/StatusScreen/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AASrE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,cAAc,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,2CAoBnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/components/StatusScreen/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AASrE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,cAAc,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE,iBAAiB,+BAoBnB"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("react"),b=require("zustand"),d=require("@zerodev/react-ui"),q=require("wagmi"),j=require("@zerodev/wallet-react"),X=require("zustand/middleware"),H=52;function Y({onBack:t,onClose:o,title:r,logo:n,className:s}){return e.jsxs("div",{className:d.cn("zd:absolute zd:top-4 zd:left-0 zd:right-0 zd:flex zd:flex-row zd:items-center zd:justify-between",s),style:{height:`calc(${H/4} * var(--zd-spacing))`},children:[t?e.jsx(d.IconButton,{iconName:"chevronLeft",onClick:t}):e.jsx("div",{className:"zd:h-13 zd:w-13"}),n&&e.jsx("div",{className:"zd:absolute zd:left-0 zd:right-0 zd:flex zd:items-center zd:justify-center zd:pointer-events-none",children:n}),r&&e.jsx("div",{className:"zd:absolute zd:left-0 zd:right-0 zd:flex zd:items-center zd:justify-center zd:pointer-events-none",children:e.jsx(d.Text,{className:"zd:text-body1",children:r})}),e.jsx(d.IconButton,{iconName:"x",onClick:o})]})}function J({layer:t,rect:o}){const{id:r,matrix:n,fillOpacity:s,stops:c}=t;return e.jsxs(e.Fragment,{children:[e.jsx("defs",{children:e.jsx("radialGradient",{id:r,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:`matrix(${n.join(" ")})`,children:c.map((i,u)=>e.jsx("stop",{offset:i.offset,stopColor:i.color,stopOpacity:i.opacity},i.color+u.toString()))})}),e.jsx("rect",{x:o.x,y:o.y,width:o.width,height:o.height,fill:`url(#${r})`,fillOpacity:s})]})}const Z="-6 -6 412 812";function Q(){return e.jsx("div",{className:"zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none",children:e.jsx("svg",{width:"100%",height:"100%",viewBox:Z,preserveAspectRatio:"none",role:"img","aria-label":"Decorative gradient background",children:e.jsx("rect",{x:"-6",y:"-6",width:"412",height:"812",fill:"#FBF7F2"})})})}function ee(){const t=h.useId(),o=[{id:`${t}-blue`,matrix:[1850,0,0,645,381.44,0],fillOpacity:1,stops:[{offset:0,color:"#45ABFB",opacity:.66},{offset:.4615,color:"#1E9AFB",opacity:.35},{offset:1,color:"#45ABFB",opacity:0}]},{id:`${t}-offwhite-tr`,matrix:[55.28,0,0,773.36,386.68,13.28],fillOpacity:1,stops:[{offset:0,color:"#F7F5F0",opacity:.1},{offset:1,color:"#45ABFB",opacity:0}]},{id:`${t}-warmgrey`,matrix:[326.72,0,0,855.52,0,50.32],fillOpacity:1,stops:[{offset:0,color:"#E3CFC3",opacity:1},{offset:1,color:"#E3CFC3",opacity:0}]},{id:`${t}-orange`,matrix:[580,0,0,380,200,835],fillOpacity:1,stops:[{offset:0,color:"#EE6C2E",opacity:.8},{offset:.55,color:"#EE6C2E",opacity:.6},{offset:1,color:"#EE6C2E",opacity:.15}]},{id:`${t}-peach`,matrix:[520,0,0,560,180,830],fillOpacity:1,stops:[{offset:0,color:"#FAC8AC",opacity:1},{offset:1,color:"#F27B3E",opacity:0}]},{id:`${t}-white-bl`,matrix:[90.72,0,0,550.48,38.04,702.64],fillOpacity:1,stops:[{offset:0,color:"white",opacity:.58},{offset:1,color:"white",opacity:0}]}];return e.jsx("div",{className:"zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none zd:overflow-hidden",children:e.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 400 800",preserveAspectRatio:"none",role:"presentation",children:[o.map(r=>e.jsx(J,{layer:r,rect:{x:0,y:0,width:400,height:800}},r.id)),e.jsx("defs",{children:e.jsxs("linearGradient",{id:`${t}-vfade`,x1:"0",y1:"0",x2:"0",y2:"800",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"white",stopOpacity:"0.55"}),e.jsx("stop",{offset:"0.45",stopColor:"white",stopOpacity:"0.52"}),e.jsx("stop",{offset:"0.65",stopColor:"white",stopOpacity:"0.5"}),e.jsx("stop",{offset:"0.85",stopColor:"white",stopOpacity:"0.5"}),e.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.5"})]})}),e.jsx("rect",{x:"0",y:"0",width:"400",height:"800",fill:`url(#${t}-vfade)`}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:`${t}-bluefade`,x1:"0",y1:"800",x2:"120",y2:"640",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{offset:"0",stopColor:"#A7B8E2",stopOpacity:"1"}),e.jsx("stop",{offset:"0.33",stopColor:"#A7B8E2",stopOpacity:"0.7"}),e.jsx("stop",{offset:"0.66",stopColor:"#A7B8E2",stopOpacity:"0.35"}),e.jsx("stop",{offset:"1",stopColor:"#A7B8E2",stopOpacity:"0"})]})}),e.jsx("rect",{x:"0",y:"0",width:"400",height:"800",fill:`url(#${t}-bluefade)`})]})})}function te(){const t=h.useId(),o=[{id:`${t}-g6`,cx:.9536,cy:0,rx:.9385,ry:1.2256,stops:[{offset:0,color:"#45ABFB",opacity:.6},{offset:.4615,color:"#1E9AFB",opacity:.32},{offset:1,color:"#45ABFB",opacity:0}]},{id:`${t}-g5`,cx:.9667,cy:.0166,rx:.1382,ry:.9667,stops:[{offset:0,color:"#F7F5F0",opacity:.1},{offset:1,color:"#45ABFB",opacity:0}]},{id:`${t}-g4`,cx:0,cy:.0629,rx:.8168,ry:1.0694,stops:[{offset:0,color:"#E3CFC3",opacity:1},{offset:1,color:"#E3CFC3",opacity:0}]},{id:`${t}-g3`,cx:.0393,cy:1,rx:1.0628,ry:1.0303,stops:[{offset:0,color:"#FF6B1F",opacity:1},{offset:.476,color:"#E76000",opacity:.72},{offset:1,color:"#E76000",opacity:0}]},{id:`${t}-g2`,cx:.3476,cy:1,rx:.9614,ry:.338,stops:[{offset:0,color:"#FAC8AC",opacity:.7},{offset:1,color:"#F27B3E",opacity:0}]},{id:`${t}-g1`,cx:.0951,cy:.8783,rx:.2268,ry:.6881,stops:[{offset:0,color:"#FFFFFF",opacity:.58},{offset:1,color:"#FFFFFF",opacity:0}]}];return e.jsx("div",{className:"zd:absolute zd:inset-0 zd:z-0 zd:rounded-4xl zd:pointer-events-none zd:overflow-hidden",children:e.jsxs("svg",{width:"100%",height:"100%",preserveAspectRatio:"none",role:"presentation",children:[e.jsx("rect",{width:"100%",height:"100%",fill:"#130E0B"}),e.jsx("defs",{children:o.map(r=>e.jsx("radialGradient",{id:r.id,cx:`${r.cx/r.rx*100}%`,cy:`${r.cy/r.ry*100}%`,r:"100%",gradientUnits:"objectBoundingBox",gradientTransform:`scale(${r.rx}, ${r.ry})`,children:r.stops.map((n,s)=>e.jsx("stop",{offset:n.offset,stopColor:n.color,stopOpacity:n.opacity},n.color+s.toString()))},r.id))}),o.map(r=>e.jsx("rect",{width:"100%",height:"100%",fill:`url(#${r.id})`},`${r.id}-rect`))]})})}const ne=H+16;function se({children:t,className:o,contentClassName:r,size:n="lg",style:s,topNav:c}){return e.jsxs("div",{"data-zd-size":n,className:d.cn("zd:relative zd:flex zd:flex-col zd:text-left","zd:w-100 zd:h-202.5 zd:max-w-full zd:max-h-full zd:overflow-hidden zd:rounded-[38px]",o),style:s,children:[e.jsx(te,{}),e.jsxs("div",{className:d.cn("zd:flex zd:flex-1 zd:flex-col zd:m-1.5 zd:px-4 zd:overflow-hidden zd:rounded-4xl zd:relative",r),style:{clipPath:"inset(0 round 32px)"},children:[e.jsx(Q,{}),e.jsx(ee,{}),e.jsxs("div",{className:"zd:relative zd:z-10 zd:flex zd:flex-1 zd:flex-col zd:min-h-0",children:[c,e.jsx("div",{className:"zd:flex zd:flex-1 zd:flex-col zd:min-h-0 zd:overflow-y-auto zd:overflow-x-hidden",style:{paddingTop:`calc(${ne/4} * var(--zd-spacing))`},children:t})]})]})]})}const re=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/error.webp").href:new URL("error.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),oe=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/loading.webp").href:new URL("loading.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),ie=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/send.webp").href:new URL("send.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),ae=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/success.webp").href:new URL("success.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),de={error:re,loading:oe,send:ie,success:ae};function I({imageName:t,title:o,children:r,className:n}){return e.jsxs("div",{className:d.cn("zd:flex zd:flex-col zd:gap-8 zd:items-center",n),children:[e.jsx("img",{src:de[t],alt:t,className:"zd:w-[118px] zd:h-[118px] zd:bg-transparent"}),e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4 zd:items-center",children:[e.jsx(d.Text,{className:"zd:text-h2 zd:text-center zd:whitespace-pre-wrap",children:o}),e.jsx(d.Text,{className:"zd:text-center zd:whitespace-pre-wrap",children:r})]})]})}function G(){const o=q.useConfig().connectors.find(r=>r.id==="zerodev-wallet");if(!o||!("getKitStore"in o))throw new Error("useKitStore must be used with the zeroDevWallet connector");return o.getKitStore()}function C(){const t=G(),o=b.useStore(t,l=>l.auth.step),r=b.useStore(t,l=>l.auth.stepHistory),n=b.useStore(t,l=>l.auth.email),s=b.useStore(t,l=>l.auth.otpId),c=b.useStore(t,l=>l.auth.otpEncryptionTargetBundle),i=b.useStore(t,l=>l.auth.enabledMethods),u=b.useStore(t,l=>l.auth.config);return{step:o,email:n,otpId:s,otpEncryptionTargetBundle:c,enabledMethods:i,config:u,goToStep:t.getState().auth.goToStep,goBack:r.length>0?t.getState().auth.goBack:null,reset:t.getState().auth.reset,setEmail:t.getState().auth.setEmail,setOtpSession:t.getState().auth.setOtpSession,clearOtpSession:t.getState().auth.clearOtpSession}}function A({className:t,style:o}){return e.jsxs("div",{className:d.cn("zd:gap-1.5 zd:flex zd:flex-row zd:items-center",t),children:[e.jsx(d.Text,{children:"Powered by"}),e.jsx(d.ZeroDevLogo,{variant:"lockup",tone:"black",className:"zd:h-4.5 zd:w-auto",style:o})]})}function ce(){const{email:t,setOtpSession:o}=C(),{mutateAsync:r,isPending:n}=j.useSendMagicLink(),[s,c]=h.useState(60),i=s<=0&&!n;h.useEffect(()=>{if(s<=0)return;const l=setInterval(()=>{c(p=>Math.max(0,p-1))},1e3);return()=>{clearInterval(l)}},[s]);const u=async()=>{if(!(!t||!i))try{const{otpId:l,otpEncryptionTargetBundle:p}=await r({email:t});o({otpId:l,otpEncryptionTargetBundle:p}),c(60)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center",children:[e.jsxs(I,{imageName:"send",title:`Check your email!
2
- An Email is On Its Way`,children:["We've sent a magic link to"," ",e.jsx(d.Text,{as:"span",className:"zd:text-solarOrange",children:t}),`
3
- `,"Please open the email and click the link to log in."]}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-1",children:e.jsxs(d.Text,{className:"zd:text-center",children:["Did not get an email?"," ",e.jsx("button",{type:"button",disabled:!i,onClick:u,className:"zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",children:i?"Resend":`Resend in ${s} ${s===1?"second":"seconds"}`})]})})]}),e.jsx(A,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function le(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).has("code")}function B(){if(typeof window>"u")return;const t=new URL(window.location.href);t.searchParams.has("code")&&(t.searchParams.delete("code"),window.history.replaceState(null,"",t.toString()))}function ue({title:t="Oops, something went wrong",message:o="We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request.",showRetry:r=!1,showChooseAnother:n=!0}){const{goToStep:s,goBack:c,reset:i}=C(),u=c??(()=>s("sign-up"));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center",children:[e.jsx(I,{imageName:"error",title:t,children:o}),e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-1",children:[r&&e.jsx(d.Button,{action:"primary",text:"Try again",onClick:u}),n&&e.jsx(d.Button,{action:r?"secondary":"primary",onClick:()=>{B(),s("sign-up")},text:"Choose another sign-in method"}),!r&&!n&&e.jsx(d.Button,{action:"primary",text:"Start over",onClick:i})]})]}),e.jsx(A,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}const pe=4,fe=8,he=6;function xe(t){return Math.max(pe,Math.min(fe,t))}function me({char:t,isFocused:o}){return e.jsx(d.Wrapper,{"data-testid":"code-input-box","data-active":o||void 0,className:d.cn("zd:h-16 zd:w-14 zd:rounded-lg zd:flex zd:items-center zd:justify-center",o&&"zd:border-[1.5px] zd:border-greyScale"),children:e.jsx(d.Text,{className:"zd:text-h2",children:t})})}function ze({onChange:t,onComplete:o,disabled:r=!1,error:n=!1,autoFocus:s=!1,length:c=he,"data-testid":i}){const u=xe(c),l=h.useMemo(()=>Array.from({length:u},(f,z)=>({id:`char-${z}`,index:z})),[u]),[p,y]=h.useState(""),[m,S]=h.useState(!1),E=h.useRef(null);h.useEffect(()=>{var f;s&&!r&&((f=E.current)==null||f.focus())},[s,r]),h.useEffect(()=>{y(f=>f.slice(0,u))},[u]);const v=f=>{const z=f.slice(0,u).toUpperCase();y(z),t==null||t(z),z.length===u&&setTimeout(()=>{var k;o==null||o(z),(k=E.current)==null||k.blur()},0)};return e.jsxs("button",{type:"button",className:"zd:flex zd:flex-row zd:items-center zd:justify-between zd:gap-2 zd:w-full zd:cursor-text",onClick:()=>{var f;return(f=E.current)==null?void 0:f.focus()},disabled:r,"data-testid":i,children:[e.jsx("input",{ref:E,value:p,onChange:f=>v(f.target.value),onFocus:()=>S(!0),onBlur:()=>S(!1),maxLength:u,disabled:r,className:"zd:absolute zd:opacity-0 zd:pointer-events-none",style:{position:"absolute",opacity:0},"aria-label":"Verification code"}),l.map(f=>e.jsx(me,{char:p[f.index]??"",isFocused:!n&&m&&f.index===p.length},f.id))]})}function ge(){const{email:t,otpId:o,otpEncryptionTargetBundle:r,setOtpSession:n,clearOtpSession:s,goToStep:c,config:i}=C(),{mutateAsync:u,isPending:l}=j.useSendOTP(),{mutateAsync:p,isPending:y}=j.useVerifyOTP(),[m,S]=h.useState(""),[E,v]=h.useState(!1),[f,z]=h.useState(60);h.useEffect(()=>{if(f<=0)return;const w=setInterval(()=>{z(T=>Math.max(0,T-1))},1e3);return()=>clearInterval(w)},[f]);const k=async()=>{var w,T;if(!(!m.trim()||!o||!r)){v(!1);try{await p({otpId:o,code:m.trim(),otpEncryptionTargetBundle:r}),s(),c("authenticated"),(w=i==null?void 0:i.onSuccess)==null||w.call(i)}catch(L){v(!0),(T=i==null?void 0:i.onError)==null||T.call(i,L)}}},g=w=>{S(w)},P=async()=>{if(!(!t||f>0||l))try{const{otpId:w,otpEncryptionTargetBundle:T}=await u({email:t});n({otpId:w,otpEncryptionTargetBundle:T}),z(60),v(!1)}catch{v(!0)}},O=f<=0&&!l;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center zd:items-center",children:[e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4",children:[e.jsx(d.Text,{className:"zd:text-h2 zd:text-center",children:"Enter verification code"}),e.jsxs(d.Text,{className:"zd:text-center",children:["Enter the code from the email we sent to"," ",e.jsx(d.Text,{className:"zd:text-solarOrange",children:t})]})]}),e.jsx(ze,{onComplete:g,onChange:()=>v(!1),disabled:y,error:E,autoFocus:!0}),e.jsx(d.Button,{text:"Confirm code",onClick:k,disabled:!m.trim()||y}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-1",children:e.jsxs(d.Text,{className:"zd:text-center",children:["Did not get an email?"," ",e.jsx("button",{type:"button",disabled:!O,onClick:P,className:"zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",children:O?"Resend":`Resend in ${f} ${f===1?"second":"seconds"}`})]})})]}),e.jsx(A,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function ye({termsAndConditionsUrl:t,privacyPolicyUrl:o,agreedToTerms:r,setAgreedToTerms:n,highlight:s=!1}){const c=!!(t||o);return e.jsxs("div",{className:"zd:flex zd:flex-col zd:items-center zd:gap-5",children:[c&&e.jsxs("div",{className:`zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${s?"zd:border zd:border-negative":"zd:border zd:border-transparent"}`,children:[e.jsx("input",{type:"checkbox",checked:r,onChange:i=>n(i.target.checked),className:"zd:cursor-pointer zd:[color-scheme:light]"}),e.jsxs(d.Text,{className:"zd:flex-1",children:["I agree to the"," ",t&&e.jsx(d.Text,{as:"a",href:t,target:"_blank",rel:"noopener noreferrer",className:"zd:underline",children:"Terms & Conditions"}),t&&o&&" and ",o&&e.jsx(d.Text,{as:"a",href:o,target:"_blank",rel:"noopener noreferrer",className:"zd:underline",children:"Privacy Policy"})]})]}),e.jsx(A,{})]})}const je=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function R(t){return je.test(t.trim())}const we=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/blob.webm").href:new URL("blob.webm",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href);function Se({className:t}){return e.jsx("video",{className:t,style:{aspectRatio:"1 / 1"},src:we,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1})}function U(t){return t instanceof Error?t.name==="AbortError"||t.name==="NotAllowedError"?!0:t.message.toLowerCase().includes("oauth popup was closed"):!1}function ve(){const{goToStep:t,setEmail:o,setOtpSession:r,config:n,enabledMethods:s}=C(),[c,i]=h.useState(!1),[u,l]=h.useState(!1),[p,y]=h.useState(""),m=(n==null?void 0:n.emailAuthMethod)==="otp",{mutateAsync:S,isPending:E}=j.useSendOTP(),{mutateAsync:v,isPending:f}=j.useSendMagicLink(),z=E||f,[k,g]=h.useState(null),{mutateAsync:P,isPending:O}=j.useAuthenticateOAuth({mutation:{onSuccess:async()=>{var a;t("authenticated"),(a=n==null?void 0:n.onSuccess)==null||a.call(n)},onError:a=>{var x;(x=n==null?void 0:n.onError)==null||x.call(n,a)}}}),{mutate:w,isPending:T}=j.useRegisterPasskey({mutation:{onSuccess:()=>{var a;t("authenticated"),(a=n==null?void 0:n.onSuccess)==null||a.call(n)},onError:a=>{var x;U(a)||g(a instanceof Error?a.message:String(a)),(x=n==null?void 0:n.onError)==null||x.call(n,a)}}}),{mutate:L,isPending:W}=j.useLoginPasskey({mutation:{onSuccess:()=>{var a;t("authenticated"),(a=n==null?void 0:n.onSuccess)==null||a.call(n)},onError:a=>{var x;U(a)||g(a instanceof Error?a.message:String(a)),(x=n==null?void 0:n.onError)==null||x.call(n,a)}}}),N=O||z||T||W,F=!!(n!=null&&n.termsAndConditionsUrl||n!=null&&n.privacyPolicyUrl)&&!c,D=()=>{if(!N){if(F){l(!0);return}g(null),w()}},V=()=>{if(!N){if(F){l(!0);return}g(null),L()}},K=async()=>{if(F){l(!0);return}g(null);try{await P({provider:"google"})}catch(a){const x=a instanceof Error?a.message:String(a);U(a)||g(x)}},M=m?async()=>{if(!(!p||N)&&R(p)){if(F){l(!0);return}g(null);try{const{otpId:a,otpEncryptionTargetBundle:x}=await S({email:p});o(p),r({otpId:a,otpEncryptionTargetBundle:x}),t("otp-input")}catch(a){g(a instanceof Error?a.message:"Failed to send verification code")}}}:async()=>{if(!(!p||N)&&R(p)){if(F){l(!0);return}g(null);try{const{otpId:a,otpEncryptionTargetBundle:x}=await v({email:p});o(p),r({otpId:a,otpEncryptionTargetBundle:x}),t("email-verification")}catch(a){g(a instanceof Error?a.message:"Failed to send verification code")}}};return k?e.jsx("div",{className:"zd:flex zd:items-center zd:justify-center zd:h-full",children:e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4 zd:max-w-md",children:[e.jsx(d.Text,{className:"zd:text-h2 zd:text-center",children:"Error occurred"}),e.jsx(d.Text,{className:"zd:text-center zd:text-red-500",children:k}),e.jsx(d.Button,{action:"primary",text:"Try again",onClick:()=>g(null)})]})}):e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden",children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:justify-center",children:[e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:items-center",children:[e.jsx("div",{className:"zd:w-full zd:px-16 zd:py-4",children:e.jsx(Se,{className:"zd:w-full zd:pointer-events-none zd:select-none"})}),e.jsx(d.Text,{className:"zd:text-h2 zd:text-center",children:"Continue to your wallet"}),e.jsx(d.Text,{className:"zd:mt-2 zd:text-center zd:text-greyScale/50",children:"Choose a sign-in method to proceed"})]}),e.jsxs("div",{className:"zd:mt-6 zd:flex zd:flex-col zd:gap-4 zd:mb-4",children:[s.includes("passkey")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:gap-2",children:[e.jsx(d.Button,{action:"secondary",text:"Create a passkey",iconName:"key",trailIcon:!0,disabled:N,onClick:D}),e.jsx(d.Button,{action:"secondary",text:"Log in with passkey",iconName:"key",trailIcon:!0,disabled:N,onClick:V})]}),e.jsxs("div",{className:"zd:flex zd:items-center zd:gap-3",children:[e.jsx("div",{className:"zd:h-px zd:flex-1 zd:bg-greyScale/30"}),e.jsx(d.Text,{className:"zd:text-body3",children:"or"}),e.jsx("div",{className:"zd:h-px zd:flex-1 zd:bg-greyScale/30"})]})]}),e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:gap-2",children:[s.includes("google")&&e.jsx(d.ListItem,{iconName:"google",title:"Google",chevron:!0,className:"zd:rounded-3xl",disabled:N,onClick:K}),s.includes("email")&&e.jsx(d.Input,{iconName:"email",placeholder:"Enter your email",value:p,onChange:a=>y(a.target.value),type:"email",autoCapitalize:"none",autoComplete:"email",disabled:N,variant:"listItemStyle",containerClassName:"zd:rounded-3xl",onKeyDown:a=>{a.key==="Enter"&&p&&!N&&M()},children:z?e.jsx("div",{className:"zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center",children:e.jsx("div",{className:"zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin"})}):e.jsx("button",{type:"button",disabled:!R(p)||F,className:`zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${R(p)&&!F?"zd:cursor-pointer":"zd:cursor-not-allowed zd:opacity-50"}`,onClick:()=>M(),children:e.jsx(d.Icon,{name:"chevronRight",className:"zd:text-greyScale"})})})]})]})]}),e.jsx("div",{className:"zd:px-4",children:e.jsx(ye,{termsAndConditionsUrl:n==null?void 0:n.termsAndConditionsUrl,privacyPolicyUrl:n==null?void 0:n.privacyPolicyUrl,agreedToTerms:c,setAgreedToTerms:a=>{i(a),a&&l(!1)},highlight:u})})]})}function Ne(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("code")}function be(){const{otpId:t,otpEncryptionTargetBundle:o,goToStep:r,clearOtpSession:n,config:s}=C(),[c]=h.useState(Ne),[i,u]=h.useState(null),l=h.useRef(!1),{mutate:p,isPending:y}=j.useVerifyMagicLink({mutation:{onSuccess:async()=>{var m;n(),r("authenticated"),(m=s==null?void 0:s.onSuccess)==null||m.call(s)},onError:m=>{var S;u(m),(S=s==null?void 0:s.onError)==null||S.call(s,m)}}});return h.useEffect(()=>{if(!(l.current||!c)){if(l.current=!0,!t||!o){B(),r(null);return}p({otpId:t,code:c,otpEncryptionTargetBundle:o})}},[t,o,c,p,r]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center",children:[!i&&y&&e.jsx(I,{imageName:"loading",title:"Verifying Your Email",children:"Please wait while we securely connect your wallet."}),!i&&!c&&!y&&e.jsxs(e.Fragment,{children:[e.jsxs(I,{imageName:"error",title:"Invalid Link",children:["This verification link is invalid or incomplete.",e.jsx("br",{}),"Please check your email and try again with the correct link."]}),e.jsx(d.Button,{action:"primary",onClick:()=>{B(),r("sign-up")},text:"Choose another sign-in method"})]}),i!=null&&e.jsxs(e.Fragment,{children:[e.jsx(I,{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."}),e.jsx(d.Button,{action:"primary",onClick:()=>{B(),r("sign-up")},text:"Choose another sign-in method"})]})]}),e.jsx(A,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function Ee(){const{goToStep:t}=C(),{connect:o,connectors:r,isPending:n}=q.useConnect(),s=r.filter(i=>i.id!=="zerodev-wallet"),c=i=>{o({connector:i},{onSuccess:()=>{t(null)}})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center",children:[e.jsx(d.Text,{className:"zd:text-h2 zd:text-center",children:"Select your wallet"}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-2",children:s.length===0?e.jsx(d.Text,{className:"zd:text-center",children:"No wallets detected. Install a browser wallet extension to continue."}):s.map(i=>e.jsx(d.ListItem,{title:i.name,iconName:"walletOutline",...i.icon?{imageUri:i.icon}:{},disabled:n,onClick:()=>c(i),className:"zd:rounded-3xl"},i.uid))})]}),e.jsx(A,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}const Te={"wallet-selection":"Choose your wallet"};function Ce(){return e.jsx("div",{className:"zd:flex zd:flex-1 zd:items-center zd:justify-center",children:e.jsx(I,{imageName:"loading",title:"Authenticating...",children:"Please wait while we complete the OAuth authentication."})})}function ke(){return e.jsx("div",{className:"zd:flex zd:flex-1 zd:items-center zd:justify-center",children:e.jsx(I,{imageName:"loading",title:"Passkey authentication",children:"Please authenticate with your passkey."})})}function Fe(t){switch(t){case"sign-up":return e.jsx(ve,{});case"email-verification":return e.jsx(ce,{});case"otp-input":return e.jsx(ge,{});case"verifying-otp":return e.jsx(be,{});case"oauth-in-progress":return e.jsx(Ce,{});case"passkey-prompt":return e.jsx(ke,{});case"wallet-selection":return e.jsx(Ee,{});case"error":return e.jsx(ue,{});default:return null}}function Ie({onClose:t,size:o}={}){const{step:r,goToStep:n,goBack:s,reset:c}=C(),i=b.useStore(G(),y=>y.logo);h.useEffect(()=>{r===null&&le()&&n("verifying-otp")},[r,n]);const u=Fe(r);if(!u)return null;const l=()=>{B(),c(),t==null||t()},p=r?Te[r]:void 0;return e.jsx(se,{...o&&{size:o},contentClassName:r==="sign-up"?"zd:px-0":void 0,topNav:e.jsx(Y,{...s!==null&&{onBack:s},onClose:l,...p&&{title:p},...r==="sign-up"&&{...i&&{logo:i},className:"zd:px-4"}}),children:u})}const $="zerodev:auth:otpSession";function Ae(){if(typeof window>"u")return null;try{const t=window.localStorage.getItem($);if(!t)return null;const o=JSON.parse(t);return!(o!=null&&o.otpId)||!(o!=null&&o.otpEncryptionTargetBundle)?null:o}catch{return null}}function Be(t){if(!(typeof window>"u"))try{window.localStorage.setItem($,JSON.stringify(t))}catch{}}function _(){if(!(typeof window>"u"))try{window.localStorage.removeItem($)}catch{}}const Oe=(t,o,r)=>({auth:{step:null,stepHistory:[],enabledMethods:[],email:null,otpId:null,otpEncryptionTargetBundle:null,config:null,initialize:n=>{const s=Ae();t(c=>({auth:{...c.auth,config:n,enabledMethods:n.enabledMethods,...s&&{otpId:s.otpId,otpEncryptionTargetBundle:s.otpEncryptionTargetBundle}}}))},goToStep:n=>{t(s=>({auth:{...s.auth,step:n,stepHistory:s.auth.step===null?s.auth.stepHistory:[...s.auth.stepHistory,s.auth.step]}}))},goBack:()=>{const{auth:n}=o();if(n.stepHistory.length===0)return;const s=[...n.stepHistory],c=s.pop();t(i=>({auth:{...i.auth,step:c,stepHistory:s}}))},reset:()=>{_(),t(n=>({auth:{...n.auth,step:null,stepHistory:[],email:null,otpId:null,otpEncryptionTargetBundle:null}}))},setEmail:n=>{t(s=>({auth:{...s.auth,email:n}}))},setOtpSession:({otpId:n,otpEncryptionTargetBundle:s})=>{Be({otpId:n,otpEncryptionTargetBundle:s}),t(c=>({auth:{...c.auth,otpId:n,otpEncryptionTargetBundle:s}}))},clearOtpSession:()=>{_(),t(n=>({auth:{...n.auth,otpId:null,otpEncryptionTargetBundle:null}}))}}}),Re=(t={})=>b.create()(X.subscribeWithSelector((o,r,n)=>({pendingRequests:[],userConfirmationListenerActive:!1,logo:t.logo??null,addPendingRequest:s=>o(c=>({pendingRequests:[...c.pendingRequests,s]})),removePendingRequest:s=>o(c=>({pendingRequests:c.pendingRequests.filter(i=>i.id!==s)})),clearPendingRequests:()=>o({pendingRequests:[]}),setUserConfirmationListenerActive:s=>o({userConfirmationListenerActive:s}),...Oe(o,r)})));function Pe(t){return new Promise((o,r)=>{const n=t.subscribe(s=>s.auth.step,s=>{s==="authenticated"?(n(),o()):s===null&&(n(),r(new Error("Auth flow dismissed")))})})}function Le(t){var n,s;const o=j.zeroDevWallet(t),r=Re({logo:(n=t.config)==null?void 0:n.logo});return(s=t.config)!=null&&s.auth&&r.getState().auth.initialize(t.config.auth),c=>{const i=o(c);return{...i,async connect(u){var l;try{return await i.connect(u)}catch(p){if(u!=null&&u.isReconnecting||!((l=t.config)!=null&&l.auth)||!(p instanceof j.NotAuthenticatedError))throw p;if(r.getState().auth.step!==null)throw new Error("Auth flow already in progress");return r.getState().auth.goToStep("sign-up"),await Pe(r),i.connect(u)}},async disconnect(){var u,l;await((u=i.disconnect)==null?void 0:u.call(i)),(l=t.config)!=null&&l.auth&&r.getState().auth.reset()},async setup(){var u;await((u=i.setup)==null?void 0:u.call(i)),typeof window>"u"},getKitStore(){return r}}}}exports.AuthFlow=Ie;exports.useAuth=C;exports.zeroDevWallet=Le;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("@zerodev/react-ui"),m=require("react"),v=require("zustand"),_=require("wagmi"),S=require("@zerodev/wallet-react"),$=require("zustand/middleware"),K=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/error.webp").href:new URL("error.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),Y=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/loading.webp").href:new URL("loading.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),J=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/send.webp").href:new URL("send.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),X=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/success.webp").href:new URL("success.webp",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),Q={error:K,loading:Y,send:J,success:X};function C({imageName:t,title:r,children:a,className:n}){return e.jsxs("div",{className:o.cn("zd:flex zd:flex-col zd:gap-8 zd:items-center",n),children:[e.jsx("img",{src:Q[t],alt:t,className:"zd:w-[118px] zd:h-[118px] zd:bg-transparent"}),e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4 zd:items-center",children:[e.jsx(o.Text,{className:"zd:text-h2 zd:text-center zd:whitespace-pre-wrap",children:r}),e.jsx(o.Text,{className:"zd:text-center zd:whitespace-pre-wrap",children:a})]})]})}function H(){const r=_.useConfig().connectors.find(a=>a.id==="zerodev-wallet");if(!r||!("getKitStore"in r))throw new Error("useKitStore must be used with the zeroDevWallet connector");return r.getKitStore()}function k(){const t=H(),r=v.useStore(t,c=>c.auth.step),a=v.useStore(t,c=>c.auth.stepHistory),n=v.useStore(t,c=>c.auth.email),s=v.useStore(t,c=>c.auth.otpId),l=v.useStore(t,c=>c.auth.otpEncryptionTargetBundle),i=v.useStore(t,c=>c.auth.enabledMethods),u=v.useStore(t,c=>c.auth.config);return{step:r,email:n,otpId:s,otpEncryptionTargetBundle:l,enabledMethods:i,config:u,goToStep:t.getState().auth.goToStep,goBack:a.length>0?t.getState().auth.goBack:null,reset:t.getState().auth.reset,setEmail:t.getState().auth.setEmail,setOtpSession:t.getState().auth.setOtpSession,clearOtpSession:t.getState().auth.clearOtpSession}}function Z(){const{email:t,setOtpSession:r}=k(),{mutateAsync:a,isPending:n}=S.useSendMagicLink(),[s,l]=m.useState(60),i=s<=0&&!n;m.useEffect(()=>{if(s<=0)return;const c=setInterval(()=>{l(p=>Math.max(0,p-1))},1e3);return()=>{clearInterval(c)}},[s]);const u=async()=>{if(!(!t||!i))try{const{otpId:c,otpEncryptionTargetBundle:p}=await a({email:t});r({otpId:c,otpEncryptionTargetBundle:p}),l(60)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center",children:[e.jsxs(C,{imageName:"send",title:`Check your email!
2
+ An Email is On Its Way`,children:["We've sent a magic link to"," ",e.jsx(o.Text,{as:"span",className:"zd:text-solarOrange",children:t}),`
3
+ `,"Please open the email and click the link to log in."]}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-1",children:e.jsxs(o.Text,{className:"zd:text-center",children:["Did not get an email?"," ",e.jsx("button",{type:"button",disabled:!i,onClick:u,className:"zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",children:i?"Resend":`Resend in ${s} ${s===1?"second":"seconds"}`})]})})]}),e.jsx(o.PoweredBy,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function ee(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).has("code")}function P(){if(typeof window>"u")return;const t=new URL(window.location.href);t.searchParams.has("code")&&(t.searchParams.delete("code"),window.history.replaceState(null,"",t.toString()))}function te({title:t="Oops, something went wrong",message:r="We couldn't complete the sign-in process. This could be due to timeout, an expired link, or a cancelled request.",showRetry:a=!1,showChooseAnother:n=!0}){const{goToStep:s,goBack:l,reset:i}=k(),u=l??(()=>s("sign-up"));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center",children:[e.jsx(C,{imageName:"error",title:t,children:r}),e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-1",children:[a&&e.jsx(o.Button,{action:"primary",text:"Try again",onClick:u}),n&&e.jsx(o.Button,{action:a?"secondary":"primary",onClick:()=>{P(),s("sign-up")},text:"Choose another sign-in method"}),!a&&!n&&e.jsx(o.Button,{action:"primary",text:"Start over",onClick:i})]})]}),e.jsx(o.PoweredBy,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}const ne=4,se=8,re=6;function ie(t){return Math.max(ne,Math.min(se,t))}function ae({char:t,isFocused:r}){return e.jsx(o.Wrapper,{"data-testid":"code-input-box","data-active":r||void 0,className:o.cn("zd:h-16 zd:w-14 zd:rounded-lg zd:flex zd:items-center zd:justify-center",r&&"zd:border-[1.5px] zd:border-greyScale"),children:e.jsx(o.Text,{className:"zd:text-h2",children:t})})}function oe({onChange:t,onComplete:r,disabled:a=!1,error:n=!1,autoFocus:s=!1,length:l=re,"data-testid":i}){const u=ie(l),c=m.useMemo(()=>Array.from({length:u},(h,z)=>({id:`char-${z}`,index:z})),[u]),[p,y]=m.useState(""),[f,j]=m.useState(!1),T=m.useRef(null);m.useEffect(()=>{var h;s&&!a&&((h=T.current)==null||h.focus())},[s,a]),m.useEffect(()=>{y(h=>h.slice(0,u))},[u]);const N=h=>{const z=h.slice(0,u).toUpperCase();y(z),t==null||t(z),z.length===u&&setTimeout(()=>{var I;r==null||r(z),(I=T.current)==null||I.blur()},0)};return e.jsxs("button",{type:"button",className:"zd:flex zd:flex-row zd:items-center zd:justify-between zd:gap-2 zd:w-full zd:cursor-text",onClick:()=>{var h;return(h=T.current)==null?void 0:h.focus()},disabled:a,"data-testid":i,children:[e.jsx("input",{ref:T,value:p,onChange:h=>N(h.target.value),onFocus:()=>j(!0),onBlur:()=>j(!1),maxLength:u,disabled:a,className:"zd:absolute zd:opacity-0 zd:pointer-events-none",style:{position:"absolute",opacity:0},"aria-label":"Verification code"}),c.map(h=>e.jsx(ae,{char:p[h.index]??"",isFocused:!n&&f&&h.index===p.length},h.id))]})}function de(){const{email:t,otpId:r,otpEncryptionTargetBundle:a,setOtpSession:n,clearOtpSession:s,goToStep:l,config:i}=k(),{mutateAsync:u,isPending:c}=S.useSendOTP(),{mutateAsync:p,isPending:y}=S.useVerifyOTP(),[f,j]=m.useState(""),[T,N]=m.useState(!1),[h,z]=m.useState(60);m.useEffect(()=>{if(h<=0)return;const w=setInterval(()=>{z(E=>Math.max(0,E-1))},1e3);return()=>clearInterval(w)},[h]);const I=async()=>{var w,E;if(!(!f.trim()||!r||!a)){N(!1);try{await p({otpId:r,code:f.trim(),otpEncryptionTargetBundle:a}),s(),l("authenticated"),(w=i==null?void 0:i.onSuccess)==null||w.call(i)}catch(O){N(!0),(E=i==null?void 0:i.onError)==null||E.call(i,O)}}},g=w=>{j(w)},B=async()=>{if(!(!t||h>0||c))try{const{otpId:w,otpEncryptionTargetBundle:E}=await u({email:t});n({otpId:w,otpEncryptionTargetBundle:E}),z(60),N(!1)}catch{N(!0)}},L=h<=0&&!c;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center zd:items-center",children:[e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4",children:[e.jsx(o.Text,{className:"zd:text-h2 zd:text-center",children:"Enter verification code"}),e.jsxs(o.Text,{className:"zd:text-center",children:["Enter the code from the email we sent to"," ",e.jsx(o.Text,{className:"zd:text-solarOrange",children:t})]})]}),e.jsx(oe,{onComplete:g,onChange:()=>N(!1),disabled:y,error:T,autoFocus:!0}),e.jsx(o.Button,{text:"Confirm code",onClick:I,disabled:!f.trim()||y}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-1",children:e.jsxs(o.Text,{className:"zd:text-center",children:["Did not get an email?"," ",e.jsx("button",{type:"button",disabled:!L,onClick:B,className:"zd:cursor-pointer zd:underline zd:disabled:opacity-50 zd:disabled:cursor-not-allowed",children:L?"Resend":`Resend in ${h} ${h===1?"second":"seconds"}`})]})})]}),e.jsx(o.PoweredBy,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function ce({termsAndConditionsUrl:t,privacyPolicyUrl:r,agreedToTerms:a,setAgreedToTerms:n,highlight:s=!1}){const l=!!(t||r);return e.jsxs("div",{className:"zd:flex zd:flex-col zd:items-center zd:gap-5",children:[l&&e.jsxs("div",{className:`zd:flex zd:flex-row zd:items-center zd:gap-2 zd:rounded-md zd:p-2 zd:transition-colors ${s?"zd:border zd:border-negative":"zd:border zd:border-transparent"}`,children:[e.jsx("input",{type:"checkbox",checked:a,onChange:i=>n(i.target.checked),className:"zd:cursor-pointer zd:[color-scheme:light]"}),e.jsxs(o.Text,{className:"zd:flex-1",children:["I agree to the"," ",t&&e.jsx(o.Text,{as:"a",href:t,target:"_blank",rel:"noopener noreferrer",className:"zd:underline",children:"Terms & Conditions"}),t&&r&&" and ",r&&e.jsx(o.Text,{as:"a",href:r,target:"_blank",rel:"noopener noreferrer",className:"zd:underline",children:"Privacy Policy"})]})]}),e.jsx(o.PoweredBy,{})]})}const le=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function A(t){return le.test(t.trim())}const ue=""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/blob.webm").href:new URL("blob.webm",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href);function pe({className:t}){return e.jsx("video",{className:t,style:{aspectRatio:"1 / 1"},src:ue,autoPlay:!0,loop:!0,muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1})}function U(t){return t instanceof Error?t.name==="AbortError"||t.name==="NotAllowedError"?!0:t.message.toLowerCase().includes("oauth popup was closed"):!1}function he(){const{goToStep:t,setEmail:r,setOtpSession:a,config:n,enabledMethods:s}=k(),[l,i]=m.useState(!1),[u,c]=m.useState(!1),[p,y]=m.useState(""),f=(n==null?void 0:n.emailAuthMethod)==="otp",{mutateAsync:j,isPending:T}=S.useSendOTP(),{mutateAsync:N,isPending:h}=S.useSendMagicLink(),z=T||h,[I,g]=m.useState(null),{mutateAsync:B,isPending:L}=S.useAuthenticateOAuth({mutation:{onSuccess:async()=>{var d;t("authenticated"),(d=n==null?void 0:n.onSuccess)==null||d.call(n)},onError:d=>{var x;(x=n==null?void 0:n.onError)==null||x.call(n,d)}}}),{mutate:w,isPending:E}=S.useRegisterPasskey({mutation:{onSuccess:()=>{var d;t("authenticated"),(d=n==null?void 0:n.onSuccess)==null||d.call(n)},onError:d=>{var x;U(d)||g(d instanceof Error?d.message:String(d)),(x=n==null?void 0:n.onError)==null||x.call(n,d)}}}),{mutate:O,isPending:W}=S.useLoginPasskey({mutation:{onSuccess:()=>{var d;t("authenticated"),(d=n==null?void 0:n.onSuccess)==null||d.call(n)},onError:d=>{var x;U(d)||g(d instanceof Error?d.message:String(d)),(x=n==null?void 0:n.onError)==null||x.call(n,d)}}}),b=L||z||E||W,R=!!(n!=null&&n.termsAndConditionsUrl||n!=null&&n.privacyPolicyUrl)&&!l,V=()=>{if(!b){if(R){c(!0);return}g(null),w()}},G=()=>{if(!b){if(R){c(!0);return}g(null),O()}},D=async()=>{if(R){c(!0);return}g(null);try{await B({provider:"google"})}catch(d){const x=d instanceof Error?d.message:String(d);U(d)||g(x)}},F=f?async()=>{if(!(!p||b)&&A(p)){if(R){c(!0);return}g(null);try{const{otpId:d,otpEncryptionTargetBundle:x}=await j({email:p});r(p),a({otpId:d,otpEncryptionTargetBundle:x}),t("otp-input")}catch(d){g(d instanceof Error?d.message:"Failed to send verification code")}}}:async()=>{if(!(!p||b)&&A(p)){if(R){c(!0);return}g(null);try{const{otpId:d,otpEncryptionTargetBundle:x}=await N({email:p});r(p),a({otpId:d,otpEncryptionTargetBundle:x}),t("email-verification")}catch(d){g(d instanceof Error?d.message:"Failed to send verification code")}}};return I?e.jsx("div",{className:"zd:flex zd:items-center zd:justify-center zd:h-full",children:e.jsxs("div",{className:"zd:flex zd:flex-col zd:gap-4 zd:max-w-md",children:[e.jsx(o.Text,{className:"zd:text-h2 zd:text-center",children:"Error occurred"}),e.jsx(o.Text,{className:"zd:text-center zd:text-red-500",children:I}),e.jsx(o.Button,{action:"primary",text:"Try again",onClick:()=>g(null)})]})}):e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:justify-between zd:pb-4 zd:overflow-y-auto zd:overflow-x-hidden",children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:justify-center",children:[e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:items-center",children:[e.jsx("div",{className:"zd:w-full zd:px-16 zd:py-4",children:e.jsx(pe,{className:"zd:w-full zd:pointer-events-none zd:select-none"})}),e.jsx(o.Text,{className:"zd:text-h2 zd:text-center",children:"Continue to your wallet"}),e.jsx(o.Text,{className:"zd:mt-2 zd:text-center zd:text-greyScale/50",children:"Choose a sign-in method to proceed"})]}),e.jsxs("div",{className:"zd:mt-6 zd:flex zd:flex-col zd:gap-4 zd:mb-4",children:[s.includes("passkey")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:gap-2",children:[e.jsx(o.Button,{action:"secondary",text:"Create a passkey",iconName:"key",trailIcon:!0,disabled:b,onClick:V}),e.jsx(o.Button,{action:"secondary",text:"Log in with passkey",iconName:"key",trailIcon:!0,disabled:b,onClick:G})]}),e.jsxs("div",{className:"zd:flex zd:items-center zd:gap-3",children:[e.jsx("div",{className:"zd:h-px zd:flex-1 zd:bg-greyScale/30"}),e.jsx(o.Text,{className:"zd:text-body3",children:"or"}),e.jsx("div",{className:"zd:h-px zd:flex-1 zd:bg-greyScale/30"})]})]}),e.jsxs("div",{className:"zd:px-4 zd:flex zd:flex-col zd:gap-2",children:[s.includes("google")&&e.jsx(o.ListItem,{icon:e.jsx(o.ListItemIcon,{name:"google"}),title:"Google",trailing:e.jsx(o.ListItemChevron,{}),className:"zd:rounded-3xl",disabled:b,onClick:D}),s.includes("email")&&e.jsx(o.Input,{iconName:"email",placeholder:"Enter your email",value:p,onChange:d=>y(d.target.value),type:"email",autoCapitalize:"none",autoComplete:"email",disabled:b,variant:"listItemStyle",containerClassName:"zd:rounded-3xl",onKeyDown:d=>{d.key==="Enter"&&p&&!b&&F()},children:z?e.jsx("div",{className:"zd:w-13 zd:h-13 zd:flex zd:items-center zd:justify-center",children:e.jsx("div",{className:"zd:w-5 zd:h-5 zd:border-2 zd:border-solarOrange zd:border-t-transparent zd:rounded-full zd:animate-spin"})}):e.jsx("button",{type:"button",disabled:!A(p)||R,className:`zd:w-13 zd:h-13 zd:rounded-2xl zd:flex zd:items-center zd:justify-center zd:transition-colors ${A(p)&&!R?"zd:cursor-pointer":"zd:cursor-not-allowed zd:opacity-50"}`,onClick:()=>F(),children:e.jsx(o.Icon,{name:"chevronRight",className:"zd:text-greyScale"})})})]})]})]}),e.jsx("div",{className:"zd:px-4",children:e.jsx(ce,{termsAndConditionsUrl:n==null?void 0:n.termsAndConditionsUrl,privacyPolicyUrl:n==null?void 0:n.privacyPolicyUrl,agreedToTerms:l,setAgreedToTerms:d=>{i(d),d&&c(!1)},highlight:u})})]})}function me(){return typeof window>"u"?null:new URLSearchParams(window.location.search).get("code")}function xe(){const{otpId:t,otpEncryptionTargetBundle:r,goToStep:a,clearOtpSession:n,config:s}=k(),[l]=m.useState(me),[i,u]=m.useState(null),c=m.useRef(!1),{mutate:p,isPending:y}=S.useVerifyMagicLink({mutation:{onSuccess:async()=>{var f;n(),a("authenticated"),(f=s==null?void 0:s.onSuccess)==null||f.call(s)},onError:f=>{var j;u(f),(j=s==null?void 0:s.onError)==null||j.call(s,f)}}});return m.useEffect(()=>{if(!(c.current||!l)){if(c.current=!0,!t||!r){P(),a(null);return}p({otpId:t,code:l,otpEncryptionTargetBundle:r})}},[t,r,l,p,a]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:items-center zd:justify-center",children:[!i&&y&&e.jsx(C,{imageName:"loading",title:"Verifying Your Email",children:"Please wait while we securely connect your wallet."}),!i&&!l&&!y&&e.jsxs(e.Fragment,{children:[e.jsxs(C,{imageName:"error",title:"Invalid Link",children:["This verification link is invalid or incomplete.",e.jsx("br",{}),"Please check your email and try again with the correct link."]}),e.jsx(o.Button,{action:"primary",onClick:()=>{P(),a("sign-up")},text:"Choose another sign-in method"})]}),i!=null&&e.jsxs(e.Fragment,{children:[e.jsx(C,{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."}),e.jsx(o.Button,{action:"primary",onClick:()=>{P(),a("sign-up")},text:"Choose another sign-in method"})]})]}),e.jsx(o.PoweredBy,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}function fe(){const{goToStep:t}=k(),{connect:r,connectors:a,isPending:n}=_.useConnect(),s=a.filter(i=>i.id!=="zerodev-wallet"),l=i=>{r({connector:i},{onSuccess:()=>{t(null)}})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"zd:flex-1 zd:flex zd:flex-col zd:gap-8 zd:justify-center",children:[e.jsx(o.Text,{className:"zd:text-h2 zd:text-center",children:"Select your wallet"}),e.jsx("div",{className:"zd:flex zd:flex-col zd:gap-2",children:s.length===0?e.jsx(o.Text,{className:"zd:text-center",children:"No wallets detected. Install a browser wallet extension to continue."}):s.map(i=>e.jsx(o.ListItem,{title:i.name,icon:i.icon?e.jsx("img",{src:i.icon,alt:"",className:"zd:w-6 zd:h-6"}):e.jsx(o.ListItemIcon,{name:"walletOutline"}),disabled:n,onClick:()=>l(i),className:"zd:rounded-3xl"},i.uid))})]}),e.jsx(o.PoweredBy,{className:"zd:self-center zd:pt-4 zd:pb-6"})]})}const ze={"wallet-selection":"Choose your wallet"};function ge(){return e.jsx("div",{className:"zd:flex zd:flex-1 zd:items-center zd:justify-center",children:e.jsx(C,{imageName:"loading",title:"Authenticating...",children:"Please wait while we complete the OAuth authentication."})})}function ye(){return e.jsx("div",{className:"zd:flex zd:flex-1 zd:items-center zd:justify-center",children:e.jsx(C,{imageName:"loading",title:"Passkey authentication",children:"Please authenticate with your passkey."})})}function Se(t){switch(t){case"sign-up":return e.jsx(he,{});case"email-verification":return e.jsx(Z,{});case"otp-input":return e.jsx(de,{});case"verifying-otp":return e.jsx(xe,{});case"oauth-in-progress":return e.jsx(ge,{});case"passkey-prompt":return e.jsx(ye,{});case"wallet-selection":return e.jsx(fe,{});case"error":return e.jsx(te,{});default:return null}}function we({onClose:t,size:r}={}){const{step:a,goToStep:n,goBack:s,reset:l}=k(),i=v.useStore(H(),y=>y.logo);m.useEffect(()=>{a===null&&ee()&&n("verifying-otp")},[a,n]);const u=Se(a);if(!u)return null;const c=()=>{P(),l(),t==null||t()},p=a?ze[a]:void 0;return e.jsx(o.Screen,{...r&&{size:r},contentClassName:a==="sign-up"?"zd:px-0":void 0,topNav:e.jsx(o.TopNav,{...s!==null&&{onLeftButtonClick:s},onRightButtonClick:c,...p&&{title:p},...a==="sign-up"&&{...i&&{logo:i},className:"zd:px-4"}}),children:u})}const M="zerodev:auth:otpSession";function je(){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(M);if(!t)return null;const r=JSON.parse(t);return!(r!=null&&r.otpId)||!(r!=null&&r.otpEncryptionTargetBundle)?null:r}catch{return null}}function Ne(t){if(!(typeof window>"u"))try{window.localStorage.setItem(M,JSON.stringify(t))}catch{}}function q(){if(!(typeof window>"u"))try{window.localStorage.removeItem(M)}catch{}}const be=(t,r,a)=>({auth:{step:null,stepHistory:[],enabledMethods:[],email:null,otpId:null,otpEncryptionTargetBundle:null,config:null,initialize:n=>{const s=je();t(l=>({auth:{...l.auth,config:n,enabledMethods:n.enabledMethods,...s&&{otpId:s.otpId,otpEncryptionTargetBundle:s.otpEncryptionTargetBundle}}}))},goToStep:n=>{t(s=>({auth:{...s.auth,step:n,stepHistory:s.auth.step===null?s.auth.stepHistory:[...s.auth.stepHistory,s.auth.step]}}))},goBack:()=>{const{auth:n}=r();if(n.stepHistory.length===0)return;const s=[...n.stepHistory],l=s.pop();t(i=>({auth:{...i.auth,step:l,stepHistory:s}}))},reset:()=>{q(),t(n=>({auth:{...n.auth,step:null,stepHistory:[],email:null,otpId:null,otpEncryptionTargetBundle:null}}))},setEmail:n=>{t(s=>({auth:{...s.auth,email:n}}))},setOtpSession:({otpId:n,otpEncryptionTargetBundle:s})=>{Ne({otpId:n,otpEncryptionTargetBundle:s}),t(l=>({auth:{...l.auth,otpId:n,otpEncryptionTargetBundle:s}}))},clearOtpSession:()=>{q(),t(n=>({auth:{...n.auth,otpId:null,otpEncryptionTargetBundle:null}}))}}}),ve=(t={})=>v.create()($.subscribeWithSelector((r,a,n)=>({pendingRequests:[],userConfirmationListenerActive:!1,logo:t.logo??null,addPendingRequest:s=>r(l=>({pendingRequests:[...l.pendingRequests,s]})),removePendingRequest:s=>r(l=>({pendingRequests:l.pendingRequests.filter(i=>i.id!==s)})),clearPendingRequests:()=>r({pendingRequests:[]}),setUserConfirmationListenerActive:s=>r({userConfirmationListenerActive:s}),...be(r,a)})));function Te(t){return new Promise((r,a)=>{const n=t.subscribe(s=>s.auth.step,s=>{s==="authenticated"?(n(),r()):s===null&&(n(),a(new Error("Auth flow dismissed")))})})}function Ee(t){var n,s;const r=S.zeroDevWallet(t),a=ve({logo:(n=t.config)==null?void 0:n.logo});return(s=t.config)!=null&&s.auth&&a.getState().auth.initialize(t.config.auth),l=>{const i=r(l);return{...i,async connect(u){var c;try{return await i.connect(u)}catch(p){if(u!=null&&u.isReconnecting||!((c=t.config)!=null&&c.auth)||!(p instanceof S.NotAuthenticatedError))throw p;if(a.getState().auth.step!==null)throw new Error("Auth flow already in progress");return a.getState().auth.goToStep("sign-up"),await Te(a),i.connect(u)}},async disconnect(){var u,c;await((u=i.disconnect)==null?void 0:u.call(i)),(c=t.config)!=null&&c.auth&&a.getState().auth.reset()},async setup(){var u;await((u=i.setup)==null?void 0:u.call(i)),typeof window>"u"},getKitStore(){return a}}}}exports.AuthFlow=we;exports.useAuth=k;exports.zeroDevWallet=Ee;
4
4
  //# sourceMappingURL=index.cjs.map