"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[3048],{953394(e,t,i){var o;i.d(t,{s:()=>o}),function(e){e.STANDARD="standard",e.USB="usb",e.LAN="lan",e.WAN="wan",e.RJ45="rj45",e.SURGE="surge"}(o||(o={}))},816260(e,t,i){i.d(t,{Av:()=>l,KP:()=>r,R4:()=>n});var o=i(945132);const n={heartbeat_interval:o.gG,silence_threshold:15*o.gG,power_off_duration:2*o.gG},r={heartbeat_interval:o.gG,silence_threshold:5*o.gG,power_off_duration:1*o.gG},l={heartbeat_interval:5*o.gG,silence_threshold:150*o.gG,power_off_duration:150*o.gG}},751998(e,t,i){i.d(t,{A:()=>m});var o=i(296540),n=i(469733),r=i(792072),l=i(944373),s=i(366188),c=i(156472),a=i(460680),u=i(538535),p=i(656432),d=i(966784);const m=({port:e,device:t})=>{const i=(0,n.useSelector)(l.D),m=(0,n.useSelector)(u.D5),E=(0,n.useSelector)(s.wf),_=(0,n.useSelector)(r.pB),A=(0,n.useSelector)(c.G),h=(0,n.useSelector)(a.qS),T=(0,o.useMemo)(()=>(0,d.vT)(e,t,i,m,E,_,A,h),[e,t,i,m,E,_,A,h]);return o.createElement(p.A,{port:T,isInteractive:!1})}},405639(e,t,i){i.d(t,{A:()=>M});var o=i(296540),n=i(822336),r=i(469733),l=i(405442),s=i(217439),c=i(705145),a=i(668393),u=i(321971),p=i(970847),d=i(699948),m=i(297454),E=i(325882),_=i(808326),A=i(71479),h=i(180524),T=i(968906),O=i(960407),f=i(311785),v=i(860631),b=i(398300),S=i(566723),g=i(855019),N=i(294303),I=i(845030),R=i(916537),C=i(953394),P=i(825032);const w=(0,A.A)("div",(0,f.A)("cellSize","isEnabled","outletType","marginSize","verticalGap","centerIcon"))`
  width: ${({cellSize:e})=>e||"20px"};
  height: ${({cellSize:e})=>e||"20px"};
  align-items: center;
  border-radius: 2px;
  color: ${({theme:{themeName:e}})=>e===P.S.DARK?"#000":"#fff"};
  justify-content: center;
  display: flex;
  position: relative;

  ${({centerIcon:e,verticalGap:t})=>e&&t&&`transform: translateY(calc(50% + ${t} / 2))`};

  &:not(:first-child) {
    margin-left: ${({marginSize:e})=>e||"10px"};
  }

  div:last-child {
    right: -15px;
  }

  ${({outletType:e,isEnabled:t,theme:{themeName:i,motifPalette:{uBlue01:o}}})=>{switch(e){case C.s.RJ45:return`\n          background-color: ${o};\n          border: 1px solid ${n.Ay[`desktop-color-ublue-03-${i}`]};\n        `;case C.s.WAN:return`\n          background-color: ${n.Ay[`desktop-color-neutral-03-${i}`]};\n        `;default:return`\n          background-color: ${t?n.Ay[`desktop-color-green-06-${i}`]:n.Ay[`desktop-color-neutral-05-${i}`]};\n        `}}}
`,x=(0,A.A)("div",(0,f.A)("iconRotation"))`
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;

  svg {
    ${({iconRotation:e})=>e?`transform: rotate(${e});`:""}
    max-width: 100%;
    max-height: 100%;
  }
