"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[9005],{689645:(e,t,r)=>{r.r(t),r.d(t,{default:()=>Ks});var a=r(296540),n=r(71479),l=r(96121),o=r(171073),i=r(592510),s=r(860923),c=r(582724),d=r(627440),u=r(984652),m=r(834959),E=r(413357),_=r(745667),A=r(37e3),p=r(566723),O=r(457311),g=r(920377),C=r(634229),S=r(896291),T=r(105540),M=r(604482),h=r(294303),I=r(469733),N=r(162420),P=r(217439),R=r(705145),b=r(271856),f=r(459449),v=r(780811),D=r(289186),L=r(962669),x=r(253198),w=r(154005),k=r(6510),y=r(311785),G=r(840279),V=r(398300),F=r(845030),U=r(635102),B=r(380584),W=r(108199),H=r(874807),$=r(490551),z=r(951106),Y=r(17437),K=r(998837),j=r(822336),Q=r(962101),q=r(791264),X=r(213601),J=r(431247),Z=r(691108),ee=r(939703),te=r(975397),re=r(518559);const ae=(0,q.xn)(10),ne=(0,n.A)(h.A,{shouldForwardProp:e=>!["color","isDisabled","isLocating","disableSelectionEvents"].includes(e)})`
  align-items: center;
  color: ${({theme:{motifPalette:e},color:t})=>e[t]};
  justify-content: center;
  position: relative;
  pointer-events: auto;
  border-radius: ${j.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?Y.AH`
          animation: ${ae} 1s cubic-bezier(0.5, 1, 0, 1) infinite alternate;
        `:""}
`,le=(0,n.A)("div",{shouldForwardProp:e=>"stacked"!==e})`
  position: relative;
  width: ${x.Dq}px;
  height: ${x.Dq}px;
`,oe={0:{top:0,left:0,topSelected:0,leftSelected:0,topHovered:0,leftHovered:0,height:x.Dq,width:x.Dq,heightSelected:x.Dq,widthSelected:x.Dq,heightHovered:x.Dq,widthHovered:x.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}},ie=(0,n.A)("div",{shouldForwardProp:e=>!["background","border","order","isSelected","isHovered","isStacked"].includes(e)})`
  position: absolute;
  transform: translate(
    ${({order:e,isSelected:t,isHovered:r})=>oe[e][t?"leftSelected":r?"leftHovered":"left"]}px,
    ${({order:e,isSelected:t,isHovered:r})=>oe[e][t?"topSelected":r?"topHovered":"top"]}px
  );

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

  border: ${({order:e})=>0!==e?"none":"1px solid"} ${({border:e})=>e};
  border-radius: ${p.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:{motifPalette:{uBlue06:r}}})=>e&&0===t?`\n      outline: 2px solid ${r}; \n      outline-offset: 1px;\n      `:""}
`,se=(0,n.A)("div")`
  position: absolute;
  right: 2px;
  top: 2px;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: ${4};
`,ce=(0,n.A)(P.A)`
  position: absolute;
  text-align: left;
  bottom: 0px;
  left: 4px;
  pointer-events: none;
  z-index: 4;
`,de=(0,n.A)("div")`
  position: absolute;
  width: ${2*x.Dq+16}px;
  height: ${x.Dq+8}px;
  top: -${p.YC};
  left: -${p.YC};
  z-index: -1;
  background: ${({theme:{themeName:e}})=>j.Ay[`desktop-color-ublue-01-${e}`]};
  border-radius: ${p.kc};
  border: 1px solid ${({theme:{themeName:e}})=>j.Ay[`desktop-color-ublue-04-${e}`]};
`,ue=({port:e,isFirstPortInMcLagLinks:t,isFirstPortWan:r,isFirstRow:n})=>{const l=(0,I.useDispatch)(),o=(0,I.useSelector)(w.x$),{motifPalette:i}=(0,K.u)(),s=(0,I.useSelector)(w.UH),c=(0,I.useSelector)(w.pN),d=(0,I.useSelector)(w.XS),[u,m]=(0,a.useState)(!1),E=(0,I.useSelector)(D.QR),_=d,A=(0,I.useSelector)((0,a.useMemo)(()=>(0,D.JX)(e.port_idx||0,e.device.mac),[e.port_idx,e.device.mac])),{background:p,border:O,text:g,stackBackground:C=p,stackBackgroundDark:S=p}=(0,a.useMemo)(()=>(0,q.PI)(e),[e]),T=Boolean(e.isInTargetDevice||e.isInMcLink),M=d?Boolean(e.port_idx&&c.includes(e.port_idx)):Boolean(e.port_idx&&s.includes((0,J.FS)(e.device.mac,e.port_idx))),h=!(0,te.s)(e,s,r,M,t,T,E,d,c),N=(0,a.useCallback)(t=>{if(t.stopPropagation(),!_&&!h&&e.port_idx){const r=(0,J.FS)(e.device.mac,e.port_idx),a=t.metaKey||t.ctrlKey;l(a?(0,Q.Ao)((0,re.QP)(r,s)):(0,Q.Ao)((0,re.Um)(r)))}},[l,_,h,e.device.mac,e.port_idx,s]),P=Boolean(e.aggregationGroup),R=u||Boolean(e.lag_idx)&&e.lag_idx===o,b=(0,a.useCallback)(()=>{_||(e.lag_idx&&l((0,Q.L$)(e.lag_idx)),m(!0))},[l,_,e.lag_idx]),f=(0,a.useCallback)(()=>{_||(l((0,Q.L$)(null)),m(!1))},[l,_]),v=(0,K.u)(),{card1Background:x,card2Background:k}=(0,a.useMemo)(()=>({card1Background:(0,ee.pW)(i[p],"dark"===v.themeName?i[S]:i[C],50),card2Background:(0,ee.pW)(i[p],"dark"===v.themeName?i[S]:i[C],100)}),[p,C,S,i,v.themeName]);return a.createElement(Z.A,{port:e,position:n?"top":"bottom"},a.createElement(ne,{onClick:N,color:g,isDisabled:h,isLocating:A,disableSelectionEvents:_,onMouseEnter:b,onMouseLeave:f},a.createElement(le,{stacked:P},a.createElement(ie,{order:0,background:i[p],border:i[O],isSelected:M,isHovered:R}),P&&a.createElement(a.Fragment,null,a.createElement(ie,{order:1,background:x,border:i[O],isSelected:M,isHovered:R}),a.createElement(ie,{order:2,background:k,border:i[O],isSelected:M,isHovered:R}))),a.createElement(se,null,a.createElement(X.A,{icon:e.icon})),a.createElement(ce,{size:"small",color:"inherit"},(0,L.Cu)(e,e.device?.model)),(0,J.s_)(e.port_idx,e.device?.model)?a.createElement(de,null):null))};var me=r(118818),Ee=r(697490),_e=r(825032);const Ae=(0,n.A)(h.A,(0,y.A)("hide"))`
  align-items: center;
  justify-content: center;
  width: ${x.Dq}px;
  height: ${x.Dq}px;
  border-radius: ${p.YC};
  padding: ${p.YC};
  background: ${({theme:{motifPalette:{neutral01:e}}})=>e};
  cursor: pointer;
  position: relative;
  ${(0,te.g)(x.Dq)}
`,pe=(0,n.A)(me.A)`
  width: ${p.YC};
  height: ${p.YC};
  position: absolute;
  background-color: ${({theme:{motifPalette:{neutral08:e,neutral04:t},themeName:r}})=>r===_e.S.DARK?t:e};
  top: ${p.YC};
  left: ${p.YC};
`,Oe=({connectedDevice:e,connectedClient:t,hide:r,wanProviderName:n,onClick:l,isActive:o})=>e||t||n?a.createElement(Ae,{hide:r,onClick:l},o?null:a.createElement(pe,null),a.createElement(h.A,{opacity:o?void 0:W.q},a.createElement(Ee.A,{size:32,connectedClient:t,connectedDevice:e,wanProviderName:n}))):null,ge=(0,n.A)(R.A)`
  text-align: center;
  cursor: pointer;
  max-width: ${x.Dq}px;
`,Ce=(0,n.A)(h.A,(0,y.A)("hide","isActive"))`
  ${(0,te.g)(20)};
  cursor: pointer;
  opacity: ${({isActive:e})=>e?1:W.q};
`,Se=({onClick:e,hide:t,label:r,isActive:n})=>a.createElement(Ce,{hide:t,onClick:e,isActive:n},a.createElement(ge,{isTruncated:!0,size:"xsmall",weight:"bold",color:"text-2"},r));var Te=r(927099);const Me=({poe_enable:e,poe_power:t})=>{const r=(0,L.lG)({poe_enable:e,poe_power:t});return r?a.createElement(h.A,null,a.createElement(Te.A,{color:"tertiary",size:"label"},r)):null},he=(0,n.A)(h.A,{shouldForwardProp:e=>"isFirstRow"!==e})`
  flex-direction: ${({isFirstRow:e})=>e?"column-reverse":"column"};
  justify-content: flex-start;
  align-items: center;
  gap: ${p.YC};
  position: relative;
  max-width: ${x.Dq}px;
`,Ie=(0,n.A)(h.A,(0,y.A)("hide","isActive"))`
  width: 1px;
  height: ${8}px;
  opacity: ${({isActive:e})=>e?1:0};
  background: ${({theme:{motifPalette:{neutral04:e}}})=>e};
  ${(0,te.g)(8)}
`,Ne=(0,a.memo)(({isFirstRow:e,port:t,hideOptionalElements:r,topConnectionMac:n,setTopConnectionMac:l})=>{const o=(0,I.useDispatch)(),i=(0,I.useSelector)(D.pZ),s=(0,I.useSelector)(D.uq),{connectedClient:c,connectedDevice:d,connectedMac:m,wanConfiguration:E,wanProviderName:_}=(0,U.A)(t),{lastConnectionClient:A,lastConnectionDevice:p}=(0,W.A)(t),O=A?.mac||p?.mac,g=(0,I.useSelector)((0,a.useMemo)(()=>{const e=m||O;return e?(0,B.r)(e):H.A},[m,O])),C=(0,a.useMemo)(()=>E?V.H.ISP_DETAILS:d||p?V.H.DEVICE:g?V.H.UNIFI_DEVICE_CLIENT:c||A?V.H.CLIENT:void 0,[d,p,c,A,g,E]),S=(0,a.useCallback)(e=>{e.stopPropagation();const t=E?.configuration?.wan_networkgroup||m||O;t&&(A&&C===V.H.CLIENT&&!m&&o((0,u.W6)(t,!0)),o((0,F.XP)({type:C,id:t})))},[m,o,A,O,C,E?.configuration?.wan_networkgroup]),T=!(!m&&!E||!t.up),M=Boolean(A||p),N=_||(0,k.Q)(d||p)||(0,z.tn)(c||A),P=T?void 0:A?.last_seen||p?.last_seen,R=!e,b=P?"text-3":"text-2";return(0,a.useEffect)(()=>{n!==t.device.mac&&e&&(T||M)&&l(t.device.mac)},[t.device.mac,n,l,T,M,e]),a.createElement(he,{isFirstRow:e},a.createElement(h.A,null,a.createElement(ue,{port:t,isFirstPortInMcLagLinks:s,isFirstPortWan:i,isFirstRow:e})),T||M?a.createElement($.A,{label:N,lastSeen:P,isUpsideDown:R,isTooltipAllowed:Boolean(N)},a.createElement(he,{isFirstRow:e},a.createElement(Ie,{hide:r,isActive:T}),a.createElement(Oe,{connectedDevice:d||p,connectedClient:c||A,wanProviderName:_,hide:r,onClick:S,isActive:T}),a.createElement(Se,{label:N,onClick:S,hide:r,textColor:b,isActive:T}),a.createElement(Me,{poe_enable:t.poe_enable,poe_power:t.poe_power}))):null)}),Pe=(0,n.A)(h.A)`
  flex-direction: column;
  justify-content: start;
  gap: ${p.kc};
`,Re=(0,n.A)(h.A)`
  gap: ${p.kc};
`,be=(0,n.A)("div")`
  width: ${x.Dq}px;
`,fe=(0,n.A)(h.A,(0,y.A)("isDiagramTopRowExpanded"))`
  align-items: start;
  padding-top: ${({isDiagramTopRowExpanded:e})=>e?111:40}px;
`,ve=(0,n.A)(R.A)`
  transform: rotate(-90deg) translate(-50%, 0);
  transform-origin: left center;
  position: absolute;
  left: -${p.xO};
  width: max-content;
  max-width: 95px;
`,De=(0,a.memo)(({useStackedData:e,diagramDeviceMac:t})=>{const r=(0,I.useSelector)(D.OF),n=(0,I.useSelector)(D.tU),l=r.filter(e=>e.device.mac===n?.mac),o=r.filter(e=>e.device.mac!==n?.mac),i=(0,I.useSelector)(w.Hd),s=Boolean(n)&&e?l[0]?.device:o[0]?.device,[c,d]=(0,a.useState)(""),u=(0,a.useMemo)(()=>{const{diagram:t}=(0,v.jo)(s?.model);if(!t)return(0,G.A)();const r=t.length?(0,L.sT)(t,s):(0,L.oJ)(s);if(!r)return(0,G.A)();return r.map((t,r)=>a.createElement(Re,{key:`PortDiagramLayoutRow-${r+1}`},t.map((t,s)=>{const u=`PortDiagramLayoutCell-${r+1}-${s+1}`,m=(n&&e?l:o).find(e=>e.port_idx===t?.portNumber);return m?a.createElement(Ne,{port:m,key:u,isFirstRow:0===r,hideOptionalElements:i&&Boolean(n),setTopConnectionMac:d,topConnectionMac:c}):a.createElement(be,{key:u})})))},[o,s,i,n,l,c,e]);if(!u||0===u.length)return a.createElement(h.A,{gap:p.kc},a.createElement(N.A,{isActive:!0}),a.createElement(P.A,{size:"small"},a.createElement(f.sA,{id:"DEVICE_DIAGRAM_MISSING"})));const m=(0,k.Q)({name:s.name,model:s.model,mac:s.mac});return a.createElement(h.A,null,n&&a.createElement(fe,{isDiagramTopRowExpanded:c===t&&!i},a.createElement(b.A,{portal:!0,description:m,position:"top",noWrap:!0},a.createElement(ve,{size:"small",color:"text-3",isTruncated:!0},m))),a.createElement(Pe,null,u))});var Le=r(226712);const xe=440,we=(0,n.A)(h.A)`
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: ${p.kc};
`,ke=(0,n.A)(h.A)`
  gap: ${p.kc};
`,ye=(0,n.A)("div")`
  width: ${38}px;
`,Ge=(0,n.A)(h.A,(0,y.A)("scale"))`
  transform: scale(${({scale:e})=>e});
  justify-content: center;
  align-self: center;
`,Ve=(0,n.A)(h.A)`
  flex-direction: column;
  gap: ${p.kc};
`,Fe=(0,n.A)(h.A)`
  min-height: 32px;
`,Ue=(0,n.A)(h.A)`
  gap: ${p.YC};
  align-items: center;
`;var Be=r(340936),We=r(864155);const He=({children:e})=>{const{spaceOffset:t,containerRef:r,contentRef:n,scale:l}=(()=>{const e=(0,a.useRef)(null),t=(0,a.useRef)(null),r=Boolean(e.current)&&Boolean(t.current),{width:n=0}=(0,Be.A)({ref:t}),{width:l=0}=(0,Be.A)({ref:e}),[o,i]=(0,a.useState)(0),s=Math.min((n-16)/l,1),c=window.innerWidth-(e.current?.getBoundingClientRect().right||0),d=c-(window.innerWidth-(t.current?.getBoundingClientRect().right||0)),u=(0,a.useRef)(d);u.current=d;const m=(0,a.useRef)(416-c);m.current=416-c;const E=(0,I.useSelector)(w.UH),_=(0,I.useSelector)(We.WS),A=Boolean(E.length)||_,p=(0,I.useSelector)(D.QR),O=(0,I.useSelector)(D.GG);return(0,a.useEffect)(()=>{if(A&&!p&&m.current>0){const e=Math.min(m.current,u.current),t=2*e,r=m.current-e;i(r+t)}else i(0)},[A,p,r,O]),{spaceOffset:o,scale:s,containerRef:t,contentRef:e}})();return a.createElement("div",{ref:r,style:{marginRight:t,transitionDuration:"0.2s",alignItems:"center"}},a.createElement(h.A,{gap:p.kc,flexDirection:"column",overflow:"visible"},a.createElement(Ge,{scale:l,ref:n},e)))},$e=(0,a.memo)(({selectedDeviceMac:e,diagramDeviceMac:t,useStackedData:r,showLegend:n})=>a.createElement(h.A,{flexDirection:"column",gap:p.kc},a.createElement(He,null,a.createElement(De,{useStackedData:r,diagramDeviceMac:t})),n?a.createElement(h.A,{justifyContent:"center"},a.createElement(Le.A,{isSingleLine:!0,deviceMac:e})):null));var ze,Ye=r(944373),Ke=r(432589),je=r(132196),Qe=r(249304),qe=r(368476),Xe=r(905410),Je=r(29896),Ze=r(815297),et=r(415246),tt=r(984297),rt=r(602021),at=r(440503),nt=r(200826),lt=r(318787),ot=r(278473);!function(e){e.CLASSIC="CLASSIC",e.SFP_ANALYZER="SFP_ANALYZER"}(ze||(ze={}));var it=r(838738),st=r(758649),ct=r(127737),dt=r(881716),ut=r(720903),mt=r(734339),Et=r(775699),_t=r(580176),At=r(627915),pt=r(278703),Ot=r(489391),gt=r(346010),Ct=r(584916),St=r(572112),Tt=r(546391);const Mt=["","k","M","G","T","P","E","Z","Y"],ht=e=>e>=St.A.XXL.TO?25:e>=St.A.L.TO?13:e>=St.A.M.TO?7:4,It={[Ct.l.ONE_DAY]:{frequency:ht,label:({index:e,value:t,selfUse24HourTime:r,selfHourCycle:a,documentWidth:n,siteTimezone:l,language:o,formatMessage:i})=>e!==ht(n)-1?new Intl.DateTimeFormat(o,{hourCycle:a,hour:"numeric",timeZone:l,...r&&{minute:"numeric"}}).format(t).toUpperCase():i({id:"COMMON_NOW"})},[Ct.l.ONE_WEEK]:{frequency:()=>7,label:({value:e,language:t})=>new Intl.DateTimeFormat(t,{weekday:"short"}).format(e)},[Ct.l.ONE_MONTH]:{frequency:(e,t)=>Math.ceil(t/(e>=St.A.XL.TO?1:e>=St.A.M.TO?2:4)),label:({value:e,language:t})=>new Intl.DateTimeFormat(t,{month:"short",day:"numeric"}).format(e)},[Ct.j]:{frequency:()=>10,label:({value:e,selfHourCycle:t,siteTimezone:r,language:a})=>new Intl.DateTimeFormat(a,{hourCycle:t,month:"short",day:"numeric",hour:"numeric",minute:"numeric",timeZone:r}).format(e).replace(Tt.sO,e=>e.toUpperCase())}};class Nt extends Ot.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${Mt[this.power]}Wh`}}class Pt extends Ot.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${Mt[this.power]}Pkts`}}class Rt extends Ot.Un{constructor(e,t){super(e,"bytes","SI",t),this.unit=`${Mt[this.power]}W`}toString(){return Number.isFinite(this.bytes)?((e,t)=>{const r=Math.abs(e);return r<10?`${e.toFixed(2)} ${t}`:r<100?`${e.toFixed(1)} ${t}`:`${e.toFixed(0)} ${t}`})(this.value,this.unit):""}}const bt=e=>(t,r)=>{const{source:a,usage:n}=e;switch(a){case qe.I0.PACKETS:case qe.I0.ERRORS:case qe.I0.DROPPED:return new Pt(t,r);case qe.I0.POE:return new Rt(t,r);case qe.I0.USAGE:return n===qe.AM.BPS?(0,Ot.cS)(t,"bitrate","SI",r):(0,Ot.cS)(t,void 0,void 0,r);default:return(0,Ot.cS)(t,void 0,void 0,r)}},ft=e=>{const t=(e=>{let t="";return e.source===qe.I0.USAGE&&(e.usage===qe.AM.BPS&&(t="rate"),e.usage===qe.AM.BYTES&&(t="bytes")),e.source===qe.I0.PACKETS&&(e.packets===qe.uO.ALL&&(t="packets"),e.packets===qe.uO.BROADCAST&&(t="broadcast"),e.packets===qe.uO.MULTICAST&&(t="multicast")),t})(e);return(r,a,n)=>{const l="number"==typeof a?`port_${a}`:`wan${a}`;if(e.source===qe.I0.USAGE&&e.usage===qe.AM.BPS){const t=r[`${l}-tx_bytes`]||0,a=r[`${l}-rx_bytes`]||0;if(!n)return 0;if(e.direction===qe.O_.ALL)return(0,gt.tI)(t+a,n);if(e.direction===qe.O_.UPLINK)return(0,gt.tI)(t,n);if(e.direction===qe.O_.DOWNLINK)return(0,gt.tI)(a,n)}if(e.source===qe.I0.POE)return r[`${l}-poe_power`]||0;if(e.source===qe.I0.ERRORS){const t=r[`${l}-tx_errors`]||0,a=r[`${l}-rx_errors`]||0;if(e.direction===qe.O_.ALL)return t+a;if(e.direction===qe.O_.UPLINK)return t;if(e.direction===qe.O_.DOWNLINK)return a}if(e.source===qe.I0.DROPPED){const t=r[`${l}-tx_dropped`]||0,a=r[`${l}-rx_dropped`]||0;if(e.direction===qe.O_.ALL)return t+a;if(e.direction===qe.O_.UPLINK)return t;if(e.direction===qe.O_.DOWNLINK)return a}const o=r[`${l}-tx_${t}`]||0,i=r[`${l}-rx_${t}`]||0;return e.direction===qe.O_.ALL?o+i:e.direction===qe.O_.UPLINK?o:e.direction===qe.O_.DOWNLINK?i:0}},vt=()=>{const e=(0,I.useDispatch)(),{motifPalette:t}=(0,K.u)(),r=(0,I.useSelector)(w.zD),n=(0,a.useMemo)(()=>(({navy06:e,navy04:t,aqua04:r,green04:a,green06:n,green08:l,lime06:o,yellow06:i,purple06:s,yellow09:c,lime07:d,aqua06:u,green09:m,navy05:E,green05:_,lime09:A,uBlue05:p,purple04:O,yellow07:g,uBlue04:C,uBlue06:S,lime05:T,uBlue09:M,lime04:h,navy09:I,orange07:N,green10:P,yellow04:R,uBlue08:b,purple05:f,orange09:v,lime08:D,uBlue10:L,orange06:x,aqua09:w,yellow05:k,orange05:y,purple07:G,navy08:V,purple08:F,aqua08:U,orange08:B,orange10:W,green07:H,navy07:$,aqua07:z,navy10:Y,orange04:K,aqua05:j,aqua10:Q,uBlue07:q,yellow08:X,yellow10:J})=>[e,t,r,a,n,l,o,i,s,c,d,u,m,E,_,A,W,p,O,g,j,Q,C,S,T,M,h,I,N,P,R,b,$,f,v,D,K,L,x,w,Q,k,W,y,G,V,F,U,B,W,H,$,z,Y,K,j,Q,q,X,J])(t),[t]),l=(0,a.useCallback)(t=>{const a={...r};t.forEach(e=>{a[e]=(0,re.O)(e,t,a,n),Object.keys(a).forEach(t=>{a[t]===a[e]&&t!==e&&delete a[t]})}),e((0,Q.Ao)(t)),e((0,Q.hl)(a))},[r,e,n]);return(0,a.useMemo)(()=>({setSelectedPortsAndAssignColors:l}),[l])};var Dt=r(206469),Lt=r(15153),xt=r(889549),wt=r(550495),kt=r(618760),yt=r(445535),Gt=r(149188),Vt=r(664967),Ft=r(992149);const Ut=[Vt.E[Ct.l.ONE_DAY],Vt.E[Ct.l.ONE_WEEK],Vt.E[Ct.l.ONE_MONTH]],Bt=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(w.Ky),r=(0,a.useCallback)(t=>{e((0,Q.m$)(t))},[e]),[n,l]=(0,a.useState)({startDate:t.startDate,endDate:t.endDate}),o=(0,a.useCallback)(({id:e})=>{const t=Ut.find(t=>t.id===e);t?r({...t.getRange(new Date),preset:e}):n&&r({...n,preset:Ct.j})},[n,r]),i=(0,a.useMemo)(()=>Ut.map(({id:e,message:t,messageValues:r})=>({id:e,label:a.createElement(f.sA,{id:t,values:r})})).concat({id:Ct.j,label:a.createElement(Gt.A,null)}),[]),s=(0,a.useCallback)(e=>{l(e),r({...e,preset:Ct.j})},[r]);return a.createElement(Ft.A,{presets:i,selectedPreset:t.preset,range:n,onSelectTab:o,onSelectCustomRange:s,showCalendar:t.preset===Ct.j})};var Wt=r(436017);const Ht=()=>{const{handleStatsChange:e}=jr(),t=(0,I.useSelector)(D.QR),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Wt.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement(h.A,{gap:p.YC,alignItems:"center"},a.createElement(f.sA,{id:"COMMON_STATS"})))},$t=()=>{const{handleVlansChange:e}=jr(),t=(0,I.useSelector)(D.$X),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Wt.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement(f.sA,{id:"PORTS_VLANS_DIAGRAM"}))};var zt=r(312583),Yt=r(445054),Kt=r(803676);const jt=(0,a.memo)(()=>(0,Yt.A)(M.g1.PORT_MANAGEMENT)?a.createElement(zt.A,{leftFilterPageId:M.g1.PORT_MANAGEMENT,columns:Object.values(Kt.YH),columnLabels:Kt.Cz,tableType:Qe.l.PORTS}):null);var Qt=r(9535),qt=r(861878),Xt=r(318195),Jt=r(974333),Zt=r(185657),er=r(532419),tr=r(774482);const rr=je.AH`
  display: none;
