"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[45378],{532082:(e,t,a)=>{a.r(t),a.d(t,{default:()=>Ua});var n=a(296540),l=a(956347),r=a(136048),s=a(834959),c=a(604482),o=a(413357),E=a(582724),i=a(105540),u=a(469733),m=a(415331),A=a(510337);const T=e=>{const t=(0,u.useSelector)(A._);return n.createElement(m.A,{routes:t,...e})};var d=a(296968),S=a(627440),h=a(596731);const I={[d.x.MAIN]:`${h.Si[S.VO.SYSLOG]}`.replace(h.wk,d.x.MAIN),[d.x.SETTINGS]:`${h.Si[S.VO.SYSLOG]}`.replace(h.wk,d.x.SETTINGS)};var C=a(270701),O=a(598796),N=a(592510),D=a(71177),_=a(622624),p=a(305434),M=a(334779),R=a(736388),g=a(57867),b=a(928085),L=a(15095),f=a(861878),P=a(17441),v=a(9535),G=a(583286),y=a(512759),F=a(55983),w=a(792072),k=a(968906),U=a(959341);const V=(0,n.memo)(()=>{const e=(0,l.W6)(),t=(0,u.useDispatch)(),a=(0,L.A)(`${S.VO.SYSLOG}/${d.x.MAIN}`),r=(0,L.A)(`${S.VO.SYSLOG}/${d.x.SETTINGS}`),s=(0,b.A)(F.Ai),c=(0,b.A)(`${U.bB}/${U.Uy.TRAFFIC_LOGGING}?${G.Mp}`),o=(0,u.useSelector)(w._),E=(0,u.useSelector)(y.Qb),i=(0,n.useCallback)(()=>{t((0,g.A)()),e.push(a)},[t,e,a]),m=(0,n.useCallback)(()=>{e.push(r)},[e,r]),A=(0,n.useCallback)(()=>{e.push(o?s:c)},[e,o,s,c]);return n.createElement(P.A,null,n.createElement(v.A,{onClear:i,disabled:E}),n.createElement(f.A,{onPress:m,labelId:"LOGS_PUSH_NOTIFICATION_SETTINGS",...k.A.addDataTestId(k.A.TestId.LOGS_SETTINGS)}),n.createElement(f.A,{onPress:A,labelId:"LOGS_EXPORT_TO_SIEM_SERVER"}))});var $=a(429252),x=a.n($),H=a(691189),B=a(449256),K=a(151033),Y=a(635937),z=a(887831);const W=({queryParams:e},{queryParams:t})=>x()(e,t);var X=a(987617);const j=`${X.A2}/filters`,q=`${X.o2}/filter-data`,Z=`${j}/all`,Q=q;var J,ee,te,ae,ne;!function(e){e.ADMIN_FILTERS="adminFilters",e.CLIENT_FILTERS="clientFilters",e.DEVICE_FILTERS="deviceFilters"}(J||(J={})),function(e){e.NAME="name",e.ID="id",e.AVATAR_URL="avatar_url",e.COUNT="count"}(ee||(ee={})),function(e){e.COUNT="count",e.FINGERPRINT="fingerprint",e.MAC="mac",e.NAME="name"}(te||(te={})),function(e){e.ICON_FILENAME="icon_filename",e.ICON_RESOLUTIONS="icon_resolutions"}(ae||(ae={})),function(e){e.COUNT="count",e.NAME="name",e.MAC="mac",e.MODEL="model",e.UNIFI_DEVICE_INFO="unifi_device_info"}(ne||(ne={}));const le=({queryParams:e},{queryParams:t})=>x()(e,t),re=e=>e.reduce((e,t)=>(e[t[ee.ID]]=t,e),{}),se=e=>e.reduce((e,t)=>(e[t[ne.MAC]]=t,e),{}),ce=e=>e.reduce((e,t)=>(e[t[te.MAC]]=t,e),{}),oe=(e={},t={})=>{return(0,H.Kd)((a=e.data,[j,JSON.stringify(a)].join()),q,j,e,{method:z.A.POST,fetchConfig:{getAllPostResponse:!0},compareFunction:le,...t});var a};var Ee=a(212178),ie=a(801081);const ue=(0,ie.Mz)(y.CU,e=>({[K.hD.SEARCH_TEXT]:e[K.hD.SEARCH_TEXT],[K.hD.SEVERITIES]:e[K.hD.SEVERITIES],[K.hD.CATEGORIES]:e[K.hD.CATEGORIES],[K.hD.EVENTS]:e[K.hD.EVENTS],[K.hD.TIMESTAMP_FROM]:e[K.hD.TIMESTAMP_FROM],[K.hD.TIMESTAMP_TO]:e[K.hD.TIMESTAMP_TO]})),me=()=>{const e=(0,u.useDispatch)(),t=(0,u.useSelector)(ue),a=(0,Ee.A)(t);return(0,n.useEffect)(()=>{x()(a,t)||e(oe({data:t}))},[e,t,a]),(0,n.useEffect)(()=>{e(((e={},t={})=>{return a={...e,data:{...e.data,[K.hD.SEARCH_TEXT]:B.fN,[K.hD.SEVERITIES]:Y.Zx,[K.hD.CATEGORIES]:Y.KF,[K.hD.EVENTS]:Y.mI,[K.hD.TIMESTAMP_FROM]:0,[K.hD.TIMESTAMP_TO]:Date.now()}},(0,H.Kd)(Z,Q,Z,a,{method:z.A.POST,fetchConfig:{getAllPostResponse:!0},compareFunction:W,...t});var a})())},[e]),null},Ae=`${X.A2}/counters`,Te=`${X.o2}/count`,de=`${Ae}/general`,Se=Te,he=({queryParams:e},{queryParams:t})=>x()(e,t),Ie=(e={},t={})=>{return(0,H.Kd)((a=e.data,[de,JSON.stringify(a)].join()),Se,de,e,{method:z.A.POST,fetchConfig:{getAllPostResponse:!0},compareFunction:he,...t});var a},Ce=`${Ae}/audit`,Oe=Te,Ne=({queryParams:e},{queryParams:t})=>x()(e,t),De=(e={},t={})=>{return(0,H.Kd)((a=e.data,[Ce,JSON.stringify(a)].join()),Oe,Ce,e,{method:z.A.POST,fetchConfig:{getAllPostResponse:!0},compareFunction:Ne,...t});var a},_e=(0,ie.Mz)(y.CU,e=>({[K.hD.SEARCH_TEXT]:e[K.hD.SEARCH_TEXT],[K.hD.SEVERITIES]:e[K.hD.SEVERITIES],[K.hD.TIMESTAMP_FROM]:e[K.hD.TIMESTAMP_FROM],[K.hD.TIMESTAMP_TO]:e[K.hD.TIMESTAMP_TO]})),pe=(0,ie.Mz)(y.CU,e=>({[K.hD.SEARCH_TEXT]:e[K.hD.SEARCH_TEXT],[K.hD.SEVERITIES]:e[K.hD.SEVERITIES],[K.hD.TIMESTAMP_FROM]:e[K.hD.TIMESTAMP_FROM],[K.hD.TIMESTAMP_TO]:e[K.hD.TIMESTAMP_TO]})),Me=()=>{const e=(0,u.useDispatch)(),t=(0,u.useSelector)(_e),a=(0,u.useSelector)(pe),l=(0,Ee.A)(t);(0,n.useEffect)(()=>{x()(l,t)||e(Ie({data:t}))},[e,t,l]);const r=(0,Ee.A)(a);return(0,n.useEffect)(()=>{x()(r,a)||e(De({data:a}))},[e,a,r]),null};var Re=a(264863),ge=a(267094),be=a(71479),Le=a(566723),fe=a(294303);const Pe=(0,be.A)(fe.A)`
  width: 100%;
  align-items: center;
  gap: ${Le.YC};
