"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[23920],{889702(e,t,n){var s;n.d(t,{S:()=>s}),function(e){e.API_DEVICE_ADOPT="API_DEVICE_ADOPT",e.API_DEVICE_RESTART="API_DEVICE_RESTART",e.API_WIDGET_OS_STATS="API_WIDGET_OS_STATS"}(s||(s={}))},952566(e,t,n){n.d(t,{p:()=>c});var s=n(222102),o=n(591256),l=n(897166),i=n(570801),a=n(889702);const c=e=>(0,s.Mz)(l.ah,o.pw,l.dK,i.fR,(t,n,s,o)=>{switch(e){case a.S.API_DEVICE_ADOPT:case a.S.API_DEVICE_RESTART:return s||t.includes(e);case a.S.API_WIDGET_OS_STATS:return o||n.includes(e);default:return s}})},774950(e,t,n){n.r(t),n.d(t,{default:()=>bs});var s=n(274934),o=n(602086),l=n(237725),i=n(977872),a=n(309920),c=n(244081),d=n(213920),r=n(401004),E=n(724081),A=n(429622),C=n(104997),_=n(301940),u=n(716342),I=n(539453),m=n(393629),O=n(598990),T=n(553732),N=n(795206),D=n(427714),S=n(239627),M=n(393482),p=n(687136),h=n(425040),x=n(159469),g=n(890932),b=n(449339),f=n(974390),R=n(988757),v=n(205521),j=n(700444),P=n(470070),V=n(910577),L=n(570801),U=n(956978),y=n(228502),w=n(291935),k=n(969288),B=n(309130),F=n(793442),G=n(100978),Y=n(29472);const W=(0,n(401042).T7)("warnings");var z=n(591256),H=n(867190),K=n(726831);const $=/[^\\\\]*$/g,q={"java.exe":"COMMON_JAVA","javaw.exe":"COMMON_JAVAW"};var X=n(222102),J=n(430328),Q=n(754924);const Z=(0,J.WY)()((0,X.Mz)(Q.ID,e=>e.map(({mac:e,adopted:t})=>({mac:e,adopted:t}))),e=>e),ee=/:/g,te=()=>{const{formatMessage:e}=(0,P.tz)(),t=(0,l.W6)(),n=(0,i.wA)(),a=(0,i.d4)(L.GP),c=(0,i.d4)(Z),{devicesToAdopt:d}=t.location.state||{devicesToAdopt:null},r=(0,i.d4)(V.hX),E=(0,i.d4)(g.p),A=(0,i.d4)(y.A),C=(0,i.d4)(L.ay),_=(0,i.d4)(w.jE),u=_?.cloud_template;return(()=>{const e=(0,i.wA)(),{formatMessage:t,formatList:n}=(0,P.tz)(),l=(0,i.d4)(z.iP);(0,o.useEffect)(()=>{l===H.gy.WINDOWS&&e((0,Y.Kd)("warnings",W)).then(({data:o})=>{const l=o.missing_windows_defender_firewall_rules?.map(({is_enabled:e,is_present:t,program:n})=>(!e||!t)&&q[n?.match($)?.[0]]).filter(Boolean);l.length&&e((0,j.ox)({id:"DEVICE_ADOPTION_UPDATE_NETWORK_RULES",icon:x.C.warning,title:t({id:"DEVICE_ADOPTION_ACCESS_NEEDED"}),details:(0,s.jsx)(G.A,{marginBottom:B.YC,children:(0,s.jsx)("div",{children:t({id:"DEVICE_ADOPTION_UPDATE_NETWORK_RULES"},{applications:n(l.map(e=>t({id:e}))),link:(0,s.jsx)(F.A.Simplified,{href:K.A.windowsFirewallRules,message:t({id:"COMMON_LEARN_MORE"})})})})}),duration:0,onClose:()=>e((0,j.uU)("DEVICE_ADOPTION_UPDATE_NETWORK_RULES"))}))})},[])})(),(0,o.useEffect)(()=>{if(a&&d&&c.length)try{const t=JSON.parse(window.atob(d)).map(({mac:e})=>c.find(({mac:t,adopted:n})=>!n&&t.replaceAll(ee,"").toUpperCase()===e.replaceAll(ee,"").toUpperCase())).filter(Boolean);if(!t.length)throw new Error("ON_LOAD_BATCH_ADOPT_NO_DEVICES");{const s=t.map(({mac:e})=>e);(0,R.A)(s,{dispatch:n,cloudTemplate:u}).then(()=>{if(!r){const s=t.filter(U.G5G);s.length&&n((({device:e,dispatch:t,deviceModelMap:n,formatMessage:s})=>{const o=(0,h.A)();return(0,j.ox)({iconUrl:f.C.getRemoteImagePath(n[e?.model]),title:"DEVICE_ACTIONS_ADOPT_ACCESS_POINT_TITLE",message:"DEVICE_ACTIONS_ADOPT_ACCESS_POINT_MESSAGE",primaryButton:{label:s({id:"DEVICE_ACTIONS_ADOPT_ACCESS_POINT_ACTION"}),onClick:()=>{t((0,j.uU)(o)),t((0,v.XP)({type:b.H.WIFI,id:k.R6}))}},translateTitle:!0},o)})({device:s[0],imagePath:E,deviceModelMap:A,selfTheme:C,dispatch:n,formatMessage:e}))}n((0,N.At)(s,!0))}).catch(()=>{})}}catch{n((0,j.ox)({icon:x.C.danger,message:"ON_LOAD_BATCH_ADOPT_NO_DEVICES"}))}finally{t.replace({pathname:t.location.pathname,state:Object.assign(t.location.state,{devicesToAdopt:null})})}},[a,d,n,u,r,E,A,C,t,c,e]),null};var ne=n(347625),se=n(869332);const oe=({device:{name:e,model:t,mac:n,upgrade_to_firmware:s},history:l,location:a})=>{const c=(0,i.wA)(),d=(0,o.useCallback)(()=>{l.push(a.pathname.split("/device-upgrade")[0]),c((0,se.AS)())},[l,a.pathname,c]),r=(0,o.useMemo)(()=>(0,ne.Q)({name:e,mac:n,model:t}),[e,n,t]),E=(0,o.useCallback)(()=>{c((0,N.xv)({titleValues:{deviceName:r},messageValues:{deviceName:r,toVersion:s},onConfirm:()=>{c((0,N.Pv)(n,r))},onCancel:()=>{d()}}))},[s,n,r,c,d]);return(0,o.useEffect)(()=>(s?E():d(),()=>{d()}),[]),null},le=({history:e,location:t,match:n})=>{const l=(0,i.d4)((0,o.useMemo)(()=>(0,Q._i)(n.params.id),[n.params.id]));return l?(0,s.jsx)(oe,{device:l,history:e,location:t,match:n}):null};var ie=n(477111),ae=n(722837),ce=n(222361),de=n(112879),re=n(797888),Ee=n(123131),Ae=n(589650),Ce=n(645648),_e=n(286988),ue=n(452998),Ie=n(917190),me=n(743178),Oe=n(976458),Te=n(890924),Ne=n(45978),De=n(313369);const Se=(0,X.Mz)((0,J.zx)(Q.ID,["state"]),e=>{const t=[],n=e.length;for(let s=0;s<n;s+=1){const{state:n,mac:o}=e[s];De.q[n]===Ne.g.UPGRADING&&t.push(o)}return t});var Me=n(349077),pe=n(604715),he=n(670830),xe=n(277139),ge=n(94411),be=n(158402),fe=n(897166),Re=n(128379),ve=n(946525),je=n(372261),Pe=n(247816);const Ve=(0,Pe.A)("div")`
  width: 100%;
  table {
    position: relative;
    &:after {
      content: '';
      display: block;
      position: absolute;
      right: -16px;
      width: 16px;
      height: 1px;
    }
  }
