"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[49005],{949655(e,t,n){n.r(t),n.d(t,{default:()=>Di});var r=n(296540),a=n(71479),o=n(592510),l=n(834959),i=n(604482),s=n(413357),c=n(422969),m=n(566723),u=n(860923),d=n(105540),E=n(294303),h=n(627440),p=n(540883),A=n(745667),_=n(274174),C=n(457311),g=n(96121),f=n(920377),S=n(634229),T=n(37e3),N=n(551698),O=n(896291),v=n(171073),I=n(984652),D=n(766254),M=n(469733),b=n(935780),P=n(200619),x=n(840279),y=n(212178),L=n(431247),w=n(286818),R=n(497470),k=n(749177),$=n(822336),F=n(217439),U=n(823858),W=n(368928),V=n(89603),H=n(382389),z=n(968906),G=n(366702),B=n(311785),Y=n(855019),K=n(142207),j=n(845030),q=n(916537),X=n(804396),Q=n(889256),J=n(572112),Z=n(398300),ee=n(75346);const te=(0,a.A)(E.A,(0,B.A)("isVisible"))`
  background-color: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-01-${e}`]};
  gap: ${m.kc};
  padding: 6px ${m.kc};
  display: ${({isVisible:e})=>e?"flex":"none"};
`,ne=(0,a.A)(E.A,(0,B.A)("elementWidth"))`
  position: absolute;
  border-radius: ${m.YC};
  width: fit-content;
  max-width: ${325}px;
  top: 0;
  max-height: ${320}px;
  overflow-y: auto;
  background-color: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-01-${e}`]};
  box-shadow: ${({theme:{themeName:e}})=>$.Ay[`desktop-shadow-low-${e}`]};
  z-index: 1;

  /* 
  Horizontal placement of this element is done through "right" property.
  1. Move element to middle of the page.
  2. Subtract half of the element width to center it.
  3. SPACE_16 is an extra constant to align with the page tabs.
  4. There is a constant relevant to scrollbar width - we dont want the element to jump left and right when scrollbar appears. This compentates the element& scrollbar widths movements.
  */
  right: ${({elementWidth:e,isOverflowing:t})=>`calc(50% + ${m.Ln} - ${e/2}px - ${t?16:0}px)`};
  @media ${J.A.VIEWPORT_M_DOWN} {
    right: 0;
  }

  opacity: ${({elementWidth:e})=>e>0?1:0};
`,re=(0,a.A)(E.A)`
  flex-direction: column;
  width: 100%;
`,ae=()=>r.createElement(U.A,{variant:"fill",size:"original",color:$.Ay[`desktop-color-red-06-${(0,H.u)().themeName}`]}),oe=()=>r.createElement(U.A,{variant:"fill",size:"original",color:$.Ay[`desktop-color-orange-06-${(0,H.u)().themeName}`]}),le=({issue:e,onClick:t})=>r.createElement(r.Fragment,null,r.createElement(Q.g[e.anomaly]===X.Q.CRITICAL?ae:oe,null),r.createElement(F.A,{size:"medium",color:"text-2",style:{cursor:t?"pointer":"default"},onClick:t?()=>t(e.port_idx):void 0,...z.A.addDataTestId(z.A.TestId.SIDE_PANEL_TRIGGER)},r.createElement(q.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e.port_idx}}),": ",r.createElement(q.sA,{id:K.l3[e.anomaly]}))),ie=({deviceIssues:e,isExpanded:t,setIsExpanded:n,onPortClick:a})=>{const o=e.some(e=>Q.g[e.anomaly]===X.Q.CRITICAL);return r.createElement(re,null,r.createElement(te,{cursor:"pointer",onClick:()=>{n(!t)},isVisible:!0},r.createElement(o?ae:oe,null),r.createElement(F.A,{size:"medium",color:"text-2"},r.createElement(q.sA,{id:"DEVICE_PORT_STATE_ISSUES_TITLE"})),r.createElement(t?W.A:V.A,{size:"original"})),t?e.map(e=>r.createElement(te,{key:e.port_idx+e.anomaly,isVisible:t},r.createElement(le,{issue:e,onClick:a}))):null)},se=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.I_),n=(0,M.useSelector)(w.tI),a=(0,r.useRef)(null),{width:o}=(0,G.Ay)(a.current),[l,i]=(0,r.useState)(!1),s=t=>{if(!n)return;const r=(0,L.FS)(n,t);e((0,R.Ao)([r])),e((0,j.XP)({type:Z.H.PORTS,id:ee.PANEL_PORTS_SIDE_PANEL_ID,tab:Y.BC.INSIGHTS,onClose:()=>e((0,R.Ao)([])),preventReopen:!0}))};return t.length?r.createElement(ne,{elementWidth:o,ref:a,isOverflowing:l&&t.length+1>10},1===t.length?r.createElement(te,{isVisible:!0},r.createElement(le,{issue:t[0],onClick:s})):r.createElement(ie,{deviceIssues:t,isExpanded:l,setIsExpanded:i,onPortClick:s})):null},ce=()=>{const e=(0,k.A)(i.g1.PORT_MANAGEMENT);return r.createElement(E.A,{alignItems:"start",minHeight:30,marginTop:2,marginBottom:2,position:"relative",paddingLeft:e?0:m.kc},r.createElement(se,null))};var me=n(271856),ue=n(705145),de=n(162420),Ee=n(6510);const he=(0,r.createContext)(null),pe=({children:e})=>{const[t,n]=(0,r.useState)(1),[a,o]=(0,r.useState)(0),l=(0,r.useRef)(1),i=(0,r.useRef)(0),s=(0,r.useMemo)(()=>({sharedScale:t,sharedOffset:a,setSharedScale:n,setSharedOffset:o,cachedScaleRef:l,cachedOffsetRef:i}),[t,a]);return r.createElement(he.Provider,{value:s},e)},Ae=()=>{const e=(0,r.useContext)(he);if(!e)throw new Error("useDiagramScaleContext must be used within DiagramScaleProvider");return e};var _e=n(962669),Ce=n(237628),ge=n(532419),fe=n(330620),Se=n(490551),Te=n(435325),Ne=n(951106),Oe=n(975397),ve=n(506327),Ie=n(825032),De=n(605066),Me=n(697490);const be=(0,a.A)(E.A,(0,B.A)("hide"))`
  align-items: center;
  justify-content: center;
  width: ${K.Dq}px;
  height: ${K.Dq}px;
  border-radius: ${m.YC};
  padding: ${m.YC};
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-01-${e}`]};
  cursor: pointer;
  position: relative;
  ${(0,Oe.g)(K.Dq)}
`,Pe=(0,a.A)(ve.A)`
  width: ${m.YC};
  height: ${m.YC};
  position: absolute;
  top: ${m.YC};
  left: ${m.YC};
`,xe=({connectedDevice:e,connectedClient:t,hide:n,wanProviderAsn:a,wanProviderName:o,onClick:l,isActive:i})=>{const{themeName:s}=(0,H.u)();return e||t||o?r.createElement(be,{hide:n,onClick:l,...z.A.addDataTestId(z.A.TestId.SIDE_PANEL_TRIGGER)},i?null:r.createElement(Pe,{color:s===Ie.S.DARK?$.Ay[`desktop-color-neutral-04-${s}`]:$.Ay[`desktop-color-neutral-08-${s}`]}),r.createElement(E.A,{opacity:i?void 0:De.q},r.createElement(Me.A,{size:32,connectedClient:t,connectedDevice:e,wanProviderAsn:a,wanProviderName:o}))):null};var ye=n(17437),Le=n(939703),we=n(548212),Re=n(691108),ke=n(213601),$e=n(966784);const Fe=(0,we.xn)(10),Ue=(0,a.A)(E.A,(0,B.A)("color","isDisabled","isLocating","disableSelectionEvents"))`
  align-items: center;
  color: ${({theme:{themeName:e},color:t})=>$.Ay[`desktop-color-${t}-${e}`]};
  justify-content: center;
  position: relative;
  pointer-events: auto;
  border-radius: ${$.Ay["desktop-radius-base"]};
  cursor: ${({disableSelectionEvents:e})=>e?"default":"pointer"};
  ${({isDisabled:e})=>e?"\n    pointer-events: none;\n    opacity: 0.4;\n  ":""}
  ${({isLocating:e})=>e?ye.AH`
          animation: ${Fe} 1s cubic-bezier(0.5, 1, 0, 1) infinite alternate;
        `:""}
`,We=(0,a.A)("div",(0,B.A)("stacked"))`
  position: relative;
  width: ${K.Dq}px;
  height: ${K.Dq}px;
`,Ve={0:{top:0,left:0,topSelected:0,leftSelected:0,topHovered:0,leftHovered:0,height:K.Dq,width:K.Dq,heightSelected:K.Dq,widthSelected:K.Dq,heightHovered:K.Dq,widthHovered:K.Dq},1:{top:-1.75,left:3,topSelected:-6,leftSelected:3.22,topHovered:-2.75,leftHovered:4,height:37,width:37,heightSelected:40,widthSelected:41,heightHovered:37,widthHovered:37},2:{top:-3.75,left:8,topSelected:-9,leftSelected:7.22,topHovered:-5.75,leftHovered:10,height:36,width:34,heightSelected:40,widthSelected:40,heightHovered:36,widthHovered:34}},He=(0,a.A)("div",(0,B.A)("background","border","order","isSelected","isHovered","isStacked"))`
  position: absolute;
  transform: translate(
    ${({order:e,isSelected:t,isHovered:n})=>Ve[e][t?"leftSelected":n?"leftHovered":"left"]}px,
    ${({order:e,isSelected:t,isHovered:n})=>Ve[e][t?"topSelected":n?"topHovered":"top"]}px
  );

  width: ${({order:e,isSelected:t,isHovered:n})=>Ve[e][t?"widthSelected":n?"widthHovered":"width"]}px;
  height: ${({order:e,isSelected:t,isHovered:n})=>Ve[e][t?"heightSelected":n?"heightHovered":"height"]}px;

  border: ${({order:e})=>0!==e?"none":"1px solid"} ${({border:e})=>e};
  border-radius: ${m.YC};
  background: ${({background:e})=>e};
  z-index: ${({order:e})=>3-e};
  transition:
    all 0.2s ease-out,
    outline 0s,
    outline-offset 0s;

  filter: ${({isHovered:e,order:t})=>e&&0===t?"brightness(0.9)":"none"};
  ${({isSelected:e,order:t,theme:{themeName:n}})=>e&&0===t?`\n      outline: 2px solid ${$.Ay[`desktop-color-ublue-06-${n}`]}; \n      outline-offset: 1px;\n      `:""}
`,ze=(0,a.A)("div")`
  position: absolute;
  right: 2px;
  top: 2px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: ${4};
`,Ge=(0,a.A)(F.A)`
  position: absolute;
  text-align: left;
  bottom: 0px;
  left: 4px;
  pointer-events: none;
  z-index: 4;
`,Be=(0,a.A)("div")`
  position: absolute;
  width: ${2*K.Dq+16}px;
  height: ${K.Dq+8}px;
  top: -${m.YC};
  left: -${m.YC};
  z-index: -1;
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-ublue-01-${e}`]};
  border-radius: ${m.kc};
  border: 1px solid ${({theme:{themeName:e}})=>$.Ay[`desktop-color-ublue-04-${e}`]};
`,Ye=(0,r.memo)(({port:e,isFirstPortInMcLagLinks:t,isFirstPortWan:n,isFirstPortManagement:a,isFirstRow:o})=>{const l=(0,M.useDispatch)(),i=(0,M.useSelector)(w.x$),s=(0,M.useSelector)(w.UH),c=(0,M.useSelector)(w.O2),m=(0,M.useSelector)(w.pN),u=(0,M.useSelector)(w.XS),[d,E]=(0,r.useState)(!1),h=(0,M.useSelector)(w.QR),p=u,A=(0,M.useSelector)((0,r.useMemo)(()=>(0,w.JX)(e.port_idx||0,e.device.mac),[e.port_idx,e.device.mac])),{background:_,border:C,text:g,stackBackground:f=_,stackBackgroundDark:S=_}=(0,r.useMemo)(()=>(0,we.PI)(e),[e]),T=Boolean(e.isInTargetDevice||e.isInMcLink),N=u?Boolean(e.port_idx&&m.includes(e.port_idx)):Boolean(e.port_idx&&c.has((0,L.FS)(e.device.mac,e.port_idx))),O=!(0,Oe.s)(e,s,n,a,N,t,T,h,u,m),v=(0,r.useCallback)(t=>{if(t.stopPropagation(),!p&&!O&&e.port_idx){const n=(0,L.FS)(e.device.mac,e.port_idx);l((0,R.Ao)(t.metaKey||t.ctrlKey?(0,$e.QP)(n,s):(0,$e.Um)(n)))}},[l,p,O,e.device.mac,e.port_idx,s]),I=Boolean(e.aggregationGroup||e.lag_idx),D=d||Boolean(e.lag_idx)&&e.lag_idx===i,b=(0,r.useCallback)(()=>{p||(e.lag_idx&&l((0,R.L$)(e.lag_idx)),E(!0))},[l,p,e.lag_idx]),P=(0,r.useCallback)(()=>{p||(l((0,R.L$)(null)),E(!1))},[l,p]),x=(0,H.u)(),{card1Background:y,card2Background:k}=(0,r.useMemo)(()=>{const e=(0,Le.YR)((0,Le.wQ)((0,$e.oX)(_,x.themeName)),(0,Le.wQ)((0,$e.oX)("dark"===x.themeName?S:f,x.themeName)),50),t=(0,Le.YR)((0,Le.wQ)((0,$e.oX)(_,x.themeName)),(0,Le.wQ)((0,$e.oX)("dark"===x.themeName?S:f,x.themeName)),100);return{card1Background:(0,Le.qi)(e),card2Background:(0,Le.qi)(t)}},[_,f,S,x.themeName]);return r.createElement(Re.A,{port:e,position:o?"top":"bottom"},r.createElement(Ue,{onClick:v,color:g,isDisabled:O,isLocating:A,disableSelectionEvents:p,onMouseEnter:b,onMouseLeave:P},r.createElement(We,{stacked:I},r.createElement(He,{order:0,background:(0,$e.oX)(_,x.themeName),border:(0,$e.oX)(C,x.themeName),isSelected:N,isHovered:D}),I?r.createElement(r.Fragment,null,r.createElement(He,{order:1,background:y,border:(0,$e.oX)(C,x.themeName),isSelected:N,isHovered:D}),r.createElement(He,{order:2,background:k,border:(0,$e.oX)(C,x.themeName),isSelected:N,isHovered:D})):null),r.createElement(ze,null,r.createElement(ke.A,{icon:e.icon})),r.createElement(Ge,{size:"small",color:"inherit"},(0,_e.LS)(e,e.device?.model)),(0,L.s_)(e.port_idx,e.device?.model)?r.createElement(Be,null):null))}),Ke=(0,a.A)(E.A,(0,B.A)("hide"))`
  ${(0,Oe.g)(20)};
`,je=({poe_enable:e,poe_power:t,hide:n})=>{const a=(0,_e.lG)({poe_enable:e,poe_power:t});return a?r.createElement(Ke,{hide:n},r.createElement(F.A,{color:"text-3",size:"xsmall"},a)):null},qe=(0,a.A)(ue.A)`
  text-align: center;
  cursor: pointer;
  max-width: ${K.Dq}px;
`,Xe=(0,a.A)(E.A,(0,B.A)("hide","isActive"))`
  ${(0,Oe.g)(20)};
  cursor: pointer;
  max-width: ${K.Dq}px;
  opacity: ${({isActive:e})=>e?1:De.q};
`,Qe=({onClick:e,hide:t,label:n,isActive:a})=>r.createElement(Xe,{hide:t,onClick:e,isActive:a,...z.A.addDataTestId(z.A.TestId.SIDE_PANEL_TRIGGER)},r.createElement(qe,{isTruncated:!0,size:"xsmall",weight:"bold",color:"text-2"},n)),Je=(0,a.A)(E.A,(0,B.A)("isFirstRow","disableGap"))`
  flex-direction: ${({isFirstRow:e})=>e?"column-reverse":"column"};
  justify-content: flex-start;
  align-items: center;
  gap: ${({disableGap:e})=>e?0:m.YC};
  position: relative;
  max-width: ${K.Dq}px;
