"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[76948],{71265:(e,t,a)=>{a.d(t,{R:()=>m,k:()=>A});var n=a(280258),l=a(190497),r=a(953048),E=a(175522),c=a(936621),i=a(305988);const o=[...new Set([n.H,E.Q.join(E.A),r.Zt,c.F,l.nc,i.Vr])],s={numeric:!0,sensitivity:"base"},m=(e,t)=>{const a=[];for(let n=e;n<=t;n+=1)a.push({value:n,label:String(n)});return a},A=e=>({value:t,label:a},{value:n,label:l})=>o.includes(t?.toString())||o.includes(n?.toString())?1/0:a?.toString().localeCompare(l?.toString(),e,s)??-1},175522:(e,t,a)=>{a.d(t,{A:()=>l,Q:()=>r});var n=a(416348);const l="_",r=[n.ZM,n.Je]},205830:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(296540),l=a(217439),r=a(83438),E=a(566723),c=a(294303),i=a(699784),o=a(780811),s=a(360113);const m=({sys_stats:e,flexProps:t,withTooltip:a,compact:m=!1})=>{const A=(0,o.eiG)(e);return A?n.createElement(s.A,{flexProps:t,compact:m},n.createElement(l.A,{color:"text-2",size:"medium"},n.createElement(i.sA,{id:"COMMON_LOAD_AVERAGE"})),a?n.createElement(c.A,{alignItems:"center",gap:E.YC},n.createElement(l.A,{color:"text-3",size:"medium"},A),n.createElement(r.A,{description:n.createElement(i.sA,{id:"DEVICE_PROPERTY_OVERVIEW_LOAD_AVERAGE_TOOLTIP"}),placement:"top left"})):n.createElement(l.A,{color:"text-3",size:"medium"},A)):null}},211908:(e,t,a)=>{a.d(t,{A:()=>Y});var n=a(469733),l=a(296540),r=a(353899),E=a(758649),c=a(742920),i=a(421130),o=a(675359),s=a(699784),m=a(801081),A=a(25553),d=a(87485),_=a(264963);const u=e=>(0,m.Mz)((e=>(0,A.uh)((0,_.lX)({queryParams:{mac:e}})))(e),e=>(0,d.i6)(e)?.devices||[]);var C,p,I=a(768195),M=a(546391);!function(e){e.EXISTING="existing",e.NEW="new"}(C||(C={})),function(e){e.MAC="mac",e.TYPE="type",e.MODEL="model"}(p||(p={}));var v,N=a(238761),D=a(271856),S=a(438628),R=a(162420),T=a(400261),O=a(874807);!function(e){e.DEVICE_REPLACEMENT_MODE="deviceReplacementMode",e.SET_DEVICE_REPLACEMENT_MODE="setDeviceReplacementMode",e.NEW_MAC="newMac",e.SET_NEW_MAC="setNewMac",e.EXISTING_MAC="existingMac",e.SET_EXISTING_MAC="setExistingMac",e.REPLACEMENT_CANDIDATES="replacementCandidates",e.ERROR="error",e.RESET_ERROR="resetError"}(v||(v={}));const P={[v.DEVICE_REPLACEMENT_MODE]:void 0,[v.SET_DEVICE_REPLACEMENT_MODE]:O.P1,[v.NEW_MAC]:void 0,[v.SET_NEW_MAC]:O.P1,[v.EXISTING_MAC]:void 0,[v.SET_EXISTING_MAC]:O.P1,[v.REPLACEMENT_CANDIDATES]:[],[v.ERROR]:void 0,[v.RESET_ERROR]:O.P1},h=(0,l.createContext)(P);const g=a(132196).AH`
  height: 54px;
`;var L=a(71479),w=a(566723),f=a(294303);const y=(0,L.A)(f.A)`
  align-items: center;
  gap: ${w.YC};
