"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[97574],{78853(e,t,n){n.d(t,{A:()=>C});var r,a=n(592563),l=n(296540),i=n(469733),c=n(217439),o=n(187483),s=n(916537),m=n(689965),u=n(86571),d=n(801081);!function(e){e.OPEN_MODAL="openModal"}(r||(r={}));const _=(0,d.Mz)(o.zn,e=>void 0!==e[r.OPEN_MODAL]);var A=n(856632),E=n(957866);const p=({uidbDevice:e})=>{const t=(0,i.useSelector)(o.zn),n=t?.[r.OPEN_MODAL];return n?l.createElement(a.A,{onClick:()=>n(e)},l.createElement(c.A,{size:"medium",color:"inherit"},l.createElement(s.sA,{id:"DEVICE_SHOW_DETAILS"}))):null},O=({shortname:e})=>{(0,E.A)();const t=(0,i.useSelector)((0,l.useMemo)(()=>(0,A.$E)(e),[e]));return t?.compliance?l.createElement(m.A,{type:m.I.ACCORDION,items:[{id:"compliance",label:l.createElement(u.A,{id:"COMMON_COMPLIANCE"}),renderContent:()=>l.createElement(p,{uidbDevice:t}),openByDefault:!0}]}):null},C=({shortname:e})=>(0,i.useSelector)(_)?l.createElement(O,{shortname:e}):null},686130(e,t,n){n.d(t,{A:()=>z});var r=n(469733),a=n(296540),l=n(592510),i=n(860631),c=n(666889),o=n(635740),s=n(745667),m=n(634229),u=n(602021),d=n(776288),_=n(71479),A=n(180524),E=n(369702),p=n(916537),O=n(780811),C=n(837612),v=n(602197),N=n(199582);const w=(0,_.A)("span")`
  width: 100%;
`,P=({activeItem:e,onClick:t,disabledWithReason:n,[N.L]:r})=>{const l=(e=>{const t=(0,C.S9)(e);return e.disabled||t!==v.g.CONNECTED||!(0,O.sc7)(t)?"DEVICE_PCAP_DISABLED_TOOLTIP":null})(e)||n;return a.createElement(A.A,{description:l?a.createElement(p.sA,{id:l}):void 0},a.createElement(w,{...r&&{[N.L]:r}},a.createElement(E.A,{onClick:t,isDisabled:!!l,width:"full"},a.createElement(p.sA,{id:"COMMON_PACKET_CAPTURE"}))))};var I=n(845030),D=n(398300),f=n(968906),M=n(683086),T=n(132196),g=n(566723),h=n(294303);const R=T.AH`
  &:empty {
    display: none;
  }
`,b=(0,_.A)("div")`
  flex: 1 1 0;
  min-width: 33%;
  box-sizing: border-box;
  padding-right: ${g.kc};

  &:last-child {
    padding-right: 0;
  }