`;var ve=a(64741),Ge=a(105925),ye=a(874807),Fe=a(382915),we=a(706574),ke=a(705559);var Ue=a(244961);const Ve=(0,n.memo)(()=>{const e=(0,l.W6)(),{pathname:t}=(0,l.zy)(),a=(0,u.useSelector)(y.MM),[r,s]=(0,n.useState)(a||""),c=(0,n.useCallback)(a=>{const n=new URL(window.location.href);n.searchParams.set(Ue.Rx,encodeURIComponent(a)),e.push(`${t}${n.search}`)},[e,t]),o=(0,n.useCallback)(a=>{const n=new URL(window.location.href);n.searchParams.append(Ue.Rx,encodeURIComponent(a)),e.push(`${t}${n.search}`)},[e,t]),E=(0,n.useCallback)(()=>{const a=new URL(window.location.href);a.searchParams.delete(Ue.Rx),e.push(`${t}${a.search}`)},[e,t]),i=(0,n.useCallback)(()=>{s(""),E()},[E]),m=(0,n.useCallback)((e,t)=>{s(t)},[]),A=(0,n.useCallback)((e,t)=>{const a=new URL(window.location.href);t?(a.searchParams.has(Ue.Rx)?c:o)(t):E()},[c,o,E]);return n.createElement(Ge.A,{onAddTag:ye.P1,onRemoveTag:ye.P1,onReset:i,onChange:m,value:r,onSubmit:A,width:Fe.Em})}),$e=()=>{const e=(0,u.useDispatch)(),t=(0,u.useSelector)(y.MM),[a,l]=(0,n.useState)(t||B.fN),r=(0,n.useCallback)(t=>{e((0,we.oz)(t))},[e]),s=(0,n.useMemo)(()=>(0,ve.A)(e=>{r(e)},2e3),[r]),c=(0,n.useCallback)(()=>{l(B.fN),s(B.fN),s.flush()},[s]),o=(0,n.useCallback)((e,t)=>{l(t),s(t)},[s]),E=(0,n.useCallback)((e,t)=>{s(t),s.flush()},[s]);return(0,n.useEffect)(()=>{l(t)},[t]),n.createElement(Ge.A,{onAddTag:ye.P1,onRemoveTag:ye.P1,onReset:c,onChange:o,value:a,onSubmit:E,width:Fe.Em})},xe=(0,n.memo)(({[ke.k.SWAI_ROUTE]:e})=>e?n.createElement(Ve,null):n.createElement($e,null));var He=a(597073),Be=a(513587),Ke=a(584916);const Ye={opacity:.5,pointerEvents:"none"};var ze=a(822336);const We=(0,be.A)(fe.A)`
  background: ${({theme:{themeName:e}})=>ze.Ay[`desktop-color-neutral-01-${e}`]};
  border-radius: ${ze.Ay["desktop-radius-base"]};
  padding: ${Le.kc};
  cursor: pointer;
  align-items: center;
  height: ${Le.fS};
`,Xe=(0,n.memo)(({disabled:e})=>{const t=(0,u.useDispatch)(),[a,l]=(0,n.useState)(!1),r=(0,u.useSelector)(y.Nv),s=(0,u.useSelector)(y.e6),c=(0,Be.A)(),o=(0,n.useCallback)(()=>{c&&(t((0,we.F6)({...r,endDate:new Date})),l(!0),setTimeout(()=>{l(!1)},750))},[t,r,c]);return n.createElement(We,{...k.A.addDataTestId(k.A.TestId.LOGS_RELOAD),disabled:e},n.createElement(He.A,{size:"original",style:{...a||s===Ke.j?Ye:{}},onClick:o,actionable:!0}))});var je=a(217439),qe=a(162420),Ze=a(699948),Qe=a(196010),Je=a(670180),et=a(699784),tt=a(198494),at=a(789768);const nt=(0,be.A)(fe.A)`
  flex-direction: column;
  gap: ${Le.kc};
`,lt=(0,be.A)(fe.A)`
  width: 100%;
  justify-content: space-between;
  border-radius: ${ze.Ay["desktop-radius-global"]};
  padding: ${Le.kc};
  background: ${({theme:{themeName:e}})=>ze.Ay[`desktop-color-neutral-01-${e}`]};
