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