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