"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[25901],{57867:(e,t,a)=>{a.d(t,{A:()=>n});var i=a(165126),o=a(512759),r=a(449256),m=a(706574);const n=()=>(e,t)=>{e((0,m.nd)((0,i.A)((0,o.rQ)(t()),r.jI)))}},82226:(e,t,a)=>{a.d(t,{p:()=>m});var i=a(691189),o=a(269828),r=a(176556);const m=(e={},t={})=>(0,i.t9)(r.A2,`${r.gI.replace(":mac:",t.queryParams.mac)}`,{...t,queryParams:{mac:t.queryParams.mac,separateConnectionSignalParam:t.queryParams.separateConnectionSignalParam,limit:t.queryParams.limit,scope:t.queryParams.scope}},{idField:r.RR,compareFunction:o.G,...e})},161235:(e,t,a)=>{a.d(t,{A2:()=>i,HF:()=>m,RR:()=>r,gI:()=>o});const i="deviceLogs",o="/v2/api/site/{site}/system-log/device/:mac:",r="timestamp",m=6},176556:(e,t,a)=>{a.d(t,{A2:()=>i,HF:()=>m,RR:()=>r,gI:()=>o});const i="apLogs",o="/v2/api/site/{site}/system-log/client-connection/:mac:",r="timestamp",m=6},269828:(e,t,a)=>{a.d(t,{G:()=>i});const i=({queryParams:{mac:e,limit:t,separateConnectionSignalParam:a,scope:i}},{queryParams:{mac:o,limit:r,separateConnectionSignalParam:m,scope:n}})=>e===o&&t===r&&a===m&&i===n},296968:(e,t,a)=>{var i;a.d(t,{x:()=>i}),function(e){e.MAIN="main",e.SETTINGS="settings"}(i||(i={}))},479546:(e,t,a)=>{a.d(t,{SY:()=>m,ZJ:()=>n,aW:()=>r});var i=a(71479),o=a(294303);const r=(0,i.A)(o.A)`
  > div {
    width: inherit;
    flex: inherit;
  }
`,m=(0,i.A)(o.A)`
  width: 12px;
  border-bottom: 2px solid
    ${({theme:{motifPalette:{uBlue06:e}}})=>e};
`,n=(0,i.A)(o.A)`
  width: 12px;
  border-bottom: 2px solid
    ${({theme:{motifPalette:{purple06:e}}})=>e};
`},500235:(e,t,a)=>{a.d(t,{p:()=>s});var i=a(801081),o=a(25553),r=a(87485),m=a(269828),n=a(176556);const s=e=>(0,i.Mz)((e=>({models:t})=>(0,o.JC)(n.A2,t,{queryParams:e},{idField:n.RR,compareFunction:m.G}))(e),r.kh)},525901:(e,t,a)=>{a.d(t,{A:()=>ee});var i,o,r=a(296540),m=a(469733),n=a(818749),s=a(101617),c=a(979106),l=a(758649),d=a(217439),A=a(162420),u=a(998837),p=a(592510),E=a(523275),M=a(640488),T=a(566723),I=a(86571),P=a(646058),C=a(294303),O=a(689965),S=a(699784),_=a(690033),g=a(706574),y=a(801081),h=a(25553),N=a(87485);!function(e){e.TIMESTAMP_FROM="timestampFrom",e.TIMESTAMP_TO="timestampTo",e.MAC="mac",e.PORT_IDX="port_idx",e.LIMIT="limit"}(i||(i={})),function(e){e.PAGE_NUMBER="pageNumber",e.PAGE_SIZE="pageSize"}(o||(o={}));const v=({data:e},{data:t})=>e[i.MAC]===t[i.MAC]&&e[i.PORT_IDX]===t[i.PORT_IDX]&&e[i.LIMIT]===t[i.LIMIT]&&e[i.TIMESTAMP_FROM]===t[i.TIMESTAMP_FROM]&&e[i.TIMESTAMP_TO]===t[i.TIMESTAMP_TO],R="portLogs",b={_id:"",key:"",message:"",timestamp:0,user:{_id:"",ip:"",name:""},isPlaceholder:!0},L=e=>e.models[R]||{},F=e=>(0,y.Mz)((({mac:e,port_idx:t,limit:a,timestampFrom:o,timestampTo:r})=>(0,y.Mz)(L,m=>(0,h.Al)(m,{data:{[i.MAC]:e,[i.PORT_IDX]:t,[i.LIMIT]:a,...void 0!==o&&{[i.TIMESTAMP_FROM]:o},...void 0!==r&&{[i.TIMESTAMP_TO]:r}}},{compareFunction:v,placeholder:b})))(e),N.kh),f=(e,t)=>(0,y.Mz)(F({mac:e,port_idx:t,limit:6}),e=>e.slice(0,6));var D=a(717905),q=a(691189),x=a(742920);const k=()=>({icon:x.C.danger,message:"COMMON_LOG_API_ERROR"}),G={getAllPostResponse:!0};var V=a(887831);var z;!function(e){e.DEVICE="DEVICE",e.CLIENTS="CLIENTS"}(z||(z={}));const $=({queryParams:{mac:e,limit:t,scope:a}},{queryParams:{mac:i,limit:o,scope:r}})=>e===i&&t===o&&a===r;var B=a(161235);const H=e=>(0,y.Mz)((e=>({models:t})=>(0,h.JC)(B.A2,t,{queryParams:e},{idField:B.RR,compareFunction:$}))(e),N.kh),w=(e={},t={})=>(0,q.t9)(B.A2,`${B.gI.replace(":mac:",t.queryParams.mac)}`,{...t,queryParams:{mac:t.queryParams.mac,scope:t.queryParams.scope,limit:t.queryParams.limit}},{idField:B.RR,compareFunction:$,...e});var U=a(500235),X=a(176556),Z=a(82226),J=a(151033),W=a(874807),Y=a(479546),j=a(540739),Q=a(822336);const K=(0,a(71479).A)(C.A)`
  padding-bottom: ${T.kc};
  &:not(:first-child) {
    padding-top: ${T.kc};
  }
  border-bottom: ${({theme:{themeName:e}})=>Q.Ay[`desktop-border-divider-${e}`]};
