import{jsxs as r,jsx as t}from"react/jsx-runtime";import{token as g}from"@styled/tokens";import u from"../../icons/ico-qrcode.js";import x from"../../primitives/button.js";import"../../primitives/checkbox.js";import"../../primitives/dropdown-selector.js";import{Popover as n}from"../../primitives/popover.js";import"../../primitives/radio.js";import"../../primitives/segmented-control.js";import"../../primitives/switch.js";import l from"../../primitives/text.js";import{css as m}from"@styled/css/css";import{HStack as v,Box as w,Stack as p,Divider as y}from"@styled/jsx";import{useState as C,useEffect as k}from"react";const _=({avatarUrl:i,email:o,name:e,logoutLabel:d="Log out",onReceive:a,onLogout:f})=>{const[h,s]=C(!1);k(()=>{s(!1)},[i]);const c=()=>r(n,{iconSize:28,placement:"bottom right",variant:"text",children:[t(n.LeadingIcon,{children:i&&!h?t("img",{style:{borderRadius:"50%"},src:i,alt:"user avatar",onError:()=>s(!0)}):r("svg",{xmlns:"http://www.w3.org/2000/svg",width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",children:[t("circle",{cx:"14",cy:"14",r:"13",fill:"url(#paint0_radial_3600_63997)",stroke:"white",strokeOpacity:"0.24",strokeWidth:"0.5"}),t("defs",{children:r("radialGradient",{id:"paint0_radial_3600_63997",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(15 30.75) rotate(-90) scale(37.3333 65.833)",children:[t("stop",{offset:"0.01",stopColor:"#FFF507"}),t("stop",{offset:"0.259381",stopColor:"#F09BEB"}),t("stop",{offset:"0.598165",stopColor:"#412CB9"}),t("stop",{offset:"1",stopColor:"#18171A"})]})})]})}),t(n.Content,{className:m({w:e&&o?"200px":"fit-content",maxW:"200px"}),children:r(p,{w:"full",alignItems:"start",gap:0,children:[(o||e)&&r(p,{w:"full",gap:1,children:[e&&t(l,{fontWeight:"medium",children:e}),o&&t(l,{size:"sm",truncate:!0,fontColor:"text.secondary",children:o})]}),(o||e)&&t(y,{color:"surface.quaternary",my:3,minW:"88px"}),t(x,{label:d,textStyle:"negative",variant:"text",size:"sm",onPress:f})]})})]});return a?r(v,{gap:1,minWidth:"fit-content",minHeight:"fit-content",children:[t(w,{onClick:a,cursor:"pointer",transition:"transform 0.1s",_active:{transform:"scale(0.95)"},className:m({"@media (max-width: 370px)":{display:"none"}}),children:t(u,{height:18,width:18,color:g("colors.text.secondary")})}),t(c,{})]}):t(c,{})};export{_ as AccountMenu};
//# sourceMappingURL=account-menu.js.map