`,Le=({children:e,className:t})=>(0,s.jsx)(Ve,{className:t,children:e});var Ue=n(578425),ye=n(526744),we=n(227170),ke=n(228837),Be=n(170936),Fe=n(486529),Ge=n(652023),Ye=n(666289);const We=({searchTags:e,hasAnyDevice:t,handleSearchReset:n,handleResetDisplayOptions:o})=>{switch(!0){case Boolean(e.length):return(0,s.jsx)(we.A,{title:(0,s.jsx)(P.sA,{id:"COMMON_NO_MATCH"}),description:(0,s.jsx)(P.sA,{id:"DEVICE_EMPTY_SEARCH_NO_DEVICES_DETAILS",values:{button:(0,s.jsx)(ye.A,{type:"button",variant:"inline",onClick:n,children:(0,s.jsx)(P.sA,{id:"COMMON_REMOVE_FILTERS_BUTTON_TEXT"})})}})});case t:return(0,s.jsx)(we.A,{title:(0,s.jsx)(P.sA,{id:"COMMON_NO_MATCH"}),description:(0,s.jsx)(P.sA,{id:"DEVICE_EMPTY_FILTER_NO_DEVICES_DETAILS",values:{button:(0,s.jsx)(ye.A,{type:"button",variant:"inline",onClick:o,children:(0,s.jsx)(P.sA,{id:"COMMON_RESET_THEM_BUTTON_TEXT"})})}})});default:return(0,s.jsx)(we.A,{title:(0,s.jsx)(P.sA,{id:"COMMON_NO_DEVICES_TITLE"}),description:(0,s.jsx)(P.sA,{id:"COMMON_NO_DEVICES_DETAILS"})})}},ze=({hasAnyDeviceSelector:e,searchModelName:t})=>{const n=(0,i.d4)(e),l=(0,i.d4)((0,o.useMemo)(()=>(0,ke.f)(t),[t])),a=(0,i.wA)(),c=(0,o.useCallback)(()=>{a(e=>{e((0,Ye.D6)(Ge.R));const t={[ae.l.UNIFI_DEVICE]:{columnSize:Fe.l[ae.l.UNIFI_DEVICE],initialColumns:xe.GO}};Fe.t.forEach(e=>{t[e]={columnSize:Fe.l[ae.l.UNIFI_DEVICE]}}),e((0,be.zF)(t))})},[a]),d=(0,o.useCallback)(()=>{const e=document.querySelector("input[role=combobox]");e&&e.focus(),a((0,Be.sV)(t))},[a,t]);return(0,s.jsx)(G.A,{width:"100%",flexDirection:"column",children:(0,s.jsx)(We,{searchTags:l,hasAnyDevice:n,handleSearchReset:d,handleResetDisplayOptions:c})})},He=(0,o.memo)(()=>(0,s.jsxs)(G.A,{height:"100%",padding:`${B.Ln} ${B.Ln} ${B.S2}`,overflow:"auto",flexDirection:"column",children:[(0,s.jsx)(Le,{children:(0,s.jsx)(je.A,{data:[],columns:(0,ue.D)()})}),(0,s.jsx)(ze,{hasAnyDeviceSelector:he.yW,searchModelName:Ue.U4.UNIFI_DEVICES})]}));var Ke=n(999633),$e=n(434521),qe=n(1943),Xe=n(850506);const Je=(0,Pe.A)("div")`
  position: absolute;
  top: -${B.YC};
  left: calc(100% - 400px); /* The restart confirm dialog width. */
  z-index: 1;
`,Qe=(0,Pe.A)(G.A)`
  padding: ${B.YC};
  gap: ${B.kc};
  position: relative;
`,Ze=({unifiDevice:e})=>{const[t,n]=(0,o.useState)(!1),l=(0,o.useCallback)(()=>{t&&n(!1)},[t]);return(0,s.jsxs)(Qe,{onMouseLeave:l,children:[(0,s.jsx)(qe.A,{device:e}),(0,s.jsx)(Xe.i,{device:e,isConfirmOpen:t,setIsConfirmOpen:n}),t?(0,s.jsx)(Je,{}):null]})},et=e=>e.product_line===pe.p1.NETWORK&&(0,$e.YP)(e)?{...e,_rowHoverContent:()=>(0,s.jsx)(Ze,{unifiDevice:e})}:e,tt=e=>{const t=(0,i.d4)(fe.EL);return(0,o.useMemo)(()=>t?e:e.map(et),[e,t])};var nt=n(951588);const st={style:{marginRight:B.xO},variant:"bgRoundedSquare",size:"large"},ot={[ae.l.UNIFI_DEVICE_NETWORK]:{icon:(0,o.createElement)(nt.m8[pe.p1.NETWORK],st)},[ae.l.UNIFI_DEVICE_PROTECT]:{icon:(0,o.createElement)(nt.m8[pe.p1.PROTECT],st)},[ae.l.UNIFI_DEVICE_TALK]:{icon:(0,o.createElement)(nt.m8[pe.p1.TALK],st)},[ae.l.UNIFI_DEVICE_ACCESS]:{icon:(0,o.createElement)(nt.m8[pe.p1.ACCESS],st)},[ae.l.UNIFI_DEVICE_CONNECT]:{icon:(0,o.createElement)(nt.m8[pe.p1.CONNECT],st)},[ae.l.UNIFI_DEVICE_APOLLO]:{icon:(0,o.createElement)(nt.m8[pe.p1.APOLLO],st)},[ae.l.UNIFI_DEVICE_DRIVE]:{icon:(0,o.createElement)(nt.m8[pe.p1.DRIVE],st)},[ae.l.UNIFI_DEVICE_UNMANAGED]:{}},lt=Object.keys(ot),it={width:"100%",scrollbarGutter:"stable",minHeight:0};var at=n(291508);const ct=(0,Pe.A)(G.A,(0,at.A)("collapsed"))`
  flex-direction: column;
  height: auto;
  width: 100%;
  padding-top: ${B.Ln};
  table {
    margin-top: ${B.Ln};
  }
  transition: all 250ms;
  > div > svg {
    cursor: pointer;
    transform: rotate(${({collapsed:e})=>e?0:180}deg);
  }
`,dt=(0,Pe.A)(G.A)`
  align-items: center;
  position: sticky;
  left: 0;
  width: 100%;
  justify-content: space-between;
`,rt=(0,Pe.A)(G.A)`
  align-items: center;
`,Et=(0,Pe.A)(G.A)`
  height: 100%;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  margin-left: ${B.Ln};
  overflow: hidden;
