"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[9208],{147433(e,t,a){a.d(t,{A:()=>i});const i={PCAP:4194304,HWOFFLOAD_QOS_AND_SMART_QUEUE:2147483648,SUPPORT_FILE:65536}},358935(e,t,a){a.d(t,{X2:()=>_,lX:()=>E,uC:()=>m});var i=a(571766),n=a(29472),s=a(159469),o=a(774366);const r=`${a(290454).w}/device/:mac:`,l=`${r}/replacement-candidates`,c=`${r}/replace?replacementDeviceMac=:replacement-mac:`,d=`${r}/replace`,E=(e={},t={})=>(0,n.Kd)("replacementCandidates",`${l.replace(":mac:",e.queryParams?.mac)}`,e.queryParams?.mac,e,{...t,idField:"mac"}),m=(e,t)=>a=>a((0,n.vB)(i.aC,null,null,o.A.POST,c.replace(":mac:",e).replace(":replacement-mac:",t),{},null,{})),_=e=>t=>t((0,n.vB)(i.aC,null,null,o.A.DELETE,d.replace(":mac:",e),{},null,{failureToast:()=>({icon:s.C.danger,message:"COMMON_UNKNOWN_ERROR"})}))},752104(e,t,a){a.d(t,{A:()=>n,Q:()=>s});var i=a(765567);const n="_",s=[i.ZM,i.Je]},721398(e,t,a){a.d(t,{A:()=>r});var i=a(274934),n=a(125799),s=a(853777),o=a(470070);const r=({messageId:e,tooltipClassName:t,values:a,isInteractive:r,portal:l,variant:c="twoTone",size:d="medium"})=>(0,i.jsx)(n.A,{description:(0,i.jsx)(o.sA,{id:e,values:a}),width:210,isInteractive:r,portal:l,tooltipClassName:t,children:(0,i.jsx)(s.A,{isActive:!0,omitSvgMargin:!0,variant:c,size:d})})},948803(e,t,a){a.d(t,{A:()=>l});var i=a(274934),n=a(938984),s=a(347625),o=a(470070),r=a(664092);const l=({model:e})=>(0,i.jsxs)(r.A,{children:[(0,i.jsx)(n.A,{color:"text-2",size:"medium",children:(0,i.jsx)(o.sA,{id:"COMMON_MODEL"})}),(0,i.jsx)(n.A,{color:"text-3",size:"medium",children:(0,s.Lm)(e)})]})},999837(e,t,a){a.d(t,{A:()=>F});var i=a(274934),n=a(977872),s=a(602086),o=a(696264),r=a(599110),l=a(159469),c=a(706925),d=a(700444),E=a(470070),m=a(222102),_=a(656466),A=a(401042),u=a(358935);var p,C,M=a(857780),x=a(570866);!function(e){e.EXISTING="existing",e.NEW="new"}(p||(p={})),function(e){e.MAC="mac",e.TYPE="type",e.MODEL="model"}(C||(C={}));var v,N=a(990330),I=a(125799),T=a(843615),h=a(853777),R=a(489714),j=a(947414);!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 S=(0,s.createContext)({[v.DEVICE_REPLACEMENT_MODE]:void 0,[v.SET_DEVICE_REPLACEMENT_MODE]:j.P1,[v.NEW_MAC]:void 0,[v.SET_NEW_MAC]:j.P1,[v.EXISTING_MAC]:void 0,[v.SET_EXISTING_MAC]:j.P1,[v.REPLACEMENT_CANDIDATES]:[],[v.ERROR]:void 0,[v.RESET_ERROR]:j.P1}),g=a(409844).AH`
  height: 54px;
`;var w=a(247816),O=a(309130),D=a(100978);const P=(0,w.A)(D.A)`
  align-items: center;
  gap: ${O.YC};