`,rt=(0,be.A)(fe.A)`
  gap: ${Le.YC};
`,st=(0,n.memo)(()=>{const e=(0,u.useDispatch)(),t=(0,L.A)(`${S.VO.INSIGHTS}/${Je.H.FLOWS}`),a=(0,n.useCallback)(()=>{e((0,at.rd)(!0))},[e]),l=(0,u.useSelector)(tt.mS),r=(0,n.useMemo)(()=>l?null:n.createElement(lt,null,n.createElement(rt,null,n.createElement(qe.A,{size:"original",variant:"fill",isActive:!0}),n.createElement(je.A,{size:"medium"},n.createElement(et.sA,{id:"LOGS_FLOWS_BANNER",values:{link:n.createElement(Qe.A,{to:t},n.createElement(et.sA,{id:"COMMON_FLOWS"}))}}))),n.createElement(Ze.A,{size:"original",actionable:!0,onClick:a})),[l,t,a]);return(0,n.useMemo)(()=>[r].some(Boolean),[r])?n.createElement(nt,null,r):null});var ct=a(814942),ot=a.n(ct),Et=a(497336),it=a.n(Et),ut=a(979106),mt=a(208288),At=a(48450),Tt=a(149188),dt=a(664967),St=a(609392),ht=a(389017),It=a(896297),Ct=a(74750);const Ot=(0,be.A)(Ct.A)`
  background: none !important;
  color: inherit !important;
  border: none !important;
  padding: 0px !important;
  font: inherit !important;
  cursor: pointer !important;
  outline: none !important;
  max-height: 24px !important;
  max-width: 24px !important;
  margin: 0 !important;
`,Nt=({children:e})=>n.createElement(Ot,{width:"square"},e),Dt=[{id:Ke.l.ONE_DAY,label:n.createElement(et.sA,{id:"COMMON_DATE_RANGE_SHORT_1D"})},{id:Ke.l.THREE_DAYS,label:n.createElement(et.sA,{id:"COMMON_DATE_RANGE_SHORT_3D"})},{id:Ke.l.ONE_WEEK,label:n.createElement(et.sA,{id:"COMMON_DATE_RANGE_SHORT_1W"})},{id:Ke.l.TWO_WEEKS,label:n.createElement(et.sA,{id:"COMMON_DATE_RANGE_SHORT_2W"})},{id:Ke.l.ONE_MONTH,label:n.createElement(et.sA,{id:"COMMON_DATE_RANGE_SHORT_1M"})}],_t=(0,be.A)(fe.A)`
  width: 100%;
`,pt=()=>{const e=(0,l.W6)(),{pathname:t}=(0,l.zy)(),a=(0,u.useSelector)(y.PA),{startDate:r,endDate:s}=(0,u.useSelector)(y.Nv);(0,n.useEffect)(()=>{const n=new URL(window.location.href);a?(r&&(n.searchParams.has(Ue.mX)?n.searchParams.set(Ue.mX,r.toISOString()):n.searchParams.append(Ue.mX,r.toISOString())),s&&(n.searchParams.has(Ue.t_)?n.searchParams.set(Ue.t_,s.toISOString()):n.searchParams.append(Ue.t_,s.toISOString()),e.push(`${t}${n.search}`))):(n.searchParams.has(Ue.mX)||n.searchParams.has(Ue.t_))&&(n.searchParams.delete(Ue.mX),n.searchParams.delete(Ue.t_),e.push(`${t}${n.search}`))},[r,s,e,t,a])},Mt=(0,n.memo)(()=>{pt();const e=(0,u.useDispatch)(),[t,a]=(0,n.useState)(!1),l=(0,u.useSelector)(y.Nv),r=(0,u.useSelector)(y.e6),s=(0,ht.A)(),{startValue:c,endValue:o}=(0,n.useMemo)(()=>l.startDate&&l.endDate?{startValue:(0,mt.A)(l.startDate,"CalendarDateTime"),endValue:(0,mt.A)(ot()(l.endDate,1),"CalendarDateTime")}:{},[l.endDate,l.startDate]),[E,i]=(0,n.useState)({start:c,end:o}),[m,A]=(0,n.useState)(!1),T=(0,n.useCallback)(()=>{a(!1)},[]),d=(0,n.useCallback)(e=>{e&&!E&&Boolean(c)&&Boolean(o)&&i({start:c,end:o}),e||m||i(null),a(e)},[m,c,o,E]),S=(0,n.useCallback)(e=>{i(e),A(Boolean(e))},[]),h=(0,n.useCallback)(()=>{A(!1),i(null)},[]),I=(0,n.useCallback)(({id:t})=>{e((0,we.wu)(t)),t!==Ke.j&&e((0,we.F6)(dt.E[t].getRange(new Date)))},[e]),C=(0,n.useCallback)(t=>{t&&(0,St.Q)(t)&&(e((0,we.F6)({startDate:new Date(t.start.toString()),endDate:new Date(t.end.toString())})),a(!1),I({id:Ke.j}))},[e,I]),{maxValue:O,minValue:N}=(0,n.useMemo)(()=>({maxValue:(0,mt.A)(it()(new Date),"CalendarDateTime"),minValue:(0,mt.A)(new Date(0),"CalendarDateTime")}),[]),D=(0,n.useMemo)(()=>({start:(0,mt.A)(l.startDate,"CalendarDateTime"),end:(0,mt.A)(l.endDate,"CalendarDateTime")}),[l.endDate,l.startDate]),_=(0,It.A)(),p=(0,n.useMemo)(()=>Dt.concat({id:Ke.j,label:n.createElement(At.X,{isOpen:t,value:E,defaultValue:D,localizationTexts:s,twoMonthCalendar:!0,onOpenChange:d,onChange:S,onClear:h,onSave:C,onCancel:T,maxValue:O,minValue:N,presets:_},n.createElement(Nt,null,n.createElement(Tt.A,{size:"original",isActive:r===Ke.j})))}),[r,t,E,D,s,O,N,_,d,S,h,C,T]);return n.createElement(_t,null,n.createElement(ut.A,{variant:"filter",tabs:p,selectedTab:r,onSelectTab:I,stretched:!0}))});var Rt=a(453191),gt=a(622258),bt=a(718073),Lt=a(628999);const ft=(0,be.A)(fe.A,{shouldForwardProp:e=>!["isActive","logSeverity"].includes(e)})`
  border: 1px solid
    ${({isActive:e,theme:{themeName:t}})=>ze.Ay[`desktop-color-${e?"ublue-06":"neutral-03"}-${t}`]};
  cursor: pointer;
  border-radius: ${ze.Ay["desktop-radius-base"]};
  padding: ${Le.kc} 0;
  width: 100%;
  justify-content: center;