`;var At;!function(e){e.TABLE_DATA="tableData",e.FILTERED_UNIFI_TABLE_COLUMNS="filteredUnifiTableColumns",e.COLUMN_VISIBILITY="columnVisibility",e.ACTIVE_ROWS="activeRows",e.ON_ROW_CLICK="onRowClick",e.ON_COLUMN_DROP="onColumnDrop",e.COLLAPSED_MAP="collapsedMap",e.ON_TOGGLE_COLLAPSE="onToggleCollapse",e.VISIBLE_TABLE_TYPES="visibleTableTypes"}(At||(At={}));const Ct=(e,{[At.VISIBLE_TABLE_TYPES]:t,[At.COLLAPSED_MAP]:n,[At.TABLE_DATA]:s})=>n[t[e]]?56:89+33*(s[t[e]]?.length??0)+16;var _t=n(179102),ut=n(916471),It=n(567082),mt=n(591917),Ot=n(54013),Tt=n(230853);const Nt=[xe.o$.STATUS_BALL,xe.o$.TYPE,xe.o$.NAME],Dt=Tt.W2[Ot.xz.TABLES][ae.l.UNIFI_DEVICE].columns,St=n(83570).E,Mt={overflow:"visible",padding:"0px"},pt=({tableType:e,icon:t,header:n,data:l,columns:i,columnVisibility:a,activeRows:c,onRowClick:d,onColumnDrop:r,style:E,collapsed:A,onToggleCollapse:C})=>{const[_,u]=(0,o.useState)(!1),I=A??_,m=(0,o.useRef)(null),[O,T]=(0,mt.A)(e),[N,D]=(0,It.A)(e),S=(0,o.useCallback)(()=>{C?C():u(e=>!e)},[C]);return(0,s.jsxs)(ct,{ref:m,style:E,collapsed:I,children:[(0,s.jsxs)(dt,{children:[(0,s.jsxs)(rt,{children:[t||null,(0,s.jsx)(_t.A,{size:"medium",color:"text-3",children:n})]}),(0,s.jsx)(ut.A,{onClick:S})]}),I?null:(0,s.jsx)(je.A,{className:St,data:l,columns:i,rowStyle:B.gc,columnVisibility:a,columnPinningLeftState:Nt,onRowClick:d,activeRows:c,onColumnSizingChange:T,initialColumnSize:O,onSort:D,sorting:N,parentRef:m,columnDnD:!0,staticDnD:Nt,onColumnDrop:r,overscanColumn:1})]})},ht=({index:e,style:t,[At.TABLE_DATA]:n,[At.FILTERED_UNIFI_TABLE_COLUMNS]:l,[At.COLUMN_VISIBILITY]:i,[At.ACTIVE_ROWS]:a,[At.ON_ROW_CLICK]:c,[At.ON_COLUMN_DROP]:d,[At.COLLAPSED_MAP]:r,[At.ON_TOGGLE_COLLAPSE]:E,[At.VISIBLE_TABLE_TYPES]:A})=>{const C=(0,o.useMemo)(()=>A[e],[A,e]),_=(0,o.useCallback)(()=>{E(C)},[E,C]);return(0,s.jsx)("div",{style:t,children:(0,s.jsx)(pt,{tableType:C,icon:ot[C].icon,header:(0,s.jsxs)(s.Fragment,{children:[C===ae.l.UNIFI_DEVICE_UNMANAGED?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.sA,{id:"UNIFI_DEVICE_HEADER_UNIFI_UNMANAGED"})," "]}):null,(0,s.jsx)(P.sA,{id:"UNIFI_NUMBER_OF_DEVICES",values:{number:n[C].length}})]}),data:n[C],columns:l,columnVisibility:i,activeRows:a,onRowClick:c,onColumnDrop:d,collapsed:Boolean(r[C]),onToggleCollapse:_})})},xt=({columnVisibility:e,columns:t,activeRows:n,onRowClick:l,onColumnDrop:a})=>{const c=tt((0,i.d4)(he.Q9)),d=(0,i.d4)(he.L_),r=(0,i.d4)(he.mw),E=(0,i.d4)(he.yQ),A=(0,i.d4)(he.AL),C=(0,i.d4)(he.Jz),_=(0,i.d4)(he.WT),u=(0,i.d4)(he.gi),[I,m]=(0,o.useState)({}),O=(0,o.useCallback)(e=>{m(t=>({...t,[e]:!t[e]}))},[]),T={[ae.l.UNIFI_DEVICE_NETWORK]:c,[ae.l.UNIFI_DEVICE_PROTECT]:d,[ae.l.UNIFI_DEVICE_TALK]:r,[ae.l.UNIFI_DEVICE_ACCESS]:E,[ae.l.UNIFI_DEVICE_CONNECT]:A,[ae.l.UNIFI_DEVICE_APOLLO]:C,[ae.l.UNIFI_DEVICE_DRIVE]:_,[ae.l.UNIFI_DEVICE_UNMANAGED]:u},N=lt.filter(e=>T[e].length>0),D=(0,o.useMemo)(()=>t.filter(({id:e})=>e!==xe.o$.APPLICATION),[t]);return(0,s.jsx)(Et,{children:(0,s.jsx)(Ke.B8,{rowCount:N.length,rowHeight:Ct,rowComponent:ht,rowProps:{tableData:T,filteredUnifiTableColumns:D,columnVisibility:e,activeRows:n,onRowClick:l,onColumnDrop:a,collapsedMap:I,onToggleCollapse:O,visibleTableTypes:N},defaultHeight:800,overscanCount:0,style:it})})},gt=(0,X.Mz)(Oe.W1,e=>!e);var bt,ft=n(692);!function(e){e.DEVICES="devices"}(bt||(bt={}));var Rt=n(14084),vt=n(373616),jt=n(501454),Pt=n(444971),Vt=n(252445),Lt=n(448e3),Ut=n(590979),yt=n(254585);const wt=(0,o.memo)(()=>{const e=(0,l.W6)(),{search:t}=(0,l.zy)(),n=(0,i.wA)(),a=(0,i.d4)(fe.EL),c=(0,i.d4)(yt.LK),d=(0,o.useCallback)(()=>{n((0,v.XP)({type:b.H.DEVICE_UPDATES,id:"any"}))},[n]);return(0,o.useEffect)(()=>{const n=new URLSearchParams(t);n.has(k.Ej)&&(setTimeout(d,100),n.delete(k.Ej),e.push({search:n.toString()}))},[e,t,d]),a?null:(0,s.jsx)(Rt.A,{onPress:d,labelId:"COMMON_DEVICE_UPDATES_AND_SETTINGS",disabled:c===b.H.DEVICE_UPDATES,...Ut.A.addDataTestId(Ut.A.TestId.SIDE_PANEL_TRIGGER)})}),kt=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(Lt.fG),n=(0,o.useCallback)(()=>{e((0,Ye.D6)(Ge.R))},[e]),l=(0,Pt.A)({leftFilterPageId:ce.g1.DEVICES,leftFilterColumnsId:bt.DEVICES}),a=(0,o.useCallback)(()=>{e((0,Vt.GD)({leftFilterPageId:ce.g1.DEVICES,leftFilterColumnsId:bt.DEVICES}))},[e]);return(0,s.jsxs)(vt.A,{children:[(0,s.jsx)(jt.A,{onClear:n,disabled:t}),(0,s.jsx)(wt,{}),(0,s.jsx)(Rt.A,{onPress:a,labelId:"COMMON_CUSTOMIZE_COLUMNS",disabled:l})]})});var Bt=n(530110);const Ft=Object.values(xe.o$).filter(e=>e!==xe.o$.STATUS_BALL),Gt=(0,o.memo)(()=>(0,s.jsx)(Bt.A,{leftFilterPageId:ce.g1.DEVICES,columns:Ft,columnLabels:xe.xJ,tableType:ae.l.UNIFI_DEVICE}));var Yt=n(479086),Wt=n(387074),zt=n(728091),Ht=n(300842),Kt=n(693207),$t=n(579680);const qt=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(Lt.O2),n=(0,i.d4)(Q.BS),l=(0,o.useCallback)(t=>{Array.isArray(t)&&e((0,Ye.ml)(t))},[e]),a=(0,o.useMemo)(()=>t[0]!==t[1]?(0,s.jsx)(P.sA,{id:"COMMON_GENERIC_FROM_TO",values:{from:$t.DL[t[0]],to:$t.DL[t[1]]}}):(()=>{switch(t[0]){case $t.WV[Kt.v.MIN].value:return(0,s.jsx)(P.sA,{id:"COMMON_NONE"});case $t.WV[Kt.v.ONE_DAY].value:case $t.WV[Kt.v.THREE_DAYS].value:case $t.WV[Kt.v.ONE_WEEK].value:case $t.WV[Kt.v.ONE_MONTH].value:return $t.DL[t[0]];case $t.WV[Kt.v.ALL].value:return(0,s.jsx)(P.sA,{id:"COMMON_ALL"});default:return null}})(),[t]);return n?(0,s.jsx)(Ht.A,{label:(0,s.jsx)(P.sA,{id:"COMMON_UPTIME"}),hasPaddedContent:!0,children:(0,s.jsx)(zt.A,{value:t,onChange:l,minValue:$t.KP,maxValue:$t.SQ,marks:$t.E7,step:$t.m7,labelEnd:a,caption:(0,s.jsx)(P.sA,{id:"COMMON_MIN"}),captionEnd:(0,s.jsx)(P.sA,{id:"COMMON_ALL"})})}):null});var Xt,Jt=n(19751),Qt=n(115238);!function(e){e.ID="id",e.NAME="name",e.COUNT="count"}(Xt||(Xt={}));var Zt=n(884644),en=n(202733);const tn={[Zt.bq.GATEWAY]:{id:Zt.bq.GATEWAY,condition:en.xi,label:"COMMON_GATEWAY",sortIndex:0},[Zt.bq.SWITCH]:{id:Zt.bq.SWITCH,condition:en.JM,label:"COMMON_SWITCH",sortIndex:1},[Zt.bq.ACCESS_POINT]:{id:Zt.bq.ACCESS_POINT,condition:en.xn,label:"COMMON_ACCESS_POINT",sortIndex:2},[Zt.bq.MODEM]:{id:Zt.bq.MODEM,condition:en.pI,label:"COMMON_MODEM",sortIndex:3},[Zt.bq.CLOUD_KEY]:{id:Zt.bq.CLOUD_KEY,condition:en.FY,label:"COMMON_CLOUD_KEY",sortIndex:4},[Zt.bq.SMART_POWER]:{id:Zt.bq.SMART_POWER,condition:en.LW,label:"COMMON_SMART_POWER",sortIndex:5},[Zt.bq.BRIDGE]:{id:Zt.bq.BRIDGE,condition:en.kZ,label:"COMMON_BRIDGE",sortIndex:6},[Zt.bq.CELLULAR_MODEM]:{id:Zt.bq.CELLULAR_MODEM,condition:en.pJ,label:"COMMON_CELLULAR_MODEM",sortIndex:7},[Zt.bq.ENTERPRISE_AUDIO_VIDEO]:{id:Zt.bq.ENTERPRISE_AUDIO_VIDEO,condition:en.H0,label:"COMMON_ENTERPRISE_AUDIO_VIDEO",sortIndex:8},[Zt.bq.NON_NETWORK_DEVICES]:{id:Zt.bq.NON_NETWORK_DEVICES,condition:en.hg,label:"COMMON_NON_NETWORK_DEVICES",sortIndex:9}},nn=(e,t)=>tn[e[Xt.ID]].sortIndex-tn[t[Xt.ID]].sortIndex,sn=(0,o.memo)(()=>{const e=(0,i.wA)(),{formatMessage:t}=(0,P.tz)(),n=(0,i.d4)((0,o.useMemo)(()=>(e=>(0,J.WY)()((0,X.Mz)(he.Qi,(0,he.a5)([Zt.Kq.TYPES]),(t,n)=>{const s={},o=Object.values(tn),l=t.length;for(let n=0;n<l;n+=1){const l=t[n],i=o.filter(({condition:e})=>e(l));for(let t=0;t<i.length;t+=1){const{id:n,label:o}=i[t];n&&!s[n]&&(s[n]={[Xt.ID]:n,[Xt.NAME]:e({id:o}),[Xt.COUNT]:0})}}const i=n.length;for(let e=0;e<i;e+=1){const t=n[e],l=o.filter(({condition:e})=>e(t));for(let e=0;e<l.length;e+=1){const{id:t}=l[e];t&&s[t]&&(s[t]={...s[t],[Xt.COUNT]:s[t][Xt.COUNT]+1})}}return s}),e=>e))(t),[t])),l=(0,i.d4)(Lt.Vs),a=(0,o.useMemo)(()=>Object.values(n),[n]),c=(0,o.useMemo)(()=>a.map(e=>e[Xt.ID]),[a]),d=(0,o.useMemo)(()=>new Set(l),[l]),r=(0,o.useMemo)(()=>new Set(a.filter(e=>!l.includes(e[Xt.ID])&&!n[e[Xt.ID]][Xt.COUNT]).map(e=>e[Xt.ID])),[a,n,l]),E=(0,o.useCallback)(t=>{e((0,Ye.H_)(Array.from(t||[])))},[e]),A=(0,o.useMemo)(()=>a.sort(nn).map(e=>({id:e[Xt.ID],type:"CHECKBOX",title:e[Xt.NAME],checkboxProps:{count:e[Xt.COUNT],isTruncated:!0},children:[]})),[a]);return(0,Qt.A)(l,c,Ye.H_),a.length?(0,s.jsx)(Ht.A,{label:(0,s.jsx)(P.sA,{id:"COMMON_UNIFI_DEVICES"}),children:(0,s.jsx)(Jt.A.Simplified,{items:A,selectedKeys:d,disabledKeys:r,onSelectionChange:E})}):null});var on,ln=n(806368),an=n(561547),cn=n(967873),dn=n(374147),rn=n(639197),En=n(905233);!function(e){e.ID="id",e.NAME="name",e.COUNT="count"}(on||(on={}));const An=(0,J.WY)()((0,X.Mz)((0,he.a5)([Zt.Kq.TAGS]),rn._,(e,t)=>{const n={},s=t.length;for(let e=0;e<s;e+=1){const s=t[e];n[s[En.Ko._ID]]={[on.ID]:s[En.Ko._ID],[on.NAME]:s[En.Ko.NAME],[on.COUNT]:0}}const o=e.length;for(let t=0;t<o;t+=1){const s=e[t];if(s.device_tags?.length){const e=s.device_tags.length;for(let t=0;t<e;t+=1){const{id:e}=s.device_tags[t];n[e]&&(n[e]={...n[e],[on.COUNT]:n[e][on.COUNT]+1})}}}return n}),e=>e),Cn=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(L.Io),n=(0,i.d4)(An),l=(0,i.d4)(Lt.pM),a=(0,o.useMemo)(()=>Object.values(n),[n]),d=(0,o.useMemo)(()=>a.map(e=>e[on.ID]),[a]),r=(0,o.useMemo)(()=>a.sort((e,t)=>e[on.NAME].localeCompare(t[on.NAME])),[a]),A=(0,o.useMemo)(()=>r.map(e=>({id:e[on.ID],type:"CHECKBOX",title:e[on.NAME],checkboxProps:{count:e[on.COUNT],isTruncated:!0},children:[]})),[r]),C=(0,o.useMemo)(()=>l.length===a.length?"all":new Set(l),[l,a]),_=(0,o.useMemo)(()=>new Set(a.filter(e=>!l.includes(e[on.ID])&&!n[e[on.ID]][on.COUNT]).map(e=>e[on.ID])),[a,n,l]),u=(0,o.useCallback)(t=>{e((0,Ye.xD)(Array.from(t||[])))},[e]),I=(0,o.useCallback)(t=>{e((0,Ye.xD)(Array.from(t||[])))},[e]),m=(0,o.useCallback)(()=>{e((0,Ye.xD)([]))},[e]);return(0,Qt.A)(l,d,Ye.xD),(0,E.A)([(0,ln.uu)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})],(0,s.jsx)(cn.A,{leftFilterPanelId:an.R.DEVICES_TAGS,items:A,selectedKeys:C,disabledKeys:_,onSelectionChange:u,onSelectAll:I,onDeselectAll:m,labelId:"COMMON_DEVICE_TAGS",labelBubbleId:t?"COMMON_FABRIC":void 0,creatorMode:!0,tagId:dn.a.DEVICES}))});var _n;!function(e){e.ID="id",e.NAME="name",e.COUNT="count"}(_n||(_n={}));var un=n(286833),In=n(117439);const mn={[un.d.ONLINE]:{id:un.d.ONLINE,condition:In.I0,label:"COMMON_ONLINE",sortIndex:0},[un.d.ISOLATED]:{id:un.d.ISOLATED,condition:In.aR,label:"COMMON_ISOLATED",sortIndex:1},[un.d.UPDATE_AVAILABLE]:{id:un.d.UPDATE_AVAILABLE,condition:In.NE,label:"COMMON_UPDATE_AVAILABLE",sortIndex:2},[un.d.CONNECTION_INTERRUPTED]:{id:un.d.CONNECTION_INTERRUPTED,condition:In.$t,label:"COMMON_DEVICE_STATE_CONNECTION_INTERRUPTED",sortIndex:3},[un.d.PENDING_ADOPTION]:{id:un.d.PENDING_ADOPTION,condition:In.CS,label:"COMMON_DEVICE_STATE_PENDING",sortIndex:4},[un.d.MANAGED_BY_ANOTHER_CONSOLE]:{id:un.d.MANAGED_BY_ANOTHER_CONSOLE,condition:In.Br,label:"COMMON_DEVICE_STATE_MANAGED_BY_OTHER",sortIndex:5},[un.d.OFFLINE]:{id:un.d.OFFLINE,condition:In.gf,label:"COMMON_OFFLINE",sortIndex:6}},On=(e,t)=>mn[e[_n.ID]].sortIndex-mn[t[_n.ID]].sortIndex,Tn=(0,o.memo)(()=>{const e=(0,i.wA)(),{formatMessage:t}=(0,P.tz)(),n=(0,i.d4)((0,o.useMemo)(()=>(e=>(0,J.WY)()((0,X.Mz)(he.Qi,(0,he.a5)([Zt.Kq.STATUS]),(t,n)=>{const s={},o=Object.values(mn),l=t.length;for(let n=0;n<l;n+=1){const l=t[n],i=o.filter(({condition:e})=>e(l));for(let t=0;t<i.length;t+=1){const{id:n,label:o}=i[t];n&&!s[n]&&(s[n]={[_n.ID]:n,[_n.NAME]:e({id:o}),[_n.COUNT]:0})}}const i=n.length;for(let e=0;e<i;e+=1){const t=n[e],l=o.filter(({condition:e})=>e(t));for(let e=0;e<l.length;e+=1){const{id:t}=l[e];t&&s[t]&&(s[t]={...s[t],[_n.COUNT]:s[t][_n.COUNT]+1})}}return s}),e=>e))(t),[t])),l=(0,i.d4)(Lt.gm),a=(0,o.useMemo)(()=>Object.values(n),[n]),c=(0,o.useMemo)(()=>a.map(e=>e[_n.ID]),[a]),d=(0,o.useMemo)(()=>a.sort(On).map(e=>({id:e[_n.ID],type:"CHECKBOX",title:e[_n.NAME],checkboxProps:{count:e[_n.COUNT],isTruncated:!0},children:[]})),[a]),r=(0,o.useMemo)(()=>new Set(l),[l]),E=(0,o.useMemo)(()=>new Set(a.filter(e=>!l.includes(e[_n.ID])&&!n[e[_n.ID]][_n.COUNT]).map(e=>e[_n.ID])),[l,n,a]),A=(0,o.useCallback)(t=>{e((0,Ye.ym)(Array.from(t||[])))},[e]);return(0,Qt.A)(l,c,Ye.ym),a.length?(0,s.jsx)(Ht.A,{label:(0,s.jsx)(P.sA,{id:"COMMON_STATUS"}),children:(0,s.jsx)(Jt.A.Simplified,{items:d,selectedKeys:r,disabledKeys:E,onSelectionChange:A})}):null});var Nn=n(800675),Dn=n(482748),Sn=n(18556),Mn=n(720770),pn=n(519182),hn=n(671909);const xn=["mac","search_type","search_status","search_name","search_model_name","search_ip","search_connection","search_network","search_experience","search_product_line",...Sn.r],gn=new Nn.A.Document({tokenize:"full",cache:500,encode:pn.Rd,document:{store:xn,id:"mac",index:xn}}),bn=(0,o.memo)(()=>{const{location:{state:e}}=(0,l.W6)(),t=(0,o.useRef)(e?.[Ue.Gd.SEARCH_INITIAL_TAGS]),{formatMessage:n}=(0,P.tz)(),[a,c]=(0,o.useState)(!1),d=(0,o.useCallback)(()=>c(!0),[]),r=(0,o.useCallback)(()=>c(!1),[]),E=(0,i.d4)((0,o.useMemo)(()=>(0,ke.f)(Ue.U4.UNIFI_DEVICES),[])),A=(0,i.d4)((0,o.useMemo)(()=>Boolean(E.length)||Boolean(t.current)||a?(0,he.X$)(n):Mn.A,[n,a,t,E.length])),C=(0,o.useMemo)(()=>((e,t)=>[(0,pn.Vj)(e,[["search_type",t({id:"COMMON_ACCESS_POINT"})],["search_type",t({id:"COMMON_GATEWAY"})],["search_type",t({id:"COMMON_SWITCH"})]]),(0,pn.Vj)(e,[["search_status",t({id:"COMMON_ONLINE"})],["search_status",t({id:"COMMON_OFFLINE"})],["search_status",t({id:"COMMON_DEVICE_STATE_PENDING"})]]),(0,pn.Vj)(e,[["search_connection",t({id:"COMMON_WIRED"})]]),(0,pn.Vj)(e,[["search_product_line","UniFi Protect"],["search_product_line","UniFi Access"],["search_product_line","UniFi Network"]])].filter(Boolean))(A,n),[A,n]);return(0,s.jsx)(hn.A,{lsKey:Dn.UZ.UNIFI_DEVICES_SEARCH,getInitialSuggestions:C,searchModelName:Ue.U4.UNIFI_DEVICES,searchIndex:gn,enabledColumns:xn,recordIdKey:"mac",onFocus:d,onBlur:r,initialTags:t.current,records:A})});var fn;!function(e){e.ID="id",e.NAME="name",e.COUNT="count"}(fn||(fn={}));const Rn=(0,J.WY)()((0,X.Mz)(he.Qi,(0,he.a5)([Zt.Kq.MODELS]),(e,t)=>{const n={},s=e.length;for(let t=0;t<s;t+=1){const s=e[t];s.model&&!n[s.model]&&(n[s.model]={[fn.ID]:s.model,[fn.NAME]:(0,ne.Lm)(s.model),[fn.COUNT]:0})}const o=t.length;for(let e=0;e<o;e+=1){const s=t[e];s.model&&n[s.model]&&(n[s.model]={...n[s.model],[fn.COUNT]:n[s.model][fn.COUNT]+1})}return n}),e=>e),vn=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(Rn),n=(0,i.d4)(Lt.Kt),l=(0,o.useMemo)(()=>Object.values(t),[t]),a=(0,o.useMemo)(()=>l.map(e=>e[fn.ID]),[l]),c=(0,o.useMemo)(()=>n.length===l.length?"all":new Set(n),[n,l]),d=(0,o.useMemo)(()=>new Set(l.filter(e=>!n.includes(e[fn.ID])&&!t[e[fn.ID]][fn.COUNT]).map(e=>e[fn.ID])),[l,t,n]),r=(0,o.useCallback)(t=>{e((0,Ye.mc)(Array.from(t||[])))},[e]),E=(0,o.useMemo)(()=>l.sort((e,t)=>t[fn.COUNT]-e[fn.COUNT]).map(e=>({id:e[fn.ID],type:"CHECKBOX",title:e[fn.NAME],checkboxProps:{count:e[fn.COUNT],isTruncated:!0},children:[]})),[l]),A=(0,o.useCallback)(t=>{e((0,Ye.mc)(Array.from(t||[])))},[e]),C=(0,o.useCallback)(()=>{e((0,Ye.mc)([]))},[e]);return(0,Qt.A)(n,a,Ye.mc),l.length?(0,s.jsx)(Ht.A,{id:an.R.DEVICES_MODELS,label:(0,s.jsx)(P.sA,{id:"COMMON_MODELS"}),children:(0,s.jsx)(Jt.A,{id:an.R.DEVICES_MODELS,items:E,selectedKeys:c,disabledKeys:d,onSelectionChange:r,onSelectAll:A,onDeselectAll:C})}):null});var jn=n(870443),Pn=n(489572);const Vn=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(Lt.EZ),n=(0,i.d4)(Q.BS),l=(0,o.useCallback)(t=>{Array.isArray(t)&&e((0,Ye.Es)(t))},[e]),a=(0,o.useMemo)(()=>t[0]!==t[1]?(0,s.jsx)(P.sA,{id:"COMMON_GENERIC_FROM_TO",values:{from:Pn.lc[t[0]],to:Pn.lc[t[1]]}}):(()=>{switch(t[0]){case Pn.el[jn.f.MIN].value:return(0,s.jsx)(P.sA,{id:"COMMON_NONE"});case Pn.el[jn.f.THREE_DAYS].value:case Pn.el[jn.f.ONE_WEEK].value:case Pn.el[jn.f.ONE_MONTH].value:case Pn.el[jn.f.SIX_MONTHS].value:case Pn.el[jn.f.ONE_YEAR].value:return Pn.lc[t[0]];case Pn.el[jn.f.ALL].value:return(0,s.jsx)(P.sA,{id:"COMMON_ALL"});default:return null}})(),[t]);return n?(0,s.jsx)(Ht.A,{label:(0,s.jsx)(P.sA,{id:"DEVICE_INSTALL_DATE"}),hasPaddedContent:!0,children:(0,s.jsx)(zt.A,{value:t,onChange:l,minValue:Pn.Ao,maxValue:Pn.gv,marks:Pn.mi,step:Pn.CX,labelEnd:a,caption:(0,s.jsx)(P.sA,{id:"COMMON_MIN"}),captionEnd:(0,s.jsx)(P.sA,{id:"COMMON_ALL"})})}):null});var Ln,Un=n(565823),yn=n(699352),wn=n(369343);!function(e){e.READY_TO_ADOPT="READY_TO_ADOPT",e.READY_TO_UPDATE="READY_TO_UPDATE",e.SMART_BATTERY_ASSIGNMENT="SMART_BATTERY_ASSIGNMENT",e.SMART_BATTERY_ADOPTION="SMART_BATTERY_ADOPTION"}(Ln||(Ln={}));const kn=(0,X.Mz)(wn.Eo,Q.X7,(e,t)=>t.length>0&&(!e||e.limit>=e.adopted+t.length)),Bn=(0,X.Mz)(Q.J1,e=>e>0),Fn=(0,X.Mz)(Q.G7,Q.Vo,(e,t)=>Boolean(e)&&Boolean(t)),Gn=(0,X.Mz)(Q.F4,Q.Vo,(e,t)=>Boolean(e)&&Boolean(t)),Yn=(0,X.Mz)(kn,Bn,Fn,Gn,(e,t,n,s)=>({[Ln.READY_TO_ADOPT]:e,[Ln.READY_TO_UPDATE]:t,[Ln.SMART_BATTERY_ADOPTION]:n,[Ln.SMART_BATTERY_ASSIGNMENT]:s}));var Wn=n(266824),zn=n(815436);const Hn="DEVICE_BANNER_MAIN_ICON_CLASSNAME";var Kn=n(505817);const $n=(0,Pe.A)(G.A)`
  flex-direction: column;
  gap: ${B.kc};
  .${Hn} {
    margin-right: ${B.kc};
  }