`,k=(0,s.memo)(()=>{const{newMac:e,setNewMac:t,error:a,resetError:n}=(0,s.useContext)(S),o=(0,s.useCallback)(({target:{value:e}})=>{t((0,R.Z)(e)),n()},[t,n]);return(0,i.jsx)(T.A,{className:g,value:e,onChange:o,onFocus:n,variant:"secondary",label:(0,i.jsxs)(P,{children:[(0,i.jsx)(E.sA,{id:"COMMON_MAC_ADDRESS"}),(0,i.jsx)(I.A,{portal:!0,width:"100%",maxWidth:248,description:(0,i.jsx)(E.sA,{id:"DEVICE_REPLACEMENT_MAC_LOCATION"}),children:(0,i.jsx)(h.A,{isActive:!0})})]}),width:"100%",invalid:a})});var y=a(237887),L=a(974390);const b=(0,s.memo)(()=>{const{replacementCandidates:e,existingMac:t,setExistingMac:a,error:n,resetError:o}=(0,s.useContext)(S),r=(0,s.useMemo)(()=>e.map(({mac:e,model:t,name:a})=>({label:a,value:e,image:(0,i.jsx)(L.A,{model:t}),additionalInfo:e})),[e]),l=(0,s.useCallback)(({value:e})=>{a(String(e)),o()},[a,o]);return(0,i.jsx)(y.A.Sorted,{value:t,label:(0,i.jsx)(E.sA,{id:"COMMON_DEVICE"}),width:"100%",searchable:!0,onChange:l,onFocus:o,maxHeight:228,options:r,invalid:n})}),f=(0,w.A)(D.A)`
  flex-direction: column;
  gap: ${O.kc};
`,W=(0,s.memo)(()=>{const{replacementCandidates:e,deviceReplacementMode:t,setDeviceReplacementMode:a,resetError:n}=(0,s.useContext)(S),o=(0,s.useMemo)(()=>e.length?[{id:p.EXISTING,children:(0,i.jsx)(E.sA,{id:"COMMON_EXISTING"}),onChange:()=>{a(p.EXISTING),n()},checked:t===p.EXISTING},{id:p.NEW,children:(0,i.jsx)(E.sA,{id:"COMMON_NEW"}),onChange:()=>{a(p.NEW),n()},checked:t===p.NEW}]:[],[e.length,t,a,n]);return(0,i.jsxs)(f,{children:[(0,i.jsx)(N.A,{direction:"row",items:o}),t===p.EXISTING?(0,i.jsx)(b,{}):null,t===p.NEW?(0,i.jsx)(k,{}):null]})}),G=(0,w.A)(D.A)`
  align-items: center;
  gap: ${O.YC};
  width: fit-content;
