"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[40439],{532114(e,t,n){n.d(t,{A:()=>i});var r=n(217439),a=n(71479),l=n(311785);const i=(0,a.A)(r.A,(0,l.A)("colorOverride"))`
  ${({colorOverride:e})=>e?`color: ${e} !important`:""};
`},720282(e,t,n){n.d(t,{A:()=>v});var r=n(296540),a=n(231755),l=n(566723),i=n(86571),o=n(294303),c=n(689965),m=n(271856),s=n(822336),d=n(217439),E=n(920360),A=n(823858),u=n(71479),p=n(311785),_=n(916537);var g,I=n(53765);!function(e){e.ORANGE="orange",e.RED="red"}(g||(g={}));const C=(e,t)=>(e.index||0)-(t.index||0),N=(0,u.A)(E.A)`
  color: ${({theme:e})=>s.Ay[`desktop-color-neutral-00-${e.themeName}`]};
`,f=(0,u.A)(A.A,(0,p.A)("color"))`
  color: ${({theme:e,color:t})=>s.Ay[`desktop-color-${t}-06-${e.themeName}`]};
`,O=(0,u.A)(o.A)`
  width: ${l.S2};
  height: ${l.S2};
  border-radius: 4px;
  background-color: ${({theme:e})=>s.Ay[`desktop-color-green-06-${e.themeName}`]};
`,h=(0,u.A)(O)`
  background-color: ${({theme:e})=>s.Ay[`desktop-color-neutral-03-${e.themeName}`]};
`,x=({fan:{index:e,speed:t}})=>r.createElement(I.m,null,r.createElement(I.Y,{id:"DEVICE_FAN"},e),r.createElement(I.Y,{id:"DEVICE_LEVEL"},t)),w=({fan:e})=>r.createElement(m.A,{description:r.createElement(x,{fan:e}),width:100},r.createElement(O,{justifyContent:"center",alignItems:"center"},r.createElement(N,null))),k=({index:e,messageId:t,color:n=g.ORANGE})=>r.createElement(m.A,{description:r.createElement(_.sA,{id:t,values:{index:e}}),width:199},r.createElement(h,{justifyContent:"center",alignItems:"center"},r.createElement(f,{color:n,size:"original",variant:"fill"}))),y=({fan:e})=>{switch(!0){case!e.present:return r.createElement(k,{index:e.index,messageId:"DEVICE_FAN_UNAVAILABLE",color:g.RED});case!!(1&e.critical_state):return r.createElement(k,{index:e.index,messageId:"DEVICE_FAN_SPEED_TOO_HIGH"});case!!(2&e.critical_state):return r.createElement(k,{index:e.index,messageId:"DEVICE_FAN_STOPPED"});case!!(4&e.critical_state):return r.createElement(k,{index:e.index,messageId:"DEVICE_FAN_UNAVAILABLE",color:g.RED});default:return r.createElement(w,{fan:e})}},M=({fan:e})=>r.createElement(o.A,{flexDirection:"column",justifyContent:"center",alignItems:"center"},r.createElement(y,{fan:e}),r.createElement(d.A,{size:"small",color:"text-3"},e.present&&void 0!==e.speed?e.speed:r.createElement(_.sA,{id:"COMMON_FALLBACK"}))),T=({fan_table:e})=>r.createElement(o.A,{flexDirection:"row",justifyContent:"center",gap:l.S2},e.sort(C).map(e=>r.createElement(M,{key:e.index,fan:e})));var R=n(418328);const v=({psu_table:e=[],fan_table:t=[]})=>e.length>0?r.createElement(c.A,{type:c.I.ACCORDION,items:[{id:"powerSource",openByDefault:!0,label:r.createElement(i.A,{id:t.length?"DEVICE_HEADER_POWER_AND_FAN_UTILIZATION":"DEVICE_HEADER_POWER_UTILIZATION"}),renderContent:()=>r.createElement(o.A,{flexDirection:"column",gap:l.Ln},r.createElement(R.A,{psuTable:e,marginBottom:0}),t.length?r.createElement(r.Fragment,null,r.createElement(a.A,null),r.createElement(T,{fan_table:t})):null)}]}):null},418328(e,t,n){n.d(t,{A:()=>x});var r=n(296540),a=n(325898),l=n(271856),i=n(822336),o=n(773412),c=n(84385),m=n(217439),s=n(823858),d=n(71479),E=n(382389),A=n(178233),u=n(566723),p=n(294303),_=n(532114),g=n(916537),I=n(757167),C=n(53765);const N=(0,d.A)(p.A)`
  justify-content: space-between;