`,ar=a.createElement(h.A,{alignItems:"center"},a.createElement(R.A,{size:"medium",color:"inherit"},a.createElement(f.sA,{id:"COMMON_RESET_STATISTICS"})),a.createElement(Jt.A,null)),nr=()=>{const{formatMessage:e}=(0,f.tz)(),t=(0,I.useSelector)(D.aq),{mac:r,port_table:n}=t||{},[l,o]=(0,a.useState)([]),{resetPortStatistics:i}=(0,tr.X)(),s=(0,a.useCallback)(e=>{const t=e.map(e=>{const t=(0,Zt.CQ)(n?.find(t=>t.port_idx===+e));return i(r,+e,t)});Promise.all(t),o([])},[r,n,i]),c=(0,a.useMemo)(()=>n.map(e=>({label:e.name,value:e.port_idx,id:e.port_idx})),[n]),d=(0,a.useCallback)(e=>{e&&o(c.map(e=>e.value))},[c]),u=(0,a.useCallback)((e,t)=>{o(e?[...l,t]:l.filter(e=>e!==t))},[l]),m=(0,a.useCallback)(e=>{o(e?c.map(e=>e.value):[])},[c]);return a.createElement(Xt.A.Popover,{options:c,onSave:s,value:l,onOpenChange:d,searchPlaceholder:e({id:"COMMON_SEARCH"}),saveButtonText:e({id:"COMMON_ACTION_RESET"}),cancelButtonText:e({id:"COMMON_ACTION_CANCEL"}),onOptionCheck:u,onChangeSelectAll:m,saveButtonProps:{disabled:0===l.length},renderToggle:()=>a.createElement(Xt.A.Trigger,{options:c,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:ar,chipContainerClassName:rr})})},lr=({options:e})=>{const[t,r]=(0,a.useState)([]),n=(0,I.useSelector)(er.ID),l=(0,a.useRef)(n),{resetSwitchStatistics:o}=(0,tr.X)(),i=(0,a.useCallback)(t=>{const a=[];t.forEach(t=>{const r=e.find(e=>e.value===t)?.label,n=l.current?.find(e=>e.mac===t);a.push(o(`${t}`,r,n?.port_table))}),Promise.all(a),r([])},[e,o]),{formatMessage:s}=(0,f.tz)(),c=(0,a.useCallback)(t=>{t&&r(e.map(e=>e.value))},[e]),d=(0,a.useCallback)((e,a)=>{r(e?[...t,a]:t.filter(e=>e!==a))},[t]),u=(0,a.useCallback)(t=>{r(t?e.map(e=>e.value):[])},[e]);return a.createElement(Xt.A.Popover,{options:e,onSave:i,onOpenChange:c,value:t,onOptionCheck:d,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:()=>a.createElement(Xt.A.Trigger,{options:e,value:t,onChange:i,editSelectionsButtonStyle:{margin:0},editSelectionsButtonText:ar,chipContainerClassName:rr})})},or=()=>{const e=(0,I.useSelector)(D.fr),t=(0,I.useSelector)(D.KK);if(0===t.length)return null;return t.find(t=>t.mac===e)?a.createElement(nr,null):a.createElement(lr,{options:t})},ir=()=>{const e=(0,I.useDispatch)(),{formatList:t}=(0,f.tz)(),r=(0,I.useSelector)(D.IS),n=(0,a.useMemo)(()=>{const e={};return r.forEach(t=>{const{mac:r}=t.device;e[r]||(e[r]=!0)}),Object.keys(e)},[r]),l=(0,I.useSelector)((0,er.nH)(n)).map(({mac:e,name:t,locating_ports:a})=>({mac:e,name:t,locatingPorts:a?.filter(t=>r.find(r=>r.device.mac===e&&r.port_idx===t))||[]})).filter(({locatingPorts:e})=>e.length>0),i=(0,a.useCallback)(()=>{const r=l.map(({mac:r,locatingPorts:a,name:n})=>e((0,o.cj)({mac:r,name:n},a,!0,t(a))));Promise.all(r)},[e,t,l]);return 0===l.length?null:a.createElement(st.A,{type:"button",size:"medium",variant:"inline",onClick:i},a.createElement(f.sA,{id:"DEVICE_ACTIONS_LOCATE_STOP"}))},sr=()=>a.createElement(h.A,{width:"100%",alignItems:"center",gap:p.kc},a.createElement(or,null),a.createElement(ir,null)),cr=(0,a.memo)(()=>{const e=(0,I.useDispatch)(),{onRestoreDefaults:t,onRestoreDefaultsWithoutDeviceAndNetwork:r,arePortsFiltersInitial:n,arePortFiltersInitialWithoutDeviceAndNetwork:l}=jr(),o=(0,I.useSelector)(D.QR),i=(0,I.useSelector)(D.oE),s=(0,Yt.A)(M.g1.PORT_MANAGEMENT),c=(0,a.useCallback)(()=>{e((0,_t.GD)(M.g1.PORT_MANAGEMENT))},[e]);return a.createElement(h.A,{gap:p.kc,flexDirection:"column"},a.createElement(sr,null),a.createElement(Qt.A,{onClear:o?r:t,disabled:o?l:n}),i?null:a.createElement(qt.A,{onPress:c,labelId:"COMMON_CUSTOMIZE_COLUMNS",disabled:s}))});var dr=r(66804),ur=r(574022),mr=r(657690);const Er=()=>{const{portsFilters:e,handleFilterChange:t}=jr(),r=(e[pt.MQ.PORT_ANOMALY]||{})[pt.dl.ANOMALY_THRESHOLD],n=(0,mr.xO)(r)||(0,mr.fX)(),[l,o]=(0,a.useState)([n.min,n.max]),i=(0,a.useRef)(t);i.current=t;const s=(0,a.useMemo)(()=>(0,ur.A)(e=>{i.current({category:pt.MQ.PORT_ANOMALY,key:pt.dl.ANOMALY_THRESHOLD,value:(0,mr.N1)({min:e[0],max:e[1]})})},500),[]);(0,a.useEffect)(()=>{o([n.min,n.max])},[n.min,n.max]);const c=(0,a.useCallback)(e=>{Array.isArray(e)&&2===e.length&&(o([e[0],e[1]]),s([e[0],e[1]]))},[s]);(0,a.useEffect)(()=>()=>{s.cancel()},[s]);const d=(0,a.useMemo)(()=>a.createElement(f.sA,{id:"COMMON_GENERIC_FROM_TO",values:{from:l[0],to:l[1]}}),[l]);return a.createElement(h.A,{flex:1,width:"100%"},a.createElement(dr.A,{defaultValue:[n.min,n.max],value:l,onChange:c,caption:0,captionEnd:100,labelEnd:d,style:{width:"100%"}}))};var _r=r(805837),Ar=r(888170),pr=r(618025),Or=r(823858),gr=r(362412),Cr=r(814680),Sr=r(6176);const Tr=(0,n.A)(gr.A)`
  z-index: ${Ar.Ay["z-index-side-panel"]-1};
`,Mr=()=>{const e=(0,I.useSelector)(D.fr),t=(0,I.useSelector)(D.N0),{formatMessage:r}=(0,f.tz)(),{handleDeviceDropdownChange:n}=jr(),{motifPalette:{danger:l,neutral00:o,warning:i}}=(0,K.u)();((e,t)=>{const r=(0,I.useSelector)(Ye.D),n=(0,I.useDispatch)(),{handleDeviceDropdownChange:l}=jr();(0,a.useEffect)(()=>{if(e.length>0&&t&&!e.find(e=>e.value===t)){const a=r.find(e=>e.peers.bottom===t&&e.stacking);a?(l(a.peers.top),n((0,Q.gU)(!0))):l(e[0].value)}},[e,t,l,r,n])})(t,e);const s=[{value:Dt.Xb,label:r({id:"COMMON_ALL_PORTS"}),image:a.createElement(pr.A,null)},...t.map(e=>({value:e.value,label:e.label+(e.isOffline?` (${r({id:"COMMON_OFFLINE"})})`:""),image:e.hasError?a.createElement(Or.A,{size:"original",variant:"fill",color:l,fill:o}):e.hasWarning?a.createElement(Or.A,{size:"original",variant:"fill",color:i,fill:o}):a.createElement(Sr.A,{width:20,height:20,model:e.model})}))],c=(0,a.useCallback)(e=>{n(e.value)},[n]);return a.createElement(Tr,{variant:"secondary",searchable:!0,portal:!0,width:"full",onChange:c,options:s,renderOption:_r.q,value:e,maxHeight:Cr.W})};var hr=r(900752);const Ir=({availableTabs:e,selectedTab:t})=>{const{handleSectionChange:r}=jr(),n=(0,a.useCallback)(e=>{r(e.id)},[r]);return a.createElement(hr.A,{tabs:e,selectedTab:t,onSelectTab:n})},Nr=()=>{const{handleDeviceDiagramChange:e}=jr(),t=(0,I.useSelector)(D.GG),r=(0,a.useCallback)(t=>{e(t.target.checked)},[e]);return a.createElement(Wt.A,{onChange:r,checked:t,full:!0,size:"small"},a.createElement(f.sA,{id:"PORTS_PORT_DIAGRAM"}))};var Pr=r(936621),Rr=r(366188),br=r(396660),fr=r(524936),vr=r(938325);const Dr=()=>{const{formatMessage:e}=(0,f.tz)(),{handleNetworkDropdownChange:t}=jr(),r=(0,I.useSelector)(Rr.SB),n=(0,I.useSelector)(D.ws),l=(0,a.useMemo)(()=>[{label:e({id:"PORTS_NATIVE_VLANS"}),value:Dt.tJ},...(0,ut.A)(r).sort(br.Cv).map(e=>({label:e.name,value:e._id,additionalInfo:`${(0,vr.jq)(e.vlan,(0,fr.nz)(e))}`})),{label:e({id:"COMMON_NONE"}),value:Dt.se}],[r,e]),o=(0,a.useCallback)(({value:e})=>{t(e||l[0].value)},[t,l]);return a.createElement(gr.A,{variant:"secondary",searchable:!0,width:"full",onChange:o,options:l,renderOption:_r.q,value:n[pt.MQ.NETWORK][pt.MQ.NETWORK],maxHeight:Cr.W,clearable:l.some(e=>e.value===Pr.F)})};var Lr=r(402210),xr=r(727678),wr=r(918060);const kr=je.AH`
  min-width: 16px;
  height: 16px;
`,yr=[pt.ou.FE,pt.ou.GE,pt.ou._2P5GE,pt.ou._10GE,pt.ou._25GE,pt.ou._40GE,pt.ou._100GE,pt.ou.SFP,pt.ou.SFPPLUS,pt.ou.SFP28,pt.ou.QSFP28],Gr=[pt.ou.FE,pt.ou.GE,pt.ou._2P5GE,pt.ou._10GE,pt.ou._25GE,pt.ou._40GE,pt.ou._100GE],Vr=[pt.fA.IN_USE,pt.fA.AVAILABLE,pt.fA.CRITICAL,pt.fA.WARNING],Fr=[pt.rW.POE,pt.rW.POE_PLUS,pt.rW.POE_PLUS_PLUS,pt.rW.POE_PLUS_PLUS_PLUS,pt.rW.POE_PASSTHROUGH,pt.rW.POE_PASSIVE_24V],Ur={[pt.fA.CRITICAL]:"COMMON_CRITICAL",[pt.fA.WARNING]:"COMMON_WARNING",[pt.fA.IN_USE]:"COMMON_IN_USE",[pt.fA.AVAILABLE]:"COMMON_NOT_CONNECTED",[pt.rW.POE]:"COMMON_DEVICE_POE_MODE_POE",[pt.rW.POE_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS",[pt.rW.POE_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS",[pt.rW.POE_PLUS_PLUS_PLUS]:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS",[pt.rW.POE_PASSTHROUGH]:"COMMON_DEVICE_POE_MODE_PASSTHROUGH",[pt.rW.POE_PASSIVE_24V]:"COMMON_DEVICE_POE_MODE_PASSIVE",[pt.ou.FE]:"COMMON_MEDIA_FE",[pt.ou.GE]:"COMMON_MEDIA_GE",[pt.ou._2P5GE]:"COMMON_MEDIA_2P5GE",[pt.ou._10GE]:"COMMON_MEDIA_10GE",[pt.ou._25GE]:"COMMON_PORT_SPEED_GBE_VALUE",[pt.ou._40GE]:"COMMON_PORT_SPEED_GBE_VALUE",[pt.ou._100GE]:"COMMON_PORT_SPEED_GBE_VALUE",[pt.ou.SFP]:"COMMON_MEDIA_SFP",[pt.ou.SFPPLUS]:"COMMON_MEDIA_SFPPLUS",[pt.ou.SFP28]:"COMMON_MEDIA_SFP28",[pt.ou.QSFP28]:"COMMON_MEDIA_QSFP28"},Br={[pt.MQ.MEDIA]:"COMMON_LINK_SPEED",[pt.MQ.POE]:"COMMON_DEVICE_POE_MODE_POE",[pt.MQ.STATUS]:"COMMON_STATUS"},Wr={[pt.ou._25GE]:{value:25},[pt.ou._40GE]:{value:40},[pt.ou._100GE]:{value:100}},Hr=(0,a.memo)(({category:e})=>{const{previewCounts:t,portsFilters:r,handleFilterChange:n}=jr(),l=(0,I.useSelector)(D.oE),{formatMessage:o}=(0,f.tz)(),i=(0,a.useMemo)(()=>{switch(e){case pt.MQ.MEDIA:return yr;case pt.MQ.POE:return Fr;case pt.MQ.STATUS:return Vr;default:return[]}},[e]),s=(0,a.useMemo)(()=>i.map(r=>l&&Gr.includes(r)||l&&e===pt.MQ.POE?null:r===pt.fA.CRITICAL?{id:pt.fA.CRITICAL,title:"",type:"CHECKBOX",checkboxProps:{label:a.createElement(h.A,{gap:p.YC,alignItems:"center"},o({id:"COMMON_CRITICAL"}),t[pt.fA.CRITICAL]?a.createElement(Lr.A,{type:"danger",value:+t[pt.fA.CRITICAL],size:"small",className:kr}):null)},children:[]}:r===pt.fA.WARNING?{id:pt.fA.WARNING,title:"",type:"CHECKBOX",checkboxProps:{label:a.createElement(h.A,{gap:p.YC,alignItems:"center"},o({id:"COMMON_WARNING"}),t[pt.fA.WARNING]?a.createElement(Lr.A,{type:"warning",value:+t[pt.fA.WARNING],size:"small",className:kr}):null)},children:[]}:{id:r,title:`${o({id:Ur[r]},Wr[r])} (${t[r]})`,type:"CHECKBOX",children:[]}).filter(Boolean),[i,e,o,l,t]),c=(0,a.useMemo)(()=>new Set(i.filter(t=>r[e][t])),[i,e,r]),d=(0,a.useMemo)(()=>new Set(i.filter(e=>!c.has(e)&&0===t[e])),[i,t,c]),u=(0,a.useCallback)(t=>{const a=Array.from(t),l=i.find(t=>a.some(e=>e===t)!==r[e][t]);l&&n({category:e,key:l,value:!r[e][l]})},[i,e,n,r]);return s.length?a.createElement(xr.A,{label:a.createElement(f.sA,{id:Br[e]}),isSingleColumn:!0},a.createElement(wr.A.Simplified,{items:s,selectedKeys:c,disabledKeys:d,onSelectionChange:u})):null});var $r;!function(e){e.MAIN="MAIN",e.SFP="SFP"}($r||($r={}));const zr=[{icon:a.createElement(Lt.A,{size:"original"}),label:a.createElement(f.sA,{id:"COMMON_MAIN"}),id:$r.MAIN},{icon:a.createElement(xt.A,{size:"original"}),label:a.createElement(f.sA,{id:"COMMON_MEDIA_SFP"}),id:$r.SFP}],Yr=(0,a.memo)(()=>{const e=(0,I.useSelector)(D.QR),t=(0,I.useSelector)(D.fr)===Dt.Xb,r=(0,I.useSelector)(D.$X),n=(0,I.useSelector)(D.oE),{vlan_caps:l}=(0,I.useSelector)(D.n7),o=!l||(0,kt.zk)(l),i=(0,I.useSelector)(D.oE),{upSfpCount:s}=(0,I.useSelector)(D.Dj),[c,d]=(0,a.useState)(s>0||i);(0,a.useEffect)(()=>{(s||i)&&d(!0)},[s,i]);const u=(0,a.useMemo)(()=>zr.filter(e=>e.id===$r.MAIN||e.id===$r.SFP&&c),[c]),m=i?$r.SFP:$r.MAIN,E=!r,_=!t,A=!t&&!n&&o,O=!t,g=_||A||O;return a.createElement(wt.A,{columns:n?null:a.createElement(jt,null),footer:a.createElement(cr,{leftFilterPageId:M.g1.PORT_MANAGEMENT}),leftFilterPageId:M.g1.PORT_MANAGEMENT,tabs:u.length>1?a.createElement(Ir,{availableTabs:u,selectedTab:m}):null},a.createElement(h.A,{flexDirection:"column",gap:p.kc},n?null:a.createElement(Mr,null),g?a.createElement(yt.A,null,O?a.createElement(Nr,null):null,_?a.createElement(Ht,null):null,A?a.createElement($t,null):null):null,E?a.createElement(yt.A,{label:a.createElement(f.sA,{id:"PORTS_AI_ANOMALY_SCORE"})},a.createElement(Er,null)):null,e?a.createElement(Bt,null):null,E?a.createElement(a.Fragment,null,n?null:a.createElement(Dr,null),a.createElement(Hr,{category:pt.MQ.STATUS}),a.createElement(Hr,{category:pt.MQ.POE}),a.createElement(Hr,{category:pt.MQ.MEDIA})):null))}),Kr=e=>Array.from({length:e},(e,t)=>t+1),jr=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(D.ws),r=(0,I.useSelector)(D.Jp),n=(0,I.useSelector)(D.QR),l=(0,I.useSelector)(D.fr),o=(0,I.useSelector)(D.rG),{setSelectedPortsAndAssignColors:i}=vt(),s=(0,a.useMemo)(()=>Kr(o[l]??0),[o,l]),c=(0,a.useCallback)(()=>{e((0,Q.Ao)([]));const t=(0,ut.A)(Dt.jb),r={...t,[pt.MQ.DEVICE]:{...t[pt.MQ.DEVICE],[pt.Jl.SFP_ANALYZER_OPEN]:!0}};e((0,mt.R)(r)),e((0,Et.yT)(Qe.l.PORTS,{filters:r}))},[e]),d=(0,a.useCallback)(t=>{e((0,mt.R)(t)),e((0,Et.yT)(Qe.l.PORTS,{filters:t}))},[e]),u=(0,a.useCallback)(e=>{let r={...t};for(let t=0;t<e.length;t+=1)r=(0,At.uI)(r,e[t],!0);return r},[t]),m=(0,a.useCallback)(e=>{const t=u([e]);d(t)},[u,d]),E=(0,a.useCallback)(t=>{const r=[];if(e((0,Q.Ao)([])),t===Dt.Xb&&(r.push({category:pt.MQ.DEVICE,key:pt.Jl.STATS_OPEN,value:!1}),r.push({category:pt.MQ.DEVICE,key:pt.Jl.VLANS_OPEN,value:!1})),t!==Dt.Xb&&n){const e=o[t]??0,r=Kr(e),a=r?.map(e=>(0,J.FS)(t,e))||(0,G.A)();i(a)}r.push({category:pt.MQ.DEVICE,key:pt.Jl.DEVICE,value:t});const a=u(r);d(a)},[u,e,n,d,i,o]),_=(0,a.useCallback)(t=>{e((0,Q.Ao)([])),m({category:pt.MQ.NETWORK,key:pt.bh.NETWORK,value:t})},[e,m]),A=(0,a.useCallback)(()=>{e((0,Q.Ao)([]));const r=(0,ut.A)(Dt.jb);r[pt.MQ.DEVICE][pt.Jl.SFP_ANALYZER_OPEN]=t[pt.MQ.DEVICE][pt.Jl.SFP_ANALYZER_OPEN],d(r)},[e,d,t]),p=(0,a.useCallback)(()=>{e((0,Q.Ao)([]));const r=(0,ut.A)(Dt.jb);r[pt.MQ.DEVICE][pt.Jl.SFP_ANALYZER_OPEN]=t[pt.MQ.DEVICE][pt.Jl.SFP_ANALYZER_OPEN],r[pt.MQ.DEVICE][pt.Jl.DEVICE]=t[pt.MQ.DEVICE][pt.Jl.DEVICE],r[pt.MQ.NETWORK][pt.bh.NETWORK]=t[pt.MQ.NETWORK][pt.bh.NETWORK],r[pt.MQ.DEVICE][pt.Jl.STATS_OPEN]=t[pt.MQ.DEVICE][pt.Jl.STATS_OPEN],d(r)},[e,d,t]),O=(0,a.useMemo)(()=>(0,At.Kn)(t),[t]),g=(0,a.useMemo)(()=>(0,At.vf)(t),[t]),C=(0,a.useMemo)(()=>[pt.MQ.STATUS,pt.MQ.POE,pt.MQ.MEDIA].reduce((e,r)=>(e[r]=Object.entries(t[r]).filter(([,e])=>Boolean(e)).map(([e])=>e),e),{}),[t]),S=(0,a.useCallback)(()=>{const t=[{category:pt.MQ.DEVICE,key:pt.Jl.VLANS_OPEN,value:!1},{category:pt.MQ.DEVICE,key:pt.Jl.STATS_OPEN,value:!1},{category:pt.MQ.DEVICE,key:pt.Jl.DEVICE_DIAGRAM_OPEN,value:!0}],r=u(t);d(r),e((0,Q.Ao)([]))},[u,d,e]),T=(0,a.useCallback)(e=>{const t=[{category:pt.MQ.DEVICE,key:pt.Jl.VLANS_OPEN,value:e}],r=u(t);d(r)},[u,d]),h=(0,a.useCallback)(e=>{const t=[{category:pt.MQ.DEVICE,key:pt.Jl.DEVICE_DIAGRAM_OPEN,value:e}],r=u(t);d(r)},[u,d]),N=(0,a.useCallback)(r=>{if(r){const e=s?.map(e=>(0,J.FS)(t[pt.MQ.DEVICE][pt.Jl.DEVICE],e))||(0,G.A)();i(e)}r||e((0,Q.Ao)([]));const a=[{category:pt.MQ.DEVICE,key:pt.Jl.STATS_OPEN,value:r}],n=u(a);d(n)},[u,d,t,i,e,s]),P=(0,a.useCallback)(t=>{switch(e((0,Q.Ao)([])),e((0,_t.Zi)(M.g1.PORT_MANAGEMENT)),t){case $r.SFP:{const e=u([{category:pt.MQ.DEVICE,key:pt.Jl.SFP_ANALYZER_OPEN,value:!0},{category:pt.MQ.DEVICE,key:pt.Jl.DEVICE,value:""},{category:pt.MQ.DEVICE,key:pt.Jl.VLANS_OPEN,value:!1}]);d(e);break}case $r.MAIN:{const e=u([{category:pt.MQ.DEVICE,key:pt.Jl.SFP_ANALYZER_OPEN,value:!1}]);d(e);break}}},[u,e,d]);return(0,a.useMemo)(()=>({arePortsFiltersInitial:O,arePortFiltersInitialWithoutDeviceAndNetwork:g,onRestoreDefaults:A,onRestoreDefaultsWithoutDeviceAndNetwork:p,handleReturnToPortsView:S,handleFilterChange:m,setPortsFilters:d,handleDeviceDropdownChange:E,handleNetworkDropdownChange:_,selectedFilterKeys:C,previewCounts:r,portsFilters:t,handleSfpTableFiltersReset:c,handleStatsChange:N,handleVlansChange:T,handleDeviceDiagramChange:h,handleSectionChange:P}),[O,g,A,p,S,m,d,E,_,C,r,t,c,N,T,h,P])},Qr=({allPortsCount:e,isSfp:t})=>{const{onRestoreDefaults:r,handleSfpTableFiltersReset:n}=jr(),l=(0,a.useMemo)(()=>e?a.createElement(dt.A,{icon:a.createElement(it.A,{variant:"fill"}),title:a.createElement(f.sA,{id:"COMMON_NO_MATCH"}),description:a.createElement(f.sA,{id:"PORTS_EMPTY_FILTER_NO_PORTS_DETAILS",values:{button:a.createElement(st.A,{type:"button",variant:"inline",onClick:t?n:r},a.createElement(f.sA,{id:"COMMON_RESET_THEM_BUTTON_TEXT"}))}})}):a.createElement(dt.A,{icon:a.createElement(ct.A,{variant:"fill"}),title:a.createElement(f.sA,{id:"PORTS_TABLE_EMPTY_HEADER"})}),[e,t,r,n]);return a.createElement(h.A,{width:"100%",flexDirection:"column"},l)};var qr=r(137625);const Xr=(0,n.A)("div")`
  position: absolute;
  top: -${p.xO};
  bottom: -${p.xO};
  left: calc(100% - 400px); /* The restart confirm dialog width */
  right: 0;