`,M=({activeItemMac:e,cellData:t,marginSize:i,cellSize:n,verticalGap:A,iconRotation:f,centerIcon:P,showBatteryPowered:M,tooltipPlacement:y,disableOnPortClick:D,iconSize:U,isBatteryMode:z,tooltipOverride:L,disableTooltip:$,isEU:k,offline:G})=>{const j=(0,r.useDispatch)(),W=(0,r.useSelector)(O.oI),F=(0,v.TT)(t,"POWER_METER"),{outletType:V=C.s.STANDARD,index:B,name:J,outlet_power:Y,outlet_current:H,outlet_voltage:K,outlet_power_factor:Q,cycle_enabled:q,relay_state:X,surgeType:Z}=t,ee=[C.s.STANDARD,C.s.USB].includes(V),te=(0,o.useMemo)(()=>{if(!$)return L||(V===C.s.RJ45?Z?o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:Z===l.ME.IN?"DEVICE_SURGE_IN":"DEVICE_SURGE_OUT"})):null:V===C.s.WAN?o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"DEVICE_PROPERTIES_OUTLET_TOOLTIP_WAN_NO_STATUS_INFO"})):F&&V===C.s.STANDARD?o.createElement(N.A,{flexDirection:"column",justifyContent:"space-between",minWidth:180},o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_AC_OUTLET"})),o.createElement(s.A,{size:"inherit",color:"inherit"},B)),o.createElement(N.A,{justifyContent:"space-between",alignItems:"center",gap:S.kc},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_NAME"})),o.createElement(c.A,{size:"inherit",color:"inherit",isTruncated:!0},J)),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_POWER"})),o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:Number(Y||0).toFixed(2)}}))),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_CURRENT"})),o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_UNIT_AMPERES_SHORT",values:{value:Number(H||0).toFixed(2)}}))),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_VOLTAGE"})),o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_UNIT_VOLTAGE_SHORT",values:{value:Number(K||0).toFixed(2)}}))),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_POWER_FACTOR"})),o.createElement(s.A,{size:"inherit",color:"inherit"},Number(Q||0).toFixed(2)))):o.createElement(N.A,{flexDirection:"column",justifyContent:"space-between",minWidth:180},o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_OUTLET"})),o.createElement(s.A,{size:"inherit",color:"inherit"},B)),o.createElement(N.A,{justifyContent:"space-between",alignItems:"center",gap:S.kc},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"COMMON_NAME"})),o.createElement(c.A,{size:"inherit",color:"inherit",isTruncated:!0},J)),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"DEVICE_PROPERTIES_OUTLET_CTL_POWER_CYCLE_ENABLED"})),o.createElement(q?m.A:d.A,null)),o.createElement(N.A,{justifyContent:"space-between"},o.createElement(s.A,{size:"inherit",color:"inherit"},o.createElement(R.sA,{id:"DEVICE_PROPERTIES_OUTLET_RELAY_STATE"})),o.createElement(X?m.A:d.A,null))))},[$,L,V,F,B,J,Y,H,K,Q,q,X,Z]),ie=(0,o.useMemo)(()=>{const e=k?E.A:u.A;switch(V){case C.s.STANDARD:return o.createElement(M?_.A:e,{size:U});case C.s.SURGE:return o.createElement(e,{size:U});case C.s.USB:return o.createElement(a.A,{size:U});case C.s.LAN:return null;case C.s.WAN:return o.createElement(p.A,{size:U});default:return null}},[k,V,M,U]),oe=(0,o.useCallback)(t=>{t?.preventDefault?.(),t?.stopPropagation?.(),D||ee&&j((0,I.XP)({type:b.H.DEVICE,id:e,tab:W,subId:String(B),subPanel:g.uY.OUTLETS}))},[j,W,e,ee,B,D]),ne=M&&V===C.s.STANDARD;return o.createElement(h.A,{description:te,placement:y},o.createElement(w,{isEnabled:!(!X||V===C.s.SURGE&&z||G),outletType:V||C.s.STANDARD,marginSize:i,cellSize:n,verticalGap:A,centerIcon:P,onClick:oe,...T.A.addDataTestId(T.A.TestId.SIDE_PANEL_TRIGGER)},o.createElement(x,{iconRotation:ne?void 0:f},ie)))}},245555(e,t,i){i.d(t,{O:()=>o});const o=""},268892(e,t,i){i.d(t,{$:()=>a,g:()=>c});var o=i(296540),n=i(469733),r=i(239417),l=i(532419),s=i(927806);const c=(e,t,i,o)=>{const n=t.get(e);if(n?.psu_table?.length)return!1;const r=n?(0,s.$Y)({device:n,devices:o}):void 0;if(Number(r?.poe_power))return!0;const l=i.get(e);return!!(l&&"uplink_mac"in l?t.get(l.uplink_mac)?.port_table?.find(t=>t.last_connection?.mac===e&&Number(t?.poe_power)):void 0)},a=e=>{const t=(0,n.useSelector)(l.ID),i=(0,n.useSelector)(l.Kh),s=(0,n.useSelector)(r.Cx);return(0,o.useMemo)(()=>c(e,i,s,t),[e,t,i,s])}},999425(e,t,i){i.d(t,{Ay:()=>b,HJ:()=>f,JV:()=>O});var o=i(296540),n=i(784045),r=i(469733),l=i(916537),s=i(532419),c=i(678419),a=i(223792),u=i(6176),p=i(876250),d=i(566723),m=i(6510),E=i(751998),_=i(405639),A=i(245555),h=i(694595),T=i(268892);const O=e=>`${a.F.OUTLET}:${e.index}`,f=e=>`${a.F.POE_PORT}:${e.port_idx}`,v={showUnassign:!0,includePoe:!0},b=(e,t,i,b,{showUnassign:S,includePoe:g}=v)=>{const{formatMessage:N}=(0,l.tz)(),I=(0,r.useSelector)(c.Lr),R=(0,r.useSelector)(s.ID),C=(0,o.useMemo)(()=>I.filter(({id:e})=>e!==b),[b,I]),P=(0,T.$)(e),w=i?.startsWith(a.F.OUTLET)?Number(i?.split(":")[1]):void 0,x=i?.startsWith(a.F.POE_PORT)?Number(i?.split(":")[1]):void 0,M=(0,o.useMemo)(()=>[...S?[{label:N({id:"COMMON_UNASSIGNED"}),value:A.O,options:{outlets:[],ports:[]},device:null}]:[],...!R.some(e=>e.mac===t)&&t?[{value:t,label:t,mac:t,options:(0,h.cL)(void 0,P,w?[w]:[],x?[x]:[])}]:[],...(0,n.A)(R,m.Q).filter(i=>i.mac!==e||i.mac===t).map(e=>{const i=(0,h.cL)(e,P&&Boolean(g),t===e.mac&&w?[w]:[],t===e.mac&&x?[x]:[]);return{device:e,label:(0,m.Q)(e),value:e.mac,image:o.createElement(u.A,{model:e.model,size:p.Xh.SMALL,width:d.S2,height:d.S2}),options:i}}).filter(e=>e.options.outlets.length||e.options.ports.length||e.value===t)],[P,g,e,R,N,t,w,x,S]),y=M.find(e=>e.value===t);return{powerSourceOptions:M,portOutletOptions:(0,o.useMemo)(()=>y?[...(y?.options?.outlets||[]).map(e=>{const i=C.some(i=>i.power_sources.some(i=>i.power_source_mac===t&&i.power_source_index===e.index&&i.power_source_type===a.F.OUTLET));return{label:`${e.index}`,value:O(e),image:o.createElement(_.A,{disableOnPortClick:!0,cellData:e,activeItemMac:""}),disabled:i,tooltipDescription:i?o.createElement(l.sA,{id:"SETTINGS_POWER_SUPERVISOR_OUTLET_IN_USE_TOOLTIP"}):null}}),...(y?.options?.ports||[]).flatMap(e=>{if(!y.device)return[];const i=C.some(i=>i.power_sources.some(i=>i.power_source_mac===t&&i.power_source_index===e.port_idx&&i.power_source_type===a.F.POE_PORT));return[{label:`${e.port_idx}`,value:f(e),image:o.createElement(E.A,{port:e,device:y.device}),disabled:i,tooltipDescription:i?o.createElement(l.sA,{id:"SETTINGS_POWER_SUPERVISOR_OUTLET_IN_USE_TOOLTIP"}):null}]})]:[],[y,C,t])}}},694595(e,t,i){i.d(t,{AP:()=>p,K_:()=>_,_Q:()=>E,cL:()=>d,hr:()=>A,lD:()=>m});var o=i(578819),n=i(780811),r=i(602197),l=i(927806),s=i(768195),c=i(557260),a=i(860631),u=i(999425);const p=e=>(e.outlet_caps??0)>=c.A.OUTLET_CAP_AC?(0,a.sQ)(e,c.A.OUTLET_CAP_AC):void 0!==e.outlet_type&&e.outlet_type===s.sj.AC,d=(e,t,i,r)=>{const l=(s=e?.model,s&&((0,n.kYz)({model:s})||(0,n.Tl7)({model:s})||(0,n.vqp)({model:s}))&&e?.outlet_table?.filter(e=>p(e))||[]);var s;const c=t&&e?.port_table?.filter(e=>(0,o.qP)(e))||[];return{outlets:[...l,...i.filter(e=>!l.some(t=>t.index===e)).map(e=>({index:e}))],ports:[...c,...r.filter(e=>!c.some(t=>t.port_idx===e)).map(e=>({port_idx:e}))]}},m=(e,t)=>{const i=e&&"psu_table"in e&&e.psu_table?e.psu_table:[];return i.length?i.map((e,t)=>({key:`psu-${e.index??t+1}`,type:"psu",label:`PSU ${e.index??t+1}`,index:t+1,psuIndex:e.index??t+1,psu:e})):t?.power_sources?.length?t.power_sources.map((e,t)=>({key:`general-${e.power_source_type}-${e.client_psu_index}`,type:"general",psuIndex:e.client_psu_index,index:t+1})):[{key:"general",type:"general",index:1,psuIndex:1}]},E=(e,t)=>{const i=t.find(t=>t.value===e);return i?.options?.outlets[0]?(0,u.JV)(i.options.outlets[0]):i?.options?.ports[0]?(0,u.HJ)(i.options.ports[0]):""},_=e=>e===r.g.CONNECTED,A=(e,t,i,o)=>{const n=i.get(e);if(n&&!n.psu_table?.length){const e=(0,l.Ag)(t,n),i=(0,l.$Y)({device:n,devices:t});if(e&&i&&Number(i.poe_power)&&i.port_idx)return{mac:e.mac,port_idx:i.port_idx}}const r=o.get(e);if(r&&"uplink_mac"in r){const t=i.get(r.uplink_mac),o=t?.port_table?.find(t=>t.last_connection?.mac===e);if(t&&o&&o.port_idx&&Number(o.poe_power))return{mac:t.mac,port_idx:o.port_idx}}}},641777(e,t,i){i.d(t,{A:()=>l});var o=i(296540),n=i(284428),r=i(451449);const l=({isDisabled:e,isAdditive:t=!0,children:i})=>{const l=(0,n.pv)(),s=(0,o.useMemo)(()=>"boolean"==typeof e?{fields:e,labels:e,tooltipIcons:e,tooltipPopovers:!1}:e,[e]),c=(0,o.useMemo)(()=>({fields:t?s.fields||l.fields:s.fields,labels:t?s.labels||l.labels:s.labels,tooltipIcons:t?s.tooltipIcons||l.tooltipIcons:s.tooltipIcons,tooltipPopovers:t?s.tooltipPopovers||l.tooltipPopovers:s.tooltipPopovers}),[t,s.fields,s.labels,s.tooltipIcons,s.tooltipPopovers,l.fields,l.labels,l.tooltipIcons,l.tooltipPopovers]);return o.createElement(r.I.Provider,{value:c},i)}}}]);