"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[30497],{45062:(e,t,l)=>{l.d(t,{A:()=>te,q:()=>j});var n=l(868238),o=l(469733),a=l(296540),r=l(951272),i=l(271856),s=l(927099),c=l(758649),d=l(720561),_=l(162420),m=l(71479),E=l(6510),A=l(592510),p=l(870443),u=l(790543),b=l(860631),O=l(398300),f=l(566723),v=l(543791),w=l(854246),g=l(143811),C=l(294303),I=l(845030),h=l(126457),P=l(86392),R=l(699784),S=l(823881),T=l(302167),N=l(457311),k=l(609695),y=l(140614),D=l(366188),L=l(780811),M=l(927806),x=l(768195),U=l(532419),V=l(485897),F=l(132650),B=l(171073),z=l(959341),W=l(398146);const j="services",G=(0,m.A)(s.A)`
  align-items: center;
  justify-content: center;
  margin-bottom: ${f.Ln};
`,$=(0,m.A)(s.A)`
  flex: 1;
  margin-right: ${f.xO};
`,H=(0,m.A)("div")`
  margin-bottom: ${({marginBottom:e})=>e||0}px;
  margin-top: ${({marginTop:e})=>e||0}px;
`,K=(0,m.A)(C.A)`
  margin-bottom: ${e=>e.marginBottom||0}px;
  justify-content: space-between;
`,X=(0,m.A)(_.A)`
  margin-bottom: 2px;
`,Q=(0,m.A)(i.A,{shouldForwardProp:e=>"disabled"!==e})`
  ${({disabled:e})=>e&&"opacity: 0.4; pointer-events: none;"}
`,Y=(0,m.A)("div")`
  margin-right: 6px;
`,q=(0,m.A)("div")`
  > div {
    margin-top: ${f.YC};
    > span {
      line-height: 20px;
    }
  }