`,qn=(0,Pe.A)(G.A)`
  background: ${({theme:{themeName:e}})=>Kn.Ay[`desktop-color-neutral-01-${e}`]};
  padding: 6px ${B.kc};
  width: 100%;
`,Xn=(0,Pe.A)(G.A)`
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
`;var Jn;!function(e){e.ADOPTION="adoption",e.ASSIGNMENT="assignment"}(Jn||(Jn={}));const Qn={[Jn.ADOPTION]:{smartBatteriesSelector:Q.Nz,smartBatteriesMacsSelector:Q.RL,title:"DEVICE_ACTIONS_ADOPT_DEVICE_READY_TO_ADOPT",actionLabel:"COMMON_ADOPT"},[Jn.ASSIGNMENT]:{smartBatteriesSelector:Q.CH,smartBatteriesMacsSelector:Q.k,title:"DEVICE_ACTIONS_ADOPT_DEVICE_READY_TO_ASSIGN",actionLabel:"COMMON_ASSIGN"}},Zn=({smartBatteryNotificationType:e,onClick:t,deviceBannersExpanded:n})=>{const l=(0,i.wA)(),{smartBatteriesSelector:a,smartBatteriesMacsSelector:c,title:d,actionLabel:r}=(0,o.useMemo)(()=>Qn[e],[e]),E=(0,i.d4)(a),A=(0,i.d4)(c),C=(0,o.useCallback)(()=>{t({[Jn.ADOPTION]:Ln.SMART_BATTERY_ADOPTION,[Jn.ASSIGNMENT]:Ln.SMART_BATTERY_ASSIGNMENT}[e]),l((0,se.to)({modalType:zn.A.ASSIGN_SMART_BATTERY,modalProps:{activeMacs:A}}))},[l,A,t,e]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f.A,{model:E[0].model,width:24,height:24,className:Hn}),(0,s.jsxs)(Xn,{children:[(0,s.jsx)(_t.A,{children:(0,s.jsx)(P.sA,{id:d,values:{deviceName:(0,ne.Q)(E[0]),count:E.length,b:P.b}})}),n?(0,s.jsx)(Wn.A,{type:"button",fontSize:"medium",onPress:C,...Ut.A.addDataTestId(Ut.A.TestId.MODAL_TRIGGER),children:(0,s.jsx)(P.sA,{id:r})}):null]})]})};var es=n(843871),ts=n(548941),ns=n(439922),ss=n(657514);const os=(0,o.memo)(({onClick:e,deviceBannersExpanded:t})=>{const n=(0,i.wA)(),l=(0,i.d4)(Q.J1),a=(0,i.d4)(w.$5),c={initialValues:{...a},onSubmit:e=>{a.auto_upgrade!==e.auto_upgrade&&n((0,O.G2)(e))}},d=(0,o.useCallback)(()=>{n((0,ss.O)()),e(Ln.READY_TO_UPDATE)},[n,e]),r=(0,o.useCallback)((e,t)=>()=>{e("auto_upgrade",!0),t()},[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ns.A,{size:"original",isActive:!0,className:Hn}),(0,s.jsxs)(Xn,{children:[(0,s.jsx)(_t.A,{size:"medium",children:(0,s.jsx)(P.sA,{id:"DEVICE_ACTIONS_BULK_UPDATE",values:{count:l}})}),t?(0,s.jsx)(es.l1,{...c,children:({handleSubmit:e,setFieldValue:t})=>(0,s.jsxs)(G.A,{justifyContent:"center",alignItems:"flex-start",flexDirection:"column",children:[(0,s.jsx)(ts.A,{cursorType:"pointer",noWrap:!0,description:(0,s.jsx)(P.sA,{id:"DEVICE_UPDATE_ALL_TOOLTIP"}),children:(0,s.jsx)(Wn.A,{type:"button",fontSize:"medium",onPress:d,children:(0,s.jsx)(P.sA,{id:l>1?"COMMON_ACTION_UPDATE_ALL":"COMMON_ACTION_UPDATE"})})}),a.auto_upgrade?null:(0,s.jsx)(Wn.A,{type:"button",fontSize:"medium",onPress:r(t,e),children:(0,s.jsx)(P.sA,{id:"COMMON_ENABLE_AUTO_UPDATE"})})]})}):null]})]})});var ls=n(362613);const is=(0,o.memo)(({deviceBannersExpanded:e,onClick:t})=>{const n=(0,i.wA)(),l=(0,i.d4)(Q.X7),a=(0,i.d4)(w.jE),c=a?.cloud_template,d=(0,o.useCallback)(()=>{(0,R.A)(l,{dispatch:n,cloudTemplate:c}).then(()=>{t(Ln.READY_TO_ADOPT),n((0,N.At)(l,!0))}).catch(()=>{})},[n,l,c,t]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ls.A,{size:"original",isActive:!0,className:Hn}),(0,s.jsxs)(Xn,{children:[(0,s.jsx)(_t.A,{size:"medium",color:"text-2",children:(0,s.jsx)(P.sA,{id:"DEVICE_ACTIONS_BULK_ADOPT",values:{count:l.length}})}),e?(0,s.jsx)(Wn.A,{type:"button",fontSize:"medium",onPress:d,children:(0,s.jsx)(P.sA,{id:l.length>1?"COMMON_ACTION_ADOPT_ALL":"COMMON_ADOPT"})}):null]})]})}),as={[Ln.READY_TO_ADOPT]:is,[Ln.READY_TO_UPDATE]:os,[Ln.SMART_BATTERY_ADOPTION]:({onClick:e,deviceBannersExpanded:t})=>(0,s.jsx)(Zn,{smartBatteryNotificationType:Jn.ADOPTION,onClick:e,deviceBannersExpanded:t}),[Ln.SMART_BATTERY_ASSIGNMENT]:({onClick:e,deviceBannersExpanded:t})=>(0,s.jsx)(Zn,{smartBatteryNotificationType:Jn.ASSIGNMENT,onClick:e,deviceBannersExpanded:t})},cs=(0,o.memo)(()=>{const e=(0,i.d4)(L.Go),[t,n]=(0,o.useState)(e),l=(0,i.d4)(Yn),a=(0,o.useMemo)(()=>Object.entries(l).find(([e,t])=>t)?.[0],[l]),[d,r]=(0,o.useState)({[Ln.READY_TO_ADOPT]:!1,[Ln.READY_TO_UPDATE]:!1,[Ln.SMART_BATTERY_ADOPTION]:!1,[Ln.SMART_BATTERY_ASSIGNMENT]:!1}),A=(0,o.useCallback)(e=>{r(t=>({...t,[e]:!0}))},[]),C=(0,o.useCallback)(()=>{n(e=>!e)},[]),_=(0,o.useMemo)(()=>as[a],[a]),u=(0,o.useMemo)(()=>t?Un.A:yn.A,[t]);return(0,E.A)([(0,O.Uc)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}),(0,D.O)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})],_&&!d[a]?(0,s.jsx)($n,{children:(0,s.jsxs)(qn,{children:[(0,s.jsx)(_,{deviceBannersExpanded:t,onClick:A}),(0,s.jsx)(u,{size:"original",actionable:!0,onClick:C})]})}):null)});var ds=n(262356),rs=n(798282);const Es=(0,Pe.A)(G.A)`
  flex-direction: column;
  gap: ${B.YC};