`,Jr=(0,n.A)("div")`
  z-index: 1;
`,Zr=(0,a.memo)(({port:e})=>{const{port_idx:t,device:r}=e,{mac:n,name:l}=r,i=(0,I.useDispatch)(),s=(0,I.useSelector)(D.KK),{resetPortStatistics:c}=(0,tr.X)(),d=s.some(e=>e.mac===n),u=(0,re.cd)(r.switch_caps?.feature_caps,r.deviceState),m=(0,re.ug)(e),E=(0,Zt.CQ)(e),[_,A]=(0,a.useState)(!1),O=(0,I.useSelector)((0,D.JX)(t,n)),[g,C]=(0,a.useState)(O),S=(0,a.useCallback)(()=>{i((0,o.Fx)({mac:n,name:l},t))},[i,n,l,t]),T=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),C(!g),i((0,o.cj)({mac:n,name:r.name},[t],g))},[r.name,i,g,n,t]),M=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),A(!0)},[]),N=(0,a.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),c(n,t,E)},[n,t,c,E]);return(0,a.useEffect)(()=>{C(O)},[O]),u||m||d?a.createElement(h.A,{padding:p.YC,gap:p.kc,position:"relative",onMouseLeave:_?()=>A(!1):void 0},m?a.createElement(Jr,null,a.createElement(qr.A,{title:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_TITLE",titleValues:{portId:t},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:A,handleConfirm:S,isOpen:_,body:a.createElement(P.A,{size:"inherit"},a.createElement(f.sA,{id:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_BODY",values:{portId:t}}))},a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:M,type:"button",size:"medium"},a.createElement(f.sA,{id:"DEVICE_ACTIONS_POWER_CYCLE"}))))):null,u?a.createElement(Jr,null,a.createElement(st.A,{variant:"inline",onClick:T,type:"button",size:"medium"},a.createElement(f.sA,{id:g?"DEVICE_ACTIONS_LOCATE_STOP":"DEVICE_ACTIONS_LOCATE"}))):null,d?a.createElement(Jr,null,a.createElement(st.A,{variant:"inline",onClick:N,type:"button",size:"medium"},a.createElement(f.sA,{id:"COMMON_RESET_STATISTICS"}))):null,_?a.createElement(Xr,null):null):null}),ea=e=>({rowId:t})=>a.createElement(Zr,{port:e});var ta;!function(e){e.PORT="port",e.NAME="name",e.ANOMALY_SCORE="anomaly_score",e.SPEED="speed",e.NATIVE_VLAN="native_vlan",e.VENDOR="vendor",e.SERIAL="serial",e.PART_NUMBER="partNumber",e.COMPLIANCE="compliance",e.TEMPERATURE="temperature",e.OUTPUT_POWER="outputPower",e.INPUT_POWER="inputPower",e.VOLTAGE="voltage",e.CURRENT="current"}(ta||(ta={}));const ra={[ta.PORT]:"COMMON_PORT",[ta.NAME]:"COMMON_NAME",[ta.ANOMALY_SCORE]:"COMMON_ANOMALY",[ta.SPEED]:"COMMON_SPEED",[ta.NATIVE_VLAN]:"COMMON_PORTS_NATIVE_VLAN",[ta.VENDOR]:"COMMON_VENDOR",[ta.SERIAL]:"COMMON_SERIAL",[ta.PART_NUMBER]:"COMMON_PART_NUMBER",[ta.COMPLIANCE]:"COMMON_COMPLIANCE",[ta.TEMPERATURE]:"COMMON_TEMPERATURE",[ta.OUTPUT_POWER]:"COMMON_OUTPUT_POWER",[ta.INPUT_POWER]:"COMMON_INPUT_POWER",[ta.VOLTAGE]:"COMMON_VOLTAGE",[ta.CURRENT]:"COMMON_CURRENT"},aa=(ta.PORT,ta.NAME,ta.ANOMALY_SCORE,ta.SPEED,ta.NATIVE_VLAN,ta.VENDOR,ta.SERIAL,ta.PART_NUMBER,ta.COMPLIANCE,ta.TEMPERATURE,ta.OUTPUT_POWER,ta.INPUT_POWER,ta.VOLTAGE,ta.CURRENT,{[ta.PORT]:{size:220},[ta.NAME]:{size:75},[ta.ANOMALY_SCORE]:{size:100},[ta.SPEED]:{size:78},[ta.NATIVE_VLAN]:{size:120},[ta.VENDOR]:{size:99},[ta.SERIAL]:{size:123},[ta.PART_NUMBER]:{size:155},[ta.COMPLIANCE]:{size:110},[ta.TEMPERATURE]:{size:115},[ta.OUTPUT_POWER]:{size:125},[ta.INPUT_POWER]:{size:120},[ta.VOLTAGE]:{size:85},[ta.CURRENT]:{size:85}});var na=r(77768),la=r(701247),oa=r(206683);const ia=e=>{if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"==typeof e){const t=parseFloat(e);return!Number.isNaN(t)&&Number.isFinite(t)?t:null}return null};var sa=r(110966),ca=r(282556);const da=({sfp_current:e})=>{const t=(0,I.useSelector)(ca.zi),r=ia(e),n=(0,sa.L)(r||0,t,3);return a.createElement(na.cp,{value:a.createElement(f.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_CURRENT":"COMMON_FALLBACK",values:{current:n}})})},ua=({sfp_voltage:e})=>{const t=(0,I.useSelector)(ca.zi),r=ia(e),n=(0,sa.L)(r||0,t,3);return a.createElement(na.cp,{value:a.createElement(f.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_VOLTAGE":"COMMON_FALLBACK",values:{voltage:n}})})},ma=({io_power:e})=>{const t=(0,I.useSelector)(ca.zi),r=ia(e),n=(0,sa.L)(r||0,t,3);return a.createElement(na.cp,{value:a.createElement(f.sA,{id:r?"DEVICE_PROPERTIES_SWITCH_TOOLTIP_VALUES_IO_POWER":"COMMON_FALLBACK",values:{power:n}})})},Ea=({sfp_temperature:e})=>{const t=(0,I.useSelector)(ca.zi),r=ia(e),n=(0,sa.L)(r||0,t,3);return a.createElement(na.cp,{value:a.createElement(f.sA,{id:r?"DEVICE_PROPERTY_OVERVIEW_TEMPERATURE_VALUE":"COMMON_FALLBACK",values:{temperature:n}})})},_a=["UBNT","Ubiquiti","UbiquitiNetworks"],Aa=({sfp_vendor:e})=>{const t=(r=e,_a.includes(r)?"Ubiquiti Inc.":r);var r;return a.createElement(na.cp,{value:t})},pa=['No SFP Inserted"',"Unknown"],Oa=e=>pa.includes(e)?void 0:e,ga=({sfp_compliance:e})=>a.createElement(na.cp,{value:Oa(e)});var Ca=r(544755);const Sa=e=>[{id:ta.PORT,accessorFn:br.Fo,maxSize:e?null:Kt.ve,...e?aa[ta.PORT]:{size:Kt.ve},header:()=>a.createElement(f.sA,{id:ra[ta.PORT]}),cell:({row:{original:t}})=>a.createElement(la.A,{port:t,isInteractive:!1,showDevice:e}),compare:ot.o$},{id:ta.NAME,accessorFn:br.Fo,...aa[ta.NAME],header:()=>a.createElement(f.sA,{id:ra[ta.NAME]}),cell:({row:{original:e}})=>a.createElement(na.cp,{value:e.name,color:e.color}),compare:(0,br.l0)(({name:e})=>e)},ot.QW,{id:ta.NATIVE_VLAN,accessorFn:br.Fo,...aa[ta.NATIVE_VLAN],header:()=>a.createElement(f.sA,{id:ra[ta.NATIVE_VLAN]}),cell:({row:{original:e}})=>a.createElement(Ca.A,{nativeNetworkConfIdSubstituted:e.nativeNetworkConfIdSubstituted}),compare:(0,br.l0)(({nativeNetworkConfIdSubstituted:e})=>e===Pr.F?-1/0:e)},{id:ta.SPEED,accessorFn:br.Fo,...aa[ta.SPEED],header:()=>a.createElement(f.sA,{id:ra[ta.SPEED]}),cell:({row:{original:e}})=>a.createElement(oa.A,{speed:e.speed,autoneg:e.autoneg,up:e.up}),compare:(0,br.l0)(({speed:e})=>e)},{id:ta.VENDOR,accessorFn:br.Fo,...aa[ta.VENDOR],header:()=>a.createElement(f.sA,{id:ra[ta.VENDOR]}),cell:({row:{original:e}})=>a.createElement(Aa,{sfp_vendor:e.sfp_vendor||void 0}),compare:(0,br.l0)(({sfp_vendor:e})=>e)},{id:ta.SERIAL,accessorFn:br.Fo,...aa[ta.SERIAL],header:()=>a.createElement(f.sA,{id:ra[ta.SERIAL]}),cell:({row:{original:e}})=>a.createElement(na.cp,{value:e.sfp_serial||void 0}),compare:(0,br.l0)(({sfp_serial:e})=>e)},{id:ta.PART_NUMBER,accessorFn:br.Fo,...aa[ta.PART_NUMBER],header:()=>a.createElement(f.sA,{id:ra[ta.PART_NUMBER]}),cell:({row:{original:e}})=>a.createElement(na.cp,{value:e.sfp_part||void 0}),compare:(0,br.l0)(({sfp_part:e})=>e)},{id:ta.COMPLIANCE,accessorFn:br.Fo,...aa[ta.COMPLIANCE],header:()=>a.createElement(f.sA,{id:ra[ta.COMPLIANCE]}),cell:({row:{original:e}})=>a.createElement(ga,{sfp_compliance:e.sfp_compliance||void 0}),compare:(0,br.l0)(({sfp_compliance:e})=>Oa(e||void 0))},{id:ta.TEMPERATURE,accessorFn:br.Fo,...aa[ta.TEMPERATURE],header:()=>a.createElement(f.sA,{id:ra[ta.TEMPERATURE]}),cell:({row:{original:e}})=>a.createElement(Ea,{sfp_temperature:e.sfp_temperature}),compare:(0,br.l0)(({sfp_temperature:e})=>e)},{id:ta.OUTPUT_POWER,accessorFn:br.Fo,...aa[ta.OUTPUT_POWER],header:()=>a.createElement(f.sA,{id:ra[ta.OUTPUT_POWER]}),cell:({row:{original:e}})=>a.createElement(ma,{io_power:e.sfp_txpower}),compare:(0,br.l0)(({sfp_txpower:e})=>e)},{id:ta.INPUT_POWER,accessorFn:br.Fo,...aa[ta.INPUT_POWER],header:()=>a.createElement(f.sA,{id:ra[ta.INPUT_POWER]}),cell:({row:{original:e}})=>a.createElement(ma,{io_power:e.sfp_rxpower}),compare:(0,br.l0)(({sfp_rxpower:e})=>e)},{id:ta.VOLTAGE,accessorFn:br.Fo,...aa[ta.VOLTAGE],header:()=>a.createElement(f.sA,{id:ra[ta.VOLTAGE]}),cell:({row:{original:e}})=>a.createElement(ua,{sfp_voltage:e.sfp_voltage}),compare:(0,br.l0)(({sfp_voltage:e})=>e)},{id:ta.CURRENT,accessorFn:br.Fo,...aa[ta.CURRENT],header:()=>a.createElement(f.sA,{id:ra[ta.CURRENT]}),cell:({row:{original:e}})=>a.createElement(da,{sfp_current:e.sfp_current}),compare:(0,br.l0)(({sfp_current:e})=>e)}],Ta=je.AH`
  div:has(> * > * > .${at.k}) {
    overflow: visible;
  }
`,Ma=(0,n.A)(h.A)`
  height: 100%;
  min-height: 400px;
  width: 100%;
  overflow: hidden;
  flex-direction: column;
  flex-grow: 1;
`,ha=je.AH`
  overflow-x: scroll;
`,Ia={height:"unset",padding:"0",overflow:"unset"},Na=Ze.W2[et.xz.TABLES][Qe.l.PORTS].columns,Pa=[{value:10},{value:25},{value:50},{value:100,default:!0}],Ra=(0,a.memo)(()=>{const e=(0,I.useDispatch)(),t=(0,K.u)(),{formatMessage:r}=(0,f.tz)(),n=(0,I.useSelector)(D.ZN),l=(0,I.useSelector)(w.vR),o=(0,I.useSelector)(w.UH),i=(0,I.useSelector)(D.yy),s=(0,I.useSelector)(D.hb),c=(0,I.useSelector)(D.fr),{initialColumns:d}=(0,nt.A)(Qe.l.PORTS),u=(0,I.useSelector)(D.ln),m=(0,I.useSelector)(w.X5),E=(0,I.useSelector)(w.zD),_=(0,I.useSelector)(rt.EL),A=(0,I.useSelector)(w.XS),O=(0,I.useSelector)(D.QR),g=(0,I.useSelector)(D.IS),{setSelectedPortsAndAssignColors:C}=vt(),S=(0,I.useSelector)(D.oE),T=S?ze.SFP_ANALYZER:ze.CLASSIC,M=(0,I.useSelector)(w.A),h=(0,I.useSelector)(Ye.D),N=(0,a.useMemo)(()=>{const e=h.find(e=>e.stacking&&e.peers.bottom===M||e.stacking&&e.peers.top===M);return e?.peers.top===M?e?.peers.bottom:e?.peers.top},[h,M]),[P,R]=(0,Je.A)(T===ze.CLASSIC?Qe.l.PORTS:Qe.l.SFP_PORTS),[b,v]=(0,lt.A)(S?Qe.l.SFP_PORTS:Qe.l.PORTS),L=(0,a.useMemo)(()=>O?g.map(e=>({...e,color:m.mode===qe.Mz.BY_PORT&&o.includes(e.id)?E[e.id]:null,disabled:e.device.mac!==M&&Boolean(M),_rowHoverContent:_?void 0:ea(e)})):g.map(e=>{const t=o.includes(e.id),r=(s.selectablePortsSingleSelection||[]).includes(e.id),a=e.device.mac===M,n=e.device.mac===N,l=!a&&!n&&Boolean(M);return{...e,disabled:!t&&!r||l||A,_rowHoverContent:_?void 0:ea(e)}}),[O,g,m.mode,o,E,M,_,s.selectablePortsSingleSelection,N,A]),x=(0,a.useCallback)(t=>{const r=t[0]?(0,J.q9)(t[0]).deviceMac:void 0;if(O){const e=t.filter(e=>(0,J.q9)(e).deviceMac===r);return void C(e)}e((0,Q.Ao)(t))},[O,C,e]),k=(0,a.useCallback)(t=>{t.disabled||(O?C([t.id]):e((0,Q.Ao)((0,re.Um)(t.id))))},[O,C,e]),y=(0,a.useMemo)(()=>{const e=Na.reduce((e,t)=>(e[t]=d.includes(t),e),{});return i||Kt.lj.forEach(t=>{e[t]=!1}),e},[i,d]),G=(0,a.useCallback)(t=>{e((0,Q.DE)(t))},[e]),V=c===Dt.Xb||u,F=(0,a.useMemo)(()=>(0,ot.oE)(t,r,V),[t,r,V]),U=(0,a.useMemo)(()=>Sa(V),[V]),B=(0,a.useRef)(null),W=(0,a.useCallback)(({rowsPerPage:e,pageNumber:t})=>a.createElement(Ke.A,{ref:B,columns:T===ze.CLASSIC?F:U,columnVisibility:T===ze.CLASSIC?y:void 0,data:d?.length?L:[],initialColumnSize:P,onColumnSizingChange:R,multiSelectMode:!0,onChangeSelection:x,onRowClick:k,enableRowSelection:e=>!e.disabled,selection:o,isSelectAllVisible:O,rowStyle:p.gc,onSort:v,sorting:b,rowDisabledClassName:"",pageIndex:t,pageSize:e,className:`${tt.E} ${Ta}`,withOverflow:!0}),[T,F,U,y,d?.length,L,P,R,x,k,o,O,v,b]);return Boolean(g.length&&d?.length)?a.createElement(Xe.A,{itemCount:g.length,tableType:Qe.l.SFP_PORTS,onRenderTable:W,onPageChanged:G,rowOptions:Pa,pageNumber:l,wrapperFlexProps:Ia,paginationTableContainerClassName:ha}):a.createElement(Ma,null,a.createElement(Ke.A,{data:[],columns:F,columnVisibility:y,tableHeight:"auto",className:tt.E,multiSelectMode:!0,isSelectAllVisible:!1}),a.createElement(Qr,{allPortsCount:n}))});var ba=r(212178),fa=r(423e3);var va=r(656372),Da=r(979106);const La=[{id:qe.AM.BPS,label:a.createElement(f.sA,{id:"COMMON_BPS"})},{id:qe.AM.BYTES,label:a.createElement(f.sA,{id:"COMMON_BYTES"})}],xa=()=>{const e=(0,I.useDispatch)(),{usage:t}=(0,I.useSelector)(w.X5);return a.createElement(Da.A,{className:Ya,tabs:La,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,Q.H4)({usage:t}))})(t),variant:"filter"})},wa=[{id:qe.Mz.AVERAGE,label:a.createElement(f.sA,{id:"COMMON_AVERAGE"})},{id:qe.Mz.BY_PORT,label:a.createElement(f.sA,{id:"PORTS_BY_PORT"})}],ka=()=>{const e=(0,I.useDispatch)(),{mode:t}=(0,I.useSelector)(w.X5);return a.createElement(Da.A,{className:Ya,tabs:wa,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,Q.H4)({mode:t}))})(t),variant:"filter"})};var ya=r(578819),Ga=r(953048);const Va=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(D.fr),r=(0,I.useSelector)((0,a.useMemo)(()=>(0,er.tG)(t),[t])),{source:n}=(0,I.useSelector)(w.X5),l=(0,a.useMemo)(()=>(0,ya.b0)(r?.port_table),[r.mac]);((e,t)=>{const r=(0,I.useDispatch)();(0,a.useEffect)(()=>{e||t!==qe.I0.POE||r((0,Q.H4)({source:Ga.ON}))},[e,r])})(l,n);const o=(0,a.useMemo)(()=>[{id:qe.I0.PACKETS,label:a.createElement(f.sA,{id:"COMMON_PACKETS"})},{id:qe.I0.USAGE,label:a.createElement(f.sA,{id:"COMMON_USAGE"})},{id:qe.I0.POE,label:a.createElement(f.sA,{id:"COMMON_DEVICE_POE_MODE_POE"}),disabled:!l},{id:qe.I0.ERRORS,label:a.createElement(f.sA,{id:"COMMON_ERRORS"})},{id:qe.I0.DROPPED,label:a.createElement(f.sA,{id:"COMMON_DROPPED"})}],[l]);return a.createElement(Da.A,{className:Ya,tabs:o,selectedTab:n,onSelectTab:({id:t})=>(t=>{e((0,Q.H4)({source:t}))})(t),variant:"filter"})},Fa=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(w.X5),{direction:r,source:n}=t,l=(0,a.useMemo)(()=>{const e=n===qe.I0.ERRORS||n===qe.I0.DROPPED;return[{id:qe.O_.ALL,label:a.createElement(f.sA,{id:"COMMON_ALL"})},{id:qe.O_.DOWNLINK,label:a.createElement(f.sA,{id:e?"COMMON_RECEIVE":"COMMON_DOWNLOAD"})},{id:qe.O_.UPLINK,label:a.createElement(f.sA,{id:e?"COMMON_TRANSMIT":"COMMON_UPLOAD"})}]},[n]);return a.createElement(Da.A,{className:Ya,tabs:l,selectedTab:r,onSelectTab:({id:t})=>(t=>{e((0,Q.H4)({direction:t}))})(t),variant:"filter"})};var Ua=r(53509),Ba=r(543678);const Wa=(0,n.A)(Te.A)`
  white-space: nowrap;
`,Ha=({summary:e})=>{const t=(0,K.u)();return a.createElement(h.A,{gap:p.kc,alignItems:"center",justifyContent:"end"},e.rx?a.createElement(Wa,{size:"body",style:{color:(0,ee.gB)(t)}},a.createElement(Ua.A,null),e.rx.toString()):null,e.tx?a.createElement(Wa,{size:"body",style:{color:(0,ee.mN)(t)}},a.createElement(Ba.A,null),e.tx.toString()):null,e.total?a.createElement(Wa,{size:"body",color:"primary"},e.total.toString()):null)},$a=[{id:qe.uO.ALL,label:a.createElement(f.sA,{id:"COMMON_ALL"})},{id:qe.uO.BROADCAST,label:a.createElement(f.sA,{id:"COMMON_STATUS_BROADCAST"})},{id:qe.uO.MULTICAST,label:a.createElement(f.sA,{id:"COMMON_STATUS_MULTICAST"})}],za=()=>{const e=(0,I.useDispatch)(),{packets:t}=(0,I.useSelector)(w.X5);return a.createElement(Da.A,{className:Ya,tabs:$a,selectedTab:t,onSelectTab:({id:t})=>(t=>{e((0,Q.H4)({packets:t}))})(t),variant:"filter"})},Ya=je.AH`
  flex: unset;
  width: auto;
  flex-shrink: 0;
`,Ka=({summary:e})=>{const{source:t}=(0,I.useSelector)(w.X5);return a.createElement(h.A,{gap:p.kc,overflow:"auto"},a.createElement(ka,null),a.createElement(Va,null),t===qe.I0.PACKETS&&a.createElement(za,null),t===qe.I0.USAGE&&a.createElement(xa,null),t!==qe.I0.POE&&a.createElement(Fa,null),a.createElement(h.A,{flexGrow:1}),a.createElement(Ha,{summary:e}))};var ja=r(936344),Qa=r(195462),qa=r(198494),Xa=r(366702),Ja=r(945132),Za=r(853699),en=r(964238);const tn=({graphDataCollection:e,graphDataKey:t,getCoordinates:r,mouseData:n,maxY:l,tooltipContainer:o,seriesIndex:i,renderTooltip:s})=>{const c=(0,K.u)(),{mode:d}=(0,I.useSelector)(w.X5),u=(0,I.useSelector)(w.zD),m=(e=>`${e}GradientId`)(t),E=d===qe.Mz.AVERAGE?((e,t)=>e.includes("rx")||e.includes("poe_power")?(0,ee.gB)(t):(0,ee.mN)(t))(t,c):u[t]||(0,ee.mN)(c),_=(0,a.useMemo)(()=>e.map(({timestamp:e,...r})=>({x:e,y:r[t]})),[e,t]),A=(0,a.useCallback)(()=>a.createElement("defs",null,a.createElement("linearGradient",{id:m,x1:"0%",y1:"0%",x2:"0%",y2:"100%"},a.createElement("stop",{offset:"0%",stopColor:E,stopOpacity:.5}),a.createElement("stop",{offset:"100%",stopColor:E,stopOpacity:.1}))),[m,E]),p=(0,a.useCallback)(e=>s?s(e,E,i):void 0,[s,E,i]);return a.createElement(en.A,{data:_,maxY:l,mouseData:n,getCoordinates:r,lineColor:E,variant:d===qe.Mz.AVERAGE?"gradientArea":"line",interpolation:"linear",allowCustomDots:!0,tooltipPortal:o?o.current:void 0,customGradientId:m,renderCustomGradient:A,renderTooltip:p})};var rn=r(112142),an=r(66706),nn=r(670),ln=r(438369);const on={Bytes:(0,n.A)(P.A)`
    color: ${({theme:{motifPalette:{aqua06:e}}})=>e};
  `,Icon:void 0},sn=(0,n.A)(h.A)`
  flex-direction: column;
  padding-bottom: ${p.kc};
  border-bottom: 1px solid
    ${({theme:{motifPalette:{neutral10:e}}})=>e};
`,cn=(0,n.A)(h.A)`
  g {
    transition: unset;
  }
`,dn=(0,n.A)("div")`
  width: ${p.kc};
  height: ${p.kc};
  background: ${({color:e})=>e};
`,un=(0,n.A)(h.A,{shouldForwardProp:e=>"columnCount"!==e})`
  display: grid;
  grid-template-columns: repeat(${({columnCount:e})=>e}, 1fr);
  column-gap: ${p.S2};
  width: 100%;