`,Ze=(0,a.A)(E.A,(0,B.A)("hide","isActive"))`
  width: 1px;
  height: ${8}px;
  opacity: ${({isActive:e})=>e?1:0};
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-04-${e}`]};
  ${(0,Oe.g)(8)}
`,et=(0,a.A)("div",(0,B.A)("isPoeCapable"))`
  height: ${({isPoeCapable:e})=>{const t=12+K.Dq+4+14;return e?t+4+14:t}}px;
`,tt=(0,r.memo)(({isFirstRow:e,port:t,hideOptionalElements:n,topConnectionMac:a,setTopConnectionMac:o,topConnectionMacWithPoe:l,setTopConnectionMacWithPoe:i,isFirstSelectedPortWan:s,isFirstSelectedPortManagement:c,isFirstSelectedPortInMcLag:m})=>{const u=(0,M.useDispatch)(),{wanConfiguration:d,wanProviderAsn:h,wanProviderName:p,lastConnectionClient:A,lastConnectionDevice:_,lastConnectionIsp:C,lastConnectionMac:g,isSomethingConnected:f,wasSomethingConnected:S}=(0,fe.A)(t),T=p?{name:p,asn:h}:C?{name:C.isp_name,asn:C.isp_asn}:void 0,N=(0,r.useMemo)(()=>g?(0,Te.r)(g):()=>{},[g]),O=(0,M.useSelector)(N),v=(0,M.useSelector)(w.Hz),D=(0,r.useMemo)(()=>d?Z.H.ISP_DETAILS:_?Z.H.DEVICE:O?Z.H.UNIFI_DEVICE_CLIENT:A?Z.H.CLIENT:void 0,[_,A,O,d]),b=(0,r.useCallback)(e=>{e.stopPropagation();const t=d?.configuration?.wan_networkgroup||g;t&&(A&&D===Z.H.CLIENT&&u((0,I.W6)(t,!0)),u((0,j.XP)({type:D,id:t})))},[u,A,g,D,d?.configuration?.wan_networkgroup]),P=T?.name||(0,Ee.Q)(_)||(0,Ne.tn)(A),x=f?void 0:A?.last_seen||_?.last_seen||C?.last_seen,y=!e,L=x?"text-3":"text-2",R=Boolean((0,_e.lG)({poe_enable:t.poe_enable,poe_power:t.poe_power})),k=Boolean(t.port_poe);return(0,r.useEffect)(()=>{e&&(f||S||v)&&(a!==t.device.mac&&o(t.device.mac),l!==t.device.mac&&(R||v&&k)&&i(t.device.mac))},[t.device.mac,a,o,l,i,f,S,e,R,v,k]),r.createElement(Je,{isFirstRow:e,disableGap:n},r.createElement(E.A,null,r.createElement(Ye,{port:t,isFirstPortInMcLagLinks:m,isFirstPortWan:s,isFirstPortManagement:c,isFirstRow:e})),f||S?r.createElement(Se.A,{label:P,lastSeen:x,isUpsideDown:y,isTooltipAllowed:Boolean(P)},r.createElement(Je,{isFirstRow:e,disableGap:n},r.createElement(Ze,{hide:n,isActive:f}),r.createElement(xe,{connectedDevice:_,connectedClient:A,wanProviderAsn:T?.asn,wanProviderName:T?.name,hide:n,onClick:b,isActive:f}),r.createElement(Qe,{label:P,onClick:b,hide:n,textColor:L,isActive:f}),r.createElement(je,{poe_enable:t.poe_enable,poe_power:t.poe_power,hide:n}))):v&&!n?r.createElement(et,{isPoeCapable:k}):null)}),nt=(0,a.A)(E.A)`
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: ${m.kc};
`,rt=(0,a.A)(E.A)`
  gap: ${m.kc};
`,at=(0,a.A)("div")`
  width: ${38}px;
`,ot=(0,a.A)(E.A,(0,B.A)("scale"))`
  transform: scale(${({scale:e})=>e});
  justify-content: center;
  align-self: center;
`,lt=(0,a.A)(E.A)`
  flex-direction: column;
  gap: ${m.kc};
`,it=(0,a.A)(E.A)`
  min-height: 32px;
`,st=(0,a.A)(E.A)`
  gap: ${m.YC};
  align-items: center;
`;var ct=n(340936),mt=n(960407),ut=n(198494);const dt=({children:e,scale:t,spaceOffset:n})=>r.createElement("div",{style:{marginRight:n,transitionDuration:"0.2s",alignItems:"center"}},r.createElement(E.A,{gap:m.kc,flexDirection:"column",overflow:"visible"},r.createElement(ot,{scale:t},e))),Et=({children:e,cachedScaleRef:t,cachedOffsetRef:n,onScaleOffsetChange:a})=>{const{spaceOffset:o,containerRef:l,contentRef:i,scale:s}=((e,t)=>{const n=(0,r.useRef)(null),a=(0,r.useRef)(null),o=Boolean(n.current)&&Boolean(a.current),{width:l=0}=(0,ct.A)({ref:a}),{width:i=0}=(0,ct.A)({ref:n}),[s,c]=(0,r.useState)(t.current),m=(0,r.useRef)(0),u=(0,r.useRef)(0),d=l>0&&i>0?Math.min((l-16)/i,1):e.current,E=(0,M.useSelector)(w.UH),h=(0,M.useSelector)(mt.WS),p=Boolean(E.length)||h,A=(0,M.useSelector)(w.QR),_=(0,M.useSelector)(w.kq),C=(0,M.useSelector)(ut.P),g=(0,M.useSelector)(mt.S5),f=416+(C&&g.length>1&&h?40:0);return(0,r.useEffect)(()=>{l>0&&i>0&&(e.current=d)},[d,l,i,e]),(0,r.useEffect)(()=>{if(!p||A)return m.current=0,c(0),u.current=0,void(t.current=0);const e=e=>{m.current=e,t.current=e,c(e)};requestAnimationFrame(()=>{const t=n.current?.getBoundingClientRect(),r=a.current?.getBoundingClientRect();if(!t||!r)return;const o=m.current,l=u.current,i=f-l;if(l>0&&0!==i)return e(Math.max(0,o+i)),void(u.current=f);const s=window.innerWidth-t.right+o,c=window.innerWidth-r.right,d=f-s;if(d>0){const t=Math.min(d,s-c);e(d-t+2*t)}else e(0);u.current=f})},[p,A,o,_,f,t]),{spaceOffset:s,scale:d,containerRef:a,contentRef:n}})(t,n);return(0,r.useEffect)(()=>{a?.(s,o)},[s,o,a]),r.createElement("div",{ref:l,style:{marginRight:o,transitionDuration:"0.2s",alignItems:"center"}},r.createElement(E.A,{gap:m.kc,flexDirection:"column",overflow:"visible"},r.createElement(ot,{scale:s,ref:i},e)))},ht=(0,a.A)(E.A)`
  flex-direction: column;
  justify-content: start;
  gap: ${m.kc};
`,pt=(0,a.A)(E.A)`
  gap: ${m.kc};
`,At=(0,a.A)("div")`
  width: ${K.Dq}px;
`,_t=(0,a.A)(E.A,(0,B.A)("isDiagramTopRowExpanded","hasPoeLabel"))`
  align-items: start;
  position: relative;
  min-width: ${m.xO};
  padding-top: ${({isDiagramTopRowExpanded:e,hasPoeLabel:t})=>(e?100:40)+(t?24:0)}px;
`,Ct=(0,a.A)(ue.A)`
  transform: rotate(-90deg) translate(-50%, 0);
  transform-origin: left center;
  position: absolute;
  left: 0;
  width: max-content;
  && {
    max-width: 95px;
  }
`,gt=(0,r.memo)(({deviceMac:e,isFirst:t,showDeviceName:n})=>{const a=(0,M.useSelector)(ge.Kh).get(e),{sharedScale:o,sharedOffset:l,setSharedScale:i,setSharedOffset:s,cachedScaleRef:c,cachedOffsetRef:u}=Ae(),d=(0,M.useSelector)(w.OF),h=(0,r.useMemo)(()=>d.filter(t=>t.device.mac===e),[d,e]),p=(0,M.useSelector)(w.Hd),A=(0,M.useSelector)(w.pZ),_=(0,M.useSelector)(w.IP),C=(0,M.useSelector)(w.uq),[g,f]=(0,r.useState)(""),[S,T]=(0,r.useState)(""),N=(0,r.useMemo)(()=>{if(!a?.model)return!1;const{diagram:e}=(0,Ce.j)(a.model);return!!e},[a?.model]),O=(0,r.useMemo)(()=>{if(!a?.model)return(0,x.A)();const{diagram:e}=(0,Ce.j)(a.model);if(!e)return(0,x.A)();const t=e.length?(0,_e.sT)(e,a):(0,_e.oJ)(a);if(!t)return(0,x.A)();const n=new Map(h.map(e=>[e.port_idx,e]));return t.map((e,t)=>r.createElement(pt,{key:`PortDiagramLayoutRow-${t+1}`},e.map((e,a)=>{const o=`PortDiagramLayoutCell-${t+1}-${a+1}`,l=n.get(e?.portNumber);return l?r.createElement(tt,{port:l,key:o,isFirstRow:0===t,hideOptionalElements:p,setTopConnectionMac:f,topConnectionMac:g,setTopConnectionMacWithPoe:T,topConnectionMacWithPoe:S,isFirstSelectedPortWan:A,isFirstSelectedPortManagement:_,isFirstSelectedPortInMcLag:C}):r.createElement(At,{key:o})})))},[h,a,p,g,S,A,_,C]),v=(0,r.useCallback)((e,t)=>{o!==e&&i(e),l!==t&&s(t)},[o,l,i,s]);if(!N)return r.createElement(E.A,{gap:m.kc},r.createElement(de.A,{isActive:!0}),r.createElement(F.A,{size:"small"},r.createElement(q.sA,{id:"DEVICE_DIAGRAM_MISSING"})));if(0===h.length)return null;if(!O||0===O.length)return null;const I=(0,Ee.Q)({name:a?.name,model:a?.model,mac:a?.mac});return t?r.createElement(Et,{cachedScaleRef:c,cachedOffsetRef:u,onScaleOffsetChange:v},r.createElement(E.A,null,n?r.createElement(_t,{isDiagramTopRowExpanded:g===e&&!p,hasPoeLabel:S===e&&!p},r.createElement(me.A,{portal:!0,description:I,position:"top",noWrap:!0},r.createElement(Ct,{size:"small",color:"text-3",isTruncated:!0},I))):null,r.createElement(ht,null,O))):r.createElement(dt,{scale:o,spaceOffset:l},r.createElement(E.A,null,n?r.createElement(_t,{isDiagramTopRowExpanded:g===e&&!p,hasPoeLabel:S===e&&!p},r.createElement(me.A,{portal:!0,description:I,position:"top",noWrap:!0},r.createElement(Ct,{size:"small",color:"text-3",isTruncated:!0},I))):null,r.createElement(ht,null,O)))});var ft=n(132196),St=n(100946),Tt=n(309447),Nt=n(720676),Ot=n(315249),vt=n(205148),It=n(543678),Dt=n(259902),Mt=n(990262),bt=n(424226),Pt=n(618025),xt=n(907011),yt=n(844356),Lt=n(878848),wt=n(280160),Rt=n(282556),kt=n(945132);const $t=kt.jU,Ft="600 11px Inter, Lato, sans-serif",Ut={hour:"2-digit",minute:"numeric"},Wt={hour:"2-digit",minute:"2-digit",second:"2-digit"},Vt={month:"short",day:"numeric"},Ht=83.5,zt=(e,t,n,r,a,o)=>{const l=t+r,i=n+a;e.beginPath(),e.moveTo(t+o,n),e.lineTo(l-o,n),e.quadraticCurveTo(l,n,l,n+o),e.lineTo(l,i-o),e.quadraticCurveTo(l,i,l-o,i),e.lineTo(t+o,i),e.quadraticCurveTo(t,i,t,i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()},Gt=(e,t,n,r,a,o)=>{zt(e,t,n,r,a,o),e.fill()};var Bt;!function(e){e.SELECTABLE="selectable",e.NEUTRAL="neutral",e.INFO="info",e.ACTION="action",e.SUCCESS="success",e.WARNING="warning",e.ERROR="error"}(Bt||(Bt={}));const Yt={[Bt.SELECTABLE]:0,[Bt.NEUTRAL]:1,[Bt.INFO]:2,[Bt.ACTION]:3,[Bt.SUCCESS]:4,[Bt.WARNING]:5,[Bt.ERROR]:6};var Kt;!function(e){e.LOOP="loop",e.WARNING="warning",e.BLOCK="block",e.DEVICE_CONNECTED="device_connected",e.DEVICE_DISCONNECTED="device_disconnected",e.CLIENT_CONNECTED="client_connected",e.CLIENT_DISCONNECTED="client_disconnected",e.INTERNET_CONNECTED="internet_connected",e.INTERNET_DISCONNECTED="internet_disconnected",e.NETWORK_OFFLINE="network_offline",e.NETWORK_UPDATED="network_updated",e.DEVICE_OFFLINE="device_offline",e.POWER_CYCLE="power_cycle"}(Kt||(Kt={}));const jt={[Kt.LOOP]:!0,[Kt.WARNING]:!0,[Kt.BLOCK]:!1,[Kt.DEVICE_CONNECTED]:!1,[Kt.DEVICE_DISCONNECTED]:!1,[Kt.CLIENT_CONNECTED]:!1,[Kt.CLIENT_DISCONNECTED]:!1,[Kt.INTERNET_CONNECTED]:!1,[Kt.INTERNET_DISCONNECTED]:!1,[Kt.NETWORK_OFFLINE]:!0,[Kt.NETWORK_UPDATED]:!1,[Kt.DEVICE_OFFLINE]:!0,[Kt.POWER_CYCLE]:!1},qt=28*1.15,Xt=[{dx:0,heightReduction:8,widthReduction:1},{dx:3,heightReduction:2,widthReduction:1}],Qt=(e,t)=>{const{offsetTop:n,end:r,msPerPx:a}=t;return n+(r-e)/a},Jt=(e,t)=>{const n=e.start,r=e.end??(e.openEnded?Date.now():void 0);if(null==n||null==r)return e.timestamp;if(n>=t.start&&n<=t.end&&!(r<=t.end&&r>=t.start))return n;const a=Math.max(n,t.start),o=Math.min(r,t.end);return a>=o?e.timestamp:(a+o)/2},Zt=(e,t)=>Yt[e]>=Yt[t]?e:t,en=(e,t,n,r,a)=>{e.push({y:(t+n)/2,events:r,highestPriority:a})},tn=(e,t)=>{const n=(t.end-t.start)/t.msPerPx,r=e.map(e=>({event:e,y:Qt(Jt(e,t),t)})).filter(({y:e})=>e>=-24&&e<=n+24).sort((e,t)=>e.y-t.y);if(0===r.length)return[];const a=[];let o=r[0].y,l=r[0].y,i=[r[0].event],s=r[0].event.priority;for(let e=1;e<r.length;e+=1){const{event:t,y:n}=r[e];n-l<28&&n-o<qt?(i.push(t),l=n,s=Zt(s,t.priority)):(en(a,o,l,i,s),o=n,l=n,i=[t],s=t.priority)}en(a,o,l,i,s);const c=[a[0]];for(let e=1;e<a.length;e+=1){const t=c.at(-1),n=a[e];n.y-t.y<28?(t.y=(t.y*t.events.length+n.y*n.events.length)/(t.events.length+n.events.length),t.events=t.events.concat(n.events),t.highestPriority=Zt(t.highestPriority,n.highestPriority)):c.push(n)}return c},nn=(e,t,n,r)=>{e.fillStyle=r.bg,Gt(e,t,n,24,24,4)},rn=(e,t,n,r,a,o,l,i)=>{e.fillStyle=l,zt(e,t,n,r,a,o),e.fill(),e.strokeStyle=i,zt(e,t+.5,n+.5,r-1,a-1,Math.max(o-.5,0)),e.stroke()},an=(e,t,n,r,a,o)=>{e.font=Ft;const l=e.measureText(r).width,i=Math.max(24,Math.ceil(l)+10),s=t+6,c=n-12;e.lineWidth=1;for(const{dx:r,heightReduction:l,widthReduction:s}of Xt){const c=24-l;rn(e,t+r,n-c/2,i-s,c,4,a.bg,o)}rn(e,s,c,i,24,4,a.bg,o),e.textAlign="center",e.textBaseline="middle",e.fillStyle=a.fg,e.fillText(r,s+i/2,n+1)},on=(e,t)=>{const n=e.start,r=e.end??(e.openEnded?Date.now():void 0);if(null==n||null==r)return"point";const a=n>=t.start&&n<=t.end,o=r<=t.end&&r>=t.start;return a&&!o?"start_anchor":Math.max(n,t.start)>=Math.min(r,t.end)?"point":a&&o?"midpoint":"floating"},ln=(e,t,n)=>{const r=document.createElement("canvas");r.width=8,r.height=8;const a=r.getContext("2d");return a?(a.fillStyle=t,a.fillRect(0,0,8,8),a.strokeStyle=n,a.lineWidth=1,a.beginPath(),a.moveTo(-1,9),a.lineTo(9,-1),a.stroke(),e.createPattern(r,"repeat")):null},sn=(e,t)=>{const{offsetTop:n,end:r,msPerPx:a}=t;return n+(r-e)/a},cn=(e,t)=>{const{offsetTop:n,end:r,msPerPx:a}=t;return n+(r-e)/a},mn=e=>e<1e3?{step:10*kt.vl,major:30*kt.vl,timestamp:kt.ti}:e<2500?{step:kt.ti,major:5*kt.ti,timestamp:5*kt.ti}:e<12e3?{step:kt.ti,major:5*kt.ti,timestamp:10*kt.ti}:{step:5*kt.ti,major:15*kt.ti,timestamp:30*kt.ti},un=e=>({x:e.offsetX,y:e.offsetY,pageY:e.pageY,timeStamp:e.timeStamp}),dn=e=>e*(2-e);class En{canvas;ctx;_colors;_currentTime;_isLive;_scale;msPerPx;liveLabel;_maxPastMs;_minTime;_rawEvents=[];_rawIconEvents=[];_events=[];_iconEvents=[];_iconImageCache=new Map;_iconPositionCache=new Map;_hatchPattern=null;onTimeChange;onLiveChange;onHoverCluster;raf=null;liveInterval=null;boundaryInterval=null;_isAtMinBoundary=!1;isDragging=!1;momentumRAF=null;wheelRAF=null;wheelTargetDelta=0;wheelAnimatedDelta=0;ticksDTF;timestampDTF;dateDTF;locale;hourCycle;timeLabelX;timezoneOffset;constructor(e,t,n={}){this.canvas=e;const r=e.getContext("2d");if(!r)throw new Error("Failed to get canvas 2d context");this.ctx=r,this._colors=t,this._hatchPattern=ln(this.ctx,t.hatchColors.bg,t.hatchColors.line),this._currentTime=n.initialTime??Date.now(),this._isLive=n.isLive??!0,this._scale=n.scale??10,this.msPerPx=kt.ti/this._scale,this.liveLabel=n.liveLabel??"LIVE",this._maxPastMs=n.maxPastMs??$t,this._minTime=Date.now()-this._maxPastMs,this.onTimeChange=n.onTimeChange,this.onLiveChange=n.onLiveChange,this.onHoverCluster=n.onHoverCluster,this.locale=n.locale??"en-US",this.hourCycle=n.hourCycle??"h23",this.updateTimeFormatters(this.locale,this.hourCycle);const a=new Date;this.timezoneOffset=a.getTimezoneOffset()*kt.ti,this.addListeners(),this._isLive&&this.startLiveUpdates(),this.invalidate()}setTimeFormatters(e,t){this.locale===e&&this.hourCycle===t||(this.updateTimeFormatters(e,t),this.invalidate())}get currentTime(){return this._currentTime}set currentTime(e){this._currentTime=e,this.onTimeChange?.(e),this.invalidate()}get isLive(){return this._isLive}set isLive(e){this._isLive!==e&&(this._isLive=e,this.onLiveChange?.(e),e?(this.stopBoundaryFollow(),this.currentTime=Date.now(),this.startLiveUpdates()):this.stopLiveUpdates())}get scale(){return this._scale}set scale(e){this._scale!==e&&(this._scale=e,this.msPerPx=kt.ti/e,this.invalidate())}get maxPastMs(){return this._maxPastMs}set maxPastMs(e){this._maxPastMs=e,this._minTime=Date.now()-e,this._events=En.clampTrackEventsToMinTime(this._rawEvents,this._minTime),this._iconEvents=En.clampIconEventsToMinTime(this._rawIconEvents,this._minTime),this.invalidate()}get colors(){return this._colors}set colors(e){const t=this._colors.hatchColors;this._colors=e,e.hatchColors.bg===t.bg&&e.hatchColors.line===t.line||(this._hatchPattern=ln(this.ctx,e.hatchColors.bg,e.hatchColors.line)),this.invalidate()}get minTime(){return this._minTime}set events(e){this._rawEvents=e,this._events=En.clampTrackEventsToMinTime(e,this._minTime),this.invalidate()}set iconEvents(e){this._rawIconEvents=e,this._iconEvents=En.clampIconEventsToMinTime(e,this._minTime),this.invalidate()}set iconImageCache(e){this._iconImageCache=e,this.invalidate()}redraw(){this.invalidate()}scrollToTime(e,t=!0){t?this.smoothScrollTo(e):this.currentTime=e}scrollToLive(e){this.stopBoundaryFollow(),this.smoothScrollTo(Date.now(),()=>{this.isLive=!0,e?.()})}resize(e){const t=window.devicePixelRatio||1;this.canvas.width=152*t,this.canvas.height=e*t,this.canvas.style.width="152px",this.canvas.style.height=`${e}px`,this.ctx.scale(t,t),this.invalidate()}destroy(){this.removeListeners(),this.stopLiveUpdates(),this.stopBoundaryFollow(),this.stopMomentum(),this.stopWheelAnimation(),this.raf&&cancelAnimationFrame(this.raf)}invalidate(){this.raf||(this.raf=requestAnimationFrame(()=>{this.raf=null,this.render()}))}getSubRange(){return{start:this._currentTime-(this.logicalHeight-72)*this.msPerPx,end:this._currentTime+72*this.msPerPx,offsetTop:0,msPerPx:this.msPerPx}}static clampTrackEventsToMinTime(e,t){const n=[];for(const r of e)(r.end??(r.openEnded?Date.now():r.start))<t||n.push(r.start<t?{...r,start:t}:r);return n}static clampIconEventsToMinTime(e,t){const n=[];for(const r of e)(r.end??(r.openEnded?Date.now():r.timestamp))<t||n.push(null!=r.start&&r.start<t||r.timestamp<t?{...r,start:null!=r.start?Math.max(r.start,t):r.start,timestamp:Math.max(r.timestamp,t)}:r);return n}render(){if(this.clear(),0===this.logicalWidth||0===this.logicalHeight)return;const e=this.getSubRange(),t={id:"__selectable_range__",priority:Bt.SELECTABLE,start:this._minTime,end:Date.now()};((e,t)=>{const{canvas:n}=e;e.save(),e.lineWidth=9,e.strokeStyle=t,e.lineCap="round",e.beginPath(),e.moveTo(76,0),e.lineTo(76,n.height),e.stroke(),e.restore()})(this.ctx,this._colors.trackColor),((e,t,n,r,a)=>{if(0===n.length)return;const o=e=>(e.end??(e.openEnded?Date.now():e.start))-e.start,l=[...n].sort((e,t)=>{const n=e.priority===Bt.SELECTABLE?0:1,r=t.priority===Bt.SELECTABLE?0:1;if(n!==r)return n-r;const a=o(t)-o(e);return 0!==a?a:Yt[e.priority]-Yt[t.priority]}),{start:i,end:s}=t;e.save();for(const n of l){const o=n.end??(n.openEnded?Date.now():void 0);if(null==o||o<i||n.start>s)continue;if(e.fillStyle=r[n.priority],n.start===n.end){const r=sn(n.start,t);e.beginPath(),e.arc(76,r,4.5,0,2*Math.PI),e.fill();continue}const l=Math.max(n.start,i),c=Math.min(o,s),m=sn(c,t),u=sn(l,t)-m,d=Math.min(8,u/2,4.5),E=71.5;"hatch"===n.pattern?a&&(e.fillStyle=a,zt(e,E,m,9,u,d),e.fill()):(e.fillStyle=r[n.priority],Gt(e,E,m,9,u,d))}e.restore()})(this.ctx,e,[t,...this._events],this._colors.eventColors,this._hatchPattern),((e,t,n,r,a)=>{const{step:o,major:l,timestamp:i}=mn(t.msPerPx);e.save(),e.lineWidth=1;const{start:s,end:c}=t;let m=Math.trunc(s/o)*o+o;for(;m<=c;){const s=cn(m,t),c=i&&!(m%i),u=l&&!(m%l);e.beginPath(),c?(e.moveTo(53,s),e.strokeStyle=a,e.lineTo(65,s)):u?(e.moveTo(57,s),e.strokeStyle=r,e.lineTo(65,s)):(e.moveTo(60,s),e.strokeStyle=n,e.lineTo(65,s)),e.stroke(),m+=o}e.restore()})(this.ctx,e,this._colors.tickColor,this._colors.majorTickColor,this._colors.longTickColor),((e,t,n,r,a,o)=>{const{timestamp:l}=mn(t.msPerPx);e.save(),e.textAlign="left",e.textBaseline="middle",e.fillStyle=a,e.font="600 9px Inter, Lato, sans-serif";const{start:i,end:s}=t;let c=Math.trunc(i/l)*l+l;for(;c<=s;){if((c-r)%kt.jU){const r=cn(c,t),a=n(c);e.fillText(a,o,r)}c+=l}e.restore()})(this.ctx,e,e=>this.ticksDTF.format(e),this.timezoneOffset,this._colors.textColor,this.timeLabelX),((e,t,n,r,a,o)=>{e.save(),e.textAlign="left",e.textBaseline="middle",e.font=Ft;const{start:l,end:i}=t;let s=l-(l-r)%kt.jU;for(;s<=i;){const r=cn(s,t);e.globalAlpha=.85,e.fillStyle=o,e.fillRect(0,r-16.5,65,33),e.globalAlpha=1,e.fillStyle=a;const l=n(s-kt.jU);e.fillText(l,22,r),s+=kt.jU}e.restore()})(this.ctx,e,e=>this.dateDTF.format(e),this.timezoneOffset,this._colors.dayTextColor,this._colors.dayBgColor);const n=((e,t,n,r,a,o,l)=>{if(0===n.length)return l?.clear(),!1;const i=tn(n,t),s=!!l&&((e,t,n)=>{let r=!1;const a=new Set;for(const o of e){for(const e of o.events)a.add(e.id);if(1!==o.events.length)continue;const e=o.events[0],l=e.id,i=on(e,n),s=t.get(l);if(null!=s&&(s.animating||s.mode!==i)){const e=o.y-s.y;if(Math.abs(e)>.5){o.y=s.y+.35*e,t.set(l,{y:o.y,mode:i,animating:!0}),r=!0;continue}}t.set(l,{y:o.y,mode:i,animating:!1})}for(const e of t.keys())a.has(e)||t.delete(e);return r})(i,l,t);e.save();for(const t of i){const n=r[t.highestPriority];if(1===t.events.length){const r=Ht,a=t.y-12;nn(e,r,a,n);const l=t.events[0],i=o.get(`${l.type}-${l.priority}`);i&&i.complete&&i.naturalWidth>0&&e.drawImage(i,r+2,a+2,20,20)}else an(e,Ht,t.y,String(t.events.length),n,a)}return e.restore(),s})(this.ctx,e,this._iconEvents,this._colors.eventIconColors,this._colors.eventClusterStrokeColor,this._iconImageCache,this._iconPositionCache);((e,t,n,r,a,o,l,i,s,c)=>{const{canvas:m}=e,u=Math.round(71)+1;e.save(),e.strokeStyle=l,e.lineWidth=2,e.beginPath(),e.moveTo(0,u),e.lineTo(m.width,u),e.stroke(),e.restore();const d=o?a.toUpperCase():r(t);e.save(),e.font=Ft,e.textAlign="center",e.textBaseline="middle";const E=e.measureText(d).width,h=Math.round(60),p=Math.round(E+16);e.shadowOffsetX=0,e.shadowOffsetY=4,e.shadowBlur=6,e.shadowColor=c,e.fillStyle=i,Gt(e,12,h,p,24,6),e.shadowColor="transparent",e.fillStyle=s;const A=20+E/2,_=Math.round(72)+1;e.fillText(d,A,_),e.restore()})(this.ctx,this._currentTime,0,e=>this.timestampDTF.format(e),this.liveLabel,this._isLive,this._colors.indicatorLineColor,this._colors.indicatorBgColor,this._colors.indicatorTextColor,this._colors.indicatorShadowColor),n&&this.invalidate()}clear(){const e=window.devicePixelRatio||1;this.ctx.clearRect(0,0,this.canvas.width/e,this.canvas.height/e)}updateTimeFormatters(e,t){this.locale=e,this.hourCycle=t,this.timeLabelX=(e=>"h23"===e||"h24"===e)(t)?22:8,this.ticksDTF=new Intl.DateTimeFormat(e,{...Ut,hourCycle:t}),this.timestampDTF=new Intl.DateTimeFormat(e,{...Wt,hourCycle:t}),this.dateDTF=new Intl.DateTimeFormat(e,Vt)}get logicalWidth(){const e=window.devicePixelRatio||1;return this.canvas.width/e}get logicalHeight(){const e=window.devicePixelRatio||1;return this.canvas.height/e}startLiveUpdates(){this.stopLiveUpdates(),this.liveInterval=window.setInterval(()=>{this._isLive&&(this._currentTime=Date.now(),this.onTimeChange?.(this._currentTime),this.invalidate())},1e3)}stopLiveUpdates(){this.liveInterval&&(clearInterval(this.liveInterval),this.liveInterval=null)}startBoundaryFollow(){this.boundaryInterval||(this._isAtMinBoundary=!0,this.boundaryInterval=window.setInterval(()=>{this._isAtMinBoundary&&(this._currentTime=this.minTime,this.onTimeChange?.(this._currentTime),this.invalidate())},1e3))}stopBoundaryFollow(){this._isAtMinBoundary=!1,this.boundaryInterval&&(clearInterval(this.boundaryInterval),this.boundaryInterval=null)}smoothScrollTo(e,t){const n=Math.max(e,this.minTime),r=this._currentTime;let a=null;const o=e=>{a||(a=e);const l=Math.min((e-a)/500,1),i=(n-r)*dn(l);this._currentTime=r+i,this.onTimeChange?.(this._currentTime),this.invalidate(),l<1?requestAnimationFrame(o):t?.()};requestAnimationFrame(o)}scrollToEventCluster(e){this.stopMomentum(),this.stopBoundaryFollow();const t=this.getSubRange();let n;if(1===e.events.length){const r=e.events[0],a=r.start??r.timestamp;n=a>=t.start&&a<=t.end?t.end-(e.y-t.offsetTop)*t.msPerPx:a}else n=Math.min(...e.events.map(e=>e.start??e.timestamp));this._isLive&&(this.isLive=!1),this.scrollToTime(n)}addListeners(){this.canvas.addEventListener("wheel",this.onWheel,{passive:!1}),this.canvas.addEventListener("mousedown",this.onMouseDown),this.canvas.addEventListener("mousemove",this.onMouseMove),this.canvas.addEventListener("mouseleave",this.onMouseLeave)}removeListeners(){this.canvas.removeEventListener("wheel",this.onWheel),this.canvas.removeEventListener("mousedown",this.onMouseDown),this.canvas.removeEventListener("mousemove",this.onMouseMove),this.canvas.removeEventListener("mouseleave",this.onMouseLeave)}onWheel=e=>{e.preventDefault(),this.stopMomentum(),this.wheelTargetDelta+=-e.deltaY,null===this.wheelRAF&&this.tickWheelScroll()};onMouseMove=e=>{if(this.isDragging)return;const t=this.hitTestEventIcons(e.offsetX,e.offsetY);this.canvas.style.cursor=t?"pointer":"grab",this.onHoverCluster?.(t??null)};onMouseLeave=()=>{this.onHoverCluster?.(null)};hitTestEventIcons(e,t){if(e<Ht||0===this._iconEvents.length)return null;const n=tn(this._iconEvents,this.getSubRange());for(const e of n)if(Math.abs(t-e.y)<=12)return e;return null}tickWheelScroll(){this.wheelRAF=requestAnimationFrame(()=>{const e=this.wheelTargetDelta-this.wheelAnimatedDelta;if(Math.abs(e)<.5)return 0!==e&&this.shiftByPixels(e),void this.resetWheelState();const t=.25*e;this.shiftByPixels(t),this.wheelAnimatedDelta+=t,this.tickWheelScroll()})}stopWheelAnimation(){this.wheelRAF&&cancelAnimationFrame(this.wheelRAF),this.resetWheelState()}resetWheelState(){this.wheelRAF=null,this.wheelTargetDelta=0,this.wheelAnimatedDelta=0}onMouseDown=e=>{if(0!==e.button)return;e.preventDefault(),this.stopMomentum(),this.stopWheelAnimation(),this.isDragging=!0,this.canvas.style.cursor="grabbing";const t=un(e);let n=t,r=0;const a=e=>{const t=un(e);this.shiftByPixels(t.pageY-n.pageY);const a=t.timeStamp-n.timeStamp;a>0&&(r=.2*r+1e3*(t.pageY-n.pageY)/a*.8),n=t},o=e=>{if(document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",o),this.isDragging=!1,this.canvas.style.cursor="grab",Math.abs(e.pageY-t.pageY)<5){const e=this.hitTestEventIcons(t.x,t.y);if(e)return void this.scrollToEventCluster(e)}const l=e.timeStamp-n.timeStamp;Math.abs(r)>100&&l<300&&this.startMomentum(r)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",o)};shiftByPixels(e){const t=e*this.msPerPx,n=this._currentTime+t;return n>=Date.now()?(this.stopBoundaryFollow(),void(this._isLive||(this.isLive=!0))):n<=this.minTime?(this._currentTime>this.minTime&&(this._currentTime=this.minTime,this.onTimeChange?.(this._currentTime),this.invalidate()),void this.startBoundaryFollow()):(this.stopBoundaryFollow(),this._isLive&&t<0&&(this.isLive=!1),this._currentTime=n,this.onTimeChange?.(this._currentTime),void this.invalidate())}startMomentum(e){this.stopMomentum();let t=e;const n=()=>{this.momentumRAF=null,t*=.9;const e=Math.abs(t)<=100?dn(Math.abs(t)/100)/10:.1,r=t*e;this.shiftByPixels(r),Math.abs(r)>=.05&&(this.momentumRAF=requestAnimationFrame(n))};this.momentumRAF=requestAnimationFrame(n)}stopMomentum(){this.momentumRAF&&(cancelAnimationFrame(this.momentumRAF),this.momentumRAF=null)}}var hn=n(180524),pn=n(530813);const An={[Kt.LOOP]:"COMMON_ANOMALY",[Kt.WARNING]:"COMMON_ANOMALY",[Kt.BLOCK]:"COMMON_ANOMALY",[Kt.DEVICE_CONNECTED]:"PORTS_TIMELINE_DEVICE_CONNECTED",[Kt.DEVICE_DISCONNECTED]:"PORTS_TIMELINE_DEVICE_DISCONNECTED",[Kt.CLIENT_CONNECTED]:"PORTS_TIMELINE_CLIENT_CONNECTED",[Kt.CLIENT_DISCONNECTED]:"PORTS_TIMELINE_CLIENT_DISCONNECTED",[Kt.INTERNET_CONNECTED]:"PORTS_TIMELINE_INTERNET_CONNECTED",[Kt.INTERNET_DISCONNECTED]:"PORTS_TIMELINE_INTERNET_DISCONNECTED",[Kt.NETWORK_OFFLINE]:"PORTS_TIMELINE_NETWORK_OFFLINE",[Kt.DEVICE_OFFLINE]:"PORTS_TIMELINE_DEVICE_OFFLINE",[Kt.NETWORK_UPDATED]:"COMMON_NETWORK_UPDATED",[Kt.POWER_CYCLE]:"PORTS_TIMELINE_POWER_CYCLE_TRIGGERED"},_n={connected:"PORTS_TIMELINE_NAME_CONNECTED",disconnected:"PORTS_TIMELINE_NAME_DISCONNECTED",power_cycled:"PORTS_TIMELINE_NAME_POWER_CYCLED"},Cn=[Kt.NETWORK_UPDATED,Kt.NETWORK_OFFLINE],gn=e=>e===Kt.DEVICE_CONNECTED||e===Kt.CLIENT_CONNECTED?"connected":e===Kt.POWER_CYCLE?"power_cycled":"disconnected",fn=({hoveredCluster:e})=>{const t=(0,r.useRef)(null);return r.createElement(r.Fragment,null,r.createElement("div",{ref:t,style:{position:"absolute",left:e?Ht:-100,top:e?e.y-12:-100,width:24,height:24,pointerEvents:"none"}}),r.createElement(hn.A,{isOpen:!!e,placement:"right",triggerRef:t,description:e?r.createElement(pn.A,{items:e.events,getItemKey:(e,t)=>e.id??t,renderItem:e=>{const t=e.metadata,n=t?.deviceName&&!Cn.includes(e.type);return r.createElement(r.Fragment,null,n?r.createElement(r.Fragment,null,t.deviceName," - "):null,null!=t?.portIdx?r.createElement(r.Fragment,null,r.createElement(q.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:t.portIdx}})," - "):null,((e,t)=>(e=>e===Kt.DEVICE_CONNECTED||e===Kt.CLIENT_CONNECTED||e===Kt.DEVICE_DISCONNECTED||e===Kt.CLIENT_DISCONNECTED||e===Kt.POWER_CYCLE)(e)&&t?.name?r.createElement(q.sA,{id:_n[gn(e)],values:{name:t.name}}):r.createElement(q.sA,{id:An[e]}))(e.type,t))},listGap:m.kc,truncateItems:!1}):null},r.createElement("span",null)))},Sn=(0,a.A)(E.A)`
  width: ${152}px;
  height: 100%;
  flex-direction: column;
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-00-${e}`]};
  border: 1px solid ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-02-${e}`]};
  border-radius: ${m.kc};
  overflow: hidden;
  flex-shrink: 0;
`,Tn=(0,a.A)(E.A)`
  flex-direction: column;
  padding: ${m.kc};
  gap: ${m.kc};
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-00-${e}`]};
  z-index: 1;