`,Pt=(0,n.memo)(({logSeverity:e,isActive:t,onClick:a})=>n.createElement(bt.A,{description:n.createElement(et.sA,{id:Y.lU[e]})},n.createElement(ft,{onClick:a,isActive:t,logSeverity:e},n.createElement(Lt.A,{logSeverity:e})))),vt=(0,be.A)(fe.A)`
  gap: ${Le.YC};
`,Gt=(0,n.memo)(({disabled:e})=>{const t=(0,u.useDispatch)(),a=(0,u.useSelector)(y.RU),l=(0,n.useCallback)(e=>()=>{t((0,we.tx)(a.includes(e)?a.filter(t=>t!==e):[e,...a]))},[t,a]);return n.createElement(vt,{disabled:e},(0,Rt.A)()[gt.O.SEVERITIES].map(e=>n.createElement(Pt,{key:e,logSeverity:e,isActive:a.includes(e),onClick:l(e)})))});var yt=a(777958),Ft=a(146262),wt=a(659243),kt=a(87485),Ut=a(25553);const Vt=e=>(0,Ut.uh)(Ie({data:e}));var $t,xt;!function(e){e.EVENTS="events",e.CATEGORIES="categories",e.TYPE="type"}($t||($t={})),function(e){e.COUNT="count",e.NAME="name"}(xt||(xt={}));const Ht=e=>(0,Ut.uh)(De({data:e})),Bt=(e,t,a)=>{return(0,ie.Mz)((n=e,(0,ie.Mz)(Vt(n),kt.i6)),(e=>(0,ie.Mz)(Ht(e),kt.i6))(e),(e,n)=>{const l=e=>(e[t]||[]).reduce((e,t)=>(e[t[xt.NAME]]=t[xt.COUNT],e),{});switch(a){case K.T2.GENERAL:return l(e);case K.T2.AUDIT:return l(n);default:return{}}});var n},Kt=(e,t)=>(0,ie.Mz)(Vt(e),Ht(e),(e,a)=>{switch(t){case K.T2.GENERAL:return(0,kt.RQ)(e);case K.T2.AUDIT:return(0,kt.RQ)(a);default:return!1}}),Yt=(e,t)=>{const[a,l]=(0,n.useState)([]),r=(0,Ee.A)(e),s=(0,Ee.A)(t);return(0,n.useEffect)(()=>{(e||r===e)&&x()(s,t)||l(t.map(e=>e||0))},[t,e,r,s]),a},zt=(0,be.A)(fe.A)`
  padding: ${Le.kc} 0 ${Le.kc} ${Le.kc};
`,Wt=(0,be.A)(fe.A)`
  justify-content: center;
  align-items: center;
  gap: ${Le.xO};