`,mn=({portIdx:e,value:t,graphDataSeries:r,color:n})=>{const l=r.getFormattedValue(t);return a.createElement(h.A,{justifyContent:"space-between",alignItems:"baseline",width:"100%",gap:p.YC},a.createElement(h.A,{gap:p.YC,alignItems:"center"},a.createElement(dn,{color:n}),a.createElement(Te.A,{size:"caption",color:"secondary"},a.createElement(f.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e}}))),a.createElement(Te.A,{size:"caption"},l.toString()))},En=({value:e,direction:t,source:r,graphDataSeries:n})=>{const l=(0,a.useMemo)(()=>((e,t)=>e===qe.I0.POE?on:t===qe.O_.UPLINK?ln.A:nn.A)(r,t),[t,r]),o=(0,a.useMemo)(()=>((e,t)=>e===qe.I0.POE?"COMMON_POWER":e===qe.I0.ERRORS||e===qe.I0.DROPPED?t===qe.O_.UPLINK?"COMMON_TRANSMIT":"COMMON_RECEIVE":t===qe.O_.UPLINK?"COMMON_UPLOAD":"COMMON_DOWNLOAD")(r,t),[t,r]),i=n.getFormattedValue(e);return a.createElement(h.A,{justifyContent:"space-between",width:"100%"},a.createElement(Te.A,{size:"caption",color:"secondary"},a.createElement(f.sA,{id:o})),a.createElement(h.A,null,l.Icon&&a.createElement(l.Icon,null),a.createElement(l.Bytes,{size:"small"},i.toString())))},_n=({hidden:e,top:t,left:r,x:n,chartWidth:l,chartHeight:o,selfHourCycle:i,tooltipPropsCollection:s,showDateWithTime:c,language:d,graphDataSeries:u,settings:m,gradientColor:E,graphDataCollection:_,seriesIndex:A,duration:O})=>{const{mode:g}=m,{motifPalette:{neutral04:C}}=(0,K.u)(),S=(0,I.useSelector)(w.zD),T=(0,a.useMemo)(()=>(e=>{switch(e){case qe.I0.POE:return a.createElement(f.sA,{id:"COMMON_POWER"});case qe.I0.PACKETS:return a.createElement(f.sA,{id:"COMMON_PACKETS"});case qe.I0.USAGE:return a.createElement(f.sA,{id:"COMMON_USAGE"});case qe.I0.ERRORS:return a.createElement(f.sA,{id:"COMMON_ERRORS"});case qe.I0.DROPPED:return a.createElement(f.sA,{id:"COMMON_DROPPED"});default:return null}})(m.source),[m.source]),M=(0,a.useMemo)(()=>Object.values(_).find(e=>e.timestamp===n),[_,n]),N=(0,a.useMemo)(()=>{const e=r<Math.round(l/2);return{left:Math.round(r+(e?8:-8)),top:Math.round(t),position:e?"rightTop":"leftTop"}},[r,t,l]),P=(0,a.useMemo)(()=>((e,t,r,a,n)=>{const l=new Intl.DateTimeFormat(t,{day:"numeric",month:"short",year:"numeric",...r&&{hour:"numeric",minute:"numeric",hourCycle:a}}).format(e);return n?`${l} - ${new Intl.DateTimeFormat(t,r?{hour:"numeric",minute:"numeric",hourCycle:a}:{day:"numeric",month:"short",year:"numeric"}).format(n)}`:l})(n,d,c,i,n+Number(O||0)),[n,d,c,i,O]),R=(0,a.useMemo)(()=>M?g===qe.Mz.BY_PORT?((e,t,r,n)=>a.createElement(un,{columnCount:Math.ceil(Object.values(e.data).length/n)},Object.values(e.data).sort((e,t)=>(0,J.q9)(e.key).portIdx-(0,J.q9)(t.key).portIdx).map(n=>{const l=t[n.key],o=r[n.key],{portIdx:i}=(0,J.q9)(n.key);return a.createElement(mn,{key:n.key,value:l,color:o,graphDataSeries:e,portIdx:i})})))(u,M,S,18):((e,t,r)=>{const n=e.data.series1,l=e.data.series2,o=n&&t[n.key],i=l&&t[l.key];return a.createElement(h.A,{flexDirection:"column",gap:p.YC},n&&a.createElement(En,{direction:qe.O_.UPLINK,graphDataSeries:e,value:o,source:r}),l&&a.createElement(En,{direction:qe.O_.DOWNLINK,graphDataSeries:e,value:i,source:r}))})(u,M,m.source):null,[M,u,g,m.source,S]),b=(0,a.useMemo)(()=>a.createElement(cn,{position:"absolute",top:0,left:0},a.createElement("svg",{width:l,height:o},r&&t&&a.createElement(an.A,{x:r,y:Math.round(t),color:E,innerRadius:4,outterRadius:8}))),[o,l,E,r,t]),v=(0,a.useMemo)(()=>{const e=Math.min(t,s.min);return{top:e,height:Math.max(t,s.max)-e,left:r-1}},[t,s,r]);return 0===A?a.createElement(a.Fragment,null,a.createElement(rn.A,{hidden:e,left:N.left,top:N.top,topMargin:4,width:"auto",tooltipProps:{maxWidth:"auto",position:N.position},description:a.createElement(h.A,{flexDirection:"column",gap:p.kc,whiteSpace:"nowrap"},a.createElement(sn,null,a.createElement(Te.A,{color:"primary",weight:"bold",size:"body"},T),a.createElement(Te.A,{color:"tertiary",size:"caption"},P)),a.createElement(h.A,{flexDirection:"column"},R))}),a.createElement(h.A,{zIndex:1,width:1,borderLeft:`2px dashed ${C}`,top:v.top,height:v.height,left:v.left,position:"absolute"}),b):b},An=(0,n.A)(h.A,{shouldForwardProp:e=>"chartWidth"!==e&&"preset"!==e})`
  #x-labels > g:last-child {
    ${({preset:e,chartWidth:t})=>!e&&`transform: translateX(${t-45}px) !important;`}
  }
`,pn=({graphDataCollection:e=[],graphDataSeries:t,graphContainerHeight:r})=>{const{formatMessage:n}=(0,f.tz)(),{width:l}=(0,Xa.A)(),o=(0,a.useRef)(null),i=(0,a.useRef)({min:0,max:0,left:0}),{ref:s,width:c=0}=(0,Be.A)(),{startDate:d,endDate:u,preset:m}=(0,I.useSelector)(w.Ky),E=(0,I.useSelector)(qa.jc),_=(0,I.useSelector)(qa.BQ),A=(0,I.useSelector)(rt.hq),p=(0,I.useSelector)(ca.zi),O=(0,I.useSelector)(w.X5),g=(0,I.useSelector)(w.UH),C=(0,a.useMemo)(()=>(0,Za.$V)(d,u,!0,!0),[u,d]),S=(0,a.useMemo)(()=>(0,va.Io)(d,u),[u,d]),T=(0,Za.Vi)(S,n),M=(0,a.useMemo)(()=>Math.floor(Math.abs(new Date(u).getTime()-new Date(d).getTime())/Ja.jU),[d,u]),N=r<400,P=(0,a.useMemo)(()=>{let r=1;const a=Object.values(t.data).map(e=>e.key);return e.forEach(e=>{Object.keys(e).forEach(t=>{"timestamp"!==t&&"number"==typeof e[t]&&a.includes(t)&&(r=Math.max(r,e[t]))})}),t.getFormattedValue(r)},[e,t]),R=(0,a.useMemo)(()=>!(O.source===qe.I0.USAGE&&O.usage===qe.AM.BPS)&&O.source!==qe.I0.POE&&O.source!==qe.I0.ERRORS&&O.source!==qe.I0.DROPPED,[O.usage,O.source]),b=(0,a.useCallback)(({hidden:n,left:l=0,top:o=0,x:s=0,y:d},u,m)=>(i.current={min:i.current.left===l?Math.min(o,i.current.min):o,max:i.current.left===l?Math.max(o,i.current.max):o,left:l},a.createElement(_n,{hidden:n,left:l,top:o,tooltipPropsCollection:i.current,x:s,y:d,duration:C.grain,chartHeight:r,chartWidth:c,selfHourCycle:_,settings:O,showDateWithTime:M<=7,language:p,graphDataSeries:t,gradientColor:u,graphDataCollection:e,seriesIndex:m})),[C.grain,r,c,_,O,M,p,t,e]),v=(0,a.useMemo)(()=>((e,t)=>{const r=Math.ceil((t-e)/36e5),a=r/24;return(r=>(0,Qa.v)([e,t],It[r].frequency(l,M)).map((e,t)=>({label:It[r].label({index:t,value:e,selfHourCycle:_,selfUse24HourTime:E,documentWidth:l,siteTimezone:A,language:p,formatMessage:n}),value:e})))(null===m||m===Ct.l.ONE_DAY&&r<13||m===Ct.l.ONE_WEEK&&a<5||m===Ct.l.ONE_MONTH&&a<10?Ct.j:m)})(e[0]?.timestamp||d.getTime(),e.length>1&&e[e.length-1]?.timestamp||u.getTime()),[e,_,E,d,u,m,A,p,l,M,n]),D=(0,a.useMemo)(()=>{return e=P.bytes,(0,Qa.Y)(Math.ceil(e+1/(N?5:10)*e),N?6:11);var e},[P.bytes,N]),L=(0,a.useCallback)(({value:e},r)=>{if(r!==(N?5:10)){return`${t.getFormattedValue(+e,P.power).value.toFixed(1)}`}},[P.power,t,N]),x=(0,a.useCallback)((r,n,l)=>a.createElement(a.Fragment,null,Object.keys(t.data).map((i,s)=>{const{key:c,label:d}=t.data[i];return a.createElement(tn,{key:c,graphDataCollection:e,graphDataKey:c,graphDataLabel:d,getCoordinates:r,mouseData:n,maxY:l,tooltipContainer:o,renderTooltip:b,seriesIndex:s})})),[t.data,e,b]);return a.createElement(An,{width:"100%",position:"relative",preset:m,chartWidth:c},a.createElement(h.A,{width:"100%",position:"relative",ref:s},a.createElement(ja.A,{xAxis:v,yAxis:D,width:c,yAxisTitle:R?`${P.unit} / ${T}`:P.unit,height:r,renderYLabel:L},g.length?x:void 0)),a.createElement("div",{ref:o}))};var On=r(801081),gn=r(212401),Cn=r(189601),Sn=r(25553),Tn=r(87485),Mn=r(559639),hn=r(748759),In=r(594827);const Nn=["tx_bytes","rx_bytes","tx_rate","rx_rate","tx_packets","rx_packets","tx_broadcast","rx_broadcast","tx_multicast","rx_multicast","tx_dropped","rx_dropped","tx_errors","rx_errors","poe_power","poe_energy"],Pn=Ga._4-32,Rn=(0,On.Mz)(w.c8,rt.vc,(e,t)=>e.includes(t)),bn=(0,Cn.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,On.Mz)(gn.Od,w.Ky,w.c8,(e,t,r)=>{const a={data:{attrs:va.$r,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:[r[0]]}};return(0,Sn.JC)(gn.Pd,e,a)}),e=>e),fn=(0,Cn.WY)((e,t)=>e.lastFetchTime===t.lastFetchTime||null===t.lastFetchTime)((0,On.Mz)(gn.yN,w.Ky,w.c8,(e,t,r)=>{const a={data:{attrs:va.Tj,start:t.startDate.getTime(),end:t.endDate.getTime(),macs:[r[0]]}};return(0,Sn.JC)(gn.Zk,e,a)}),e=>e),vn=(0,On.Mz)(bn,Tn.kh),Dn=(0,On.Mz)(fn,Tn.kh),Ln=/(\d+)-(.+)/,xn=(0,On.Mz)(vn,Dn,w.UH,Rn,Mn.BG,(e,t,r,a,n)=>{const l=r.map(e=>(0,J.q9)(e).portIdx),o=n.sort((e,t)=>e.id.localeCompare(t.id)).filter(e=>e.port_info?.port_idx);return e.map((e,r)=>{const n={timestamp:e.time,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};return Object.keys(e).forEach(t=>{const[r,a,o]=t.match(Ln)||[];l.includes(+a)&&(n[o]+=e[t])}),a&&Nn.forEach(e=>{o.forEach(({id:a,port_info:{port_idx:o}})=>{if(l.includes(o)){const l=(0,hn.XI)(a);n[e]+=t[r]?.[`${l}-${e}`]||0}})}),{...n,tx_rate:(0,gt.tI)(n.tx_bytes,e.duration),rx_rate:(0,gt.tI)(n.rx_bytes,e.duration),poe_energy:n.poe_power*e.duration/gn.W_}})}),wn=(0,On.Mz)(xn,e=>{const t=(e,t)=>e.reduce((e,r)=>(r[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")}}),kn=(0,On.Mz)(vn,Dn,w.UH,w.X5,Rn,er.IP,Mn.nB,(e,t,r,a,n,l,o)=>{const i=ft(a);return e.map((e,a)=>{const{duration:l}=e,s=e.time,c=r.reduce((r,s)=>{const{portIdx:c}=(0,J.q9)(s),d=i(e,c,l),u=o[c];if(n&&t[a]&&u){const e=(0,In.si)(u.id),n=i(t[a],e<2?"":e.toString(),l);return{...r,[s]:n}}return{...r,[s]:d}},{});return{timestamp:s,duration:l,...c}})}),yn=(0,On.Mz)(kn,w.X5,(e,t)=>{const r=bt(t),a=Object.keys(e[0]||{}).filter(e=>"timestamp"!==e&&"duration"!==e);let n=e.reduce((e,r)=>{const n=a.reduce((e,a)=>{let n=r[a];return t.source===qe.I0.POE&&(n=n*r.duration/gn.W_),e+n},0);return e+n},0);return t.source===qe.I0.USAGE&&t.usage===qe.AM.BPS&&(n=n/e.length||1),t.source===qe.I0.POE?{total:new Nt(n)}:{total:r(n)}}),Gn=({settings:e})=>{const t=(0,I.useSelector)(w.UH),r=(0,I.useSelector)(kn),n=(0,I.useSelector)(yn),l=((e,t)=>{const r={getFormattedValue:bt(t),data:{}};return e.forEach(e=>{r.data[e]={key:e,label:`COMMON_PORT ${e}`}}),r})(t,e);return a.createElement(a.Fragment,null,a.createElement(Ka,{summary:n}),a.createElement(pn,{graphDataCollection:r,graphDataSeries:l,graphContainerHeight:Pn}))},Vn=({settings:e})=>{const t=(0,I.useSelector)(wn),r=(0,I.useSelector)(xn),n=((e,t)=>{const{DOWNLINK:r,UPLINK:a,ALL:n}=qe.O_,l=bt(t),o={getFormattedValue:l,data:{}},{rx_broadcast:i,rx_bytes:s,rx_multicast:c,rx_packets:d,rx_rate:u,tx_broadcast:m,tx_bytes:E,tx_multicast:_,tx_packets:A,tx_rate:p,tx_errors:O,rx_errors:g,tx_dropped:C,rx_dropped:S,poe_energy:T}=e;return t.source===qe.I0.ERRORS&&(o.summary={tx:l(O),rx:l(g),total:l(O+g)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_errors",label:"COMMON_ERRORS"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_errors",label:"COMMON_ERRORS"})),t.source===qe.I0.DROPPED&&(o.summary={tx:l(C),rx:l(S),total:l(C+S)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_dropped",label:"COMMON_DROPPED"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_dropped",label:"COMMON_DROPPED"})),t.source===qe.I0.USAGE&&(t.usage===qe.AM.BPS&&(o.summary={tx:l(p),rx:l(u),total:l((p+u)/2)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_rate",label:"COMMON_RATE"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_rate",label:"COMMON_RATE"})),t.usage===qe.AM.BYTES&&(o.summary={tx:l(E),rx:l(s),total:l(E+s)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_bytes",label:"COMMON_USAGE"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_bytes",label:"COMMON_USAGE"}))),t.source===qe.I0.PACKETS&&(t.packets===qe.uO.ALL&&(o.summary={tx:l(A),rx:l(d),total:l(A+d)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_packets",label:"COMMON_PACKETS"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_packets",label:"COMMON_PACKETS"})),t.packets===qe.uO.BROADCAST&&(o.summary={tx:l(m),rx:l(i),total:l(m+i)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_broadcast",label:"COMMON_PACKETS"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_broadcast",label:"COMMON_PACKETS"})),t.packets===qe.uO.MULTICAST&&(o.summary={tx:l(_),rx:l(c),total:l(_+c)},[a,n].includes(t.direction)&&(o.data.series1={key:"tx_multicast",label:"COMMON_PACKETS"}),[r,n].includes(t.direction)&&(o.data.series2={key:"rx_multicast",label:"COMMON_PACKETS"}))),t.source===qe.I0.POE&&(o.summary={total:new Nt(T)},o.data.series1={key:"poe_power",label:"COMMON_POE_USAGE"}),o})(t,e);return a.createElement(a.Fragment,null,a.createElement(Ka,{summary:n.summary}),a.createElement(pn,{graphDataCollection:r,graphDataSeries:n,graphContainerHeight:Pn}))},Fn=(0,n.A)(h.A)`
  flex-direction: column;
  width: 100%;
  border-radius: ${p.YC};
`,Un=(0,a.memo)(()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(w.c8),r=(0,I.useSelector)(w.Ky),n=(0,I.useSelector)(w.X5),l=(0,I.useSelector)(Rn),[o,s]=(0,a.useState)([]),[c,d]=(0,a.useState)(null),[u,m]=(0,a.useState)(null),{startDate:E,endDate:_}=r,A=(0,a.useMemo)(()=>!!t[0]&&!((0,fa.L)(o,t)&&E===c&&_===u),[o,t,E,c,_,u]);return(0,a.useEffect)(()=>{A&&(s(t),d(E),m(_),e((0,va.Y2)({start:E,end:_,macs:[t[0]]},void 0,{crudCacheStrategy:{type:i.e.CACHE}})),l&&e((0,va.QZ)({start:E,end:_,macs:[t[0]]},{crudCacheStrategy:{type:i.e.CACHE}})))},[A,e,E,_,t,l]),a.createElement(Fn,null,n.mode===qe.Mz.AVERAGE?a.createElement(Vn,{settings:n}):a.createElement(Gn,{settings:n}))});var Bn,Wn,Hn,$n=r(854726),zn=r(768195),Yn=r(325752);!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"}(Bn||(Bn={})),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"}(Wn||(Wn={})),function(e){e.BLOCKED="BLOCKED",e.TAGGED="TAGGED",e.DISABLED="DISABLED",e.NATIVE="NATIVE",e.WAN="WAN",e.UNTAGGED_NATIVE="UNTAGGED_NATIVE"}(Hn||(Hn={}));const Kn={[Hn.DISABLED]:{background:"neutral01",border:"neutral04",text:"neutral07"},[Hn.NATIVE]:{background:"neutral01",border:"neutral04",text:"neutral07"},[Hn.TAGGED]:{background:"green06",border:"green06",text:"neutral00"},[Hn.BLOCKED]:{background:"neutral05",border:"neutral05",text:"neutral00"},[Hn.WAN]:{background:"neutral00",border:"neutral04",text:"neutral07"},[Hn.UNTAGGED_NATIVE]:{background:"uBlue04",border:"uBlue04",text:"neutral00"}},jn=(e,t,r)=>{let a=e.port_table?.find(e=>e.port_idx===t),n=a?.portconf_id&&r.find(e=>e._id===a?.portconf_id);const l=a?.name;let o=t;return a?.masked&&a?.aggregated_by&&(o=Number(a.aggregated_by),a=e.port_table?.find(e=>e.port_idx===o),n=a?.portconf_id&&r.find(e=>e._id===a?.portconf_id)),{profile:n,portData:a,adjustedPortNumber:o,originalPortName:l}},Qn=(e,t)=>`${e?.vlan||(t||e&&e?.networkgroup!==zn.vj.LAN?"-":1)}`;var qn=r(105925),Xn=r(596176),Jn=r(766624),Zn=r(264752),el=r(907011),tl=r(421289),rl=r(538535),al=r(792072),nl=r(156472);const ll=(0,n.A)(R.A)`
  max-width: 120px;