`,Nn=(0,a.A)(E.A)`
  align-items: center;
  gap: ${m.kc};
  padding: 2px ${m.YC};
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-01-${e}`]};
  border-radius: 18px;
`,On=()=>r.createElement("svg",{width:"20",height:"8",viewBox:"0 0 20 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r.createElement("rect",{width:"20",height:"8",rx:"4",fill:"#006FFF"}),r.createElement("rect",{x:"0.5",y:"0.5",width:"19",height:"7",rx:"3.5",stroke:"url(#zoomThumbGradient)"}),r.createElement("defs",null,r.createElement("linearGradient",{id:"zoomThumbGradient",x1:"10",y1:"0",x2:"10",y2:"8",gradientUnits:"userSpaceOnUse"},r.createElement("stop",{stopColor:"white",stopOpacity:"0.3"}),r.createElement("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})))),vn=ft.AH`
  background: transparent !important;
`,In=ft.AH`
  flex: 1;

  [data-uic-component='Slider.ValueMark'] {
    display: none;
  }

  [data-uic-component='Slider.Thumb'] {
    top: 50%;
    width: 20px;
    height: 8px;
    background: transparent;
    border: none;
    box-shadow: none;

    svg {
      display: block;
      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.2));
    }
  }
`,Dn=(0,a.A)("div")`
  flex: 1;
  position: relative;
  overflow: hidden;

  canvas {
    display: block;
    font-variant-numeric: tabular-nums slashed-zero;
    cursor: grab;
  }
`,Mn=(0,a.A)("button")`
  position: absolute;
  bottom: ${m.kc};
  right: ${m.kc};
  width: ${m.ED};
  height: ${m.ED};
  border-radius: ${m.ED};
  border: none;
  padding: ${m.YC};
  display: flex;
  align-items: center;
  justify-content: center;
  background: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-ublue-06-${e}`]};
  color: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-00-${e}`]};
  cursor: pointer;
  z-index: 2;

  &:hover {
    filter: brightness(1.1);
  }
`,bn={[Kt.LOOP]:vt.A,[Kt.WARNING]:U.A,[Kt.BLOCK]:Dt.A,[Kt.DEVICE_CONNECTED]:Mt.A,[Kt.DEVICE_DISCONNECTED]:Mt.A,[Kt.CLIENT_CONNECTED]:bt.A,[Kt.CLIENT_DISCONNECTED]:bt.A,[Kt.INTERNET_CONNECTED]:xt.A,[Kt.INTERNET_DISCONNECTED]:wt.A,[Kt.NETWORK_OFFLINE]:yt.A,[Kt.NETWORK_UPDATED]:yt.A,[Kt.DEVICE_OFFLINE]:Pt.A,[Kt.POWER_CYCLE]:Lt.A},Pn={[Kt.NETWORK_OFFLINE]:"fill",[Kt.NETWORK_UPDATED]:"fill"},xn={position:"fixed",top:-9999,left:-9999,pointerEvents:"none"},yn=(e,t,n)=>Math.log(e/t)/Math.log(n/t),Ln=(e,t,n)=>t*Math.pow(n/t,e),wn=(0,r.memo)(({titleId:e="COMMON_TIMELINE_LAST_24H",liveLabelId:t="COMMON_TIMELINE_LIVE",selectedTimestamp:n,onTimestampSelect:a,isLive:o,onLiveChange:l,defaultScale:i=10,minScale:s=2,maxScale:c=200,scaleStep:m=1,maxPastMs:u=$t,events:d=[],iconEvents:E=[]})=>{const h=(0,r.useRef)(null),p=(0,r.useRef)(null),A=(0,r.useRef)(null),_=(0,r.useRef)(null),[C,g]=(0,r.useState)(i),[f,S]=(0,r.useState)(null),T=(0,r.useRef)(a),N=(0,r.useRef)(l),O=(0,r.useRef)(S);T.current=a,N.current=l;const{themeName:v}=(0,H.u)(),{formatMessage:I}=(0,q.tz)(),D=(0,M.useSelector)(Rt.zi),b=(0,M.useSelector)(ut.BQ),P=I({id:t}),x=(0,r.useMemo)(()=>{const e=$.Ay[`desktop-color-ublue-06-${v}`];return{trackColor:$.Ay[`desktop-color-neutral-03-${v}`],tickColor:$.Ay[`desktop-color-neutral-03-${v}`],majorTickColor:$.Ay[`desktop-color-neutral-04-${v}`],longTickColor:$.Ay[`desktop-color-neutral-05-${v}`],textColor:$.Ay[`desktop-color-text-4-${v}`],dayTextColor:$.Ay[`desktop-color-neutral-08-${v}`],dayBgColor:$.Ay[`desktop-color-neutral-02-${v}`],indicatorLineColor:e,indicatorBgColor:e,indicatorTextColor:$.Ay[`desktop-color-neutral-00-${v}`],indicatorShadowColor:`color-mix(in srgb, ${e} 15%, transparent)`,eventColors:{[Bt.SELECTABLE]:$.Ay[`desktop-color-ublue-01-${v}`],[Bt.NEUTRAL]:$.Ay[`desktop-color-neutral-06-${v}`],[Bt.INFO]:$.Ay[`desktop-color-ublue-03-${v}`],[Bt.ACTION]:$.Ay[`desktop-color-aqua-03-${v}`],[Bt.SUCCESS]:$.Ay[`desktop-color-green-03-${v}`],[Bt.WARNING]:$.Ay[`desktop-color-orange-03-${v}`],[Bt.ERROR]:$.Ay[`desktop-color-red-03-${v}`]},eventClusterStrokeColor:$.Ay[`desktop-color-neutral-00-${v}`],eventIconColors:{[Bt.SELECTABLE]:{bg:$.Ay[`desktop-color-ublue-01-${v}`],fg:$.Ay[`desktop-color-ublue-06-${v}`]},[Bt.NEUTRAL]:{bg:$.Ay[`desktop-color-neutral-02-${v}`],fg:$.Ay[`desktop-color-neutral-06-${v}`]},[Bt.INFO]:{bg:$.Ay[`desktop-color-ublue-01-${v}`],fg:$.Ay[`desktop-color-ublue-06-${v}`]},[Bt.ACTION]:{bg:$.Ay[`desktop-color-aqua-01-${v}`],fg:$.Ay[`desktop-color-aqua-06-${v}`]},[Bt.SUCCESS]:{bg:$.Ay[`desktop-color-green-01-${v}`],fg:$.Ay[`desktop-color-green-06-${v}`]},[Bt.WARNING]:{bg:$.Ay[`desktop-color-orange-01-${v}`],fg:$.Ay[`desktop-color-orange-06-${v}`]},[Bt.ERROR]:{bg:$.Ay[`desktop-color-red-01-${v}`],fg:$.Ay[`desktop-color-red-06-${v}`]}},hatchColors:{bg:$.Ay[`desktop-color-neutral-00-${v}`],line:$.Ay[`desktop-color-neutral-04-${v}`]}}},[v]),y=(0,r.useRef)({colors:x,scale:C,isLive:o,selectedTimestamp:n,liveLabel:P,maxPastMs:u,language:D,selfHourCycle:b});(0,r.useEffect)(()=>{if(!h.current)return;const e=y.current,t=new En(h.current,e.colors,{scale:e.scale,initialTime:e.isLive?Date.now():e.selectedTimestamp??Date.now(),isLive:e.isLive,liveLabel:e.liveLabel,maxPastMs:e.maxPastMs,locale:e.language,hourCycle:e.selfHourCycle,onTimeChange:e=>T.current(e),onLiveChange:e=>N.current(e),onHoverCluster:e=>O.current(e)});return A.current=t,()=>{t.destroy(),A.current=null}},[]),(0,r.useEffect)(()=>{const e=p.current;if(!e||!A.current)return;const t=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.height);e>0&&A.current?.resize(e)}});t.observe(e);const n=Math.floor(e.clientHeight);return n>0&&A.current.resize(n),()=>t.disconnect()},[]),(0,r.useEffect)(()=>{A.current&&(A.current.colors=x)},[x]),(0,r.useEffect)(()=>{A.current&&A.current.setTimeFormatters(D,b)},[D,b]),(0,r.useEffect)(()=>{A.current&&(A.current.scale=C)},[C]),(0,r.useEffect)(()=>{A.current&&A.current.isLive!==o&&(A.current.isLive=o)},[o]),(0,r.useEffect)(()=>{A.current&&(A.current.maxPastMs=u)},[u]),(0,r.useEffect)(()=>{A.current&&(A.current.events=d)},[d]),(0,r.useEffect)(()=>{A.current&&(A.current.iconEvents=E)},[E]),(0,r.useEffect)(()=>{const e=_.current;if(!e||!A.current)return;const t=((e,t)=>{const n=new Map,r=window.devicePixelRatio||1;return e.querySelectorAll("[data-icon-key]").forEach(e=>{const a=e.dataset.iconKey,o=e.dataset.fg;if(!a||!o)return;const l=e.querySelector("svg");if(!l)return;const i=l.cloneNode(!0),s="path, circle, ellipse, rect, polygon, polyline, line",c=Array.from(l.querySelectorAll(s)),m=Array.from(i.querySelectorAll(s));for(let e=c.length-1;e>=0;e-=1)"none"===getComputedStyle(c[e]).display&&m[e].remove();i.querySelectorAll('[fill="currentColor"]').forEach(e=>{e.setAttribute("fill",o)}),i.querySelectorAll('[stroke="currentColor"]').forEach(e=>{e.setAttribute("stroke",o)}),"currentColor"===i.getAttribute("fill")&&i.setAttribute("fill","none"),i.removeAttribute("class"),i.querySelectorAll("[class]").forEach(e=>e.removeAttribute("class")),i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width",String(20*r)),i.setAttribute("height",String(20*r));const u=(new XMLSerializer).serializeToString(i),d=new Image;d.onload=t,d.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`,n.set(a,d)}),n})(e,()=>{A.current?.redraw()});A.current.iconImageCache=t},[v]),(0,r.useEffect)(()=>{A.current&&!o&&n&&Math.abs(A.current.currentTime-n)>1e3&&A.current.scrollToTime(n)},[n,o]);const L=m/(c-s),w=yn(C,s,c),R=(0,r.useCallback)(()=>{g(e=>{const t=yn(e,s,c);return Ln(Math.min(t+L,1),s,c)})},[L,s,c]),k=(0,r.useCallback)(()=>{g(e=>{const t=yn(e,s,c);return Ln(Math.max(t-L,0),s,c)})},[L,s,c]),U=(0,r.useCallback)(e=>{const t=Array.isArray(e)?e[0]:e;g(Ln(t,s,c))},[s,c]),W=(0,r.useCallback)(()=>{A.current?.scrollToLive()},[]);return r.createElement(Sn,null,r.createElement(Tn,null,r.createElement(F.A,{size:"small",color:"text-3"},r.createElement(q.sA,{id:e})),r.createElement(Nn,null,r.createElement(Tt.A,{className:vn,variant:"neutral",size:"xsmall",onPress:k,isDisabled:C<=s},r.createElement(Nt.A,{size:14})),r.createElement(St.A,{className:In,customThumb:r.createElement(On,null),minValue:0,maxValue:1,step:.01,value:w,onChange:U}),r.createElement(Tt.A,{className:vn,variant:"neutral",size:"xsmall",onPress:R,isDisabled:C>=c},r.createElement(Ot.A,{size:14})))),r.createElement(Dn,{ref:p},r.createElement("canvas",{ref:h}),r.createElement(fn,{hoveredCluster:f}),o?null:r.createElement(Mn,{onClick:W},r.createElement(It.A,{size:20}))),r.createElement("div",{ref:_,style:xn},Object.entries(bn).flatMap(([e,t])=>Object.entries(x.eventIconColors).map(([n,{fg:a}])=>r.createElement("span",{key:`${e}-${n}`,"data-icon-key":`${e}-${n}`,"data-fg":a},r.createElement(t,{size:20,variant:Pn[e]}))))))});var Rn=n(801081),kn=n(25553),$n=n(87485),Fn=n(586931);const Un=e=>(0,Rn.Mz)((e=>(0,kn.uh)((0,Fn.R)(e)))(e),$n.kh);var Wn,Vn=n(81898);!function(e){e.ANOMALY="ANOMALY",e.DEVICE_CONNECTED="DEVICE_CONNECTED",e.DEVICE_DISCONNECTED="DEVICE_DISCONNECTED",e.CLIENT_CONNECTED="CLIENT_CONNECTED",e.CLIENT_DISCONNECTED="CLIENT_DISCONNECTED",e.INTERNET_CONNECTED="INTERNET_CONNECTED",e.INTERNET_DISCONNECTED="INTERNET_DISCONNECTED",e.NETWORK_OFFLINE="NETWORK_OFFLINE",e.NETWORK_UPDATED="NETWORK_UPDATED",e.DEVICE_OFFLINE="DEVICE_OFFLINE",e.POWER_CYCLE_TRIGGERED="POWER_CYCLE_TRIGGERED"}(Wn||(Wn={}));const Hn={[X.Q.CRITICAL]:Bt.ERROR,[X.Q.DEGRADED]:Bt.WARNING,[X.Q.NONE]:Bt.INFO},zn={[X.t.NETWORK_LOOP_DETECTED_BY_STP]:Kt.LOOP,[X.t.NETWORK_LOOP_DETECTED_BY_KEEPALIVE]:Kt.LOOP},Gn=e=>e.external_id?`${e.type}-${e.external_id}`:`${e.type}-${e.timestamp}-${e.end_timestamp??e.timestamp}`,Bn=(e,t)=>{const n={};return null!=e.anomaly_type&&(n.anomalyType=e.anomaly_type),null!=e.name&&(n.name=e.name),null!=e.port_idx&&(n.portIdx=e.port_idx),t&&e.deviceMac&&t[e.deviceMac]&&(n.deviceName=t[e.deviceMac]),n},Yn={[Wn.DEVICE_CONNECTED]:{type:Kt.DEVICE_CONNECTED,priority:Bt.INFO},[Wn.DEVICE_DISCONNECTED]:{type:Kt.DEVICE_DISCONNECTED,priority:Bt.NEUTRAL},[Wn.CLIENT_CONNECTED]:{type:Kt.CLIENT_CONNECTED,priority:Bt.INFO},[Wn.CLIENT_DISCONNECTED]:{type:Kt.CLIENT_DISCONNECTED,priority:Bt.NEUTRAL},[Wn.INTERNET_CONNECTED]:{type:Kt.INTERNET_CONNECTED,priority:Bt.SUCCESS},[Wn.INTERNET_DISCONNECTED]:{type:Kt.INTERNET_DISCONNECTED,priority:Bt.NEUTRAL},[Wn.POWER_CYCLE_TRIGGERED]:{type:Kt.POWER_CYCLE,priority:Bt.ACTION}},Kn=e=>e.external_id||`${e.timestamp}-${e.type}-${e.port_idx??""}`;var jn=n(525512),qn=n(413914),Xn=n(648092),Qn=n(906593),Jn=n(802125);const Zn=[],er=[],tr=[],nr=[],rr=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w._h),n=(e=>{const t=(0,M.useSelector)(Xn.a),n=(0,r.useMemo)(()=>t[Qn.Uz],[t]),[a,o]=(0,r.useState)(Zn),l=(0,r.useMemo)(()=>JSON.stringify(e),[e]),i=(0,r.useCallback)((e,t)=>{const n=Array.isArray(e)?e:[e];0!==n.length&&o(e=>{const t=new Map;for(const n of e)t.set(Kn(n),n);for(const e of n)t.set(Kn(e),e);return Array.from(t.values())})},[]);return(0,r.useEffect)(()=>{const e=JSON.parse(l);if(n&&0!==e.length){for(const t of e)n.send((0,Jn.f)(qn.E.PORTS_TIMELINE,!0,{device_mac:t}));return()=>{for(const t of e)n.send((0,Jn.f)(qn.E.PORTS_TIMELINE,!1,{device_mac:t}))}}},[n,l]),(0,r.useEffect)(()=>{const e=(0,jn.K6)(qn._.PORTS_TIMELINE_EVENT,i);return()=>(0,jn.$N)(e)},[i]),(0,r.useEffect)(()=>{o(Zn)},[l]),a})(t),a=(0,r.useRef)(0);(0,r.useEffect)(()=>{if(n.length>0&&n.length!==a.current){a.current=n.length;const r=Date.now();for(const n of t)e((0,Vn.N)(n,r-kt.jU,r))}},[e,t,n.length]);const o=(0,M.useSelector)(w.Kw),l=(0,r.useMemo)(()=>{if(0===t.length)return()=>nr;if(1===t.length){const e=Un(t[0]);return t=>e(t)}const e=t.map(e=>Un(e));return(0,Rn.Mz)(e,(...e)=>{const n=[];for(let r=0;r<e.length;r+=1){const a=t[r],o=e[r];for(let e=0;e<o.length;e+=1)n.push({...o[e],deviceMac:a})}return n})},[t]),i=(0,M.useSelector)(l),{trackEvents:s,iconEvents:c}=(0,r.useMemo)(()=>{const e=((e,t)=>{if(0===t.length)return e;const n=new Map;for(const t of e)n.set(Kn(t),t);for(const e of t)n.has(Kn(e))||n.set(Kn(e),e);return Array.from(n.values())})(i,n);return 0===e.length?{trackEvents:er,iconEvents:tr}:((e,t)=>{const n=[],r=[],a=t?new Set:void 0;return e.forEach((e,o)=>{const l=`${e.type}-${e.timestamp}-${o}`,i=Yn[e.type];if(i)return n.push({id:`track-${l}`,priority:i.priority,start:e.timestamp,end:e.timestamp}),void r.push({id:`icon-${l}`,type:i.type,priority:i.priority,timestamp:e.timestamp,metadata:Bn(e,t)});switch(e.type){case Wn.ANOMALY:{const a=(e=>{if(!e)return Bt.WARNING;const t=Q.g[e];return t?Hn[t]:Bt.WARNING})(e.anomaly_type),o=(s=e.anomaly_type)&&zn[s]||Kt.WARNING,i=jt[o];n.push({id:`track-${l}`,priority:a,start:e.timestamp,end:e.end_timestamp??void 0,openEnded:i}),r.push({id:`icon-${l}`,type:o,priority:a,timestamp:e.end_timestamp?(e.timestamp+e.end_timestamp)/2:e.timestamp,start:e.timestamp,end:e.end_timestamp??void 0,openEnded:i,metadata:Bn(e,t)});break}case Wn.NETWORK_OFFLINE:case Wn.DEVICE_OFFLINE:{if(e.type===Wn.NETWORK_OFFLINE&&a){const t=Gn(e);if(a.has(t))break;a.add(t)}const o=e.type===Wn.NETWORK_OFFLINE?Kt.NETWORK_OFFLINE:Kt.DEVICE_OFFLINE,i=!e.end_timestamp;n.push({id:`track-${l}`,priority:Bt.NEUTRAL,start:e.timestamp,end:e.end_timestamp??void 0,openEnded:i,pattern:"hatch"}),r.push({id:`icon-${l}`,type:o,priority:Bt.NEUTRAL,timestamp:e.end_timestamp?(e.timestamp+e.end_timestamp)/2:e.timestamp,start:e.timestamp,end:e.end_timestamp??void 0,openEnded:i,metadata:Bn(e,t)});break}case Wn.NETWORK_UPDATED:if(a){const t=Gn(e);if(a.has(t))break;a.add(t)}n.push({id:`track-${l}`,priority:Bt.INFO,start:e.timestamp,end:e.end_timestamp??void 0}),r.push({id:`icon-${l}`,type:Kt.NETWORK_UPDATED,priority:Bt.INFO,timestamp:e.end_timestamp?(e.timestamp+e.end_timestamp)/2:e.timestamp,start:e.timestamp,end:e.end_timestamp??void 0,metadata:Bn(e,t)})}var s}),{trackEvents:n,iconEvents:r}})(e,o)},[i,n,o]);return{trackEvents:s,iconEvents:c}},ar=kt.vl/2,or=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.XI),n=(0,M.useSelector)(w.Hm),a=(0,M.useSelector)(w.aX),{trackEvents:o,iconEvents:l}=rr(),i=a?Date.now()-a:void 0,s=(0,r.useRef)(0),c=(0,r.useRef)();(0,r.useEffect)(()=>()=>clearTimeout(c.current),[]);const m=(0,r.useCallback)(t=>{const n=Date.now(),r=n-s.current;clearTimeout(c.current),r>=ar?(e((0,R.DH)(t)),s.current=n):c.current=setTimeout(()=>{e((0,R.DH)(t)),s.current=Date.now()},ar-r)},[e]),u=(0,r.useCallback)(t=>{e((0,R.j$)(t))},[e]);return r.createElement(wn,{selectedTimestamp:t,onTimestampSelect:m,isLive:n,onLiveChange:u,events:o,iconEvents:l,maxPastMs:i})});var lr=n(601021);var ir=n(649413),sr=n(953048);var cr=n(523275),mr=n(854726),ur=n(366188),dr=n(43130),Er=n(961630),hr=n(766624),pr=n(596176),Ar=n(959207),_r=n(226712),Cr=n(264752),gr=n(288006),fr=n(538535),Sr=n(156472),Tr=n(944373),Nr=n(792072),Or=n(460680);const vr=(0,a.A)(ue.A)`
  max-width: 120px;
`,Ir=({portNumber:e})=>{const t=(0,M.useSelector)(w.aq),n=(0,M.useSelector)(mr.wD),a=(0,M.useSelector)(Tr.D),o=(0,M.useSelector)(fr.D5),{portData:l,originalPortName:i}=(0,dr.E)(t,e,n),s=(0,M.useSelector)(ur.wf),c=(0,M.useSelector)(Nr.pB),u=(0,M.useSelector)(Sr.G),d=(0,M.useSelector)(Or.qS),h=(0,$e.vT)(l,t,a,o,s,c,u,d),{wanProviderName:p,lastConnectionClient:A,lastConnectionDevice:_,isSomethingConnected:C}=(0,fe.A)(h),g=p??(_?(0,Ee.Q)(_):(0,Ne.tn)(A));return r.createElement(E.A,{flexDirection:"column",gap:m.YC,width:"100%"},r.createElement(E.A,{gap:m.kc,alignItems:"center",width:"100%"},r.createElement(ue.A,{color:"inherit",weight:"bold",size:"inherit",isTruncated:!0},e,i?` | ${i}`:"")),C?r.createElement(E.A,{justifyContent:"space-between",gap:m.fS,alignItems:"center"},r.createElement(ue.A,{color:"inherit",size:"small",style:{whiteSpace:"nowrap"}},r.createElement(q.sA,{id:"COMMON_CONNECTED_TO"})),r.createElement(E.A,{alignItems:"center",gap:m.YC,minWidth:0},r.createElement(Me.A,{size:20,connectedClient:A,connectedDevice:_,wanProviderName:p}),r.createElement(vr,{color:"inherit",size:"small",isTruncated:!0},g))):null)};var Dr=n(871666);const Mr=(0,a.A)(E.A,(0,B.A)("background","border"))`
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${m.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,br=(0,r.memo)(({isTagged:e,isWanPort:t,isNative:n,portNumber:a,networkId:o,rowIndex:l,isDisabled:i})=>{const{themeName:s}=(0,H.u)(),{background:c,border:m,text:u}=(0,r.useMemo)(()=>{let r;switch(!0){case t:r=gr.vL.WAN;break;case i:r=gr.vL.DISABLED;break;case n:r=gr.vL.UNTAGGED_NATIVE;break;case e:r=gr.vL.TAGGED;break;default:r=gr.vL.BLOCKED}const{background:a,border:o,text:l}=Dr.k[r];return{background:a,border:o,text:l}},[t,i,n,e]);return r.createElement(hn.A,{key:`${a}-${o}`,description:r.createElement(Ir,{portNumber:a}),placement:0===l?"top":"bottom",delay:0,closeDelay:0},r.createElement(Mr,{background:(0,$e.oX)(c,s),border:(0,$e.oX)(m,s),color:(0,$e.oX)(u,s)},t?r.createElement(xt.A,{size:"original",color:(0,$e.oX)(u,s)}):null))}),Pr=(0,a.A)(E.A)`
  & > *:not(:last-child) {
    border-bottom: ${({theme:{themeName:e}})=>$.Ay[`desktop-border-divider-${e}`]};
  }
