@authdog/react-elements 0.0.35 → 0.0.36

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @authdog/react-elements@0.0.35 build /home/runner/work/web-sdk/web-sdk/packages/react-elements
2
+ > @authdog/react-elements@0.0.36 build /home/runner/work/web-sdk/web-sdk/packages/react-elements
3
3
  > pnpm tsup && pnpm build:styles
4
4
 
5
5
  CLI Building entry: src/index.ts, src/lib/utils.ts, src/components/ui/alert.tsx, src/components/ui/avatar.tsx, src/components/ui/badge.tsx, src/components/ui/button.tsx, src/components/ui/card.tsx, src/components/ui/dropdown-menu.tsx, src/components/ui/input.tsx, src/components/ui/label.tsx, src/components/ui/separator.tsx, src/components/ui/sheet.tsx
@@ -10,32 +10,7 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 26.75 KB
14
- CJS dist/components/ui/alert.js 1.65 KB
15
- CJS dist/lib/utils.js 620.00 B
16
- CJS dist/components/ui/avatar.js 1.34 KB
17
- CJS dist/components/ui/badge.js 1.78 KB
18
- CJS dist/components/ui/card.js 1.85 KB
19
- CJS dist/components/ui/button.js 1.94 KB
20
- CJS dist/components/ui/dropdown-menu.js 6.10 KB
21
- CJS dist/components/ui/input.js 1.37 KB
22
- CJS dist/components/ui/label.js 1.14 KB
23
- CJS dist/components/ui/sheet.js 3.36 KB
24
- CJS dist/components/ui/separator.js 1.18 KB
25
- CJS dist/index.js.map 77.86 KB
26
- CJS dist/components/ui/alert.js.map 3.01 KB
27
- CJS dist/lib/utils.js.map 520.00 B
28
- CJS dist/components/ui/avatar.js.map 2.31 KB
29
- CJS dist/components/ui/badge.js.map 2.79 KB
30
- CJS dist/components/ui/card.js.map 3.81 KB
31
- CJS dist/components/ui/button.js.map 3.17 KB
32
- CJS dist/components/ui/dropdown-menu.js.map 12.49 KB
33
- CJS dist/components/ui/input.js.map 1.79 KB
34
- CJS dist/components/ui/label.js.map 1.45 KB
35
- CJS dist/components/ui/sheet.js.map 6.75 KB
36
- CJS dist/components/ui/separator.js.map 1.64 KB
37
- CJS ⚡️ Build success in 115ms
38
- ESM dist/index.mjs 24.62 KB
13
+ ESM dist/index.mjs 27.65 KB
39
14
  ESM dist/lib/utils.mjs 166.00 B
40
15
  ESM dist/components/ui/alert.mjs 1.19 KB
41
16
  ESM dist/components/ui/avatar.mjs 749.00 B
@@ -47,8 +22,8 @@
47
22
  ESM dist/components/ui/label.mjs 566.00 B
48
23
  ESM dist/components/ui/separator.mjs 604.00 B
49
24
  ESM dist/components/ui/sheet.mjs 2.68 KB
50
- ESM dist/index.mjs.map 78.35 KB
51
25
  ESM dist/lib/utils.mjs.map 415.00 B
26
+ ESM dist/index.mjs.map 85.68 KB
52
27
  ESM dist/components/ui/alert.mjs.map 2.82 KB
53
28
  ESM dist/components/ui/avatar.mjs.map 2.13 KB
54
29
  ESM dist/components/ui/badge.mjs.map 2.63 KB
@@ -59,12 +34,37 @@
59
34
  ESM dist/components/ui/label.mjs.map 1.32 KB
60
35
  ESM dist/components/ui/separator.mjs.map 1.51 KB
61
36
  ESM dist/components/ui/sheet.mjs.map 6.49 KB
62
- ESM ⚡️ Build success in 128ms
37
+ ESM ⚡️ Build success in 117ms
38
+ CJS dist/index.js 29.95 KB
39
+ CJS dist/lib/utils.js 620.00 B
40
+ CJS dist/components/ui/alert.js 1.65 KB
41
+ CJS dist/components/ui/avatar.js 1.34 KB
42
+ CJS dist/components/ui/badge.js 1.78 KB
43
+ CJS dist/components/ui/card.js 1.85 KB
44
+ CJS dist/components/ui/dropdown-menu.js 6.10 KB
45
+ CJS dist/components/ui/button.js 1.94 KB
46
+ CJS dist/components/ui/input.js 1.37 KB
47
+ CJS dist/components/ui/label.js 1.14 KB
48
+ CJS dist/components/ui/sheet.js 3.36 KB
49
+ CJS dist/components/ui/separator.js 1.18 KB
50
+ CJS dist/index.js.map 85.15 KB
51
+ CJS dist/lib/utils.js.map 520.00 B
52
+ CJS dist/components/ui/alert.js.map 3.01 KB
53
+ CJS dist/components/ui/avatar.js.map 2.31 KB
54
+ CJS dist/components/ui/badge.js.map 2.79 KB
55
+ CJS dist/components/ui/card.js.map 3.81 KB
56
+ CJS dist/components/ui/dropdown-menu.js.map 12.49 KB
57
+ CJS dist/components/ui/button.js.map 3.17 KB
58
+ CJS dist/components/ui/input.js.map 1.79 KB
59
+ CJS dist/components/ui/label.js.map 1.45 KB
60
+ CJS dist/components/ui/sheet.js.map 6.75 KB
61
+ CJS dist/components/ui/separator.js.map 1.64 KB
62
+ CJS ⚡️ Build success in 128ms
63
63
  DTS Build start
64
- DTS ⚡️ Build success in 6250ms
65
- DTS dist/index.d.mts 3.45 KB
66
- DTS dist/index.d.ts 3.45 KB
64
+ DTS ⚡️ Build success in 5973ms
65
+ DTS dist/index.d.mts 3.57 KB
66
+ DTS dist/index.d.ts 3.57 KB
67
67
 
68
- > @authdog/react-elements@0.0.35 build:styles /home/runner/work/web-sdk/web-sdk/packages/react-elements
68
+ > @authdog/react-elements@0.0.36 build:styles /home/runner/work/web-sdk/web-sdk/packages/react-elements
69
69
  > postcss src/global.css -o dist/styles.css