`,ol=({portNumber:e})=>{const t=(0,I.useSelector)(D.aq),r=(0,I.useSelector)($n.w),n=(0,I.useSelector)(Ye.D),l=(0,I.useSelector)(rl.D5),{portData:o,originalPortName:i}=jn(t,e,r),s=(0,I.useSelector)(Rr.wf),c=(0,I.useSelector)(al.pB),d=(0,I.useSelector)(nl.G),u=(0,re.vT)(o,t,n,l,s,c,d),{connectedClient:m,connectedDevice:E,connectedMac:_,wanConfiguration:A,wanProviderName:O}=(0,U.A)(u);return a.createElement(h.A,{flexDirection:"column",gap:p.YC},a.createElement(h.A,{gap:p.kc,alignItems:"center",width:"100%"},a.createElement(R.A,{color:"inherit",weight:"bold",size:"inherit",isTruncated:!0},e,i?` | ${i}`:"")),(_||A)&&u.up?a.createElement(h.A,{justifyContent:"space-between",gap:p.fS,alignItems:"center"},a.createElement(R.A,{color:"inherit",size:"small"},a.createElement(f.sA,{id:"COMMON_CONNECTED_TO"})),a.createElement(h.A,{alignItems:"center",gap:p.YC},a.createElement(Ee.A,{size:20,connectedClient:m,connectedDevice:E,wanProviderName:O}),a.createElement(ll,{color:"inherit",size:"small",isTruncated:!0},O??(E?(0,k.Q)(E):(0,z.tn)(m))))):null)},il=(0,n.A)(h.A,{shouldForwardProp:e=>!["background","border"].includes(e)})`
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${p.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,sl=(0,a.memo)(({isTagged:e,isWanPort:t,isNative:r,portNumber:n,networkId:l,rowIndex:o,isDisabled:i})=>{const{motifPalette:s}=(0,K.u)(),{background:c,border:d,text:u}=(0,a.useMemo)(()=>{let a;switch(!0){case t:a=Hn.WAN;break;case i:a=Hn.DISABLED;break;case r:a=Hn.UNTAGGED_NATIVE;break;case e:a=Hn.TAGGED;break;default:a=Hn.BLOCKED}const{background:n,border:l,text:o}=Kn[a];return{background:n,border:l,text:o}},[t,i,r,e]);return a.createElement(tl.A,{key:`${n}-${l}`,description:a.createElement(ol,{portNumber:n}),placement:0===o?"top":"bottom",delay:0,closeDelay:0},a.createElement(il,{background:s[c],border:s[d],color:s[u]},t?a.createElement(el.A,{size:"original",color:s[u]}):null))}),cl=(0,n.A)(h.A)`
  & > *:not(:last-child) {
    border-bottom: ${({theme:{themeName:e}})=>j.Ay[`desktop-border-divider-${e}`]};
  }
`,dl=(0,n.A)(h.A)`
  &:not(:last-child) {
    padding-bottom: ${p.kc};
  }
  &:not(:first-child) {
    padding-top: ${p.kc};
  }
`,ul=({network:e,rowLayouts:t,model:r,values:n})=>a.createElement(He,null,a.createElement(we,null,(t||[]).map((t,l)=>a.createElement(ke,{key:`PortDiagramLayoutRow-${l+1}`},t.map((t,o)=>{const i=`PortDiagramLayoutCell-${l+1}-${o+1}`,s=+(0,L.Cu)({port_idx:t?.portNumber},r),c=n.taggedNetworks[s]?.[e._id];return t&&c?a.createElement(sl,{key:i,isNative:c[Wn.IS_NETWORK_NATIVE_ON_PORT],isWanPort:c[Wn.IS_WAN_PORT],isTagged:c[Wn.IS_TAGGED],isDisabled:c[Wn.IS_DISABLED],portNumber:s,rowIndex:l,networkId:e._id}):a.createElement(ye,{key:i})}))))),ml=({rowLayouts:e,model:t,values:r})=>{const{formatMessage:n}=(0,f.tz)(),l=(0,I.useSelector)(Rr.Tn).sort((e,t)=>e.vlan-t.vlan),[o,i]=(0,a.useState)(""),[s,c]=(0,a.useState)([]),d=(0,a.useMemo)(()=>l.map(e=>({id:e._id,vlan:e.vlan,name:e.name,subnet:(0,fr.mC)(e),label:e.name})),[l]),u=(0,a.useMemo)(()=>d.filter(({id:e,name:t,subnet:r,vlan:a})=>(t?.toLowerCase().includes(o.toLowerCase())||r?.toLowerCase().includes(o.toLowerCase())||a?.toString().toLowerCase().includes(o.toLowerCase()))&&!s.some(t=>t.id===e)),[d,s,o]),m=(0,a.useCallback)(e=>{if(s.some(({id:t})=>t===e))return;const t=d.find(({id:t})=>t===e);t&&c(e=>e.concat([{id:t.id,label:t.label}]))},[d,s]),E=(0,a.useCallback)(e=>{c(t=>t.filter(({id:t})=>t!==e))},[]);return a.createElement(h.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},a.createElement(Fe,null,a.createElement(h.A,{gap:p.kc,width:"100%",flexWrap:"wrap",alignItems:"center"},a.createElement(Ue,null,a.createElement(Te.A,{size:"body",weight:"bold",color:"primary",style:{whiteSpace:"nowrap"}},a.createElement(f.sA,{id:"PORTS_VLANS_SECTION_TITLE"})),a.createElement(Jn.A,{description:a.createElement(Xn.A,{messages:[["PORTS_VLANS_SECTION_TITLE_DESC_1"],["PORTS_VLANS_SECTION_TITLE_DESC_2"],["PORTS_VLANS_SECTION_TITLE_DESC_3"]]})})),a.createElement(Zn.A,{description:a.createElement(f.sA,{id:"COMMON_TAGGED"}),indicator:a.createElement(Le.j,{background:Kn.TAGGED.background})}),a.createElement(Zn.A,{description:a.createElement(f.sA,{id:"COMMON_BLOCKED"}),indicator:a.createElement(Le.j,{background:Kn.BLOCKED.background})}),a.createElement(Zn.A,{description:a.createElement(f.sA,{id:"COMMON_NATIVE"}),indicator:a.createElement(Le.j,{background:Kn.UNTAGGED_NATIVE.background})}),a.createElement(h.A,{flexGrow:1}),a.createElement(qn.A,{selectOnEnter:!0,value:o,tags:s,searchResults:u,onClear:(e,t)=>{i("")},onReset:()=>{i(""),c([])},onChange:(e,t)=>{i(t)},onAddTag:m,onRemoveTag:E,placeholder:s.length?"":n({id:"PORTS_VLANS_SECTION_SEARCH"}),maxResultsHeight:300}))),a.createElement(Ve,null,a.createElement(cl,{flexDirection:"column"},l.filter(e=>!s.length||s.map(e=>e.id).includes(e._id)).map(n=>a.createElement(dl,{flexDirection:"column",gap:p.YC,key:n._id},a.createElement(h.A,{justifyContent:"space-between",alignItems:"center"},a.createElement(Te.A,{size:"body",color:"secondary"},(0,fr.gm)(n)),a.createElement(Te.A,{size:"body",color:"tertiary"},(0,fr.mC)(n))),a.createElement(ul,{network:n,rowLayouts:e,model:t,values:r}))))))},El=(0,n.A)(h.A,{shouldForwardProp:e=>!["background","border"].includes(e)})`
  position: relative;
  justify-content: center;
  width: ${38}px;
  height: ${38}px;
  border-radius: ${p.YC};
  border: 1px solid ${({border:e})=>e};
  background: ${({background:e})=>e};
  align-items: center;
`,_l=(0,a.memo)(({nativeNetworkVlanId:e,isWanPort:t,portNumber:r,rowIndex:n})=>{const{motifPalette:l}=(0,K.u)(),{background:o,border:i,text:s}=t?Kn[Hn.WAN]:Kn[Hn.NATIVE];return a.createElement(tl.A,{key:`${r}-${n}`,description:a.createElement(ol,{portNumber:r}),placement:0===n?"top":"bottom",delay:0,closeDelay:0},a.createElement(El,{background:l[o],border:l[i]},t?a.createElement(el.A,{size:"original",color:l[s]}):a.createElement(Te.A,{size:"caption",color:"primary"},e)))}),Al=({rowLayouts:e,model:t,values:r})=>a.createElement(h.A,{flexDirection:"column",maxWidth:"100%",width:"100%"},a.createElement(Fe,null,a.createElement(Ue,null,a.createElement(Te.A,{size:"body",weight:"bold",color:"primary",style:{whiteSpace:"nowrap"}},a.createElement(f.sA,{id:"PORTS_VLANS_NATIVE_TITLE"})),a.createElement(Jn.A,{description:a.createElement(Xn.A,{messages:[["PORTS_VLANS_NATIVE_TITLE_DESC_1"],["PORTS_VLANS_NATIVE_TITLE_DESC_2"]]})}))),a.createElement(Ve,null,a.createElement(He,null,a.createElement(we,null,(e||[]).map((e,n)=>a.createElement(ke,{key:`PortDiagramLayoutRow-${n+1}`},e.map((e,l)=>{const o=`PortDiagramLayoutCell-${n+1}-${l+1}`,i=+(0,L.Cu)({port_idx:e?.portNumber},t),s=r.nativeNetwork[i];return e&&s?a.createElement(_l,{key:o,isWanPort:s[Bn.IS_WAN_PORT],nativeNetworkVlanId:s[Bn.DISPLAYED_VLAN_ID],isDisabled:s[Bn.IS_DISABLED],portNumber:i,rowIndex:n}):a.createElement(ye,{key:o})}))))))),pl=(0,n.A)(h.A)`
  flex-direction: column;
  gap: ${p.kc};
  padding-bottom: 3px;
  min-width: ${xe}px;
  width: 100%;
  align-items: center;
  align-self: ${({isNarrow:e})=>e?"start":"center"};
`,Ol=()=>{const[e,t]=(0,a.useState)(!1),r=(0,a.useRef)(null),n=(0,I.useSelector)(D.aq),{diagram:l}=(0,v.jo)(n?.model),o=(0,I.useSelector)($n.w),i=(0,I.useSelector)(Rr.Tn),s=(0,I.useSelector)(Rr.nT)?._id,c=(0,a.useMemo)(()=>((e,t,r,a)=>(e.port_table||[]).reduce((n,l)=>{const{profile:o,portData:i,adjustedPortNumber:s}=jn(e,l.port_idx,t),c=o?o.native_networkconf_id:i?.native_networkconf_id,d=o?o.excluded_networkconf_ids:i?.excluded_networkconf_ids,u=o?o.tagged_vlan_mgmt:i?.tagged_vlan_mgmt,m=c===Pr.F,E=r.find(e=>e._id===c),_=(0,re.Ue)(i?.ifname,e)||(0,re.m)(e,l.port_idx),A=(0,re.Xq)(i?.ifname,e),p=u===zn.sg.BLOCK_ALL,O=u===zn.sg.AUTO,g=(0,re.$k)(i?.ifname,e).includes(Yn.Vd.INTERFACE_DISABLED)||(0,J.Rj)(i);n.nativeNetwork[l.port_idx]={excluded_networkconf_ids:d,native_networkconf_id:c??a,tagged_vlan_mgmt:u??zn.sg.AUTO,[Bn.DISPLAYED_VLAN_ID]:Qn(E,m),[Bn.IS_WAN_PORT]:_,[Bn.ADJUSTED_PORT_NUMBER]:s,[Bn.IS_MANAGED_BY_PORT_PROFILE]:!!o,[Bn.IS_DISABLED]:g};const C=r.reduce((e,t)=>{const r=(c??a)===t?._id&&A,n=!d?.includes(t._id),i=!r&&!p&&A&&(n||O);return e[t._id]={port_idx:l.port_idx,excluded_networkconf_ids:d,[Wn.IS_TAGGED]:i,[Wn.IS_NETWORK_NATIVE_ON_PORT]:r,[Wn.ADJUSTED_PORT_NUMBER]:s,[Wn.IS_WAN_PORT]:_,[Wn.IS_MANAGED_BY_PORT_PROFILE]:!!o,[Wn.IS_DISABLED]:g},e},{});return n.taggedNetworks[l.port_idx]=C,n},{nativeNetwork:{},taggedNetworks:{}}))(n,o,i,s),[s,n,i,o]),d=l.length?(0,L.sT)(l,n):(0,L.oJ)(n);return(0,a.useEffect)(()=>{const e=r.current;if(!e)return;const a=new ResizeObserver(e=>{const[r]=e,{width:a}=r.contentRect;t(a<=xe)});return a.observe(e),()=>{a.disconnect()}},[]),a.createElement(pl,{ref:r,isNarrow:e,flexDirection:"column",paddingBottom:3,minWidth:xe,width:"100%",alignItems:"center"},a.createElement(Al,{rowLayouts:d,model:n?.model,values:c}),a.createElement(ml,{rowLayouts:d,model:n?.model,values:c}))};var gl=r(478211),Cl=r(674911),Sl=r(999589),Tl=r(761708);const Ml=(0,n.A)(st.A)`
  width: ${p.fS};
  height: ${p.fS};
`,hl=e=>a.createElement(Ml,{variant:"tertiary",...e});var Il=r(855019),Nl=r(532114),Pl=r(120964),Rl=r(463477),bl=r(734707);const fl=({device:{model:e,displayable_version:t}})=>{const{motifPalette:r}=(0,K.u)();return a.createElement(Nl.A,{size:"medium",colorOverride:r.neutral09,style:{whiteSpace:"nowrap"}},(0,k.Lm)(e)," · ",a.createElement(f.sA,{id:"COMMON_DEVICE_VERSION"}),": ",t)},vl=()=>{const e=(0,I.useSelector)(D.fr),t=(0,I.useSelector)((0,er.tG)(e)),{onUpgradeDevice:r,showButton:n,isPending:l}=(0,Rl.S)(t),o=(0,Sl.coerce)(t.upgrade_to_firmware)?.version;return n?a.createElement(h.A,{marginLeft:p.Ln},a.createElement(tl.A,{description:a.createElement(Pl.F,{fromVersion:t.displayable_version,toVersion:t.upgrade_to_firmware,model:t.model})},a.createElement(h.A,{alignItems:"center",height:p.fS},a.createElement(bl.Ay,{variant:"inline",onClick:r,disabled:l,Icon:Cl.A,size:"medium"},a.createElement(f.sA,{id:"COMMON_ACTION_UPDATE_TO",values:{version:o}}))))):null},Dl=({translationId:e})=>{const{handleReturnToPortsView:t}=jr();return a.createElement(h.A,{alignItems:"center",height:p.fS},a.createElement(st.A,{variant:"inline",onClick:t,Icon:Tl.A,size:"medium"},a.createElement(f.sA,{id:e})))},Ll=(0,n.A)(h.A)`
  @media ${St.A.VIEWPORT_M_DOWN} {
    flex-direction: column;
  }
`,xl=(0,n.A)("div")`
  position: absolute;
  left: 0;

  @media ${St.A.VIEWPORT_M_DOWN} {
    position: static;
  }
`,wl=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(D.IY),r=(0,I.useSelector)(D.gR),n=(0,I.useSelector)(D.fr),{themeName:l}=(0,K.u)(),o=(0,I.useSelector)(D.QR),i=(0,I.useSelector)(D.$X),s=(0,a.useCallback)(()=>{r?e((0,F.XP)({type:V.H.STACKING,id:r})):n&&e((0,F.XP)({type:V.H.DEVICE,id:n,tab:Il.BC.SETTINGS}))},[r,n,e]),c=(0,a.useMemo)(()=>o||i,[o,i]);return a.createElement(Ll,{borderTop:j.Ay[`desktop-border-divider-${l}`],flexWrap:"wrap",position:"relative",alignItems:"center",justifyContent:"center",...i?{minWidth:xe,alignItems:"center",alignSelf:"center",width:"100%"}:{}},c?a.createElement(xl,null,a.createElement(Dl,{translationId:o?"PORTS_PORT_CONFIGURATION":"PORTS_PORT_TABLE"})):null,a.createElement(h.A,{alignItems:"center",justifyContent:"center",flexWrap:"wrap"},a.createElement(hl,{Icon:gl.A,onClick:s,style:{marginRight:p.YC}}),t?.device?a.createElement(fl,{device:t.device}):null,a.createElement(vl,null)))};var kl=r(959341),yl=r(363370),Gl=r(749177),Vl=r(368928),Fl=r(89603),Ul=r(804396),Bl=r(889256);const Wl=(0,n.A)(h.A,(0,y.A)("isVisible"))`
  background-color: ${({theme:{motifPalette:e}})=>e.neutral01};
  gap: ${p.kc};
  padding: 6px ${p.kc};
  display: ${({isVisible:e})=>e?"flex":"none"};
`,Hl=(0,n.A)(h.A,(0,y.A)("elementWidth"))`
  position: absolute;
  border-radius: ${p.YC};
  width: fit-content;
  max-width: ${325}px;
  top: 0;
  max-height: ${320}px;
  overflow-y: auto;
  background-color: ${({theme:{motifPalette:e}})=>e.neutral01};
  box-shadow: ${({theme:{motifPalette:{shadowLow:e}}})=>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% + ${p.Ln} - ${e/2}px - ${t?16:0}px)`};
  @media ${St.A.VIEWPORT_M_DOWN} {
    right: 0;
  }

  opacity: ${({elementWidth:e})=>e>0?1:0};
`,$l=(0,n.A)(h.A)`
  flex-direction: column;
  width: 100%;
`,zl=()=>a.createElement(Or.A,{variant:"fill",size:"original",color:(0,K.u)().motifPalette.danger}),Yl=()=>a.createElement(Or.A,{variant:"fill",size:"original",color:(0,K.u)().motifPalette.warning}),Kl=({issue:e})=>a.createElement(a.Fragment,null,Bl.g[e.anomaly]===Ul.Q.CRITICAL?a.createElement(zl,null):a.createElement(Yl,null),a.createElement(P.A,{size:"medium",color:"text-2"},a.createElement(f.sA,{id:"COMMON_PORT_NUMBER",values:{portNumber:e.port_idx}}),": ",a.createElement(f.sA,{id:x.l3[e.anomaly]}))),jl=({deviceIssues:e,isExpanded:t,setIsExpanded:r})=>{const n=e.some(e=>Bl.g[e.anomaly]===Ul.Q.CRITICAL);return a.createElement($l,null,a.createElement(Wl,{cursor:"pointer",onClick:()=>{r(!t)},isVisible:!0},n?a.createElement(zl,null):a.createElement(Yl,null),a.createElement(P.A,{size:"medium",color:"text-2"},a.createElement(f.sA,{id:"DEVICE_PORT_STATE_ISSUES_TITLE"})),t?a.createElement(Vl.A,{size:"original"}):a.createElement(Fl.A,{size:"original"})),t?e.map(e=>a.createElement(Wl,{key:e.port_idx+e.anomaly,isVisible:t},a.createElement(Kl,{issue:e}))):null)},Ql=()=>{const e=(0,I.useSelector)(D.pN),t=(0,a.useRef)(null),{width:r}=(0,Xa.A)(t.current),[n,l]=(0,a.useState)(!1);return e.length?a.createElement(Hl,{elementWidth:r,ref:t,isOverflowing:n&&e.length+1>10},1===e.length?a.createElement(Wl,{isVisible:!0},a.createElement(Kl,{issue:e[0]})):a.createElement(jl,{deviceIssues:e,isExpanded:n,setIsExpanded:l})):null},ql=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(D.ln),r=(0,I.useSelector)(w.Hd),n=(0,I.useSelector)(D.hb),l=(0,I.useSelector)(w.UH),o=(0,I.useSelector)(w.XS),i=(0,Gl.A)(M.g1.PORT_MANAGEMENT),s=(0,a.useCallback)(()=>{e((0,Q.Ao)([]))},[e]),c=(0,a.useCallback)(()=>{e((0,Q.Ao)([l,n.selectablePortsBulkSelection].flat()))},[e,n.selectablePortsBulkSelection,l]),d=!n.selectablePortsBulkSelection.length,u=(0,a.useCallback)(()=>{e((0,Q.xj)(!r))},[e,r]);return a.createElement(a.Fragment,null,a.createElement(h.A,{alignItems:"start",minHeight:30,marginTop:2,position:"relative",paddingLeft:i?0:p.kc},a.createElement(h.A,{gap:p.kc},t?a.createElement(yl.A,{to:kl.QI,size:"small"},a.createElement(f.sA,{id:"PORTS_EDIT_MC_LAG"})):null,l.length?a.createElement(st.A,{size:"small",type:"button",variant:"inline",onClick:s},a.createElement(f.sA,{id:"COMMON_ACTION_DESELECT_ALL"})):null,d||o?null:a.createElement(st.A,{size:"small",type:"button",variant:"inline",onClick:c},a.createElement(f.sA,{id:"COMMON_ACTION_SELECT_ALL"})),t?a.createElement(st.A,{size:"small",type:"button",variant:"inline",onClick:u},a.createElement(f.sA,{id:r?"PORTS_SHOW_CONNECTED_DEVICES":"PORTS_HIDE_CONNECTED_DEVICES"})):null),a.createElement(Ql,null)))};var Xl=r(935780),Jl=r(601021);const Zl=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(w.Jm),r=(0,I.useSelector)(D.ws);(0,a.useEffect)(()=>{e((0,mt.R)(r))},[e]),(0,a.useEffect)(()=>t?(e((0,Q.gU)(!1)),()=>null):()=>{e((0,Jl.p)(!1)),e((0,Q.Ao)([]))},[e])},eo=(0,n.A)("div")`
  display: ${e=>e.isVisible?"block":"none"};
`,to=(0,a.memo)(()=>{const e=(0,I.useSelector)(Ye.D),t=(0,I.useSelector)(D.fr),r=(0,I.useSelector)(D.tU),n=(0,I.useSelector)(D.QR),l=(0,I.useSelector)(D.$X),o=(0,I.useSelector)(D.GG);(()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(D.QR),r=(0,I.useSelector)(D.Bt)||(0,G.A)(),n=(0,I.useSelector)(D.Fk),l=(0,I.useSelector)(w.UH),o=(0,ba.A)(l);(0,a.useEffect)(()=>{if(!(0,fa.L)(l,o)&&!t){const t=l.filter(e=>!o?.includes(e))||[],a=o?.filter(e=>!l.includes(e))||[],i=new Set,s=new Set;t.forEach(e=>{const{aggregationGroup:t,device:a}=r.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(n){const t=r.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==a.mac);t&&i.add({...t.aggregationGroup,deviceMac:t.device.mac})}i.add({...t,deviceMac:a.mac})}}),a.forEach(e=>{const{aggregationGroup:t,device:a}=r.find(t=>t.id===e)||{};if(t){const e=t.lag_idx;if(n){const t=r.find(t=>t.aggregationGroup?.lag_idx===e&&t.device.mac!==a.mac);t&&s.add({...t.aggregationGroup,deviceMac:t.device.mac})}s.add({...t,deviceMac:a.mac})}});const c=Array.from(i).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,J.FS)(t.deviceMac,e))],[]),d=Array.from(s).reduce((e,t)=>[...e,...t.aggregate_members.map(e=>(0,J.FS)(t.deviceMac,e))],[]);let u=[...l].filter(e=>!d.includes(e));u=new Array(...new Set([...u,...c])),e((0,Q.Ao)(u))}},[l,o,e,t,n,r])})(),(0,Xl.A)(t),Zl();const i=Boolean(r)&&e.find(e=>e._id===r.mclag_group_id).peers.top===r.mac,s=t&&o;return a.createElement(a.Fragment,null,s?a.createElement(h.A,{flexDirection:"column"},l?a.createElement(h.A,{minHeight:p.fS}):a.createElement(ql,null),a.createElement(h.A,{flexDirection:i?"column-reverse":"column",gap:p.kc},a.createElement($e,{selectedDeviceMac:t,diagramDeviceMac:t,useStackedData:!1,showLegend:!r||i}),r?a.createElement($e,{selectedDeviceMac:t,diagramDeviceMac:r.mac,useStackedData:Boolean(r),showLegend:r&&!i}):null)):null,a.createElement(eo,{isVisible:n},a.createElement(Un,null)),t&&o?a.createElement(wl,null):null,a.createElement(eo,{isVisible:l},a.createElement(Ol,null)),a.createElement(eo,{isVisible:!l},a.createElement(Ra,null)))});var ro=r(921243),ao=r(595369),no=r(951272),lo=r(86392),oo=r(96512),io=r(302167),so=r(126457),co=r(154828),uo=r(523275),mo=r(429252),Eo=r.n(mo),_o=r(768941),Ao=r(104436),po=r(711157),Oo=r(870443),go=r(949330),Co=r(277184),So=r(956347),To=r(388151),Mo=r(955161),ho=r(263130),Io=r(524803);var No,Po=r(324609),Ro=r(370333),bo=r(836645),fo=r(333080),vo=r(928085);!function(e){e.PORT_IS_AGGREGATING_IN_DIFFERENT_GROUP="PORTS_AGGREGATION_DISABLE_REASON_IS_AGGREGATING_IN_DIFFERENT_GROUP",e.PORT_IS_MIRRORING="PORTS_AGGREGATION_DISABLE_REASON_IS_MIRRORING",e.PORT_IS_WAN="PORTS_AGGREGATION_DISABLE_REASON_IS_WAN",e.PORT_MEDIA_MISMATCH="PORTS_AGGREGATION_DISABLE_REASON_MEDIA_MISMATCH",e.PORT_SPEED_MISMATCH="PORTS_AGGREGATION_DISABLE_REASON_SPEED_MISMATCH",e.PORT_AGGREGATION_ALREADY_PRESENT_IN_CURRENT_AGGREGATION_GROUP="PORTS_AGGREGATION_DISABLE_REASON_AGGREGATION_ALREADY_PRESENT_IN_CURRENT_AGGREGATION_GROUP",e.PORT_IS_HEAD_PORT="PORTS_AGGREGATION_DISABLE_REASON_IS_HEAD_PORT"}(No||(No={}));const Do=e=>(e||[]).map(e=>{const[t,r]=e.port_range.split("-").map(e=>parseInt(e,10));return{port_range_num:(0,Ro.Du)(t,r)}}),Lo=(0,n.A)(h.A)`
  width: 100%;
  > div {
    width: 100%;
  }