`,As=(0,o.memo)(()=>{const e=(0,i.wA)(),t=(0,i.d4)(gt),{custom:n}=(0,ge.A)(ae.l.UNIFI_DEVICE),l=(0,o.useCallback)(({target:{checked:t}})=>{e((0,be.yT)(ae.l.UNIFI_DEVICE,{custom:{groupByApplication:t}}))},[e]);return t?(0,s.jsxs)(Es,{children:[(0,s.jsx)(ds.A,{onChange:l,checked:n?.groupByApplication,full:!0,size:"small",children:(0,s.jsx)(_t.A,{style:{marginLeft:B.kc},size:"small",color:"text-1",weight:"bold",children:(0,s.jsx)(P.sA,{id:"COMMON_GROUP_BY_APPLICATION"})})}),(0,s.jsx)(rs.A,{})]}):null});var Cs=n(788819);const _s={[Zt.cO.POE]:{id:Zt.cO.POE,label:"DEVICE_POE_SUPERVISED",condition:Cs.Jr},[Zt.cO.AC]:{id:Zt.cO.AC,label:"DEVICE_AC_SUPERVISED",condition:Cs.jt}};var us;!function(e){e.ID="id",e.NAME="name",e.COUNT="count"}(us||(us={}));const Is=(0,o.memo)(()=>{const e=(0,i.wA)(),{formatMessage:t}=(0,P.tz)(),n=(0,i.d4)((0,o.useMemo)(()=>(e=>(0,J.WY)()((0,X.Mz)(he.Qi,(0,he.a5)([Zt.Kq.SUPERVISION]),(t,n)=>{const s={},o=Object.values(_s),l=t.length;for(let n=0;n<l;n+=1){const l=t[n],i=o.filter(({condition:e})=>e(l));for(let t=0;t<i.length;t+=1){const{id:n,label:o}=i[t];n&&!s[n]&&(s[n]={[us.ID]:n,[us.NAME]:e({id:o}),[us.COUNT]:0})}}const i=n.length;for(let e=0;e<i;e+=1){const t=n[e],l=o.filter(({condition:e})=>e(t));for(let e=0;e<l.length;e+=1){const{id:t}=l[e];t&&s[t]&&(s[t]={...s[t],[us.COUNT]:s[t][us.COUNT]+1})}}return s}),e=>e))(t),[t])),l=(0,i.d4)(Lt.y3),a=(0,o.useMemo)(()=>Object.values(n),[n]),c=(0,o.useMemo)(()=>a.map(e=>e[us.ID]),[a]),d=(0,o.useMemo)(()=>a.map(e=>({id:e[us.ID],type:"CHECKBOX",title:e[us.NAME],checkboxProps:{count:e[us.COUNT],isTruncated:!0},children:[]})),[a]),r=(0,o.useMemo)(()=>new Set(l),[l]),E=(0,o.useMemo)(()=>new Set(a.filter(e=>!l.includes(e[us.ID])&&!n[e[us.ID]]?.[us.COUNT]).map(e=>e[us.ID])),[l,n,a]),A=(0,o.useCallback)(t=>{e((0,Ye.zZ)(Array.from(t||[])))},[e]);return(0,Qt.A)(l,c,Ye.zZ),a.length?(0,s.jsx)(Ht.A,{label:(0,s.jsx)(P.sA,{id:"DEVICE_SUPERVISION"}),children:(0,s.jsx)(Jt.A.Simplified,{items:d,selectedKeys:r,disabledKeys:E,onSelectionChange:A})}):null}),ms=(0,o.memo)(()=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(Yt.A,{children:[(0,s.jsx)(bn,{}),(0,s.jsx)(cs,{})]}),(0,s.jsxs)(Wt.A,{children:[(0,s.jsx)(Yt.A,{children:(0,s.jsx)(As,{})}),(0,s.jsx)(Tn,{}),(0,s.jsx)(Cn,{}),(0,s.jsx)(sn,{}),(0,s.jsx)(vn,{}),(0,s.jsx)(Is,{}),(0,s.jsx)(qt,{}),(0,s.jsx)(Vn,{})]})]})),Os=(0,o.memo)(()=>(0,s.jsx)(ft.A,{leftFilterPageId:ce.g1.DEVICES,leftFilterColumnsId:bt.DEVICES,footer:(0,s.jsx)(kt,{}),columns:(0,s.jsx)(Gt,{}),editor:void 0,children:(0,s.jsx)(ms,{})}));var Ts=n(579875),Ns=n(667059),Ds=n(172205),Ss=n(518525);const Ms=(0,X.Mz)(e=>e[Ds.U.DEVICE_PAGE],e=>e[Ss.u.PAGE_NUMBER]);var ps=n(675822);const hs=[{value:25,default:!0},{value:50},{value:100}],xs=(0,o.memo)(({columns:e,columnVisibility:t,activeRows:n,onRowClick:l,onColumnDrop:a})=>{const c=(0,o.useRef)(null),d=(0,i.wA)(),r=(0,i.d4)(he.b2),E=tt(r),A=(0,i.d4)(Ms),[C,_]=(0,mt.A)(ae.l.UNIFI_DEVICE),[u,I]=(0,It.A)(ae.l.UNIFI_DEVICE),m=(0,Ns.A)({tagId:dn.a.DEVICES,data:E}),O=(0,o.useCallback)(e=>{d((e=>({type:ps.o,pageNumber:e}))(e))},[d]);return(0,s.jsx)(G.A,{width:"100%",height:"100%",ref:c,children:(0,s.jsx)(Ts.A,{section:"COMMON_DEVICES",itemCount:r.length,tableType:ae.l.UNIFI_DEVICE,onRenderTable:({rowsPerPage:o,pageNumber:i})=>(0,s.jsx)(je.A,{className:St,data:E,columns:e,rowStyle:B.gc,columnVisibility:t,columnPinningLeftState:Nt,activeRows:n,onRowClick:l,onColumnSizingChange:_,initialColumnSize:C,onSort:I,sorting:u,parentRef:c,pageIndex:i,pageSize:o,columnDnD:!0,staticDnD:Nt,onColumnDrop:a,withOverflow:!0,overscan:1,overscanColumn:1,...m}),onPageChanged:O,pageNumber:A,wrapperFlexProps:Mt,rowOptions:hs})})}),gs=(0,o.memo)(()=>{const e=(0,l.W6)(),{search:t}=(0,l.zy)(),n=(0,i.d4)(fe.vc),a=(0,i.d4)(ie.RE),c=(0,i.d4)(ve.Ib),d=(0,i.d4)(he.hm),r=(0,i.wA)();(()=>{const e=(0,i.d4)(Se),t=(0,i.d4)(Oe.W1),n=(0,i.d4)(Oe.YL),s=(0,i.d4)(Oe.TP),l=(0,i.d4)(Q.bc);(0,o.useEffect)(()=>{if(l){const o=(0,me.ns)(t,n,s);(0,Te.UM)((0,Ie.A)((0,Te.sQ)(o),e),o)}},[l,e,t,n,s])})();const E=(0,i.d4)(gt),{initialColumns:A=[],custom:C,columnOrder:_}=(0,ge.A)(ae.l.UNIFI_DEVICE);(0,o.useEffect)(()=>{const s=new URLSearchParams(t);s.has(k.zs)&&n&&(setTimeout(()=>{r((0,v.XP)({type:b.H.DEVICE,id:n,tab:Ae.BC.SETTINGS}))},100),s.delete(k.zs),e.push({search:s.toString()}))},[r,e,t,n]);const u=(0,o.useCallback)(({device_type:e,product_line:t,mac:n,stacking_group_id:s})=>{r((0,_e.p)(!1)),r((0,v.XP)({type:s?b.H.STACKING:(0,Me.cW)({device_type:e,product_line:t})?e===pe.iU.CLIENT&&b.H.UNIFI_DEVICE_CLIENT||b.H.DEVICE:b.H.UNIFI_DEVICE_CLIENT,id:s||n}))},[r]);(0,ue.D)(a,c);const I=(0,o.useCallback)(e=>{r((0,be.yT)(ae.l.UNIFI_DEVICE,{columnOrder:(0,Ee.F)((0,ue.D)(),e,_)}))},[r,_]),m=(0,o.useMemo)(()=>[...(0,ue.D)()].sort((e,t)=>_.findIndex(t=>t===e.id)-_.findIndex(e=>e===t.id)),[_]),O=(0,o.useMemo)(()=>A.length?Dt.reduce((e,t)=>(e[t]=t===xe.o$.STATUS_BALL||A.includes(t),e),{}):{},[A]);(0,o.useEffect)(()=>{if(e.location.state){const{id:t,openSidePanel:n,type:s,tab:o}=e.location.state;t&&n&&s&&(r((0,v.XP)({type:s,id:t,tab:o})),delete e.location.state.openSidePanel,delete e.location.state.id,delete e.location.state.type)}},[r,e.location.state]);const T=(0,o.useMemo)(()=>!!E&&C?.groupByApplication,[E,C?.groupByApplication]),N=(0,re.A)([b.H.DEVICE,b.H.UNIFI_DEVICE_CLIENT]),D=(0,i.d4)(Re.MQ);return(0,s.jsx)(Ce.A,{leftFilterPageId:ce.g1.DEVICES,content:(0,s.jsx)(Os,{}),overflow:"hidden",children:d&&A.length?(0,s.jsx)(s.Fragment,{children:T&&!D?(0,s.jsx)(xt,{columns:m,columnVisibility:O,onRowClick:u,onColumnDrop:I,activeRows:N}):(0,s.jsx)(de.A,{children:(0,s.jsx)(xs,{columns:m,columnVisibility:O,onRowClick:u,onColumnDrop:I,activeRows:N})})}):(0,s.jsx)(He,{})})}),bs=(0,o.memo)(({path:e})=>{const t=(0,i.wA)();return(0,o.useEffect)(()=>{t((0,D.O)()),t((0,N.Uc)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,p.y)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,M.Yo)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,_.uy)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,T.Sk)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,O.Uc)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,S.$3)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,I.hh)(void 0,{crudCacheStrategy:{type:c.e.CACHE}})),t((0,u.G)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}))},[t]),(0,E.A)([(0,m.T)(void 0,{crudCacheStrategy:{type:c.e.CACHE}}),(0,r.Zi)(d.B.DEVICES),(0,r.Zi)(d.B.CLIENTS),(0,r.Zi)(d.B.UNIFI_DEVICES)],(0,s.jsxs)(A.A,{children:[(0,s.jsxs)(l.dO,{children:[(0,s.jsx)(a.F,{children:(0,s.jsx)(gs,{})}),(0,s.jsx)(a.F,{path:`${e}/device-upgrade/:id/`,render:e=>(0,s.jsx)(le,{...e})})]}),(0,s.jsx)(te,{})]}),{trackingName:C.VO.DEVICES})})},112879(e,t,n){n.d(t,{A:()=>l});var s=n(247816),o=n(309130);const l=(0,s.A)("div")`
  height: 100%;
  flex: 1;
  overflow: scroll;
  margin-left: ${o.Ln};
  padding: ${o.Ln} 0 0 0;