`,J=(0,r.bk)({enableReinitialize:!0,mapPropsToValues:({switchDeviceData:{jumboframe_enabled:e=!1,flowctrl_enabled:t=!1,stp_version:l=S.uI.RSTP,stp_priority:n="32768",dot1x_portctrl_enabled:o=!1,radiusprofile_id:a,dot1x_fallback_networkconf_id:r="",snmp_location:i="",snmp_contact:s="",lowpfmode_override:c,lowpfmode:d,outdoor_mode_override:_=x.Gi.DEFAULT,power_source_ctrl:m=F.A.AUTO,power_source_ctrl_enabled:E=!1},defaultRadiusProfile:A})=>({jumboframe_enabled:e,flowctrl_enabled:t,stp_version:l,stp_priority:n,dot1x_portctrl_enabled:o,radiusprofile_id:a||A?._id||"",dot1x_fallback_networkconf_id:r,snmp_location:i,snmp_contact:s,snmpEnabled:Boolean(i||s),outdoor_mode_override:_,lowpfmode_override:c||d,power_source_ctrl:m,power_source_ctrl_enabled:E}),validationSchema:({defaultRadiusProfile:e})=>p.A.object().shape({flowctrl_enabled:p.A.boolean(),stp_version:p.A.string(),stp_priority:p.A.string(),dot1x_portctrl_enabled:p.A.boolean(),lowpfmode_override:p.A.boolean(),...W.U,radiusprofile_id:p.A.string().when("dot1x_portctrl_enabled",{is:!0,then:p.A.string().test({name:"isDefaultRadiusProfileEnabled",test:t=>t!==e._id||e.enabled,message:a.createElement(R.sA,{id:"COMMON_VALIDATION_VALID_DEFAULT_RADIUS_PROFILE"})})}),radiusProfiles:p.A.array().of(p.A.object()),radiusSettings:p.A.object(),dot1x_fallback_networkconf_id:p.A.string(),outdoor_mode_override:p.A.string(),power_source_ctrl:p.A.string(),power_source_ctrl_enabled:p.A.boolean()}),handleSubmit:()=>null}),Z=[{label:"DEVICE_PROPERTIES_VALUES_SPANNING_TREE_STP",value:"stp"},{label:"DEVICE_PROPERTIES_VALUES_SPANNING_TREE_RSTP",value:"rstp"},{label:"COMMON_DISABLED",value:"disabled"}],ee=V.A.map(e=>({label:e,value:e})),te=(0,n.Zz)((0,o.connect)((e,{activeItem:t})=>({nativeNetworks:(0,D.Tn)(e),switchDeviceData:(0,U.tG)(t.mac)(e),radiusOptions:(0,k.selectAllRadiusOptions)(e),radiusProfiles:(0,k.selectAllRadiusProfiles)(e),radiusSettings:(0,T.QC)(e),globalSwitchSettings:(0,T.zu)(e)}),{updateDevice:B.c8,fetchRadiusProfiles:y.fetchRadiusProfiles,fetchSettings:N.Uc}),J,(0,u.A)(({fetchRadiusProfiles:e,fetchSettings:t})=>Promise.all([e(void 0,{crudCacheStrategy:{type:A.e.CACHE}}),t(void 0,{crudCacheStrategy:{type:A.e.CACHE}})])))(({activeItem:e,values:t,errors:l,resetForm:n,dirty:r,setFormDirty:m,setFormInvalid:A,setFieldValue:p,nativeNetworks:u=[],isValid:T,hideFlowControl:N,formName:y=j,globalSwitchSettings:D,isGlobalSwitchSettingsEnabled:V})=>{const{formatMessage:B}=(0,R.tz)(),J=(0,o.useDispatch)(),te=((0,L.Tbi)(e)||(0,L.moU)(e)&&(0,L.rm3)(e))&&V,le=(0,b.kL)(e.switch_caps?.feature_caps),ne=(0,b.R8)(e.switch_caps?.feature_caps),oe=(0,L.KKO)(e.model,"outdoorModeSupport"),ae=(0,L.moU)(e),re=(0,o.useSelector)(U.ID),ie=(0,b.CB)(e),se=(0,M.$Y)({device:e,devices:re}),ce=e.lowpfmode,de=(0,b.gU)(e,se),_e=(0,L.J2F)(e),me=(0,o.useSelector)(k.selectAllRadiusOptions),Ee=(0,a.useCallback)(()=>{J((0,I.XP)({type:O.H.NETWORK,id:z.R6}))},[J]);(0,a.useEffect)(()=>{m(y,r),A(y,!T)},[A,m,r,T,y]),(0,a.useEffect)(()=>(J((0,I.uo)({[y]:()=>({snmp_contact:t.snmpEnabled?t.snmp_contact:"",snmp_location:t.snmpEnabled?t.snmp_location:"",...te?{}:{...!N&&{jumboframe_enabled:t.jumboframe_enabled,flowctrl_enabled:t.flowctrl_enabled},...le&&{stp_version:t.stp_version,stp_priority:t.stp_priority},...ne&&{dot1x_portctrl_enabled:t.dot1x_portctrl_enabled},...t.dot1x_portctrl_enabled&&ne&&{radiusprofile_id:t.radiusprofile_id,dot1x_fallback_networkconf_id:t.dot1x_fallback_networkconf_id}},...oe&&{outdoor_mode_override:t.outdoor_mode_override},...ce&&{lowpfmode_override:t.lowpfmode_override},...ie&&{power_source_ctrl:t.power_source_ctrl,power_source_ctrl_enabled:t.power_source_ctrl!==F.A.AUTO}})})),J((0,I.Oo)({[y]:()=>n({values:t})})),J((0,I.rW)({[y]:n})),()=>{J((0,I.uo)({[y]:null})),J((0,I.Oo)({[y]:null})),J((0,I.rW)({[y]:null}))}),[e._id,J,n,t,y,ne,le,ae,N,oe,ie,te,ce]);const Ae=(0,a.useMemo)(()=>u.map(e=>({value:e._id,label:e.name})),[u]);return a.createElement(C.A,{width:"100%",flexDirection:"column",flex:"1 1 85%"},a.createElement(v.A,{show:te},a.createElement(C.A,{flexDirection:"column"},N?null:a.createElement(a.Fragment,null,a.createElement(K,{marginBottom:16},a.createElement($,{size:"body",color:te?"disabled":void 0},a.createElement(R.sA,{id:"COMMON_JUMBO_FRAMES"})),a.createElement(g.A,{name:"jumboframe_enabled",type:"checkbox",checked:te?D.jumboframe_enabled:t.jumboframe_enabled,disabled:te})),a.createElement(K,{marginBottom:16},a.createElement($,{size:"body",color:te?"disabled":void 0},a.createElement(R.sA,{id:"COMMON_FLOW_CONTROL"})),a.createElement(g.A,{name:"flowctrl_enabled",type:"checkbox",checked:te?D.flowctrl_enabled:t.flowctrl_enabled,disabled:te}))),le?a.createElement(a.Fragment,null,a.createElement(H,{marginBottom:16},a.createElement(g.A,{label:"COMMON_DEVICE_CAP_SWITCH_CAP_STP",name:"stp_version",full:!0,type:"dropdown",variant:"secondary",translateOptions:!0,translateLabel:!0,options:Z,value:te?D.stp_version:t.stp_version,disabled:te})),t.stp_version!==S.uI.DISABLED?a.createElement(H,{marginBottom:16},a.createElement(g.A,{label:"COMMON_PRIORITY",name:"stp_priority",type:"dropdown",variant:"secondary",full:!0,validated:!0,options:ee,translateLabel:!0,value:t.stp_priority,disabled:te})):null):null,ne?a.createElement(a.Fragment,null,a.createElement(K,{marginBottom:16},a.createElement($,{size:"body",color:te?"disabled":void 0},a.createElement(C.A,{alignItems:"center"},a.createElement(Y,null,a.createElement(R.sA,{id:"COMMON_DEVICE_CAP_SWITCH_CAP_DOT1X"})),a.createElement(Q,{width:200,description:a.createElement(R.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_8021X_CONTROL_D"}),disabled:te},a.createElement(X,{size:"original",isActive:!0,disabled:te})))),a.createElement(g.A,{label:"COMMON_DEVICE_CAP_SWITCH_CAP_DOT1X",name:"dot1x_portctrl_enabled",type:"checkbox",checked:te?D.dot1x_portctrl_enabled:t.dot1x_portctrl_enabled,disabled:te})),t.dot1x_portctrl_enabled?a.createElement(a.Fragment,null,a.createElement(H,{marginBottom:8},a.createElement(g.A,{label:"COMMON_RADIUS_PROFILE",name:"radiusprofile_id",type:"dropdown",variant:"secondary",full:!0,options:me,invalid:!!l.radiusprofile_id,translateLabel:!0,value:te?D.radiusprofile_id:t.radiusprofile_id,disabled:te}),l.radiusprofile_id?a.createElement(q,null,a.createElement(w.A,{align:"left",visible:!0},l.radiusprofile_id)):null),a.createElement(K,{marginBottom:16},a.createElement(c.A,{size:"small",type:"button",variant:"inline",onClick:()=>{J((0,I.XP)({type:O.H.CUSTOM_RADIUS_PROFILE,id:z.R6}))},Icon:d.A,iconProps:{isActive:!0}},a.createElement(s.A,{color:"inherit",size:"body"},a.createElement(R.sA,{id:"COMMON_CREATE_NEW_RADIUS_PROFILE"})))),a.createElement(H,{marginBottom:8},a.createElement(g.A,{label:"DEVICE_PROPERTIES_LABEL_FALLBACK_VLAN",name:"dot1x_fallback_networkconf_id",type:"dropdown",variant:"secondary",full:!0,validated:!0,options:[{label:B({id:"COMMON_NONE"}),value:""},...Ae],translateLabel:!0,value:te?D.dot1x_fallback_networkconf_id:t.dot1x_fallback_networkconf_id,disabled:te})),a.createElement(K,{marginBottom:16},a.createElement(c.A,{size:"small",type:"button",variant:"inline",onClick:Ee,Icon:d.A,iconProps:{isActive:!0}},a.createElement(s.A,{color:"inherit",size:"body"},a.createElement(R.sA,{id:"COMMON_CREATE_NEW_NETWORK"}))))):null):null)),(0,b.A6)(e)?a.createElement(W.A,null):null,ie?a.createElement(a.Fragment,null,a.createElement(G,{weight:"bold"},a.createElement(R.sA,{id:"DEVICE_PROPERTIES_LABEL_POWER_SOURCE"})),a.createElement(H,{marginBottom:oe?24:0},a.createElement(C.A,{gap:f.Ln},a.createElement(g.A,{type:"radio",name:"power_source_ctrl",value:F.A.AUTO},a.createElement(s.A,null,a.createElement(R.sA,{id:"DEVICE_PROPERTIES_VALUES_POWER_SOURCE_AUTO"}))),a.createElement(g.A,{type:"radio",name:"power_source_ctrl",value:F.A.POE},a.createElement(s.A,null,a.createElement(R.sA,{id:"DEVICE_PROPERTIES_VALUES_POWER_SOURCE_POE_8023AF"}))),a.createElement(g.A,{type:"radio",name:"power_source_ctrl",value:F.A.POE_PLUS_PLUS},a.createElement(s.A,null,a.createElement(R.sA,{id:"DEVICE_PROPERTIES_VALUES_POWER_SOURCE_POE_INJECTOR"})))))):null,oe?a.createElement(C.A,{justifyContent:"space-between",alignItems:"flex-start"},a.createElement(C.A,{alignItems:"center"},a.createElement(s.A,{size:"body"},a.createElement(Y,null,a.createElement(R.sA,{id:"COMMON_OUTDOOR_MODE"}))),a.createElement(i.A,{width:200,description:a.createElement(R.sA,{id:"DEVICE_PROPERTIES_LABEL_OUTDOOR_MODE_DESCRIPTION"})},a.createElement(_.A,{isActive:!0,size:"original"}))),a.createElement(g.A,{type:"checkbox",name:"outdoor_mode_override",value:t.outdoor_mode_override===x.Gi.ON,afterChange:e=>{_e&&e?J((0,P.E)({title:"DEVICE_PROPERTIES_LABEL_OUTDOOR_MODE_CONFIRM_TITLE",message:"DEVICE_PROPERTIES_LABEL_OUTDOOR_MODE_CONFIRM_MESSAGE",onConfirm:()=>{J((0,h.AS)()),p("outdoor_mode_override",x.Gi.ON)}})):p("outdoor_mode_override",e?x.Gi.ON:x.Gi.OFF)}})):null,ce?a.createElement(C.A,{justifyContent:"space-between",alignItems:"flex-start"},a.createElement(C.A,{alignItems:"center"},a.createElement(s.A,{size:"body"},a.createElement(Y,null,a.createElement(R.sA,{id:"COMMON_LOW_PERFORMANCE_MODE"}))),a.createElement(i.A,{width:200,description:a.createElement(R.sA,{id:de,values:{name:(0,E.Q)(e)}})},a.createElement(_.A,{isActive:!0,size:"original"}))),a.createElement(g.A,{type:"checkbox",name:"lowpfmode_override"})):null)})},132650:(e,t,l)=>{var n;l.d(t,{A:()=>o}),function(e){e.AUTO="auto",e.POE="8023af",e.POE_PLUS="8023at",e.POE_PLUS_PLUS="poe-injector",e.ADAPTER="adapter"}(n||(n={}));const o=n},263262:(e,t,l)=>{l.d(t,{A:()=>h,g:()=>C});var n=l(868238),o=l(469733),a=l(296540),r=l(951272),i=l(927099),s=l(870443),c=l(566723),d=l(855019),_=l(62227),m=l(143811),E=l(294303),A=l(845030),p=l(699784),u=l(302167),b=l(366188),O=l(780811),f=l(239417),v=l(785146),w=l(31208),g=l(726317);const C="network",I=(0,r.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({activeItem:{config_network:e,model:t,ip:l,switch_vlan_enabled:n,lte_limit_enabled:o,lte_limit:a,mgmt_network_id:r,connection_network_id:i},nativeNetworks:s})=>{const c=(0,O.U$e)(s,i);return{config_network:{type:e?.type||d.NL.DHCP,ip:e?.ip||l||"",netmask:e?.netmask||c?.netmask||"",gateway:e?.gateway||c?.ip||"",dns1:e?.dns1||c?.dns1||"",dns2:e?.dns2||c?.dns2||"",dnssuffix:e?.dnssuffix||"",bonding_enabled:e?.bonding_enabled||!1},mgmt_network_id:(0,O.ewD)(s,r),switch_vlan_enabled:n||!1,...((0,O.C6C)({model:t}),{})}},handleSubmit:(e,{resetForm:t})=>{t({values:e})},validationSchema:({honeypotNetworksIps:e,clients:t})=>s.A.object().shape({config_network:(0,_.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")})})}),h=(0,n.Zz)((0,o.connect)(e=>({nativeNetworks:(0,b.Tn)(e),honeypotNetworksIps:(0,u.Yk)(e),clients:(0,f.A8)(e)})),I)(({setFormDirty:e,setFormInvalid:t,dirty:l,values:n,resetForm:r,isValid:s,initialValues:_,activeItem:u,nativeNetworks:b,hideNetworkOverride:f,formName:I=C})=>{const h=(0,o.useDispatch)(),P=(0,O.iQS)(u.model),R=(0,O.C6C)(u);(0,a.useEffect)(()=>{e(C,l),t(C,!s)},[e,t,l,s]);const S=(0,O.moU)(u);(0,a.useEffect)(()=>(h((0,A.uo)({[I]:()=>{const e={config_network:n.config_network?.type===d.NL.STATIC?n.config_network:{type:d.NL.DHCP,bonding_enabled:n.config_network?.bonding_enabled},mgmt_network_id:n.mgmt_network_id};return P&&(e.switch_vlan_enabled=n.switch_vlan_enabled,_.switch_vlan_enabled&&!n.switch_vlan_enabled&&u.port_overrides?.length&&(e.port_overrides=(u.port_overrides||[]).map(({portconf_id:e,...t})=>t))),e}})),h((0,A.Oo)({[I]:()=>r({values:n})})),h((0,A.rW)({[I]:r})),()=>{h((0,A.uo)({[I]:null})),h((0,A.Oo)({[I]:null})),h((0,A.rW)({[I]:null}))}),[h,r,n,I,u.port_overrides,_.switch_vlan_enabled,P,R]);const T=!f&&!S&&b.length>1&&!(0,O.q82)({model:u.model})&&!(0,O.xQi)({model:u.model});return a.createElement(E.A,{flexDirection:"column",gap:c.S2},T?a.createElement(v.A,{nativeNetworks:b,activeItemMac:u.mac}):null,a.createElement(g.A,null),n.config_network?.type===d.NL.STATIC?a.createElement(w.A,null):null,(0,O.xyH)(u)||(0,O.Eyk)(u)||(0,O._iI)(u)||(0,O.W46)(u)?a.createElement(E.A,null,a.createElement(m.A,{name:"config_network.bonding_enabled",type:"realCheckbox"},a.createElement(p.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_AGGREGATION"}))):null,P?a.createElement(E.A,{flexDirection:"column",gap:c.kc},a.createElement(i.A,{weight:"bold",size:"body"},a.createElement(p.sA,{id:"COMMON_VLAN"})),a.createElement(E.A,{justifyContent:"space-between"},a.createElement(i.A,{size:"body"},a.createElement(p.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_PORT_VLAN"})),a.createElement(m.A,{type:"checkbox",name:"switch_vlan_enabled"}))):null,null)})},485897:(e,t,l)=>{l.d(t,{A:()=>o,v:()=>n});const n="32768",o=["0","4096","8192","12288","16384","20480","24576","28672","32768","36864","40960","45056","49152","53248","57344","61440"]},543791:(e,t,l)=>{l.d(t,{A:()=>r});var n=l(296540),o=l(271856),a=l(699784);const r=({show:e,children:t,position:l})=>n.createElement(o.A,{position:l||"topStart",description:e?n.createElement(a.sA,{id:"DEVICE_DISABLE_GLOBAL_SWITCH_SETTINGS"}):void 0},n.createElement("span",null,t))},726317:(e,t,l)=>{l.d(t,{A:()=>_});var n=l(296540),o=l(927099),a=l(454195),r=l(566723),i=l(855019),s=l(143811),c=l(294303),d=l(699784);const _=(0,n.memo)(()=>n.createElement(c.A,{flexDirection:"column"},n.createElement(o.A,{color:"tertiary",size:"caption"},n.createElement(d.sA,{id:"COMMON_IP_CONFIGURATION"})),n.createElement(c.A,{height:a.b,alignItems:"center",gap:r.Ln},n.createElement(s.A,{name:"config_network.type",type:"radio",value:i.NL.DHCP},n.createElement(d.sA,{id:"COMMON_DHCP"})),n.createElement(s.A,{name:"config_network.type",type:"radio",value:i.NL.STATIC},n.createElement(d.sA,{id:"COMMON_STATIC"})))))},790543:(e,t,l)=>{l.d(t,{A:()=>o});var n=l(296540);const o=(e,t=()=>null,l=null,o=!1)=>a=>class extends n.Component{constructor(){super(...arguments),this.isCanceled=!1,this.state={loaded:!1}}UNSAFE_componentWillMount(){l&&performance.mark(`ufsdn.${l}:start`)}componentDidMount(){Promise.resolve(e(this.props)).then(()=>{this.isCanceled||(this.setState({loaded:!0}),l&&performance.measure(`ufsdn.${l}-rendered`,`ufsdn.${l}:start`))})}componentWillUnmount(){this.isCanceled=!0}render(){return o?n.createElement(a,{...this.props,isLoaded:this.state.loaded}):this.state.loaded?n.createElement(a,{...this.props}):n.createElement(t,null)}}},854246:(e,t,l)=>{l.d(t,{A:()=>s});var n=l(296540),o=l(71479),a=l(132196),r=l(699784);const i=(0,o.A)("div",{shouldForwardProp:e=>"align"!==e})`
  ${({align:e})=>e&&`text-align: ${e}`};
  color: ${({theme:{motifPalette:{red06:e}}})=>e};
  font-size: ${({theme:{fontSizes:e}})=>e[0]}px;
  line-height: 20px;
`,s=({align:e="left",children:t=null,className:l=null,translation:o=null,visible:s=!1})=>s?n.createElement(i,{align:e,className:(0,a.cx)(l)},o&&n.createElement(r.sA,{id:o}),t):null}}]);