`,xo=({disabled:e,device:t,portData:r,isInTargetLink:n,isInMcLink:l,isInCrossLags:o,isInStackingLink:i})=>{const s=(0,I.useDispatch)(),{formatMessage:c}=(0,f.tz)(),d=(0,I.useSelector)(er.IP),u=(0,I.useSelector)(w.pN),m=(0,I.useSelector)(w.UH),E=(0,I.useSelector)(w.XS),_=(0,I.useSelector)(D.LL),A=(0,vo.A)(kl.QI),O=(0,vo.A)(kl.Q8),g=(0,So.W6)(),[C,S]=(0,a.useState)(!1),{values:T,errors:M,submitCount:R,setFieldValue:L,touched:x,initialValues:k}=(0,no.j7)(),{port_idx:y,portConfEnabled:G,op_mode:V,portSpeed:F}=T,{mclag_group_id:U,switch_caps:B,model:W,port_overrides:H=[],port_table:$,downlink_table:z,type:Y,device_mode_override:K,stacking_group_id:j}=t||{},q=(0,v.mo)({model:W,type:Y,device_mode_override:K}),{max_aggregate_sessions:X,max_mirror_sessions:Z,agg_groups:ee,mirror_groups:te,feature_caps:ae}=B||{},ne=Boolean(U),le=Boolean(j),oe=V===_o.RC.MIRROR,ie=T.op_mode===_o.RC.AGGREGATE,{isMirroringSupported:se,isMirroringAllowed:ce,mirroringDropdownOptions:de}=(0,a.useMemo)(()=>{const e=!q&&Z>0;if(!e)return{isMirroringSupported:!1,isMirroringAllowed:!1,mirroringDropdownOptions:[]};const t=(H||[]).filter(e=>e.op_mode===_o.RC.MIRROR).length,r=oe||t<Z&&!_&&!(u.length>1),a=Do(te),n=a.find(e=>e.port_range_num.includes(y)),l=($||[]).map(({port_idx:e})=>e),o=Math.min(...l,1),i=Math.max(...l,1);return{isMirroringSupported:e,isMirroringAllowed:r,mirroringDropdownOptions:(a&&n?n.port_range_num:(0,Ro.Du)(o,i)).filter(e=>e!==y).map(e=>({label:e,value:e}))}},[q,Z,H,oe,_,te,$,y,u]),ue=(0,a.useMemo)(()=>{const e=((e,t,r,a,n,l)=>{const o=t?.speed_caps&~co.A.PORTSPEED_AUTO_NEG,i=n;return e.map(e=>{let n=Boolean(e.speed_caps&o);i!==_o.n5.PORTSPEED_AUTO_NEG&&(n=(0,Po.Mr)(e,co.A[i]));const s=!l?.length||l.find(e=>e.ports_idx.includes(t.port_idx))?.ports_idx.includes(e.port_idx),c=r.mac!==a.mac||(0,J.d4)({media:t.media})===(0,J.d4)({media:e.media}),d=!!e.mirror_port_idx,u=e.lag_idx&&t.lag_idx!==e.lag_idx,m=!(0,re.Ue)(e.ifname,r),E=d?No.PORT_IS_MIRRORING:u?No.PORT_IS_AGGREGATING_IN_DIFFERENT_GROUP:m?n?c?s?null:No.PORT_AGGREGATION_ALREADY_PRESENT_IN_CURRENT_AGGREGATION_GROUP:No.PORT_MEDIA_MISMATCH:No.PORT_SPEED_MISMATCH:No.PORT_IS_WAN;return{portIdx:e.port_idx,disabledReason:E}})})($||[],r,t,d,F,ee);return($||[]).map(t=>{const r=e.find(e=>e.portIdx===t.port_idx)?.disabledReason;return{label:c({id:"COMMON_PORT_NUMBER"},{portNumber:t.port_idx}),value:t.port_idx,disabled:Boolean(r),tooltipDescription:r?a.createElement(f.sA,{id:r}):null,tooltipPosition:"left",tooltipPortal:!0}}).sort((e,t)=>Number(e.value)-Number(t.value))},[$,r,t,d,ee,c,F]),me=(0,a.useMemo)(()=>m.every(e=>!ue.find(t=>t.value===(0,J.q9)(e).portIdx)?.disabled),[m,ue]),{isAggregationSupportedByDevice:Ee,isAggregationAllowed:_e,hasMaxAggregateSessionsReached:Ae}=(0,a.useMemo)(()=>{const e=(!q||(0,kt.j$)(ae))&&X>0,a=X??4,n=H.reduce((e,t)=>(t.lag_idx&&e.add(t.lag_idx),e),new Set).size>=a,l=((e,t,r)=>{if(!t?.length)return!1;const a=t?.find(t=>t.ports_idx.includes(e)),n=a?.ports_idx.some(t=>e!==t&&r?.find(e=>e.port_idx===t)?.op_mode===_o.RC.AGGREGATE);return n})(r.port_idx,ee,$);return{isAggregationSupportedByDevice:e,isAggregationAllowed:ie||ue.filter(e=>!e.disabled).length>1&&me&&!l&&!t.mclag_group_id&&!t.stacking_group_id,hasMaxAggregateSessionsReached:n}},[q,ae,X,H,r.port_idx,ee,$,ie,ue,me,t.mclag_group_id,t.stacking_group_id]);(0,a.useEffect)(()=>{!(u.length>0)||me&&T.op_mode===_o.RC.AGGREGATE||E||(s((0,Q.jv)([])),L("aggregate_members",[]),L("op_mode",_o.RC.SWITCH))},[u.length,me,s,E,L,T.op_mode]),(0,a.useEffect)(()=>{const e=ie&&!(0,fa.L)(T.aggregate_members,k.aggregate_members);s((0,Q.fB)(e))},[T.aggregate_members,k.aggregate_members,s,ie]);const pe=(0,a.useCallback)(e=>{const a=T.op_mode===_o.RC.AGGREGATE;if(L("op_mode",e),e===_o.RC.MIRROR&&de[0]?.value&&L("mirror_port_idx",de[0]?.value),e===_o.RC.AGGREGATE){if(_){const e=m.map(e=>(0,J.q9)(e).portIdx);return L("aggregate_members",e),s((0,Q.jv)(e)),void s((0,Q.Ao)([(0,J.FS)(t.mac,r.port_idx)]))}const e=r.port_idx,a=ue.find(t=>Number(t.value)>e&&!t.disabled)?.value,n=ue.find(e=>!e.disabled)?.value,l=[e,a??n];L("aggregate_members",l),s((0,Q.jv)(l.map(e=>Number(e))))}e===_o.RC.SWITCH&&(L("aggregate_members",[]),L("mirror_port_idx",void 0),s((0,Q.jv)([]))),a&&e!==_o.RC.AGGREGATE&&s((0,Q.jv)([]))},[T.op_mode,L,de,_,r.port_idx,ue,s,m,t.mac]),Oe=G,ge=n||l,Ce=o||i,Se=(0,a.useCallback)(({value:e})=>{e===_o.RC.MIRROR&&Oe?S(!0):pe(e)},[pe,Oe]),Te=(0,a.useCallback)(()=>{pe(_o.RC.MIRROR),S(!1),L("portConfEnabled",!1),L("portconf_id",void 0),s((0,Q.jv)([]))},[pe,L,s]),Me=(0,a.useCallback)(()=>{g.push(A)},[g,A]),he=(0,a.useCallback)(()=>{g.push(O)},[g,O]),Ie=(0,a.useMemo)(()=>{const e=[{label:"COMMON_SWITCHING",value:_o.RC.SWITCH}];return se&&e.push({label:"DEVICE_PORT_FORM_MIRRORING_LABEL",value:_o.RC.MIRROR,disabled:!ce}),Ee&&e.push({label:"COMMON_AGGREGATING",value:_o.RC.AGGREGATE,disabled:!_e}),e},[_e,Ee,ce,se]),Ne=(0,a.useCallback)(e=>a.createElement(Mo.A,{key:e.id,condition:e.option.disabled&&e.option.value===_o.RC.AGGREGATE&&(ne||le),wrapper:(0,Io.rR)(void 0,a.createElement(f.sA,{id:"PORTS_OPERATION_TOOLTIP_REDIRECT",values:{link:a.createElement(st.A,{variant:"inline",onClick:ne?Me:he},a.createElement(f.sA,{id:ne?"PORTS_MCLAG":"PORTS_STACKING"}))}}),{position:"left",portal:!0,isInteractive:!0,maxWidth:"unset"})},a.createElement(Co.p,{...e})),[Me,he,ne,le]),Pe=(0,a.useCallback)(e=>{s((0,Q.fB)(!0)),L("aggregate_members",e),s((0,Q.jv)(e.map(e=>Number(e))))},[L,s]),Re=oe&&m.length>1,be=Ie.filter(e=>!e.disabled).length<2||Re;return(0,a.useEffect)(()=>(!be&&ie||(s((0,Q.jv)([])),s((0,Q.fB)(!1))),()=>{s((0,Q.jv)([])),s((0,Q.fB)(!1))}),[be,s,ie]),be?null:a.createElement(a.Fragment,null,a.createElement(b.A,{position:"top",isInteractive:!0,portal:!0,description:ge||Ce?a.createElement(f.sA,{id:"PORTS_OPERATION_TOOLTIP_REDIRECT",values:{link:a.createElement(st.A,{variant:"inline",onClick:ge?Me:he},a.createElement(f.sA,{id:"PORTS_MCLAG"}))}}):null},a.createElement(Mo.A,{condition:Oe,wrapper:e=>a.createElement(Lo,null,a.createElement(qr.A,{title:"DEVICE_PORT_OPERATION_INLINE_CONFIRM_TITLE",buttonMessage:"COMMON_ACTION_PROCEED",handleClose:S,handleConfirm:Te,isOpen:C,body:a.createElement(P.A,{size:"inherit"},a.createElement(f.sA,{id:"DEVICE_PORT_OPERATION_INLINE_CONFIRM_MESSAGE"}))},e))},a.createElement(To.A,{name:"op_mode",type:"dropdown",variant:"secondary",full:!0,translateOptions:!0,onChange:Se,renderOption:Ne,options:Ie,disabled:e,label:a.createElement(f.sA,{id:"COMMON_OPERATION"}),translateLabel:!0}))),T.op_mode===_o.RC.MIRROR&&a.createElement(To.A,{label:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_MIRRORING_PORT"}),translateLabel:!0,name:"mirror_port_idx",type:"dropdown",variant:"secondary",full:!0,options:de,disabled:e}),T.op_mode===_o.RC.AGGREGATE&&!ne&&a.createElement(h.A,{flexDirection:"column"},a.createElement(bo.A,{options:ue,list:T.aggregate_members,onChange:Pe,disabled:e,triggerButtonText:"COMMON_ACTION_EDIT",validationMessage:(0,fo.t$)("aggregate_members",M,x,R),label:a.createElement(f.sA,{id:"COMMON_AGGREGATE_PORTS"})}),!Ae&&a.createElement(ho.A,{marginTop:p.kc,icon:a.createElement(N.A,{isActive:!0,size:"original",variant:"fill"}),description:a.createElement(a.Fragment,null,q?a.createElement(a.Fragment,null,a.createElement(f.sA,{id:"DEVICE_PROPERTIES_WARNING_PORT_AGGREGATION_GATEWAY"})," "):null,a.createElement(f.sA,{id:z?.length?"DEVICE_PROPERTIES_WARNING_PORT_AGGREGATION_UPLINK":"DEVICE_PROPERTIES_WARNING_PORT_AGGREGATION_DOWNLINK",values:{strong:f.ko}}))}),Ae&&a.createElement(ho.A,{marginTop:p.kc,icon:a.createElement(N.A,{isActive:!0,size:"original",variant:"fill"}),description:a.createElement(f.sA,{id:"DEVICE_PROPERTIES_WARNING_PORT_AGGREGATION_MAX_SESSION_WARNING",values:{strong:f.ko}})})))};var wo=r(161374);const ko=(e,t,r)=>{if(r===_o.n5.PORTSPEED_AUTO_NEG)return[];const a=(0,wo.UH)(t,e);return Object.keys(a).filter(e=>{const t=a[e];return!!t&&!t.includes(r)})},yo=(e,t,r,{formatMessage:n,formatList:l},o,i,s)=>{const c=t.map(e=>e.port_idx),d=Math.min(...c,1),u=Math.max(...c,1),m=a.createElement(f.sA,{id:"COMMON_VALIDATION_HINT_RANGE",values:{min:d,max:u}}),{switch_caps:E,model:_}=t[0]?.device||{},A=t[0]?.speed_caps,p=!E?.vlan_caps||(0,kt.zk)(E?.vlan_caps);return Oo.A.object().shape({port_idx:Oo.A.number(),name:Oo.A.string().label("COMMON_NAME").max(128),poe_mode:Oo.A.string(),portconf_id:Oo.A.string().test({name:"profilePortSpeedNotValid",test:(e,n)=>{const o=ko(t,r,n.parent.portSpeed);return!(A&&e&&o.length)||n.createError({message:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_PROFILE_SPEED_NOT_SUPPORTED",values:{count:o.length,ports:l(o)}})})}}).test({name:"profileDontAllowForwardCustomize",test:(e,t)=>p||((e,t,r,a,n)=>{if(!t.find(e=>e._id===r))return!0;const l=e.find(e=>e._id===n);return(0,fr.nz)(l)?a!==zn.sg.CUSTOM:a===zn.sg.BLOCK_ALL})(i,o,e,t.parent.tagged_vlan_mgmt,t.parent.native_networkconf_id)||t.createError({message:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_PROFILE_FORWARD_NOT_SUPPORTED"})})}).test({name:"profileContainsUnsupportedQoS",test:(e,t)=>{const r=s.max_class_maps>0&&(0,kt.Sb)(s?.feature_caps||0),n=Eo()(t.parent.qos_profile,go.a$);return!(!r&&e&&!n)||t.createError({message:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_PROFILE_QOS_NOT_SUPPORTED"})})}}),stormControlEnabled:Ao.tn,stormctrl_bcast_enabled:Oo.A.boolean(),stormctrl_mcast_enabled:Oo.A.boolean(),stormctrl_ucast_enabled:Oo.A.boolean(),stormctrl_bcast_rate:(0,Ao.v7)("bcast"),stormctrl_mcast_rate:(0,Ao.v7)("mcast"),stormctrl_ucast_rate:(0,Ao.v7)("ucast"),isolation:Oo.A.boolean(),portSpeed:Oo.A.string().test({name:"portSpeedNotValid",test:(e,n)=>{const o=ko(t,r,e);return!(A&&!n.parent.portconf_id&&ko(t,r,e).length)||n.createError({message:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_LINK_SPEED_NOT_SUPPORTED",values:{count:o.length,ports:l(o)}})})}}),lldpmed_enabled:Ao.l8,op_mode:Oo.A.string(),aggregate_members:Oo.A.array().of(Oo.A.number()).test({name:"aggregateMembersValidation",test:(r,n)=>{const l=t.find(t=>t.id===(0,J.FS)(e,n.parent.port_idx));return!!(n.parent.op_mode!==_o.RC.AGGREGATE||l.isInMcLink||l.isInTargetDevice||l.isInStackingLagsGroup||l.isInStackingLink)||(!r||r.length<2?n.createError({message:a.createElement(f.sA,{id:"COMMON_VALIDATION_AGGREGATE_MEMBERS_MIN"})}):!(r.length>8)||n.createError({message:a.createElement(f.sA,{id:"COMMON_VALIDATION_AGGREGATE_MEMBERS_MAX"})}))}}),mirror_port_idx:Oo.A.number().when("op_mode",{is:"mirror",then:Oo.A.number().required(m).min(d,m).max(u,m).notOneOf([Oo.A.ref("port_idx")],n({id:"DEVICE_PORT_FORM_MIRROR_PORT_NOT_SAME_ALERT"})).test({name:"mirrorPortRangeCheck",test:(e,t)=>{const r=Do(s.mirror_groups).find(e=>e.port_range_num.includes(t.parent.port_idx));return!((0,v.CI)({model:_})&&!r?.port_range_num.includes(e))||t.createError({message:a.createElement(f.sA,{id:"PORTS_MIRROR_GROUP_VALIDATION",values:{min:Math.min(...r?.port_range_num||[]),max:Math.max(...r?.port_range_num||[])}})})}})}),port_security_mac_address:Oo.A.array().of(Oo.A.string()).test({name:"requiredIfPortSecurity",test:(e,t)=>!!(e.length>0||t.parent.portSecurity!==po.r.RESTRICTED)||t.createError({message:a.createElement(f.sA,{id:"COMMON_PORTS_MAC_ADRESS_REQUIRED"})})}),egress_rate_limit_kbps_enabled:Oo.A.boolean(),stp_port_mode:Oo.A.boolean(),port_keepalive_enabled:Oo.A.boolean(),egress_rate_limit_kbps:Ao.Ib,dot1x_idle_timeout:Ao.tI,taggedVlans:Ao.mH,qosEnabled:Ao.HX,multicastRouterEnabled:Oo.A.bool(),multicast_router_networkconf_ids:Oo.A.array().when("multicastRouterEnabled",{is:!0,then:Oo.A.array().of(Oo.A.string()).min(1,a.createElement(f.sA,{id:"COMMON_VALIDATION_NETWORK"}))})})};var Go=r(334521),Vo=r(106287),Fo=r(165126),Uo=r(689965),Bo=r(898257),Wo=r(125234),Ho=r(961863),$o=r(699736),zo=r(459593),Yo=r(15095),Ko=r(877299);const jo=({children:e,isActive:t})=>a.createElement(b.A,{description:t?a.createElement(f.sA,{id:"DEVICE_POE_PASSTHROUGH_ONLY",values:{b:f.b}}):null,portal:!0},e),Qo=({children:e,onClick:t,isActive:r})=>a.createElement(b.A,{isInteractive:!0,description:r?a.createElement(f.sA,{id:"PORTS_POE_LOW_PF_MODE",values:{link:a.createElement(st.A,{type:"button",variant:"inline",size:"inherit",onClick:t},a.createElement(f.sA,{id:"COMMON_LOW_PERFORMANCE_MODE"}))}}):null,portal:!0,noWrap:!0},e),qo=e=>e.isPoePlusPlusPlusSupported?"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS":e.isPoePlusPlusSupported?"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS":e.isPoePlusSupported?"COMMON_DEVICE_POE_MODE_POE_PLUS":"COMMON_DEVICE_POE_MODE_POE",Xo=({port_idx:e,poe_power:t,poe_caps:r,port_poe:n,selectedPortNumbers:l,device:o,disabled:i})=>{const{formatMessage:s}=(0,f.tz)(),c=(0,So.W6)(),u=o.lowpfmode||o.lowpfmode_override,m=(0,Yo.A)(d.VO.DEVICES),{setFieldValue:E}=(0,no.j7)(),{values:_}=(0,no.j7)(),A=(0,I.useSelector)(er.ID),O=(0,a.useMemo)(()=>(0,ya.kO)({poe_caps:r,port_poe:n}),[r,n]),g=(0,a.useMemo)(()=>O.isPoePassthroughSupported&&!O.isPoeOffSupported,[O]),C=l.length>1&&l.some(e=>{const t=o?.port_table?.find(t=>t.port_idx===e);return Boolean(parseInt(t?.poe_power,10))}),S=(0,a.useCallback)(()=>{E("poe_mode",_o.Gu.OFF)},[E]),T=(0,a.useCallback)(()=>{E("poe_mode",_o.Gu.PASSIVE_24V)},[E]),M=(0,a.useCallback)(()=>{E("poe_mode",_o.Gu.PASSTHROUGH)},[E]),R=Boolean(parseInt(t,10))&&!C&&(0,L.Uz)(e,o.mac,o.downlink_table,A),[b,v]=(0,a.useState)(!1),D=(0,a.useCallback)(()=>{v(!1)},[]),x=(0,a.useCallback)(()=>{S(),v(!1)},[S]),w=(0,a.useCallback)(()=>{R?.mac||C?v(!0):S()},[C,R?.mac,S]),[y,G]=(0,a.useState)(!1),V=(0,a.useCallback)(()=>{G(!1)},[]),F=(0,a.useCallback)(()=>{T(),G(!1)},[T]),U=(0,a.useCallback)(()=>{G(!0)},[]),[B,W]=(0,a.useState)(!1),H=(0,a.useCallback)(()=>{W(!1)},[]),$=(0,a.useCallback)(()=>{M(),W(!1)},[M]),z=(0,a.useCallback)(()=>{W(!0)},[]),Y=(0,a.useCallback)(()=>{(0,zo.X)(c,m,o.mac,Il.BC.SETTINGS)},[m,c,o.mac]),K=Boolean(_.portconf_id)&&!O.isPoePassive24Supported&&!O.isPoePassthroughSupported,j=(0,a.useMemo)(()=>{if(1===l.length)return!1;const e=(o?.port_table||[]).filter(e=>l.includes(e.port_idx)&&(0,Ko.nz)(_.poe_mode,(0,ya.kO)(e))).length;return 0!==e&&e!==l.length},[l.length,_.poe_mode]);return a.createElement(a.Fragment,null,a.createElement(h.A,{flexDirection:"column"},a.createElement(P.A,{size:"small",color:"text-3"},a.createElement(f.sA,{id:"COMMON_DEVICE_POE_MODE_POE"})),a.createElement(Qo,{onClick:Y,isActive:u},a.createElement(h.A,{gap:p.Ln,alignItems:"center"},(O.isPoeOffSupported||g)&&a.createElement(jo,{isActive:g&&!u},a.createElement(qr.A,{title:C?"DEVICE_POE_MULTIPLE_OFF_TITLE":"DEVICE_POE_PORT_IN_USE_TITLE",body:a.createElement(P.A,null,a.createElement(f.sA,{id:C?"DEVICE_POE_MUTLIPLE_OFF_DESC":"DEVICE_POE_PORT_IN_USE_DESC",values:C?{}:{name:(0,k.Q)(R)}})),showHeaderClose:!0,buttonMessage:"COMMON_ACTION_PROCEED",isOpen:b,handleClose:D,handleConfirm:x},a.createElement(To.A,{id:"poe-mode-group",value:_o.Gu.OFF,onChange:w,type:"radio",name:"poe_mode",disabled:g||u||K||i},a.createElement(f.sA,{id:"COMMON_PORTS_FORM_FIELD_POE_MODE_OPTION_OFF"})))),O.isPoeAutoSupported&&a.createElement("div",null,a.createElement(To.A,{value:_o.Gu.AUTO,type:"radio",name:"poe_mode",id:"poe-mode-group",disabled:u||i},a.createElement(f.sA,{id:qo(O)}))),O.isPoePassive24Supported&&a.createElement(qr.A,{title:"DEVICE_POE_UPDATE_TITLE",body:a.createElement(P.A,null,a.createElement(f.sA,{id:"DEVICE_POE_UPDATE_DESC",values:{poeMode:s({id:"COMMON_DEVICE_POE_MODE_PASSIVE"}),portIds:l.join(", "),port:1===l.length?s({id:"COMMON_PORT"}):s({id:"DEVICE_PROPERTY_HEADER_PORTS"}),b:f.b}})),showHeaderClose:!0,buttonMessage:"COMMON_ACTION_PROCEED",isOpen:y,handleClose:V,handleConfirm:F},a.createElement(To.A,{value:_o.Gu.PASSIVE_24V,onChange:U,type:"radio",name:"poe_mode",id:"poe-mode-group",disabled:u||K||i},a.createElement(f.sA,{id:"COMMON_PORTS_FORM_FIELD_POE_MODE_OPTION_PASV24"}))),O.isPoePassthroughSupported&&a.createElement(qr.A,{title:"DEVICE_POE_UPDATE_TITLE",body:a.createElement(P.A,null,a.createElement(f.sA,{id:"DEVICE_POE_UPDATE_DESC",values:{poeMode:s({id:"COMMON_DEVICE_POE_MODE_PASSTHROUGH"}),portIds:l[0],port:s({id:"COMMON_PORT"}),b:f.b}})),showHeaderClose:!0,buttonMessage:"COMMON_ACTION_PROCEED",isOpen:B,handleClose:H,handleConfirm:$},a.createElement(To.A,{value:_o.Gu.PASSTHROUGH,onChange:z,type:"radio",name:"poe_mode",id:"poe-mode-group",disabled:u||K||i},a.createElement(f.sA,{id:"COMMON_PORTS_FORM_FIELD_POE_MODE_OPTION_PASSTHROUGH"})))))),j?a.createElement(ho.A,{icon:a.createElement(N.A,{isActive:!0,size:"original",variant:"fill"}),description:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_NOTICE_POE_NOT_APPLICABLE_TO_ALL_PORTS"})}):null)};var Jo=r(609519),Zo=r(649705),ei=r(883840),ti=r(173068),ri=r(114470),ai=r(883554),ni=r(461983),li=r(174897),oi=r(185414),ii=r(872352),si=r(605452),ci=r(232832),di=r(329109),ui=r(242281),mi=r(275463),Ei=r(817068),_i=r(854246),Ai=r(645732),pi=r(987588);const Oi=({disabled:e,featureCaps:t,currentPort:r})=>{const{values:n,setFieldValue:l,resetForm:o,setValues:i,errors:s}=(0,no.j7)(),c=(0,I.useSelector)($n.w),d=(0,So.W6)(),u=(0,vo.A)(`${kl.E5}?${kl.NH}`),m=(0,a.useCallback)(()=>{d.push(u)},[d,u]),[E,_]=(0,a.useState)(!1),A=(0,I.useSelector)(Rr.Tn),O=(0,a.useMemo)(()=>(0,ut.A)(c).sort(br.dS).map(({_id:e,name:t})=>({label:t,value:e})),[c]),g=(0,I.useSelector)(Rr.nT),C=(0,a.useCallback)(e=>{if(!e)return;const a=c?.find(t=>t._id===e.value),l=(0,ya.kO)(r),s=(0,kt.On)(t),d=!l.isPoePassive24Supported&&!l.isPoePassthroughSupported,u=(0,Ai.f)(a,!0,A,l,g,s),m={...a,...u},{_id:E,setting_preference:_,name:p,portConfEnabled:O,op_mode:C,mirror_port_idx:S,aggregate_members:T,port_idx:M,site_id:h,poe_mode:I,vlanGroupId:N,...P}=m;o(),i({...n,...P,...d&&{poe_mode:I},portconf_id:e.value})},[r,t,g,o,i,n]),S=(0,a.useCallback)(e=>{e&&O[0]&&(C(O[0]),n.op_mode===_o.RC.MIRROR&&l("op_mode",_o.RC.SWITCH)),e||(l("portconf_id",void 0),l("portSpeed",_o.n5.PORTSPEED_AUTO_NEG)),l("portConfEnabled",e)},[C,O,l,n.op_mode]),T=n.op_mode===_o.RC.MIRROR,M=(0,a.useCallback)(({target:{checked:e}})=>{e&&T?_(!0):S(e)},[S,T]);return a.createElement(h.A,{flexDirection:"column",gap:p.Ln},a.createElement(Mo.A,{condition:T,wrapper:e=>a.createElement(qr.A,{title:"DEVICE_PORT_PROFILE_INLINE_CONFIRM_TITLE",buttonMessage:"COMMON_ACTION_PROCEED",handleClose:_,handleConfirm:()=>S(!0),isOpen:E,body:a.createElement(Te.A,{size:"inherit"},a.createElement(f.sA,{id:"DEVICE_PORT_PROFILE_INLINE_CONFIRM_MESSAGE"}))},e)},a.createElement(pi.l2,{width:"100%",gap:p.kc},a.createElement(To.A,{name:"portConfEnabled",type:"realCheckbox",disabled:e,onChange:M},a.createElement(f.sA,{id:"COMMON_ETHERNET_PORT_PROFILE"})),n.portConfEnabled&&0===O.length?a.createElement(st.A,{type:"button",variant:"inline",size:"medium",disabled:e,onClick:m},a.createElement(f.sA,{id:"COMMON_NEW"})):null)),n.portConfEnabled&&O.length>0?a.createElement(h.A,{width:"100%",gap:p.kc},a.createElement(To.A,{name:"portconf_id",type:"dropdown",sortedOptions:!0,variant:"secondary",full:!0,options:O,onChange:C}),a.createElement(st.A,{variant:"inline",type:"button",size:"medium",disabled:e,onClick:m},a.createElement(f.sA,{id:"COMMON_NEW"}))):null,a.createElement(_i.A,{visible:!!s.portconf_id},s.portconf_id))};var gi=r(795097);const Ci=({showFields:e,isHybridSwitchWithoutTaggedVlans:t,isStacking:r})=>{const{values:{portconf_id:n,portSpeed:l},errors:o}=(0,no.j7)(),[i,s]=(0,a.useState)(!1);if(!n||o.portconf_id)return null;const c=(({showSecurityMac:e,showDot1x:t,showEgressRateLimit:r,showIsolation:a,showLldpMed:n,showNetwork:l,showPoe:o,showStormControl:i,showStp:s,showVoiceNetwork:c,showKeepAliveLoopProtection:d,showFec:u},m,E,_)=>{const A=[];return e||A.push("COMMON_PORTS_FORM_FIELD_PORT_SECURITY_OPTION_RESTRICTED"),l&&!E||A.push("COMMON_PORTS_TAGGED_VLAN_MANAGEMENT"),l&&!E||A.push("COMMON_PORTS_NATIVE_VLAN_NETWORKS"),o||A.push("COMMON_DEVICE_POE_MODE_POE"),t&&!_||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_DOT1X"),a&&!_||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_PORT_ISOLATION"),i||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_STORM_CONTROL"),s||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_STP"),n&&!_||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_LLDP_MED"),r&&!_||A.push("COMMON_DEVICE_CAP_SWITCH_CAP_EGRESS_RATE_LIMIT"),c&&!_||A.push("COMMON_PORTS_FORM_FIELD_VOICE_NETWORKCONF_ID_LABEL"),d&&!_||A.push("COMMON_LOOP_PROTECTION"),u||m!==_o.n5.PORTSPEED_FULL_25G||A.push("COMMON_PORTS_FORM_FIELD_PORT_SPEED_FEC_LABEL"),A})(e,l,t,r);return c.length?a.createElement(ho.A,{icon:a.createElement(N.A,{isActive:!0,size:"original",variant:"fill"}),description:a.createElement(h.A,{flexDirection:"column",alignItems:"start"},a.createElement(f.sA,{id:"PORTS_FORM_PROFILE_UNSUPPORTED_FEAUTRE"}),a.createElement(gi.A,null,c.slice(0,i?c.length:3).map(e=>a.createElement("li",{key:e},a.createElement(Te.A,{size:"body",weight:"bold"},a.createElement(f.sA,{id:e}))))),c.length>3?a.createElement(st.A,{type:"button",variant:"inline",onClick:()=>s(e=>!e)},a.createElement(f.sA,{id:i?"COMMON_HIDE":"COMMON_SHOW_X_MORE",values:{value:c.length-3}})):null)}):null};var Si=r(439247),Ti=r(349665),Mi=r(553432),hi=r(317672),Ii=r(774570);const Ni=({disabled:e,isUsg:t,ethernetOverrides:r,ifname:n})=>{const{formatMessage:l}=(0,f.tz)(),o=(0,I.useSelector)(Rr.uD),i=(0,a.useCallback)(e=>!!t&&r.some(t=>t.networkgroup===e&&n!==t.ifname),[r,n,t]),s=(0,a.useMemo)(()=>o.sort().map(e=>({value:e,label:(0,Ii.bR)(e,l),disabled:i(e)})),[o,l,i]);return a.createElement(Ti.A,null,a.createElement(hi.A,{htmlFor:"vlanGroupId",tooltip:a.createElement(f.sA,{id:"COMMON_VLAN_GROUP_TOOLTIP"})},a.createElement(f.sA,{id:"COMMON_VLAN_GROUP"})),a.createElement(Mi.A,null,s.map(t=>a.createElement(To.A,{value:t.value,type:"radio",name:"vlanGroupId",disabled:e||t.disabled},t.label))))},Pi=({disabled:e,disableReason:t,overrideValue:r})=>{const{values:n}=(0,no.j7)(),l=r??n.flow_control_enabled;return a.createElement(h.A,{flexDirection:"column",gap:p.kc},a.createElement(tl.A,{description:e?t:void 0},a.createElement(pi.l2,null,a.createElement(To.A,{name:"flow_control_enabled",type:"realCheckbox",tooltipMessage:t?void 0:a.createElement(f.sA,{id:"COMMON_FLOW_CONTROL_TOOLTIP"}),disabled:e,checked:l},a.createElement(f.sA,{id:"COMMON_FLOW_CONTROL"})))))};var Ri=r(515289);const bi=(0,a.memo)(()=>{const e=(0,I.useSelector)(D.xP),t=(0,I.useSelector)(w.UH),r=(0,I.useDispatch)(),n=(0,a.useCallback)(e=>{r((0,Q.Ao)((0,re.QP)(e,t)))},[r,t]);if(t.length<2)return null;const l=t.slice(0,2),o=t.slice(2),i=l.map(t=>{const r=e.find(e=>e.id===t);return a.createElement(Ri.A,{onClose:()=>n(r.id),key:r.id,maxWidth:192},r?.name)});return a.createElement(h.A,{flexWrap:"wrap",gap:p.kc},i,o.length>0?a.createElement(h.A,{alignItems:"center",flexGrow:0,flexShrink:0},a.createElement(b.A,{portal:!0,isInteractive:!0,description:a.createElement(h.A,{gap:p.YC,flexDirection:"column"},o.map(t=>{const r=e.find(e=>e.id===t);return r?a.createElement(Ri.A,{onClose:()=>n(r.id),key:r.id,maxWidth:192,width:"fit-content"},r?.name):null}))},a.createElement(P.A,null,"+",a.createElement(f.sA,{id:"DEVICE_PLUS_N_SELECTED",values:{n:o.length}})))):null)}),fi=({mac:e,port_idx:t,showLocate:r,showManualPowerCycle:n,selectedPorts:l})=>{const i=(0,I.useDispatch)(),s=(0,I.useSelector)(rt.EL),c=(0,I.useSelector)(D.dp),[d,u]=(0,a.useState)(!1),[m,E]=(0,a.useState)(!1),_=(0,I.useSelector)((0,a.useMemo)(()=>(0,er.tG)(e),[e])),A=((e=[],t=[])=>t.every(t=>e.includes(t)))(_.locating_ports,l),[O,g]=(0,a.useState)(A);(0,a.useEffect)(()=>{g(A)},[A]);const C=(0,a.useCallback)(()=>{g(!O),i((0,o.cj)({mac:e,name:_.name},l,O))},[_.name,i,O,e,l]),S=(0,a.useCallback)(()=>{i((0,o.Fx)({mac:e,name:_.name},t))},[_.name,i,e,t]),T=(0,a.useMemo)(()=>((e,t)=>t.filter(t=>{const r=e.find(e=>e.port_idx===t);return r?.anomalyList.includes(Ul.t.NETWORK_LOOP_DETECTED_BY_KEEPALIVE)||!1}))(c,l),[c,l]);(0,a.useEffect)(()=>{E(!1)},[T]);const M=(0,a.useCallback)(()=>{T.forEach(t=>{i((0,o.jx)(e,t))}),E(!0)},[i,e,T]),N=T.length>0&&!m;return!s&&(r||n||N)?a.createElement(h.A,{gap:p.Ln},r?a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:C,type:"button",size:"medium"},a.createElement(f.sA,{id:O?"DEVICE_ACTIONS_LOCATE_STOP":"DEVICE_ACTIONS_LOCATE"}))):null,n?a.createElement(qr.A,{title:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_TITLE",titleValues:{portId:t},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:u,handleConfirm:S,isOpen:d,body:a.createElement(Te.A,{size:"inherit"},a.createElement(f.sA,{id:"DEVICE_PORT_POWER_CYCLE_CONFIRMATION_BODY",values:{portId:t}}))},a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:()=>u(!0),type:"button",size:"medium"},a.createElement(f.sA,{id:"DEVICE_ACTIONS_POWER_CYCLE"})))):null,N?a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:M,type:"button",size:"medium"},a.createElement(f.sA,{id:"PORTS_ACTIONS_RE_ENABLE_NETWORK_LOOP"}))):null):null},vi=()=>{const{values:e}=(0,no.j7)(),t=(0,I.useSelector)(w.pN),r=(0,I.useDispatch)();(0,a.useEffect)(()=>{e.aggregate_members&&!(0,fa.L)(e.aggregate_members,t)&&r((0,Q.jv)(e.aggregate_members))},[e.aggregate_members,t,r])},Di=["port_idx","name"],Li=["advancedConfigSwap","stormControlEnabled","excludedNetworksConfEnabled","voiceNetworkConfEnabled","portConfEnabled","forward","lldpmed_notify_enabled","qosEnabled","avManufacturer"],xi=({deviceOfMainPort:e,currentExtendedPort:t,isVlanTaggingSupported:r,isPortMacFilteringSupported:n,selectedPortsSpeedCapIntersection:l,mainPortId:o})=>{const{values:i,handleSubmit:s,handleReset:c,initialValues:d}=(0,no.j7)(),u=(0,I.useDispatch)(),[m,E]=(0,a.useState)(!1);vi();const{model:_,switch_vlan_enabled:A,mac:O,port_overrides:g,switch_caps:C,port_table:S}=e,T=(0,v.oW)(e),M=(0,I.useSelector)(mi.L),R=(0,I.useSelector)(Rr.Tn),b=(0,I.useSelector)(Ei.nI),L=(0,I.useSelector)(io.zu),x=(0,I.useSelector)(w.UH),k=(0,I.useSelector)(Rr.uD),{selectedPortIndexes:y}=(0,a.useMemo)(()=>({selectedPortIndexes:x.map(e=>(0,J.q9)(e)).map(({portIdx:e})=>e)}),[x]),G=(0,kt.R9)(e),U=(0,kt.vk)({model:_,switch_vlan_enabled:A}),B=(0,I.useSelector)(D.LL),W=(0,I.useSelector)(w.XS),H=(0,I.useSelector)(al.pB),$=(0,Go.Xo)(e,i,t,B,L,l,k,y,W,H),z=(0,a.useMemo)(()=>(0,wo.EV)(l).map(wo.MT),[l]),Y=!!i.portconf_id,K=i.portSecurity===po.r.DISABLED&&$.showDisablePort,j=i.setting_preference===ei.C.AUTO,q=t.isInMcLink,X=(0,kt.Tn)(e),Z=e.device_mode_override===zn.Yp.MANAGED_SHADOW_GATEWAY,ee=K||j||Y||q||X||Z,te=(0,a.useMemo)(()=>{const e=y.filter(e=>e!==o),t=(0,Fo.A)((g||[]).find(({port_idx:e})=>e===o),Di);return e.every(e=>{if(S.find(({port_idx:t})=>t===e).aggregated_by)return!0;const r=(0,Fo.A)((g||[]).find(({port_idx:t})=>t===e),Di);return 0===[...new Set([...Object.keys(t||{}),...Object.keys(r||{})])].filter(e=>Array.isArray(t?.[e])&&Array.isArray(r?.[e])?!(0,fa.L)(t?.[e],r?.[e]):!Eo()(t?.[e],r?.[e])).length})},[y]),{showApplyButton:re,showCancelButton:ae}=(0,a.useMemo)(()=>{const e=[...Li];let t=[...new Set([...Object.keys(d),...Object.keys(i)])].filter(e=>i[e]!==d[e]);(0,fa.L)(i.taggedVlans,d.taggedVlans)&&(t=t.filter(e=>"taggedVlans"!==e)),(0,fa.L)(i.port_security_mac_address,d.port_security_mac_address)&&(t=t.filter(e=>"port_security_mac_address"!==e)),Eo()(i.multicast_router_networkconf_ids,d.multicast_router_networkconf_ids)&&(t=t.filter(e=>"multicast_router_networkconf_ids"!==e)),Eo()(i.excluded_networkconf_ids,d.excluded_networkconf_ids)&&(t=t.filter(e=>"excluded_networkconf_ids"!==e)),Eo()(i.qos_profile,d.qos_profile)&&(t=t.filter(e=>"qos_profile"!==e)),Eo()(i.aggregate_members,d.aggregate_members)&&(t=t.filter(e=>"aggregate_members"!==e)),$.showPoe||(t=t.filter(e=>"poeModeSimple"!==e&&"poeModeAdvanced"!==e)),$.showDot1x||(t=t.filter(e=>"dot1x_idle_timeout"!==e&&"dot1x_ctrl"!==e)),i.tagged_vlan_mgmt!==zn.sg.CUSTOM&&e.push("taggedVlans"),i.autoneg&&e.push("speed","full_duplex");const r=t.filter(t=>!e.includes(t)).length>0;return{showApplyButton:r||B&&!te,showCancelButton:r}},[B,te,i,d,$.showDot1x,$.showPoe]),ne=(0,a.useCallback)(e=>(0,Go.VT)(e?.native_networkconf_id,b.length,M,u),[u,M,b.length]),le=(0,a.useCallback)(()=>{O&&u((0,F.XP)({type:V.H.DEVICE,id:O,tab:Il.BC.SETTINGS}))},[O,u]),{showSwitchVlanLimit:oe,showApVlanLimit:ie}=(0,a.useMemo)(()=>ui.t2.includes(_)&&R.length>ui.Oz?{showSwitchVlanLimit:!0,showApVlanLimit:!1}:ui.OO.includes(_)&&R.length>ui.pC?{showSwitchVlanLimit:!1,showApVlanLimit:!0}:{showSwitchVlanLimit:!1,showApVlanLimit:!1},[_,R.length]),se=i.portSecurity===po.r.AV&&(0,Go.lB)(i?.native_networkconf_id),ce={disableReason:X?a.createElement(f.sA,{id:"DEVICE_PROPERTIES_DISABLED_WARNING_STACKING"}):void 0,overrideValue:!X&&void 0},de=(0,a.useCallback)(()=>{c(),u((0,Q.jv)([]))},[c,u]);return a.createElement(h.A,{flexDirection:"column"},a.createElement(Uo.A,null,a.createElement(h.A,{flexDirection:"column",gap:p.Ln},$.showSelectedPortList?a.createElement(bi,null):null,$.showSelectedPortList?a.createElement(ho.A,{icon:a.createElement(N.A,{isActive:!0,size:"original",variant:"fill"}),description:a.createElement(f.sA,{id:"DEVICE_PORT_FORM_NOTICE_PORT_BATCH_EDIT",values:{portIdx:t.port_idx,b:f.b}})}):null,$.showNameField?a.createElement(Bo.A,{disabled:Z}):null,a.createElement(fi,{mac:O,port_idx:t.port_idx,showManualPowerCycle:$.showManualPowerCycle,showLocate:$.showLocate,selectedPorts:y}),$.showDisablePort?a.createElement(Wo.A,{disabled:Y||q||X||Z,isPortMacFilteringSupported:n,showQos:$.showQos}):null,!B&&$.showLanNetworkGroups?a.createElement(Ni,{ethernetOverrides:e.ethernet_overrides,ifname:t.ifname,isUsg:T,disabled:K||Z}):null,$.showNetwork?a.createElement(Mo.A,{condition:U,wrapper:e=>a.createElement(h.A,{marginBottom:p.Ln,flexDirection:"column"},(0,Io.rR)(void 0,a.createElement(P.A,{color:"text-1",size:"small"},a.createElement(f.sA,{id:"PORTS_HYBRID_DEVICE_TOOLTIP_TEXT",values:{link:a.createElement(st.A,{type:"button",variant:"inline",onClick:le},a.createElement(f.sA,{id:"PORTS_HYBRID_DEVICE_TOOLTIP_LINK"}))}})),{isInteractive:!0})(e))},a.createElement(Ho.A,{disabled:K||Y||U||q||X||Z}),a.createElement($o.A,{disabled:K||Y||U||q||K||Z,isVlanTaggingSupported:r,showApVlanLimit:ie,showSwitchVlanLimit:oe})):null,$.showMulticastRouterPort?a.createElement(Jo.A,{disabled:K||Y||q||X||Z,...ce}):null,$.showPoe?a.createElement(Xo,{device:e,selectedPortNumbers:y,port_idx:t.port_idx,poe_power:t.poe_power,poe_caps:t.poe_caps,port_poe:t.port_poe,disabled:Z}):null,a.createElement(P.A,{color:"text-1",size:"medium",weight:"bold"},a.createElement(f.sA,{id:"COMMON_ADVANCED"})),a.createElement(Zo.A,{disabled:K||Y||Z||t.isInMcLink||t.isInTargetDevice||t.isInStackingLagsGroup||t.isInStackingLink}),$.showOperation?a.createElement(xo,{disabled:K||j||Z||t.isInMcLink||t.isInTargetDevice||t.isInStackingLagsGroup||t.isInStackingLink,portData:t,device:e,isInMcLink:t.isInMcLink,isInTargetLink:t.isInTargetDevice,isInCrossLags:t.isInStackingLagsGroup,isInStackingLink:t.isInStackingLink}):null,$.showSpeed?a.createElement(ti.A,{disabled:K||j||Y||Z,optionsOverride:z,showFec:$.showFec,media:t.media,showMixedSpeedWarning:G}):null,$.showProfile?a.createElement(a.Fragment,null,a.createElement(Oi,{disabled:(Z||K||j||q)&&!Y,featureCaps:C?.feature_caps,currentPort:t}),a.createElement(Ci,{showFields:$,isHybridSwitchWithoutTaggedVlans:U,isStacking:X})):null,$.showDot1x?a.createElement(Si.A,{disabled:ee||X,...ce}):null,$.showFlowControl?a.createElement(Pi,{disabled:ee,...ce}):null,$.showIsolation?a.createElement(ri.A,{disabled:ee,model:_,...ce}):null,$.showStormControl?a.createElement(ai.A,{disabled:ee}):null,$.showKeepAliveLoopProtection?a.createElement(ni.A,{disabled:ee,...ce}):null,$.showStp?a.createElement(li.A,{disabled:ee}):null,$.showEgressRateLimit?a.createElement(oi.A,{disabled:ee,...ce}):null,$.showLldpMed?a.createElement(ii.A,{disabled:ee,...ce}):null,$.showVoiceNetwork?a.createElement(si.A,{disabled:ee,...ce}):null,$.showQos?a.createElement(ci.A,{disabled:ee,...ce}):null)),a.createElement(di.A,{isDirty:re,onFormSubmit:s,onFormCancel:de,hideCancelButton:!ae,applyButton:se?a.createElement(qr.A,{message:"PORTS_PRO_AV_ENABLE_IGMP_SNOOPING",buttonMessage:"COMMON_ACTION_ENABLE",cancelButtonMessage:"COMMON_ACTION_DO_NOT_ENABLE",isOpen:m,handleClose:()=>s(),handleConfirm:()=>{ne(i)}},a.createElement(st.A,{name:"submit",variant:"primary",type:"submit",disabled:!re,onClick:e=>{E(!0),e.stopPropagation(),e.preventDefault()}},a.createElement(f.sA,{id:"COMMON_ACTION_APPLY_CHANGES"}))):null}))},wi=()=>{const e=(0,I.useDispatch)(),t=(0,f.tz)(),r=(0,oo.I)(),n=(0,I.useSelector)($n.w),l=(0,I.useSelector)(Rr.nT),i=(0,I.useSelector)(io.zu),s=(0,I.useSelector)(Ye.D),c=(0,I.useSelector)(rl.D5),d=(0,I.useSelector)(w.UH),u=(0,I.useSelector)(D.dp),m=(0,I.useSelector)(D.xP),E=(0,I.useSelector)(Rr.uD),_=(0,I.useSelector)(nl.G),A=(0,I.useSelector)(D.LL),p=(0,I.useSelector)(w.A),O=(0,I.useSelector)(al.pB),g=(0,I.useSelector)(Rr.Tn),C=(0,I.useSelector)((0,a.useMemo)(()=>(0,er.tG)(p),[p])),{link_aggregation_groups:S}=C,T=(0,a.useMemo)(()=>C,[C.mac,C.switch_vlan_enabled]),M=(0,I.useSelector)(D.mb),h=(0,I.useSelector)(Rr.wf),N=(0,I.useSelector)(w.pN),P=(0,I.useSelector)(w.XS),R=(0,a.useMemo)(()=>{const e=(0,J.q9)(d[0]).portIdx,t=S?.find(t=>t.aggregate_members.includes(e));return t?Math.min(...t.aggregate_members):e},[d,S]),b=(0,J.q9)(d[0]).deviceMac===T.mac,L=(0,a.useMemo)(()=>b&&T?T:M||(0,uo.A)(),[b,T,M]),x=(0,a.useMemo)(()=>d.map(e=>(0,J.q9)(e).portIdx),[d]),k=(0,a.useMemo)(()=>{let e=co.q;return(N.length?N:x).forEach(t=>{const r=m.find(({port_idx:e})=>e===t);r&&(e=e?e&r.speed_caps:r.speed_caps)}),e},[N,x]),y=(0,a.useMemo)(()=>({...(L.port_table||[]).find(e=>e.port_idx===R),...(L.port_overrides||[]).find(e=>e.port_idx===R)}),[L.port_table,L.port_overrides,R]),G=(0,re.vT)(y,L,s,c,h,O,_),{isInMcLink:V,isInTargetDevice:F}=(0,re.q)(y.port_idx,L.mac,s),{isInStackingLagsGroup:U,isInStackingLink:B}=(0,re.EP)(y.port_idx,L.mac,c),W=!L.switch_caps?.vlan_caps||(0,kt.zk)(L.switch_caps?.vlan_caps),H=(0,kt.On)(L.switch_caps?.feature_caps),$=(0,Go.f6)(y,L,g,l,n),z=(0,a.useMemo)(()=>N.length?N:x,[N,x]),Y=yo(L.mac,u,z,t,n,g,L.switch_caps);return a.createElement(no.l1,{validateOnBlur:!0,validateOnChange:!0,validationSchema:Y,initialValues:$,onSubmit:t=>{const a=()=>{const a=[],n=(0,Vo.Kh)(t,g,W),l={...t,...n},s=(0,Go.Xo)(L||{},t,y,A,i,k,E,x,P,O),c=(0,Go.GF)(s,t,V||F,U||B,A),u=Object.fromEntries(c.filter(e=>e in l).map(e=>[e,l[e]])),m=d.filter(e=>(0,J.q9)(e).deviceMac===T.mac).map(e=>(0,J.q9)(e).portIdx),_=d.filter(e=>(0,J.q9)(e).deviceMac===M?.mac).map(e=>(0,J.q9)(e).portIdx),p=(0,v.iQ)(L?.model)&&!L?.switch_vlan_enabled&&(Boolean(u.native_networkconf_id)||Boolean(u.voice_networkconf_id)||u.excluded_networkconf_ids&&u.excluded_networkconf_ids.length>0),C=$.name===t.name;if(m.length){const r=(0,Vo.rt)(u,T,C,m),n=(0,v.No)(T)?(0,Vo.PN)(t,T.ethernet_overrides,d,T):[];a.push(e((0,o.ex)({port_overrides:r,switch_vlan_enabled:p||void 0,ethernet_overrides:n?.length?n:void 0},T._id,T.mac,{mergeAndOverrideKeys:["port_overrides","ethernet_overrides"],extend:!0})))}if(M&&_.length){const t=(0,Vo.rt)(u,M,C,_);a.push(e((0,o.ex)({port_overrides:t,switch_vlan_enabled:p||void 0},M._id,M.mac,{mergeAndOverrideKeys:["port_overrides"],extend:!0})))}Promise.all(a).then(()=>{e((0,Q.Ao)([])),e((0,o.Uc)())}).catch(r)};A?e((0,lo.E)({title:"DEVICE_ACTIONS_SWITCH_BATCH_SAVE_CONFIRMATION_TITLE",message:"DEVICE_ACTIONS_SWITCH_BATCH_SAVE_CONFIRMATION_MESSAGE",onConfirm:()=>{a(),e((0,so.AS)())}})):a()},key:R},a.createElement(a.Fragment,null,a.createElement(xi,{currentExtendedPort:G,deviceOfMainPort:L,isVlanTaggingSupported:W,isPortMacFilteringSupported:H,selectedPortsSpeedCapIntersection:k,mainPortId:R})))};var ki,yi=r(973581),Gi=r(356927);!function(e){e.ENABLED="enabled",e.DISABLED="disabled"}(ki||(ki={}));var Vi=r(242366),Fi=r(736014),Ui=r(64003);const Bi=je.AH`
  margin: unset;
