"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[99070],{627308(e,t,i){i.d(t,{A:()=>a});var n=i(602086),s=i(716155);const a=(0,i(302405).w)(e=>(0,n.createElement)("svg",(0,s.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,n.createElement)("path",{d:"M6.5 4.5c0 1.649 1.09 3.03 2.651 4.642.31.32.849.097.849-.348V2.5a.48.48 0 0 0-.5-.487c-1.696.097-3 .724-3 2.487Zm9 2c-1.648 0-3.03 1.09-4.64 2.651a.495.495 0 0 0 .347.849H17.5a.48.48 0 0 0 .486-.5c-.096-1.696-.723-3-2.486-3Zm-11 7c1.648 0 3.03-1.09 4.64-2.651A.495.495 0 0 0 8.794 10H2.5a.48.48 0 0 0-.487.5c.097 1.696.724 3 2.487 3Zm6.349-2.64c1.56 1.611 2.651 2.993 2.651 4.641 0 1.763-1.304 2.39-3 2.487a.48.48 0 0 1-.5-.487v-6.293c0-.445.539-.668.849-.348Z",fill:"currentColor",className:e.twotonedclassname}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.5 4.5c0 1.649 1.09 3.03 2.651 4.642.31.32.849.097.849-.348V2.5a.48.48 0 0 0-.5-.487c-1.696.097-3 .724-3 2.487Zm1 0c0 .953.496 1.852 1.5 3.006V3.07c-.474.074-.82.205-1.05.372-.251.181-.45.462-.45 1.058Zm8 2c-1.648 0-3.03 1.09-4.64 2.651a.495.495 0 0 0 .347.849H17.5a.48.48 0 0 0 .486-.5c-.096-1.696-.723-3-2.486-3Zm0 1c-.952 0-1.851.496-3.005 1.5h4.435c-.074-.474-.205-.82-.372-1.05-.181-.251-.462-.45-1.058-.45Zm-11 6c1.648 0 3.03-1.09 4.64-2.651A.495.495 0 0 0 8.794 10H2.5a.48.48 0 0 0-.487.5c.097 1.696.724 3 2.487 3ZM3.07 11h4.435C6.35 12.004 5.452 12.5 4.5 12.5c-.596 0-.877-.199-1.058-.45-.167-.23-.298-.576-.372-1.05Zm7.779-.14c1.56 1.611 2.651 2.993 2.651 4.641 0 1.763-1.304 2.39-3 2.487a.48.48 0 0 1-.5-.487v-6.293c0-.445.539-.668.849-.348ZM11 12.496v4.435c.474-.075.82-.205 1.05-.372.251-.181.45-.462.45-1.058 0-.952-.496-1.851-1.5-3.005Z",fill:"currentColor",className:e.baseclassname}),(0,n.createElement)("path",{d:"M6.5 4.5c0 1.649 1.09 3.03 2.651 4.642.31.32.849.097.849-.348V2.5a.48.48 0 0 0-.5-.487c-1.696.097-3 .724-3 2.487Zm9 2c-1.648 0-3.03 1.09-4.64 2.651a.495.495 0 0 0 .347.849H17.5a.48.48 0 0 0 .486-.5c-.096-1.696-.723-3-2.486-3Zm-11 7c1.648 0 3.03-1.09 4.64-2.651A.495.495 0 0 0 8.794 10H2.5a.48.48 0 0 0-.487.5c.097 1.696.724 3 2.487 3Zm6.349-2.64c1.56 1.611 2.651 2.993 2.651 4.641 0 1.763-1.304 2.39-3 2.487a.48.48 0 0 1-.5-.487v-6.293c0-.445.539-.668.849-.348Z",fill:"currentColor",className:e.fillclassname})))},453007(e,t,i){i.d(t,{A:()=>r});var n=i(179102),s=i(247816),a=i(291508);const r=(0,s.A)(n.A,(0,a.A)("colorOverride"))`
  ${({colorOverride:e})=>e?`color: ${e} !important`:""};
`},241092(e,t,i){i.d(t,{A:()=>T});var n=i(274934),s=i(798282),a=i(309130),r=i(376892),l=i(100978),o=i(535322),d=i(548941),c=i(505817),m=i(179102),u=i(627308),_=i(711950),p=i(247816),A=i(291508),x=i(470070);var h,j=i(820510);!function(e){e.ORANGE="orange",e.RED="red"}(h||(h={}));const v=(e,t)=>(e.index||0)-(t.index||0),I=(0,p.A)(u.A)`
  color: ${({theme:e})=>c.Ay[`desktop-color-neutral-00-${e.themeName}`]};
`,E=(0,p.A)(_.A,(0,A.A)("color"))`
  color: ${({theme:e,color:t})=>c.Ay[`desktop-color-${t}-06-${e.themeName}`]};
`,O=(0,p.A)(l.A)`
  width: ${a.S2};
  height: ${a.S2};
  border-radius: 4px;
  background-color: ${({theme:e})=>c.Ay[`desktop-color-green-06-${e.themeName}`]};
`,N=(0,p.A)(O)`
  background-color: ${({theme:e})=>c.Ay[`desktop-color-neutral-03-${e.themeName}`]};
`,g=({fan:{index:e,speed:t}})=>(0,n.jsxs)(j.m,{children:[(0,n.jsx)(j.Y,{id:"DEVICE_FAN",children:e}),(0,n.jsx)(j.Y,{id:"DEVICE_LEVEL",children:t})]}),C=({fan:e})=>(0,n.jsx)(d.A,{description:(0,n.jsx)(g,{fan:e}),width:100,children:(0,n.jsx)(O,{justifyContent:"center",alignItems:"center",children:(0,n.jsx)(I,{})})}),f=({index:e,messageId:t,color:i=h.ORANGE})=>(0,n.jsx)(d.A,{description:(0,n.jsx)(x.sA,{id:t,values:{index:e}}),width:199,children:(0,n.jsx)(N,{justifyContent:"center",alignItems:"center",children:(0,n.jsx)(E,{color:i,size:"original",variant:"fill"})})}),w=({fan:e})=>{switch(!0){case!e.present:return(0,n.jsx)(f,{index:e.index,messageId:"DEVICE_FAN_UNAVAILABLE",color:h.RED});case!!(1&e.critical_state):return(0,n.jsx)(f,{index:e.index,messageId:"DEVICE_FAN_SPEED_TOO_HIGH"});case!!(2&e.critical_state):return(0,n.jsx)(f,{index:e.index,messageId:"DEVICE_FAN_STOPPED"});case!!(4&e.critical_state):return(0,n.jsx)(f,{index:e.index,messageId:"DEVICE_FAN_UNAVAILABLE",color:h.RED});default:return(0,n.jsx)(C,{fan:e})}},M=({fan:e})=>(0,n.jsxs)(l.A,{flexDirection:"column",justifyContent:"center",alignItems:"center",children:[(0,n.jsx)(w,{fan:e}),(0,n.jsx)(m.A,{size:"small",color:"text-3",children:e.present&&void 0!==e.speed?e.speed:(0,n.jsx)(x.sA,{id:"COMMON_FALLBACK"})})]}),b=({fan_table:e})=>(0,n.jsx)(l.A,{flexDirection:"row",justifyContent:"center",gap:a.S2,children:e.sort(v).map(e=>(0,n.jsx)(M,{fan:e},e.index))});var D=i(203071);const T=({psu_table:e=[],fan_table:t=[]})=>e.length>0?(0,n.jsx)(o.A,{type:o.I.ACCORDION,items:[{id:"powerSource",openByDefault:!0,label:(0,n.jsx)(r.A,{id:t.length?"DEVICE_HEADER_POWER_AND_FAN_UTILIZATION":"DEVICE_HEADER_POWER_UTILIZATION"}),renderContent:()=>(0,n.jsxs)(l.A,{flexDirection:"column",gap:a.Ln,children:[(0,n.jsx)(D.A,{psuTable:e,marginBottom:0}),t.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.A,{}),(0,n.jsx)(b,{fan_table:t})]}):null]})}]}):null},665367(e,t,i){i.d(t,{A:()=>l});var n=i(274934),s=i(179102),a=i(470070),r=i(664092);const l=({local_uplink_port:e})=>e?(0,n.jsxs)(r.A,{children:[(0,n.jsx)(s.A,{color:"text-2",size:"medium",children:(0,n.jsx)(a.sA,{id:"COMMON_CONNECTED_VIA"})}),(0,n.jsx)(s.A,{color:"text-3",size:"medium",children:(0,n.jsx)(a.sA,{id:"COMMON_LOCAL_UPLINK_PORT",values:{portIdx:e}})})]}):null},203071(e,t,i){i.d(t,{A:()=>C});var n=i(274934),s=i(602086),a=i(713035),r=i(548941),l=i(505817),o=i(505753),d=i(651172),c=i(179102),m=i(711950),u=i(247816),_=i(263705),p=i(662986),A=i(309130),x=i(100978),h=i(453007),j=i(470070),v=i(314229),I=i(820510);const E=(0,u.A)(x.A)`
  justify-content: space-between;
`,O=(0,u.A)(d.A)`
  margin: 0 6px;
  height: 10px;
`,N=(0,u.A)(m.A)`
  margin: 0 6px;
`,g=({index:e,item:t})=>(0,n.jsxs)(I.m,{children:[(0,n.jsx)(I.Y,{id:"COMMON_POWER_SUPPLY_UNIT",values:{psuIndex:""},children:e+1}),t.temp?Object.entries(t.temp).map(([e,t])=>(0,n.jsxs)(I.Y,{id:"DEVICE_TEMPERATURE_SENSOR",values:{index:+e+1},children:[t?.toFixed(1)||(0,n.jsx)(j.sA,{id:"COMMON_FALLBACK"})," ",(0,n.jsx)(j.sA,{id:"COMMON_UNIT_CELSIUS"})]},e)):null,t.fanSpeed?(0,n.jsxs)(I.Y,{id:"DEVICE_FAN_SPEED",children:[t.fanSpeed," ",(0,n.jsx)(j.sA,{id:"COMMON_UNIT_RPM"})]}):null]}),C=({psuTable:e=[],marginBottom:t})=>{const{themeName:i,motifPalette:d}=(0,_.u)(),{motif:m}=(0,a.A)(),{formatMessage:u}=(0,j.tz)(),I=(0,s.useMemo)(()=>e.map(({power:t,power_capacity:s,temp:a,fan:_,present:A,online:I,label:C},f)=>{const w=s||550,M=Math.ceil(Number.parseFloat(t)/w*100),b={variant:(0,v.NH)(M),value:M,temp:a,fanSpeed:_?.[0],online:I,present:A},D=e?.[f]?.power;return(0,n.jsxs)(x.A,{flexDirection:"column",children:[(0,n.jsxs)(E,{children:[(0,n.jsx)(c.A,{color:"text-2",size:"medium",children:(0,n.jsx)(j.sA,{id:"COMMON_POWER_SUPPLY_UNIT",values:{psuIndex:f+1}})}),(0,n.jsx)(x.A,{justifyContent:"space-between",alignItems:"center",children:b.present?(0,n.jsxs)(n.Fragment,{children:[b.online||b.value?null:(0,n.jsx)(r.A,{description:u({id:"DEVICE_USW_MC_PSU_OFFLINE_TOOLTIP"},{index:f+1}),portal:!0,children:(0,n.jsx)(N,{size:"original",variant:"fill",color:l.Ay[`desktop-color-orange-06-${i}`],fill:l.Ay[`desktop-color-neutral-00-${i}`]})}),b.online?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.A,{color:"text-3",size:"medium",children:(0,n.jsx)(j.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:`${Math.ceil(Number.parseFloat(D))}/${w}`}})}),(0,n.jsx)(O,{orientation:"vertical",color:l.Ay[`desktop-color-neutral-04-${i}`]}),(0,n.jsx)(h.A,{size:"medium",colorOverride:b.value?d[b.variant]:l.Ay[`desktop-color-text-3-${m}`],children:(0,p.A)(b.value)})]}):null]}):(0,n.jsx)(c.A,{color:"text-3",size:"medium",children:(0,n.jsx)(j.sA,{id:"DEVICE_NOT_INSTALLED"})})})]}),(0,n.jsx)(r.A,{description:b.present?(0,n.jsx)(g,{index:f,item:b}):null,width:250,children:(0,n.jsx)(o.A,{items:[b],rounded:!0})})]},C)}),[e]);return(0,n.jsx)(x.A,{flexDirection:"column",marginBottom:t??A.kI,gap:A.kc,children:I})}},384780(e,t,i){i.d(t,{A:()=>z});var n=i(274934),s=i(505817),a=i(977872),r=i(602086),l=i(548941),o=i(645759),d=i(711950),c=i(263705),m=i(244081),u=i(112104),_=i(61322),p=i(449339),A=i(974390),x=i(650632),h=i(535322),j=i(205521),v=i(347625),I=i(754924),E=i(223597),O=i(34118),N=i(239627),g=i(645682),C=i(254590),f=i(857780);const w=({name:e,mac:t,model:i})=>e===t&&i?i:e,M=e=>{switch(e?.uplink?.type){case f.au.WIRE:return e?.connection_network_name||C.L;case f.au.WIRELESS:return e?.connection_network_name||e?.uplink?.essid||C.L;default:return C.L}};var b,D=i(526744),T=i(594005),y=i(309130),k=i(156007);!function(e){e.NAME="name",e.PORT="port",e.NETWORK="network"}(b||(b={}));const R={[b.NAME]:"COMMON_NAME",[b.PORT]:"COMMON_PORT",[b.NETWORK]:"COMMON_NETWORK"};var S=i(100978),L=i(470070),P=i(850352);const F=({port:e,mac:t})=>{const{handleGoToPortsPage:i}=(0,P.e)();return(0,n.jsx)(D.A,{variant:"inline",type:"button",size:"medium",onClick:()=>{i(t,e)},children:e})},z=({activeItem:e})=>{const{themeName:t}=(0,c.u)(),i=(0,a.wA)(),C=(0,a.d4)(I.ID),f=(0,r.useMemo)(()=>((e,t)=>(e||[]).map(e=>{const i=t.find(({mac:t})=>t===e.mac||t===e.ap_mac);return i?{...e,id:i._id,name:(0,v.Q)(i),activeItem:i,model:(0,v.Lm)(i.model)}:null}).filter(Boolean))(e.downlink_table,C),[e.downlink_table,C]),D=(0,a.d4)((0,O.Ax)(e.mac)).filter(e=>e.type===E.sK.WIRED);(0,r.useEffect)(()=>{i((0,N.$3)(void 0,{crudCacheStrategy:{type:m.e.CACHE}}))},[i]);const P=(0,r.useMemo)(()=>D.map(e=>({id:`${e.id}${e.sw_port}`,name:e.display_name,mac:e.mac,network:e.network_name,port:e.sw_port,image:(0,n.jsx)(x.A,{client:e}),isClient:!0})),[D]),z=(0,r.useMemo)(()=>f.map(({id:e,name:i,mac:a,port_idx:r,activeItem:o})=>({id:`${e}${r}`,name:w({name:i,mac:o.mac,model:o.model}),mac:a,network:M(o),port:r,image:(0,n.jsx)(A.A,{model:o.model}),isClient:!1,warning:o.detailed_states?.negotiated_low_uplink_port_speed?(0,n.jsx)(l.A,{portal:!0,description:(0,n.jsx)(g.A,{color:"text-1"}),children:(0,n.jsx)(d.A,{size:"medium",color:s.Ay[`desktop-color-orange-06-${t}`]})}):void 0,stacking_group_id:o.stacking_group_id})),[f,s.Ay[`desktop-color-orange-06-${t}`]]),U=(0,r.useMemo)(()=>Array.prototype.concat.apply([],[P,z]),[z,P]),V=(0,r.useMemo)(()=>(({mac:e})=>[{id:b.NAME,label:(0,n.jsx)(L.sA,{id:R[b.NAME]}),renderCell:({image:e,name:t})=>(0,n.jsxs)(S.A,{alignItems:"center",justifyContent:"center",width:"100%",children:[(0,n.jsx)(S.A,{alignItems:"center",justifyContent:"center",height:"20px",width:"20px",children:e}),(0,n.jsx)(k.A,{color:"inherit",size:"medium",style:{width:"170px",paddingLeft:"6px",paddingRight:"6px"},children:t})]}),width:170,compare:(0,T.l0)(({name:e})=>e)},{id:b.NETWORK,label:(0,n.jsx)(L.sA,{id:R[b.NETWORK]}),renderCell:({network:e})=>(0,n.jsx)(k.A,{color:"inherit",size:"medium",children:e}),width:112,compare:(0,T.l0)(({network:e})=>e)},{id:b.PORT,align:"right",label:(0,n.jsx)(L.sA,{id:R[b.PORT]}),renderCell:({port:t,warning:i})=>(0,n.jsxs)(S.A,{justifyContent:"flex-end",alignItems:"center",flexGrow:1,children:[(0,n.jsx)(S.A,{marginTop:-2,marginRight:y.YC,children:i}),(0,n.jsx)(F,{port:t,mac:e})]}),width:54,compare:(0,T.l0)(({port:e})=>e)}])({mac:e.mac}),[e.mac]),$=(0,r.useCallback)(({mac:e,isClient:t,stacking_group_id:n})=>{i((0,j.XP)({type:t?p.H.CLIENT:n?p.H.STACKING:p.H.DEVICE,id:n||e}))},[i]),{rowLimit:W,renderFooter:H}=(0,u.A)(U.length,{defaultCount:10});return U.length?(0,n.jsx)(h.A,{children:(0,n.jsx)(o.A,{items:U,columns:V,idField:"id",initialSortBy:"port",initiallySortAscending:!0,disableColumnFilters:!0,rowOffset:0,disableSelection:!0,onRowClick:$,rowLimit:W,renderFooter:()=>H,rowHeight:_.I.ROW_HEIGHT,truncateHeaderCells:!0})}):null}},203155(e,t,i){i.d(t,{A:()=>N});var n=i(274934),s=i(376892),a=i(535322),r=i(977872),l=i(602086),o=i(179102),d=i(775250),c=i(346949),m=i(526744),u=i(590979),_=i(320509),p=i(449339),A=i(100978),x=i(205521),h=i(470070),j=i(853109),v=i(754924),I=i(664092),E=i(631692);const O=({activeItem:e})=>{const{speed:t,rx_packets:i,rx_bytes:s,tx_packets:a,tx_bytes:O}=(0,j.q$)(e)||{},N=(0,r.d4)((0,l.useMemo)(()=>(0,v.I4)(e.mac),[e.mac])),{poe_power:g=null,port_poe:C=!1}=(0,j.$Y)({device:e,uplink:N})||{},f=(0,r.wA)(),{formatMessage:w}=(0,h.tz)(),M=(0,l.useCallback)(()=>{f((0,x.XP)({type:p.H.DEVICE,id:N?.mac}))},[f,N?.mac]);return(0,n.jsxs)(A.A,{height:"100%",flexDirection:"column",children:[N?.mac?(0,n.jsxs)(I.A,{children:[(0,n.jsx)(o.A,{size:"medium",children:(0,n.jsx)(h.sA,{id:"COMMON_DEVICE"})}),(0,n.jsx)(m.A,{type:"button",variant:"inline",onClick:M,...u.A.addDataTestId(u.A.TestId.SIDE_PANEL_TRIGGER),children:(0,n.jsx)(d.A,{color:"inherit",size:"medium",isTruncated:!0,children:(0,j.Jz)(e,N,w)})})]}):null,(0,n.jsx)(E.A,{portSpeed:t}),C&&Number(g)>0?(0,n.jsxs)(I.A,{children:[(0,n.jsx)(o.A,{size:"medium",children:(0,n.jsx)(h.sA,{id:"DEVICE_PROPERTY_UPLINK_POWER"})}),(0,n.jsx)(o.A,{size:"medium",color:"text-3",children:(0,n.jsx)(h.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:g}})})]}):null,i&&s?(0,n.jsxs)(I.A,{children:[(0,n.jsx)(o.A,{size:"medium",children:(0,n.jsx)(h.sA,{id:"COMMON_DOWN_PKTS_BYTES"})}),(0,n.jsxs)(o.A,{size:"medium",color:"text-3",children:[(0,n.jsx)(c.A,{type:"number",input:i,size:"body",color:"tertiary"})," / ",(0,_.z3)(s)]})]}):null,a&&O?(0,n.jsxs)(I.A,{children:[(0,n.jsx)(o.A,{size:"medium",children:(0,n.jsx)(h.sA,{id:"COMMON_UP_PKTS_BYTES"})}),(0,n.jsxs)(o.A,{size:"medium",color:"text-3",children:[(0,n.jsx)(c.A,{type:"number",input:a,size:"body",color:"tertiary"})," / ",(0,_.z3)(O)]})]}):null]})},N=({activeItem:e})=>(0,n.jsx)(a.A,{type:a.I.ACCORDION,items:[{id:"uplink",openByDefault:!0,label:(0,n.jsx)(s.A,{id:"COMMON_PARENT_DEVICE"}),renderContent:()=>(0,n.jsx)(O,{activeItem:e})}]})},872926(e,t,i){i.d(t,{A:()=>u});var n=i(274934),s=i(977872),a=i(810024),r=i(589650),l=i(748094),o=i(470070),d=i(754924),c=i(726831);const m=({adopted:e})=>(0,n.jsx)(l.A,{link:c.A.virtualNetworkConnectivity,children:(0,n.jsx)(o.sA,{id:e?"DEVICE_FALLBACK_IP_ADOPTED_WITH_UNIFI_GATEWAY_WARNING":"DEVICE_FALLBACK_IP_NOT_ADOPTED_WARNING",values:{bold:(0,n.jsx)("strong",{children:(0,n.jsx)(o.sA,{id:e?"DEVICE_WARNING_FALLBACK_IP":"DEVICE_WARNING_ADOPTION_FAILED"})})}})}),u=({ip:e,adopted:t,config_network:i})=>(0,s.d4)(d.m9)&&(0,a.W5)(e)&&i?.type===r.NL.DHCP?(0,n.jsx)(m,{adopted:t}):null},539082(e,t,i){i.d(t,{t8:()=>A,Ay:()=>x});var n=i(274934),s=i(602086),a=i(684935),r=i(179102),l=i(409844),o=i(237887),d=i(309130),c=i(100978),m=i(535322),u=i(470070),_=i(262457);const p=l.AH`
  width: unset;
`,A=({activeItem:e,addGroupOption:t})=>{const{formatMessage:i}=(0,u.tz)(),{switchId:r,setSwitchId:l}=(0,_.y)(),d=(0,s.useCallback)(e=>l(e.id),[l]),c=e.device.stacking?.members?.length?e.device.stacking.members:Object.values(e.unitsRuntimeData).sort((e,t)=>e.unit_id-t.unit_id),m=[...t?[{id:"group",label:i({id:"COMMON_GROUP"})}]:[],...c.map(({unit_id:e},t)=>({id:String(e),label:i({id:"COMMON_UNIT_N"},{n:t+1})}))];return m.length>5?(0,n.jsx)(o.A,{variant:"secondary",width:"100%",portal:!0,options:m.map(({id:e,label:t})=>({value:e,label:t})),value:r,onChange:({value:e})=>{l(e)},placeholder:i({id:"SETTINGS_TRAFFIC_ROUTES_INTERFACE_SELECT"})}):(0,n.jsx)(a.A,{tabs:m,onSelectTab:d,selectedTab:r,variant:"filter",className:p})},x=e=>(0,n.jsx)(m.A,{children:(0,n.jsxs)(c.A,{flexDirection:"column",height:"100%",gap:d.Ln,alignItems:"start",children:[(0,n.jsx)(r.A,{weight:"bold",size:"medium",children:(0,n.jsx)(u.sA,{id:"COMMON_STACKED_UNITS"})}),(0,n.jsx)(A,{...e})]})})},499070(e,t,i){i.r(t),i.d(t,{default:()=>V});var n=i(274934),s=i(602086),a=i(586566),r=i(469890),l=i(956978),o=i(434521),d=i(857780),c=i(45978),m=i(869744),u=i(216082),_=i(383550),p=i(562896),A=i(384780),x=i(203155),h=i(241092),j=i(872926),v=i(808202),I=i(539082),E=i(262457),O=i(906701),N=i(100978),g=i(535322),C=i(893762),f=i(446722),w=i(179102),M=i(470070),b=i(664092);const D=({isDeviceOffline:e})=>(0,n.jsxs)(b.A,{children:[(0,n.jsx)(w.A,{color:"text-2",size:"medium",children:(0,n.jsx)(M.sA,{id:"COMMON_STATUS"})}),(0,n.jsx)(w.A,{color:"text-3",size:"medium",children:(0,n.jsx)(M.sA,{id:e?"COMMON_OFFLINE":"COMMON_ONLINE"})})]});var T=i(725870),y=i(924453),k=i(665367),R=i(597377),S=i(418193),L=i(643334);const P=({name:e,model:t,ip:i,lan_ip:s,ipv6:a,mac:r,displayable_version:l,uptime:o,has_temperature:d,has_fan:c,overheating:m,general_temperature:u,fan_level:_,systemStatsMem:p,fan_table:A,local_uplink_port:x,isDeviceOffline:h,hide_uplink:j,type:v,deviceState:I,ethernet_overrides:E,port_table:w,uplink:M,device_mode_override:b})=>(0,n.jsx)(g.A,{children:(0,n.jsxs)(N.A,{height:"100%",flexDirection:"column",children:[j?null:(0,n.jsx)(k.A,{local_uplink_port:x}),void 0===h?null:(0,n.jsx)(D,{isDeviceOffline:h}),(0,n.jsx)(R.A,{ip:i,lan_ip:s,type:v,ethernet_overrides:E,port_table:w,uplink:M,device_mode_override:b}),(0,n.jsx)(O.A,{ipv6_address:a}),(0,n.jsx)(y.A,{mac:r}),(0,n.jsx)(L.A,{name:e,model:t,mac:r,type:v,displayable_version:l,uptime:o,deviceState:I}),(0,n.jsx)(C.A,{uptime:o}),(0,n.jsx)(f.A,{has_temperature:d,overheating:m,general_temperature:u}),A?null:(0,n.jsx)(S.A,{has_fan:c,fan_level:_}),(0,n.jsx)(T.A,{systemStatsMem:p})]})}),F=({activeItem:e,selectedUnitData:t})=>{const{device:i,runtimeView:E}=e,O=(0,o.S9)(i),N=(0,l.aK8)(O||c.g.DISCONNECTED),g=t.status===d.NW.OFFLINE,C=(0,m.lV)(e.unitsRuntimeData),f=t.uplinks?.[0],w=f?.port_idx,M=e.device.stacking?.members.length?e.device.stacking.members.map(e=>e.mac):Object.values(e.unitsRuntimeData).map(e=>e.mac),b=Boolean(f?.upstream_chassis_id&&!M.includes(f.upstream_chassis_id)),D=E.portTablesByUnitId.get(t.unit_id)||(0,m.Bm)(i.port_table,t.unit_id),T=w??(g&&D.some(e=>e.is_uplink)?i.uplink?.port_idx:void 0),y=!b&&void 0===T,k=(0,s.useMemo)(()=>{const{portTablesByUnitId:t}=E;if(!(t.size<=1))return[...t.entries()].sort(([e],[t])=>e-t).map(([t,n])=>({...i,mac:e.unitsRuntimeData[t]?.mac||i.mac,port_table:n}))},[e.unitsRuntimeData,i,E]),{adopted:R,config_network:S,ip:L,mac:F,type:z,model:U,port_table:V,shortname:$,total_used_power:W,total_max_power:H,detailed_states:{device_near_power_limit:B,device_near_effective_power_limit:K}={device_near_power_limit:!1,device_near_effective_power_limit:!1},has_temperature:Z,overheating:G,general_temperature:Y,fan_level:X,fan_table:q,has_fan:J,"system-stats":Q,uplink:ee,device_mode_override:te,psu_table:ie}=i,ne=(0,s.useMemo)(()=>(ie||[]).filter(e=>e.unit_id===t.unit_id),[ie,t.unit_id]),se=(0,s.useMemo)(()=>(q||[]).filter(e=>e.unit_id===t.unit_id),[q,t.unit_id]),ae=se.length>0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_.A,{activeItem:i,showPortOverview:!0,isStacking:!0,multipleDisplayedDevicesData:k,connectionStatusOverride:C?p.v.OFFLINE:void 0}),(0,n.jsx)(j.A,{ip:L,adopted:R,config_network:S}),(0,n.jsx)(P,{ip:i.ip,lan_ip:i.lan_ip,ipv6:i.ipv6,model:i.model,name:i.name,type:i.type,displayable_version:i.displayable_version}),C||N?null:(0,n.jsx)(A.A,{activeItem:i}),C?null:(0,n.jsx)(I.Ay,{activeItem:e}),g?null:(0,n.jsxs)(n.Fragment,{children:[ne.length>0?(0,n.jsx)(h.A,{psu_table:ne,fan_table:se}):null,(0,r.b0)(V)?(0,n.jsx)(v.A,{mac:F,type:z,model:U,device_near_power_limit:Boolean(B),device_near_effective_power_limit:Boolean(K),total_used_power:W||0,total_max_power:H||0,isPoeAdapter:(0,a.Y6)(i)}):null]}),(0,n.jsx)(P,{ethernet_overrides:i.ethernet_overrides,port_table:C?V:D,mac:C?F:t.mac,uptime:C?i.uptime:t.uptime_seconds,has_temperature:C?Z:void 0!==t.temperature_celsius||Z,has_fan:(C||ae)&&J,overheating:C?G:t.overheating||G,general_temperature:C?Y:t.temperature_celsius||Y,fan_level:X,fan_table:C?q:ae?se:void 0,systemStatsMem:C?Q?.mem:t.mem_percent?.toString()||Q?.mem,local_uplink_port:C?i.uplink?.port_idx:T,isDeviceOffline:C||g,hide_uplink:C?!i.uplink?.port_idx:y,uplink:ee,device_mode_override:te}),i.uplink?(0,n.jsx)(x.A,{activeItem:i}):null,(0,n.jsx)(u.A,{shortname:$})]})},z=({activeItem:e})=>{const{switchId:t}=(0,E.y)(),i=e.unitsRuntimeData[Number(t)]||Object.values(e.unitsRuntimeData)[0];return i?(0,n.jsx)(F,{activeItem:e,selectedUnitData:i}):null},U=e=>Object.keys(e.unitsRuntimeData)[0]||"1",V=({activeItem:e})=>(0,n.jsx)(E.u,{initialSwitchId:U(e),children:(0,n.jsx)(z,{activeItem:e})})},262457(e,t,i){i.d(t,{u:()=>r,y:()=>l});var n=i(274934),s=i(602086);const a=(0,s.createContext)({}),r=({children:e,initialSwitchId:t})=>{const[i,r]=(0,s.useState)(t),l=(0,s.useMemo)(()=>({switchId:i,setSwitchId:r}),[i]);return(0,n.jsx)(a.Provider,{value:l,children:e})},l=()=>(0,s.useContext)(a)}}]);