"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[60694],{158216:(e,t,r)=>{r.d(t,{K:()=>a});const a=(e,t)=>e?"COMMON_DEVICE_AUTONEG_FULL":t?"COMMON_DEVICE_DUPLEX_FULL":"COMMON_DEVICE_DUPLEX_HALF"},263262:(e,t,r)=>{r.d(t,{A:()=>N,g:()=>P});var a=r(868238),l=r(469733),n=r(296540),o=r(951272),_=r(927099),s=r(870443),i=r(566723),m=r(855019),c=r(62227),d=r(143811),p=r(294303),u=r(845030),E=r(699784),A=r(302167),O=r(366188),b=r(780811),C=r(239417),g=r(785146),I=r(31208),M=r(726317);const P="network",f=(0,o.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({activeItem:{config_network:e,model:t,ip:r,switch_vlan_enabled:a,lte_limit_enabled:l,lte_limit:n,mgmt_network_id:o,connection_network_id:_},nativeNetworks:s})=>{const i=(0,b.U$e)(s,_);return{config_network:{type:e?.type||m.NL.DHCP,ip:e?.ip||r||"",netmask:e?.netmask||i?.netmask||"",gateway:e?.gateway||i?.ip||"",dns1:e?.dns1||i?.dns1||"",dns2:e?.dns2||i?.dns2||"",dnssuffix:e?.dnssuffix||"",bonding_enabled:e?.bonding_enabled||!1},mgmt_network_id:(0,b.ewD)(s,o),switch_vlan_enabled:a||!1,...((0,b.C6C)({model:t}),{})}},handleSubmit:(e,{resetForm:t})=>{t({values:e})},validationSchema:({honeypotNetworksIps:e,clients:t})=>s.A.object().shape({config_network:(0,c.d)(e,t),mgmt_network_id:s.A.string(),lte_limit_enabled:s.A.boolean().label("COMMON_LTE_DATA_LIMIT"),lte_limit:s.A.number().integer().label("COMMON_DATA_LIMIT").when("lte_limit_enabled",{is:!0,then:s.A.number().min(1).required().label("COMMON_DATA_LIMIT")})})}),N=(0,a.Zz)((0,l.connect)(e=>({nativeNetworks:(0,O.Tn)(e),honeypotNetworksIps:(0,A.Yk)(e),clients:(0,C.A8)(e)})),f)(({setFormDirty:e,setFormInvalid:t,dirty:r,values:a,resetForm:o,isValid:s,initialValues:c,activeItem:A,nativeNetworks:O,hideNetworkOverride:C,formName:f=P})=>{const N=(0,l.useDispatch)(),T=(0,b.iQS)(A.model),S=(0,b.C6C)(A);(0,n.useEffect)(()=>{e(P,r),t(P,!s)},[e,t,r,s]);const h=(0,b.moU)(A);(0,n.useEffect)(()=>(N((0,u.uo)({[f]:()=>{const e={config_network:a.config_network?.type===m.NL.STATIC?a.config_network:{type:m.NL.DHCP,bonding_enabled:a.config_network?.bonding_enabled},mgmt_network_id:a.mgmt_network_id};return T&&(e.switch_vlan_enabled=a.switch_vlan_enabled,c.switch_vlan_enabled&&!a.switch_vlan_enabled&&A.port_overrides?.length&&(e.port_overrides=(A.port_overrides||[]).map(({portconf_id:e,...t})=>t))),e}})),N((0,u.Oo)({[f]:()=>o({values:a})})),N((0,u.rW)({[f]:o})),()=>{N((0,u.uo)({[f]:null})),N((0,u.Oo)({[f]:null})),N((0,u.rW)({[f]:null}))}),[N,o,a,f,A.port_overrides,c.switch_vlan_enabled,T,S]);const D=!C&&!h&&O.length>1&&!(0,b.q82)({model:A.model})&&!(0,b.xQi)({model:A.model});return n.createElement(p.A,{flexDirection:"column",gap:i.S2},D?n.createElement(g.A,{nativeNetworks:O,activeItemMac:A.mac}):null,n.createElement(M.A,null),a.config_network?.type===m.NL.STATIC?n.createElement(I.A,null):null,(0,b.xyH)(A)||(0,b.Eyk)(A)||(0,b._iI)(A)||(0,b.W46)(A)?n.createElement(p.A,null,n.createElement(d.A,{name:"config_network.bonding_enabled",type:"realCheckbox"},n.createElement(E.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_AGGREGATION"}))):null,T?n.createElement(p.A,{flexDirection:"column",gap:i.kc},n.createElement(_.A,{weight:"bold",size:"body"},n.createElement(E.sA,{id:"COMMON_VLAN"})),n.createElement(p.A,{justifyContent:"space-between"},n.createElement(_.A,{size:"body"},n.createElement(E.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_VLAN"})),n.createElement(d.A,{type:"checkbox",name:"switch_vlan_enabled"}))):null,null)})},319826:(e,t,r)=>{r.d(t,{$3:()=>M,SD:()=>S,b5:()=>P,nR:()=>T,sD:()=>N,yz:()=>f});var a=r(296540),l=r(566401),n=r(927099),o=r(71479),_=r(316144),s=r(137298),i=r(6510),m=r(266714),c=r(294303),d=r(6176),p=r(703447),u=r(699784),E=r(768941),A=r(962669),O=r(757167),b=r(552020),C=r(780811),g=(r(154828),r(951106));const I=(0,o.A)(n.A)`
  padding-left: 10px;
  color: inherit;
  font-size: inherit;
`,M=({activeItem:e,networkGroups:t,rest:r})=>{const{diagram:n}=(0,C.joB)(e.model),o=[(0,C.D6h)(e),(0,C.bf1)(e),(0,C.Bh_)(e)],{uplinkItems:E,...M}=r||{},P=(0,C.Tl7)(e)||(0,C.kYz)(e)||(0,C.vqp)(e),f=n.length?(0,A.sT)(n,e):(0,A.oJ)(e);return f?f.flat().reduce((r,n)=>{if(!n)return r;const A=(0,C.NF$)(n.portNumber,e);if((0,l.A)(A))return r;const f=a.createElement(c.A,{alignItems:"center"},a.createElement(m.A,{cellData:A,activeItem:e,style:{minWidth:20},...M}),a.createElement(I,{truncate:!0},A.port_idx)),N=a.createElement(c.A,{alignItems:"center"},a.createElement(m.A,{cellData:A,activeItem:e,style:{minWidth:20},disableOnPortClick:P,...M}),a.createElement(I,{truncate:!0},((e,t)=>{if(t.poe_caps&&!(0,C.C6C)(e)){const e=(0,b.Ki)(t);return e?a.createElement(u.sA,{id:e,values:{power:t.poe_power}}):""}return t.up?(0,s.ap)(t?.speed||0)||a.createElement(u.sA,{id:"DEVICE_PORT_STATE_CONNECTED"}):t.enable?a.createElement(u.sA,{id:"COMMON_DISCONNECTED"}):a.createElement(u.sA,{id:"COMMON_DISABLED"})})(e,A))),T=(0,_.nL)(A.ifname,e,t),S="Internal"===T?.label,h=T?.id?.startsWith("LAN")||S,D=E?.find(e=>e.portIdx===A.port_idx)?.connected[0];let x=a.createElement(c.A,null);if(D){const e="device_id"in D?(0,i.Q)(D):(0,g.tn)(D),t="device_id"in D?a.createElement(d.A,{model:D.model,width:18,height:22}):a.createElement(c.A,{height:26,minWidth:22,maxWidth:22,justifyContent:"center",alignItems:"center"},a.createElement(p.A,{client:D}));x=a.createElement(c.A,{alignItems:"center"},a.createElement(c.A,{alignItems:"center",marginRight:"14px"},t),a.createElement(c.A,{alignItems:"center",flex:1},e))}const R={...A,id:A.port_idx?.toString()||A.ifname,defaultNetworkGroupLabel:(0,C.Xq1)(e,A),disabled:A.masked||(0,O.dC)(A.ifname),isInternalPort:S,isLanPort:h,isWanPort:!h,networkGroup:T?.id,portUplinkItemName:x,portStatus:N,portSymbol:f};return o.every(e=>!e)&&(R.macFilters=A.port_security_mac_address?.length),r.push(R),r},[]).sort(({port_idx:e},{port_idx:t})=>e-t):[]},P=e=>e.isWanPort,f=e=>e.isLanPort,N=e=>e.filter(({disabled:e})=>!e).map(({port_idx:e})=>String(e)),T=(e,t)=>e.map(e=>{const r=t.find(t=>e.port_idx===t.portIdx);if(!r)return e;const{rx_broadcast:a,rx_bytes:l,rx_dropped:n,rx_errors:o,rx_multicast:_,rx_packets:s,tx_broadcast:i,tx_bytes:m,tx_dropped:c,tx_errors:d,tx_multicast:p,tx_packets:u}=r;return{...e,rx_broadcast:a,rx_bytes:l,rx_dropped:n,rx_errors:o,rx_multicast:_,rx_packets:s,tx_broadcast:i,tx_bytes:m,tx_dropped:c,tx_errors:d,tx_multicast:p,tx_packets:u}}),S=e=>{const{isPoeOffSupported:t,isPoePassthroughSupported:r,isPoePassive24Supported:a,isPoeAutoSupported:l}=e,n=[];return t&&n.push(E.Gu.OFF),r&&n.push(E.Gu.PASSTHROUGH),!r&&a&&n.push(E.Gu.PASSIVE_24V),!r&&l&&n.push(E.Gu.AUTO),n}},360694:(e,t,r)=>{r.r(t),r.d(t,{default:()=>He});var a=r(868238),l=r(469733),n=r(296540),o=r(947042),_=r(951272),s=r(742920),i=r(870443),m=r(960407),c=r(860631),d=r(398300),p=r(161374),u=r(104436),E=r(845030),A=r(699784),O=r(94752),b=r(854726),C=r(153643),g=r(24006),I=r(962669),M=r(324609),P=r(780811),f=r(171073),N=r(956347),T=r(962315),S=r(376618),h=r(834098),D=r(429252),x=r.n(D),R=r(927099),v=r(758649),y=r(217439),L=r(427853),k=r(392659),w=r(162420),V=r(350312),F=r(71479),B=r(132196),G=r(582724),U=r(15095),H=r(566723),W=r(373229),z=r(143811),$=r(294303),X=r(689965),j=r(126457),K=r(86392),q=r(627440),J=r(319826),Y=r(187483),Q=r(768941),Z=r(920377),ee=r(602021),te=r(578819),re=r(730087),ae=r(906936),le=r(263262),ne=r(393832),oe=r(369596),_e=r(532419),se=r(239417),ie=r(546391);const me=(0,F.A)($.A)`
  width: 100%;
`,ce=(e,t,r)=>Array.from(e,(e,a)=>({id:`port_security_mac_address-${a}`,port_security_mac_address:e,port_security_mac_address_name:(0,ne.K)(t,r,e)})),de=[{id:"port_security_mac_address",label:n.createElement(A.sA,{id:"COMMON_MAC_ADDRESS"}),sortable:!1},{id:"port_security_mac_address_name",label:n.createElement(A.sA,{id:"COMMON_NAME"}),sortable:!1}],pe={port_security_mac_addresses:"DEVICE_PORT_FORM_TOPOLOGY_LABEL"},ue=({formValues:e,setFieldValue:t})=>{const{port_security_mac_address:r}=e,a=(0,l.useSelector)(_e.ID),o=(0,l.useSelector)(se.GB),_=(0,n.useMemo)(()=>({editActive:!1,port_security_mac_address:ce(r,a,o)}),[r,a,o]),s=(0,n.useMemo)(()=>ce(r,a,o),[r,a,o]),m=(0,n.useMemo)(()=>[{name:"new_port_security_mac_address",label:"COMMON_LABEL_MAC_ID",placeholder:"",type:"text"}],[]),c=(0,n.useCallback)(e=>{t("port_security_mac_address",e)},[t]),d=(0,n.useCallback)(({port_security_mac_address:e,new_port_security_mac_address:t})=>{t&&c([...e.map(({port_security_mac_address:e})=>e),t])},[c]),p=(0,n.useCallback)(({port_security_mac_address:t})=>{c(e.port_security_mac_address.filter(e=>e!==t))},[e,c]),u=(0,n.useCallback)(e=>{c([...e.map(({port_security_mac_address:e})=>e)])},[c]);return n.createElement(me,{flexWrap:"wrap"},n.createElement(oe.A,{fieldName:"port_security_mac_address",items:s,columns:de,fieldLabels:pe,newFields:m,onAddItem:d,onRemoveItem:p,onEditSubmit:u,initialValues:_,validationSchema:i.A.lazy(e=>(e=>{const t=()=>i.A.string().label("COMMON_MAC_ADDRESS").matches(ie.b8,{message:n.createElement(A.sA,{id:"COMMON_VALIDATION_VALID_MAC"})}),r={arrayFieldName:"port_security_mac_address",stringFieldName:"port_security_mac_address",errorMessage:n.createElement(A.sA,{id:"DEVICE_PORT_FORM_MAC_MUST_BE_UNIQUE"})};return i.A.object().shape({editActive:i.A.bool(),new_port_security_mac_address:t().isMacUnique({formValues:null,...r}),port_security_mac_address:i.A.array().of(i.A.object().shape({port_security_mac_address:t().isMacUnique({formValues:e,...r}).required()}))})})(e)),addButtonText:"COMMON_ACTION_ADD",fieldVariant:"secondary"}))};var Ee=r(967431),Ae=r(489391),Oe=r(271856),be=r(888170),Ce=r(137273),ge=r(137298),Ie=r(356927),Me=r(158216);const Pe=(0,F.A)($.A,{shouldForwardProp:e=>"marginBottom"!==e})`
  margin-bottom: ${({marginBottom:e})=>e||16}px;
  justify-content: space-between;
  :last-child {
    margin-bottom: 0;
  }
`,fe=(0,F.A)(R.A)`
  font-size: ${({theme:{fontSizes:e}})=>e[2]}px;
  display: flex;
  flex: 1;
  margin-right: 6px;
`,Ne=(0,F.A)("div",{shouldForwardProp:e=>"marginBottom"!==e})`
  margin-bottom: ${({marginBottom:e})=>e||0}px;
`,Te=(0,F.A)("div")`
  > div:not(:last-child) {
    margin-bottom: ${({theme:{spacing:e}})=>e["spacing-xxl"]};
  }
`,Se=(0,F.A)($.A)`
  width: 100%;
`,he=(0,F.A)(z.A)`
  width: unset !important;
  margin-right: ${({theme:{spacing:e}})=>e["spacing-m"]};
  input {
    width: 100%;
  }
`,De=(0,F.A)(z.A)`
  width: 20% !important;
  > div > div {
    width: 100% !important;
  }
`,xe=((0,F.A)("div")`
  flex: 1;
  max-width: calc(50% - 8px);
`,(0,F.A)(R.A)`
  margin-bottom: 5px;
`),Re=(0,F.A)("div")`
  padding-bottom: 10px;
  border-bottom: 1px solid ${be.Ay["white-6"]};

  span {
    margin-left: 5px;
  }
`,ve=(0,F.A)($.A)`
  > * {
    width: 100%;
  }
`,ye=({activeItem:e,portData:t,formValues:r,setFieldValue:a,setFieldTouched:o,initialValues:_})=>{const{formatMessage:s}=(0,A.tz)(),{port_table:i=[]}=e,{stormctrl_enabled:m,op_mode:d,egress_rate_limit_kbps_enabled:p,speed:u}=r,{op_mode:E,port_idx:b,port_poe:I}=t,f=r.poe_mode,N=e.dot1x_portctrl_enabled,T=1===b,S=(0,P.CFJ)(e),h=(0,P.Bh_)(e),D=(0,P.aR8)(e)||(0,P.FeX)(e),x=(0,P.D6h)(e),R=(0,P.iHo)(e),v=(0,P.Lqw)(e),y=(0,P.ocB)(e),L=(0,P.Tbi)(e),k=(0,P.rm3)(e)||((0,P.CFJ)(e)||(0,P.ZBh)(e)||(0,P.PRS)(e))&&(T||N),V=(0,c.Ih)(e.switch_caps?.feature_caps),F=(0,c.Jk)(e.switch_caps?.feature_caps),B=(0,c.Nb)(e.switch_caps?.feature_caps),G=(0,c.kL)(e.switch_caps?.feature_caps),U=(0,te.kO)(t),W=U.isPoePassthroughSupported&&!U.isPoeOffSupported,X="switch"===E&&(I||(0,P.ZBh)(e)||(0,P.PRS)(e))&&k,q=(0,l.useDispatch)(),J=(0,n.useMemo)(()=>{try{return JSON.parse(u)?.speed}catch(e){return null}},[u]),Y=(0,n.useMemo)(()=>(0,M.dd)(t).map(({autoneg:e,speed:t=0,full_duplex:r=!1})=>{const{value:a,unit:l}=(0,Ae.cS)((0,ge.N8)(t),"bitrate"),n=`${(0,Ee.A)(a,1)}${l}`;return{full_duplex:r,label:(0,Me.K)(e,r),value:JSON.stringify({speed:t,full_duplex:r}),values:!e&&{speed:n}}}),[t]),Z=((0,n.useMemo)(()=>{if(e){const t="mirror"===E;let r=e?.switch_caps?.max_mirror_sessions??void 0;if(r||0===r||(r=1),t||e.port_table?.filter(e=>"mirror"===e.op_mode).length<r)return!0}return!1},[e,E]),(0,n.useMemo)(()=>{const{isPoeOffSupported:e,isPoePassthroughSupported:t,isPoePassive24Supported:r,isPoeAutoSupported:a,isPoePlusPlusSupported:l,isPoePlusPlusPlusSupported:n,isPoePlusSupported:o}=U,_=[];if(e&&_.push({label:s({id:"COMMON_DEVICE_POE_MODE_OFF"}),value:Q.Gu.OFF}),t&&_.push({label:s({id:"COMMON_DEVICE_POE_MODE_PASSTHROUGH"}),value:Q.Gu.PASSTHROUGH}),!t&&r&&_.push({label:s({id:"COMMON_DEVICE_POE_MODE_PASSIVE"}),value:Q.Gu.PASSIVE_24V}),!t&&a){let e="";e=s(n?{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS_PLUS"}:l?{id:"COMMON_DEVICE_POE_MODE_POE_PLUS_PLUS"}:o?{id:"COMMON_DEVICE_POE_MODE_AUTO"}:{id:"COMMON_DEVICE_POE_MODE_POE"}),_.push({label:e,value:Q.Gu.AUTO})}return _},[s,U]));return n.createElement(n.Fragment,null,X&&!D&&n.createElement(Ne,{marginBottom:24},W?n.createElement(ve,{alignItems:"center",flexDirection:"column"},n.createElement(xe,{size:"body"},n.createElement(A.sA,{id:"COMMON_DEVICE_POE_MODE_POE"})),n.createElement(Re,null,n.createElement(w.A,{isActive:!0})," ",n.createElement(A.sA,{id:"DEVICE_PORT_FORM_NOTICE_POE_PASSTHROUGH_ONLY"}))):n.createElement(z.A,{label:"COMMON_DEVICE_POE_MODE_POE",name:"poe_mode",type:"dropdown",full:!0,translateLabel:!0,variant:"secondary",options:Z,afterChange:e=>{e!==Q.Gu.PASSIVE_24V&&e!==Q.Gu.PASSTHROUGH||q((0,K.E)({message:"DEVICE_ACTIONS_SWITCH_PORT_POE_MODE_CONFIRM_MESSAGE",messageValues:{ports:n.createElement("strong",null,b),portsCount:1,poe_mode:n.createElement("strong",null,e===Q.Gu.PASSIVE_24V?s({id:"COMMON_DEVICE_POE_MODE_PASSIVE"}):e)},title:"DEVICE_ACTIONS_SWITCH_PORT_POE_MODE_CONFIRM_TITLE",onConfirm:()=>{a("poe_mode",e),q((0,j.AS)())},onCancel:()=>{a("poe_mode",f),q((0,j.AS)())},size:"medium"}))}})),"mirror"===d&&n.createElement(Ne,{marginBottom:24},n.createElement(z.A,{label:"DEVICE_PORT_FORM_MIRRORING_PORT",full:!0,type:"number",name:"mirror_port_idx"})),!h&&t.media?n.createElement($.A,{marginBottom:H.Ln},n.createElement(z.A,{label:"COMMON_LINK_SPEED",name:"speed",type:"dropdown",variant:"secondary",full:!0,translateLabel:!0,translateOptions:!0,options:Y})):null,L&&J===Ie.A.PORTSPEED_FULL_25G.speed&&n.createElement(Ne,{marginBottom:24},n.createElement(Ce.A,{text:s({id:"COMMON_PORT_FORM_LINK_SPEED_SFP28_ALERT"})})),V&&"aggregate"!==d&&!S&&n.createElement(Pe,null,n.createElement($.A,{alignItems:"center"},n.createElement(fe,null,n.createElement(A.sA,{id:"COMMON_DEVICE_CAP_SWITCH_CAP_PORT_ISOLATION"})),n.createElement(Oe.A,{width:200,description:n.createElement(A.sA,{id:"DEVICE_PORT_FORM_PORT_ISOLATION_NOTIFICATION"})},n.createElement(w.A,{isActive:!0,size:"original"}))),n.createElement(z.A,{label:"COMMON_DEVICE_CAP_SWITCH_CAP_PORT_ISOLATION",name:"isolation",type:"checkbox"})),"switch"!==d||h||x||R||v||y||D?null:n.createElement(n.Fragment,null,n.createElement($.A,{marginBottom:H.Ln},n.createElement(z.A,{type:"realCheckbox",name:"stormctrl_enabled",afterChange:e=>{a("stormctrl_enabled",e),e||["stormctrl_ucast_rate","stormctrl_mcast_rate","stormctrl_bcast_rate"].forEach(e=>{a(e,_[e]),o(e,!1)})}},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_STORM_CONTROL_LABEL"}))),m&&n.createElement(Te,null,n.createElement(Ne,{marginBottom:10},n.createElement(z.A,{label:"DEVICE_PORT_FORM_UNKNOWN_UNICAST",placeholder:"COMMON_ENTER_PACKETS_PER_SECOND",full:!0,variant:"secondary",type:"number",min:C.A.MIN,max:C.A.MAX,name:"stormctrl_ucast_rate"})),n.createElement(Ne,{marginBottom:10},n.createElement(z.A,{label:"DEVICE_PORT_FORM_UNKNOWN_MULTICAST",placeholder:"COMMON_ENTER_PACKETS_PER_SECOND",full:!0,type:"number",variant:"secondary",name:"stormctrl_mcast_rate",min:C.A.MIN,max:C.A.MAX})),n.createElement(Ne,{marginBottom:20},n.createElement(z.A,{label:"DEVICE_PORT_FORM_UNKNOWN_BROADCAST",placeholder:"COMMON_ENTER_PACKETS_PER_SECOND",full:!0,type:"number",variant:"secondary",name:"stormctrl_bcast_rate",min:C.A.MIN,max:C.A.MAX})))),F&&"switch"===d&&!S?n.createElement($.A,{marginBottom:H.Ln,justifyContent:"space-between"},n.createElement(fe,null,n.createElement(A.sA,{id:"COMMON_DEVICE_CAP_SWITCH_CAP_LLDP_MED"})),n.createElement(z.A,{label:"COMMON_DEVICE_CAP_SWITCH_CAP_LLDP_MED",name:"lldpmed_enabled",type:"checkbox"})):null,G&&"switch"===d&&!S?n.createElement($.A,{marginBottom:H.Ln,justifyContent:"space-between"},n.createElement($.A,{alignItems:"center"},n.createElement(fe,null,n.createElement(A.sA,{id:"COMMON_DEVICE_CAP_SWITCH_CAP_STP"})),n.createElement(Oe.A,{width:200,description:n.createElement(A.sA,{id:"COMMON_STP_TOOLTIP"})},n.createElement(w.A,{isActive:!0,size:"original"}))),n.createElement(z.A,{name:"stp_port_mode",type:"checkbox"})):null,!B||"switch"!==d||S||D?null:n.createElement(n.Fragment,null,n.createElement($.A,{marginBottom:H.Ln},n.createElement(z.A,{type:"realCheckbox",name:"egress_rate_limit_kbps_enabled",afterChange:e=>{a("egress_rate_limit_kbps_enabled",e),e||(a("egress_rate_limit_kbps",_.egress_rate_limit_kbps),o("egress_rate_limit_kbps",!1))}},n.createElement(A.sA,{id:"COMMON_DEVICE_CAP_SWITCH_CAP_EGRESS_RATE_LIMIT"}))),p?n.createElement($.A,{flexDirection:"row",alignItems:"flex-end",marginBottom:H.Ln},n.createElement(Se,{flexDirection:"column"},n.createElement(he,{full:!0,label:"DEVICE_PORT_FORM_RATE_LIMIT_LABEL",type:"number",variant:"secondary",min:g.A[r.egress_rate_limit_unit]?.MIN,max:g.A[r.egress_rate_limit_unit]?.MAX,name:"egress_rate_limit_kbps"})),n.createElement(De,{type:"dropdown",variant:"secondary",options:O.A.slice(0,2),name:"egress_rate_limit_unit",translateOptions:!0})):null))},Le=(0,F.A)(L.A)`
  > li {
    :last-child {
      border-bottom: none;

      > div {
        margin-bottom: 0;
      }
    }
  }
`,ke=(0,F.A)("li")`
  ${({isGroup:e})=>e?"\n      pointer-events: none;\n      opacity: 0.4;\n    ":"margin-left: 16px;"}
`,we=(0,F.A)(v.A)`
  font-size: ${({theme:e})=>e.fontSizes[2]}px;
  span {
    margin-left: 5px !important;
    svg {
      margin-right: 0 !important;
    }
  }
`,Ve=B.AH`
  padding: 0 !important;
  gap: ${H.kc};
`,Fe=({portConfig:e,activeItem:t,currentPort:r,submitForm:a,resetForm:o,setFieldValue:_,setFieldTouched:s,values:i,values:{name:p,op_mode:u,portconf_id:b},dirty:C,initialValues:g,setValues:D,isInSection:L,goBack:F})=>{const B=(0,N.W6)(),{formatMessage:ne}=(0,A.tz)(),oe=(0,P.Bh_)(t),_e=(0,P.aR8)(t)||(0,P.FeX)(t),se=(0,P.qr2)(t),ie=(0,P.iQS)(t.model),me=(0,c.On)(t.switch_caps?.feature_caps),ce=(0,I.bs)(t,r),de=(0,M.Ic)(t,r),pe=(0,te.kO)(r),Ee=(0,J.SD)(pe),Ae=(0,l.useDispatch)(),Oe=(0,l.useSelector)(ee.LF),be=(0,l.useSelector)(m.oI),Ce=(0,l.useSelector)(Y.Xt),ge=(0,l.useSelector)(ee.EL),Ie=(0,N.tW)(Ce,{site:Oe}),Me="switch"===u&&me&&!oe&&!(0,P.D6h)(t),Pe=(0,U.A)(`${q.VO.DEVICES}/properties/:mac/settings`),fe=oe?Pe.replace(":mac",t.mac):"../services",[Ne,Te]=(0,n.useState)(""),[Se,he]=(0,n.useState)(!1),[De,xe]=(0,n.useState)(!1),Re=(0,n.useMemo)(()=>{const t=e.map(e=>({...e,groupLabel:(0,I._y)(e)})),r=(0,S.A)(t,"groupLabel");return Object.entries(r).reduce((e,[t,r])=>{const a=r.filter(e=>ie?e.attr_hidden_id!==re.z.ALL_ID:!se||"COMMON_CUSTOM"!==e.groupLabel).map(({name:e,_id:t})=>({label:e,value:t}));return"undefined"===t||se&&"COMMON_CUSTOM"===t?(e.push(...a),e):(e.push({groupLabel:ne({id:t}),items:a}),e)},[])},[ne,e,ie,se]),ve=(0,n.useMemo)(()=>(0,h.A)(Re.map(({groupLabel:e,items:t})=>[{isGroup:!0,label:e,value:e},...t])),[Re]),Fe=(Be=t,(0,P.TT5)(Be)?"COMMON_ACCESS_POINT":(0,P.D6h)(Be)?"COMMON_GATEWAY":"DEVICE_TYPE_SWITCH");var Be;const Ge=(0,n.useCallback)((t,a)=>{const l=Ee.includes(Q.Gu.AUTO)?Q.Gu.AUTO:Q.Gu.OFF,s=e?.find(e=>e._id===t),m=r?.portconf_id===s?._id,{speed:c=0,full_duplex:d=0}=s,u={lldpmed_enabled:!0,stormctrl_enabled:!1,flow_control_enabled:!1,poe_mode:l,stormctrl_bcast_enabled:!1,stormctrl_bcast_rate:"",stormctrl_mcast_enabled:!1,stormctrl_mcast_rate:"",stormctrl_ucast_enabled:!1,stormctrl_ucast_rate:"",isolation:!1,op_mode:"switch",port_security_mac_address:[],egress_rate_limit_kbps:"",egress_rate_limit_unit:O.A[0].value,egress_rate_limit_kbps_enabled:!1,stp_port_mode:!0,full_duplex:!1},E={...u,...e?.find(e=>e._id===r?.portconf_id)},A=E?.speed&&E?.full_duplex?{speed:c,full_duplex:d}:{speed:0,full_duplex:!1},b=["name","speed"],C=[Object.keys(i),Object.keys(E)].reduce((e,t)=>e.filter(e=>t.includes(e))).filter(e=>!b.includes(e)),g=!x()((0,T.A)(E,C),(0,T.A)(i,C))||!x()(A,JSON.parse(i.speed));xe(g),m?(o(),_("name",p)):D({...i,speed:s?.speed&&s?.full_duplex?JSON.stringify({speed:c,full_duplex:d}):JSON.stringify({speed:0,full_duplex:!1}),lldpmed_enabled:!1!==s?.lldpmed_enabled,stormctrl_enabled:s?.stormctrl_bcast_enabled||s?.stormctrl_mcast_enabled||s?.stormctrl_ucast_enabled,flow_control_enabled:s?.flow_control_enabled,stormctrl_bcast_enabled:s?.stormctrl_bcast_enabled,stormctrl_bcast_rate:s?.stormctrl_bcast_rate,stormctrl_mcast_enabled:s?.stormctrl_mcast_enabled,stormctrl_mcast_rate:s?.stormctrl_mcast_rate,stormctrl_ucast_enabled:s?.stormctrl_ucast_enabled,stormctrl_ucast_rate:s?.stormctrl_ucast_rate,isolation:s?.isolation,full_duplex:s?.full_duplex,op_mode:s?.op_mode,egress_rate_limit_kbps:s?.egress_rate_limit_kbps,egress_rate_limit_unit:O.A[0].value,egress_rate_limit_kbps_enabled:s?.egress_rate_limit_kbps_enabled,stp_port_mode:s?.stp_port_mode});const I=s?.poe_mode||l;Te(I);const M=Ee.includes(I);he(M),M?I===Q.Gu.PASSIVE_24V||I===Q.Gu.PASSTHROUGH?Ae((0,K.E)({message:"DEVICE_ACTIONS_SWITCH_PORT_POE_MODE_CONFIRM_MESSAGE",messageValues:{ports:n.createElement("strong",null,r?.port_idx),portsCount:1,poe_mode:n.createElement("strong",null,I===Q.Gu.PASSIVE_24V?ne({id:"COMMON_DEVICE_POE_MODE_PASSIVE"}):I)},title:"DEVICE_ACTIONS_SWITCH_PORT_POE_MODE_CONFIRM_TITLE",onConfirm:()=>{_("poe_mode",I),Ae((0,j.AS)()),a()},onCancel:()=>{_("poe_mode",r?.poe_mode),Ae((0,j.AS)())},size:"medium"})):(_("poe_mode",I),a()):a()},[i,r?.poe_mode,e,ne]),Ue=(0,n.useMemo)(()=>n.createElement(z.A,{label:ce?"COMMON_ETHERNET_PORT_PROFILE":"DEVICE_PORT_FORM_PORT_NETWORKS_VLAN_LABEL",name:"portconf_id",type:"dropdown",variant:"secondary",full:!0,translateLabel:!0,options:ve,renderOption:({id:e,onClick:t,className:r,isSelected:a,option:{isGroup:l=!1,label:o,value:_}})=>n.createElement(ke,{key:`${e}-${o}`,id:e,onClick:e=>{Ge(_,()=>t(e))},className:r,"aria-selected":a,role:"option",isGroup:l},o),disabled:de}),[Ge,ce,de,ve]),He=(0,n.useCallback)(()=>{o(),L?F():Ae((0,E.XP)({type:d.H.DEVICE,id:t.mac,tab:be}))},[Ae,o,t.mac,be,L,F]),We=(0,n.useCallback)(()=>{Ae((0,K.E)({message:"DEVICE_ACTIONS_SWITCH_PORT_POWER_CONFIRM_MESSAGE",messageValues:{portName:n.createElement("strong",null,r.portName),deviceName:t.name},title:"DEVICE_ACTIONS_SWITCH_PORT_POWER_CONFIRM_TITLE",onConfirm:()=>{Ae((0,f.Fx)({mac:t.mac,name:t.name},r.port_idx)),Ae((0,j.AS)())}}))},[t.mac,t.name,r.portName,r.port_idx,Ae]);return(0,G.A)([(0,Z.kE)()],n.createElement(X.A,{padding:L?"0":void 0,marginBottom:L?"0":void 0},n.createElement($.A,{alignItems:"center",marginBottom:H.Ln,gap:H.kc},n.createElement(V.A,{onClick:He,style:{cursor:"pointer"}}),n.createElement(y.A,{weight:"bold",color:"text-1"},n.createElement(A.sA,{id:"DEVICE_PROPERTIES_PORT_WITH_NUMBER",values:{port:(0,I.LS)(r,t.model)}}))),n.createElement($.A,{marginBottom:H.Ln},n.createElement(z.A,{label:"COMMON_NAME",variant:"secondary",full:!0,name:"name",placeholder:"COMMON_PORT"})),!_e&&n.createElement(n.Fragment,null,n.createElement($.A,{marginBottom:H.Ln},Ue),n.createElement($.A,{marginBottom:H.Ln},n.createElement(v.A,{type:"button",variant:"inline",onClick:()=>{B.push(`${Ie}/settings/profiles`)}},n.createElement(y.A,{color:"inherit"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_MANAGE_PORT_PROFILES"})))),r.portconf_id&&b!==r.portconf_id&&De?n.createElement($.A,{marginBottom:H.Ln},n.createElement(ae.A,{level:"warning"},n.createElement(R.A,{size:"caption"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_NOTICE_OVERRIDE_RESET"})))):null,r.portconf_id&&b!==r.portconf_id&&!Se&&r.port_poe&&De?n.createElement($.A,{marginBottom:H.Ln},n.createElement(ae.A,{level:"warning"},n.createElement(R.A,{size:"caption"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_NOTICE_OVERRIDE_POE_MODE",values:{profile_poe_mode:n.createElement("strong",null,Ne===Q.Gu.PASSIVE_24V?ne({id:"COMMON_DEVICE_POE_MODE_PASSIVE"}):Ne===Q.Gu.AUTO?ne({id:"COMMON_DEVICE_POE_MODE_AUTO"}):Ne)}})))):null,de?n.createElement($.A,{flexDirection:"column",marginBottom:H.Ln},n.createElement($.A,{marginBottom:H.kc},n.createElement(w.A,{isActive:!0,style:{marginRight:H.kc}}),n.createElement(R.A,{size:"caption"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_NOTICE_PORT_CONF_DISABLED"}))),n.createElement($.A,{alignSelf:"flex-end"},n.createElement(v.A,{name:"configureLink",type:"button",variant:"link",size:"small",onClick:()=>B.push(fe,{accordion:le.g})},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_BUTTON_PORT_CONF_CONFIGURE"})))):null,r.poe_enable?n.createElement(n.Fragment,null,n.createElement($.A,{flexDirection:"column",marginBottom:H.Ln},n.createElement(R.A,{color:"primary",size:"body",weight:"bold"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_PORT_MANUAL_POWER_CYCLE"})),n.createElement(R.A,{size:"body",color:"secondary"},n.createElement(A.sA,{id:"DEVICE_PORT_FORM_PORT_MANUAL_POWER_CYCLE_DESCRIPTION",values:{deviceType:n.createElement(A.sA,{id:Fe})}}))),n.createElement($.A,{alignSelf:"flex-end",marginBottom:H.Ln},n.createElement(we,{type:"button",size:"small",variant:"inline",onClick:()=>{We()},Icon:n.createElement(k.A,null),disabled:ge},n.createElement(A.sA,{id:"DEVICE_ACTIONS_POWER_CYCLE"})))):null,n.createElement(Le,{variant:"secondary",multiOpen:!0,items:[...Me?[{id:"macFilter",openByDefault:!0,label:n.createElement(A.sA,{id:"DEVICE_PORT_FORM_MAC_FILTER_LABEL"}),renderContent:()=>n.createElement(ue,{setFieldValue:_,formValues:i})}]:[]]})),ce?n.createElement(n.Fragment,null,n.createElement($.A,{marginBottom:H.Ln},n.createElement(y.A,{color:"text-1"},n.createElement(A.sA,{id:"DEVICE_PORT_PROFILE_OVERRIDE"}))),n.createElement(ye,{initialValues:g,setFieldValue:_,setFieldTouched:s,portData:r,activeItem:t,formValues:i})):null,n.createElement($.A,{justifyContent:"flex-end"},n.createElement(W.A,{isDirty:C,onFormSubmit:a,onFormCancel:He,allowCancel:!0,className:Ve}))))},Be=()=>{const e=n.createElement(A.sA,{id:"COMMON_VALIDATION_HINT_RANGE",values:{min:C.A.MIN,max:C.A.MAX}});return i.A.number().when("stormctrl_enabled",{is:!0,then:i.A.number().label(e).min(C.A.MIN,e).max(C.A.MAX,e).integer(e)})},Ge=(0,_.bk)({enableReinitialize:!0,mapPropsToValues:({currentPort:e,currentPortOverride:t})=>{const{port_idx:r,poe_mode:a,portconf_id:l,stormctrl_bcast_enabled:n=!1,stormctrl_bcast_rate:o="",stormctrl_mcast_enabled:_=!1,stormctrl_mcast_rate:s="",stormctrl_ucast_enabled:i=!1,stormctrl_ucast_rate:m="",isolation:c=!1,lldpmed_enabled:d,full_duplex:u,op_mode:E,mirror_port_idx:A,port_security_mac_address:b=[],egress_rate_limit_kbps_enabled:C=!1,egress_rate_limit_kbps:g="",stp_port_mode:I=!0,nameOverride:M="",flow_control_enabled:P=!1}=e;return{name:M,speed:JSON.stringify((0,p.qL)(t)),lldpmed_enabled:!1!==d,stormctrl_enabled:n||_||i,port_idx:r,poe_mode:a,portconf_id:l,stormctrl_bcast_enabled:n,stormctrl_bcast_rate:o,stormctrl_mcast_enabled:_,stormctrl_mcast_rate:s,stormctrl_ucast_enabled:i,stormctrl_ucast_rate:m,isolation:c,full_duplex:u,mirror_port_idx:A,op_mode:E,port_security_mac_address:b,egress_rate_limit_kbps:g,egress_rate_limit_unit:O.A[0].value,egress_rate_limit_kbps_enabled:C,stp_port_mode:I,flow_control_enabled:P}},validationSchema:({activeItem:e})=>{const t=(0,I.o2)(e.model),r=Math.min(t.standard[0]||1,t.sfp[0]||1,t.plus[0]||1),a=Math.max(t.standard[t.standard.length-1]||1,t.sfp[t.sfp.length-1]||1,t.plus[t.plus.length-1]||1),l=n.createElement(A.sA,{id:"COMMON_VALIDATION_HINT_RANGE",values:{min:r,max:a}}),o=(e=!1)=>n.createElement(A.sA,{id:"COMMON_VALIDATION_HINT_RANGE",values:{min:g.A[O.A[e?1:0].value].MIN,max:g.A[O.A[e?1:0].value].MAX}});return i.A.object().shape({port_idx:i.A.number(),name:i.A.string().label("COMMON_NAME").max(128),poe_mode:i.A.string(),portconf_id:i.A.string(),stormControlEnabled:u.tn,stormctrl_bcast_enabled:i.A.boolean(),stormctrl_bcast_rate:Be(),stormctrl_mcast_enabled:i.A.boolean(),stormctrl_mcast_rate:Be(),stormctrl_ucast_enabled:i.A.boolean(),stormctrl_ucast_rate:Be(),isolation:i.A.boolean(),full_duplex:i.A.boolean(),lldpmed_enabled:i.A.boolean(),op_mode:i.A.string(),mirror_port_idx:i.A.number().when("op_mode",{is:"mirror",then:i.A.number().required(l).min(r,l).max(a,l)}),port_security_mac_address:i.A.array().of(i.A.string()),egress_rate_limit_kbps_enabled:i.A.boolean(),stp_port_mode:i.A.boolean(),egress_rate_limit_kbps:i.A.number().when(["egress_rate_limit_unit","egress_rate_limit_kbps_enabled"],{is:(e,t)=>e===O.A[0].value&&t,then:i.A.number().required(o()).min(g.A.k.MIN,o()).max(g.A.k.MAX,o()).integer()}).when(["egress_rate_limit_unit","egress_rate_limit_kbps_enabled"],{is:(e,t)=>e===O.A[1].value&&t,then:i.A.number().required(o(!0)).min(g.A.M.MIN,o(!0)).max(g.A.M.MAX,o(!0))})})},handleSubmit:(e,{props:{updateDeviceWithIdEndpoint:t,activeItem:{_id:r,port_overrides:a,mac:l},activeItem:n,currentPort:_,intl:{formatMessage:i},propertyPanelActiveItemTab:m,showPropertyPanel:p}})=>{const u=i({id:"DEVICE_PROPERTY_HEADER_PORTS"}),E=(0,M.Ic)(n,_),{stormctrl_enabled:A,stormctrl_bcast_rate:b,stormctrl_mcast_rate:C,stormctrl_ucast_rate:g,egress_rate_limit_kbps:I,egress_rate_limit_kbps_enabled:f,op_mode:N,mirror_port_idx:T,stp_port_mode:S}=e,{speed:h,full_duplex:D}=JSON.parse(e.speed);let x=null;f&&(x=e.egress_rate_limit_unit===O.A[1].value?1e3*I:I),delete e.egress_rate_limit_unit;const R={...e,speed:h,full_duplex:D,stp_port_mode:S,autoneg:!h,stormctrl_bcast_enabled:!!A&&!!b,stormctrl_bcast_rate:A?b:null,stormctrl_mcast_enabled:!!A&&!!C,stormctrl_mcast_rate:A?C:null,stormctrl_ucast_enabled:!!A&&!!g,stormctrl_ucast_rate:A?g:null,egress_rate_limit_kbps:x,mirror_port_idx:"mirror"===N?T.toString():null},v=(0,o.A)(R,(e,t)=>"portconf_id"===t?E:"stormctrl_enabled"===t||("op_mode"===t&&"switch"===e||("lldpmed_enabled"===t?e:("full_duplex"!==t||!R.speed)&&("autoneg"!==t&&("poe_mode"===t&&"mirror"===R.op_mode||("stp_port_mode"===t?!("switch"===R.op_mode&&(0,c.kL)(n.switch_caps?.feature_caps)&&!(0,P.CFJ)(n)):!e))))));v.port_security_enabled=!!v.port_security_mac_address?.length;let y=[v];a&&(y=[v,...a.filter(e=>e.port_idx!==v.port_idx)]),t({port_overrides:y},r,l,{failureToast:{icon:s.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR",values:{section:u}},mergeAndOverrideKeys:["port_overrides"],extend:!0}).then(()=>p({type:d.H.DEVICE,id:n.mac,tab:m}))}}),Ue={updateDeviceWithIdEndpoint:f.ex,showPropertyPanel:E.XP},He=(0,a.Zz)((0,l.connect)((e,{activeItem:t,isInSection:r,subId:a})=>((r,a)=>({portConfig:(0,b.wD)(e),currentPort:(0,P.NF$)(r?+r:+a,t),currentPortOverride:(0,P.XKY)(r?+r:+a,t),propertyPanelActiveItemTab:(0,m.oI)(e)}))(r?a:(0,m.Oh)(e),(0,m.n6)(e)),Ue),A.j4,Ge)(Fe)},726317:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(296540),l=r(927099),n=r(454195),o=r(566723),_=r(855019),s=r(143811),i=r(294303),m=r(699784);const c=(0,a.memo)(()=>a.createElement(i.A,{flexDirection:"column"},a.createElement(l.A,{color:"tertiary",size:"caption"},a.createElement(m.sA,{id:"COMMON_IP_CONFIGURATION"})),a.createElement(i.A,{height:n.b,alignItems:"center",gap:o.Ln},a.createElement(s.A,{name:"config_network.type",type:"radio",value:_.NL.DHCP},a.createElement(m.sA,{id:"COMMON_DHCP"})),a.createElement(s.A,{name:"config_network.type",type:"radio",value:_.NL.STATIC},a.createElement(m.sA,{id:"COMMON_STATIC"})))))},906936:(e,t,r)=>{r.d(t,{A:()=>E});var a=r(296540),l=r(819663),n=r(162420),o=r(823858),_=r(793336),s=r(71479),i=r(998837),m=r(566723),c=r(294303);const d=(0,s.A)(c.A,{shouldForwardProp:e=>!["borderColor","backgroundColor","dividerColor"].includes(e)})`
  background-color: ${({backgroundColor:e})=>e};
  border-left: 2px solid ${({borderColor:e})=>e};
  padding: ${m.Ln} ${m.Ln} ${m.Ln} 0;

  & + & {
    border-top: 1px solid ${({dividerColor:e})=>e};
  }
`,p=(0,s.A)(c.A)`
  min-width: 36px;
  max-width: 36px;
`,u=(e,{warning:t,neutral01:r,danger:s,info:i})=>{switch(e){case"warning":return{icon:a.createElement(o.A,{size:"medium",color:t,variant:"fill"}),backgroundColor:r,borderColor:t,dividerColor:(0,l.A)(t).alpha(.2).css()};case"danger":return{icon:a.createElement(_.A,{size:"medium",color:s,variant:"fill"}),backgroundColor:r,borderColor:s,dividerColor:(0,l.A)(s).alpha(.2).css()};default:return{icon:a.createElement(n.A,{isActive:!0,size:"original"}),backgroundColor:r,borderColor:i,dividerColor:(0,l.A)(i).alpha(.2).css()}}},E=({level:e,children:t,overrideLevel:r})=>{const{motifPalette:l}=(0,i.u)(),{icon:n,backgroundColor:o,borderColor:_,dividerColor:s}={...u(e,l),...r};return a.createElement(d,{flexDirection:"row",width:"100%",backgroundColor:o,borderColor:_,dividerColor:s},a.createElement(p,{justifyContent:"center"},n),a.createElement(c.A,{flexDirection:"column",justifyContent:"center"},t))}}}]);