"use strict";var e=require("react/jsx-runtime"),t=require("@styled/tokens"),m=require("../../icons/ico-globe.js"),b=require("../../icons/ico-remove.js"),x=require("../../primitives/button.js");require("../../primitives/checkbox.js"),require("../../primitives/dropdown-selector.js");var s=require("../../primitives/popover.js");require("../../primitives/radio.js"),require("../../primitives/segmented-control.js"),require("../../primitives/switch.js");var n=require("../../primitives/text.js"),d=require("@styled/css/css"),r=require("@styled/jsx"),h=require("react");const q=({connected:i,connectedLabel:u="Connected",disconnectLabel:c,disconnectedLabel:v="Not connected",domain:j,logoUrl:o,onDisconnect:g,onReceive:p})=>{const[f,a]=h.useState(!1);h.useEffect(()=>{a(!1)},[o]);const l=()=>e.jsxs(s.Popover,{iconSize:28,variant:"text",children:[e.jsx(s.Popover.LeadingIcon,{color:t.token("colors.text.tertiary"),children:o&&i&&!f?e.jsxs(r.Circle,{position:"relative",w:7,h:7,children:[e.jsx("img",{style:{borderRadius:"50%"},width:28,height:28,src:o,alt:"app logo",onError:()=>a(!0)}),e.jsx(r.Circle,{size:"7px",position:"absolute",bg:"positive.base",borderWidth:"thin",borderColor:"surface.primary",bottom:"-1px",right:"-1px",boxSizing:"border-box"})]}):e.jsxs("svg",{width:"28",height:"28",children:[e.jsx("circle",{cx:"14",cy:"14",r:"14",fill:t.token("colors.surface.tertiary")}),e.jsx(m.default,{color:t.token("colors.text.tertiary"),x:6,y:6,height:16,width:16})]})}),e.jsxs(s.Popover.Content,{className:d.css({w:"200px"}),children:[e.jsxs(r.Stack,{w:"100%",gap:1,overflow:"hidden",children:[i?e.jsx(n.default,{size:"xs",variant:"success",fontWeight:"normal",children:u}):e.jsx(n.default,{fontColor:"text.tertiary",size:"xs",children:v}),e.jsx(n.default,{truncate:!0,children:j})]}),i&&c&&e.jsxs(e.Fragment,{children:[e.jsx(r.Divider,{color:"surface.quaternary",my:3}),e.jsx(x.default,{label:c,size:"sm",textStyle:"negative",variant:"text",onPress:g,children:e.jsx(x.default.LeadingIcon,{children:e.jsxs("svg",{width:"20",height:"20",children:[e.jsx("circle",{cx:"8",cy:"8",r:"8",fill:t.token("colors.negative.lightest")}),e.jsx(b.default,{color:t.token("colors.negative.base"),x:3,y:3,height:10,width:10})]})})})]})]})]});return p?e.jsxs(r.HStack,{gap:1,minWidth:"fit-content",minHeight:"fit-content",children:[e.jsx(l,{}),e.jsx(r.Box,{className:d.css({"@media (max-width: 370px)":{display:"none"}}),minH:"18px",minW:"18px"})]}):e.jsx(l,{})};exports.ConnectionMenu=q;
//# sourceMappingURL=connection-menu.js.map