`,b=(0,l.memo)(()=>{const{newMac:e,setNewMac:t,error:a,resetError:n}=(0,l.useContext)(h),r=(0,l.useCallback)(({target:{value:e}})=>{t((0,T.Z)(e)),n()},[t,n]);return l.createElement(S.A,{className:g,value:e,onChange:r,onFocus:n,variant:"secondary",label:l.createElement(y,null,l.createElement(s.sA,{id:"COMMON_MAC_ADDRESS"}),l.createElement(D.A,{portal:!0,width:"100%",maxWidth:248,description:l.createElement(s.sA,{id:"DEVICE_REPLACEMENT_MAC_LOCATION"})},l.createElement(R.A,{isActive:!0}))),width:"100%",invalid:a})});var V=a(362412),x=a(6176);const k=(0,l.memo)(()=>{const{replacementCandidates:e,existingMac:t,setExistingMac:a,error:n,resetError:r}=(0,l.useContext)(h),E=(0,l.useMemo)(()=>e.map(({mac:e,model:t,name:a})=>({label:a,value:e,image:l.createElement(x.A,{model:t}),additionalInfo:e})),[e]),c=(0,l.useCallback)(({value:e})=>{a(String(e)),r()},[a,r]);return l.createElement(V.A.Sorted,{value:t,label:l.createElement(s.sA,{id:"COMMON_DEVICE"}),width:"100%",searchable:!0,onChange:c,onFocus:r,maxHeight:228,options:E,invalid:n})}),W=(0,L.A)(f.A)`
  flex-direction: column;
  gap: ${w.kc};
`,G=(0,l.memo)(()=>{const{replacementCandidates:e,deviceReplacementMode:t,setDeviceReplacementMode:a,resetError:n}=(0,l.useContext)(h),r=(0,l.useMemo)(()=>e.length?[{id:C.EXISTING,children:l.createElement(s.sA,{id:"COMMON_EXISTING"}),onChange:()=>{a(C.EXISTING),n()},checked:t===C.EXISTING},{id:C.NEW,children:l.createElement(s.sA,{id:"COMMON_NEW"}),onChange:()=>{a(C.NEW),n()},checked:t===C.NEW}]:[],[e.length,t,a,n]);return l.createElement(W,null,l.createElement(N.A,{direction:"row",items:r}),t===C.EXISTING?l.createElement(k,null):null,t===C.NEW?l.createElement(b,null):null)}),z=(0,L.A)(f.A)`
  align-items: center;
  gap: ${w.YC};
  width: fit-content;