70
70
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @authdog/react-elements
2
2
 
3
+ ## 0.0.36
4
+
5
+ ### Patch Changes
6
+
7
+ - 7d2c857: enhance email management
8
+ - 6f3aa8c: fix display sign out
9
+
3
10
  ## 0.0.35
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -54,8 +54,12 @@ interface UserProfileProps {
54
54
  success: boolean;
55
55
  message?: string;
56
56
  } | void>;
57
+ onAddEmail?: (email: string) => Promise<{
58
+ success: boolean;
59
+ message?: string;
60
+ } | void>;
57
61
  }
58
- declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
62
+ declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, onAddEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
59
63
 
60
64
  type UserDropdownLink = {
61
65
  label: string;
package/dist/index.d.ts CHANGED
@@ -54,8 +54,12 @@ interface UserProfileProps {
54
54
  success: boolean;
55
55
  message?: string;
56
56
  } | void>;
57
+ onAddEmail?: (email: string) => Promise<{
58
+ success: boolean;
59
+ message?: string;
60
+ } | void>;
57
61
  }
58
- declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
62
+ declare const UserProfile: ({ loading, user, handleAuthenticated, onRequestEmailVerification, onVerifyEmail, onAddEmail, }: UserProfileProps) => react_jsx_runtime.JSX.Element;
59
63
 