`,f=(0,d.A)(c.A)`
  margin: 0 6px;
  height: 10px;
`,O=(0,d.A)(s.A)`
  margin: 0 6px;
`,h=({index:e,item:t})=>r.createElement(C.m,null,r.createElement(C.Y,{id:"COMMON_POWER_SUPPLY_UNIT",values:{psuIndex:""}},e+1),t.temp?Object.entries(t.temp).map(([e,t])=>r.createElement(C.Y,{id:"DEVICE_TEMPERATURE_SENSOR",values:{index:+e+1},key:e},t?.toFixed(1)||r.createElement(g.sA,{id:"COMMON_FALLBACK"})," ",r.createElement(g.sA,{id:"COMMON_UNIT_CELSIUS"}))):null,t.fanSpeed?r.createElement(C.Y,{id:"DEVICE_FAN_SPEED"},t.fanSpeed," ",r.createElement(g.sA,{id:"COMMON_UNIT_RPM"})):null),x=({psuTable:e=[],marginBottom:t})=>{const{themeName:n,motifPalette:c}=(0,E.u)(),{motif:s}=(0,a.A)(),{formatMessage:d}=(0,g.tz)(),C=(0,r.useMemo)(()=>e.map(({power:t,power_capacity:a,temp:E,fan:u,present:C,online:x,label:w},k)=>{const y=a||550,M=Math.ceil(Number.parseFloat(t)/y*100),T={variant:(0,I.NH)(M),value:M,temp:E,fanSpeed:u?.[0],online:x,present:C},R=e?.[k]?.power;return r.createElement(p.A,{flexDirection:"column",key:w},r.createElement(N,null,r.createElement(m.A,{color:"text-2",size:"medium"},r.createElement(g.sA,{id:"COMMON_POWER_SUPPLY_UNIT",values:{psuIndex:k+1}})),r.createElement(p.A,{justifyContent:"space-between",alignItems:"center"},T.present?r.createElement(r.Fragment,null,T.online||T.value?null:r.createElement(l.A,{description:d({id:"DEVICE_USW_MC_PSU_OFFLINE_TOOLTIP"},{index:k+1}),portal:!0},r.createElement(O,{size:"original",variant:"fill",color:i.Ay[`desktop-color-orange-06-${n}`],fill:i.Ay[`desktop-color-neutral-00-${n}`]})),T.online?r.createElement(r.Fragment,null,r.createElement(m.A,{color:"text-3",size:"medium"},r.createElement(g.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:`${Math.ceil(Number.parseFloat(R))}/${y}`}})),r.createElement(f,{orientation:"vertical",color:i.Ay[`desktop-color-neutral-04-${n}`]}),r.createElement(_.A,{size:"medium",colorOverride:T.value?c[T.variant]:i.Ay[`desktop-color-text-3-${s}`]},(0,A.A)(T.value))):null):r.createElement(m.A,{color:"text-3",size:"medium"},r.createElement(g.sA,{id:"DEVICE_NOT_INSTALLED"})))),r.createElement(l.A,{description:T.present?r.createElement(h,{index:k,item:T}):null,width:250},r.createElement(o.A,{items:[T],rounded:!0})))}),[e]);return r.createElement(p.A,{flexDirection:"column",marginBottom:t??u.kI,gap:u.kc},C)}},442728(e,t,n){n.d(t,{A:()=>F});var r=n(822336),a=n(469733),l=n(296540),i=n(271856),o=n(963070),c=n(823858),m=n(382389),s=n(592510),d=n(879905),E=n(596441),A=n(398300),u=n(6176),p=n(703447),_=n(689965),g=n(845030),I=n(6510),C=n(532419),N=n(691294),f=n(239417),O=n(984652),h=n(643633),x=n(573531),w=n(768195);const k=({name:e,mac:t,model:n})=>e===t&&n?n:e,y=e=>{switch(e?.uplink?.type){case w.au.WIRE:return e?.connection_network_name||x.L;case w.au.WIRELESS:return e?.connection_network_name||e?.uplink?.essid||x.L;default:return x.L}};var M,T=n(758649),R=n(396660),v=n(566723),D=n(115829);!function(e){e.NAME="name",e.PORT="port",e.NETWORK="network"}(M||(M={}));const L={[M.NAME]:"COMMON_NAME",[M.PORT]:"COMMON_PORT",[M.NETWORK]:"COMMON_NETWORK"};var S=n(294303),b=n(916537),$=n(216211);const P=({port:e,mac:t})=>{const{handleGoToPortsPage:n}=(0,$.e)();return l.createElement(T.A,{variant:"inline",type:"button",size:"medium",onClick:()=>{n(t,e)}},e)},F=({activeItem:e})=>{const{themeName:t}=(0,m.u)(),n=(0,a.useDispatch)(),x=(0,a.useSelector)(C.ID),w=(0,l.useMemo)(()=>((e,t)=>(e||[]).map(e=>{const n=t.find(({mac:t})=>t===e.mac||t===e.ap_mac);return n?{...e,id:n._id,name:(0,I.Q)(n),activeItem:n,model:(0,I.Lm)(n.model)}:null}).filter(Boolean))(e.downlink_table,x),[e.downlink_table,x]),T=(0,a.useSelector)((0,f.Ax)(e.mac)).filter(e=>e.type===N.sK.WIRED);(0,l.useEffect)(()=>{n((0,O.$3)(void 0,{crudCacheStrategy:{type:s.e.CACHE}}))},[n]);const $=(0,l.useMemo)(()=>T.map(e=>({id:`${e.id}${e.sw_port}`,name:e.display_name,mac:e.mac,network:e.network_name,port:e.sw_port,image:l.createElement(p.A,{client:e}),isClient:!0})),[T]),F=(0,l.useMemo)(()=>w.map(({id:e,name:n,mac:a,port_idx:o,activeItem:m})=>({id:`${e}${o}`,name:k({name:n,mac:m.mac,model:m.model}),mac:a,network:y(m),port:o,image:l.createElement(u.A,{model:m.model}),isClient:!1,warning:m.detailed_states?.negotiated_low_uplink_port_speed?l.createElement(i.A,{portal:!0,description:l.createElement(h.A,{color:"text-1"})},l.createElement(c.A,{size:"medium",color:r.Ay[`desktop-color-orange-06-${t}`]})):void 0})),[w,r.Ay[`desktop-color-orange-06-${t}`]]),U=(0,l.useMemo)(()=>Array.prototype.concat.apply([],[$,F]),[F,$]),V=(0,l.useMemo)(()=>(({mac:e})=>[{id:M.NAME,label:l.createElement(b.sA,{id:L[M.NAME]}),renderCell:({image:e,name:t})=>l.createElement(S.A,{alignItems:"center",justifyContent:"center",width:"100%"},l.createElement(S.A,{alignItems:"center",justifyContent:"center",height:"20px",width:"20px"},e),l.createElement(D.A,{color:"inherit",size:"medium",style:{width:"170px",paddingLeft:"6px",paddingRight:"6px"}},t)),width:170,compare:(0,R.l0)(({name:e})=>e)},{id:M.NETWORK,label:l.createElement(b.sA,{id:L[M.NETWORK]}),renderCell:({network:e})=>l.createElement(D.A,{color:"inherit",size:"medium"},e),width:112,compare:(0,R.l0)(({network:e})=>e)},{id:M.PORT,align:"right",label:l.createElement(b.sA,{id:L[M.PORT]}),renderCell:({port:t,warning:n})=>l.createElement(S.A,{justifyContent:"flex-end",alignItems:"center",flexGrow:1},l.createElement(S.A,{marginTop:-2,marginRight:v.YC},n),l.createElement(P,{port:t,mac:e})),width:54,compare:(0,R.l0)(({port:e})=>e)}])({mac:e.mac}),[e.mac]),W=(0,l.useCallback)(({mac:e,isClient:t})=>{n((0,g.XP)({type:t?A.H.CLIENT:A.H.DEVICE,id:e}))},[n]),{rowLimit:H,renderFooter:z}=(0,d.A)(U.length,{defaultCount:10});return U.length?l.createElement(_.A,null,l.createElement(o.A,{items:U,columns:V,idField:"id",initialSortBy:"port",initiallySortAscending:!0,disableColumnFilters:!0,rowOffset:0,disableSelection:!0,onRowClick:W,rowLimit:H,renderFooter:()=>z,rowHeight:E.I.ROW_HEIGHT,truncateHeaderCells:!0})):null}}}]);