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