60
64
  type UserDropdownLink = {
61
65
  label: string;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var Be=Object.create;var $=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var je=(t,o)=>{for(var a in o)$(t,a,{get:o[a],enumerable:!0})},me=(t,o,a,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of Oe(o))!Ue.call(t,d)&&d!==a&&$(t,d,{get:()=>o[d],enumerable:!(l=Ge(o,d))||l.enumerable});return t};var K=(t,o,a)=>(a=t!=null?Be(_e(t)):{},me(o||!t||!t.__esModule?$(a,"default",{value:t,enumerable:!0}):a,t)),Fe=t=>me($({},"__esModule",{value:!0}),t);var Ze={};je(Ze,{Button:()=>P,ClientOnly:()=>be,Navbar:()=>De,PlaceholderAlert:()=>Ee,TOTPValidator:()=>Le,UserDropdown:()=>Te,UserProfile:()=>Ie});module.exports=Fe(Ze);var fe=K(require("react")),ve=require("@radix-ui/react-slot"),ge=require("class-variance-authority");var pe=require("clsx"),ue=require("tailwind-merge");function s(...t){return(0,ue.twMerge)((0,pe.clsx)(t))}var xe=require("react/jsx-runtime"),He=(0,ge.cva)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),P=fe.forwardRef(({className:t,variant:o,size:a,asChild:l=!1,...d},h)=>(0,xe.jsx)(l?ve.Slot:"button",{className:s(He({variant:o,size:a,className:t})),ref:h,...d}));P.displayName="Button";var W=require("react"),q=require("react/jsx-runtime"),be=({children:t})=>{let[o,a]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{a(!0)},[]),o?(0,q.jsx)(q.Fragment,{children:t}):null};var ke=require("react"),G=require("lucide-react");var A=K(require("@radix-ui/react-avatar"));var X=require("react/jsx-runtime");function V({className:t,...o}){return(0,X.jsx)(A.Root,{"data-slot":"avatar",className:s("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...o})}function z({className:t,...o}){return(0,X.jsx)(A.Image,{"data-slot":"avatar-image",className:s("aspect-square size-full",t),...o})}function E({className:t,...o}){return(0,X.jsx)(A.Fallback,{"data-slot":"avatar-fallback",className:s("bg-muted flex size-full items-center justify-center rounded-full",t),...o})}var m=K(require("@radix-ui/react-dropdown-menu")),de=require("lucide-react");var C=require("react/jsx-runtime");function Y({...t}){return(0,C.jsx)(m.Root,{"data-slot":"dropdown-menu",...t})}function J({...t}){return(0,C.jsx)(m.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function Q({className:t,sideOffset:o=4,...a}){return(0,C.jsx)(m.Portal,{children:(0,C.jsx)(m.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:s("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...a})})}function he({...t}){return(0,C.jsx)(m.Group,{"data-slot":"dropdown-menu-group",...t})}function R({className:t,inset:o,variant:a="default",...l}){return(0,C.jsx)(m.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:s("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l})}function ye({className:t,inset:o,...a}){return(0,C.jsx)(m.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:s("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...a})}function L({className:t,...o}){return(0,C.jsx)(m.Separator,{"data-slot":"dropdown-menu-separator",className:s("bg-border -mx-1 my-1 h-px",t),...o})}var f=K(require("@radix-ui/react-dialog")),we=require("lucide-react");var b=require("react/jsx-runtime"),$e=we.X;function Ne({...t}){return(0,b.jsx)(f.Root,{"data-slot":"sheet",...t})}function Pe({...t}){return(0,b.jsx)(f.Trigger,{"data-slot":"sheet-trigger",...t})}function Ke({...t}){return(0,b.jsx)(f.Portal,{"data-slot":"sheet-portal",...t})}function We({className:t,...o}){return(0,b.jsx)(f.Overlay,{"data-slot":"sheet-overlay",className:s("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...o})}function Ce({className:t,children:o,side:a="right",...l}){return(0,b.jsxs)(Ke,{children:[(0,b.jsx)(We,{}),(0,b.jsxs)(f.Content,{"data-slot":"sheet-content",className:s("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",a==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",a==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",a==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",a==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...l,children:[o,(0,b.jsxs)(f.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,b.jsx)($e,{className:"size-4"}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ee=require("react"),Z=require("react/jsx-runtime"),qe={className:"mr-2 h-4 w-4","aria-hidden":"true"},Xe=t=>{let[o,a]=(0,ee.useState)(!1);return(0,ee.useEffect)(()=>{a(!0)},[]),o?(0,Z.jsx)(t,{...qe}):(0,Z.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},B=({Icon:t})=>(0,Z.jsx)("span",{className:"inline-flex items-center justify-center",children:Xe(t)});var r=require("react/jsx-runtime");function De({items:t=[],children:o,className:a,logoText:l="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:h=()=>console.log("Navigating to home"),onNavItemClick:x=k=>console.log(`Navigating to ${k}`),onProfileSelected:v,onLogout:y=()=>console.log("Logout clicked"),isLoading:g=!1,identityHost:w="https://stg-id.authdog.xyz",environmentId:D="58be35b0-708f-49f6-84f0-6695d307d997"}){let[k,M]=(0,ke.useState)(!1),u=d!=null&&d.id!==null&&d.id!==void 0;return(0,r.jsx)("header",{className:s("border-b bg-background",a),children:(0,r.jsxs)("div",{className:"container flex h-16 items-center justify-between px-4 md:px-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("span",{className:"text-xl font-bold cursor-pointer",onClick:h,children:l}),(0,r.jsx)("nav",{className:"hidden md:flex gap-6",children:t?.map((n,c)=>(0,r.jsx)("span",{onClick:()=>{n.disabled||x(n.href)},className:s("text-sm font-medium transition-colors hover:text-primary cursor-pointer",n.disabled&&"cursor-not-allowed opacity-80"),children:n.title},c))})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[o,u?(0,r.jsxs)(Y,{children:[(0,r.jsx)(J,{asChild:!0,children:(0,r.jsx)(P,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:g,children:(0,r.jsx)(V,{className:"h-8 w-8",children:g?(0,r.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(z,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,r.jsx)(E,{children:d.displayName?.charAt(0)})]})})})}),(0,r.jsx)(Q,{className:"w-56",align:"end",forceMount:!0,children:g?(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,r.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ye,{className:"font-normal",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium leading-none",children:d.displayName}),(0,r.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:d.emails?.[0]?.value})]})}),(0,r.jsx)(L,{}),(0,r.jsx)(he,{children:(0,r.jsxs)(R,{onClick:v,children:[(0,r.jsx)(B,{Icon:G.User}),(0,r.jsx)("span",{children:"Profile"})]})}),(0,r.jsx)(L,{}),(0,r.jsxs)(R,{onClick:y,children:[(0,r.jsx)(B,{Icon:G.LogOut}),(0,r.jsx)("span",{children:"Log out"})]})]})})]}):(0,r.jsx)(P,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!D)throw new Error("Environment ID is required");if(!w)throw new Error("Identity Host is required");let n=`${w}/signin/${D}`;window.open(n,"_blank")},children:"Sign in"}),(0,r.jsxs)(Ne,{open:k,onOpenChange:M,children:[(0,r.jsx)(Pe,{asChild:!0,children:(0,r.jsx)(P,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,r.jsx)(B,{Icon:G.Menu})})}),(0,r.jsx)(Ce,{side:"left",className:"pr-0",children:(0,r.jsx)("nav",{className:"grid gap-2 py-6",children:t?.map((n,c)=>(0,r.jsx)("a",{href:n.href,className:s("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",n.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>M(!1),children:n.title},c))})})]})]})]})})}var S=require("react");var Me=require("@radix-ui/react-slot"),Se=require("class-variance-authority");var Re=require("react/jsx-runtime"),Ye=(0,Se.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function te({className:t,variant:o,asChild:a=!1,...l}){return(0,Re.jsx)(a?Me.Slot:"span",{"data-slot":"badge",className:s(Ye({variant:o}),t),...l})}var O=require("lucide-react"),e=require("react/jsx-runtime"),Ie=({loading:t,user:o,handleAuthenticated:a,onRequestEmailVerification:l,onVerifyEmail:d})=>{let[h,x]=(0,S.useState)(!1),[v,y]=(0,S.useState)("profile"),[g,w]=(0,S.useState)(null),[D,k]=(0,S.useState)({});(0,S.useEffect)(()=>{x(!0)},[]),(0,S.useEffect)(()=>{!t&&a&&a()},[t,o,a]);let M={className:"mr-2 h-4 w-4","aria-hidden":"true"},u=n=>h?(0,e.jsx)(n,{...M}):null;return!h||t?(0,e.jsx)("div",{children:"Loading..."}):o?(0,e.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,e.jsxs)("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,e.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),(0,e.jsxs)("nav",{className:"space-y-1 flex-1",children:[(0,e.jsxs)("button",{onClick:()=>y("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.User),"Profile"]}),(0,e.jsxs)("button",{onClick:()=>y("security"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="security"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.Shield),"Security"]}),(0,e.jsxs)("button",{onClick:()=>y("preferences"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="preferences"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[u(O.SlidersHorizontal),"Preferences"]})]})]}),(0,e.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,e.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,e.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:v==="profile"?"Profile details":v==="security"?"Security settings":"Preferences"})}),v==="profile"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),(0,e.jsx)("div",{className:"flex items-center justify-between",children:(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)(V,{className:"h-12 w-12 mr-4 border",children:[(0,e.jsx)(z,{src:o.photos?.[0]?.value,alt:"Profile picture"}),(0,e.jsx)(E,{children:o.displayName?.split(" ").map(n=>n[0]).join("")})]}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:o.displayName})]})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),(0,e.jsx)("div",{className:"space-y-2.5",children:o.emails.map((n,c)=>{let j=(o?.verifications||[]).find(H=>H.email===n.value)?.verified===!0,F=D[n.value]||"";return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("span",{className:"text-foreground",children:n.value}),(0,e.jsx)("div",{className:"mt-1",children:j?(0,e.jsx)(te,{className:"text-xs bg-green-600 text-white border-green-700 dark:bg-green-500 dark:text-white dark:border-green-600",children:"Verified"}):(0,e.jsx)(te,{className:"text-xs bg-amber-500 text-white border-amber-600 dark:bg-amber-500 dark:text-white dark:border-amber-600",children:"Not verified"})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[c===0&&(0,e.jsx)(te,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!j&&(0,e.jsx)(e.Fragment,{children:g===n.value?(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:F,onChange:H=>k(se=>({...se,[n.value]:H.target.value}))}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{d&&await d(n.value,F)},children:"Verify"}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>w(null),children:"Cancel"})]}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{l&&await l(n.value),w(n.value)},children:"Send code"})})})]})]},n.value)})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,e.jsx)("div",{className:"space-y-2.5",children:(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("div",{className:"flex items-center",children:(0,e.jsx)("div",{className:"mr-2",children:(0,e.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:o.provider})})}),(0,e.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:o?.emails?.[0]?.value})]},o.provider)})]})]}):v==="security"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),(0,e.jsxs)("div",{className:"border rounded-md overflow-hidden",children:[(0,e.jsx)("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),(0,e.jsx)("div",{className:"p-4 space-y-3",children:(0,e.jsxs)("div",{className:"text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),(0,e.jsx)("span",{className:"font-medium",children:"X11"}),(0,e.jsx)("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),(0,e.jsx)("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):(0,e.jsx)("div",{className:"space-y-5 md:space-y-6",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):(0,e.jsx)("div",{children:"No user"})};var _=require("lucide-react"),p=require("react/jsx-runtime"),Je=t=>t&&String(t).trim().split(/\s+/).slice(0,2).map(l=>l[0]?.toUpperCase()).join("")||"?",Te=({trigger:t,user:o,className:a,onManageAccount:l,onSignout:d,links:h=[],side:x="bottom",align:v="end",sideOffset:y=8})=>{let g=o?.emails?.[0]?.value||o?.email||"",w=o?.displayName||o?.name||"",D=o?.photos?.[0]?.value||o?.avatar||"",k=u=>{if(u.onClick)return u.onClick();u.href&&(u.href.startsWith("http")?window.open(u.href,"_blank"):window.location.assign(u.href))},M=_.ExternalLink;return(0,p.jsxs)(Y,{children:[(0,p.jsx)(J,{className:"inline-flex items-center justify-center h-10 w-10 rounded-full focus:outline-none",children:t}),(0,p.jsxs)(Q,{align:v,side:x,sideOffset:y,className:s("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",a),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,p.jsxs)(V,{className:"h-9 w-9 rounded-full",children:[(0,p.jsx)(z,{src:D,alt:w}),(0,p.jsx)(E,{className:"rounded-full",children:Je(w)})]}),(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsx)("div",{className:"text-sm font-semibold truncate",children:w}),(0,p.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g})]})]}),(0,p.jsx)(L,{}),(0,p.jsxs)(R,{className:"cursor-pointer py-2",onClick:()=>l?.(),children:[(0,p.jsx)(_.Settings,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Manage account"})]}),h.map((u,n)=>{let c=u.icon??M;return(0,p.jsxs)(R,{className:"cursor-pointer py-2",onClick:()=>k(u),children:[(0,p.jsx)(c,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:u.label})]},`${u.label}-${n}`)}),(0,p.jsx)(L,{}),(0,p.jsxs)(R,{className:"cursor-pointer text-red-600 focus:text-red-700 py-2",onClick:()=>d?.(),children:[(0,p.jsx)(_.LogOut,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Sign out"})]})]})]})};var ze=require("lucide-react");var Ae=require("class-variance-authority");var ae=require("react/jsx-runtime"),Qe=(0,Ae.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function oe({className:t,variant:o,...a}){return(0,ae.jsx)("div",{"data-slot":"alert",role:"alert",className:s(Qe({variant:o}),t),...a})}function Ve({className:t,...o}){return(0,ae.jsx)("div",{"data-slot":"alert-title",className:s("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...o})}function re({className:t,...o}){return(0,ae.jsx)("div",{"data-slot":"alert-description",className:s("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...o})}var I=require("react/jsx-runtime"),Ee=t=>{let o=t.title??"Placeholder Alert",a=t.description??"This is a placeholder alert.";return(0,I.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,I.jsxs)(oe,{children:[(0,I.jsx)(B,{Icon:ze.CheckCircle2Icon}),(0,I.jsx)(Ve,{children:o}),(0,I.jsx)(re,{children:a})]})})};var T=require("react");var le=require("react/jsx-runtime");function ne({className:t,...o}){return(0,le.jsx)("div",{"data-slot":"card",className:s("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...o})}function ie({className:t,...o}){return(0,le.jsx)("div",{"data-slot":"card-content",className:s("px-6",t),...o})}var U=require("lucide-react"),i=require("react/jsx-runtime"),Le=({onValidate:t})=>{let[o,a]=(0,T.useState)(["","","","","",""]),[l,d]=(0,T.useState)(!1),[h,x]=(0,T.useState)(""),[v,y]=(0,T.useState)(!1),g=(0,T.useRef)([]),w=(n,c)=>{if(!/^\d*$/.test(c))return;let N=[...o];N[n]=c.slice(-1),a(N),x(""),y(!1),c&&n<5&&g.current[n+1]?.focus()},D=(n,c)=>{c.key==="Backspace"&&!o[n]&&n>0&&g.current[n-1]?.focus(),c.key==="v"&&(c.ctrlKey||c.metaKey)&&(c.preventDefault(),navigator.clipboard.readText().then(N=>{let j=N.replace(/\D/g,"").slice(0,6).split(""),F=[...o];j.forEach((se,ce)=>{ce<6&&(F[ce]=se)}),a(F);let H=Math.min(j.length,5);g.current[H]?.focus()}))},k=async()=>{let n=o.join("");if(n.length!==6){x("Please enter all 6 digits");return}d(!0),x("");try{await t(n),y(!0)}catch{x("Invalid TOTP code. Please try again.")}finally{d(!1)}},M=n=>{n.preventDefault(),k()},u=()=>{a(["","","","","",""]),x(""),y(!1),d(!1),g.current[0]?.focus()};return v?(0,i.jsx)("div",{className:"max-w-md mx-auto",children:(0,i.jsx)(ne,{className:"border-green-200 bg-green-50",children:(0,i.jsx)(ie,{className:"pt-6",children:(0,i.jsxs)("div",{className:"text-center space-y-4",children:[(0,i.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,i.jsx)(U.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,i.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,i.jsx)(P,{onClick:u,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,i.jsx)("div",{className:"max-w-md mx-auto",children:(0,i.jsx)(ne,{children:(0,i.jsx)(ie,{className:"pt-6",children:(0,i.jsxs)("div",{className:"text-center space-y-6",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,i.jsx)(U.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,i.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,i.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,i.jsxs)("form",{onSubmit:M,className:"space-y-6",children:[(0,i.jsx)("div",{className:"flex justify-center gap-2",children:o.map((n,c)=>(0,i.jsx)(ne,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,i.jsx)(ie,{className:"p-0 h-full flex items-center justify-center",children:(0,i.jsx)("input",{ref:N=>{g.current[c]=N},type:"tel",inputMode:"numeric",maxLength:1,value:n,onChange:N=>w(c,N.target.value),onKeyDown:N=>D(c,N),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:l,style:{height:"auto"}})})},c))}),h&&(0,i.jsxs)(oe,{variant:"destructive",children:[(0,i.jsx)(U.AlertCircle,{className:"h-4 w-4"}),(0,i.jsx)(re,{children:h})]}),(0,i.jsxs)("div",{className:"space-y-3",children:[(0,i.jsx)(P,{type:"submit",className:"w-full",disabled:l||o.some(n=>n===""),children:l?"Verifying...":"Verify Code"}),(0,i.jsx)(P,{type:"button",variant:"ghost",size:"sm",onClick:u,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,i.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
2
+ "use strict";var Ye=Object.create;var Y=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ze=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(t,o)=>{for(var r in o)Y(t,r,{get:o[r],enumerable:!0})},fe=(t,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of Qe(o))!et.call(t,d)&&d!==r&&Y(t,d,{get:()=>o[d],enumerable:!(c=Je(o,d))||c.enumerable});return t};var q=(t,o,r)=>(r=t!=null?Ye(Ze(t)):{},fe(o||!t||!t.__esModule?Y(r,"default",{value:t,enumerable:!0}):r,t)),ot=t=>fe(Y({},"__esModule",{value:!0}),t);var pt={};tt(pt,{Button:()=>x,ClientOnly:()=>we,Navbar:()=>Re,PlaceholderAlert:()=>We,TOTPValidator:()=>qe,UserDropdown:()=>je,UserProfile:()=>Ue});module.exports=ot(pt);var be=q(require("react")),xe=require("@radix-ui/react-slot"),he=require("class-variance-authority");var ve=require("clsx"),ge=require("tailwind-merge");function n(...t){return(0,ge.twMerge)((0,ve.clsx)(t))}var ye=require("react/jsx-runtime"),rt=(0,he.cva)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),x=be.forwardRef(({className:t,variant:o,size:r,asChild:c=!1,...d},y)=>(0,ye.jsx)(c?xe.Slot:"button",{className:n(rt({variant:o,size:r,className:t})),ref:y,...d}));x.displayName="Button";var J=require("react"),Q=require("react/jsx-runtime"),we=({children:t})=>{let[o,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{r(!0)},[]),o?(0,Q.jsx)(Q.Fragment,{children:t}):null};var Se=require("react"),U=require("lucide-react");var z=q(require("@radix-ui/react-avatar"));var Z=require("react/jsx-runtime");function B({className:t,...o}){return(0,Z.jsx)(z.Root,{"data-slot":"avatar",className:n("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...o})}function G({className:t,...o}){return(0,Z.jsx)(z.Image,{"data-slot":"avatar-image",className:n("aspect-square size-full",t),...o})}function O({className:t,...o}){return(0,Z.jsx)(z.Fallback,{"data-slot":"avatar-fallback",className:n("bg-muted flex size-full items-center justify-center rounded-full",t),...o})}var m=q(require("@radix-ui/react-dropdown-menu")),me=require("lucide-react");var P=require("react/jsx-runtime");function ee({...t}){return(0,P.jsx)(m.Root,{"data-slot":"dropdown-menu",...t})}function te({...t}){return(0,P.jsx)(m.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function oe({className:t,sideOffset:o=4,...r}){return(0,P.jsx)(m.Portal,{children:(0,P.jsx)(m.Content,{"data-slot":"dropdown-menu-content",sideOffset:o,className:n("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function Ne({...t}){return(0,P.jsx)(m.Group,{"data-slot":"dropdown-menu-group",...t})}function I({className:t,inset:o,variant:r="default",...c}){return(0,P.jsx)(m.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:n("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...c})}function Ce({className:t,inset:o,...r}){return(0,P.jsx)(m.Label,{"data-slot":"dropdown-menu-label","data-inset":o,className:n("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function F({className:t,...o}){return(0,P.jsx)(m.Separator,{"data-slot":"dropdown-menu-separator",className:n("bg-border -mx-1 my-1 h-px",t),...o})}var h=q(require("@radix-ui/react-dialog")),Pe=require("lucide-react");var N=require("react/jsx-runtime"),at=Pe.X;function ke({...t}){return(0,N.jsx)(h.Root,{"data-slot":"sheet",...t})}function De({...t}){return(0,N.jsx)(h.Trigger,{"data-slot":"sheet-trigger",...t})}function nt({...t}){return(0,N.jsx)(h.Portal,{"data-slot":"sheet-portal",...t})}function it({className:t,...o}){return(0,N.jsx)(h.Overlay,{"data-slot":"sheet-overlay",className:n("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...o})}function Me({className:t,children:o,side:r="right",...c}){return(0,N.jsxs)(nt,{children:[(0,N.jsx)(it,{}),(0,N.jsxs)(h.Content,{"data-slot":"sheet-content",className:n("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",t),...c,children:[o,(0,N.jsxs)(h.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,N.jsx)(at,{className:"size-4"}),(0,N.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var ae=require("react"),re=require("react/jsx-runtime"),st={className:"mr-2 h-4 w-4","aria-hidden":"true"},dt=t=>{let[o,r]=(0,ae.useState)(!1);return(0,ae.useEffect)(()=>{r(!0)},[]),o?(0,re.jsx)(t,{...st}):(0,re.jsx)("span",{className:"mr-2 h-4 w-4","aria-hidden":"true"})},_=({Icon:t})=>(0,re.jsx)("span",{className:"inline-flex items-center justify-center",children:dt(t)});var a=require("react/jsx-runtime");function Re({items:t=[],children:o,className:r,logoText:c="ACME Corp",user:d={name:"John Doe",email:"john@example.com",image:"https://i.pravatar.cc/150?u=a042581f4e29026704d"},onNavigateHome:y=()=>console.log("Navigating to home"),onNavItemClick:w=M=>console.log(`Navigating to ${M}`),onProfileSelected:R,onLogout:v=()=>console.log("Logout clicked"),isLoading:g=!1,identityHost:C="https://stg-id.authdog.xyz",environmentId:D="58be35b0-708f-49f6-84f0-6695d307d997"}){let[M,S]=(0,Se.useState)(!1),f=d!=null&&d.id!==null&&d.id!==void 0;return(0,a.jsx)("header",{className:n("border-b bg-background",r),children:(0,a.jsxs)("div",{className:"container flex h-16 items-center justify-between px-4 md:px-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("span",{className:"text-xl font-bold cursor-pointer",onClick:y,children:c}),(0,a.jsx)("nav",{className:"hidden md:flex gap-6",children:t?.map((i,l)=>(0,a.jsx)("span",{onClick:()=>{i.disabled||w(i.href)},className:n("text-sm font-medium transition-colors hover:text-primary cursor-pointer",i.disabled&&"cursor-not-allowed opacity-80"),children:i.title},l))})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[o,f?(0,a.jsxs)(ee,{children:[(0,a.jsx)(te,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",className:"relative h-8 w-8 rounded-full",disabled:g,children:(0,a.jsx)(B,{className:"h-8 w-8",children:g?(0,a.jsx)("div",{className:"h-8 w-8 animate-pulse bg-muted rounded-full"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(G,{src:d.photos?.[0]?.value||"/placeholder.svg",alt:d.displayName}),(0,a.jsx)(O,{children:d.displayName?.charAt(0)})]})})})}),(0,a.jsx)(oe,{className:"w-56",align:"end",forceMount:!0,children:g?(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsx)("div",{className:"h-4 w-3/4 animate-pulse bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-3 w-1/2 animate-pulse bg-muted rounded"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Ce,{className:"font-normal",children:(0,a.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,a.jsx)("p",{className:"text-sm font-medium leading-none",children:d.displayName}),(0,a.jsx)("p",{className:"text-xs leading-none text-muted-foreground",children:d.emails?.[0]?.value})]})}),(0,a.jsx)(F,{}),(0,a.jsx)(Ne,{children:(0,a.jsxs)(I,{onClick:R,children:[(0,a.jsx)(_,{Icon:U.User}),(0,a.jsx)("span",{children:"Profile"})]})}),(0,a.jsx)(F,{}),(0,a.jsxs)(I,{onClick:v,children:[(0,a.jsx)(_,{Icon:U.LogOut}),(0,a.jsx)("span",{children:"Log out"})]})]})})]}):(0,a.jsx)(x,{variant:"default","aria-label":"Sign in",onClick:()=>{if(!D)throw new Error("Environment ID is required");if(!C)throw new Error("Identity Host is required");let i=`${C}/signin/${D}`;window.open(i,"_blank")},children:"Sign in"}),(0,a.jsxs)(ke,{open:M,onOpenChange:S,children:[(0,a.jsx)(De,{asChild:!0,children:(0,a.jsx)(x,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open Menu",children:(0,a.jsx)(_,{Icon:U.Menu})})}),(0,a.jsx)(Me,{side:"left",className:"pr-0",children:(0,a.jsx)("nav",{className:"grid gap-2 py-6",children:t?.map((i,l)=>(0,a.jsx)("a",{href:i.href,className:n("flex w-full items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent",i.disabled&&"cursor-not-allowed opacity-80"),onClick:()=>S(!1),children:i.title},l))})})]})]})]})})}var k=require("react");var Ie=require("@radix-ui/react-slot"),Te=require("class-variance-authority");var Ae=require("react/jsx-runtime"),lt=(0,Te.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function ne({className:t,variant:o,asChild:r=!1,...c}){return(0,Ae.jsx)(r?Ie.Slot:"span",{"data-slot":"badge",className:n(lt({variant:o}),t),...c})}var T=require("react/jsx-runtime");function j({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card",className:n("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...o})}function Ve({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-header",className:n("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...o})}function Le({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-title",className:n("leading-none font-semibold",t),...o})}function Ee({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-description",className:n("text-muted-foreground text-sm",t),...o})}function H({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-content",className:n("px-6",t),...o})}function ze({className:t,...o}){return(0,T.jsx)("div",{"data-slot":"card-footer",className:n("flex items-center px-6 [.border-t]:pt-6",t),...o})}var Ge=require("react/jsx-runtime");function Be({className:t,type:o,...r}){return(0,Ge.jsx)("input",{type:o,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...r})}var Oe=q(require("@radix-ui/react-label"));var _e=require("react/jsx-runtime");function Fe({className:t,...o}){return(0,_e.jsx)(Oe.Root,{"data-slot":"label",className:n("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...o})}var $=require("lucide-react"),e=require("react/jsx-runtime"),Ue=({loading:t,user:o,handleAuthenticated:r,onRequestEmailVerification:c,onVerifyEmail:d,onAddEmail:y})=>{let[w,R]=(0,k.useState)(!1),[v,g]=(0,k.useState)("profile"),[C,D]=(0,k.useState)(null),[M,S]=(0,k.useState)({}),[f,i]=(0,k.useState)(!1),[l,b]=(0,k.useState)("");(0,k.useEffect)(()=>{R(!0)},[]),(0,k.useEffect)(()=>{!t&&r&&r()},[t,o,r]);let X={className:"mr-2 h-4 w-4","aria-hidden":"true"},L=u=>w?(0,e.jsx)(u,{...X}):null;return!w||t?(0,e.jsx)("div",{children:"Loading..."}):o?(0,e.jsxs)("div",{className:"grid grid-cols-[14rem,1fr] w-full bg-transparent",children:[(0,e.jsxs)("div",{className:"h-full border-r border-border p-3 md:p-4 bg-transparent flex flex-col min-w-0",children:[(0,e.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Account"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Manage your account info."})]}),(0,e.jsxs)("nav",{className:"space-y-1 flex-1",children:[(0,e.jsxs)("button",{onClick:()=>g("profile"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="profile"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[L($.User),"Profile"]}),(0,e.jsxs)("button",{onClick:()=>g("security"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="security"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[L($.Shield),"Security"]}),(0,e.jsxs)("button",{onClick:()=>g("preferences"),className:`flex items-center w-full px-3 py-2 text-sm rounded-md ${v==="preferences"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:[L($.SlidersHorizontal),"Preferences"]})]})]}),(0,e.jsxs)("div",{className:"h-full p-3 md:p-5 min-w-0 bg-transparent",children:[(0,e.jsx)("div",{className:"flex justify-between items-center mb-3 md:mb-4",children:(0,e.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:v==="profile"?"Profile details":v==="security"?"Security settings":"Preferences"})}),v==="profile"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Profile"}),(0,e.jsx)("div",{className:"flex items-center justify-between",children:(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)(B,{className:"h-12 w-12 mr-4 border",children:[(0,e.jsx)(G,{src:o.photos?.[0]?.value,alt:"Profile picture"}),(0,e.jsx)(O,{children:o.displayName?.split(" ").map(u=>u[0]).join("")})]}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:o.displayName})]})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-foreground",children:"Email addresses"}),(0,e.jsxs)("div",{className:"space-y-2.5",children:[o.emails.map((u,E)=>{let pe=(o?.verifications||[]).find(ce=>ce.email===u.value)?.verified===!0,ue=M[u.value]||"";return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsx)("span",{className:"text-foreground",children:u.value}),(0,e.jsx)("div",{className:"mt-1",children:pe?(0,e.jsx)(ne,{className:"text-xs rounded-full px-2.5 py-0.5 bg-green-100 text-green-800 border border-green-300 dark:bg-green-500/20 dark:text-green-200 dark:border-green-400/40",children:"Verified"}):(0,e.jsx)(ne,{className:"text-xs rounded-full px-2.5 py-0.5 bg-amber-100 text-amber-800 border border-amber-300 dark:bg-amber-500/20 dark:text-amber-200 dark:border-amber-400/40",children:"Not verified"})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[E===0&&(0,e.jsx)(ne,{variant:"outline",className:"text-xs bg-muted text-foreground hover:bg-muted",children:"Primary"}),!pe&&(0,e.jsx)(e.Fragment,{children:C===u.value?(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{className:"h-7 w-24 text-sm rounded-md border border-border bg-background px-2 text-foreground",placeholder:"Code",value:ue,onChange:ce=>S(Xe=>({...Xe,[u.value]:ce.target.value}))}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{d&&await d(u.value,ue)},children:"Verify"}),(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:()=>D(null),children:"Cancel"})]}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("button",{className:"h-7 rounded-md border border-border px-2 text-xs",onClick:async()=>{c&&await c(u.value),D(u.value)},children:"Send code"})})})]})]},u.value)}),(0,e.jsx)("div",{className:"mt-2",children:f?(0,e.jsx)("div",{className:"max-w-md",children:(0,e.jsxs)(j,{children:[(0,e.jsxs)(Ve,{children:[(0,e.jsx)(Le,{children:"Add email address"}),(0,e.jsx)(Ee,{children:"You'll need to verify this email address before it can be added to your account."})]}),(0,e.jsx)(H,{children:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Fe,{htmlFor:"new-email",children:"Email address"}),(0,e.jsx)(Be,{id:"new-email",placeholder:"Enter your email address",value:l,onChange:u=>b(u.target.value),onKeyDown:async u=>{if(u.key==="Enter"){let E=String(l||"").trim().toLowerCase();if(!E)return;y&&await y(E),i(!1),b("")}}})]})}),(0,e.jsxs)(ze,{className:"justify-end gap-2",children:[(0,e.jsx)(x,{variant:"ghost",onClick:()=>{i(!1),b("")},children:"Cancel"}),(0,e.jsx)(x,{onClick:async()=>{let u=String(l||"").trim().toLowerCase();u&&(y&&await y(u),i(!1),b(""))},children:"Add"})]})]})}):(0,e.jsx)(x,{variant:"outline",size:"sm",className:"text-xs",onClick:()=>i(!0),children:"Add email"})})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Connected accounts"}),(0,e.jsx)("div",{className:"space-y-2.5",children:(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("div",{className:"flex items-center",children:(0,e.jsx)("div",{className:"mr-2",children:(0,e.jsx)("span",{className:"text-gray-900 dark:text-gray-100",children:o.provider})})}),(0,e.jsx)("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:o?.emails?.[0]?.value})]},o.provider)})]})]}):v==="security"?(0,e.jsxs)("div",{className:"space-y-5 md:space-y-6",children:[(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Password"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"Set password"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Passkeys"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add a passkey"})]})}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Two-step verification"}),(0,e.jsx)("button",{className:"text-sm text-indigo-600 hover:underline",children:"+\xA0Add two-step verification"})]})}),(0,e.jsxs)("div",{className:"border rounded-md overflow-hidden",children:[(0,e.jsx)("div",{className:"px-4 py-3 border-b text-sm font-medium text-gray-900 dark:text-gray-100",children:"Active devices"}),(0,e.jsx)("div",{className:"p-4 space-y-3",children:(0,e.jsxs)("div",{className:"text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"inline-block h-5 w-5 rounded-sm bg-gray-900 dark:bg-white"}),(0,e.jsx)("span",{className:"font-medium",children:"X11"}),(0,e.jsx)("span",{className:"text-xs rounded-md border px-2 py-0.5 text-gray-600 dark:text-gray-300",children:"This device"})]}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Firefox 142.0"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"127.0.0.1 (Local), (Your City)"}),(0,e.jsx)("div",{className:"text-gray-600 dark:text-gray-400",children:"Today at 7:08 PM"})]})})]}),(0,e.jsx)("div",{className:"border rounded-md overflow-hidden",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,e.jsx)("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Delete account"}),(0,e.jsx)("button",{className:"text-sm text-red-600 hover:underline",children:"Delete account"})]})})]}):(0,e.jsx)("div",{className:"space-y-5 md:space-y-6",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-medium mb-3 text-gray-900 dark:text-gray-100",children:"Preferences"}),(0,e.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Locale"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Auto"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-gray-700 dark:text-gray-300",children:"Theme"}),(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"System"})]})]})]})})]})]}):(0,e.jsx)("div",{children:"No user"})};var K=require("lucide-react"),p=require("react/jsx-runtime"),ct=t=>t&&String(t).trim().split(/\s+/).slice(0,2).map(c=>c[0]?.toUpperCase()).join("")||"?",je=({trigger:t,user:o,className:r,onManageAccount:c,onSignout:d,links:y=[],side:w="bottom",align:R="end",sideOffset:v=8})=>{let g=o?.emails?.[0]?.value||o?.email||"",C=o?.displayName||o?.name||"",D=o?.photos?.[0]?.value||o?.avatar||"",M=f=>{if(f.onClick)return f.onClick();f.href&&(f.href.startsWith("http")?window.open(f.href,"_blank"):window.location.assign(f.href))},S=K.ExternalLink;return(0,p.jsxs)(ee,{children:[(0,p.jsx)(te,{className:"inline-flex items-center justify-center h-10 w-10 rounded-full focus:outline-none",children:t}),(0,p.jsxs)(oe,{align:R,side:w,sideOffset:v,className:n("w-72 p-2 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",r),children:[(0,p.jsxs)("div",{className:"flex items-center gap-3 px-4 pt-4 pb-3",children:[(0,p.jsxs)(B,{className:"h-9 w-9 rounded-full",children:[(0,p.jsx)(G,{src:D,alt:C}),(0,p.jsx)(O,{className:"rounded-full",children:ct(C)})]}),(0,p.jsxs)("div",{className:"min-w-0",children:[(0,p.jsx)("div",{className:"text-sm font-semibold truncate",children:C}),(0,p.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:g})]})]}),(0,p.jsx)(F,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>c?.(),children:[(0,p.jsx)(K.Settings,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:"Manage account"})]}),y.map((f,i)=>{let l=f.icon??S;return(0,p.jsxs)(I,{className:"cursor-pointer py-2",onClick:()=>M(f),children:[(0,p.jsx)(l,{className:"mr-2 h-4 w-4"}),(0,p.jsx)("span",{children:f.label})]},`${f.label}-${i}`)}),(0,p.jsx)(F,{}),(0,p.jsxs)(I,{className:"cursor-pointer py-2 rounded-md font-semibold text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-950/40 hover:text-red-700 dark:hover:text-red-300 focus:bg-red-50 dark:focus:bg-red-950/40 focus:text-red-700 dark:focus:text-red-300",onClick:()=>d?.(),children:[(0,p.jsx)(K.LogOut,{className:"mr-2 h-4 w-4 text-red-600 dark:text-red-400"}),(0,p.jsx)("span",{children:"Sign out"})]})]})]})};var Ke=require("lucide-react");var He=require("class-variance-authority");var de=require("react/jsx-runtime"),mt=(0,He.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function ie({className:t,variant:o,...r}){return(0,de.jsx)("div",{"data-slot":"alert",role:"alert",className:n(mt({variant:o}),t),...r})}function $e({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"alert-title",className:n("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...o})}function se({className:t,...o}){return(0,de.jsx)("div",{"data-slot":"alert-description",className:n("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...o})}var A=require("react/jsx-runtime"),We=t=>{let o=t.title??"Placeholder Alert",r=t.description??"This is a placeholder alert.";return(0,A.jsx)("div",{className:"grid w-full max-w-xl items-start gap-4",children:(0,A.jsxs)(ie,{children:[(0,A.jsx)(_,{Icon:Ke.CheckCircle2Icon}),(0,A.jsx)($e,{children:o}),(0,A.jsx)(se,{children:r})]})})};var V=require("react");var W=require("lucide-react"),s=require("react/jsx-runtime"),qe=({onValidate:t})=>{let[o,r]=(0,V.useState)(["","","","","",""]),[c,d]=(0,V.useState)(!1),[y,w]=(0,V.useState)(""),[R,v]=(0,V.useState)(!1),g=(0,V.useRef)([]),C=(i,l)=>{if(!/^\d*$/.test(l))return;let b=[...o];b[i]=l.slice(-1),r(b),w(""),v(!1),l&&i<5&&g.current[i+1]?.focus()},D=(i,l)=>{l.key==="Backspace"&&!o[i]&&i>0&&g.current[i-1]?.focus(),l.key==="v"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),navigator.clipboard.readText().then(b=>{let X=b.replace(/\D/g,"").slice(0,6).split(""),L=[...o];X.forEach((E,le)=>{le<6&&(L[le]=E)}),r(L);let u=Math.min(X.length,5);g.current[u]?.focus()}))},M=async()=>{let i=o.join("");if(i.length!==6){w("Please enter all 6 digits");return}d(!0),w("");try{await t(i),v(!0)}catch{w("Invalid TOTP code. Please try again.")}finally{d(!1)}},S=i=>{i.preventDefault(),M()},f=()=>{r(["","","","","",""]),w(""),v(!1),d(!1),g.current[0]?.focus()};return R?(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(j,{className:"border-green-200 bg-green-50",children:(0,s.jsx)(H,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center",children:(0,s.jsx)(W.CheckCircle,{className:"w-8 h-8 text-green-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-green-900",children:"Verification Successful!"}),(0,s.jsx)("p",{className:"text-sm text-green-700 mt-1",children:"Your TOTP code has been validated."})]}),(0,s.jsx)(x,{onClick:f,variant:"outline",className:"bg-white",children:"Verify Another Code"})]})})})}):(0,s.jsx)("div",{className:"max-w-md mx-auto",children:(0,s.jsx)(j,{children:(0,s.jsx)(H,{className:"pt-6",children:(0,s.jsxs)("div",{className:"text-center space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mx-auto w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4",children:(0,s.jsx)(W.Shield,{className:"w-6 h-6 text-blue-600"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold",children:"Enter Verification Code"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Enter the 6-digit code from your authenticator app"})]}),(0,s.jsxs)("form",{onSubmit:S,className:"space-y-6",children:[(0,s.jsx)("div",{className:"flex justify-center gap-2",children:o.map((i,l)=>(0,s.jsx)(j,{className:"w-12 h-14 border-2 focus-within:border-blue-500 transition-colors",children:(0,s.jsx)(H,{className:"p-0 h-full flex items-center justify-center",children:(0,s.jsx)("input",{ref:b=>{g.current[l]=b},type:"tel",inputMode:"numeric",maxLength:1,value:i,onChange:b=>C(l,b.target.value),onKeyDown:b=>D(l,b),className:"w-full h-full text-center text-2xl font-bold border-none outline-none bg-transparent",autoComplete:"one-time-code",disabled:c,style:{height:"auto"}})})},l))}),y&&(0,s.jsxs)(ie,{variant:"destructive",children:[(0,s.jsx)(W.AlertCircle,{className:"h-4 w-4"}),(0,s.jsx)(se,{children:y})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(x,{type:"submit",className:"w-full",disabled:c||o.some(i=>i===""),children:c?"Verifying...":"Verify Code"}),(0,s.jsx)(x,{type:"button",variant:"ghost",size:"sm",onClick:f,className:"w-full text-xs",children:"Clear Code"})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Codes refresh every 30 seconds"})]})})})})};
3
3
  //# sourceMappingURL=index.js.map