`},1943(e,t,n){n.d(t,{A:()=>_});var s=n(274934),o=n(602086),l=n(977872),i=n(247816),a=n(470070),c=n(956978),d=n(434521),r=n(45978),E=n(795206),A=n(648576);const C=(0,i.A)(A.Ay)`
  padding: 0;
  white-space: nowrap;
`,_=({device:e,labelId:t,disabled:n,unit_id:i})=>{const A=(0,l.wA)(),_=(0,d.S9)(e),u=(0,o.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),(0,c.YdF)({type:e.type})&&e.peer_ubb?.mac&&A((0,E.VO)({locating:e.peer_ubb.locating,mac:e.peer_ubb.mac,name:e.peer_ubb.name,model:e.peer_ubb.model})),A((0,E.VO)({locating:e.locating,mac:e.mac,name:e.name,model:e.model,unit_id:i}))},[A,e.type,e.mac,e.name,e.model,e.locating,e.peer_ubb?.mac,e.peer_ubb?.name,e.peer_ubb?.model,e.peer_ubb?.locating,i]);return(0,s.jsx)(C,{variant:"link",onClick:u,disabled:n||_!==r.g.CONNECTED,children:(0,s.jsx)(a.sA,{id:e.locating?"DEVICE_ACTIONS_LOCATE_STOP":t||"DEVICE_ACTIONS_LOCATE"})})}},850506(e,t,n){n.d(t,{i:()=>g,A:()=>b});var s=n(274934),o=n(602086),l=n(977872),i=n(221835),a=n(309130),c=n(250266),d=n(100978),r=n(470070),E=n(952566),A=n(889702),C=n(469890),_=n(956978),u=n(45978),I=n(795206),m=n(347625),O=n(434521),T=n(963428),N=n(146215);const D=({device:e,disabled:t,confirmTitle:n,confirmMessage:c,confirmButtonMessage:m,hidePoe:D,customName:S,unit_id:M})=>{const p=(0,l.wA)(),h=(0,l.d4)((0,E.p)(A.S.API_DEVICE_RESTART)),[x,g]=(0,o.useState)(!1),b=S||e.name||e.mac,f=(0,_.Tbi)(e)&&(0,C.b0)(e.port_table),R=(0,O.S9)(e),v=R!==u.g.CONNECTED&&R!==u.g.RFSCANNING,j=f||(0,_.moU)(e)||!e.bypassConfirmRestart,P=(0,o.useCallback)(()=>{p((0,I.CP)(e,x?"hard":"soft",M))},[p,e,x,M]);return h?(0,s.jsx)(N.A,{title:(0,s.jsx)(r.sA,{id:n||"DEVICE_ACTIONS_RESTART_CONFIRM_TITLE",values:{deviceName:b}}),message:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.sA,{id:c||"DEVICE_ACTIONS_RESTART_CONFIRM_MESSAGE",values:{deviceName:b}}),f&&!D?(0,s.jsx)(d.A,{paddingTop:a.kc,children:(0,s.jsx)(i.A,{checked:x,id:"hardReboot",onChange:()=>{g(e=>!e)},children:(0,s.jsx)(r.sA,{id:"DEVICE_ACTIONS_RESTART_CONFIRM_CYCLE_POE_POWER"})})}):null]}),confirmButtonLabel:m||"DEVICE_ACTIONS_RESTART",confirmButtonVariant:"destructive",onConfirm:P,trigger:j?(0,s.jsx)(T.A,{isDisabled:v||t,children:(0,s.jsx)(r.sA,{id:"DEVICE_ACTIONS_RESTART"})}):null}):null},S=(0,o.memo)(({device:e,disabled:t,confirmTitle:n,confirmMessage:o,confirmButtonMessage:l,hidePoe:i,customName:a,unit_id:c})=>(0,s.jsx)(D,{device:e,disabled:t,confirmTitle:n,confirmMessage:o,confirmButtonMessage:l,hidePoe:i,customName:a,unit_id:c}));var M=n(247816),p=n(648576);const h=(0,M.A)(p.Ay)`
  padding: 0;