`,S=({children:e,...t})=>a.createElement(h.A,{marginTop:g.kc,className:R,...t},a.Children.map(e,e=>e?a.createElement(b,{className:R},e):null)),z=({activeItem:e,showPortsButton:t,showCaptureButton:n})=>{const _=(0,r.useDispatch)(),A=(0,r.useSelector)(u.vc),E=(0,r.useSelector)(c.ar),p=n&&A===e.mac&&E&&(0,i.W4)(e,d.A.PCAP),O=t&&e.port_table?.length>0;(0,a.useEffect)(()=>{_((0,m.Sk)(void 0,{crudCacheStrategy:{type:l.e.CACHE}})),_((0,s.hh)(void 0,{crudCacheStrategy:{type:l.e.CACHE}}))},[_]);const C=(0,a.useCallback)(()=>{_((0,I.XP)({type:D.H.PACKET_CAPTURE,id:e.mac,customData:{captureDeviceType:o.X.GATEWAY}}))},[_,e.mac]);return a.createElement(a.Fragment,null,a.createElement(S,null,O?a.createElement(M.A,{mac:e.mac}):null,p?a.createElement(P,{activeItem:e,captureDeviceType:o.X.GATEWAY,onClick:C,...f.A.addDataTestId(f.A.TestId.SIDE_PANEL_TRIGGER)}):null))}},635740(e,t,n){var r,a;n.d(t,{A:()=>r,X:()=>a}),function(e){e.DEFAULT="default",e.IN_PROGRESS="inProgress",e.READY="ready",e.DOWNLOADING="downloading",e.STOPPING="stopping"}(r||(r={})),function(e){e.AP="ap",e.GATEWAY="gateway"}(a||(a={}))},666889(e,t,n){n.d(t,{ar:()=>I,ax:()=>D,r8:()=>f});var r=n(801081),a=n(189601),l=n(513180),i=n(573531),c=n(938325),o=n(477544),s=n(339879),m=n(959207),u=n(233187),d=n(366188),_=n(535657),A=n(615720),E=n(532419),p=n(180830),O=n(635740);const C=[u.rR.CORPORATE,u.rR.GUEST],v=e=>void 0===e||e,N=({_id:e,name:t,enabled:n,ip_subnet:r,ipv6_subnet:a,wan_networkgroup:l,vpn_type:c,purpose:o,l2tp_interface:s,openvpn_interface:u,wireguard_interface:d,ipsec_interface:A,sdwan_hub_spoke_local_wan_id:E},p)=>({_id:e,enabled:v(n),name:t||i.L,ip_subnet:p?i.L:(0,m.Qe)({ip_subnet:r,ipv6_subnet:a},_.L),wan_networkgroup:l,vpn_type:c,ipsec_interface:A,l2tp_interface:s,openvpn_interface:u,purpose:o,sdwan_hub_spoke_local_wan_id:E,wireguard_interface:d}),w=(e,t)=>e?e===l.C.WAN?t.wan1:t[e.toLocaleLowerCase()]||{}:{},P=(0,a.WY)()((0,r.Mz)(d.Ct,E.U$,s.$D,E.AL,(e,t,n,r)=>[...e.reduce((e,n)=>(n&&t.network_table?.some(({_id:e})=>e===n._id)&&v(n.enabled)&&n.gateway_type!==u.xk.SWITCH&&C.includes(n.purpose)&&e.push(N(n)),e),[]),...n.reduce((e,{configuration:n={}})=>{if((({purpose:e,wan_networkgroup:t},n)=>{if(e!==u.rR.WAN)return!1;if(t===l.C.WAN_LTE_FAILOVER)return!0;const r=w(t,n);return!!r?.up})(n,t)){let a;if(n.wan_networkgroup===l.C.WAN_LTE_FAILOVER)a=r?.lte_ip;else{const e=w(n.wan_networkgroup,t);a=e?.ip}e.push({...N(n),...a?{ip_subnet:a}:{}})}return e},[])]),e=>e),I=(0,a.WY)()((0,r.Mz)(P,e=>Boolean(e.length)),e=>e),D=(e,t)=>{switch(t){case O.X.AP:return(e=>(0,r.Mz)(d.Ct,o.Ag,(0,p.a5)(e),E.fq,E.Dx,(e,t,n,r,a)=>{const l=t.reduce((e,{enabled:t,networkconf_id:r,ap_group_ids:a=[]})=>(t&&n.some(({_id:e})=>a.includes(e))&&e.push(r),e),[]);return e.reduce((e,t)=>(A.A.includes(t.purpose)&&l.includes(t._id)&&e.push(N(t,(0,c.cH)({gateway_device:t.gateway_device,purpose:t.purpose},r,a))),e),[])}))(e);case O.X.GATEWAY:return P;default:return()=>[]}},f=e=>(0,r.Mz)(o.Ag,t=>{const n=t.filter(t=>t.networkconf_id===e);return[...new Set(n.flatMap(e=>e.wlan_bands))]})},400242(e,t,n){n.d(t,{A:()=>o});var r=n(296540),a=n(217439),l=n(916537),i=n(780811),c=n(360113);const o=({ip:e,lan_ip:t,ethernet_overrides:n,port_table:o,type:s,wan:m=!1,lan:u=!1,compact:d=!1})=>{const _=(0,i.o_Q)({type:s,ip:e,lan_ip:t,ethernet_overrides:n,port_table:o}),A=(0,r.useMemo)(()=>m?"DEVICE_PROPERTY_OVERVIEW_WAN_IP_ADDRESS":u?"DEVICE_PROPERTY_OVERVIEW_LAN_IP_ADDRESS":"COMMON_IP_ADDRESS",[m,u]);return _?r.createElement(c.A,{compact:d},r.createElement(a.A,{color:"text-2",size:"medium"},r.createElement(l.sA,{id:A})),r.createElement(a.A,{color:"text-3",size:"medium"},_)):null}},205830(e,t,n){n.d(t,{A:()=>u});var r=n(296540),a=n(217439),l=n(83438),i=n(566723),c=n(294303),o=n(916537),s=n(780811),m=n(360113);const u=({sys_stats:e,flexProps:t,withTooltip:n,compact:u=!1})=>{const d=(0,s.eiG)(e);return d?r.createElement(m.A,{flexProps:t,compact:u},r.createElement(a.A,{color:"text-2",size:"medium"},r.createElement(o.sA,{id:"COMMON_LOAD_AVERAGE"})),n?r.createElement(c.A,{alignItems:"center",gap:i.YC},r.createElement(a.A,{color:"text-3",size:"medium"},d),r.createElement(l.A,{description:r.createElement(o.sA,{id:"DEVICE_PROPERTY_OVERVIEW_LOAD_AVERAGE_TOOLTIP"}),placement:"top start"})):r.createElement(a.A,{color:"text-3",size:"medium"},d)):null}},559674(e,t,n){n.d(t,{A:()=>s});var r=n(296540),a=n(217439),l=n(115829),i=n(294303),c=n(916537),o=n(360113);const s=({connection_network_name:e})=>e?r.createElement(o.A,null,r.createElement(a.A,{color:"text-2",size:"medium"},r.createElement(c.sA,{id:"COMMON_NETWORK"})),r.createElement(i.A,null,r.createElement(l.A,{color:"text-3",size:"medium"},e))):null},633819(e,t,n){n.d(t,{A:()=>c});var r=n(296540),a=n(217439),l=n(916537),i=n(360113);const c=({totalPower:e})=>e?r.createElement(i.A,null,r.createElement(a.A,{color:"text-2",size:"medium"},r.createElement(l.sA,{id:"DEVICE_HEADER_POWER_CONSUMPTION"})),r.createElement(a.A,{color:"text-3",size:"medium"},r.createElement(l.sA,{id:"COMMON_UNIT_WATTS_SHORT",values:{value:e.toFixed(1)}}))):null},15244(e,t,n){n.d(t,{A:()=>h});var r=n(469733),a=n(296540),l=n(979106),i=n(362412),c=n(594827),o=n(513180),s=n(566723),m=n(294303),u=n(689965),d=n(916537),_=n(339879),A=n(316144),E=n(927806),p=n(993341),O=n(28536);var C=n(659243),v=n(217439),N=n(777916),w=n(137298),P=n(817518),I=n(348466),D=n(360113),f=n(258117),M=n(723544),T=n(146784);const g=({uplinkAttrs:e,configuration:t={wan_dns1:void 0,wan_dns2:void 0,wan_dhcpv6_pd_size:void 0,wan_type_v6:void 0,wan_prefixlen:void 0},details:n={},gatewayPort:{ipv6:r=[]}={}})=>{const{ip:l,speed:i,rx_packets:c,rx_bytes:o,tx_packets:s,tx_bytes:u,"rx_bytes-r":_,"tx_bytes-r":A,mac:E}=e||{};return a.createElement(m.A,{height:"100%",flexDirection:"column"},l?a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"COMMON_IP_ADDRESS"})),a.createElement(v.A,{size:"medium",color:"text-3"},l)):null,r.length?a.createElement(T.A,{ipv6_address:r,wan_dhcpv6_pd_size:t.wan_type_v6===P.c.SLAAC||t.wan_type_v6===P.c.DHCPV6?t.wan_dhcpv6_pd_size:void 0}):null,a.createElement(M.A,{mac:E}),a.createElement(f.A,{portSpeed:i}),n.service_provider?.name?a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"COMMON_ISP"})),a.createElement(v.A,{size:"medium",color:"text-3"},n.service_provider.name)):null,a.createElement(a.Fragment,null,t.wan_dns1?a.createElement(D.A,null,a.createElement(v.A,{color:"text-2",size:"medium"},a.createElement(d.sA,{id:"COMMON_DNS_SERVER_N",values:{n:1}})),a.createElement(v.A,{color:"text-3",size:"medium"},t.wan_dns1)):null,t.wan_dns2?a.createElement(D.A,null,a.createElement(v.A,{color:"text-2",size:"medium"},a.createElement(d.sA,{id:"COMMON_DNS_SERVER_N",values:{n:2}})),a.createElement(v.A,{color:"text-3",size:"medium"},t.wan_dns2)):null),c&&o?a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"COMMON_DOWN_PKTS_BYTES"})),a.createElement(v.A,{size:"medium",color:"text-3"},(0,C.A)(c,{spacer:I.HY})," / ",(0,w.z3)(o))):null,s&&u?a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"COMMON_UP_PKTS_BYTES"})),a.createElement(v.A,{size:"medium",color:"text-3"},(0,C.A)(s,{spacer:I.HY})," / ",(0,w.z3)(u))):null,a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"DEVICE_PROPERTY_UPLINK_DOWN_ACTIVITY"})),a.createElement(v.A,{size:"medium",color:"text-3"},void 0!==_?a.createElement(N.A,{type:"bytes",input:_,options:"bitrate",size:"body",color:"inherit"}):a.createElement(d.sA,{id:"COMMON_FALLBACK"}))),a.createElement(D.A,null,a.createElement(v.A,{size:"medium"},a.createElement(d.sA,{id:"DEVICE_PROPERTY_UPLINK_UP_ACTIVITY"})),a.createElement(v.A,{size:"medium",color:"text-3"},void 0!==A?a.createElement(N.A,{type:"bytes",input:A,options:"bitrate",size:"body",color:"inherit"}):a.createElement(d.sA,{id:"COMMON_FALLBACK"}))))},h=({activeItem:e})=>{const{formatMessage:t}=(0,d.tz)(),n=((e,t)=>{const n=(e.port_table||[]).filter(({up:e})=>e);return Object.values(O.s).reduce((r,a)=>{const l=1===(0,c.si)(a)?o.C.WAN:a.toUpperCase();if(n.find(({ifname:t})=>t===(0,A.KF)(l,{ethernet_overrides:e.ethernet_overrides,model:e.model,usg_caps:e.usg_caps,usg2_caps:e.usg2_caps}))||(i=e[a],i?.type===p.YT)){const n=(0,E.q$)(e,a);n&&r.push({wanNetworkGroup:l,uplinkAttrs:n,...(()=>{const{configuration:e={},details:n={}}=t.find(({configuration:{wan_networkgroup:e}})=>e===l)||{};return{configuration:e,details:n}})(),gatewayPort:e[a]})}var i;return r},[])})(e,(0,r.useSelector)(_.ht)),C=(0,a.useMemo)(()=>n.map(({wanNetworkGroup:e})=>({id:e,label:t({id:"COMMON_NETWORK_PURPOSE_WANX"},{number:(0,c.si)(e)})})),[t,n]),v=(0,a.useMemo)(()=>n.map(({wanNetworkGroup:e,configuration:t={}})=>({value:e,label:t.name||"",additionalInfo:a.createElement(d.sA,{id:"COMMON_NETWORK_PURPOSE_WANX",values:{number:(0,c.si)(e)}})})),[n]),[N,w]=(0,a.useState)(n?.[0]?.wanNetworkGroup||o.C.WAN),P=n.length<=4,I=(0,a.useMemo)(()=>n.find(({wanNetworkGroup:e})=>e===N)||{},[n,N]),D=(0,a.useMemo)(()=>[{id:"wan",openByDefault:!0,label:a.createElement(d.sA,1===C.length?{id:"COMMON_NETWORK_PURPOSE_WANX",values:{number:1}}:{id:"COMMON_NETWORK_PURPOSE_WAN"}),renderContent:()=>a.createElement(a.Fragment,null,C.length>1?a.createElement(m.A,{paddingBottom:s.kc,inline:P},P?a.createElement(l.A,{tabs:C,variant:"filter",onSelectTab:({id:e})=>{w(e)},selectedTab:N}):a.createElement(i.A,{options:v,width:"100%",variant:"secondary",value:N,onChange:({value:e})=>{w(e)}})):null,a.createElement(g,{...I}))}],[C,P,v,N,w,I]);return I?a.createElement(u.A,{type:u.I.ACCORDION,items:D}):null}},328787(e,t,n){n.d(t,{A:()=>d});var r=n(469733),a=n(296540),l=n(149133),i=n(855019),c=n(551753),o=n(916537),s=n(532419),m=n(765562);const u=({adopted:e})=>a.createElement(c.A,{link:m.A.virtualNetworkConnectivity},a.createElement(o.sA,{id:e?"DEVICE_FALLBACK_IP_ADOPTED_WITH_UNIFI_GATEWAY_WARNING":"DEVICE_FALLBACK_IP_NOT_ADOPTED_WARNING",values:{bold:a.createElement("strong",null,a.createElement(o.sA,{id:e?"DEVICE_WARNING_FALLBACK_IP":"DEVICE_WARNING_ADOPTION_FAILED"}))}})),d=({ip:e,adopted:t,config_network:n})=>(0,r.useSelector)(s.m9)&&(0,l.W5)(e)&&n?.type===i.NL.DHCP?a.createElement(u,{adopted:t}):null},957866(e,t,n){n.d(t,{A:()=>o});var r=n(296540),a=n(469733),l=n(765562),i=n(79871),c=n(856632);const o=()=>{const e=(0,a.useDispatch)(),t=(0,a.useSelector)(c.eo);return(0,r.useEffect)(()=>{t||(async()=>{const t=await fetch(l.A.fingerprintPublicDatabasePath),n=await t.json();e((0,i.$)(n))})()},[t,e]),t}},856632(e,t,n){n.d(t,{$E:()=>m,eo:()=>o});var r=n(801081),a=n(523275),l=n(840279),i=n(919952);const c=e=>e[i.U.UIDB]||(0,a.A)(),o=(0,r.Mz)(c,({version:e})=>Boolean(e)),s=(0,r.Mz)(c,({devices:e})=>e||(0,l.A)()),m=e=>(0,r.Mz)(s,t=>t.find(({shortnames:t})=>e&&(t||[]).includes(e))||(0,a.A)());(0,r.Mz)(s,e=>{const t=new Map;for(let n=0;n<e.length;n+=1){const r=e[n].power?.baseConsumption;if(void 0!==r){const{shortnames:a}=e[n];for(let e=0;e<(a||[]).length;e+=1)t.set(a[e],r)}}return t})}}]);