`,Xt=({logFilterType:e,disabled:t})=>{const a=(0,u.useDispatch)(),l=(0,n.useCallback)(e=>{a((0,we.qX)(e))},[a]),r=(0,u.useSelector)(_e),s=(0,u.useSelector)(pe),{logsCountersFetchParams:c}=(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return{logsCountersFetchParams:r};case K.T2.AUDIT:return{logsCountersFetchParams:s};default:return{logsCountersFetchParams:{}}}},[e,r,s]),o=(0,u.useSelector)((0,n.useMemo)(()=>Bt(c,$t.TYPE,K.T2.GENERAL),[c])),E=(0,u.useSelector)((0,n.useMemo)(()=>Bt(c,$t.TYPE,K.T2.AUDIT),[c])),i=(0,u.useSelector)((0,n.useMemo)(()=>Kt(c,K.T2.GENERAL),[c])),m=(0,u.useSelector)((0,n.useMemo)(()=>Kt(c,K.T2.AUDIT),[c])),[A]=Yt(i,[o[K.T2.GENERAL]]),[T]=Yt(m,[E[K.T2.AUDIT]]);return n.createElement(zt,{disabled:t},n.createElement(yt.A,{direction:"horizontal",onChange:l,value:e},n.createElement(Wt,null,n.createElement(Ft.A,{label:n.createElement(n.Fragment,null,n.createElement(et.sA,{id:"COMMON_LABEL_GENERAL"}),Number.isInteger(A)?n.createElement(n.Fragment,null," (",(0,wt.A)(A),")"):""),value:K.T2.GENERAL}),n.createElement(Ft.A,{label:n.createElement(n.Fragment,null,n.createElement(et.sA,{id:"LOGS_AUDIT"}),Number.isInteger(T)?n.createElement(n.Fragment,null," (",(0,wt.A)(T),")"):""),value:K.T2.AUDIT}))))};var jt=a(370333),qt=a(156870),Zt=a(556456),Qt=a(524332);const Jt=e=>e[Qt.rR.PATH].slice(e[Qt.rR.PATH].indexOf("/")+1,e[Qt.rR.PATH].length),ea="LOGS_CATEGORY_SWAI_ROUTE_PATH_PLACEHOLDER",ta=(0,n.memo)(({disabled:e})=>{const t=(0,l.W6)(),a=(0,u.useDispatch)(),{formatMessage:r}=(0,et.tz)(),{pathname:s}=(0,l.zy)(),c=(0,u.useSelector)(Zt.jO),[o,E]=(0,n.useState)(c.some(({[Qt.rR.PATH]:e})=>s.endsWith(e))),i=(0,L.A)(`${S.VO.SYSLOG}/${ea}`),m=(0,L.A)(`${S.VO.SYSLOG}/${d.x.MAIN}`),A=(0,u.useSelector)(y.PA),{[gt.O.GENERAL_CATEGORIES]:T}=(0,Rt.A)(),h=(0,n.useMemo)(()=>T.filter(e=>e!==K.nh.AUDIT),[T]),I=(0,u.useSelector)(y.wg),C=(0,u.useSelector)(_e),O=(0,u.useSelector)((0,n.useMemo)(()=>Bt(C,$t.CATEGORIES,K.T2.GENERAL),[C])),N=(0,u.useSelector)((0,n.useMemo)(()=>Kt(C,K.T2.GENERAL),[C])),D=(0,n.useMemo)(()=>h.map(e=>O[e]),[h,O]),_=Yt(N,D),p=(0,n.useMemo)(()=>h.map((e,t)=>({id:e,type:"CHECKBOX",title:r({id:Y.Vx[e]}),checkboxProps:{count:_[t],isTruncated:!0},children:[]})).sort(({title:e},{title:t})=>e.localeCompare(t)).concat(c.map(({[Qt.rR.PATH]:e,[Qt.rR.LABEL]:t})=>({id:e,type:"CHECKBOX",title:t,checkboxProps:{isTruncated:!0},children:[]}))),[h,r,_,c]),M=(0,n.useMemo)(()=>I.length===h.length?"all":new Set([...I,...A?[A]:[]]),[I,h,A]),R=(0,n.useMemo)(()=>new Set(e?h:[]),[h,e]),g=(0,n.useCallback)(e=>{if("all"!==e){const a=c.find(({[Qt.rR.PATH]:t})=>e.has(t));if(a)return E(!0),void t.push(i.replace(ea,Jt(a)));if(!a&&o)return E(!1),void t.push(m)}a((0,we.A$)("all"===e?h:Array.from(e)))},[a,h,c,i,t,m,o]);return n.createElement(qt.A,{items:p,selectedKeys:M,disabledKeys:R,onSelectionChange:g,shouldAlwaysUseSimplifiedPicker:!0})});var aa=a(445535),na=a(627068),la=a(708984),ra=a(888964);const sa=(0,n.memo)(({logFilterType:e,disabled:t})=>{const a=(0,u.useDispatch)(),{formatMessage:l}=(0,et.tz)(),{[gt.O.GENERAL_EVENTS]:r,[gt.O.AUDIT_EVENTS]:s}=(0,Rt.A)(),c=(0,u.useSelector)(y.Tc),o=(0,u.useSelector)(y.oR),E=(0,u.useSelector)(y.wg),{[la.o4.CATEGORY_TO_EVENT]:i}=(0,u.useSelector)(na.zm),m=(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return E.length?E.flatMap(e=>i[e]||[]):r;case K.T2.AUDIT:return s;default:return[]}},[e,r,s,i,E]),A=(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return c;case K.T2.AUDIT:return o;default:return[]}},[e,c,o]),T=(0,u.useSelector)(_e),d=(0,u.useSelector)(pe),S=(0,u.useSelector)((0,n.useMemo)(()=>Bt(T,$t.EVENTS,K.T2.GENERAL),[T])),h=(0,u.useSelector)((0,n.useMemo)(()=>Bt(d,$t.EVENTS,K.T2.AUDIT),[d])),I=(0,u.useSelector)((0,n.useMemo)(()=>Kt(T,K.T2.GENERAL),[T])),C=(0,u.useSelector)((0,n.useMemo)(()=>Kt(d,K.T2.AUDIT),[d])),O=(0,n.useMemo)(()=>{const t=(()=>{switch(e){case K.T2.GENERAL:return S;case K.T2.AUDIT:return h;default:return{}}})();return m.map(e=>t[e])},[m,S,h,e]),N=(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return I;case K.T2.AUDIT:return C;default:return!1}},[e,I,C]),D=Yt(N,O),_=(0,n.useMemo)(()=>m.map((e,t)=>({id:e,type:"CHECKBOX",title:l({id:`${K.yQ.SYS_LOG_EVENT}_${Y.Nc[e]}`}),checkboxProps:{count:D[t],isTruncated:!0},children:[]})).sort(({title:e,checkboxProps:{count:t}},{title:a,checkboxProps:{count:n}})=>0===t&&0!==n?1:0!==t&&0===n?-1:e.localeCompare(a)),[m,l,D]),p=(0,n.useMemo)(()=>A.length===m.length?"all":new Set(A),[A,m]),M=(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return new Set(t?m:m.filter(e=>!A.includes(e)&&Boolean(!h[e])));case K.T2.AUDIT:return new Set(t?m:m.filter(e=>!A.includes(e)&&Boolean(!S[e])));default:return new Set}},[t,e,h,S,m,A]),R=(0,n.useCallback)(t=>{switch(e){case K.T2.GENERAL:a((0,we.li)(t));break;case K.T2.AUDIT:a((0,we.aT)(t))}},[a,e]),g=(0,n.useCallback)(e=>{R("all"===e?m:Array.from(e))},[R,m]),b=(0,n.useCallback)(e=>{R(Array.from(e))},[R]),L=(0,n.useCallback)(()=>{R([])},[R]);return n.createElement(aa.A,{id:ra.R.LOGS_EVENT_PICKER,label:n.createElement(et.sA,{id:"COMMON_EVENTS"}),initialExpanded:!0},n.createElement(qt.A,{id:ra.R.LOGS_EVENT_PICKER,items:_,selectedKeys:p,disabledKeys:M,onSelectionChange:g,onSelectAll:b,onDeselectAll:L}))});var ca=a(6510),oa=a(6176),Ea=a(703447);const ia=(0,ie.Mz)(e=>e.models[Z]?.byId?.[Z]?.record||{},e=>e),ua=e=>(0,ie.Mz)((e=>(0,Ut.uh)(oe({data:e})))(e),ia,(e,t)=>((e,t)=>{return a=re(t[J.ADMIN_FILTERS]||[]),n=se(t[J.DEVICE_FILTERS]||[]),l=ce(t[J.CLIENT_FILTERS]||[]),{[J.ADMIN_FILTERS]:Object.entries(re(e[J.ADMIN_FILTERS]||[])).map(([e,t])=>({...t,[ee.COUNT]:a[e]?.[ee.COUNT]||0})),[J.DEVICE_FILTERS]:Object.entries(se(e[J.DEVICE_FILTERS]||[])).map(([e,t])=>({...t,[ne.COUNT]:n[e]?.[ne.COUNT]||0})),[J.CLIENT_FILTERS]:Object.entries(ce(e[J.CLIENT_FILTERS]||[])).map(([e,t])=>({...t,[te.COUNT]:l[e]?.[te.COUNT]||0}))};var a,n,l})(t,(0,kt.i6)(e))),ma=20,Aa=(0,n.memo)(({disabled:e})=>{const t=(0,u.useDispatch)(),a=(0,u.useSelector)(y.n9),l=(0,u.useSelector)(ue),r=(0,u.useSelector)((0,n.useMemo)(()=>(e=>(0,ie.Mz)(ua(e),e=>e[J.DEVICE_FILTERS]||[]))(l),[l])),s=(0,n.useMemo)(()=>r.map(e=>e[ne.MAC]),[r]),c=(0,n.useMemo)(()=>r.map(e=>{return t=Boolean(Object.keys(e[ne.UNIFI_DEVICE_INFO]||{}).length),{id:e[ne.MAC],type:"CHECKBOX",title:t?e[ne.NAME]:(0,ca.Q)({name:e[ne.NAME],model:e[ne.MODEL],mac:e[ne.MAC]}),checkboxProps:{symbol:t?n.createElement(Ea.A,{width:ma,height:ma,client:{icon_filename:e[ne.UNIFI_DEVICE_INFO][ae.ICON_FILENAME],icon_resolutions:e[ne.UNIFI_DEVICE_INFO][ae.ICON_RESOLUTIONS]}}):n.createElement(oa.A,{width:ma,height:ma,model:e[ne.MODEL]}),count:e[ne.COUNT],isTruncated:!0},children:[]};var t}).sort(({title:e},{title:t})=>e.localeCompare(t)),[r]),o=(0,n.useMemo)(()=>a.length===s.length?"all":new Set(a),[a,s]),E=(0,n.useMemo)(()=>new Set(e?s:"all"!==o?r.filter(e=>!o.has(e[ne.MAC])&&Boolean(!e[ne.COUNT])).map(e=>e[ne.MAC]):[]),[r,s,o,e]),i=(0,n.useCallback)(e=>{t((0,we.vI)("all"===e?s:Array.from(e)))},[t,s]),m=(0,n.useCallback)(e=>{t((0,we.vI)(Array.from(e)))},[t]),A=(0,n.useCallback)(()=>{t((0,we.vI)([]))},[t]);return c.length?n.createElement(aa.A,{id:ra.R.LOGS_DEVICE_PICKER,label:n.createElement(et.sA,{id:"LOGS_FILTER_BY_UNIFI_DEVICES"}),initialExpanded:!0},n.createElement(qt.A,{id:ra.R.LOGS_DEVICE_PICKER,items:c,selectedKeys:o,disabledKeys:E,onSelectionChange:i,onSelectAll:m,onDeselectAll:A})):null}),Ta=(0,n.memo)(({disabled:e})=>{const t=(0,u.useDispatch)(),a=(0,u.useSelector)(y.Ob),l=(0,u.useSelector)(ue),r=(0,u.useSelector)((0,n.useMemo)(()=>(e=>(0,ie.Mz)(ua(e),e=>e[J.CLIENT_FILTERS]||[]))(l),[l])),s=(0,n.useMemo)(()=>r.map(e=>e[te.MAC]),[r]),c=(0,n.useMemo)(()=>r.map(e=>({id:e[te.MAC],type:"CHECKBOX",title:e[te.NAME],checkboxProps:{symbol:n.createElement(Ea.A,{width:ma,height:ma,client:{fingerprint:e[te.FINGERPRINT]}}),count:e[te.COUNT],isTruncated:!0},children:[]})).sort(({title:e},{title:t})=>e.localeCompare(t)),[r]),o=(0,n.useMemo)(()=>a.length===s.length?"all":new Set(a),[a,s]),E=(0,n.useMemo)(()=>new Set(e?s:"all"!==o?r.filter(e=>!o.has(e[te.MAC])&&Boolean(!e[te.COUNT])).map(e=>e[te.MAC]):[]),[r,s,o,e]),i=(0,n.useCallback)(e=>{t((0,we.Sy)("all"===e?s:Array.from(e)))},[t,s]),m=(0,n.useCallback)(e=>{t((0,we.Sy)(Array.from(e)))},[t]),A=(0,n.useCallback)(()=>{t((0,we.Sy)([]))},[t]);return c.length?n.createElement(aa.A,{id:ra.R.LOGS_CLIENT_PICKER,label:n.createElement(et.sA,{id:"LOGS_FILTER_BY_CLIENT_DEVICES"}),initialExpanded:!0},n.createElement(qt.A,{id:ra.R.LOGS_CLIENT_PICKER,items:c,selectedKeys:o,disabledKeys:E,onSelectionChange:i,onSelectAll:m,onDeselectAll:A})):null}),da=e=>Object.entries(e).reduce((e,[t,a])=>(a&&e.push(t),e),[]),Sa=da({[K.nh.CLIENT_DEVICES]:!0,[K.nh.INTERNET_AND_WAN]:!1,[K.nh.POWER]:!0,[K.nh.AUDIT]:!0,[K.nh.SECURITY]:!0,[K.nh.UNIFI_DEVICES]:!0,[K.nh.SOFTWARE_UPDATES]:!0,[K.nh.UNIFI_ETHERNET_PORTS]:!0,[K.nh.VPN]:!1}),ha=da({[K.nh.CLIENT_DEVICES]:!0,[K.nh.INTERNET_AND_WAN]:!1,[K.nh.POWER]:!1,[K.nh.AUDIT]:!1,[K.nh.SECURITY]:!0,[K.nh.UNIFI_DEVICES]:!1,[K.nh.SOFTWARE_UPDATES]:!1,[K.nh.UNIFI_ETHERNET_PORTS]:!0,[K.nh.VPN]:!0}),Ia=(0,n.memo)(({disabled:e})=>{const t=(0,u.useSelector)(y.wg),a=(0,u.useSelector)(y.n9),l=(0,u.useSelector)(y.Ob),r=(0,n.useMemo)(()=>Boolean(a.length)||!t.length||(0,jt.LW)(t,Sa),[a.length,t]),s=(0,n.useMemo)(()=>Boolean(l.length)||!t.length||(0,jt.LW)(t,ha),[l.length,t]);return n.createElement(n.Fragment,null,n.createElement(Re.A,null,n.createElement(ta,{disabled:e})),n.createElement(sa,{logFilterType:K.T2.GENERAL,disabled:e}),r?n.createElement(Aa,{disabled:e}):null,s?n.createElement(Ta,{disabled:e}):null)});var Ca=a(538205),Oa=a(765562);const Na=(0,n.memo)(({disabled:e})=>{const t=(0,u.useDispatch)(),a=(0,u.useSelector)(y.up),l=(0,u.useSelector)(ue),r=(0,u.useSelector)((0,n.useMemo)(()=>(e=>(0,ie.Mz)(ua(e),e=>e[J.ADMIN_FILTERS]||[]))(l),[l])),s=(0,n.useMemo)(()=>r.map(e=>e[ee.ID]),[r]),c=(0,n.useMemo)(()=>r.map(e=>{return{id:e[ee.ID],type:"CHECKBOX",title:e[ee.NAME],checkboxProps:{symbol:n.createElement(Ca.A,{image:(t=e[ee.AVATAR_URL],`${Oa.A.accountCdn}/${t}`)}),count:e[ee.COUNT],isTruncated:!0},children:[]};var t}).sort(({title:e},{title:t})=>e.localeCompare(t)),[r]),o=(0,n.useMemo)(()=>a.length===s.length?"all":new Set(a),[a,s]),E=(0,n.useMemo)(()=>new Set(e?s:"all"!==o?r.filter(e=>!o.has(e[ee.ID])&&Boolean(!e[ee.COUNT])).map(e=>e[ee.ID]):[]),[e,r,s,o]),i=(0,n.useCallback)(e=>{t((0,we.g1)("all"===e?s:Array.from(e)))},[t,s]);return c.length?n.createElement(aa.A,{id:ra.R.LOGS_ADMIN_PICKER,label:n.createElement(et.sA,{id:"COMMON_ADMINS"}),initialExpanded:!0},n.createElement(qt.A,{id:ra.R.LOGS_ADMIN_PICKER,items:c,selectedKeys:o,disabledKeys:E,onSelectionChange:i})):null}),Da=(0,n.memo)(({disabled:e})=>n.createElement(n.Fragment,null,n.createElement(Na,{disabled:e}),n.createElement(sa,{logFilterType:K.T2.AUDIT,disabled:e}))),_a=(0,n.memo)(({logFilterType:e,disabled:t})=>(0,n.useMemo)(()=>{switch(e){case K.T2.GENERAL:return n.createElement(Ia,{disabled:t});case K.T2.AUDIT:return n.createElement(Da,{disabled:t});default:return null}},[e,t])),pa=(0,n.memo)(()=>{const e=(0,u.useSelector)(y.I1),t=(0,u.useSelector)(y.PA),a=Boolean(t);return n.createElement(n.Fragment,null,n.createElement(Re.A,null,n.createElement(Pe,null,n.createElement(xe,{swaiRoute:t}),n.createElement(Xe,{disabled:a})),n.createElement(st,null),n.createElement(Mt,null),n.createElement(Gt,{disabled:a})),n.createElement(ge.A,null,n.createElement(Re.A,null,n.createElement(Xt,{logFilterType:e,disabled:a})),n.createElement(_a,{logFilterType:e,disabled:a})))}),Ma=(0,n.memo)(()=>(me(),Me(),n.createElement(R.A,{leftFilterPageId:c.g1.LOGS,footer:n.createElement(V,null)},n.createElement(pa,null))));var Ra=a(751862),ga=a(472796);const ba=()=>{const e=(0,u.useDispatch)(),t=(0,n.useRef)(!0),a=(0,u.useSelector)(y.CU),l=(0,u.useSelector)((0,n.useMemo)(()=>(0,ga.om)(a),[a]));return(0,n.useEffect)(()=>{t.current&&!l&&(t.current=!1)},[e,l]),null};var La,fa=a(775586);!function(e){e.LOG_ID="logId",e.SEARCH="search",e.SEVERITIES="severities",e.CATEGORIES="categories",e.TYPE="type",e.EVENTS="events",e.DEVICES="devices",e.CLIENTS="clients",e.ADMINS="admins",e.DATE_RANGE_ID="dateRangeId",e.TIMESTAMP_FROM="timestampFrom",e.TIMESTAMP_TO="timestampTo"}(La||(La={}));var Pa=a(186248),va=a(960407),Ga=a(975791),ya=a(902529);const Fa=(0,n.memo)(({children:e})=>{const t=(0,l.W6)(),a=(0,u.useDispatch)(),[r,s]=(0,n.useState)(!1),{search:c}=(0,fa.A)(),o=(0,l.zy)();return(0,n.useEffect)(()=>{if(!r){const e=new URLSearchParams(c),n=e=>{const a=new URLSearchParams(e.toString());Object.values(La).forEach(e=>{a.delete(e)}),t.replace({...o,search:a.toString()}),s(!0)},l=e.get(La.LOG_ID),r=e.get(La.SEARCH),E=e.get(La.SEVERITIES),i=e.get(La.CATEGORIES),m=e.get(La.TYPE),A=e.get(La.EVENTS),T=e.get(La.DEVICES),d=e.get(La.CLIENTS),S=e.get(La.ADMINS),h=e.get(La.DATE_RANGE_ID),I=e.get(La.TIMESTAMP_FROM),C=e.get(La.TIMESTAMP_TO);(0,u.batch)(()=>{var e;l&&a((e=l,(t,a)=>{t((0,Pa.$)({queryParams:{id:e}})).then(()=>{const n=(0,va.$h)(e)(a());t((0,ya.L)({log:n,adminActivityIdOverride:(0,Ga.Qm)(n),flowIdOverride:(0,Ga.gg)(n)}))})})),r&&a((e=>t=>{t((0,we.oz)(e))})(r)),E&&a((e=>t=>{const a=e.split(",").map(e=>e.toUpperCase());a.every(e=>Object.values(K.S1).includes(e))&&t((0,we.tx)(a))})(E)),i&&a((e=>t=>{const a=e.split(",").map(e=>e.toUpperCase());a.every(e=>Object.values(K.nh).includes(e))&&t((0,we.A$)(a))})(i)),m&&a((e=>t=>{const a=e.toUpperCase();Object.values(K.T2).includes(a)&&t((0,we.qX)(a))})(m)),A&&a(((e,t)=>a=>{const n=(t||"").toUpperCase(),l=e.split(",").map(e=>e.toUpperCase());if(l.every(e=>Y.mI.includes(e)))switch(n){case K.T2.AUDIT:a((0,we.aT)(l));break;case K.T2.GENERAL:default:a((0,we.li)(l))}})(A,m)),T&&a((e=>t=>{t((0,we.vI)(e.split(",")))})(T)),d&&a((e=>t=>{t((0,we.Sy)(e.split(",")))})(d)),S&&a((e=>t=>{t((0,we.g1)(e.split(",")))})(S)),h&&a(((e,t,a)=>n=>{switch(e.toLowerCase()){case"day":case"3_day":case"week":case"2_week":case"month":{const t={day:Ke.l.ONE_DAY,"3_day":Ke.l.THREE_DAYS,week:Ke.l.ONE_WEEK,"2_week":Ke.l.TWO_WEEKS,month:Ke.l.ONE_MONTH}[e.toLowerCase()];t&&(n((0,we.wu)(t)),n((0,we.F6)(dt.E[t].getRange(new Date))));break}case"custom":{const e=Date.parse(t),l=Date.parse(a);Number.isInteger(e)&&Number.isInteger(l)&&(n((0,we.wu)(Ke.j)),n((0,we.F6)({startDate:new Date(e),endDate:new Date(l)})));break}}})(h,I,C))}),n(e)}},[a,c,t,o,r]),r?n.createElement(n.Fragment,null,e):null});var wa;!function(e){e.ID="id",e.SECTION="section"}(wa||(wa={}));const ka=e=>{const t=(0,u.useDispatch)(),a=(0,u.useSelector)(Zt.YQ);return(0,n.useEffect)(()=>{const n=a.map(e=>({[wa.ID]:e[Qt.rR.PATH],[wa.SECTION]:Jt(e)})).find(t=>t[wa.SECTION]===e.section);t(n?(0,we.pi)(n[wa.ID]):(0,we.pi)(void 0))},[e.section,t,a]),null},Ua=({match:{path:e,params:t}})=>{ba();const a=(0,p.A)(M.Z.SYSLOG);return ka(t),(0,E.A)([(0,_.D)(O.Xj.AFC_CAPABLE_AP_ADOPTED),(0,_.D)(O.Xj.LTE_BACKUP_ADOPTED),(0,_.D)(O.Xj.MISSION_CRITICAL_ADOPTED),(0,_.D)(O.Xj.UPS_ADOPTED),(0,_.D)(O.Xj.MOBILE_BROADBAND_ADOPTED),(0,D.m)(void 0,{crudCacheStrategy:{type:N.e.CACHE}}),(0,C.X)(void 0,{crudCacheStrategy:{type:N.e.CACHE}}),(0,o.Zi)(s.B.LOGS),(0,o.Zi)(s.B.LOG_EVENTS),(0,o.Zi)(s.B.LOG_MESSAGES),(0,o.Zi)(s.B.SYSTEM_LOG_ACTION),(0,o.Zi)(s.B.LOG_SECTION),(0,o.Zi)(s.B.ADMIN_CHANGES),(0,o.Zi)(s.B.SYSTEM_LOG)],n.createElement(Fa,null,n.createElement(i.A,{leftFilterPageId:t.section!==d.x.SETTINGS?c.g1.LOGS:void 0,content:n.createElement(Ma,null)},n.createElement(Ra.U,null,n.createElement(n.Suspense,{fallback:null},n.createElement(l.dO,null,n.createElement(r.F,{path:I[d.x.MAIN],render:e=>n.createElement(T,{id:d.x.MAIN,...e})}),n.createElement(r.F,{path:I[d.x.SETTINGS],render:e=>n.createElement(T,{id:d.x.SETTINGS,...e})}),a,n.createElement(r.F,{exact:!0,path:h.Si[S.VO.SYSLOG]},n.createElement(l.rd,{to:(0,l.tW)(e,{...t,section:d.x.MAIN})}))))))),{trackingName:S.VO.SYSLOG})}},775586:(e,t,a)=>{a.d(t,{A:()=>r});var n=a(956347),l=a(296540);const r=()=>{const e=(0,n.zy)(),[t,a]=(0,l.useState)(e.search),[r,s]=(0,l.useState)(e.pathname),c=(0,l.useCallback)(e=>{const{search:t,pathname:n}=e.target.location;a(t),s(n)},[]);return(0,l.useEffect)(()=>(window.addEventListener("replacestate",c),()=>{window.removeEventListener("replacestate",c)})),{search:t,pathname:r}}}}]);