`,xr=(0,a.A)(E.A)`
  &:not(:last-child) {
    padding-bottom: ${m.kc};
  }
  &:not(:first-child) {
    padding-top: ${m.kc};
  }
`,yr=({network:e,rowLayouts:t,model:n,values:a,scale:o,spaceOffset:l})=>r.createElement(dt,{scale:o,spaceOffset:l},r.createElement(nt,null,(t||[]).map((t,o)=>r.createElement(rt,{key:`PortDiagramLayoutRow-${o+1}`},t.map((t,l)=>{const i=`PortDiagramLayoutCell-${o+1}-${l+1}`;if(!t)return r.createElement(at,{key:i});const s=+(0,_e.Cu)({port_idx:t.portNumber},n),c=a.taggedNetworks[s]?.[e._id];return c?r.createElement(br,{key:i,isNative:c[gr.at.IS_NETWORK_NATIVE_ON_PORT],isWanPort:c[gr.at.IS_WAN_PORT],isTagged:c[gr.at.IS_TAGGED],isDisabled:c[gr.at.IS_DISABLED],portNumber:s,rowIndex:o,networkId:e._id}):r.createElement(at,{key:i})}))))),Lr=({rowLayouts:e,model:t,values:n})=>{const{themeName:a}=(0,H.u)(),{formatMessage:o}=(0,q.tz)(),{sharedScale:l,sharedOffset:i}=Ae(),s=(0,M.useSelector)(ur.Tn).sort((e,t)=>(e.vlan??0)-(t.vlan??0)),[c,u]=(0,r.useState)(""),[d,h]=(0,r.useState)([]),p=(0,r.useMemo)(()=>s.map(e=>({id:e._id,vlan:e.vlan??0,name:e.name,subnet:(0,Ar.mC)(e)??"",label:e.name})),[s]),A=(0,r.useMemo)(()=>p.filter(({id:e,name:t,subnet:n,vlan:r})=>(t?.toLowerCase().includes(c.toLowerCase())||n?.toLowerCase().includes(c.toLowerCase())||r?.toString().toLowerCase().includes(c.toLowerCase()))&&!d.some(t=>t.id===e)),[p,d,c]),_=(0,r.useCallback)(e=>{if(d.some(({id:t})=>t===e))return;const t=p.find(({id:t})=>t===e);t&&h(e=>e.concat([{id:t.id,label:t.label}]))},[p,d]),C=(0,r.useCallback)(e=>{h(t=>t.filter(({id:t})=>t!==e))},[]);return r.createElement(E.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},r.createElement(it,null,r.createElement(E.A,{gap:m.kc,width:"100%",flexWrap:"wrap",alignItems:"center"},r.createElement(st,null,r.createElement(F.A,{size:"medium",weight:"bold",color:"text-1",style:{whiteSpace:"nowrap"}},r.createElement(q.sA,{id:"PORTS_VLANS_SECTION_TITLE"})),r.createElement(hr.A,{description:r.createElement(pr.A,{messages:[["PORTS_VLANS_SECTION_TITLE_DESC_1"],["PORTS_VLANS_SECTION_TITLE_DESC_2"],["PORTS_VLANS_SECTION_TITLE_DESC_3"]]})})),r.createElement(Cr.A,{description:r.createElement(q.sA,{id:"COMMON_TAGGED"}),indicator:r.createElement(_r.T,{color:(0,$e.oX)(Dr.k.TAGGED.background,a)})}),r.createElement(Cr.A,{description:r.createElement(q.sA,{id:"COMMON_BLOCKED"}),indicator:r.createElement(_r.T,{color:(0,$e.oX)(Dr.k.BLOCKED.background,a)})}),r.createElement(Cr.A,{description:r.createElement(q.sA,{id:"COMMON_NATIVE"}),indicator:r.createElement(_r.T,{color:(0,$e.oX)(Dr.k.UNTAGGED_NATIVE.background,a)})}),r.createElement(E.A,{flexGrow:1}),r.createElement(Er.A,{selectOnEnter:!0,value:c,tags:d,searchResults:A,onClear:(e,t)=>{u("")},onReset:()=>{u(""),h([])},onChange:(e,t)=>{u(t)},onAddTag:_,onRemoveTag:C,placeholder:d.length?"":o({id:"PORTS_VLANS_SECTION_SEARCH"}),maxResultsHeight:300}))),r.createElement(lt,null,r.createElement(Pr,{flexDirection:"column"},s.filter(e=>!d.length||d.map(e=>e.id).includes(e._id)).map(a=>r.createElement(xr,{flexDirection:"column",gap:m.YC,key:a._id},r.createElement(E.A,{justifyContent:"space-between",alignItems:"center"},r.createElement(F.A,{size:"medium",color:"text-2"},(0,Ar.gm)(a)),r.createElement(F.A,{size:"medium",color:"text-3"},(0,Ar.mC)(a))),r.createElement(yr,{network:a,rowLayouts:e,model:t,values:n,scale:l,spaceOffset:i}))))))},wr=(0,a.A)(E.A,(0,B.A)("background","border"))`
  position: relative;
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${m.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,Rr=(0,r.memo)(({nativeNetworkVlanId:e,isWanPort:t,portNumber:n,rowIndex:a})=>{const{themeName:o}=(0,H.u)(),{background:l,border:i,text:s}=t?Dr.k[gr.vL.WAN]:Dr.k[gr.vL.NATIVE];return r.createElement(hn.A,{key:`${n}-${a}`,description:r.createElement(Ir,{portNumber:n}),placement:0===a?"top":"bottom",delay:0,closeDelay:0},r.createElement(wr,{background:(0,$e.oX)(l,o),border:(0,$e.oX)(i,o)},t?r.createElement(xt.A,{size:"original",color:(0,$e.oX)(s,o)}):r.createElement(F.A,{size:"small",color:"text-1"},e)))}),kr=({rowLayouts:e,model:t,values:n})=>{const{sharedScale:a,sharedOffset:o}=Ae();return r.createElement(E.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},r.createElement(it,null,r.createElement(st,null,r.createElement(F.A,{size:"medium",weight:"bold",color:"text-1",style:{whiteSpace:"nowrap"}},r.createElement(q.sA,{id:"PORTS_VLANS_NATIVE_TITLE"})),r.createElement(hr.A,{description:r.createElement(pr.A,{messages:[["PORTS_VLANS_NATIVE_TITLE_DESC_1"],["PORTS_VLANS_NATIVE_TITLE_DESC_2"]]})}))),r.createElement(lt,null,r.createElement(dt,{scale:a,spaceOffset:o},r.createElement(nt,null,(e||[]).map((e,a)=>r.createElement(rt,{key:`PortDiagramLayoutRow-${a+1}`},e.map((e,o)=>{const l=`PortDiagramLayoutCell-${a+1}-${o+1}`;if(!e)return r.createElement(at,{key:l});const i=+(0,_e.Cu)({port_idx:e.portNumber},t),s=n.nativeNetwork[i];return s?r.createElement(Rr,{key:l,isWanPort:s[gr.dv.IS_WAN_PORT],nativeNetworkVlanId:s[gr.dv.DISPLAYED_VLAN_ID],isDisabled:s[gr.dv.IS_DISABLED],portNumber:i,rowIndex:a}):r.createElement(at,{key:l})})))))))},$r=(0,a.A)(E.A,(0,B.A)("isNarrow"))`
  flex-direction: column;
  gap: ${m.kc};
  padding-bottom: 3px;
  min-width: ${440}px;
  width: 100%;
  align-items: center;
  align-self: ${({isNarrow:e})=>e?"start":"center"};
`,Fr=()=>{const[e,t]=(0,r.useState)(!1),n=(0,r.useRef)(null),a=(0,M.useSelector)(w.w2),o=(0,M.useSelector)(ge.ID),l=(0,M.useSelector)(w.jv),i=(0,M.useSelector)(w.Sg),s=(0,r.useMemo)(()=>a[0]?o.find(e=>e.mac===a[0])??(0,cr.A)():(0,cr.A)(),[a,o]),c=(0,r.useMemo)(()=>{if(!l||0===i.length)return s;const e=i.find(e=>e.mac===a[0]);return e?((e,t)=>({...t,port_table:e.ports,ethernet_overrides:e.ethernet_overrides,model:e.model,name:e.name,type:e.type,mac:e.mac}))(e,s):s},[l,i,s,a]),m=c?.model,u=m?(0,Ce.j)(m).diagram??[]:[],d=(0,M.useSelector)(mr.wD),E=(0,M.useSelector)(ur.Tn),h=(0,M.useSelector)(ur.nT)?._id,p=(0,r.useMemo)(()=>(0,dr.Np)(c,d,E,h),[h,c,E,d]),A=u.length?(0,_e.sT)(u,c):(0,_e.oJ)(c);return(0,r.useEffect)(()=>{const e=n.current;if(!e)return;const r=new ResizeObserver(e=>{const[n]=e,{width:r}=n.contentRect;t(r<=440)});return r.observe(e),()=>{r.disconnect()}},[]),r.createElement($r,{ref:n,isNarrow:e,flexDirection:"column",paddingBottom:3,minWidth:440,width:"100%",alignItems:"center"},m?r.createElement(r.Fragment,null,r.createElement(kr,{rowLayouts:A,model:m,values:p}),r.createElement(Lr,{rowLayouts:A,model:m,values:p})):null)};var Ur=n(870189),Wr=n(762319),Vr=n(429252),Hr=n.n(Vr),zr=n(249304),Gr=n(318787),Br=n(29896),Yr=n(984297),Kr=n(905410),jr=n(440503),qr=n(368476),Xr=n(602021),Qr=n(200826),Jr=n(415246),Zr=n(742525),ea=n(509046),ta=n(396660),na=n(936621),ra=n(754363),aa=n(803676),oa=n(206683),la=n(544755),ia=n(5243),sa=n(939047),ca=n(77768),ma=n(350120),ua=n(110966);const da=({sfp_voltage:e})=>{const t=(0,M.useSelector)(Rt.zi),n=(0,ma.b)(e),a=(0,ua.L)(n||0,t,3);return r.createElement(ca.cp,{value:r.createElement(q.sA,{id:n?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_VOLTAGE":"COMMON_FALLBACK",values:{voltage:a}})})},Ea=["UBNT","Ubiquiti","UbiquitiNetworks"],ha=({sfp_vendor:e})=>{const t=Ea.includes(n=e)?"Ubiquiti Inc.":n;var n;return r.createElement(ca.cp,{value:t})},pa=({sfp_temperature:e})=>{const t=(0,M.useSelector)(Rt.zi),n=(0,ma.b)(e),a=(0,ua.L)(n||0,t,3);return r.createElement(ca.cp,{value:r.createElement(q.sA,{id:n?"DEVICE_PROPERTY_OVERVIEW_TEMPERATURE_VALUE":"COMMON_FALLBACK",values:{temperature:a}})})},Aa=({io_power:e})=>{const t=(0,M.useSelector)(Rt.zi),n=(0,ma.b)(e),a=(0,ua.L)(n||0,t,3);return r.createElement(ca.cp,{value:r.createElement(q.sA,{id:n?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_IO_POWER":"COMMON_FALLBACK",values:{power:a}})})},_a=({sfp_current:e})=>{const t=(0,M.useSelector)(Rt.zi),n=(0,ma.b)(e),a=(0,ua.L)(n||0,t,3);return r.createElement(ca.cp,{value:r.createElement(q.sA,{id:n?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_CURRENT":"COMMON_FALLBACK",values:{current:a}})})},Ca=['No SFP Inserted"',"Unknown"],ga=e=>Ca.includes(e)?void 0:e,fa=({sfp_compliance:e})=>r.createElement(ca.cp,{value:ga(e)}),Sa=e=>[{id:ra.d1.PORT,accessorFn:ta.Fo,maxSize:e?void 0:aa.ve,...e?ra.sP[ra.d1.PORT]:{size:aa.ve},header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.PORT]}),cell:({row:{original:t}})=>r.createElement(ia.A,{port:t,isInteractive:!1,showDevice:e}),compare:sa.o$},{id:ra.d1.NAME,accessorFn:ta.Fo,...ra.sP[ra.d1.NAME],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.NAME]}),cell:({row:{original:e}})=>r.createElement(ca.cp,{value:e.name,color:e.color}),compare:(0,ta.l0)(({name:e})=>e)},sa.QW,{id:ra.d1.NATIVE_VLAN,accessorFn:ta.Fo,...ra.sP[ra.d1.NATIVE_VLAN],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.NATIVE_VLAN]}),cell:({row:{original:e}})=>r.createElement(la.A,{nativeNetworkConfIdSubstituted:e.nativeNetworkConfIdSubstituted}),compare:(0,ta.l0)(({nativeNetworkConfIdSubstituted:e})=>e===na.F?-1/0:e)},{id:ra.d1.SPEED,accessorFn:ta.Fo,...ra.sP[ra.d1.SPEED],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.SPEED]}),cell:({row:{original:e}})=>r.createElement(oa.A,{speed:e.speed,autoneg:e.autoneg,up:e.up}),compare:(0,ta.l0)(({speed:e})=>e)},{id:ra.d1.VENDOR,accessorFn:ta.Fo,...ra.sP[ra.d1.VENDOR],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.VENDOR]}),cell:({row:{original:e}})=>r.createElement(ha,{sfp_vendor:e.sfp_vendor||void 0}),compare:(0,ta.l0)(({sfp_vendor:e})=>e)},{id:ra.d1.SERIAL,accessorFn:ta.Fo,...ra.sP[ra.d1.SERIAL],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.SERIAL]}),cell:({row:{original:e}})=>r.createElement(ca.cp,{value:e.sfp_serial||void 0}),compare:(0,ta.l0)(({sfp_serial:e})=>e)},{id:ra.d1.PART_NUMBER,accessorFn:ta.Fo,...ra.sP[ra.d1.PART_NUMBER],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.PART_NUMBER]}),cell:({row:{original:e}})=>r.createElement(ca.cp,{value:e.sfp_part||void 0}),compare:(0,ta.l0)(({sfp_part:e})=>e)},{id:ra.d1.COMPLIANCE,accessorFn:ta.Fo,...ra.sP[ra.d1.COMPLIANCE],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.COMPLIANCE]}),cell:({row:{original:e}})=>r.createElement(fa,{sfp_compliance:e.sfp_compliance||void 0}),compare:(0,ta.l0)(({sfp_compliance:e})=>ga(e||void 0))},{id:ra.d1.TEMPERATURE,accessorFn:ta.Fo,...ra.sP[ra.d1.TEMPERATURE],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.TEMPERATURE]}),cell:({row:{original:e}})=>r.createElement(pa,{sfp_temperature:e.sfp_temperature}),compare:(0,ta.l0)(({sfp_temperature:e})=>e)},{id:ra.d1.OUTPUT_POWER,accessorFn:ta.Fo,...ra.sP[ra.d1.OUTPUT_POWER],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.OUTPUT_POWER]}),cell:({row:{original:e}})=>r.createElement(Aa,{io_power:e.sfp_txpower}),compare:(0,ta.l0)(({sfp_txpower:e})=>e)},{id:ra.d1.INPUT_POWER,accessorFn:ta.Fo,...ra.sP[ra.d1.INPUT_POWER],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.INPUT_POWER]}),cell:({row:{original:e}})=>r.createElement(Aa,{io_power:e.sfp_rxpower}),compare:(0,ta.l0)(({sfp_rxpower:e})=>e)},{id:ra.d1.VOLTAGE,accessorFn:ta.Fo,...ra.sP[ra.d1.VOLTAGE],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.VOLTAGE]}),cell:({row:{original:e}})=>r.createElement(da,{sfp_voltage:e.sfp_voltage}),compare:(0,ta.l0)(({sfp_voltage:e})=>e)},{id:ra.d1.CURRENT,accessorFn:ta.Fo,...ra.sP[ra.d1.CURRENT],header:()=>r.createElement(q.sA,{id:ra.Cz[ra.d1.CURRENT]}),cell:({row:{original:e}})=>r.createElement(_a,{sfp_current:e.sfp_current}),compare:(0,ta.l0)(({sfp_current:e})=>e)}];var Ta=n(758649),Na=n(137625),Oa=n(774482);const va=(0,a.A)("div")`
  position: absolute;
  top: -${m.xO};
  bottom: -${m.xO};
  left: calc(100% - 400px); /* The restart confirm dialog width */
  right: 0;
`,Ia=(0,a.A)("div")`
  z-index: 1;
`,Da=(0,r.memo)(({port:e})=>{const{port_idx:t,device:n}=e,{mac:a,name:o}=n,l=(0,M.useDispatch)(),i=(0,M.useSelector)(w.qq),{resetPortStatistics:s}=(0,Oa.X)(),c=i.some(e=>e.deviceProperties?.mac===a),u=(0,$e.cd)(n.switch_caps?.feature_caps,n.deviceState),d=(0,$e.ug)(e),h=(0,$e.CQ)(e),[p,A]=(0,r.useState)(!1),_=(0,M.useSelector)((0,w.JX)(t,a)),[C,g]=(0,r.useState)(_),f=(0,r.useCallback)(()=>{l((0,v.Fx)({mac:a,name:o},t))},[l,a,o,t]),S=(0,r.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),g(!C),l((0,v.cj)({mac:a,name:n.name},[t],C))},[n.name,l,C,a,t]),T=(0,r.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),A(!0)},[]),N=(0,r.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),s(a,t,h)},[a,t,s,h]);return(0,r.useEffect)(()=>{g(_)},[_]),u||d||c?r.createElement(E.A,{padding:m.YC,gap:m.kc,position:"relative",onMouseLeave:p?()=>A(!1):void 0},d?r.createElement(Ia,null,r.createElement(Na.A,{title:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_TITLE",titleValues:{portId:t},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:A,handleConfirm:f,isOpen:p,rootClose:!0,body:r.createElement(F.A,{size:"inherit"},r.createElement(q.sA,{id:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_BODY",values:{portId:t}}))},r.createElement(E.A,{alignItems:"center"},r.createElement(Ta.A,{variant:"inline",onClick:T,type:"button",size:"medium"},r.createElement(q.sA,{id:"COMMON_POWER_CYCLE"}))))):null,u?r.createElement(Ia,null,r.createElement(Ta.A,{variant:"inline",onClick:S,type:"button",size:"medium"},r.createElement(q.sA,{id:C?"DEVICE_ACTIONS_LOCATE_STOP":"DEVICE_ACTIONS_LOCATE"}))):null,c?r.createElement(Ia,null,r.createElement(Ta.A,{variant:"inline",onClick:N,type:"button",size:"medium"},r.createElement(q.sA,{id:"COMMON_RESET_STATISTICS"}))):null,p?r.createElement(va,null):null):null}),Ma=e=>({})=>r.createElement(Da,{port:e});var ba;!function(e){e.CLASSIC="CLASSIC",e.SFP_ANALYZER="SFP_ANALYZER"}(ba||(ba={}));var Pa=n(733712),xa=n(720903),ya=n(750103);const La=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.t),n=(0,M.useSelector)(w.EW),a=(0,r.useCallback)(()=>{e((0,R.Ao)([]));const t=(0,xa.A)(sr.Fs);e((0,R.Ff)(t))},[e]),o=(0,r.useMemo)(()=>(0,ya.Kn)(t),[t]),l=(0,r.useMemo)(()=>(0,ir.Ac)(n),[n]),i=(0,r.useMemo)(()=>o&&l,[o,l]);return(0,r.useMemo)(()=>({areFiltersInitial:i,resetPortsFilters:a}),[i,a])},wa=({allPortsCount:e})=>{const{resetPortsFilters:t}=La(),n=(0,r.useMemo)(()=>r.createElement(Pa.A,e?{title:r.createElement(q.sA,{id:"COMMON_NO_MATCH"}),description:r.createElement(q.sA,{id:"PORTS_EMPTY_FILTER_NO_PORTS_DETAILS",values:{button:r.createElement(Ta.A,{type:"button",variant:"inline",onClick:t},r.createElement(q.sA,{id:"COMMON_RESET_THEM_BUTTON_TEXT"}))}})}:{title:r.createElement(q.sA,{id:"PORTS_TABLE_EMPTY_HEADER"})}),[e,t]);return r.createElement(E.A,{width:"100%",flexDirection:"column"},n)},Ra=ft.AH`
  div:has(> * > * > .${jr.k}) {
    overflow: visible;
  }
`,ka=(0,a.A)(E.A)`
  height: 100%;
  min-height: 400px;
  width: 100%;
  overflow: hidden;
  flex-direction: column;
  flex-grow: 1;
`,$a=ft.AH`
  overflow-x: scroll;
`,Fa={height:"unset",padding:"0",overflow:"unset"},Ua=Zr.W2[Jr.xz.TABLES][zr.l.PORTS].columns,Wa=(0,w.IS)([]),Va=new Set(Ur.qq),Ha=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<t.length;n+=1){const r=e[n],a=t[n];if(r!==a){if(r.id!==a.id)return!1;for(const e of Object.keys(a))if(!Va.has(e)){if("last_connection"===e){const e=r.last_connection,t=a.last_connection;if(e?.mac!==t?.mac||e?.connected!==t?.connected)return!1;continue}if((null!=r[e]||null!=a[e])&&!Hr()(r[e],a[e]))return!1}}}return!0},za=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),t=(0,H.u)(),{formatMessage:n}=(0,q.tz)(),a=(0,M.useSelector)(w.ZN),o=(0,M.useSelector)(w.vR),l=(0,M.useSelector)(w.UH),i=(0,M.useSelector)(w.O2),s=(0,M.useSelector)(w.cW),c=(0,M.useSelector)(w.yZ),u=(0,M.useSelector)(w.hb),{initialColumns:d}=(0,Qr.A)(zr.l.PORTS),E=(0,M.useSelector)(w.TP),h=(0,M.useSelector)(w.X5),p=(0,M.useSelector)(w.zD),A=(0,M.useSelector)(Xr.EL),_=(0,M.useSelector)(w.XS),C=(0,M.useSelector)(w.QR),g=(0,M.useSelector)(Wa,Ha),{setSelectedPortsAndAssignColors:f}=(0,ea.A)(),S=(0,M.useSelector)(w.oE),T=S?ba.SFP_ANALYZER:ba.CLASSIC,N=(0,M.useSelector)(w.x4),O=(0,M.useSelector)(Tr.D),v=(0,r.useMemo)(()=>{const e=O.find(e=>e.stacking&&e.peers.bottom===N||e.stacking&&e.peers.top===N);return e?.peers.top===N?e?.peers.bottom:e?.peers.top},[O,N]),[I,D]=(0,Br.A)(T===ba.CLASSIC?zr.l.PORTS:zr.l.SFP_PORTS),[b,P]=(0,Gr.A)(S?zr.l.SFP_PORTS:zr.l.PORTS),x=(0,r.useMemo)(()=>{if(A)return null;const e=new Map;for(const t of g)e.set(t.id,Ma(t));return e},[g,A]),y=(0,r.useMemo)(()=>{if(C)return g.map(e=>({...e,color:h.mode===qr.Mz.BY_PORT&&i.has(e.id)?p[e.id]:void 0,disabled:!1,_rowHoverContent:x?.get(e.id)}));const e=new Set(u.selectablePortsSingleSelection||[]);return g.map(t=>{const n=i.has(t.id),r=e.has(t.id),a=!(t.device.mac===N)&&!(t.device.mac===v)&&Boolean(N);return{...t,color:void 0,disabled:!n&&!r||a||_,_rowHoverContent:x?.get(t.id)}})},[C,g,h.mode,i,p,N,x,u.selectablePortsSingleSelection,v,_]),L=(0,r.useCallback)(t=>{C?f(t):e((0,R.Ao)(t))},[C,f,e]),k=(0,r.useCallback)(t=>{t.disabled||(C?f([t.id]):e((0,R.Ao)((0,$e.Um)(t.id))))},[C,f,e]),$=(0,r.useMemo)(()=>{const e=Ua.reduce((e,t)=>(e[t]=d.includes(t),e),{});return s||aa.lj.forEach(t=>{e[t]=!1}),c||aa.v0.forEach(t=>{e[t]=!1}),e},[s,c,d]),F=(0,r.useCallback)(t=>{e((0,R.DE)(t))},[e]),U=(0,r.useMemo)(()=>(0,sa.oE)(t,n,E),[t,n,E]),W=(0,r.useMemo)(()=>Sa(E),[E]),V=(0,r.useRef)(null),z=(0,r.useCallback)(({rowsPerPage:e,pageNumber:t})=>r.createElement(Wr.A,{ref:V,columns:T===ba.CLASSIC?U:W,columnVisibility:T===ba.CLASSIC?$:void 0,data:d?.length?y:[],initialColumnSize:I,onColumnSizingChange:D,multiSelectMode:!0,onChangeSelection:L,onRowClick:k,enableRowSelection:e=>!e.disabled,selection:l,isSelectAllVisible:C,rowStyle:m.gc,onSort:P,sorting:b,rowDisabledClassName:"",pageIndex:t,pageSize:e,className:`${Yr.E} ${Ra}`,withOverflow:!0,virtualizeColumn:!0,overscanColumn:1}),[T,U,W,$,d?.length,y,I,D,L,k,l,C,P,b]);return Boolean(g.length&&d?.length)?r.createElement(Kr.A,{itemCount:g.length,tableType:zr.l.SFP_PORTS,onRenderTable:z,onPageChanged:F,rowOptions:aa.j8,pageNumber:o,wrapperFlexProps:Fa,paginationTableContainerClassName:$a}):r.createElement(ka,null,r.createElement(Wr.A,{data:[],columns:U,columnVisibility:$,tableHeight:"auto",className:Yr.E,multiSelectMode:!0,isSelectAllVisible:!1}),r.createElement(wa,{allPortsCount:a}))});var Ga=n(189601),Ba=n(594827),Ya=n(460176),Ka=n(559639),ja=n(346010),qa=n(212401),Xa=n(656372),Qa=n(29069),Ja=n(495728),Za=n(511999);const eo=(0,Rn.Mz)(w._h,Xr.vc,(e,t)=>e.includes(t)),to=(0,Ga.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,Rn.Mz)(qa.Od,w.Ky,w._h,(e,t,n)=>{const r={data:{attrs:Xa.$r,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:n}};return(0,kn.JC)(qa.Pd,e,r)}),e=>e),no=(0,Ga.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,Rn.Mz)(qa.yN,w.Ky,w._h,(e,t,n)=>{const r={data:{attrs:Xa.Tj,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:n}};return(0,kn.JC)(qa.Zk,e,r)}),e=>e),ro=(0,Rn.Mz)(to,$n.kh),ao=(0,Rn.Mz)(no,$n.kh),oo=/(\d+)-(.+)/,lo=(0,Rn.Mz)(ro,ao,w.UH,eo,Ka.BG,w.QR,(e,t,n,r,a,o)=>{if(!n||0===n.length||!o)return[];const l=new Set(n),i=r?a.filter(e=>e.port_info?.port_idx).sort((e,t)=>e.id.localeCompare(t.id)):[],s=new Map;r&&t.length>0&&t.forEach((t,n)=>{if(!t)return;const r=e[n]?.oid;if(!r)return;const a={};i.forEach(({id:e,port_info:{port_idx:n}})=>{const o=(0,L.FS)(r,n);if(!l.has(o))return;const i=(0,Ya.X)(e);Za.M6.forEach(e=>{const n=t[`${i}-${e}`];null!=n&&(a[e]=(a[e]||0)+n)})}),s.set(n,a)});const c=new Map,m=new Map;e.forEach((e,t)=>{const n=e.oid,r=e.time;m.has(r)||m.set(r,e.duration);let a=c.get(r);a||(a={timestamp:r,tx_bytes:0,rx_bytes:0,tx_rate:0,rx_rate:0,tx_packets:0,rx_packets:0,tx_broadcast:0,rx_broadcast:0,tx_multicast:0,rx_multicast:0,tx_dropped:0,rx_dropped:0,tx_errors:0,rx_errors:0,poe_power:0,poe_energy:0},c.set(r,a)),Object.keys(e).forEach(t=>{const r=t.match(oo);if(r){const[,o,i]=r,s=(0,L.FS)(n,+o);l.has(s)&&void 0!==a[i]&&(a[i]+=e[t])}});const o=s.get(t);o&&Za.M6.forEach(e=>{void 0!==o[e]&&(a[e]+=o[e])})});const u=[];return c.forEach((e,t)=>{const n=m.get(t)||0;u.push({...e,tx_rate:(0,ja.tI)(e.tx_bytes,n),rx_rate:(0,ja.tI)(e.rx_bytes,n),poe_energy:e.poe_power*n/kt.$_})}),u.sort((e,t)=>e.timestamp-t.timestamp),u}),io=(0,Rn.Mz)(lo,e=>{const t=(e,t)=>e.reduce((e,n)=>(n[t]||0)+e,0);return{tx_bytes:t(e,"tx_bytes"),rx_bytes:t(e,"rx_bytes"),tx_rate:t(e,"tx_rate")/(e.length||1),rx_rate:t(e,"rx_rate")/(e.length||1),tx_packets:t(e,"tx_packets"),rx_packets:t(e,"rx_packets"),tx_broadcast:t(e,"tx_broadcast"),rx_broadcast:t(e,"rx_broadcast"),tx_multicast:t(e,"tx_multicast"),rx_multicast:t(e,"rx_multicast"),poe_power:t(e,"poe_power")/(e.length||1),poe_energy:t(e,"poe_energy"),tx_errors:t(e,"tx_errors"),rx_errors:t(e,"rx_errors"),tx_dropped:t(e,"tx_dropped"),rx_dropped:t(e,"rx_dropped")}}),so=(0,Rn.Mz)(ro,ao,w.UH,w.X5,eo,Ka.nB,w.QR,(e,t,n,r,a,o,l)=>{if(!n||0===n.length||!l)return[];const i=(0,Qa.Ol)(r),s=new Map;e.forEach((e,r)=>{const{duration:l,oid:c}=e,m=e.time,u=t[r];let d=s.get(m);d||(d={timestamp:m,duration:l,portsData:{}},s.set(m,d));for(let t=0;t<n.length;t+=1){const r=n[t],{deviceMac:s,portIdx:m}=(0,L.q9)(r);if(s===c){const t=o[m];if(a&&u&&t){const e=(0,Ba.si)(t.id);d.portsData[r]=i(u,e<2?"":e.toString(),l)}else d.portsData[r]=i(e,m,l)}}});const c=[];return s.forEach(({timestamp:e,duration:t,portsData:n})=>{c.push({timestamp:e,duration:t,...n})}),c.sort((e,t)=>e.timestamp-t.timestamp),c}),co=(0,Rn.Mz)(so,w.X5,(e,t)=>{const n=(0,Qa.gC)(t),r=Object.keys(e[0]||{}).filter(e=>"timestamp"!==e&&"duration"!==e);let a=e.reduce((e,n)=>{const a=r.reduce((e,r)=>{let a=n[r];return t.source===qr.I0.POE&&(a=a*n.duration/kt.$_),e+a},0);return e+a},0);return t.source===qr.I0.USAGE&&t.usage===qr.AM.BPS&&(a/=e.length||1),t.source===qr.I0.POE?{total:new Ja.U(a)}:{total:n(a)}});var mo=n(53509);const uo=(0,a.A)(F.A)`
  white-space: nowrap;
`,Eo=({summary:e})=>{const t=(0,H.u)();return r.createElement(E.A,{gap:m.kc,alignItems:"center",justifyContent:"end"},e.rx?r.createElement(uo,{size:"medium",style:{color:(0,Le.gB)(t)}},r.createElement(mo.A,null),e.rx.toString()):null,e.tx?r.createElement(uo,{size:"medium",style:{color:(0,Le.mN)(t)}},r.createElement(It.A,null),e.tx.toString()):null,e.total?r.createElement(uo,{size:"medium",color:"text-1"},e.total.toString()):null)};var ho=n(979106);const po=[{id:qr.AM.BPS,label:r.createElement(q.sA,{id:"COMMON_BPS"})},{id:qr.AM.BYTES,label:r.createElement(q.sA,{id:"COMMON_BYTES"})}],Ao=()=>{const e=(0,M.useDispatch)(),{usage:t}=(0,M.useSelector)(w.X5);return r.createElement(ho.A,{className:No,tabs:po,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,R.H4)({usage:t}))})(t),variant:"filter"})},_o=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.cW),{source:n}=(0,M.useSelector)(w.X5);((e,t)=>{const n=(0,M.useDispatch)();(0,r.useEffect)(()=>{e||t!==qr.I0.POE||n((0,R.H4)({source:Za.ON}))},[e,n])})(t,n);const a=(0,r.useMemo)(()=>[{id:qr.I0.PACKETS,label:r.createElement(q.sA,{id:"COMMON_PACKETS"})},{id:qr.I0.USAGE,label:r.createElement(q.sA,{id:"COMMON_USAGE"})},{id:qr.I0.POE,label:r.createElement(q.sA,{id:"COMMON_DEVICE_POE_MODE_POE"}),disabled:!t},{id:qr.I0.ERRORS,label:r.createElement(q.sA,{id:"COMMON_ERRORS"})},{id:qr.I0.DROPPED,label:r.createElement(q.sA,{id:"COMMON_DROPPED"})}],[t]);return r.createElement(ho.A,{className:No,tabs:a,selectedTab:n,onSelectTab:({id:t})=>(t=>{e((0,R.H4)({source:t}))})(t),variant:"filter"})},Co=[{id:qr.uO.ALL,label:r.createElement(q.sA,{id:"COMMON_ALL"})},{id:qr.uO.BROADCAST,label:r.createElement(q.sA,{id:"COMMON_STATUS_BROADCAST"})},{id:qr.uO.MULTICAST,label:r.createElement(q.sA,{id:"COMMON_MULTICAST"})}],go=()=>{const e=(0,M.useDispatch)(),{packets:t}=(0,M.useSelector)(w.X5);return r.createElement(ho.A,{className:No,tabs:Co,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,R.H4)({packets:t}))})(t),variant:"filter"})},fo=[{id:qr.Mz.AVERAGE,label:r.createElement(q.sA,{id:"COMMON_TOTAL"})},{id:qr.Mz.BY_PORT,label:r.createElement(q.sA,{id:"PORTS_BY_PORT"})}],So=()=>{const e=(0,M.useDispatch)(),{mode:t}=(0,M.useSelector)(w.X5);return r.createElement(ho.A,{className:No,tabs:fo,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,R.H4)({mode:t}))})(t),variant:"filter"})},To=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.X5),{direction:n,source:a}=t,o=(0,r.useMemo)(()=>{const e=a===qr.I0.ERRORS||a===qr.I0.DROPPED;return[{id:qr.O_.ALL,label:r.createElement(q.sA,{id:"COMMON_ALL"})},{id:qr.O_.DOWNLINK,label:r.createElement(q.sA,{id:e?"COMMON_RECEIVE":"COMMON_DOWNLOAD"})},{id:qr.O_.UPLINK,label:r.createElement(q.sA,{id:e?"COMMON_TRANSMIT":"COMMON_UPLOAD"})}]},[a]);return r.createElement(ho.A,{className:No,tabs:o,selectedTab:n,onSelectTab:({id:t})=>(t=>{e((0,R.H4)({direction:t}))})(t),variant:"filter"})},No=ft.AH`
  flex: unset;
  width: auto;
  flex-shrink: 0;
`,Oo=({summary:e})=>{const{source:t}=(0,M.useSelector)(w.X5);return r.createElement(E.A,{gap:m.kc,overflow:"auto"},r.createElement(So,null),r.createElement(_o,null),t===qr.I0.PACKETS?r.createElement(go,null):null,t===qr.I0.USAGE?r.createElement(Ao,null):null,t!==qr.I0.POE?r.createElement(To,null):null,r.createElement(E.A,{flexGrow:1}),r.createElement(Eo,{summary:e}))};var vo=n(936344),Io=n(853699),Do=n(195462),Mo=n(584916),bo=n(66706),Po=n(112142),xo=n(501103),yo=n(445772);const Lo={Bytes:(0,a.A)(F.A)`
    color: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-aqua-06-${e}`]};
  `,Icon:void 0},wo=(0,a.A)(E.A)`
  flex-direction: column;
  padding-bottom: ${m.kc};
  border-bottom: 1px solid ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-10-${e}`]};
`,Ro=(0,a.A)(E.A)`
  g {
    transition: unset;
  }
`,ko=(0,a.A)("div",(0,B.A)("color"))`
  width: ${m.kc};
  height: ${m.kc};
  background: ${({color:e})=>e};
`,$o=(0,a.A)(E.A,(0,B.A)("columnCount"))`
  display: grid;
  grid-template-columns: repeat(${({columnCount:e})=>e}, 1fr);
  column-gap: ${m.S2};
  width: 100%;
`,Fo=({portIdx:e,value:t,graphDataSeries:n,color:a})=>{const o=n.getFormattedValue(t);return r.createElement(E.A,{justifyContent:"space-between",alignItems:"baseline",width:"100%",gap:m.YC},r.createElement(E.A,{gap:m.YC,alignItems:"center"},r.createElement(ko,{color:a}),r.createElement(F.A,{size:"small",color:"text-2"},r.createElement(q.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e}}))),r.createElement(F.A,{size:"small"},o.toString()))},Uo=({value:e,direction:t,source:n,graphDataSeries:a})=>{const o=(0,r.useMemo)(()=>((e,t)=>e===qr.I0.POE?Lo:t===qr.O_.UPLINK?xo.A:yo.A)(n,t),[t,n]),l=(0,r.useMemo)(()=>((e,t)=>e===qr.I0.POE?"COMMON_POWER":e===qr.I0.ERRORS||e===qr.I0.DROPPED?t===qr.O_.UPLINK?"COMMON_TRANSMIT":"COMMON_RECEIVE":t===qr.O_.UPLINK?"COMMON_UPLOAD":"COMMON_DOWNLOAD")(n,t),[t,n]),i=a.getFormattedValue(e);return r.createElement(E.A,{justifyContent:"space-between",width:"100%"},r.createElement(F.A,{size:"small",color:"text-2"},r.createElement(q.sA,{id:l})),r.createElement(E.A,null,o.Icon?r.createElement(o.Icon,null):null,r.createElement(o.Bytes,{size:"small"},i.toString())))},Wo=({hidden:e,top:t,left:n,x:a,chartWidth:o,chartHeight:l,selfHourCycle:i,tooltipPropsCollection:s,showDateWithTime:c,language:u,graphDataSeries:d,settings:h,gradientColor:p,graphDataCollection:A,seriesIndex:_,duration:C})=>{const{mode:g}=h,{themeName:f}=(0,H.u)(),S=(0,M.useSelector)(w.zD),T=(0,r.useMemo)(()=>(e=>{switch(e){case qr.I0.POE:return r.createElement(q.sA,{id:"COMMON_POWER"});case qr.I0.PACKETS:return r.createElement(q.sA,{id:"COMMON_PACKETS"});case qr.I0.USAGE:return r.createElement(q.sA,{id:"COMMON_USAGE"});case qr.I0.ERRORS:return r.createElement(q.sA,{id:"COMMON_ERRORS"});case qr.I0.DROPPED:return r.createElement(q.sA,{id:"COMMON_DROPPED"});default:return null}})(h.source),[h.source]),N=(0,r.useMemo)(()=>Object.values(A).find(e=>e.timestamp===a),[A,a]),O=(0,r.useMemo)(()=>{const e=n<Math.round(o/2);return{left:Math.round(n+(e?8:-8)),top:Math.round(t),position:e?"rightTop":"leftTop"}},[n,t,o]),v=(0,r.useMemo)(()=>((e,t,n,r,a)=>{const o=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",...n&&{hour:"numeric",minute:"numeric",hourCycle:r}}).format(e);return a?`${o} - ${new Intl.DateTimeFormat(t,n?{hour:"numeric",minute:"numeric",hourCycle:r}:{day:"numeric",month:"short",year:"numeric"}).format(a)}`:o})(a,u,c,i,a+Number(C||0)),[a,u,c,i,C]),I=(0,r.useMemo)(()=>N?g===qr.Mz.BY_PORT?((e,t,n)=>r.createElement($o,{columnCount:Math.ceil(Object.values(e.data).length/18)},Object.values(e.data).sort((e,t)=>(0,L.q9)(e.key).portIdx-(0,L.q9)(t.key).portIdx).map(a=>{const o=t[a.key],l=n[a.key],{portIdx:i}=(0,L.q9)(a.key);return r.createElement(Fo,{key:a.key,value:o,color:l,graphDataSeries:e,portIdx:i})})))(d,N,S):((e,t,n)=>{const a=e.data.series1,o=e.data.series2,l=o&&t[o.key];return r.createElement(E.A,{flexDirection:"column",gap:m.YC},a?r.createElement(Uo,{direction:qr.O_.UPLINK,graphDataSeries:e,value:a&&t[a.key],source:n}):null,o?r.createElement(Uo,{direction:qr.O_.DOWNLINK,graphDataSeries:e,value:l,source:n}):null)})(d,N,h.source):null,[N,d,g,h.source,S]),D=(0,r.useMemo)(()=>r.createElement(Ro,{position:"absolute",top:0,left:0},r.createElement("svg",{width:o,height:l},n&&t?r.createElement(bo.A,{hasAnimation:!1,x:n,y:Math.round(t),color:p,innerRadius:4,outterRadius:8}):null)),[l,o,p,n,t]),b=(0,r.useMemo)(()=>{const e=Math.min(t,s.min);return{top:e,height:Math.max(t,s.max)-e,left:n-1}},[t,s,n]);return 0===_?r.createElement(r.Fragment,null,r.createElement(Po.A,{hidden:e,left:O.left,top:O.top,topMargin:4,width:"auto",tooltipProps:{maxWidth:"auto",position:O.position},description:r.createElement(E.A,{flexDirection:"column",gap:m.kc,whiteSpace:"nowrap"},r.createElement(wo,null,r.createElement(F.A,{color:"text-1",weight:"bold",size:"medium"},T),r.createElement(F.A,{color:"text-3",size:"small"},v)),r.createElement(E.A,{flexDirection:"column"},I))}),r.createElement(E.A,{zIndex:1,width:1,borderLeft:`2px dashed ${$.Ay[`desktop-color-neutral-04-${f}`]}`,top:b.top,height:b.height,left:b.left,position:"absolute"}),D):D};var Vo=n(831743);const Ho=({graphDataCollection:e,graphDataKey:t,getCoordinates:n,mouseData:a,maxY:o,tooltipContainer:l,seriesIndex:i,renderTooltip:s})=>{const c=(0,H.u)(),{mode:m}=(0,M.useSelector)(w.X5),u=(0,M.useSelector)(w.zD),d=(e=>`${e}GradientId`)(t),E=m===qr.Mz.AVERAGE?((e,t)=>e.includes("rx")||e.includes("poe_power")?(0,Le.gB)(t):(0,Le.mN)(t))(t,c):u[t]||(0,Le.mN)(c),h=(0,r.useMemo)(()=>e.map(({timestamp:e,...n})=>({x:e,y:n[t]})),[e,t]),p=(0,r.useCallback)(()=>r.createElement("defs",null,r.createElement("linearGradient",{id:d,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},r.createElement("stop",{offset:"0%",stopColor:E,stopOpacity:.5}),r.createElement("stop",{offset:"100%",stopColor:E,stopOpacity:.1}))),[d,E]),A=(0,r.useCallback)(e=>s?s(e,E,i):void 0,[s,E,i]);return r.createElement(Vo.A,{data:h,maxY:o,mouseData:a,getCoordinates:n,lineColor:E,variant:m===qr.Mz.AVERAGE?"gradientArea":"line",interpolation:"linear",allowCustomDots:!0,tooltipPortal:l?l.current:void 0,customGradientId:d,renderCustomGradient:p,renderTooltip:A})};var zo=n(874816);const Go=(0,a.A)(E.A,(0,B.A)("chartWidth","preset"))`
  #x-labels > g:last-child {
    ${({preset:e,chartWidth:t})=>!e&&`transform: translateX(${t-45}px) !important;`}
  }
`,Bo=({graphDataCollection:e=[],graphDataSeries:t,graphContainerHeight:n})=>{const{formatMessage:a}=(0,q.tz)(),{width:o}=(0,G.Ay)(),l=(0,r.useRef)(null),i=(0,r.useRef)({min:0,max:0,left:0}),{ref:s,width:c=0}=(0,ct.A)(),{startDate:m,endDate:u,preset:d}=(0,M.useSelector)(w.Ky),h=(0,M.useSelector)(ut.jc),p=(0,M.useSelector)(ut.BQ),A=(0,M.useSelector)(Xr.hq),_=(0,M.useSelector)(Rt.zi),C=(0,M.useSelector)(w.X5),g=(0,M.useSelector)(w.UH),f=(0,r.useMemo)(()=>(0,Io.$V)(m,u,!0,!0),[u,m]),S=(0,r.useMemo)(()=>(0,Xa.Io)(m,u),[u,m]),T=(0,Io.Vi)(S,a),N=(0,r.useMemo)(()=>Math.floor(Math.abs(new Date(u).getTime()-new Date(m).getTime())/kt.jU),[m,u]),O=n<400,v=(0,r.useMemo)(()=>{let n=1;const r=Object.values(t.data).map(e=>e.key);return e.forEach(e=>{Object.keys(e).forEach(t=>{"timestamp"!==t&&"number"==typeof e[t]&&r.includes(t)&&(n=Math.max(n,e[t]))})}),t.getFormattedValue(n)},[e,t]),I=(0,r.useMemo)(()=>!(C.source===qr.I0.USAGE&&C.usage===qr.AM.BPS)&&C.source!==qr.I0.POE&&C.source!==qr.I0.ERRORS&&C.source!==qr.I0.DROPPED,[C.usage,C.source]),D=(0,r.useCallback)(({hidden:a,left:o=0,top:l=0,x:s=0,y:m},u,d)=>(i.current={min:i.current.left===o?Math.min(l,i.current.min):l,max:i.current.left===o?Math.max(l,i.current.max):l,left:o},r.createElement(Wo,{hidden:a,left:o,top:l,tooltipPropsCollection:i.current,x:s,y:m,duration:f.grain,chartHeight:n,chartWidth:c,selfHourCycle:p,settings:C,showDateWithTime:N<=7,language:_,graphDataSeries:t,gradientColor:u,graphDataCollection:e,seriesIndex:d})),[f.grain,n,c,p,C,N,_,t,e]),b=(0,r.useMemo)(()=>((e,t)=>{const n=Math.ceil((t-e)/36e5),r=n/24;return(n=>(0,Do.v)([e,t],zo.P[n].frequency(o,N)).map((e,t)=>({label:zo.P[n].label({index:t,value:e,selfHourCycle:p,selfUse24HourTime:h,documentWidth:o,siteTimezone:A,language:_,formatMessage:a}),value:e})))(null===d||d===Mo.l.ONE_DAY&&n<13||d===Mo.l.ONE_WEEK&&r<5||d===Mo.l.ONE_MONTH&&r<10?Mo.j:d)})(e[0]?.timestamp||m.getTime(),e.length>1&&e.at(-1)?.timestamp||u.getTime()),[e,p,h,m,u,d,A,_,o,N,a]),P=(0,r.useMemo)(()=>{return e=v.bytes,(0,Do.Y)(Math.ceil(e+1/(O?5:10)*e),O?6:11);var e},[v.bytes,O]),x=(0,r.useCallback)(({value:e},n)=>{if(n!==(O?5:10))return`${t.getFormattedValue(+e,v.power).value.toFixed(1)}`},[v.power,t,O]),y=(0,r.useCallback)((n,a,o)=>r.createElement(r.Fragment,null,Object.keys(t.data).map((i,s)=>{const{key:c,label:m}=t.data[i];return r.createElement(Ho,{key:c,graphDataCollection:e,graphDataKey:c,graphDataLabel:m,getCoordinates:n,mouseData:a,maxY:o,tooltipContainer:l,renderTooltip:D,seriesIndex:s})})),[t.data,e,D]);return r.createElement(Go,{width:"100%",position:"relative",preset:d,chartWidth:c},r.createElement(E.A,{width:"100%",position:"relative",ref:s},r.createElement(vo.A,{xAxis:b,yAxis:P,width:c,yAxisTitle:I?`${v.unit} / ${T}`:v.unit,height:n,renderYLabel:x},g.length?y:void 0)),r.createElement("div",{ref:l}))},Yo=({settings:e})=>{const t=(0,M.useSelector)(w.UH),n=(0,M.useSelector)(so),a=(0,M.useSelector)(co),o=(0,Qa.IK)(t,e);return r.createElement(r.Fragment,null,r.createElement(Oo,{summary:a}),r.createElement(Bo,{graphDataCollection:n,graphDataSeries:o,graphContainerHeight:Za.F$}))},Ko=({settings:e})=>{const t=(0,M.useSelector)(io),n=(0,M.useSelector)(lo),a=(0,Qa.Gz)(t,e);return r.createElement(r.Fragment,null,r.createElement(Oo,{summary:a.summary}),r.createElement(Bo,{graphDataCollection:n,graphDataSeries:a,graphContainerHeight:Za.F$}))},jo=(0,a.A)(E.A)`
  flex-direction: column;
  width: 100%;
  border-radius: ${m.YC};
`,qo=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w._h),n=(0,M.useSelector)(w.Ky),a=(0,M.useSelector)(w.X5),o=(0,M.useSelector)(eo),[l,i]=(0,r.useState)([]),[s,c]=(0,r.useState)(null),[m,u]=(0,r.useState)(null),{startDate:d,endDate:E}=n,h=(0,r.useMemo)(()=>!(!t.length||(0,P.L)(l,t)&&d===s&&E===m),[l,t,d,s,E,m]);return(0,r.useEffect)(()=>{h&&(i(t),c(d),u(E),e((0,R.qV)({deviceMacs:t,dateRange:{startDate:d,endDate:E,preset:n.preset},isGatewaySelected:o})))},[h,e,d,E,t,o,n.preset]),r.createElement(jo,null,r.createElement(a.mode===qr.Mz.AVERAGE?Ko:Yo,{settings:a}))});var Xo=n(363370),Qo=n(959341),Jo=n(293016);const Zo=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.OA),{type:n,id:a}=(0,r.useMemo)(()=>(0,ir.Se)(t),[t]),o=n===Jo.F7.MC_LAG,l=n===Jo.F7.STACKING_GROUP,i=(0,r.useMemo)(()=>a?`${Qo.Rm}/${a}`:Qo.Rm,[a]),s=(0,r.useMemo)(()=>a?`${Qo.vc}/${a}`:Qo.vc,[a]),c=(0,M.useSelector)(w.Hd),u=(0,M.useSelector)(w.hb),d=(0,M.useSelector)(w.UH),h=(0,M.useSelector)(w.XS),p=(0,r.useCallback)(()=>{e((0,R.Ao)([]))},[e]),A=(0,r.useCallback)(()=>{e((0,R.Ao)([d,u.selectablePortsBulkSelection].flat()))},[e,u.selectablePortsBulkSelection,d]),_=!u.selectablePortsBulkSelection.length,C=(0,r.useCallback)(()=>{e((0,R.xj)(!c))},[e,c]);return r.createElement(E.A,{gap:m.kc,alignItems:"center"},o?r.createElement(Xo.A,{to:i,size:"small"},r.createElement(q.sA,{id:"PORTS_EDIT_MC_LAG"})):null,l?r.createElement(Xo.A,{to:s,size:"small"},r.createElement(q.sA,{id:"PORTS_EDIT_STACKING"})):null,d.length?r.createElement(Ta.A,{size:"small",type:"button",variant:"inline",onClick:p},r.createElement(q.sA,{id:"COMMON_ACTION_DESELECT_ALL"})):null,_||h?null:r.createElement(Ta.A,{size:"small",type:"button",variant:"inline",onClick:A},r.createElement(q.sA,{id:"COMMON_ACTION_SELECT_ALL"})),r.createElement(Ta.A,{size:"small",type:"button",variant:"inline",onClick:C},r.createElement(q.sA,{id:c?"PORTS_SHOW_CONNECTED_DEVICES":"PORTS_HIDE_CONNECTED_DEVICES"})))},el=(0,a.A)(E.A)`
  gap: ${m.Ln};
  height: 100%;
  overflow: hidden;
`,tl=(0,a.A)("div")`
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  height: 100%;
`,nl=(0,a.A)("div")`
  container-type: inline-size;
`,rl=(0,a.A)("div")`
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: ${m.YC};

  > :nth-child(2) {
    flex-wrap: nowrap;
  }

  @container (max-width: 950px) {
    grid-template-columns: 1fr;

    > :first-child {
      order: 1;
    }

    > :nth-child(2) {
      flex-wrap: wrap;
    }
  }
`,al=(0,r.memo)(()=>{const e=(0,M.useSelector)(w.w2),t=(0,M.useSelector)(w.tI),n=(0,M.useSelector)(w.OA),a=(0,M.useSelector)(w.Mi),o=(0,M.useSelector)(w.QR),l=(0,M.useSelector)(w.$X),i=(0,M.useSelector)(w.kq),s=(0,M.useSelector)(w.Hz);(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.QR),n=(0,M.useSelector)(w.Bt)||(0,x.A)(),a=(0,M.useSelector)(w.Fk),o=(0,M.useSelector)(w.UH),l=(0,y.A)(o);(0,r.useEffect)(()=>{if(!(0,P.L)(o,l)&&!t){const t=o.filter(e=>!l?.includes(e))||[],r=l?.filter(e=>!o.includes(e))||[],i=new Set,s=new Set;t.forEach(e=>{const{aggregationGroup:t,device:r}=n.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(a){const t=n.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==r.mac);t&&i.add({...t.aggregationGroup,deviceMac:t.device.mac})}i.add({...t,deviceMac:r.mac})}}),r.forEach(e=>{const{aggregationGroup:t,device:r}=n.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(a){const t=n.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==r.mac);t&&s.add({...t.aggregationGroup,deviceMac:t.device.mac})}s.add({...t,deviceMac:r.mac})}});const c=Array.from(i).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,L.FS)(t.deviceMac,e))],[]),m=Array.from(s).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,L.FS)(t.deviceMac,e))],[]);let u=[...o].filter(e=>!m.includes(e));u=new Array(...new Set([...u,...c])),0===u.length&&1===o.length&&(u=[...o]),(0,P.L)(u,o)||e((0,R.Ao)(u))}},[o,l,e,t,a,n])})(),(0,b.A)(t),(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.OA),n=(0,M.useSelector)(w.Jm);(0,r.useEffect)(()=>{e((0,R.U)(t))},[e]),(0,r.useEffect)(()=>n?(e((0,R.gU)(!1)),()=>null):()=>{e((0,lr.p)(!1)),e((0,R.Ao)([]))},[e])})(),(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.$X),n=(0,M.useSelector)(w.wJ),a=(0,$e.Ki)(n);(0,r.useEffect)(()=>{!a&&t&&e((0,R.JL)(!1))},[a,t,e])})(),((e,t)=>{const n=(0,M.useDispatch)();(0,r.useEffect)(()=>{if(e.length>0&&t&&t!==sr.Zt&&!e.find(e=>e.value===t)){const{deviceMacs:r}=(0,ir.Se)(t),a=e.find(e=>r.some(t=>e.includeDevices?.includes(t)));a?(n((0,R.U)(a.value)),n((0,R.gU)(!0))):n((0,R.U)(sr.Zt))}},[e,t,n])})(a,n),(()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(mt.WS),n=(0,M.useSelector)(mt.it),a=(0,M.useSelector)(w.QR);(0,r.useEffect)(()=>{t&&n!==Z.H.PORTS&&!a&&e((0,R.Ao)([]))},[e,t,n,a])})();const c=r.createElement(pe,null,t&&i?r.createElement(E.A,{flexDirection:"column"},l?r.createElement(E.A,{minHeight:"34px"}):r.createElement(ce,null),r.createElement(E.A,{flexDirection:"column",gap:m.kc},e.map((t,n)=>r.createElement(gt,{key:t,deviceMac:t,isFirst:0===n,showDeviceName:e.length>1})),r.createElement(nl,null,r.createElement(rl,null,r.createElement("div",null,l?null:r.createElement(Zo,null)),r.createElement(_r.A,{isSingleLine:!0,deviceMac:t}))))):null,o?r.createElement(qo,null):null,l?r.createElement(Fr,null):null,l?null:r.createElement(Ur.uA,null,r.createElement(za,null)));return s&&e.length>0?r.createElement(el,null,r.createElement(or,null),r.createElement(tl,null,c)):c});var ol=n(231755),ll=n(736388),il=n(264863),sl=n(436017),cl=n(191568);const ml=()=>{const{handleVlansChange:e}=(0,cl.x)(),t=(0,M.useSelector)(w.$X),n=(0,r.useCallback)(t=>{e(t.target.checked)},[e]);return r.createElement(sl.A,{onChange:n,checked:t,full:!0,size:"small"},r.createElement(F.A,{weight:"bold",size:"small",color:"text-1"},r.createElement(q.sA,{id:"PORTS_VLANS_DIAGRAM"})))},ul=()=>{const{handleTimeMachineChange:e}=(0,cl.x)(),t=(0,M.useSelector)(w.Hz),n=(0,r.useCallback)(t=>{e(t.target.checked)},[e]);return r.createElement(sl.A,{onChange:n,checked:t,full:!0,size:"small"},r.createElement(F.A,{weight:"bold",size:"small",color:"text-1"},r.createElement(q.sA,{id:"PORTS_TIME_MACHINE"})))},dl=()=>{const{handleStatsChange:e}=(0,cl.x)(),t=(0,M.useSelector)(w.QR),n=(0,r.useCallback)(t=>{e(t.target.checked)},[e]);return r.createElement(sl.A,{onChange:n,checked:t,full:!0,size:"small"},r.createElement(F.A,{weight:"bold",size:"small",color:"text-1"},r.createElement(q.sA,{id:"COMMON_STATS"})))},El=()=>{const{handleDeviceDiagramChange:e}=(0,cl.x)(),t=(0,M.useSelector)(w.kq),n=(0,r.useCallback)(t=>{e(t.target.checked)},[e]);return r.createElement(sl.A,{onChange:n,checked:t,full:!0,size:"small"},r.createElement(F.A,{weight:"bold",size:"small",color:"text-1"},r.createElement(q.sA,{id:"PORTS_PORT_DIAGRAM"})))};var hl=n(594767),pl=n(861878),Al=n(17441),_l=n(9535),Cl=n(445054),gl=n(580176),fl=n(318195),Sl=n(974333);const Tl=ft.AH`
  display: none;
`,Nl=r.createElement(E.A,{alignItems:"center"},r.createElement(ue.A,{size:"medium",color:"inherit"},r.createElement(q.sA,{id:"COMMON_RESET_STATISTICS"})),r.createElement(Sl.A,null)),Ol=()=>{const{formatMessage:e}=(0,q.tz)(),t=(0,M.useSelector)(w.aq),{mac:n,port_table:a}=t||{},[o,l]=(0,r.useState)([]),{resetPortStatistics:i}=(0,Oa.X)(),s=(0,r.useCallback)(e=>{const t=e.map(e=>i(n,Number(e),(0,$e.CQ)(a?.find(t=>t.port_idx===Number(e)))));Promise.all(t),l([])},[n,a,i]),c=(0,r.useMemo)(()=>a.map(e=>({label:e.name,value:e.port_idx,id:e.port_idx})),[a]),m=(0,r.useCallback)(e=>{e&&l(c.map(({value:e})=>e))},[c]),u=(0,r.useCallback)((e,t)=>{l(e?[...o,t]:o.filter(e=>e!==t))},[o]),d=(0,r.useCallback)(e=>{l(e?c.map(({value:e})=>e):[])},[c]);return r.createElement(fl.A.Popover,{options:c,onSave:s,value:o,onOpenChange:m,searchPlaceholder:e({id:"COMMON_SEARCH"}),saveButtonText:e({id:"COMMON_ACTION_RESET"}),cancelButtonText:e({id:"COMMON_ACTION_CANCEL"}),onOptionCheck:u,onChangeSelectAll:d,saveButtonProps:{disabled:0===o.length},renderToggle:()=>r.createElement(fl.A.Trigger,{options:c,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:Nl,chipContainerClassName:Tl})})},vl=({options:e})=>{const[t,n]=(0,r.useState)([]),a=(0,M.useSelector)(ge.ID),o=(0,r.useRef)(a),{resetSwitchStatistics:l}=(0,Oa.X)(),i=(0,r.useCallback)(t=>{const r=[];t.forEach(t=>{const n=e.find(e=>e.value===t);if(!n)return;const{includeDevices:a}=n;a.forEach(e=>{const t=o.current?.find(t=>t.mac===e);if(!t)return;const{name:n}=t;r.push(l(`${e}`,n,t.port_table||[]))})}),Promise.all(r),n([])},[e,l]),{formatMessage:s}=(0,q.tz)(),c=(0,r.useCallback)(t=>{t&&n(e.map(e=>e.value))},[e]),m=(0,r.useCallback)((e,r)=>{n(e?[...t,r]:t.filter(e=>e!==r))},[t]),u=(0,r.useCallback)(t=>{n(t?e.map(({value:e})=>e):[])},[e]);return r.createElement(fl.A.Popover,{options:e,onSave:i,onOpenChange:c,value:t,onOptionCheck:m,onChangeSelectAll:u,searchPlaceholder:s({id:"COMMON_SEARCH"}),saveButtonText:s({id:"COMMON_ACTION_RESET"}),cancelButtonText:s({id:"COMMON_ACTION_CANCEL"}),saveButtonProps:{disabled:0===t.length},renderToggle:()=>r.createElement(fl.A.Trigger,{options:e,value:t,onChange:i,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:Nl,chipContainerClassName:Tl})})},Il=()=>{const e=(0,M.useSelector)(w.tI),t=(0,M.useSelector)(w.qq);return e&&0!==t.length?t.some(({includeDevices:t})=>t.includes(e))?r.createElement(Ol,null):r.createElement(vl,{options:t}):null},Dl=()=>{const e=(0,M.useDispatch)(),{formatList:t}=(0,q.tz)(),n=(0,M.useSelector)((0,w.IS)([])),a=(0,r.useMemo)(()=>{const e={};return n.forEach(t=>{const{mac:n}=t.device;e[n]||(e[n]=!0)}),Object.keys(e)},[n]),o=(0,M.useSelector)((0,ge.nH)(a)).map(({mac:e,name:t,locating_ports:r})=>({mac:e,name:t,locatingPorts:r?.filter(t=>n.find(n=>n.device.mac===e&&n.port_idx===t))||[]})).filter(({locatingPorts:e})=>e.length>0),l=(0,r.useCallback)(()=>{const n=o.map(({mac:n,locatingPorts:r,name:a})=>e((0,v.cj)({mac:n,name:a},r,!0,t(r))));Promise.all(n)},[e,t,o]);return 0===o.length?null:r.createElement(Ta.A,{type:"button",size:"medium",variant:"inline",onClick:l},r.createElement(q.sA,{id:"DEVICE_ACTIONS_LOCATE_STOP"}))},Ml=()=>r.createElement(E.A,{width:"100%",alignItems:"center",gap:m.kc},r.createElement(Il,null),r.createElement(Dl,null));var bl;!function(e){e.PORTS="ports"}(bl||(bl={}));const Pl=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),{areFiltersInitial:t,resetPortsFilters:n}=La(),a=(0,M.useSelector)(w.oE),o=(0,Cl.A)({leftFilterPageId:i.g1.PORT_MANAGEMENT,leftFilterColumnsId:bl.PORTS}),l=(0,r.useCallback)(()=>{e((0,gl.GD)({leftFilterPageId:i.g1.PORT_MANAGEMENT,leftFilterColumnsId:bl.PORTS}))},[e]);return r.createElement(Al.A,null,r.createElement(Ml,null),r.createElement(_l.A,{onClear:n,disabled:t}),a?null:r.createElement(pl.A,{onPress:l,labelId:"COMMON_CUSTOMIZE_COLUMNS",disabled:o}))});var xl=n(149188),yl=n(664967),Ll=n(992149);const wl=[yl.E[Mo.l.ONE_DAY],yl.E[Mo.l.ONE_WEEK],yl.E[Mo.l.ONE_MONTH]],Rl=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.Ky),n=(0,r.useCallback)(t=>{e((0,R.m$)(t))},[e]),[a,o]=(0,r.useState)({startDate:t.startDate,endDate:t.endDate}),l=(0,r.useCallback)(({id:e})=>{const t=wl.find(t=>t.id===e);t?n({...t.getRange(new Date),preset:e}):a&&n({...a,preset:Mo.j})},[a,n]),i=(0,r.useMemo)(()=>wl.map(({id:e,message:t,messageValues:n})=>({id:e,label:r.createElement(q.sA,{id:t,values:n})})).concat({id:Mo.j,label:r.createElement(xl.A,null)}),[]),s=(0,r.useCallback)(e=>{o(e),n({...e,preset:Mo.j})},[n]);return r.createElement(Ll.A,{presets:i,selectedPreset:t.preset,range:a,onSelectTab:l,onSelectCustomRange:s,showCalendar:t.preset===Mo.j})};var kl=n(312583);const $l=(0,r.memo)(()=>{const e=(0,M.useSelector)(w.cW),t=(0,M.useSelector)(w.yZ),n=(0,r.useMemo)(()=>Object.values(aa.YH).filter(n=>!(!e&&aa.lj.includes(n)||!t&&aa.v0.includes(n))),[e,t]);return r.createElement(kl.A,{leftFilterPageId:i.g1.PORT_MANAGEMENT,columns:n,columnLabels:aa.Fi,tableType:zr.l.PORTS})});var Fl=n(895),Ul=n(773033),Wl=n(727678),Vl=n(613046),Hl=n(128989);const zl={[Jo.fA.AVAILABLE]:"COMMON_NOT_CONNECTED",[Jo.fA.IN_USE]:"COMMON_IN_USE",[Jo.fA.CRITICAL]:"COMMON_CRITICAL",[Jo.fA.WARNING]:"COMMON_WARNING"},Gl={[Jo.fA.IN_USE]:1,[Jo.fA.AVAILABLE]:2,[Jo.fA.CRITICAL]:3,[Jo.fA.WARNING]:4},Bl=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),{formatMessage:t,formatNumber:n}=(0,q.tz)(),a=(0,M.useSelector)(e=>(0,Vl.e)(e).status),o=(0,M.useSelector)(w.ji),l=(0,r.useMemo)(()=>Object.values(a),[a]),i=(0,r.useMemo)(()=>l.map(e=>e[Hl.x.ID]),[l]),s=(0,r.useCallback)(t=>{e((0,R.HF)(Array.from(t)))},[e]),c=(0,r.useCallback)(t=>{e((0,R.HF)(Array.from(t)))},[e]),m=(0,r.useCallback)(()=>{e((0,R.HF)([]))},[e]),u=(0,r.useMemo)(()=>l.sort((e,t)=>Gl[e[Hl.x.ID]]-Gl[t[Hl.x.ID]]).map(e=>({id:e[Hl.x.ID],type:"CHECKBOX",title:`${t({id:zl[e[Hl.x.ID]]})} (${n(e[Hl.x.COUNT])})`,children:[]})),[l,t,n]),d=(0,r.useMemo)(()=>o.length===l.length?"all":new Set(o),[o,l.length]),E=(0,r.useMemo)(()=>new Set(l.filter(e=>!o.includes(e[Hl.x.ID])&&!a[e[Hl.x.ID]][Hl.x.COUNT]).map(e=>e[Hl.x.ID])),[l,a,o]);return(0,Ul.A)(o,i,R.HF),l.length?r.createElement(Wl.A,{label:r.createElement(q.sA,{id:"COMMON_STATUS"}),isSingleColumn:!0},r.createElement(Fl.A,{items:u,selectedKeys:d,disabledKeys:E,onSelectionChange:s,onSelectAll:c,onDeselectAll:m,shouldAlwaysUseSimplifiedPicker:!0})):null}),Yl={[Jo.rW.NONE]:"COMMON_NONE",[Jo.rW.POE]:"COMMON_DEVICE_POE_MODE_POE",[Jo.rW.POE_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS",[Jo.rW.POE_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS",[Jo.rW.POE_PLUS_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS",[Jo.rW.POE_PASSTHROUGH]:"COMMON_DEVICE_POE_MODE_PASSTHROUGH",[Jo.rW.POE_PASSIVE_24V]:"COMMON_DEVICE_POE_MODE_PASSIVE"},Kl={[Jo.rW.NONE]:1,[Jo.rW.POE]:2,[Jo.rW.POE_PLUS]:3,[Jo.rW.POE_PLUS_PLUS]:4,[Jo.rW.POE_PLUS_PLUS_PLUS]:5,[Jo.rW.POE_PASSTHROUGH]:5,[Jo.rW.POE_PASSIVE_24V]:6},jl=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),{formatNumber:t,formatMessage:n}=(0,q.tz)(),a=(0,M.useSelector)(e=>(0,Vl.e)(e).poe),o=(0,M.useSelector)(w.px),l=(0,r.useMemo)(()=>Object.values(a),[a]),i=(0,r.useMemo)(()=>l.map(e=>e[Hl.x.ID]),[l]),s=(0,r.useCallback)(t=>{e((0,R.PJ)(Array.from(t)))},[e]),c=(0,r.useCallback)(t=>{e((0,R.PJ)(Array.from(t)))},[e]),m=(0,r.useCallback)(()=>{e((0,R.PJ)([]))},[e]),u=(0,r.useMemo)(()=>l.sort((e,t)=>Kl[e[Hl.x.ID]]-Kl[t[Hl.x.ID]]).map(e=>({id:e[Hl.x.ID],type:"CHECKBOX",title:`${n({id:Yl[e[Hl.x.ID]]})} (${t(e[Hl.x.COUNT])})`,children:[]})),[l,t,n]),d=(0,r.useMemo)(()=>o.length===l.length?"all":new Set(o),[o,l.length]),E=(0,r.useMemo)(()=>new Set(l.filter(e=>!o.includes(e[Hl.x.ID])&&!a[e[Hl.x.ID]][Hl.x.COUNT]).map(e=>e[Hl.x.ID])),[l,a,o]);return(0,Ul.A)(o,i,R.PJ),l.length?r.createElement(Wl.A,{label:r.createElement(q.sA,{id:"COMMON_DEVICE_POE_MODE_POE"}),isSingleColumn:!0},r.createElement(Fl.A,{items:u,selectedKeys:d,disabledKeys:E,onSelectionChange:s,onSelectAll:c,shouldAlwaysUseSimplifiedPicker:!0,onDeselectAll:m})):null});var ql=n(445535),Xl=n(888964);const Ql=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),{formatNumber:t,formatMessage:n}=(0,q.tz)(),a=(0,M.useSelector)(e=>(0,Vl.e)(e).nativeVlan),o=(0,M.useSelector)(w.l9),l=(0,r.useMemo)(()=>Object.values(a),[a]),i=(0,r.useMemo)(()=>l.map(e=>e[Hl.x.ID]),[l]),s=(0,r.useCallback)(t=>{e((0,R.t4)(Array.from(t)))},[e]),c=(0,r.useCallback)(t=>{e((0,R.t4)(Array.from(t)))},[e]),m=(0,r.useCallback)(()=>{e((0,R.t4)([]))},[e]),u=(0,r.useMemo)(()=>l.sort((e,t)=>e[Hl.x.ID]===Vl.C?1:t[Hl.x.ID]===Vl.C?-1:(e[Hl.x.VLAN_ID]??1)-(t[Hl.x.VLAN_ID]??1)).map(e=>{const r=e[Hl.x.NAME],a=r===Vl.C?n({id:"COMMON_NONE"}):r;return{id:e[Hl.x.ID],type:"CHECKBOX",title:`${a} (${t(e[Hl.x.COUNT])})`,children:[]}}),[l,t,n]),d=(0,r.useMemo)(()=>o.length===l.length?"all":new Set(o),[o,l.length]),E=(0,r.useMemo)(()=>new Set(l.filter(e=>!o.includes(e[Hl.x.ID])&&!a[e[Hl.x.ID]][Hl.x.COUNT]).map(e=>e[Hl.x.ID])),[l,a,o]);return(0,Ul.A)(o,i,R.t4),l.length?r.createElement(ql.A,{id:Xl.R.PORTS_NATIVE_VLAN,label:r.createElement(q.sA,{id:"COMMON_PORTS_NATIVE_VLAN"})},r.createElement(Fl.A,{id:Xl.R.PORTS_NATIVE_VLAN,items:u,selectedKeys:d,disabledKeys:E,onSelectionChange:s,onSelectAll:c,onDeselectAll:m})):null});var Jl=n(28874),Zl=n(574022),ei=n(548165);const ti=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.uC),n=(0,ei.xO)(t)||(0,ei.fX)(),[a,o]=(0,r.useState)([n.min,n.max]),l=(0,r.useMemo)(()=>(0,Zl.A)(t=>{const n=(0,ei.N1)({min:t[0],max:t[1]});e((0,R.uN)(n))},500),[e]);(0,r.useEffect)(()=>{o([n.min,n.max])},[n.min,n.max]);const i=(0,r.useCallback)(e=>{Array.isArray(e)&&2===e.length&&(o([e[0],e[1]]),l([e[0],e[1]]))},[l]);(0,r.useEffect)(()=>()=>{l.cancel()},[l]);const s=(0,r.useMemo)(()=>r.createElement(q.sA,{id:"COMMON_GENERIC_FROM_TO",values:{from:a[0],to:a[1]}}),[a]);return r.createElement(ql.A,{label:r.createElement(q.sA,{id:"PORTS_AI_ANOMALY_SCORE"})},r.createElement(E.A,{flex:1,width:"100%",paddingLeft:m.kc},r.createElement(St.A,{defaultValue:[n.min,n.max],value:a,onChange:i,caption:0,captionEnd:100,labelEnd:s,style:{width:"100%"}})))},ni=(0,r.memo)(()=>{const e=(0,M.useDispatch)(),{formatMessage:t}=(0,q.tz)(),n=(0,M.useSelector)(w.N0),a=(0,M.useSelector)(w.K6),o=(0,M.useSelector)(w.$X),l=(0,M.useSelector)(w.UH),i=(0,r.useMemo)(()=>n.map(e=>({id:e.mac,type:"CHECKBOX",title:(0,Ee.Q)(e)+(e.isOffline?` (${t({id:"COMMON_OFFLINE"})})`:""),checkboxProps:{isTruncated:!0},children:[]})),[n,t]),s=(0,r.useMemo)(()=>new Set(a),[a]),c=(0,r.useCallback)(t=>{const n=Array.from(t);if(!(o&&0===n.length&&a.length>0)&&(e((0,R.is)(n)),0!==n.length)){const t=l.filter(e=>{const t=(0,L.q9)(e).deviceMac;return n.includes(t)});t.length!==l.length&&e((0,R.Ao)(t))}},[e,o,a.length,l]),m=(0,r.useCallback)(t=>{e((0,R.is)(Array.from(t)))},[e]),u=(0,r.useCallback)(()=>{o&&a.length>0||e((0,R.is)([]))},[e,o,a]);return n.length>1?r.createElement(ql.A,{id:Xl.R.PORTS_NATIVE_VLAN,label:r.createElement(q.sA,{id:"COMMON_SWITCHES"})},r.createElement(Fl.A,{id:Xl.R.PORTS_NATIVE_VLAN,items:i,selectedKeys:s,onSelectionChange:c,onSelectAll:m,onDeselectAll:u,shouldAlwaysUseSimplifiedPicker:!0,selectionMode:o?"single":"multiple"})):null});var ri=n(888170),ai=n(805837),oi=n(362412),li=n(814680),ii=n(6176),si=n(999589),ci=n(478211),mi=n(463477),ui=n(734707),di=n(129361),Ei=n(392699),hi=n(281884),pi=n(837612),Ai=n(613141);const _i=(0,a.A)("div",(0,B.A)("connectionStatus"))`
  height: ${({connectionStatus:e})=>e===Ei.v.OFFLINE?"unset":m.S2};
  flex-wrap: ${({connectionStatus:e})=>e===Ei.v.OFFLINE?"wrap":"unset"};
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: ${({connectionStatus:e})=>e===Ei.v.OFFLINE?"unset":m.YC};
  * {
    line-height: ${m.Er} !important;
    font-size: 13px !important;
    flex-flow: nowrap !important;
    }
  {/* Target "Connected To" */}
  div > span {
    color: ${({theme:{themeName:e}})=>$.Ay[`desktop-color-neutral-10-${e}`]} !important;
  }
  {/* Target flex container */}
  & > div {
    justify-content: space-between;
    width: ${({connectionStatus:e})=>e===Ei.v.OFFLINE?"unset":"100%"};
    min-height: 24px;
  }
`,Ci=({device:e,stackingGroupModelName:t})=>{const n=(0,M.useSelector)(w.gR),a=(0,M.useSelector)(w.tI),o=(0,M.useSelector)(w.w2),l=(0,M.useSelector)(w.OA),i=(0,M.useDispatch)(),s=t||(0,Ee.Lm)(e?.model),{type:c}=(0,ir.Se)(l),u=c===Jo.F7.MC_LAG&&o.length>1,d=(0,r.useCallback)(()=>{n?i((0,j.XP)({type:Z.H.STACKING,id:n})):a&&i((0,j.XP)({type:Z.H.DEVICE,id:a,tab:Y.BC.SETTINGS}))},[n,a,i]);return e&&e.model?r.createElement(E.A,{alignItems:"center",gap:m.kc,height:m.S2,justifyContent:"space-between"},r.createElement(F.A,{size:"medium",color:"text-2"},r.createElement(q.sA,{id:"COMMON_MODEL"})),r.createElement(E.A,{alignItems:"center",gap:m.YC},r.createElement(F.A,{size:"medium",color:"text-3"},s),r.createElement(hn.A,{description:u?r.createElement(q.sA,{id:"PORTS_FIRST_SELECT_SWITCH"}):null},r.createElement(Tt.A,{size:"small",variant:"neutral",onPress:d,isDisabled:u,...z.A.addDataTestId(z.A.TestId.SIDE_PANEL_TRIGGER)},r.createElement(ci.A,null))))):null},gi=({firstSelectedDeviceMac:e})=>{const t=(0,M.useSelector)((0,ge.tG)(e)),n=(0,M.useSelector)(w._h),{onUpgradeDevice:a,showButton:o,isPending:l}=(0,mi.S)(t),i=o&&1===n.length;if(!t.displayable_version)return null;const s=(0,si.coerce)(t.upgrade_to_firmware)?.version;return r.createElement(E.A,{gap:m.kc,alignItems:"center",justifyContent:"space-between",height:m.S2},r.createElement(F.A,{size:"medium",color:"text-2"},r.createElement(q.sA,{id:"COMMON_VERSION"})),r.createElement(E.A,{gap:m.kc},r.createElement(F.A,{size:"medium",color:"text-3"},t.displayable_version),i?r.createElement(Ai.A,{fromVersion:t.displayable_version,toVersion:t.upgrade_to_firmware,model:t.model},r.createElement(ui.Ay,{variant:"inline",onClick:a,disabled:l,size:"medium"},r.createElement(q.sA,{id:"COMMON_ACTION_UPDATE_TO",values:{version:s}}))):null))},fi=({firstSelectedDeviceMac:e})=>{const t=(0,M.useSelector)((0,ge.tG)(e)),{uplink:n}=t,a=(0,r.useMemo)(()=>(0,hi.H)((0,pi.S9)(t),n?.type),[t,n?.type]),o=Boolean(t.wan_networkgroup)||Boolean(n?.uplink_device_name),l=(0,pi.YP)(t);return o&&l?r.createElement(_i,{connectionStatus:a},r.createElement(di.A,{activeItem:{...t,deviceState:(0,pi.S9)(t)},connectionStatus:a,uplinkNameMaxWidth:a===Ei.v.CONNECTED?142:116,key:t.mac})):null},Si=()=>{const e=(0,M.useSelector)(w.IY),t=(0,M.useSelector)(w.w2),n=(0,M.useSelector)(w.OA),a=t[0],o=(0,M.useSelector)(w._h),l=(0,r.useMemo)(()=>{const{type:e}=(0,ir.Se)(n);return e},[n]),i=(0,r.useMemo)(()=>l===Jo.F7.MC_LAG,[l]),s=(0,r.useMemo)(()=>l===Jo.F7.STACKING_GROUP,[l]),c=(0,M.useSelector)((0,r.useMemo)(()=>(0,ge.nH)(t),[t])),u=(0,M.useSelector)((0,r.useMemo)(()=>(0,ge.nH)(o),[o])),{formatMessage:d}=(0,q.tz)(),h=d({id:"PORTS_STACKING_MODEL_POE_SUFFIX"}),p=(0,r.useMemo)(()=>s&&0!==u.length?((e,t)=>{if(0===e.length)return null;const n=e.map(e=>(0,Ee.Lm)(e.model)),r=Array.from(new Set(n));if(1===r.length)return r[0];const a=r.some(e=>e.toLowerCase().includes("poe")),o=r.some(e=>!e.toLowerCase().includes("poe"));if(a&&o){const e=r.find(e=>!e.toLowerCase().includes("poe"));if(e)return`${e} ${t}`}return r[0]})(u,h):null,[s,u,h]),A=(0,r.useMemo)(()=>i&&c[0]?c[0]:s&&u.length>0&&u[0]?u[0]:e?.device?e.device:null,[i,s,c,u,e]);return r.createElement(E.A,{flexDirection:"column",paddingLeft:m.kc,paddingRight:m.kc,gap:m.kc},r.createElement(E.A,{flexDirection:"column"},r.createElement(Ci,{device:A,stackingGroupModelName:p}),r.createElement(gi,{firstSelectedDeviceMac:a}),r.createElement(fi,{firstSelectedDeviceMac:a})),r.createElement(ol.A,{orientation:"horizontal"}))},Ti=(0,a.A)(oi.A)`
  z-index: ${ri.Ay["z-index-side-panel"]-1};
`,Ni=(0,a.A)("div",(0,B.A)("isOffline","themeName"))`
  ${({isOffline:e,themeName:t})=>e?`\n    color: ${ri.Ay.motifs[t].text03} !important;\n  `:""}
`,Oi=()=>{const e=(0,M.useDispatch)(),t=(0,M.useSelector)(w.OA),n=(0,M.useSelector)(w.Mi),a=(0,M.useSelector)(w.$X),o=(0,M.useSelector)(w.QR),l=(0,M.useSelector)(w.fD),{setSelectedPortsAndAssignColors:i}=(0,ea.A)(),{formatMessage:s}=(0,q.tz)(),{themeName:c}=(0,H.u)(),u=(0,r.useCallback)(t=>{if(e((0,R.Ao)([])),e((0,R.U)(t)),e((0,R.E1)(t!==sr.Zt)),t===sr.Zt)return e((0,R.IU)(!1)),void e((0,R.JL)(!1));if(o){const{deviceMacs:e}=(0,ir.Se)(t),n=new Set(e),r=l.filter(e=>n.has(e.device.mac)).map(e=>e.id);r.length>0&&i(r)}if(a){const r=n.find(e=>e.value===t);if(r?.includeDevices?.length)return void e((0,R.is)([r?.includeDevices?.[0]]))}e((0,R.is)([]))},[e,a,o,l,i,n]),d=[{value:(0,ir.HN)(Jo.F7.ALL,[]),label:s({id:"COMMON_ALL_PORTS"}),image:r.createElement(Pt.A,null)},...n.map(e=>({value:e.value,label:e.label+(e.isOffline?` (${s({id:"COMMON_OFFLINE"})})`:""),isOffline:e.isOffline,image:e.hasError?r.createElement(U.A,{size:"original",variant:"fill",color:$.Ay[`desktop-color-red-06-${c}`],fill:$.Ay[`desktop-color-neutral-00-${c}`]}):e.hasWarning?r.createElement(U.A,{size:"original",variant:"fill",color:$.Ay[`desktop-color-orange-06-${c}`],fill:$.Ay[`desktop-color-neutral-00-${c}`]}):r.createElement(ii.A,{width:sr.NK,height:sr.NK,model:e.deviceProperties?.model})}))],h=(0,r.useCallback)(e=>r.createElement(Ni,{isOffline:e.option.isOffline??!1,themeName:c},r.createElement(ai.q,{...e})),[c]),p=(0,r.useCallback)(e=>{u(e.value)},[u]);return r.createElement(E.A,{flexDirection:"column",gap:m.kc},r.createElement(Ti,{variant:"secondary",searchable:!0,portal:!0,width:"full",onChange:p,options:d,renderOption:h,value:t,maxHeight:li.W}),t!==sr.Zt?r.createElement(Si,null):null)},vi=(0,r.memo)(()=>{const e=(0,M.useSelector)(w.QR),t=(0,M.useSelector)(w.OA)===sr.Zt,n=(0,M.useSelector)(w.$X),a=(0,M.useSelector)(w.oE),o=(0,M.useSelector)(w.wJ),l=(0,$e.Ki)(o),s=!n,c=!t&&!a,u=!t&&!a&&l,d=!a,h=!t,p=c||d||u||h;return r.createElement(ll.A,{columns:a?null:r.createElement($l,null),leftFilterColumnsId:bl.PORTS,footer:r.createElement(Pl,{leftFilterPageId:i.g1.PORT_MANAGEMENT}),leftFilterPageId:i.g1.PORT_MANAGEMENT,tabs:r.createElement(hl.Ay,{selectedTab:a?hl.al.SFP:hl.al.MAIN})},r.createElement(E.A,{flexDirection:"column"},r.createElement(il.A,null,a?null:r.createElement(Oi,null),a?null:r.createElement(ni,null),p?r.createElement(E.A,{flexDirection:"column",gap:m.kc,padding:m.kc},r.createElement(E.A,{flexDirection:"column"},c?r.createElement(ul,null):null,h?r.createElement(El,null):null,u?r.createElement(ml,null):null,d?r.createElement(dl,null):null),r.createElement(ol.A,{orientation:"horizontal"})):null,s?r.createElement(ti,null):null,e?r.createElement(Rl,null):null),s?r.createElement(r.Fragment,null,a?null:r.createElement(Ql,null),r.createElement(il.A,null,r.createElement(Bl,null),a?null:r.createElement(jl,null),r.createElement(Jl.Ay,null))):null))}),Ii=(0,a.A)(E.A)`
  flex-direction: column;
  gap: ${m.kc};
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  padding: ${m.xO} 0 0 ${m.Ln};
`,Di=()=>(0,c.A)([(0,s.Zi)(l.B.PORTS),(0,s.Zi)(l.B.DEVICES),(0,s.Zi)(l.B.SETTINGS),(0,T.J4)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,_.d9)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,I.$3)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,A.hh)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,p.F)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,v.Uc)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,C.Uc)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,f.kE)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,S.Sk)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,N.s)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,O.N)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,g.G)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}),(0,D.ot)(void 0,{crudCacheStrategy:{type:o.e.CACHE}})],r.createElement(u.A,{mainPanelProps:{gap:m.Ln}},r.createElement(d.A,{leftFilterPageId:i.g1.PORT_MANAGEMENT,content:r.createElement(vi,null),overflow:"hidden",paddingBottom:m.Ln},r.createElement(Ii,null,r.createElement(al,null)))),{trackingName:h.VO.PORTS})},264752(e,t,n){n.d(t,{A:()=>d});var r=n(296540),a=n(217439),o=n(71479),l=n(566723),i=n(766624),s=n(294303);const c=(0,o.A)(a.A)`
  white-space: nowrap;
`,m=(0,o.A)(s.A)`
  align-items: center;
`,u=(0,o.A)(s.A)`
  width: ${l.Ln};
  justify-content: flex-start;
`,d=({indicator:e,description:t,isSingleLine:n,tooltipDescription:a})=>r.createElement(m,{marginRight:n?l.kc:0},r.createElement(u,null,e),r.createElement(c,{size:"small",color:"text-3"},t),a?r.createElement(i.A,{description:a}):null)},226712(e,t,n){n.d(t,{A:()=>y,T:()=>P});var r=n(296540),a=n(469733),o=n(822336),l=n(934846),i=n(95918),s=n(455806),c=n(383704),m=n(363334),u=n(794993),d=n(71479),E=n(382389),h=n(506327),p=n(903216),A=n(566723),_=n(294303),C=n(916537),g=n(966784),f=n(962669),S=n(578819),T=n(780811),N=n(532419),O=n(376272),v=n(60687),I=n(311785),D=n(264752);const M=(0,d.A)("div")`
  display: grid;
  grid-template-columns: repeat(3, minmax(min-content, 1fr));
  gap: ${A.YC};
  margin-top: ${A.kc};
`,b=(0,d.A)(_.A)`
  gap: ${A.kc};
  row-gap: ${A.YC};
  flex-wrap: wrap;
`,P=(0,d.A)(h.A,(0,I.A)("borderColor"))`
  flex-shrink: 0;
  border-radius: 0;
  border: ${({borderColor:e,theme:{themeName:t}})=>e&&`1px solid ${(0,g.oX)(e,t)}`};
`,x=(e,t)=>e===v.s.PASSTHROUGH?1:e===v.s.PASSIVE?2:e===v.s.POE?3:e===v.s.POE_PLUS?4:e===v.s.POE_PLUS_PLUS?5:6,y=({deviceMac:e,isSingleLine:t=!1,hidePoe:n=!1,hideDisabled:d=!1,hideDisconnected:h=!1,displayedSpeedList:A})=>{const{themeName:_}=(0,E.u)(),I=(0,a.useSelector)((0,r.useMemo)(()=>(0,N.tG)(e),[e])),{type:y,model:L}=I;return(0,r.useMemo)(()=>{const e=(0,f.MB)(I),a=(0,T.NuO)(I),E=(0,S._L)(I,a),N=d||(0,T.m_j)(I)||(0,T.Syn)(I)||(0,T.Fp0)(I),L=t?b:M,w=Array.from(E).sort(x).map(e=>{switch(!0){case e===v.s.POE_PLUS_PLUS_PLUS:return r.createElement(D.A,{key:e,description:r.createElement(C.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS"}),indicator:r.createElement(l.A,{color:o.Ay[`desktop-color-neutral-08-${_}`]})});case e===v.s.POE_PLUS_PLUS:return r.createElement(D.A,{key:e,description:r.createElement(C.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS"}),indicator:r.createElement(i.A,{color:o.Ay[`desktop-color-neutral-08-${_}`]})});case e===v.s.POE_PLUS:return r.createElement(D.A,{key:e,description:r.createElement(C.sA,{id:"COMMON_DEVICE_POE_MODE_POE_PLUS"}),indicator:r.createElement(s.A,{color:o.Ay[`desktop-color-neutral-08-${_}`]})});case e===v.s.PASSTHROUGH||e===v.s.PASSIVE||e===v.s.POE:return r.createElement(D.A,{key:e,description:r.createElement(C.sA,{id:e===v.s.PASSIVE?"COMMON_DEVICE_POE_MODE_PASSIVE":"COMMON_DEVICE_POE_MODE_POE"}),indicator:r.createElement(c.A,{color:o.Ay[`desktop-color-neutral-08-${_}`]})});default:return null}});return r.createElement(L,null,e.filter(e=>!A||A.includes(e)).sort((e,t)=>e-t).map(e=>r.createElement(D.A,{key:e,description:(0,p.ir)(e),indicator:r.createElement(P,{color:(0,g.oX)((O.A[e]??O.A.DEFAULT).background,_)})})),h?null:r.createElement(D.A,{key:"disconnected",description:r.createElement(C.sA,{id:"COMMON_DISCONNECTED"}),indicator:r.createElement(P,{color:(0,g.oX)(O.A.DEFAULT.background,_)})}),N?null:r.createElement(D.A,{key:"disabled",description:r.createElement(C.sA,{id:"COMMON_DISABLED"}),indicator:r.createElement(P,{color:"transparent",borderColor:O.A.DEFAULT.background}),isSingleLine:t}),n?null:w,!(0,T.Tbi)({type:y})||(0,T.Syn)(I)||(0,T.Fp0)(I)?null:r.createElement(r.Fragment,null,r.createElement(D.A,{key:"aggregating",description:r.createElement(C.sA,{id:"COMMON_AGGREGATING"}),indicator:r.createElement(u.A,{color:o.Ay[`desktop-color-neutral-08-${_}`]})}),r.createElement(D.A,{key:"mirror",indicator:r.createElement(m.A,null),description:r.createElement(C.sA,{id:"DEVICE_PORT_STATE_MIRROR"}),tooltipDescription:r.createElement(C.sA,{id:"DEVICE_PORT_STATE_MIRROR_TOOLTIP"})})))},[L,n,d,A,_])}},871666(e,t,n){n.d(t,{$:()=>o,k:()=>a});var r=n(288006);const a={[r.vL.DISABLED]:{background:"neutral-01",border:"neutral-04",text:"neutral-07"},[r.vL.NATIVE]:{background:"neutral-01",border:"neutral-04",text:"neutral-07"},[r.vL.TAGGED]:{background:"green-06",border:"green-06",text:"neutral-00"},[r.vL.BLOCKED]:{background:"neutral-05",border:"neutral-05",text:"neutral-00"},[r.vL.WAN]:{background:"neutral-00",border:"neutral-04",text:"neutral-07"},[r.vL.UNTAGGED_NATIVE]:{background:"ublue-04",border:"ublue-04",text:"neutral-00"}},o="-"},288006(e,t,n){var r,a,o;n.d(t,{at:()=>a,dv:()=>r,vL:()=>o}),function(e){e.DISPLAYED_VLAN_ID="nativeVlanId",e.IS_WAN_PORT="isWanPort",e.ADJUSTED_PORT_NUMBER="adjustedPortNumber",e.IS_MANAGED_BY_PORT_PROFILE="isManagedByPortProfile",e.IS_DISABLED="isDisabled"}(r||(r={})),function(e){e.IS_TAGGED="isTagged",e.IS_NETWORK_NATIVE_ON_PORT="isNetworkNativeOnPort",e.ADJUSTED_PORT_NUMBER="adjustedPortNumber",e.IS_WAN_PORT="isWanPort",e.IS_MANAGED_BY_PORT_PROFILE="isManagedByPortProfile",e.IS_DISABLED="isDisabled"}(a||(a={})),function(e){e.BLOCKED="BLOCKED",e.TAGGED="TAGGED",e.DISABLED="DISABLED",e.NATIVE="NATIVE",e.WAN="WAN",e.UNTAGGED_NATIVE="UNTAGGED_NATIVE"}(o||(o={}))},43130(e,t,n){n.d(t,{E:()=>m,Np:()=>d,SH:()=>u});var r=n(325752),a=n(966784),o=n(936621),l=n(431247),i=n(768195),s=n(288006),c=n(871666);const m=(e,t,n)=>{let r=e.port_table?.find(e=>e.port_idx===t),a=r?.portconf_id?n.find(e=>e._id===r?.portconf_id):void 0;const o=r?.name;let l=t;if(!r?.aggregate_members?.length){const o=e.port_table?.find(e=>e.aggregate_members?.includes(t)&&e.port_idx!==t);null!=o?.port_idx&&(l=o.port_idx,r=o,a=r?.portconf_id?n.find(e=>e._id===r?.portconf_id):void 0)}return{profile:a,portData:r,adjustedPortNumber:l,originalPortName:o}},u=(e,t)=>`${e?.vlan||(t||e&&e?.networkgroup!==i.vj.LAN?c.$:1)}`,d=(e,t,n,c)=>(e.port_table||[]).reduce((d,E)=>{if(null==E.port_idx)return d;const{profile:h,portData:p,adjustedPortNumber:A}=m(e,E.port_idx,t),_=h?h.native_networkconf_id:p?.native_networkconf_id,C=h?h.excluded_networkconf_ids:p?.excluded_networkconf_ids,g=h?h.tagged_vlan_mgmt:p?.tagged_vlan_mgmt,f=_===o.F,S=n.find(e=>e._id===_),T=(0,a.Ue)(p?.ifname,e)||(0,a.m)(e,E.port_idx),N=(0,a.Xq)(p?.ifname,e),O=g===i.sg.BLOCK_ALL,v=g===i.sg.AUTO,I=(0,a.$k)(p?.ifname,e),D=!!p&&(I.includes(r.Vd.INTERFACE_DISABLED)||(0,l.Rj)(p));d.nativeNetwork[E.port_idx]={excluded_networkconf_ids:C,native_networkconf_id:_??c,tagged_vlan_mgmt:g??i.sg.AUTO,[s.dv.DISPLAYED_VLAN_ID]:u(S,f),[s.dv.IS_WAN_PORT]:T,[s.dv.ADJUSTED_PORT_NUMBER]:A,[s.dv.IS_MANAGED_BY_PORT_PROFILE]:!!h,[s.dv.IS_DISABLED]:D};const M=n.reduce((e,t)=>{const n=(_??c)===t?._id&&N,r=!C?.includes(t._id),a=!n&&!O&&N&&(r||v);return e[t._id]={port_idx:E.port_idx,excluded_networkconf_ids:C,[s.at.IS_TAGGED]:a,[s.at.IS_NETWORK_NATIVE_ON_PORT]:n,[s.at.ADJUSTED_PORT_NUMBER]:A,[s.at.IS_WAN_PORT]:T,[s.at.IS_MANAGED_BY_PORT_PROFILE]:!!h,[s.at.IS_DISABLED]:D},e},{});return d.taggedNetworks[E.port_idx]=M,d},{nativeNetwork:{},taggedNetworks:{}})},28874(e,t,n){n.d(t,{Ay:()=>_,PB:()=>p});var r=n(296540),a=n(469733),o=n(895),l=n(773033),i=n(727678),s=n(916537),c=n(286818),m=n(497470),u=n(293016),d=n(128989),E=n(613046);const h=[u.f4.SFP,u.f4.SFPPLUS,u.f4.SFP28,u.f4.QSFP28],p={[u.f4.FE]:"COMMON_MEDIA_FE",[u.f4.GE]:"COMMON_MEDIA_GE",[u.f4.GE_2P5]:"COMMON_MEDIA_2P5GE",[u.f4.GE_10]:"COMMON_MEDIA_10GE",[u.f4.GE_25]:"COMMON_MEDIA_25GE",[u.f4.GE_40]:"COMMON_MEDIA_40GE",[u.f4.GE_100]:"COMMON_MEDIA_100GE",[u.f4.SFP]:"COMMON_MEDIA_SFP",[u.f4.SFPPLUS]:"COMMON_MEDIA_SFPPLUS",[u.f4.SFP28]:"COMMON_MEDIA_SFP28",[u.f4.QSFP28]:"COMMON_MEDIA_QSFP28"},A={[u.f4.FE]:1,[u.f4.GE]:2,[u.f4.GE_2P5]:3,[u.f4.GE_10]:4,[u.f4.GE_25]:5,[u.f4.GE_40]:6,[u.f4.GE_100]:7,[u.f4.SFP]:8,[u.f4.SFPPLUS]:9,[u.f4.SFP28]:10,[u.f4.QSFP28]:11},_=(0,r.memo)(()=>{const e=(0,a.useDispatch)(),{formatNumber:t,formatMessage:n}=(0,s.tz)(),u=(0,a.useSelector)(e=>(0,E.e)(e).media),_=(0,a.useSelector)(c.T4),C=(0,r.useMemo)(()=>Object.values(u),[u]),g=(0,a.useSelector)(c.oE),f=(0,r.useMemo)(()=>C.map(e=>e[d.x.ID]),[C]),S=(0,r.useCallback)(t=>{e((0,m.Vw)(Array.from(t)))},[e]),T=(0,r.useCallback)(t=>{e((0,m.Vw)(Array.from(t)))},[e]),N=(0,r.useCallback)(()=>{e((0,m.Vw)([]))},[e]),O=(0,r.useMemo)(()=>C.filter(e=>!g||h.includes(e[d.x.ID])).sort((e,t)=>A[e[d.x.ID]]-A[t[d.x.ID]]).map(e=>({id:e[d.x.ID],type:"CHECKBOX",title:`${n({id:p[e[d.x.ID]]})} (${t(e[d.x.COUNT])})`,children:[]})),[C,g,n,t]),v=(0,r.useMemo)(()=>_.length===C.length?"all":new Set(_),[_,C.length]),I=(0,r.useMemo)(()=>new Set(C.filter(e=>!_.includes(e[d.x.ID])&&!u[e[d.x.ID]][d.x.COUNT]).map(e=>e[d.x.ID])),[C,u,_]);return(0,l.A)(_,f,m.Vw),C.length?r.createElement(i.A,{label:r.createElement(s.sA,{id:"COMMON_LINK_SPEED"}),isSingleColumn:!0},r.createElement(o.A,{shouldAlwaysUseSimplifiedPicker:!0,items:O,selectedKeys:v,disabledKeys:I,onSelectionChange:S,onSelectAll:T,onDeselectAll:N})):null})},613046(e,t,n){n.d(t,{C:()=>c,e:()=>m});var r=n(801081),a=n(189601),o=n(286818),l=n(366188),i=n(293016),s=n(128989);const c="__NONE__",m=(0,a.WY)()((0,r.Mz)(o.xP,(0,o.IS)([i.s9.PORTS_MEDIA]),(0,o.IS)([i.s9.PORTS_POE]),(0,o.IS)([i.s9.PORTS_NATIVE_VLAN]),(0,o.IS)([i.s9.PORTS_STATUS]),l.Ct,o.Hz,(e,t,n,r,a,o,l)=>{const m={},u={},d={},E={},h=e.length;for(let t=0;t<h;t+=1){const n=e[t],r=n.filterMedia;r.length&&r.forEach(e=>{m[e]||(m[e]={[s.x.ID]:e,[s.x.NAME]:e,[s.x.COUNT]:0})});const a=n.filterPoe;u[a]||(u[a]={[s.x.ID]:a,[s.x.NAME]:a,[s.x.COUNT]:0});const l=n?.nativeNetworkConfIdSubstituted;if(void 0!==l){const e=""===l,t=e?c:l;if(!d[t]){const n=l?o.find(({_id:e})=>e===l):void 0;d[t]={[s.x.ID]:t,[s.x.NAME]:e?c:n?.name,[s.x.COUNT]:0,[s.x.VLAN_ID]:n?.vlan??1}}}const i=n.filterStatus;i.length&&i.forEach(e=>{E[e]||(E[e]={[s.x.ID]:e,[s.x.NAME]:e,[s.x.COUNT]:0})})}l&&!E[i.fA.IN_USE]&&(E[i.fA.IN_USE]={[s.x.ID]:i.fA.IN_USE,[s.x.NAME]:i.fA.IN_USE,[s.x.COUNT]:0});const p=t.length;for(let e=0;e<p;e+=1){const n=t[e].filterMedia;n.length&&n.forEach(e=>{m[e]&&(m[e]={...m[e],[s.x.COUNT]:m[e][s.x.COUNT]+1})})}const A=n.length;for(let e=0;e<A;e+=1){const t=n[e].filterPoe;u[t]&&(u[t]={...u[t],[s.x.COUNT]:u[t][s.x.COUNT]+1})}const _=r.length;for(let e=0;e<_;e+=1){const t=r[e].nativeNetworkConfIdSubstituted;if(void 0!==t){const e=""===t?c:t;d[e]&&(d[e]={...d[e],[s.x.COUNT]:d[e][s.x.COUNT]+1})}}const C=a.length;for(let e=0;e<C;e+=1){const t=a[e].filterStatus;t.length&&t.forEach(e=>{E[e]&&(E[e]={...E[e],[s.x.COUNT]:E[e][s.x.COUNT]+1})})}return{media:m,poe:u,nativeVlan:d,status:E}}),e=>e)},128989(e,t,n){var r;n.d(t,{x:()=>r}),function(e){e.COUNT="count",e.NAME="name",e.ID="id",e.VLAN_ID="vlan_id"}(r||(r={}))},596176(e,t,n){n.d(t,{A:()=>s});var r=n(296540),a=n(217439),o=n(566723),l=n(916537),i=n(294303);const s=({messages:e=[]})=>e.length?r.createElement(i.A,{flexDirection:"column",gap:o.kc},e.map(([e,t={}])=>r.createElement(a.A,{key:e,color:"inherit",size:"inherit"},r.createElement(l.sA,{id:e,values:t})))):null},243322(e,t,n){n.d(t,{A:()=>a});var r=n(217439);const a=(0,n(71479).A)(r.A)`
  white-space: nowrap;
`},876773(e,t,n){n.d(t,{A:()=>l});var r=n(296540),a=n(758649),o=n(196010);const l=e=>r.createElement(a.A,{component:o.A,variant:"inline",size:"medium",...e})},363370(e,t,n){n.d(t,{A:()=>l});var r=n(296540),a=n(928085),o=n(876773);const l=e=>{const t=(0,a.A)(e.to);return r.createElement(o.A,{...e,to:t})}},137625(e,t,n){n.d(t,{A:()=>c});var r=n(296540),a=n(353899),o=n(132196),l=n(372737),i=n(566723),s=n(916537);const c=({children:e=null,title:t,titleValues:n,message:c,messageValues:m,handleConfirm:u=()=>null,handleClose:d=()=>null,handleCancel:E,isOpen:h,buttonVariant:p="primary",cancelButtonVariant:A="tertiary",cancelButtonMessage:_="COMMON_ACTION_CANCEL",buttonMessage:C="COMMON_ACTION_CONFIRM",buttonDisabled:g=!1,position:f="top",offset:S,showHeaderClose:T=!1,contentClassName:N="",body:O,titleBody:v,className:I,rootClose:D=!1,footerActions:M})=>{const b=(0,r.useCallback)(e=>{h&&(e.stopPropagation(),e.key===l.U.ENTER?u():e.key===l.U.ESCAPE&&d(!1))},[h,u,d]);(0,r.useEffect)(()=>(window.addEventListener("keydown",b,!0),()=>{window.removeEventListener("keydown",b,!0)}),[b]);const P=(0,r.useCallback)(()=>{d(!1),E?.()},[d,E]),x=(0,r.useCallback)(()=>{d(!1),u()},[d,u]),y=(0,r.useMemo)(()=>[{text:r.createElement(s.sA,{id:_}),variant:A,onClick:P},{text:r.createElement(s.sA,{id:C}),disabled:g,variant:p,onClick:x}],[C,p,_,A,P,x,g]),L=(0,r.useCallback)(()=>{d(!1)},[d]),w=o.AH`
    ${t?"":`margin-top: ${i.xO}`}
  `;return r.createElement(a.A,{title:t?r.createElement(s.sA,{id:t,values:n}):v||null,...c?{body:r.createElement(r.Fragment,null,r.createElement(s.sA,{id:c,values:m}),O)}:{body:O},position:f,portal:!0,offset:S,actions:M||y,showHeaderClose:T,contentClassName:o.AH`
        ${w}
        ${N}
      `,onRequestClose:L,isOpen:h,allowOverflow:!0,rootClose:D,className:I},e)}},773033(e,t,n){n.d(t,{A:()=>l});var r=n(296540),a=n(469733),o=n(212178);const l=(e,t,n)=>{const l=(0,a.useDispatch)(),i=[JSON.stringify(e),JSON.stringify(t)].join(),s=(0,o.A)(i);return(0,r.useEffect)(()=>{if(i!==s){const r=[],a=e.length;for(let n=0;n<a;n+=1){const a=e[n];t.includes(a)||r.push(a)}r.length&&l(n(e.filter(e=>!r.includes(e))))}},[i,s,e,t,n,l]),null}},992149(e,t,n){n.d(t,{A:()=>h});var r=n(296540),a=n(469733),o=n(979106),l=n(208522),i=n(208288),s=n(874807),c=n(566723),m=n(294303),u=n(602021),d=n(778085);const E=(0,n(71479).A)(d.A)`
  [data-uic-component='RangeCalendar.Container'] {
    padding: 0;
  }
`,h=({presets:e=[],selectedPreset:t,range:n,onSelectTab:d=s.P1,onSelectCustomRange:h=s.P1,showCalendar:p=!1})=>{const A=(0,a.useSelector)(u.hq),_=(0,r.useMemo)(()=>(0,i.A)(new Date,"ZonedDateTime",A),[A]),C=(0,r.useMemo)(()=>(0,l.A)({start:(0,i.A)(n?.startDate,"ZonedDateTime",A),end:(0,i.A)(n?.endDate,"ZonedDateTime",A)}),[n,A]),g=(0,r.useCallback)(({start:e,end:t})=>{h({startDate:e.toDate(A),endDate:t.toDate(A)})},[h,A]);return r.createElement("div",null,e.length?r.createElement(o.A,{variant:"filter",tabs:e,selectedTab:t,onSelectTab:d,stretched:!0}):null,p?r.createElement(m.A,{marginTop:c.xO},r.createElement(E,{value:C,onChange:g,maxValue:_})):null)}},697490(e,t,n){n.d(t,{A:()=>s});var r=n(296540),a=n(568777),o=n(294303),l=n(6176),i=n(703447);const s=({connectedClient:e,connectedDevice:t,size:n,wanProviderAsn:s,wanProviderName:c})=>r.createElement(r.Fragment,null,c?r.createElement(a.A,{asn:s,name:c,style:{userSelect:"none",display:"block",height:"20px",width:"20px",objectFit:"contain",margin:"0 auto"},useFallback:!0}):null,!c&&t?r.createElement(l.A,{model:t.model,width:n,height:n}):null,c||t||!e?null:r.createElement(o.A,{height:n,minWidth:n,maxWidth:n,justifyContent:"center",alignItems:"center"},r.createElement(i.A,{client:e})))},94313(e,t,n){n.d(t,{A:()=>h});var r=n(296540),a=n(71479),o=n(132196),l=n(311785),i=n(916537),s=n(566723),c=n(294303),m=n(243322);const u=(0,a.A)(c.A,(0,l.A)("alignLeft"))`
  ${({alignLeft:e})=>e?"max-width: 288px;":"max-width: 100%; justify-content: center;"}
  gap: ${s.YC};
  align-items: center;
`,d=o.AH`
  max-width: 50%;
`,E=o.AH`
  flex: 0 1 auto;
  min-width: 0;
`,h=({messageId:e,messageValues:t,buttonEl:n,alignLeft:a=!0,color:o="text-3",variant:l="body-primary"})=>r.createElement(u,{alignLeft:a},r.createElement(m.A,{variant:l,color:o},t?r.createElement(c.A,{maxWidth:288,whiteSpace:"nowrap",paddingRight:s.YC},r.createElement(i.sA,{id:e,values:t})):r.createElement(i.sA,{id:e})),n?r.createElement(c.A,{className:a?E:d},n):null)},532988(e,t,n){n.d(t,{A:()=>C});var r=n(469733),a=n(296540),o=n(217439),l=n(968906),i=n(90757),s=n(566723),c=n(294303),m=n(398300),u=n(623771),d=n(845030),E=n(916537),h=n(532419),p=n(413146),A=n(94313),_=n(932752);const C=({last_uplink_mac:e,last_uplink_name:t,last_uplink_remote_port:n,disconnected_at:C,disabled:g,separatePortNumber:f,maxWidth:S})=>{const{formatMessage:T}=(0,E.tz)(),N=(0,r.useDispatch)(),O=(0,r.useSelector)(h.CC),v=(0,_.Z)(e,O),I=(0,_.z)(t,n,v,T,f),D=(0,a.useCallback)(()=>{g||N((0,d.XP)({type:m.H.DEVICE,id:e}))},[g,N,e]);return a.createElement(a.Fragment,null,v?a.createElement(A.A,{messageId:"COMMON_DEVICE_LAST_CONNECTED_TO",messageValues:{deviceWithPort:a.createElement(c.A,{width:"100%",overflow:"hidden",paddingLeft:s.YC},a.createElement(u.A,{onClick:D,disabled:g,...l.A.addDataTestId(l.A.TestId.SIDE_PANEL_TRIGGER),name:I,port:n,separatePortNumber:f,maxWidth:S}))}}):null,C?a.createElement("div",null,a.createElement(o.A,{color:"text-3"},a.createElement(p.A,{date:(0,i.gH)(C)}))):null)}},932752(e,t,n){n.d(t,{Z:()=>a,z:()=>o});var r=n(6510);const a=(e,t)=>e?t.find(({mac:t})=>t===e):void 0,o=(e,t,n,a,o)=>{const l=!o&&t?` ${a({id:"DEVICE_PROPERTIES_PORT_WITH_NUMBER"},{port:t})}`:"";return e?`${e}${l}`:n?`${(0,r.Q)(n)}${l}`:a({id:"COMMON_FALLBACK"})}},708019(e,t,n){n.d(t,{A:()=>s});var r=n(296540),a=n(370969),o=n(780811),l=n(94313),i=n(762334);const s=({type:e,name:t,mac:n,uplink:s,state:c,model:m,disabled:u,alignLeft:d})=>(0,i.n)(c,s)?r.createElement(l.A,{messageId:(0,o.E4T)({model:m})?"COMMON_CONNECTED_TO":"DEVICE_MESHING_TO",alignLeft:d,buttonEl:r.createElement(a.E,{device:{type:e,name:t,mac:n,uplink:s},size:"medium",disabled:u})}):null},762334(e,t,n){n.d(t,{n:()=>i});var r=n(469733),a=n(602197),o=n(532419),l=n(211368);const i=(e,t)=>{const n=(0,r.useSelector)(o.CC),i=t.uplink_mac?n.find(({mac:e})=>e===t.uplink_mac):void 0,s=Boolean(t.signal);return l.q[e]===a.g.CONNECTED&&i&&s?i:void 0}},129361(e,t,n){n.d(t,{A:()=>m});var r=n(296540),a=n(708019),o=n(392699),l=n(532988),i=n(370969),s=n(94313);const c=({type:e,name:t,mac:n,uplink:a,disabled:o,maxWidth:l,peer_ubb:c,deviceState:m,ubb_pairing_state:u})=>r.createElement(s.A,{messageId:"COMMON_CONNECTED_TO",buttonEl:r.createElement(i.E,{device:{type:e,name:t,mac:n,uplink:a,peer_ubb:c,deviceState:m,ubb_pairing_state:u},maxWidth:l,disabled:o,separatePortNumber:!0})}),m=({connectionStatus:e,activeItem:{type:t,last_uplink:n,uplink:i,state:s,name:m,mac:u,model:d,disconnected_at:E,peer_ubb:h,deviceState:p,ubb_pairing_state:A},disabled:_,uplinkNameMaxWidth:C=195})=>{switch(e){case o.v.OFFLINE:return r.createElement(l.A,{last_uplink_mac:n?.uplink_mac,last_uplink_name:n?.uplink_device_name,last_uplink_remote_port:n?.uplink_remote_port,disconnected_at:E,disabled:_,separatePortNumber:!0,maxWidth:C});case o.v.MESHING:return r.createElement(a.A,{type:t,name:m,model:d,mac:u,uplink:i,state:s,disabled:_});case o.v.CONNECTED:return r.createElement(c,{type:t,name:m,mac:u,uplink:i,disabled:_,maxWidth:C,peer_ubb:h,deviceState:p,ubb_pairing_state:A});default:return null}}},392699(e,t,n){var r;n.d(t,{v:()=>r}),function(e){e.OFFLINE="offline",e.MESHING="meshing",e.CONNECTED_INTERRUPTED="connected-interrupted",e.CONNECTED="connected"}(r||(r={}))},281884(e,t,n){n.d(t,{H:()=>l});var r=n(780811),a=n(768195),o=n(392699);const l=(e,t)=>(0,r.aK8)(e)?o.v.OFFLINE:t===a.au.WIRELESS?o.v.MESHING:o.v.CONNECTED},766624(e,t,n){n.d(t,{A:()=>s});var r=n(296540),a=n(271856),o=n(709690),l=n(284428),i=n(566723);const s=({description:e,isInteractive:t,portal:n=!0,cursorType:s,title:c,position:m,width:u,iconProps:d,disabled:E=!1})=>{const h=(0,l.Im)()||E,p=(0,l.q)();return r.createElement(a.A,{description:e,portal:n,isInteractive:t,style:{display:"flex",alignItems:"center"},cursorType:s,title:c,position:m,width:u,disableHover:p},r.createElement(o.A,{isActive:!0,size:"original",opacity:h?i.xN:void 0,...d}))}},814680(e,t,n){n.d(t,{W:()=>a,k:()=>r});const r=34,a=12*r},451449(e,t,n){n.d(t,{I:()=>r});const r=(0,n(296540).createContext)({fields:!1,labels:!1,tooltipPopovers:!1,tooltipIcons:!1})},284428(e,t,n){n.d(t,{Im:()=>s,iL:()=>c,mQ:()=>l,pv:()=>o,q:()=>i});var r=n(296540),a=n(451449);function o(){return(0,r.useContext)(a.I)}function l(){return o().fields}function i(){return o().tooltipPopovers}function s(){return o().tooltipIcons}function c(){return o().labels}},935780(e,t,n){n.d(t,{A:()=>b});var r=n(296540),a=n(469733),o=n(592510),l=n(525512),i=n(413914),s=n(687573),c=n(648092),m=n(906593),u=n(171073),d=n(984652),E=n(602197),h=n(960987),p=n(691294);const A=new Map,_="device-watch-mode-listener",C=["mac","state"],g=["uplink_mac","type","unifi_device"],f=({mac:e,state:t},n)=>Boolean(e&&n)&&e!==n&&t===h.A[E.g.CONNECTED],S=e=>e.type!==p.sK.WIRELESS&&e.type!==p.sK.WIRED||e.unifi_device?void 0:e.uplink_mac;var T,N,O=n(801081),v=n(189601),I=n(602021),D=n(532419),M=n(239417);!function(e){e.DEVICE_MAC="device_mac",e.IS_WATCHED="is_watched",e.WATCHED_TIMEOUT="watched_timeout",e.UPDATE_INTERVAL_SECONDS="update_interval_seconds"}(T||(T={})),function(e){e.INSTANCES="instances",e.TIMEOUT="timeout"}(N||(N={}));const b=e=>{const t=(0,a.useDispatch)(),n=(0,a.useSelector)((0,r.useMemo)(()=>{return t=e,(0,v.WY)()((0,O.Mz)((0,M.kV)(t,g),S),e=>e);var t},[e])),E=(0,r.useMemo)(()=>n||e,[n,e]),h=(0,a.useSelector)((0,r.useMemo)(()=>{return e=E,(0,v.WY)()((0,O.Mz)((0,D.bw)(e,C),I.vc,f),e=>e);var e},[E])),p=(0,a.useSelector)(c.a),b=(0,r.useMemo)(()=>p[m.Uz],[p]),P=(0,r.useCallback)(e=>{b.send({type:i.E.WATCH_DEVICE,device_mac:e})},[b]),x=(0,r.useCallback)(({[T.IS_WATCHED]:e,[T.WATCHED_TIMEOUT]:t,[T.DEVICE_MAC]:n})=>{if(e){const e=1e3*t;if(e>Date.now()){const t=A.get(n);t&&(t[N.TIMEOUT]=setTimeout(()=>{P(n)},(e=>Math.max(e-Date.now()-5e3,5e3))(e)))}}},[P]),y=(0,r.useCallback)(e=>(0,l.K6)(e,x,!1,(e=>`${_}::${e}`)(e)),[x]);(0,r.useEffect)(()=>{if(h){Object.keys((0,l.WM)()).some(e=>e.startsWith(_))||s._[i.E.WATCH_DEVICE].map(y);const e=A.get(E);e?e[N.INSTANCES]+=1:(P(E),A.set(E,{[N.INSTANCES]:1,[N.TIMEOUT]:void 0}))}return()=>{const e=A.get(E);e&&(e[N.INSTANCES]>1?e[N.INSTANCES]-=1:(clearTimeout(e[N.TIMEOUT]),A.delete(E)),A.size||Object.keys((0,l.WM)()).filter(e=>e.startsWith(_)).forEach(l.$N))}},[P,y,E,h]),(0,r.useEffect)(()=>{t((0,u.Uc)(void 0,{crudCacheStrategy:{type:o.e.CACHE}})),t((0,d.$3)(void 0,{crudCacheStrategy:{type:o.e.CACHE}}))},[t])}},350120(e,t,n){n.d(t,{b:()=>r});const r=e=>{if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"==typeof e){const t=Number.parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)?t:null}return null}},853699(e,t,n){n.d(t,{$V:()=>i,UE:()=>l,Vi:()=>s});var r=n(741494),a=n.n(r),o=n(874734);const l={NONE:{url:null,grain:null,grainInSeconds:null,translationKey:null},MINUTES:{url:o.FE.MINUTES,grain:3e5,grainInSeconds:300,translationKey:"GRANULARITY_5_MINUTES"},HOURLY:{url:o.FE.HOURLY,grain:36e5,grainInSeconds:3600,translationKey:"GRANULARITY_HOURLY"},DAILY:{url:o.FE.DAILY,grain:864e5,grainInSeconds:86400,translationKey:"GRANULARITY_DAILY"},MONTHLY:{url:o.FE.MONTHLY,grain:2592e6,grainInSeconds:2592e3,translationKey:"GRANULARITY_MONTHLY"}},i=(e,t,n,r)=>{const o=a()(t,e);return n&&(o<1||r&&o<=1)?l.MINUTES:o<=7?l.HOURLY:o<120?l.DAILY:l.MONTHLY},s=(e,t)=>{switch(e){case o.FE.DAILY:return`1${t({id:"COMMON_UNIT_D"})}`;case o.FE.HOURLY:return`1${t({id:"COMMON_UNIT_H"})}`;case o.FE.MINUTES:return`5${t({id:"COMMON_UNIT_MIN"})}`;default:return""}}}}]);