"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[52710],{188481(e,t,i){var s;i.d(t,{s:()=>s}),function(e){e.STANDARD="standard",e.USB="usb",e.LAN="lan",e.WAN="wan",e.RJ45="rj45",e.SURGE="surge"}(s||(s={}))},164205(e,t,i){i.d(t,{Av:()=>r,KP:()=>n,R4:()=>o});var s=i(455425);const o={heartbeat_interval:s.gG,silence_threshold:15*s.gG,power_off_duration:2*s.gG},n={heartbeat_interval:s.gG,silence_threshold:5*s.gG,power_off_duration:1*s.gG},r={heartbeat_interval:5*s.gG,silence_threshold:150*s.gG,power_off_duration:150*s.gG}},55375(e,t,i){i.d(t,{A:()=>A});var s=i(274934),o=i(602086),n=i(977872),r=i(167933),l=i(874866),c=i(197571),a=i(461731),d=i(68105),p=i(160286),u=i(267561),_=i(940229);const A=({port:e,device:t})=>{const i=(0,n.d4)(l.D),A=(0,n.d4)(p.D5),h=(0,n.d4)(c.wf),x=(0,n.d4)(r.pB),m=(0,n.d4)(a.G),T=(0,n.d4)(d.qS),j=(0,o.useMemo)(()=>(0,_.vT)(e,t,i,A,h,x,m,T),[e,t,i,A,h,x,m,T]);return(0,s.jsx)(u.A,{port:j,isInteractive:!1})}},682662(e,t,i){i.d(t,{A:()=>M});var s=i(274934),o=i(602086),n=i(814557),r=i(977872),l=i(675709),c=i(938984),a=i(95032),d=i(975020),p=i(811114),u=i(912294),_=i(164815),A=i(380047),h=i(187075),x=i(245505),m=i(247816),T=i(669439),j=i(590979),O=i(254585),E=i(291508),f=i(586566),v=i(449339),b=i(309130),g=i(589650),N=i(100978),S=i(205521),I=i(470070),R=i(188481),C=i(565527);const w=(0,m.A)("div",(0,E.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===C.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:s}}})=>{switch(e){case R.s.RJ45:return`\n          background-color: ${s};\n          border: 1px solid ${n.Ay[`desktop-color-ublue-03-${i}`]};\n        `;case R.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        `}}}
`,P=(0,m.A)("div",(0,E.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:m,iconRotation:E,centerIcon:C,showBatteryPowered:M,tooltipPlacement:y,disableOnPortClick:D,iconSize:U,isBatteryMode:z,tooltipOverride:L,disableTooltip:$,isEU:k,offline:G})=>{const W=(0,r.wA)(),F=(0,r.d4)(O.oI),V=(0,f.TT)(t,"POWER_METER"),{outletType:B=R.s.STANDARD,index:J,name:Y,outlet_power:H,outlet_current:K,outlet_voltage:Q,outlet_power_factor:q,cycle_enabled:X,relay_state:Z,surgeType:ee}=t,te=[R.s.STANDARD,R.s.USB].includes(B),ie=(0,o.useMemo)(()=>{if(!$)return L||(B===R.s.RJ45?ee?(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:ee===l.ME.IN?"DEVICE_SURGE_IN":"DEVICE_SURGE_OUT"})}):null:B===R.s.WAN?(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"DEVICE_PROPERTIES_OUTLET_TOOLTIP_WAN_NO_STATUS_INFO"})}):(0,s.jsxs)(N.A,V&&B===R.s.STANDARD?{flexDirection:"column",justifyContent:"space-between",minWidth:180,children:[(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_AC_OUTLET"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:J})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",alignItems:"center",gap:b.kc,children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_NAME"})}),(0,s.jsx)(a.A,{size:"inherit",color:"inherit",isTruncated:!0,children:Y})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_POWER"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:Number(H||0).toFixed(2)}})})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_CURRENT"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_UNIT_AMPERES_SHORT",values:{value:Number(K||0).toFixed(2)}})})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_VOLTAGE"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_UNIT_VOLTAGE_SHORT",values:{value:Number(Q||0).toFixed(2)}})})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_POWER_FACTOR"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:Number(q||0).toFixed(2)})]})]}:{flexDirection:"column",justifyContent:"space-between",minWidth:180,children:[(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_OUTLET"})}),(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:J})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",alignItems:"center",gap:b.kc,children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"COMMON_NAME"})}),(0,s.jsx)(a.A,{size:"inherit",color:"inherit",isTruncated:!0,children:Y})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"DEVICE_PROPERTIES_OUTLET_CTL_POWER_CYCLE_ENABLED"})}),(0,s.jsx)(X?A.A:_.A,{})]}),(0,s.jsxs)(N.A,{justifyContent:"space-between",children:[(0,s.jsx)(c.A,{size:"inherit",color:"inherit",children:(0,s.jsx)(I.sA,{id:"DEVICE_PROPERTIES_OUTLET_RELAY_STATE"})}),(0,s.jsx)(Z?A.A:_.A,{})]})]}))},[$,L,B,V,J,Y,H,K,Q,q,X,Z,ee]),se=(0,o.useMemo)(()=>{const e=k?h.A:p.A;switch(B){case R.s.STANDARD:return(0,s.jsx)(M?x.A:e,{size:U});case R.s.SURGE:return(0,s.jsx)(e,{size:U});case R.s.USB:return(0,s.jsx)(d.A,{size:U});case R.s.LAN:return null;case R.s.WAN:return(0,s.jsx)(u.A,{size:U});default:return null}},[k,B,M,U]),oe=(0,o.useCallback)(t=>{t?.preventDefault?.(),t?.stopPropagation?.(),D||te&&W((0,S.XP)({type:v.H.DEVICE,id:e,tab:F,subId:String(J),subPanel:g.uY.OUTLETS}))},[W,F,e,te,J,D]),ne=M&&B===R.s.STANDARD;return(0,s.jsx)(T.A,{description:ie,placement:y,children:(0,s.jsx)(w,{isEnabled:!(!Z||B===R.s.SURGE&&z||G),outletType:B||R.s.STANDARD,marginSize:i,cellSize:n,verticalGap:m,centerIcon:C,onClick:oe,...j.A.addDataTestId(j.A.TestId.SIDE_PANEL_TRIGGER),children:(0,s.jsx)(P,{iconRotation:ne?void 0:E,children:se})})})}},644026(e,t,i){i.d(t,{O:()=>s});const s=""},932093(e,t,i){i.d(t,{$:()=>a,g:()=>c});var s=i(602086),o=i(977872),n=i(34118),r=i(754924),l=i(853109);const c=(e,t,i,s)=>{const o=t.get(e);if(o?.psu_table?.length)return!1;const n=o?(0,l.$Y)({device:o,devices:s}):void 0;if(Number(n?.poe_power))return!0;const r=i.get(e);return!!(r&&"uplink_mac"in r?t.get(r.uplink_mac)?.port_table?.find(t=>t.last_connection?.mac===e&&Number(t?.poe_power)):void 0)},a=e=>{const t=(0,o.d4)(r.ID),i=(0,o.d4)(r.Kh),l=(0,o.d4)(n.Cx);return(0,s.useMemo)(()=>c(e,i,l,t),[e,t,i,l])}},17722(e,t,i){i.d(t,{Ay:()=>v,HJ:()=>E,JV:()=>O});var s=i(274934),o=i(602086),n=i(117948),r=i(977872),l=i(470070),c=i(754924),a=i(232410),d=i(35977),p=i(974390),u=i(541819),_=i(309130),A=i(347625),h=i(55375),x=i(682662),m=i(644026),T=i(113454),j=i(932093);const O=e=>`${d.F.OUTLET}:${e.index}`,E=e=>`${d.F.POE_PORT}:${e.port_idx}`,f={showUnassign:!0,includePoe:!0},v=(e,t,i,v,{showUnassign:b,includePoe:g}=f)=>{const{formatMessage:N}=(0,l.tz)(),S=(0,r.d4)(a.Lr),I=(0,r.d4)(c.ID),R=(0,o.useMemo)(()=>S.filter(({id:e})=>e!==v),[v,S]),C=(0,j.$)(e),w=i?.startsWith(d.F.OUTLET)?Number(i?.split(":")[1]):void 0,P=i?.startsWith(d.F.POE_PORT)?Number(i?.split(":")[1]):void 0,M=(0,o.useMemo)(()=>[...b?[{label:N({id:"COMMON_UNASSIGNED"}),value:m.O,options:{outlets:[],ports:[]},device:null}]:[],...!I.some(e=>e.mac===t)&&t?[{value:t,label:t,mac:t,options:(0,T.cL)(void 0,C,w?[w]:[],P?[P]:[])}]:[],...(0,n.A)(I,A.Q).filter(i=>i.mac!==e||i.mac===t).map(e=>{const i=(0,T.cL)(e,C&&Boolean(g),t===e.mac&&w?[w]:[],t===e.mac&&P?[P]:[]);return{device:e,label:(0,A.Q)(e),value:e.mac,image:(0,s.jsx)(p.A,{model:e.model,size:u.Xh.SMALL,width:_.S2,height:_.S2}),options:i}}).filter(e=>e.options.outlets.length||e.options.ports.length||e.value===t)],[C,g,e,I,N,t,w,P,b]),y=M.find(e=>e.value===t);return{powerSourceOptions:M,portOutletOptions:(0,o.useMemo)(()=>y?[...(y?.options?.outlets||[]).map(e=>{const i=R.some(i=>i.power_sources.some(i=>i.power_source_mac===t&&i.power_source_index===e.index&&i.power_source_type===d.F.OUTLET));return{label:`${e.index}`,value:O(e),image:(0,s.jsx)(x.A,{disableOnPortClick:!0,cellData:e,activeItemMac:""}),disabled:i,tooltipDescription:i?(0,s.jsx)(l.sA,{id:"SETTINGS_POWER_SUPERVISOR_OUTLET_IN_USE_TOOLTIP"}):null}}),...(y?.options?.ports||[]).flatMap(e=>{if(!y.device)return[];const i=R.some(i=>i.power_sources.some(i=>i.power_source_mac===t&&i.power_source_index===e.port_idx&&i.power_source_type===d.F.POE_PORT));return[{label:`${e.port_idx}`,value:E(e),image:(0,s.jsx)(h.A,{port:e,device:y.device}),disabled:i,tooltipDescription:i?(0,s.jsx)(l.sA,{id:"SETTINGS_POWER_SUPERVISOR_OUTLET_IN_USE_TOOLTIP"}):null}]})]:[],[y,R,t])}}},113454(e,t,i){i.d(t,{AP:()=>p,K_:()=>h,_Q:()=>A,cL:()=>u,hr:()=>x,lD:()=>_});var s=i(469890),o=i(956978),n=i(45978),r=i(853109),l=i(857780),c=i(163727),a=i(586566),d=i(17722);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===l.sj.AC,u=(e,t,i,n)=>{const r=(l=e?.model,l&&((0,o.kYz)({model:l})||(0,o.Tl7)({model:l})||(0,o.vqp)({model:l}))&&e?.outlet_table?.filter(e=>p(e))||[]);var l;const c=t&&e?.port_table?.filter(e=>(0,s.qP)(e))||[];return{outlets:[...r,...i.filter(e=>!r.some(t=>t.index===e)).map(e=>({index:e}))],ports:[...c,...n.filter(e=>!c.some(t=>t.port_idx===e)).map(e=>({port_idx:e}))]}},_=(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}]},A=(e,t)=>{const i=t.find(t=>t.value===e);return i?.options?.outlets[0]?(0,d.JV)(i.options.outlets[0]):i?.options?.ports[0]?(0,d.HJ)(i.options.ports[0]):""},h=e=>e===n.g.CONNECTED,x=(e,t,i,s)=>{const o=i.get(e);if(o&&!o.psu_table?.length){const e=(0,r.Ag)(t,o),i=(0,r.$Y)({device:o,devices:t});if(e&&i&&Number(i.poe_power)&&i.port_idx)return{mac:e.mac,port_idx:i.port_idx}}const n=s.get(e);if(n&&"uplink_mac"in n){const t=i.get(n.uplink_mac),s=t?.port_table?.find(t=>t.last_connection?.mac===e);if(t&&s&&s.port_idx&&Number(s.poe_power))return{mac:t.mac,port_idx:s.port_idx}}}},877840(e,t,i){i.d(t,{A:()=>l});var s=i(274934),o=i(602086),n=i(184931),r=i(712642);const l=({isDisabled:e,isAdditive:t=!0,children:i})=>{const l=(0,n.pv)(),c=(0,o.useMemo)(()=>"boolean"==typeof e?{fields:e,labels:e,tooltipIcons:e,tooltipPopovers:!1}:e,[e]),a=(0,o.useMemo)(()=>({fields:t?c.fields||l.fields:c.fields,labels:t?c.labels||l.labels:c.labels,tooltipIcons:t?c.tooltipIcons||l.tooltipIcons:c.tooltipIcons,tooltipPopovers:t?c.tooltipPopovers||l.tooltipPopovers:c.tooltipPopovers}),[t,c.fields,c.labels,c.tooltipIcons,c.tooltipPopovers,l.fields,l.labels,l.tooltipIcons,l.tooltipPopovers]);return(0,s.jsx)(r.I.Provider,{value:a,children:i})}}}]);