`;var X=a(252093);const B={[I.gQ.INCOMPATIBLE_REPLACEMENT]:"DEVICE_REPLACEMENT_DEVICE_INCOMPATIBLE_REPLACEMENT_ERROR",[I.gQ.REPLACEMENT_ALREADY_ASSIGNED]:"DEVICE_REPLACEMENT_DEVICE_REPLACEMENT_ALREADY_ASSIGNED_ERROR"},U=({mac:e,hideTooltip:t=!1})=>{const{formatMessage:a}=(0,s.tz)(),i=(0,n.useDispatch)(),[m,A]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),[N,D]=(0,l.useState)(C.NEW),[S,R]=(0,l.useState)(""),[T,O]=(0,l.useState)(""),[P,g]=(0,l.useState)(void 0),L=(0,n.useSelector)((0,l.useMemo)(()=>u(e),[e])),w=(0,l.useCallback)(()=>{A(!0)},[]),f=(0,l.useCallback)(()=>{A(!1),R(""),O(""),p(!1),D(C.NEW),g(void 0)},[]),y=(0,l.useCallback)(()=>{switch(N){case C.EXISTING:return T;case C.NEW:return S;default:return}},[N,T,S]),b=(0,l.useCallback)(()=>{i((0,o.ox)({icon:c.C.success,message:"DEVICE_REPLACEMENT_DEVICE_SET",duration:3e3})),f()},[i,f]),V=(0,l.useCallback)(e=>{switch(e.apiData?.replacement_state){case I.gQ.INCOMPATIBLE_REPLACEMENT:case I.gQ.REPLACEMENT_ALREADY_ASSIGNED:g(a({id:B[e.apiData.replacement_state]}));break;case I.gQ.CANNOT_REPLACE:default:i((0,o.ox)({icon:c.C.danger,message:"DEVICE_FAILED_TO_SET_REPLACEMENT_DEVICE",duration:3e3}))}},[i,a]),x=(0,l.useCallback)(()=>{p(!1)},[]),k=(0,l.useCallback)(()=>{p(!0),i((0,_.uC)(e,y())).then(b).catch(V).finally(x)},[i,b,V,e,y,x]),W=(0,l.useMemo)(()=>Boolean(y().match(M.b8)),[y]),U=(0,l.useMemo)(()=>[{text:l.createElement(s.sA,{id:"COMMON_ACTION_CANCEL"}),variant:"tertiary",onClick:f},{text:l.createElement(s.sA,{id:"COMMON_ACTION_APPLY"}),variant:"primary",onClick:k,disabled:!W||d,loader:d?"spinner":void 0}],[f,k,W,d]),Y=(0,l.useCallback)(()=>{g(void 0)},[g]),q=(0,l.useMemo)(()=>({[v.DEVICE_REPLACEMENT_MODE]:N,[v.SET_DEVICE_REPLACEMENT_MODE]:D,[v.NEW_MAC]:S,[v.SET_NEW_MAC]:R,[v.EXISTING_MAC]:T,[v.SET_EXISTING_MAC]:O,[v.REPLACEMENT_CANDIDATES]:L,[v.ERROR]:P,[v.RESET_ERROR]:Y}),[N,S,T,L,P,Y]);return(0,l.useEffect)(()=>{i((0,_.lX)({queryParams:{mac:e}}))},[i,e]),l.createElement(h.Provider,{value:q},l.createElement(r.A,{allowOverflow:!0,title:l.createElement(s.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"}),body:l.createElement(G,null),position:"top",portal:!0,actions:U,isOpen:m,onRequestClose:f},l.createElement(z,null,l.createElement(E.A,{type:"button",variant:"inline",size:"medium",onClick:w},l.createElement(s.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"})),t?null:l.createElement(X.A,{messageId:"DEVICE_SET_REPLACEMENT_DEVICE_DESCRIPTION",variant:"outline"}))))},Y=(0,l.memo)(({model:e,type:t,...a})=>(0,i.G)({type:t,model:e})?l.createElement(U,{type:t,model:e,...a}):null)},220405:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(296540),l=a(780811),r=a(513154),E=a(889879),c=a(328787),i=a(15244),o=a(686130),s=a(442728),m=a(812454),A=a(772317);const d=({activeItem:e,activeItem:{adopted:t,mac:a,type:d,model:_,uptime:u,total_used_power:C,ip:p,ipv6:I,lan_ip:M,displayable_version:v,connection_network_name:N,"system-stats":D,sys_stats:S,config_network:R,detailed_states:{device_near_power_limit:T}={device_near_power_limit:!1},shortname:O}})=>n.createElement(n.Fragment,null,n.createElement(m.A,{activeItem:e,showPortOverview:!0,hidePortsButton:!0},n.createElement(o.A,{activeItem:e,showPortsButton:!0,showCaptureButton:!0})),n.createElement(c.A,{ip:p,adopted:t,config_network:R}),n.createElement(E.A,{mac:a,type:d,model:_,device_near_power_limit:T,total_used_power:C,total_max_power:(0,l.Cox)(e)}),n.createElement(s.A,{activeItem:e}),n.createElement(r.A,{ip:p,lan_ip:M,ipv6:I,mac:a,displayable_version:v,connection_network_name:N,uptime:u,systemStatsMem:D?.mem,sys_stats:S,total_used_power:C}),n.createElement(i.A,{activeItem:e}),n.createElement(A.A,{shortname:O}))},252093:(e,t,a)=>{a.d(t,{A:()=>c});var n=a(296540),l=a(271856),r=a(162420),E=a(699784);const c=({messageId:e,tooltipClassName:t,values:a,isInteractive:c,portal:i,variant:o="twoTone",size:s="medium"})=>n.createElement(l.A,{description:n.createElement(E.sA,{id:e,values:a}),width:210,isInteractive:c,portal:i,tooltipClassName:t},n.createElement(r.A,{isActive:!0,omitSvgMargin:!0,variant:o,size:s}))},264963:(e,t,a)=>{a.d(t,{X2:()=>d,lX:()=>m,uC:()=>A});var n=a(516693),l=a(691189),r=a(742920),E=a(887831);const c="/v2/api/site/{site}/device/:mac:",i=`${c}/replacement-candidates`,o=`${c}/replace?replacementDeviceMac=:replacement-mac:`,s=`${c}/replace`,m=(e={},t={})=>(0,l.Kd)("replacementCandidates",`${i.replace(":mac:",e.queryParams?.mac)}`,e.queryParams?.mac,e,{...t,idField:"mac"}),A=(e,t)=>a=>a((0,l.vB)(n.aC,null,null,E.A.POST,o.replace(":mac:",e).replace(":replacement-mac:",t),{},null,{})),d=e=>t=>t((0,l.vB)(n.aC,null,null,E.A.DELETE,s.replace(":mac:",e),{},null,{failureToast:()=>({icon:r.C.danger,message:"COMMON_UNKNOWN_ERROR"})}))},284428:(e,t,a)=>{a.d(t,{Im:()=>i,iL:()=>o,mQ:()=>E,pv:()=>r,q:()=>c});var n=a(296540),l=a(451449);function r(){return(0,n.useContext)(l.I)}function E(){return r().fields}function c(){return r().tooltipPopovers}function i(){return r().tooltipIcons}function o(){return r().labels}},362412:(e,t,a)=>{a.d(t,{A:()=>m});var n=a(469733),l=a(296540),r=a(436331),E=a(805837),c=a(282556),i=a(71265);const o=e=>l.createElement(r.A,{renderOption:E.q,...e}),s=e=>l.createElement(o,{...e});s.Sorted=e=>{const t=(0,n.useSelector)(c.zi),a=(0,l.useMemo)(()=>(0,i.k)(t),[t]);return l.createElement(o,{...e,sortBy:a})};const m=s},400242:(e,t,a)=>{a.d(t,{A:()=>c});var n=a(296540),l=a(927099),r=a(699784),E=a(360113);const c=({ip:e,lan_ip:t,wan:a=!1,lan:c=!1,compact:i=!1})=>t||e?n.createElement(E.A,{compact:i},n.createElement(l.A,{color:"secondary",size:"body"},n.createElement(r.sA,{id:a?"DEVICE_PROPERTY_OVERVIEW_WAN_IP_ADDRESS":c?"DEVICE_PROPERTY_OVERVIEW_LAN_IP_ADDRESS":"COMMON_IP_ADDRESS"})),n.createElement(l.A,{color:"tertiary",size:"body"},t||e)):null},400261:(e,t,a)=>{a.d(t,{Z:()=>l});var n=a(546391);const l=e=>e?e.replace(n.SD,"").replace(n.fA,"$&:").substring(0,17).toLowerCase():e},421130:(e,t,a)=>{a.d(t,{G:()=>c});var n=a(780811),l=a(768195);const r=[l.bq.USW,l.bq.UAP],E=[l.W4.UDBA69F],c=({type:e,model:t})=>(r.includes(e)||E.includes(t))&&!(0,n.tNJ)({model:t})},451449:(e,t,a)=>{a.d(t,{I:()=>n});const n=(0,a(296540).createContext)({fields:!1,labels:!1,tooltipPopovers:!1,tooltipIcons:!1})},513154:(e,t,a)=>{a.d(t,{A:()=>M});var n=a(296540),l=a(217439),r=a(146784),E=a(294303),c=a(689965),i=a(699784),o=a(360113),s=a(999063),m=a(633819),A=a(559674),d=a(32753),_=a(723544),u=a(205830),C=a(400242),p=a(500045),I=a(777741);const M=({ip:e,ipv6:t,lan_ip:a,mac:M,displayable_version:v,connection_network_name:N,uptime:D,systemStatsMem:S,sys_stats:R,total_used_power:T,imei:O,eSimEid:P})=>n.createElement(c.A,null,n.createElement(E.A,{height:"100%",flexDirection:"column"},n.createElement(C.A,{ip:e,lan_ip:a}),n.createElement(r.A,{ipv6_address:t}),n.createElement(_.A,{mac:M}),n.createElement(p.A,{displayable_version:v}),n.createElement(A.A,{connection_network_name:N}),n.createElement(s.A,{uptime:D}),n.createElement(d.A,{systemStatsMem:S}),n.createElement(u.A,{sys_stats:R}),n.createElement(m.A,{totalPower:T}),O?n.createElement(o.A,null,n.createElement(l.A,{color:"text-2"},n.createElement(i.sA,{id:"DEVICE_IMEI"})),n.createElement(l.A,{color:"text-3"},O)):null,P?n.createElement(I.A,{eid:P}):null))},766624:(e,t,a)=>{a.d(t,{A:()=>i});var n=a(296540),l=a(271856),r=a(709690),E=a(284428),c=a(566723);const i=({description:e,isInteractive:t,portal:a=!0,cursorType:i,title:o,position:s,width:m,iconProps:A,disabled:d=!1})=>{const _=(0,E.Im)()||d,u=(0,E.q)();return n.createElement(l.A,{description:e,portal:a,isInteractive:t,style:{display:"flex",alignItems:"center"},cursorType:i,title:o,position:s,width:m,disableHover:u},n.createElement(r.A,{isActive:!0,size:"original",opacity:_?c.xN:void 0,...A}))}},772317:(e,t,a)=>{a.d(t,{A:()=>T});var n,l=a(592563),r=a(296540),E=a(469733),c=a(217439),i=a(187483),o=a(699784),s=a(689965),m=a(86571),A=a(801081);!function(e){e.OPEN_MODAL="openModal"}(n||(n={}));const d=(0,A.Mz)(i.zn,e=>void 0!==e[n.OPEN_MODAL]);var _=a(523275),u=a(840279),C=a(919952);const p=e=>e[C.U.UIDB]||(0,_.A)(),I=(0,A.Mz)(p,({version:e})=>Boolean(e)),M=(0,A.Mz)(p,({devices:e})=>e||(0,u.A)());var v=a(765562),N=a(79871);const D=()=>{const e=(0,E.useDispatch)(),t=(0,E.useSelector)(I);return(0,r.useEffect)(()=>{t||(async()=>{const t=await fetch(v.A.fingerprintPublicDatabasePath),a=await t.json();e((0,N.$)(a))})()},[t,e]),t},S=({uidbDevice:e})=>{const t=(0,E.useSelector)(i.zn),a=t?.[n.OPEN_MODAL];return a?r.createElement(l.A,{onClick:()=>a(e)},r.createElement(c.A,{size:"medium",color:"inherit"},r.createElement(o.sA,{id:"DEVICE_SHOW_DETAILS"}))):null},R=({shortname:e})=>{const t=(0,E.useSelector)((e=>(0,A.Mz)(M,t=>t.find(t=>t.shortnames?.includes(e))||(0,_.A)()))(e));return D(),t?.compliance?r.createElement(s.A,{type:s.I.ACCORDION,items:[{id:"compliance",label:r.createElement(m.A,{id:"COMMON_COMPLIANCE"}),renderContent:()=>r.createElement(S,{uidbDevice:t}),openByDefault:!0}]}):null},T=({shortname:e})=>(0,E.useSelector)(d)?r.createElement(R,{shortname:e}):null},776288:(e,t,a)=>{a.d(t,{A:()=>n});const n={PCAP:4194304,HWOFFLOAD_QOS_AND_SMART_QUEUE:2147483648,SUPPORT_FILE:65536}},777741:(e,t,a)=>{a.d(t,{A:()=>i});var n=a(296540),l=a(217439),r=a(115829),E=a(360113),c=a(699784);const i=({eid:e})=>e?n.createElement(E.A,{valueMaxWidth:270},n.createElement(l.A,{color:"text-2"},n.createElement(c.sA,{id:"DEVICE_ESIM_EID"})),n.createElement(r.A,{color:"text-3",size:"medium",flexProps:{justifyContent:"flex-end"}},e)):null}}]);