"use strict";(self.webpackChunkunifiNetworkUi=self.webpackChunkunifiNetworkUi||[]).push([[65601],{815879(e,t,n){n.d(t,{A:()=>o});var i=n(602086),s=n(141992);const o=(0,n(272338).w)(e=>(0,i.createElement)("svg",(0,s.d)({viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},e),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4Zm8 8a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-4Z",fill:"currentColor",className:e.twotonedclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 4h4v4H4V4ZM3 4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4Zm9 8h4v4h-4v-4Zm-1 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-4Zm1.854-4.854L11.707 6H16v3.5a.5.5 0 0 0 1 0v-4a.5.5 0 0 0-.5-.5h-4.793l1.147-1.146a.5.5 0 0 0-.708-.708l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708ZM8.293 15H3.5a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0V14h4.293l-1.147-1.146a.5.5 0 0 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L8.293 15Z",fill:"currentColor",className:e.baseclassname}),(0,i.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4 3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4Zm7 9a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-4Zm1.854-4.854L11.707 6H16v3.5a.5.5 0 0 0 1 0v-4a.5.5 0 0 0-.5-.5h-4.793l1.147-1.146a.5.5 0 0 0-.708-.708l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708ZM8.293 15H3.5a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 1 0V14h4.293l-1.147-1.146a.5.5 0 0 1 .708-.708l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L8.293 15Z",fill:"currentColor",className:e.fillclassname})))},595778(e,t,n){n.d(t,{I:()=>s,U:()=>o});var i=n(241365);const s=(0,n(419284).Wj)(i.Ay["blue-0"]),o=100},446863(e,t,n){n.d(t,{H5:()=>r,Lq:()=>a,n0:()=>l});var i=n(909924),s=n(573534),o=n(172205);const l=e=>e[o.U.SHARED][s.N.PROPERTY_PANEL]?.[i.Io.TAB_GET_DATA_FUNCTION]||{},a=e=>e[o.U.SHARED][s.N.PROPERTY_PANEL]?.[i.Io.TAB_SUBMIT_FUNCTION]||{},r=e=>e[o.U.SHARED][s.N.PROPERTY_PANEL]?.[i.Io.TAB_RESET_FUNCTION]||{}},144312(e,t,n){n.d(t,{A:()=>l});var i=n(274934),s=n(125799),o=n(470070);const l=({show:e,children:t,position:n})=>(0,i.jsx)(s.A,{position:n||"topStart",description:e?(0,i.jsx)(o.sA,{id:"DEVICE_DISABLE_GLOBAL_SWITCH_SETTINGS"}):void 0,children:(0,i.jsx)("span",{children:t})})},535322(e,t,n){n.d(t,{A:()=>_,I:()=>i});var i,s=n(274934),o=n(814557),l=n(158885),a=n(247816),r=n(565527),d=n(309130),c=n(100978),m=n(291508);!function(e){e.ACCORDION="accordion",e.BUTTON_LIST="buttonList"}(i||(i={}));const u=(0,a.A)(c.A,(0,m.A)("marginBottom","isButtonList","margin","flex","width","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||o.Ay[n===r.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${r.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${r.S.LIGHT}`]};
  padding: ${({isButtonList:e,padding:t})=>t||(e?`0 ${d.Ln}`:d.Ln)};
  margin-bottom: ${({marginBottom:e})=>e||d.Ln};
  ${({margin:e})=>e?`margin: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  width: ${({width:e="100%"})=>e};
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  ${({isButtonList:e})=>e?`\n    > div {\n      display: flex;\n      height: 48px;\n      border-bottom: ${({theme:{themeName:e}})=>o.Ay[`desktop-border-divider-${e}`]};\n      &:last-child {\n        border-bottom: none;\n      }\n    }\n  `:""}
`,h=(0,a.A)(l.A,(0,m.A)("marginBottom","margin","flex","padding","nested","background"))`
  background-color: ${({background:e,nested:t,theme:{themeName:n}})=>e||o.Ay[n===r.S.DARK?`desktop-color-neutral-${t?"00":"01"}-${r.S.DARK}`:`desktop-color-neutral-${t?"01":"00"}-${r.S.LIGHT}`]};
  margin-bottom: ${({theme:e,marginBottom:t})=>t||e.spacing["spacing-l"]};
  ${({margin:e})=>e?`margin: ${e};`:""}
  ${({padding:e})=>e?`padding: ${e};`:""}
  border-radius: 8px;
  flex-direction: column;
  flex: ${({flex:e=0})=>e};
  > :last-child {
    margin-bottom: 0;
  }
  thead {
    tr {
      height: 32px !important;
    }
    th {
      text-transform: none;
    }
  }
  > li {
    > div:first-child {
      background: ${({background:e,theme:{themeName:t}})=>e||o.Ay[t===r.S.DARK?`desktop-color-neutral-01-${r.S.DARK}`:`desktop-color-neutral-00-${r.S.LIGHT}`]};
      height: 48px;
      padding: 0 ${d.Ln};
    }
    > div:nth-child(2) {
      margin-bottom: 0;
      padding: 0;
      > div {
        padding: 0 ${d.Ln} ${d.Ln};
      }
    }
  }
`,_=({type:e,marginBottom:t,margin:n,padding:o,flex:l,width:a,nested:r,...d})=>"items"in d?(0,s.jsx)(h,{marginBottom:t,margin:n,padding:o,flex:l,nested:r,...d}):(0,s.jsx)(u,{nested:r,width:a,marginBottom:t,margin:n,padding:o,flex:l,isButtonList:e===i.BUTTON_LIST,...d,children:d.children})},250266(e,t,n){n.d(t,{A:()=>c});var i=n(274934),s=n(602086),o=n(696264),l=n(409844),a=n(521376),r=n(309130),d=n(470070);const c=({children:e=null,title:t,titleValues:n,message:c,messageValues:m,handleConfirm:u=()=>null,handleClose:h=()=>null,handleCancel:_,isOpen:A,buttonVariant:g="primary",cancelButtonVariant:b="tertiary",cancelButtonMessage:p="COMMON_ACTION_CANCEL",buttonMessage:v="COMMON_ACTION_CONFIRM",buttonDisabled:x=!1,position:O="top",offset:w,showHeaderClose:f=!1,contentClassName:C="",body:E,titleBody:S,className:I,rootClose:N=!1,footerActions:j})=>{const k=(0,s.useCallback)(e=>{A&&(e.stopPropagation(),e.key===a.U.ENTER?u():e.key===a.U.ESCAPE&&h(!1))},[A,u,h]);(0,s.useEffect)(()=>(window.addEventListener("keydown",k,!0),()=>{window.removeEventListener("keydown",k,!0)}),[k]);const T=(0,s.useCallback)(()=>{h(!1),_?.()},[h,_]),y=(0,s.useCallback)(()=>{h(!1),u()},[h,u]),R=(0,s.useMemo)(()=>[{text:(0,i.jsx)(d.sA,{id:p}),variant:b,onClick:T},{text:(0,i.jsx)(d.sA,{id:v}),disabled:x,variant:g,onClick:y}],[v,g,p,b,T,y,x]),M=(0,s.useCallback)(()=>{h(!1)},[h]),L=l.AH`
    ${t?"":`margin-top: ${r.xO}`}
  `;return(0,i.jsx)(o.A,{title:t?(0,i.jsx)(d.sA,{id:t,values:n}):S||null,...c?{body:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.sA,{id:c,values:m}),E]})}:{body:E},position:O,portal:!0,offset:w,actions:j||R,showHeaderClose:f,contentClassName:l.AH`
        ${L}
        ${C}
      `,onRequestClose:M,isOpen:A,allowOverflow:!0,rootClose:N,className:I,children:e})}},341699(e,t,n){n.d(t,{HV:()=>o,pm:()=>l,vF:()=>s});var i=n(726831);const s=e=>`${i.A.fabricsOrchestration}?orchestrationId=${e?.template_id||""}&orgId=${e?.organization_id||""}`,o=e=>`${i.A.fabricsDeviceTemplates}/${e?.template_id||""}?orgId=${e?.organization_id||""}`,l=()=>`${i.A.fabricsOrchestration}`},637084(e,t,n){n.d(t,{A:()=>b});var i=n(274934),s=n(602086),o=n(843871),l=n(977872),a=n(418398),r=n(205521),d=n(232410),c=n(1469),m=n(260288),u=n(619619),h=n(876809),_=n(113454),A=n(621309);const g=(0,o.bk)({enableReinitialize:!0,mapPropsToValues:({powerSupervisor:e,device:t})=>({powerSupervisor:(0,u.f)(e,(0,_.lD)(t,e))}),handleSubmit:(e,{resetForm:t})=>t({values:e}),validationSchema:h.A}),b=(0,a.Zz)((0,l.Ng)((e,{device:{mac:t}})=>({powerSupervisor:(0,d.x0)(t)(e)})))(g(({powerSupervisor:e,device:t,setFormDirty:n,setFormInvalid:o,validateForm:a,values:d,resetForm:u,dirty:h,isValid:_,formName:g=m.r8})=>{const b=(0,l.wA)();return(0,s.useEffect)(()=>(b((0,r.uo)({[g]:()=>({})})),b((0,r.Oo)({[g]:()=>{a().then(t=>{Object.keys(t).length||b((0,A.A)(e?.id,d.powerSupervisor))})}})),b((0,r.rW)({[g]:u})),()=>{b((0,r.uo)({[g]:null})),b((0,r.Oo)({[g]:null})),b((0,r.rW)({[g]:null}))}),[b,u,d.powerSupervisor,g,a,e?.id]),(0,s.useEffect)(()=>{n?.(g,h),o?.(g,!_)},[n,h,o,_,g]),(0,i.jsx)(c.A,{device:t})}))},876809(e,t,n){n.d(t,{A:()=>o,q:()=>s});var i=n(950804);const s=i.A.object().shape({power_sources:i.A.array().transform(e=>e.filter(e=>e.power_source_mac)).of(i.A.object().shape({client_psu_index:i.A.number().required(),power_source_mac:i.A.string().label("COMMON_POWER_SOURCE").required(),power_source_index:i.A.string().label("COMMON_OUTLET").required()})).label("COMMON_POWER_SOURCE").min(1)}).optional(),o=i.A.object().shape({powerSupervisor:s})},377764(e,t,n){n.d(t,{A:()=>C,R:()=>O});var i=n(274934),s=n(418398),o=n(977872),l=n(602086),a=n(843871),r=n(938984),d=n(925845),c=n(762705),m=n(60927),u=n(419284),h=n(586566),_=n(309130),A=n(100978),g=n(205521),b=n(470070),p=n(291935),v=n(857780),x=n(595778);const O="led",w=(0,a.bk)({enableReinitialize:!0,mapPropsToValues:({activeItem:{led_override:e,led_override_color:t=x.I,led_override_color_brightness:n=x.U}={},mgmtSettings:i})=>({led_override:e||(!1===i.led_enabled?v.c_.OFF:v.c_.ON),led_override_color:t,led_override_color_brightness:n}),handleSubmit:(e,{resetForm:t})=>{t({values:e})}}),f=e=>(0,i.jsxs)("span",{children:[e,"%"]}),C=(0,s.Zz)((0,o.Ng)(e=>({mgmtSettings:(0,p.$5)(e)})))(w(({activeItem:e,setFormDirty:t,setFormInvalid:n,dirty:s,isValid:a,values:p,resetForm:w,setFieldValue:C,formName:E=O,mgmtSettings:{led_enabled:S}})=>{const I=(0,o.wA)(),N=(0,h.lp)(e),j=(S&&e.led_override!==v.c_.OFF||e.led_override===v.c_.ON)&&N;(0,l.useEffect)(()=>(I((0,g.uo)({[E]:()=>p})),I((0,g.Oo)({[E]:()=>w({values:p})})),I((0,g.rW)({[E]:w})),()=>{I((0,g.uo)({[E]:null})),I((0,g.Oo)({[E]:null})),I((0,g.rW)({[E]:null}))}),[I,w,p,E]),(0,l.useEffect)(()=>{t(E,s),n(E,!a)},[t,n,s,a,E]);const k=(0,l.useCallback)(e=>{C("led_override_color",(0,u.E6)(e.toString())||x.I)},[C]);return(0,i.jsxs)(A.A,{gap:_.Ln,flexDirection:"column",children:[(0,i.jsx)(A.A,{width:"100%",justifyContent:"space-between",children:(0,i.jsx)(c.A,{id:"led_override",checked:v.c_.ON===p.led_override,onChange:()=>{C("led_override",p.led_override===v.c_.ON?v.c_.OFF:v.c_.ON)},children:(0,i.jsx)(r.A,{size:"medium",color:"text-2",children:(0,i.jsx)(b.sA,{id:"COMMON_LED"})})})}),j?(0,i.jsxs)(A.A,{flexDirection:"column",gap:12,children:[(0,i.jsx)(r.A,{size:"medium",children:(0,i.jsx)(b.sA,{id:"COMMON_BRIGHTNESS"})}),(0,i.jsx)(d.A,{size:"large",value:+p.led_override_color_brightness||100,withValueIndicator:!0,valueIndicatorPosition:"right",formatValueIndicatorContent:f,onChange:({target:{value:e}})=>{C("led_override_color_brightness",e)}}),(0,i.jsx)(r.A,{size:"medium",color:"text-1",weight:"bold",children:(0,i.jsx)(b.sA,{id:"COMMON_COLOR"})}),(0,i.jsx)(m.A,{value:p?.led_override_color||x.I,onChange:k,sliders:[{id:"hue",channel:"hue"}],colorSpace:"hex",children:(0,i.jsx)("span",{children:(0,i.jsx)(b.sA,{id:"DEVICE_PROPERTIES_LABEL_HEX"})})})]}):null]})}))},419685(e,t,n){n.d(t,{A:()=>f});var i=n(274934),s=n(602086),o=n(770698),l=n(938984),a=n(762705),r=n(954702),d=n(247816),c=n(977872),m=n(669439),u=n(309130),h=n(793442),_=n(100978),A=n(470070),g=n(291935),b=n(598990),p=n(6276),v=n(341699);const x=(0,d.A)("div")`
  width: 100%;
  margin-bottom: ${u.Ln};
`,O=()=>{const e=(0,c.d4)(g.zu);return{isOrchestrated:(0,s.useMemo)(()=>(0,p.A)(e),[e]),globalSwitchSettings:e}},w=({globalSwitchSettings:e,children:t})=>{const n=(0,c.wA)(),o=(0,s.useCallback)(()=>{n((0,b.Np)("global_network")).then(e=>{(e?.data?.setting_keys||[]).length>0&&n((0,b.Uc)(void 0,{resolveWithExisting:!1}))})},[n]);return(0,i.jsx)(m.A,{placement:"top start",description:(0,i.jsxs)(_.A,{flexDirection:"column",width:"100%",children:[(0,i.jsx)(A.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS_MANAGED_BY_FABRIC"}),(0,i.jsxs)(_.A,{gap:u.YC,alignItems:"baseline",children:[(0,i.jsx)(h.A,{id:"COMMON_VIEW_IN_SITE_MANAGER",href:(0,v.vF)(e.cloud_template)}),(0,i.jsx)(l.A,{style:{textTransform:"lowercase"},size:"small",children:(0,i.jsx)(A.sA,{id:"COMMON_OR"})}),(0,i.jsx)(r.A,{variant:"destructive",fontSize:"inherit",onClick:o,children:(0,i.jsx)(A.sA,{id:"COMMON_DETACH"})})]})]}),children:(0,i.jsx)("div",{children:t})})},f={Toggle:({isGlobalSwitchSettingsEnabled:e,setGlobalSwitchSettingsEnabled:t,noStyledRow:n})=>{const{isOrchestrated:a,globalSwitchSettings:r}=O(),d=(0,s.useCallback)(({target:{checked:e}})=>{t(e)},[t]),c=(0,i.jsx)(o.A,{full:!0,checked:e,onChange:d,disabled:a,children:(0,i.jsx)(_.A,{width:"100%",alignItems:"center",children:(0,i.jsx)(l.A,{size:"medium",color:a?"disabled":void 0,children:(0,i.jsx)(A.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS"})})})}),m=n?c:(0,i.jsx)(x,{children:c});return a?(0,i.jsx)(w,{globalSwitchSettings:r,children:m}):m},Checkbox:({isGlobalSwitchSettingsEnabled:e,setGlobalSwitchSettingsEnabled:t,onChange:n,noStyledRow:o})=>{const{isOrchestrated:r,globalSwitchSettings:d}=O(),c=(0,s.useCallback)(({target:{checked:e}})=>{t(e),n?.(e)},[n,t]),m=(0,i.jsx)(a.A,{id:"global-switch-settings-checkbox",checked:e,onChange:c,disabled:r,children:(0,i.jsx)(l.A,{size:"medium",color:r?"disabled":void 0,children:(0,i.jsx)(A.sA,{id:"COMMON_GLOBAL_SWITCH_SETTINGS"})})}),u=o?m:(0,i.jsx)(x,{children:m});return r?(0,i.jsx)(w,{globalSwitchSettings:d,children:u}):u}}},336128(e,t,n){n.d(t,{A:()=>u});var i=n(274934),s=n(602086),o=n(938984),l=n(833466),a=n(309130),r=n(589650),d=n(120197),c=n(100978),m=n(470070);const u=(0,s.memo)(()=>(0,i.jsxs)(c.A,{flexDirection:"column",children:[(0,i.jsx)(o.A,{color:"text-3",size:"small",children:(0,i.jsx)(m.sA,{id:"COMMON_IP_CONFIGURATION"})}),(0,i.jsxs)(c.A,{height:l.b,alignItems:"center",gap:a.Ln,children:[(0,i.jsx)(d.A,{name:"config_network.type",type:"radio",value:r.NL.DHCP,children:(0,i.jsx)(m.sA,{id:"COMMON_DHCP"})}),(0,i.jsx)(d.A,{name:"config_network.type",type:"radio",value:r.NL.STATIC,children:(0,i.jsx)(m.sA,{id:"COMMON_STATIC"})})]})]}))},548403(e,t,n){n.d(t,{A:()=>f,H:()=>O});var i=n(274934),s=n(418398),o=n(977872),l=n(602086),a=n(843871),r=n(950804),d=n(309130),c=n(589650),m=n(977663),u=n(100978),h=n(205521),_=n(291935),A=n(197571),g=n(956978),b=n(34118),p=n(550521),v=n(21265),x=n(336128);const O="network",w=(0,a.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({activeItem:{config_network:e,ip:t,switch_vlan_enabled:n,mgmt_network_id:i,connection_network_id:s},nativeNetworks:o})=>{const l=(0,g.U$e)(o,s);return{config_network:{type:e?.type||c.NL.DHCP,ip:e?.ip||t||"",netmask:e?.netmask||l?.netmask||"",gateway:e?.gateway||l?.ip||"",dns1:e?.dns1||l?.dns1||"",dns2:e?.dns2||l?.dns2||"",dnssuffix:e?.dnssuffix||"",bonding_enabled:e?.bonding_enabled||!1},mgmt_network_id:(0,g.ewD)(o,i),switch_vlan_enabled:n||!1}},handleSubmit:(e,{resetForm:t})=>{t({values:e})},validationSchema:({honeypotNetworksIps:e,combinedClients:t})=>r.A.object().shape({config_network:(0,m.d)(e,t),mgmt_network_id:r.A.string(),lte_limit_enabled:r.A.boolean().label("COMMON_LTE_DATA_LIMIT"),lte_limit:r.A.number().integer().label("COMMON_DATA_LIMIT").when("lte_limit_enabled",{is:!0,then:r.A.number().min(1).required().label("COMMON_DATA_LIMIT")})})}),f=(0,s.Zz)((0,o.Ng)(e=>({nativeNetworks:(0,A.Tn)(e),honeypotNetworksIps:(0,_.Yk)(e),combinedClients:(0,b.GB)(e)})),w)(({setFormDirty:e,setFormInvalid:t,dirty:n,values:s,resetForm:a,isValid:r,initialValues:m,nativeNetworks:_=[],activeItem:A})=>{const g=(0,o.wA)();return(0,l.useEffect)(()=>{e(O,n),t(O,!r)},[e,t,n,r]),(0,l.useEffect)(()=>(g((0,h.uo)({[O]:()=>({config_network:s.config_network.type===c.NL.STATIC?s.config_network:{type:c.NL.DHCP,bonding_enabled:s.config_network.bonding_enabled},mgmt_network_id:s.mgmt_network_id})})),g((0,h.Oo)({[O]:()=>a({values:s})})),g((0,h.rW)({[O]:a})),()=>{g((0,h.uo)({[O]:null})),g((0,h.Oo)({[O]:null})),g((0,h.rW)({[O]:null}))}),[g,a,s,A.port_overrides,m.switch_vlan_enabled]),(0,i.jsxs)(u.A,{gap:d.S2,flexDirection:"column",children:[_.length>1?(0,i.jsx)(p.A,{nativeNetworks:_,activeItemMac:A.mac}):null,(0,i.jsx)(x.A,{}),s.config_network.type===c.NL.STATIC?(0,i.jsx)(v.A,{}):null]})})},476072(e,t,n){n.r(t),n.d(t,{default:()=>F});var i=n(274934),s=n(418398),o=n(977872),l=n(602086),a=n(159469),r=n(478961),d=n(309130),c=n(843871),m=n(318087),u=n(586566),h=n(183743),_=n(419685),A=n(144312),g=n(89469),b=n(120197),p=n(796091),v=n(205521),x=n(470070),O=n(291935);const w="advanced",f=(0,c.bk)({enableReinitialize:!0,isInitialValid:!0,mapPropsToValues:({activeItem:{snmp_contact:e,snmp_location:t,flowctrl_enabled:n}})=>({snmpEnabled:Boolean(e||t),snmp_contact:e,snmp_location:t,flowctrl_enabled:n}),handleSubmit:(e,{resetForm:t})=>{t({values:e})}})(({setFormDirty:e,setFormInvalid:t,dirty:n,setValues:s,values:a,resetForm:r,isValid:d,initialValues:c,activeItem:f,isGlobalSwitchSettingsEnabled:C,setGlobalSwitchSettingsEnabled:E})=>{const S=(0,o.wA)(),I=(0,o.d4)(O.zu),[N,j]=(0,l.useState)(null),k=(0,u.Tn)(f);return(0,l.useEffect)(()=>{e(w,n||C!==!I.switch_exclusions?.includes(f.mac)),t(w,!d)},[e,t,n,d,C,I.switch_exclusions,f.mac]),(0,l.useEffect)(()=>{const{snmpEnabled:e,snmp_location:t,snmp_contact:n}=a;return S((0,v.uo)({[w]:()=>({snmpEnabled:e,snmp_contact:e?n:"",snmp_location:e?t:"",flowctrl_enabled:a.flowctrl_enabled})})),S((0,v.Oo)({[w]:()=>r({values:a})})),S((0,v.rW)({[w]:r})),()=>{S((0,v.uo)({[w]:null})),S((0,v.Oo)({[w]:null})),S((0,v.rW)({[w]:null}))}},[S,r,a,f.port_overrides,c.switch_vlan_enabled,f.snmp_contact,f.snmp_location]),(0,i.jsxs)(g.A,{children:[(0,i.jsx)(_.A.Checkbox,{isGlobalSwitchSettingsEnabled:C,setGlobalSwitchSettingsEnabled:E,onChange:e=>{if(e){const e=(0,m.LE)(c,a),t=(0,m.LE)(a,c),n=Object.keys(t).reduce((e,t)=>(I[t]&&(e[t]=I[t]),e),{});s({...a,...n}),j(e)}else s({...a,...N}),j(null)},noStyledRow:!0}),(0,i.jsx)(p.A,{children:(0,i.jsx)(A.A,{show:C,children:(0,i.jsx)(b.A,{name:"flowctrl_enabled",type:"realCheckbox",checked:!k&&(C?I.flowctrl_enabled:a.flowctrl_enabled),disabled:C||k,tooltipMessage:(0,i.jsx)(x.sA,{id:"DEVICE_PROPERTIES_VALUES_ENABLE_FLOW_CONTROL_D"}),tooltipProps:{portal:!0},children:(0,i.jsx)(x.sA,{id:"COMMON_FLOW_CONTROL"})})})}),(0,u.A6)(f)?(0,i.jsx)(h.A,{}):null]})});var C=n(548403),E=n(377764),S=n(376892),I=n(100978),N=n(535322),j=n(700444),k=n(598990),T=n(446863),y=n(795206),R=n(637084),M=n(115114),L=n(532635),D=n(795928);const F=(0,s.Zz)((0,r.A)([D.UH,C.H,w])(({activeItem:e,setFormDirty:t,setFormInvalid:n,isDirty:s,isInvalid:r})=>{const c=(0,o.d4)(T.n0),m=(0,o.d4)(T.Lq),u=(0,o.d4)(T.H5),{_id:h,mac:_}=e,A=(0,o.wA)(),g=(0,o.d4)(O.zu),[b,p]=(0,l.useState)(!g.switch_exclusions?.includes(e.mac));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.Ay,{activeItem:e,setFormDirty:t,setFormInvalid:n}),(0,i.jsx)(N.A,{type:N.I.ACCORDION,items:[{id:C.H,openByDefault:!0,label:(0,i.jsx)(S.A,{id:"COMMON_IP_SETTINGS"}),renderContent:()=>(0,i.jsx)(C.A,{activeItem:e,setFormDirty:t,setFormInvalid:n})}]}),(0,i.jsx)(N.A,{type:N.I.ACCORDION,items:[{id:w,openByDefault:!0,label:(0,i.jsx)(S.A,{id:"COMMON_ADVANCED"}),renderContent:()=>(0,i.jsx)(f,{activeItem:e,setFormDirty:t,setFormInvalid:n,isGlobalSwitchSettingsEnabled:b,setGlobalSwitchSettingsEnabled:p})}]}),(0,i.jsx)(R.A,{device:e,setFormDirty:t,setFormInvalid:n}),(0,i.jsx)(N.A,{type:N.I.ACCORDION,items:[{id:L.f,openByDefault:!0,label:(0,i.jsx)(S.A,{id:"COMMON_ACTION_MANAGE"}),renderContent:()=>(0,i.jsxs)(I.A,{flexDirection:"column",gap:d.Ln,children:[(0,i.jsx)(E.A,{activeItem:e,setFormDirty:t,setFormInvalid:n}),(0,i.jsx)(L.A,{activeItem:e})]})}]}),(0,i.jsx)(M.A,{isDirty:s,isInvalid:r,onFormSubmit:async()=>{if(b!==!g.switch_exclusions?.includes(e.mac)){const t=g.switch_exclusions.filter(t=>t!==e.mac);b||t.push(e.mac);try{await A((0,k.OD)({...g,switch_exclusions:t}))}catch{A((0,j.ox)({icon:a.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"}))}}const t=Object.entries(c).reduce((e,[t,n])=>{if("function"==typeof n){const t=n();if("object"==typeof t&&t&&Object.keys(t).length)return{...e,...t}}return e},{});A((0,y.ex)(t,h,_,{failureToast:{icon:a.C.danger,message:"DEVICE_NOTICE_SAVE_ERROR"},extend:!0})).then(()=>{Object.values(m).forEach(e=>{"function"==typeof e&&e()})})},onFormCancel:()=>{p(!g.switch_exclusions?.includes(e.mac)),Object.values(u).forEach(e=>{"function"==typeof e&&e()})}})]})}))},521376(e,t,n){var i;n.d(t,{U:()=>i}),function(e){e.ARROW_LEFT="ArrowLeft",e.ARROW_RIGHT="ArrowRight",e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.ESCAPE="Escape",e.BACKSPACE="Backspace",e.DELETE="Delete",e.TAB="Tab"}(i||(i={}))},478961(e,t,n){n.d(t,{A:()=>o});var i=n(274934),s=n(602086);const o=function(e){return t=>n=>{const[o,l]=(0,s.useState)(Object.fromEntries(e.map(e=>[e,!1]))),[a,r]=(0,s.useState)(Object.fromEntries(e.map(e=>[e,!1]))),d=(0,s.useCallback)((e,t)=>{l(n=>({...n,[e]:t}))},[]),c=(0,s.useCallback)((e,t)=>{r(n=>({...n,[e]:t}))},[]),m=!!Object.values(o).find(e=>e),u=!!Object.values(a).find(e=>e);return(0,i.jsx)(t,{isDirty:m,isInvalid:u,formStates:o,setFormDirty:d,setFormInvalid:c,...n})}}}}]);