`,x=({device:e,isConfirmOpen:t,setIsConfirmOpen:n,disabled:E})=>{const A=(0,l.wA)(),[O,T]=(0,o.useState)(!1),N=(0,o.useMemo)(()=>(0,m.Q)({name:e.name,model:e.model,mac:e.mac}),[e.name,e.model,e.mac]),D=(0,o.useMemo)(()=>(0,_.Tbi)({type:e.type})&&(0,C.b0)(e.port_table),[e.type,e.port_table]),S=(0,o.useMemo)(()=>e.deviceState!==u.g.CONNECTED&&e.deviceState!==u.g.RFSCANNING,[e.deviceState]),M=(0,o.useCallback)(()=>{A((0,I.CP)({name:e.name,model:e.model,mac:e.mac},O?"hard":"soft"))},[A,e.name,e.model,e.mac,O]),p=(0,o.useCallback)(()=>{n(!1)},[n]),x=(0,o.useCallback)(()=>{T(e=>!e)},[]),g=(0,o.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),D||(0,_.moU)({type:e.type,model:e.model,device_mode_override:e.device_mode_override})||!e.bypassConfirmRestart?n(!0):A((0,I.CP)({name:e.name,model:e.model,mac:e.mac}))},[A,D,e.bypassConfirmRestart,n,e.type,e.model,e.device_mode_override,e.name,e.mac]);return(0,s.jsx)(c.A,{isOpen:t,title:"DEVICE_ACTIONS_RESTART_CONFIRM_TITLE",titleValues:{deviceName:N},message:"DEVICE_ACTIONS_RESTART_CONFIRM_MESSAGE",messageValues:{deviceName:N},...D?{body:(0,s.jsx)(d.A,{paddingTop:a.kc,children:(0,s.jsx)(i.A,{checked:O,id:"hardReboot",onChange:x,children:(0,s.jsx)(r.sA,{id:"DEVICE_ACTIONS_RESTART_CONFIRM_CYCLE_POE_POWER"})})})}:{},buttonMessage:"DEVICE_ACTIONS_RESTART",buttonVariant:"danger",handleConfirm:M,handleClose:p,offset:-1,children:(0,s.jsx)(h,{variant:"link",onClick:g,disabled:S||E,children:(0,s.jsx)(r.sA,{id:"DEVICE_ACTIONS_RESTART"})})})},g=e=>(0,l.d4)((0,o.useMemo)(()=>(0,E.p)(A.S.API_DEVICE_RESTART),[]))?(0,s.jsx)(x,{...e}):null,b=(0,o.memo)(({device:e,disabled:t})=>(0,s.jsx)(S,{device:e,disabled:t}))},963428(e,t,n){n.d(t,{A:()=>r});var s=n(274934),o=n(977872),l=n(602086),i=n(266824),a=n(669439),c=n(897166),d=n(100978);const r=(0,l.forwardRef)(({allowReadOnly:e,disabledReason:t,...n},l)=>{const r=(0,o.d4)(c.EL)&&!e;return(0,s.jsx)(d.A,{alignItems:"center",children:(0,s.jsx)(a.A,{description:t,placement:"left",children:(0,s.jsx)(i.A,{fontSize:"medium",type:"button",...n,isDisabled:r||n.isDisabled||!!t,ref:l})})})})},387074(e,t,n){n.d(t,{A:()=>E});var s=n(274934),o=n(602086),l=n(247816),i=n(100978),a=n(291508);const c=(0,l.A)(i.A,(0,a.A)("isMaximized"))`
  flex-direction: column;
  ${({isMaximized:e})=>e?"\n  min-height: 0;\n  ":""}
`;var d=n(961231),r=n(614209);const E=({children:e})=>{const{[d.A.IS_MAXIMIZED]:t}=(0,o.useContext)(r.A);return(0,s.jsx)(c,{isMaximized:t,children:e})}},115238(e,t,n){n.d(t,{A:()=>i});var s=n(602086),o=n(977872),l=n(968021);const i=(e,t,n)=>{const i=(0,o.wA)(),a=[JSON.stringify(e),JSON.stringify(t)].join(),c=(0,l.A)(a);(0,s.useEffect)(()=>{if(a!==c){const s=[],o=e.length;for(let n=0;n<o;n+=1){const o=e[n];t.includes(o)||s.push(o)}s.length&&i(n(e.filter(e=>!s.includes(e))))}},[a,c,e,t,n,i])}}}]);