`,Wi=({disabled:e})=>{const{values:t,setValues:r}=(0,no.j7)(),n=(0,I.useSelector)(rt.EL),l=(0,a.useCallback)(e=>{const a=(0,Ui.A)(t,"setting_preference",e,"advancedConfigSwap");r(a)},[r,t]);return a.createElement(Da.A,{variant:"capsule",tabs:Fi.r,selectedTab:t.setting_preference,onSelectTab:e=>l(e.id),disabled:n||e,tabsClassName:Bi})};var Hi=r(391855);const $i=()=>{const{setFieldValue:e}=(0,no.j7)(),t=t=>{e("portDisabled",t)};return a.createElement(Ti.A,null,a.createElement(hi.A,{htmlFor:"portDisabled"},a.createElement(f.sA,{id:"COMMON_PORT"})),a.createElement(Mi.A,null,a.createElement(To.A,{value:ki.ENABLED,type:"radio",name:"portDisabled",onChange:()=>t(ki.ENABLED)},a.createElement(f.sA,{id:"COMMON_ACTIVE"})),a.createElement(To.A,{value:ki.DISABLED,type:"radio",name:"portDisabled",onChange:()=>t(ki.DISABLED)},a.createElement(f.sA,{id:"COMMON_DISABLED"}))))};var zi=r(513180),Yi=r(540883);const Ki=({port_idx:e,mac:t,ifname:r,_id:n,ethernet_overrides:l,up:i})=>{const s=(0,I.useDispatch)(),c=(0,I.useSelector)(rt.EL),u=(0,So.W6)(),m=(0,Yo.A)(`${d.VO.SETTINGS}/${kl.wE}`),[E,_]=(0,a.useState)(!1),A=(0,a.useCallback)(()=>{u.push(m)},[u,m]),O=l?.find(e=>e.ifname===r)||{},{networkgroup:g,disabled:C}=O,S=g===zi.C.WAN,T=!c&&!S,M=(0,a.useCallback)(()=>{const e={ifname:r,disabled:C,networkgroup:zn.vj.LAN},a=[e,...(l||[]).filter(t=>t.ifname!==e.ifname)];s((0,o.ex)({ethernet_overrides:a},n,t,{mergeAndOverrideKeys:["ethernet_overrides"],extend:!0})).then(()=>{s((0,o.Uc)()),s((0,Yi.F)())})},[r,C,l,s,n,t]);return a.createElement(h.A,{gap:p.Ln},a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:A,type:"button",size:"medium"},a.createElement(f.sA,{id:"PORTS_CONFIGURE_INTERNET_SETTINGS"}))),T?a.createElement(qr.A,{title:"PORTS_CHANGE_TO_LAN_CONFIRMATION_TITLE",titleValues:{portId:e},buttonMessage:"COMMON_ACTION_PROCEED",handleClose:_,handleConfirm:M,buttonVariant:"danger",isOpen:E,body:a.createElement(P.A,{size:"inherit"},a.createElement(f.sA,{id:i?"PORTS_CHANGE_TO_LAN_CONFIRMATION_BODY_IN_USE":"PORTS_CHANGE_TO_LAN_CONFIRMATION_BODY_NOT_IN_USE"}))},a.createElement(h.A,{alignItems:"center"},a.createElement(st.A,{variant:"inline",onClick:()=>_(!0),type:"button",size:"medium"},a.createElement(f.sA,{id:"PORTS_CHANGE_TO_LAN"})))):null)},ji=["advancedConfigSwap"],Qi=({currentPortData:e,device:t})=>{const{values:r,submitForm:n,resetForm:l,initialValues:o,isSubmitting:i,validateForm:s}=(0,no.j7)(),c=t.device_mode_override===zn.Yp.MANAGED_SHADOW_GATEWAY,[d,u]=(0,a.useState)(!1),{_id:m,mac:E,ethernet_overrides:_}=t,A=(0,a.useMemo)(()=>{const e=[...ji],t=[...new Set([...Object.keys(o),...Object.keys(r)])].filter(e=>r[e]!==o[e]);r.autoneg&&e.push("speed","full_duplex");return t.filter(t=>!e.includes(t)).length>0},[o,r]),p=(0,J.H3)(e,t),O=Boolean(e.poe_caps),g=(0,a.useMemo)(()=>{const t=(0,In.pg)(e.network_name),a=r.portDisabled&&r.portDisabled!==o.portDisabled;return t&&a},[e.network_name,o.portDisabled,r.portDisabled]),C=(0,a.useMemo)(()=>(0,wo.EV)(e.speed_caps).map(wo.MT),[e.speed_caps]),S=_?.find(t=>t.ifname===e.ifname)?.networkgroup,T=r.setting_preference===ei.C.AUTO;return a.createElement(h.A,{flexDirection:"column"},a.createElement(Uo.A,null,a.createElement(Vi.A,null,a.createElement(Bo.A,{networkGroup:S,disabled:c}),c?void 0:a.createElement(Ki,{_id:m,ethernet_overrides:_,ifname:e.ifname,mac:E,port_idx:e.port_idx,up:e.up}),a.createElement($i,null),O?a.createElement(Xo,{device:t,poe_caps:e.poe_caps,poe_power:e.poe_power,port_idx:e.port_idx,port_poe:e.port_poe,selectedPortNumbers:[e.port_idx],disabled:c}):null,a.createElement(Wi,{disabled:c}),a.createElement(ti.A,{optionsOverride:C,showFec:p,media:e.media,showMixedSpeedWarning:!1,disabled:T||c}))),a.createElement(di.A,{isDirty:A,onFormSubmit:n,onFormCancel:l,applyButton:a.createElement(qr.A,{title:"PORTS_WAN_DISABLE_TITLE",titleValues:{portIdx:e.port_idx},body:a.createElement(P.A,{variant:"inherit"},a.createElement(f.sA,{id:"PORTS_WAN_DISABLE_MESSAGE"})),buttonMessage:"COMMON_ACTION_PROCEED",buttonVariant:"danger",isOpen:d,handleConfirm:()=>{n()},handleCancel:()=>u(!1),handleClose:()=>u(!1)},a.createElement(Hi.A,{label:"COMMON_ACTION_APPLY_CHANGES",showLoader:i,isDisabled:d,onSubmit:()=>{s().then(e=>{Object.keys(e).length||(g?u(!0):n())})},showWarningIcon:g}))}))},qi=()=>{const e=(0,I.useDispatch)(),t=(0,I.useSelector)(w.UH),{portIdx:r,deviceMac:n}=(0,J.q9)(t[0]),l=(0,I.useSelector)((0,er.tG)(n)),i=(0,a.useMemo)(()=>l,[l.mac]),s=Oo.A.object().shape({name:Oo.A.string().min(0).max(128).label("COMMON_NAME")}),c=(0,a.useMemo)(()=>{const e=i.port_table?.find(e=>e.port_idx===r),t=i.port_overrides?.find(e=>e.port_idx===r);return{...e,...t}},[i.mac]),d=(0,a.useMemo)(()=>{const e=i.ethernet_overrides,t=e?.find(e=>e.ifname===c.ifname);return t},[c.ifname,i.ethernet_overrides]),u=(0,J.H3)(c,l),m=Boolean(c.poe_caps),E=(0,a.useMemo)(()=>{const e=d?.disabled,t=c.autoneg?_o.n5.PORTSPEED_AUTO_NEG:(0,wo.xR)(c.full_duplex,c.speed),r=(0,Ko.V9)(c.poe_mode),a=c.setting_preference===ei.C.MANUAL||t!==_o.n5.PORTSPEED_AUTO_NEG?ei.C.MANUAL:ei.C.AUTO,n={portSpeed:_o.n5.PORTSPEED_AUTO_NEG,fec_mode:u?zn._t.FC_FEC:void 0,autoneg:Gi.A[_o.n5.PORTSPEED_AUTO_NEG].autoneg,speed:Gi.A[_o.n5.PORTSPEED_AUTO_NEG].speed,full_duplex:Gi.A[_o.n5.PORTSPEED_AUTO_NEG].full_duplex};return{name:c.name,portSpeed:t,fec_mode:u?c.fec_mode:void 0,autoneg:Gi.A[t].autoneg,speed:Gi.A[t].speed,full_duplex:Gi.A[t].full_duplex,poe_mode:m?r:void 0,portDisabled:e?ki.DISABLED:ki.ENABLED,advancedConfigSwap:n,setting_preference:a}},[d?.disabled,c,u,m]),_=(0,a.useCallback)(t=>{const a={name:t.name,fec_mode:u?(0,Go.K4)(t):void 0,autoneg:t.autoneg,speed:t.speed,full_duplex:t.full_duplex,poe_mode:m?t.poe_mode:void 0,port_idx:r},n={...d,disabled:t.portDisabled===ki.DISABLED||void 0},l=[n,...(i.ethernet_overrides||[]).filter(e=>e.ifname!==n.ifname)],s=[a,...(i.port_overrides||[]).filter(e=>e.port_idx!==r)];e((0,o.ex)({ethernet_overrides:l,port_overrides:s},i._id,i.mac,{mergeAndOverrideKeys:["port_overrides","ethernet_overrides"],extend:!0})).then(()=>{e((0,Q.Ao)([])),e((0,o.Uc)())})},[u,m,d,i.ethernet_overrides,i.port_overrides,i._id,i.mac,e,r]);return a.createElement(no.l1,{onSubmit:_,validationSchema:s,initialValues:E},a.createElement(Qi,{currentPortData:c,device:i}))};var Xi=r(360113);const Ji=()=>{const e=(0,I.useSelector)(D.Jf),t=(0,a.useMemo)(()=>e.stp_state===_o.vs.DISCARDING?"blocked":(0,Vo.Gn)(e)?"disabled":"active",[e]),r=(0,a.useMemo)(()=>"blocked"===t?"destructive":"disabled"===t?"notice":"text-3",[t]),n=(0,a.useMemo)(()=>"blocked"===t?"COMMON_BLOCKED":"disabled"===t?"COMMON_DISABLED":"COMMON_ACTIVE",[t]);return a.createElement(Xi.A,null,a.createElement(R.A,{color:"text-2",size:"medium"},a.createElement(f.sA,{id:"COMMON_STATUS"})),a.createElement(R.A,{color:r,size:"medium"},a.createElement(f.sA,{id:n})))};var Zi=r(10473),es=r(674530),ts=r(703447),rs=r(301265);const as=()=>{const e=(0,I.useSelector)(D.Jf),{connectedClient:t,connectedDevice:r,connectedMac:n,wanConfiguration:l}=(0,U.A)(e),o=Boolean(n||l)&&e.up,i=(0,a.useMemo)(()=>{if(l)return a.createElement(h.A,{gap:p.YC,alignItems:"center"},a.createElement(rs.A,{wanConfiguration:l}));if(!o)return a.createElement(f.sA,{id:"COMMON_FALLBACK"});const e=r?(0,k.Q)(r):(0,z.tn)(t);return o?a.createElement(h.A,{gap:p.YC,alignItems:"center"},r?a.createElement(Sr.A,{model:r.model,width:Zi.NJ,height:Zi.NJ,className:es.L}):null,!r&&t?a.createElement(h.A,{height:Zi.NJ,minWidth:Zi.NJ,maxWidth:Zi.NJ,justifyContent:"center",alignItems:"center",className:es.L},a.createElement(ts.A,{client:t})):null,e):null},[t,r,o,l]);return a.createElement(Xi.A,null,a.createElement(R.A,{color:"text-2",size:"medium"},a.createElement(f.sA,{id:"COMMON_CONNECTION"})),a.createElement(R.A,{color:"text-3",size:"medium"},i))},ns=()=>{const e=(0,I.useSelector)(D.Jf),t=(0,I.useSelector)((0,Rr.hQ)(e?.nativeNetworkConfIdSubstituted)),{formatMessage:r}=(0,f.tz)(),n=t?`(${(0,fr.mC)(t)})`:null,l=t?Qn(t,!1):r({id:"COMMON_FALLBACK"});return a.createElement(Xi.A,null,a.createElement(R.A,{color:"text-2",size:"medium"},a.createElement(f.sA,{id:"COMMON_PORTS_NATIVE_VLAN"})),a.createElement(R.A,{color:"text-3",size:"medium"},t?`${l} ${n}`:a.createElement(f.sA,{id:"COMMON_FALLBACK"})))};var ls=r(376272),os=r(903216);const is=()=>{const e=(0,I.useSelector)(D.Jf),{motifPalette:t}=(0,K.u)(),{speed:r,up:n,autoneg:l}=e||{},o=Boolean(r)&&(n||!l);return a.createElement(Xi.A,null,a.createElement(R.A,{color:"text-2",size:"medium"},a.createElement(f.sA,{id:"COMMON_SPEED"})),o?a.createElement(Nl.A,{colorOverride:t[(ls.A[r]??ls.A.DEFAULT).background],size:"medium"},(0,os.ir)(r)):a.createElement(R.A,{color:"text-3",size:"medium"},a.createElement(f.sA,{id:"COMMON_AUTO"})))};var ss=r(747107);const cs=()=>{const e=(0,I.useSelector)(D.Jf);return e.poe_caps?a.createElement(Xi.A,null,a.createElement(R.A,{color:"text-2",size:"medium"},a.createElement(f.sA,{id:"COMMON_POE_MODE"})),a.createElement(R.A,{color:"text-3",size:"medium"},a.createElement(f.sA,{id:(0,ss.j)(e)}))):null},ds=()=>a.createElement(Uo.A,null,a.createElement(h.A,{height:"100%",flexDirection:"column"},a.createElement(Ji,null),a.createElement(as,null),a.createElement(ns,null),a.createElement(is,null),a.createElement(cs,null)));var us=r(376618),ms=r(691189),Es=r(909522);const _s=(e,t,r={},a={})=>(0,ms.t9)(Es.A2,(0,Es.Yn)(e,t),r,{...a,idField:r=>`${(0,Es.OX)(e,t)}-${r.alert_event}`,payloadTransform:e=>e?.data??e});var As=r(975526),ps=r(128736);const Os=(e,t)=>(0,On.Mz)(((e,t)=>(0,Sn.uh)(_s(e,t)))(e,t),Tn.kh),gs=(0,n.A)(h.A)`
  align-items: center;
  gap: ${p.YC};