`;var V=a(721398);const X={[M.gQ.INCOMPATIBLE_REPLACEMENT]:"DEVICE_REPLACEMENT_DEVICE_INCOMPATIBLE_REPLACEMENT_ERROR",[M.gQ.REPLACEMENT_ALREADY_ASSIGNED]:"DEVICE_REPLACEMENT_DEVICE_REPLACEMENT_ALREADY_ASSIGNED_ERROR"},$=({mac:e,hideTooltip:t=!1})=>{const{formatMessage:a}=(0,E.tz)(),c=(0,n.wA)(),[C,N]=(0,s.useState)(!1),[I,T]=(0,s.useState)(!1),[h,R]=(0,s.useState)(p.NEW),[j,g]=(0,s.useState)(""),[w,O]=(0,s.useState)(""),[D,P]=(0,s.useState)(void 0),k=(0,n.d4)((0,s.useMemo)(()=>(e=>(0,m.Mz)((e=>(0,_.uh)((0,u.lX)({queryParams:{mac:e}})))(e),e=>(0,A.i6)(e)?.devices||[]))(e),[e])),y=(0,s.useCallback)(()=>{N(!0)},[]),L=(0,s.useCallback)(()=>{N(!1),g(""),O(""),T(!1),R(p.NEW),P(void 0)},[]),b=(0,s.useCallback)(()=>{switch(h){case p.EXISTING:return w;case p.NEW:return j;default:return}},[h,w,j]),f=(0,s.useCallback)(()=>{c((0,d.ox)({icon:l.C.success,message:"DEVICE_REPLACEMENT_DEVICE_SET",duration:3e3})),L()},[c,L]),$=(0,s.useCallback)(e=>{switch(e.apiData?.replacement_state){case M.gQ.INCOMPATIBLE_REPLACEMENT:case M.gQ.REPLACEMENT_ALREADY_ASSIGNED:P(a({id:X[e.apiData.replacement_state]}));break;default:c((0,d.ox)({icon:l.C.danger,message:"DEVICE_FAILED_TO_SET_REPLACEMENT_DEVICE",duration:3e3}))}},[c,a]),F=(0,s.useCallback)(()=>{T(!1)},[]),H=(0,s.useCallback)(()=>{T(!0),c((0,u.uC)(e,b())).then(f).catch($).finally(F)},[c,f,$,e,b,F]),B=(0,s.useMemo)(()=>Boolean(b().match(x.b8)),[b]),z=(0,s.useMemo)(()=>[{text:(0,i.jsx)(E.sA,{id:"COMMON_ACTION_CANCEL"}),variant:"tertiary",onClick:L},{text:(0,i.jsx)(E.sA,{id:"COMMON_ACTION_APPLY"}),variant:"primary",onClick:H,disabled:!B||I,loader:I?"spinner":void 0}],[L,H,B,I]),U=(0,s.useCallback)(()=>{P(void 0)},[P]),Y=(0,s.useMemo)(()=>({[v.DEVICE_REPLACEMENT_MODE]:h,[v.SET_DEVICE_REPLACEMENT_MODE]:R,[v.NEW_MAC]:j,[v.SET_NEW_MAC]:g,[v.EXISTING_MAC]:w,[v.SET_EXISTING_MAC]:O,[v.REPLACEMENT_CANDIDATES]:k,[v.ERROR]:D,[v.RESET_ERROR]:U}),[h,j,w,k,D,U]);return(0,s.useEffect)(()=>{c((0,u.lX)({queryParams:{mac:e}}))},[c,e]),(0,i.jsx)(S.Provider,{value:Y,children:(0,i.jsx)(o.A,{allowOverflow:!0,title:(0,i.jsx)(E.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"}),body:(0,i.jsx)(W,{}),position:"top",portal:!0,actions:z,isOpen:C,onRequestClose:L,children:(0,i.jsxs)(G,{children:[(0,i.jsx)(r.A,{type:"button",variant:"inline",size:"medium",onClick:y,children:(0,i.jsx)(E.sA,{id:"DEVICE_SET_REPLACEMENT_DEVICE"})}),t?null:(0,i.jsx)(V.A,{messageId:"DEVICE_SET_REPLACEMENT_DEVICE_DESCRIPTION",variant:"outline"})]})})})},F=(0,s.memo)(({model:e,type:t,...a})=>(0,c.G)({type:t,model:e})?(0,i.jsx)($,{type:t,model:e,...a}):null)},384780(e,t,a){a.d(t,{A:()=>G});var i=a(274934),n=a(814557),s=a(977872),o=a(602086),r=a(125799),l=a(792929),c=a(600191),d=a(263705),E=a(244081),m=a(112104),_=a(61322),A=a(449339),u=a(974390),p=a(650632),C=a(535322),M=a(205521),x=a(347625),v=a(754924),N=a(223597),I=a(34118),T=a(239627),h=a(645682),R=a(254590),j=a(857780);const S=({name:e,mac:t,model:a})=>e===t&&a?a:e,g=e=>{switch(e?.uplink?.type){case j.au.WIRE:return e?.connection_network_name||R.L;case j.au.WIRELESS:return e?.connection_network_name||e?.uplink?.essid||R.L;default:return R.L}};var w,O=a(599110),D=a(594005),P=a(309130),k=a(421314);!function(e){e.NAME="name",e.PORT="port",e.NETWORK="network"}(w||(w={}));const y={[w.NAME]:"COMMON_NAME",[w.PORT]:"COMMON_PORT",[w.NETWORK]:"COMMON_NETWORK"};var L=a(100978),b=a(470070),f=a(850352);const W=({port:e,mac:t})=>{const{handleGoToPortsPage:a}=(0,f.e)();return(0,i.jsx)(O.A,{variant:"inline",type:"button",size:"medium",onClick:()=>{a(t,e)},children:e})},G=({activeItem:e})=>{const{themeName:t}=(0,d.u)(),a=(0,s.wA)(),R=(0,s.d4)(v.ID),j=(0,o.useMemo)(()=>((e,t)=>(e||[]).map(e=>{const a=t.find(({mac:t})=>t===e.mac||t===e.ap_mac);return a?{...e,id:a._id,name:(0,x.Q)(a),activeItem:a,model:(0,x.Lm)(a.model)}:null}).filter(Boolean))(e.downlink_table,R),[e.downlink_table,R]),O=(0,s.d4)((0,I.Ax)(e.mac)).filter(e=>e.type===N.sK.WIRED);(0,o.useEffect)(()=>{a((0,T.$3)(void 0,{crudCacheStrategy:{type:E.e.CACHE}}))},[a]);const f=(0,o.useMemo)(()=>O.map(e=>({id:`${e.id}${e.sw_port}`,name:e.display_name,mac:e.mac,network:e.network_name,port:e.sw_port,image:(0,i.jsx)(p.A,{client:e}),isClient:!0})),[O]),G=(0,o.useMemo)(()=>j.map(({id:e,name:a,mac:s,port_idx:o,activeItem:l})=>({id:`${e}${o}`,name:S({name:a,mac:l.mac,model:l.model}),mac:s,network:g(l),port:o,image:(0,i.jsx)(u.A,{model:l.model}),isClient:!1,warning:l.detailed_states?.negotiated_low_uplink_port_speed?(0,i.jsx)(r.A,{portal:!0,description:(0,i.jsx)(h.A,{color:"text-1"}),children:(0,i.jsx)(c.A,{size:"medium",color:n.Ay[`desktop-color-orange-06-${t}`]})}):void 0,stacking_group_id:l.stacking_group_id})),[j,n.Ay[`desktop-color-orange-06-${t}`]]),V=(0,o.useMemo)(()=>Array.prototype.concat.apply([],[f,G]),[G,f]),X=(0,o.useMemo)(()=>(({mac:e})=>[{id:w.NAME,label:(0,i.jsx)(b.sA,{id:y[w.NAME]}),renderCell:({image:e,name:t})=>(0,i.jsxs)(L.A,{alignItems:"center",justifyContent:"center",width:"100%",children:[(0,i.jsx)(L.A,{alignItems:"center",justifyContent:"center",height:"20px",width:"20px",children:e}),(0,i.jsx)(k.A,{color:"inherit",size:"medium",style:{width:"170px",paddingLeft:"6px",paddingRight:"6px"},children:t})]}),width:170,compare:(0,D.l0)(({name:e})=>e)},{id:w.NETWORK,label:(0,i.jsx)(b.sA,{id:y[w.NETWORK]}),renderCell:({network:e})=>(0,i.jsx)(k.A,{color:"inherit",size:"medium",children:e}),width:112,compare:(0,D.l0)(({network:e})=>e)},{id:w.PORT,align:"right",label:(0,i.jsx)(b.sA,{id:y[w.PORT]}),renderCell:({port:t,warning:a})=>(0,i.jsxs)(L.A,{justifyContent:"flex-end",alignItems:"center",flexGrow:1,children:[(0,i.jsx)(L.A,{marginTop:-2,marginRight:P.YC,children:a}),(0,i.jsx)(W,{port:t,mac:e})]}),width:54,compare:(0,D.l0)(({port:e})=>e)}])({mac:e.mac}),[e.mac]),$=(0,o.useCallback)(({mac:e,isClient:t,stacking_group_id:i})=>{a((0,M.XP)({type:t?A.H.CLIENT:i?A.H.STACKING:A.H.DEVICE,id:i||e}))},[a]),{rowLimit:F,renderFooter:H}=(0,m.A)(V.length,{defaultCount:10});return V.length?(0,i.jsx)(C.A,{children:(0,i.jsx)(l.A,{items:V,columns:X,idField:"id",initialSortBy:"port",initiallySortAscending:!0,disableColumnFilters:!0,rowOffset:0,disableSelection:!0,onRowClick:$,rowLimit:F,renderFooter:()=>H,rowHeight:_.I.ROW_HEIGHT,truncateHeaderCells:!0})}):null}},979653(e,t,a){a.d(t,{A:()=>C});var i=a(274934),n=a(906701),s=a(100978),o=a(535322),r=a(857780),l=a(893762),c=a(766022),d=a(382583),E=a(948803),m=a(725870),_=a(924453),A=a(664613),u=a(597377),p=a(643334);const C=({name:e,model:t,ip:a,lan_ip:C,ipv6:M,mac:x,connection_network_id:v,displayable_version:N,uptime:I,sys_stats:T,systemStatsMem:h,type:R,total_used_power:j,device_mode_override:S,deviceState:g,ethernet_overrides:w,port_table:O,uplink:D})=>{const P=S===r.Yp.MANAGED_SHADOW_GATEWAY;return(0,i.jsx)(o.A,{children:(0,i.jsxs)(s.A,{height:"100%",flexDirection:"column",children:[(0,i.jsx)(E.A,{model:t}),P?null:(0,i.jsx)(u.A,{ip:a,lan_ip:C,type:R,ethernet_overrides:w,port_table:O,uplink:D,device_mode_override:S}),P?null:(0,i.jsx)(n.A,{ipv6_address:M}),P?null:(0,i.jsx)(d.A,{connection_network_id:v}),(0,i.jsx)(_.A,{mac:x}),(0,i.jsx)(p.A,{displayable_version:N,mac:x,name:e,model:t,type:R,uptime:I,deviceState:g}),(0,i.jsx)(l.A,{uptime:I}),P?null:(0,i.jsx)(m.A,{systemStatsMem:h}),P?null:(0,i.jsx)(A.A,{sys_stats:T}),P?null:(0,i.jsx)(c.A,{totalPower:j})]})})}},776004(e,t,a){a.r(t),a.d(t,{default:()=>m});var i=a(274934),n=a(808202),s=a(872926),o=a(23377),r=a(189042),l=a(384780),c=a(383550),d=a(979653),E=a(216082);const m=({activeItem:e,activeItem:{adopted:t,name:a,type:m,mac:_,ip:A,detailed_states:{device_near_power_limit:u}={device_near_power_limit:!1},total_used_power:p,total_max_power:C,config_network:M,model:x,lan_ip:v,ipv6:N,displayable_version:I,uptime:T,sys_stats:h,"system-stats":R,shortname:j,ethernet_overrides:S,port_table:g,uplink:w,device_mode_override:O}})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c.A,{activeItem:e,showPortOverview:!0,hidePortsButton:!0,children:(0,i.jsx)(r.A,{activeItem:e,showPortsButton:!0,showCaptureButton:!0})}),(0,i.jsx)(s.A,{ip:A,adopted:t,config_network:M}),(0,i.jsx)(n.A,{mac:_,type:m,model:x,device_near_power_limit:u,total_used_power:p,total_max_power:C}),(0,i.jsx)(l.A,{activeItem:e}),(0,i.jsx)(d.A,{name:a,model:x,type:m,ip:A,uplink:w,lan_ip:v,ipv6:N,mac:_,connection_network_id:e.connection_network_id,displayable_version:I,uptime:T,sys_stats:h,systemStatsMem:R?.mem,total_used_power:p,ethernet_overrides:S,port_table:g,device_mode_override:O}),(0,i.jsx)(o.A,{activeItem:e}),(0,i.jsx)(E.A,{shortname:j})]})},696049(e,t,a){a.d(t,{H:()=>i});const i=""},706925(e,t,a){a.d(t,{G:()=>r});var i=a(956978),n=a(857780);const s=[n.bq.USW,n.bq.UAP,n.bq.USP],o=[n.W4.UDBA69F],r=({type:e,model:t})=>(s.includes(e)||o.includes(t))&&!(0,i.tNJ)({model:t})},237887(e,t,a){a.d(t,{A:()=>m});var i=a(274934),n=a(602086),s=a(977872),o=a(693371),r=a(767822),l=a(820633),c=a(308111);const d=e=>(0,i.jsx)(o.A,{renderOption:r.q,...e}),E=e=>(0,i.jsx)(d,{...e});E.Sorted=e=>{const t=(0,s.d4)(l.zi),a=(0,n.useMemo)(()=>(0,c.k)(t),[t]);return(0,i.jsx)(d,{...e,sortBy:a})};const m=E},308111(e,t,a){a.d(t,{R:()=>E,k:()=>m});var i=a(696049),n=a(350068),s=a(177173),o=a(752104),r=a(64222),l=a(332530);const c=[...new Set([i.H,o.Q.join(o.A),s.Zt,r.F,n.nc,l.Vr])],d={numeric:!0,sensitivity:"base"},E=(e,t)=>{const a=[];for(let i=e;i<=t;i+=1)a.push({value:i,label:String(i)});return a},m=e=>({value:t,label:a},{value:i,label:n})=>c.includes(t?.toString())||c.includes(i?.toString())?1/0:a?.toString().localeCompare(n?.toString(),e,d)??-1},489714(e,t,a){a.d(t,{Z:()=>n});var i=a(570866);const n=e=>e?e.replace(i.SD,"").replace(i.fA,"$&:").substring(0,17).toLowerCase():e}}]);