`,ee=(0,r.memo)(({mac:e,model:t,logType:a,label:y,ignoreActionableValues:h=[],hideClientTabs:N,portIdx:b,cache:L=!0})=>{const{motifPalette:{uBlue02:F}}=(0,u.u)(),x=(0,m.useDispatch)(),[$,Q]=(0,r.useState)(z.DEVICE),ee=(0,M.A)(),{action:te,queryParams:ae,logSelector:ie,emptyMessageId:oe,onSeeAll:re}=(0,r.useMemo)(()=>{switch(a){case j.F.DEVICE:{const t={mac:e,limit:B.HF,scope:$};return{action:w,queryParams:t,logSelector:H(t),emptyMessageId:"COMMON_NO_LOGS_DEVICE",onSeeAll:()=>{ee(()=>{x((0,g.vI)([e]))})}}}case j.F.CLIENT:{const t={mac:e,limit:X.HF,separateConnectionSignalParam:!1,scope:void 0};return{action:Z.p,queryParams:t,logSelector:(0,U.p)(t),emptyMessageId:"COMMON_NO_LOGS_CLIENTS",onSeeAll:()=>{ee(()=>{x((0,g.Sy)([e])),x((0,g.A$)([J.nh.CLIENT_DEVICES]))})}}}case j.F.PORT:return{action:(t,a)=>((e,t={},a={})=>(0,q.sU)(R,"/v2/api/site/{site}/ports/system-logs",{data:{[i.MAC]:e[i.MAC],[i.PORT_IDX]:e[i.PORT_IDX],[i.LIMIT]:e[i.LIMIT]||6,...void 0!==e[i.TIMESTAMP_FROM]&&{[i.TIMESTAMP_FROM]:e[i.TIMESTAMP_FROM]},...void 0!==e[i.TIMESTAMP_TO]&&{[i.TIMESTAMP_TO]:e[i.TIMESTAMP_TO]},[o.PAGE_SIZE]:e[o.PAGE_SIZE]||10,[o.PAGE_NUMBER]:e[o.PAGE_NUMBER]||0},...t},{method:V.A.POST,idField:"id",fetchConfig:G,additionalPayloadSelectors:{[D.bI.PAGE_NUMBER]:{},[D.bI.TOTAL_PAGE_COUNT]:{},[D.bI.TOTAL_ELEMENT_COUNT]:{}},failureToast:k,compareFunction:v,...a}))({mac:e,port_idx:Number(b),limit:6},a,t),queryParams:{mac:e,port_idx:b},logSelector:f(e,b),emptyMessageId:"COMMON_NO_LOGS_PORT",onSeeAll:()=>{ee(()=>{x((0,g.vI)([e]))})}};default:return{action:E.A,queryParams:(0,E.A)(),logSelector:(0,E.A)(),emptyMessageId:"COMMON_FALLBACK",onSeeAll:W.P1}}},[e,a,$,b,x,ee]),me=(0,r.useCallback)(({id:e})=>{Q(e)},[]),ne=(0,m.useSelector)(ie),{deviceHasAccessPointCapability:se,deviceHasPoeCapability:ce}=(0,r.useMemo)(()=>{const{deviceCapabilities:e=[],features:{poe:a}={poe:!1}}=s[t]||{};return{deviceHasAccessPointCapability:e.includes(n.DeviceCapability.ACCESS_POINT),deviceHasPoeCapability:a||!1}},[t]),le=(0,r.useMemo)(()=>[{id:z.DEVICE,label:r.createElement(S.sA,{id:"COMMON_DEVICE"})},...a!==j.F.DEVICE||N||!se&&!ce?[]:[{id:z.CLIENTS,label:r.createElement(S.sA,{id:"COMMON_CLIENTS"})}]],[N,a,se,ce]),de=(0,r.useMemo)(()=>[{id:"Logs",label:r.createElement(I.A,{id:y}),openByDefault:!0,renderContent:()=>r.createElement(C.A,{flexDirection:"column"},le.length>1?r.createElement(Y.aW,{marginBottom:T.Ln},r.createElement(c.A,{variant:"filter",tabs:le,onSelectTab:me})):null,ne.length>0?r.createElement(C.A,{flexDirection:"column",minHeight:78},ne.map(e=>r.createElement(K,{key:e.id,flexDirection:"column",gap:T.YC},r.createElement(_.A.Actionable,{log:e,ignoreActionableValues:h}),r.createElement(P.A,{timestamp:e.timestamp}))),r.createElement(C.A,{alignItems:"baseline",paddingTop:T.kc,marginTop:"auto"},r.createElement(d.A,{size:"medium",color:"text-3"},r.createElement(S.sA,{id:"COMMON_TABLE_FOOTER",values:{length:ne.length}}))," ",r.createElement(l.A,{type:"button",variant:"inline",onClick:re},r.createElement(d.A,{size:"medium",color:"inherit"},r.createElement(S.sA,{id:"COMMON_SEE_ALL"}))))):r.createElement(C.A,{gap:10,justifyContent:"center",alignItems:"center",minHeight:78},r.createElement(A.A,{color:F,variant:"fill"}),r.createElement(d.A,{size:"medium",color:"text-2"},r.createElement(S.sA,{id:oe}))))}],[y,me,ne,re,h,F,le,oe]);return(0,r.useEffect)(()=>{x(te(L?{crudCacheStrategy:{type:p.e.CACHE}}:{},{queryParams:ae}))},[x,te,ae,a,e,b,L]),r.createElement(O.A,{type:O.I.ACCORDION,items:de})})},540739:(e,t,a)=>{var i;a.d(t,{F:()=>i}),function(e){e.DEVICE="DEVICE",e.CLIENT="CLIENT",e.PORT="PORT"}(i||(i={}))},640488:(e,t,a)=>{a.d(t,{A:()=>A});var i=a(956347),o=a(469733),r=a(296540),m=a(15095),n=a(296968),s=a(627440),c=a(449256),l=a(706574),d=a(57867);const A=()=>{const e=(0,o.useDispatch)(),t=(0,i.W6)(),a=(0,m.A)(`${s.VO.SYSLOG}/${n.x.MAIN}`);return(0,r.useCallback)(i=>{(0,o.batch)(()=>{e((0,d.A)()),e((0,l.ov)(!0)),e((0,l.oz)(c.fN)),i?.(e)}),t.push(a)},[e,t,a])}},646058:(e,t,a)=>{a.d(t,{A:()=>l});var i=a(296540),o=a(217439),r=a(469733),m=a(699784),n=a(602021),s=a(198494),c=a(282556);const l=(0,i.memo)(({timestamp:e})=>{const{formatMessage:t}=(0,m.tz)(),a=(0,r.useSelector)(s.BQ),l=(0,r.useSelector)(n.hq),d=(0,r.useSelector)(c.zi);return i.createElement(o.A,{size:"small",color:"text-3"},new Intl.DateTimeFormat(d,{month:"short",day:"numeric",hour:"numeric",minute:"numeric",hourCycle:a,timeZone:l}).format(e).replace(",",` ${t({id:"COMMON_AT"}).toLowerCase()}`))})}}]);