`,Cs=(0,n.A)(h.A)`
  flex-direction: column;
  gap: ${p.YC};
`,Ss=(0,n.A)(h.A)`
  align-items: center;
  justify-content: space-between;
`,Ts=(0,n.A)(h.A)`
  flex-direction: column;
  padding-left: ${p.Ln};
  gap: 2px;
  align-items: flex-start;
`,Ms=(0,n.A)(h.A)`
  align-items: start;
  gap: ${p.kc};
`,hs=({category:e,severity:t,anomalyList:r})=>{const{motifPalette:n}=(0,K.u)();return a.createElement(Cs,null,a.createElement(Ss,null,a.createElement(R.A,{size:"medium"},a.createElement(f.sA,{id:x.HJ[e]})),a.createElement(R.A,{size:"medium",color:x.HC[t]},a.createElement(f.sA,{id:x.e7[t]}))),a.createElement(Ts,null,r.map((e,t)=>{const r=(0,q.Hr)(e.anomaly_score);return a.createElement(Ms,{key:e.alert_event+t},a.createElement(ps.A,{variant:"outline",color:n[x.X2[r]]}),a.createElement(R.A,{size:"medium"},a.createElement(f.sA,{id:x.l3[e.alert_event]})))})))},Is=()=>{const e=(0,I.useSelector)(D.Jf),t=(0,I.useSelector)(Os(e?.device.mac,e?.port_idx)),r=(0,a.useMemo)(()=>({...{[As.V.LOOP_BROADCAST_FLOOD]:[],[As.V.TRAFFIC_PATH_HEALTH]:[],[As.V.CABLE_POWER]:[],[As.V.MULTICAST_DISCOVERY]:[]},...(0,us.A)(t||[],e=>e.anomaly_category)}),[t]),n=(0,a.useMemo)(()=>Object.entries(r).reduce((e,[t,r])=>(e[t]=(e=>{const t=e.reduce((e,t)=>e+t.anomaly_score,0);return t>=x.hz?Ul.Q.CRITICAL:t>0?Ul.Q.DEGRADED:Ul.Q.NONE})(r),e),{[As.V.LOOP_BROADCAST_FLOOD]:Ul.Q.NONE,[As.V.TRAFFIC_PATH_HEALTH]:Ul.Q.NONE,[As.V.CABLE_POWER]:Ul.Q.NONE,[As.V.MULTICAST_DISCOVERY]:Ul.Q.NONE}),[r]);return(0,c.A)([_s(e?.device.mac,e?.port_idx)],a.createElement(Uo.A,null,a.createElement(h.A,{height:"100%",flexDirection:"column",gap:p.kc},e?.anomalyScoreCombinedValue?a.createElement(gs,null,a.createElement(R.A,{size:"medium",weight:"bold"},a.createElement(f.sA,{id:"PORTS_AI_ANOMALY_SCORE"})),a.createElement(R.A,{color:(0,q.B9)(e?.anomalyScoreCombinedValue),size:"medium",weight:"bold"},e?.anomalyScoreCombinedValue)):null,a.createElement(hs,{category:As.V.CABLE_POWER,severity:n[As.V.CABLE_POWER],anomalyList:r[As.V.CABLE_POWER]}),a.createElement(hs,{category:As.V.LOOP_BROADCAST_FLOOD,severity:n[As.V.LOOP_BROADCAST_FLOOD],anomalyList:r[As.V.LOOP_BROADCAST_FLOOD]}),a.createElement(hs,{category:As.V.MULTICAST_DISCOVERY,severity:n[As.V.MULTICAST_DISCOVERY],anomalyList:r[As.V.MULTICAST_DISCOVERY]}),a.createElement(hs,{category:As.V.TRAFFIC_PATH_HEALTH,severity:n[As.V.TRAFFIC_PATH_HEALTH],anomalyList:r[As.V.TRAFFIC_PATH_HEALTH]}))),{renderKey:`${e?.device.mac||"none"}-${e?.port_idx||"none"}`})};var Ns=r(963070),Ps=r(450308);const Rs=(e,t)=>{const r=(e=>(0,On.Mz)((0,er.tG)(e),e=>e?.port_table?e.port_table.map(e=>e.port_idx):[]))(e);return(0,On.Mz)(r,e=>e,(r,a)=>{if(0===r.length)return;var n;const l=(n=[{mac:e,ports:r}],(0,On.Mz)((0,Sn.uh)((0,Ps.Z)({data:n})),Tn.kh))(a).shift();return l?l.ports.find(e=>e.port_idx===t):void 0})};var bs,fs=r(879905),vs=r(573531);!function(e){e.MAC="mac",e.VLAN="vlan",e.AGE="age"}(bs||(bs={}));const Ds={[bs.MAC]:"COMMON_DEVICE",[bs.VLAN]:"COMMON_VLAN",[bs.AGE]:"PORTS_CONNECTED_FOR"};var Ls=r(90757);const xs=({entry:e})=>{const t=e.age>0?(0,Ls.Ay)(e.age,[Ls.Au.DAYS,Ls.Au.HOURS,Ls.Au.MINUTES]).join(" "):null;return a.createElement(R.A,{size:"inherit"},t||a.createElement(f.sA,{id:"COMMON_FALLBACK"}))};var ws=r(239417);const ks=je.AH`
  flex-shrink: 0;
`,ys=({entry:e})=>{const t=(0,I.useSelector)((0,ws.og)(e.mac)),r=Object.keys(t).length>0,n=(0,I.useSelector)((0,er.tG)(e.mac)),l=Object.keys(n).length>0,o=l?a.createElement(Sr.A,{model:n.model,width:20,height:20,className:ks}):r?a.createElement(ts.A,{client:t,width:20,height:20,className:ks}):null,i=l?(0,k.Q)(n):r?(0,z.tn)(t):e.mac;return r||l?a.createElement(tl.A,{description:e.mac},a.createElement(h.A,{gap:p.YC,alignItems:"center",maxWidth:"100%"},a.createElement(h.A,{height:20,minWidth:20,maxWidth:20,justifyContent:"center",alignItems:"center"},o),a.createElement(R.A,{color:"text-2",size:"medium",isTruncated:!0},i))):a.createElement(R.A,{color:"text-2",size:"medium",isTruncated:!0},e.mac)},Gs=({entry:e})=>a.createElement(R.A,{size:"inherit"},e.vlan),Vs=[{id:bs.MAC,label:a.createElement(f.sA,{id:Ds[bs.MAC]}),minWidth:130,renderCell:e=>a.createElement(ys,{entry:e}),compare:(0,br.l0)(({mac:e})=>e||vs.L),sortable:!0},{id:bs.VLAN,label:a.createElement(f.sA,{id:Ds[bs.VLAN]}),minWidth:60,renderCell:e=>a.createElement(Gs,{entry:e}),compare:(0,br.l0)(({vlan:e})=>e||vs.L),sortable:!0},{id:bs.AGE,label:a.createElement(f.sA,{id:Ds[bs.AGE]}),minWidth:100,renderCell:e=>a.createElement(xs,{entry:e}),compare:(0,br.l0)(({age:e})=>e||vs.L),sortable:!0}],Fs=()=>{const e=(0,I.useSelector)(D.Jf),t=(0,I.useSelector)(D.aq),r=(0,I.useSelector)(Rs(t.mac,e.port_idx)),n=(0,a.useMemo)(()=>r?.mac_table?.map((e,t)=>({_id:`${e.mac}-${e.vlan}-${t}`,mac:e.mac,vlan:e.vlan,age:e.age}))||[],[r]),{rowLimit:l,renderFooter:o}=(0,fs.A)(n.length,{defaultCount:10,label:{singular:"COMMON_MAC_ADDRESS",plural:"COMMON_MAC_ADDRESSES"}});return n.length?a.createElement(Uo.A,{type:Uo.I.ACCORDION,items:[{id:"mac-table",label:a.createElement(f.sA,{id:"PORTS_MAC_TABLE"}),openByDefault:!0,renderContent:()=>a.createElement(Ns.A,{columns:Vs,idField:"_id",items:n,disableColumnFilters:!0,disableTextPointer:!0,rowLimit:l,renderFooter:()=>o})}]}):null};var Us=r(121267),Bs=r(540739),Ws=r(275357);const Hs=()=>{const e=(0,I.useSelector)(D.Jf);return void 0!==e?.port_idx&&e?.device?a.createElement(Us.A,{mac:e.device.mac,model:e.device.model,name:e.device.name,logType:Bs.F.PORT,label:"PORTS_ACTIVITY_LOG",portIdx:e.port_idx,cache:!1,ignoreActionableValues:[Ws.dl.DEVICE_WITH_PORT]}):null},$s=()=>a.createElement(h.A,{flexDirection:"column",gap:p.kc},a.createElement(ds,null),a.createElement(Is,null),a.createElement(Fs,null),a.createElement(Hs,null)),zs=()=>{const e=(0,I.useDispatch)(),t=(0,a.useCallback)(()=>{e((0,Q.Ao)([]))},[e]),r=(0,I.useSelector)(w.UH),n=(0,I.useSelector)(D.pZ),l=(0,I.useSelector)(We.WS),o=(0,I.useSelector)(D.QR),i=(0,I.useSelector)(w.Jr),s=(0,I.useSelector)(D.Jf),c=!!r.length&&!o,d=(0,a.useCallback)(t=>{e((0,Q.TZ)(t))},[e]),u=(0,a.useMemo)(()=>1===r.length||r.every(e=>{const{portIdx:t}=(0,J.q9)(e);return s?.aggregationGroup?.type===zn.cx.MCLAG_LINK||s?.aggregationGroup?.type===zn.cx.MCLAG_TARGET||s?.aggregationGroup?.aggregate_members.includes(t)}),[r,s]);(0,a.useEffect)(()=>{c&&e((0,F.K5)())},[e,c]),(0,a.useEffect)(()=>{l&&e((0,Q.Ao)([]))},[e,l]),(0,yi.A)(()=>{r.length<2&&t()},[r]),(0,a.useEffect)(()=>{u||i!==qe.Re.INSIGHTS||e((0,Q.TZ)(qe.Re.SETTINGS))},[e,u,i]);const m=(0,a.useMemo)(()=>i!==qe.Re.SETTINGS||o?a.createElement($s,null):n?a.createElement(qi,null):a.createElement(wi,null),[n,o,i]),E=(0,a.useMemo)(()=>[{value:qe.Re.SETTINGS,icon:a.createElement(gl.A,null),label:""},{value:qe.Re.INSIGHTS,icon:a.createElement(ao.A,null),label:"",disabled:!u}],[u]),_=(0,a.useMemo)(()=>i===qe.Re.SETTINGS?a.createElement(f.sA,{id:"PORTS_PORT_SETTINGS"}):s?.name??a.createElement(f.sA,{id:"PORTS_PORT_STATS"}),[s,i]);return o?null:a.createElement(ro.A,{in:c,onClose:t,header:_,tabs:u?E:void 0,onTabChange:d,tabValue:i},c?m:null)},Ys=(0,n.A)(h.A)`
  flex-direction: column;
  gap: ${p.kc};
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  padding: ${p.Ln} 0 ${p.Ln} ${p.Ln};
`,Ks=()=>(0,c.A)([(0,E.Zi)(m.B.PORTS),(0,E.Zi)(m.B.DEVICES),(0,A.J4)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,u.$3)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,_.hh)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,o.Uc)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,O.Uc)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,g.kE)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,C.Sk)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,S.N)(void 0,{crudCacheStrategy:{type:i.e.CACHE}}),(0,l.G)(void 0,{crudCacheStrategy:{type:i.e.CACHE}})],a.createElement(s.A,{mainPanelProps:{gap:p.Ln}},a.createElement(zs,null),a.createElement(T.A,{leftFilterPageId:M.g1.PORT_MANAGEMENT,content:a.createElement(Yr,null),overflow:"hidden",paddingBottom:p.Ln},a.createElement(Ys,null,a.createElement(to,null)))),{trackingName:d.VO.PORTS})},128736:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(998837),n=r(823858),l=r(296540);const o=e=>{const{motifPalette:t}=(0,a.u)();return l.createElement(n.A,{size:"original",variant:"fill",color:t.warning,...e})}},697490:(e,t,r)=>{r.d(t,{A:()=>s});var a=r(296540),n=r(294303),l=r(703447),o=r(913963),i=r(6176);const s=({connectedClient:e,connectedDevice:t,size:r,wanProviderName:s})=>a.createElement(a.Fragment,null,s?a.createElement(o.A,{name:s,style:{userSelect:"none",display:"block",height:"20px",width:"20px",objectFit:"contain",margin:"0 auto"},useFallback:!0}):null,!s&&t?a.createElement(i.A,{model:t.model,width:r,height:r}):null,s||t||!e?null:a.createElement(n.A,{height:r,minWidth:r,maxWidth:r,justifyContent:"center",alignItems:"center"},a.createElement(l.A,{client:e})))},318787:(e,t,r)=>{r.d(t,{A:()=>u});var a=r(296540),n=r(469733),l=r(64741),o=r(429252),i=r.n(o),s=r(775699),c=r(200826);const d=(e,t)=>e?{id:e,isAscending:t}:void 0,u=e=>{const t=(0,n.useDispatch)(),{sortBy:r,isAscending:o}=(0,c.A)(e),[u,m]=(0,a.useState)(d(r,o)),E=(0,a.useMemo)(()=>(0,l.A)((r,a)=>{i()(r,a)||t((0,s.yT)(e,{sortBy:r?.id,isAscending:r?.isAscending}))},2e3),[t,e]);(0,a.useEffect)(()=>{E(u,d(r,o))},[u,E,r,o]);const _=(0,a.useCallback)((e,t)=>{m(d(e?.id,t))},[]);return(0,a.useMemo)(()=>[u,_],[u,_])}}}]);